@discordeno/utils 19.0.0-next.898578f → 19.0.0-next.8bb91fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bucket.d.ts +34 -48
- package/dist/bucket.d.ts.map +1 -1
- package/dist/bucket.js +59 -72
- package/dist/bucket.js.map +1 -1
- package/dist/casing.d.ts.map +1 -1
- package/dist/casing.js +2 -2
- package/dist/casing.js.map +1 -1
- package/dist/images.js +2 -2
- package/dist/images.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +8 -8
- package/dist/logger.js.map +1 -1
- package/dist/urlToBase64.d.ts.map +1 -1
- package/dist/urlToBase64.js +1 -0
- package/dist/urlToBase64.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -149,6 +149,6 @@ and unofficial templates:
|
|
|
149
149
|
|
|
150
150
|
## Links
|
|
151
151
|
|
|
152
|
-
- [Website](https://discordeno.
|
|
152
|
+
- [Website](https://discordeno.github.io/discordeno/)
|
|
153
153
|
- [Documentation](https://doc.deno.land/https/deno.land/x/discordeno/mod.ts)
|
|
154
154
|
- [Discord](https://discord.com/invite/5vBgXk3UcZ)
|
package/dist/bucket.d.ts
CHANGED
|
@@ -1,55 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Useful for rate limiting purposes.
|
|
4
|
-
* This uses `performance.now()` instead of `Date.now()` for higher accuracy.
|
|
5
|
-
*
|
|
6
|
-
* NOTE: This bucket is lazy, means it only updates when a related method is called.
|
|
7
|
-
*/
|
|
8
|
-
export interface LeakyBucket {
|
|
9
|
-
/** How many tokens this bucket can hold. */
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class LeakyBucket implements LeakyBucketOptions {
|
|
10
3
|
max: number;
|
|
11
|
-
/** Amount of tokens gained per interval.
|
|
12
|
-
* If bigger than `max` it will be pressed to `max`.
|
|
13
|
-
*/
|
|
14
|
-
refillAmount: number;
|
|
15
|
-
/** Interval at which the bucket gains tokens. */
|
|
16
4
|
refillInterval: number;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
refillAmount: number;
|
|
6
|
+
/** The amount of requests that have been used up already. */
|
|
7
|
+
used: number;
|
|
8
|
+
/** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */
|
|
9
|
+
queue: Array<(value: void | PromiseLike<void>) => void>;
|
|
10
|
+
/** Whether or not the queue is already processing. */
|
|
11
|
+
processing: boolean;
|
|
12
|
+
/** The timeout id for the timer to reduce the used amount by the refill amount. */
|
|
13
|
+
timeoutId?: NodeJS.Timeout;
|
|
14
|
+
/** The timestamp in milliseconds when the next refill is scheduled. */
|
|
15
|
+
refillsAt?: number;
|
|
16
|
+
constructor(options?: LeakyBucketOptions);
|
|
17
|
+
/** The amount of requests that still remain. */
|
|
18
|
+
get remaining(): number;
|
|
19
|
+
/** Begin processing the queue. */
|
|
20
|
+
processQueue(): Promise<void>;
|
|
21
|
+
/** Pauses the execution until the request is available to be made. */
|
|
22
|
+
acquire(highPriority?: boolean): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface LeakyBucketOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Max requests allowed at once.
|
|
27
|
+
* @default 1
|
|
32
28
|
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
29
|
+
max?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Interval in milliseconds between refills.
|
|
32
|
+
* @default 5000
|
|
36
33
|
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
34
|
+
refillInterval?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Amount of requests to refill at each interval.
|
|
37
|
+
* @default 1
|
|
40
38
|
*/
|
|
41
|
-
|
|
39
|
+
refillAmount?: number;
|
|
42
40
|
}
|
|
43
|
-
export declare function createLeakyBucket({ max, refillInterval, refillAmount, tokens, waiting, ...rest }: Omit<PickPartial<LeakyBucket, 'max' | 'refillInterval' | 'refillAmount'>, 'tokens'> & {
|
|
44
|
-
/** Current tokens in the bucket.
|
|
45
|
-
* @default max
|
|
46
|
-
*/
|
|
47
|
-
tokens?: number;
|
|
48
|
-
}): LeakyBucket;
|
|
49
|
-
/** Update the tokens of that bucket.
|
|
50
|
-
* @returns {number} The amount of current available tokens.
|
|
51
|
-
*/
|
|
52
|
-
export declare function updateTokens(bucket: LeakyBucket): number;
|
|
53
|
-
export declare function nextRefill(bucket: LeakyBucket): number;
|
|
54
|
-
export declare function acquire(bucket: LeakyBucket, amount: number, highPriority?: boolean): Promise<void>;
|
|
55
41
|
//# sourceMappingURL=bucket.d.ts.map
|
package/dist/bucket.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../src/bucket.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../src/bucket.ts"],"names":[],"mappings":";AAGA,qBAAa,WAAY,YAAW,kBAAkB;IACpD,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IAEpB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAI;IAChB,4FAA4F;IAC5F,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAK;IAC5D,sDAAsD;IACtD,UAAU,EAAE,OAAO,CAAQ;IAC3B,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC,OAAO,CAAA;IAC1B,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAA;gBAEN,OAAO,CAAC,EAAE,kBAAkB;IAMxC,gDAAgD;IAChD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,kCAAkC;IAC5B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAgDnC,sEAAsE;IAChE,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAWrD;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
|
package/dist/bucket.js
CHANGED
|
@@ -1,80 +1,67 @@
|
|
|
1
|
+
import logger from './logger.js';
|
|
1
2
|
import { delay } from './utils.js';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
3
|
+
export class LeakyBucket {
|
|
4
|
+
constructor(options){
|
|
5
|
+
/** The amount of requests that have been used up already. */ this.used = 0;
|
|
6
|
+
/** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */ this.queue = [];
|
|
7
|
+
/** Whether or not the queue is already processing. */ this.processing = false;
|
|
8
|
+
this.max = options?.max ?? 1;
|
|
9
|
+
this.refillAmount = options?.refillAmount ? options.refillAmount > this.max ? this.max : options.refillAmount : 1;
|
|
10
|
+
this.refillInterval = options?.refillInterval ?? 5000;
|
|
11
|
+
}
|
|
12
|
+
/** The amount of requests that still remain. */ get remaining() {
|
|
13
|
+
return this.max < this.used ? 0 : this.max - this.used;
|
|
14
|
+
}
|
|
15
|
+
/** Begin processing the queue. */ async processQueue() {
|
|
16
|
+
logger.debug('[Gateway] Processing queue');
|
|
17
|
+
// There is already a queue that is processing
|
|
18
|
+
if (this.processing) {
|
|
19
|
+
logger.debug('[Gateway] Queue is already processing.');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Begin going through the queue.
|
|
23
|
+
while(this.queue.length){
|
|
24
|
+
if (this.remaining) {
|
|
25
|
+
logger.debug(`[LeakyBucket] Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`);
|
|
26
|
+
// Resolves the promise allowing the paused execution of this request to resolve and continue.
|
|
27
|
+
this.queue.shift()?.();
|
|
28
|
+
// A request can be made
|
|
29
|
+
this.used++;
|
|
30
|
+
// Create a new timeout for this request if none exists.
|
|
31
|
+
if (!this.timeoutId) {
|
|
32
|
+
logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`);
|
|
33
|
+
this.timeoutId = setTimeout(()=>{
|
|
34
|
+
logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`);
|
|
35
|
+
// Lower the used amount by the refill amount
|
|
36
|
+
this.used -= this.refillAmount;
|
|
37
|
+
// Reset the refillsAt timestamp since it just got refilled
|
|
38
|
+
this.refillsAt = undefined;
|
|
39
|
+
}, this.refillInterval);
|
|
40
|
+
// Set the time for when this refill will occur.
|
|
41
|
+
this.refillsAt = Date.now() + this.refillInterval;
|
|
42
|
+
}
|
|
43
|
+
} else if (this.refillsAt) {
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
// If there is time left until next refill, just delay execution.
|
|
46
|
+
if (this.refillsAt > now) {
|
|
47
|
+
logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`);
|
|
48
|
+
await delay(this.refillsAt - now);
|
|
49
|
+
logger.debug(`[LeakyBucket] Resuming execution`);
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
|
-
});
|
|
50
|
-
// Somehow another acquire has started,
|
|
51
|
-
// so need to wait again.
|
|
52
|
-
if (!bucket.allowAcquire) {
|
|
53
|
-
return await acquire(bucket, amount);
|
|
54
52
|
}
|
|
53
|
+
// Loop has ended mark false so it can restart later when needed
|
|
54
|
+
this.processing = false;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const refillsNeeded = Math.ceil(tokensNeeded / bucket.refillAmount);
|
|
65
|
-
const waitTime = bucket.refillInterval * refillsNeeded;
|
|
66
|
-
await delay(waitTime);
|
|
67
|
-
// Update the tokens again to ensure nothing has been missed.
|
|
68
|
-
updateTokens(bucket);
|
|
56
|
+
/** Pauses the execution until the request is available to be made. */ async acquire(highPriority) {
|
|
57
|
+
return await new Promise((resolve)=>{
|
|
58
|
+
// High priority requests get added to the start of the queue
|
|
59
|
+
if (highPriority) this.queue.unshift(resolve);
|
|
60
|
+
else this.queue.push(resolve);
|
|
61
|
+
// Each request should trigger the queue to be processesd.
|
|
62
|
+
void this.processQueue();
|
|
63
|
+
});
|
|
69
64
|
}
|
|
70
|
-
// In order to not subtract too much from the tokens,
|
|
71
|
-
// calculate what is actually needed to subtract.
|
|
72
|
-
const toSubtract = (amount % bucket.refillAmount) ?? amount;
|
|
73
|
-
bucket.tokensState -= toSubtract;
|
|
74
|
-
// Allow the next acquire to happen.
|
|
75
|
-
bucket.allowAcquire = true;
|
|
76
|
-
// If there is an acquire waiting, let it continue.
|
|
77
|
-
bucket.waiting.shift()?.();
|
|
78
65
|
}
|
|
79
66
|
|
|
80
67
|
//# sourceMappingURL=bucket.js.map
|
package/dist/bucket.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bucket.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../src/bucket.ts"],"sourcesContent":["import logger from './logger.js'\nimport { delay } from './utils.js'\n\nexport class LeakyBucket implements LeakyBucketOptions {\n max: number\n refillInterval: number\n refillAmount: number\n\n /** The amount of requests that have been used up already. */\n used: number = 0\n /** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */\n queue: Array<(value: void | PromiseLike<void>) => void> = []\n /** Whether or not the queue is already processing. */\n processing: boolean = false\n /** The timeout id for the timer to reduce the used amount by the refill amount. */\n timeoutId?: NodeJS.Timeout\n /** The timestamp in milliseconds when the next refill is scheduled. */\n refillsAt?: number\n\n constructor(options?: LeakyBucketOptions) {\n this.max = options?.max ?? 1\n this.refillAmount = options?.refillAmount ? (options.refillAmount > this.max ? this.max : options.refillAmount) : 1\n this.refillInterval = options?.refillInterval ?? 5000\n }\n\n /** The amount of requests that still remain. */\n get remaining(): number {\n return this.max < this.used ? 0 : this.max - this.used\n }\n\n /** Begin processing the queue. */\n async processQueue(): Promise<void> {\n logger.debug('[Gateway] Processing queue')\n // There is already a queue that is processing\n if (this.processing) {\n logger.debug('[Gateway] Queue is already processing.')\n return\n }\n\n // Begin going through the queue.\n while (this.queue.length) {\n if (this.remaining) {\n logger.debug(`[LeakyBucket] Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`)\n // Resolves the promise allowing the paused execution of this request to resolve and continue.\n this.queue.shift()?.()\n // A request can be made\n this.used++\n\n // Create a new timeout for this request if none exists.\n if (!this.timeoutId) {\n logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`)\n this.timeoutId = setTimeout(() => {\n logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`)\n // Lower the used amount by the refill amount\n this.used -= this.refillAmount\n // Reset the refillsAt timestamp since it just got refilled\n this.refillsAt = undefined\n }, this.refillInterval)\n // Set the time for when this refill will occur.\n this.refillsAt = Date.now() + this.refillInterval\n }\n }\n\n // Check if a refill is scheduled, since we have used up all available requests\n else if (this.refillsAt) {\n const now = Date.now()\n // If there is time left until next refill, just delay execution.\n if (this.refillsAt > now) {\n logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`)\n await delay(this.refillsAt - now)\n logger.debug(`[LeakyBucket] Resuming execution`)\n }\n }\n }\n\n // Loop has ended mark false so it can restart later when needed\n this.processing = false\n }\n\n /** Pauses the execution until the request is available to be made. */\n async acquire(highPriority?: boolean): Promise<void> {\n return await new Promise((resolve) => {\n // High priority requests get added to the start of the queue\n if (highPriority) this.queue.unshift(resolve)\n // All other requests get pushed to the end.\n else this.queue.push(resolve)\n\n // Each request should trigger the queue to be processesd.\n void this.processQueue()\n })\n }\n}\n\nexport interface LeakyBucketOptions {\n /**\n * Max requests allowed at once.\n * @default 1\n */\n max?: number\n /**\n * Interval in milliseconds between refills.\n * @default 5000\n */\n refillInterval?: number\n /**\n * Amount of requests to refill at each interval.\n * @default 1\n */\n refillAmount?: number\n}\n"],"names":["logger","delay","LeakyBucket","constructor","options","used","queue","processing","max","refillAmount","refillInterval","remaining","processQueue","debug","length","shift","timeoutId","setTimeout","refillsAt","undefined","Date","now","acquire","highPriority","Promise","resolve","unshift","push"],"mappings":"AAAA,OAAOA,YAAY,cAAa;AAChC,SAASC,KAAK,QAAQ,aAAY;AAElC,OAAO,MAAMC;IAgBXC,YAAYC,OAA4B,CAAE;QAX1C,2DAA2D,QAC3DC,OAAe;QACf,0FAA0F,QAC1FC,QAA0D,EAAE;QAC5D,oDAAoD,QACpDC,aAAsB,KAAK;QAOzB,IAAI,CAACC,GAAG,GAAGJ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GE,KAAKC,GAAG,KAAK,IAAI,CAACX,cAAc;gBACnD,CAAC;YACH,OAGK,IAAI,IAAI,CAACQ,SAAS,EAAE;gBACvB,MAAMG,MAAMD,KAAKC,GAAG;gBACpB,iEAAiE;gBACjE,IAAI,IAAI,CAACH,SAAS,GAAGG,KAAK;oBACxBrB,OAAOa,KAAK,CAAC,CAAC,8DAA8D,EAAE,IAAI,CAACK,SAAS,GAAGG,IAAI,EAAE,CAAC;oBACtG,MAAMpB,MAAM,IAAI,CAACiB,SAAS,GAAGG;oBAC7BrB,OAAOa,KAAK,CAAC,CAAC,gCAAgC,CAAC;gBACjD,CAAC;YACH,CAAC;QACH;QAEA,gEAAgE;QAChE,IAAI,CAACN,UAAU,GAAG,KAAK;IACzB;IAEA,oEAAoE,GACpE,MAAMe,QAAQC,YAAsB,EAAiB;QACnD,OAAO,MAAM,IAAIC,QAAQ,CAACC,UAAY;YACpC,6DAA6D;YAC7D,IAAIF,cAAc,IAAI,CAACjB,KAAK,CAACoB,OAAO,CAACD;iBAEhC,IAAI,CAACnB,KAAK,CAACqB,IAAI,CAACF;YAErB,0DAA0D;YAC1D,KAAK,IAAI,CAACb,YAAY;QACxB;IACF;AACF,CAAC"}
|
package/dist/casing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../src/casing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,QAAQ,CAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAcnD;AAED,wBAAgB,SAAS,CAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../src/casing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,QAAQ,CAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAcnD;AAED,wBAAgB,SAAS,CAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAcrD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAepD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAapD"}
|
package/dist/casing.js
CHANGED
|
@@ -5,7 +5,7 @@ export function camelize(object) {
|
|
|
5
5
|
if (typeof object === 'object' && object !== null) {
|
|
6
6
|
const obj = {};
|
|
7
7
|
Object.keys(object).forEach((key)=>{
|
|
8
|
-
obj[
|
|
8
|
+
obj[snakeToCamelCase(key)] = camelize(object[key]);
|
|
9
9
|
});
|
|
10
10
|
return obj;
|
|
11
11
|
}
|
|
@@ -18,7 +18,7 @@ export function snakelize(object) {
|
|
|
18
18
|
if (typeof object === 'object' && object !== null) {
|
|
19
19
|
const obj = {};
|
|
20
20
|
Object.keys(object).forEach((key)=>{
|
|
21
|
-
obj[
|
|
21
|
+
obj[camelToSnakeCase(key)] = snakelize(object[key]);
|
|
22
22
|
});
|
|
23
23
|
return obj;
|
|
24
24
|
}
|
package/dist/casing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Camelize, Snakelize } from '@discordeno/types'\n\nexport function camelize <T>(object: T): Camelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => camelize(element)) as Camelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Camelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[
|
|
1
|
+
{"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Camelize, Snakelize } from '@discordeno/types'\n\nexport function camelize <T>(object: T): Camelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => camelize(element)) as Camelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Camelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[snakeToCamelCase(key)] as Camelize<(T & object)[keyof T]>) = camelize(object[key])\n })\n return obj\n }\n return object as Camelize<T>\n}\n\nexport function snakelize <T>(object: T): Snakelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => snakelize(element)) as Snakelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Snakelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[camelToSnakeCase(key)] as Snakelize<(T & object)[keyof T]>) = snakelize(object[key])\n })\n return obj\n }\n return object as Snakelize<T>\n}\n\nexport function snakeToCamelCase(str: string): string {\n if (!str.includes('_')) return str\n\n let result = ''\n for (let i = 0, len = str.length; i < len; ++i) {\n if (str[i] === '_') {\n result += str[++i].toUpperCase()\n\n continue\n }\n\n result += str[i]\n }\n\n return result\n}\n\nexport function camelToSnakeCase(str: string): string {\n let result = ''\n for (let i = 0, len = str.length; i < len; ++i) {\n if (str[i] >= 'A' && str[i] <= 'Z') {\n result += `_${str[i].toLowerCase()}`\n\n continue\n }\n\n result += str[i]\n }\n\n return result\n}\n"],"names":["camelize","object","Array","isArray","map","element","obj","Object","keys","forEach","key","snakeToCamelCase","snakelize","camelToSnakeCase","str","includes","result","i","len","length","toUpperCase","toLowerCase"],"mappings":"AAEA,OAAO,SAASA,SAAaC,MAAS,EAAe;IACnD,IAAIC,MAAMC,OAAO,CAACF,SAAS;QACzB,OAAOA,OAAOG,GAAG,CAAC,CAACC,UAAYL,SAASK;IAC1C,CAAC;IAED,IAAI,OAAOJ,WAAW,YAAYA,WAAW,IAAI,EAAE;QACjD,MAAMK,MAAM,CAAC;QACXC,OAA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,WAAW,GAAG,CAAC;YAEpC,QAAQ;QACV,CAAC;QAEDL,UAAUF,GAAG,CAACG,EAAE;IAClB;IAEA,OAAOD;AACT,CAAC"}
|
package/dist/images.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* @param options - The parameters for the building of the URL.
|
|
20
20
|
* @returns The link to the resource.
|
|
21
21
|
*/ export function avatarUrl(userId, discriminator, options) {
|
|
22
|
-
return options?.avatar ? formatImageUrl(`https://cdn.discordapp.com/avatars/${userId}/${typeof options
|
|
22
|
+
return options?.avatar ? formatImageUrl(`https://cdn.discordapp.com/avatars/${userId}/${typeof options.avatar === 'string' ? options.avatar : iconBigintToHash(options.avatar)}`, options?.size ?? 128, options?.format) : `https://cdn.discordapp.com/embed/avatars/${Number(discriminator) % 5}.png`;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Builds a URL to the guild banner stored in the Discord CDN.
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @param options - The parameters for the building of the URL.
|
|
57
57
|
* @returns The link to the resource.
|
|
58
58
|
*/ export function getWidgetImageUrl(guildId, options) {
|
|
59
|
-
let url = `https://
|
|
59
|
+
let url = `https://discordapp.com/api/guilds/${guildId}/widget.png`;
|
|
60
60
|
if (options?.style) {
|
|
61
61
|
url += `?style=${options.style}`;
|
|
62
62
|
}
|
package/dist/images.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/images.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-template-expressions */\nimport type { BigString, GetGuildWidgetImageQuery, ImageFormat, ImageSize } from '@discordeno/types'\nimport { iconBigintToHash } from './hash.js'\n\n/** Help format an image url. */\nexport function formatImageUrl(url: string, size: ImageSize = 128, format?: ImageFormat): string {\n return `${url}.${format ?? (url.includes('/a_') ? 'gif' : 'jpg')}?size=${size}`\n}\n\n/**\n * Get the url for an emoji.\n *\n * @param emojiId The id of the emoji\n * @param animated Whether or not the emoji is animated\n * @returns string\n */\nexport function emojiUrl(emojiId: BigString, animated = false): string {\n return `https://cdn.discordapp.com/emojis/${emojiId}.${animated ? 'gif' : 'png'}`\n}\n\n/**\n * Builds a URL to a user's avatar stored in the Discord CDN.\n *\n * @param userId - The ID of the user to get the avatar of.\n * @param discriminator - The user's discriminator. (4-digit tag after the hashtag.)\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource.\n */\nexport function avatarUrl(\n userId: BigString,\n discriminator: string,\n options?: {\n avatar: BigString | undefined\n size?: ImageSize\n format?: ImageFormat\n },\n): string {\n return options?.avatar\n ? formatImageUrl(\n `https://cdn.discordapp.com/avatars/${userId}/${typeof options
|
|
1
|
+
{"version":3,"sources":["../src/images.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-template-expressions */\nimport type { BigString, GetGuildWidgetImageQuery, ImageFormat, ImageSize } from '@discordeno/types'\nimport { iconBigintToHash } from './hash.js'\n\n/** Help format an image url. */\nexport function formatImageUrl(url: string, size: ImageSize = 128, format?: ImageFormat): string {\n return `${url}.${format ?? (url.includes('/a_') ? 'gif' : 'jpg')}?size=${size}`\n}\n\n/**\n * Get the url for an emoji.\n *\n * @param emojiId The id of the emoji\n * @param animated Whether or not the emoji is animated\n * @returns string\n */\nexport function emojiUrl(emojiId: BigString, animated = false): string {\n return `https://cdn.discordapp.com/emojis/${emojiId}.${animated ? 'gif' : 'png'}`\n}\n\n/**\n * Builds a URL to a user's avatar stored in the Discord CDN.\n *\n * @param userId - The ID of the user to get the avatar of.\n * @param discriminator - The user's discriminator. (4-digit tag after the hashtag.)\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource.\n */\nexport function avatarUrl(\n userId: BigString,\n discriminator: string,\n options?: {\n avatar: BigString | undefined\n size?: ImageSize\n format?: ImageFormat\n },\n): string {\n return options?.avatar\n ? formatImageUrl(\n `https://cdn.discordapp.com/avatars/${userId}/${typeof options.avatar === 'string' ? options.avatar : iconBigintToHash(options.avatar)}`,\n options?.size ?? 128,\n options?.format,\n )\n : `https://cdn.discordapp.com/embed/avatars/${Number(discriminator) % 5}.png`\n}\n\n/**\n * Builds a URL to the guild banner stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the link to the banner for.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource or `undefined` if no banner has been set.\n */\nexport function guildBannerUrl(\n guildId: BigString,\n options: {\n banner?: string | bigint\n size?: ImageSize\n format?: ImageFormat\n },\n): string | undefined {\n return options.banner\n ? formatImageUrl(\n `https://cdn.discordapp.com/banners/${guildId}/${typeof options.banner === 'string' ? options.banner : iconBigintToHash(options.banner)}`,\n options.size ?? 128,\n options.format,\n )\n : undefined\n}\n\n/**\n * Builds a URL to the guild icon stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the link to the banner for.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource or `undefined` if no banner has been set.\n */\nexport function guildIconUrl(\n guildId: BigString,\n imageHash: BigString | undefined,\n options?: {\n size?: ImageSize\n format?: ImageFormat\n },\n): string | undefined {\n return imageHash\n ? formatImageUrl(\n `https://cdn.discordapp.com/icons/${guildId}/${typeof imageHash === 'string' ? imageHash : iconBigintToHash(imageHash)}`,\n options?.size ?? 128,\n options?.format,\n )\n : undefined\n}\n\n/**\n * Builds the URL to a guild splash stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the splash of.\n * @param imageHash - The hash identifying the splash image.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource or `undefined` if the guild does not have a splash image set.\n */\nexport function guildSplashUrl(\n guildId: BigString,\n imageHash: BigString | undefined,\n options?: {\n size?: ImageSize\n format?: ImageFormat\n },\n): string | undefined {\n return imageHash\n ? formatImageUrl(\n `https://cdn.discordapp.com/splashes/${guildId}/${typeof imageHash === 'string' ? imageHash : iconBigintToHash(imageHash)}`,\n options?.size ?? 128,\n options?.format,\n )\n : undefined\n}\n\n/**\n * Builds a URL to the guild widget image stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the link to the widget image for.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource.\n */\nexport function getWidgetImageUrl(guildId: BigString, options?: GetGuildWidgetImageQuery): string {\n let url = `https://discordapp.com/api/guilds/${guildId}/widget.png`\n\n if (options?.style) {\n url += `?style=${options.style}`\n }\n\n return url\n}\n"],"names":["iconBigintToHash","formatImageUrl","url","size","format","includes","emojiUrl","emojiId","animated","avatarUrl","userId","discriminator","options","avatar","Number","guildBannerUrl","guildId","banner","undefined","guildIconUrl","imageHash","guildSplashUrl","getWidgetImageUrl","style"],"mappings":"AAAA,mEAAmE,GAEnE,SAASA,gBAAgB,QAAQ,YAAW;AAE5C,8BAA8B,GAC9B,OAAO,SAASC,eAAeC,GAAW,EAAEC,OAAkB,GAAG,EAAEC,MAAoB,EAAU;IAC/F,OAAO,CAAC,EAAEF,IAAI,CAAC,EAAEE,UAAWF,CAAAA,IAAIG,QAAQ,CAAC,SAAS,QAAQ,KAAK,AAAD,EAAG,MAAM,EAAEF,KAAK,CAAC;AACjF,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASG,SAASC,OAAkB,EAAEC,WAAW,KAAK,EAAU;IACrE,OAAO,CAAC,kCAAkC,EAAED,QAAQ,CAAC,EAAEC,WAAW,QAAQ,KAAK,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;CAOC,GACD,OAAO,SAASC,UACdC,MAAiB,EACjBC,aAAqB,EACrBC,OAIC,EACO;IACR,OAAOA,SAASC,SACZZ,eACE,CAAC,mCAAmC,EAAES,OAAO,CAAC,EAAE,OAAOE,QAAQC,MAAM,KAAK,WAAWD,QAAQC,MAAM,GAAGb,iBAAiBY,QAAQC,MAAM,CAAC,CAAC,CAAC,EACxID,SAAST,QAAQ,KACjBS,SAASR,UAEX,CAAC,yCAAyC,EAAEU,OAAOH,iBAAiB,EAAE,IAAI,CAAC;AACjF,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASI,eACdC,OAAkB,EAClBJ,OAIC,EACmB;IACpB,OAAOA,QAAQK,MAAM,GACjBhB,eACE,CAAC,mCAAmC,EAAEe,QAAQ,CAAC,EAAE,OAAOJ,QAAQK,MAAM,KAAK,WAAWL,QAAQK,MAAM,GAAGjB,iBAAiBY,QAAQK,MAAM,CAAC,CAAC,CAAC,EACzIL,QAAQT,IAAI,IAAI,KAChBS,QAAQR,MAAM,IAEhBc,SAAS;AACf,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASC,aACdH,OAAkB,EAClBI,SAAgC,EAChCR,OAGC,EACmB;IACpB,OAAOQ,YACHnB,eACE,CAAC,iCAAiC,EAAEe,QAAQ,CAAC,EAAE,OAAOI,cAAc,WAAWA,YAAYpB,iBAAiBoB,UAAU,CAAC,CAAC,EACxHR,SAAST,QAAQ,KACjBS,SAASR,UAEXc,SAAS;AACf,CAAC;AAED;;;;;;;CAOC,GACD,OAAO,SAASG,eACdL,OAAkB,EAClBI,SAAgC,EAChCR,OAGC,EACmB;IACpB,OAAOQ,YACHnB,eACE,CAAC,oCAAoC,EAAEe,QAAQ,CAAC,EAAE,OAAOI,cAAc,WAAWA,YAAYpB,iBAAiBoB,UAAU,CAAC,CAAC,EAC3HR,SAAST,QAAQ,KACjBS,SAASR,UAEXc,SAAS;AACf,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASI,kBAAkBN,OAAkB,EAAEJ,OAAkC,EAAU;IAChG,IAAIV,MAAM,CAAC,kCAAkC,EAAEc,QAAQ,WAAW,CAAC;IAEnE,IAAIJ,SAASW,OAAO;QAClBrB,OAAO,CAAC,OAAO,EAAEU,QAAQW,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,OAAOrB;AACT,CAAC"}
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAIA,oBAAY,SAAS;IACnB,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,KAAK,IAAA;CACN;AAED,oBAAY,QAAQ;IAClB,OAAO,IAAA;IACP,IAAI,IAAA;CACL;AAmBD,wBAAgB,YAAY,CAAC,EAC3B,QAAyB,EACzB,IAAI,GACL,GAAE;IACD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACT;iBAGgB,SAAS,WAAW,GAAG,EAAE;sBAkCpB,QAAQ;sBAJR,SAAS;qBAQV,GAAG,EAAE;oBAKN,GAAG,EAAE;oBAKL,GAAG,EAAE;qBAKJ,GAAG,EAAE;qBAKL,GAAG,EAAE;EAe9B;AAED,eAAO,MAAM,MAAM;iBA3EG,SAAS,WAAW,GAAG,EAAE;sBAkCpB,QAAQ;sBAJR,SAAS;qBAQV,GAAG,EAAE;oBAKN,GAAG,EAAE;oBAKL,GAAG,EAAE;qBAKJ,GAAG,EAAE;qBAKL,GAAG,EAAE;CAiB2B,CAAA;AAC1D,eAAe,MAAM,CAAA"}
|
package/dist/logger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */ import { bgBrightMagenta, black, bold, cyan, gray, italic, red, yellow } from './colors.js';
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-confusing-void-expression */ /* eslint-disable @typescript-eslint/explicit-function-return-type */ import { bgBrightMagenta, black, bold, cyan, gray, italic, red, yellow } from './colors.js';
|
|
2
2
|
export var LogLevels;
|
|
3
3
|
(function(LogLevels) {
|
|
4
4
|
LogLevels[LogLevels["Debug"] = 0] = "Debug";
|
|
@@ -64,7 +64,7 @@ export function createLogger({ logLevel =1 , name } = {}) {
|
|
|
64
64
|
let color = colorFunctions.get(level);
|
|
65
65
|
if (!color) color = noColor;
|
|
66
66
|
const date = new Date();
|
|
67
|
-
const
|
|
67
|
+
const log1 = [
|
|
68
68
|
bgBrightMagenta(black(`[${date.toLocaleDateString()} ${date.toLocaleTimeString()}]`)),
|
|
69
69
|
color(prefixes.get(level) ?? 'DEBUG'),
|
|
70
70
|
name ? `${name} >` : '>',
|
|
@@ -72,17 +72,17 @@ export function createLogger({ logLevel =1 , name } = {}) {
|
|
|
72
72
|
];
|
|
73
73
|
switch(level){
|
|
74
74
|
case 0:
|
|
75
|
-
return console.debug(...
|
|
75
|
+
return console.debug(...log1);
|
|
76
76
|
case 1:
|
|
77
|
-
return console.info(...
|
|
77
|
+
return console.info(...log1);
|
|
78
78
|
case 2:
|
|
79
|
-
return console.warn(...
|
|
79
|
+
return console.warn(...log1);
|
|
80
80
|
case 3:
|
|
81
|
-
return console.error(...
|
|
81
|
+
return console.error(...log1);
|
|
82
82
|
case 4:
|
|
83
|
-
return console.error(...
|
|
83
|
+
return console.error(...log1);
|
|
84
84
|
default:
|
|
85
|
-
return console.log(...
|
|
85
|
+
return console.log(...log1);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
function setLevel(level) {
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { bgBrightMagenta, black, bold, cyan, gray, italic, red, yellow } from './colors.js'\n\nexport enum LogLevels {\n Debug,\n Info,\n Warn,\n Error,\n Fatal,\n}\n\nexport enum LogDepth {\n Minimal,\n Full,\n}\n\nconst prefixes = new Map<LogLevels, string>([\n [LogLevels.Debug, 'DEBUG'],\n [LogLevels.Info, 'INFO'],\n [LogLevels.Warn, 'WARN'],\n [LogLevels.Error, 'ERROR'],\n [LogLevels.Fatal, 'FATAL'],\n])\n\nconst noColor: (str: string) => string = (msg) => msg\nconst colorFunctions = new Map<LogLevels, (str: string) => string>([\n [LogLevels.Debug, gray],\n [LogLevels.Info, cyan],\n [LogLevels.Warn, yellow],\n [LogLevels.Error, (str: string) => red(str)],\n [LogLevels.Fatal, (str: string) => red(bold(italic(str)))],\n])\n\nexport function createLogger({\n logLevel = LogLevels.Info,\n name,\n}: {\n logLevel?: LogLevels\n name?: string\n} = {}) {\n let depth = LogDepth.Minimal\n\n function log(level: LogLevels, ...args: any[]) {\n if (level < logLevel) return\n\n let color = colorFunctions.get(level)\n if (!color) color = noColor\n\n const date = new Date()\n const log = [\n bgBrightMagenta(black(`[${date.toLocaleDateString()} ${date.toLocaleTimeString()}]`)),\n color(prefixes.get(level) ?? 'DEBUG'),\n name ? `${name} >` : '>',\n ...args,\n ]\n\n switch (level) {\n case LogLevels.Debug:\n return console.debug(...log)\n case LogLevels.Info:\n return console.info(...log)\n case LogLevels.Warn:\n return console.warn(...log)\n case LogLevels.Error:\n return console.error(...log)\n case LogLevels.Fatal:\n return console.error(...log)\n default:\n return console.log(...log)\n }\n }\n\n function setLevel(level: LogLevels) {\n logLevel = level\n }\n\n function setDepth(level: LogDepth) {\n depth = level\n }\n\n function debug(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Debug, args[0])\n else log(LogLevels.Debug, ...args)\n }\n\n function info(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Info, args[0])\n else log(LogLevels.Info, ...args)\n }\n\n function warn(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Warn, args[0])\n else log(LogLevels.Warn, ...args)\n }\n\n function error(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Error, args[0])\n else log(LogLevels.Error, ...args)\n }\n\n function fatal(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Fatal, args[0])\n else log(LogLevels.Fatal, ...args)\n }\n\n return {\n log,\n setDepth,\n setLevel,\n debug,\n info,\n warn,\n error,\n fatal,\n }\n}\n\nexport const logger = createLogger({ name: 'Discordeno' })\nexport default logger\n"],"names":["bgBrightMagenta","black","bold","cyan","gray","italic","red","yellow","LogLevels","Debug","Info","Warn","Error","Fatal","LogDepth","Minimal","Full","prefixes","Map","noColor","msg","colorFunctions","str","createLogger","logLevel","name","depth","log","level","args","color","get","date","Date","toLocaleDateString","toLocaleTimeString","console","debug","info","warn","error","setLevel","setDepth","fatal","logger"],"mappings":"AAAA,mEAAmE,GACnE,SAASA,eAAe,EAAEC,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,QAAQ,cAAa;WAEpF;UAAKC,SAAS;IAATA,UAAAA,UACVC,WAAAA,KAAAA;IADUD,UAAAA,UAEVE,UAAAA,KAAAA;IAFUF,UAAAA,UAGVG,UAAAA,KAAAA;IAHUH,UAAAA,UAIVI,WAAAA,KAAAA;IAJUJ,UAAAA,UAKVK,WAAAA,KAAAA;GALUL,cAAAA;WAQL;UAAKM,QAAQ;IAARA,SAAAA,SACVC,aAAAA,KAAAA;IADUD,SAAAA,SAEVE,UAAAA,KAAAA;GAFUF,aAAAA;AAKZ,MAAMG,WAAW,IAAIC,IAAuB;IAC1C;QAbAT;QAakB;KAAQ;IAC1B;QAbAC;QAaiB;KAAO;IACxB;QAbAC;QAaiB;KAAO;IACxB;QAbAC;QAakB;KAAQ;IAC1B;QAbAC;QAakB;KAAQ;CAC3B;AAED,MAAMM,UAAmC,CAACC,MAAQA;AAClD,MAAMC,iBAAiB,IAAIH,IAAwC;IACjE;QAtBAT;QAsBkBL;KAAK;IACvB;QAtBAM;QAsBiBP;KAAK;IACtB;QAtBAQ;QAsBiBJ;KAAO;IACxB;QAtBAK;QAsBkB,CAACU,MAAgBhB,IAAIgB;KAAK;IAC5C;QAtBAT;QAsBkB,CAACS,MAAgBhB,IAAIJ,KAAKG,OAAOiB;KAAO;CAC3D;AAED,OAAO,SAASC,aAAa,EAC3BC,UA7BAd,EA6ByB,EACzBe,KAAI,EAIL,GAAG,CAAC,CAAC,EAAE;IACN,IAAIC,QA5BJX;IA8BA,SAASY,IAAIC,KAAgB,EAAE,GAAGC,IAAW,EAAE;QAC7C,IAAID,QAAQJ,UAAU;QAEtB,IAAIM,QAAQT,eAAeU,GAAG,CAACH;QAC/B,IAAI,CAACE,OAAOA,QAAQX;QAEpB,MAAMa,OAAO,IAAIC;QACjB,MAAMN,
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-confusing-void-expression */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { bgBrightMagenta, black, bold, cyan, gray, italic, red, yellow } from './colors.js'\n\nexport enum LogLevels {\n Debug,\n Info,\n Warn,\n Error,\n Fatal,\n}\n\nexport enum LogDepth {\n Minimal,\n Full,\n}\n\nconst prefixes = new Map<LogLevels, string>([\n [LogLevels.Debug, 'DEBUG'],\n [LogLevels.Info, 'INFO'],\n [LogLevels.Warn, 'WARN'],\n [LogLevels.Error, 'ERROR'],\n [LogLevels.Fatal, 'FATAL'],\n])\n\nconst noColor: (str: string) => string = (msg) => msg\nconst colorFunctions = new Map<LogLevels, (str: string) => string>([\n [LogLevels.Debug, gray],\n [LogLevels.Info, cyan],\n [LogLevels.Warn, yellow],\n [LogLevels.Error, (str: string) => red(str)],\n [LogLevels.Fatal, (str: string) => red(bold(italic(str)))],\n])\n\nexport function createLogger({\n logLevel = LogLevels.Info,\n name,\n}: {\n logLevel?: LogLevels\n name?: string\n} = {}) {\n let depth = LogDepth.Minimal\n\n function log(level: LogLevels, ...args: any[]) {\n if (level < logLevel) return\n\n let color = colorFunctions.get(level)\n if (!color) color = noColor\n\n const date = new Date()\n const log = [\n bgBrightMagenta(black(`[${date.toLocaleDateString()} ${date.toLocaleTimeString()}]`)),\n color(prefixes.get(level) ?? 'DEBUG'),\n name ? `${name} >` : '>',\n ...args,\n ]\n\n switch (level) {\n case LogLevels.Debug:\n return console.debug(...log)\n case LogLevels.Info:\n return console.info(...log)\n case LogLevels.Warn:\n return console.warn(...log)\n case LogLevels.Error:\n return console.error(...log)\n case LogLevels.Fatal:\n return console.error(...log)\n default:\n return console.log(...log)\n }\n }\n\n function setLevel(level: LogLevels) {\n logLevel = level\n }\n\n function setDepth(level: LogDepth) {\n depth = level\n }\n\n function debug(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Debug, args[0])\n else log(LogLevels.Debug, ...args)\n }\n\n function info(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Info, args[0])\n else log(LogLevels.Info, ...args)\n }\n\n function warn(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Warn, args[0])\n else log(LogLevels.Warn, ...args)\n }\n\n function error(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Error, args[0])\n else log(LogLevels.Error, ...args)\n }\n\n function fatal(...args: any[]) {\n if (LogDepth.Minimal === depth) log(LogLevels.Fatal, args[0])\n else log(LogLevels.Fatal, ...args)\n }\n\n return {\n log,\n setDepth,\n setLevel,\n debug,\n info,\n warn,\n error,\n fatal,\n }\n}\n\nexport const logger = createLogger({ name: 'Discordeno' })\nexport default logger\n"],"names":["bgBrightMagenta","black","bold","cyan","gray","italic","red","yellow","LogLevels","Debug","Info","Warn","Error","Fatal","LogDepth","Minimal","Full","prefixes","Map","noColor","msg","colorFunctions","str","createLogger","logLevel","name","depth","log","level","args","color","get","date","Date","toLocaleDateString","toLocaleTimeString","console","debug","info","warn","error","setLevel","setDepth","fatal","logger"],"mappings":"AAAA,kEAAkE,GAClE,mEAAmE,GACnE,SAASA,eAAe,EAAEC,KAAK,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAEC,GAAG,EAAEC,MAAM,QAAQ,cAAa;WAEpF;UAAKC,SAAS;IAATA,UAAAA,UACVC,WAAAA,KAAAA;IADUD,UAAAA,UAEVE,UAAAA,KAAAA;IAFUF,UAAAA,UAGVG,UAAAA,KAAAA;IAHUH,UAAAA,UAIVI,WAAAA,KAAAA;IAJUJ,UAAAA,UAKVK,WAAAA,KAAAA;GALUL,cAAAA;WAQL;UAAKM,QAAQ;IAARA,SAAAA,SACVC,aAA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":"","sources":["../src/urlToBase64.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"urlToBase64.d.ts","sourceRoot":"","sources":["../src/urlToBase64.ts"],"names":[],"mappings":"AAGA,uFAAuF;AACvF,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK9D"}
|
package/dist/urlToBase64.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
1
2
|
import { encode } from './base64.js';
|
|
2
3
|
/** Converts a url to base 64. Useful for example, uploading/creating server emojis. */ export async function urlToBase64(url) {
|
|
3
4
|
const buffer = await fetch(url).then(async (res)=>await res.arrayBuffer());
|
package/dist/urlToBase64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/urlToBase64.ts"],"sourcesContent":["import { encode } from './base64.js'\n\n/** Converts a url to base 64. Useful for example, uploading/creating server emojis. */\nexport async function urlToBase64(url: string): Promise<string> {\n const buffer = await fetch(url).then(async (res) => await res.arrayBuffer())\n const imageStr = encode(buffer)\n const type = url.substring(url.lastIndexOf('.') + 1)\n return `data:image/${type};base64,${imageStr}`\n}\n"],"names":["encode","urlToBase64","url","buffer","
|
|
1
|
+
{"version":3,"sources":["../src/urlToBase64.ts"],"sourcesContent":["import fetch from 'node-fetch'\nimport { encode } from './base64.js'\n\n/** Converts a url to base 64. Useful for example, uploading/creating server emojis. */\nexport async function urlToBase64(url: string): Promise<string> {\n const buffer = await fetch(url).then(async (res) => await res.arrayBuffer())\n const imageStr = encode(buffer)\n const type = url.substring(url.lastIndexOf('.') + 1)\n return `data:image/${type};base64,${imageStr}`\n}\n"],"names":["fetch","encode","urlToBase64","url","buffer","then","res","arrayBuffer","imageStr","type","substring","lastIndexOf"],"mappings":"AAAA,OAAOA,WAAW,aAAY;AAC9B,SAASC,MAAM,QAAQ,cAAa;AAEpC,qFAAqF,GACrF,OAAO,eAAeC,YAAYC,GAAW,EAAmB;IAC9D,MAAMC,SAAS,MAAMJ,MAAMG,KAAKE,IAAI,CAAC,OAAOC,MAAQ,MAAMA,IAAIC,WAAW;IACzE,MAAMC,WAAWP,OAAOG;IACxB,MAAMK,OAAON,IAAIO,SAAS,CAACP,IAAIQ,WAAW,CAAC,OAAO;IAClD,OAAO,CAAC,WAAW,EAAEF,KAAK,QAAQ,EAAED,SAAS,CAAC;AAChD,CAAC"}
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrD;AAID,6DAA6D;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,wBAAsB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrD;AAID,6DAA6D;AAE7D,wBAAgB,WAAW,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,WAAW,GAAG,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAGxH"}
|
package/dist/utils.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
}
|
|
7
7
|
// Typescript is not so good as we developers so we need this little utility function to help it out
|
|
8
8
|
// Taken from https://fettblog.eu/typescript-hasownproperty/
|
|
9
|
-
/** TS save way to check if a property exists in an object */
|
|
9
|
+
/** TS save way to check if a property exists in an object */ // eslint-disable-next-line @typescript-eslint/ban-types
|
|
10
|
+
export function hasProperty(obj, prop) {
|
|
10
11
|
// eslint-disable-next-line no-prototype-builtins
|
|
11
12
|
return obj.hasOwnProperty(prop);
|
|
12
13
|
}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["/** Pause the execution for a given amount of milliseconds. */\nexport async function delay(ms: number): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/return-await\n return new Promise(\n (resolve): NodeJS.Timeout =>\n setTimeout((): void => {\n resolve()\n }, ms),\n )\n}\n\n// Typescript is not so good as we developers so we need this little utility function to help it out\n// Taken from https://fettblog.eu/typescript-hasownproperty/\n/** TS save way to check if a property exists in an object */\nexport function hasProperty<T extends {}, Y extends PropertyKey = string>(obj: T, prop: Y): obj is T & Record<Y, unknown> {\n // eslint-disable-next-line no-prototype-builtins\n return obj.hasOwnProperty(prop)\n}\n"],"names":["delay","ms","Promise","resolve","setTimeout","hasProperty","obj","prop","hasOwnProperty"],"mappings":"AAAA,4DAA4D,GAC5D,OAAO,eAAeA,MAAMC,EAAU,EAAiB;IACrD,2DAA2D;IAC3D,OAAO,IAAIC,QACT,CAACC,UACCC,WAAW,IAAY;YACrBD;QACF,GAAGF;AAET,CAAC;AAED,oGAAoG;AACpG,4DAA4D;AAC5D,2DAA2D,GAC3D,OAAO,SAASI,YAA0DC,GAAM,EAAEC,IAAO,EAAiC;IACxH,iDAAiD;IACjD,OAAOD,IAAIE,cAAc,CAACD;AAC5B,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["/** Pause the execution for a given amount of milliseconds. */\nexport async function delay(ms: number): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/return-await\n return new Promise(\n (resolve): NodeJS.Timeout =>\n setTimeout((): void => {\n resolve()\n }, ms),\n )\n}\n\n// Typescript is not so good as we developers so we need this little utility function to help it out\n// Taken from https://fettblog.eu/typescript-hasownproperty/\n/** TS save way to check if a property exists in an object */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function hasProperty<T extends {}, Y extends PropertyKey = string>(obj: T, prop: Y): obj is T & Record<Y, unknown> {\n // eslint-disable-next-line no-prototype-builtins\n return obj.hasOwnProperty(prop)\n}\n"],"names":["delay","ms","Promise","resolve","setTimeout","hasProperty","obj","prop","hasOwnProperty"],"mappings":"AAAA,4DAA4D,GAC5D,OAAO,eAAeA,MAAMC,EAAU,EAAiB;IACrD,2DAA2D;IAC3D,OAAO,IAAIC,QACT,CAACC,UACCC,WAAW,IAAY;YACrBD;QACF,GAAGF;AAET,CAAC;AAED,oGAAoG;AACpG,4DAA4D;AAC5D,2DAA2D,GAC3D,wDAAwD;AACxD,OAAO,SAASI,YAA0DC,GAAM,EAAEC,IAAO,EAAiC;IACxH,iDAAiD;IACjD,OAAOD,IAAIE,cAAc,CAACD;AAC5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discordeno/utils",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.8bb91fa",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -23,24 +23,25 @@
|
|
|
23
23
|
"test:test-type": "tsc --project tsconfig.test.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@discordeno/types": "19.0.0-next.
|
|
26
|
+
"@discordeno/types": "19.0.0-next.8bb91fa",
|
|
27
|
+
"node-fetch": "^3.3.1",
|
|
27
28
|
"tweetnacl": "^1.0.3"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@swc/cli": "^0.1.
|
|
31
|
-
"@swc/core": "^1.3.
|
|
32
|
-
"@types/chai": "^4",
|
|
33
|
-
"@types/mocha": "^10",
|
|
34
|
-
"@types/node": "^18.
|
|
31
|
+
"@swc/cli": "^0.1.62",
|
|
32
|
+
"@swc/core": "^1.3.40",
|
|
33
|
+
"@types/chai": "^4.3.4",
|
|
34
|
+
"@types/mocha": "^10.0.1",
|
|
35
|
+
"@types/node": "^18.15.3",
|
|
35
36
|
"@types/sinon": "^10.0.13",
|
|
36
|
-
"c8": "^7.
|
|
37
|
+
"c8": "^7.13.0",
|
|
37
38
|
"chai": "^4.3.7",
|
|
38
|
-
"eslint": "^8.0
|
|
39
|
+
"eslint": "^8.36.0",
|
|
39
40
|
"eslint-config-discordeno": "*",
|
|
40
|
-
"mocha": "^10.
|
|
41
|
-
"sinon": "^15.0.
|
|
41
|
+
"mocha": "^10.2.0",
|
|
42
|
+
"sinon": "^15.0.2",
|
|
42
43
|
"ts-node": "^10.9.1",
|
|
43
44
|
"tsconfig": "*",
|
|
44
|
-
"typescript": "^4.9.
|
|
45
|
+
"typescript": "^4.9.5"
|
|
45
46
|
}
|
|
46
47
|
}
|