@slicemachine/adapter-nuxt 0.3.38-beta.1 → 0.3.38-beta.3
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/plugin.cjs +1 -3
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -3
- package/dist/plugin.js.map +1 -1
- package/package.json +2 -3
- package/src/plugin.ts +0 -7
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs +0 -41
- package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +0 -1
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js +0 -41
- package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +0 -1
- package/dist/_node_modules/fetch-blob/file.cjs +0 -61
- package/dist/_node_modules/fetch-blob/file.cjs.map +0 -1
- package/dist/_node_modules/fetch-blob/file.js +0 -61
- package/dist/_node_modules/fetch-blob/file.js.map +0 -1
- package/dist/_node_modules/fetch-blob/index.cjs +0 -223
- package/dist/_node_modules/fetch-blob/index.cjs.map +0 -1
- package/dist/_node_modules/fetch-blob/index.js +0 -223
- package/dist/_node_modules/fetch-blob/index.js.map +0 -1
- package/dist/_node_modules/fetch-blob/streams.cjs +0 -43
- package/dist/_node_modules/fetch-blob/streams.cjs.map +0 -1
- package/dist/_node_modules/fetch-blob/streams.js +0 -42
- package/dist/_node_modules/fetch-blob/streams.js.map +0 -1
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs +0 -116
- package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +0 -1
- package/dist/_node_modules/formdata-polyfill/esm.min.js +0 -116
- package/dist/_node_modules/formdata-polyfill/esm.min.js.map +0 -1
- package/dist/_node_modules/node-domexception/index.cjs +0 -11
- package/dist/_node_modules/node-domexception/index.cjs.map +0 -1
- package/dist/_node_modules/node-domexception/index.js +0 -10
- package/dist/_node_modules/node-domexception/index.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/body.cjs +0 -262
- package/dist/_node_modules/node-fetch/src/body.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/body.js +0 -262
- package/dist/_node_modules/node-fetch/src/body.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs +0 -10
- package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js +0 -10
- package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/errors/base.cjs +0 -17
- package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/errors/base.js +0 -17
- package/dist/_node_modules/node-fetch/src/errors/base.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs +0 -19
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js +0 -19
- package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/headers.cjs +0 -190
- package/dist/_node_modules/node-fetch/src/headers.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/headers.js +0 -190
- package/dist/_node_modules/node-fetch/src/headers.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/index.cjs +0 -292
- package/dist/_node_modules/node-fetch/src/index.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/index.js +0 -292
- package/dist/_node_modules/node-fetch/src/index.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/request.cjs +0 -206
- package/dist/_node_modules/node-fetch/src/request.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/request.js +0 -206
- package/dist/_node_modules/node-fetch/src/request.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/response.cjs +0 -122
- package/dist/_node_modules/node-fetch/src/response.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/response.js +0 -123
- package/dist/_node_modules/node-fetch/src/response.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs +0 -12
- package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/get-search.js +0 -12
- package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs +0 -8
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js +0 -8
- package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/is.cjs +0 -28
- package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/is.js +0 -28
- package/dist/_node_modules/node-fetch/src/utils/is.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs +0 -356
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js +0 -356
- package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs +0 -149
- package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +0 -1
- package/dist/_node_modules/node-fetch/src/utils/referrer.js +0 -149
- package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +0 -1
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +0 -3822
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +0 -1
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +0 -3822
- package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +0 -1
- package/dist/_virtual/_commonjsHelpers.cjs +0 -5
- package/dist/_virtual/_commonjsHelpers.cjs.map +0 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -5
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/ponyfill.es2018.cjs +0 -5
- package/dist/_virtual/ponyfill.es2018.cjs.map +0 -1
- package/dist/_virtual/ponyfill.es2018.js +0 -5
- package/dist/_virtual/ponyfill.es2018.js.map +0 -1
- package/dist/hooks/sliceSimulator-setup-read.cjs +0 -150
- package/dist/hooks/sliceSimulator-setup-read.cjs.map +0 -1
- package/dist/hooks/sliceSimulator-setup-read.d.ts +0 -3
- package/dist/hooks/sliceSimulator-setup-read.js +0 -150
- package/dist/hooks/sliceSimulator-setup-read.js.map +0 -1
- package/src/hooks/sliceSimulator-setup-read.ts +0 -209
- /package/dist/{packages/adapter-nuxt/package.json.cjs → package.json.cjs} +0 -0
- /package/dist/{packages/adapter-nuxt/package.json.cjs.map → package.json.cjs.map} +0 -0
- /package/dist/{packages/adapter-nuxt/package.json.js → package.json.js} +0 -0
- /package/dist/{packages/adapter-nuxt/package.json.js.map → package.json.js.map} +0 -0
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { format } from "node:url";
|
|
2
|
-
import { deprecate } from "node:util";
|
|
3
|
-
import Headers from "./headers.js";
|
|
4
|
-
import Body, { clone, extractContentType, getTotalBytes } from "./body.js";
|
|
5
|
-
import { isAbortSignal } from "./utils/is.js";
|
|
6
|
-
import { getSearch } from "./utils/get-search.js";
|
|
7
|
-
import { validateReferrerPolicy, DEFAULT_REFERRER_POLICY, determineRequestsReferrer } from "./utils/referrer.js";
|
|
8
|
-
const INTERNALS = Symbol("Request internals");
|
|
9
|
-
const isRequest = (object) => {
|
|
10
|
-
return typeof object === "object" && typeof object[INTERNALS] === "object";
|
|
11
|
-
};
|
|
12
|
-
const doBadDataWarn = deprecate(
|
|
13
|
-
() => {
|
|
14
|
-
},
|
|
15
|
-
".data is not a valid RequestInit property, use .body instead",
|
|
16
|
-
"https://github.com/node-fetch/node-fetch/issues/1000 (request)"
|
|
17
|
-
);
|
|
18
|
-
class Request extends Body {
|
|
19
|
-
constructor(input, init = {}) {
|
|
20
|
-
let parsedURL;
|
|
21
|
-
if (isRequest(input)) {
|
|
22
|
-
parsedURL = new URL(input.url);
|
|
23
|
-
} else {
|
|
24
|
-
parsedURL = new URL(input);
|
|
25
|
-
input = {};
|
|
26
|
-
}
|
|
27
|
-
if (parsedURL.username !== "" || parsedURL.password !== "") {
|
|
28
|
-
throw new TypeError(`${parsedURL} is an url with embedded credentials.`);
|
|
29
|
-
}
|
|
30
|
-
let method = init.method || input.method || "GET";
|
|
31
|
-
if (/^(delete|get|head|options|post|put)$/i.test(method)) {
|
|
32
|
-
method = method.toUpperCase();
|
|
33
|
-
}
|
|
34
|
-
if (!isRequest(init) && "data" in init) {
|
|
35
|
-
doBadDataWarn();
|
|
36
|
-
}
|
|
37
|
-
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
|
38
|
-
throw new TypeError("Request with GET/HEAD method cannot have body");
|
|
39
|
-
}
|
|
40
|
-
const inputBody = init.body ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
|
|
41
|
-
super(inputBody, {
|
|
42
|
-
size: init.size || input.size || 0
|
|
43
|
-
});
|
|
44
|
-
const headers = new Headers(init.headers || input.headers || {});
|
|
45
|
-
if (inputBody !== null && !headers.has("Content-Type")) {
|
|
46
|
-
const contentType = extractContentType(inputBody, this);
|
|
47
|
-
if (contentType) {
|
|
48
|
-
headers.set("Content-Type", contentType);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
let signal = isRequest(input) ? input.signal : null;
|
|
52
|
-
if ("signal" in init) {
|
|
53
|
-
signal = init.signal;
|
|
54
|
-
}
|
|
55
|
-
if (signal != null && !isAbortSignal(signal)) {
|
|
56
|
-
throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
|
|
57
|
-
}
|
|
58
|
-
let referrer = init.referrer == null ? input.referrer : init.referrer;
|
|
59
|
-
if (referrer === "") {
|
|
60
|
-
referrer = "no-referrer";
|
|
61
|
-
} else if (referrer) {
|
|
62
|
-
const parsedReferrer = new URL(referrer);
|
|
63
|
-
referrer = /^about:(\/\/)?client$/.test(parsedReferrer) ? "client" : parsedReferrer;
|
|
64
|
-
} else {
|
|
65
|
-
referrer = void 0;
|
|
66
|
-
}
|
|
67
|
-
this[INTERNALS] = {
|
|
68
|
-
method,
|
|
69
|
-
redirect: init.redirect || input.redirect || "follow",
|
|
70
|
-
headers,
|
|
71
|
-
parsedURL,
|
|
72
|
-
signal,
|
|
73
|
-
referrer
|
|
74
|
-
};
|
|
75
|
-
this.follow = init.follow === void 0 ? input.follow === void 0 ? 20 : input.follow : init.follow;
|
|
76
|
-
this.compress = init.compress === void 0 ? input.compress === void 0 ? true : input.compress : init.compress;
|
|
77
|
-
this.counter = init.counter || input.counter || 0;
|
|
78
|
-
this.agent = init.agent || input.agent;
|
|
79
|
-
this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
|
|
80
|
-
this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
|
|
81
|
-
this.referrerPolicy = init.referrerPolicy || input.referrerPolicy || "";
|
|
82
|
-
}
|
|
83
|
-
/** @returns {string} */
|
|
84
|
-
get method() {
|
|
85
|
-
return this[INTERNALS].method;
|
|
86
|
-
}
|
|
87
|
-
/** @returns {string} */
|
|
88
|
-
get url() {
|
|
89
|
-
return format(this[INTERNALS].parsedURL);
|
|
90
|
-
}
|
|
91
|
-
/** @returns {Headers} */
|
|
92
|
-
get headers() {
|
|
93
|
-
return this[INTERNALS].headers;
|
|
94
|
-
}
|
|
95
|
-
get redirect() {
|
|
96
|
-
return this[INTERNALS].redirect;
|
|
97
|
-
}
|
|
98
|
-
/** @returns {AbortSignal} */
|
|
99
|
-
get signal() {
|
|
100
|
-
return this[INTERNALS].signal;
|
|
101
|
-
}
|
|
102
|
-
// https://fetch.spec.whatwg.org/#dom-request-referrer
|
|
103
|
-
get referrer() {
|
|
104
|
-
if (this[INTERNALS].referrer === "no-referrer") {
|
|
105
|
-
return "";
|
|
106
|
-
}
|
|
107
|
-
if (this[INTERNALS].referrer === "client") {
|
|
108
|
-
return "about:client";
|
|
109
|
-
}
|
|
110
|
-
if (this[INTERNALS].referrer) {
|
|
111
|
-
return this[INTERNALS].referrer.toString();
|
|
112
|
-
}
|
|
113
|
-
return void 0;
|
|
114
|
-
}
|
|
115
|
-
get referrerPolicy() {
|
|
116
|
-
return this[INTERNALS].referrerPolicy;
|
|
117
|
-
}
|
|
118
|
-
set referrerPolicy(referrerPolicy) {
|
|
119
|
-
this[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Clone this request
|
|
123
|
-
*
|
|
124
|
-
* @return Request
|
|
125
|
-
*/
|
|
126
|
-
clone() {
|
|
127
|
-
return new Request(this);
|
|
128
|
-
}
|
|
129
|
-
get [Symbol.toStringTag]() {
|
|
130
|
-
return "Request";
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
Object.defineProperties(Request.prototype, {
|
|
134
|
-
method: { enumerable: true },
|
|
135
|
-
url: { enumerable: true },
|
|
136
|
-
headers: { enumerable: true },
|
|
137
|
-
redirect: { enumerable: true },
|
|
138
|
-
clone: { enumerable: true },
|
|
139
|
-
signal: { enumerable: true },
|
|
140
|
-
referrer: { enumerable: true },
|
|
141
|
-
referrerPolicy: { enumerable: true }
|
|
142
|
-
});
|
|
143
|
-
const getNodeRequestOptions = (request) => {
|
|
144
|
-
const { parsedURL } = request[INTERNALS];
|
|
145
|
-
const headers = new Headers(request[INTERNALS].headers);
|
|
146
|
-
if (!headers.has("Accept")) {
|
|
147
|
-
headers.set("Accept", "*/*");
|
|
148
|
-
}
|
|
149
|
-
let contentLengthValue = null;
|
|
150
|
-
if (request.body === null && /^(post|put)$/i.test(request.method)) {
|
|
151
|
-
contentLengthValue = "0";
|
|
152
|
-
}
|
|
153
|
-
if (request.body !== null) {
|
|
154
|
-
const totalBytes = getTotalBytes(request);
|
|
155
|
-
if (typeof totalBytes === "number" && !Number.isNaN(totalBytes)) {
|
|
156
|
-
contentLengthValue = String(totalBytes);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (contentLengthValue) {
|
|
160
|
-
headers.set("Content-Length", contentLengthValue);
|
|
161
|
-
}
|
|
162
|
-
if (request.referrerPolicy === "") {
|
|
163
|
-
request.referrerPolicy = DEFAULT_REFERRER_POLICY;
|
|
164
|
-
}
|
|
165
|
-
if (request.referrer && request.referrer !== "no-referrer") {
|
|
166
|
-
request[INTERNALS].referrer = determineRequestsReferrer(request);
|
|
167
|
-
} else {
|
|
168
|
-
request[INTERNALS].referrer = "no-referrer";
|
|
169
|
-
}
|
|
170
|
-
if (request[INTERNALS].referrer instanceof URL) {
|
|
171
|
-
headers.set("Referer", request.referrer);
|
|
172
|
-
}
|
|
173
|
-
if (!headers.has("User-Agent")) {
|
|
174
|
-
headers.set("User-Agent", "node-fetch");
|
|
175
|
-
}
|
|
176
|
-
if (request.compress && !headers.has("Accept-Encoding")) {
|
|
177
|
-
headers.set("Accept-Encoding", "gzip, deflate, br");
|
|
178
|
-
}
|
|
179
|
-
let { agent } = request;
|
|
180
|
-
if (typeof agent === "function") {
|
|
181
|
-
agent = agent(parsedURL);
|
|
182
|
-
}
|
|
183
|
-
if (!headers.has("Connection") && !agent) {
|
|
184
|
-
headers.set("Connection", "close");
|
|
185
|
-
}
|
|
186
|
-
const search = getSearch(parsedURL);
|
|
187
|
-
const options = {
|
|
188
|
-
// Overwrite search to retain trailing ? (issue #776)
|
|
189
|
-
path: parsedURL.pathname + search,
|
|
190
|
-
// The following options are not expressed in the URL
|
|
191
|
-
method: request.method,
|
|
192
|
-
headers: headers[Symbol.for("nodejs.util.inspect.custom")](),
|
|
193
|
-
insecureHTTPParser: request.insecureHTTPParser,
|
|
194
|
-
agent
|
|
195
|
-
};
|
|
196
|
-
return {
|
|
197
|
-
/** @type {URL} */
|
|
198
|
-
parsedURL,
|
|
199
|
-
options
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
export {
|
|
203
|
-
Request as default,
|
|
204
|
-
getNodeRequestOptions
|
|
205
|
-
};
|
|
206
|
-
//# sourceMappingURL=request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../../../../../node_modules/node-fetch/src/request.js"],"sourcesContent":["/**\n * Request.js\n *\n * Request class contains server only options\n *\n * All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.\n */\n\nimport {format as formatUrl} from 'node:url';\nimport {deprecate} from 'node:util';\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType, getTotalBytes} from './body.js';\nimport {isAbortSignal} from './utils/is.js';\nimport {getSearch} from './utils/get-search.js';\nimport {\n\tvalidateReferrerPolicy, determineRequestsReferrer, DEFAULT_REFERRER_POLICY\n} from './utils/referrer.js';\n\nconst INTERNALS = Symbol('Request internals');\n\n/**\n * Check if `obj` is an instance of Request.\n *\n * @param {*} object\n * @return {boolean}\n */\nconst isRequest = object => {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object[INTERNALS] === 'object'\n\t);\n};\n\nconst doBadDataWarn = deprecate(() => {},\n\t'.data is not a valid RequestInit property, use .body instead',\n\t'https://github.com/node-fetch/node-fetch/issues/1000 (request)');\n\n/**\n * Request class\n *\n * Ref: https://fetch.spec.whatwg.org/#request-class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nexport default class Request extends Body {\n\tconstructor(input, init = {}) {\n\t\tlet parsedURL;\n\n\t\t// Normalize input and force URL to be encoded as UTF-8 (https://github.com/node-fetch/node-fetch/issues/245)\n\t\tif (isRequest(input)) {\n\t\t\tparsedURL = new URL(input.url);\n\t\t} else {\n\t\t\tparsedURL = new URL(input);\n\t\t\tinput = {};\n\t\t}\n\n\t\tif (parsedURL.username !== '' || parsedURL.password !== '') {\n\t\t\tthrow new TypeError(`${parsedURL} is an url with embedded credentials.`);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tif (/^(delete|get|head|options|post|put)$/i.test(method)) {\n\t\t\tmethod = method.toUpperCase();\n\t\t}\n\n\t\tif (!isRequest(init) && 'data' in init) {\n\t\t\tdoBadDataWarn();\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif ((init.body != null || (isRequest(input) && input.body !== null)) &&\n\t\t\t(method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tconst inputBody = init.body ?\n\t\t\tinit.body :\n\t\t\t(isRequest(input) && input.body !== null ?\n\t\t\t\tclone(input) :\n\t\t\t\tnull);\n\n\t\tsuper(inputBody, {\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.set('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ?\n\t\t\tinput.signal :\n\t\t\tnull;\n\t\tif ('signal' in init) {\n\t\t\tsignal = init.signal;\n\t\t}\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal or EventTarget');\n\t\t}\n\n\t\t// §5.4, Request constructor steps, step 15.1\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq\n\t\tlet referrer = init.referrer == null ? input.referrer : init.referrer;\n\t\tif (referrer === '') {\n\t\t\t// §5.4, Request constructor steps, step 15.2\n\t\t\treferrer = 'no-referrer';\n\t\t} else if (referrer) {\n\t\t\t// §5.4, Request constructor steps, step 15.3.1, 15.3.2\n\t\t\tconst parsedReferrer = new URL(referrer);\n\t\t\t// §5.4, Request constructor steps, step 15.3.3, 15.3.4\n\t\t\treferrer = /^about:(\\/\\/)?client$/.test(parsedReferrer) ? 'client' : parsedReferrer;\n\t\t} else {\n\t\t\treferrer = undefined;\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal,\n\t\t\treferrer\n\t\t};\n\n\t\t// Node-fetch-only options\n\t\tthis.follow = init.follow === undefined ? (input.follow === undefined ? 20 : input.follow) : init.follow;\n\t\tthis.compress = init.compress === undefined ? (input.compress === undefined ? true : input.compress) : init.compress;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t\tthis.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;\n\t\tthis.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;\n\n\t\t// §5.4, Request constructor steps, step 16.\n\t\t// Default is empty string per https://fetch.spec.whatwg.org/#concept-request-referrer-policy\n\t\tthis.referrerPolicy = init.referrerPolicy || input.referrerPolicy || '';\n\t}\n\n\t/** @returns {string} */\n\tget method() {\n\t\treturn this[INTERNALS].method;\n\t}\n\n\t/** @returns {string} */\n\tget url() {\n\t\treturn formatUrl(this[INTERNALS].parsedURL);\n\t}\n\n\t/** @returns {Headers} */\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS].redirect;\n\t}\n\n\t/** @returns {AbortSignal} */\n\tget signal() {\n\t\treturn this[INTERNALS].signal;\n\t}\n\n\t// https://fetch.spec.whatwg.org/#dom-request-referrer\n\tget referrer() {\n\t\tif (this[INTERNALS].referrer === 'no-referrer') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer === 'client') {\n\t\t\treturn 'about:client';\n\t\t}\n\n\t\tif (this[INTERNALS].referrer) {\n\t\t\treturn this[INTERNALS].referrer.toString();\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tget referrerPolicy() {\n\t\treturn this[INTERNALS].referrerPolicy;\n\t}\n\n\tset referrerPolicy(referrerPolicy) {\n\t\tthis[INTERNALS].referrerPolicy = validateReferrerPolicy(referrerPolicy);\n\t}\n\n\t/**\n\t * Clone this request\n\t *\n\t * @return Request\n\t */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Request';\n\t}\n}\n\nObject.defineProperties(Request.prototype, {\n\tmethod: {enumerable: true},\n\turl: {enumerable: true},\n\theaders: {enumerable: true},\n\tredirect: {enumerable: true},\n\tclone: {enumerable: true},\n\tsignal: {enumerable: true},\n\treferrer: {enumerable: true},\n\treferrerPolicy: {enumerable: true}\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param {Request} request - A Request instance\n * @return The options object to be passed to http.request\n */\nexport const getNodeRequestOptions = request => {\n\tconst {parsedURL} = request[INTERNALS];\n\tconst headers = new Headers(request[INTERNALS].headers);\n\n\t// Fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body === null && /^(post|put)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\n\tif (request.body !== null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\t// Set Content-Length if totalBytes is a number (that is not NaN)\n\t\tif (typeof totalBytes === 'number' && !Number.isNaN(totalBytes)) {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// 4.1. Main fetch, step 2.6\n\t// > If request's referrer policy is the empty string, then set request's referrer policy to the\n\t// > default referrer policy.\n\tif (request.referrerPolicy === '') {\n\t\trequest.referrerPolicy = DEFAULT_REFERRER_POLICY;\n\t}\n\n\t// 4.1. Main fetch, step 2.7\n\t// > If request's referrer is not \"no-referrer\", set request's referrer to the result of invoking\n\t// > determine request's referrer.\n\tif (request.referrer && request.referrer !== 'no-referrer') {\n\t\trequest[INTERNALS].referrer = determineRequestsReferrer(request);\n\t} else {\n\t\trequest[INTERNALS].referrer = 'no-referrer';\n\t}\n\n\t// 4.5. HTTP-network-or-cache fetch, step 6.9\n\t// > If httpRequest's referrer is a URL, then append `Referer`/httpRequest's referrer, serialized\n\t// > and isomorphic encoded, to httpRequest's header list.\n\tif (request[INTERNALS].referrer instanceof URL) {\n\t\theaders.set('Referer', request.referrer);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip, deflate, br');\n\t}\n\n\tlet {agent} = request;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\tif (!headers.has('Connection') && !agent) {\n\t\theaders.set('Connection', 'close');\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\tconst search = getSearch(parsedURL);\n\n\t// Pass the full URL directly to request(), but overwrite the following\n\t// options:\n\tconst options = {\n\t\t// Overwrite search to retain trailing ? (issue #776)\n\t\tpath: parsedURL.pathname + search,\n\t\t// The following options are not expressed in the URL\n\t\tmethod: request.method,\n\t\theaders: headers[Symbol.for('nodejs.util.inspect.custom')](),\n\t\tinsecureHTTPParser: request.insecureHTTPParser,\n\t\tagent\n\t};\n\n\treturn {\n\t\t/** @type {URL} */\n\t\tparsedURL,\n\t\toptions\n\t};\n};\n"],"names":["formatUrl"],"mappings":";;;;;;;AAkBA,MAAM,YAAY,OAAO,mBAAmB;AAQ5C,MAAM,YAAY,YAAU;AAC3B,SACC,OAAO,WAAW,YAClB,OAAO,OAAO,SAAS,MAAM;AAE/B;AAEA,MAAM,gBAAgB;AAAA,EAAU,MAAM;AAAA,EAAE;AAA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@@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const headers = require("./headers.cjs");
|
|
3
|
-
const body = require("./body.cjs");
|
|
4
|
-
const isRedirect = require("./utils/is-redirect.cjs");
|
|
5
|
-
const INTERNALS = Symbol("Response internals");
|
|
6
|
-
class Response extends body.default {
|
|
7
|
-
constructor(body$1 = null, options = {}) {
|
|
8
|
-
super(body$1, options);
|
|
9
|
-
const status = options.status != null ? options.status : 200;
|
|
10
|
-
const headers$1 = new headers.default(options.headers);
|
|
11
|
-
if (body$1 !== null && !headers$1.has("Content-Type")) {
|
|
12
|
-
const contentType = body.extractContentType(body$1, this);
|
|
13
|
-
if (contentType) {
|
|
14
|
-
headers$1.append("Content-Type", contentType);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
this[INTERNALS] = {
|
|
18
|
-
type: "default",
|
|
19
|
-
url: options.url,
|
|
20
|
-
status,
|
|
21
|
-
statusText: options.statusText || "",
|
|
22
|
-
headers: headers$1,
|
|
23
|
-
counter: options.counter,
|
|
24
|
-
highWaterMark: options.highWaterMark
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
get type() {
|
|
28
|
-
return this[INTERNALS].type;
|
|
29
|
-
}
|
|
30
|
-
get url() {
|
|
31
|
-
return this[INTERNALS].url || "";
|
|
32
|
-
}
|
|
33
|
-
get status() {
|
|
34
|
-
return this[INTERNALS].status;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Convenience property representing if the request ended normally
|
|
38
|
-
*/
|
|
39
|
-
get ok() {
|
|
40
|
-
return this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;
|
|
41
|
-
}
|
|
42
|
-
get redirected() {
|
|
43
|
-
return this[INTERNALS].counter > 0;
|
|
44
|
-
}
|
|
45
|
-
get statusText() {
|
|
46
|
-
return this[INTERNALS].statusText;
|
|
47
|
-
}
|
|
48
|
-
get headers() {
|
|
49
|
-
return this[INTERNALS].headers;
|
|
50
|
-
}
|
|
51
|
-
get highWaterMark() {
|
|
52
|
-
return this[INTERNALS].highWaterMark;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Clone this response
|
|
56
|
-
*
|
|
57
|
-
* @return Response
|
|
58
|
-
*/
|
|
59
|
-
clone() {
|
|
60
|
-
return new Response(body.clone(this, this.highWaterMark), {
|
|
61
|
-
type: this.type,
|
|
62
|
-
url: this.url,
|
|
63
|
-
status: this.status,
|
|
64
|
-
statusText: this.statusText,
|
|
65
|
-
headers: this.headers,
|
|
66
|
-
ok: this.ok,
|
|
67
|
-
redirected: this.redirected,
|
|
68
|
-
size: this.size,
|
|
69
|
-
highWaterMark: this.highWaterMark
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @param {string} url The URL that the new response is to originate from.
|
|
74
|
-
* @param {number} status An optional status code for the response (e.g., 302.)
|
|
75
|
-
* @returns {Response} A Response object.
|
|
76
|
-
*/
|
|
77
|
-
static redirect(url, status = 302) {
|
|
78
|
-
if (!isRedirect.isRedirect(status)) {
|
|
79
|
-
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
|
80
|
-
}
|
|
81
|
-
return new Response(null, {
|
|
82
|
-
headers: {
|
|
83
|
-
location: new URL(url).toString()
|
|
84
|
-
},
|
|
85
|
-
status
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
static error() {
|
|
89
|
-
const response = new Response(null, { status: 0, statusText: "" });
|
|
90
|
-
response[INTERNALS].type = "error";
|
|
91
|
-
return response;
|
|
92
|
-
}
|
|
93
|
-
static json(data = void 0, init = {}) {
|
|
94
|
-
const body2 = JSON.stringify(data);
|
|
95
|
-
if (body2 === void 0) {
|
|
96
|
-
throw new TypeError("data is not JSON serializable");
|
|
97
|
-
}
|
|
98
|
-
const headers$1 = new headers.default(init && init.headers);
|
|
99
|
-
if (!headers$1.has("content-type")) {
|
|
100
|
-
headers$1.set("content-type", "application/json");
|
|
101
|
-
}
|
|
102
|
-
return new Response(body2, {
|
|
103
|
-
...init,
|
|
104
|
-
headers: headers$1
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
get [Symbol.toStringTag]() {
|
|
108
|
-
return "Response";
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
Object.defineProperties(Response.prototype, {
|
|
112
|
-
type: { enumerable: true },
|
|
113
|
-
url: { enumerable: true },
|
|
114
|
-
status: { enumerable: true },
|
|
115
|
-
ok: { enumerable: true },
|
|
116
|
-
redirected: { enumerable: true },
|
|
117
|
-
statusText: { enumerable: true },
|
|
118
|
-
headers: { enumerable: true },
|
|
119
|
-
clone: { enumerable: true }
|
|
120
|
-
});
|
|
121
|
-
module.exports = Response;
|
|
122
|
-
//# sourceMappingURL=response.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.cjs","sources":["../../../../../../node_modules/node-fetch/src/response.js"],"sourcesContent":["/**\n * Response.js\n *\n * Response class provides content decoding\n */\n\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType} from './body.js';\nimport {isRedirect} from './utils/is-redirect.js';\n\nconst INTERNALS = Symbol('Response internals');\n\n/**\n * Response class\n *\n * Ref: https://fetch.spec.whatwg.org/#response-class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Response extends Body {\n\tconstructor(body = null, options = {}) {\n\t\tsuper(body, options);\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition\n\t\tconst status = options.status != null ? options.status : 200;\n\n\t\tconst headers = new Headers(options.headers);\n\n\t\tif (body !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\ttype: 'default',\n\t\t\turl: options.url,\n\t\t\tstatus,\n\t\t\tstatusText: options.statusText || '',\n\t\t\theaders,\n\t\t\tcounter: options.counter,\n\t\t\thighWaterMark: options.highWaterMark\n\t\t};\n\t}\n\n\tget type() {\n\t\treturn this[INTERNALS].type;\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS].status;\n\t}\n\n\t/**\n\t * Convenience property representing if the request ended normally\n\t */\n\tget ok() {\n\t\treturn this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget highWaterMark() {\n\t\treturn this[INTERNALS].highWaterMark;\n\t}\n\n\t/**\n\t * Clone this response\n\t *\n\t * @return Response\n\t */\n\tclone() {\n\t\treturn new Response(clone(this, this.highWaterMark), {\n\t\t\ttype: this.type,\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected,\n\t\t\tsize: this.size,\n\t\t\thighWaterMark: this.highWaterMark\n\t\t});\n\t}\n\n\t/**\n\t * @param {string} url The URL that the new response is to originate from.\n\t * @param {number} status An optional status code for the response (e.g., 302.)\n\t * @returns {Response} A Response object.\n\t */\n\tstatic redirect(url, status = 302) {\n\t\tif (!isRedirect(status)) {\n\t\t\tthrow new RangeError('Failed to execute \"redirect\" on \"response\": Invalid status code');\n\t\t}\n\n\t\treturn new Response(null, {\n\t\t\theaders: {\n\t\t\t\tlocation: new URL(url).toString()\n\t\t\t},\n\t\t\tstatus\n\t\t});\n\t}\n\n\tstatic error() {\n\t\tconst response = new Response(null, {status: 0, statusText: ''});\n\t\tresponse[INTERNALS].type = 'error';\n\t\treturn response;\n\t}\n\n\tstatic json(data = undefined, init = {}) {\n\t\tconst body = JSON.stringify(data);\n\n\t\tif (body === undefined) {\n\t\t\tthrow new TypeError('data is not JSON serializable');\n\t\t}\n\n\t\tconst headers = new Headers(init && init.headers);\n\n\t\tif (!headers.has('content-type')) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t}\n\n\t\treturn new Response(body, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Response';\n\t}\n}\n\nObject.defineProperties(Response.prototype, {\n\ttype: {enumerable: true},\n\turl: {enumerable: true},\n\tstatus: {enumerable: true},\n\tok: {enumerable: true},\n\tredirected: {enumerable: true},\n\tstatusText: {enumerable: true},\n\theaders: {enumerable: true},\n\tclone: {enumerable: true}\n});\n"],"names":["Body","body","headers","Headers","extractContentType","clone","isRedirect"],"mappings":";;;;AAUA,MAAM,YAAY,OAAO,oBAAoB;AAW9B,MAAM,iBAAiBA,KAAAA,QAAK;AAAA,EAC1C,YAAYC,SAAO,MAAM,UAAU,CAAA,GAAI;AACtC,UAAMA,QAAM,OAAO;AAGnB,UAAM,SAAS,QAAQ,UAAU,OAAO,QAAQ,SAAS;AAEzD,UAAMC,YAAU,IAAIC,QAAAA,QAAQ,QAAQ,OAAO;AAE3C,QAAIF,WAAS,QAAQ,CAACC,UAAQ,IAAI,cAAc,GAAG;AAClD,YAAM,cAAcE,KAAAA,mBAAmBH,QAAM,IAAI;AACjD,UAAI,aAAa;AAChBC,kBAAQ,OAAO,gBAAgB,WAAW;AAAA,MAC1C;AAAA,IACD;AAED,SAAK,SAAS,IAAI;AAAA,MACjB,MAAM;AAAA,MACN,KAAK,QAAQ;AAAA,MACb;AAAA,MACA,YAAY,QAAQ,cAAc;AAAA,MACrC,SAAGA;AAAAA,MACA,SAAS,QAAQ;AAAA,MACjB,eAAe,QAAQ;AAAA,IAC1B;AAAA,EACE;AAAA,EAED,IAAI,OAAO;AACV,WAAO,KAAK,SAAS,EAAE;AAAA,EACvB;AAAA,EAED,IAAI,MAAM;AACT,WAAO,KAAK,SAAS,EAAE,OAAO;AAAA,EAC9B;AAAA,EAED,IAAI,SAAS;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AAAA,EAED,OAAO,KAAK,OAAO,QAAW,OAAO,CAAA,GAAI;AACxC,UAAML,QAAO,KAAK,UAAU,IAAI;AAEhC,QAAIA,UAAS,QAAW;AACvB,YAAM,IAAI,UAAU,+BAA+B;AAAA,IACnD;AAED,UAAMC,YAAU,IAAIC,QAAO,QAAC,QAAQ,KAAK,OAAO;AAEhD,QAAI,CAACD,UAAQ,IAAI,cAAc,GAAG;AACjCA,gBAAQ,IAAI,gBAAgB,kBAAkB;AAAA,IAC9C;AAED,WAAO,IAAI,SAASD,OAAM;AAAA,MACzB,GAAG;AAAA,MACN,SAAGC;AAAAA,IACH,CAAG;AAAA,EACD;AAAA,EAED,KAAK,OAAO,WAAW,IAAI;AAC1B,WAAO;AAAA,EACP;AACF;AAEA,OAAO,iBAAiB,SAAS,WAAW;AAAA,EAC3C,MAAM,EAAC,YAAY,KAAI;AAAA,EACvB,KAAK,EAAC,YAAY,KAAI;AAAA,EACtB,QAAQ,EAAC,YAAY,KAAI;AAAA,EACzB,IAAI,EAAC,YAAY,KAAI;AAAA,EACrB,YAAY,EAAC,YAAY,KAAI;AAAA,EAC7B,YAAY,EAAC,YAAY,KAAI;AAAA,EAC7B,SAAS,EAAC,YAAY,KAAI;AAAA,EAC1B,OAAO,EAAC,YAAY,KAAI;AACzB,CAAC;;","x_google_ignoreList":[0]}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import Headers from "./headers.js";
|
|
2
|
-
import Body, { extractContentType, clone } from "./body.js";
|
|
3
|
-
import { isRedirect } from "./utils/is-redirect.js";
|
|
4
|
-
const INTERNALS = Symbol("Response internals");
|
|
5
|
-
class Response extends Body {
|
|
6
|
-
constructor(body = null, options = {}) {
|
|
7
|
-
super(body, options);
|
|
8
|
-
const status = options.status != null ? options.status : 200;
|
|
9
|
-
const headers = new Headers(options.headers);
|
|
10
|
-
if (body !== null && !headers.has("Content-Type")) {
|
|
11
|
-
const contentType = extractContentType(body, this);
|
|
12
|
-
if (contentType) {
|
|
13
|
-
headers.append("Content-Type", contentType);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
this[INTERNALS] = {
|
|
17
|
-
type: "default",
|
|
18
|
-
url: options.url,
|
|
19
|
-
status,
|
|
20
|
-
statusText: options.statusText || "",
|
|
21
|
-
headers,
|
|
22
|
-
counter: options.counter,
|
|
23
|
-
highWaterMark: options.highWaterMark
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
get type() {
|
|
27
|
-
return this[INTERNALS].type;
|
|
28
|
-
}
|
|
29
|
-
get url() {
|
|
30
|
-
return this[INTERNALS].url || "";
|
|
31
|
-
}
|
|
32
|
-
get status() {
|
|
33
|
-
return this[INTERNALS].status;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Convenience property representing if the request ended normally
|
|
37
|
-
*/
|
|
38
|
-
get ok() {
|
|
39
|
-
return this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;
|
|
40
|
-
}
|
|
41
|
-
get redirected() {
|
|
42
|
-
return this[INTERNALS].counter > 0;
|
|
43
|
-
}
|
|
44
|
-
get statusText() {
|
|
45
|
-
return this[INTERNALS].statusText;
|
|
46
|
-
}
|
|
47
|
-
get headers() {
|
|
48
|
-
return this[INTERNALS].headers;
|
|
49
|
-
}
|
|
50
|
-
get highWaterMark() {
|
|
51
|
-
return this[INTERNALS].highWaterMark;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Clone this response
|
|
55
|
-
*
|
|
56
|
-
* @return Response
|
|
57
|
-
*/
|
|
58
|
-
clone() {
|
|
59
|
-
return new Response(clone(this, this.highWaterMark), {
|
|
60
|
-
type: this.type,
|
|
61
|
-
url: this.url,
|
|
62
|
-
status: this.status,
|
|
63
|
-
statusText: this.statusText,
|
|
64
|
-
headers: this.headers,
|
|
65
|
-
ok: this.ok,
|
|
66
|
-
redirected: this.redirected,
|
|
67
|
-
size: this.size,
|
|
68
|
-
highWaterMark: this.highWaterMark
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @param {string} url The URL that the new response is to originate from.
|
|
73
|
-
* @param {number} status An optional status code for the response (e.g., 302.)
|
|
74
|
-
* @returns {Response} A Response object.
|
|
75
|
-
*/
|
|
76
|
-
static redirect(url, status = 302) {
|
|
77
|
-
if (!isRedirect(status)) {
|
|
78
|
-
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
|
79
|
-
}
|
|
80
|
-
return new Response(null, {
|
|
81
|
-
headers: {
|
|
82
|
-
location: new URL(url).toString()
|
|
83
|
-
},
|
|
84
|
-
status
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
static error() {
|
|
88
|
-
const response = new Response(null, { status: 0, statusText: "" });
|
|
89
|
-
response[INTERNALS].type = "error";
|
|
90
|
-
return response;
|
|
91
|
-
}
|
|
92
|
-
static json(data = void 0, init = {}) {
|
|
93
|
-
const body = JSON.stringify(data);
|
|
94
|
-
if (body === void 0) {
|
|
95
|
-
throw new TypeError("data is not JSON serializable");
|
|
96
|
-
}
|
|
97
|
-
const headers = new Headers(init && init.headers);
|
|
98
|
-
if (!headers.has("content-type")) {
|
|
99
|
-
headers.set("content-type", "application/json");
|
|
100
|
-
}
|
|
101
|
-
return new Response(body, {
|
|
102
|
-
...init,
|
|
103
|
-
headers
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
get [Symbol.toStringTag]() {
|
|
107
|
-
return "Response";
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
Object.defineProperties(Response.prototype, {
|
|
111
|
-
type: { enumerable: true },
|
|
112
|
-
url: { enumerable: true },
|
|
113
|
-
status: { enumerable: true },
|
|
114
|
-
ok: { enumerable: true },
|
|
115
|
-
redirected: { enumerable: true },
|
|
116
|
-
statusText: { enumerable: true },
|
|
117
|
-
headers: { enumerable: true },
|
|
118
|
-
clone: { enumerable: true }
|
|
119
|
-
});
|
|
120
|
-
export {
|
|
121
|
-
Response as default
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=response.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sources":["../../../../../../node_modules/node-fetch/src/response.js"],"sourcesContent":["/**\n * Response.js\n *\n * Response class provides content decoding\n */\n\nimport Headers from './headers.js';\nimport Body, {clone, extractContentType} from './body.js';\nimport {isRedirect} from './utils/is-redirect.js';\n\nconst INTERNALS = Symbol('Response internals');\n\n/**\n * Response class\n *\n * Ref: https://fetch.spec.whatwg.org/#response-class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nexport default class Response extends Body {\n\tconstructor(body = null, options = {}) {\n\t\tsuper(body, options);\n\n\t\t// eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition\n\t\tconst status = options.status != null ? options.status : 200;\n\n\t\tconst headers = new Headers(options.headers);\n\n\t\tif (body !== null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body, this);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS] = {\n\t\t\ttype: 'default',\n\t\t\turl: options.url,\n\t\t\tstatus,\n\t\t\tstatusText: options.statusText || '',\n\t\t\theaders,\n\t\t\tcounter: options.counter,\n\t\t\thighWaterMark: options.highWaterMark\n\t\t};\n\t}\n\n\tget type() {\n\t\treturn this[INTERNALS].type;\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS].status;\n\t}\n\n\t/**\n\t * Convenience property representing if the request ended normally\n\t */\n\tget ok() {\n\t\treturn this[INTERNALS].status >= 200 && this[INTERNALS].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS].headers;\n\t}\n\n\tget highWaterMark() {\n\t\treturn this[INTERNALS].highWaterMark;\n\t}\n\n\t/**\n\t * Clone this response\n\t *\n\t * @return Response\n\t */\n\tclone() {\n\t\treturn new Response(clone(this, this.highWaterMark), {\n\t\t\ttype: this.type,\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected,\n\t\t\tsize: this.size,\n\t\t\thighWaterMark: this.highWaterMark\n\t\t});\n\t}\n\n\t/**\n\t * @param {string} url The URL that the new response is to originate from.\n\t * @param {number} status An optional status code for the response (e.g., 302.)\n\t * @returns {Response} A Response object.\n\t */\n\tstatic redirect(url, status = 302) {\n\t\tif (!isRedirect(status)) {\n\t\t\tthrow new RangeError('Failed to execute \"redirect\" on \"response\": Invalid status code');\n\t\t}\n\n\t\treturn new Response(null, {\n\t\t\theaders: {\n\t\t\t\tlocation: new URL(url).toString()\n\t\t\t},\n\t\t\tstatus\n\t\t});\n\t}\n\n\tstatic error() {\n\t\tconst response = new Response(null, {status: 0, statusText: ''});\n\t\tresponse[INTERNALS].type = 'error';\n\t\treturn response;\n\t}\n\n\tstatic json(data = undefined, init = {}) {\n\t\tconst body = JSON.stringify(data);\n\n\t\tif (body === undefined) {\n\t\t\tthrow new TypeError('data is not JSON serializable');\n\t\t}\n\n\t\tconst headers = new Headers(init && init.headers);\n\n\t\tif (!headers.has('content-type')) {\n\t\t\theaders.set('content-type', 'application/json');\n\t\t}\n\n\t\treturn new Response(body, {\n\t\t\t...init,\n\t\t\theaders\n\t\t});\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn 'Response';\n\t}\n}\n\nObject.defineProperties(Response.prototype, {\n\ttype: {enumerable: true},\n\turl: {enumerable: true},\n\tstatus: {enumerable: true},\n\tok: {enumerable: true},\n\tredirected: {enumerable: true},\n\tstatusText: {enumerable: true},\n\theaders: {enumerable: true},\n\tclone: {enumerable: true}\n});\n"],"names":[],"mappings":";;;AAUA,MAAM,YAAY,OAAO,oBAAoB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AA,EACvB,KAAK,EAAC,YAAY,KAAI;AAAA,EACtB,QAAQ,EAAC,YAAY,KAAI;AAAA,EACzB,IAAI,EAAC,YAAY,KAAI;AAAA,EACrB,YAAY,EAAC,YAAY,KAAI;AAAA,EAC7B,YAAY,EAAC,YAAY,KAAI;AAAA,EAC7B,SAAS,EAAC,YAAY,KAAI;AAAA,EAC1B,OAAO,EAAC,YAAY,KAAI;AACzB,CAAC;","x_google_ignoreList":[0]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const getSearch = (parsedURL) => {
|
|
4
|
-
if (parsedURL.search) {
|
|
5
|
-
return parsedURL.search;
|
|
6
|
-
}
|
|
7
|
-
const lastOffset = parsedURL.href.length - 1;
|
|
8
|
-
const hash = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
|
|
9
|
-
return parsedURL.href[lastOffset - hash.length] === "?" ? "?" : "";
|
|
10
|
-
};
|
|
11
|
-
exports.getSearch = getSearch;
|
|
12
|
-
//# sourceMappingURL=get-search.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-search.cjs","sources":["../../../../../../../node_modules/node-fetch/src/utils/get-search.js"],"sourcesContent":["export const getSearch = parsedURL => {\n\tif (parsedURL.search) {\n\t\treturn parsedURL.search;\n\t}\n\n\tconst lastOffset = parsedURL.href.length - 1;\n\tconst hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');\n\treturn parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';\n};\n"],"names":[],"mappings":";;AAAY,MAAC,YAAY,eAAa;AACrC,MAAI,UAAU,QAAQ;AACrB,WAAO,UAAU;AAAA,EACjB;AAED,QAAM,aAAa,UAAU,KAAK,SAAS;AAC3C,QAAM,OAAO,UAAU,SAAS,UAAU,KAAK,UAAU,MAAM,MAAM,MAAM;AAC3E,SAAO,UAAU,KAAK,aAAa,KAAK,MAAM,MAAM,MAAM,MAAM;AACjE;;","x_google_ignoreList":[0]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const getSearch = (parsedURL) => {
|
|
2
|
-
if (parsedURL.search) {
|
|
3
|
-
return parsedURL.search;
|
|
4
|
-
}
|
|
5
|
-
const lastOffset = parsedURL.href.length - 1;
|
|
6
|
-
const hash = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
|
|
7
|
-
return parsedURL.href[lastOffset - hash.length] === "?" ? "?" : "";
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
getSearch
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=get-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-search.js","sources":["../../../../../../../node_modules/node-fetch/src/utils/get-search.js"],"sourcesContent":["export const getSearch = parsedURL => {\n\tif (parsedURL.search) {\n\t\treturn parsedURL.search;\n\t}\n\n\tconst lastOffset = parsedURL.href.length - 1;\n\tconst hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');\n\treturn parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';\n};\n"],"names":[],"mappings":"AAAY,MAAC,YAAY,eAAa;AACrC,MAAI,UAAU,QAAQ;AACrB,WAAO,UAAU;AAAA,EACjB;AAED,QAAM,aAAa,UAAU,KAAK,SAAS;AAC3C,QAAM,OAAO,UAAU,SAAS,UAAU,KAAK,UAAU,MAAM,MAAM,MAAM;AAC3E,SAAO,UAAU,KAAK,aAAa,KAAK,MAAM,MAAM,MAAM,MAAM;AACjE;","x_google_ignoreList":[0]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const redirectStatus = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
4
|
-
const isRedirect = (code) => {
|
|
5
|
-
return redirectStatus.has(code);
|
|
6
|
-
};
|
|
7
|
-
exports.isRedirect = isRedirect;
|
|
8
|
-
//# sourceMappingURL=is-redirect.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-redirect.cjs","sources":["../../../../../../../node_modules/node-fetch/src/utils/is-redirect.js"],"sourcesContent":["const redirectStatus = new Set([301, 302, 303, 307, 308]);\n\n/**\n * Redirect code matching\n *\n * @param {number} code - Status code\n * @return {boolean}\n */\nexport const isRedirect = code => {\n\treturn redirectStatus.has(code);\n};\n"],"names":[],"mappings":";;AAAA,MAAM,iBAAiB,oBAAI,IAAI,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG,CAAC;AAQ5C,MAAC,aAAa,UAAQ;AACjC,SAAO,eAAe,IAAI,IAAI;AAC/B;;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-redirect.js","sources":["../../../../../../../node_modules/node-fetch/src/utils/is-redirect.js"],"sourcesContent":["const redirectStatus = new Set([301, 302, 303, 307, 308]);\n\n/**\n * Redirect code matching\n *\n * @param {number} code - Status code\n * @return {boolean}\n */\nexport const isRedirect = code => {\n\treturn redirectStatus.has(code);\n};\n"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,oBAAI,IAAI,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG,CAAC;AAQ5C,MAAC,aAAa,UAAQ;AACjC,SAAO,eAAe,IAAI,IAAI;AAC/B;","x_google_ignoreList":[0]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const NAME = Symbol.toStringTag;
|
|
4
|
-
const isURLSearchParameters = (object) => {
|
|
5
|
-
return typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && typeof object.sort === "function" && object[NAME] === "URLSearchParams";
|
|
6
|
-
};
|
|
7
|
-
const isBlob = (object) => {
|
|
8
|
-
return object && typeof object === "object" && typeof object.arrayBuffer === "function" && typeof object.type === "string" && typeof object.stream === "function" && typeof object.constructor === "function" && /^(Blob|File)$/.test(object[NAME]);
|
|
9
|
-
};
|
|
10
|
-
const isAbortSignal = (object) => {
|
|
11
|
-
return typeof object === "object" && (object[NAME] === "AbortSignal" || object[NAME] === "EventTarget");
|
|
12
|
-
};
|
|
13
|
-
const isDomainOrSubdomain = (destination, original) => {
|
|
14
|
-
const orig = new URL(original).hostname;
|
|
15
|
-
const dest = new URL(destination).hostname;
|
|
16
|
-
return orig === dest || orig.endsWith(`.${dest}`);
|
|
17
|
-
};
|
|
18
|
-
const isSameProtocol = (destination, original) => {
|
|
19
|
-
const orig = new URL(original).protocol;
|
|
20
|
-
const dest = new URL(destination).protocol;
|
|
21
|
-
return orig === dest;
|
|
22
|
-
};
|
|
23
|
-
exports.isAbortSignal = isAbortSignal;
|
|
24
|
-
exports.isBlob = isBlob;
|
|
25
|
-
exports.isDomainOrSubdomain = isDomainOrSubdomain;
|
|
26
|
-
exports.isSameProtocol = isSameProtocol;
|
|
27
|
-
exports.isURLSearchParameters = isURLSearchParameters;
|
|
28
|
-
//# sourceMappingURL=is.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is.cjs","sources":["../../../../../../../node_modules/node-fetch/src/utils/is.js"],"sourcesContent":["/**\n * Is.js\n *\n * Object type checks.\n */\n\nconst NAME = Symbol.toStringTag;\n\n/**\n * Check if `obj` is a URLSearchParams object\n * ref: https://github.com/node-fetch/node-fetch/issues/296#issuecomment-307598143\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isURLSearchParameters = object => {\n\treturn (\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.append === 'function' &&\n\t\ttypeof object.delete === 'function' &&\n\t\ttypeof object.get === 'function' &&\n\t\ttypeof object.getAll === 'function' &&\n\t\ttypeof object.has === 'function' &&\n\t\ttypeof object.set === 'function' &&\n\t\ttypeof object.sort === 'function' &&\n\t\tobject[NAME] === 'URLSearchParams'\n\t);\n};\n\n/**\n * Check if `object` is a W3C `Blob` object (which `File` inherits from)\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isBlob = object => {\n\treturn (\n\t\tobject &&\n\t\ttypeof object === 'object' &&\n\t\ttypeof object.arrayBuffer === 'function' &&\n\t\ttypeof object.type === 'string' &&\n\t\ttypeof object.stream === 'function' &&\n\t\ttypeof object.constructor === 'function' &&\n\t\t/^(Blob|File)$/.test(object[NAME])\n\t);\n};\n\n/**\n * Check if `obj` is an instance of AbortSignal.\n * @param {*} object - Object to check for\n * @return {boolean}\n */\nexport const isAbortSignal = object => {\n\treturn (\n\t\ttypeof object === 'object' && (\n\t\t\tobject[NAME] === 'AbortSignal' ||\n\t\t\tobject[NAME] === 'EventTarget'\n\t\t)\n\t);\n};\n\n/**\n * isDomainOrSubdomain reports whether sub is a subdomain (or exact match) of\n * the parent domain.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isDomainOrSubdomain = (destination, original) => {\n\tconst orig = new URL(original).hostname;\n\tconst dest = new URL(destination).hostname;\n\n\treturn orig === dest || orig.endsWith(`.${dest}`);\n};\n\n/**\n * isSameProtocol reports whether the two provided URLs use the same protocol.\n *\n * Both domains must already be in canonical form.\n * @param {string|URL} original\n * @param {string|URL} destination\n */\nexport const isSameProtocol = (destination, original) => {\n\tconst orig = new URL(original).protocol;\n\tconst dest = new URL(destination).protocol;\n\n\treturn orig === dest;\n};\n"],"names":[],"mappings":";;AAMA,MAAM,OAAO,OAAO;AAQR,MAAC,wBAAwB,YAAU;AAC9C,SACC,OAAO,WAAW,YAClB,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,QAAQ,cACtB,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,QAAQ,cACtB,OAAO,OAAO,QAAQ,cACtB,OAAO,OAAO,SAAS,cACvB,OAAO,IAAI,MAAM;AAEnB;AAOY,MAAC,SAAS,YAAU;AAC/B,SACC,UACA,OAAO,WAAW,YAClB,OAAO,OAAO,gBAAgB,cAC9B,OAAO,OAAO,SAAS,YACvB,OAAO,OAAO,WAAW,cACzB,OAAO,OAAO,gBAAgB,cAC9B,gBAAgB,KAAK,OAAO,IAAI,CAAC;AAEnC;AAOY,MAAC,gBAAgB,YAAU;AACtC,SACC,OAAO,WAAW,aACjB,OAAO,IAAI,MAAM,iBACjB,OAAO,IAAI,MAAM;AAGpB;AAUY,MAAC,sBAAsB,CAAC,aAAa,aAAa;AAC7D,QAAM,OAAO,IAAI,IAAI,QAAQ,EAAE;AAC/B,QAAM,OAAO,IAAI,IAAI,WAAW,EAAE;AAElC,SAAO,SAAS,QAAQ,KAAK,SAAS,IAAI,MAAM;AACjD;AASY,MAAC,iBAAiB,CAAC,aAAa,aAAa;AACxD,QAAM,OAAO,IAAI,IAAI,QAAQ,EAAE;AAC/B,QAAM,OAAO,IAAI,IAAI,WAAW,EAAE;AAElC,SAAO,SAAS;AACjB;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const NAME = Symbol.toStringTag;
|
|
2
|
-
const isURLSearchParameters = (object) => {
|
|
3
|
-
return typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && typeof object.sort === "function" && object[NAME] === "URLSearchParams";
|
|
4
|
-
};
|
|
5
|
-
const isBlob = (object) => {
|
|
6
|
-
return object && typeof object === "object" && typeof object.arrayBuffer === "function" && typeof object.type === "string" && typeof object.stream === "function" && typeof object.constructor === "function" && /^(Blob|File)$/.test(object[NAME]);
|
|
7
|
-
};
|
|
8
|
-
const isAbortSignal = (object) => {
|
|
9
|
-
return typeof object === "object" && (object[NAME] === "AbortSignal" || object[NAME] === "EventTarget");
|
|
10
|
-
};
|
|
11
|
-
const isDomainOrSubdomain = (destination, original) => {
|
|
12
|
-
const orig = new URL(original).hostname;
|
|
13
|
-
const dest = new URL(destination).hostname;
|
|
14
|
-
return orig === dest || orig.endsWith(`.${dest}`);
|
|
15
|
-
};
|
|
16
|
-
const isSameProtocol = (destination, original) => {
|
|
17
|
-
const orig = new URL(original).protocol;
|
|
18
|
-
const dest = new URL(destination).protocol;
|
|
19
|
-
return orig === dest;
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
isAbortSignal,
|
|
23
|
-
isBlob,
|
|
24
|
-
isDomainOrSubdomain,
|
|
25
|
-
isSameProtocol,
|
|
26
|
-
isURLSearchParameters
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=is.js.map
|