@opra/common 0.22.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +957 -1566
- package/cjs/document/api-document.js +7 -3
- package/cjs/document/data-type/api-field.js +2 -2
- package/cjs/document/data-type/complex-type.js +17 -63
- package/cjs/document/data-type/data-type.js +0 -9
- package/cjs/document/data-type/enum-type.js +2 -8
- package/cjs/document/data-type/mapped-type.js +0 -36
- package/cjs/document/data-type/simple-type.js +2 -8
- package/cjs/document/data-type/union-type.js +1 -37
- package/cjs/document/index.js +2 -0
- package/cjs/document/resource/collection.js +75 -32
- package/cjs/document/resource/singleton.js +31 -20
- package/cjs/document/resource/storage.js +6 -20
- package/cjs/document/utils/generate-codec.js +39 -0
- package/cjs/exception/http-errors/bad-request.error.js +2 -3
- package/cjs/exception/http-errors/failed-dependency.error.js +2 -3
- package/cjs/exception/http-errors/forbidden.error.js +2 -3
- package/cjs/exception/http-errors/internal-server.error.js +2 -3
- package/cjs/exception/http-errors/method-not-allowed.error.js +2 -3
- package/cjs/exception/http-errors/not-acceptable.error.js +2 -3
- package/cjs/exception/http-errors/not-found.error.js +2 -3
- package/cjs/exception/http-errors/unauthorized.error.js +2 -3
- package/cjs/exception/http-errors/unprocessable-entity.error.js +2 -2
- package/cjs/exception/opra-exception.js +48 -33
- package/cjs/exception/resource-errors/resource-not-found.error.js +2 -3
- package/cjs/exception/wrap-exception.js +16 -16
- package/cjs/helpers/index.js +1 -1
- package/cjs/helpers/is-url-string.js +14 -0
- package/cjs/helpers/object-utils.js +2 -2
- package/cjs/helpers/responsive-map.js +4 -4
- package/cjs/helpers/type-guards.js +15 -3
- package/cjs/http/index.js +2 -9
- package/cjs/http/opra-url-path.js +251 -0
- package/cjs/{url → http}/opra-url.js +53 -109
- package/cjs/i18n/i18n.js +1 -1
- package/cjs/index.js +0 -2
- package/cjs/schema/opra-schema.ns.js +1 -1
- package/cjs/schema/resource/operation.interface.js +2 -0
- package/esm/document/api-document.js +9 -5
- package/esm/document/data-type/api-field.js +2 -2
- package/esm/document/data-type/complex-type.js +13 -59
- package/esm/document/data-type/data-type.js +0 -9
- package/esm/document/data-type/enum-type.js +2 -8
- package/esm/document/data-type/mapped-type.js +0 -36
- package/esm/document/data-type/simple-type.js +2 -8
- package/esm/document/data-type/union-type.js +1 -37
- package/esm/document/index.js +2 -0
- package/esm/document/resource/collection.js +75 -32
- package/esm/document/resource/singleton.js +31 -20
- package/esm/document/resource/storage.js +6 -20
- package/esm/document/utils/generate-codec.js +33 -0
- package/esm/exception/http-errors/bad-request.error.js +2 -3
- package/esm/exception/http-errors/failed-dependency.error.js +2 -3
- package/esm/exception/http-errors/forbidden.error.js +2 -3
- package/esm/exception/http-errors/internal-server.error.js +2 -3
- package/esm/exception/http-errors/method-not-allowed.error.js +2 -3
- package/esm/exception/http-errors/not-acceptable.error.js +2 -3
- package/esm/exception/http-errors/not-found.error.js +2 -3
- package/esm/exception/http-errors/unauthorized.error.js +2 -3
- package/esm/exception/http-errors/unprocessable-entity.error.js +2 -2
- package/esm/exception/opra-exception.js +47 -32
- package/esm/exception/resource-errors/resource-not-found.error.js +2 -3
- package/esm/exception/wrap-exception.js +16 -16
- package/esm/helpers/index.js +1 -1
- package/esm/helpers/is-url-string.js +9 -0
- package/esm/helpers/object-utils.js +2 -2
- package/esm/helpers/responsive-map.js +4 -4
- package/esm/helpers/type-guards.js +11 -2
- package/esm/http/index.js +2 -9
- package/esm/http/opra-url-path.js +246 -0
- package/esm/{url → http}/opra-url.js +53 -109
- package/esm/i18n/i18n.js +2 -2
- package/esm/index.js +0 -2
- package/esm/schema/opra-schema.ns.js +1 -1
- package/esm/schema/resource/operation.interface.js +1 -0
- package/package.json +5 -5
- package/types/document/api-document.d.ts +4 -1
- package/types/document/data-type/complex-type.d.ts +7 -12
- package/types/document/data-type/data-type.d.ts +0 -6
- package/types/document/data-type/enum-type.d.ts +2 -4
- package/types/document/data-type/mapped-type.d.ts +1 -5
- package/types/document/data-type/simple-type.d.ts +2 -4
- package/types/document/data-type/union-type.d.ts +1 -5
- package/types/document/index.d.ts +2 -0
- package/types/document/interfaces/collection-resource.interface.d.ts +10 -0
- package/types/document/interfaces/singleton-resource.interface.d.ts +7 -0
- package/types/document/interfaces/storage-resource.interface.d.ts +8 -0
- package/types/document/resource/collection.d.ts +41 -35
- package/types/document/resource/resource.d.ts +1 -0
- package/types/document/resource/singleton.d.ts +24 -21
- package/types/document/resource/storage.d.ts +14 -17
- package/types/document/utils/generate-codec.d.ts +10 -0
- package/types/exception/error-issue.d.ts +2 -1
- package/types/exception/http-errors/bad-request.error.d.ts +2 -1
- package/types/exception/http-errors/failed-dependency.error.d.ts +2 -1
- package/types/exception/http-errors/forbidden.error.d.ts +2 -1
- package/types/exception/http-errors/internal-server.error.d.ts +2 -1
- package/types/exception/http-errors/method-not-allowed.error.d.ts +2 -1
- package/types/exception/http-errors/not-acceptable.error.d.ts +2 -1
- package/types/exception/http-errors/not-found.error.d.ts +2 -1
- package/types/exception/http-errors/unauthorized.error.d.ts +2 -1
- package/types/exception/http-errors/unprocessable-entity.error.d.ts +2 -1
- package/types/exception/opra-exception.d.ts +13 -8
- package/types/exception/wrap-exception.d.ts +1 -1
- package/types/helpers/index.d.ts +1 -1
- package/types/helpers/is-url-string.d.ts +2 -0
- package/types/helpers/object-utils.d.ts +1 -1
- package/types/helpers/type-guards.d.ts +3 -0
- package/types/http/index.d.ts +2 -9
- package/types/http/opra-url-path.d.ts +54 -0
- package/types/{url → http}/opra-url.d.ts +9 -13
- package/types/index.d.ts +0 -2
- package/types/schema/data-type/complex-type.interface.d.ts +1 -1
- package/types/schema/opra-schema.ns.d.ts +1 -1
- package/types/schema/resource/collection.interface.d.ts +29 -8
- package/types/schema/resource/operation.interface.d.ts +3 -0
- package/types/schema/resource/singleton.interface.d.ts +5 -5
- package/types/schema/resource/storage.interface.d.ts +42 -5
- package/cjs/helpers/is-url.js +0 -8
- package/cjs/http/codecs/boolean-codec.js +0 -24
- package/cjs/http/codecs/date-codec.js +0 -41
- package/cjs/http/codecs/filter-codec.js +0 -17
- package/cjs/http/codecs/integer-codec.js +0 -19
- package/cjs/http/codecs/number-codec.js +0 -24
- package/cjs/http/codecs/string-codec.js +0 -23
- package/cjs/http/http-params.js +0 -353
- package/cjs/http/multipart/batch-multipart.js +0 -170
- package/cjs/http/multipart/http-request-content.js +0 -17
- package/cjs/http/multipart/http-response-content.js +0 -14
- package/cjs/http/multipart/index.js +0 -2
- package/cjs/url/index.js +0 -8
- package/cjs/url/opra-url-path-component.js +0 -30
- package/cjs/url/opra-url-path.js +0 -155
- package/cjs/url/utils/decode-path-component.js +0 -41
- package/cjs/url/utils/encode-path-component.js +0 -27
- package/cjs/utils/path-utils.js +0 -24
- package/esm/helpers/is-url.js +0 -4
- package/esm/http/codecs/boolean-codec.js +0 -20
- package/esm/http/codecs/date-codec.js +0 -37
- package/esm/http/codecs/filter-codec.js +0 -13
- package/esm/http/codecs/integer-codec.js +0 -15
- package/esm/http/codecs/number-codec.js +0 -20
- package/esm/http/codecs/string-codec.js +0 -19
- package/esm/http/http-params.js +0 -348
- package/esm/http/multipart/batch-multipart.js +0 -170
- package/esm/http/multipart/http-request-content.js +0 -17
- package/esm/http/multipart/http-response-content.js +0 -14
- package/esm/http/multipart/index.js +0 -2
- package/esm/url/index.js +0 -5
- package/esm/url/opra-url-path-component.js +0 -26
- package/esm/url/opra-url-path.js +0 -151
- package/esm/url/utils/decode-path-component.js +0 -37
- package/esm/url/utils/encode-path-component.js +0 -22
- package/esm/utils/path-utils.js +0 -19
- package/types/helpers/is-url.d.ts +0 -1
- package/types/http/codecs/boolean-codec.d.ts +0 -5
- package/types/http/codecs/date-codec.d.ts +0 -16
- package/types/http/codecs/filter-codec.d.ts +0 -6
- package/types/http/codecs/integer-codec.d.ts +0 -11
- package/types/http/codecs/number-codec.d.ts +0 -14
- package/types/http/codecs/string-codec.d.ts +0 -16
- package/types/http/http-params.d.ts +0 -114
- package/types/http/interfaces/client-http-headers.interface.d.ts +0 -65
- package/types/http/interfaces/server-http-headers.interface.d.ts +0 -1
- package/types/http/multipart/batch-multipart.d.ts +0 -0
- package/types/http/multipart/http-request-content.d.ts +0 -0
- package/types/http/multipart/http-response-content.d.ts +0 -0
- package/types/http/multipart/index.d.ts +0 -0
- package/types/schema/resource/endpoint.interface.d.ts +0 -29
- package/types/url/index.d.ts +0 -5
- package/types/url/opra-url-path-component.d.ts +0 -15
- package/types/url/opra-url-path.d.ts +0 -36
- package/types/url/utils/decode-path-component.d.ts +0 -5
- package/types/url/utils/encode-path-component.d.ts +0 -1
- package/types/utils/path-utils.d.ts +0 -2
- /package/cjs/{http/interfaces/client-http-headers.interface.js → document/interfaces/collection-resource.interface.js} +0 -0
- /package/cjs/{http/interfaces/server-http-headers.interface.js → document/interfaces/singleton-resource.interface.js} +0 -0
- /package/cjs/{schema/resource/endpoint.interface.js → document/interfaces/storage-resource.interface.js} +0 -0
- /package/esm/{http/interfaces/client-http-headers.interface.js → document/interfaces/collection-resource.interface.js} +0 -0
- /package/esm/{http/interfaces/server-http-headers.interface.js → document/interfaces/singleton-resource.interface.js} +0 -0
- /package/esm/{schema/resource/endpoint.interface.js → document/interfaces/storage-resource.interface.js} +0 -0
package/browser.js
CHANGED
|
@@ -18,12 +18,6 @@ var METADATA_KEY = Symbol.for("opra.metadata");
|
|
|
18
18
|
var NAMESPACE_PATTERN = /([A-Z$_]\w+)(?::.+)?/i;
|
|
19
19
|
var TYPENAME_PATTERN = /^(.*)Type(\d*)$/;
|
|
20
20
|
|
|
21
|
-
// ../../build/common/esm/i18n/i18n.js
|
|
22
|
-
import { splitString, tokenize } from "fast-tokenizer";
|
|
23
|
-
import fs from "@browsery/fs";
|
|
24
|
-
import path from "path-browserify";
|
|
25
|
-
import i18next from "@browsery/i18next";
|
|
26
|
-
|
|
27
21
|
// ../../build/common/esm/helpers/function-utils.js
|
|
28
22
|
import promisify from "putil-promisify";
|
|
29
23
|
|
|
@@ -37,11 +31,15 @@ function isStream(stream) {
|
|
|
37
31
|
}
|
|
38
32
|
__name(isStream, "isStream");
|
|
39
33
|
function isReadable(x) {
|
|
40
|
-
return isStream(x) &&
|
|
34
|
+
return isStream(x) && typeof x._read === "function" && typeof x._readableState === "object";
|
|
41
35
|
}
|
|
42
36
|
__name(isReadable, "isReadable");
|
|
37
|
+
function isWritable(x) {
|
|
38
|
+
return isStream(x) && typeof x._write === "function";
|
|
39
|
+
}
|
|
40
|
+
__name(isWritable, "isWritable");
|
|
43
41
|
function isReadableStream(x) {
|
|
44
|
-
return isStream(x) &&
|
|
42
|
+
return isStream(x) && typeof x.getReader === "function" && typeof x.pipeThrough === "function" && typeof x.pipeTo === "function";
|
|
45
43
|
}
|
|
46
44
|
__name(isReadableStream, "isReadableStream");
|
|
47
45
|
function isBlob(x) {
|
|
@@ -53,9 +51,17 @@ function isFormData(x) {
|
|
|
53
51
|
}
|
|
54
52
|
__name(isFormData, "isFormData");
|
|
55
53
|
function isURL(x) {
|
|
56
|
-
return x !== null && typeof x.host === "string" && typeof x.href === "string";
|
|
54
|
+
return x !== null && typeof x == "object" && typeof x.host === "string" && typeof x.href === "string";
|
|
57
55
|
}
|
|
58
56
|
__name(isURL, "isURL");
|
|
57
|
+
function isIterable(x) {
|
|
58
|
+
return Symbol.iterator in x;
|
|
59
|
+
}
|
|
60
|
+
__name(isIterable, "isIterable");
|
|
61
|
+
function isAsyncIterable(x) {
|
|
62
|
+
return Symbol.asyncIterator in x;
|
|
63
|
+
}
|
|
64
|
+
__name(isAsyncIterable, "isAsyncIterable");
|
|
59
65
|
|
|
60
66
|
// ../../build/common/esm/helpers/function-utils.js
|
|
61
67
|
async function resolveThunk(thunk) {
|
|
@@ -97,12 +103,16 @@ function getStackFileName(position = 1) {
|
|
|
97
103
|
}
|
|
98
104
|
__name(getStackFileName, "getStackFileName");
|
|
99
105
|
|
|
100
|
-
// ../../build/common/esm/helpers/is-url.js
|
|
106
|
+
// ../../build/common/esm/helpers/is-url-string.js
|
|
107
|
+
import { URL } from "url";
|
|
101
108
|
var URL_PATTERN = /^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;
|
|
102
|
-
function
|
|
109
|
+
function isUrlString(url) {
|
|
103
110
|
return URL_PATTERN.test(url);
|
|
104
111
|
}
|
|
105
|
-
__name(
|
|
112
|
+
__name(isUrlString, "isUrlString");
|
|
113
|
+
var isAbsoluteUrl = /* @__PURE__ */ __name((urlString) => {
|
|
114
|
+
return !urlString.includes("://") && new URL(urlString, "http://tempuri.org/").host !== "tempuri.org";
|
|
115
|
+
}, "isAbsoluteUrl");
|
|
106
116
|
|
|
107
117
|
// ../../build/common/esm/helpers/mixin-utils.js
|
|
108
118
|
function mergePrototype(targetProto, baseProto, filter) {
|
|
@@ -139,13 +149,13 @@ function cloneObject(obj, jsonOnly) {
|
|
|
139
149
|
});
|
|
140
150
|
}
|
|
141
151
|
__name(cloneObject, "cloneObject");
|
|
142
|
-
function omitUndefined(obj) {
|
|
152
|
+
function omitUndefined(obj, recursive) {
|
|
143
153
|
if (!(obj && typeof obj === "object"))
|
|
144
154
|
return obj;
|
|
145
155
|
for (const k of Object.keys(obj)) {
|
|
146
156
|
if (obj[k] === void 0)
|
|
147
157
|
delete obj[k];
|
|
148
|
-
else if (typeof obj[k] === "object")
|
|
158
|
+
else if (recursive && typeof obj[k] === "object")
|
|
149
159
|
omitUndefined(obj[k]);
|
|
150
160
|
}
|
|
151
161
|
return obj;
|
|
@@ -188,10 +198,10 @@ function isMap(v) {
|
|
|
188
198
|
return v && typeof v.forEach === "function";
|
|
189
199
|
}
|
|
190
200
|
__name(isMap, "isMap");
|
|
191
|
-
var kKeyMap = Symbol("kKeyMap");
|
|
192
|
-
var kKeyOrder = Symbol("kKeyOrder");
|
|
193
|
-
var kWellKnownKeys = Symbol("kWellKnownKeys");
|
|
194
|
-
var kOptions = Symbol("kOptions");
|
|
201
|
+
var kKeyMap = Symbol.for("kKeyMap");
|
|
202
|
+
var kKeyOrder = Symbol.for("kKeyOrder");
|
|
203
|
+
var kWellKnownKeys = Symbol.for("kWellKnownKeys");
|
|
204
|
+
var kOptions = Symbol.for("kOptions");
|
|
195
205
|
var ResponsiveMap = class extends Map {
|
|
196
206
|
static {
|
|
197
207
|
__name(this, "ResponsiveMap");
|
|
@@ -352,6 +362,12 @@ var ResponsiveMap = class extends Map {
|
|
|
352
362
|
}
|
|
353
363
|
};
|
|
354
364
|
|
|
365
|
+
// ../../build/common/esm/i18n/i18n.js
|
|
366
|
+
import { splitString, tokenize } from "fast-tokenizer";
|
|
367
|
+
import fs from "@browsery/fs";
|
|
368
|
+
import path from "path-browserify";
|
|
369
|
+
import i18next from "@browsery/i18next";
|
|
370
|
+
|
|
355
371
|
// ../../build/common/esm/i18n/string-utils.js
|
|
356
372
|
var unescapeRegEx = /\\(.)/g;
|
|
357
373
|
var escapeRegEx = /(\\)/g;
|
|
@@ -413,7 +429,7 @@ var I18n = class _I18n extends BaseI18n {
|
|
|
413
429
|
}
|
|
414
430
|
async loadResourceBundle(lang, ns, filePath, deep, overwrite) {
|
|
415
431
|
let obj;
|
|
416
|
-
if (
|
|
432
|
+
if (isUrlString(filePath)) {
|
|
417
433
|
obj = (await fetch(filePath, { headers: { accept: "application/json" } })).json();
|
|
418
434
|
} else {
|
|
419
435
|
const content = fs.readFileSync(filePath, "utf8");
|
|
@@ -532,53 +548,68 @@ var i18n = I18n.createInstance();
|
|
|
532
548
|
i18n.init().catch(() => void 0);
|
|
533
549
|
|
|
534
550
|
// ../../build/common/esm/exception/opra-exception.js
|
|
551
|
+
var inDevelopment = (process.env.NODE_ENV || "").startsWith("dev");
|
|
535
552
|
var OpraException = class extends Error {
|
|
536
553
|
static {
|
|
537
554
|
__name(this, "OpraException");
|
|
538
555
|
}
|
|
539
|
-
constructor(issue,
|
|
540
|
-
super("");
|
|
556
|
+
constructor(issue, arg1, arg2) {
|
|
557
|
+
super("Unknown error");
|
|
541
558
|
this.status = 500;
|
|
542
|
-
|
|
559
|
+
let cause = arg1 && arg1 instanceof Error ? arg1 : void 0;
|
|
560
|
+
this.status = (typeof arg1 === "number" ? arg1 : Number(arg2)) || 500;
|
|
543
561
|
if (issue instanceof Error)
|
|
544
562
|
cause = issue;
|
|
545
|
-
if (cause) {
|
|
563
|
+
if (cause && cause instanceof Error) {
|
|
546
564
|
this.cause = cause;
|
|
547
565
|
if (cause.stack)
|
|
548
566
|
this.stack = cause.stack;
|
|
549
567
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
this._issue = {
|
|
558
|
-
message: "Unknown error",
|
|
559
|
-
severity: "error",
|
|
560
|
-
...issue
|
|
561
|
-
};
|
|
568
|
+
if (typeof issue === "string")
|
|
569
|
+
this.initString(issue);
|
|
570
|
+
else if (issue instanceof Error)
|
|
571
|
+
this.initError(issue);
|
|
572
|
+
else if (issue && typeof issue === "object")
|
|
573
|
+
this.init(issue);
|
|
574
|
+
this.message = this.message || this.constructor.name;
|
|
562
575
|
}
|
|
563
576
|
setStatus(status) {
|
|
564
577
|
this.status = status;
|
|
565
578
|
return this;
|
|
566
579
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
580
|
+
toString() {
|
|
581
|
+
return i18n.deep(this.message);
|
|
582
|
+
}
|
|
583
|
+
toJSON() {
|
|
584
|
+
return omitUndefined({
|
|
585
|
+
message: this.message,
|
|
586
|
+
severity: this.severity,
|
|
587
|
+
system: this.system,
|
|
588
|
+
code: this.code,
|
|
589
|
+
details: this.details,
|
|
590
|
+
stack: inDevelopment ? this.stack?.split("\n") : void 0
|
|
591
|
+
}, true);
|
|
592
|
+
}
|
|
593
|
+
init(issue) {
|
|
594
|
+
this.message = issue.message || this.constructor.name;
|
|
595
|
+
this.severity = issue.severity || "error";
|
|
596
|
+
this.system = issue.system;
|
|
597
|
+
this.code = issue.code;
|
|
598
|
+
this.details = issue.details;
|
|
599
|
+
}
|
|
600
|
+
initString(issue) {
|
|
601
|
+
this.message = String(issue || "") || this.constructor.name;
|
|
602
|
+
this.severity = "error";
|
|
603
|
+
this.code = this.constructor.name;
|
|
604
|
+
}
|
|
605
|
+
initError(issue) {
|
|
606
|
+
if (typeof issue.status === "number")
|
|
607
|
+
this.status = issue.status;
|
|
608
|
+
else if (typeof issue.getStatus === "function")
|
|
609
|
+
this.status = issue.getStatus();
|
|
610
|
+
this.message = issue.message;
|
|
611
|
+
this.severity = issue.severity || "error";
|
|
612
|
+
this.code = issue.code || issue.constructor.name;
|
|
582
613
|
}
|
|
583
614
|
};
|
|
584
615
|
|
|
@@ -591,10 +622,9 @@ var BadRequestError = class extends OpraException {
|
|
|
591
622
|
super(...arguments);
|
|
592
623
|
this.status = 400;
|
|
593
624
|
}
|
|
594
|
-
|
|
595
|
-
super.
|
|
625
|
+
init(issue) {
|
|
626
|
+
super.init({
|
|
596
627
|
message: translate("error:BAD_REQUEST", "Bad request"),
|
|
597
|
-
severity: "error",
|
|
598
628
|
code: "BAD_REQUEST",
|
|
599
629
|
...issue
|
|
600
630
|
});
|
|
@@ -610,10 +640,9 @@ var FailedDependencyError = class extends OpraException {
|
|
|
610
640
|
super(...arguments);
|
|
611
641
|
this.status = 424;
|
|
612
642
|
}
|
|
613
|
-
|
|
614
|
-
super.
|
|
643
|
+
init(issue) {
|
|
644
|
+
super.init({
|
|
615
645
|
message: translate("error:FAILED_DEPENDENCY", "The request failed due to failure of a previous request"),
|
|
616
|
-
severity: "error",
|
|
617
646
|
code: "FAILED_DEPENDENCY",
|
|
618
647
|
...issue
|
|
619
648
|
});
|
|
@@ -629,10 +658,9 @@ var ForbiddenError = class extends OpraException {
|
|
|
629
658
|
super(...arguments);
|
|
630
659
|
this.status = 403;
|
|
631
660
|
}
|
|
632
|
-
|
|
633
|
-
super.
|
|
661
|
+
init(issue) {
|
|
662
|
+
super.init({
|
|
634
663
|
message: translate("error:FORBIDDEN", "You are not authorized to perform this action"),
|
|
635
|
-
severity: "error",
|
|
636
664
|
code: "FORBIDDEN",
|
|
637
665
|
...issue
|
|
638
666
|
});
|
|
@@ -648,10 +676,9 @@ var MethodNotAllowedError = class extends OpraException {
|
|
|
648
676
|
super(...arguments);
|
|
649
677
|
this.status = 405;
|
|
650
678
|
}
|
|
651
|
-
|
|
652
|
-
super.
|
|
679
|
+
init(issue) {
|
|
680
|
+
super.init({
|
|
653
681
|
message: translate("error:METHOD_NOT_ALLOWED", "Method not allowed"),
|
|
654
|
-
severity: "error",
|
|
655
682
|
code: "METHOD_NOT_ALLOWED",
|
|
656
683
|
...issue
|
|
657
684
|
});
|
|
@@ -667,10 +694,9 @@ var NotAcceptableError = class extends OpraException {
|
|
|
667
694
|
super(...arguments);
|
|
668
695
|
this.status = 406;
|
|
669
696
|
}
|
|
670
|
-
|
|
671
|
-
super.
|
|
697
|
+
init(issue) {
|
|
698
|
+
super.init({
|
|
672
699
|
message: translate("error:NOT_ACCEPTABLE", "Not Acceptable"),
|
|
673
|
-
severity: "error",
|
|
674
700
|
code: "NOT_ACCEPTABLE",
|
|
675
701
|
...issue
|
|
676
702
|
});
|
|
@@ -686,10 +712,9 @@ var NotFoundError = class extends OpraException {
|
|
|
686
712
|
super(...arguments);
|
|
687
713
|
this.status = 404;
|
|
688
714
|
}
|
|
689
|
-
|
|
690
|
-
super.
|
|
715
|
+
init(issue) {
|
|
716
|
+
super.init({
|
|
691
717
|
message: translate("error:NOT_FOUND", "Not found"),
|
|
692
|
-
severity: "error",
|
|
693
718
|
code: "NOT_FOUND",
|
|
694
719
|
...issue
|
|
695
720
|
});
|
|
@@ -705,10 +730,9 @@ var UnauthorizedError = class extends OpraException {
|
|
|
705
730
|
super(...arguments);
|
|
706
731
|
this.status = 401;
|
|
707
732
|
}
|
|
708
|
-
|
|
709
|
-
super.
|
|
733
|
+
init(issue) {
|
|
734
|
+
super.init({
|
|
710
735
|
message: translate("error:UNAUTHORIZED", "You have not been authenticated to perform this action"),
|
|
711
|
-
severity: "error",
|
|
712
736
|
code: "UNAUTHORIZED",
|
|
713
737
|
...issue
|
|
714
738
|
});
|
|
@@ -724,8 +748,8 @@ var UnprocessableEntityError = class extends OpraException {
|
|
|
724
748
|
super(...arguments);
|
|
725
749
|
this.status = 422;
|
|
726
750
|
}
|
|
727
|
-
|
|
728
|
-
super.
|
|
751
|
+
init(issue) {
|
|
752
|
+
super.init({
|
|
729
753
|
message: translate("error:UNPROCESSABLE_ENTITY", "Unprocessable entity"),
|
|
730
754
|
severity: "error",
|
|
731
755
|
code: "UNPROCESSABLE_ENTITY",
|
|
@@ -735,33 +759,33 @@ var UnprocessableEntityError = class extends OpraException {
|
|
|
735
759
|
};
|
|
736
760
|
|
|
737
761
|
// ../../build/common/esm/exception/wrap-exception.js
|
|
738
|
-
function wrapException(
|
|
739
|
-
if (
|
|
740
|
-
return
|
|
762
|
+
function wrapException(error) {
|
|
763
|
+
if (error instanceof OpraException)
|
|
764
|
+
return error;
|
|
741
765
|
let status = 500;
|
|
742
|
-
if (typeof
|
|
743
|
-
status =
|
|
744
|
-
else if (typeof
|
|
745
|
-
status =
|
|
766
|
+
if (typeof error.status === "number")
|
|
767
|
+
status = error.status;
|
|
768
|
+
else if (typeof error.getStatus === "function")
|
|
769
|
+
status = error.getStatus();
|
|
746
770
|
switch (status) {
|
|
747
771
|
case 400:
|
|
748
|
-
return new BadRequestError(
|
|
772
|
+
return new BadRequestError(error);
|
|
749
773
|
case 401:
|
|
750
|
-
return new UnauthorizedError(
|
|
774
|
+
return new UnauthorizedError(error);
|
|
751
775
|
case 403:
|
|
752
|
-
return new ForbiddenError(
|
|
776
|
+
return new ForbiddenError(error);
|
|
753
777
|
case 404:
|
|
754
|
-
return new NotFoundError(
|
|
778
|
+
return new NotFoundError(error);
|
|
755
779
|
case 405:
|
|
756
|
-
return new MethodNotAllowedError(
|
|
780
|
+
return new MethodNotAllowedError(error);
|
|
757
781
|
case 406:
|
|
758
|
-
return new NotAcceptableError(
|
|
782
|
+
return new NotAcceptableError(error);
|
|
759
783
|
case 422:
|
|
760
|
-
return new UnprocessableEntityError(
|
|
784
|
+
return new UnprocessableEntityError(error);
|
|
761
785
|
case 424:
|
|
762
|
-
return new FailedDependencyError(
|
|
786
|
+
return new FailedDependencyError(error);
|
|
763
787
|
default:
|
|
764
|
-
return new FailedDependencyError(
|
|
788
|
+
return new FailedDependencyError(error);
|
|
765
789
|
}
|
|
766
790
|
}
|
|
767
791
|
__name(wrapException, "wrapException");
|
|
@@ -796,10 +820,9 @@ var InternalServerError = class extends OpraException {
|
|
|
796
820
|
super(...arguments);
|
|
797
821
|
this.status = 500;
|
|
798
822
|
}
|
|
799
|
-
|
|
800
|
-
super.
|
|
823
|
+
init(issue) {
|
|
824
|
+
super.init({
|
|
801
825
|
message: translate("error:INTERNAL_SERVER_ERROR", "Internal server error"),
|
|
802
|
-
severity: "error",
|
|
803
826
|
code: "INTERNAL_SERVER_ERROR",
|
|
804
827
|
...issue
|
|
805
828
|
});
|
|
@@ -832,15 +855,14 @@ var ResourceNotFoundError = class extends OpraException {
|
|
|
832
855
|
}
|
|
833
856
|
constructor(resource, keyValue, cause) {
|
|
834
857
|
super({
|
|
835
|
-
message: translate(`error:RESOURCE_NOT_FOUND`, { resource: resource + (keyValue ? "@" + keyValue : "") }, `The resource '{{resource}}'
|
|
858
|
+
message: translate(`error:RESOURCE_NOT_FOUND`, { resource: resource + (keyValue ? "@" + keyValue : "") }, `The resource '{{resource}}' not found`),
|
|
836
859
|
severity: "error",
|
|
837
860
|
code: "RESOURCE_NOT_FOUND",
|
|
838
861
|
details: {
|
|
839
862
|
resource,
|
|
840
863
|
key: keyValue
|
|
841
864
|
}
|
|
842
|
-
}, cause);
|
|
843
|
-
this.status = 404;
|
|
865
|
+
}, cause, 404);
|
|
844
866
|
}
|
|
845
867
|
};
|
|
846
868
|
|
|
@@ -988,7 +1010,6 @@ __name(isContainer, "isContainer");
|
|
|
988
1010
|
import "reflect-metadata";
|
|
989
1011
|
import omit2 from "lodash.omit";
|
|
990
1012
|
import merge3 from "putil-merge";
|
|
991
|
-
import * as vg2 from "valgen";
|
|
992
1013
|
|
|
993
1014
|
// ../../build/common/esm/document/data-type/enum-type.js
|
|
994
1015
|
import "reflect-metadata";
|
|
@@ -1014,15 +1035,6 @@ var DataType = class _DataType {
|
|
|
1014
1035
|
this.description = init?.description;
|
|
1015
1036
|
this.isAnonymous = !this.name;
|
|
1016
1037
|
}
|
|
1017
|
-
decode(v) {
|
|
1018
|
-
return this._getDecoder()(v, { coerce: true });
|
|
1019
|
-
}
|
|
1020
|
-
encode(v) {
|
|
1021
|
-
return this._getEncoder()(v, { coerce: true });
|
|
1022
|
-
}
|
|
1023
|
-
validate(v) {
|
|
1024
|
-
return this._getEncoder()(v);
|
|
1025
|
-
}
|
|
1026
1038
|
exportSchema() {
|
|
1027
1039
|
return omitUndefined({
|
|
1028
1040
|
kind: this.kind,
|
|
@@ -1060,6 +1072,8 @@ var EnumTypeClass = class extends DataType {
|
|
|
1060
1072
|
this.ownMeanings = init.meanings || {};
|
|
1061
1073
|
this.values = { ...this.base?.values, ...this.ownValues };
|
|
1062
1074
|
this.meanings = { ...this.base?.meanings, ...this.ownMeanings };
|
|
1075
|
+
this.decode = vg.isEnum(Object.values(this.values));
|
|
1076
|
+
this.encode = vg.isEnum(Object.values(this.values));
|
|
1063
1077
|
}
|
|
1064
1078
|
exportSchema() {
|
|
1065
1079
|
const out = DataType.prototype.exportSchema.call(this);
|
|
@@ -1070,14 +1084,6 @@ var EnumTypeClass = class extends DataType {
|
|
|
1070
1084
|
}));
|
|
1071
1085
|
return out;
|
|
1072
1086
|
}
|
|
1073
|
-
_getDecoder() {
|
|
1074
|
-
if (!this._decoder)
|
|
1075
|
-
this._decoder = vg.isEnum(Object.values(this.values), { enumName: this.name });
|
|
1076
|
-
return this._decoder;
|
|
1077
|
-
}
|
|
1078
|
-
_getEncoder() {
|
|
1079
|
-
return this._getDecoder();
|
|
1080
|
-
}
|
|
1081
1087
|
};
|
|
1082
1088
|
var EnumType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1083
1089
|
if (this) {
|
|
@@ -1161,14 +1167,14 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1161
1167
|
}, "ApiField");
|
|
1162
1168
|
var proto = {
|
|
1163
1169
|
exportSchema() {
|
|
1164
|
-
return {
|
|
1170
|
+
return omitUndefined({
|
|
1165
1171
|
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
1166
1172
|
description: this.description,
|
|
1167
1173
|
isArray: this.isArray,
|
|
1168
1174
|
default: this.default,
|
|
1169
1175
|
fixed: this.fixed,
|
|
1170
1176
|
required: this.required
|
|
1171
|
-
};
|
|
1177
|
+
});
|
|
1172
1178
|
}
|
|
1173
1179
|
};
|
|
1174
1180
|
Object.assign(ApiField.prototype, proto);
|
|
@@ -1182,7 +1188,7 @@ var ComplexTypeClass = class extends DataType {
|
|
|
1182
1188
|
super(document, init);
|
|
1183
1189
|
this.kind = opra_schema_ns_exports.ComplexType.Kind;
|
|
1184
1190
|
const own = this.own = {};
|
|
1185
|
-
own.ctor = init?.ctor;
|
|
1191
|
+
own.ctor = init?.ctor || init?.base?.ctor;
|
|
1186
1192
|
own.abstract = init?.abstract;
|
|
1187
1193
|
own.additionalFields = init?.additionalFields;
|
|
1188
1194
|
own.fields = new ResponsiveMap();
|
|
@@ -1195,8 +1201,6 @@ var ComplexTypeClass = class extends DataType {
|
|
|
1195
1201
|
if (this.base) {
|
|
1196
1202
|
if (this.additionalFields == null)
|
|
1197
1203
|
this.additionalFields = this.base.additionalFields;
|
|
1198
|
-
if (own.ctor == null && this.base instanceof ComplexType2)
|
|
1199
|
-
this.ctor = this.base.ctor;
|
|
1200
1204
|
if (this.base.fields)
|
|
1201
1205
|
for (const [k, el] of this.base.fields.entries()) {
|
|
1202
1206
|
const newEl = new ApiField(this, el);
|
|
@@ -1231,7 +1235,7 @@ var ComplexTypeClass = class extends DataType {
|
|
|
1231
1235
|
} else
|
|
1232
1236
|
field = this.fields.get(nameOrPath);
|
|
1233
1237
|
if (!field)
|
|
1234
|
-
throw new Error(
|
|
1238
|
+
throw new Error(translate("error:UNKNOWN_FIELD", { field: nameOrPath }));
|
|
1235
1239
|
return field;
|
|
1236
1240
|
}
|
|
1237
1241
|
iteratePath(path2, silent) {
|
|
@@ -1264,7 +1268,7 @@ var ComplexTypeClass = class extends DataType {
|
|
|
1264
1268
|
if (dataType && !dataType.additionalFields) {
|
|
1265
1269
|
if (silent)
|
|
1266
1270
|
return { done: true, value: [] };
|
|
1267
|
-
throw new Error(
|
|
1271
|
+
throw new Error(translate("error:UNKNOWN_FIELD", { field: curPath }));
|
|
1268
1272
|
}
|
|
1269
1273
|
}
|
|
1270
1274
|
}
|
|
@@ -1276,13 +1280,14 @@ var ComplexTypeClass = class extends DataType {
|
|
|
1276
1280
|
};
|
|
1277
1281
|
}
|
|
1278
1282
|
normalizeFieldPath(fieldPaths) {
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1283
|
+
const array = (Array.isArray(fieldPaths) ? fieldPaths : [fieldPaths]).map((s) => {
|
|
1284
|
+
let curPath = "";
|
|
1285
|
+
for (const [, , p] of this.iteratePath(s)) {
|
|
1286
|
+
curPath = p;
|
|
1287
|
+
}
|
|
1288
|
+
return curPath;
|
|
1289
|
+
}).flat();
|
|
1290
|
+
return array.length ? array : void 0;
|
|
1286
1291
|
}
|
|
1287
1292
|
exportSchema() {
|
|
1288
1293
|
const out = super.exportSchema();
|
|
@@ -1311,52 +1316,6 @@ var ComplexTypeClass = class extends DataType {
|
|
|
1311
1316
|
}
|
|
1312
1317
|
return false;
|
|
1313
1318
|
}
|
|
1314
|
-
decode(v) {
|
|
1315
|
-
return this._getDecoder()(v, { coerce: true });
|
|
1316
|
-
}
|
|
1317
|
-
encode(v) {
|
|
1318
|
-
return this._getEncoder()(v, { coerce: true });
|
|
1319
|
-
}
|
|
1320
|
-
validate(v) {
|
|
1321
|
-
return this._getEncoder()(v);
|
|
1322
|
-
}
|
|
1323
|
-
_getDecoder() {
|
|
1324
|
-
if (this._decoder)
|
|
1325
|
-
return this._decoder;
|
|
1326
|
-
const schema = {};
|
|
1327
|
-
for (const f of this.fields.values()) {
|
|
1328
|
-
let t = f.type._getDecoder();
|
|
1329
|
-
if (f.isArray)
|
|
1330
|
-
t = vg2.isArray(t);
|
|
1331
|
-
schema[f.name] = f.required ? vg2.required(t) : vg2.optional(t);
|
|
1332
|
-
}
|
|
1333
|
-
this._decoder = vg2.isObject(schema, {
|
|
1334
|
-
ctor: this.ctor,
|
|
1335
|
-
additionalFields: this.additionalFields ?? "ignore",
|
|
1336
|
-
name: this.name,
|
|
1337
|
-
caseInSensitive: true
|
|
1338
|
-
});
|
|
1339
|
-
return this._decoder;
|
|
1340
|
-
}
|
|
1341
|
-
_getEncoder() {
|
|
1342
|
-
if (this._encoder)
|
|
1343
|
-
return this._encoder;
|
|
1344
|
-
const schema = {};
|
|
1345
|
-
for (const f of this.fields.values()) {
|
|
1346
|
-
let t = f.type._getEncoder();
|
|
1347
|
-
if (f.isArray)
|
|
1348
|
-
t = vg2.isArray(t);
|
|
1349
|
-
schema[f.name] = t;
|
|
1350
|
-
}
|
|
1351
|
-
this._encoder = vg2.isObject(schema, {
|
|
1352
|
-
ctor: this.ctor,
|
|
1353
|
-
additionalFields: this.additionalFields,
|
|
1354
|
-
name: this.name,
|
|
1355
|
-
caseInSensitive: true,
|
|
1356
|
-
detectCircular: true
|
|
1357
|
-
});
|
|
1358
|
-
return this._encoder;
|
|
1359
|
-
}
|
|
1360
1319
|
};
|
|
1361
1320
|
var ComplexType2 = /* @__PURE__ */ __name(function(...args) {
|
|
1362
1321
|
if (this) {
|
|
@@ -1530,7 +1489,7 @@ var ApiDocument = class {
|
|
|
1530
1489
|
}
|
|
1531
1490
|
if (silent)
|
|
1532
1491
|
return;
|
|
1533
|
-
throw new
|
|
1492
|
+
throw new ResourceNotFoundError(path2);
|
|
1534
1493
|
}
|
|
1535
1494
|
getCollection(path2, silent) {
|
|
1536
1495
|
const t = this.getResource(path2);
|
|
@@ -1559,7 +1518,9 @@ var ApiDocument = class {
|
|
|
1559
1518
|
/**
|
|
1560
1519
|
* Export as Opra schema definition object
|
|
1561
1520
|
*/
|
|
1562
|
-
exportSchema() {
|
|
1521
|
+
exportSchema(options) {
|
|
1522
|
+
if (this._metadataCache)
|
|
1523
|
+
return cloneObject(this._metadataCache, options?.webSafe);
|
|
1563
1524
|
const schema = {
|
|
1564
1525
|
version: opra_schema_ns_exports.SpecVersion,
|
|
1565
1526
|
url: this.url,
|
|
@@ -1589,9 +1550,11 @@ var ApiDocument = class {
|
|
|
1589
1550
|
types[name] = r.exportSchema();
|
|
1590
1551
|
}
|
|
1591
1552
|
}
|
|
1592
|
-
|
|
1553
|
+
this._metadataCache = schema;
|
|
1554
|
+
return this._metadataCache;
|
|
1593
1555
|
}
|
|
1594
1556
|
invalidate() {
|
|
1557
|
+
this._metadataCache = void 0;
|
|
1595
1558
|
this._typeCache.clear();
|
|
1596
1559
|
this._typesCacheByCtor.clear();
|
|
1597
1560
|
}
|
|
@@ -1630,7 +1593,7 @@ __name(__decorate, "__decorate");
|
|
|
1630
1593
|
import "reflect-metadata";
|
|
1631
1594
|
import omit3 from "lodash.omit";
|
|
1632
1595
|
import merge4 from "putil-merge";
|
|
1633
|
-
import * as
|
|
1596
|
+
import * as vg2 from "valgen";
|
|
1634
1597
|
var SimpleTypeClass = class extends DataType {
|
|
1635
1598
|
static {
|
|
1636
1599
|
__name(this, "SimpleTypeClass");
|
|
@@ -1639,14 +1602,8 @@ var SimpleTypeClass = class extends DataType {
|
|
|
1639
1602
|
super(document, init);
|
|
1640
1603
|
this.kind = opra_schema_ns_exports.SimpleType.Kind;
|
|
1641
1604
|
this.base = init.base;
|
|
1642
|
-
this.
|
|
1643
|
-
this.
|
|
1644
|
-
}
|
|
1645
|
-
_getDecoder() {
|
|
1646
|
-
return this._decoder;
|
|
1647
|
-
}
|
|
1648
|
-
_getEncoder() {
|
|
1649
|
-
return this._encoder;
|
|
1605
|
+
this.decode = init.decoder || init.base?.decode || vg2.isAny();
|
|
1606
|
+
this.encode = init.encoder || init.base?.encode || vg2.isAny();
|
|
1650
1607
|
}
|
|
1651
1608
|
exportSchema() {
|
|
1652
1609
|
const out = super.exportSchema();
|
|
@@ -2145,7 +2102,8 @@ __name(extractFieldSchema, "extractFieldSchema");
|
|
|
2145
2102
|
|
|
2146
2103
|
// ../../build/common/esm/document/resource/collection.js
|
|
2147
2104
|
import omit4 from "lodash.omit";
|
|
2148
|
-
import
|
|
2105
|
+
import merge7 from "putil-merge";
|
|
2106
|
+
import * as vg4 from "valgen";
|
|
2149
2107
|
|
|
2150
2108
|
// ../../build/common/esm/filter/opra-filter.ns.js
|
|
2151
2109
|
var opra_filter_ns_exports = {};
|
|
@@ -9658,6 +9616,202 @@ var _wrapEntryValue = /* @__PURE__ */ __name((v) => {
|
|
|
9658
9616
|
return new StringLiteral("" + v);
|
|
9659
9617
|
}, "_wrapEntryValue");
|
|
9660
9618
|
|
|
9619
|
+
// ../../build/common/esm/document/utils/generate-codec.js
|
|
9620
|
+
import * as vg3 from "valgen";
|
|
9621
|
+
|
|
9622
|
+
// ../../build/common/esm/document/data-type/mapped-type.js
|
|
9623
|
+
import "reflect-metadata";
|
|
9624
|
+
import merge5 from "putil-merge";
|
|
9625
|
+
var MappedTypeClass = class extends DataType {
|
|
9626
|
+
static {
|
|
9627
|
+
__name(this, "MappedTypeClass");
|
|
9628
|
+
}
|
|
9629
|
+
constructor(document, init) {
|
|
9630
|
+
super(document, init);
|
|
9631
|
+
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
9632
|
+
const own = this.own;
|
|
9633
|
+
own.pick = init.pick;
|
|
9634
|
+
own.omit = init.omit;
|
|
9635
|
+
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
9636
|
+
this.type = init.type;
|
|
9637
|
+
this.pick = own.pick;
|
|
9638
|
+
this.omit = own.omit;
|
|
9639
|
+
this.fields = new ResponsiveMap();
|
|
9640
|
+
this.additionalFields = this.type.additionalFields;
|
|
9641
|
+
const isInheritedPredicate = getIsInheritedPredicateFn(init.pick, init.omit);
|
|
9642
|
+
for (const [elemName, elem] of this.type.fields.entries()) {
|
|
9643
|
+
if (isInheritedPredicate(elemName))
|
|
9644
|
+
this.fields.set(elemName, elem);
|
|
9645
|
+
}
|
|
9646
|
+
}
|
|
9647
|
+
exportSchema() {
|
|
9648
|
+
const out = DataType.prototype.exportSchema.call(this);
|
|
9649
|
+
Object.assign(out, omitUndefined({
|
|
9650
|
+
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
9651
|
+
pick: this.own.pick,
|
|
9652
|
+
omit: this.own.omit
|
|
9653
|
+
}));
|
|
9654
|
+
return out;
|
|
9655
|
+
}
|
|
9656
|
+
};
|
|
9657
|
+
var MappedType2 = /* @__PURE__ */ __name(function(...args) {
|
|
9658
|
+
if (this) {
|
|
9659
|
+
const [document, init] = args;
|
|
9660
|
+
merge5(this, new MappedTypeClass(document, init), { descriptor: true });
|
|
9661
|
+
return;
|
|
9662
|
+
}
|
|
9663
|
+
const [source, options] = args;
|
|
9664
|
+
const isInheritedPredicate = getIsInheritedPredicateFn(options.pick, options.omit);
|
|
9665
|
+
class MappedClass {
|
|
9666
|
+
static {
|
|
9667
|
+
__name(this, "MappedClass");
|
|
9668
|
+
}
|
|
9669
|
+
constructor() {
|
|
9670
|
+
inheritPropertyInitializers(this, source, isInheritedPredicate);
|
|
9671
|
+
}
|
|
9672
|
+
}
|
|
9673
|
+
mergePrototype(MappedClass.prototype, source.prototype);
|
|
9674
|
+
const m = Reflect.getOwnMetadata(METADATA_KEY, source);
|
|
9675
|
+
if (!m)
|
|
9676
|
+
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
9677
|
+
if (!(m.kind === opra_schema_ns_exports.ComplexType.Kind))
|
|
9678
|
+
throw new TypeError(`Class "${source}" is not a ${opra_schema_ns_exports.ComplexType.Kind}`);
|
|
9679
|
+
const metadata = {
|
|
9680
|
+
kind: "MappedType",
|
|
9681
|
+
type: source
|
|
9682
|
+
};
|
|
9683
|
+
if (options.pick)
|
|
9684
|
+
metadata.pick = options.pick;
|
|
9685
|
+
if (options.omit)
|
|
9686
|
+
metadata.omit = options.omit;
|
|
9687
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, MappedClass);
|
|
9688
|
+
MappedType2._applyMixin(MappedClass, source, {
|
|
9689
|
+
...options,
|
|
9690
|
+
isInheritedPredicate
|
|
9691
|
+
});
|
|
9692
|
+
return MappedClass;
|
|
9693
|
+
}, "MappedType");
|
|
9694
|
+
MappedType2.prototype = MappedTypeClass.prototype;
|
|
9695
|
+
MappedType2._applyMixin = () => void 0;
|
|
9696
|
+
function getIsInheritedPredicateFn(pick, omit7) {
|
|
9697
|
+
const pickKeys = pick?.map((x) => String(x).toLowerCase());
|
|
9698
|
+
const omitKeys = omit7?.map((x) => String(x).toLowerCase());
|
|
9699
|
+
return (propertyName) => {
|
|
9700
|
+
if (omitKeys && omitKeys.includes(propertyName.toLowerCase()))
|
|
9701
|
+
return false;
|
|
9702
|
+
if (pickKeys)
|
|
9703
|
+
return pickKeys.includes(propertyName.toLowerCase());
|
|
9704
|
+
return true;
|
|
9705
|
+
};
|
|
9706
|
+
}
|
|
9707
|
+
__name(getIsInheritedPredicateFn, "getIsInheritedPredicateFn");
|
|
9708
|
+
function PickType(classRef, keys) {
|
|
9709
|
+
return MappedType2(classRef, { pick: keys });
|
|
9710
|
+
}
|
|
9711
|
+
__name(PickType, "PickType");
|
|
9712
|
+
function OmitType(classRef, keys) {
|
|
9713
|
+
return MappedType2(classRef, { omit: keys });
|
|
9714
|
+
}
|
|
9715
|
+
__name(OmitType, "OmitType");
|
|
9716
|
+
|
|
9717
|
+
// ../../build/common/esm/document/data-type/union-type.js
|
|
9718
|
+
import "reflect-metadata";
|
|
9719
|
+
import merge6 from "putil-merge";
|
|
9720
|
+
var UnionTypeClass = class extends DataType {
|
|
9721
|
+
static {
|
|
9722
|
+
__name(this, "UnionTypeClass");
|
|
9723
|
+
}
|
|
9724
|
+
constructor(document, init) {
|
|
9725
|
+
super(document, init);
|
|
9726
|
+
this.kind = opra_schema_ns_exports.UnionType.Kind;
|
|
9727
|
+
this.fields = new ResponsiveMap();
|
|
9728
|
+
const own = this.own;
|
|
9729
|
+
own.types = [];
|
|
9730
|
+
for (const base of init.types) {
|
|
9731
|
+
if (!(base instanceof ComplexType2 || base instanceof UnionType2 || base instanceof MappedType2))
|
|
9732
|
+
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.`);
|
|
9733
|
+
own.types.push(base);
|
|
9734
|
+
if (base.additionalFields)
|
|
9735
|
+
this.additionalFields = base.additionalFields;
|
|
9736
|
+
this.fields.setAll(base.fields);
|
|
9737
|
+
}
|
|
9738
|
+
this.types = [...own.types];
|
|
9739
|
+
}
|
|
9740
|
+
exportSchema() {
|
|
9741
|
+
const out = super.exportSchema();
|
|
9742
|
+
Object.assign(out, omitUndefined({
|
|
9743
|
+
types: this.own.types.map((t) => t.name ? t.name : t.exportSchema())
|
|
9744
|
+
}));
|
|
9745
|
+
return out;
|
|
9746
|
+
}
|
|
9747
|
+
};
|
|
9748
|
+
var UnionType2 = /* @__PURE__ */ __name(function(...args) {
|
|
9749
|
+
if (this) {
|
|
9750
|
+
const [document, init] = args;
|
|
9751
|
+
merge6(this, new UnionTypeClass(document, init), { descriptor: true });
|
|
9752
|
+
return;
|
|
9753
|
+
}
|
|
9754
|
+
const clasRefs = [...args].filter((x) => !!x);
|
|
9755
|
+
if (!clasRefs.length)
|
|
9756
|
+
throw new TypeError("No Class has been provided");
|
|
9757
|
+
if (clasRefs.length === 1)
|
|
9758
|
+
return clasRefs[0];
|
|
9759
|
+
class UnionClass {
|
|
9760
|
+
static {
|
|
9761
|
+
__name(this, "UnionClass");
|
|
9762
|
+
}
|
|
9763
|
+
constructor() {
|
|
9764
|
+
for (const c of clasRefs)
|
|
9765
|
+
inheritPropertyInitializers(this, c);
|
|
9766
|
+
}
|
|
9767
|
+
}
|
|
9768
|
+
const metadata = {
|
|
9769
|
+
kind: opra_schema_ns_exports.UnionType.Kind,
|
|
9770
|
+
types: []
|
|
9771
|
+
};
|
|
9772
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, UnionClass);
|
|
9773
|
+
for (const c of clasRefs) {
|
|
9774
|
+
const itemMeta = Reflect.getMetadata(METADATA_KEY, c);
|
|
9775
|
+
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)))
|
|
9776
|
+
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}`);
|
|
9777
|
+
metadata.types.push(c);
|
|
9778
|
+
mergePrototype(UnionClass.prototype, c.prototype);
|
|
9779
|
+
}
|
|
9780
|
+
UnionType2._applyMixin(UnionClass, ...clasRefs);
|
|
9781
|
+
return UnionClass;
|
|
9782
|
+
}, "UnionType");
|
|
9783
|
+
UnionType2.prototype = UnionTypeClass.prototype;
|
|
9784
|
+
UnionType2._applyMixin = () => void 0;
|
|
9785
|
+
|
|
9786
|
+
// ../../build/common/esm/document/utils/generate-codec.js
|
|
9787
|
+
function generateCodec(type, codec, options) {
|
|
9788
|
+
return _generateDecoder(type, codec, options);
|
|
9789
|
+
}
|
|
9790
|
+
__name(generateCodec, "generateCodec");
|
|
9791
|
+
function _generateDecoder(type, codec, options) {
|
|
9792
|
+
const schema = {};
|
|
9793
|
+
for (const f of type.fields.values()) {
|
|
9794
|
+
let fn;
|
|
9795
|
+
if (f.type instanceof SimpleType2 || f.type instanceof EnumType2) {
|
|
9796
|
+
fn = f.type[codec];
|
|
9797
|
+
} else if (f.type instanceof ComplexType2 || f.type instanceof MappedType2 || f.type instanceof UnionType2) {
|
|
9798
|
+
fn = _generateDecoder(f.type, codec, options);
|
|
9799
|
+
}
|
|
9800
|
+
if (!fn)
|
|
9801
|
+
throw new TypeError(`Can't generate codec for (${f.type})`);
|
|
9802
|
+
if (f.isArray)
|
|
9803
|
+
fn = vg3.isArray(fn);
|
|
9804
|
+
schema[f.name] = !options.partial && f.required ? vg3.required(fn) : vg3.optional(fn);
|
|
9805
|
+
}
|
|
9806
|
+
return vg3.isObject(schema, {
|
|
9807
|
+
ctor: type.ctor,
|
|
9808
|
+
additionalFields: type.additionalFields ?? false,
|
|
9809
|
+
name: type.name,
|
|
9810
|
+
caseInSensitive: true
|
|
9811
|
+
});
|
|
9812
|
+
}
|
|
9813
|
+
__name(_generateDecoder, "_generateDecoder");
|
|
9814
|
+
|
|
9661
9815
|
// ../../build/common/esm/document/resource/resource.js
|
|
9662
9816
|
var Resource = class {
|
|
9663
9817
|
static {
|
|
@@ -9692,9 +9846,11 @@ var CollectionClass = class extends Resource {
|
|
|
9692
9846
|
}
|
|
9693
9847
|
constructor(document, init) {
|
|
9694
9848
|
super(document, init);
|
|
9849
|
+
this._decoders = {};
|
|
9850
|
+
this._encoders = {};
|
|
9695
9851
|
this.kind = opra_schema_ns_exports.Collection.Kind;
|
|
9696
9852
|
this.controller = init.controller;
|
|
9697
|
-
|
|
9853
|
+
this.operations = { ...init.operations };
|
|
9698
9854
|
const dataType = this.type = init.type;
|
|
9699
9855
|
this.primaryKey = init.primaryKey ? Array.isArray(init.primaryKey) ? init.primaryKey : [init.primaryKey] : [];
|
|
9700
9856
|
if (!this.primaryKey.length)
|
|
@@ -9704,17 +9860,6 @@ var CollectionClass = class extends Resource {
|
|
|
9704
9860
|
if (!(field?.type instanceof SimpleType2))
|
|
9705
9861
|
throw new TypeError(`Only Simple type allowed for primary keys but "${f}" is a ${field.type.kind}`);
|
|
9706
9862
|
});
|
|
9707
|
-
if (this.controller) {
|
|
9708
|
-
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9709
|
-
for (const operation of Object.values(operations)) {
|
|
9710
|
-
if (!operation.handler && operation.handlerName) {
|
|
9711
|
-
const fn = instance[operation.handlerName];
|
|
9712
|
-
if (!fn)
|
|
9713
|
-
throw new TypeError(`No such operation handler (${operation.handlerName}) found`);
|
|
9714
|
-
operation.handler = fn.bind(instance);
|
|
9715
|
-
}
|
|
9716
|
-
}
|
|
9717
|
-
}
|
|
9718
9863
|
}
|
|
9719
9864
|
exportSchema() {
|
|
9720
9865
|
const out = Resource.prototype.exportSchema.call(this);
|
|
@@ -9736,7 +9881,8 @@ var CollectionClass = class extends Resource {
|
|
|
9736
9881
|
}, {}) : value;
|
|
9737
9882
|
for (const [k, v] of Object.entries(obj)) {
|
|
9738
9883
|
const el = dataType.getField(k);
|
|
9739
|
-
|
|
9884
|
+
if (el.type instanceof SimpleType2)
|
|
9885
|
+
obj[k] = el.type.decode(v);
|
|
9740
9886
|
if (obj[k] == null)
|
|
9741
9887
|
throw new TypeError(`You must provide value of primary field(s) (${k})`);
|
|
9742
9888
|
}
|
|
@@ -9745,7 +9891,9 @@ var CollectionClass = class extends Resource {
|
|
|
9745
9891
|
if (typeof value === "object")
|
|
9746
9892
|
value = value[primaryKey];
|
|
9747
9893
|
const el = dataType.getField(primaryKey);
|
|
9748
|
-
|
|
9894
|
+
let result;
|
|
9895
|
+
if (el.type instanceof SimpleType2)
|
|
9896
|
+
result = el.type.decode(value);
|
|
9749
9897
|
if (result == null)
|
|
9750
9898
|
throw new TypeError(`You must provide value of primary field(s) (${primaryKey})`);
|
|
9751
9899
|
return result;
|
|
@@ -9756,12 +9904,14 @@ var CollectionClass = class extends Resource {
|
|
|
9756
9904
|
}
|
|
9757
9905
|
normalizeSortFields(fields) {
|
|
9758
9906
|
const normalized = this.type.normalizeFieldPath(fields);
|
|
9759
|
-
|
|
9760
|
-
|
|
9907
|
+
if (!normalized)
|
|
9908
|
+
return;
|
|
9909
|
+
const findManyOp = this.operations.findMany;
|
|
9910
|
+
const sortFields = findManyOp && findManyOp.sortFields;
|
|
9761
9911
|
(Array.isArray(normalized) ? normalized : [normalized]).forEach((field) => {
|
|
9762
9912
|
if (!sortFields?.find((x) => x === field))
|
|
9763
9913
|
throw new BadRequestError({
|
|
9764
|
-
message: translate("error:UNACCEPTED_SORT_FIELD", { field }
|
|
9914
|
+
message: translate("error:UNACCEPTED_SORT_FIELD", { field })
|
|
9765
9915
|
});
|
|
9766
9916
|
});
|
|
9767
9917
|
return normalized;
|
|
@@ -9774,22 +9924,72 @@ var CollectionClass = class extends Resource {
|
|
|
9774
9924
|
this.normalizeFilter(ast.left);
|
|
9775
9925
|
if (!(ast.left instanceof opra_filter_ns_exports.QualifiedIdentifier && ast.left.field))
|
|
9776
9926
|
throw new TypeError(`Invalid filter query. Left side should be a data field.`);
|
|
9927
|
+
const findManyOp = this.operations.findMany;
|
|
9928
|
+
const fieldLower = ast.left.value.toLowerCase();
|
|
9929
|
+
const filterDef = (findManyOp && findManyOp.filters || []).find((f) => f.field.toLowerCase() === fieldLower);
|
|
9930
|
+
if (!filterDef) {
|
|
9931
|
+
throw new BadRequestError({
|
|
9932
|
+
message: translate("error:UNACCEPTED_FILTER_FIELD", { field: ast.left.value })
|
|
9933
|
+
});
|
|
9934
|
+
}
|
|
9935
|
+
if (!filterDef.operators?.includes(ast.op))
|
|
9936
|
+
throw new BadRequestError({
|
|
9937
|
+
message: translate("error:UNACCEPTED_FILTER_OPERATION", { field: ast.left.value })
|
|
9938
|
+
});
|
|
9777
9939
|
this.normalizeFilter(ast.right);
|
|
9778
|
-
|
|
9940
|
+
return ast;
|
|
9941
|
+
}
|
|
9942
|
+
if (ast instanceof opra_filter_ns_exports.LogicalExpression) {
|
|
9779
9943
|
ast.items.forEach((item) => this.normalizeFilter(item));
|
|
9780
|
-
|
|
9944
|
+
return ast;
|
|
9945
|
+
}
|
|
9946
|
+
if (ast instanceof opra_filter_ns_exports.ArithmeticExpression) {
|
|
9781
9947
|
ast.items.forEach((item) => this.normalizeFilter(item.expression));
|
|
9782
|
-
|
|
9948
|
+
return ast;
|
|
9949
|
+
}
|
|
9950
|
+
if (ast instanceof opra_filter_ns_exports.ArrayExpression) {
|
|
9783
9951
|
ast.items.forEach((item) => this.normalizeFilter(item));
|
|
9784
|
-
|
|
9952
|
+
return ast;
|
|
9953
|
+
}
|
|
9954
|
+
if (ast instanceof opra_filter_ns_exports.ParenthesizedExpression) {
|
|
9785
9955
|
this.normalizeFilter(ast.expression);
|
|
9786
|
-
|
|
9787
|
-
|
|
9956
|
+
return ast;
|
|
9957
|
+
}
|
|
9958
|
+
if (ast instanceof opra_filter_ns_exports.QualifiedIdentifier) {
|
|
9959
|
+
const normalizedFieldPath = this.type.normalizeFieldPath(ast.value)?.join(".");
|
|
9960
|
+
ast.field = this.type.getField(normalizedFieldPath);
|
|
9788
9961
|
ast.dataType = ast.field?.type || this.document.getDataType("any");
|
|
9789
|
-
ast.value =
|
|
9962
|
+
ast.value = normalizedFieldPath;
|
|
9963
|
+
return ast;
|
|
9790
9964
|
}
|
|
9791
9965
|
return ast;
|
|
9792
9966
|
}
|
|
9967
|
+
getDecoder(operation) {
|
|
9968
|
+
let decoder = this._decoders[operation];
|
|
9969
|
+
if (decoder)
|
|
9970
|
+
return decoder;
|
|
9971
|
+
const options = {
|
|
9972
|
+
partial: operation !== "create"
|
|
9973
|
+
};
|
|
9974
|
+
if (operation !== "create")
|
|
9975
|
+
options.omit = [...this.primaryKey];
|
|
9976
|
+
decoder = generateCodec(this.type, "decode", options);
|
|
9977
|
+
this._decoders[operation] = decoder;
|
|
9978
|
+
return decoder;
|
|
9979
|
+
}
|
|
9980
|
+
getEncoder(operation) {
|
|
9981
|
+
let encoder = this._encoders[operation];
|
|
9982
|
+
if (encoder)
|
|
9983
|
+
return encoder;
|
|
9984
|
+
const options = {
|
|
9985
|
+
partial: true
|
|
9986
|
+
};
|
|
9987
|
+
encoder = generateCodec(this.type, "encode", options);
|
|
9988
|
+
if (operation === "findMany")
|
|
9989
|
+
return vg4.isArray(encoder);
|
|
9990
|
+
this._encoders[operation] = encoder;
|
|
9991
|
+
return encoder;
|
|
9992
|
+
}
|
|
9793
9993
|
};
|
|
9794
9994
|
var Collection2 = /* @__PURE__ */ __name(function(...args) {
|
|
9795
9995
|
if (!this) {
|
|
@@ -9799,7 +9999,7 @@ var Collection2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
9799
9999
|
const metadata = Reflect.getOwnMetadata(METADATA_KEY, target) || {};
|
|
9800
10000
|
const baseMetadata = Reflect.getOwnMetadata(METADATA_KEY, Object.getPrototypeOf(target));
|
|
9801
10001
|
if (baseMetadata) {
|
|
9802
|
-
|
|
10002
|
+
merge7(metadata, baseMetadata, { deep: true });
|
|
9803
10003
|
}
|
|
9804
10004
|
metadata.kind = opra_schema_ns_exports.Collection.Kind;
|
|
9805
10005
|
metadata.name = name;
|
|
@@ -9814,18 +10014,17 @@ var Collection2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
9814
10014
|
};
|
|
9815
10015
|
}
|
|
9816
10016
|
const [document, init] = args;
|
|
9817
|
-
|
|
10017
|
+
merge7(this, new CollectionClass(document, init), { descriptor: true });
|
|
9818
10018
|
}, "Collection");
|
|
9819
10019
|
Collection2.prototype = CollectionClass.prototype;
|
|
9820
10020
|
function createOperationDecorator(operation) {
|
|
9821
10021
|
return (options) => (target, propertyKey) => {
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
};
|
|
10022
|
+
if (propertyKey !== operation)
|
|
10023
|
+
throw new TypeError(`Name of the handler name should be '${operation}'`);
|
|
10024
|
+
const operationMeta = { ...options };
|
|
9826
10025
|
const resourceMetadata = Reflect.getOwnMetadata(METADATA_KEY, target.constructor) || {};
|
|
9827
10026
|
resourceMetadata.operations = resourceMetadata.operations || {};
|
|
9828
|
-
resourceMetadata.operations[operation] =
|
|
10027
|
+
resourceMetadata.operations[operation] = operationMeta;
|
|
9829
10028
|
Reflect.defineMetadata(METADATA_KEY, resourceMetadata, target.constructor);
|
|
9830
10029
|
};
|
|
9831
10030
|
}
|
|
@@ -9840,7 +10039,7 @@ Collection2.UpdateMany = createOperationDecorator("updateMany");
|
|
|
9840
10039
|
|
|
9841
10040
|
// ../../build/common/esm/document/resource/singleton.js
|
|
9842
10041
|
import omit5 from "lodash.omit";
|
|
9843
|
-
import
|
|
10042
|
+
import merge8 from "putil-merge";
|
|
9844
10043
|
var NESTJS_INJECTABLE_WATERMARK2 = "__injectable__";
|
|
9845
10044
|
var NAME_PATTERN2 = /^(.*)(Resource|Singleton)$/;
|
|
9846
10045
|
var SingletonClass = class extends Resource {
|
|
@@ -9849,21 +10048,12 @@ var SingletonClass = class extends Resource {
|
|
|
9849
10048
|
}
|
|
9850
10049
|
constructor(document, init) {
|
|
9851
10050
|
super(document, init);
|
|
10051
|
+
this._decoders = {};
|
|
10052
|
+
this._encoders = {};
|
|
9852
10053
|
this.kind = opra_schema_ns_exports.Singleton.Kind;
|
|
9853
10054
|
this.controller = init.controller;
|
|
9854
|
-
|
|
10055
|
+
this.operations = { ...init.operations };
|
|
9855
10056
|
this.type = init.type;
|
|
9856
|
-
if (this.controller) {
|
|
9857
|
-
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9858
|
-
for (const operation of Object.values(operations)) {
|
|
9859
|
-
if (!operation.handler && operation.handlerName) {
|
|
9860
|
-
const fn = instance[operation.handlerName];
|
|
9861
|
-
if (!fn)
|
|
9862
|
-
throw new TypeError(`No such operation handler (${operation.handlerName}) found`);
|
|
9863
|
-
operation.handler = fn.bind(instance);
|
|
9864
|
-
}
|
|
9865
|
-
}
|
|
9866
|
-
}
|
|
9867
10057
|
}
|
|
9868
10058
|
exportSchema() {
|
|
9869
10059
|
const out = Resource.prototype.exportSchema.call(this);
|
|
@@ -9876,6 +10066,28 @@ var SingletonClass = class extends Resource {
|
|
|
9876
10066
|
normalizeFieldPath(path2) {
|
|
9877
10067
|
return this.type.normalizeFieldPath(path2);
|
|
9878
10068
|
}
|
|
10069
|
+
getDecoder(operation) {
|
|
10070
|
+
let decoder = this._decoders[operation];
|
|
10071
|
+
if (decoder)
|
|
10072
|
+
return decoder;
|
|
10073
|
+
const options = {
|
|
10074
|
+
partial: operation !== "create"
|
|
10075
|
+
};
|
|
10076
|
+
decoder = generateCodec(this.type, "decode", options);
|
|
10077
|
+
this._decoders[operation] = decoder;
|
|
10078
|
+
return decoder;
|
|
10079
|
+
}
|
|
10080
|
+
getEncoder(operation) {
|
|
10081
|
+
let encoder = this._encoders[operation];
|
|
10082
|
+
if (encoder)
|
|
10083
|
+
return encoder;
|
|
10084
|
+
const options = {
|
|
10085
|
+
partial: true
|
|
10086
|
+
};
|
|
10087
|
+
encoder = generateCodec(this.type, "encode", options);
|
|
10088
|
+
this._encoders[operation] = encoder;
|
|
10089
|
+
return encoder;
|
|
10090
|
+
}
|
|
9879
10091
|
};
|
|
9880
10092
|
var Singleton2 = /* @__PURE__ */ __name(function(...args) {
|
|
9881
10093
|
if (!this) {
|
|
@@ -9896,18 +10108,17 @@ var Singleton2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
9896
10108
|
};
|
|
9897
10109
|
}
|
|
9898
10110
|
const [document, init] = args;
|
|
9899
|
-
|
|
10111
|
+
merge8(this, new SingletonClass(document, init), { descriptor: true });
|
|
9900
10112
|
}, "Singleton");
|
|
9901
10113
|
Singleton2.prototype = SingletonClass.prototype;
|
|
9902
10114
|
function createOperationDecorator2(operation) {
|
|
9903
10115
|
return (options) => (target, propertyKey) => {
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
};
|
|
10116
|
+
if (propertyKey !== operation)
|
|
10117
|
+
throw new TypeError(`Name of the handler name should be '${operation}'`);
|
|
10118
|
+
const operationMeta = { ...options };
|
|
9908
10119
|
const resourceMetadata = Reflect.getOwnMetadata(METADATA_KEY, target.constructor) || {};
|
|
9909
10120
|
resourceMetadata.operations = resourceMetadata.operations || {};
|
|
9910
|
-
resourceMetadata.operations[operation] =
|
|
10121
|
+
resourceMetadata.operations[operation] = operationMeta;
|
|
9911
10122
|
Reflect.defineMetadata(METADATA_KEY, resourceMetadata, target.constructor);
|
|
9912
10123
|
};
|
|
9913
10124
|
}
|
|
@@ -9919,7 +10130,7 @@ Singleton2.Update = createOperationDecorator2("update");
|
|
|
9919
10130
|
|
|
9920
10131
|
// ../../build/common/esm/document/resource/storage.js
|
|
9921
10132
|
import omit6 from "lodash.omit";
|
|
9922
|
-
import
|
|
10133
|
+
import merge9 from "putil-merge";
|
|
9923
10134
|
var NESTJS_INJECTABLE_WATERMARK3 = "__injectable__";
|
|
9924
10135
|
var NAME_PATTERN3 = /^(.*)(Resource)$/;
|
|
9925
10136
|
var StorageClass = class extends Resource {
|
|
@@ -9930,18 +10141,7 @@ var StorageClass = class extends Resource {
|
|
|
9930
10141
|
super(document, init);
|
|
9931
10142
|
this.kind = opra_schema_ns_exports.Storage.Kind;
|
|
9932
10143
|
this.controller = init.controller;
|
|
9933
|
-
|
|
9934
|
-
if (this.controller) {
|
|
9935
|
-
const instance = typeof this.controller == "function" ? new this.controller() : this.controller;
|
|
9936
|
-
for (const operation of Object.values(operations)) {
|
|
9937
|
-
if (!operation.handler && operation.handlerName) {
|
|
9938
|
-
const fn = instance[operation.handlerName];
|
|
9939
|
-
if (!fn)
|
|
9940
|
-
throw new TypeError(`No such operation handler (${operation.handlerName}) found`);
|
|
9941
|
-
operation.handler = fn.bind(instance);
|
|
9942
|
-
}
|
|
9943
|
-
}
|
|
9944
|
-
}
|
|
10144
|
+
this.operations = { ...init.operations };
|
|
9945
10145
|
}
|
|
9946
10146
|
exportSchema() {
|
|
9947
10147
|
const out = Resource.prototype.exportSchema.call(this);
|
|
@@ -9969,25 +10169,24 @@ var Storage2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
9969
10169
|
};
|
|
9970
10170
|
}
|
|
9971
10171
|
const [document, init] = args;
|
|
9972
|
-
|
|
10172
|
+
merge9(this, new StorageClass(document, init), { descriptor: true });
|
|
9973
10173
|
}, "Storage");
|
|
9974
10174
|
Storage2.prototype = StorageClass.prototype;
|
|
9975
10175
|
function createOperationDecorator3(operation) {
|
|
9976
10176
|
return (options) => (target, propertyKey) => {
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
};
|
|
10177
|
+
if (propertyKey !== operation)
|
|
10178
|
+
throw new TypeError(`Name of the handler name should be '${operation}'`);
|
|
10179
|
+
const operationMeta = { ...options };
|
|
9981
10180
|
const resourceMetadata = Reflect.getOwnMetadata(METADATA_KEY, target.constructor) || {};
|
|
9982
10181
|
resourceMetadata.operations = resourceMetadata.operations || {};
|
|
9983
|
-
resourceMetadata.operations[operation] =
|
|
10182
|
+
resourceMetadata.operations[operation] = operationMeta;
|
|
9984
10183
|
Reflect.defineMetadata(METADATA_KEY, resourceMetadata, target.constructor);
|
|
9985
10184
|
};
|
|
9986
10185
|
}
|
|
9987
10186
|
__name(createOperationDecorator3, "createOperationDecorator");
|
|
9988
10187
|
Storage2.Delete = createOperationDecorator3("delete");
|
|
9989
10188
|
Storage2.Get = createOperationDecorator3("get");
|
|
9990
|
-
Storage2.
|
|
10189
|
+
Storage2.Post = createOperationDecorator3("post");
|
|
9991
10190
|
|
|
9992
10191
|
// ../../build/common/esm/document/factory/process-resources.js
|
|
9993
10192
|
async function processResourceQueue() {
|
|
@@ -10053,242 +10252,6 @@ async function createFileResource(name, schema) {
|
|
|
10053
10252
|
}
|
|
10054
10253
|
__name(createFileResource, "createFileResource");
|
|
10055
10254
|
|
|
10056
|
-
// ../../build/common/esm/document/data-type/mapped-type.js
|
|
10057
|
-
import "reflect-metadata";
|
|
10058
|
-
import merge8 from "putil-merge";
|
|
10059
|
-
import * as vg4 from "valgen";
|
|
10060
|
-
var MappedTypeClass = class extends DataType {
|
|
10061
|
-
static {
|
|
10062
|
-
__name(this, "MappedTypeClass");
|
|
10063
|
-
}
|
|
10064
|
-
constructor(document, init) {
|
|
10065
|
-
super(document, init);
|
|
10066
|
-
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
10067
|
-
const own = this.own;
|
|
10068
|
-
own.pick = init.pick;
|
|
10069
|
-
own.omit = init.omit;
|
|
10070
|
-
this.kind = opra_schema_ns_exports.MappedType.Kind;
|
|
10071
|
-
this.type = init.type;
|
|
10072
|
-
this.pick = own.pick;
|
|
10073
|
-
this.omit = own.omit;
|
|
10074
|
-
this.fields = new ResponsiveMap();
|
|
10075
|
-
this.additionalFields = this.type.additionalFields;
|
|
10076
|
-
const isInheritedPredicate = getIsInheritedPredicateFn(init.pick, init.omit);
|
|
10077
|
-
for (const [elemName, elem] of this.type.fields.entries()) {
|
|
10078
|
-
if (isInheritedPredicate(elemName))
|
|
10079
|
-
this.fields.set(elemName, elem);
|
|
10080
|
-
}
|
|
10081
|
-
}
|
|
10082
|
-
exportSchema() {
|
|
10083
|
-
const out = DataType.prototype.exportSchema.call(this);
|
|
10084
|
-
Object.assign(out, omitUndefined({
|
|
10085
|
-
type: this.type.name ? this.type.name : this.type.exportSchema(),
|
|
10086
|
-
pick: this.own.pick,
|
|
10087
|
-
omit: this.own.omit
|
|
10088
|
-
}));
|
|
10089
|
-
return out;
|
|
10090
|
-
}
|
|
10091
|
-
_getDecoder() {
|
|
10092
|
-
if (this._decoder)
|
|
10093
|
-
return this._decoder;
|
|
10094
|
-
const schema = {};
|
|
10095
|
-
for (const f of this.fields.values()) {
|
|
10096
|
-
let t = f.type.getDecoder();
|
|
10097
|
-
if (f.isArray)
|
|
10098
|
-
t = vg4.isArray(t);
|
|
10099
|
-
schema[f.name] = t;
|
|
10100
|
-
}
|
|
10101
|
-
this._decoder = vg4.isObject(schema, {
|
|
10102
|
-
additionalFields: this.additionalFields,
|
|
10103
|
-
name: this.name,
|
|
10104
|
-
caseInSensitive: true
|
|
10105
|
-
});
|
|
10106
|
-
return this._decoder;
|
|
10107
|
-
}
|
|
10108
|
-
_getEncoder() {
|
|
10109
|
-
if (this._encoder)
|
|
10110
|
-
return this._encoder;
|
|
10111
|
-
const schema = {};
|
|
10112
|
-
for (const f of this.fields.values()) {
|
|
10113
|
-
let t = f.type.getEncoder();
|
|
10114
|
-
if (f.isArray)
|
|
10115
|
-
t = vg4.isArray(t);
|
|
10116
|
-
schema[f.name] = t;
|
|
10117
|
-
}
|
|
10118
|
-
this._encoder = vg4.isObject(schema, {
|
|
10119
|
-
additionalFields: this.additionalFields,
|
|
10120
|
-
name: this.name,
|
|
10121
|
-
caseInSensitive: true,
|
|
10122
|
-
detectCircular: true
|
|
10123
|
-
});
|
|
10124
|
-
return this._encoder;
|
|
10125
|
-
}
|
|
10126
|
-
};
|
|
10127
|
-
var MappedType2 = /* @__PURE__ */ __name(function(...args) {
|
|
10128
|
-
if (this) {
|
|
10129
|
-
const [document, init] = args;
|
|
10130
|
-
merge8(this, new MappedTypeClass(document, init), { descriptor: true });
|
|
10131
|
-
return;
|
|
10132
|
-
}
|
|
10133
|
-
const [source, options] = args;
|
|
10134
|
-
const isInheritedPredicate = getIsInheritedPredicateFn(options.pick, options.omit);
|
|
10135
|
-
class MappedClass {
|
|
10136
|
-
static {
|
|
10137
|
-
__name(this, "MappedClass");
|
|
10138
|
-
}
|
|
10139
|
-
constructor() {
|
|
10140
|
-
inheritPropertyInitializers(this, source, isInheritedPredicate);
|
|
10141
|
-
}
|
|
10142
|
-
}
|
|
10143
|
-
mergePrototype(MappedClass.prototype, source.prototype);
|
|
10144
|
-
const m = Reflect.getOwnMetadata(METADATA_KEY, source);
|
|
10145
|
-
if (!m)
|
|
10146
|
-
throw new TypeError(`Class "${source}" doesn't have datatype metadata information`);
|
|
10147
|
-
if (!(m.kind === opra_schema_ns_exports.ComplexType.Kind))
|
|
10148
|
-
throw new TypeError(`Class "${source}" is not a ${opra_schema_ns_exports.ComplexType.Kind}`);
|
|
10149
|
-
const metadata = {
|
|
10150
|
-
kind: "MappedType",
|
|
10151
|
-
type: source
|
|
10152
|
-
};
|
|
10153
|
-
if (options.pick)
|
|
10154
|
-
metadata.pick = options.pick;
|
|
10155
|
-
if (options.omit)
|
|
10156
|
-
metadata.omit = options.omit;
|
|
10157
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, MappedClass);
|
|
10158
|
-
MappedType2._applyMixin(MappedClass, source, {
|
|
10159
|
-
...options,
|
|
10160
|
-
isInheritedPredicate
|
|
10161
|
-
});
|
|
10162
|
-
return MappedClass;
|
|
10163
|
-
}, "MappedType");
|
|
10164
|
-
MappedType2.prototype = MappedTypeClass.prototype;
|
|
10165
|
-
MappedType2._applyMixin = () => void 0;
|
|
10166
|
-
function getIsInheritedPredicateFn(pick, omit7) {
|
|
10167
|
-
const pickKeys = pick?.map((x) => String(x).toLowerCase());
|
|
10168
|
-
const omitKeys = omit7?.map((x) => String(x).toLowerCase());
|
|
10169
|
-
return (propertyName) => {
|
|
10170
|
-
if (omitKeys && omitKeys.includes(propertyName.toLowerCase()))
|
|
10171
|
-
return false;
|
|
10172
|
-
if (pickKeys)
|
|
10173
|
-
return pickKeys.includes(propertyName.toLowerCase());
|
|
10174
|
-
return true;
|
|
10175
|
-
};
|
|
10176
|
-
}
|
|
10177
|
-
__name(getIsInheritedPredicateFn, "getIsInheritedPredicateFn");
|
|
10178
|
-
function PickType(classRef, keys) {
|
|
10179
|
-
return MappedType2(classRef, { pick: keys });
|
|
10180
|
-
}
|
|
10181
|
-
__name(PickType, "PickType");
|
|
10182
|
-
function OmitType(classRef, keys) {
|
|
10183
|
-
return MappedType2(classRef, { omit: keys });
|
|
10184
|
-
}
|
|
10185
|
-
__name(OmitType, "OmitType");
|
|
10186
|
-
|
|
10187
|
-
// ../../build/common/esm/document/data-type/union-type.js
|
|
10188
|
-
import "reflect-metadata";
|
|
10189
|
-
import merge9 from "putil-merge";
|
|
10190
|
-
import * as vg5 from "valgen";
|
|
10191
|
-
var UnionTypeClass = class extends DataType {
|
|
10192
|
-
static {
|
|
10193
|
-
__name(this, "UnionTypeClass");
|
|
10194
|
-
}
|
|
10195
|
-
constructor(document, init) {
|
|
10196
|
-
super(document, init);
|
|
10197
|
-
this.kind = opra_schema_ns_exports.UnionType.Kind;
|
|
10198
|
-
this.fields = new ResponsiveMap();
|
|
10199
|
-
const own = this.own;
|
|
10200
|
-
own.types = [];
|
|
10201
|
-
for (const base of init.types) {
|
|
10202
|
-
if (!(base instanceof ComplexType2 || base instanceof UnionType2 || base instanceof MappedType2))
|
|
10203
|
-
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.`);
|
|
10204
|
-
own.types.push(base);
|
|
10205
|
-
if (base.additionalFields)
|
|
10206
|
-
this.additionalFields = true;
|
|
10207
|
-
this.fields.setAll(base.fields);
|
|
10208
|
-
}
|
|
10209
|
-
this.types = [...own.types];
|
|
10210
|
-
}
|
|
10211
|
-
exportSchema() {
|
|
10212
|
-
const out = super.exportSchema();
|
|
10213
|
-
Object.assign(out, omitUndefined({
|
|
10214
|
-
types: this.own.types.map((t) => t.name ? t.name : t.exportSchema())
|
|
10215
|
-
}));
|
|
10216
|
-
return out;
|
|
10217
|
-
}
|
|
10218
|
-
_getDecoder() {
|
|
10219
|
-
if (this._decoder)
|
|
10220
|
-
return this._decoder;
|
|
10221
|
-
const schema = {};
|
|
10222
|
-
for (const f of this.fields.values()) {
|
|
10223
|
-
let t = f.type.getDecoder();
|
|
10224
|
-
if (f.isArray)
|
|
10225
|
-
t = vg5.isArray(t);
|
|
10226
|
-
schema[f.name] = t;
|
|
10227
|
-
}
|
|
10228
|
-
this._decoder = vg5.isObject(schema, {
|
|
10229
|
-
additionalFields: this.additionalFields,
|
|
10230
|
-
name: this.name,
|
|
10231
|
-
caseInSensitive: true
|
|
10232
|
-
});
|
|
10233
|
-
return this._decoder;
|
|
10234
|
-
}
|
|
10235
|
-
_getEncoder() {
|
|
10236
|
-
if (this._encoder)
|
|
10237
|
-
return this._encoder;
|
|
10238
|
-
const schema = {};
|
|
10239
|
-
for (const f of this.fields.values()) {
|
|
10240
|
-
let t = f.type.getEncoder();
|
|
10241
|
-
if (f.isArray)
|
|
10242
|
-
t = vg5.isArray(t);
|
|
10243
|
-
schema[f.name] = t;
|
|
10244
|
-
}
|
|
10245
|
-
this._encoder = vg5.isObject(schema, {
|
|
10246
|
-
additionalFields: this.additionalFields,
|
|
10247
|
-
name: this.name,
|
|
10248
|
-
caseInSensitive: true,
|
|
10249
|
-
detectCircular: true
|
|
10250
|
-
});
|
|
10251
|
-
return this._encoder;
|
|
10252
|
-
}
|
|
10253
|
-
};
|
|
10254
|
-
var UnionType2 = /* @__PURE__ */ __name(function(...args) {
|
|
10255
|
-
if (this) {
|
|
10256
|
-
const [document, init] = args;
|
|
10257
|
-
merge9(this, new UnionTypeClass(document, init), { descriptor: true });
|
|
10258
|
-
return;
|
|
10259
|
-
}
|
|
10260
|
-
const clasRefs = [...args].filter((x) => !!x);
|
|
10261
|
-
if (!clasRefs.length)
|
|
10262
|
-
throw new TypeError("No Class has been provided");
|
|
10263
|
-
if (clasRefs.length === 1)
|
|
10264
|
-
return clasRefs[0];
|
|
10265
|
-
class UnionClass {
|
|
10266
|
-
static {
|
|
10267
|
-
__name(this, "UnionClass");
|
|
10268
|
-
}
|
|
10269
|
-
constructor() {
|
|
10270
|
-
for (const c of clasRefs)
|
|
10271
|
-
inheritPropertyInitializers(this, c);
|
|
10272
|
-
}
|
|
10273
|
-
}
|
|
10274
|
-
const metadata = {
|
|
10275
|
-
kind: opra_schema_ns_exports.UnionType.Kind,
|
|
10276
|
-
types: []
|
|
10277
|
-
};
|
|
10278
|
-
Reflect.defineMetadata(METADATA_KEY, metadata, UnionClass);
|
|
10279
|
-
for (const c of clasRefs) {
|
|
10280
|
-
const itemMeta = Reflect.getMetadata(METADATA_KEY, c);
|
|
10281
|
-
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)))
|
|
10282
|
-
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}`);
|
|
10283
|
-
metadata.types.push(c);
|
|
10284
|
-
mergePrototype(UnionClass.prototype, c.prototype);
|
|
10285
|
-
}
|
|
10286
|
-
UnionType2._applyMixin(UnionClass, ...clasRefs);
|
|
10287
|
-
return UnionClass;
|
|
10288
|
-
}, "UnionType");
|
|
10289
|
-
UnionType2.prototype = UnionTypeClass.prototype;
|
|
10290
|
-
UnionType2._applyMixin = () => void 0;
|
|
10291
|
-
|
|
10292
10255
|
// ../../build/common/esm/document/factory/process-types.js
|
|
10293
10256
|
async function processTypes() {
|
|
10294
10257
|
const { document, typeQueue } = this;
|
|
@@ -10514,1024 +10477,286 @@ DocumentFactory.designTypeMap = /* @__PURE__ */ new Map();
|
|
|
10514
10477
|
_a2.prototype.createFileResource = createFileResource;
|
|
10515
10478
|
})();
|
|
10516
10479
|
|
|
10517
|
-
// ../../build/common/esm/http/
|
|
10518
|
-
import { splitString as
|
|
10480
|
+
// ../../build/common/esm/http/opra-url.js
|
|
10481
|
+
import { splitString as splitString3, tokenize as tokenize3 } from "fast-tokenizer";
|
|
10519
10482
|
|
|
10520
|
-
// ../../build/common/esm/http/
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
var
|
|
10483
|
+
// ../../build/common/esm/http/opra-url-path.js
|
|
10484
|
+
import { splitString as splitString2, tokenize as tokenize2 } from "fast-tokenizer";
|
|
10485
|
+
import isPlainObject2 from "putil-isplainobject";
|
|
10486
|
+
var _a3;
|
|
10487
|
+
var nodeInspectCustom2 = Symbol.for("nodejs.util.inspect.custom");
|
|
10488
|
+
var kLength = Symbol.for("kLength");
|
|
10489
|
+
var pathComponentRegEx = /^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;
|
|
10490
|
+
var decimalPattern = /^[+-]?\d+(\.\d+)?$/;
|
|
10491
|
+
var booleanPattern = /^true|false$/;
|
|
10492
|
+
var OpraURLPath = class _OpraURLPath {
|
|
10524
10493
|
static {
|
|
10525
|
-
__name(this, "
|
|
10526
|
-
}
|
|
10527
|
-
decode(value) {
|
|
10528
|
-
if (value === "")
|
|
10529
|
-
return true;
|
|
10530
|
-
if (typeof value === "boolean")
|
|
10531
|
-
return value;
|
|
10532
|
-
if (trueValues.includes(value.toLowerCase()))
|
|
10533
|
-
return true;
|
|
10534
|
-
if (falseValues.includes(value.toLowerCase()))
|
|
10535
|
-
return false;
|
|
10536
|
-
throw new TypeError(`"${value}" is not a valid boolean`);
|
|
10537
|
-
}
|
|
10538
|
-
encode(value) {
|
|
10539
|
-
return typeof value === "boolean" ? value ? "true" : "false" : "";
|
|
10494
|
+
__name(this, "OpraURLPath");
|
|
10540
10495
|
}
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
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])?))?)?$/;
|
|
10545
|
-
var DateCodec = class {
|
|
10546
|
-
static {
|
|
10547
|
-
__name(this, "DateCodec");
|
|
10496
|
+
constructor(...init) {
|
|
10497
|
+
this[_a3] = 0;
|
|
10498
|
+
this._resolve(init.filter((x) => x));
|
|
10548
10499
|
}
|
|
10549
|
-
|
|
10550
|
-
this
|
|
10551
|
-
this.min = options?.min ? coerceToDateString(options.min) : void 0;
|
|
10552
|
-
this.time = options?.time ?? true;
|
|
10553
|
-
this.timeZone = options?.timeZone ?? true;
|
|
10554
|
-
}
|
|
10555
|
-
decode(value) {
|
|
10556
|
-
const v = coerceToDateString(value, this.time, this.timeZone);
|
|
10557
|
-
if (this.min != null && v < this.min)
|
|
10558
|
-
throw new TypeError(`Value must be ${this.min} or greater.`);
|
|
10559
|
-
if (this.max != null && v > this.max)
|
|
10560
|
-
throw new TypeError(`Value must be ${this.max} or less.`);
|
|
10561
|
-
return v;
|
|
10500
|
+
get length() {
|
|
10501
|
+
return this[kLength];
|
|
10562
10502
|
}
|
|
10563
|
-
|
|
10564
|
-
|
|
10503
|
+
resolve(...items) {
|
|
10504
|
+
this._resolve(items);
|
|
10505
|
+
return this;
|
|
10565
10506
|
}
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
return "";
|
|
10570
|
-
const m = value.match(DATE_FORMAT_PATTERN);
|
|
10571
|
-
if (!m)
|
|
10572
|
-
throw new TypeError(`"${value}" is not a valid date.`);
|
|
10573
|
-
let v = m[1] + "-" + (m[2] || "01") + "-" + (m[3] || "01");
|
|
10574
|
-
if (time) {
|
|
10575
|
-
v += "T" + (m[4] || "00") + ":" + (m[5] || "00") + ":" + (m[6] || "00") + (m[7] ? "." + m[7] : "");
|
|
10576
|
-
if (timeZone)
|
|
10577
|
-
v += m[8] ? "Z" : m[9] ? m[9] + (m[10] || "00") + ":" + (m[11] || "00") : "";
|
|
10578
|
-
}
|
|
10579
|
-
return v;
|
|
10580
|
-
}
|
|
10581
|
-
__name(coerceToDateString, "coerceToDateString");
|
|
10582
|
-
|
|
10583
|
-
// ../../build/common/esm/http/codecs/filter-codec.js
|
|
10584
|
-
var FilterCodec = class {
|
|
10585
|
-
static {
|
|
10586
|
-
__name(this, "FilterCodec");
|
|
10507
|
+
join(...items) {
|
|
10508
|
+
this._resolve(items, true);
|
|
10509
|
+
return this;
|
|
10587
10510
|
}
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10511
|
+
isRelativeTo(basePath) {
|
|
10512
|
+
basePath = basePath instanceof _OpraURLPath ? basePath : new _OpraURLPath(basePath);
|
|
10513
|
+
let i;
|
|
10514
|
+
for (i = 0; i < basePath.length; i++) {
|
|
10515
|
+
if (String(this[i]) !== String(basePath[i]))
|
|
10516
|
+
return false;
|
|
10517
|
+
}
|
|
10518
|
+
return true;
|
|
10592
10519
|
}
|
|
10593
|
-
|
|
10594
|
-
|
|
10520
|
+
forEach(callback) {
|
|
10521
|
+
let i = 0;
|
|
10522
|
+
for (const item of this.values()) {
|
|
10523
|
+
callback.call(this, item, i++, this);
|
|
10524
|
+
}
|
|
10595
10525
|
}
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
__name(this, "NumberCodec");
|
|
10526
|
+
values() {
|
|
10527
|
+
const arr = new Array(this.length);
|
|
10528
|
+
for (let i = 0; i < this.length; i++)
|
|
10529
|
+
arr[i] = this[i];
|
|
10530
|
+
return arr.values();
|
|
10602
10531
|
}
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
}
|
|
10607
|
-
decode(value) {
|
|
10608
|
-
const v = typeof value === "number" ? value : parseFloat(value);
|
|
10609
|
-
if (isNaN(v))
|
|
10610
|
-
throw new TypeError(`"${value}" is not a valid number`);
|
|
10611
|
-
if (this.min != null && v < this.min)
|
|
10612
|
-
throw new TypeError(`Value must be ${this.min} or greater.`);
|
|
10613
|
-
if (this.max != null && v > this.max)
|
|
10614
|
-
throw new TypeError(`Value must be ${this.max} or less.`);
|
|
10615
|
-
return v;
|
|
10532
|
+
toString() {
|
|
10533
|
+
const v = Array.from(this).join("/");
|
|
10534
|
+
return v ? "/" + v : "";
|
|
10616
10535
|
}
|
|
10617
|
-
|
|
10618
|
-
|
|
10536
|
+
/* istanbul ignore next */
|
|
10537
|
+
[(_a3 = kLength, nodeInspectCustom2)]() {
|
|
10538
|
+
return `(UrlPath [${this.toString()}])`;
|
|
10619
10539
|
}
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10540
|
+
[Symbol.iterator]() {
|
|
10541
|
+
return this.values();
|
|
10542
|
+
}
|
|
10543
|
+
_resolve(items, join) {
|
|
10544
|
+
let paths = (Array.isArray(items) ? items : [items]).map((item) => {
|
|
10545
|
+
if (typeof item === "object" && !(item instanceof _OpraURLPath || item instanceof OpraURLPathComponent))
|
|
10546
|
+
item = new OpraURLPathComponent(item);
|
|
10547
|
+
item = String(item);
|
|
10548
|
+
if (item.includes("?"))
|
|
10549
|
+
item = splitString2(item, {
|
|
10550
|
+
delimiters: "?",
|
|
10551
|
+
quotes: true,
|
|
10552
|
+
brackets: true,
|
|
10553
|
+
keepBrackets: true,
|
|
10554
|
+
keepQuotes: true
|
|
10555
|
+
})[0];
|
|
10556
|
+
if (item.includes("#"))
|
|
10557
|
+
item = splitString2(item, {
|
|
10558
|
+
delimiters: "#",
|
|
10559
|
+
quotes: true,
|
|
10560
|
+
brackets: true,
|
|
10561
|
+
keepBrackets: true,
|
|
10562
|
+
keepQuotes: true
|
|
10563
|
+
})[0];
|
|
10564
|
+
return join ? removeLeadingSeparator(item) : item;
|
|
10565
|
+
});
|
|
10566
|
+
const oldLength = this.length;
|
|
10567
|
+
let n = 0;
|
|
10568
|
+
if (!join) {
|
|
10569
|
+
for (n = paths.length - 1; n >= 0; n--) {
|
|
10570
|
+
if (String(items[n]).startsWith("/"))
|
|
10571
|
+
break;
|
|
10572
|
+
}
|
|
10573
|
+
if (n > 0)
|
|
10574
|
+
paths = paths.slice(n);
|
|
10575
|
+
}
|
|
10576
|
+
const newPath = paths[0]?.startsWith("/") ? [] : Array.from(this).map(String);
|
|
10577
|
+
for (let i = 0; i < paths.length; i++) {
|
|
10578
|
+
const pathTokenizer = tokenize2(paths[i], { delimiters: "/", quotes: true, brackets: true });
|
|
10579
|
+
for (const x of pathTokenizer) {
|
|
10580
|
+
if (!x)
|
|
10581
|
+
continue;
|
|
10582
|
+
if (x.startsWith(".")) {
|
|
10583
|
+
if (x === ".")
|
|
10584
|
+
continue;
|
|
10585
|
+
if (x === "..") {
|
|
10586
|
+
newPath.pop();
|
|
10587
|
+
continue;
|
|
10588
|
+
}
|
|
10589
|
+
throw new TypeError("Invalid path string");
|
|
10590
|
+
}
|
|
10591
|
+
newPath.push(x);
|
|
10592
|
+
}
|
|
10593
|
+
}
|
|
10594
|
+
for (let i = 0; i < newPath.length; i++) {
|
|
10595
|
+
this[i] = OpraURLPathComponent.parse(newPath[i]);
|
|
10596
|
+
}
|
|
10597
|
+
for (let i = newPath.length; i < oldLength; i++) {
|
|
10598
|
+
delete this[i];
|
|
10599
|
+
}
|
|
10600
|
+
this[kLength] = newPath.length;
|
|
10626
10601
|
}
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
decode(value) {
|
|
10632
|
-
const v = super.decode(value);
|
|
10633
|
-
if (!Number.isInteger(v))
|
|
10634
|
-
throw new TypeError(`"${value}" is not a valid integer`);
|
|
10635
|
-
if (this.enum && !this.enum.includes(v))
|
|
10636
|
-
throw new TypeError(`"${value}" is not one of allowed enum values (${this.enum}).`);
|
|
10637
|
-
return v;
|
|
10602
|
+
static join(...items) {
|
|
10603
|
+
const instance = new _OpraURLPath();
|
|
10604
|
+
instance.join(...items);
|
|
10605
|
+
return instance;
|
|
10638
10606
|
}
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
// ../../build/common/esm/http/codecs/string-codec.js
|
|
10642
|
-
var StringCodec = class {
|
|
10643
|
-
static {
|
|
10644
|
-
__name(this, "StringCodec");
|
|
10607
|
+
static resolve(...items) {
|
|
10608
|
+
return new _OpraURLPath(...items);
|
|
10645
10609
|
}
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
throw new TypeError(`Value can be up to ${this.maxLength} character${this.maxLength > 1 ? "s" : ""} long.`);
|
|
10656
|
-
if (this.enum && !this.enum.includes(value))
|
|
10657
|
-
throw new TypeError(`"${value}" is not one of allowed enum values (${this.enum}).`);
|
|
10658
|
-
return value;
|
|
10659
|
-
}
|
|
10660
|
-
encode(value) {
|
|
10661
|
-
return value == null ? "" : "" + value;
|
|
10610
|
+
static relative(source, basePath) {
|
|
10611
|
+
source = source instanceof _OpraURLPath ? source : new _OpraURLPath(source);
|
|
10612
|
+
basePath = basePath instanceof _OpraURLPath ? basePath : new _OpraURLPath(basePath);
|
|
10613
|
+
let i;
|
|
10614
|
+
for (i = 0; i < basePath.length; i++) {
|
|
10615
|
+
if (String(source[i]) !== String(basePath[i]))
|
|
10616
|
+
return;
|
|
10617
|
+
}
|
|
10618
|
+
return new _OpraURLPath(Array.from(source).slice(i).join("/"));
|
|
10662
10619
|
}
|
|
10663
10620
|
};
|
|
10664
|
-
|
|
10665
|
-
// ../../build/common/esm/http/http-params.js
|
|
10666
|
-
var _a3;
|
|
10667
|
-
var _b2;
|
|
10668
|
-
var _c2;
|
|
10669
|
-
var kEntries = Symbol("kEntries");
|
|
10670
|
-
var kSize = Symbol("kSize");
|
|
10671
|
-
var kParamDefs = Symbol("kParamDefs");
|
|
10672
|
-
var kOptions2 = Symbol("kOptions");
|
|
10673
|
-
var HttpParams = class _HttpParams {
|
|
10621
|
+
var OpraURLPathComponent = class _OpraURLPathComponent {
|
|
10674
10622
|
static {
|
|
10675
|
-
__name(this, "
|
|
10623
|
+
__name(this, "OpraURLPathComponent");
|
|
10676
10624
|
}
|
|
10677
|
-
constructor(init
|
|
10678
|
-
this
|
|
10679
|
-
this
|
|
10680
|
-
this
|
|
10681
|
-
this
|
|
10682
|
-
const defineParams = options?.params;
|
|
10683
|
-
if (defineParams)
|
|
10684
|
-
Object.keys(defineParams).forEach((key) => this.define(key, defineParams[key]));
|
|
10685
|
-
if (init)
|
|
10686
|
-
this.appendAll(init);
|
|
10687
|
-
this[kOptions2].onChange = options?.onChange;
|
|
10625
|
+
constructor(init) {
|
|
10626
|
+
this.resource = init.resource;
|
|
10627
|
+
this.key = init.key;
|
|
10628
|
+
this.args = init.args;
|
|
10629
|
+
this.typeCast = init.typeCast;
|
|
10688
10630
|
}
|
|
10689
|
-
|
|
10690
|
-
|
|
10631
|
+
toString() {
|
|
10632
|
+
let out = encodeURIComponent(this.resource).replace(/%24/, "$");
|
|
10633
|
+
if (this.key) {
|
|
10634
|
+
if (typeof this.key === "object" && isPlainObject2(this.key)) {
|
|
10635
|
+
const arr = [];
|
|
10636
|
+
for (const k of Object.keys(this.key)) {
|
|
10637
|
+
let v = this.key[k];
|
|
10638
|
+
if (typeof v === "number" || typeof v === "boolean")
|
|
10639
|
+
v = String(v);
|
|
10640
|
+
else
|
|
10641
|
+
v = '"' + encodeURIComponent(String(v)) + '"';
|
|
10642
|
+
arr.push(encodeURIComponent(k) + "=" + v);
|
|
10643
|
+
}
|
|
10644
|
+
out += "@" + arr.join(";");
|
|
10645
|
+
} else
|
|
10646
|
+
out += "@" + encodeURIComponent(String(this.key));
|
|
10647
|
+
}
|
|
10648
|
+
if (this.args) {
|
|
10649
|
+
const arr = [];
|
|
10650
|
+
for (const k of Object.keys(this.args)) {
|
|
10651
|
+
arr.push(encodeURIComponent(k) + "=" + encodeURIComponent(String(this.args[k])));
|
|
10652
|
+
}
|
|
10653
|
+
out += "(" + arr.join(";") + ")";
|
|
10654
|
+
}
|
|
10655
|
+
if (this.typeCast)
|
|
10656
|
+
out += "::" + encodeURIComponent(this.typeCast);
|
|
10657
|
+
return out;
|
|
10691
10658
|
}
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
*/
|
|
10696
|
-
append(name, value) {
|
|
10697
|
-
this._append(name, value);
|
|
10698
|
-
this.changed();
|
|
10699
|
-
return this;
|
|
10700
|
-
}
|
|
10701
|
-
appendAll(input) {
|
|
10702
|
-
if (typeof input === "string") {
|
|
10703
|
-
if (input && input.startsWith("?"))
|
|
10704
|
-
input = input.substring(1);
|
|
10705
|
-
if (!input)
|
|
10706
|
-
return this;
|
|
10707
|
-
const tokenizer = tokenize2(input, { delimiters: "&", quotes: true, brackets: true });
|
|
10708
|
-
for (const token of tokenizer) {
|
|
10709
|
-
if (!token)
|
|
10710
|
-
continue;
|
|
10711
|
-
const itemTokenizer = tokenize2(token, {
|
|
10712
|
-
delimiters: "=",
|
|
10713
|
-
quotes: true,
|
|
10714
|
-
brackets: true
|
|
10715
|
-
});
|
|
10716
|
-
const k = decodeURIComponent(itemTokenizer.next() || "");
|
|
10717
|
-
const v = this.decodeValue(itemTokenizer.join("="), k);
|
|
10718
|
-
this._append(k, v);
|
|
10719
|
-
}
|
|
10720
|
-
} else if (input.forEach && typeof input.forEach === "function")
|
|
10721
|
-
input.forEach((value, name) => this._append(name, value));
|
|
10722
|
-
else
|
|
10723
|
-
Object.keys(input).forEach((name) => this._append(name, input[name]));
|
|
10724
|
-
return this;
|
|
10725
|
-
}
|
|
10726
|
-
changed() {
|
|
10727
|
-
if (this[kOptions2].onChange)
|
|
10728
|
-
this[kOptions2].onChange();
|
|
10729
|
-
}
|
|
10730
|
-
clear() {
|
|
10731
|
-
if (this[kEntries].size) {
|
|
10732
|
-
this[kEntries].clear();
|
|
10733
|
-
this[kSize] = 0;
|
|
10734
|
-
this.changed();
|
|
10735
|
-
}
|
|
10736
|
-
}
|
|
10737
|
-
/**
|
|
10738
|
-
* Deletes values for a given parameter
|
|
10739
|
-
*/
|
|
10740
|
-
delete(name, value) {
|
|
10741
|
-
if (this._delete(name, value))
|
|
10742
|
-
this.changed();
|
|
10743
|
-
return this;
|
|
10659
|
+
/* istanbul ignore next */
|
|
10660
|
+
[nodeInspectCustom2]() {
|
|
10661
|
+
return this.toString();
|
|
10744
10662
|
}
|
|
10745
10663
|
/**
|
|
10746
|
-
*
|
|
10664
|
+
* Factory method.
|
|
10665
|
+
* @param input
|
|
10747
10666
|
*/
|
|
10748
|
-
|
|
10749
|
-
const
|
|
10750
|
-
|
|
10667
|
+
static parse(input) {
|
|
10668
|
+
const m = pathComponentRegEx.exec(input);
|
|
10669
|
+
if (!m)
|
|
10670
|
+
throw Object.assign(new TypeError("Invalid Opra URL"), {
|
|
10671
|
+
code: "ERR_INVALID_OPRA_URL",
|
|
10672
|
+
input
|
|
10673
|
+
});
|
|
10751
10674
|
let key;
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
if (
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10675
|
+
if (m[2]) {
|
|
10676
|
+
const s = decodeURIComponent(m[2]);
|
|
10677
|
+
const b = splitString2(s, { delimiters: ";", quotes: true, escape: false, keepQuotes: true, keepBrackets: true });
|
|
10678
|
+
for (const n of b) {
|
|
10679
|
+
const c = splitString2(n, { delimiters: "=", quotes: true, escape: false, keepQuotes: true, keepBrackets: true });
|
|
10680
|
+
if (b.length > 1 && c.length < 2 || (key && (c.length >= 2 && typeof key !== "object") || c.length < 2 && typeof key === "object"))
|
|
10681
|
+
throw Object.assign(new TypeError("Invalid Opra URL. name:value pair required for multiple key format"), {
|
|
10682
|
+
pathComponent: input,
|
|
10683
|
+
code: "ERR_INVALID_OPRA_URL"
|
|
10684
|
+
});
|
|
10685
|
+
if (c.length >= 2) {
|
|
10686
|
+
key = key || {};
|
|
10687
|
+
const k = c.shift() || "";
|
|
10688
|
+
let v = c.join("=");
|
|
10689
|
+
if (decimalPattern.test(v))
|
|
10690
|
+
v = Number(v);
|
|
10691
|
+
else if (booleanPattern.test(v))
|
|
10692
|
+
v = Boolean(v);
|
|
10693
|
+
else if (v.startsWith('"') && v.endsWith('"'))
|
|
10694
|
+
v = v.substring(1, v.length - 1);
|
|
10695
|
+
else if (v.startsWith("'") && v.endsWith("'"))
|
|
10696
|
+
v = v.substring(1, v.length - 1);
|
|
10697
|
+
key[k] = v;
|
|
10698
|
+
} else {
|
|
10699
|
+
if (decimalPattern.test(c[0]))
|
|
10700
|
+
key = Number(c[0]);
|
|
10701
|
+
else if (booleanPattern.test(c[0]))
|
|
10702
|
+
key = Boolean(c[0]);
|
|
10703
|
+
else
|
|
10704
|
+
key = c[0];
|
|
10770
10705
|
}
|
|
10771
|
-
return {
|
|
10772
|
-
done: false,
|
|
10773
|
-
value: [key, values[i++]]
|
|
10774
|
-
};
|
|
10775
10706
|
}
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
while (!entry.done) {
|
|
10782
|
-
callbackFn.call(thisArg || this, entry.value[1], entry.value[0], this);
|
|
10783
|
-
entry = iterator.next();
|
|
10707
|
+
return new _OpraURLPathComponent({
|
|
10708
|
+
resource: decodeURIComponent(m[1]),
|
|
10709
|
+
key,
|
|
10710
|
+
typeCast: m[3] ? decodeURIComponent(m[3]) : void 0
|
|
10711
|
+
});
|
|
10784
10712
|
}
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
*/
|
|
10789
|
-
get(name, index = 0) {
|
|
10790
|
-
const values = this[kEntries].get(name);
|
|
10791
|
-
return values && values.length > index ? values[index] : null;
|
|
10792
|
-
}
|
|
10793
|
-
/**
|
|
10794
|
-
* Retrieves an array of values for a given parameter.
|
|
10795
|
-
*/
|
|
10796
|
-
getAll(name) {
|
|
10797
|
-
const entry = this[kEntries].get(name);
|
|
10798
|
-
return entry ? entry.slice(0) : null;
|
|
10799
|
-
}
|
|
10800
|
-
/**
|
|
10801
|
-
* Retrieves the names of the parameters.
|
|
10802
|
-
*/
|
|
10803
|
-
keys() {
|
|
10804
|
-
return this[kEntries].keys();
|
|
10805
|
-
}
|
|
10806
|
-
/**
|
|
10807
|
-
* Retrieves the names of the parameters.
|
|
10808
|
-
*/
|
|
10809
|
-
values() {
|
|
10810
|
-
const items = [];
|
|
10811
|
-
this.forEach((value) => items.push(value));
|
|
10812
|
-
return items.values();
|
|
10813
|
-
}
|
|
10814
|
-
/**
|
|
10815
|
-
* Checks for existence of a parameter.
|
|
10816
|
-
*/
|
|
10817
|
-
has(name) {
|
|
10818
|
-
return this[kEntries].has(name);
|
|
10819
|
-
}
|
|
10820
|
-
/**
|
|
10821
|
-
* Sets or modifies a value for a given parameter.
|
|
10822
|
-
* If the header already exists, its value is replaced with the given value
|
|
10823
|
-
*/
|
|
10824
|
-
set(name, value) {
|
|
10825
|
-
this._set(name, value);
|
|
10826
|
-
this.changed();
|
|
10827
|
-
return this;
|
|
10828
|
-
}
|
|
10829
|
-
sort(compareFn) {
|
|
10830
|
-
this[kEntries].sort(compareFn);
|
|
10831
|
-
this.changed();
|
|
10832
|
-
return this;
|
|
10833
|
-
}
|
|
10834
|
-
/**
|
|
10835
|
-
* Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
|
|
10836
|
-
* separated by `&`s.
|
|
10837
|
-
*/
|
|
10838
|
-
toString() {
|
|
10839
|
-
const out = [];
|
|
10840
|
-
this.forEach((v, k) => {
|
|
10841
|
-
out.push(encodeURIParam(k) + (v ? "=" + this.encodeValue(v, k) : ""));
|
|
10713
|
+
return new _OpraURLPathComponent({
|
|
10714
|
+
resource: decodeURIComponent(m[1]),
|
|
10715
|
+
typeCast: m[3] ? decodeURIComponent(m[3]) : void 0
|
|
10842
10716
|
});
|
|
10843
|
-
return out.join("&");
|
|
10844
|
-
}
|
|
10845
|
-
getProxy() {
|
|
10846
|
-
const _this = this;
|
|
10847
|
-
return this[kEntries].getProxy({
|
|
10848
|
-
get(target, p, receiver) {
|
|
10849
|
-
if (typeof p === "string") {
|
|
10850
|
-
const v = _this[kEntries].get(p);
|
|
10851
|
-
return v ? v.length > 1 ? v : v[0] : null;
|
|
10852
|
-
}
|
|
10853
|
-
return Reflect.get(target, p, receiver);
|
|
10854
|
-
},
|
|
10855
|
-
set(target, p, newValue, receiver) {
|
|
10856
|
-
if (typeof p === "string") {
|
|
10857
|
-
_this.set(p, newValue);
|
|
10858
|
-
return true;
|
|
10859
|
-
}
|
|
10860
|
-
return Reflect.set(target, p, newValue, receiver);
|
|
10861
|
-
}
|
|
10862
|
-
});
|
|
10863
|
-
}
|
|
10864
|
-
define(arg0, options) {
|
|
10865
|
-
if (typeof arg0 === "object") {
|
|
10866
|
-
for (const [name, def] of Object.entries(arg0))
|
|
10867
|
-
this.define(name, def);
|
|
10868
|
-
return this;
|
|
10869
|
-
}
|
|
10870
|
-
if (!arg0)
|
|
10871
|
-
throw new Error('"name" argument required');
|
|
10872
|
-
if (!options)
|
|
10873
|
-
throw new Error('"options" argument required');
|
|
10874
|
-
if (typeof options.codec === "string" && !_HttpParams.codecs[options.codec])
|
|
10875
|
-
throw new Error(`Unknown url parameter format name "${options.codec}"`);
|
|
10876
|
-
const codec = (typeof options?.codec === "string" ? _HttpParams.codecs[options.codec] : options?.codec) || _HttpParams.codecs.string;
|
|
10877
|
-
const meta = {
|
|
10878
|
-
...options,
|
|
10879
|
-
codec
|
|
10880
|
-
};
|
|
10881
|
-
this[kParamDefs].set(arg0, meta);
|
|
10882
|
-
return this;
|
|
10883
|
-
}
|
|
10884
|
-
encodeValue(value, key) {
|
|
10885
|
-
const prmDef = this[kParamDefs].get(key);
|
|
10886
|
-
if (prmDef) {
|
|
10887
|
-
const delimReplace = "%" + (prmDef.arrayDelimiter || ",").charCodeAt(0).toString(16).toUpperCase();
|
|
10888
|
-
const fn = /* @__PURE__ */ __name((x) => encodeURIParam(prmDef.codec.encode(x)).replace(/,/g, delimReplace), "fn");
|
|
10889
|
-
return Array.isArray(value) ? value.map((v) => fn(v)).join(prmDef.arrayDelimiter || ",") : fn(value);
|
|
10890
|
-
}
|
|
10891
|
-
return encodeURIParam(String(value));
|
|
10892
|
-
}
|
|
10893
|
-
decodeValue(value, key) {
|
|
10894
|
-
const prmDef = this[kParamDefs].get(key);
|
|
10895
|
-
let val = value;
|
|
10896
|
-
if (prmDef) {
|
|
10897
|
-
if (prmDef.array) {
|
|
10898
|
-
val = splitString2(value, {
|
|
10899
|
-
delimiters: prmDef.arrayDelimiter || ",",
|
|
10900
|
-
brackets: true,
|
|
10901
|
-
quotes: true,
|
|
10902
|
-
keepQuotes: false
|
|
10903
|
-
}).map((x) => decodeURIComponent(x));
|
|
10904
|
-
} else
|
|
10905
|
-
val = decodeURIComponent(val);
|
|
10906
|
-
const fn = /* @__PURE__ */ __name((x) => prmDef.codec.decode(decodeURIComponent(x)), "fn");
|
|
10907
|
-
val = Array.isArray(val) ? val.map(fn) : fn(val);
|
|
10908
|
-
if (prmDef.array === "strict")
|
|
10909
|
-
val = Array.isArray(val) ? val : [val];
|
|
10910
|
-
else if (prmDef.array)
|
|
10911
|
-
val = Array.isArray(val) && val.length === 1 ? val[0] : val;
|
|
10912
|
-
if (Array.isArray(val)) {
|
|
10913
|
-
if (prmDef.minArrayItems && val.length < prmDef.minArrayItems)
|
|
10914
|
-
throw new Error(`"${key}" parameter requires at least ${prmDef.minArrayItems} values`);
|
|
10915
|
-
if (prmDef.maxArrayItems && val.length > prmDef.maxArrayItems)
|
|
10916
|
-
throw new Error(`"${key}" parameter accepts up to ${prmDef.maxArrayItems} values`);
|
|
10917
|
-
}
|
|
10918
|
-
return val;
|
|
10919
|
-
}
|
|
10920
|
-
return decodeURIComponent(value);
|
|
10921
|
-
}
|
|
10922
|
-
[(_a3 = kEntries, _b2 = kSize, _c2 = kParamDefs, Symbol.iterator)]() {
|
|
10923
|
-
return this.entries();
|
|
10924
|
-
}
|
|
10925
|
-
get [Symbol.toStringTag]() {
|
|
10926
|
-
return "HttpParams";
|
|
10927
|
-
}
|
|
10928
|
-
_append(name, value) {
|
|
10929
|
-
let values = this[kEntries].get(name);
|
|
10930
|
-
if (!values) {
|
|
10931
|
-
values = [];
|
|
10932
|
-
this[kEntries].set(name, values);
|
|
10933
|
-
}
|
|
10934
|
-
values.push(value ?? null);
|
|
10935
|
-
this[kSize] += 1;
|
|
10936
|
-
}
|
|
10937
|
-
_delete(name, value) {
|
|
10938
|
-
const oldValues = this[kEntries].get(name);
|
|
10939
|
-
if (!oldValues)
|
|
10940
|
-
return false;
|
|
10941
|
-
const oldSize = this[kSize];
|
|
10942
|
-
if (value) {
|
|
10943
|
-
const newValues = oldValues.filter((x) => x === value);
|
|
10944
|
-
this[kEntries].set(name, newValues);
|
|
10945
|
-
this[kSize] += -oldValues.length + newValues.length;
|
|
10946
|
-
} else {
|
|
10947
|
-
this[kEntries].delete(name);
|
|
10948
|
-
this[kSize] -= oldValues.length;
|
|
10949
|
-
}
|
|
10950
|
-
return oldSize !== this[kSize];
|
|
10951
|
-
}
|
|
10952
|
-
_set(name, value, index) {
|
|
10953
|
-
if (value === void 0) {
|
|
10954
|
-
this._delete(name);
|
|
10955
|
-
return;
|
|
10956
|
-
}
|
|
10957
|
-
const values = this[kEntries].get(name);
|
|
10958
|
-
if (!values) {
|
|
10959
|
-
this[kEntries].set(name, [value]);
|
|
10960
|
-
this[kSize] += 1;
|
|
10961
|
-
return;
|
|
10962
|
-
}
|
|
10963
|
-
if (index == null || index < 0) {
|
|
10964
|
-
this[kEntries].set(name, [value]);
|
|
10965
|
-
this[kSize] += -values.length + 1;
|
|
10966
|
-
return;
|
|
10967
|
-
}
|
|
10968
|
-
const oldLen = values.length;
|
|
10969
|
-
values[Math.min(index, values.length)] = value;
|
|
10970
|
-
this[kSize] += -oldLen + values.length;
|
|
10971
|
-
}
|
|
10972
|
-
};
|
|
10973
|
-
HttpParams.kEntries = kEntries;
|
|
10974
|
-
HttpParams.kSize = kSize;
|
|
10975
|
-
HttpParams.kParamDefs = kParamDefs;
|
|
10976
|
-
HttpParams.kOptions = kOptions2;
|
|
10977
|
-
HttpParams.codecs = {
|
|
10978
|
-
"boolean": new BooleanCodec(),
|
|
10979
|
-
"date": new DateCodec(),
|
|
10980
|
-
"filter": new FilterCodec(),
|
|
10981
|
-
"integer": new IntegerCodec(),
|
|
10982
|
-
"number": new NumberCodec(),
|
|
10983
|
-
"string": new StringCodec()
|
|
10984
|
-
};
|
|
10985
|
-
var ENCODING_REGEX = /%(\d[a-f0-9])/gi;
|
|
10986
|
-
var ENCODING_REPLACEMENTS = {
|
|
10987
|
-
"2C": ",",
|
|
10988
|
-
"2F": "/",
|
|
10989
|
-
"24": "$",
|
|
10990
|
-
"3A": ":",
|
|
10991
|
-
"3B": ";",
|
|
10992
|
-
"3D": "=",
|
|
10993
|
-
"3F": "?",
|
|
10994
|
-
"40": "@"
|
|
10995
|
-
};
|
|
10996
|
-
function encodeURIParam(v) {
|
|
10997
|
-
return encodeURIComponent(v).replace(ENCODING_REGEX, (s, t) => ENCODING_REPLACEMENTS[t] ?? s);
|
|
10998
|
-
}
|
|
10999
|
-
__name(encodeURIParam, "encodeURIParam");
|
|
11000
|
-
|
|
11001
|
-
// ../../build/common/esm/http/enums/http-headers-codes.enum.js
|
|
11002
|
-
var HttpHeaderCodes;
|
|
11003
|
-
(function(HttpHeaderCodes2) {
|
|
11004
|
-
HttpHeaderCodes2["X_Opra_Version"] = "X-Opra-Version";
|
|
11005
|
-
HttpHeaderCodes2["X_Total_Count"] = "X-Total-Count";
|
|
11006
|
-
HttpHeaderCodes2["WWW_Authenticate"] = "WWW-Authenticate";
|
|
11007
|
-
HttpHeaderCodes2["Authorization"] = "Authorization";
|
|
11008
|
-
HttpHeaderCodes2["Proxy_Authenticate"] = "Proxy-Authenticate";
|
|
11009
|
-
HttpHeaderCodes2["Proxy_Authorization"] = "Proxy-Authorization";
|
|
11010
|
-
HttpHeaderCodes2["Age"] = "Age";
|
|
11011
|
-
HttpHeaderCodes2["Cache_Control"] = "Cache-Control";
|
|
11012
|
-
HttpHeaderCodes2["Clear_Site_Data"] = "Clear-Site-Data";
|
|
11013
|
-
HttpHeaderCodes2["Expires"] = "Expires";
|
|
11014
|
-
HttpHeaderCodes2["Pragma"] = "Pragma";
|
|
11015
|
-
HttpHeaderCodes2["Last_Modified"] = "Last-Modified";
|
|
11016
|
-
HttpHeaderCodes2["ETag"] = "ETag";
|
|
11017
|
-
HttpHeaderCodes2["If_Match"] = "If-Match";
|
|
11018
|
-
HttpHeaderCodes2["If_None_Match"] = "If-None-Match";
|
|
11019
|
-
HttpHeaderCodes2["If_Modified_Since"] = "If-Modified-Since";
|
|
11020
|
-
HttpHeaderCodes2["If_Unmodified_Since"] = "If-Unmodified-Since";
|
|
11021
|
-
HttpHeaderCodes2["Vary"] = "Vary";
|
|
11022
|
-
HttpHeaderCodes2["Connection"] = "Connection";
|
|
11023
|
-
HttpHeaderCodes2["Keep_Alive"] = "Keep-Alive";
|
|
11024
|
-
HttpHeaderCodes2["Accept"] = "Accept";
|
|
11025
|
-
HttpHeaderCodes2["Accept_Encoding"] = "Accept-Encoding";
|
|
11026
|
-
HttpHeaderCodes2["Accept_Language"] = "Accept-Language";
|
|
11027
|
-
HttpHeaderCodes2["Expect"] = "Expect";
|
|
11028
|
-
HttpHeaderCodes2["Cookie"] = "Cookie";
|
|
11029
|
-
HttpHeaderCodes2["Set_Cookie"] = "Set-Cookie";
|
|
11030
|
-
HttpHeaderCodes2["Access_Control_Allow_Origin"] = "Access-Control-Allow-Origin";
|
|
11031
|
-
HttpHeaderCodes2["Access_Control_Allow_Credentials"] = "Access-Control-Allow-Credentials";
|
|
11032
|
-
HttpHeaderCodes2["Access_Control_Allow_Headers"] = "Access-Control-Allow-Headers";
|
|
11033
|
-
HttpHeaderCodes2["Access_Control_Allow_Methods"] = "Access-Control-Allow-Methods";
|
|
11034
|
-
HttpHeaderCodes2["Access_Control_Expose_Headers"] = "Access-Control-Expose-Headers";
|
|
11035
|
-
HttpHeaderCodes2["Access_Control_Max_Age"] = "Access-Control-Max-Age";
|
|
11036
|
-
HttpHeaderCodes2["Access_Control_Request_Headers"] = "Access-Control-Request-Headers";
|
|
11037
|
-
HttpHeaderCodes2["Access_Control_Request_Method"] = "Access-Control-Request-Method";
|
|
11038
|
-
HttpHeaderCodes2["Origin"] = "Origin";
|
|
11039
|
-
HttpHeaderCodes2["Timing_Allow_Origin"] = "Timing-Allow-Origin";
|
|
11040
|
-
HttpHeaderCodes2["Content_Disposition"] = "Content-Disposition";
|
|
11041
|
-
HttpHeaderCodes2["Content_ID"] = "Content-ID";
|
|
11042
|
-
HttpHeaderCodes2["Content_Length"] = "Content-Length";
|
|
11043
|
-
HttpHeaderCodes2["Content_Type"] = "Content-Type";
|
|
11044
|
-
HttpHeaderCodes2["Content_Transfer_Encoding"] = "Content-Transfer-Encoding";
|
|
11045
|
-
HttpHeaderCodes2["Content_Encoding"] = "Content-Encoding";
|
|
11046
|
-
HttpHeaderCodes2["Content_Language"] = "Content-Language";
|
|
11047
|
-
HttpHeaderCodes2["Content_Location"] = "Content-Location";
|
|
11048
|
-
HttpHeaderCodes2["Forwarded"] = "Forwarded";
|
|
11049
|
-
HttpHeaderCodes2["X_Forwarded_For"] = "X-Forwarded-For";
|
|
11050
|
-
HttpHeaderCodes2["X_Forwarded_Host"] = "X-Forwarded-Host";
|
|
11051
|
-
HttpHeaderCodes2["X_Forwarded_Proto"] = "X-Forwarded-Proto";
|
|
11052
|
-
HttpHeaderCodes2["Via"] = "Via";
|
|
11053
|
-
HttpHeaderCodes2["Location"] = "Location";
|
|
11054
|
-
HttpHeaderCodes2["From"] = "From";
|
|
11055
|
-
HttpHeaderCodes2["Host"] = "Host";
|
|
11056
|
-
HttpHeaderCodes2["Referer"] = "Referer";
|
|
11057
|
-
HttpHeaderCodes2["Referrer_Policy"] = "Referrer-Policy";
|
|
11058
|
-
HttpHeaderCodes2["User_Agent"] = "User-Agent";
|
|
11059
|
-
HttpHeaderCodes2["Allow"] = "Allow";
|
|
11060
|
-
HttpHeaderCodes2["Server"] = "Server";
|
|
11061
|
-
HttpHeaderCodes2["Accept_Ranges"] = "Accept-Ranges";
|
|
11062
|
-
HttpHeaderCodes2["Range"] = "Range";
|
|
11063
|
-
HttpHeaderCodes2["If_Range"] = "If-Range";
|
|
11064
|
-
HttpHeaderCodes2["Content_Range"] = "Content-Range";
|
|
11065
|
-
HttpHeaderCodes2["Cross_Origin_Embedder_Policy"] = "Cross-Origin-Embedder-Policy";
|
|
11066
|
-
HttpHeaderCodes2["Cross_Origin_Opener_Policy"] = "Cross-Origin-Opener-Policy";
|
|
11067
|
-
HttpHeaderCodes2["Cross_Origin_Resource_Policy"] = "Cross-Origin-Resource-Policy";
|
|
11068
|
-
HttpHeaderCodes2["Content_Security_Policy"] = "Content-Security-Policy";
|
|
11069
|
-
HttpHeaderCodes2["Content_Security_Policy_Report_Only"] = "Content-Security-Policy-Report-Only";
|
|
11070
|
-
HttpHeaderCodes2["Expect_CT"] = "Expect-CT";
|
|
11071
|
-
HttpHeaderCodes2["Feature_Policy"] = "Feature-Policy";
|
|
11072
|
-
HttpHeaderCodes2["Strict_Transport_Security"] = "Strict-Transport-Security";
|
|
11073
|
-
HttpHeaderCodes2["Upgrade"] = "Upgrade";
|
|
11074
|
-
HttpHeaderCodes2["Upgrade_Insecure_Requests"] = "Upgrade-Insecure-Requests";
|
|
11075
|
-
HttpHeaderCodes2["X_Content_Type_Options"] = "X-Content-Type-Options";
|
|
11076
|
-
HttpHeaderCodes2["X_Download_Options"] = "X-Download-Options";
|
|
11077
|
-
HttpHeaderCodes2["X_Frame_Options"] = "X-Frame-Options";
|
|
11078
|
-
HttpHeaderCodes2["X_Permitted_Cross_Domain_Policies"] = "X-Permitted-Cross-Domain-Policies";
|
|
11079
|
-
HttpHeaderCodes2["X_Powered_By"] = "X-Powered-By";
|
|
11080
|
-
HttpHeaderCodes2["X_XSS_Protection"] = "X-XSS-Protection";
|
|
11081
|
-
HttpHeaderCodes2["Transfer_Encoding"] = "Transfer-Encoding";
|
|
11082
|
-
HttpHeaderCodes2["TE"] = "TE";
|
|
11083
|
-
HttpHeaderCodes2["Trailer"] = "Trailer";
|
|
11084
|
-
HttpHeaderCodes2["Sec_WebSocket_Key"] = "Sec-WebSocket-Key";
|
|
11085
|
-
HttpHeaderCodes2["Sec_WebSocket_Extensions"] = "Sec-WebSocket-Extensions";
|
|
11086
|
-
HttpHeaderCodes2["Sec_WebSocket_Accept"] = "Sec-WebSocket-Accept";
|
|
11087
|
-
HttpHeaderCodes2["Sec_WebSocket_Protocol"] = "Sec-WebSocket-Protocol";
|
|
11088
|
-
HttpHeaderCodes2["Sec_WebSocket_Version"] = "Sec-WebSocket-Version";
|
|
11089
|
-
HttpHeaderCodes2["Date"] = "Date";
|
|
11090
|
-
HttpHeaderCodes2["Retry_After"] = "Retry-After";
|
|
11091
|
-
HttpHeaderCodes2["Server_Timing"] = "Server-Timing";
|
|
11092
|
-
HttpHeaderCodes2["X_DNS_Prefetch_Control"] = "X-DNS-Prefetch-Control";
|
|
11093
|
-
HttpHeaderCodes2["Max_Forwards"] = "Max-Forwards";
|
|
11094
|
-
})(HttpHeaderCodes || (HttpHeaderCodes = {}));
|
|
11095
|
-
|
|
11096
|
-
// ../../build/common/esm/http/enums/http-status-codes.enum.js
|
|
11097
|
-
var HttpStatusCodes;
|
|
11098
|
-
(function(HttpStatusCodes2) {
|
|
11099
|
-
HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
|
|
11100
|
-
HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
11101
|
-
HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
|
|
11102
|
-
HttpStatusCodes2[HttpStatusCodes2["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
11103
|
-
HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
|
|
11104
|
-
HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
|
|
11105
|
-
HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
11106
|
-
HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
11107
|
-
HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
11108
|
-
HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
11109
|
-
HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
11110
|
-
HttpStatusCodes2[HttpStatusCodes2["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
11111
|
-
HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
11112
|
-
HttpStatusCodes2[HttpStatusCodes2["FOUND"] = 302] = "FOUND";
|
|
11113
|
-
HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
11114
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
11115
|
-
HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
11116
|
-
HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
11117
|
-
HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
11118
|
-
HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
11119
|
-
HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
11120
|
-
HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
11121
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
11122
|
-
HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
11123
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
11124
|
-
HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
11125
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
11126
|
-
HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
|
|
11127
|
-
HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
|
|
11128
|
-
HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
11129
|
-
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
11130
|
-
HttpStatusCodes2[HttpStatusCodes2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
11131
|
-
HttpStatusCodes2[HttpStatusCodes2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
11132
|
-
HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
11133
|
-
HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
11134
|
-
HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
11135
|
-
HttpStatusCodes2[HttpStatusCodes2["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
11136
|
-
HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
11137
|
-
HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
11138
|
-
HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
|
|
11139
|
-
HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
11140
|
-
HttpStatusCodes2[HttpStatusCodes2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
11141
|
-
HttpStatusCodes2[HttpStatusCodes2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
11142
|
-
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
11143
|
-
HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
11144
|
-
HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
11145
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
11146
|
-
HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
11147
|
-
HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
11148
|
-
HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
11149
|
-
HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
11150
|
-
HttpStatusCodes2[HttpStatusCodes2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
11151
|
-
HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
11152
|
-
HttpStatusCodes2[HttpStatusCodes2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
11153
|
-
HttpStatusCodes2[HttpStatusCodes2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
11154
|
-
HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
11155
|
-
})(HttpStatusCodes || (HttpStatusCodes = {}));
|
|
11156
|
-
|
|
11157
|
-
// ../../build/common/esm/http/enums/http-status-messages.js
|
|
11158
|
-
var HttpStatusMessages = {
|
|
11159
|
-
"100": "Continue",
|
|
11160
|
-
"101": "Switching Protocols",
|
|
11161
|
-
"102": "Processing",
|
|
11162
|
-
"103": "Early Hints",
|
|
11163
|
-
"200": "OK",
|
|
11164
|
-
"201": "Created",
|
|
11165
|
-
"202": "Accepted",
|
|
11166
|
-
"203": "Non-Authoritative Information",
|
|
11167
|
-
"204": "No Content",
|
|
11168
|
-
"205": "Reset Content",
|
|
11169
|
-
"206": "Partial Content",
|
|
11170
|
-
"207": "Multi-Status",
|
|
11171
|
-
"208": "Already Reported",
|
|
11172
|
-
"226": "IM Used",
|
|
11173
|
-
"300": "Multiple Choices",
|
|
11174
|
-
"301": "Moved Permanently",
|
|
11175
|
-
"302": "Found",
|
|
11176
|
-
"303": "See Other",
|
|
11177
|
-
"304": "Not Modified",
|
|
11178
|
-
"305": "Use Proxy",
|
|
11179
|
-
"307": "Temporary Redirect",
|
|
11180
|
-
"308": "Permanent Redirect",
|
|
11181
|
-
"400": "Bad Request",
|
|
11182
|
-
"401": "Unauthorized",
|
|
11183
|
-
"402": "Payment Required",
|
|
11184
|
-
"403": "Forbidden",
|
|
11185
|
-
"404": "Not Found",
|
|
11186
|
-
"405": "Method Not Allowed",
|
|
11187
|
-
"406": "Not Acceptable",
|
|
11188
|
-
"407": "Proxy Authentication Required",
|
|
11189
|
-
"408": "Request Timeout",
|
|
11190
|
-
"409": "Conflict",
|
|
11191
|
-
"410": "Gone",
|
|
11192
|
-
"411": "Length Required",
|
|
11193
|
-
"412": "Precondition Failed",
|
|
11194
|
-
"413": "Payload Too Large",
|
|
11195
|
-
"414": "URI Too Long",
|
|
11196
|
-
"415": "Unsupported Media Type",
|
|
11197
|
-
"416": "Range Not Satisfiable",
|
|
11198
|
-
"417": "Expectation Failed",
|
|
11199
|
-
"418": "I'm a Teapot",
|
|
11200
|
-
"421": "Misdirected Request",
|
|
11201
|
-
"422": "Unprocessable Entity",
|
|
11202
|
-
"423": "Locked",
|
|
11203
|
-
"424": "Failed Dependency",
|
|
11204
|
-
"425": "Too Early",
|
|
11205
|
-
"426": "Upgrade Required",
|
|
11206
|
-
"428": "Precondition Required",
|
|
11207
|
-
"429": "Too Many Requests",
|
|
11208
|
-
"431": "Request Header Fields Too Large",
|
|
11209
|
-
"451": "Unavailable For Legal Reasons",
|
|
11210
|
-
"500": "Internal Server Error",
|
|
11211
|
-
"501": "Not Implemented",
|
|
11212
|
-
"502": "Bad Gateway",
|
|
11213
|
-
"503": "Service Unavailable",
|
|
11214
|
-
"504": "Gateway Timeout",
|
|
11215
|
-
"505": "HTTP Version Not Supported",
|
|
11216
|
-
"506": "Variant Also Negotiates",
|
|
11217
|
-
"507": "Insufficient Storage",
|
|
11218
|
-
"508": "Loop Detected",
|
|
11219
|
-
"509": "Bandwidth Limit Exceeded",
|
|
11220
|
-
"510": "Not Extended",
|
|
11221
|
-
"511": "Network Authentication Required"
|
|
11222
|
-
};
|
|
11223
|
-
|
|
11224
|
-
// ../../build/common/esm/url/opra-url.js
|
|
11225
|
-
import { splitString as splitString4, tokenize as tokenize4 } from "fast-tokenizer";
|
|
11226
|
-
|
|
11227
|
-
// ../../build/common/esm/utils/path-utils.js
|
|
11228
|
-
function normalizePath(p, noLeadingSlash) {
|
|
11229
|
-
if (!p)
|
|
11230
|
-
return "";
|
|
11231
|
-
while (noLeadingSlash && p.startsWith("/"))
|
|
11232
|
-
p = p.substring(1);
|
|
11233
|
-
while (p.endsWith("/"))
|
|
11234
|
-
p = p.substring(0, p.length - 1);
|
|
11235
|
-
return p;
|
|
11236
|
-
}
|
|
11237
|
-
__name(normalizePath, "normalizePath");
|
|
11238
|
-
function joinPath(...p) {
|
|
11239
|
-
const out = [];
|
|
11240
|
-
let s;
|
|
11241
|
-
for (let i = 0, l = p.length; i < l; i++) {
|
|
11242
|
-
s = normalizePath(p[i], i > 0);
|
|
11243
|
-
if (s)
|
|
11244
|
-
out.push(s);
|
|
11245
|
-
}
|
|
11246
|
-
return out.join("/");
|
|
11247
|
-
}
|
|
11248
|
-
__name(joinPath, "joinPath");
|
|
11249
|
-
|
|
11250
|
-
// ../../build/common/esm/url/opra-url-path.js
|
|
11251
|
-
import { tokenize as tokenize3 } from "fast-tokenizer";
|
|
11252
|
-
|
|
11253
|
-
// ../../build/common/esm/url/utils/encode-path-component.js
|
|
11254
|
-
import isPlainObject2 from "putil-isplainobject";
|
|
11255
|
-
function encodePathComponent(resource, key, typeCast) {
|
|
11256
|
-
if (resource == null)
|
|
11257
|
-
return "";
|
|
11258
|
-
let keyString = "";
|
|
11259
|
-
if (key !== "" && key != null) {
|
|
11260
|
-
if (isPlainObject2(key)) {
|
|
11261
|
-
const arr = [];
|
|
11262
|
-
for (const k of Object.keys(key)) {
|
|
11263
|
-
arr.push(encodeURIComponent(k) + "=" + encodeURIComponent(key[k]));
|
|
11264
|
-
}
|
|
11265
|
-
keyString = arr.join(";");
|
|
11266
|
-
} else
|
|
11267
|
-
keyString = encodeURIComponent("" + key);
|
|
11268
|
-
}
|
|
11269
|
-
if (typeCast)
|
|
11270
|
-
typeCast = encodeURIComponent(typeCast);
|
|
11271
|
-
return encodeURIComponent(resource).replace(/%24/, "$") + (keyString ? "@" + keyString : "") + (typeCast ? "::" + typeCast : "");
|
|
11272
|
-
}
|
|
11273
|
-
__name(encodePathComponent, "encodePathComponent");
|
|
11274
|
-
|
|
11275
|
-
// ../../build/common/esm/url/opra-url-path-component.js
|
|
11276
|
-
var nodeInspectCustom2 = Symbol.for("nodejs.util.inspect.custom");
|
|
11277
|
-
var OpraURLPathComponent = class _OpraURLPathComponent {
|
|
11278
|
-
static {
|
|
11279
|
-
__name(this, "OpraURLPathComponent");
|
|
11280
|
-
}
|
|
11281
|
-
constructor(init) {
|
|
11282
|
-
this.resource = init.resource;
|
|
11283
|
-
this.key = init.key;
|
|
11284
|
-
this.typeCast = init.typeCast;
|
|
11285
|
-
}
|
|
11286
|
-
toString() {
|
|
11287
|
-
const obj = encodePathComponent(this.resource, this.key, this.typeCast);
|
|
11288
|
-
if (obj)
|
|
11289
|
-
Object.setPrototypeOf(obj, _OpraURLPathComponent.prototype);
|
|
11290
|
-
return obj;
|
|
11291
|
-
}
|
|
11292
|
-
/* istanbul ignore next */
|
|
11293
|
-
[nodeInspectCustom2]() {
|
|
11294
|
-
const out = {
|
|
11295
|
-
resource: this.resource
|
|
11296
|
-
};
|
|
11297
|
-
if (this.key != null)
|
|
11298
|
-
out.key = this.key;
|
|
11299
|
-
if (this.typeCast != null)
|
|
11300
|
-
out.typeCast = this.typeCast;
|
|
11301
|
-
return out;
|
|
11302
10717
|
}
|
|
11303
10718
|
};
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
var pathComponentRegEx = /^([^/?#:@]+)(?:@([^/?#:]*))?(?:::(.*))?$/;
|
|
11308
|
-
function decodePathComponent(input) {
|
|
11309
|
-
const m = pathComponentRegEx.exec(input);
|
|
11310
|
-
if (!m)
|
|
11311
|
-
throw Object.assign(new TypeError("Invalid URL path"), {
|
|
11312
|
-
code: "ERR_INVALID_URL_PATH",
|
|
11313
|
-
input
|
|
11314
|
-
});
|
|
11315
|
-
const resource = decodeURIComponent(m[1]);
|
|
11316
|
-
let key;
|
|
11317
|
-
if (m[2]) {
|
|
11318
|
-
const s = decodeURIComponent(m[2] || "");
|
|
11319
|
-
const b = splitString3(s, { delimiters: ";", quotes: true, escape: false });
|
|
11320
|
-
for (const k of b) {
|
|
11321
|
-
const c = splitString3(k, { delimiters: "=", quotes: true, escape: false });
|
|
11322
|
-
if (b.length > 1 && c.length < 2 || (key && (c.length >= 2 && typeof key !== "object") || c.length < 2 && typeof key === "object"))
|
|
11323
|
-
throw Object.assign(new TypeError("Invalid URL path. name:value pair required for multiple key format"), {
|
|
11324
|
-
pathComponent: input,
|
|
11325
|
-
code: "ERR_INVALID_URL_PATH"
|
|
11326
|
-
});
|
|
11327
|
-
if (c.length >= 2) {
|
|
11328
|
-
key = key || {};
|
|
11329
|
-
key[c.shift() || ""] = c.join("=");
|
|
11330
|
-
} else
|
|
11331
|
-
key = c[0];
|
|
11332
|
-
}
|
|
11333
|
-
}
|
|
11334
|
-
if (m[3]) {
|
|
11335
|
-
return { resource, key, typeCast: m[3] };
|
|
11336
|
-
}
|
|
11337
|
-
return { resource, key };
|
|
10719
|
+
function removeLeadingSeparator(s) {
|
|
10720
|
+
const m = /^\/*(.*)/.exec(s);
|
|
10721
|
+
return m?.[1] || s;
|
|
11338
10722
|
}
|
|
11339
|
-
__name(
|
|
10723
|
+
__name(removeLeadingSeparator, "removeLeadingSeparator");
|
|
11340
10724
|
|
|
11341
|
-
// ../../build/common/esm/
|
|
10725
|
+
// ../../build/common/esm/http/opra-url.js
|
|
11342
10726
|
var _a4;
|
|
11343
10727
|
var nodeInspectCustom3 = Symbol.for("nodejs.util.inspect.custom");
|
|
11344
|
-
var kEntries2 = Symbol("kEntries");
|
|
11345
|
-
var kOptions3 = Symbol("kOptions");
|
|
11346
|
-
var OpraURLPath = class _OpraURLPath {
|
|
11347
|
-
static {
|
|
11348
|
-
__name(this, "OpraURLPath");
|
|
11349
|
-
}
|
|
11350
|
-
constructor(init, options) {
|
|
11351
|
-
this[_a4] = [];
|
|
11352
|
-
this[kOptions3] = { ...options, onChange: void 0 };
|
|
11353
|
-
if (Array.isArray(init))
|
|
11354
|
-
this.join(...init);
|
|
11355
|
-
else if (init)
|
|
11356
|
-
this.join(init);
|
|
11357
|
-
this[kOptions3].onChange = options?.onChange;
|
|
11358
|
-
}
|
|
11359
|
-
get size() {
|
|
11360
|
-
return this[kEntries2].length;
|
|
11361
|
-
}
|
|
11362
|
-
changed() {
|
|
11363
|
-
if (this[kOptions3].onChange)
|
|
11364
|
-
this[kOptions3].onChange();
|
|
11365
|
-
}
|
|
11366
|
-
clear() {
|
|
11367
|
-
this[kEntries2] = [];
|
|
11368
|
-
this.changed();
|
|
11369
|
-
}
|
|
11370
|
-
get(index) {
|
|
11371
|
-
return this[kEntries2][index];
|
|
11372
|
-
}
|
|
11373
|
-
join(...source) {
|
|
11374
|
-
source.forEach((x) => this._join(this[kEntries2], x));
|
|
11375
|
-
this.changed();
|
|
11376
|
-
return this;
|
|
11377
|
-
}
|
|
11378
|
-
entries() {
|
|
11379
|
-
let i = -1;
|
|
11380
|
-
const arr = [...this[kEntries2]];
|
|
11381
|
-
return {
|
|
11382
|
-
[Symbol.iterator]() {
|
|
11383
|
-
return this;
|
|
11384
|
-
},
|
|
11385
|
-
next() {
|
|
11386
|
-
i++;
|
|
11387
|
-
return {
|
|
11388
|
-
done: i >= arr.length,
|
|
11389
|
-
value: [arr[i], i]
|
|
11390
|
-
};
|
|
11391
|
-
}
|
|
11392
|
-
};
|
|
11393
|
-
}
|
|
11394
|
-
forEach(callback) {
|
|
11395
|
-
for (const item of this[kEntries2]) {
|
|
11396
|
-
callback.call(this, item, this);
|
|
11397
|
-
}
|
|
11398
|
-
}
|
|
11399
|
-
getResource(index) {
|
|
11400
|
-
const v = this[kEntries2][index];
|
|
11401
|
-
return v == null ? void 0 : v.resource;
|
|
11402
|
-
}
|
|
11403
|
-
getKey(index) {
|
|
11404
|
-
const v = this[kEntries2][index];
|
|
11405
|
-
return v == null ? void 0 : v.key;
|
|
11406
|
-
}
|
|
11407
|
-
pop() {
|
|
11408
|
-
const out = this[kEntries2].pop();
|
|
11409
|
-
this.changed();
|
|
11410
|
-
return out;
|
|
11411
|
-
}
|
|
11412
|
-
shift() {
|
|
11413
|
-
const out = this[kEntries2].shift();
|
|
11414
|
-
this.changed();
|
|
11415
|
-
return out;
|
|
11416
|
-
}
|
|
11417
|
-
slice(start, end) {
|
|
11418
|
-
return new _OpraURLPath(this[kEntries2].slice(start, end));
|
|
11419
|
-
}
|
|
11420
|
-
splice(start, deleteCount, join) {
|
|
11421
|
-
const items = join ? this._join([], join) : [];
|
|
11422
|
-
this[kEntries2].splice(start, deleteCount, ...items);
|
|
11423
|
-
this.changed();
|
|
11424
|
-
}
|
|
11425
|
-
unshift(join) {
|
|
11426
|
-
return this.splice(0, 0, join);
|
|
11427
|
-
}
|
|
11428
|
-
toString() {
|
|
11429
|
-
return this[kEntries2].map((x) => encodePathComponent(x.resource, x.key, x.typeCast)).join("/");
|
|
11430
|
-
}
|
|
11431
|
-
values() {
|
|
11432
|
-
let i = -1;
|
|
11433
|
-
const arr = [...this[kEntries2]];
|
|
11434
|
-
return {
|
|
11435
|
-
[Symbol.iterator]() {
|
|
11436
|
-
return this;
|
|
11437
|
-
},
|
|
11438
|
-
next() {
|
|
11439
|
-
i++;
|
|
11440
|
-
return {
|
|
11441
|
-
done: i >= arr.length,
|
|
11442
|
-
value: arr[i]
|
|
11443
|
-
};
|
|
11444
|
-
}
|
|
11445
|
-
};
|
|
11446
|
-
}
|
|
11447
|
-
_join(target, source) {
|
|
11448
|
-
if (typeof source === "string") {
|
|
11449
|
-
const pathTokenizer = tokenize3(normalizePath(source, true), {
|
|
11450
|
-
delimiters: "/",
|
|
11451
|
-
quotes: true,
|
|
11452
|
-
brackets: true
|
|
11453
|
-
});
|
|
11454
|
-
for (const x of pathTokenizer) {
|
|
11455
|
-
const p = decodePathComponent(x);
|
|
11456
|
-
target.push(new OpraURLPathComponent(p));
|
|
11457
|
-
}
|
|
11458
|
-
return;
|
|
11459
|
-
}
|
|
11460
|
-
if (source instanceof _OpraURLPath) {
|
|
11461
|
-
target.push(...source[kEntries2].map((x) => new OpraURLPathComponent(x)));
|
|
11462
|
-
return;
|
|
11463
|
-
}
|
|
11464
|
-
if (typeof source === "object" && source.path instanceof _OpraURLPath) {
|
|
11465
|
-
this._join(target, source.path);
|
|
11466
|
-
return;
|
|
11467
|
-
}
|
|
11468
|
-
if (isURL(source)) {
|
|
11469
|
-
this._join(target, source.pathname);
|
|
11470
|
-
return;
|
|
11471
|
-
}
|
|
11472
|
-
if (Array.isArray(source)) {
|
|
11473
|
-
source.forEach((x) => this._join(target, x));
|
|
11474
|
-
return;
|
|
11475
|
-
}
|
|
11476
|
-
target.push(new OpraURLPathComponent(source));
|
|
11477
|
-
}
|
|
11478
|
-
/* istanbul ignore next */
|
|
11479
|
-
[(_a4 = kEntries2, nodeInspectCustom3)]() {
|
|
11480
|
-
return this[kEntries2];
|
|
11481
|
-
}
|
|
11482
|
-
[Symbol.iterator]() {
|
|
11483
|
-
return this.entries();
|
|
11484
|
-
}
|
|
11485
|
-
get [Symbol.toStringTag]() {
|
|
11486
|
-
return "OpraURLPath";
|
|
11487
|
-
}
|
|
11488
|
-
};
|
|
11489
|
-
OpraURLPath.kEntries = kEntries2;
|
|
11490
|
-
OpraURLPath.kOptions = kOptions3;
|
|
11491
|
-
|
|
11492
|
-
// ../../build/common/esm/url/opra-url.js
|
|
11493
|
-
var _a5;
|
|
11494
|
-
var nodeInspectCustom4 = Symbol.for("nodejs.util.inspect.custom");
|
|
11495
10728
|
var urlRegEx = /^(?:((?:[A-Z][A-Z+-.]+:)+)\/\/([^/?]+))?(.*)?$/i;
|
|
11496
10729
|
var schemeRegEx = /^([A-Z][A-Z+-.]+:?)+$/i;
|
|
11497
10730
|
var hostRegEx = /^([^/:]+)(?::(\d+))?$/;
|
|
11498
10731
|
var hostnameRegEx = /^([^/:]+)$/;
|
|
11499
|
-
var kContext = Symbol("kContext");
|
|
11500
|
-
var kPath = Symbol("kPath");
|
|
11501
|
-
var
|
|
10732
|
+
var kContext = Symbol.for("kContext");
|
|
10733
|
+
var kPath = Symbol.for("kPath");
|
|
10734
|
+
var kSearchParams = Symbol.for("kSearchParams");
|
|
11502
10735
|
var OpraURL = class _OpraURL {
|
|
11503
10736
|
static {
|
|
11504
10737
|
__name(this, "OpraURL");
|
|
11505
10738
|
}
|
|
11506
10739
|
constructor(input, base) {
|
|
11507
|
-
this[
|
|
10740
|
+
this[_a4] = {
|
|
11508
10741
|
protocol: "",
|
|
11509
10742
|
username: "",
|
|
11510
|
-
prefix: "",
|
|
11511
10743
|
hostname: "",
|
|
11512
10744
|
port: "",
|
|
11513
10745
|
hash: "",
|
|
11514
10746
|
password: ""
|
|
11515
10747
|
};
|
|
11516
|
-
this[
|
|
11517
|
-
|
|
11518
|
-
this[kContext].pathname = void 0;
|
|
11519
|
-
this[kContext].address = void 0;
|
|
11520
|
-
}
|
|
11521
|
-
});
|
|
11522
|
-
this[kParams] = new HttpParams("", {
|
|
11523
|
-
onChange: () => {
|
|
11524
|
-
this[kContext].search = void 0;
|
|
11525
|
-
}
|
|
11526
|
-
});
|
|
10748
|
+
this[kSearchParams] = new URLSearchParams();
|
|
10749
|
+
this[kPath] = new OpraURLPath();
|
|
11527
10750
|
if (input)
|
|
11528
|
-
this.
|
|
11529
|
-
if (base) {
|
|
10751
|
+
this._parse(String(input));
|
|
10752
|
+
if (base && !this.host) {
|
|
11530
10753
|
const baseUrl = base instanceof _OpraURL ? base : new _OpraURL(base);
|
|
11531
10754
|
this[kContext].protocol = baseUrl.protocol;
|
|
11532
10755
|
this[kContext].hostname = baseUrl.hostname;
|
|
10756
|
+
this[kContext].username = baseUrl.username;
|
|
10757
|
+
this[kContext].password = baseUrl.password;
|
|
11533
10758
|
this[kContext].port = baseUrl.port;
|
|
11534
|
-
this
|
|
10759
|
+
this.path = OpraURLPath.join(baseUrl.path, this.path);
|
|
11535
10760
|
}
|
|
11536
10761
|
}
|
|
11537
10762
|
get address() {
|
|
@@ -11540,7 +10765,7 @@ var OpraURL = class _OpraURL {
|
|
|
11540
10765
|
if (this[kContext].hostname) {
|
|
11541
10766
|
address += (this[kContext].protocol || "http:") + "//" + (this[kContext].username || this[kContext].password ? (this[kContext].username ? encodeURIComponent(this[kContext].username) : "") + (this[kContext].password ? ":" + encodeURIComponent(this[kContext].password) : "") + "@" : "") + this.host;
|
|
11542
10767
|
}
|
|
11543
|
-
this[kContext].address = address + (this.
|
|
10768
|
+
this[kContext].address = address + (this.pathname !== "/" ? this.pathname : "");
|
|
11544
10769
|
}
|
|
11545
10770
|
return this[kContext].address;
|
|
11546
10771
|
}
|
|
@@ -11575,7 +10800,7 @@ var OpraURL = class _OpraURL {
|
|
|
11575
10800
|
this[kContext].hostname = v;
|
|
11576
10801
|
} else
|
|
11577
10802
|
this[kContext].hostname = "";
|
|
11578
|
-
this
|
|
10803
|
+
this.invalidate();
|
|
11579
10804
|
}
|
|
11580
10805
|
get href() {
|
|
11581
10806
|
return this.address + this.search + this.hash;
|
|
@@ -11585,7 +10810,7 @@ var OpraURL = class _OpraURL {
|
|
|
11585
10810
|
}
|
|
11586
10811
|
set password(v) {
|
|
11587
10812
|
this[kContext].password = v ?? "";
|
|
11588
|
-
this
|
|
10813
|
+
this.invalidate();
|
|
11589
10814
|
}
|
|
11590
10815
|
get port() {
|
|
11591
10816
|
return this[kContext].port;
|
|
@@ -11593,25 +10818,15 @@ var OpraURL = class _OpraURL {
|
|
|
11593
10818
|
set port(value) {
|
|
11594
10819
|
if (value) {
|
|
11595
10820
|
const v = typeof value === "number" ? value : parseInt(value, 10);
|
|
11596
|
-
if (isNaN(v) || v < 1 || v >
|
|
11597
|
-
throw Object.assign(new TypeError(
|
|
10821
|
+
if (isNaN(v) || v < 1 || v > 65535 || v % 1 > 0)
|
|
10822
|
+
throw Object.assign(new TypeError(`Invalid port number (${value})`), {
|
|
11598
10823
|
hostname: v,
|
|
11599
10824
|
code: "ERR_INVALID_URL"
|
|
11600
10825
|
});
|
|
11601
|
-
this[kContext].port = String(v);
|
|
11602
|
-
} else
|
|
11603
|
-
this[kContext].port = "";
|
|
11604
|
-
}
|
|
11605
|
-
get prefix() {
|
|
11606
|
-
return this[kContext].prefix;
|
|
11607
|
-
}
|
|
11608
|
-
set prefix(value) {
|
|
11609
|
-
if (value) {
|
|
11610
|
-
const url = new _OpraURL(value);
|
|
11611
|
-
this[kContext].prefix = url.pathname;
|
|
10826
|
+
this[kContext].port = String(v);
|
|
11612
10827
|
} else
|
|
11613
|
-
this[kContext].
|
|
11614
|
-
this
|
|
10828
|
+
this[kContext].port = "";
|
|
10829
|
+
this.invalidate();
|
|
11615
10830
|
}
|
|
11616
10831
|
get protocol() {
|
|
11617
10832
|
return this[kContext].protocol;
|
|
@@ -11626,14 +10841,14 @@ var OpraURL = class _OpraURL {
|
|
|
11626
10841
|
this[kContext].protocol = v + (v.endsWith(":") ? "" : ":");
|
|
11627
10842
|
} else
|
|
11628
10843
|
this[kContext].protocol = "";
|
|
11629
|
-
this
|
|
10844
|
+
this.invalidate();
|
|
11630
10845
|
}
|
|
11631
10846
|
get username() {
|
|
11632
10847
|
return this[kContext].username;
|
|
11633
10848
|
}
|
|
11634
10849
|
set username(v) {
|
|
11635
10850
|
this[kContext].username = v ?? "";
|
|
11636
|
-
this
|
|
10851
|
+
this.invalidate();
|
|
11637
10852
|
}
|
|
11638
10853
|
get origin() {
|
|
11639
10854
|
return this.hostname ? this.protocol + "//" + this.hostname : "";
|
|
@@ -11641,13 +10856,19 @@ var OpraURL = class _OpraURL {
|
|
|
11641
10856
|
get path() {
|
|
11642
10857
|
return this[kPath];
|
|
11643
10858
|
}
|
|
10859
|
+
set path(path2) {
|
|
10860
|
+
this[kPath] = path2 instanceof OpraURLPath ? path2 : new OpraURLPath(path2);
|
|
10861
|
+
this[kContext].pathname = String(this[kPath]);
|
|
10862
|
+
this.invalidate();
|
|
10863
|
+
}
|
|
11644
10864
|
get pathname() {
|
|
11645
10865
|
if (this[kContext].pathname == null)
|
|
11646
|
-
this[kContext].pathname =
|
|
10866
|
+
this[kContext].pathname = this.path.toString() || "/";
|
|
11647
10867
|
return this[kContext].pathname;
|
|
11648
10868
|
}
|
|
11649
10869
|
set pathname(v) {
|
|
11650
|
-
this
|
|
10870
|
+
this[kPath] = new OpraURLPath(v);
|
|
10871
|
+
this.invalidate();
|
|
11651
10872
|
}
|
|
11652
10873
|
get hash() {
|
|
11653
10874
|
return this[kContext].hash;
|
|
@@ -11656,23 +10877,36 @@ var OpraURL = class _OpraURL {
|
|
|
11656
10877
|
this[kContext].hash = v ? v.startsWith("#") ? v : "#" + v : "";
|
|
11657
10878
|
}
|
|
11658
10879
|
get search() {
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
this[kContext].search = s ? "?" + s : "";
|
|
11662
|
-
}
|
|
11663
|
-
return this[kContext].search;
|
|
10880
|
+
const s = this[kSearchParams].toString();
|
|
10881
|
+
return s ? "?" + s : "";
|
|
11664
10882
|
}
|
|
11665
10883
|
set search(v) {
|
|
11666
|
-
|
|
11667
|
-
this[kParams].clear();
|
|
11668
|
-
this[kParams].appendAll(v);
|
|
11669
|
-
}
|
|
11670
|
-
this[kContext].search = void 0;
|
|
10884
|
+
this[kSearchParams] = new URLSearchParams(v);
|
|
11671
10885
|
}
|
|
11672
10886
|
get searchParams() {
|
|
11673
|
-
return this[
|
|
10887
|
+
return this[kSearchParams];
|
|
10888
|
+
}
|
|
10889
|
+
set setSearchParams(v) {
|
|
10890
|
+
this[kSearchParams] = v;
|
|
10891
|
+
}
|
|
10892
|
+
invalidate() {
|
|
10893
|
+
this[kContext].address = void 0;
|
|
10894
|
+
this[kContext].pathname = void 0;
|
|
10895
|
+
}
|
|
10896
|
+
join(...items) {
|
|
10897
|
+
this.path = this.path.join(...items);
|
|
10898
|
+
this.invalidate();
|
|
10899
|
+
return this;
|
|
10900
|
+
}
|
|
10901
|
+
resolve(...items) {
|
|
10902
|
+
this.path = this.path.resolve(...items);
|
|
10903
|
+
this.invalidate();
|
|
10904
|
+
return this;
|
|
10905
|
+
}
|
|
10906
|
+
toString() {
|
|
10907
|
+
return this.href;
|
|
11674
10908
|
}
|
|
11675
|
-
|
|
10909
|
+
_parse(input) {
|
|
11676
10910
|
const m = urlRegEx.exec(input);
|
|
11677
10911
|
if (!m)
|
|
11678
10912
|
throw Object.assign(new TypeError("Invalid URL"), {
|
|
@@ -11682,10 +10916,10 @@ var OpraURL = class _OpraURL {
|
|
|
11682
10916
|
this.protocol = m[1];
|
|
11683
10917
|
const isAbsolute = !!m[2];
|
|
11684
10918
|
if (isAbsolute) {
|
|
11685
|
-
let tokens =
|
|
10919
|
+
let tokens = splitString3(m[2], { delimiters: "@" });
|
|
11686
10920
|
if (tokens.length > 1) {
|
|
11687
10921
|
this.host = tokens[1];
|
|
11688
|
-
tokens =
|
|
10922
|
+
tokens = splitString3(tokens[0], { delimiters: ":" });
|
|
11689
10923
|
this.username = tokens[0] ? decodeURIComponent(tokens[0]) : "";
|
|
11690
10924
|
this.password = tokens[1] ? decodeURIComponent(tokens[1]) : "";
|
|
11691
10925
|
} else
|
|
@@ -11696,22 +10930,15 @@ var OpraURL = class _OpraURL {
|
|
|
11696
10930
|
this.password = "";
|
|
11697
10931
|
}
|
|
11698
10932
|
input = m[3] || "";
|
|
11699
|
-
let tokenizer =
|
|
10933
|
+
let tokenizer = tokenize3(input, { delimiters: "#", quotes: true, brackets: true });
|
|
11700
10934
|
input = tokenizer.next() || "";
|
|
11701
10935
|
this.hash = tokenizer.join("#");
|
|
11702
|
-
tokenizer =
|
|
11703
|
-
this.
|
|
10936
|
+
tokenizer = tokenize3(input, { delimiters: "?", quotes: true, brackets: true });
|
|
10937
|
+
this.path = new OpraURLPath(tokenizer.next());
|
|
11704
10938
|
this.search = tokenizer.join("&");
|
|
11705
10939
|
}
|
|
11706
|
-
join(...source) {
|
|
11707
|
-
this.path.join(...source);
|
|
11708
|
-
return this;
|
|
11709
|
-
}
|
|
11710
|
-
toString() {
|
|
11711
|
-
return this.href;
|
|
11712
|
-
}
|
|
11713
10940
|
/* istanbul ignore next */
|
|
11714
|
-
[(
|
|
10941
|
+
[(_a4 = kContext, nodeInspectCustom3)]() {
|
|
11715
10942
|
return {
|
|
11716
10943
|
protocol: this.protocol,
|
|
11717
10944
|
username: this.username,
|
|
@@ -11719,66 +10946,239 @@ var OpraURL = class _OpraURL {
|
|
|
11719
10946
|
host: this.host,
|
|
11720
10947
|
hostname: this.hostname,
|
|
11721
10948
|
origin: this.origin,
|
|
11722
|
-
pathPrefix: this.prefix,
|
|
11723
10949
|
path: this.path,
|
|
11724
10950
|
pathname: this.pathname,
|
|
11725
10951
|
search: this.search,
|
|
11726
10952
|
hash: this.hash
|
|
11727
10953
|
};
|
|
11728
10954
|
}
|
|
11729
|
-
//
|
|
11730
|
-
// protected _update() {
|
|
11731
|
-
// if (!this[kContext].needUpdate)
|
|
11732
|
-
// return;
|
|
11733
|
-
// const ctx = this[kContext];
|
|
11734
|
-
// ctx.needUpdate = false;
|
|
11735
|
-
// let s = this.path.toString();
|
|
11736
|
-
// ctx.pathname = s ? '/' + s : '';
|
|
11737
|
-
// s = this.searchParams.toString();
|
|
11738
|
-
// ctx.search = s ? '?' + s : '';
|
|
11739
|
-
//
|
|
11740
|
-
// let address = '';
|
|
11741
|
-
// if (ctx.hostname) {
|
|
11742
|
-
// address += (ctx.protocol || 'http:') + '//' +
|
|
11743
|
-
// (ctx.username || ctx.password
|
|
11744
|
-
// ? (
|
|
11745
|
-
// (ctx.username ? encodeURIComponent(ctx.username) : '') +
|
|
11746
|
-
// (ctx.password ? ':' + encodeURIComponent(ctx.password) : '') + '@'
|
|
11747
|
-
// )
|
|
11748
|
-
// : '') + this.host;
|
|
11749
|
-
// }
|
|
11750
|
-
// ctx.address = address + ctx.prefix + ctx.pathname;
|
|
11751
|
-
// }
|
|
11752
|
-
_setPathname(v, trimPrefix) {
|
|
11753
|
-
this.path.clear();
|
|
11754
|
-
if (!v)
|
|
11755
|
-
return;
|
|
11756
|
-
const pathTokenizer = tokenize4(normalizePath(v, true), {
|
|
11757
|
-
delimiters: "/",
|
|
11758
|
-
quotes: true,
|
|
11759
|
-
brackets: true
|
|
11760
|
-
});
|
|
11761
|
-
if (trimPrefix && this.prefix) {
|
|
11762
|
-
const prefixTokenizer = tokenize4(normalizePath(this.prefix, true), {
|
|
11763
|
-
delimiters: "/",
|
|
11764
|
-
quotes: true,
|
|
11765
|
-
brackets: true
|
|
11766
|
-
});
|
|
11767
|
-
for (const a of prefixTokenizer) {
|
|
11768
|
-
const b = pathTokenizer.next();
|
|
11769
|
-
if (a !== b)
|
|
11770
|
-
throw Object.assign(new Error("Invalid URL path. pathPrefix does not match"), { path: v, code: "ERR_INVALID_URL_PATH" });
|
|
11771
|
-
}
|
|
11772
|
-
}
|
|
11773
|
-
for (const x of pathTokenizer) {
|
|
11774
|
-
const p = decodePathComponent(x);
|
|
11775
|
-
this.path.join(p);
|
|
11776
|
-
}
|
|
11777
|
-
}
|
|
11778
10955
|
};
|
|
11779
10956
|
OpraURL.kContext = kContext;
|
|
11780
10957
|
OpraURL.kPath = kPath;
|
|
11781
|
-
OpraURL.kParams =
|
|
10958
|
+
OpraURL.kParams = kSearchParams;
|
|
10959
|
+
|
|
10960
|
+
// ../../build/common/esm/http/enums/http-headers-codes.enum.js
|
|
10961
|
+
var HttpHeaderCodes;
|
|
10962
|
+
(function(HttpHeaderCodes2) {
|
|
10963
|
+
HttpHeaderCodes2["X_Opra_Version"] = "X-Opra-Version";
|
|
10964
|
+
HttpHeaderCodes2["X_Total_Count"] = "X-Total-Count";
|
|
10965
|
+
HttpHeaderCodes2["WWW_Authenticate"] = "WWW-Authenticate";
|
|
10966
|
+
HttpHeaderCodes2["Authorization"] = "Authorization";
|
|
10967
|
+
HttpHeaderCodes2["Proxy_Authenticate"] = "Proxy-Authenticate";
|
|
10968
|
+
HttpHeaderCodes2["Proxy_Authorization"] = "Proxy-Authorization";
|
|
10969
|
+
HttpHeaderCodes2["Age"] = "Age";
|
|
10970
|
+
HttpHeaderCodes2["Cache_Control"] = "Cache-Control";
|
|
10971
|
+
HttpHeaderCodes2["Clear_Site_Data"] = "Clear-Site-Data";
|
|
10972
|
+
HttpHeaderCodes2["Expires"] = "Expires";
|
|
10973
|
+
HttpHeaderCodes2["Pragma"] = "Pragma";
|
|
10974
|
+
HttpHeaderCodes2["Last_Modified"] = "Last-Modified";
|
|
10975
|
+
HttpHeaderCodes2["ETag"] = "ETag";
|
|
10976
|
+
HttpHeaderCodes2["If_Match"] = "If-Match";
|
|
10977
|
+
HttpHeaderCodes2["If_None_Match"] = "If-None-Match";
|
|
10978
|
+
HttpHeaderCodes2["If_Modified_Since"] = "If-Modified-Since";
|
|
10979
|
+
HttpHeaderCodes2["If_Unmodified_Since"] = "If-Unmodified-Since";
|
|
10980
|
+
HttpHeaderCodes2["Vary"] = "Vary";
|
|
10981
|
+
HttpHeaderCodes2["Connection"] = "Connection";
|
|
10982
|
+
HttpHeaderCodes2["Keep_Alive"] = "Keep-Alive";
|
|
10983
|
+
HttpHeaderCodes2["Accept"] = "Accept";
|
|
10984
|
+
HttpHeaderCodes2["Accept_Encoding"] = "Accept-Encoding";
|
|
10985
|
+
HttpHeaderCodes2["Accept_Language"] = "Accept-Language";
|
|
10986
|
+
HttpHeaderCodes2["Expect"] = "Expect";
|
|
10987
|
+
HttpHeaderCodes2["Cookie"] = "Cookie";
|
|
10988
|
+
HttpHeaderCodes2["Set_Cookie"] = "Set-Cookie";
|
|
10989
|
+
HttpHeaderCodes2["Access_Control_Allow_Origin"] = "Access-Control-Allow-Origin";
|
|
10990
|
+
HttpHeaderCodes2["Access_Control_Allow_Credentials"] = "Access-Control-Allow-Credentials";
|
|
10991
|
+
HttpHeaderCodes2["Access_Control_Allow_Headers"] = "Access-Control-Allow-Headers";
|
|
10992
|
+
HttpHeaderCodes2["Access_Control_Allow_Methods"] = "Access-Control-Allow-Methods";
|
|
10993
|
+
HttpHeaderCodes2["Access_Control_Expose_Headers"] = "Access-Control-Expose-Headers";
|
|
10994
|
+
HttpHeaderCodes2["Access_Control_Max_Age"] = "Access-Control-Max-Age";
|
|
10995
|
+
HttpHeaderCodes2["Access_Control_Request_Headers"] = "Access-Control-Request-Headers";
|
|
10996
|
+
HttpHeaderCodes2["Access_Control_Request_Method"] = "Access-Control-Request-Method";
|
|
10997
|
+
HttpHeaderCodes2["Origin"] = "Origin";
|
|
10998
|
+
HttpHeaderCodes2["Timing_Allow_Origin"] = "Timing-Allow-Origin";
|
|
10999
|
+
HttpHeaderCodes2["Content_Disposition"] = "Content-Disposition";
|
|
11000
|
+
HttpHeaderCodes2["Content_ID"] = "Content-ID";
|
|
11001
|
+
HttpHeaderCodes2["Content_Length"] = "Content-Length";
|
|
11002
|
+
HttpHeaderCodes2["Content_Type"] = "Content-Type";
|
|
11003
|
+
HttpHeaderCodes2["Content_Transfer_Encoding"] = "Content-Transfer-Encoding";
|
|
11004
|
+
HttpHeaderCodes2["Content_Encoding"] = "Content-Encoding";
|
|
11005
|
+
HttpHeaderCodes2["Content_Language"] = "Content-Language";
|
|
11006
|
+
HttpHeaderCodes2["Content_Location"] = "Content-Location";
|
|
11007
|
+
HttpHeaderCodes2["Forwarded"] = "Forwarded";
|
|
11008
|
+
HttpHeaderCodes2["X_Forwarded_For"] = "X-Forwarded-For";
|
|
11009
|
+
HttpHeaderCodes2["X_Forwarded_Host"] = "X-Forwarded-Host";
|
|
11010
|
+
HttpHeaderCodes2["X_Forwarded_Proto"] = "X-Forwarded-Proto";
|
|
11011
|
+
HttpHeaderCodes2["Via"] = "Via";
|
|
11012
|
+
HttpHeaderCodes2["Location"] = "Location";
|
|
11013
|
+
HttpHeaderCodes2["From"] = "From";
|
|
11014
|
+
HttpHeaderCodes2["Host"] = "Host";
|
|
11015
|
+
HttpHeaderCodes2["Referer"] = "Referer";
|
|
11016
|
+
HttpHeaderCodes2["Referrer_Policy"] = "Referrer-Policy";
|
|
11017
|
+
HttpHeaderCodes2["User_Agent"] = "User-Agent";
|
|
11018
|
+
HttpHeaderCodes2["Allow"] = "Allow";
|
|
11019
|
+
HttpHeaderCodes2["Server"] = "Server";
|
|
11020
|
+
HttpHeaderCodes2["Accept_Ranges"] = "Accept-Ranges";
|
|
11021
|
+
HttpHeaderCodes2["Range"] = "Range";
|
|
11022
|
+
HttpHeaderCodes2["If_Range"] = "If-Range";
|
|
11023
|
+
HttpHeaderCodes2["Content_Range"] = "Content-Range";
|
|
11024
|
+
HttpHeaderCodes2["Cross_Origin_Embedder_Policy"] = "Cross-Origin-Embedder-Policy";
|
|
11025
|
+
HttpHeaderCodes2["Cross_Origin_Opener_Policy"] = "Cross-Origin-Opener-Policy";
|
|
11026
|
+
HttpHeaderCodes2["Cross_Origin_Resource_Policy"] = "Cross-Origin-Resource-Policy";
|
|
11027
|
+
HttpHeaderCodes2["Content_Security_Policy"] = "Content-Security-Policy";
|
|
11028
|
+
HttpHeaderCodes2["Content_Security_Policy_Report_Only"] = "Content-Security-Policy-Report-Only";
|
|
11029
|
+
HttpHeaderCodes2["Expect_CT"] = "Expect-CT";
|
|
11030
|
+
HttpHeaderCodes2["Feature_Policy"] = "Feature-Policy";
|
|
11031
|
+
HttpHeaderCodes2["Strict_Transport_Security"] = "Strict-Transport-Security";
|
|
11032
|
+
HttpHeaderCodes2["Upgrade"] = "Upgrade";
|
|
11033
|
+
HttpHeaderCodes2["Upgrade_Insecure_Requests"] = "Upgrade-Insecure-Requests";
|
|
11034
|
+
HttpHeaderCodes2["X_Content_Type_Options"] = "X-Content-Type-Options";
|
|
11035
|
+
HttpHeaderCodes2["X_Download_Options"] = "X-Download-Options";
|
|
11036
|
+
HttpHeaderCodes2["X_Frame_Options"] = "X-Frame-Options";
|
|
11037
|
+
HttpHeaderCodes2["X_Permitted_Cross_Domain_Policies"] = "X-Permitted-Cross-Domain-Policies";
|
|
11038
|
+
HttpHeaderCodes2["X_Powered_By"] = "X-Powered-By";
|
|
11039
|
+
HttpHeaderCodes2["X_XSS_Protection"] = "X-XSS-Protection";
|
|
11040
|
+
HttpHeaderCodes2["Transfer_Encoding"] = "Transfer-Encoding";
|
|
11041
|
+
HttpHeaderCodes2["TE"] = "TE";
|
|
11042
|
+
HttpHeaderCodes2["Trailer"] = "Trailer";
|
|
11043
|
+
HttpHeaderCodes2["Sec_WebSocket_Key"] = "Sec-WebSocket-Key";
|
|
11044
|
+
HttpHeaderCodes2["Sec_WebSocket_Extensions"] = "Sec-WebSocket-Extensions";
|
|
11045
|
+
HttpHeaderCodes2["Sec_WebSocket_Accept"] = "Sec-WebSocket-Accept";
|
|
11046
|
+
HttpHeaderCodes2["Sec_WebSocket_Protocol"] = "Sec-WebSocket-Protocol";
|
|
11047
|
+
HttpHeaderCodes2["Sec_WebSocket_Version"] = "Sec-WebSocket-Version";
|
|
11048
|
+
HttpHeaderCodes2["Date"] = "Date";
|
|
11049
|
+
HttpHeaderCodes2["Retry_After"] = "Retry-After";
|
|
11050
|
+
HttpHeaderCodes2["Server_Timing"] = "Server-Timing";
|
|
11051
|
+
HttpHeaderCodes2["X_DNS_Prefetch_Control"] = "X-DNS-Prefetch-Control";
|
|
11052
|
+
HttpHeaderCodes2["Max_Forwards"] = "Max-Forwards";
|
|
11053
|
+
})(HttpHeaderCodes || (HttpHeaderCodes = {}));
|
|
11054
|
+
|
|
11055
|
+
// ../../build/common/esm/http/enums/http-status-codes.enum.js
|
|
11056
|
+
var HttpStatusCodes;
|
|
11057
|
+
(function(HttpStatusCodes2) {
|
|
11058
|
+
HttpStatusCodes2[HttpStatusCodes2["CONTINUE"] = 100] = "CONTINUE";
|
|
11059
|
+
HttpStatusCodes2[HttpStatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
11060
|
+
HttpStatusCodes2[HttpStatusCodes2["PROCESSING"] = 102] = "PROCESSING";
|
|
11061
|
+
HttpStatusCodes2[HttpStatusCodes2["EARLYHINTS"] = 103] = "EARLYHINTS";
|
|
11062
|
+
HttpStatusCodes2[HttpStatusCodes2["OK"] = 200] = "OK";
|
|
11063
|
+
HttpStatusCodes2[HttpStatusCodes2["CREATED"] = 201] = "CREATED";
|
|
11064
|
+
HttpStatusCodes2[HttpStatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
11065
|
+
HttpStatusCodes2[HttpStatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
11066
|
+
HttpStatusCodes2[HttpStatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
11067
|
+
HttpStatusCodes2[HttpStatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
11068
|
+
HttpStatusCodes2[HttpStatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
11069
|
+
HttpStatusCodes2[HttpStatusCodes2["AMBIGUOUS"] = 300] = "AMBIGUOUS";
|
|
11070
|
+
HttpStatusCodes2[HttpStatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
11071
|
+
HttpStatusCodes2[HttpStatusCodes2["FOUND"] = 302] = "FOUND";
|
|
11072
|
+
HttpStatusCodes2[HttpStatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
11073
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
11074
|
+
HttpStatusCodes2[HttpStatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
11075
|
+
HttpStatusCodes2[HttpStatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
11076
|
+
HttpStatusCodes2[HttpStatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
11077
|
+
HttpStatusCodes2[HttpStatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
11078
|
+
HttpStatusCodes2[HttpStatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
11079
|
+
HttpStatusCodes2[HttpStatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
11080
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
11081
|
+
HttpStatusCodes2[HttpStatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
11082
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
11083
|
+
HttpStatusCodes2[HttpStatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
11084
|
+
HttpStatusCodes2[HttpStatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
11085
|
+
HttpStatusCodes2[HttpStatusCodes2["CONFLICT"] = 409] = "CONFLICT";
|
|
11086
|
+
HttpStatusCodes2[HttpStatusCodes2["GONE"] = 410] = "GONE";
|
|
11087
|
+
HttpStatusCodes2[HttpStatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
11088
|
+
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
11089
|
+
HttpStatusCodes2[HttpStatusCodes2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
11090
|
+
HttpStatusCodes2[HttpStatusCodes2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
11091
|
+
HttpStatusCodes2[HttpStatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
11092
|
+
HttpStatusCodes2[HttpStatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
|
|
11093
|
+
HttpStatusCodes2[HttpStatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
11094
|
+
HttpStatusCodes2[HttpStatusCodes2["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
11095
|
+
HttpStatusCodes2[HttpStatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
11096
|
+
HttpStatusCodes2[HttpStatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
11097
|
+
HttpStatusCodes2[HttpStatusCodes2["LOCKED"] = 423] = "LOCKED";
|
|
11098
|
+
HttpStatusCodes2[HttpStatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
11099
|
+
HttpStatusCodes2[HttpStatusCodes2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
11100
|
+
HttpStatusCodes2[HttpStatusCodes2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
11101
|
+
HttpStatusCodes2[HttpStatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
11102
|
+
HttpStatusCodes2[HttpStatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
11103
|
+
HttpStatusCodes2[HttpStatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
11104
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
11105
|
+
HttpStatusCodes2[HttpStatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
11106
|
+
HttpStatusCodes2[HttpStatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
11107
|
+
HttpStatusCodes2[HttpStatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
11108
|
+
HttpStatusCodes2[HttpStatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
11109
|
+
HttpStatusCodes2[HttpStatusCodes2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
11110
|
+
HttpStatusCodes2[HttpStatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
11111
|
+
HttpStatusCodes2[HttpStatusCodes2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
11112
|
+
HttpStatusCodes2[HttpStatusCodes2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
11113
|
+
HttpStatusCodes2[HttpStatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
11114
|
+
})(HttpStatusCodes || (HttpStatusCodes = {}));
|
|
11115
|
+
|
|
11116
|
+
// ../../build/common/esm/http/enums/http-status-messages.js
|
|
11117
|
+
var HttpStatusMessages = {
|
|
11118
|
+
"100": "Continue",
|
|
11119
|
+
"101": "Switching Protocols",
|
|
11120
|
+
"102": "Processing",
|
|
11121
|
+
"103": "Early Hints",
|
|
11122
|
+
"200": "OK",
|
|
11123
|
+
"201": "Created",
|
|
11124
|
+
"202": "Accepted",
|
|
11125
|
+
"203": "Non-Authoritative Information",
|
|
11126
|
+
"204": "No Content",
|
|
11127
|
+
"205": "Reset Content",
|
|
11128
|
+
"206": "Partial Content",
|
|
11129
|
+
"207": "Multi-Status",
|
|
11130
|
+
"208": "Already Reported",
|
|
11131
|
+
"226": "IM Used",
|
|
11132
|
+
"300": "Multiple Choices",
|
|
11133
|
+
"301": "Moved Permanently",
|
|
11134
|
+
"302": "Found",
|
|
11135
|
+
"303": "See Other",
|
|
11136
|
+
"304": "Not Modified",
|
|
11137
|
+
"305": "Use Proxy",
|
|
11138
|
+
"307": "Temporary Redirect",
|
|
11139
|
+
"308": "Permanent Redirect",
|
|
11140
|
+
"400": "Bad Request",
|
|
11141
|
+
"401": "Unauthorized",
|
|
11142
|
+
"402": "Payment Required",
|
|
11143
|
+
"403": "Forbidden",
|
|
11144
|
+
"404": "Not Found",
|
|
11145
|
+
"405": "Method Not Allowed",
|
|
11146
|
+
"406": "Not Acceptable",
|
|
11147
|
+
"407": "Proxy Authentication Required",
|
|
11148
|
+
"408": "Request Timeout",
|
|
11149
|
+
"409": "Conflict",
|
|
11150
|
+
"410": "Gone",
|
|
11151
|
+
"411": "Length Required",
|
|
11152
|
+
"412": "Precondition Failed",
|
|
11153
|
+
"413": "Payload Too Large",
|
|
11154
|
+
"414": "URI Too Long",
|
|
11155
|
+
"415": "Unsupported Media Type",
|
|
11156
|
+
"416": "Range Not Satisfiable",
|
|
11157
|
+
"417": "Expectation Failed",
|
|
11158
|
+
"418": "I'm a Teapot",
|
|
11159
|
+
"421": "Misdirected Request",
|
|
11160
|
+
"422": "Unprocessable Entity",
|
|
11161
|
+
"423": "Locked",
|
|
11162
|
+
"424": "Failed Dependency",
|
|
11163
|
+
"425": "Too Early",
|
|
11164
|
+
"426": "Upgrade Required",
|
|
11165
|
+
"428": "Precondition Required",
|
|
11166
|
+
"429": "Too Many Requests",
|
|
11167
|
+
"431": "Request Header Fields Too Large",
|
|
11168
|
+
"451": "Unavailable For Legal Reasons",
|
|
11169
|
+
"500": "Internal Server Error",
|
|
11170
|
+
"501": "Not Implemented",
|
|
11171
|
+
"502": "Bad Gateway",
|
|
11172
|
+
"503": "Service Unavailable",
|
|
11173
|
+
"504": "Gateway Timeout",
|
|
11174
|
+
"505": "HTTP Version Not Supported",
|
|
11175
|
+
"506": "Variant Also Negotiates",
|
|
11176
|
+
"507": "Insufficient Storage",
|
|
11177
|
+
"508": "Loop Detected",
|
|
11178
|
+
"509": "Bandwidth Limit Exceeded",
|
|
11179
|
+
"510": "Not Extended",
|
|
11180
|
+
"511": "Network Authentication Required"
|
|
11181
|
+
};
|
|
11782
11182
|
|
|
11783
11183
|
// ../../build/common/esm/index.js
|
|
11784
11184
|
import { uid } from "uid";
|
|
@@ -11787,22 +11187,17 @@ export {
|
|
|
11787
11187
|
ApiField,
|
|
11788
11188
|
BadRequestError,
|
|
11789
11189
|
BaseI18n,
|
|
11790
|
-
BooleanCodec,
|
|
11791
11190
|
Collection2 as Collection,
|
|
11792
11191
|
ComplexType2 as ComplexType,
|
|
11793
11192
|
DataType,
|
|
11794
|
-
DateCodec,
|
|
11795
11193
|
DocumentFactory,
|
|
11796
11194
|
EnumType2 as EnumType,
|
|
11797
11195
|
FailedDependencyError,
|
|
11798
|
-
FilterCodec,
|
|
11799
11196
|
ForbiddenError,
|
|
11800
11197
|
HttpHeaderCodes,
|
|
11801
|
-
HttpParams,
|
|
11802
11198
|
HttpStatusCodes,
|
|
11803
11199
|
HttpStatusMessages,
|
|
11804
11200
|
I18n,
|
|
11805
|
-
IntegerCodec,
|
|
11806
11201
|
InternalServerError,
|
|
11807
11202
|
IssueSeverity,
|
|
11808
11203
|
METADATA_KEY,
|
|
@@ -11811,14 +11206,12 @@ export {
|
|
|
11811
11206
|
NAMESPACE_PATTERN,
|
|
11812
11207
|
NotAcceptableError,
|
|
11813
11208
|
NotFoundError,
|
|
11814
|
-
NumberCodec,
|
|
11815
11209
|
OmitType,
|
|
11816
11210
|
OpraException,
|
|
11817
11211
|
opra_filter_ns_exports as OpraFilter,
|
|
11818
11212
|
opra_schema_ns_exports as OpraSchema,
|
|
11819
11213
|
OpraURL,
|
|
11820
11214
|
OpraURLPath,
|
|
11821
|
-
OpraURLPathComponent,
|
|
11822
11215
|
PickType,
|
|
11823
11216
|
Resource,
|
|
11824
11217
|
ResourceConflictError,
|
|
@@ -11827,30 +11220,28 @@ export {
|
|
|
11827
11220
|
SimpleType2 as SimpleType,
|
|
11828
11221
|
Singleton2 as Singleton,
|
|
11829
11222
|
Storage2 as Storage,
|
|
11830
|
-
StringCodec,
|
|
11831
11223
|
TYPENAME_PATTERN,
|
|
11832
11224
|
UnauthorizedError,
|
|
11833
11225
|
UnionType2 as UnionType,
|
|
11834
11226
|
UnprocessableEntityError,
|
|
11835
11227
|
ValidationError,
|
|
11836
11228
|
cloneObject,
|
|
11837
|
-
decodePathComponent,
|
|
11838
|
-
encodePathComponent,
|
|
11839
|
-
encodeURIParam,
|
|
11840
11229
|
getStackFileName,
|
|
11841
11230
|
i18n,
|
|
11842
11231
|
inheritPropertyInitializers,
|
|
11232
|
+
isAbsoluteUrl,
|
|
11233
|
+
isAsyncIterable,
|
|
11843
11234
|
isBlob,
|
|
11844
11235
|
isConstructor,
|
|
11845
11236
|
isFormData,
|
|
11237
|
+
isIterable,
|
|
11846
11238
|
isReadable,
|
|
11847
11239
|
isReadableStream,
|
|
11848
11240
|
isStream,
|
|
11849
11241
|
isURL,
|
|
11850
|
-
|
|
11851
|
-
|
|
11242
|
+
isUrlString,
|
|
11243
|
+
isWritable,
|
|
11852
11244
|
mergePrototype,
|
|
11853
|
-
normalizePath,
|
|
11854
11245
|
omitUndefined,
|
|
11855
11246
|
pathToObjectTree,
|
|
11856
11247
|
resolveClass,
|