@discordjs/rest 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/index.d.mts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.js +40 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -5
- package/dist/index.mjs.map +1 -1
- package/dist/web.d.mts +17 -4
- package/dist/web.d.ts +17 -4
- package/dist/web.js +40 -5
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +40 -5
- package/dist/web.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -86,7 +86,7 @@ import { CDNRoutes } from "discord-api-types/v10";
|
|
|
86
86
|
// src/lib/utils/constants.ts
|
|
87
87
|
import { getUserAgentAppendix } from "@discordjs/util";
|
|
88
88
|
import { APIVersion } from "discord-api-types/v10";
|
|
89
|
-
var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.
|
|
89
|
+
var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.3)`;
|
|
90
90
|
var DefaultUserAgentAppendix = getUserAgentAppendix();
|
|
91
91
|
var DefaultRestOptions = {
|
|
92
92
|
agent: null,
|
|
@@ -223,10 +223,29 @@ function serializeSearchParam(value) {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
__name(serializeSearchParam, "serializeSearchParam");
|
|
226
|
-
function makeURLSearchParams(options) {
|
|
226
|
+
function makeURLSearchParams(parameters, options = {}) {
|
|
227
227
|
const params = new URLSearchParams();
|
|
228
|
-
if (!
|
|
229
|
-
|
|
228
|
+
if (!parameters) return params;
|
|
229
|
+
const { arrayFormat = "repeat" } = options;
|
|
230
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
231
|
+
if (Array.isArray(value)) {
|
|
232
|
+
const commaSeparatedElements = arrayFormat === "comma" ? [] : null;
|
|
233
|
+
for (const element of value) {
|
|
234
|
+
const serialized2 = serializeSearchParam(element);
|
|
235
|
+
if (serialized2 === null) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (commaSeparatedElements) {
|
|
239
|
+
commaSeparatedElements.push(serialized2);
|
|
240
|
+
} else {
|
|
241
|
+
params.append(key, serialized2);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (commaSeparatedElements?.length) {
|
|
245
|
+
params.append(key, commaSeparatedElements.join(","));
|
|
246
|
+
}
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
230
249
|
const serialized = serializeSearchParam(value);
|
|
231
250
|
if (serialized !== null) params.append(key, serialized);
|
|
232
251
|
}
|
|
@@ -302,6 +321,8 @@ var CDN = class {
|
|
|
302
321
|
this.cdn = cdn;
|
|
303
322
|
this.mediaProxy = mediaProxy;
|
|
304
323
|
}
|
|
324
|
+
cdn;
|
|
325
|
+
mediaProxy;
|
|
305
326
|
static {
|
|
306
327
|
__name(this, "CDN");
|
|
307
328
|
}
|
|
@@ -582,6 +603,11 @@ var DiscordAPIError = class _DiscordAPIError extends Error {
|
|
|
582
603
|
this.url = url;
|
|
583
604
|
this.requestBody = { files: bodyData.files, json: bodyData.body };
|
|
584
605
|
}
|
|
606
|
+
rawError;
|
|
607
|
+
code;
|
|
608
|
+
status;
|
|
609
|
+
method;
|
|
610
|
+
url;
|
|
585
611
|
static {
|
|
586
612
|
__name(this, "DiscordAPIError");
|
|
587
613
|
}
|
|
@@ -638,6 +664,9 @@ var HTTPError = class _HTTPError extends Error {
|
|
|
638
664
|
this.url = url;
|
|
639
665
|
this.requestBody = { files: bodyData.files, json: bodyData.body };
|
|
640
666
|
}
|
|
667
|
+
status;
|
|
668
|
+
method;
|
|
669
|
+
url;
|
|
641
670
|
static {
|
|
642
671
|
__name(this, "HTTPError");
|
|
643
672
|
}
|
|
@@ -738,6 +767,9 @@ var BurstHandler = class {
|
|
|
738
767
|
this.majorParameter = majorParameter;
|
|
739
768
|
this.id = `${hash}:${majorParameter}`;
|
|
740
769
|
}
|
|
770
|
+
manager;
|
|
771
|
+
hash;
|
|
772
|
+
majorParameter;
|
|
741
773
|
static {
|
|
742
774
|
__name(this, "BurstHandler");
|
|
743
775
|
}
|
|
@@ -845,6 +877,9 @@ var SequentialHandler = class {
|
|
|
845
877
|
this.majorParameter = majorParameter;
|
|
846
878
|
this.id = `${hash}:${majorParameter}`;
|
|
847
879
|
}
|
|
880
|
+
manager;
|
|
881
|
+
hash;
|
|
882
|
+
majorParameter;
|
|
848
883
|
static {
|
|
849
884
|
__name(this, "SequentialHandler");
|
|
850
885
|
}
|
|
@@ -1442,7 +1477,7 @@ var REST = class _REST extends AsyncEventEmitter {
|
|
|
1442
1477
|
};
|
|
1443
1478
|
|
|
1444
1479
|
// src/shared.ts
|
|
1445
|
-
var version = "2.6.
|
|
1480
|
+
var version = "2.6.3";
|
|
1446
1481
|
|
|
1447
1482
|
// src/index.ts
|
|
1448
1483
|
globalThis.FormData ??= FormData2;
|