@otonoma/paranet-client 2.16.1 → 2.17.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/{index-Dz-_ygkd.cjs → index-eBiJ1Egw.cjs} +194 -70
- package/dist/cjs/index-eBiJ1Egw.cjs.map +1 -0
- package/dist/cjs/index.cjs +28 -4
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/pncp.d.ts +3 -0
- package/dist/cjs/pncp.d.ts.map +1 -1
- package/dist/cjs/proto/pncp.d.ts +18 -0
- package/dist/cjs/proto/pncp.d.ts.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/{index-CO5PSAqf.mjs → index-PztyZob7.mjs} +194 -70
- package/dist/esm/index-PztyZob7.mjs.map +1 -0
- package/dist/esm/index.mjs +28 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/pncp.d.ts +3 -0
- package/dist/esm/pncp.d.ts.map +1 -1
- package/dist/esm/proto/pncp.d.ts +18 -0
- package/dist/esm/proto/pncp.d.ts.map +1 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.mts +21 -0
- package/dist/pncp.d.ts +3 -0
- package/dist/pncp.d.ts.map +1 -1
- package/dist/pncp.js +2 -0
- package/dist/proto/pncp.d.ts +18 -0
- package/dist/proto/pncp.d.ts.map +1 -1
- package/dist/proto/pncp.js +24 -3
- package/package.json +1 -1
- package/dist/cjs/index-Dz-_ygkd.cjs.map +0 -1
- package/dist/esm/index-CO5PSAqf.mjs.map +0 -1
|
@@ -201,7 +201,7 @@ let ResponseStatusCodeError$1 = class ResponseStatusCodeError extends UndiciErro
|
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
const kInvalidArgumentError = Symbol.for('undici.error.UND_ERR_INVALID_ARG');
|
|
204
|
-
let InvalidArgumentError$
|
|
204
|
+
let InvalidArgumentError$p = class InvalidArgumentError extends UndiciError$2 {
|
|
205
205
|
constructor (message) {
|
|
206
206
|
super(message);
|
|
207
207
|
this.name = 'InvalidArgumentError';
|
|
@@ -508,7 +508,7 @@ var errors$1 = {
|
|
|
508
508
|
RequestContentLengthMismatchError: RequestContentLengthMismatchError$2,
|
|
509
509
|
ConnectTimeoutError: ConnectTimeoutError$1,
|
|
510
510
|
ResponseStatusCodeError: ResponseStatusCodeError$1,
|
|
511
|
-
InvalidArgumentError: InvalidArgumentError$
|
|
511
|
+
InvalidArgumentError: InvalidArgumentError$p,
|
|
512
512
|
InvalidReturnValueError: InvalidReturnValueError$2,
|
|
513
513
|
RequestAbortedError: RequestAbortedError$8,
|
|
514
514
|
ClientDestroyedError: ClientDestroyedError$2,
|
|
@@ -801,7 +801,7 @@ const { Blob: Blob$1 } = require$$0$3;
|
|
|
801
801
|
const nodeUtil = require$$0$4;
|
|
802
802
|
const { stringify } = require$$7;
|
|
803
803
|
const { EventEmitter: EE$1 } = require$$8;
|
|
804
|
-
const { InvalidArgumentError: InvalidArgumentError$
|
|
804
|
+
const { InvalidArgumentError: InvalidArgumentError$o } = errors$1;
|
|
805
805
|
const { headerNameLowerCasedRecord: headerNameLowerCasedRecord$1 } = constants$5;
|
|
806
806
|
const { tree } = tree_1;
|
|
807
807
|
|
|
@@ -928,39 +928,39 @@ function parseURL (url) {
|
|
|
928
928
|
url = new URL(url);
|
|
929
929
|
|
|
930
930
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
931
|
-
throw new InvalidArgumentError$
|
|
931
|
+
throw new InvalidArgumentError$o('Invalid URL protocol: the URL must start with `http:` or `https:`.')
|
|
932
932
|
}
|
|
933
933
|
|
|
934
934
|
return url
|
|
935
935
|
}
|
|
936
936
|
|
|
937
937
|
if (!url || typeof url !== 'object') {
|
|
938
|
-
throw new InvalidArgumentError$
|
|
938
|
+
throw new InvalidArgumentError$o('Invalid URL: The URL argument must be a non-null object.')
|
|
939
939
|
}
|
|
940
940
|
|
|
941
941
|
if (!(url instanceof URL)) {
|
|
942
942
|
if (url.port != null && url.port !== '' && isValidPort(url.port) === false) {
|
|
943
|
-
throw new InvalidArgumentError$
|
|
943
|
+
throw new InvalidArgumentError$o('Invalid URL: port must be a valid integer or a string representation of an integer.')
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
if (url.path != null && typeof url.path !== 'string') {
|
|
947
|
-
throw new InvalidArgumentError$
|
|
947
|
+
throw new InvalidArgumentError$o('Invalid URL path: the path must be a string or null/undefined.')
|
|
948
948
|
}
|
|
949
949
|
|
|
950
950
|
if (url.pathname != null && typeof url.pathname !== 'string') {
|
|
951
|
-
throw new InvalidArgumentError$
|
|
951
|
+
throw new InvalidArgumentError$o('Invalid URL pathname: the pathname must be a string or null/undefined.')
|
|
952
952
|
}
|
|
953
953
|
|
|
954
954
|
if (url.hostname != null && typeof url.hostname !== 'string') {
|
|
955
|
-
throw new InvalidArgumentError$
|
|
955
|
+
throw new InvalidArgumentError$o('Invalid URL hostname: the hostname must be a string or null/undefined.')
|
|
956
956
|
}
|
|
957
957
|
|
|
958
958
|
if (url.origin != null && typeof url.origin !== 'string') {
|
|
959
|
-
throw new InvalidArgumentError$
|
|
959
|
+
throw new InvalidArgumentError$o('Invalid URL origin: the origin must be a string or null/undefined.')
|
|
960
960
|
}
|
|
961
961
|
|
|
962
962
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
963
|
-
throw new InvalidArgumentError$
|
|
963
|
+
throw new InvalidArgumentError$o('Invalid URL protocol: the URL must start with `http:` or `https:`.')
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
const port = url.port != null
|
|
@@ -988,7 +988,7 @@ function parseURL (url) {
|
|
|
988
988
|
}
|
|
989
989
|
|
|
990
990
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
991
|
-
throw new InvalidArgumentError$
|
|
991
|
+
throw new InvalidArgumentError$o('Invalid URL protocol: the URL must start with `http:` or `https:`.')
|
|
992
992
|
}
|
|
993
993
|
|
|
994
994
|
return url
|
|
@@ -998,7 +998,7 @@ function parseOrigin$1 (url) {
|
|
|
998
998
|
url = parseURL(url);
|
|
999
999
|
|
|
1000
1000
|
if (url.pathname !== '/' || url.search || url.hash) {
|
|
1001
|
-
throw new InvalidArgumentError$
|
|
1001
|
+
throw new InvalidArgumentError$o('invalid url')
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
1004
|
return url
|
|
@@ -1194,36 +1194,36 @@ function isBuffer$1 (buffer) {
|
|
|
1194
1194
|
|
|
1195
1195
|
function validateHandler$1 (handler, method, upgrade) {
|
|
1196
1196
|
if (!handler || typeof handler !== 'object') {
|
|
1197
|
-
throw new InvalidArgumentError$
|
|
1197
|
+
throw new InvalidArgumentError$o('handler must be an object')
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
1200
|
if (typeof handler.onConnect !== 'function') {
|
|
1201
|
-
throw new InvalidArgumentError$
|
|
1201
|
+
throw new InvalidArgumentError$o('invalid onConnect method')
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
1204
|
if (typeof handler.onError !== 'function') {
|
|
1205
|
-
throw new InvalidArgumentError$
|
|
1205
|
+
throw new InvalidArgumentError$o('invalid onError method')
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
1208
|
if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) {
|
|
1209
|
-
throw new InvalidArgumentError$
|
|
1209
|
+
throw new InvalidArgumentError$o('invalid onBodySent method')
|
|
1210
1210
|
}
|
|
1211
1211
|
|
|
1212
1212
|
if (upgrade || method === 'CONNECT') {
|
|
1213
1213
|
if (typeof handler.onUpgrade !== 'function') {
|
|
1214
|
-
throw new InvalidArgumentError$
|
|
1214
|
+
throw new InvalidArgumentError$o('invalid onUpgrade method')
|
|
1215
1215
|
}
|
|
1216
1216
|
} else {
|
|
1217
1217
|
if (typeof handler.onHeaders !== 'function') {
|
|
1218
|
-
throw new InvalidArgumentError$
|
|
1218
|
+
throw new InvalidArgumentError$o('invalid onHeaders method')
|
|
1219
1219
|
}
|
|
1220
1220
|
|
|
1221
1221
|
if (typeof handler.onData !== 'function') {
|
|
1222
|
-
throw new InvalidArgumentError$
|
|
1222
|
+
throw new InvalidArgumentError$o('invalid onData method')
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
1225
|
if (typeof handler.onComplete !== 'function') {
|
|
1226
|
-
throw new InvalidArgumentError$
|
|
1226
|
+
throw new InvalidArgumentError$o('invalid onComplete method')
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
@@ -1713,7 +1713,7 @@ var diagnostics = {
|
|
|
1713
1713
|
};
|
|
1714
1714
|
|
|
1715
1715
|
const {
|
|
1716
|
-
InvalidArgumentError: InvalidArgumentError$
|
|
1716
|
+
InvalidArgumentError: InvalidArgumentError$n,
|
|
1717
1717
|
NotSupportedError: NotSupportedError$1
|
|
1718
1718
|
} = errors$1;
|
|
1719
1719
|
const assert$d = require$$0;
|
|
@@ -1757,45 +1757,45 @@ let Request$2 = class Request {
|
|
|
1757
1757
|
servername
|
|
1758
1758
|
}, handler) {
|
|
1759
1759
|
if (typeof path !== 'string') {
|
|
1760
|
-
throw new InvalidArgumentError$
|
|
1760
|
+
throw new InvalidArgumentError$n('path must be a string')
|
|
1761
1761
|
} else if (
|
|
1762
1762
|
path[0] !== '/' &&
|
|
1763
1763
|
!(path.startsWith('http://') || path.startsWith('https://')) &&
|
|
1764
1764
|
method !== 'CONNECT'
|
|
1765
1765
|
) {
|
|
1766
|
-
throw new InvalidArgumentError$
|
|
1766
|
+
throw new InvalidArgumentError$n('path must be an absolute URL or start with a slash')
|
|
1767
1767
|
} else if (invalidPathRegex.test(path)) {
|
|
1768
|
-
throw new InvalidArgumentError$
|
|
1768
|
+
throw new InvalidArgumentError$n('invalid request path')
|
|
1769
1769
|
}
|
|
1770
1770
|
|
|
1771
1771
|
if (typeof method !== 'string') {
|
|
1772
|
-
throw new InvalidArgumentError$
|
|
1772
|
+
throw new InvalidArgumentError$n('method must be a string')
|
|
1773
1773
|
} else if (normalizedMethodRecords[method] === undefined && !isValidHTTPToken(method)) {
|
|
1774
|
-
throw new InvalidArgumentError$
|
|
1774
|
+
throw new InvalidArgumentError$n('invalid request method')
|
|
1775
1775
|
}
|
|
1776
1776
|
|
|
1777
1777
|
if (upgrade && typeof upgrade !== 'string') {
|
|
1778
|
-
throw new InvalidArgumentError$
|
|
1778
|
+
throw new InvalidArgumentError$n('upgrade must be a string')
|
|
1779
1779
|
}
|
|
1780
1780
|
|
|
1781
1781
|
if (upgrade && !isValidHeaderValue(upgrade)) {
|
|
1782
|
-
throw new InvalidArgumentError$
|
|
1782
|
+
throw new InvalidArgumentError$n('invalid upgrade header')
|
|
1783
1783
|
}
|
|
1784
1784
|
|
|
1785
1785
|
if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {
|
|
1786
|
-
throw new InvalidArgumentError$
|
|
1786
|
+
throw new InvalidArgumentError$n('invalid headersTimeout')
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
1789
|
if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) {
|
|
1790
|
-
throw new InvalidArgumentError$
|
|
1790
|
+
throw new InvalidArgumentError$n('invalid bodyTimeout')
|
|
1791
1791
|
}
|
|
1792
1792
|
|
|
1793
1793
|
if (reset != null && typeof reset !== 'boolean') {
|
|
1794
|
-
throw new InvalidArgumentError$
|
|
1794
|
+
throw new InvalidArgumentError$n('invalid reset')
|
|
1795
1795
|
}
|
|
1796
1796
|
|
|
1797
1797
|
if (expectContinue != null && typeof expectContinue !== 'boolean') {
|
|
1798
|
-
throw new InvalidArgumentError$
|
|
1798
|
+
throw new InvalidArgumentError$n('invalid expectContinue')
|
|
1799
1799
|
}
|
|
1800
1800
|
|
|
1801
1801
|
this.headersTimeout = headersTimeout;
|
|
@@ -1840,7 +1840,7 @@ let Request$2 = class Request {
|
|
|
1840
1840
|
} else if (isFormDataLike(body) || isIterable(body) || isBlobLike(body)) {
|
|
1841
1841
|
this.body = body;
|
|
1842
1842
|
} else {
|
|
1843
|
-
throw new InvalidArgumentError$
|
|
1843
|
+
throw new InvalidArgumentError$n('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')
|
|
1844
1844
|
}
|
|
1845
1845
|
|
|
1846
1846
|
this.completed = false;
|
|
@@ -1874,7 +1874,7 @@ let Request$2 = class Request {
|
|
|
1874
1874
|
|
|
1875
1875
|
if (Array.isArray(headers)) {
|
|
1876
1876
|
if (headers.length % 2 !== 0) {
|
|
1877
|
-
throw new InvalidArgumentError$
|
|
1877
|
+
throw new InvalidArgumentError$n('headers array must be even')
|
|
1878
1878
|
}
|
|
1879
1879
|
for (let i = 0; i < headers.length; i += 2) {
|
|
1880
1880
|
processHeader(this, headers[i], headers[i + 1]);
|
|
@@ -1883,7 +1883,7 @@ let Request$2 = class Request {
|
|
|
1883
1883
|
if (headers[Symbol.iterator]) {
|
|
1884
1884
|
for (const header of headers) {
|
|
1885
1885
|
if (!Array.isArray(header) || header.length !== 2) {
|
|
1886
|
-
throw new InvalidArgumentError$
|
|
1886
|
+
throw new InvalidArgumentError$n('headers must be in key-value pair format')
|
|
1887
1887
|
}
|
|
1888
1888
|
processHeader(this, header[0], header[1]);
|
|
1889
1889
|
}
|
|
@@ -1894,7 +1894,7 @@ let Request$2 = class Request {
|
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
1896
|
} else if (headers != null) {
|
|
1897
|
-
throw new InvalidArgumentError$
|
|
1897
|
+
throw new InvalidArgumentError$n('headers must be an object or an array')
|
|
1898
1898
|
}
|
|
1899
1899
|
|
|
1900
1900
|
validateHandler(handler, method, upgrade);
|
|
@@ -2035,7 +2035,7 @@ let Request$2 = class Request {
|
|
|
2035
2035
|
|
|
2036
2036
|
function processHeader (request, key, val) {
|
|
2037
2037
|
if (val && (typeof val === 'object' && !Array.isArray(val))) {
|
|
2038
|
-
throw new InvalidArgumentError$
|
|
2038
|
+
throw new InvalidArgumentError$n(`invalid ${key} header`)
|
|
2039
2039
|
} else if (val === undefined) {
|
|
2040
2040
|
return
|
|
2041
2041
|
}
|
|
@@ -2045,7 +2045,7 @@ function processHeader (request, key, val) {
|
|
|
2045
2045
|
if (headerName === undefined) {
|
|
2046
2046
|
headerName = key.toLowerCase();
|
|
2047
2047
|
if (headerNameLowerCasedRecord[headerName] === undefined && !isValidHTTPToken(headerName)) {
|
|
2048
|
-
throw new InvalidArgumentError$
|
|
2048
|
+
throw new InvalidArgumentError$n('invalid header key')
|
|
2049
2049
|
}
|
|
2050
2050
|
}
|
|
2051
2051
|
|
|
@@ -2054,54 +2054,65 @@ function processHeader (request, key, val) {
|
|
|
2054
2054
|
for (let i = 0; i < val.length; i++) {
|
|
2055
2055
|
if (typeof val[i] === 'string') {
|
|
2056
2056
|
if (!isValidHeaderValue(val[i])) {
|
|
2057
|
-
throw new InvalidArgumentError$
|
|
2057
|
+
throw new InvalidArgumentError$n(`invalid ${key} header`)
|
|
2058
2058
|
}
|
|
2059
2059
|
arr.push(val[i]);
|
|
2060
2060
|
} else if (val[i] === null) {
|
|
2061
2061
|
arr.push('');
|
|
2062
2062
|
} else if (typeof val[i] === 'object') {
|
|
2063
|
-
throw new InvalidArgumentError$
|
|
2063
|
+
throw new InvalidArgumentError$n(`invalid ${key} header`)
|
|
2064
2064
|
} else {
|
|
2065
|
-
|
|
2065
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
2066
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
2067
|
+
const str = `${val[i]}`;
|
|
2068
|
+
if (!isValidHeaderValue(str)) {
|
|
2069
|
+
throw new InvalidArgumentError$n(`invalid ${key} header`)
|
|
2070
|
+
}
|
|
2071
|
+
arr.push(str);
|
|
2066
2072
|
}
|
|
2067
2073
|
}
|
|
2068
2074
|
val = arr;
|
|
2069
2075
|
} else if (typeof val === 'string') {
|
|
2070
2076
|
if (!isValidHeaderValue(val)) {
|
|
2071
|
-
throw new InvalidArgumentError$
|
|
2077
|
+
throw new InvalidArgumentError$n(`invalid ${key} header`)
|
|
2072
2078
|
}
|
|
2073
2079
|
} else if (val === null) {
|
|
2074
2080
|
val = '';
|
|
2075
2081
|
} else {
|
|
2082
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
2083
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
2076
2084
|
val = `${val}`;
|
|
2085
|
+
if (!isValidHeaderValue(val)) {
|
|
2086
|
+
throw new InvalidArgumentError$n(`invalid ${key} header`)
|
|
2087
|
+
}
|
|
2077
2088
|
}
|
|
2078
2089
|
|
|
2079
2090
|
if (headerName === 'host') {
|
|
2080
2091
|
if (request.host !== null) {
|
|
2081
|
-
throw new InvalidArgumentError$
|
|
2092
|
+
throw new InvalidArgumentError$n('duplicate host header')
|
|
2082
2093
|
}
|
|
2083
2094
|
if (typeof val !== 'string') {
|
|
2084
|
-
throw new InvalidArgumentError$
|
|
2095
|
+
throw new InvalidArgumentError$n('invalid host header')
|
|
2085
2096
|
}
|
|
2086
2097
|
// Consumed by Client
|
|
2087
2098
|
request.host = val;
|
|
2088
2099
|
} else if (headerName === 'content-length') {
|
|
2089
2100
|
if (request.contentLength !== null) {
|
|
2090
|
-
throw new InvalidArgumentError$
|
|
2101
|
+
throw new InvalidArgumentError$n('duplicate content-length header')
|
|
2091
2102
|
}
|
|
2092
2103
|
request.contentLength = parseInt(val, 10);
|
|
2093
2104
|
if (!Number.isFinite(request.contentLength)) {
|
|
2094
|
-
throw new InvalidArgumentError$
|
|
2105
|
+
throw new InvalidArgumentError$n('invalid content-length header')
|
|
2095
2106
|
}
|
|
2096
2107
|
} else if (request.contentType === null && headerName === 'content-type') {
|
|
2097
2108
|
request.contentType = val;
|
|
2098
2109
|
request.headers.push(key, val);
|
|
2099
2110
|
} else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {
|
|
2100
|
-
throw new InvalidArgumentError$
|
|
2111
|
+
throw new InvalidArgumentError$n(`invalid ${headerName} header`)
|
|
2101
2112
|
} else if (headerName === 'connection') {
|
|
2102
2113
|
const value = typeof val === 'string' ? val.toLowerCase() : null;
|
|
2103
2114
|
if (value !== 'close' && value !== 'keep-alive') {
|
|
2104
|
-
throw new InvalidArgumentError$
|
|
2115
|
+
throw new InvalidArgumentError$n('invalid connection header')
|
|
2105
2116
|
}
|
|
2106
2117
|
|
|
2107
2118
|
if (value === 'close') {
|
|
@@ -2185,7 +2196,7 @@ const Dispatcher$3 = dispatcher;
|
|
|
2185
2196
|
const {
|
|
2186
2197
|
ClientDestroyedError: ClientDestroyedError$1,
|
|
2187
2198
|
ClientClosedError,
|
|
2188
|
-
InvalidArgumentError: InvalidArgumentError$
|
|
2199
|
+
InvalidArgumentError: InvalidArgumentError$m
|
|
2189
2200
|
} = errors$1;
|
|
2190
2201
|
const { kDestroy: kDestroy$5, kClose: kClose$7, kClosed: kClosed$1, kDestroyed: kDestroyed$1, kDispatch: kDispatch$5, kInterceptors: kInterceptors$5 } = symbols$4;
|
|
2191
2202
|
|
|
@@ -2229,7 +2240,7 @@ let DispatcherBase$5 = class DispatcherBase extends Dispatcher$3 {
|
|
|
2229
2240
|
for (let i = newInterceptors.length - 1; i >= 0; i--) {
|
|
2230
2241
|
const interceptor = this[kInterceptors$5][i];
|
|
2231
2242
|
if (typeof interceptor !== 'function') {
|
|
2232
|
-
throw new InvalidArgumentError$
|
|
2243
|
+
throw new InvalidArgumentError$m('interceptor must be an function')
|
|
2233
2244
|
}
|
|
2234
2245
|
}
|
|
2235
2246
|
}
|
|
@@ -2247,7 +2258,7 @@ let DispatcherBase$5 = class DispatcherBase extends Dispatcher$3 {
|
|
|
2247
2258
|
}
|
|
2248
2259
|
|
|
2249
2260
|
if (typeof callback !== 'function') {
|
|
2250
|
-
throw new InvalidArgumentError$
|
|
2261
|
+
throw new InvalidArgumentError$m('invalid callback')
|
|
2251
2262
|
}
|
|
2252
2263
|
|
|
2253
2264
|
if (this[kDestroyed$1]) {
|
|
@@ -2298,7 +2309,7 @@ let DispatcherBase$5 = class DispatcherBase extends Dispatcher$3 {
|
|
|
2298
2309
|
}
|
|
2299
2310
|
|
|
2300
2311
|
if (typeof callback !== 'function') {
|
|
2301
|
-
throw new InvalidArgumentError$
|
|
2312
|
+
throw new InvalidArgumentError$m('invalid callback')
|
|
2302
2313
|
}
|
|
2303
2314
|
|
|
2304
2315
|
if (this[kDestroyed$1]) {
|
|
@@ -2348,12 +2359,12 @@ let DispatcherBase$5 = class DispatcherBase extends Dispatcher$3 {
|
|
|
2348
2359
|
|
|
2349
2360
|
dispatch (opts, handler) {
|
|
2350
2361
|
if (!handler || typeof handler !== 'object') {
|
|
2351
|
-
throw new InvalidArgumentError$
|
|
2362
|
+
throw new InvalidArgumentError$m('handler must be an object')
|
|
2352
2363
|
}
|
|
2353
2364
|
|
|
2354
2365
|
try {
|
|
2355
2366
|
if (!opts || typeof opts !== 'object') {
|
|
2356
|
-
throw new InvalidArgumentError$
|
|
2367
|
+
throw new InvalidArgumentError$m('opts must be an object.')
|
|
2357
2368
|
}
|
|
2358
2369
|
|
|
2359
2370
|
if (this[kDestroyed$1] || this[kOnDestroyed]) {
|
|
@@ -2367,7 +2378,7 @@ let DispatcherBase$5 = class DispatcherBase extends Dispatcher$3 {
|
|
|
2367
2378
|
return this[kInterceptedDispatch](opts, handler)
|
|
2368
2379
|
} catch (err) {
|
|
2369
2380
|
if (typeof handler.onError !== 'function') {
|
|
2370
|
-
throw new InvalidArgumentError$
|
|
2381
|
+
throw new InvalidArgumentError$m('invalid onError method')
|
|
2371
2382
|
}
|
|
2372
2383
|
|
|
2373
2384
|
handler.onError(err);
|
|
@@ -2804,7 +2815,7 @@ var timers$2 = {
|
|
|
2804
2815
|
const net$1 = require$$0$2;
|
|
2805
2816
|
const assert$c = require$$0;
|
|
2806
2817
|
const util$l = util$n;
|
|
2807
|
-
const { InvalidArgumentError: InvalidArgumentError$
|
|
2818
|
+
const { InvalidArgumentError: InvalidArgumentError$l, ConnectTimeoutError } = errors$1;
|
|
2808
2819
|
const timers$1 = timers$2;
|
|
2809
2820
|
|
|
2810
2821
|
function noop$3 () {}
|
|
@@ -2879,7 +2890,7 @@ if (commonjsGlobal.FinalizationRegistry && !(process.env.NODE_V8_COVERAGE || pro
|
|
|
2879
2890
|
|
|
2880
2891
|
function buildConnector$4 ({ allowH2, maxCachedSessions, socketPath, timeout, session: customSession, ...opts }) {
|
|
2881
2892
|
if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) {
|
|
2882
|
-
throw new InvalidArgumentError$
|
|
2893
|
+
throw new InvalidArgumentError$l('maxCachedSessions must be a positive integer or zero')
|
|
2883
2894
|
}
|
|
2884
2895
|
|
|
2885
2896
|
const options = { path: socketPath, ...opts };
|
|
@@ -8070,6 +8081,7 @@ const {
|
|
|
8070
8081
|
RequestContentLengthMismatchError: RequestContentLengthMismatchError$1,
|
|
8071
8082
|
ResponseContentLengthMismatchError,
|
|
8072
8083
|
RequestAbortedError: RequestAbortedError$7,
|
|
8084
|
+
InvalidArgumentError: InvalidArgumentError$k,
|
|
8073
8085
|
HeadersTimeoutError,
|
|
8074
8086
|
HeadersOverflowError,
|
|
8075
8087
|
SocketError: SocketError$3,
|
|
@@ -9053,8 +9065,16 @@ function writeH1 (client, request) {
|
|
|
9053
9065
|
}
|
|
9054
9066
|
body = bodyStream.stream;
|
|
9055
9067
|
contentLength = bodyStream.length;
|
|
9056
|
-
} else if (util$j.isBlobLike(body) && request.contentType == null
|
|
9057
|
-
|
|
9068
|
+
} else if (util$j.isBlobLike(body) && request.contentType == null) {
|
|
9069
|
+
const contentType = body.type;
|
|
9070
|
+
if (contentType) {
|
|
9071
|
+
const contentTypeValue = `${contentType}`;
|
|
9072
|
+
if (!util$j.isValidHeaderValue(contentTypeValue)) {
|
|
9073
|
+
util$j.errorRequest(client, request, new InvalidArgumentError$k('invalid content-type header'));
|
|
9074
|
+
return false
|
|
9075
|
+
}
|
|
9076
|
+
headers.push('content-type', contentTypeValue);
|
|
9077
|
+
}
|
|
9058
9078
|
}
|
|
9059
9079
|
|
|
9060
9080
|
if (body && typeof body.read === 'function') {
|
|
@@ -12374,6 +12394,28 @@ function calculateRetryAfterHeader (retryAfter) {
|
|
|
12374
12394
|
return new Date(retryAfter).getTime() - current
|
|
12375
12395
|
}
|
|
12376
12396
|
|
|
12397
|
+
function validatePartialResponseContentLength (headers, range, statusCode, retryCount) {
|
|
12398
|
+
const contentLength = headers['content-length'];
|
|
12399
|
+
if (contentLength == null) {
|
|
12400
|
+
return null
|
|
12401
|
+
}
|
|
12402
|
+
|
|
12403
|
+
if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) {
|
|
12404
|
+
return null
|
|
12405
|
+
}
|
|
12406
|
+
|
|
12407
|
+
const length = Number(contentLength);
|
|
12408
|
+
const expectedLength = range.end - range.start + 1;
|
|
12409
|
+
if (!Number.isFinite(length) || length !== expectedLength) {
|
|
12410
|
+
return new RequestRetryError('Content-Length mismatch', statusCode, {
|
|
12411
|
+
headers,
|
|
12412
|
+
data: { count: retryCount }
|
|
12413
|
+
})
|
|
12414
|
+
}
|
|
12415
|
+
|
|
12416
|
+
return null
|
|
12417
|
+
}
|
|
12418
|
+
|
|
12377
12419
|
let RetryHandler$3 = class RetryHandler {
|
|
12378
12420
|
constructor (opts, handlers) {
|
|
12379
12421
|
const { retryOptions, ...dispatchOpts } = opts;
|
|
@@ -12588,6 +12630,12 @@ let RetryHandler$3 = class RetryHandler {
|
|
|
12588
12630
|
return false
|
|
12589
12631
|
}
|
|
12590
12632
|
|
|
12633
|
+
const contentLengthError = validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount);
|
|
12634
|
+
if (contentLengthError != null) {
|
|
12635
|
+
this.abort(contentLengthError);
|
|
12636
|
+
return false
|
|
12637
|
+
}
|
|
12638
|
+
|
|
12591
12639
|
const { start, size, end = size - 1 } = contentRange;
|
|
12592
12640
|
|
|
12593
12641
|
assert$7(this.start === start, 'content-range mismatch');
|
|
@@ -12611,6 +12659,12 @@ let RetryHandler$3 = class RetryHandler {
|
|
|
12611
12659
|
)
|
|
12612
12660
|
}
|
|
12613
12661
|
|
|
12662
|
+
const contentLengthError = validatePartialResponseContentLength(headers, range, statusCode, this.retryCount);
|
|
12663
|
+
if (contentLengthError != null) {
|
|
12664
|
+
this.abort(contentLengthError);
|
|
12665
|
+
return false
|
|
12666
|
+
}
|
|
12667
|
+
|
|
12614
12668
|
const { start, size, end = size - 1 } = range;
|
|
12615
12669
|
assert$7(
|
|
12616
12670
|
start != null && Number.isFinite(start),
|
|
@@ -22761,7 +22815,7 @@ function requireUtil$2 () {
|
|
|
22761
22815
|
|
|
22762
22816
|
if (
|
|
22763
22817
|
code < 0x20 || // exclude CTLs (0-31)
|
|
22764
|
-
code
|
|
22818
|
+
code > 0x7E || // exclude DEL and non-ascii
|
|
22765
22819
|
code === 0x3B // ;
|
|
22766
22820
|
) {
|
|
22767
22821
|
throw new Error('Invalid cookie path')
|
|
@@ -22770,16 +22824,80 @@ function requireUtil$2 () {
|
|
|
22770
22824
|
}
|
|
22771
22825
|
|
|
22772
22826
|
/**
|
|
22773
|
-
*
|
|
22774
|
-
*
|
|
22827
|
+
* <let-dig> ::= <letter> | <digit>
|
|
22828
|
+
*
|
|
22829
|
+
* <letter> ::= any one of the 52 alphabetic characters A through Z in
|
|
22830
|
+
* upper case and a through z in lower case
|
|
22831
|
+
*
|
|
22832
|
+
* <digit> ::= any one of the ten digits 0 through 9r
|
|
22833
|
+
*
|
|
22834
|
+
* @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
|
|
22835
|
+
* @param {number} code
|
|
22836
|
+
*/
|
|
22837
|
+
function isLetterOrDigit (code) {
|
|
22838
|
+
return (
|
|
22839
|
+
(code >= 0x30 && code <= 0x39) || // 0-9
|
|
22840
|
+
(code >= 0x41 && code <= 0x5A) || // A-Z
|
|
22841
|
+
(code >= 0x61 && code <= 0x7A) // a-z
|
|
22842
|
+
)
|
|
22843
|
+
}
|
|
22844
|
+
|
|
22845
|
+
/**
|
|
22846
|
+
* Validates a cookie domain against the "preferred name syntax".
|
|
22847
|
+
*
|
|
22848
|
+
* <domain> ::= <subdomain> | " "
|
|
22849
|
+
* <subdomain> ::= <label> | <subdomain> "." <label>
|
|
22850
|
+
* <label> ::= <let-dig> [ [ <ldh-str> ] <let-dig> ]
|
|
22851
|
+
* <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
|
|
22852
|
+
* <let-dig-hyp> ::= <let-dig> | "-"
|
|
22853
|
+
*
|
|
22854
|
+
* @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
|
|
22855
|
+
* @see https://www.rfc-editor.org/rfc/rfc1123#section-2.1
|
|
22856
|
+
* @see https://www.rfc-editor.org/rfc/rfc1035#section-2.3.4
|
|
22775
22857
|
* @param {string} domain
|
|
22776
22858
|
*/
|
|
22777
22859
|
function validateCookieDomain (domain) {
|
|
22778
|
-
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22860
|
+
// <domain> ::= <subdomain> | " "
|
|
22861
|
+
if (domain === ' ') {
|
|
22862
|
+
return
|
|
22863
|
+
}
|
|
22864
|
+
|
|
22865
|
+
if (domain.length > 255) {
|
|
22866
|
+
throw new Error('Invalid cookie domain')
|
|
22867
|
+
}
|
|
22868
|
+
|
|
22869
|
+
let labelLength = 0;
|
|
22870
|
+
|
|
22871
|
+
for (let i = 0; i < domain.length; ++i) {
|
|
22872
|
+
const code = domain.charCodeAt(i);
|
|
22873
|
+
|
|
22874
|
+
if (code === 0x2E) {
|
|
22875
|
+
if (labelLength === 0) {
|
|
22876
|
+
throw new Error('Invalid cookie domain')
|
|
22877
|
+
}
|
|
22878
|
+
|
|
22879
|
+
if (domain.charCodeAt(i - 1) === 0x2D) { // "-"
|
|
22880
|
+
throw new Error('Invalid cookie domain')
|
|
22881
|
+
}
|
|
22882
|
+
|
|
22883
|
+
labelLength = 0;
|
|
22884
|
+
continue
|
|
22885
|
+
}
|
|
22886
|
+
|
|
22887
|
+
if (labelLength === 0 && !isLetterOrDigit(code)) {
|
|
22888
|
+
throw new Error('Invalid cookie domain')
|
|
22889
|
+
}
|
|
22890
|
+
|
|
22891
|
+
if (!isLetterOrDigit(code) && code !== 0x2D) { // "-"
|
|
22892
|
+
throw new Error('Invalid cookie domain')
|
|
22893
|
+
}
|
|
22894
|
+
|
|
22895
|
+
if (++labelLength > 63) {
|
|
22896
|
+
throw new Error('Invalid cookie domain')
|
|
22897
|
+
}
|
|
22898
|
+
}
|
|
22899
|
+
|
|
22900
|
+
if (labelLength === 0 || domain.charCodeAt(domain.length - 1) === 0x2D) { // "-"
|
|
22783
22901
|
throw new Error('Invalid cookie domain')
|
|
22784
22902
|
}
|
|
22785
22903
|
}
|
|
@@ -22922,7 +23040,13 @@ function requireUtil$2 () {
|
|
|
22922
23040
|
|
|
22923
23041
|
const [key, ...value] = part.split('=');
|
|
22924
23042
|
|
|
22925
|
-
|
|
23043
|
+
const trimmedKey = key.trim();
|
|
23044
|
+
const joinedValue = value.join('=');
|
|
23045
|
+
|
|
23046
|
+
validateCookieName(trimmedKey);
|
|
23047
|
+
validateCookieValue(joinedValue);
|
|
23048
|
+
|
|
23049
|
+
out.push(`${trimmedKey}=${joinedValue}`);
|
|
22926
23050
|
}
|
|
22927
23051
|
|
|
22928
23052
|
return out.join('; ')
|
|
@@ -27195,4 +27319,4 @@ var index = /*#__PURE__*/_mergeNamespaces({
|
|
|
27195
27319
|
}, [undici]);
|
|
27196
27320
|
|
|
27197
27321
|
export { index as i };
|
|
27198
|
-
//# sourceMappingURL=index-
|
|
27322
|
+
//# sourceMappingURL=index-PztyZob7.mjs.map
|