@gapi/gcli 1.8.202 → 1.8.204
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/package.json +1 -1
- package/release/index.js +1379 -1297
package/release/index.js
CHANGED
|
@@ -2398,6 +2398,50 @@ var require_commander = __commonJS({
|
|
|
2398
2398
|
}
|
|
2399
2399
|
});
|
|
2400
2400
|
|
|
2401
|
+
// ../../node_modules/data-uri-to-buffer/dist/index.js
|
|
2402
|
+
function dataUriToBuffer(uri) {
|
|
2403
|
+
if (!/^data:/i.test(uri)) {
|
|
2404
|
+
throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
|
|
2405
|
+
}
|
|
2406
|
+
uri = uri.replace(/\r?\n/g, "");
|
|
2407
|
+
const firstComma = uri.indexOf(",");
|
|
2408
|
+
if (firstComma === -1 || firstComma <= 4) {
|
|
2409
|
+
throw new TypeError("malformed data: URI");
|
|
2410
|
+
}
|
|
2411
|
+
const meta3 = uri.substring(5, firstComma).split(";");
|
|
2412
|
+
let charset = "";
|
|
2413
|
+
let base643 = false;
|
|
2414
|
+
const type2 = meta3[0] || "text/plain";
|
|
2415
|
+
let typeFull = type2;
|
|
2416
|
+
for (let i2 = 1; i2 < meta3.length; i2++) {
|
|
2417
|
+
if (meta3[i2] === "base64") {
|
|
2418
|
+
base643 = true;
|
|
2419
|
+
} else if (meta3[i2]) {
|
|
2420
|
+
typeFull += `;${meta3[i2]}`;
|
|
2421
|
+
if (meta3[i2].indexOf("charset=") === 0) {
|
|
2422
|
+
charset = meta3[i2].substring(8);
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
if (!meta3[0] && !charset.length) {
|
|
2427
|
+
typeFull += ";charset=US-ASCII";
|
|
2428
|
+
charset = "US-ASCII";
|
|
2429
|
+
}
|
|
2430
|
+
const encoding = base643 ? "base64" : "ascii";
|
|
2431
|
+
const data = unescape(uri.substring(firstComma + 1));
|
|
2432
|
+
const buffer = Buffer.from(data, encoding);
|
|
2433
|
+
buffer.type = type2;
|
|
2434
|
+
buffer.typeFull = typeFull;
|
|
2435
|
+
buffer.charset = charset;
|
|
2436
|
+
return buffer;
|
|
2437
|
+
}
|
|
2438
|
+
var dist_default;
|
|
2439
|
+
var init_dist = __esm({
|
|
2440
|
+
"../../node_modules/data-uri-to-buffer/dist/index.js"() {
|
|
2441
|
+
dist_default = dataUriToBuffer;
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
|
|
2401
2445
|
// ../../node_modules/web-streams-polyfill/dist/ponyfill.es2018.js
|
|
2402
2446
|
var require_ponyfill_es2018 = __commonJS({
|
|
2403
2447
|
"../../node_modules/web-streams-polyfill/dist/ponyfill.es2018.js"(exports2, module2) {
|
|
@@ -7064,6 +7108,75 @@ var init_esm_min = __esm({
|
|
|
7064
7108
|
}
|
|
7065
7109
|
});
|
|
7066
7110
|
|
|
7111
|
+
// ../../node_modules/node-fetch/src/errors/base.js
|
|
7112
|
+
var FetchBaseError;
|
|
7113
|
+
var init_base = __esm({
|
|
7114
|
+
"../../node_modules/node-fetch/src/errors/base.js"() {
|
|
7115
|
+
FetchBaseError = class extends Error {
|
|
7116
|
+
constructor(message, type2) {
|
|
7117
|
+
super(message);
|
|
7118
|
+
Error.captureStackTrace(this, this.constructor);
|
|
7119
|
+
this.type = type2;
|
|
7120
|
+
}
|
|
7121
|
+
get name() {
|
|
7122
|
+
return this.constructor.name;
|
|
7123
|
+
}
|
|
7124
|
+
get [Symbol.toStringTag]() {
|
|
7125
|
+
return this.constructor.name;
|
|
7126
|
+
}
|
|
7127
|
+
};
|
|
7128
|
+
}
|
|
7129
|
+
});
|
|
7130
|
+
|
|
7131
|
+
// ../../node_modules/node-fetch/src/errors/fetch-error.js
|
|
7132
|
+
var FetchError;
|
|
7133
|
+
var init_fetch_error = __esm({
|
|
7134
|
+
"../../node_modules/node-fetch/src/errors/fetch-error.js"() {
|
|
7135
|
+
init_base();
|
|
7136
|
+
FetchError = class extends FetchBaseError {
|
|
7137
|
+
/**
|
|
7138
|
+
* @param {string} message - Error message for human
|
|
7139
|
+
* @param {string} [type] - Error type for machine
|
|
7140
|
+
* @param {SystemError} [systemError] - For Node.js system error
|
|
7141
|
+
*/
|
|
7142
|
+
constructor(message, type2, systemError) {
|
|
7143
|
+
super(message, type2);
|
|
7144
|
+
if (systemError) {
|
|
7145
|
+
this.code = this.errno = systemError.code;
|
|
7146
|
+
this.erroredSysCall = systemError.syscall;
|
|
7147
|
+
}
|
|
7148
|
+
}
|
|
7149
|
+
};
|
|
7150
|
+
}
|
|
7151
|
+
});
|
|
7152
|
+
|
|
7153
|
+
// ../../node_modules/node-fetch/src/utils/is.js
|
|
7154
|
+
var NAME, isURLSearchParameters, isBlob, isAbortSignal, isDomainOrSubdomain, isSameProtocol;
|
|
7155
|
+
var init_is = __esm({
|
|
7156
|
+
"../../node_modules/node-fetch/src/utils/is.js"() {
|
|
7157
|
+
NAME = Symbol.toStringTag;
|
|
7158
|
+
isURLSearchParameters = (object3) => {
|
|
7159
|
+
return typeof object3 === "object" && typeof object3.append === "function" && typeof object3.delete === "function" && typeof object3.get === "function" && typeof object3.getAll === "function" && typeof object3.has === "function" && typeof object3.set === "function" && typeof object3.sort === "function" && object3[NAME] === "URLSearchParams";
|
|
7160
|
+
};
|
|
7161
|
+
isBlob = (object3) => {
|
|
7162
|
+
return object3 && typeof object3 === "object" && typeof object3.arrayBuffer === "function" && typeof object3.type === "string" && typeof object3.stream === "function" && typeof object3.constructor === "function" && /^(Blob|File)$/.test(object3[NAME]);
|
|
7163
|
+
};
|
|
7164
|
+
isAbortSignal = (object3) => {
|
|
7165
|
+
return typeof object3 === "object" && (object3[NAME] === "AbortSignal" || object3[NAME] === "EventTarget");
|
|
7166
|
+
};
|
|
7167
|
+
isDomainOrSubdomain = (destination, original) => {
|
|
7168
|
+
const orig = new URL(original).hostname;
|
|
7169
|
+
const dest = new URL(destination).hostname;
|
|
7170
|
+
return orig === dest || orig.endsWith(`.${dest}`);
|
|
7171
|
+
};
|
|
7172
|
+
isSameProtocol = (destination, original) => {
|
|
7173
|
+
const orig = new URL(original).protocol;
|
|
7174
|
+
const dest = new URL(destination).protocol;
|
|
7175
|
+
return orig === dest;
|
|
7176
|
+
};
|
|
7177
|
+
}
|
|
7178
|
+
});
|
|
7179
|
+
|
|
7067
7180
|
// ../../node_modules/node-domexception/index.js
|
|
7068
7181
|
var require_node_domexception = __commonJS({
|
|
7069
7182
|
"../../node_modules/node-domexception/index.js"(exports2, module2) {
|
|
@@ -7453,6 +7566,1256 @@ var init_multipart_parser = __esm({
|
|
|
7453
7566
|
}
|
|
7454
7567
|
});
|
|
7455
7568
|
|
|
7569
|
+
// ../../node_modules/node-fetch/src/body.js
|
|
7570
|
+
async function consumeBody(data) {
|
|
7571
|
+
if (data[INTERNALS].disturbed) {
|
|
7572
|
+
throw new TypeError(`body used already for: ${data.url}`);
|
|
7573
|
+
}
|
|
7574
|
+
data[INTERNALS].disturbed = true;
|
|
7575
|
+
if (data[INTERNALS].error) {
|
|
7576
|
+
throw data[INTERNALS].error;
|
|
7577
|
+
}
|
|
7578
|
+
const { body } = data;
|
|
7579
|
+
if (body === null) {
|
|
7580
|
+
return import_node_buffer.Buffer.alloc(0);
|
|
7581
|
+
}
|
|
7582
|
+
if (!(body instanceof import_node_stream.default)) {
|
|
7583
|
+
return import_node_buffer.Buffer.alloc(0);
|
|
7584
|
+
}
|
|
7585
|
+
const accum = [];
|
|
7586
|
+
let accumBytes = 0;
|
|
7587
|
+
try {
|
|
7588
|
+
for await (const chunk of body) {
|
|
7589
|
+
if (data.size > 0 && accumBytes + chunk.length > data.size) {
|
|
7590
|
+
const error48 = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size");
|
|
7591
|
+
body.destroy(error48);
|
|
7592
|
+
throw error48;
|
|
7593
|
+
}
|
|
7594
|
+
accumBytes += chunk.length;
|
|
7595
|
+
accum.push(chunk);
|
|
7596
|
+
}
|
|
7597
|
+
} catch (error48) {
|
|
7598
|
+
const error_ = error48 instanceof FetchBaseError ? error48 : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error48.message}`, "system", error48);
|
|
7599
|
+
throw error_;
|
|
7600
|
+
}
|
|
7601
|
+
if (body.readableEnded === true || body._readableState.ended === true) {
|
|
7602
|
+
try {
|
|
7603
|
+
if (accum.every((c) => typeof c === "string")) {
|
|
7604
|
+
return import_node_buffer.Buffer.from(accum.join(""));
|
|
7605
|
+
}
|
|
7606
|
+
return import_node_buffer.Buffer.concat(accum, accumBytes);
|
|
7607
|
+
} catch (error48) {
|
|
7608
|
+
throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error48.message}`, "system", error48);
|
|
7609
|
+
}
|
|
7610
|
+
} else {
|
|
7611
|
+
throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`);
|
|
7612
|
+
}
|
|
7613
|
+
}
|
|
7614
|
+
var import_node_stream, import_node_util, import_node_buffer, pipeline, INTERNALS, Body, clone, getNonSpecFormDataBoundary, extractContentType, getTotalBytes, writeToStream;
|
|
7615
|
+
var init_body = __esm({
|
|
7616
|
+
"../../node_modules/node-fetch/src/body.js"() {
|
|
7617
|
+
import_node_stream = __toESM(require("node:stream"), 1);
|
|
7618
|
+
import_node_util = require("node:util");
|
|
7619
|
+
import_node_buffer = require("node:buffer");
|
|
7620
|
+
init_fetch_blob();
|
|
7621
|
+
init_esm_min();
|
|
7622
|
+
init_fetch_error();
|
|
7623
|
+
init_base();
|
|
7624
|
+
init_is();
|
|
7625
|
+
pipeline = (0, import_node_util.promisify)(import_node_stream.default.pipeline);
|
|
7626
|
+
INTERNALS = /* @__PURE__ */ Symbol("Body internals");
|
|
7627
|
+
Body = class {
|
|
7628
|
+
constructor(body, {
|
|
7629
|
+
size = 0
|
|
7630
|
+
} = {}) {
|
|
7631
|
+
let boundary = null;
|
|
7632
|
+
if (body === null) {
|
|
7633
|
+
body = null;
|
|
7634
|
+
} else if (isURLSearchParameters(body)) {
|
|
7635
|
+
body = import_node_buffer.Buffer.from(body.toString());
|
|
7636
|
+
} else if (isBlob(body)) {
|
|
7637
|
+
} else if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
7638
|
+
} else if (import_node_util.types.isAnyArrayBuffer(body)) {
|
|
7639
|
+
body = import_node_buffer.Buffer.from(body);
|
|
7640
|
+
} else if (ArrayBuffer.isView(body)) {
|
|
7641
|
+
body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
|
|
7642
|
+
} else if (body instanceof import_node_stream.default) {
|
|
7643
|
+
} else if (body instanceof FormData) {
|
|
7644
|
+
body = formDataToBlob(body);
|
|
7645
|
+
boundary = body.type.split("=")[1];
|
|
7646
|
+
} else {
|
|
7647
|
+
body = import_node_buffer.Buffer.from(String(body));
|
|
7648
|
+
}
|
|
7649
|
+
let stream = body;
|
|
7650
|
+
if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
7651
|
+
stream = import_node_stream.default.Readable.from(body);
|
|
7652
|
+
} else if (isBlob(body)) {
|
|
7653
|
+
stream = import_node_stream.default.Readable.from(body.stream());
|
|
7654
|
+
}
|
|
7655
|
+
this[INTERNALS] = {
|
|
7656
|
+
body,
|
|
7657
|
+
stream,
|
|
7658
|
+
boundary,
|
|
7659
|
+
disturbed: false,
|
|
7660
|
+
error: null
|
|
7661
|
+
};
|
|
7662
|
+
this.size = size;
|
|
7663
|
+
if (body instanceof import_node_stream.default) {
|
|
7664
|
+
body.on("error", (error_) => {
|
|
7665
|
+
const error48 = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
|
|
7666
|
+
this[INTERNALS].error = error48;
|
|
7667
|
+
});
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
get body() {
|
|
7671
|
+
return this[INTERNALS].stream;
|
|
7672
|
+
}
|
|
7673
|
+
get bodyUsed() {
|
|
7674
|
+
return this[INTERNALS].disturbed;
|
|
7675
|
+
}
|
|
7676
|
+
/**
|
|
7677
|
+
* Decode response as ArrayBuffer
|
|
7678
|
+
*
|
|
7679
|
+
* @return Promise
|
|
7680
|
+
*/
|
|
7681
|
+
async arrayBuffer() {
|
|
7682
|
+
const { buffer, byteOffset, byteLength } = await consumeBody(this);
|
|
7683
|
+
return buffer.slice(byteOffset, byteOffset + byteLength);
|
|
7684
|
+
}
|
|
7685
|
+
async formData() {
|
|
7686
|
+
const ct = this.headers.get("content-type");
|
|
7687
|
+
if (ct.startsWith("application/x-www-form-urlencoded")) {
|
|
7688
|
+
const formData = new FormData();
|
|
7689
|
+
const parameters = new URLSearchParams(await this.text());
|
|
7690
|
+
for (const [name2, value] of parameters) {
|
|
7691
|
+
formData.append(name2, value);
|
|
7692
|
+
}
|
|
7693
|
+
return formData;
|
|
7694
|
+
}
|
|
7695
|
+
const { toFormData: toFormData2 } = await Promise.resolve().then(() => (init_multipart_parser(), multipart_parser_exports));
|
|
7696
|
+
return toFormData2(this.body, ct);
|
|
7697
|
+
}
|
|
7698
|
+
/**
|
|
7699
|
+
* Return raw response as Blob
|
|
7700
|
+
*
|
|
7701
|
+
* @return Promise
|
|
7702
|
+
*/
|
|
7703
|
+
async blob() {
|
|
7704
|
+
const ct = this.headers && this.headers.get("content-type") || this[INTERNALS].body && this[INTERNALS].body.type || "";
|
|
7705
|
+
const buf = await this.arrayBuffer();
|
|
7706
|
+
return new fetch_blob_default([buf], {
|
|
7707
|
+
type: ct
|
|
7708
|
+
});
|
|
7709
|
+
}
|
|
7710
|
+
/**
|
|
7711
|
+
* Decode response as json
|
|
7712
|
+
*
|
|
7713
|
+
* @return Promise
|
|
7714
|
+
*/
|
|
7715
|
+
async json() {
|
|
7716
|
+
const text = await this.text();
|
|
7717
|
+
return JSON.parse(text);
|
|
7718
|
+
}
|
|
7719
|
+
/**
|
|
7720
|
+
* Decode response as text
|
|
7721
|
+
*
|
|
7722
|
+
* @return Promise
|
|
7723
|
+
*/
|
|
7724
|
+
async text() {
|
|
7725
|
+
const buffer = await consumeBody(this);
|
|
7726
|
+
return new TextDecoder().decode(buffer);
|
|
7727
|
+
}
|
|
7728
|
+
/**
|
|
7729
|
+
* Decode response as buffer (non-spec api)
|
|
7730
|
+
*
|
|
7731
|
+
* @return Promise
|
|
7732
|
+
*/
|
|
7733
|
+
buffer() {
|
|
7734
|
+
return consumeBody(this);
|
|
7735
|
+
}
|
|
7736
|
+
};
|
|
7737
|
+
Body.prototype.buffer = (0, import_node_util.deprecate)(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
|
|
7738
|
+
Object.defineProperties(Body.prototype, {
|
|
7739
|
+
body: { enumerable: true },
|
|
7740
|
+
bodyUsed: { enumerable: true },
|
|
7741
|
+
arrayBuffer: { enumerable: true },
|
|
7742
|
+
blob: { enumerable: true },
|
|
7743
|
+
json: { enumerable: true },
|
|
7744
|
+
text: { enumerable: true },
|
|
7745
|
+
data: { get: (0, import_node_util.deprecate)(
|
|
7746
|
+
() => {
|
|
7747
|
+
},
|
|
7748
|
+
"data doesn't exist, use json(), text(), arrayBuffer(), or body instead",
|
|
7749
|
+
"https://github.com/node-fetch/node-fetch/issues/1000 (response)"
|
|
7750
|
+
) }
|
|
7751
|
+
});
|
|
7752
|
+
clone = (instance, highWaterMark) => {
|
|
7753
|
+
let p1;
|
|
7754
|
+
let p2;
|
|
7755
|
+
let { body } = instance[INTERNALS];
|
|
7756
|
+
if (instance.bodyUsed) {
|
|
7757
|
+
throw new Error("cannot clone body after it is used");
|
|
7758
|
+
}
|
|
7759
|
+
if (body instanceof import_node_stream.default && typeof body.getBoundary !== "function") {
|
|
7760
|
+
p1 = new import_node_stream.PassThrough({ highWaterMark });
|
|
7761
|
+
p2 = new import_node_stream.PassThrough({ highWaterMark });
|
|
7762
|
+
body.pipe(p1);
|
|
7763
|
+
body.pipe(p2);
|
|
7764
|
+
instance[INTERNALS].stream = p1;
|
|
7765
|
+
body = p2;
|
|
7766
|
+
}
|
|
7767
|
+
return body;
|
|
7768
|
+
};
|
|
7769
|
+
getNonSpecFormDataBoundary = (0, import_node_util.deprecate)(
|
|
7770
|
+
(body) => body.getBoundary(),
|
|
7771
|
+
"form-data doesn't follow the spec and requires special treatment. Use alternative package",
|
|
7772
|
+
"https://github.com/node-fetch/node-fetch/issues/1167"
|
|
7773
|
+
);
|
|
7774
|
+
extractContentType = (body, request) => {
|
|
7775
|
+
if (body === null) {
|
|
7776
|
+
return null;
|
|
7777
|
+
}
|
|
7778
|
+
if (typeof body === "string") {
|
|
7779
|
+
return "text/plain;charset=UTF-8";
|
|
7780
|
+
}
|
|
7781
|
+
if (isURLSearchParameters(body)) {
|
|
7782
|
+
return "application/x-www-form-urlencoded;charset=UTF-8";
|
|
7783
|
+
}
|
|
7784
|
+
if (isBlob(body)) {
|
|
7785
|
+
return body.type || null;
|
|
7786
|
+
}
|
|
7787
|
+
if (import_node_buffer.Buffer.isBuffer(body) || import_node_util.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
|
7788
|
+
return null;
|
|
7789
|
+
}
|
|
7790
|
+
if (body instanceof FormData) {
|
|
7791
|
+
return `multipart/form-data; boundary=${request[INTERNALS].boundary}`;
|
|
7792
|
+
}
|
|
7793
|
+
if (body && typeof body.getBoundary === "function") {
|
|
7794
|
+
return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;
|
|
7795
|
+
}
|
|
7796
|
+
if (body instanceof import_node_stream.default) {
|
|
7797
|
+
return null;
|
|
7798
|
+
}
|
|
7799
|
+
return "text/plain;charset=UTF-8";
|
|
7800
|
+
};
|
|
7801
|
+
getTotalBytes = (request) => {
|
|
7802
|
+
const { body } = request[INTERNALS];
|
|
7803
|
+
if (body === null) {
|
|
7804
|
+
return 0;
|
|
7805
|
+
}
|
|
7806
|
+
if (isBlob(body)) {
|
|
7807
|
+
return body.size;
|
|
7808
|
+
}
|
|
7809
|
+
if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
7810
|
+
return body.length;
|
|
7811
|
+
}
|
|
7812
|
+
if (body && typeof body.getLengthSync === "function") {
|
|
7813
|
+
return body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;
|
|
7814
|
+
}
|
|
7815
|
+
return null;
|
|
7816
|
+
};
|
|
7817
|
+
writeToStream = async (dest, { body }) => {
|
|
7818
|
+
if (body === null) {
|
|
7819
|
+
dest.end();
|
|
7820
|
+
} else {
|
|
7821
|
+
await pipeline(body, dest);
|
|
7822
|
+
}
|
|
7823
|
+
};
|
|
7824
|
+
}
|
|
7825
|
+
});
|
|
7826
|
+
|
|
7827
|
+
// ../../node_modules/node-fetch/src/headers.js
|
|
7828
|
+
function fromRawHeaders(headers = []) {
|
|
7829
|
+
return new Headers2(
|
|
7830
|
+
headers.reduce((result, value, index, array2) => {
|
|
7831
|
+
if (index % 2 === 0) {
|
|
7832
|
+
result.push(array2.slice(index, index + 2));
|
|
7833
|
+
}
|
|
7834
|
+
return result;
|
|
7835
|
+
}, []).filter(([name2, value]) => {
|
|
7836
|
+
try {
|
|
7837
|
+
validateHeaderName(name2);
|
|
7838
|
+
validateHeaderValue(name2, String(value));
|
|
7839
|
+
return true;
|
|
7840
|
+
} catch {
|
|
7841
|
+
return false;
|
|
7842
|
+
}
|
|
7843
|
+
})
|
|
7844
|
+
);
|
|
7845
|
+
}
|
|
7846
|
+
var import_node_util2, import_node_http, validateHeaderName, validateHeaderValue, Headers2;
|
|
7847
|
+
var init_headers = __esm({
|
|
7848
|
+
"../../node_modules/node-fetch/src/headers.js"() {
|
|
7849
|
+
import_node_util2 = require("node:util");
|
|
7850
|
+
import_node_http = __toESM(require("node:http"), 1);
|
|
7851
|
+
validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name2) => {
|
|
7852
|
+
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name2)) {
|
|
7853
|
+
const error48 = new TypeError(`Header name must be a valid HTTP token [${name2}]`);
|
|
7854
|
+
Object.defineProperty(error48, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
|
|
7855
|
+
throw error48;
|
|
7856
|
+
}
|
|
7857
|
+
};
|
|
7858
|
+
validateHeaderValue = typeof import_node_http.default.validateHeaderValue === "function" ? import_node_http.default.validateHeaderValue : (name2, value) => {
|
|
7859
|
+
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
|
|
7860
|
+
const error48 = new TypeError(`Invalid character in header content ["${name2}"]`);
|
|
7861
|
+
Object.defineProperty(error48, "code", { value: "ERR_INVALID_CHAR" });
|
|
7862
|
+
throw error48;
|
|
7863
|
+
}
|
|
7864
|
+
};
|
|
7865
|
+
Headers2 = class _Headers extends URLSearchParams {
|
|
7866
|
+
/**
|
|
7867
|
+
* Headers class
|
|
7868
|
+
*
|
|
7869
|
+
* @constructor
|
|
7870
|
+
* @param {HeadersInit} [init] - Response headers
|
|
7871
|
+
*/
|
|
7872
|
+
constructor(init) {
|
|
7873
|
+
let result = [];
|
|
7874
|
+
if (init instanceof _Headers) {
|
|
7875
|
+
const raw = init.raw();
|
|
7876
|
+
for (const [name2, values] of Object.entries(raw)) {
|
|
7877
|
+
result.push(...values.map((value) => [name2, value]));
|
|
7878
|
+
}
|
|
7879
|
+
} else if (init == null) {
|
|
7880
|
+
} else if (typeof init === "object" && !import_node_util2.types.isBoxedPrimitive(init)) {
|
|
7881
|
+
const method = init[Symbol.iterator];
|
|
7882
|
+
if (method == null) {
|
|
7883
|
+
result.push(...Object.entries(init));
|
|
7884
|
+
} else {
|
|
7885
|
+
if (typeof method !== "function") {
|
|
7886
|
+
throw new TypeError("Header pairs must be iterable");
|
|
7887
|
+
}
|
|
7888
|
+
result = [...init].map((pair) => {
|
|
7889
|
+
if (typeof pair !== "object" || import_node_util2.types.isBoxedPrimitive(pair)) {
|
|
7890
|
+
throw new TypeError("Each header pair must be an iterable object");
|
|
7891
|
+
}
|
|
7892
|
+
return [...pair];
|
|
7893
|
+
}).map((pair) => {
|
|
7894
|
+
if (pair.length !== 2) {
|
|
7895
|
+
throw new TypeError("Each header pair must be a name/value tuple");
|
|
7896
|
+
}
|
|
7897
|
+
return [...pair];
|
|
7898
|
+
});
|
|
7899
|
+
}
|
|
7900
|
+
} else {
|
|
7901
|
+
throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");
|
|
7902
|
+
}
|
|
7903
|
+
result = result.length > 0 ? result.map(([name2, value]) => {
|
|
7904
|
+
validateHeaderName(name2);
|
|
7905
|
+
validateHeaderValue(name2, String(value));
|
|
7906
|
+
return [String(name2).toLowerCase(), String(value)];
|
|
7907
|
+
}) : void 0;
|
|
7908
|
+
super(result);
|
|
7909
|
+
return new Proxy(this, {
|
|
7910
|
+
get(target, p, receiver) {
|
|
7911
|
+
switch (p) {
|
|
7912
|
+
case "append":
|
|
7913
|
+
case "set":
|
|
7914
|
+
return (name2, value) => {
|
|
7915
|
+
validateHeaderName(name2);
|
|
7916
|
+
validateHeaderValue(name2, String(value));
|
|
7917
|
+
return URLSearchParams.prototype[p].call(
|
|
7918
|
+
target,
|
|
7919
|
+
String(name2).toLowerCase(),
|
|
7920
|
+
String(value)
|
|
7921
|
+
);
|
|
7922
|
+
};
|
|
7923
|
+
case "delete":
|
|
7924
|
+
case "has":
|
|
7925
|
+
case "getAll":
|
|
7926
|
+
return (name2) => {
|
|
7927
|
+
validateHeaderName(name2);
|
|
7928
|
+
return URLSearchParams.prototype[p].call(
|
|
7929
|
+
target,
|
|
7930
|
+
String(name2).toLowerCase()
|
|
7931
|
+
);
|
|
7932
|
+
};
|
|
7933
|
+
case "keys":
|
|
7934
|
+
return () => {
|
|
7935
|
+
target.sort();
|
|
7936
|
+
return new Set(URLSearchParams.prototype.keys.call(target)).keys();
|
|
7937
|
+
};
|
|
7938
|
+
default:
|
|
7939
|
+
return Reflect.get(target, p, receiver);
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
});
|
|
7943
|
+
}
|
|
7944
|
+
get [Symbol.toStringTag]() {
|
|
7945
|
+
return this.constructor.name;
|
|
7946
|
+
}
|
|
7947
|
+
toString() {
|
|
7948
|
+
return Object.prototype.toString.call(this);
|
|
7949
|
+
}
|
|
7950
|
+
get(name2) {
|
|
7951
|
+
const values = this.getAll(name2);
|
|
7952
|
+
if (values.length === 0) {
|
|
7953
|
+
return null;
|
|
7954
|
+
}
|
|
7955
|
+
let value = values.join(", ");
|
|
7956
|
+
if (/^content-encoding$/i.test(name2)) {
|
|
7957
|
+
value = value.toLowerCase();
|
|
7958
|
+
}
|
|
7959
|
+
return value;
|
|
7960
|
+
}
|
|
7961
|
+
forEach(callback, thisArg = void 0) {
|
|
7962
|
+
for (const name2 of this.keys()) {
|
|
7963
|
+
Reflect.apply(callback, thisArg, [this.get(name2), name2, this]);
|
|
7964
|
+
}
|
|
7965
|
+
}
|
|
7966
|
+
*values() {
|
|
7967
|
+
for (const name2 of this.keys()) {
|
|
7968
|
+
yield this.get(name2);
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7971
|
+
/**
|
|
7972
|
+
* @type {() => IterableIterator<[string, string]>}
|
|
7973
|
+
*/
|
|
7974
|
+
*entries() {
|
|
7975
|
+
for (const name2 of this.keys()) {
|
|
7976
|
+
yield [name2, this.get(name2)];
|
|
7977
|
+
}
|
|
7978
|
+
}
|
|
7979
|
+
[Symbol.iterator]() {
|
|
7980
|
+
return this.entries();
|
|
7981
|
+
}
|
|
7982
|
+
/**
|
|
7983
|
+
* Node-fetch non-spec method
|
|
7984
|
+
* returning all headers and their values as array
|
|
7985
|
+
* @returns {Record<string, string[]>}
|
|
7986
|
+
*/
|
|
7987
|
+
raw() {
|
|
7988
|
+
return [...this.keys()].reduce((result, key) => {
|
|
7989
|
+
result[key] = this.getAll(key);
|
|
7990
|
+
return result;
|
|
7991
|
+
}, {});
|
|
7992
|
+
}
|
|
7993
|
+
/**
|
|
7994
|
+
* For better console.log(headers) and also to convert Headers into Node.js Request compatible format
|
|
7995
|
+
*/
|
|
7996
|
+
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
7997
|
+
return [...this.keys()].reduce((result, key) => {
|
|
7998
|
+
const values = this.getAll(key);
|
|
7999
|
+
if (key === "host") {
|
|
8000
|
+
result[key] = values[0];
|
|
8001
|
+
} else {
|
|
8002
|
+
result[key] = values.length > 1 ? values : values[0];
|
|
8003
|
+
}
|
|
8004
|
+
return result;
|
|
8005
|
+
}, {});
|
|
8006
|
+
}
|
|
8007
|
+
};
|
|
8008
|
+
Object.defineProperties(
|
|
8009
|
+
Headers2.prototype,
|
|
8010
|
+
["get", "entries", "forEach", "values"].reduce((result, property) => {
|
|
8011
|
+
result[property] = { enumerable: true };
|
|
8012
|
+
return result;
|
|
8013
|
+
}, {})
|
|
8014
|
+
);
|
|
8015
|
+
}
|
|
8016
|
+
});
|
|
8017
|
+
|
|
8018
|
+
// ../../node_modules/node-fetch/src/utils/is-redirect.js
|
|
8019
|
+
var redirectStatus, isRedirect;
|
|
8020
|
+
var init_is_redirect = __esm({
|
|
8021
|
+
"../../node_modules/node-fetch/src/utils/is-redirect.js"() {
|
|
8022
|
+
redirectStatus = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
8023
|
+
isRedirect = (code) => {
|
|
8024
|
+
return redirectStatus.has(code);
|
|
8025
|
+
};
|
|
8026
|
+
}
|
|
8027
|
+
});
|
|
8028
|
+
|
|
8029
|
+
// ../../node_modules/node-fetch/src/response.js
|
|
8030
|
+
var INTERNALS2, Response2;
|
|
8031
|
+
var init_response = __esm({
|
|
8032
|
+
"../../node_modules/node-fetch/src/response.js"() {
|
|
8033
|
+
init_headers();
|
|
8034
|
+
init_body();
|
|
8035
|
+
init_is_redirect();
|
|
8036
|
+
INTERNALS2 = /* @__PURE__ */ Symbol("Response internals");
|
|
8037
|
+
Response2 = class _Response extends Body {
|
|
8038
|
+
constructor(body = null, options = {}) {
|
|
8039
|
+
super(body, options);
|
|
8040
|
+
const status = options.status != null ? options.status : 200;
|
|
8041
|
+
const headers = new Headers2(options.headers);
|
|
8042
|
+
if (body !== null && !headers.has("Content-Type")) {
|
|
8043
|
+
const contentType = extractContentType(body, this);
|
|
8044
|
+
if (contentType) {
|
|
8045
|
+
headers.append("Content-Type", contentType);
|
|
8046
|
+
}
|
|
8047
|
+
}
|
|
8048
|
+
this[INTERNALS2] = {
|
|
8049
|
+
type: "default",
|
|
8050
|
+
url: options.url,
|
|
8051
|
+
status,
|
|
8052
|
+
statusText: options.statusText || "",
|
|
8053
|
+
headers,
|
|
8054
|
+
counter: options.counter,
|
|
8055
|
+
highWaterMark: options.highWaterMark
|
|
8056
|
+
};
|
|
8057
|
+
}
|
|
8058
|
+
get type() {
|
|
8059
|
+
return this[INTERNALS2].type;
|
|
8060
|
+
}
|
|
8061
|
+
get url() {
|
|
8062
|
+
return this[INTERNALS2].url || "";
|
|
8063
|
+
}
|
|
8064
|
+
get status() {
|
|
8065
|
+
return this[INTERNALS2].status;
|
|
8066
|
+
}
|
|
8067
|
+
/**
|
|
8068
|
+
* Convenience property representing if the request ended normally
|
|
8069
|
+
*/
|
|
8070
|
+
get ok() {
|
|
8071
|
+
return this[INTERNALS2].status >= 200 && this[INTERNALS2].status < 300;
|
|
8072
|
+
}
|
|
8073
|
+
get redirected() {
|
|
8074
|
+
return this[INTERNALS2].counter > 0;
|
|
8075
|
+
}
|
|
8076
|
+
get statusText() {
|
|
8077
|
+
return this[INTERNALS2].statusText;
|
|
8078
|
+
}
|
|
8079
|
+
get headers() {
|
|
8080
|
+
return this[INTERNALS2].headers;
|
|
8081
|
+
}
|
|
8082
|
+
get highWaterMark() {
|
|
8083
|
+
return this[INTERNALS2].highWaterMark;
|
|
8084
|
+
}
|
|
8085
|
+
/**
|
|
8086
|
+
* Clone this response
|
|
8087
|
+
*
|
|
8088
|
+
* @return Response
|
|
8089
|
+
*/
|
|
8090
|
+
clone() {
|
|
8091
|
+
return new _Response(clone(this, this.highWaterMark), {
|
|
8092
|
+
type: this.type,
|
|
8093
|
+
url: this.url,
|
|
8094
|
+
status: this.status,
|
|
8095
|
+
statusText: this.statusText,
|
|
8096
|
+
headers: this.headers,
|
|
8097
|
+
ok: this.ok,
|
|
8098
|
+
redirected: this.redirected,
|
|
8099
|
+
size: this.size,
|
|
8100
|
+
highWaterMark: this.highWaterMark
|
|
8101
|
+
});
|
|
8102
|
+
}
|
|
8103
|
+
/**
|
|
8104
|
+
* @param {string} url The URL that the new response is to originate from.
|
|
8105
|
+
* @param {number} status An optional status code for the response (e.g., 302.)
|
|
8106
|
+
* @returns {Response} A Response object.
|
|
8107
|
+
*/
|
|
8108
|
+
static redirect(url2, status = 302) {
|
|
8109
|
+
if (!isRedirect(status)) {
|
|
8110
|
+
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
|
8111
|
+
}
|
|
8112
|
+
return new _Response(null, {
|
|
8113
|
+
headers: {
|
|
8114
|
+
location: new URL(url2).toString()
|
|
8115
|
+
},
|
|
8116
|
+
status
|
|
8117
|
+
});
|
|
8118
|
+
}
|
|
8119
|
+
static error() {
|
|
8120
|
+
const response = new _Response(null, { status: 0, statusText: "" });
|
|
8121
|
+
response[INTERNALS2].type = "error";
|
|
8122
|
+
return response;
|
|
8123
|
+
}
|
|
8124
|
+
static json(data = void 0, init = {}) {
|
|
8125
|
+
const body = JSON.stringify(data);
|
|
8126
|
+
if (body === void 0) {
|
|
8127
|
+
throw new TypeError("data is not JSON serializable");
|
|
8128
|
+
}
|
|
8129
|
+
const headers = new Headers2(init && init.headers);
|
|
8130
|
+
if (!headers.has("content-type")) {
|
|
8131
|
+
headers.set("content-type", "application/json");
|
|
8132
|
+
}
|
|
8133
|
+
return new _Response(body, {
|
|
8134
|
+
...init,
|
|
8135
|
+
headers
|
|
8136
|
+
});
|
|
8137
|
+
}
|
|
8138
|
+
get [Symbol.toStringTag]() {
|
|
8139
|
+
return "Response";
|
|
8140
|
+
}
|
|
8141
|
+
};
|
|
8142
|
+
Object.defineProperties(Response2.prototype, {
|
|
8143
|
+
type: { enumerable: true },
|
|
8144
|
+
url: { enumerable: true },
|
|
8145
|
+
status: { enumerable: true },
|
|
8146
|
+
ok: { enumerable: true },
|
|
8147
|
+
redirected: { enumerable: true },
|
|
8148
|
+
statusText: { enumerable: true },
|
|
8149
|
+
headers: { enumerable: true },
|
|
8150
|
+
clone: { enumerable: true }
|
|
8151
|
+
});
|
|
8152
|
+
}
|
|
8153
|
+
});
|
|
8154
|
+
|
|
8155
|
+
// ../../node_modules/node-fetch/src/utils/get-search.js
|
|
8156
|
+
var getSearch;
|
|
8157
|
+
var init_get_search = __esm({
|
|
8158
|
+
"../../node_modules/node-fetch/src/utils/get-search.js"() {
|
|
8159
|
+
getSearch = (parsedURL) => {
|
|
8160
|
+
if (parsedURL.search) {
|
|
8161
|
+
return parsedURL.search;
|
|
8162
|
+
}
|
|
8163
|
+
const lastOffset = parsedURL.href.length - 1;
|
|
8164
|
+
const hash2 = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
|
|
8165
|
+
return parsedURL.href[lastOffset - hash2.length] === "?" ? "?" : "";
|
|
8166
|
+
};
|
|
8167
|
+
}
|
|
8168
|
+
});
|
|
8169
|
+
|
|
8170
|
+
// ../../node_modules/node-fetch/src/utils/referrer.js
|
|
8171
|
+
function stripURLForUseAsAReferrer(url2, originOnly = false) {
|
|
8172
|
+
if (url2 == null) {
|
|
8173
|
+
return "no-referrer";
|
|
8174
|
+
}
|
|
8175
|
+
url2 = new URL(url2);
|
|
8176
|
+
if (/^(about|blob|data):$/.test(url2.protocol)) {
|
|
8177
|
+
return "no-referrer";
|
|
8178
|
+
}
|
|
8179
|
+
url2.username = "";
|
|
8180
|
+
url2.password = "";
|
|
8181
|
+
url2.hash = "";
|
|
8182
|
+
if (originOnly) {
|
|
8183
|
+
url2.pathname = "";
|
|
8184
|
+
url2.search = "";
|
|
8185
|
+
}
|
|
8186
|
+
return url2;
|
|
8187
|
+
}
|
|
8188
|
+
function validateReferrerPolicy(referrerPolicy) {
|
|
8189
|
+
if (!ReferrerPolicy.has(referrerPolicy)) {
|
|
8190
|
+
throw new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);
|
|
8191
|
+
}
|
|
8192
|
+
return referrerPolicy;
|
|
8193
|
+
}
|
|
8194
|
+
function isOriginPotentiallyTrustworthy(url2) {
|
|
8195
|
+
if (/^(http|ws)s:$/.test(url2.protocol)) {
|
|
8196
|
+
return true;
|
|
8197
|
+
}
|
|
8198
|
+
const hostIp = url2.host.replace(/(^\[)|(]$)/g, "");
|
|
8199
|
+
const hostIPVersion = (0, import_node_net.isIP)(hostIp);
|
|
8200
|
+
if (hostIPVersion === 4 && /^127\./.test(hostIp)) {
|
|
8201
|
+
return true;
|
|
8202
|
+
}
|
|
8203
|
+
if (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {
|
|
8204
|
+
return true;
|
|
8205
|
+
}
|
|
8206
|
+
if (url2.host === "localhost" || url2.host.endsWith(".localhost")) {
|
|
8207
|
+
return false;
|
|
8208
|
+
}
|
|
8209
|
+
if (url2.protocol === "file:") {
|
|
8210
|
+
return true;
|
|
8211
|
+
}
|
|
8212
|
+
return false;
|
|
8213
|
+
}
|
|
8214
|
+
function isUrlPotentiallyTrustworthy(url2) {
|
|
8215
|
+
if (/^about:(blank|srcdoc)$/.test(url2)) {
|
|
8216
|
+
return true;
|
|
8217
|
+
}
|
|
8218
|
+
if (url2.protocol === "data:") {
|
|
8219
|
+
return true;
|
|
8220
|
+
}
|
|
8221
|
+
if (/^(blob|filesystem):$/.test(url2.protocol)) {
|
|
8222
|
+
return true;
|
|
8223
|
+
}
|
|
8224
|
+
return isOriginPotentiallyTrustworthy(url2);
|
|
8225
|
+
}
|
|
8226
|
+
function determineRequestsReferrer(request, { referrerURLCallback, referrerOriginCallback } = {}) {
|
|
8227
|
+
if (request.referrer === "no-referrer" || request.referrerPolicy === "") {
|
|
8228
|
+
return null;
|
|
8229
|
+
}
|
|
8230
|
+
const policy = request.referrerPolicy;
|
|
8231
|
+
if (request.referrer === "about:client") {
|
|
8232
|
+
return "no-referrer";
|
|
8233
|
+
}
|
|
8234
|
+
const referrerSource = request.referrer;
|
|
8235
|
+
let referrerURL = stripURLForUseAsAReferrer(referrerSource);
|
|
8236
|
+
let referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);
|
|
8237
|
+
if (referrerURL.toString().length > 4096) {
|
|
8238
|
+
referrerURL = referrerOrigin;
|
|
8239
|
+
}
|
|
8240
|
+
if (referrerURLCallback) {
|
|
8241
|
+
referrerURL = referrerURLCallback(referrerURL);
|
|
8242
|
+
}
|
|
8243
|
+
if (referrerOriginCallback) {
|
|
8244
|
+
referrerOrigin = referrerOriginCallback(referrerOrigin);
|
|
8245
|
+
}
|
|
8246
|
+
const currentURL = new URL(request.url);
|
|
8247
|
+
switch (policy) {
|
|
8248
|
+
case "no-referrer":
|
|
8249
|
+
return "no-referrer";
|
|
8250
|
+
case "origin":
|
|
8251
|
+
return referrerOrigin;
|
|
8252
|
+
case "unsafe-url":
|
|
8253
|
+
return referrerURL;
|
|
8254
|
+
case "strict-origin":
|
|
8255
|
+
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
|
|
8256
|
+
return "no-referrer";
|
|
8257
|
+
}
|
|
8258
|
+
return referrerOrigin.toString();
|
|
8259
|
+
case "strict-origin-when-cross-origin":
|
|
8260
|
+
if (referrerURL.origin === currentURL.origin) {
|
|
8261
|
+
return referrerURL;
|
|
8262
|
+
}
|
|
8263
|
+
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
|
|
8264
|
+
return "no-referrer";
|
|
8265
|
+
}
|
|
8266
|
+
return referrerOrigin;
|
|
8267
|
+
case "same-origin":
|
|
8268
|
+
if (referrerURL.origin === currentURL.origin) {
|
|
8269
|
+
return referrerURL;
|
|
8270
|
+
}
|
|
8271
|
+
return "no-referrer";
|
|
8272
|
+
case "origin-when-cross-origin":
|
|
8273
|
+
if (referrerURL.origin === currentURL.origin) {
|
|
8274
|
+
return referrerURL;
|
|
8275
|
+
}
|
|
8276
|
+
return referrerOrigin;
|
|
8277
|
+
case "no-referrer-when-downgrade":
|
|
8278
|
+
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
|
|
8279
|
+
return "no-referrer";
|
|
8280
|
+
}
|
|
8281
|
+
return referrerURL;
|
|
8282
|
+
default:
|
|
8283
|
+
throw new TypeError(`Invalid referrerPolicy: ${policy}`);
|
|
8284
|
+
}
|
|
8285
|
+
}
|
|
8286
|
+
function parseReferrerPolicyFromHeader(headers) {
|
|
8287
|
+
const policyTokens = (headers.get("referrer-policy") || "").split(/[,\s]+/);
|
|
8288
|
+
let policy = "";
|
|
8289
|
+
for (const token of policyTokens) {
|
|
8290
|
+
if (token && ReferrerPolicy.has(token)) {
|
|
8291
|
+
policy = token;
|
|
8292
|
+
}
|
|
8293
|
+
}
|
|
8294
|
+
return policy;
|
|
8295
|
+
}
|
|
8296
|
+
var import_node_net, ReferrerPolicy, DEFAULT_REFERRER_POLICY;
|
|
8297
|
+
var init_referrer = __esm({
|
|
8298
|
+
"../../node_modules/node-fetch/src/utils/referrer.js"() {
|
|
8299
|
+
import_node_net = require("node:net");
|
|
8300
|
+
ReferrerPolicy = /* @__PURE__ */ new Set([
|
|
8301
|
+
"",
|
|
8302
|
+
"no-referrer",
|
|
8303
|
+
"no-referrer-when-downgrade",
|
|
8304
|
+
"same-origin",
|
|
8305
|
+
"origin",
|
|
8306
|
+
"strict-origin",
|
|
8307
|
+
"origin-when-cross-origin",
|
|
8308
|
+
"strict-origin-when-cross-origin",
|
|
8309
|
+
"unsafe-url"
|
|
8310
|
+
]);
|
|
8311
|
+
DEFAULT_REFERRER_POLICY = "strict-origin-when-cross-origin";
|
|
8312
|
+
}
|
|
8313
|
+
});
|
|
8314
|
+
|
|
8315
|
+
// ../../node_modules/node-fetch/src/request.js
|
|
8316
|
+
var import_node_url, import_node_util3, INTERNALS3, isRequest, doBadDataWarn, Request2, getNodeRequestOptions;
|
|
8317
|
+
var init_request = __esm({
|
|
8318
|
+
"../../node_modules/node-fetch/src/request.js"() {
|
|
8319
|
+
import_node_url = require("node:url");
|
|
8320
|
+
import_node_util3 = require("node:util");
|
|
8321
|
+
init_headers();
|
|
8322
|
+
init_body();
|
|
8323
|
+
init_is();
|
|
8324
|
+
init_get_search();
|
|
8325
|
+
init_referrer();
|
|
8326
|
+
INTERNALS3 = /* @__PURE__ */ Symbol("Request internals");
|
|
8327
|
+
isRequest = (object3) => {
|
|
8328
|
+
return typeof object3 === "object" && typeof object3[INTERNALS3] === "object";
|
|
8329
|
+
};
|
|
8330
|
+
doBadDataWarn = (0, import_node_util3.deprecate)(
|
|
8331
|
+
() => {
|
|
8332
|
+
},
|
|
8333
|
+
".data is not a valid RequestInit property, use .body instead",
|
|
8334
|
+
"https://github.com/node-fetch/node-fetch/issues/1000 (request)"
|
|
8335
|
+
);
|
|
8336
|
+
Request2 = class _Request extends Body {
|
|
8337
|
+
constructor(input, init = {}) {
|
|
8338
|
+
let parsedURL;
|
|
8339
|
+
if (isRequest(input)) {
|
|
8340
|
+
parsedURL = new URL(input.url);
|
|
8341
|
+
} else {
|
|
8342
|
+
parsedURL = new URL(input);
|
|
8343
|
+
input = {};
|
|
8344
|
+
}
|
|
8345
|
+
if (parsedURL.username !== "" || parsedURL.password !== "") {
|
|
8346
|
+
throw new TypeError(`${parsedURL} is an url with embedded credentials.`);
|
|
8347
|
+
}
|
|
8348
|
+
let method = init.method || input.method || "GET";
|
|
8349
|
+
if (/^(delete|get|head|options|post|put)$/i.test(method)) {
|
|
8350
|
+
method = method.toUpperCase();
|
|
8351
|
+
}
|
|
8352
|
+
if (!isRequest(init) && "data" in init) {
|
|
8353
|
+
doBadDataWarn();
|
|
8354
|
+
}
|
|
8355
|
+
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
|
8356
|
+
throw new TypeError("Request with GET/HEAD method cannot have body");
|
|
8357
|
+
}
|
|
8358
|
+
const inputBody = init.body ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
|
|
8359
|
+
super(inputBody, {
|
|
8360
|
+
size: init.size || input.size || 0
|
|
8361
|
+
});
|
|
8362
|
+
const headers = new Headers2(init.headers || input.headers || {});
|
|
8363
|
+
if (inputBody !== null && !headers.has("Content-Type")) {
|
|
8364
|
+
const contentType = extractContentType(inputBody, this);
|
|
8365
|
+
if (contentType) {
|
|
8366
|
+
headers.set("Content-Type", contentType);
|
|
8367
|
+
}
|
|
8368
|
+
}
|
|
8369
|
+
let signal = isRequest(input) ? input.signal : null;
|
|
8370
|
+
if ("signal" in init) {
|
|
8371
|
+
signal = init.signal;
|
|
8372
|
+
}
|
|
8373
|
+
if (signal != null && !isAbortSignal(signal)) {
|
|
8374
|
+
throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
|
|
8375
|
+
}
|
|
8376
|
+
let referrer = init.referrer == null ? input.referrer : init.referrer;
|
|
8377
|
+
if (referrer === "") {
|
|
8378
|
+
referrer = "no-referrer";
|
|
8379
|
+
} else if (referrer) {
|
|
8380
|
+
const parsedReferrer = new URL(referrer);
|
|
8381
|
+
referrer = /^about:(\/\/)?client$/.test(parsedReferrer) ? "client" : parsedReferrer;
|
|
8382
|
+
} else {
|
|
8383
|
+
referrer = void 0;
|
|
8384
|
+
}
|
|
8385
|
+
this[INTERNALS3] = {
|
|
8386
|
+
method,
|
|
8387
|
+
redirect: init.redirect || input.redirect || "follow",
|
|
8388
|
+
headers,
|
|
8389
|
+
parsedURL,
|
|
8390
|
+
signal,
|
|
8391
|
+
referrer
|
|
8392
|
+
};
|
|
8393
|
+
this.follow = init.follow === void 0 ? input.follow === void 0 ? 20 : input.follow : init.follow;
|
|
8394
|
+
this.compress = init.compress === void 0 ? input.compress === void 0 ? true : input.compress : init.compress;
|
|
8395
|
+
this.counter = init.counter || input.counter || 0;
|
|
8396
|
+
this.agent = init.agent || input.agent;
|
|
8397
|
+
this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
|
|
8398
|
+
this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
|
|
8399
|
+
this.referrerPolicy = init.referrerPolicy || input.referrerPolicy || "";
|
|
8400
|
+
}
|
|
8401
|
+
/** @returns {string} */
|
|
8402
|
+
get method() {
|
|
8403
|
+
return this[INTERNALS3].method;
|
|
8404
|
+
}
|
|
8405
|
+
/** @returns {string} */
|
|
8406
|
+
get url() {
|
|
8407
|
+
return (0, import_node_url.format)(this[INTERNALS3].parsedURL);
|
|
8408
|
+
}
|
|
8409
|
+
/** @returns {Headers} */
|
|
8410
|
+
get headers() {
|
|
8411
|
+
return this[INTERNALS3].headers;
|
|
8412
|
+
}
|
|
8413
|
+
get redirect() {
|
|
8414
|
+
return this[INTERNALS3].redirect;
|
|
8415
|
+
}
|
|
8416
|
+
/** @returns {AbortSignal} */
|
|
8417
|
+
get signal() {
|
|
8418
|
+
return this[INTERNALS3].signal;
|
|
8419
|
+
}
|
|
8420
|
+
// https://fetch.spec.whatwg.org/#dom-request-referrer
|
|
8421
|
+
get referrer() {
|
|
8422
|
+
if (this[INTERNALS3].referrer === "no-referrer") {
|
|
8423
|
+
return "";
|
|
8424
|
+
}
|
|
8425
|
+
if (this[INTERNALS3].referrer === "client") {
|
|
8426
|
+
return "about:client";
|
|
8427
|
+
}
|
|
8428
|
+
if (this[INTERNALS3].referrer) {
|
|
8429
|
+
return this[INTERNALS3].referrer.toString();
|
|
8430
|
+
}
|
|
8431
|
+
return void 0;
|
|
8432
|
+
}
|
|
8433
|
+
get referrerPolicy() {
|
|
8434
|
+
return this[INTERNALS3].referrerPolicy;
|
|
8435
|
+
}
|
|
8436
|
+
set referrerPolicy(referrerPolicy) {
|
|
8437
|
+
this[INTERNALS3].referrerPolicy = validateReferrerPolicy(referrerPolicy);
|
|
8438
|
+
}
|
|
8439
|
+
/**
|
|
8440
|
+
* Clone this request
|
|
8441
|
+
*
|
|
8442
|
+
* @return Request
|
|
8443
|
+
*/
|
|
8444
|
+
clone() {
|
|
8445
|
+
return new _Request(this);
|
|
8446
|
+
}
|
|
8447
|
+
get [Symbol.toStringTag]() {
|
|
8448
|
+
return "Request";
|
|
8449
|
+
}
|
|
8450
|
+
};
|
|
8451
|
+
Object.defineProperties(Request2.prototype, {
|
|
8452
|
+
method: { enumerable: true },
|
|
8453
|
+
url: { enumerable: true },
|
|
8454
|
+
headers: { enumerable: true },
|
|
8455
|
+
redirect: { enumerable: true },
|
|
8456
|
+
clone: { enumerable: true },
|
|
8457
|
+
signal: { enumerable: true },
|
|
8458
|
+
referrer: { enumerable: true },
|
|
8459
|
+
referrerPolicy: { enumerable: true }
|
|
8460
|
+
});
|
|
8461
|
+
getNodeRequestOptions = (request) => {
|
|
8462
|
+
const { parsedURL } = request[INTERNALS3];
|
|
8463
|
+
const headers = new Headers2(request[INTERNALS3].headers);
|
|
8464
|
+
if (!headers.has("Accept")) {
|
|
8465
|
+
headers.set("Accept", "*/*");
|
|
8466
|
+
}
|
|
8467
|
+
let contentLengthValue = null;
|
|
8468
|
+
if (request.body === null && /^(post|put)$/i.test(request.method)) {
|
|
8469
|
+
contentLengthValue = "0";
|
|
8470
|
+
}
|
|
8471
|
+
if (request.body !== null) {
|
|
8472
|
+
const totalBytes = getTotalBytes(request);
|
|
8473
|
+
if (typeof totalBytes === "number" && !Number.isNaN(totalBytes)) {
|
|
8474
|
+
contentLengthValue = String(totalBytes);
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
if (contentLengthValue) {
|
|
8478
|
+
headers.set("Content-Length", contentLengthValue);
|
|
8479
|
+
}
|
|
8480
|
+
if (request.referrerPolicy === "") {
|
|
8481
|
+
request.referrerPolicy = DEFAULT_REFERRER_POLICY;
|
|
8482
|
+
}
|
|
8483
|
+
if (request.referrer && request.referrer !== "no-referrer") {
|
|
8484
|
+
request[INTERNALS3].referrer = determineRequestsReferrer(request);
|
|
8485
|
+
} else {
|
|
8486
|
+
request[INTERNALS3].referrer = "no-referrer";
|
|
8487
|
+
}
|
|
8488
|
+
if (request[INTERNALS3].referrer instanceof URL) {
|
|
8489
|
+
headers.set("Referer", request.referrer);
|
|
8490
|
+
}
|
|
8491
|
+
if (!headers.has("User-Agent")) {
|
|
8492
|
+
headers.set("User-Agent", "node-fetch");
|
|
8493
|
+
}
|
|
8494
|
+
if (request.compress && !headers.has("Accept-Encoding")) {
|
|
8495
|
+
headers.set("Accept-Encoding", "gzip, deflate, br");
|
|
8496
|
+
}
|
|
8497
|
+
let { agent } = request;
|
|
8498
|
+
if (typeof agent === "function") {
|
|
8499
|
+
agent = agent(parsedURL);
|
|
8500
|
+
}
|
|
8501
|
+
const search = getSearch(parsedURL);
|
|
8502
|
+
const options = {
|
|
8503
|
+
// Overwrite search to retain trailing ? (issue #776)
|
|
8504
|
+
path: parsedURL.pathname + search,
|
|
8505
|
+
// The following options are not expressed in the URL
|
|
8506
|
+
method: request.method,
|
|
8507
|
+
headers: headers[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](),
|
|
8508
|
+
insecureHTTPParser: request.insecureHTTPParser,
|
|
8509
|
+
agent
|
|
8510
|
+
};
|
|
8511
|
+
return {
|
|
8512
|
+
/** @type {URL} */
|
|
8513
|
+
parsedURL,
|
|
8514
|
+
options
|
|
8515
|
+
};
|
|
8516
|
+
};
|
|
8517
|
+
}
|
|
8518
|
+
});
|
|
8519
|
+
|
|
8520
|
+
// ../../node_modules/node-fetch/src/errors/abort-error.js
|
|
8521
|
+
var AbortError;
|
|
8522
|
+
var init_abort_error = __esm({
|
|
8523
|
+
"../../node_modules/node-fetch/src/errors/abort-error.js"() {
|
|
8524
|
+
init_base();
|
|
8525
|
+
AbortError = class extends FetchBaseError {
|
|
8526
|
+
constructor(message, type2 = "aborted") {
|
|
8527
|
+
super(message, type2);
|
|
8528
|
+
}
|
|
8529
|
+
};
|
|
8530
|
+
}
|
|
8531
|
+
});
|
|
8532
|
+
|
|
8533
|
+
// ../../node_modules/node-fetch/src/index.js
|
|
8534
|
+
async function fetch2(url2, options_) {
|
|
8535
|
+
return new Promise((resolve, reject) => {
|
|
8536
|
+
const request = new Request2(url2, options_);
|
|
8537
|
+
const { parsedURL, options } = getNodeRequestOptions(request);
|
|
8538
|
+
if (!supportedSchemas.has(parsedURL.protocol)) {
|
|
8539
|
+
throw new TypeError(`node-fetch cannot load ${url2}. URL scheme "${parsedURL.protocol.replace(/:$/, "")}" is not supported.`);
|
|
8540
|
+
}
|
|
8541
|
+
if (parsedURL.protocol === "data:") {
|
|
8542
|
+
const data = dist_default(request.url);
|
|
8543
|
+
const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
|
|
8544
|
+
resolve(response2);
|
|
8545
|
+
return;
|
|
8546
|
+
}
|
|
8547
|
+
const send = (parsedURL.protocol === "https:" ? import_node_https.default : import_node_http2.default).request;
|
|
8548
|
+
const { signal } = request;
|
|
8549
|
+
let response = null;
|
|
8550
|
+
const abort = () => {
|
|
8551
|
+
const error48 = new AbortError("The operation was aborted.");
|
|
8552
|
+
reject(error48);
|
|
8553
|
+
if (request.body && request.body instanceof import_node_stream2.default.Readable) {
|
|
8554
|
+
request.body.destroy(error48);
|
|
8555
|
+
}
|
|
8556
|
+
if (!response || !response.body) {
|
|
8557
|
+
return;
|
|
8558
|
+
}
|
|
8559
|
+
response.body.emit("error", error48);
|
|
8560
|
+
};
|
|
8561
|
+
if (signal && signal.aborted) {
|
|
8562
|
+
abort();
|
|
8563
|
+
return;
|
|
8564
|
+
}
|
|
8565
|
+
const abortAndFinalize = () => {
|
|
8566
|
+
abort();
|
|
8567
|
+
finalize2();
|
|
8568
|
+
};
|
|
8569
|
+
const request_ = send(parsedURL.toString(), options);
|
|
8570
|
+
if (signal) {
|
|
8571
|
+
signal.addEventListener("abort", abortAndFinalize);
|
|
8572
|
+
}
|
|
8573
|
+
const finalize2 = () => {
|
|
8574
|
+
request_.abort();
|
|
8575
|
+
if (signal) {
|
|
8576
|
+
signal.removeEventListener("abort", abortAndFinalize);
|
|
8577
|
+
}
|
|
8578
|
+
};
|
|
8579
|
+
request_.on("error", (error48) => {
|
|
8580
|
+
reject(new FetchError(`request to ${request.url} failed, reason: ${error48.message}`, "system", error48));
|
|
8581
|
+
finalize2();
|
|
8582
|
+
});
|
|
8583
|
+
fixResponseChunkedTransferBadEnding(request_, (error48) => {
|
|
8584
|
+
if (response && response.body) {
|
|
8585
|
+
response.body.destroy(error48);
|
|
8586
|
+
}
|
|
8587
|
+
});
|
|
8588
|
+
if (process.version < "v14") {
|
|
8589
|
+
request_.on("socket", (s2) => {
|
|
8590
|
+
let endedWithEventsCount;
|
|
8591
|
+
s2.prependListener("end", () => {
|
|
8592
|
+
endedWithEventsCount = s2._eventsCount;
|
|
8593
|
+
});
|
|
8594
|
+
s2.prependListener("close", (hadError) => {
|
|
8595
|
+
if (response && endedWithEventsCount < s2._eventsCount && !hadError) {
|
|
8596
|
+
const error48 = new Error("Premature close");
|
|
8597
|
+
error48.code = "ERR_STREAM_PREMATURE_CLOSE";
|
|
8598
|
+
response.body.emit("error", error48);
|
|
8599
|
+
}
|
|
8600
|
+
});
|
|
8601
|
+
});
|
|
8602
|
+
}
|
|
8603
|
+
request_.on("response", (response_) => {
|
|
8604
|
+
request_.setTimeout(0);
|
|
8605
|
+
const headers = fromRawHeaders(response_.rawHeaders);
|
|
8606
|
+
if (isRedirect(response_.statusCode)) {
|
|
8607
|
+
const location = headers.get("Location");
|
|
8608
|
+
let locationURL = null;
|
|
8609
|
+
try {
|
|
8610
|
+
locationURL = location === null ? null : new URL(location, request.url);
|
|
8611
|
+
} catch {
|
|
8612
|
+
if (request.redirect !== "manual") {
|
|
8613
|
+
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
|
|
8614
|
+
finalize2();
|
|
8615
|
+
return;
|
|
8616
|
+
}
|
|
8617
|
+
}
|
|
8618
|
+
switch (request.redirect) {
|
|
8619
|
+
case "error":
|
|
8620
|
+
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
|
|
8621
|
+
finalize2();
|
|
8622
|
+
return;
|
|
8623
|
+
case "manual":
|
|
8624
|
+
break;
|
|
8625
|
+
case "follow": {
|
|
8626
|
+
if (locationURL === null) {
|
|
8627
|
+
break;
|
|
8628
|
+
}
|
|
8629
|
+
if (request.counter >= request.follow) {
|
|
8630
|
+
reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
|
|
8631
|
+
finalize2();
|
|
8632
|
+
return;
|
|
8633
|
+
}
|
|
8634
|
+
const requestOptions = {
|
|
8635
|
+
headers: new Headers2(request.headers),
|
|
8636
|
+
follow: request.follow,
|
|
8637
|
+
counter: request.counter + 1,
|
|
8638
|
+
agent: request.agent,
|
|
8639
|
+
compress: request.compress,
|
|
8640
|
+
method: request.method,
|
|
8641
|
+
body: clone(request),
|
|
8642
|
+
signal: request.signal,
|
|
8643
|
+
size: request.size,
|
|
8644
|
+
referrer: request.referrer,
|
|
8645
|
+
referrerPolicy: request.referrerPolicy
|
|
8646
|
+
};
|
|
8647
|
+
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
|
8648
|
+
for (const name2 of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
|
|
8649
|
+
requestOptions.headers.delete(name2);
|
|
8650
|
+
}
|
|
8651
|
+
}
|
|
8652
|
+
if (response_.statusCode !== 303 && request.body && options_.body instanceof import_node_stream2.default.Readable) {
|
|
8653
|
+
reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
|
|
8654
|
+
finalize2();
|
|
8655
|
+
return;
|
|
8656
|
+
}
|
|
8657
|
+
if (response_.statusCode === 303 || (response_.statusCode === 301 || response_.statusCode === 302) && request.method === "POST") {
|
|
8658
|
+
requestOptions.method = "GET";
|
|
8659
|
+
requestOptions.body = void 0;
|
|
8660
|
+
requestOptions.headers.delete("content-length");
|
|
8661
|
+
}
|
|
8662
|
+
const responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);
|
|
8663
|
+
if (responseReferrerPolicy) {
|
|
8664
|
+
requestOptions.referrerPolicy = responseReferrerPolicy;
|
|
8665
|
+
}
|
|
8666
|
+
resolve(fetch2(new Request2(locationURL, requestOptions)));
|
|
8667
|
+
finalize2();
|
|
8668
|
+
return;
|
|
8669
|
+
}
|
|
8670
|
+
default:
|
|
8671
|
+
return reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
|
|
8672
|
+
}
|
|
8673
|
+
}
|
|
8674
|
+
if (signal) {
|
|
8675
|
+
response_.once("end", () => {
|
|
8676
|
+
signal.removeEventListener("abort", abortAndFinalize);
|
|
8677
|
+
});
|
|
8678
|
+
}
|
|
8679
|
+
let body = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error48) => {
|
|
8680
|
+
if (error48) {
|
|
8681
|
+
reject(error48);
|
|
8682
|
+
}
|
|
8683
|
+
});
|
|
8684
|
+
if (process.version < "v12.10") {
|
|
8685
|
+
response_.on("aborted", abortAndFinalize);
|
|
8686
|
+
}
|
|
8687
|
+
const responseOptions = {
|
|
8688
|
+
url: request.url,
|
|
8689
|
+
status: response_.statusCode,
|
|
8690
|
+
statusText: response_.statusMessage,
|
|
8691
|
+
headers,
|
|
8692
|
+
size: request.size,
|
|
8693
|
+
counter: request.counter,
|
|
8694
|
+
highWaterMark: request.highWaterMark
|
|
8695
|
+
};
|
|
8696
|
+
const codings = headers.get("Content-Encoding");
|
|
8697
|
+
if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
|
|
8698
|
+
response = new Response2(body, responseOptions);
|
|
8699
|
+
resolve(response);
|
|
8700
|
+
return;
|
|
8701
|
+
}
|
|
8702
|
+
const zlibOptions = {
|
|
8703
|
+
flush: import_node_zlib.default.Z_SYNC_FLUSH,
|
|
8704
|
+
finishFlush: import_node_zlib.default.Z_SYNC_FLUSH
|
|
8705
|
+
};
|
|
8706
|
+
if (codings === "gzip" || codings === "x-gzip") {
|
|
8707
|
+
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error48) => {
|
|
8708
|
+
if (error48) {
|
|
8709
|
+
reject(error48);
|
|
8710
|
+
}
|
|
8711
|
+
});
|
|
8712
|
+
response = new Response2(body, responseOptions);
|
|
8713
|
+
resolve(response);
|
|
8714
|
+
return;
|
|
8715
|
+
}
|
|
8716
|
+
if (codings === "deflate" || codings === "x-deflate") {
|
|
8717
|
+
const raw = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error48) => {
|
|
8718
|
+
if (error48) {
|
|
8719
|
+
reject(error48);
|
|
8720
|
+
}
|
|
8721
|
+
});
|
|
8722
|
+
raw.once("data", (chunk) => {
|
|
8723
|
+
if ((chunk[0] & 15) === 8) {
|
|
8724
|
+
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflate(), (error48) => {
|
|
8725
|
+
if (error48) {
|
|
8726
|
+
reject(error48);
|
|
8727
|
+
}
|
|
8728
|
+
});
|
|
8729
|
+
} else {
|
|
8730
|
+
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error48) => {
|
|
8731
|
+
if (error48) {
|
|
8732
|
+
reject(error48);
|
|
8733
|
+
}
|
|
8734
|
+
});
|
|
8735
|
+
}
|
|
8736
|
+
response = new Response2(body, responseOptions);
|
|
8737
|
+
resolve(response);
|
|
8738
|
+
});
|
|
8739
|
+
raw.once("end", () => {
|
|
8740
|
+
if (!response) {
|
|
8741
|
+
response = new Response2(body, responseOptions);
|
|
8742
|
+
resolve(response);
|
|
8743
|
+
}
|
|
8744
|
+
});
|
|
8745
|
+
return;
|
|
8746
|
+
}
|
|
8747
|
+
if (codings === "br") {
|
|
8748
|
+
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error48) => {
|
|
8749
|
+
if (error48) {
|
|
8750
|
+
reject(error48);
|
|
8751
|
+
}
|
|
8752
|
+
});
|
|
8753
|
+
response = new Response2(body, responseOptions);
|
|
8754
|
+
resolve(response);
|
|
8755
|
+
return;
|
|
8756
|
+
}
|
|
8757
|
+
response = new Response2(body, responseOptions);
|
|
8758
|
+
resolve(response);
|
|
8759
|
+
});
|
|
8760
|
+
writeToStream(request_, request).catch(reject);
|
|
8761
|
+
});
|
|
8762
|
+
}
|
|
8763
|
+
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
8764
|
+
const LAST_CHUNK = import_node_buffer2.Buffer.from("0\r\n\r\n");
|
|
8765
|
+
let isChunkedTransfer = false;
|
|
8766
|
+
let properLastChunkReceived = false;
|
|
8767
|
+
let previousChunk;
|
|
8768
|
+
request.on("response", (response) => {
|
|
8769
|
+
const { headers } = response;
|
|
8770
|
+
isChunkedTransfer = headers["transfer-encoding"] === "chunked" && !headers["content-length"];
|
|
8771
|
+
});
|
|
8772
|
+
request.on("socket", (socket) => {
|
|
8773
|
+
const onSocketClose = () => {
|
|
8774
|
+
if (isChunkedTransfer && !properLastChunkReceived) {
|
|
8775
|
+
const error48 = new Error("Premature close");
|
|
8776
|
+
error48.code = "ERR_STREAM_PREMATURE_CLOSE";
|
|
8777
|
+
errorCallback(error48);
|
|
8778
|
+
}
|
|
8779
|
+
};
|
|
8780
|
+
const onData = (buf) => {
|
|
8781
|
+
properLastChunkReceived = import_node_buffer2.Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;
|
|
8782
|
+
if (!properLastChunkReceived && previousChunk) {
|
|
8783
|
+
properLastChunkReceived = import_node_buffer2.Buffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 && import_node_buffer2.Buffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0;
|
|
8784
|
+
}
|
|
8785
|
+
previousChunk = buf;
|
|
8786
|
+
};
|
|
8787
|
+
socket.prependListener("close", onSocketClose);
|
|
8788
|
+
socket.on("data", onData);
|
|
8789
|
+
request.on("close", () => {
|
|
8790
|
+
socket.removeListener("close", onSocketClose);
|
|
8791
|
+
socket.removeListener("data", onData);
|
|
8792
|
+
});
|
|
8793
|
+
});
|
|
8794
|
+
}
|
|
8795
|
+
var import_node_http2, import_node_https, import_node_zlib, import_node_stream2, import_node_buffer2, supportedSchemas;
|
|
8796
|
+
var init_src = __esm({
|
|
8797
|
+
"../../node_modules/node-fetch/src/index.js"() {
|
|
8798
|
+
import_node_http2 = __toESM(require("node:http"), 1);
|
|
8799
|
+
import_node_https = __toESM(require("node:https"), 1);
|
|
8800
|
+
import_node_zlib = __toESM(require("node:zlib"), 1);
|
|
8801
|
+
import_node_stream2 = __toESM(require("node:stream"), 1);
|
|
8802
|
+
import_node_buffer2 = require("node:buffer");
|
|
8803
|
+
init_dist();
|
|
8804
|
+
init_body();
|
|
8805
|
+
init_response();
|
|
8806
|
+
init_headers();
|
|
8807
|
+
init_request();
|
|
8808
|
+
init_fetch_error();
|
|
8809
|
+
init_abort_error();
|
|
8810
|
+
init_is_redirect();
|
|
8811
|
+
init_esm_min();
|
|
8812
|
+
init_is();
|
|
8813
|
+
init_referrer();
|
|
8814
|
+
init_from();
|
|
8815
|
+
supportedSchemas = /* @__PURE__ */ new Set(["data:", "http:", "https:"]);
|
|
8816
|
+
}
|
|
8817
|
+
});
|
|
8818
|
+
|
|
7456
8819
|
// ../../node_modules/rxjs/dist/cjs/internal/util/isFunction.js
|
|
7457
8820
|
var require_isFunction = __commonJS({
|
|
7458
8821
|
"../../node_modules/rxjs/dist/cjs/internal/util/isFunction.js"(exports2) {
|
|
@@ -253983,17 +255346,17 @@ var init_build = __esm({
|
|
|
253983
255346
|
target: args.target ?? config3?.options?.bundler?.target ?? "node24",
|
|
253984
255347
|
outfile: args.outfile ?? config3?.options?.bundler?.outfile ?? "index.js",
|
|
253985
255348
|
external: args.external ?? config3?.options?.bundler?.external ?? []
|
|
253986
|
-
}
|
|
253987
|
-
plugins: [
|
|
253988
|
-
(0, import_esbuild_decorators.esbuildDecorators)({
|
|
253989
|
-
tsconfig: "tsconfig.json",
|
|
253990
|
-
cwd: process.cwd()
|
|
253991
|
-
})
|
|
253992
|
-
]
|
|
255349
|
+
}
|
|
253993
255350
|
})),
|
|
253994
255351
|
(0, import_operators5.switchMap)(
|
|
253995
255352
|
({ esbuild: esbuild2, options }) => esbuild2.build({
|
|
253996
|
-
...options
|
|
255353
|
+
...options,
|
|
255354
|
+
plugins: [
|
|
255355
|
+
(0, import_esbuild_decorators.esbuildDecorators)({
|
|
255356
|
+
tsconfig: "./tsconfig.json",
|
|
255357
|
+
cwd: process.cwd()
|
|
255358
|
+
})
|
|
255359
|
+
]
|
|
253997
255360
|
})
|
|
253998
255361
|
),
|
|
253999
255362
|
(0, import_operators5.tap)((data) => {
|
|
@@ -285513,9 +286876,7 @@ var init_package = __esm({
|
|
|
285513
286876
|
(buffer) => (0, import_rxjs12.from)((0, import_util3.promisify)(import_fs3.mkdir)(".gcache")).pipe(
|
|
285514
286877
|
(0, import_operators11.catchError)(() => (0, import_rxjs12.of)(true)),
|
|
285515
286878
|
(0, import_operators11.switchMap)(
|
|
285516
|
-
() => (0, import_util3.promisify)(import_fs3.writeFile)(`.gcache/${data.name}.zip`, buffer
|
|
285517
|
-
encoding: "utf-8"
|
|
285518
|
-
})
|
|
286879
|
+
() => (0, import_util3.promisify)(import_fs3.writeFile)(`.gcache/${data.name}.zip`, buffer)
|
|
285519
286880
|
)
|
|
285520
286881
|
)
|
|
285521
286882
|
)
|
|
@@ -285544,6 +286905,7 @@ var init_helpers2 = __esm({
|
|
|
285544
286905
|
"src/commands/lambda/helpers/index.ts"() {
|
|
285545
286906
|
import_form_data = __toESM(require_form_data());
|
|
285546
286907
|
import_fs4 = require("fs");
|
|
286908
|
+
init_src();
|
|
285547
286909
|
import_rxjs13 = __toESM(require_cjs());
|
|
285548
286910
|
import_operators12 = __toESM(require_operators());
|
|
285549
286911
|
import_stream_to_buffer = __toESM(require_stream_to_buffer());
|
|
@@ -285578,7 +286940,7 @@ var init_helpers2 = __esm({
|
|
|
285578
286940
|
const config2 = await (0, import_rxjs13.lastValueFrom)(GraphqlClienAPI.getConfig());
|
|
285579
286941
|
return (0, import_rxjs13.lastValueFrom)(
|
|
285580
286942
|
(0, import_rxjs13.from)(
|
|
285581
|
-
|
|
286943
|
+
fetch2(config2.uploadUrl, {
|
|
285582
286944
|
method: "POST",
|
|
285583
286945
|
body,
|
|
285584
286946
|
headers: {
|
|
@@ -296176,7 +297538,7 @@ function is_default() {
|
|
|
296176
297538
|
};
|
|
296177
297539
|
}
|
|
296178
297540
|
var error20;
|
|
296179
|
-
var
|
|
297541
|
+
var init_is2 = __esm({
|
|
296180
297542
|
"../../node_modules/zod/v4/locales/is.js"() {
|
|
296181
297543
|
init_util2();
|
|
296182
297544
|
error20 = () => {
|
|
@@ -299651,7 +301013,7 @@ var init_locales = __esm({
|
|
|
299651
301013
|
init_hu();
|
|
299652
301014
|
init_hy();
|
|
299653
301015
|
init_id();
|
|
299654
|
-
|
|
301016
|
+
init_is2();
|
|
299655
301017
|
init_it();
|
|
299656
301018
|
init_ja();
|
|
299657
301019
|
init_ka();
|
|
@@ -315841,7 +317203,7 @@ function splitLines(chunk) {
|
|
|
315841
317203
|
return [lines, incompleteLine];
|
|
315842
317204
|
}
|
|
315843
317205
|
var ParseError;
|
|
315844
|
-
var
|
|
317206
|
+
var init_dist2 = __esm({
|
|
315845
317207
|
"../../node_modules/eventsource-parser/dist/index.js"() {
|
|
315846
317208
|
ParseError = class extends Error {
|
|
315847
317209
|
constructor(message, options) {
|
|
@@ -315855,7 +317217,7 @@ var init_dist = __esm({
|
|
|
315855
317217
|
var EventSourceParserStream;
|
|
315856
317218
|
var init_stream = __esm({
|
|
315857
317219
|
"../../node_modules/eventsource-parser/dist/stream.js"() {
|
|
315858
|
-
|
|
317220
|
+
init_dist2();
|
|
315859
317221
|
EventSourceParserStream = class extends TransformStream {
|
|
315860
317222
|
constructor({ onError, onRetry, onComment } = {}) {
|
|
315861
317223
|
let parser;
|
|
@@ -317311,1287 +318673,7 @@ var import_node_os = __toESM(require("node:os"));
|
|
|
317311
318673
|
var import_node_path = __toESM(require("node:path"));
|
|
317312
318674
|
var import_node_sea = require("node:sea");
|
|
317313
318675
|
var import_commander = __toESM(require_commander());
|
|
317314
|
-
|
|
317315
|
-
// ../../node_modules/node-fetch/src/index.js
|
|
317316
|
-
var import_node_http2 = __toESM(require("node:http"), 1);
|
|
317317
|
-
var import_node_https = __toESM(require("node:https"), 1);
|
|
317318
|
-
var import_node_zlib = __toESM(require("node:zlib"), 1);
|
|
317319
|
-
var import_node_stream2 = __toESM(require("node:stream"), 1);
|
|
317320
|
-
var import_node_buffer2 = require("node:buffer");
|
|
317321
|
-
|
|
317322
|
-
// ../../node_modules/data-uri-to-buffer/dist/index.js
|
|
317323
|
-
function dataUriToBuffer(uri) {
|
|
317324
|
-
if (!/^data:/i.test(uri)) {
|
|
317325
|
-
throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
|
|
317326
|
-
}
|
|
317327
|
-
uri = uri.replace(/\r?\n/g, "");
|
|
317328
|
-
const firstComma = uri.indexOf(",");
|
|
317329
|
-
if (firstComma === -1 || firstComma <= 4) {
|
|
317330
|
-
throw new TypeError("malformed data: URI");
|
|
317331
|
-
}
|
|
317332
|
-
const meta3 = uri.substring(5, firstComma).split(";");
|
|
317333
|
-
let charset = "";
|
|
317334
|
-
let base643 = false;
|
|
317335
|
-
const type2 = meta3[0] || "text/plain";
|
|
317336
|
-
let typeFull = type2;
|
|
317337
|
-
for (let i2 = 1; i2 < meta3.length; i2++) {
|
|
317338
|
-
if (meta3[i2] === "base64") {
|
|
317339
|
-
base643 = true;
|
|
317340
|
-
} else if (meta3[i2]) {
|
|
317341
|
-
typeFull += `;${meta3[i2]}`;
|
|
317342
|
-
if (meta3[i2].indexOf("charset=") === 0) {
|
|
317343
|
-
charset = meta3[i2].substring(8);
|
|
317344
|
-
}
|
|
317345
|
-
}
|
|
317346
|
-
}
|
|
317347
|
-
if (!meta3[0] && !charset.length) {
|
|
317348
|
-
typeFull += ";charset=US-ASCII";
|
|
317349
|
-
charset = "US-ASCII";
|
|
317350
|
-
}
|
|
317351
|
-
const encoding = base643 ? "base64" : "ascii";
|
|
317352
|
-
const data = unescape(uri.substring(firstComma + 1));
|
|
317353
|
-
const buffer = Buffer.from(data, encoding);
|
|
317354
|
-
buffer.type = type2;
|
|
317355
|
-
buffer.typeFull = typeFull;
|
|
317356
|
-
buffer.charset = charset;
|
|
317357
|
-
return buffer;
|
|
317358
|
-
}
|
|
317359
|
-
var dist_default = dataUriToBuffer;
|
|
317360
|
-
|
|
317361
|
-
// ../../node_modules/node-fetch/src/body.js
|
|
317362
|
-
var import_node_stream = __toESM(require("node:stream"), 1);
|
|
317363
|
-
var import_node_util = require("node:util");
|
|
317364
|
-
var import_node_buffer = require("node:buffer");
|
|
317365
|
-
init_fetch_blob();
|
|
317366
|
-
init_esm_min();
|
|
317367
|
-
|
|
317368
|
-
// ../../node_modules/node-fetch/src/errors/base.js
|
|
317369
|
-
var FetchBaseError = class extends Error {
|
|
317370
|
-
constructor(message, type2) {
|
|
317371
|
-
super(message);
|
|
317372
|
-
Error.captureStackTrace(this, this.constructor);
|
|
317373
|
-
this.type = type2;
|
|
317374
|
-
}
|
|
317375
|
-
get name() {
|
|
317376
|
-
return this.constructor.name;
|
|
317377
|
-
}
|
|
317378
|
-
get [Symbol.toStringTag]() {
|
|
317379
|
-
return this.constructor.name;
|
|
317380
|
-
}
|
|
317381
|
-
};
|
|
317382
|
-
|
|
317383
|
-
// ../../node_modules/node-fetch/src/errors/fetch-error.js
|
|
317384
|
-
var FetchError = class extends FetchBaseError {
|
|
317385
|
-
/**
|
|
317386
|
-
* @param {string} message - Error message for human
|
|
317387
|
-
* @param {string} [type] - Error type for machine
|
|
317388
|
-
* @param {SystemError} [systemError] - For Node.js system error
|
|
317389
|
-
*/
|
|
317390
|
-
constructor(message, type2, systemError) {
|
|
317391
|
-
super(message, type2);
|
|
317392
|
-
if (systemError) {
|
|
317393
|
-
this.code = this.errno = systemError.code;
|
|
317394
|
-
this.erroredSysCall = systemError.syscall;
|
|
317395
|
-
}
|
|
317396
|
-
}
|
|
317397
|
-
};
|
|
317398
|
-
|
|
317399
|
-
// ../../node_modules/node-fetch/src/utils/is.js
|
|
317400
|
-
var NAME = Symbol.toStringTag;
|
|
317401
|
-
var isURLSearchParameters = (object3) => {
|
|
317402
|
-
return typeof object3 === "object" && typeof object3.append === "function" && typeof object3.delete === "function" && typeof object3.get === "function" && typeof object3.getAll === "function" && typeof object3.has === "function" && typeof object3.set === "function" && typeof object3.sort === "function" && object3[NAME] === "URLSearchParams";
|
|
317403
|
-
};
|
|
317404
|
-
var isBlob = (object3) => {
|
|
317405
|
-
return object3 && typeof object3 === "object" && typeof object3.arrayBuffer === "function" && typeof object3.type === "string" && typeof object3.stream === "function" && typeof object3.constructor === "function" && /^(Blob|File)$/.test(object3[NAME]);
|
|
317406
|
-
};
|
|
317407
|
-
var isAbortSignal = (object3) => {
|
|
317408
|
-
return typeof object3 === "object" && (object3[NAME] === "AbortSignal" || object3[NAME] === "EventTarget");
|
|
317409
|
-
};
|
|
317410
|
-
var isDomainOrSubdomain = (destination, original) => {
|
|
317411
|
-
const orig = new URL(original).hostname;
|
|
317412
|
-
const dest = new URL(destination).hostname;
|
|
317413
|
-
return orig === dest || orig.endsWith(`.${dest}`);
|
|
317414
|
-
};
|
|
317415
|
-
var isSameProtocol = (destination, original) => {
|
|
317416
|
-
const orig = new URL(original).protocol;
|
|
317417
|
-
const dest = new URL(destination).protocol;
|
|
317418
|
-
return orig === dest;
|
|
317419
|
-
};
|
|
317420
|
-
|
|
317421
|
-
// ../../node_modules/node-fetch/src/body.js
|
|
317422
|
-
var pipeline = (0, import_node_util.promisify)(import_node_stream.default.pipeline);
|
|
317423
|
-
var INTERNALS = /* @__PURE__ */ Symbol("Body internals");
|
|
317424
|
-
var Body = class {
|
|
317425
|
-
constructor(body, {
|
|
317426
|
-
size = 0
|
|
317427
|
-
} = {}) {
|
|
317428
|
-
let boundary = null;
|
|
317429
|
-
if (body === null) {
|
|
317430
|
-
body = null;
|
|
317431
|
-
} else if (isURLSearchParameters(body)) {
|
|
317432
|
-
body = import_node_buffer.Buffer.from(body.toString());
|
|
317433
|
-
} else if (isBlob(body)) {
|
|
317434
|
-
} else if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
317435
|
-
} else if (import_node_util.types.isAnyArrayBuffer(body)) {
|
|
317436
|
-
body = import_node_buffer.Buffer.from(body);
|
|
317437
|
-
} else if (ArrayBuffer.isView(body)) {
|
|
317438
|
-
body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
|
|
317439
|
-
} else if (body instanceof import_node_stream.default) {
|
|
317440
|
-
} else if (body instanceof FormData) {
|
|
317441
|
-
body = formDataToBlob(body);
|
|
317442
|
-
boundary = body.type.split("=")[1];
|
|
317443
|
-
} else {
|
|
317444
|
-
body = import_node_buffer.Buffer.from(String(body));
|
|
317445
|
-
}
|
|
317446
|
-
let stream = body;
|
|
317447
|
-
if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
317448
|
-
stream = import_node_stream.default.Readable.from(body);
|
|
317449
|
-
} else if (isBlob(body)) {
|
|
317450
|
-
stream = import_node_stream.default.Readable.from(body.stream());
|
|
317451
|
-
}
|
|
317452
|
-
this[INTERNALS] = {
|
|
317453
|
-
body,
|
|
317454
|
-
stream,
|
|
317455
|
-
boundary,
|
|
317456
|
-
disturbed: false,
|
|
317457
|
-
error: null
|
|
317458
|
-
};
|
|
317459
|
-
this.size = size;
|
|
317460
|
-
if (body instanceof import_node_stream.default) {
|
|
317461
|
-
body.on("error", (error_) => {
|
|
317462
|
-
const error48 = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
|
|
317463
|
-
this[INTERNALS].error = error48;
|
|
317464
|
-
});
|
|
317465
|
-
}
|
|
317466
|
-
}
|
|
317467
|
-
get body() {
|
|
317468
|
-
return this[INTERNALS].stream;
|
|
317469
|
-
}
|
|
317470
|
-
get bodyUsed() {
|
|
317471
|
-
return this[INTERNALS].disturbed;
|
|
317472
|
-
}
|
|
317473
|
-
/**
|
|
317474
|
-
* Decode response as ArrayBuffer
|
|
317475
|
-
*
|
|
317476
|
-
* @return Promise
|
|
317477
|
-
*/
|
|
317478
|
-
async arrayBuffer() {
|
|
317479
|
-
const { buffer, byteOffset, byteLength } = await consumeBody(this);
|
|
317480
|
-
return buffer.slice(byteOffset, byteOffset + byteLength);
|
|
317481
|
-
}
|
|
317482
|
-
async formData() {
|
|
317483
|
-
const ct = this.headers.get("content-type");
|
|
317484
|
-
if (ct.startsWith("application/x-www-form-urlencoded")) {
|
|
317485
|
-
const formData = new FormData();
|
|
317486
|
-
const parameters = new URLSearchParams(await this.text());
|
|
317487
|
-
for (const [name2, value] of parameters) {
|
|
317488
|
-
formData.append(name2, value);
|
|
317489
|
-
}
|
|
317490
|
-
return formData;
|
|
317491
|
-
}
|
|
317492
|
-
const { toFormData: toFormData2 } = await Promise.resolve().then(() => (init_multipart_parser(), multipart_parser_exports));
|
|
317493
|
-
return toFormData2(this.body, ct);
|
|
317494
|
-
}
|
|
317495
|
-
/**
|
|
317496
|
-
* Return raw response as Blob
|
|
317497
|
-
*
|
|
317498
|
-
* @return Promise
|
|
317499
|
-
*/
|
|
317500
|
-
async blob() {
|
|
317501
|
-
const ct = this.headers && this.headers.get("content-type") || this[INTERNALS].body && this[INTERNALS].body.type || "";
|
|
317502
|
-
const buf = await this.arrayBuffer();
|
|
317503
|
-
return new fetch_blob_default([buf], {
|
|
317504
|
-
type: ct
|
|
317505
|
-
});
|
|
317506
|
-
}
|
|
317507
|
-
/**
|
|
317508
|
-
* Decode response as json
|
|
317509
|
-
*
|
|
317510
|
-
* @return Promise
|
|
317511
|
-
*/
|
|
317512
|
-
async json() {
|
|
317513
|
-
const text = await this.text();
|
|
317514
|
-
return JSON.parse(text);
|
|
317515
|
-
}
|
|
317516
|
-
/**
|
|
317517
|
-
* Decode response as text
|
|
317518
|
-
*
|
|
317519
|
-
* @return Promise
|
|
317520
|
-
*/
|
|
317521
|
-
async text() {
|
|
317522
|
-
const buffer = await consumeBody(this);
|
|
317523
|
-
return new TextDecoder().decode(buffer);
|
|
317524
|
-
}
|
|
317525
|
-
/**
|
|
317526
|
-
* Decode response as buffer (non-spec api)
|
|
317527
|
-
*
|
|
317528
|
-
* @return Promise
|
|
317529
|
-
*/
|
|
317530
|
-
buffer() {
|
|
317531
|
-
return consumeBody(this);
|
|
317532
|
-
}
|
|
317533
|
-
};
|
|
317534
|
-
Body.prototype.buffer = (0, import_node_util.deprecate)(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
|
|
317535
|
-
Object.defineProperties(Body.prototype, {
|
|
317536
|
-
body: { enumerable: true },
|
|
317537
|
-
bodyUsed: { enumerable: true },
|
|
317538
|
-
arrayBuffer: { enumerable: true },
|
|
317539
|
-
blob: { enumerable: true },
|
|
317540
|
-
json: { enumerable: true },
|
|
317541
|
-
text: { enumerable: true },
|
|
317542
|
-
data: { get: (0, import_node_util.deprecate)(
|
|
317543
|
-
() => {
|
|
317544
|
-
},
|
|
317545
|
-
"data doesn't exist, use json(), text(), arrayBuffer(), or body instead",
|
|
317546
|
-
"https://github.com/node-fetch/node-fetch/issues/1000 (response)"
|
|
317547
|
-
) }
|
|
317548
|
-
});
|
|
317549
|
-
async function consumeBody(data) {
|
|
317550
|
-
if (data[INTERNALS].disturbed) {
|
|
317551
|
-
throw new TypeError(`body used already for: ${data.url}`);
|
|
317552
|
-
}
|
|
317553
|
-
data[INTERNALS].disturbed = true;
|
|
317554
|
-
if (data[INTERNALS].error) {
|
|
317555
|
-
throw data[INTERNALS].error;
|
|
317556
|
-
}
|
|
317557
|
-
const { body } = data;
|
|
317558
|
-
if (body === null) {
|
|
317559
|
-
return import_node_buffer.Buffer.alloc(0);
|
|
317560
|
-
}
|
|
317561
|
-
if (!(body instanceof import_node_stream.default)) {
|
|
317562
|
-
return import_node_buffer.Buffer.alloc(0);
|
|
317563
|
-
}
|
|
317564
|
-
const accum = [];
|
|
317565
|
-
let accumBytes = 0;
|
|
317566
|
-
try {
|
|
317567
|
-
for await (const chunk of body) {
|
|
317568
|
-
if (data.size > 0 && accumBytes + chunk.length > data.size) {
|
|
317569
|
-
const error48 = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size");
|
|
317570
|
-
body.destroy(error48);
|
|
317571
|
-
throw error48;
|
|
317572
|
-
}
|
|
317573
|
-
accumBytes += chunk.length;
|
|
317574
|
-
accum.push(chunk);
|
|
317575
|
-
}
|
|
317576
|
-
} catch (error48) {
|
|
317577
|
-
const error_ = error48 instanceof FetchBaseError ? error48 : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error48.message}`, "system", error48);
|
|
317578
|
-
throw error_;
|
|
317579
|
-
}
|
|
317580
|
-
if (body.readableEnded === true || body._readableState.ended === true) {
|
|
317581
|
-
try {
|
|
317582
|
-
if (accum.every((c) => typeof c === "string")) {
|
|
317583
|
-
return import_node_buffer.Buffer.from(accum.join(""));
|
|
317584
|
-
}
|
|
317585
|
-
return import_node_buffer.Buffer.concat(accum, accumBytes);
|
|
317586
|
-
} catch (error48) {
|
|
317587
|
-
throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error48.message}`, "system", error48);
|
|
317588
|
-
}
|
|
317589
|
-
} else {
|
|
317590
|
-
throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`);
|
|
317591
|
-
}
|
|
317592
|
-
}
|
|
317593
|
-
var clone = (instance, highWaterMark) => {
|
|
317594
|
-
let p1;
|
|
317595
|
-
let p2;
|
|
317596
|
-
let { body } = instance[INTERNALS];
|
|
317597
|
-
if (instance.bodyUsed) {
|
|
317598
|
-
throw new Error("cannot clone body after it is used");
|
|
317599
|
-
}
|
|
317600
|
-
if (body instanceof import_node_stream.default && typeof body.getBoundary !== "function") {
|
|
317601
|
-
p1 = new import_node_stream.PassThrough({ highWaterMark });
|
|
317602
|
-
p2 = new import_node_stream.PassThrough({ highWaterMark });
|
|
317603
|
-
body.pipe(p1);
|
|
317604
|
-
body.pipe(p2);
|
|
317605
|
-
instance[INTERNALS].stream = p1;
|
|
317606
|
-
body = p2;
|
|
317607
|
-
}
|
|
317608
|
-
return body;
|
|
317609
|
-
};
|
|
317610
|
-
var getNonSpecFormDataBoundary = (0, import_node_util.deprecate)(
|
|
317611
|
-
(body) => body.getBoundary(),
|
|
317612
|
-
"form-data doesn't follow the spec and requires special treatment. Use alternative package",
|
|
317613
|
-
"https://github.com/node-fetch/node-fetch/issues/1167"
|
|
317614
|
-
);
|
|
317615
|
-
var extractContentType = (body, request) => {
|
|
317616
|
-
if (body === null) {
|
|
317617
|
-
return null;
|
|
317618
|
-
}
|
|
317619
|
-
if (typeof body === "string") {
|
|
317620
|
-
return "text/plain;charset=UTF-8";
|
|
317621
|
-
}
|
|
317622
|
-
if (isURLSearchParameters(body)) {
|
|
317623
|
-
return "application/x-www-form-urlencoded;charset=UTF-8";
|
|
317624
|
-
}
|
|
317625
|
-
if (isBlob(body)) {
|
|
317626
|
-
return body.type || null;
|
|
317627
|
-
}
|
|
317628
|
-
if (import_node_buffer.Buffer.isBuffer(body) || import_node_util.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
|
317629
|
-
return null;
|
|
317630
|
-
}
|
|
317631
|
-
if (body instanceof FormData) {
|
|
317632
|
-
return `multipart/form-data; boundary=${request[INTERNALS].boundary}`;
|
|
317633
|
-
}
|
|
317634
|
-
if (body && typeof body.getBoundary === "function") {
|
|
317635
|
-
return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;
|
|
317636
|
-
}
|
|
317637
|
-
if (body instanceof import_node_stream.default) {
|
|
317638
|
-
return null;
|
|
317639
|
-
}
|
|
317640
|
-
return "text/plain;charset=UTF-8";
|
|
317641
|
-
};
|
|
317642
|
-
var getTotalBytes = (request) => {
|
|
317643
|
-
const { body } = request[INTERNALS];
|
|
317644
|
-
if (body === null) {
|
|
317645
|
-
return 0;
|
|
317646
|
-
}
|
|
317647
|
-
if (isBlob(body)) {
|
|
317648
|
-
return body.size;
|
|
317649
|
-
}
|
|
317650
|
-
if (import_node_buffer.Buffer.isBuffer(body)) {
|
|
317651
|
-
return body.length;
|
|
317652
|
-
}
|
|
317653
|
-
if (body && typeof body.getLengthSync === "function") {
|
|
317654
|
-
return body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;
|
|
317655
|
-
}
|
|
317656
|
-
return null;
|
|
317657
|
-
};
|
|
317658
|
-
var writeToStream = async (dest, { body }) => {
|
|
317659
|
-
if (body === null) {
|
|
317660
|
-
dest.end();
|
|
317661
|
-
} else {
|
|
317662
|
-
await pipeline(body, dest);
|
|
317663
|
-
}
|
|
317664
|
-
};
|
|
317665
|
-
|
|
317666
|
-
// ../../node_modules/node-fetch/src/headers.js
|
|
317667
|
-
var import_node_util2 = require("node:util");
|
|
317668
|
-
var import_node_http = __toESM(require("node:http"), 1);
|
|
317669
|
-
var validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name2) => {
|
|
317670
|
-
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name2)) {
|
|
317671
|
-
const error48 = new TypeError(`Header name must be a valid HTTP token [${name2}]`);
|
|
317672
|
-
Object.defineProperty(error48, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
|
|
317673
|
-
throw error48;
|
|
317674
|
-
}
|
|
317675
|
-
};
|
|
317676
|
-
var validateHeaderValue = typeof import_node_http.default.validateHeaderValue === "function" ? import_node_http.default.validateHeaderValue : (name2, value) => {
|
|
317677
|
-
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
|
|
317678
|
-
const error48 = new TypeError(`Invalid character in header content ["${name2}"]`);
|
|
317679
|
-
Object.defineProperty(error48, "code", { value: "ERR_INVALID_CHAR" });
|
|
317680
|
-
throw error48;
|
|
317681
|
-
}
|
|
317682
|
-
};
|
|
317683
|
-
var Headers2 = class _Headers extends URLSearchParams {
|
|
317684
|
-
/**
|
|
317685
|
-
* Headers class
|
|
317686
|
-
*
|
|
317687
|
-
* @constructor
|
|
317688
|
-
* @param {HeadersInit} [init] - Response headers
|
|
317689
|
-
*/
|
|
317690
|
-
constructor(init) {
|
|
317691
|
-
let result = [];
|
|
317692
|
-
if (init instanceof _Headers) {
|
|
317693
|
-
const raw = init.raw();
|
|
317694
|
-
for (const [name2, values] of Object.entries(raw)) {
|
|
317695
|
-
result.push(...values.map((value) => [name2, value]));
|
|
317696
|
-
}
|
|
317697
|
-
} else if (init == null) {
|
|
317698
|
-
} else if (typeof init === "object" && !import_node_util2.types.isBoxedPrimitive(init)) {
|
|
317699
|
-
const method = init[Symbol.iterator];
|
|
317700
|
-
if (method == null) {
|
|
317701
|
-
result.push(...Object.entries(init));
|
|
317702
|
-
} else {
|
|
317703
|
-
if (typeof method !== "function") {
|
|
317704
|
-
throw new TypeError("Header pairs must be iterable");
|
|
317705
|
-
}
|
|
317706
|
-
result = [...init].map((pair) => {
|
|
317707
|
-
if (typeof pair !== "object" || import_node_util2.types.isBoxedPrimitive(pair)) {
|
|
317708
|
-
throw new TypeError("Each header pair must be an iterable object");
|
|
317709
|
-
}
|
|
317710
|
-
return [...pair];
|
|
317711
|
-
}).map((pair) => {
|
|
317712
|
-
if (pair.length !== 2) {
|
|
317713
|
-
throw new TypeError("Each header pair must be a name/value tuple");
|
|
317714
|
-
}
|
|
317715
|
-
return [...pair];
|
|
317716
|
-
});
|
|
317717
|
-
}
|
|
317718
|
-
} else {
|
|
317719
|
-
throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");
|
|
317720
|
-
}
|
|
317721
|
-
result = result.length > 0 ? result.map(([name2, value]) => {
|
|
317722
|
-
validateHeaderName(name2);
|
|
317723
|
-
validateHeaderValue(name2, String(value));
|
|
317724
|
-
return [String(name2).toLowerCase(), String(value)];
|
|
317725
|
-
}) : void 0;
|
|
317726
|
-
super(result);
|
|
317727
|
-
return new Proxy(this, {
|
|
317728
|
-
get(target, p, receiver) {
|
|
317729
|
-
switch (p) {
|
|
317730
|
-
case "append":
|
|
317731
|
-
case "set":
|
|
317732
|
-
return (name2, value) => {
|
|
317733
|
-
validateHeaderName(name2);
|
|
317734
|
-
validateHeaderValue(name2, String(value));
|
|
317735
|
-
return URLSearchParams.prototype[p].call(
|
|
317736
|
-
target,
|
|
317737
|
-
String(name2).toLowerCase(),
|
|
317738
|
-
String(value)
|
|
317739
|
-
);
|
|
317740
|
-
};
|
|
317741
|
-
case "delete":
|
|
317742
|
-
case "has":
|
|
317743
|
-
case "getAll":
|
|
317744
|
-
return (name2) => {
|
|
317745
|
-
validateHeaderName(name2);
|
|
317746
|
-
return URLSearchParams.prototype[p].call(
|
|
317747
|
-
target,
|
|
317748
|
-
String(name2).toLowerCase()
|
|
317749
|
-
);
|
|
317750
|
-
};
|
|
317751
|
-
case "keys":
|
|
317752
|
-
return () => {
|
|
317753
|
-
target.sort();
|
|
317754
|
-
return new Set(URLSearchParams.prototype.keys.call(target)).keys();
|
|
317755
|
-
};
|
|
317756
|
-
default:
|
|
317757
|
-
return Reflect.get(target, p, receiver);
|
|
317758
|
-
}
|
|
317759
|
-
}
|
|
317760
|
-
});
|
|
317761
|
-
}
|
|
317762
|
-
get [Symbol.toStringTag]() {
|
|
317763
|
-
return this.constructor.name;
|
|
317764
|
-
}
|
|
317765
|
-
toString() {
|
|
317766
|
-
return Object.prototype.toString.call(this);
|
|
317767
|
-
}
|
|
317768
|
-
get(name2) {
|
|
317769
|
-
const values = this.getAll(name2);
|
|
317770
|
-
if (values.length === 0) {
|
|
317771
|
-
return null;
|
|
317772
|
-
}
|
|
317773
|
-
let value = values.join(", ");
|
|
317774
|
-
if (/^content-encoding$/i.test(name2)) {
|
|
317775
|
-
value = value.toLowerCase();
|
|
317776
|
-
}
|
|
317777
|
-
return value;
|
|
317778
|
-
}
|
|
317779
|
-
forEach(callback, thisArg = void 0) {
|
|
317780
|
-
for (const name2 of this.keys()) {
|
|
317781
|
-
Reflect.apply(callback, thisArg, [this.get(name2), name2, this]);
|
|
317782
|
-
}
|
|
317783
|
-
}
|
|
317784
|
-
*values() {
|
|
317785
|
-
for (const name2 of this.keys()) {
|
|
317786
|
-
yield this.get(name2);
|
|
317787
|
-
}
|
|
317788
|
-
}
|
|
317789
|
-
/**
|
|
317790
|
-
* @type {() => IterableIterator<[string, string]>}
|
|
317791
|
-
*/
|
|
317792
|
-
*entries() {
|
|
317793
|
-
for (const name2 of this.keys()) {
|
|
317794
|
-
yield [name2, this.get(name2)];
|
|
317795
|
-
}
|
|
317796
|
-
}
|
|
317797
|
-
[Symbol.iterator]() {
|
|
317798
|
-
return this.entries();
|
|
317799
|
-
}
|
|
317800
|
-
/**
|
|
317801
|
-
* Node-fetch non-spec method
|
|
317802
|
-
* returning all headers and their values as array
|
|
317803
|
-
* @returns {Record<string, string[]>}
|
|
317804
|
-
*/
|
|
317805
|
-
raw() {
|
|
317806
|
-
return [...this.keys()].reduce((result, key) => {
|
|
317807
|
-
result[key] = this.getAll(key);
|
|
317808
|
-
return result;
|
|
317809
|
-
}, {});
|
|
317810
|
-
}
|
|
317811
|
-
/**
|
|
317812
|
-
* For better console.log(headers) and also to convert Headers into Node.js Request compatible format
|
|
317813
|
-
*/
|
|
317814
|
-
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
|
317815
|
-
return [...this.keys()].reduce((result, key) => {
|
|
317816
|
-
const values = this.getAll(key);
|
|
317817
|
-
if (key === "host") {
|
|
317818
|
-
result[key] = values[0];
|
|
317819
|
-
} else {
|
|
317820
|
-
result[key] = values.length > 1 ? values : values[0];
|
|
317821
|
-
}
|
|
317822
|
-
return result;
|
|
317823
|
-
}, {});
|
|
317824
|
-
}
|
|
317825
|
-
};
|
|
317826
|
-
Object.defineProperties(
|
|
317827
|
-
Headers2.prototype,
|
|
317828
|
-
["get", "entries", "forEach", "values"].reduce((result, property) => {
|
|
317829
|
-
result[property] = { enumerable: true };
|
|
317830
|
-
return result;
|
|
317831
|
-
}, {})
|
|
317832
|
-
);
|
|
317833
|
-
function fromRawHeaders(headers = []) {
|
|
317834
|
-
return new Headers2(
|
|
317835
|
-
headers.reduce((result, value, index, array2) => {
|
|
317836
|
-
if (index % 2 === 0) {
|
|
317837
|
-
result.push(array2.slice(index, index + 2));
|
|
317838
|
-
}
|
|
317839
|
-
return result;
|
|
317840
|
-
}, []).filter(([name2, value]) => {
|
|
317841
|
-
try {
|
|
317842
|
-
validateHeaderName(name2);
|
|
317843
|
-
validateHeaderValue(name2, String(value));
|
|
317844
|
-
return true;
|
|
317845
|
-
} catch {
|
|
317846
|
-
return false;
|
|
317847
|
-
}
|
|
317848
|
-
})
|
|
317849
|
-
);
|
|
317850
|
-
}
|
|
317851
|
-
|
|
317852
|
-
// ../../node_modules/node-fetch/src/utils/is-redirect.js
|
|
317853
|
-
var redirectStatus = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
317854
|
-
var isRedirect = (code) => {
|
|
317855
|
-
return redirectStatus.has(code);
|
|
317856
|
-
};
|
|
317857
|
-
|
|
317858
|
-
// ../../node_modules/node-fetch/src/response.js
|
|
317859
|
-
var INTERNALS2 = /* @__PURE__ */ Symbol("Response internals");
|
|
317860
|
-
var Response2 = class _Response extends Body {
|
|
317861
|
-
constructor(body = null, options = {}) {
|
|
317862
|
-
super(body, options);
|
|
317863
|
-
const status = options.status != null ? options.status : 200;
|
|
317864
|
-
const headers = new Headers2(options.headers);
|
|
317865
|
-
if (body !== null && !headers.has("Content-Type")) {
|
|
317866
|
-
const contentType = extractContentType(body, this);
|
|
317867
|
-
if (contentType) {
|
|
317868
|
-
headers.append("Content-Type", contentType);
|
|
317869
|
-
}
|
|
317870
|
-
}
|
|
317871
|
-
this[INTERNALS2] = {
|
|
317872
|
-
type: "default",
|
|
317873
|
-
url: options.url,
|
|
317874
|
-
status,
|
|
317875
|
-
statusText: options.statusText || "",
|
|
317876
|
-
headers,
|
|
317877
|
-
counter: options.counter,
|
|
317878
|
-
highWaterMark: options.highWaterMark
|
|
317879
|
-
};
|
|
317880
|
-
}
|
|
317881
|
-
get type() {
|
|
317882
|
-
return this[INTERNALS2].type;
|
|
317883
|
-
}
|
|
317884
|
-
get url() {
|
|
317885
|
-
return this[INTERNALS2].url || "";
|
|
317886
|
-
}
|
|
317887
|
-
get status() {
|
|
317888
|
-
return this[INTERNALS2].status;
|
|
317889
|
-
}
|
|
317890
|
-
/**
|
|
317891
|
-
* Convenience property representing if the request ended normally
|
|
317892
|
-
*/
|
|
317893
|
-
get ok() {
|
|
317894
|
-
return this[INTERNALS2].status >= 200 && this[INTERNALS2].status < 300;
|
|
317895
|
-
}
|
|
317896
|
-
get redirected() {
|
|
317897
|
-
return this[INTERNALS2].counter > 0;
|
|
317898
|
-
}
|
|
317899
|
-
get statusText() {
|
|
317900
|
-
return this[INTERNALS2].statusText;
|
|
317901
|
-
}
|
|
317902
|
-
get headers() {
|
|
317903
|
-
return this[INTERNALS2].headers;
|
|
317904
|
-
}
|
|
317905
|
-
get highWaterMark() {
|
|
317906
|
-
return this[INTERNALS2].highWaterMark;
|
|
317907
|
-
}
|
|
317908
|
-
/**
|
|
317909
|
-
* Clone this response
|
|
317910
|
-
*
|
|
317911
|
-
* @return Response
|
|
317912
|
-
*/
|
|
317913
|
-
clone() {
|
|
317914
|
-
return new _Response(clone(this, this.highWaterMark), {
|
|
317915
|
-
type: this.type,
|
|
317916
|
-
url: this.url,
|
|
317917
|
-
status: this.status,
|
|
317918
|
-
statusText: this.statusText,
|
|
317919
|
-
headers: this.headers,
|
|
317920
|
-
ok: this.ok,
|
|
317921
|
-
redirected: this.redirected,
|
|
317922
|
-
size: this.size,
|
|
317923
|
-
highWaterMark: this.highWaterMark
|
|
317924
|
-
});
|
|
317925
|
-
}
|
|
317926
|
-
/**
|
|
317927
|
-
* @param {string} url The URL that the new response is to originate from.
|
|
317928
|
-
* @param {number} status An optional status code for the response (e.g., 302.)
|
|
317929
|
-
* @returns {Response} A Response object.
|
|
317930
|
-
*/
|
|
317931
|
-
static redirect(url2, status = 302) {
|
|
317932
|
-
if (!isRedirect(status)) {
|
|
317933
|
-
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
|
317934
|
-
}
|
|
317935
|
-
return new _Response(null, {
|
|
317936
|
-
headers: {
|
|
317937
|
-
location: new URL(url2).toString()
|
|
317938
|
-
},
|
|
317939
|
-
status
|
|
317940
|
-
});
|
|
317941
|
-
}
|
|
317942
|
-
static error() {
|
|
317943
|
-
const response = new _Response(null, { status: 0, statusText: "" });
|
|
317944
|
-
response[INTERNALS2].type = "error";
|
|
317945
|
-
return response;
|
|
317946
|
-
}
|
|
317947
|
-
static json(data = void 0, init = {}) {
|
|
317948
|
-
const body = JSON.stringify(data);
|
|
317949
|
-
if (body === void 0) {
|
|
317950
|
-
throw new TypeError("data is not JSON serializable");
|
|
317951
|
-
}
|
|
317952
|
-
const headers = new Headers2(init && init.headers);
|
|
317953
|
-
if (!headers.has("content-type")) {
|
|
317954
|
-
headers.set("content-type", "application/json");
|
|
317955
|
-
}
|
|
317956
|
-
return new _Response(body, {
|
|
317957
|
-
...init,
|
|
317958
|
-
headers
|
|
317959
|
-
});
|
|
317960
|
-
}
|
|
317961
|
-
get [Symbol.toStringTag]() {
|
|
317962
|
-
return "Response";
|
|
317963
|
-
}
|
|
317964
|
-
};
|
|
317965
|
-
Object.defineProperties(Response2.prototype, {
|
|
317966
|
-
type: { enumerable: true },
|
|
317967
|
-
url: { enumerable: true },
|
|
317968
|
-
status: { enumerable: true },
|
|
317969
|
-
ok: { enumerable: true },
|
|
317970
|
-
redirected: { enumerable: true },
|
|
317971
|
-
statusText: { enumerable: true },
|
|
317972
|
-
headers: { enumerable: true },
|
|
317973
|
-
clone: { enumerable: true }
|
|
317974
|
-
});
|
|
317975
|
-
|
|
317976
|
-
// ../../node_modules/node-fetch/src/request.js
|
|
317977
|
-
var import_node_url = require("node:url");
|
|
317978
|
-
var import_node_util3 = require("node:util");
|
|
317979
|
-
|
|
317980
|
-
// ../../node_modules/node-fetch/src/utils/get-search.js
|
|
317981
|
-
var getSearch = (parsedURL) => {
|
|
317982
|
-
if (parsedURL.search) {
|
|
317983
|
-
return parsedURL.search;
|
|
317984
|
-
}
|
|
317985
|
-
const lastOffset = parsedURL.href.length - 1;
|
|
317986
|
-
const hash2 = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
|
|
317987
|
-
return parsedURL.href[lastOffset - hash2.length] === "?" ? "?" : "";
|
|
317988
|
-
};
|
|
317989
|
-
|
|
317990
|
-
// ../../node_modules/node-fetch/src/utils/referrer.js
|
|
317991
|
-
var import_node_net = require("node:net");
|
|
317992
|
-
function stripURLForUseAsAReferrer(url2, originOnly = false) {
|
|
317993
|
-
if (url2 == null) {
|
|
317994
|
-
return "no-referrer";
|
|
317995
|
-
}
|
|
317996
|
-
url2 = new URL(url2);
|
|
317997
|
-
if (/^(about|blob|data):$/.test(url2.protocol)) {
|
|
317998
|
-
return "no-referrer";
|
|
317999
|
-
}
|
|
318000
|
-
url2.username = "";
|
|
318001
|
-
url2.password = "";
|
|
318002
|
-
url2.hash = "";
|
|
318003
|
-
if (originOnly) {
|
|
318004
|
-
url2.pathname = "";
|
|
318005
|
-
url2.search = "";
|
|
318006
|
-
}
|
|
318007
|
-
return url2;
|
|
318008
|
-
}
|
|
318009
|
-
var ReferrerPolicy = /* @__PURE__ */ new Set([
|
|
318010
|
-
"",
|
|
318011
|
-
"no-referrer",
|
|
318012
|
-
"no-referrer-when-downgrade",
|
|
318013
|
-
"same-origin",
|
|
318014
|
-
"origin",
|
|
318015
|
-
"strict-origin",
|
|
318016
|
-
"origin-when-cross-origin",
|
|
318017
|
-
"strict-origin-when-cross-origin",
|
|
318018
|
-
"unsafe-url"
|
|
318019
|
-
]);
|
|
318020
|
-
var DEFAULT_REFERRER_POLICY = "strict-origin-when-cross-origin";
|
|
318021
|
-
function validateReferrerPolicy(referrerPolicy) {
|
|
318022
|
-
if (!ReferrerPolicy.has(referrerPolicy)) {
|
|
318023
|
-
throw new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);
|
|
318024
|
-
}
|
|
318025
|
-
return referrerPolicy;
|
|
318026
|
-
}
|
|
318027
|
-
function isOriginPotentiallyTrustworthy(url2) {
|
|
318028
|
-
if (/^(http|ws)s:$/.test(url2.protocol)) {
|
|
318029
|
-
return true;
|
|
318030
|
-
}
|
|
318031
|
-
const hostIp = url2.host.replace(/(^\[)|(]$)/g, "");
|
|
318032
|
-
const hostIPVersion = (0, import_node_net.isIP)(hostIp);
|
|
318033
|
-
if (hostIPVersion === 4 && /^127\./.test(hostIp)) {
|
|
318034
|
-
return true;
|
|
318035
|
-
}
|
|
318036
|
-
if (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {
|
|
318037
|
-
return true;
|
|
318038
|
-
}
|
|
318039
|
-
if (url2.host === "localhost" || url2.host.endsWith(".localhost")) {
|
|
318040
|
-
return false;
|
|
318041
|
-
}
|
|
318042
|
-
if (url2.protocol === "file:") {
|
|
318043
|
-
return true;
|
|
318044
|
-
}
|
|
318045
|
-
return false;
|
|
318046
|
-
}
|
|
318047
|
-
function isUrlPotentiallyTrustworthy(url2) {
|
|
318048
|
-
if (/^about:(blank|srcdoc)$/.test(url2)) {
|
|
318049
|
-
return true;
|
|
318050
|
-
}
|
|
318051
|
-
if (url2.protocol === "data:") {
|
|
318052
|
-
return true;
|
|
318053
|
-
}
|
|
318054
|
-
if (/^(blob|filesystem):$/.test(url2.protocol)) {
|
|
318055
|
-
return true;
|
|
318056
|
-
}
|
|
318057
|
-
return isOriginPotentiallyTrustworthy(url2);
|
|
318058
|
-
}
|
|
318059
|
-
function determineRequestsReferrer(request, { referrerURLCallback, referrerOriginCallback } = {}) {
|
|
318060
|
-
if (request.referrer === "no-referrer" || request.referrerPolicy === "") {
|
|
318061
|
-
return null;
|
|
318062
|
-
}
|
|
318063
|
-
const policy = request.referrerPolicy;
|
|
318064
|
-
if (request.referrer === "about:client") {
|
|
318065
|
-
return "no-referrer";
|
|
318066
|
-
}
|
|
318067
|
-
const referrerSource = request.referrer;
|
|
318068
|
-
let referrerURL = stripURLForUseAsAReferrer(referrerSource);
|
|
318069
|
-
let referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);
|
|
318070
|
-
if (referrerURL.toString().length > 4096) {
|
|
318071
|
-
referrerURL = referrerOrigin;
|
|
318072
|
-
}
|
|
318073
|
-
if (referrerURLCallback) {
|
|
318074
|
-
referrerURL = referrerURLCallback(referrerURL);
|
|
318075
|
-
}
|
|
318076
|
-
if (referrerOriginCallback) {
|
|
318077
|
-
referrerOrigin = referrerOriginCallback(referrerOrigin);
|
|
318078
|
-
}
|
|
318079
|
-
const currentURL = new URL(request.url);
|
|
318080
|
-
switch (policy) {
|
|
318081
|
-
case "no-referrer":
|
|
318082
|
-
return "no-referrer";
|
|
318083
|
-
case "origin":
|
|
318084
|
-
return referrerOrigin;
|
|
318085
|
-
case "unsafe-url":
|
|
318086
|
-
return referrerURL;
|
|
318087
|
-
case "strict-origin":
|
|
318088
|
-
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
|
|
318089
|
-
return "no-referrer";
|
|
318090
|
-
}
|
|
318091
|
-
return referrerOrigin.toString();
|
|
318092
|
-
case "strict-origin-when-cross-origin":
|
|
318093
|
-
if (referrerURL.origin === currentURL.origin) {
|
|
318094
|
-
return referrerURL;
|
|
318095
|
-
}
|
|
318096
|
-
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
|
|
318097
|
-
return "no-referrer";
|
|
318098
|
-
}
|
|
318099
|
-
return referrerOrigin;
|
|
318100
|
-
case "same-origin":
|
|
318101
|
-
if (referrerURL.origin === currentURL.origin) {
|
|
318102
|
-
return referrerURL;
|
|
318103
|
-
}
|
|
318104
|
-
return "no-referrer";
|
|
318105
|
-
case "origin-when-cross-origin":
|
|
318106
|
-
if (referrerURL.origin === currentURL.origin) {
|
|
318107
|
-
return referrerURL;
|
|
318108
|
-
}
|
|
318109
|
-
return referrerOrigin;
|
|
318110
|
-
case "no-referrer-when-downgrade":
|
|
318111
|
-
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
|
|
318112
|
-
return "no-referrer";
|
|
318113
|
-
}
|
|
318114
|
-
return referrerURL;
|
|
318115
|
-
default:
|
|
318116
|
-
throw new TypeError(`Invalid referrerPolicy: ${policy}`);
|
|
318117
|
-
}
|
|
318118
|
-
}
|
|
318119
|
-
function parseReferrerPolicyFromHeader(headers) {
|
|
318120
|
-
const policyTokens = (headers.get("referrer-policy") || "").split(/[,\s]+/);
|
|
318121
|
-
let policy = "";
|
|
318122
|
-
for (const token of policyTokens) {
|
|
318123
|
-
if (token && ReferrerPolicy.has(token)) {
|
|
318124
|
-
policy = token;
|
|
318125
|
-
}
|
|
318126
|
-
}
|
|
318127
|
-
return policy;
|
|
318128
|
-
}
|
|
318129
|
-
|
|
318130
|
-
// ../../node_modules/node-fetch/src/request.js
|
|
318131
|
-
var INTERNALS3 = /* @__PURE__ */ Symbol("Request internals");
|
|
318132
|
-
var isRequest = (object3) => {
|
|
318133
|
-
return typeof object3 === "object" && typeof object3[INTERNALS3] === "object";
|
|
318134
|
-
};
|
|
318135
|
-
var doBadDataWarn = (0, import_node_util3.deprecate)(
|
|
318136
|
-
() => {
|
|
318137
|
-
},
|
|
318138
|
-
".data is not a valid RequestInit property, use .body instead",
|
|
318139
|
-
"https://github.com/node-fetch/node-fetch/issues/1000 (request)"
|
|
318140
|
-
);
|
|
318141
|
-
var Request2 = class _Request extends Body {
|
|
318142
|
-
constructor(input, init = {}) {
|
|
318143
|
-
let parsedURL;
|
|
318144
|
-
if (isRequest(input)) {
|
|
318145
|
-
parsedURL = new URL(input.url);
|
|
318146
|
-
} else {
|
|
318147
|
-
parsedURL = new URL(input);
|
|
318148
|
-
input = {};
|
|
318149
|
-
}
|
|
318150
|
-
if (parsedURL.username !== "" || parsedURL.password !== "") {
|
|
318151
|
-
throw new TypeError(`${parsedURL} is an url with embedded credentials.`);
|
|
318152
|
-
}
|
|
318153
|
-
let method = init.method || input.method || "GET";
|
|
318154
|
-
if (/^(delete|get|head|options|post|put)$/i.test(method)) {
|
|
318155
|
-
method = method.toUpperCase();
|
|
318156
|
-
}
|
|
318157
|
-
if (!isRequest(init) && "data" in init) {
|
|
318158
|
-
doBadDataWarn();
|
|
318159
|
-
}
|
|
318160
|
-
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
|
|
318161
|
-
throw new TypeError("Request with GET/HEAD method cannot have body");
|
|
318162
|
-
}
|
|
318163
|
-
const inputBody = init.body ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
|
|
318164
|
-
super(inputBody, {
|
|
318165
|
-
size: init.size || input.size || 0
|
|
318166
|
-
});
|
|
318167
|
-
const headers = new Headers2(init.headers || input.headers || {});
|
|
318168
|
-
if (inputBody !== null && !headers.has("Content-Type")) {
|
|
318169
|
-
const contentType = extractContentType(inputBody, this);
|
|
318170
|
-
if (contentType) {
|
|
318171
|
-
headers.set("Content-Type", contentType);
|
|
318172
|
-
}
|
|
318173
|
-
}
|
|
318174
|
-
let signal = isRequest(input) ? input.signal : null;
|
|
318175
|
-
if ("signal" in init) {
|
|
318176
|
-
signal = init.signal;
|
|
318177
|
-
}
|
|
318178
|
-
if (signal != null && !isAbortSignal(signal)) {
|
|
318179
|
-
throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
|
|
318180
|
-
}
|
|
318181
|
-
let referrer = init.referrer == null ? input.referrer : init.referrer;
|
|
318182
|
-
if (referrer === "") {
|
|
318183
|
-
referrer = "no-referrer";
|
|
318184
|
-
} else if (referrer) {
|
|
318185
|
-
const parsedReferrer = new URL(referrer);
|
|
318186
|
-
referrer = /^about:(\/\/)?client$/.test(parsedReferrer) ? "client" : parsedReferrer;
|
|
318187
|
-
} else {
|
|
318188
|
-
referrer = void 0;
|
|
318189
|
-
}
|
|
318190
|
-
this[INTERNALS3] = {
|
|
318191
|
-
method,
|
|
318192
|
-
redirect: init.redirect || input.redirect || "follow",
|
|
318193
|
-
headers,
|
|
318194
|
-
parsedURL,
|
|
318195
|
-
signal,
|
|
318196
|
-
referrer
|
|
318197
|
-
};
|
|
318198
|
-
this.follow = init.follow === void 0 ? input.follow === void 0 ? 20 : input.follow : init.follow;
|
|
318199
|
-
this.compress = init.compress === void 0 ? input.compress === void 0 ? true : input.compress : init.compress;
|
|
318200
|
-
this.counter = init.counter || input.counter || 0;
|
|
318201
|
-
this.agent = init.agent || input.agent;
|
|
318202
|
-
this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
|
|
318203
|
-
this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
|
|
318204
|
-
this.referrerPolicy = init.referrerPolicy || input.referrerPolicy || "";
|
|
318205
|
-
}
|
|
318206
|
-
/** @returns {string} */
|
|
318207
|
-
get method() {
|
|
318208
|
-
return this[INTERNALS3].method;
|
|
318209
|
-
}
|
|
318210
|
-
/** @returns {string} */
|
|
318211
|
-
get url() {
|
|
318212
|
-
return (0, import_node_url.format)(this[INTERNALS3].parsedURL);
|
|
318213
|
-
}
|
|
318214
|
-
/** @returns {Headers} */
|
|
318215
|
-
get headers() {
|
|
318216
|
-
return this[INTERNALS3].headers;
|
|
318217
|
-
}
|
|
318218
|
-
get redirect() {
|
|
318219
|
-
return this[INTERNALS3].redirect;
|
|
318220
|
-
}
|
|
318221
|
-
/** @returns {AbortSignal} */
|
|
318222
|
-
get signal() {
|
|
318223
|
-
return this[INTERNALS3].signal;
|
|
318224
|
-
}
|
|
318225
|
-
// https://fetch.spec.whatwg.org/#dom-request-referrer
|
|
318226
|
-
get referrer() {
|
|
318227
|
-
if (this[INTERNALS3].referrer === "no-referrer") {
|
|
318228
|
-
return "";
|
|
318229
|
-
}
|
|
318230
|
-
if (this[INTERNALS3].referrer === "client") {
|
|
318231
|
-
return "about:client";
|
|
318232
|
-
}
|
|
318233
|
-
if (this[INTERNALS3].referrer) {
|
|
318234
|
-
return this[INTERNALS3].referrer.toString();
|
|
318235
|
-
}
|
|
318236
|
-
return void 0;
|
|
318237
|
-
}
|
|
318238
|
-
get referrerPolicy() {
|
|
318239
|
-
return this[INTERNALS3].referrerPolicy;
|
|
318240
|
-
}
|
|
318241
|
-
set referrerPolicy(referrerPolicy) {
|
|
318242
|
-
this[INTERNALS3].referrerPolicy = validateReferrerPolicy(referrerPolicy);
|
|
318243
|
-
}
|
|
318244
|
-
/**
|
|
318245
|
-
* Clone this request
|
|
318246
|
-
*
|
|
318247
|
-
* @return Request
|
|
318248
|
-
*/
|
|
318249
|
-
clone() {
|
|
318250
|
-
return new _Request(this);
|
|
318251
|
-
}
|
|
318252
|
-
get [Symbol.toStringTag]() {
|
|
318253
|
-
return "Request";
|
|
318254
|
-
}
|
|
318255
|
-
};
|
|
318256
|
-
Object.defineProperties(Request2.prototype, {
|
|
318257
|
-
method: { enumerable: true },
|
|
318258
|
-
url: { enumerable: true },
|
|
318259
|
-
headers: { enumerable: true },
|
|
318260
|
-
redirect: { enumerable: true },
|
|
318261
|
-
clone: { enumerable: true },
|
|
318262
|
-
signal: { enumerable: true },
|
|
318263
|
-
referrer: { enumerable: true },
|
|
318264
|
-
referrerPolicy: { enumerable: true }
|
|
318265
|
-
});
|
|
318266
|
-
var getNodeRequestOptions = (request) => {
|
|
318267
|
-
const { parsedURL } = request[INTERNALS3];
|
|
318268
|
-
const headers = new Headers2(request[INTERNALS3].headers);
|
|
318269
|
-
if (!headers.has("Accept")) {
|
|
318270
|
-
headers.set("Accept", "*/*");
|
|
318271
|
-
}
|
|
318272
|
-
let contentLengthValue = null;
|
|
318273
|
-
if (request.body === null && /^(post|put)$/i.test(request.method)) {
|
|
318274
|
-
contentLengthValue = "0";
|
|
318275
|
-
}
|
|
318276
|
-
if (request.body !== null) {
|
|
318277
|
-
const totalBytes = getTotalBytes(request);
|
|
318278
|
-
if (typeof totalBytes === "number" && !Number.isNaN(totalBytes)) {
|
|
318279
|
-
contentLengthValue = String(totalBytes);
|
|
318280
|
-
}
|
|
318281
|
-
}
|
|
318282
|
-
if (contentLengthValue) {
|
|
318283
|
-
headers.set("Content-Length", contentLengthValue);
|
|
318284
|
-
}
|
|
318285
|
-
if (request.referrerPolicy === "") {
|
|
318286
|
-
request.referrerPolicy = DEFAULT_REFERRER_POLICY;
|
|
318287
|
-
}
|
|
318288
|
-
if (request.referrer && request.referrer !== "no-referrer") {
|
|
318289
|
-
request[INTERNALS3].referrer = determineRequestsReferrer(request);
|
|
318290
|
-
} else {
|
|
318291
|
-
request[INTERNALS3].referrer = "no-referrer";
|
|
318292
|
-
}
|
|
318293
|
-
if (request[INTERNALS3].referrer instanceof URL) {
|
|
318294
|
-
headers.set("Referer", request.referrer);
|
|
318295
|
-
}
|
|
318296
|
-
if (!headers.has("User-Agent")) {
|
|
318297
|
-
headers.set("User-Agent", "node-fetch");
|
|
318298
|
-
}
|
|
318299
|
-
if (request.compress && !headers.has("Accept-Encoding")) {
|
|
318300
|
-
headers.set("Accept-Encoding", "gzip, deflate, br");
|
|
318301
|
-
}
|
|
318302
|
-
let { agent } = request;
|
|
318303
|
-
if (typeof agent === "function") {
|
|
318304
|
-
agent = agent(parsedURL);
|
|
318305
|
-
}
|
|
318306
|
-
const search = getSearch(parsedURL);
|
|
318307
|
-
const options = {
|
|
318308
|
-
// Overwrite search to retain trailing ? (issue #776)
|
|
318309
|
-
path: parsedURL.pathname + search,
|
|
318310
|
-
// The following options are not expressed in the URL
|
|
318311
|
-
method: request.method,
|
|
318312
|
-
headers: headers[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")](),
|
|
318313
|
-
insecureHTTPParser: request.insecureHTTPParser,
|
|
318314
|
-
agent
|
|
318315
|
-
};
|
|
318316
|
-
return {
|
|
318317
|
-
/** @type {URL} */
|
|
318318
|
-
parsedURL,
|
|
318319
|
-
options
|
|
318320
|
-
};
|
|
318321
|
-
};
|
|
318322
|
-
|
|
318323
|
-
// ../../node_modules/node-fetch/src/errors/abort-error.js
|
|
318324
|
-
var AbortError = class extends FetchBaseError {
|
|
318325
|
-
constructor(message, type2 = "aborted") {
|
|
318326
|
-
super(message, type2);
|
|
318327
|
-
}
|
|
318328
|
-
};
|
|
318329
|
-
|
|
318330
|
-
// ../../node_modules/node-fetch/src/index.js
|
|
318331
|
-
init_esm_min();
|
|
318332
|
-
init_from();
|
|
318333
|
-
var supportedSchemas = /* @__PURE__ */ new Set(["data:", "http:", "https:"]);
|
|
318334
|
-
async function fetch2(url2, options_) {
|
|
318335
|
-
return new Promise((resolve, reject) => {
|
|
318336
|
-
const request = new Request2(url2, options_);
|
|
318337
|
-
const { parsedURL, options } = getNodeRequestOptions(request);
|
|
318338
|
-
if (!supportedSchemas.has(parsedURL.protocol)) {
|
|
318339
|
-
throw new TypeError(`node-fetch cannot load ${url2}. URL scheme "${parsedURL.protocol.replace(/:$/, "")}" is not supported.`);
|
|
318340
|
-
}
|
|
318341
|
-
if (parsedURL.protocol === "data:") {
|
|
318342
|
-
const data = dist_default(request.url);
|
|
318343
|
-
const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
|
|
318344
|
-
resolve(response2);
|
|
318345
|
-
return;
|
|
318346
|
-
}
|
|
318347
|
-
const send = (parsedURL.protocol === "https:" ? import_node_https.default : import_node_http2.default).request;
|
|
318348
|
-
const { signal } = request;
|
|
318349
|
-
let response = null;
|
|
318350
|
-
const abort = () => {
|
|
318351
|
-
const error48 = new AbortError("The operation was aborted.");
|
|
318352
|
-
reject(error48);
|
|
318353
|
-
if (request.body && request.body instanceof import_node_stream2.default.Readable) {
|
|
318354
|
-
request.body.destroy(error48);
|
|
318355
|
-
}
|
|
318356
|
-
if (!response || !response.body) {
|
|
318357
|
-
return;
|
|
318358
|
-
}
|
|
318359
|
-
response.body.emit("error", error48);
|
|
318360
|
-
};
|
|
318361
|
-
if (signal && signal.aborted) {
|
|
318362
|
-
abort();
|
|
318363
|
-
return;
|
|
318364
|
-
}
|
|
318365
|
-
const abortAndFinalize = () => {
|
|
318366
|
-
abort();
|
|
318367
|
-
finalize2();
|
|
318368
|
-
};
|
|
318369
|
-
const request_ = send(parsedURL.toString(), options);
|
|
318370
|
-
if (signal) {
|
|
318371
|
-
signal.addEventListener("abort", abortAndFinalize);
|
|
318372
|
-
}
|
|
318373
|
-
const finalize2 = () => {
|
|
318374
|
-
request_.abort();
|
|
318375
|
-
if (signal) {
|
|
318376
|
-
signal.removeEventListener("abort", abortAndFinalize);
|
|
318377
|
-
}
|
|
318378
|
-
};
|
|
318379
|
-
request_.on("error", (error48) => {
|
|
318380
|
-
reject(new FetchError(`request to ${request.url} failed, reason: ${error48.message}`, "system", error48));
|
|
318381
|
-
finalize2();
|
|
318382
|
-
});
|
|
318383
|
-
fixResponseChunkedTransferBadEnding(request_, (error48) => {
|
|
318384
|
-
if (response && response.body) {
|
|
318385
|
-
response.body.destroy(error48);
|
|
318386
|
-
}
|
|
318387
|
-
});
|
|
318388
|
-
if (process.version < "v14") {
|
|
318389
|
-
request_.on("socket", (s2) => {
|
|
318390
|
-
let endedWithEventsCount;
|
|
318391
|
-
s2.prependListener("end", () => {
|
|
318392
|
-
endedWithEventsCount = s2._eventsCount;
|
|
318393
|
-
});
|
|
318394
|
-
s2.prependListener("close", (hadError) => {
|
|
318395
|
-
if (response && endedWithEventsCount < s2._eventsCount && !hadError) {
|
|
318396
|
-
const error48 = new Error("Premature close");
|
|
318397
|
-
error48.code = "ERR_STREAM_PREMATURE_CLOSE";
|
|
318398
|
-
response.body.emit("error", error48);
|
|
318399
|
-
}
|
|
318400
|
-
});
|
|
318401
|
-
});
|
|
318402
|
-
}
|
|
318403
|
-
request_.on("response", (response_) => {
|
|
318404
|
-
request_.setTimeout(0);
|
|
318405
|
-
const headers = fromRawHeaders(response_.rawHeaders);
|
|
318406
|
-
if (isRedirect(response_.statusCode)) {
|
|
318407
|
-
const location = headers.get("Location");
|
|
318408
|
-
let locationURL = null;
|
|
318409
|
-
try {
|
|
318410
|
-
locationURL = location === null ? null : new URL(location, request.url);
|
|
318411
|
-
} catch {
|
|
318412
|
-
if (request.redirect !== "manual") {
|
|
318413
|
-
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
|
|
318414
|
-
finalize2();
|
|
318415
|
-
return;
|
|
318416
|
-
}
|
|
318417
|
-
}
|
|
318418
|
-
switch (request.redirect) {
|
|
318419
|
-
case "error":
|
|
318420
|
-
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
|
|
318421
|
-
finalize2();
|
|
318422
|
-
return;
|
|
318423
|
-
case "manual":
|
|
318424
|
-
break;
|
|
318425
|
-
case "follow": {
|
|
318426
|
-
if (locationURL === null) {
|
|
318427
|
-
break;
|
|
318428
|
-
}
|
|
318429
|
-
if (request.counter >= request.follow) {
|
|
318430
|
-
reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
|
|
318431
|
-
finalize2();
|
|
318432
|
-
return;
|
|
318433
|
-
}
|
|
318434
|
-
const requestOptions = {
|
|
318435
|
-
headers: new Headers2(request.headers),
|
|
318436
|
-
follow: request.follow,
|
|
318437
|
-
counter: request.counter + 1,
|
|
318438
|
-
agent: request.agent,
|
|
318439
|
-
compress: request.compress,
|
|
318440
|
-
method: request.method,
|
|
318441
|
-
body: clone(request),
|
|
318442
|
-
signal: request.signal,
|
|
318443
|
-
size: request.size,
|
|
318444
|
-
referrer: request.referrer,
|
|
318445
|
-
referrerPolicy: request.referrerPolicy
|
|
318446
|
-
};
|
|
318447
|
-
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
|
318448
|
-
for (const name2 of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
|
|
318449
|
-
requestOptions.headers.delete(name2);
|
|
318450
|
-
}
|
|
318451
|
-
}
|
|
318452
|
-
if (response_.statusCode !== 303 && request.body && options_.body instanceof import_node_stream2.default.Readable) {
|
|
318453
|
-
reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
|
|
318454
|
-
finalize2();
|
|
318455
|
-
return;
|
|
318456
|
-
}
|
|
318457
|
-
if (response_.statusCode === 303 || (response_.statusCode === 301 || response_.statusCode === 302) && request.method === "POST") {
|
|
318458
|
-
requestOptions.method = "GET";
|
|
318459
|
-
requestOptions.body = void 0;
|
|
318460
|
-
requestOptions.headers.delete("content-length");
|
|
318461
|
-
}
|
|
318462
|
-
const responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);
|
|
318463
|
-
if (responseReferrerPolicy) {
|
|
318464
|
-
requestOptions.referrerPolicy = responseReferrerPolicy;
|
|
318465
|
-
}
|
|
318466
|
-
resolve(fetch2(new Request2(locationURL, requestOptions)));
|
|
318467
|
-
finalize2();
|
|
318468
|
-
return;
|
|
318469
|
-
}
|
|
318470
|
-
default:
|
|
318471
|
-
return reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
|
|
318472
|
-
}
|
|
318473
|
-
}
|
|
318474
|
-
if (signal) {
|
|
318475
|
-
response_.once("end", () => {
|
|
318476
|
-
signal.removeEventListener("abort", abortAndFinalize);
|
|
318477
|
-
});
|
|
318478
|
-
}
|
|
318479
|
-
let body = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error48) => {
|
|
318480
|
-
if (error48) {
|
|
318481
|
-
reject(error48);
|
|
318482
|
-
}
|
|
318483
|
-
});
|
|
318484
|
-
if (process.version < "v12.10") {
|
|
318485
|
-
response_.on("aborted", abortAndFinalize);
|
|
318486
|
-
}
|
|
318487
|
-
const responseOptions = {
|
|
318488
|
-
url: request.url,
|
|
318489
|
-
status: response_.statusCode,
|
|
318490
|
-
statusText: response_.statusMessage,
|
|
318491
|
-
headers,
|
|
318492
|
-
size: request.size,
|
|
318493
|
-
counter: request.counter,
|
|
318494
|
-
highWaterMark: request.highWaterMark
|
|
318495
|
-
};
|
|
318496
|
-
const codings = headers.get("Content-Encoding");
|
|
318497
|
-
if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
|
|
318498
|
-
response = new Response2(body, responseOptions);
|
|
318499
|
-
resolve(response);
|
|
318500
|
-
return;
|
|
318501
|
-
}
|
|
318502
|
-
const zlibOptions = {
|
|
318503
|
-
flush: import_node_zlib.default.Z_SYNC_FLUSH,
|
|
318504
|
-
finishFlush: import_node_zlib.default.Z_SYNC_FLUSH
|
|
318505
|
-
};
|
|
318506
|
-
if (codings === "gzip" || codings === "x-gzip") {
|
|
318507
|
-
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error48) => {
|
|
318508
|
-
if (error48) {
|
|
318509
|
-
reject(error48);
|
|
318510
|
-
}
|
|
318511
|
-
});
|
|
318512
|
-
response = new Response2(body, responseOptions);
|
|
318513
|
-
resolve(response);
|
|
318514
|
-
return;
|
|
318515
|
-
}
|
|
318516
|
-
if (codings === "deflate" || codings === "x-deflate") {
|
|
318517
|
-
const raw = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error48) => {
|
|
318518
|
-
if (error48) {
|
|
318519
|
-
reject(error48);
|
|
318520
|
-
}
|
|
318521
|
-
});
|
|
318522
|
-
raw.once("data", (chunk) => {
|
|
318523
|
-
if ((chunk[0] & 15) === 8) {
|
|
318524
|
-
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflate(), (error48) => {
|
|
318525
|
-
if (error48) {
|
|
318526
|
-
reject(error48);
|
|
318527
|
-
}
|
|
318528
|
-
});
|
|
318529
|
-
} else {
|
|
318530
|
-
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error48) => {
|
|
318531
|
-
if (error48) {
|
|
318532
|
-
reject(error48);
|
|
318533
|
-
}
|
|
318534
|
-
});
|
|
318535
|
-
}
|
|
318536
|
-
response = new Response2(body, responseOptions);
|
|
318537
|
-
resolve(response);
|
|
318538
|
-
});
|
|
318539
|
-
raw.once("end", () => {
|
|
318540
|
-
if (!response) {
|
|
318541
|
-
response = new Response2(body, responseOptions);
|
|
318542
|
-
resolve(response);
|
|
318543
|
-
}
|
|
318544
|
-
});
|
|
318545
|
-
return;
|
|
318546
|
-
}
|
|
318547
|
-
if (codings === "br") {
|
|
318548
|
-
body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error48) => {
|
|
318549
|
-
if (error48) {
|
|
318550
|
-
reject(error48);
|
|
318551
|
-
}
|
|
318552
|
-
});
|
|
318553
|
-
response = new Response2(body, responseOptions);
|
|
318554
|
-
resolve(response);
|
|
318555
|
-
return;
|
|
318556
|
-
}
|
|
318557
|
-
response = new Response2(body, responseOptions);
|
|
318558
|
-
resolve(response);
|
|
318559
|
-
});
|
|
318560
|
-
writeToStream(request_, request).catch(reject);
|
|
318561
|
-
});
|
|
318562
|
-
}
|
|
318563
|
-
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
318564
|
-
const LAST_CHUNK = import_node_buffer2.Buffer.from("0\r\n\r\n");
|
|
318565
|
-
let isChunkedTransfer = false;
|
|
318566
|
-
let properLastChunkReceived = false;
|
|
318567
|
-
let previousChunk;
|
|
318568
|
-
request.on("response", (response) => {
|
|
318569
|
-
const { headers } = response;
|
|
318570
|
-
isChunkedTransfer = headers["transfer-encoding"] === "chunked" && !headers["content-length"];
|
|
318571
|
-
});
|
|
318572
|
-
request.on("socket", (socket) => {
|
|
318573
|
-
const onSocketClose = () => {
|
|
318574
|
-
if (isChunkedTransfer && !properLastChunkReceived) {
|
|
318575
|
-
const error48 = new Error("Premature close");
|
|
318576
|
-
error48.code = "ERR_STREAM_PREMATURE_CLOSE";
|
|
318577
|
-
errorCallback(error48);
|
|
318578
|
-
}
|
|
318579
|
-
};
|
|
318580
|
-
const onData = (buf) => {
|
|
318581
|
-
properLastChunkReceived = import_node_buffer2.Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;
|
|
318582
|
-
if (!properLastChunkReceived && previousChunk) {
|
|
318583
|
-
properLastChunkReceived = import_node_buffer2.Buffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 && import_node_buffer2.Buffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0;
|
|
318584
|
-
}
|
|
318585
|
-
previousChunk = buf;
|
|
318586
|
-
};
|
|
318587
|
-
socket.prependListener("close", onSocketClose);
|
|
318588
|
-
socket.on("data", onData);
|
|
318589
|
-
request.on("close", () => {
|
|
318590
|
-
socket.removeListener("close", onSocketClose);
|
|
318591
|
-
socket.removeListener("data", onData);
|
|
318592
|
-
});
|
|
318593
|
-
});
|
|
318594
|
-
}
|
|
318676
|
+
init_src();
|
|
318595
318677
|
|
|
318596
318678
|
// src/commands/auth/index.ts
|
|
318597
318679
|
init_helpers();
|