@discordjs/util 2.0.0-pr-11005.1765454364-f3f6d34e7 → 2.0.0-pr-10758.1765463096-d081e1706

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,10 +1,26 @@
1
- import { GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
1
+ import { APIEmbed, GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
2
+ import { Buffer } from 'node:buffer';
2
3
 
3
4
  /**
4
5
  * Represents a type that may or may not be a promise
5
6
  */
6
7
  type Awaitable<Value> = PromiseLike<Value> | Value;
7
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
+
8
24
  /**
9
25
  * Lazy is a wrapper around a value that is computed lazily. It is useful for
10
26
  * cases where the value is expensive to compute and the computation may not
@@ -64,14 +80,6 @@ interface RangeOptions {
64
80
  */
65
81
  declare function range(range: RangeOptions | number): Generator<number, void, unknown>;
66
82
 
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
-
75
83
  declare function shouldUseGlobalFetchAndWebSocket(): boolean;
76
84
 
77
85
  /**
@@ -79,6 +87,39 @@ declare function shouldUseGlobalFetchAndWebSocket(): boolean;
79
87
  */
80
88
  declare function getUserAgentAppendix(): string;
81
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
+
82
123
  /**
83
124
  * Represents an object capable of representing itself as a JSON object
84
125
  *
@@ -96,6 +137,40 @@ interface JSONEncodable<Value> {
96
137
  * @param maybeEncodable - The object to check against
97
138
  */
98
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>;
99
174
 
100
175
  /**
101
176
  * Represents a structure that can be checked against another
@@ -156,4 +231,4 @@ declare class GatewayRateLimitError extends Error {
156
231
  */
157
232
  declare const version: string;
158
233
 
159
- export { type Awaitable, type Equatable, GatewayRateLimitError, 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,10 +1,26 @@
1
- import { GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
1
+ import { APIEmbed, GatewayRateLimitedDispatchData, GatewayOpcodeRateLimitMetadataMap } from 'discord-api-types/v10';
2
+ import { Buffer } from 'node:buffer';
2
3
 
3
4
  /**
4
5
  * Represents a type that may or may not be a promise
5
6
  */
6
7
  type Awaitable<Value> = PromiseLike<Value> | Value;
7
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
+
8
24
  /**
9
25
  * Lazy is a wrapper around a value that is computed lazily. It is useful for
10
26
  * cases where the value is expensive to compute and the computation may not
@@ -64,14 +80,6 @@ interface RangeOptions {
64
80
  */
65
81
  declare function range(range: RangeOptions | number): Generator<number, void, unknown>;
66
82
 
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
-
75
83
  declare function shouldUseGlobalFetchAndWebSocket(): boolean;
76
84
 
77
85
  /**
@@ -79,6 +87,39 @@ declare function shouldUseGlobalFetchAndWebSocket(): boolean;
79
87
  */
80
88
  declare function getUserAgentAppendix(): string;
81
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
+
82
123
  /**
83
124
  * Represents an object capable of representing itself as a JSON object
84
125
  *
@@ -96,6 +137,40 @@ interface JSONEncodable<Value> {
96
137
  * @param maybeEncodable - The object to check against
97
138
  */
98
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>;
99
174
 
100
175
  /**
101
176
  * Represents a structure that can be checked against another
@@ -156,4 +231,4 @@ declare class GatewayRateLimitError extends Error {
156
231
  */
157
232
  declare const version: string;
158
233
 
159
- export { type Awaitable, type Equatable, GatewayRateLimitError, 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
@@ -23,8 +23,10 @@ var index_exports = {};
23
23
  __export(index_exports, {
24
24
  GatewayRateLimitError: () => GatewayRateLimitError,
25
25
  calculateShardId: () => calculateShardId,
26
+ embedLength: () => embedLength,
26
27
  getUserAgentAppendix: () => getUserAgentAppendix,
27
28
  isEquatable: () => isEquatable,
29
+ isFileBodyEncodable: () => isFileBodyEncodable,
28
30
  isJSONEncodable: () => isJSONEncodable,
29
31
  lazy: () => lazy,
30
32
  range: () => range,
@@ -33,6 +35,18 @@ __export(index_exports, {
33
35
  });
34
36
  module.exports = __toCommonJS(index_exports);
35
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
+
36
50
  // src/functions/lazy.ts
37
51
  function lazy(cb) {
38
52
  let defaultValue;
@@ -58,12 +72,6 @@ function* range(range2) {
58
72
  }
59
73
  __name(range, "range");
60
74
 
61
- // src/functions/calculateShardId.ts
62
- function calculateShardId(guildId, shardCount) {
63
- return Number(BigInt(guildId) >> 22n) % shardCount;
64
- }
65
- __name(calculateShardId, "calculateShardId");
66
-
67
75
  // src/functions/runtime.ts
68
76
  function shouldUseGlobalFetchAndWebSocket() {
69
77
  if (typeof globalThis.process === "undefined") {
@@ -108,11 +116,15 @@ function getUserAgentAppendix() {
108
116
  }
109
117
  __name(getUserAgentAppendix, "getUserAgentAppendix");
110
118
 
111
- // src/JSONEncodable.ts
119
+ // src/encodables.ts
112
120
  function isJSONEncodable(maybeEncodable) {
113
121
  return maybeEncodable !== null && typeof maybeEncodable === "object" && "toJSON" in maybeEncodable;
114
122
  }
115
123
  __name(isJSONEncodable, "isJSONEncodable");
124
+ function isFileBodyEncodable(maybeEncodable) {
125
+ return maybeEncodable !== null && typeof maybeEncodable === "object" && "toFileBody" in maybeEncodable;
126
+ }
127
+ __name(isFileBodyEncodable, "isFileBodyEncodable");
116
128
 
117
129
  // src/Equatable.ts
118
130
  function isEquatable(maybeEquatable) {
@@ -134,13 +146,15 @@ var GatewayRateLimitError = class _GatewayRateLimitError extends Error {
134
146
  };
135
147
 
136
148
  // src/index.ts
137
- var version = "2.0.0-pr-11005.1765454364-f3f6d34e7";
149
+ var version = "2.0.0-pr-10758.1765463096-d081e1706";
138
150
  // Annotate the CommonJS export names for ESM import in node:
139
151
  0 && (module.exports = {
140
152
  GatewayRateLimitError,
141
153
  calculateShardId,
154
+ embedLength,
142
155
  getUserAgentAppendix,
143
156
  isEquatable,
157
+ isFileBodyEncodable,
144
158
  isJSONEncodable,
145
159
  lazy,
146
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","../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;AA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B,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;;;ARZO,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-10758.1765463096-d081e1706' 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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zF;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) {
@@ -102,12 +112,14 @@ var GatewayRateLimitError = class _GatewayRateLimitError extends Error {
102
112
  };
103
113
 
104
114
  // src/index.ts
105
- var version = "2.0.0-pr-11005.1765454364-f3f6d34e7";
115
+ var version = "2.0.0-pr-10758.1765463096-d081e1706";
106
116
  export {
107
117
  GatewayRateLimitError,
108
118
  calculateShardId,
119
+ embedLength,
109
120
  getUserAgentAppendix,
110
121
  isEquatable,
122
+ isFileBodyEncodable,
111
123
  isJSONEncodable,
112
124
  lazy,
113
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/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;A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A,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;;;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"]}
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-10758.1765463096-d081e1706' 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,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,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-pr-11005.1765454364-f3f6d34e7",
4
+ "version": "2.0.0-pr-10758.1765463096-d081e1706",
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.31"
53
+ "discord-api-types": "^0.38.36"
54
54
  },
55
55
  "devDependencies": {
56
- "@favware/cliff-jumper": "^4.1.0",
57
- "@types/node": "^22.18.13",
58
- "@vitest/coverage-v8": "^3.2.4",
56
+ "@favware/cliff-jumper": "^6.0.0",
57
+ "@types/node": "^22.19.2",
58
+ "@vitest/coverage-v8": "^4.0.15",
59
59
  "cross-env": "^10.1.0",
60
60
  "esbuild-plugin-version-injector": "^1.2.1",
61
- "eslint": "^9.38.0",
61
+ "eslint": "^9.39.1",
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.6.2",
66
- "tsup": "^8.5.0",
67
- "turbo": "^2.5.8",
65
+ "prettier": "^3.7.4",
66
+ "tsup": "^8.5.1",
67
+ "turbo": "^2.6.3",
68
68
  "typescript": "~5.9.3",
69
- "vitest": "^3.2.4",
69
+ "vitest": "^4.0.15",
70
70
  "@discordjs/api-extractor": "7.52.7",
71
71
  "@discordjs/scripts": "0.1.0"
72
72
  },