@discordeno/gateway 19.0.0-next.40c19da → 19.0.0-next.4142946
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 +16 -13
- package/dist/cjs/Shard.cjs +488 -0
- package/dist/cjs/index.cjs +22 -0
- package/dist/cjs/manager.cjs +463 -0
- package/dist/cjs/types.cjs +41 -0
- package/dist/esm/Shard.js +465 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/manager.js +448 -0
- package/dist/esm/types.js +23 -0
- package/dist/{Shard.d.ts → types/Shard.d.ts} +13 -89
- package/dist/types/Shard.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/{manager.d.ts → types/manager.d.ts} +79 -12
- package/dist/types/manager.d.ts.map +1 -0
- package/dist/{types.d.ts → types/types.d.ts} +2 -3
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +31 -27
- package/dist/Shard.d.ts.map +0 -1
- package/dist/Shard.js +0 -596
- package/dist/Shard.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +0 -1
- package/dist/manager.d.ts.map +0 -1
- package/dist/manager.js +0 -243
- package/dist/manager.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -23
- package/dist/types.js.map +0 -1
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type { BotStatusUpdate, ShardEvents, ShardGatewayConfig, ShardHeart, ShardSocketRequest, StatusUpdate, UpdateVoiceState } from './types.js';
|
|
1
|
+
import type { DiscordGatewayPayload } from '@discordeno/types';
|
|
2
|
+
import { LeakyBucket, logger } from '@discordeno/utils';
|
|
3
|
+
import NodeWebSocket from 'ws';
|
|
4
|
+
import type { BotStatusUpdate, ShardEvents, ShardGatewayConfig, ShardHeart, ShardSocketRequest } from './types.js';
|
|
6
5
|
import { ShardState } from './types.js';
|
|
7
6
|
export declare class DiscordenoShard {
|
|
8
7
|
/** The id of the shard */
|
|
@@ -20,7 +19,7 @@ export declare class DiscordenoShard {
|
|
|
20
19
|
/** Current session id of the shard if present. */
|
|
21
20
|
sessionId?: string;
|
|
22
21
|
/** This contains the WebSocket connection to Discord, if currently connected. */
|
|
23
|
-
socket?:
|
|
22
|
+
socket?: NodeWebSocket;
|
|
24
23
|
/** Current internal state of the this. */
|
|
25
24
|
state: ShardState;
|
|
26
25
|
/** The url provided by discord to use when resuming a connection for this this. */
|
|
@@ -33,22 +32,12 @@ export declare class DiscordenoShard {
|
|
|
33
32
|
resolves: Map<"READY" | "RESUMED" | "INVALID_SESSION", (payload: DiscordGatewayPayload) => void>;
|
|
34
33
|
/** Shard bucket. Only access this if you know what you are doing. Bucket for handling shard request rate limits. */
|
|
35
34
|
bucket: LeakyBucket;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
requestMembers: {
|
|
39
|
-
/**
|
|
40
|
-
* Whether or not request member requests should be cached.
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
/** The pending requests. */
|
|
45
|
-
pending: Collection<string, RequestMemberRequest>;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
35
|
+
/** Logger for the bucket */
|
|
36
|
+
logger: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
48
37
|
constructor(options: ShardCreateOptions);
|
|
49
38
|
/** The gateway configuration which is used to connect to Discord. */
|
|
50
39
|
get gatewayConfig(): ShardGatewayConfig;
|
|
51
|
-
/** The url to connect to.
|
|
40
|
+
/** The url to connect to. Initially this is the discord gateway url, and then is switched to resume gateway url once a READY is received. */
|
|
52
41
|
get connectionUrl(): string;
|
|
53
42
|
/** Calculate the amount of requests which can safely be made per rate limit interval, before the gateway gets disconnected due to an exceeded rate limit. */
|
|
54
43
|
calculateSafeRequests(): number;
|
|
@@ -70,11 +59,12 @@ export declare class DiscordenoShard {
|
|
|
70
59
|
/** Shutdown the this. Forcefully disconnect the shard from Discord. The shard may not attempt to reconnect with Discord. */
|
|
71
60
|
shutdown(): Promise<void>;
|
|
72
61
|
/** Handle a gateway connection close. */
|
|
73
|
-
handleClose(close:
|
|
62
|
+
handleClose(close: NodeWebSocket.CloseEvent): Promise<void>;
|
|
74
63
|
/** Handles a incoming gateway packet. */
|
|
75
64
|
handleDiscordPacket(packet: DiscordGatewayPayload): Promise<void>;
|
|
65
|
+
forwardToBot(packet: DiscordGatewayPayload): void;
|
|
76
66
|
/** Handle an incoming gateway message. */
|
|
77
|
-
handleMessage(message:
|
|
67
|
+
handleMessage(message: NodeWebSocket.MessageEvent): Promise<void>;
|
|
78
68
|
/**
|
|
79
69
|
* Override in order to make the shards presence.
|
|
80
70
|
* async in case devs create the presence based on eg. database values.
|
|
@@ -89,74 +79,6 @@ export declare class DiscordenoShard {
|
|
|
89
79
|
startHeartbeating(interval: number): void;
|
|
90
80
|
/** Stop the heartbeating process with discord. */
|
|
91
81
|
stopHeartbeating(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Connects the bot user to a voice or stage channel.
|
|
94
|
-
*
|
|
95
|
-
* This function sends the _Update Voice State_ gateway command over the gateway behind the scenes.
|
|
96
|
-
*
|
|
97
|
-
* @param guildId - The ID of the guild the voice channel to leave is in.
|
|
98
|
-
* @param channelId - The ID of the channel you want to join.
|
|
99
|
-
*
|
|
100
|
-
* @remarks
|
|
101
|
-
* Requires the `CONNECT` permission.
|
|
102
|
-
*
|
|
103
|
-
* Fires a _Voice State Update_ gateway event.
|
|
104
|
-
*
|
|
105
|
-
* @see {@link https://discord.com/developers/docs/topics/gateway#update-voice-state}
|
|
106
|
-
*/
|
|
107
|
-
joinVoiceChannel(guildId: BigString, channelId: BigString, options?: AtLeastOne<Omit<UpdateVoiceState, 'guildId' | 'channelId'>>): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* Edits the bot status in all shards that this gateway manages.
|
|
110
|
-
*
|
|
111
|
-
* @param data The status data to set the bots status to.
|
|
112
|
-
* @returns Promise<void>
|
|
113
|
-
*/
|
|
114
|
-
editBotStatus(data: StatusUpdate): Promise<void>;
|
|
115
|
-
/**
|
|
116
|
-
* Edits the bot's status on one shard.
|
|
117
|
-
*
|
|
118
|
-
* @param shardId The shard id to edit the status for.
|
|
119
|
-
* @param data The status data to set the bots status to.
|
|
120
|
-
* @returns Promise<void>
|
|
121
|
-
*/
|
|
122
|
-
editShardStatus(data: StatusUpdate): Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Fetches the list of members for a guild over the gateway.
|
|
125
|
-
*
|
|
126
|
-
* @param guildId - The ID of the guild to get the list of members for.
|
|
127
|
-
* @param options - The parameters for the fetching of the members.
|
|
128
|
-
*
|
|
129
|
-
* @remarks
|
|
130
|
-
* If requesting the entire member list:
|
|
131
|
-
* - Requires the `GUILD_MEMBERS` intent.
|
|
132
|
-
*
|
|
133
|
-
* If requesting presences ({@link RequestGuildMembers.presences | presences} set to `true`):
|
|
134
|
-
* - Requires the `GUILD_PRESENCES` intent.
|
|
135
|
-
*
|
|
136
|
-
* If requesting a prefix ({@link RequestGuildMembers.query | query} non-`undefined`):
|
|
137
|
-
* - Returns a maximum of 100 members.
|
|
138
|
-
*
|
|
139
|
-
* If requesting a users by ID ({@link RequestGuildMembers.userIds | userIds} non-`undefined`):
|
|
140
|
-
* - Returns a maximum of 100 members.
|
|
141
|
-
*
|
|
142
|
-
* Fires a _Guild Members Chunk_ gateway event for every 1000 members fetched.
|
|
143
|
-
*
|
|
144
|
-
* @see {@link https://discord.com/developers/docs/topics/gateway#request-guild-members}
|
|
145
|
-
*/
|
|
146
|
-
requestMembers(guildId: BigString, options?: Omit<RequestGuildMembers, 'guildId'>): Promise<Camelize<DiscordMember[]>>;
|
|
147
|
-
/**
|
|
148
|
-
* Leaves the voice channel the bot user is currently in.
|
|
149
|
-
*
|
|
150
|
-
* This function sends the _Update Voice State_ gateway command over the gateway behind the scenes.
|
|
151
|
-
*
|
|
152
|
-
* @param guildId - The ID of the guild the voice channel to leave is in.
|
|
153
|
-
*
|
|
154
|
-
* @remarks
|
|
155
|
-
* Fires a _Voice State Update_ gateway event.
|
|
156
|
-
*
|
|
157
|
-
* @see {@link https://discord.com/developers/docs/topics/gateway#update-voice-state}
|
|
158
|
-
*/
|
|
159
|
-
leaveVoiceChannel(guildId: BigString): Promise<void>;
|
|
160
82
|
}
|
|
161
83
|
export interface ShardCreateOptions {
|
|
162
84
|
/** The shard id */
|
|
@@ -165,6 +87,8 @@ export interface ShardCreateOptions {
|
|
|
165
87
|
connection: ShardGatewayConfig;
|
|
166
88
|
/** The event handlers for events on the shard. */
|
|
167
89
|
events: ShardEvents;
|
|
90
|
+
/** The logger for the shard */
|
|
91
|
+
logger?: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
168
92
|
/** The handler to request a space to make an identify request. */
|
|
169
93
|
requestIdentify?: () => Promise<void>;
|
|
170
94
|
/** The handler to alert the gateway manager that this shard has received a READY event. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shard.d.ts","sourceRoot":"","sources":["../../src/Shard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAA8B,MAAM,mBAAmB,CAAA;AAE1F,OAAO,EAAE,WAAW,EAAmB,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,aAAa,MAAM,IAAI,CAAA;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAClH,OAAO,EAAyB,UAAU,EAAE,MAAM,YAAY,CAAA;AAI9D,qBAAa,eAAe;IAC1B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,qFAAqF;IACrF,UAAU,EAAE,kBAAkB,CAAA;IAC9B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CAAC,IAAI,CAAC,CAAA;IACrC,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACnC;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { Collection } from '@discordeno/utils';
|
|
1
|
+
import { type AtLeastOne, type BigString, type Camelize, type DiscordGetGatewayBot, type DiscordMemberWithUser, type RequestGuildMembers } from '@discordeno/types';
|
|
2
|
+
import { Collection, logger } from '@discordeno/utils';
|
|
3
3
|
import Shard from './Shard.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type ShardEvents, type ShardSocketRequest, type StatusUpdate, type UpdateVoiceState } from './types.js';
|
|
5
5
|
export declare function createGatewayManager(options: CreateGatewayManagerOptions): GatewayManager;
|
|
6
6
|
export interface CreateGatewayManagerOptions {
|
|
7
7
|
/**
|
|
@@ -19,6 +19,11 @@ export interface CreateGatewayManagerOptions {
|
|
|
19
19
|
* @default 5300
|
|
20
20
|
*/
|
|
21
21
|
spawnShardDelay?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to send the discord packets in snake case form.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
preferSnakeCase?: boolean;
|
|
22
27
|
/**
|
|
23
28
|
* Total amount of shards your bot uses. Useful for zero-downtime updates or resharding.
|
|
24
29
|
* @default 1
|
|
@@ -77,7 +82,7 @@ export interface CreateGatewayManagerOptions {
|
|
|
77
82
|
*/
|
|
78
83
|
version?: number;
|
|
79
84
|
/** The events handlers */
|
|
80
|
-
events
|
|
85
|
+
events?: ShardEvents;
|
|
81
86
|
/** This managers cache related settings. */
|
|
82
87
|
cache?: {
|
|
83
88
|
requestMembers?: {
|
|
@@ -86,10 +91,13 @@ export interface CreateGatewayManagerOptions {
|
|
|
86
91
|
* @default false
|
|
87
92
|
*/
|
|
88
93
|
enabled?: boolean;
|
|
89
|
-
/** The pending requests. */
|
|
90
|
-
pending: Collection<string, RequestMemberRequest>;
|
|
91
94
|
};
|
|
92
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* The logger that the gateway manager will use
|
|
98
|
+
* @default logger // The logger exported by `@discordeno/utils`
|
|
99
|
+
*/
|
|
100
|
+
logger?: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
93
101
|
}
|
|
94
102
|
export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
95
103
|
/** The max concurrency buckets. Those will be created when the `spawnShards` (which calls `prepareBuckets` under the hood) function gets called. */
|
|
@@ -103,6 +111,52 @@ export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
|
103
111
|
}>;
|
|
104
112
|
/** The shards that are created. */
|
|
105
113
|
shards: Map<number, Shard>;
|
|
114
|
+
/** The logger for the gateway manager */
|
|
115
|
+
logger: Pick<typeof logger, 'debug' | 'info' | 'warn' | 'error' | 'fatal'>;
|
|
116
|
+
/** Everything related to resharding. */
|
|
117
|
+
resharding: {
|
|
118
|
+
/**
|
|
119
|
+
* Whether or not automated resharding should be enabled.
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
122
|
+
enabled: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The % of how full a shard is when resharding should be triggered.
|
|
125
|
+
* @default 80 as in 80%
|
|
126
|
+
*/
|
|
127
|
+
shardsFullPercentage: number;
|
|
128
|
+
/**
|
|
129
|
+
* The interval in milliseconds, of how often to check whether resharding is needed and reshard automatically. Set to -1 to disable auto resharding.
|
|
130
|
+
* @default 28800000 (8 hours)
|
|
131
|
+
*/
|
|
132
|
+
checkInterval: number;
|
|
133
|
+
/**
|
|
134
|
+
* The interval id of the check interval. This is used to clear the interval when the manager is shutdown.
|
|
135
|
+
*/
|
|
136
|
+
checkIntervalId?: NodeJS.Timeout | undefined;
|
|
137
|
+
/** Holds the shards that resharding has created. Once resharding is done, this replaces the gateway.shards */
|
|
138
|
+
shards: Collection<number, Shard>;
|
|
139
|
+
/** Holds the pending shards that have been created and are pending all shards finish loading. */
|
|
140
|
+
pendingShards: Collection<number, Shard>;
|
|
141
|
+
/** Handler to get shard count and other session info. */
|
|
142
|
+
getSessionInfo: () => Promise<Camelize<DiscordGetGatewayBot>>;
|
|
143
|
+
/** Handler to edit the shard id on any cached guilds. */
|
|
144
|
+
updateGuildsShardId: (guildIds: string[], shardId: number) => Promise<void>;
|
|
145
|
+
/** Handler to check if resharding is necessary. */
|
|
146
|
+
checkIfReshardingIsNeeded: () => Promise<{
|
|
147
|
+
needed: boolean;
|
|
148
|
+
info?: Camelize<DiscordGetGatewayBot>;
|
|
149
|
+
}>;
|
|
150
|
+
/** Handler to begin resharding. */
|
|
151
|
+
reshard: (info: Camelize<DiscordGetGatewayBot> & {
|
|
152
|
+
firstShardId?: number;
|
|
153
|
+
lastShardId?: number;
|
|
154
|
+
}) => Promise<void>;
|
|
155
|
+
/** Handler to communicate to a worker that a shard needs to be created. */
|
|
156
|
+
tellWorkerToPrepare: (workerId: number, shardId: number, bucketId: number) => Promise<void>;
|
|
157
|
+
/** Handler to alert the gateway that a shard(resharded) is online. It should now wait for all shards to be pending before shutting off old shards. */
|
|
158
|
+
shardIsPending: (shard: Shard) => Promise<void>;
|
|
159
|
+
};
|
|
106
160
|
/** Determine max number of shards to use based upon the max concurrency. */
|
|
107
161
|
calculateTotalShards: () => number;
|
|
108
162
|
/** Determine the id of the worker which is handling a shard. */
|
|
@@ -112,7 +166,8 @@ export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
|
112
166
|
/** Start identifying all the shards. */
|
|
113
167
|
spawnShards: () => Promise<void>;
|
|
114
168
|
/** Shutdown all shards. */
|
|
115
|
-
shutdown: (code: number, reason: string) => Promise<void>;
|
|
169
|
+
shutdown: (code: number, reason: string, clearReshardingInterval?: boolean) => Promise<void>;
|
|
170
|
+
sendPayload: (shardId: number, payload: ShardSocketRequest) => Promise<void>;
|
|
116
171
|
/** Allows users to hook in and change to communicate to different workers across different servers or anything they like. For example using redis pubsub to talk to other servers. */
|
|
117
172
|
tellWorkerToIdentify: (workerId: number, shardId: number, bucketId: number) => Promise<void>;
|
|
118
173
|
/** Tell the manager to identify a Shard. If this Shard is not already managed this will also add the Shard to the manager. */
|
|
@@ -143,7 +198,7 @@ export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
|
143
198
|
* Edits the bot status in all shards that this gateway manages.
|
|
144
199
|
*
|
|
145
200
|
* @param data The status data to set the bots status to.
|
|
146
|
-
* @returns
|
|
201
|
+
* @returns nothing
|
|
147
202
|
*/
|
|
148
203
|
editBotStatus: (data: StatusUpdate) => Promise<void>;
|
|
149
204
|
/**
|
|
@@ -151,7 +206,7 @@ export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
|
151
206
|
*
|
|
152
207
|
* @param shardId The shard id to edit the status for.
|
|
153
208
|
* @param data The status data to set the bots status to.
|
|
154
|
-
* @returns
|
|
209
|
+
* @returns nothing
|
|
155
210
|
*/
|
|
156
211
|
editShardStatus: (shardId: number, data: StatusUpdate) => Promise<void>;
|
|
157
212
|
/**
|
|
@@ -177,7 +232,7 @@ export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
|
177
232
|
*
|
|
178
233
|
* @see {@link https://discord.com/developers/docs/topics/gateway#request-guild-members}
|
|
179
234
|
*/
|
|
180
|
-
requestMembers: (guildId: BigString, options?: Omit<RequestGuildMembers, 'guildId'>) => Promise<Camelize<
|
|
235
|
+
requestMembers: (guildId: BigString, options?: Omit<RequestGuildMembers, 'guildId'>) => Promise<Camelize<DiscordMemberWithUser[]>>;
|
|
181
236
|
/**
|
|
182
237
|
* Leaves the voice channel the bot user is currently in.
|
|
183
238
|
*
|
|
@@ -191,13 +246,25 @@ export interface GatewayManager extends Required<CreateGatewayManagerOptions> {
|
|
|
191
246
|
* @see {@link https://discord.com/developers/docs/topics/gateway#update-voice-state}
|
|
192
247
|
*/
|
|
193
248
|
leaveVoiceChannel: (guildId: BigString) => Promise<void>;
|
|
249
|
+
/** This managers cache related settings. */
|
|
250
|
+
cache: {
|
|
251
|
+
requestMembers: {
|
|
252
|
+
/**
|
|
253
|
+
* Whether or not request member requests should be cached.
|
|
254
|
+
* @default false
|
|
255
|
+
*/
|
|
256
|
+
enabled: boolean;
|
|
257
|
+
/** The pending requests. */
|
|
258
|
+
pending: Collection<string, RequestMemberRequest>;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
194
261
|
}
|
|
195
262
|
export interface RequestMemberRequest {
|
|
196
263
|
/** The unique nonce for this request. */
|
|
197
264
|
nonce: string;
|
|
198
265
|
/** The resolver handler to run when all members arrive. */
|
|
199
|
-
resolve: (value: Camelize<
|
|
266
|
+
resolve: (value: Camelize<DiscordMemberWithUser[]> | PromiseLike<Camelize<DiscordMemberWithUser[]>>) => void;
|
|
200
267
|
/** The members that have already arrived for this request. */
|
|
201
|
-
members:
|
|
268
|
+
members: DiscordMemberWithUser[];
|
|
202
269
|
}
|
|
203
270
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAI1B,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,UAAU,EAAS,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,KAAK,WAAW,EAAyB,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,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EAAE;YACd;;;eAGG;YACH,OAAO,EAAE,OAAO,CAAA;YAChB,4BAA4B;YAC5B,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;SAClD,CAAA;KACF,CAAA;CACF;AAED,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,qBAAqB,EAAE,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAA;IAC5G,8DAA8D;IAC9D,OAAO,EAAE,qBAAqB,EAAE,CAAA;CACjC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { ActivityTypes, Camelize, DiscordActivity, DiscordGatewayPayload, GatewayOpcodes, PresenceStatus } from '@discordeno/types';
|
|
3
2
|
import type Shard from './Shard.js';
|
|
4
3
|
export declare enum ShardState {
|
|
@@ -70,7 +69,7 @@ export interface ShardHeart {
|
|
|
70
69
|
/** Interval between heartbeats requested by Discord. */
|
|
71
70
|
interval: number;
|
|
72
71
|
/** Id of the interval, which is used for sending the heartbeats. */
|
|
73
|
-
intervalId?: NodeJS.
|
|
72
|
+
intervalId?: NodeJS.Timeout;
|
|
74
73
|
/** Unix (in milliseconds) timestamp when the last heartbeat ACK was received from Discord. */
|
|
75
74
|
lastAck?: number;
|
|
76
75
|
/** Unix timestamp (in milliseconds) when the last heartbeat was sent. */
|
|
@@ -161,7 +160,7 @@ export interface UpdateVoiceState {
|
|
|
161
160
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
|
162
161
|
export interface StatusUpdate {
|
|
163
162
|
/** The user's activities */
|
|
164
|
-
activities?: Camelize<
|
|
163
|
+
activities?: Camelize<Omit<DiscordActivity, 'created_at'>[]>;
|
|
165
164
|
/** The user's new status */
|
|
166
165
|
status: keyof typeof PresenceStatus;
|
|
167
166
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,qBAAqB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACxI,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,oBAAY,UAAU;IACpB,iFAAiF;IACjF,SAAS,IAAI;IACb,6HAA6H;IAC7H,UAAU,IAAI;IACd,yEAAyE;IACzE,YAAY,IAAI;IAChB,iIAAiI;IACjI,YAAY,IAAI;IAChB,4EAA4E;IAC5E,WAAW,IAAI;IACf,4DAA4D;IAC5D,QAAQ,IAAI;IACZ,oHAAoH;IACpH,OAAO,IAAI;CACZ;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,iCAAiC;IACjC,UAAU,EAAE;QACV;;;WAGG;QACH,EAAE,EAAE,MAAM,CAAA;QACV;;;WAGG;QACH,OAAO,EAAE,MAAM,CAAA;QACf;;;WAGG;QACH,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,wEAAwE;IACxE,YAAY,EAAE,OAAO,CAAA;IACrB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAA;IAChB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC,OAAO,CAAA;IAC3B,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,y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
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discordeno/gateway",
|
|
3
|
-
"version": "19.0.0-next.
|
|
4
|
-
"main": "./dist/index.js",
|
|
5
|
-
"
|
|
3
|
+
"version": "19.0.0-next.4142946",
|
|
4
|
+
"main": "./dist/esm/index.js",
|
|
5
|
+
"exports": {
|
|
6
|
+
"import": "./dist/esm/index.js",
|
|
7
|
+
"require": "./dist/cjs/index.cjs",
|
|
8
|
+
"types": "./dist/types/index.d.ts"
|
|
9
|
+
},
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
6
11
|
"type": "module",
|
|
7
12
|
"license": "Apache-2.0",
|
|
8
13
|
"repository": {
|
|
@@ -10,41 +15,40 @@
|
|
|
10
15
|
"url": "https://github.com/discordeno/discordeno.git"
|
|
11
16
|
},
|
|
12
17
|
"scripts": {
|
|
13
|
-
"build": "swc --delete-dir-on-start src --out-dir dist",
|
|
14
|
-
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
|
18
|
+
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
|
19
|
+
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
|
15
20
|
"release-build": "yarn build && yarn build:type",
|
|
16
|
-
"fmt": "
|
|
17
|
-
"lint": "
|
|
21
|
+
"fmt": "biome format --write",
|
|
22
|
+
"lint": "biome lint --write",
|
|
18
23
|
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
|
|
19
24
|
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
|
20
|
-
"test:deno-unit": "swc tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
|
|
25
|
+
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
|
|
21
26
|
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
|
22
27
|
"test:integration": "c8 --r lcov mocha --no-warnings 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
|
23
28
|
"test:type": "tsc --noEmit",
|
|
24
|
-
"test:test-type": "tsc --project tsconfig.
|
|
29
|
+
"test:test-type": "tsc --project tests/tsconfig.json"
|
|
25
30
|
},
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@discordeno/types": "19.0.0-next.
|
|
28
|
-
"@discordeno/utils": "19.0.0-next.
|
|
29
|
-
"ws": "^8.
|
|
32
|
+
"@discordeno/types": "19.0.0-next.4142946",
|
|
33
|
+
"@discordeno/utils": "19.0.0-next.4142946",
|
|
34
|
+
"ws": "^8.18.0"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@swc/
|
|
34
|
-
"@
|
|
35
|
-
"@types/
|
|
36
|
-
"@types/
|
|
37
|
-
"@types/
|
|
38
|
-
"@types/
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"ts-node": "^10.9.1",
|
|
37
|
+
"@biomejs/biome": "^1.8.3",
|
|
38
|
+
"@swc/cli": "^0.4.0",
|
|
39
|
+
"@swc/core": "^1.4.2",
|
|
40
|
+
"@types/chai": "^4.3.16",
|
|
41
|
+
"@types/mocha": "^10.0.7",
|
|
42
|
+
"@types/node": "^20.14.10",
|
|
43
|
+
"@types/sinon": "^17.0.3",
|
|
44
|
+
"@types/ws": "^8.5.10",
|
|
45
|
+
"c8": "^9.1.0",
|
|
46
|
+
"chai": "^5.1.1",
|
|
47
|
+
"mocha": "^10.5.1",
|
|
48
|
+
"sinon": "^18.0.0",
|
|
49
|
+
"ts-node": "^10.9.2",
|
|
46
50
|
"tsconfig": "*",
|
|
47
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^5.5.3",
|
|
48
52
|
"uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js.git#commit=42c9c0d5d31f46ca4115dc75672b0037ec970f28"
|
|
49
53
|
}
|
|
50
54
|
}
|
package/dist/Shard.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Shard.d.ts","sourceRoot":"","sources":["../src/Shard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,qBAAqB,EAErB,aAAa,EAEb,mBAAmB,EACpB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAY,UAAU,EAAS,WAAW,EAAU,MAAM,mBAAmB,CAAA;AAEpF,OAAO,SAAS,MAAM,IAAI,CAAA;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClJ,OAAO,EAAyB,UAAU,EAAE,MAAM,YAAY,CAAA;AAE9D,qBAAa,eAAe;IAC1B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,qFAAqF;IACrF,UAAU,EAAE,kBAAkB,CAAA;IAC9B,kDAAkD;IAClD,KAAK,EAAE,UAAU,CAAA;IACjB,4HAA4H;IAC5H,2BAA2B,EAAE,MAAM,CAAM;IACzC,4CAA4C;IAC5C,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAO;IAC5C,8EAA8E;IAC9E,sBAAsB,EAAE,MAAM,CAAQ;IACtC,kDAAkD;IAClD,SAAS,CAAC,EA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