From 0436a4b162d5bde5e02ca08c988a2e7e0e1f6841 Mon Sep 17 00:00:00 2001 From: socram03 Date: Mon, 5 Jun 2023 05:01:57 +0000 Subject: [PATCH] fix(rest): proxy cumulative routes --- packages/helpers/src/commands/index.ts | 6 +++--- packages/helpers/src/components/index.ts | 10 +++++----- packages/rest/src/Router.ts | 14 +++++--------- packages/ws/src/shard/Shard.ts | 4 ++-- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/packages/helpers/src/commands/index.ts b/packages/helpers/src/commands/index.ts index 769edc7..4e4a865 100644 --- a/packages/helpers/src/commands/index.ts +++ b/packages/helpers/src/commands/index.ts @@ -1,3 +1,3 @@ -export * from "./slash/SlashCommand"; -export * from "./slash/SlashCommandOption"; -export * from "./contextMenu/ContextCommand"; +export * from './slash/SlashCommand'; +export * from './slash/SlashCommandOption'; +export * from './contextMenu/ContextCommand'; diff --git a/packages/helpers/src/components/index.ts b/packages/helpers/src/components/index.ts index f2888df..371ac8d 100644 --- a/packages/helpers/src/components/index.ts +++ b/packages/helpers/src/components/index.ts @@ -1,5 +1,5 @@ -export * from "./ActionRow"; -export * from "./MessageButton"; -export * from "./SelectMenu"; -export * from "./TextInput"; -export * from "./BaseComponent"; +export * from './ActionRow'; +export * from './MessageButton'; +export * from './SelectMenu'; +export * from './TextInput'; +export * from './BaseComponent'; diff --git a/packages/rest/src/Router.ts b/packages/rest/src/Router.ts index 509f6cf..900541b 100644 --- a/packages/rest/src/Router.ts +++ b/packages/rest/src/Router.ts @@ -25,12 +25,10 @@ export class Router { if (ArrRequestsMethods.includes(key)) { return (...options: any[]) => this.rest[key](`/${route.join('/')}`, ...options); } - route.push(key); - return this.createProxy(route); + return this.createProxy([...route, key]); }, apply: (...[, _, args]) => { - route.push(...args.filter((x) => x != null)); - return this.createProxy(route); + return this.createProxy([...route, ...args.filter((x) => x != null)]); } }) as unknown as Routes; } @@ -48,7 +46,7 @@ export class CDN { const lastRoute = `${CDN_URL}/${route.join('/')}`; if (value) { if (typeof value !== 'string') { - // rome-ignore lint/style/noParameterAssign: ?! + // rome-ignore lint/nursery/noParameterAssign: fix multiples value types value = String(value); } return `${lastRoute}/${value}`; @@ -56,12 +54,10 @@ export class CDN { return lastRoute; }; } - route.push(key); - return this.createProxy(route); + return this.createProxy([...route, key]); }, apply: (...[, _, args]) => { - route.push(...args.filter((x) => x != null)); - return this.createProxy(route); + return this.createProxy([...route, ...args.filter((x) => x != null)]); } }) as unknown as CDNRoutes; } diff --git a/packages/ws/src/shard/Shard.ts b/packages/ws/src/shard/Shard.ts index 1201361..5f994a8 100644 --- a/packages/ws/src/shard/Shard.ts +++ b/packages/ws/src/shard/Shard.ts @@ -576,8 +576,8 @@ export class Shard { } /** This function communicates with the management process, in order to know whether its free to identify. When this function resolves, this means that the shard is allowed to send an identify payload to discord. */ - async requestIdentify(): Promise { } + async requestIdentify(): Promise {} /** This function communicates with the management process, in order to tell it can identify the next shard. */ - async shardIsReady(): Promise { } + async shardIsReady(): Promise {} }