@discordjs/util 2.0.0-pr-11006.1765450794-e636950b2 → 2.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 CHANGED
@@ -1,26 +1,10 @@
1
- import { APIEmbed, GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
2
- import { Buffer } from 'node:buffer';
1
+ import { GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
3
2
 
4
3
  /**
5
4
  * Represents a type that may or may not be a promise
6
5
  */
7
6
  type Awaitable<Value> = PromiseLike<Value> | Value;
8
7
 
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
-
24
8
  /**
25
9
  * Lazy is a wrapper around a value that is computed lazily. It is useful for
26
10
  * cases where the value is expensive to compute and the computation may not
@@ -80,6 +64,14 @@ interface RangeOptions {
80
64
  */
81
65
  declare function range(range: RangeOptions | number): Generator<number, void, unknown>;
82
66
 
67
+ /**
68
+ * Calculates the shard id for a given guild id.
69
+ *
70
+ * @param guildId - The guild id to calculate the shard id for
71
+ * @param shardCount - The total number of shards
72
+ */
73
+ declare function calculateShardId(guildId: string, shardCount: number): number;
74
+
83
75
  declare function shouldUseGlobalFetchAndWebSocket(): boolean;
84
76
 
85
77
  /**
@@ -87,39 +79,6 @@ declare function shouldUseGlobalFetchAndWebSocket(): boolean;
87
79
  */
88
80
  declare function getUserAgentAppendix(): string;
89
81
 
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
-
123
82
  /**
124
83
  * Represents an object capable of representing itself as a JSON object
125
84
  *
@@ -137,40 +96,6 @@ interface JSONEncodable<Value> {
137
96
  * @param maybeEncodable - The object to check against
138
97
  */
139
98
  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>;
174
99
 
175
100
  /**
176
101
  * Represents a structure that can be checked against another
@@ -231,4 +156,4 @@ declare class GatewayRateLimitError extends Error {
231
156
  */
232
157
  declare const version: string;
233
158
 
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 };
159
+ export { type Awaitable, type Equatable, GatewayRateLimitError, type JSONEncodable, type RangeOptions, calculateShardId, getUserAgentAppendix, isEquatable, isJSONEncodable, lazy, range, shouldUseGlobalFetchAndWebSocket, version };
package/dist/index.d.ts CHANGED
@@ -1,26 +1,10 @@
1
- import { APIEmbed, GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
2
- import { Buffer } from 'node:buffer';
1
+ import { GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
3
2
 
4
3
  /**
5
4
  * Represents a type that may or may not be a promise
6
5
  */
7
6
  type Awaitable<Value> = PromiseLike<Value> | Value;
8
7
 
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
-
24
8
  /**
25
9
  * Lazy is a wrapper around a value that is computed lazily. It is useful for
26
10
  * cases where the value is expensive to compute and the computation may not
@@ -80,6 +64,14 @@ interface RangeOptions {
80
64
  */
81
65
  declare function range(range: RangeOptions | number): Generator<number, void, unknown>;
82
66
 
67
+ /**
68
+ * Calculates the shard id for a given guild id.
69
+ *
70
+ * @param guildId - The guild id to calculate the shard id for
71
+ * @param shardCount - The total number of shards
72
+ */
73
+ declare function calculateShardId(guildId: string, shardCount: number): number;
74
+
83
75
  declare function shouldUseGlobalFetchAndWebSocket(): boolean;
84
76
 
85
77
  /**
@@ -87,39 +79,6 @@ declare function shouldUseGlobalFetchAndWebSocket(): boolean;
87
79
  */
88
80
  declare function getUserAgentAppendix(): string;
89
81
 
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
-
123
82
  /**
124
83
  * Represents an object capable of representing itself as a JSON object
125
84
  *
@@ -137,40 +96,6 @@ interface JSONEncodable<Value> {
137
96
  * @param maybeEncodable - The object to check against
138
97
  */
139
98
  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>;
174
99
 
175
100
  /**
176
101
  * Represents a structure that can be checked against another
@@ -231,4 +156,4 @@ declare class GatewayRateLimitError extends Error {
231
156
  */
232
157
  declare const version: string;
233
158
 
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 };
159
+ export { type Awaitable, type Equatable, GatewayRateLimitError, type JSONEncodable, type RangeOptions, calculateShardId, getUserAgentAppendix, isEquatable, isJSONEncodable, lazy, range, shouldUseGlobalFetchAndWebSocket, version };
package/dist/index.js CHANGED
@@ -23,10 +23,8 @@ var index_exports = {};
23
23
  __export(index_exports, {
24
24
  GatewayRateLimitError: () => GatewayRateLimitError,
25
25
  calculateShardId: () => calculateShardId,
26
- embedLength: () => embedLength,
27
26
  getUserAgentAppendix: () => getUserAgentAppendix,
28
27
  isEquatable: () => isEquatable,
29
- isFileBodyEncodable: () => isFileBodyEncodable,
30
28
  isJSONEncodable: () => isJSONEncodable,
31
29
  lazy: () => lazy,
32
30
  range: () => range,
@@ -35,18 +33,6 @@ __export(index_exports, {
35
33
  });
36
34
  module.exports = __toCommonJS(index_exports);
37
35
 
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
-
50
36
  // src/functions/lazy.ts
51
37
  function lazy(cb) {
52
38
  let defaultValue;
@@ -72,6 +58,12 @@ function* range(range2) {
72
58
  }
73
59
  __name(range, "range");
74
60
 
61
+ // src/functions/calculateShardId.ts
62
+ function calculateShardId(guildId, shardCount) {
63
+ return Number(BigInt(guildId) >> 22n) % shardCount;
64
+ }
65
+ __name(calculateShardId, "calculateShardId");
66
+
75
67
  // src/functions/runtime.ts
76
68
  function shouldUseGlobalFetchAndWebSocket() {
77
69
  if (typeof globalThis.process === "undefined") {
@@ -116,15 +108,11 @@ function getUserAgentAppendix() {
116
108
  }
117
109
  __name(getUserAgentAppendix, "getUserAgentAppendix");
118
110
 
119
- // src/encodables.ts
111
+ // src/JSONEncodable.ts
120
112
  function isJSONEncodable(maybeEncodable) {
121
113
  return maybeEncodable !== null && typeof maybeEncodable === "object" && "toJSON" in maybeEncodable;
122
114
  }
123
115
  __name(isJSONEncodable, "isJSONEncodable");
124
- function isFileBodyEncodable(maybeEncodable) {
125
- return maybeEncodable !== null && typeof maybeEncodable === "object" && "toFileBody" in maybeEncodable;
126
- }
127
- __name(isFileBodyEncodable, "isFileBodyEncodable");
128
116
 
129
117
  // src/Equatable.ts
130
118
  function isEquatable(maybeEquatable) {
@@ -146,15 +134,13 @@ var GatewayRateLimitError = class _GatewayRateLimitError extends Error {
146
134
  };
147
135
 
148
136
  // src/index.ts
149
- var version = "2.0.0-pr-11006.1765450794-e636950b2";
137
+ var version = "2.0.0-pr-11005.1765454364-f3f6d34e7";
150
138
  // Annotate the CommonJS export names for ESM import in node:
151
139
  0 && (module.exports = {
152
140
  GatewayRateLimitError,
153
141
  calculateShardId,
154
- embedLength,
155
142
  getUserAgentAppendix,
156
143
  isEquatable,
157
- isFileBodyEncodable,
158
144
  isJSONEncodable,
159
145
  lazy,
160
146
  range,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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.1765450794-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;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,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"]}
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","../src/gatewayRateLimitError.ts"],"sourcesContent":["export type * from './types.js';\nexport * from './functions/index.js';\nexport * from './JSONEncodable.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-11005.1765454364-f3f6d34e7' 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","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;;;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;A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,uBAAuB,KAAK,MAAM,kCAAkC,KAAK,WAAW,WAAW;AAVrF;AAQA;AAAA,EAGjB;AAAA,EAvBD,OAKiD;AAAA;AAAA;AAAA,EACvB,OAAO,uBAAsB;AAkBvD;;;ARZO,IAAM,UAAU;","names":["range"]}
package/dist/index.mjs CHANGED
@@ -1,18 +1,6 @@
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
-
16
4
  // src/functions/lazy.ts
17
5
  function lazy(cb) {
18
6
  let defaultValue;
@@ -38,6 +26,12 @@ function* range(range2) {
38
26
  }
39
27
  __name(range, "range");
40
28
 
29
+ // src/functions/calculateShardId.ts
30
+ function calculateShardId(guildId, shardCount) {
31
+ return Number(BigInt(guildId) >> 22n) % shardCount;
32
+ }
33
+ __name(calculateShardId, "calculateShardId");
34
+
41
35
  // src/functions/runtime.ts
42
36
  function shouldUseGlobalFetchAndWebSocket() {
43
37
  if (typeof globalThis.process === "undefined") {
@@ -82,15 +76,11 @@ function getUserAgentAppendix() {
82
76
  }
83
77
  __name(getUserAgentAppendix, "getUserAgentAppendix");
84
78
 
85
- // src/encodables.ts
79
+ // src/JSONEncodable.ts
86
80
  function isJSONEncodable(maybeEncodable) {
87
81
  return maybeEncodable !== null && typeof maybeEncodable === "object" && "toJSON" in maybeEncodable;
88
82
  }
89
83
  __name(isJSONEncodable, "isJSONEncodable");
90
- function isFileBodyEncodable(maybeEncodable) {
91
- return maybeEncodable !== null && typeof maybeEncodable === "object" && "toFileBody" in maybeEncodable;
92
- }
93
- __name(isFileBodyEncodable, "isFileBodyEncodable");
94
84
 
95
85
  // src/Equatable.ts
96
86
  function isEquatable(maybeEquatable) {
@@ -112,14 +102,12 @@ var GatewayRateLimitError = class _GatewayRateLimitError extends Error {
112
102
  };
113
103
 
114
104
  // src/index.ts
115
- var version = "2.0.0-pr-11006.1765450794-e636950b2";
105
+ var version = "2.0.0-pr-11005.1765454364-f3f6d34e7";
116
106
  export {
117
107
  GatewayRateLimitError,
118
108
  calculateShardId,
119
- embedLength,
120
109
  getUserAgentAppendix,
121
110
  isEquatable,
122
- isFileBodyEncodable,
123
111
  isJSONEncodable,
124
112
  lazy,
125
113
  range,
@@ -1 +1 @@
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.1765450794-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;A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,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"]}
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/gatewayRateLimitError.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","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 './JSONEncodable.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-11005.1765454364-f3f6d34e7' 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,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AS,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;;;ACZO,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-pr-11006.1765450794-e636950b2",
4
+ "version": "2.0.0-pr-11005.1765454364-f3f6d34e7",
5
5
  "description": "Utilities shared across Discord.js packages",
6
6
  "exports": {
7
7
  ".": {
@@ -50,23 +50,23 @@
50
50
  "homepage": "https://discord.js.org",
51
51
  "funding": "https://github.com/discordjs/discord.js?sponsor",
52
52
  "dependencies": {
53
- "discord-api-types": "^0.38.36"
53
+ "discord-api-types": "^0.38.31"
54
54
  },
55
55
  "devDependencies": {
56
- "@favware/cliff-jumper": "^6.0.0",
57
- "@types/node": "^22.19.1",
58
- "@vitest/coverage-v8": "^4.0.15",
56
+ "@favware/cliff-jumper": "^4.1.0",
57
+ "@types/node": "^22.18.13",
58
+ "@vitest/coverage-v8": "^3.2.4",
59
59
  "cross-env": "^10.1.0",
60
60
  "esbuild-plugin-version-injector": "^1.2.1",
61
- "eslint": "^9.39.1",
61
+ "eslint": "^9.38.0",
62
62
  "eslint-config-neon": "^0.2.9",
63
63
  "eslint-formatter-compact": "^9.0.1",
64
64
  "eslint-formatter-pretty": "^7.0.0",
65
- "prettier": "^3.7.4",
66
- "tsup": "^8.5.1",
67
- "turbo": "^2.6.3",
65
+ "prettier": "^3.6.2",
66
+ "tsup": "^8.5.0",
67
+ "turbo": "^2.5.8",
68
68
  "typescript": "~5.9.3",
69
- "vitest": "^4.0.15",
69
+ "vitest": "^3.2.4",
70
70
  "@discordjs/api-extractor": "7.52.7",
71
71
  "@discordjs/scripts": "0.1.0"
72
72
  },