@bakit/gateway 2.0.0 → 2.1.1

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.ts CHANGED
@@ -2,7 +2,7 @@ import { EventBus, ReadonlyCollection } from '@bakit/utils';
2
2
  import { GatewayReadyDispatchData, GatewayReceivePayload, GatewayDispatchPayload, GatewaySendPayload } from 'discord-api-types/gateway';
3
3
  import { ValueOf } from 'type-fest';
4
4
  import { GatewayReadyDispatchData as GatewayReadyDispatchData$1, GatewayReceivePayload as GatewayReceivePayload$1, GatewayDispatchPayload as GatewayDispatchPayload$1, GatewaySendPayload as GatewaySendPayload$1 } from 'discord-api-types/v10';
5
- import { RESTOptions, REST } from '@bakit/rest';
5
+ import { REST } from '@bakit/rest';
6
6
 
7
7
  interface ShardOptions {
8
8
  id: number;
@@ -128,7 +128,6 @@ interface GatewayManagerOptions {
128
128
  gatewayURL?: string;
129
129
  totalShards?: number | "auto";
130
130
  shardsPerWorker?: number;
131
- rest?: RESTOptions;
132
131
  }
133
132
  declare const DEFAULT_GATEWAY_MANAGER_OPTIONS: {
134
133
  readonly gatewayURL: "wss://gateway.discord.gg";
@@ -151,6 +150,6 @@ interface GatewayManager extends EventBus<GatewayManagerEvents> {
151
150
  sendToWorker(id: number, payload: GatewaySendPayload$1): void;
152
151
  sendToShard(id: number, payload: GatewaySendPayload$1): void;
153
152
  }
154
- declare function createGatewayManager(options: GatewayManagerOptions): GatewayManager;
153
+ declare function createGatewayManager(options: GatewayManagerOptions, rest: REST): GatewayManager;
155
154
 
156
155
  export { DEFAULT_GATEWAY_MANAGER_OPTIONS, DEFAULT_WORKER_PATH, type GatewayManager, type GatewayManagerEvents, type GatewayManagerOptions, type GatewayWorker, type GatewayWorkerEvents, type GatewayWorkerOptions, GatewayWorkerState, type Shard, type ShardEvents, type ShardGatewayOptions, type ShardOptions, ShardState, ShardStrategy, bindWorkerToProcess, createGatewayManager, createShard, createWorker, getWorkerOptions };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { attachEventBus, Collection, createQueue } from '@bakit/utils';
4
4
  import { GatewayOpcodes, GatewayCloseCodes, GatewayDispatchEvents } from 'discord-api-types/gateway';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { fork } from 'child_process';
7
- import { createREST } from '@bakit/rest';
7
+ import '@bakit/rest';
8
8
 
9
9
  // src/lib/shard.ts
10
10
  var ZLIB_FLUSH = Buffer.from([0, 0, 255, 255]), DEFAULT_SHARD_OPTIONS = {
@@ -331,11 +331,11 @@ var DEFAULT_WORKER_PATH = fileURLToPath(new URL("./services/worker.js", import.m
331
331
  totalShards: "auto",
332
332
  shardsPerWorker: 5
333
333
  };
334
- function createGatewayManager(options) {
334
+ function createGatewayManager(options, rest) {
335
335
  let opts = {
336
336
  ...DEFAULT_GATEWAY_MANAGER_OPTIONS,
337
337
  ...options
338
- }, identifyQueue, workers = new Collection(), rest = createREST(opts.rest ?? { token: options.token }), self = attachEventBus({
338
+ }, identifyQueue, workers = new Collection(), self = attachEventBus({
339
339
  get rest() {
340
340
  return rest;
341
341
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakit/gateway",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Gateway manager for bakit framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -30,10 +30,10 @@
30
30
  "dependencies": {
31
31
  "discord-api-types": "^0.38.37",
32
32
  "type-fest": "^4.41.0",
33
- "ws": "^8.18.3",
34
- "@bakit/service": "^2.0.0",
35
- "@bakit/rest": "^2.0.0",
36
- "@bakit/utils": "^2.0.0-alpha.36"
33
+ "ws": "^8.19.0",
34
+ "@bakit/service": "^2.0.1",
35
+ "@bakit/utils": "^2.0.0",
36
+ "@bakit/rest": "^2.0.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/ws": "^8.18.1"