@discordjs/rest 3.0.0-pr-11006.1765452229-e636950b2 → 3.0.0-pr-11005.1765454364-f3f6d34e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +25 -4
- package/dist/index.d.ts +25 -4
- package/dist/index.js +6 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -13
- package/dist/index.mjs.map +1 -1
- package/dist/strategies/undiciRequest.js +4 -9
- package/dist/strategies/undiciRequest.js.map +1 -1
- package/dist/strategies/undiciRequest.mjs +4 -9
- package/dist/strategies/undiciRequest.mjs.map +1 -1
- package/dist/web.d.mts +25 -4
- package/dist/web.d.ts +25 -4
- package/dist/web.js +2 -3
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +2 -3
- package/dist/web.mjs.map +1 -1
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -16,20 +16,15 @@ function getDefaultStrategy() {
|
|
|
16
16
|
__name(getDefaultStrategy, "getDefaultStrategy");
|
|
17
17
|
|
|
18
18
|
// src/strategies/undiciRequest.ts
|
|
19
|
-
import { Buffer as Buffer2 } from "buffer";
|
|
20
19
|
import { STATUS_CODES } from "http";
|
|
20
|
+
import { URLSearchParams as URLSearchParams2 } from "url";
|
|
21
21
|
import { types } from "util";
|
|
22
|
-
import { request, Headers, FormData as UndiciFormData
|
|
23
|
-
var localAgent = null;
|
|
22
|
+
import { request, Headers, FormData as UndiciFormData } from "undici";
|
|
24
23
|
async function makeRequest(url, init) {
|
|
25
24
|
const options = {
|
|
26
25
|
...init,
|
|
27
26
|
body: await resolveBody(init.body)
|
|
28
27
|
};
|
|
29
|
-
if (!options.dispatcher) {
|
|
30
|
-
localAgent ??= new Agent();
|
|
31
|
-
options.dispatcher = localAgent;
|
|
32
|
-
}
|
|
33
28
|
const res = await request(url, options);
|
|
34
29
|
return {
|
|
35
30
|
body: res.body,
|
|
@@ -61,7 +56,7 @@ async function resolveBody(body) {
|
|
|
61
56
|
return body;
|
|
62
57
|
} else if (types.isArrayBuffer(body)) {
|
|
63
58
|
return new Uint8Array(body);
|
|
64
|
-
} else if (body instanceof
|
|
59
|
+
} else if (body instanceof URLSearchParams2) {
|
|
65
60
|
return body.toString();
|
|
66
61
|
} else if (body instanceof DataView) {
|
|
67
62
|
return new Uint8Array(body.buffer);
|
|
@@ -73,13 +68,13 @@ async function resolveBody(body) {
|
|
|
73
68
|
return globalToUndiciFormData(body);
|
|
74
69
|
} else if (body[Symbol.iterator]) {
|
|
75
70
|
const chunks = [...body];
|
|
76
|
-
return
|
|
71
|
+
return Buffer.concat(chunks);
|
|
77
72
|
} else if (body[Symbol.asyncIterator]) {
|
|
78
73
|
const chunks = [];
|
|
79
74
|
for await (const chunk of body) {
|
|
80
75
|
chunks.push(chunk);
|
|
81
76
|
}
|
|
82
|
-
return
|
|
77
|
+
return Buffer.concat(chunks);
|
|
83
78
|
}
|
|
84
79
|
throw new TypeError(`Unable to resolve body.`);
|
|
85
80
|
}
|
|
@@ -103,7 +98,7 @@ import { CDNRoutes } from "discord-api-types/v10";
|
|
|
103
98
|
// src/lib/utils/constants.ts
|
|
104
99
|
import { getUserAgentAppendix } from "@discordjs/util";
|
|
105
100
|
import { APIVersion } from "discord-api-types/v10";
|
|
106
|
-
var DefaultUserAgent = `DiscordBot (https://discord.js.org, 3.0.0-pr-
|
|
101
|
+
var DefaultUserAgent = `DiscordBot (https://discord.js.org, 3.0.0-pr-11005.1765454364-f3f6d34e7)`;
|
|
107
102
|
var DefaultUserAgentAppendix = getUserAgentAppendix();
|
|
108
103
|
var DefaultRestOptions = {
|
|
109
104
|
agent: null,
|
|
@@ -1220,7 +1215,6 @@ var REST = class _REST extends AsyncEventEmitter {
|
|
|
1220
1215
|
handlerTimer;
|
|
1221
1216
|
options;
|
|
1222
1217
|
constructor(options = {}) {
|
|
1223
|
-
console.log("even rest got something new \u203C\uFE0F \u{1F5E3}\uFE0F \u{1F525}");
|
|
1224
1218
|
super();
|
|
1225
1219
|
this.cdn = new CDN(options);
|
|
1226
1220
|
this.options = { ...DefaultRestOptions, ...options };
|
|
@@ -1505,7 +1499,7 @@ var REST = class _REST extends AsyncEventEmitter {
|
|
|
1505
1499
|
};
|
|
1506
1500
|
|
|
1507
1501
|
// src/shared.ts
|
|
1508
|
-
var version = "3.0.0-pr-
|
|
1502
|
+
var version = "3.0.0-pr-11005.1765454364-f3f6d34e7";
|
|
1509
1503
|
|
|
1510
1504
|
// src/index.ts
|
|
1511
1505
|
setDefaultStrategy(shouldUseGlobalFetchAndWebSocket() ? fetch : makeRequest);
|