@discordjs/util 2.0.0-djs-file-upload.1761302390-5ae769c9e → 2.0.0-pr-11006.1765450224-e636950b2

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 CHANGED
@@ -1,8 +1,26 @@
1
+ import { APIEmbed, GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
2
+ import { Buffer } from 'node:buffer';
3
+
1
4
  /**
2
5
  * Represents a type that may or may not be a promise
3
6
  */
4
7
  type Awaitable<Value> = PromiseLike<Value> | Value;
5
8
 
9
+ /**
10
+ * Calculates the shard id for a given guild id.
11
+ *
12
+ * @param guildId - The guild id to calculate the shard id for
13
+ * @param shardCount - The total number of shards
14
+ */
15
+ declare function calculateShardId(guildId: string, shardCount: number): number;
16
+
17
+ /**
18
+ * Calculates the length of an embed.
19
+ *
20
+ * @param data - The embed data to check
21
+ */
22
+ declare function embedLength(data: APIEmbed): number;
23
+
6
24
  /**
7
25
  * Lazy is a wrapper around a value that is computed lazily. It is useful for
8
26
  * cases where the value is expensive to compute and the computation may not
@@ -62,14 +80,6 @@ interface RangeOptions {
62
80
  */
63
81
  declare function range(range: RangeOptions | number): Generator<number, void, unknown>;
64
82
 
65
- /**
66
- * Calculates the shard id for a given guild id.
67
- *
68
- * @param guildId - The guild id to calculate the shard id for
69
- * @param shardCount - The total number of shards
70
- */
71
- declare function calculateShardId(guildId: string, shardCount: number): number;
72
-
73
83
  declare function shouldUseGlobalFetchAndWebSocket(): boolean;
74
84
 
75
85
  /**
@@ -77,6 +87,39 @@ declare function shouldUseGlobalFetchAndWebSocket(): boolean;
77
87
  */
78
88
  declare function getUserAgentAppendix(): string;
79
89
 
90
+ /**
91
+ * Represents a file to be added to a request with multipart/form-data encoding
92
+ */
93
+ interface RawFile {
94
+ /**
95
+ * Content-Type of the file.
96
+ * If not provided, it will be inferred from the file data when possible
97
+ *
98
+ * @example 'image/png'
99
+ * @example 'application/pdf'
100
+ */
101
+ contentType?: string;
102
+ /**
103
+ * The actual data for the file
104
+ */
105
+ data: Buffer | Uint8Array | boolean | number | string;
106
+ /**
107
+ * An explicit key to use for the formdata field for this file.
108
+ * When not provided, the index of the file in the files array is used in the form `files[${index}]`.
109
+ * If you wish to alter the placeholder snowflake, you must provide this property in the same form (`files[${placeholder}]`)
110
+ */
111
+ key?: string;
112
+ /**
113
+ * The name of the file. This is the actual filename that will be used when uploading to Discord.
114
+ * This is also the name you'll use to reference the file with attachment:// URLs.
115
+ *
116
+ * @example 'image.png'
117
+ * @example 'document.pdf'
118
+ * @example 'SPOILER_secret.jpeg'
119
+ */
120
+ name: string;
121
+ }
122
+
80
123
  /**
81
124
  * Represents an object capable of representing itself as a JSON object
82
125
  *
@@ -94,6 +137,40 @@ interface JSONEncodable<Value> {
94
137
  * @param maybeEncodable - The object to check against
95
138
  */
96
139
  declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown>;
140
+ /**
141
+ * Result of encoding an object that includes file attachments
142
+ *
143
+ * @typeParam BodyValue - The JSON body type
144
+ */
145
+ interface FileBodyEncodableResult<BodyValue> {
146
+ /**
147
+ * The JSON body to send with the request
148
+ */
149
+ body: BodyValue;
150
+ /**
151
+ * The files to attach to the request
152
+ */
153
+ files: RawFile[];
154
+ }
155
+ /**
156
+ * Represents an object capable of representing itself as a request body with file attachments.
157
+ * Objects implementing this interface can separate JSON body data from binary file data,
158
+ * which is necessary for multipart/form-data requests.
159
+ *
160
+ * @typeParam BodyValue - The JSON body type
161
+ */
162
+ interface FileBodyEncodable<BodyValue> {
163
+ /**
164
+ * Transforms this object to its file body format, separating the JSON body from file attachments.
165
+ */
166
+ toFileBody(): FileBodyEncodableResult<BodyValue>;
167
+ }
168
+ /**
169
+ * Indicates if an object is file body encodable or not.
170
+ *
171
+ * @param maybeEncodable - The object to check against
172
+ */
173
+ declare function isFileBodyEncodable(maybeEncodable: unknown): maybeEncodable is FileBodyEncodable<unknown>;
97
174
 
98
175
  /**
99
176
  * Represents a structure that can be checked against another
@@ -114,6 +191,38 @@ interface Equatable<Value> {
114
191
  */
115
192
  declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown>;
116
193
 
194
+ /**
195
+ * Represents the error thrown when the gateway emits a `RATE_LIMITED` event after a certain request.
196
+ */
197
+ declare class GatewayRateLimitError extends Error {
198
+ /**
199
+ * The data associated with the rate limit event
200
+ */
201
+ readonly data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>;
202
+ /**
203
+ * The payload data that lead to this rate limit
204
+ *
205
+ * @privateRemarks
206
+ * Too complicated to type properly here (i.e. extract the ['data']
207
+ * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)
208
+ */
209
+ readonly payload: unknown;
210
+ readonly name: string;
211
+ constructor(
212
+ /**
213
+ * The data associated with the rate limit event
214
+ */
215
+ data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>,
216
+ /**
217
+ * The payload data that lead to this rate limit
218
+ *
219
+ * @privateRemarks
220
+ * Too complicated to type properly here (i.e. extract the ['data']
221
+ * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)
222
+ */
223
+ payload: unknown);
224
+ }
225
+
117
226
  /**
118
227
  * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version
119
228
  * that you are currently using.
@@ -122,4 +231,4 @@ declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatab
122
231
  */
123
232
  declare const version: string;
124
233
 
125
- export { type Awaitable, type Equatable, type JSONEncodable, type RangeOptions, calculateShardId, getUserAgentAppendix, isEquatable, isJSONEncodable, lazy, range, shouldUseGlobalFetchAndWebSocket, version };
234
+ export { type Awaitable, type Equatable, type FileBodyEncodable, type FileBodyEncodableResult, GatewayRateLimitError, type JSONEncodable, type RangeOptions, type RawFile, calculateShardId, embedLength, getUserAgentAppendix, isEquatable, isFileBodyEncodable, isJSONEncodable, lazy, range, shouldUseGlobalFetchAndWebSocket, version };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,26 @@
1
+ import { APIEmbed, GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
2
+ import { Buffer } from 'node:buffer';
3
+
1
4
  /**
2
5
  * Represents a type that may or may not be a promise
3
6
  */
4
7
  type Awaitable<Value> = PromiseLike<Value> | Value;
5
8
 
9
+ /**
10
+ * Calculates the shard id for a given guild id.
11
+ *
12
+ * @param guildId - The guild id to calculate the shard id for
13
+ * @param shardCount - The total number of shards
14
+ */
15
+ declare function calculateShardId(guildId: string, shardCount: number): number;
16
+
17
+ /**
18
+ * Calculates the length of an embed.
19
+ *
20
+ * @param data - The embed data to check
21
+ */
22
+ declare function embedLength(data: APIEmbed): number;
23
+
6
24
  /**
7
25
  * Lazy is a wrapper around a value that is computed lazily. It is useful for
8
26
  * cases where the value is expensive to compute and the computation may not
@@ -62,14 +80,6 @@ interface RangeOptions {
62
80
  */
63
81
  declare function range(range: RangeOptions | number): Generator<number, void, unknown>;
64
82
 
65
- /**
66
- * Calculates the shard id for a given guild id.
67
- *
68
- * @param guildId - The guild id to calculate the shard id for
69
- * @param shardCount - The total number of shards
70
- */
71
- declare function calculateShardId(guildId: string, shardCount: number): number;
72
-
73
83
  declare function shouldUseGlobalFetchAndWebSocket(): boolean;
74
84
 
75
85
  /**
@@ -77,6 +87,39 @@ declare function shouldUseGlobalFetchAndWebSocket(): boolean;
77
87
  */
78
88
  declare function getUserAgentAppendix(): string;
79
89
 
90
+ /**
91
+ * Represents a file to be added to a request with multipart/form-data encoding
92
+ */
93
+ interface RawFile {
94
+ /**
95
+ * Content-Type of the file.
96
+ * If not provided, it will be inferred from the file data when possible
97
+ *
98
+ * @example 'image/png'
99
+ * @example 'application/pdf'
100
+ */
101
+ contentType?: string;
102
+ /**
103
+ * The actual data for the file
104
+ */
105
+ data: Buffer | Uint8Array | boolean | number | string;
106
+ /**
107
+ * An explicit key to use for the formdata field for this file.
108
+ * When not provided, the index of the file in the files array is used in the form `files[${index}]`.
109
+ * If you wish to alter the placeholder snowflake, you must provide this property in the same form (`files[${placeholder}]`)
110
+ */
111
+ key?: string;
112
+ /**
113
+ * The name of the file. This is the actual filename that will be used when uploading to Discord.
114
+ * This is also the name you'll use to reference the file with attachment:// URLs.
115
+ *
116
+ * @example 'image.png'
117
+ * @example 'document.pdf'
118
+ * @example 'SPOILER_secret.jpeg'
119
+ */
120
+ name: string;
121
+ }
122
+
80
123
  /**
81
124
  * Represents an object capable of representing itself as a JSON object
82
125
  *
@@ -94,6 +137,40 @@ interface JSONEncodable<Value> {
94
137
  * @param maybeEncodable - The object to check against
95
138
  */
96
139
  declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown>;
140
+ /**
141
+ * Result of encoding an object that includes file attachments
142
+ *
143
+ * @typeParam BodyValue - The JSON body type
144
+ */
145
+ interface FileBodyEncodableResult<BodyValue> {
146
+ /**
147
+ * The JSON body to send with the request
148
+ */
149
+ body: BodyValue;
150
+ /**
151
+ * The files to attach to the request
152
+ */
153
+ files: RawFile[];
154
+ }
155
+ /**
156
+ * Represents an object capable of representing itself as a request body with file attachments.
157
+ * Objects implementing this interface can separate JSON body data from binary file data,
158
+ * which is necessary for multipart/form-data requests.
159
+ *
160
+ * @typeParam BodyValue - The JSON body type
161
+ */
162
+ interface FileBodyEncodable<BodyValue> {
163
+ /**
164
+ * Transforms this object to its file body format, separating the JSON body from file attachments.
165
+ */
166
+ toFileBody(): FileBodyEncodableResult<BodyValue>;
167
+ }
168
+ /**
169
+ * Indicates if an object is file body encodable or not.
170
+ *
171
+ * @param maybeEncodable - The object to check against
172
+ */
173
+ declare function isFileBodyEncodable(maybeEncodable: unknown): maybeEncodable is FileBodyEncodable<unknown>;
97
174
 
98
175
  /**
99
176
  * Represents a structure that can be checked against another
@@ -114,6 +191,38 @@ interface Equatable<Value> {
114
191
  */
115
192
  declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown>;
116
193
 
194
+ /**
195
+ * Represents the error thrown when the gateway emits a `RATE_LIMITED` event after a certain request.
196
+ */
197
+ declare class GatewayRateLimitError extends Error {
198
+ /**
199
+ * The data associated with the rate limit event
200
+ */
201
+ readonly data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>;
202
+ /**
203
+ * The payload data that lead to this rate limit
204
+ *
205
+ * @privateRemarks
206
+ * Too complicated to type properly here (i.e. extract the ['data']
207
+ * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)
208
+ */
209
+ readonly payload: unknown;
210
+ readonly name: string;
211
+ constructor(
212
+ /**
213
+ * The data associated with the rate limit event
214
+ */
215
+ data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>,
216
+ /**
217
+ * The payload data that lead to this rate limit
218
+ *
219
+ * @privateRemarks
220
+ * Too complicated to type properly here (i.e. extract the ['data']
221
+ * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)
222
+ */
223
+ payload: unknown);
224
+ }
225
+
117
226
  /**
118
227
  * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version
119
228
  * that you are currently using.
@@ -122,4 +231,4 @@ declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatab
122
231
  */
123
232
  declare const version: string;
124
233
 
125
- export { type Awaitable, type Equatable, type JSONEncodable, type RangeOptions, calculateShardId, getUserAgentAppendix, isEquatable, isJSONEncodable, lazy, range, shouldUseGlobalFetchAndWebSocket, version };
234
+ export { type Awaitable, type Equatable, type FileBodyEncodable, type FileBodyEncodableResult, GatewayRateLimitError, type JSONEncodable, type RangeOptions, type RawFile, calculateShardId, embedLength, getUserAgentAppendix, isEquatable, isFileBodyEncodable, isJSONEncodable, lazy, range, shouldUseGlobalFetchAndWebSocket, version };
package/dist/index.js CHANGED
@@ -21,9 +21,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  // src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
+ GatewayRateLimitError: () => GatewayRateLimitError,
24
25
  calculateShardId: () => calculateShardId,
26
+ embedLength: () => embedLength,
25
27
  getUserAgentAppendix: () => getUserAgentAppendix,
26
28
  isEquatable: () => isEquatable,
29
+ isFileBodyEncodable: () => isFileBodyEncodable,
27
30
  isJSONEncodable: () => isJSONEncodable,
28
31
  lazy: () => lazy,
29
32
  range: () => range,
@@ -32,6 +35,18 @@ __export(index_exports, {
32
35
  });
33
36
  module.exports = __toCommonJS(index_exports);
34
37
 
38
+ // src/functions/calculateShardId.ts
39
+ function calculateShardId(guildId, shardCount) {
40
+ return Number(BigInt(guildId) >> 22n) % shardCount;
41
+ }
42
+ __name(calculateShardId, "calculateShardId");
43
+
44
+ // src/functions/embedLength.ts
45
+ function embedLength(data) {
46
+ return (data.title?.length ?? 0) + (data.description?.length ?? 0) + (data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) + (data.footer?.text.length ?? 0) + (data.author?.name.length ?? 0);
47
+ }
48
+ __name(embedLength, "embedLength");
49
+
35
50
  // src/functions/lazy.ts
36
51
  function lazy(cb) {
37
52
  let defaultValue;
@@ -57,12 +72,6 @@ function* range(range2) {
57
72
  }
58
73
  __name(range, "range");
59
74
 
60
- // src/functions/calculateShardId.ts
61
- function calculateShardId(guildId, shardCount) {
62
- return Number(BigInt(guildId) >> 22n) % shardCount;
63
- }
64
- __name(calculateShardId, "calculateShardId");
65
-
66
75
  // src/functions/runtime.ts
67
76
  function shouldUseGlobalFetchAndWebSocket() {
68
77
  if (typeof globalThis.process === "undefined") {
@@ -107,11 +116,15 @@ function getUserAgentAppendix() {
107
116
  }
108
117
  __name(getUserAgentAppendix, "getUserAgentAppendix");
109
118
 
110
- // src/JSONEncodable.ts
119
+ // src/encodables.ts
111
120
  function isJSONEncodable(maybeEncodable) {
112
121
  return maybeEncodable !== null && typeof maybeEncodable === "object" && "toJSON" in maybeEncodable;
113
122
  }
114
123
  __name(isJSONEncodable, "isJSONEncodable");
124
+ function isFileBodyEncodable(maybeEncodable) {
125
+ return maybeEncodable !== null && typeof maybeEncodable === "object" && "toFileBody" in maybeEncodable;
126
+ }
127
+ __name(isFileBodyEncodable, "isFileBodyEncodable");
115
128
 
116
129
  // src/Equatable.ts
117
130
  function isEquatable(maybeEquatable) {
@@ -119,13 +132,29 @@ function isEquatable(maybeEquatable) {
119
132
  }
120
133
  __name(isEquatable, "isEquatable");
121
134
 
135
+ // src/gatewayRateLimitError.ts
136
+ var GatewayRateLimitError = class _GatewayRateLimitError extends Error {
137
+ constructor(data, payload) {
138
+ super(`Request with opcode ${data.opcode} was rate limited. Retry after ${data.retry_after} seconds.`);
139
+ this.data = data;
140
+ this.payload = payload;
141
+ }
142
+ static {
143
+ __name(this, "GatewayRateLimitError");
144
+ }
145
+ name = _GatewayRateLimitError.name;
146
+ };
147
+
122
148
  // src/index.ts
123
- var version = "2.0.0-djs-file-upload.1761302390-5ae769c9e";
149
+ var version = "2.0.0-pr-11006.1765450224-e636950b2";
124
150
  // Annotate the CommonJS export names for ESM import in node:
125
151
  0 && (module.exports = {
152
+ GatewayRateLimitError,
126
153
  calculateShardId,
154
+ embedLength,
127
155
  getUserAgentAppendix,
128
156
  isEquatable,
157
+ isFileBodyEncodable,
129
158
  isJSONEncodable,
130
159
  lazy,
131
160
  range,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/functions/lazy.ts","../src/functions/range.ts","../src/functions/calculateShardId.ts","../src/functions/runtime.ts","../src/functions/userAgentAppendix.ts","../src/JSONEncodable.ts","../src/Equatable.ts"],"sourcesContent":["export type * from './types.js';\nexport * from './functions/index.js';\nexport * from './JSONEncodable.js';\nexport * from './Equatable.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '2.0.0-djs-file-upload.1761302390-5ae769c9e' as string;\n","/**\n * Lazy is a wrapper around a value that is computed lazily. It is useful for\n * cases where the value is expensive to compute and the computation may not\n * be needed at all.\n *\n * @param cb - The callback to lazily evaluate\n * @typeParam Value - The type of the value\n * @example\n * ```ts\n * const value = lazy(() => computeExpensiveValue());\n * ```\n */\n// eslint-disable-next-line promise/prefer-await-to-callbacks\nexport function lazy<Value>(cb: () => Value): () => Value {\n\tlet defaultValue: Value;\n\t// eslint-disable-next-line promise/prefer-await-to-callbacks\n\treturn () => (defaultValue ??= cb());\n}\n","/**\n * Options for creating a range\n */\nexport interface RangeOptions {\n\t/**\n\t * The end of the range (exclusive)\n\t */\n\tend: number;\n\t/**\n\t * The start of the range (inclusive)\n\t */\n\tstart: number;\n\t/**\n\t * The amount to increment by\n\t *\n\t * @defaultValue `1`\n\t */\n\tstep?: number;\n}\n\n/**\n * A generator to yield numbers in a given range\n *\n * @remarks\n * This method is end-exclusive, for example the last number yielded by `range(5)` is 4. If you\n * prefer for the end to be included add 1 to the range or `end` option.\n * @param range - A number representing the range to yield (exclusive) or an object with start, end and step\n * @example\n * Basic range\n * ```ts\n * for (const number of range(5)) {\n * console.log(number);\n * }\n * // Prints 0, 1, 2, 3, 4\n * ```\n * @example\n * Range with a step\n * ```ts\n * for (const number of range({ start: 3, end: 10, step: 2 })) {\n * \tconsole.log(number);\n * }\n * // Prints 3, 5, 7, 9\n * ```\n */\nexport function* range(range: RangeOptions | number) {\n\tlet rangeEnd: number;\n\tlet start = 0;\n\tlet step = 1;\n\n\tif (typeof range === 'number') {\n\t\trangeEnd = range;\n\t} else {\n\t\tstart = range.start;\n\t\trangeEnd = range.end;\n\t\tstep = range.step ?? 1;\n\t}\n\n\tfor (let index = start; index < rangeEnd; index += step) {\n\t\tyield index;\n\t}\n}\n","/**\n * Calculates the shard id for a given guild id.\n *\n * @param guildId - The guild id to calculate the shard id for\n * @param shardCount - The total number of shards\n */\nexport function calculateShardId(guildId: string, shardCount: number) {\n\treturn Number(BigInt(guildId) >> 22n) % shardCount;\n}\n","/* eslint-disable n/prefer-global/process */\n\nexport function shouldUseGlobalFetchAndWebSocket() {\n\t// Browser env and deno when ran directly\n\tif (typeof globalThis.process === 'undefined') {\n\t\treturn 'fetch' in globalThis && 'WebSocket' in globalThis;\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\treturn 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;\n\t}\n\n\treturn false;\n}\n","/* eslint-disable n/prefer-global/process */\n\n/**\n * Resolves the user agent appendix string for the current environment.\n */\nexport function getUserAgentAppendix(): string {\n\t// https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime#check-if-you're-running-on-the-edge-runtime\n\t// @ts-expect-error Vercel Edge functions\n\tif (typeof globalThis.EdgeRuntime !== 'undefined') {\n\t\treturn 'Vercel-Edge-Functions';\n\t}\n\n\t// @ts-expect-error Cloudflare Workers\n\tif (typeof globalThis.R2 !== 'undefined' && typeof globalThis.WebSocketPair !== 'undefined') {\n\t\t// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\t\treturn 'Cloudflare-Workers';\n\t}\n\n\t// https://docs.netlify.com/edge-functions/api/#netlify-global-object\n\t// @ts-expect-error Netlify Edge functions\n\tif (typeof globalThis.Netlify !== 'undefined') {\n\t\treturn 'Netlify-Edge-Functions';\n\t}\n\n\t// Most (if not all) edge environments will have `process` defined. Within a web browser we'll extract it using `navigator.userAgent`.\n\tif (typeof globalThis.process !== 'object') {\n\t\tif (typeof globalThis.navigator === 'object') {\n\t\t\treturn globalThis.navigator.userAgent;\n\t\t}\n\n\t\treturn 'UnknownEnvironment';\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\tif ('deno' in globalThis.process.versions) {\n\t\t\treturn `Deno/${globalThis.process.versions.deno}`;\n\t\t}\n\n\t\tif ('bun' in globalThis.process.versions) {\n\t\t\treturn `Bun/${globalThis.process.versions.bun}`;\n\t\t}\n\n\t\tif ('node' in globalThis.process.versions) {\n\t\t\treturn `Node.js/${globalThis.process.versions.node}`;\n\t\t}\n\t}\n\n\treturn 'UnknownEnvironment';\n}\n","/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam Value - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<Value> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON(): Value;\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n","/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam Value - The type of object to compare the current object to\n */\nexport interface Equatable<Value> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals(other: Value): boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n *\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,KAAY,IAA8B;AACzD,MAAI;AAEJ,SAAO,MAAO,iBAAiB,GAAG;AACnC;AAJgB;;;AC+BT,UAAU,MAAMA,QAA8B;AACpD,MAAI;AACJ,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,OAAOA,WAAU,UAAU;AAC9B,eAAWA;AAAA,EACZ,OAAO;AACN,YAAQA,OAAM;AACd,eAAWA,OAAM;AACjB,WAAOA,OAAM,QAAQ;AAAA,EACtB;AAEA,WAAS,QAAQ,OAAO,QAAQ,UAAU,SAAS,MAAM;AACxD,UAAM;AAAA,EACP;AACD;AAhBiB;;;ACtCV,SAAS,iBAAiB,SAAiB,YAAoB;AACrE,SAAO,OAAO,OAAO,OAAO,KAAK,GAAG,IAAI;AACzC;AAFgB;;;ACJT,SAAS,mCAAmC;AAElD,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO,WAAW,cAAc,eAAe;AAAA,EAChD;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,WAAO,UAAU,WAAW,QAAQ,YAAY,SAAS,WAAW,QAAQ;AAAA,EAC7E;AAEA,SAAO;AACR;AAXgB;;;ACGT,SAAS,uBAA+B;AAG9C,MAAI,OAAO,WAAW,gBAAgB,aAAa;AAClD,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,OAAO,eAAe,OAAO,WAAW,kBAAkB,aAAa;AAE5F,WAAO;AAAA,EACR;AAIA,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,YAAY,UAAU;AAC3C,QAAI,OAAO,WAAW,cAAc,UAAU;AAC7C,aAAO,WAAW,UAAU;AAAA,IAC7B;AAEA,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI;AAAA,IAChD;AAEA,QAAI,SAAS,WAAW,QAAQ,UAAU;AACzC,aAAO,OAAO,WAAW,QAAQ,SAAS,GAAG;AAAA,IAC9C;AAEA,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,WAAW,WAAW,QAAQ,SAAS,IAAI;AAAA,IACnD;AAAA,EACD;AAEA,SAAO;AACR;AA3CgB;;;ACYT,SAAS,gBAAgB,gBAAmE;AAClG,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;;;ACCT,SAAS,YAAY,gBAA+D;AAC1F,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;;;APPT,IAAM,UAAU;","names":["range"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/functions/calculateShardId.ts","../src/functions/embedLength.ts","../src/functions/lazy.ts","../src/functions/range.ts","../src/functions/runtime.ts","../src/functions/userAgentAppendix.ts","../src/encodables.ts","../src/Equatable.ts","../src/gatewayRateLimitError.ts"],"sourcesContent":["export type * from './types.js';\nexport * from './functions/index.js';\nexport * from './encodables.js';\nexport type * from './RawFile.js';\nexport * from './Equatable.js';\nexport * from './gatewayRateLimitError.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '2.0.0-pr-11006.1765450224-e636950b2' as string;\n","/**\n * Calculates the shard id for a given guild id.\n *\n * @param guildId - The guild id to calculate the shard id for\n * @param shardCount - The total number of shards\n */\nexport function calculateShardId(guildId: string, shardCount: number) {\n\treturn Number(BigInt(guildId) >> 22n) % shardCount;\n}\n","import type { APIEmbed } from 'discord-api-types/v10';\n\n/**\n * Calculates the length of an embed.\n *\n * @param data - The embed data to check\n */\nexport function embedLength(data: APIEmbed) {\n\treturn (\n\t\t(data.title?.length ?? 0) +\n\t\t(data.description?.length ?? 0) +\n\t\t(data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) +\n\t\t(data.footer?.text.length ?? 0) +\n\t\t(data.author?.name.length ?? 0)\n\t);\n}\n","/**\n * Lazy is a wrapper around a value that is computed lazily. It is useful for\n * cases where the value is expensive to compute and the computation may not\n * be needed at all.\n *\n * @param cb - The callback to lazily evaluate\n * @typeParam Value - The type of the value\n * @example\n * ```ts\n * const value = lazy(() => computeExpensiveValue());\n * ```\n */\n// eslint-disable-next-line promise/prefer-await-to-callbacks\nexport function lazy<Value>(cb: () => Value): () => Value {\n\tlet defaultValue: Value;\n\t// eslint-disable-next-line promise/prefer-await-to-callbacks\n\treturn () => (defaultValue ??= cb());\n}\n","/**\n * Options for creating a range\n */\nexport interface RangeOptions {\n\t/**\n\t * The end of the range (exclusive)\n\t */\n\tend: number;\n\t/**\n\t * The start of the range (inclusive)\n\t */\n\tstart: number;\n\t/**\n\t * The amount to increment by\n\t *\n\t * @defaultValue `1`\n\t */\n\tstep?: number;\n}\n\n/**\n * A generator to yield numbers in a given range\n *\n * @remarks\n * This method is end-exclusive, for example the last number yielded by `range(5)` is 4. If you\n * prefer for the end to be included add 1 to the range or `end` option.\n * @param range - A number representing the range to yield (exclusive) or an object with start, end and step\n * @example\n * Basic range\n * ```ts\n * for (const number of range(5)) {\n * console.log(number);\n * }\n * // Prints 0, 1, 2, 3, 4\n * ```\n * @example\n * Range with a step\n * ```ts\n * for (const number of range({ start: 3, end: 10, step: 2 })) {\n * \tconsole.log(number);\n * }\n * // Prints 3, 5, 7, 9\n * ```\n */\nexport function* range(range: RangeOptions | number) {\n\tlet rangeEnd: number;\n\tlet start = 0;\n\tlet step = 1;\n\n\tif (typeof range === 'number') {\n\t\trangeEnd = range;\n\t} else {\n\t\tstart = range.start;\n\t\trangeEnd = range.end;\n\t\tstep = range.step ?? 1;\n\t}\n\n\tfor (let index = start; index < rangeEnd; index += step) {\n\t\tyield index;\n\t}\n}\n","/* eslint-disable n/prefer-global/process */\n\nexport function shouldUseGlobalFetchAndWebSocket() {\n\t// Browser env and deno when ran directly\n\tif (typeof globalThis.process === 'undefined') {\n\t\treturn 'fetch' in globalThis && 'WebSocket' in globalThis;\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\treturn 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;\n\t}\n\n\treturn false;\n}\n","/* eslint-disable n/prefer-global/process */\n\n/**\n * Resolves the user agent appendix string for the current environment.\n */\nexport function getUserAgentAppendix(): string {\n\t// https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime#check-if-you're-running-on-the-edge-runtime\n\t// @ts-expect-error Vercel Edge functions\n\tif (typeof globalThis.EdgeRuntime !== 'undefined') {\n\t\treturn 'Vercel-Edge-Functions';\n\t}\n\n\t// @ts-expect-error Cloudflare Workers\n\tif (typeof globalThis.R2 !== 'undefined' && typeof globalThis.WebSocketPair !== 'undefined') {\n\t\t// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\t\treturn 'Cloudflare-Workers';\n\t}\n\n\t// https://docs.netlify.com/edge-functions/api/#netlify-global-object\n\t// @ts-expect-error Netlify Edge functions\n\tif (typeof globalThis.Netlify !== 'undefined') {\n\t\treturn 'Netlify-Edge-Functions';\n\t}\n\n\t// Most (if not all) edge environments will have `process` defined. Within a web browser we'll extract it using `navigator.userAgent`.\n\tif (typeof globalThis.process !== 'object') {\n\t\tif (typeof globalThis.navigator === 'object') {\n\t\t\treturn globalThis.navigator.userAgent;\n\t\t}\n\n\t\treturn 'UnknownEnvironment';\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\tif ('deno' in globalThis.process.versions) {\n\t\t\treturn `Deno/${globalThis.process.versions.deno}`;\n\t\t}\n\n\t\tif ('bun' in globalThis.process.versions) {\n\t\t\treturn `Bun/${globalThis.process.versions.bun}`;\n\t\t}\n\n\t\tif ('node' in globalThis.process.versions) {\n\t\t\treturn `Node.js/${globalThis.process.versions.node}`;\n\t\t}\n\t}\n\n\treturn 'UnknownEnvironment';\n}\n","import type { RawFile } from './RawFile.js';\n\n/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam Value - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<Value> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON(): Value;\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n\n/**\n * Result of encoding an object that includes file attachments\n *\n * @typeParam BodyValue - The JSON body type\n */\nexport interface FileBodyEncodableResult<BodyValue> {\n\t/**\n\t * The JSON body to send with the request\n\t */\n\tbody: BodyValue;\n\t/**\n\t * The files to attach to the request\n\t */\n\tfiles: RawFile[];\n}\n\n/**\n * Represents an object capable of representing itself as a request body with file attachments.\n * Objects implementing this interface can separate JSON body data from binary file data,\n * which is necessary for multipart/form-data requests.\n *\n * @typeParam BodyValue - The JSON body type\n */\nexport interface FileBodyEncodable<BodyValue> {\n\t/**\n\t * Transforms this object to its file body format, separating the JSON body from file attachments.\n\t */\n\ttoFileBody(): FileBodyEncodableResult<BodyValue>;\n}\n\n/**\n * Indicates if an object is file body encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isFileBodyEncodable(maybeEncodable: unknown): maybeEncodable is FileBodyEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toFileBody' in maybeEncodable;\n}\n","/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam Value - The type of object to compare the current object to\n */\nexport interface Equatable<Value> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals(other: Value): boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n *\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n","import type { GatewayOpcodeRateLimitMetadataMap, GatewayRateLimitedDispatchData } from 'discord-api-types/v10';\n\n/**\n * Represents the error thrown when the gateway emits a `RATE_LIMITED` event after a certain request.\n */\nexport class GatewayRateLimitError extends Error {\n\tpublic override readonly name = GatewayRateLimitError.name;\n\n\tpublic constructor(\n\t\t/**\n\t\t * The data associated with the rate limit event\n\t\t */\n\t\tpublic readonly data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>,\n\t\t/**\n\t\t * The payload data that lead to this rate limit\n\t\t *\n\t\t * @privateRemarks\n\t\t * Too complicated to type properly here (i.e. extract the ['data']\n\t\t * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)\n\t\t */\n\t\tpublic readonly payload: unknown,\n\t) {\n\t\tsuper(`Request with opcode ${data.opcode} was rate limited. Retry after ${data.retry_after} seconds.`);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,SAAS,iBAAiB,SAAiB,YAAoB;AACrE,SAAO,OAAO,OAAO,OAAO,KAAK,GAAG,IAAI;AACzC;AAFgB;;;ACCT,SAAS,YAAY,MAAgB;AAC3C,UACE,KAAK,OAAO,UAAU,MACtB,KAAK,aAAa,UAAU,MAC5B,KAAK,QAAQ,OAAO,CAAC,MAAM,SAAS,OAAO,KAAK,KAAK,SAAS,KAAK,MAAM,QAAQ,CAAC,KAAK,MACvF,KAAK,QAAQ,KAAK,UAAU,MAC5B,KAAK,QAAQ,KAAK,UAAU;AAE/B;AARgB;;;ACMT,SAAS,KAAY,IAA8B;AACzD,MAAI;AAEJ,SAAO,MAAO,iBAAiB,GAAG;AACnC;AAJgB;;;AC+BT,UAAU,MAAMA,QAA8B;AACpD,MAAI;AACJ,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,OAAOA,WAAU,UAAU;AAC9B,eAAWA;AAAA,EACZ,OAAO;AACN,YAAQA,OAAM;AACd,eAAWA,OAAM;AACjB,WAAOA,OAAM,QAAQ;AAAA,EACtB;AAEA,WAAS,QAAQ,OAAO,QAAQ,UAAU,SAAS,MAAM;AACxD,UAAM;AAAA,EACP;AACD;AAhBiB;;;AC1CV,SAAS,mCAAmC;AAElD,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO,WAAW,cAAc,eAAe;AAAA,EAChD;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,WAAO,UAAU,WAAW,QAAQ,YAAY,SAAS,WAAW,QAAQ;AAAA,EAC7E;AAEA,SAAO;AACR;AAXgB;;;ACGT,SAAS,uBAA+B;AAG9C,MAAI,OAAO,WAAW,gBAAgB,aAAa;AAClD,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,OAAO,eAAe,OAAO,WAAW,kBAAkB,aAAa;AAE5F,WAAO;AAAA,EACR;AAIA,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,YAAY,UAAU;AAC3C,QAAI,OAAO,WAAW,cAAc,UAAU;AAC7C,aAAO,WAAW,UAAU;AAAA,IAC7B;AAEA,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI;AAAA,IAChD;AAEA,QAAI,SAAS,WAAW,QAAQ,UAAU;AACzC,aAAO,OAAO,WAAW,QAAQ,SAAS,GAAG;AAAA,IAC9C;AAEA,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,WAAW,WAAW,QAAQ,SAAS,IAAI;AAAA,IACnD;AAAA,EACD;AAEA,SAAO;AACR;AA3CgB;;;ACcT,SAAS,gBAAgB,gBAAmE;AAClG,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;AAuCT,SAAS,oBAAoB,gBAAuE;AAC1G,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,gBAAgB;AACzF;AAFgB;;;ACxCT,SAAS,YAAY,gBAA+D;AAC1F,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;;;ACbT,IAAM,wBAAN,MAAM,+BAA8B,MAAM;AAAA,EAGzC,YAIU,MAQA,SACf;AACD,UAAM,uBAAuB,KAAK,MAAM,kCAAkC,KAAK,WAAW,WAAW;AAVrF;AAQA;AAAA,EAGjB;AAAA,EAvBD,OAKiD;AAAA;AAAA;AAAA,EACvB,OAAO,uBAAsB;AAkBvD;;;ATXO,IAAM,UAAU;","names":["range"]}
package/dist/index.mjs CHANGED
@@ -1,6 +1,18 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
+ // src/functions/calculateShardId.ts
5
+ function calculateShardId(guildId, shardCount) {
6
+ return Number(BigInt(guildId) >> 22n) % shardCount;
7
+ }
8
+ __name(calculateShardId, "calculateShardId");
9
+
10
+ // src/functions/embedLength.ts
11
+ function embedLength(data) {
12
+ return (data.title?.length ?? 0) + (data.description?.length ?? 0) + (data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) + (data.footer?.text.length ?? 0) + (data.author?.name.length ?? 0);
13
+ }
14
+ __name(embedLength, "embedLength");
15
+
4
16
  // src/functions/lazy.ts
5
17
  function lazy(cb) {
6
18
  let defaultValue;
@@ -26,12 +38,6 @@ function* range(range2) {
26
38
  }
27
39
  __name(range, "range");
28
40
 
29
- // src/functions/calculateShardId.ts
30
- function calculateShardId(guildId, shardCount) {
31
- return Number(BigInt(guildId) >> 22n) % shardCount;
32
- }
33
- __name(calculateShardId, "calculateShardId");
34
-
35
41
  // src/functions/runtime.ts
36
42
  function shouldUseGlobalFetchAndWebSocket() {
37
43
  if (typeof globalThis.process === "undefined") {
@@ -76,11 +82,15 @@ function getUserAgentAppendix() {
76
82
  }
77
83
  __name(getUserAgentAppendix, "getUserAgentAppendix");
78
84
 
79
- // src/JSONEncodable.ts
85
+ // src/encodables.ts
80
86
  function isJSONEncodable(maybeEncodable) {
81
87
  return maybeEncodable !== null && typeof maybeEncodable === "object" && "toJSON" in maybeEncodable;
82
88
  }
83
89
  __name(isJSONEncodable, "isJSONEncodable");
90
+ function isFileBodyEncodable(maybeEncodable) {
91
+ return maybeEncodable !== null && typeof maybeEncodable === "object" && "toFileBody" in maybeEncodable;
92
+ }
93
+ __name(isFileBodyEncodable, "isFileBodyEncodable");
84
94
 
85
95
  // src/Equatable.ts
86
96
  function isEquatable(maybeEquatable) {
@@ -88,12 +98,28 @@ function isEquatable(maybeEquatable) {
88
98
  }
89
99
  __name(isEquatable, "isEquatable");
90
100
 
101
+ // src/gatewayRateLimitError.ts
102
+ var GatewayRateLimitError = class _GatewayRateLimitError extends Error {
103
+ constructor(data, payload) {
104
+ super(`Request with opcode ${data.opcode} was rate limited. Retry after ${data.retry_after} seconds.`);
105
+ this.data = data;
106
+ this.payload = payload;
107
+ }
108
+ static {
109
+ __name(this, "GatewayRateLimitError");
110
+ }
111
+ name = _GatewayRateLimitError.name;
112
+ };
113
+
91
114
  // src/index.ts
92
- var version = "2.0.0-djs-file-upload.1761302390-5ae769c9e";
115
+ var version = "2.0.0-pr-11006.1765450224-e636950b2";
93
116
  export {
117
+ GatewayRateLimitError,
94
118
  calculateShardId,
119
+ embedLength,
95
120
  getUserAgentAppendix,
96
121
  isEquatable,
122
+ isFileBodyEncodable,
97
123
  isJSONEncodable,
98
124
  lazy,
99
125
  range,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/functions/lazy.ts","../src/functions/range.ts","../src/functions/calculateShardId.ts","../src/functions/runtime.ts","../src/functions/userAgentAppendix.ts","../src/JSONEncodable.ts","../src/Equatable.ts","../src/index.ts"],"sourcesContent":["/**\n * Lazy is a wrapper around a value that is computed lazily. It is useful for\n * cases where the value is expensive to compute and the computation may not\n * be needed at all.\n *\n * @param cb - The callback to lazily evaluate\n * @typeParam Value - The type of the value\n * @example\n * ```ts\n * const value = lazy(() => computeExpensiveValue());\n * ```\n */\n// eslint-disable-next-line promise/prefer-await-to-callbacks\nexport function lazy<Value>(cb: () => Value): () => Value {\n\tlet defaultValue: Value;\n\t// eslint-disable-next-line promise/prefer-await-to-callbacks\n\treturn () => (defaultValue ??= cb());\n}\n","/**\n * Options for creating a range\n */\nexport interface RangeOptions {\n\t/**\n\t * The end of the range (exclusive)\n\t */\n\tend: number;\n\t/**\n\t * The start of the range (inclusive)\n\t */\n\tstart: number;\n\t/**\n\t * The amount to increment by\n\t *\n\t * @defaultValue `1`\n\t */\n\tstep?: number;\n}\n\n/**\n * A generator to yield numbers in a given range\n *\n * @remarks\n * This method is end-exclusive, for example the last number yielded by `range(5)` is 4. If you\n * prefer for the end to be included add 1 to the range or `end` option.\n * @param range - A number representing the range to yield (exclusive) or an object with start, end and step\n * @example\n * Basic range\n * ```ts\n * for (const number of range(5)) {\n * console.log(number);\n * }\n * // Prints 0, 1, 2, 3, 4\n * ```\n * @example\n * Range with a step\n * ```ts\n * for (const number of range({ start: 3, end: 10, step: 2 })) {\n * \tconsole.log(number);\n * }\n * // Prints 3, 5, 7, 9\n * ```\n */\nexport function* range(range: RangeOptions | number) {\n\tlet rangeEnd: number;\n\tlet start = 0;\n\tlet step = 1;\n\n\tif (typeof range === 'number') {\n\t\trangeEnd = range;\n\t} else {\n\t\tstart = range.start;\n\t\trangeEnd = range.end;\n\t\tstep = range.step ?? 1;\n\t}\n\n\tfor (let index = start; index < rangeEnd; index += step) {\n\t\tyield index;\n\t}\n}\n","/**\n * Calculates the shard id for a given guild id.\n *\n * @param guildId - The guild id to calculate the shard id for\n * @param shardCount - The total number of shards\n */\nexport function calculateShardId(guildId: string, shardCount: number) {\n\treturn Number(BigInt(guildId) >> 22n) % shardCount;\n}\n","/* eslint-disable n/prefer-global/process */\n\nexport function shouldUseGlobalFetchAndWebSocket() {\n\t// Browser env and deno when ran directly\n\tif (typeof globalThis.process === 'undefined') {\n\t\treturn 'fetch' in globalThis && 'WebSocket' in globalThis;\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\treturn 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;\n\t}\n\n\treturn false;\n}\n","/* eslint-disable n/prefer-global/process */\n\n/**\n * Resolves the user agent appendix string for the current environment.\n */\nexport function getUserAgentAppendix(): string {\n\t// https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime#check-if-you're-running-on-the-edge-runtime\n\t// @ts-expect-error Vercel Edge functions\n\tif (typeof globalThis.EdgeRuntime !== 'undefined') {\n\t\treturn 'Vercel-Edge-Functions';\n\t}\n\n\t// @ts-expect-error Cloudflare Workers\n\tif (typeof globalThis.R2 !== 'undefined' && typeof globalThis.WebSocketPair !== 'undefined') {\n\t\t// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\t\treturn 'Cloudflare-Workers';\n\t}\n\n\t// https://docs.netlify.com/edge-functions/api/#netlify-global-object\n\t// @ts-expect-error Netlify Edge functions\n\tif (typeof globalThis.Netlify !== 'undefined') {\n\t\treturn 'Netlify-Edge-Functions';\n\t}\n\n\t// Most (if not all) edge environments will have `process` defined. Within a web browser we'll extract it using `navigator.userAgent`.\n\tif (typeof globalThis.process !== 'object') {\n\t\tif (typeof globalThis.navigator === 'object') {\n\t\t\treturn globalThis.navigator.userAgent;\n\t\t}\n\n\t\treturn 'UnknownEnvironment';\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\tif ('deno' in globalThis.process.versions) {\n\t\t\treturn `Deno/${globalThis.process.versions.deno}`;\n\t\t}\n\n\t\tif ('bun' in globalThis.process.versions) {\n\t\t\treturn `Bun/${globalThis.process.versions.bun}`;\n\t\t}\n\n\t\tif ('node' in globalThis.process.versions) {\n\t\t\treturn `Node.js/${globalThis.process.versions.node}`;\n\t\t}\n\t}\n\n\treturn 'UnknownEnvironment';\n}\n","/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam Value - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<Value> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON(): Value;\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n","/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam Value - The type of object to compare the current object to\n */\nexport interface Equatable<Value> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals(other: Value): boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n *\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n","export type * from './types.js';\nexport * from './functions/index.js';\nexport * from './JSONEncodable.js';\nexport * from './Equatable.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '2.0.0-djs-file-upload.1761302390-5ae769c9e' as string;\n"],"mappings":";;;;AAaO,SAAS,KAAY,IAA8B;AACzD,MAAI;AAEJ,SAAO,MAAO,iBAAiB,GAAG;AACnC;AAJgB;;;AC+BT,UAAU,MAAMA,QAA8B;AACpD,MAAI;AACJ,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,OAAOA,WAAU,UAAU;AAC9B,eAAWA;AAAA,EACZ,OAAO;AACN,YAAQA,OAAM;AACd,eAAWA,OAAM;AACjB,WAAOA,OAAM,QAAQ;AAAA,EACtB;AAEA,WAAS,QAAQ,OAAO,QAAQ,UAAU,SAAS,MAAM;AACxD,UAAM;AAAA,EACP;AACD;AAhBiB;;;ACtCV,SAAS,iBAAiB,SAAiB,YAAoB;AACrE,SAAO,OAAO,OAAO,OAAO,KAAK,GAAG,IAAI;AACzC;AAFgB;;;ACJT,SAAS,mCAAmC;AAElD,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO,WAAW,cAAc,eAAe;AAAA,EAChD;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,WAAO,UAAU,WAAW,QAAQ,YAAY,SAAS,WAAW,QAAQ;AAAA,EAC7E;AAEA,SAAO;AACR;AAXgB;;;ACGT,SAAS,uBAA+B;AAG9C,MAAI,OAAO,WAAW,gBAAgB,aAAa;AAClD,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,OAAO,eAAe,OAAO,WAAW,kBAAkB,aAAa;AAE5F,WAAO;AAAA,EACR;AAIA,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,YAAY,UAAU;AAC3C,QAAI,OAAO,WAAW,cAAc,UAAU;AAC7C,aAAO,WAAW,UAAU;AAAA,IAC7B;AAEA,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI;AAAA,IAChD;AAEA,QAAI,SAAS,WAAW,QAAQ,UAAU;AACzC,aAAO,OAAO,WAAW,QAAQ,SAAS,GAAG;AAAA,IAC9C;AAEA,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,WAAW,WAAW,QAAQ,SAAS,IAAI;AAAA,IACnD;AAAA,EACD;AAEA,SAAO;AACR;AA3CgB;;;ACYT,SAAS,gBAAgB,gBAAmE;AAClG,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;;;ACCT,SAAS,YAAY,gBAA+D;AAC1F,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;;;ACPT,IAAM,UAAU;","names":["range"]}
1
+ {"version":3,"sources":["../src/functions/calculateShardId.ts","../src/functions/embedLength.ts","../src/functions/lazy.ts","../src/functions/range.ts","../src/functions/runtime.ts","../src/functions/userAgentAppendix.ts","../src/encodables.ts","../src/Equatable.ts","../src/gatewayRateLimitError.ts","../src/index.ts"],"sourcesContent":["/**\n * Calculates the shard id for a given guild id.\n *\n * @param guildId - The guild id to calculate the shard id for\n * @param shardCount - The total number of shards\n */\nexport function calculateShardId(guildId: string, shardCount: number) {\n\treturn Number(BigInt(guildId) >> 22n) % shardCount;\n}\n","import type { APIEmbed } from 'discord-api-types/v10';\n\n/**\n * Calculates the length of an embed.\n *\n * @param data - The embed data to check\n */\nexport function embedLength(data: APIEmbed) {\n\treturn (\n\t\t(data.title?.length ?? 0) +\n\t\t(data.description?.length ?? 0) +\n\t\t(data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) +\n\t\t(data.footer?.text.length ?? 0) +\n\t\t(data.author?.name.length ?? 0)\n\t);\n}\n","/**\n * Lazy is a wrapper around a value that is computed lazily. It is useful for\n * cases where the value is expensive to compute and the computation may not\n * be needed at all.\n *\n * @param cb - The callback to lazily evaluate\n * @typeParam Value - The type of the value\n * @example\n * ```ts\n * const value = lazy(() => computeExpensiveValue());\n * ```\n */\n// eslint-disable-next-line promise/prefer-await-to-callbacks\nexport function lazy<Value>(cb: () => Value): () => Value {\n\tlet defaultValue: Value;\n\t// eslint-disable-next-line promise/prefer-await-to-callbacks\n\treturn () => (defaultValue ??= cb());\n}\n","/**\n * Options for creating a range\n */\nexport interface RangeOptions {\n\t/**\n\t * The end of the range (exclusive)\n\t */\n\tend: number;\n\t/**\n\t * The start of the range (inclusive)\n\t */\n\tstart: number;\n\t/**\n\t * The amount to increment by\n\t *\n\t * @defaultValue `1`\n\t */\n\tstep?: number;\n}\n\n/**\n * A generator to yield numbers in a given range\n *\n * @remarks\n * This method is end-exclusive, for example the last number yielded by `range(5)` is 4. If you\n * prefer for the end to be included add 1 to the range or `end` option.\n * @param range - A number representing the range to yield (exclusive) or an object with start, end and step\n * @example\n * Basic range\n * ```ts\n * for (const number of range(5)) {\n * console.log(number);\n * }\n * // Prints 0, 1, 2, 3, 4\n * ```\n * @example\n * Range with a step\n * ```ts\n * for (const number of range({ start: 3, end: 10, step: 2 })) {\n * \tconsole.log(number);\n * }\n * // Prints 3, 5, 7, 9\n * ```\n */\nexport function* range(range: RangeOptions | number) {\n\tlet rangeEnd: number;\n\tlet start = 0;\n\tlet step = 1;\n\n\tif (typeof range === 'number') {\n\t\trangeEnd = range;\n\t} else {\n\t\tstart = range.start;\n\t\trangeEnd = range.end;\n\t\tstep = range.step ?? 1;\n\t}\n\n\tfor (let index = start; index < rangeEnd; index += step) {\n\t\tyield index;\n\t}\n}\n","/* eslint-disable n/prefer-global/process */\n\nexport function shouldUseGlobalFetchAndWebSocket() {\n\t// Browser env and deno when ran directly\n\tif (typeof globalThis.process === 'undefined') {\n\t\treturn 'fetch' in globalThis && 'WebSocket' in globalThis;\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\treturn 'deno' in globalThis.process.versions || 'bun' in globalThis.process.versions;\n\t}\n\n\treturn false;\n}\n","/* eslint-disable n/prefer-global/process */\n\n/**\n * Resolves the user agent appendix string for the current environment.\n */\nexport function getUserAgentAppendix(): string {\n\t// https://vercel.com/docs/concepts/functions/edge-functions/edge-runtime#check-if-you're-running-on-the-edge-runtime\n\t// @ts-expect-error Vercel Edge functions\n\tif (typeof globalThis.EdgeRuntime !== 'undefined') {\n\t\treturn 'Vercel-Edge-Functions';\n\t}\n\n\t// @ts-expect-error Cloudflare Workers\n\tif (typeof globalThis.R2 !== 'undefined' && typeof globalThis.WebSocketPair !== 'undefined') {\n\t\t// https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n\t\treturn 'Cloudflare-Workers';\n\t}\n\n\t// https://docs.netlify.com/edge-functions/api/#netlify-global-object\n\t// @ts-expect-error Netlify Edge functions\n\tif (typeof globalThis.Netlify !== 'undefined') {\n\t\treturn 'Netlify-Edge-Functions';\n\t}\n\n\t// Most (if not all) edge environments will have `process` defined. Within a web browser we'll extract it using `navigator.userAgent`.\n\tif (typeof globalThis.process !== 'object') {\n\t\tif (typeof globalThis.navigator === 'object') {\n\t\t\treturn globalThis.navigator.userAgent;\n\t\t}\n\n\t\treturn 'UnknownEnvironment';\n\t}\n\n\tif ('versions' in globalThis.process) {\n\t\tif ('deno' in globalThis.process.versions) {\n\t\t\treturn `Deno/${globalThis.process.versions.deno}`;\n\t\t}\n\n\t\tif ('bun' in globalThis.process.versions) {\n\t\t\treturn `Bun/${globalThis.process.versions.bun}`;\n\t\t}\n\n\t\tif ('node' in globalThis.process.versions) {\n\t\t\treturn `Node.js/${globalThis.process.versions.node}`;\n\t\t}\n\t}\n\n\treturn 'UnknownEnvironment';\n}\n","import type { RawFile } from './RawFile.js';\n\n/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam Value - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<Value> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON(): Value;\n}\n\n/**\n * Indicates if an object is encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n\n/**\n * Result of encoding an object that includes file attachments\n *\n * @typeParam BodyValue - The JSON body type\n */\nexport interface FileBodyEncodableResult<BodyValue> {\n\t/**\n\t * The JSON body to send with the request\n\t */\n\tbody: BodyValue;\n\t/**\n\t * The files to attach to the request\n\t */\n\tfiles: RawFile[];\n}\n\n/**\n * Represents an object capable of representing itself as a request body with file attachments.\n * Objects implementing this interface can separate JSON body data from binary file data,\n * which is necessary for multipart/form-data requests.\n *\n * @typeParam BodyValue - The JSON body type\n */\nexport interface FileBodyEncodable<BodyValue> {\n\t/**\n\t * Transforms this object to its file body format, separating the JSON body from file attachments.\n\t */\n\ttoFileBody(): FileBodyEncodableResult<BodyValue>;\n}\n\n/**\n * Indicates if an object is file body encodable or not.\n *\n * @param maybeEncodable - The object to check against\n */\nexport function isFileBodyEncodable(maybeEncodable: unknown): maybeEncodable is FileBodyEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toFileBody' in maybeEncodable;\n}\n","/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam Value - The type of object to compare the current object to\n */\nexport interface Equatable<Value> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals(other: Value): boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n *\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n","import type { GatewayOpcodeRateLimitMetadataMap, GatewayRateLimitedDispatchData } from 'discord-api-types/v10';\n\n/**\n * Represents the error thrown when the gateway emits a `RATE_LIMITED` event after a certain request.\n */\nexport class GatewayRateLimitError extends Error {\n\tpublic override readonly name = GatewayRateLimitError.name;\n\n\tpublic constructor(\n\t\t/**\n\t\t * The data associated with the rate limit event\n\t\t */\n\t\tpublic readonly data: GatewayRateLimitedDispatchData<keyof GatewayOpcodeRateLimitMetadataMap>,\n\t\t/**\n\t\t * The payload data that lead to this rate limit\n\t\t *\n\t\t * @privateRemarks\n\t\t * Too complicated to type properly here (i.e. extract the ['data']\n\t\t * of event payloads that have t = keyof GatewayOpcodeRateLimitMetadataMap)\n\t\t */\n\t\tpublic readonly payload: unknown,\n\t) {\n\t\tsuper(`Request with opcode ${data.opcode} was rate limited. Retry after ${data.retry_after} seconds.`);\n\t}\n}\n","export type * from './types.js';\nexport * from './functions/index.js';\nexport * from './encodables.js';\nexport type * from './RawFile.js';\nexport * from './Equatable.js';\nexport * from './gatewayRateLimitError.js';\n\n/**\n * The {@link https://github.com/discordjs/discord.js/blob/main/packages/util#readme | @discordjs/util} version\n * that you are currently using.\n *\n * @privateRemarks This needs to explicitly be `string` so it is not typed as a \"const string\" that gets injected by esbuild.\n */\nexport const version = '2.0.0-pr-11006.1765450224-e636950b2' as string;\n"],"mappings":";;;;AAMO,SAAS,iBAAiB,SAAiB,YAAoB;AACrE,SAAO,OAAO,OAAO,OAAO,KAAK,GAAG,IAAI;AACzC;AAFgB;;;ACCT,SAAS,YAAY,MAAgB;AAC3C,UACE,KAAK,OAAO,UAAU,MACtB,KAAK,aAAa,UAAU,MAC5B,KAAK,QAAQ,OAAO,CAAC,MAAM,SAAS,OAAO,KAAK,KAAK,SAAS,KAAK,MAAM,QAAQ,CAAC,KAAK,MACvF,KAAK,QAAQ,KAAK,UAAU,MAC5B,KAAK,QAAQ,KAAK,UAAU;AAE/B;AARgB;;;ACMT,SAAS,KAAY,IAA8B;AACzD,MAAI;AAEJ,SAAO,MAAO,iBAAiB,GAAG;AACnC;AAJgB;;;AC+BT,UAAU,MAAMA,QAA8B;AACpD,MAAI;AACJ,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,OAAOA,WAAU,UAAU;AAC9B,eAAWA;AAAA,EACZ,OAAO;AACN,YAAQA,OAAM;AACd,eAAWA,OAAM;AACjB,WAAOA,OAAM,QAAQ;AAAA,EACtB;AAEA,WAAS,QAAQ,OAAO,QAAQ,UAAU,SAAS,MAAM;AACxD,UAAM;AAAA,EACP;AACD;AAhBiB;;;AC1CV,SAAS,mCAAmC;AAElD,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO,WAAW,cAAc,eAAe;AAAA,EAChD;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,WAAO,UAAU,WAAW,QAAQ,YAAY,SAAS,WAAW,QAAQ;AAAA,EAC7E;AAEA,SAAO;AACR;AAXgB;;;ACGT,SAAS,uBAA+B;AAG9C,MAAI,OAAO,WAAW,gBAAgB,aAAa;AAClD,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,OAAO,eAAe,OAAO,WAAW,kBAAkB,aAAa;AAE5F,WAAO;AAAA,EACR;AAIA,MAAI,OAAO,WAAW,YAAY,aAAa;AAC9C,WAAO;AAAA,EACR;AAGA,MAAI,OAAO,WAAW,YAAY,UAAU;AAC3C,QAAI,OAAO,WAAW,cAAc,UAAU;AAC7C,aAAO,WAAW,UAAU;AAAA,IAC7B;AAEA,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,WAAW,SAAS;AACrC,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,QAAQ,WAAW,QAAQ,SAAS,IAAI;AAAA,IAChD;AAEA,QAAI,SAAS,WAAW,QAAQ,UAAU;AACzC,aAAO,OAAO,WAAW,QAAQ,SAAS,GAAG;AAAA,IAC9C;AAEA,QAAI,UAAU,WAAW,QAAQ,UAAU;AAC1C,aAAO,WAAW,WAAW,QAAQ,SAAS,IAAI;AAAA,IACnD;AAAA,EACD;AAEA,SAAO;AACR;AA3CgB;;;ACcT,SAAS,gBAAgB,gBAAmE;AAClG,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;AAuCT,SAAS,oBAAoB,gBAAuE;AAC1G,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,gBAAgB;AACzF;AAFgB;;;ACxCT,SAAS,YAAY,gBAA+D;AAC1F,SAAO,mBAAmB,QAAQ,OAAO,mBAAmB,YAAY,YAAY;AACrF;AAFgB;;;ACbT,IAAM,wBAAN,MAAM,+BAA8B,MAAM;AAAA,EAGzC,YAIU,MAQA,SACf;AACD,UAAM,uBAAuB,KAAK,MAAM,kCAAkC,KAAK,WAAW,WAAW;AAVrF;AAQA;AAAA,EAGjB;AAAA,EAvBD,OAKiD;AAAA;AAAA;AAAA,EACvB,OAAO,uBAAsB;AAkBvD;;;ACXO,IAAM,UAAU;","names":["range"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@discordjs/util",
4
- "version": "2.0.0-djs-file-upload.1761302390-5ae769c9e",
4
+ "version": "2.0.0-pr-11006.1765450224-e636950b2",
5
5
  "description": "Utilities shared across Discord.js packages",
6
6
  "exports": {
7
7
  ".": {
@@ -49,23 +49,26 @@
49
49
  },
50
50
  "homepage": "https://discord.js.org",
51
51
  "funding": "https://github.com/discordjs/discord.js?sponsor",
52
+ "dependencies": {
53
+ "discord-api-types": "^0.38.36"
54
+ },
52
55
  "devDependencies": {
53
- "@favware/cliff-jumper": "^4.1.0",
54
- "@types/node": "^22.18.8",
55
- "@vitest/coverage-v8": "^3.2.4",
56
+ "@favware/cliff-jumper": "^6.0.0",
57
+ "@types/node": "^22.19.1",
58
+ "@vitest/coverage-v8": "^4.0.15",
56
59
  "cross-env": "^10.1.0",
57
60
  "esbuild-plugin-version-injector": "^1.2.1",
58
- "eslint": "^9.37.0",
59
- "eslint-config-neon": "^0.2.7",
60
- "eslint-formatter-compact": "^8.40.0",
61
+ "eslint": "^9.39.1",
62
+ "eslint-config-neon": "^0.2.9",
63
+ "eslint-formatter-compact": "^9.0.1",
61
64
  "eslint-formatter-pretty": "^7.0.0",
62
- "prettier": "^3.6.2",
63
- "tsup": "^8.5.0",
64
- "turbo": "^2.5.8",
65
+ "prettier": "^3.7.4",
66
+ "tsup": "^8.5.1",
67
+ "turbo": "^2.6.3",
65
68
  "typescript": "~5.9.3",
66
- "vitest": "^3.2.4",
67
- "@discordjs/api-extractor": "^7.52.7",
68
- "@discordjs/scripts": "^0.1.0"
69
+ "vitest": "^4.0.15",
70
+ "@discordjs/api-extractor": "7.52.7",
71
+ "@discordjs/scripts": "0.1.0"
69
72
  },
70
73
  "engines": {
71
74
  "node": ">=22.12.0"