refactor(IContextFetchingStrategy): explicitly name forwarded properties (#10652)

This commit is contained in:
Denis-Adrian Cristea
2024-12-10 08:34:15 +02:00
committed by GitHub
parent 5d00332b8c
commit 2ff47d85cf

View File

@@ -3,15 +3,20 @@ import type { APIGatewayBotInfo } from 'discord-api-types/v10';
import type { SessionInfo, WebSocketManager, WebSocketManagerOptions } from '../../ws/WebSocketManager.js'; import type { SessionInfo, WebSocketManager, WebSocketManagerOptions } from '../../ws/WebSocketManager.js';
export interface FetchingStrategyOptions export interface FetchingStrategyOptions
extends Omit< extends Pick<
WebSocketManagerOptions, WebSocketManagerOptions,
| 'buildIdentifyThrottler' | 'compression'
| 'buildStrategy' | 'encoding'
| 'rest' | 'handshakeTimeout'
| 'retrieveSessionInfo' | 'helloTimeout'
| 'shardCount' | 'identifyProperties'
| 'shardIds' | 'initialPresence'
| 'updateSessionInfo' | 'intents'
| 'largeThreshold'
| 'readyTimeout'
| 'token'
| 'useIdentifyCompression'
| 'version'
> { > {
readonly gatewayInformation: APIGatewayBotInfo; readonly gatewayInformation: APIGatewayBotInfo;
readonly shardCount: number; readonly shardCount: number;
@@ -33,20 +38,20 @@ export interface IContextFetchingStrategy {
} }
export async function managerToFetchingStrategyOptions(manager: WebSocketManager): Promise<FetchingStrategyOptions> { export async function managerToFetchingStrategyOptions(manager: WebSocketManager): Promise<FetchingStrategyOptions> {
const {
buildIdentifyThrottler,
buildStrategy,
retrieveSessionInfo,
updateSessionInfo,
shardCount,
shardIds,
rest,
...managerOptions
} = manager.options;
return { return {
...managerOptions, compression: manager.options.compression,
encoding: manager.options.encoding,
handshakeTimeout: manager.options.handshakeTimeout,
helloTimeout: manager.options.helloTimeout,
identifyProperties: manager.options.identifyProperties,
initialPresence: manager.options.initialPresence,
intents: manager.options.intents,
largeThreshold: manager.options.largeThreshold,
readyTimeout: manager.options.readyTimeout,
token: manager.token, token: manager.token,
useIdentifyCompression: manager.options.useIdentifyCompression,
version: manager.options.version,
gatewayInformation: await manager.fetchGatewayInformation(), gatewayInformation: await manager.fetchGatewayInformation(),
shardCount: await manager.getShardCount(), shardCount: await manager.getShardCount(),
}; };