dfx 0.45.4 → 0.45.6

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.
Files changed (145) hide show
  1. package/package.json +2 -2
  2. package/src/DiscordGateway/Sharder.ts +7 -6
  3. package/src/package.json +2 -2
  4. package/tsconfig.json +2 -15
  5. package/Cache/driver.d.ts +0 -22
  6. package/Cache/driver.js +0 -3
  7. package/Cache/driver.js.map +0 -1
  8. package/Cache/memory.d.ts +0 -3
  9. package/Cache/memory.js +0 -48
  10. package/Cache/memory.js.map +0 -1
  11. package/Cache/memoryTTL.d.ts +0 -20
  12. package/Cache/memoryTTL.js +0 -121
  13. package/Cache/memoryTTL.js.map +0 -1
  14. package/Cache/prelude.d.ts +0 -56
  15. package/Cache/prelude.js +0 -108
  16. package/Cache/prelude.js.map +0 -1
  17. package/Cache.d.ts +0 -75
  18. package/Cache.js +0 -62
  19. package/Cache.js.map +0 -1
  20. package/DiscordConfig.d.ts +0 -28
  21. package/DiscordConfig.js +0 -29
  22. package/DiscordConfig.js.map +0 -1
  23. package/DiscordGateway/DiscordWS.d.ts +0 -31
  24. package/DiscordGateway/DiscordWS.js +0 -31
  25. package/DiscordGateway/DiscordWS.js.map +0 -1
  26. package/DiscordGateway/Shard/heartbeats.d.ts +0 -3
  27. package/DiscordGateway/Shard/heartbeats.js +0 -17
  28. package/DiscordGateway/Shard/heartbeats.js.map +0 -1
  29. package/DiscordGateway/Shard/identify.d.ts +0 -12
  30. package/DiscordGateway/Shard/identify.js +0 -26
  31. package/DiscordGateway/Shard/identify.js.map +0 -1
  32. package/DiscordGateway/Shard/invalidSession.d.ts +0 -3
  33. package/DiscordGateway/Shard/invalidSession.js +0 -6
  34. package/DiscordGateway/Shard/invalidSession.js.map +0 -1
  35. package/DiscordGateway/Shard/sendEvents.d.ts +0 -7
  36. package/DiscordGateway/Shard/sendEvents.js +0 -25
  37. package/DiscordGateway/Shard/sendEvents.js.map +0 -1
  38. package/DiscordGateway/Shard/utils.d.ts +0 -3
  39. package/DiscordGateway/Shard/utils.js +0 -9
  40. package/DiscordGateway/Shard/utils.js.map +0 -1
  41. package/DiscordGateway/Shard.d.ts +0 -16
  42. package/DiscordGateway/Shard.js +0 -85
  43. package/DiscordGateway/Shard.js.map +0 -1
  44. package/DiscordGateway/ShardStore.d.ts +0 -12
  45. package/DiscordGateway/ShardStore.js +0 -22
  46. package/DiscordGateway/ShardStore.js.map +0 -1
  47. package/DiscordGateway/Sharder.d.ts +0 -15
  48. package/DiscordGateway/Sharder.js +0 -49
  49. package/DiscordGateway/Sharder.js.map +0 -1
  50. package/DiscordGateway/WS.d.ts +0 -31
  51. package/DiscordGateway/WS.js +0 -77
  52. package/DiscordGateway/WS.js.map +0 -1
  53. package/DiscordGateway.d.ts +0 -12
  54. package/DiscordGateway.js +0 -29
  55. package/DiscordGateway.js.map +0 -1
  56. package/DiscordREST/types.d.ts +0 -7
  57. package/DiscordREST/types.js +0 -2
  58. package/DiscordREST/types.js.map +0 -1
  59. package/DiscordREST/utils.d.ts +0 -10
  60. package/DiscordREST/utils.js +0 -21
  61. package/DiscordREST/utils.js.map +0 -1
  62. package/DiscordREST.d.ts +0 -16
  63. package/DiscordREST.js +0 -123
  64. package/DiscordREST.js.map +0 -1
  65. package/Helpers/flags.d.ts +0 -27
  66. package/Helpers/flags.js +0 -36
  67. package/Helpers/flags.js.map +0 -1
  68. package/Helpers/intents.d.ts +0 -24
  69. package/Helpers/intents.js +0 -29
  70. package/Helpers/intents.js.map +0 -1
  71. package/Helpers/interactions.d.ts +0 -96
  72. package/Helpers/interactions.js +0 -97
  73. package/Helpers/interactions.js.map +0 -1
  74. package/Helpers/members.d.ts +0 -9
  75. package/Helpers/members.js +0 -10
  76. package/Helpers/members.js.map +0 -1
  77. package/Helpers/permissions.d.ts +0 -40
  78. package/Helpers/permissions.js +0 -83
  79. package/Helpers/permissions.js.map +0 -1
  80. package/Helpers/ui.d.ts +0 -47
  81. package/Helpers/ui.js +0 -66
  82. package/Helpers/ui.js.map +0 -1
  83. package/Interactions/builder.d.ts +0 -48
  84. package/Interactions/builder.js +0 -68
  85. package/Interactions/builder.js.map +0 -1
  86. package/Interactions/context.d.ts +0 -58
  87. package/Interactions/context.js +0 -61
  88. package/Interactions/context.js.map +0 -1
  89. package/Interactions/definitions.d.ts +0 -126
  90. package/Interactions/definitions.js +0 -53
  91. package/Interactions/definitions.js.map +0 -1
  92. package/Interactions/gateway.d.ts +0 -20
  93. package/Interactions/gateway.js +0 -39
  94. package/Interactions/gateway.js.map +0 -1
  95. package/Interactions/handlers.d.ts +0 -10
  96. package/Interactions/handlers.js +0 -45
  97. package/Interactions/handlers.js.map +0 -1
  98. package/Interactions/index.d.ts +0 -10
  99. package/Interactions/index.js +0 -12
  100. package/Interactions/index.js.map +0 -1
  101. package/Interactions/utils.d.ts +0 -78
  102. package/Interactions/utils.js +0 -74
  103. package/Interactions/utils.js.map +0 -1
  104. package/Interactions/webhook.d.ts +0 -45
  105. package/Interactions/webhook.js +0 -56
  106. package/Interactions/webhook.js.map +0 -1
  107. package/Log.d.ts +0 -10
  108. package/Log.js +0 -17
  109. package/Log.js.map +0 -1
  110. package/RateLimit/memory.d.ts +0 -2
  111. package/RateLimit/memory.js +0 -35
  112. package/RateLimit/memory.js.map +0 -1
  113. package/RateLimit/utils.d.ts +0 -2
  114. package/RateLimit/utils.js +0 -18
  115. package/RateLimit/utils.js.map +0 -1
  116. package/RateLimit.d.ts +0 -25
  117. package/RateLimit.js +0 -25
  118. package/RateLimit.js.map +0 -1
  119. package/_common.d.ts +0 -36
  120. package/_common.js +0 -8
  121. package/_common.js.map +0 -1
  122. package/gateway.d.ts +0 -13
  123. package/gateway.js +0 -25
  124. package/gateway.js.map +0 -1
  125. package/global.d.ts +0 -17
  126. package/global.js +0 -2
  127. package/global.js.map +0 -1
  128. package/index.d.ts +0 -13
  129. package/index.js +0 -14
  130. package/index.js.map +0 -1
  131. package/types.d.ts +0 -4449
  132. package/types.js +0 -1204
  133. package/types.js.map +0 -1
  134. package/utils/effect.d.ts +0 -1
  135. package/utils/effect.js +0 -2
  136. package/utils/effect.js.map +0 -1
  137. package/utils/hub.d.ts +0 -11
  138. package/utils/hub.js +0 -23
  139. package/utils/hub.js.map +0 -1
  140. package/utils/tsplus.d.ts +0 -12
  141. package/utils/tsplus.js +0 -2
  142. package/utils/tsplus.js.map +0 -1
  143. package/webhooks.d.ts +0 -9
  144. package/webhooks.js +0 -22
  145. package/webhooks.js.map +0 -1
package/Cache.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Cache.js","sourceRoot":"","sources":["src/Cache.ts"],"names":[],"mappings":";;AAEA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,gBAAgB,IAAI,kBAAkB,GACvC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,MAAM,IAAI,eAAe,EACzB,gBAAgB,IAAI,qBAAqB,GAC1C,MAAM,sBAAsB,CAAA;AAa7B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAkC,EAC9D,MAAM,EACN,GAAG,wBAAe,EAClB,EAAE,EACF,MAAM,EACN,YAAY,GASb,EAAE,EAAE;IACH,MAAM,IAAI,4BAAG,oBAAA,GAAG,EAAK,CAAC,EAAE,EAAgC,EAAE;QACxD,QAAQ,EAAE,CAAC,EAAE,EAAE;YACb,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAA;YAE5D,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,CAAA;YAElD,KAAK,cAAc;gBACjB,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAA;SAC1C;IACH,CAAC,CAAC,CAA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GAAG;QACH,MAAM;QACN,GAAG,EAAE,4BAAA,IAAI,EAAa,MAAM,CAAC,GAAG,CAAC;KAClC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,OAAO,cAAc;IAEJ;IAA4B;IADxC,IAAI,GAAG,gBAAgB,CAAA;IAChC,YAAqB,SAAiB,EAAW,EAAU;QAAtC,cAAS,GAAT,SAAS,CAAQ;QAAW,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;CAChE"}
@@ -1,28 +0,0 @@
1
- import { ConfigSecret, Duration, Discord, Config } from "dfx/_common";
2
- export interface DiscordConfig {
3
- token: ConfigSecret;
4
- debug: boolean;
5
- rest: {
6
- baseUrl: string;
7
- globalRateLimit: {
8
- limit: number;
9
- window: Duration;
10
- };
11
- };
12
- gateway: {
13
- intents: number;
14
- presence?: Discord.UpdatePresence;
15
- shardCount?: number;
16
- identifyRateLimit: readonly [window: number, limit: number];
17
- };
18
- }
19
- export declare const DiscordConfig: import("@effect/data/Context").Tag<DiscordConfig, DiscordConfig>;
20
- export interface MakeOpts {
21
- token: ConfigSecret;
22
- debug?: boolean;
23
- rest?: Partial<DiscordConfig["rest"]>;
24
- gateway?: Partial<DiscordConfig["gateway"]>;
25
- }
26
- export declare const make: ({ token, debug, rest, gateway, }: MakeOpts) => DiscordConfig;
27
- export declare const makeLayer: (a_0: MakeOpts) => import("@effect-http/client/_common").Layer<never, never, DiscordConfig>;
28
- export declare const makeFromConfig: (_: Config.Wrap<MakeOpts>) => import("@effect-http/client/_common").Layer<never, import("./_common.js").ConfigError, DiscordConfig>;
package/DiscordConfig.js DELETED
@@ -1,29 +0,0 @@
1
- import * as tsplus_module_1 from "dfx/_common";
2
- import * as tsplus_module_2 from "@effect/data/Duration";
3
- import * as tsplus_module_3 from "@effect/io/Layer";
4
- import * as tsplus_module_4 from "@effect/data/Function";
5
- import * as tsplus_module_5 from "@effect/io/Config";
6
- import * as tsplus_module_6 from "@effect/io/Effect";
7
- const VERSION = 10;
8
- export const DiscordConfig = tsplus_module_1.Tag();
9
- export const make = ({ token, debug = false, rest, gateway, }) => ({
10
- token,
11
- debug,
12
- rest: {
13
- baseUrl: `https://discord.com/api/v${VERSION}`,
14
- ...(rest ?? {}),
15
- globalRateLimit: {
16
- limit: 50,
17
- window: tsplus_module_2.seconds(1),
18
- ...(rest?.globalRateLimit ?? {}),
19
- },
20
- },
21
- gateway: {
22
- intents: tsplus_module_1.Discord.GatewayIntents.GUILDS,
23
- identifyRateLimit: [5000, 1],
24
- ...(gateway ?? {}),
25
- },
26
- });
27
- export const makeLayer = tsplus_module_4.flow(make, _ => tsplus_module_3.succeed(DiscordConfig, _));
28
- export const makeFromConfig = (_) => tsplus_module_6.toLayer(tsplus_module_6.map(tsplus_module_6.config(tsplus_module_5.unwrap(_)), make), DiscordConfig);
29
- //# sourceMappingURL=DiscordConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DiscordConfig.js","sourceRoot":"","sources":["src/DiscordConfig.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,OAAO,GAAG,EAAE,CAAA;AAoBlB,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAA,GAAG,EAAiB,CAAA;AASjD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,KAAK,EACL,KAAK,GAAG,KAAK,EACb,IAAI,EACJ,OAAO,GACE,EAAiB,EAAE,CAAC,CAAC;IAC9B,KAAK;IACL,KAAK;IACL,IAAI,EAAE;QACJ,OAAO,EAAE,4BAA4B,OAAO,EAAE;QAC9C,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACf,eAAe,EAAE;YACf,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,wBAAiB,CAAC,CAAC;YAC3B,GAAG,CAAC,IAAI,EAAE,eAAe,IAAI,EAAE,CAAC;SACjC;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,gBAAA,OAAO,CAAC,cAAc,CAAC,MAAM;QACtC,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5B,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KACnB;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAA,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,wBAAc,aAAa,EAAE,CAAC,CAAC,CAAC,CAAA;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAwB,EAAE,EAAE,CACzD,wBAAA,2CAAA,uBAAc,CAAC,CAAC,GAAY,IAAI,CAAC,EAAS,aAAa,CAAC,CAAA"}
@@ -1,31 +0,0 @@
1
- /// <reference types="ws" />
2
- import { Discord, Effect } from "dfx/_common";
3
- import { Reconnect, WS, WebSocketCloseError, WebSocketError } from "dfx/DiscordGateway/WS";
4
- import WebSocket from "isomorphic-ws";
5
- export type Message = Discord.GatewayPayload | Reconnect;
6
- export interface OpenOpts {
7
- url?: string;
8
- version?: number;
9
- encoding?: DiscordWSCodec;
10
- outbound: Effect<never, never, Message>;
11
- onConnecting?: Effect<never, never, void>;
12
- }
13
- export interface DiscordWSCodec {
14
- type: "json" | "etf";
15
- encode: (p: Discord.GatewayPayload) => string;
16
- decode: (p: WebSocket.Data) => Discord.GatewayPayload;
17
- }
18
- export declare const DiscordWSCodec: import("@effect/data/Context").Tag<DiscordWSCodec, DiscordWSCodec>;
19
- export declare const LiveJsonDiscordWSCodec: import("@effect-http/client/_common").Layer<never, never, DiscordWSCodec>;
20
- declare const make: import("@effect/io/Effect").Effect<WS | DiscordWSCodec, never, {
21
- readonly connect: ({ url, version, outbound, onConnecting, }: OpenOpts) => import("@effect/io/Effect").Effect<never, never, {
22
- readonly run: import("@effect/io/Effect").Effect<never, WebSocketError | WebSocketCloseError, never>;
23
- readonly take: import("@effect/io/Effect").Effect<never, never, import("../types.js").GatewayPayload<any>>;
24
- readonly setUrl: (url: string) => import("@effect/io/Effect").Effect<never, never, void>;
25
- }>;
26
- }>;
27
- export interface DiscordWS extends Effect.Success<typeof make> {
28
- }
29
- export declare const DiscordWS: import("@effect/data/Context").Tag<DiscordWS, DiscordWS>;
30
- export declare const LiveDiscordWS: import("@effect-http/client/_common").Layer<import("../Log.js").Log | DiscordWSCodec, never, DiscordWS>;
31
- export {};
@@ -1,31 +0,0 @@
1
- import * as tsplus_module_1 from "dfx/_common";
2
- import * as tsplus_module_2 from "@effect/io/Layer";
3
- import * as tsplus_module_3 from "@effect/io/Effect";
4
- import * as tsplus_module_4 from "@effect/io/Ref";
5
- import { LiveWS, Reconnect, WS, } from "dfx/DiscordGateway/WS";
6
- export const DiscordWSCodec = tsplus_module_1.Tag();
7
- export const LiveJsonDiscordWSCodec = tsplus_module_2.succeed(DiscordWSCodec, {
8
- type: "json",
9
- encode: p => JSON.stringify(p),
10
- decode: p => JSON.parse(p.toString("utf8")),
11
- });
12
- const make = tsplus_module_3.flatMap(WS, ws => tsplus_module_3.map(DiscordWSCodec, encoding => {
13
- const connect = ({ url = "wss://gateway.discord.gg/", version = 10, outbound, onConnecting, }) => tsplus_module_3.flatMap(tsplus_module_4.make(`${url}?v=${version}&encoding=${encoding.type}`), urlRef => {
14
- const setUrl = (url) => tsplus_module_4.set(urlRef, `${url}?v=${version}&encoding=${encoding.type}`);
15
- const takeOutbound = tsplus_module_3.map(outbound, a => a === Reconnect ? a : encoding.encode(a));
16
- return tsplus_module_3.map(ws.connect(urlRef, takeOutbound, onConnecting), socket => {
17
- const take = tsplus_module_3.map(socket.take, encoding.decode);
18
- const run = tsplus_module_3.retryWhile(socket.run, _ => (_._tag === "WebSocketCloseError" && _.code < 2000) ||
19
- (_._tag === "WebSocketError" && _.reason === "open-timeout"));
20
- return {
21
- run,
22
- take,
23
- setUrl,
24
- };
25
- });
26
- });
27
- return { connect };
28
- }));
29
- export const DiscordWS = tsplus_module_1.Tag();
30
- export const LiveDiscordWS = tsplus_module_2.provide(tsplus_module_3.toLayer(make, DiscordWS))(LiveWS);
31
- //# sourceMappingURL=DiscordWS.js.map
@@ -1 +0,0 @@
1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,IAAI,EAAK,QAAQ,CAAC,MAAM,CAAC,CAAA;YAE7C,MAAM,GAAG,GAAG,2BAAA,MAAM,CAAC,GAAG,EACpB,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,CAAC,IAAI,KAAK,qBAAqB,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;gBACnD,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAgB,IAAI,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,CAC/D,CAAA;YAED,OAAO;gBACL,GAAG;gBACH,IAAI;gBACJ,MAAM;aACE,CAAA;;MACV,CAAA;IAEJ,OAAO,EAAE,OAAO,EAAW,CAAA;GAC3B,CAAA;AAGF,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAA,GAAG,EAAa,CAAA;AACzC,MAAM,CAAC,MAAM,aAAa,2BAAa,wBAAA,IAAI,EAAS,SAAS,CAAC,EAAjC,MAAM,CAA2B,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Ref, Maybe, Effect, Dequeue, Discord } from "dfx/_common";
2
- import * as DiscordWS from "dfx/DiscordGateway/DiscordWS";
3
- export declare const send: (hellos: Dequeue<Discord.GatewayPayload>, acks: Dequeue<Discord.GatewayPayload>, seqRef: Ref<Maybe<number>>, send: (p: DiscordWS.Message) => Effect<never, never, boolean>) => import("@effect/io/Effect").Effect<never, never, never>;
@@ -1,17 +0,0 @@
1
- import * as tsplus_module_1 from "@effect/io/Ref";
2
- import * as tsplus_module_2 from "@effect/data/Option";
3
- import * as tsplus_module_3 from "@effect/io/Effect";
4
- import * as tsplus_module_4 from "@effect/io/Schedule";
5
- import * as tsplus_module_5 from "dfx/utils/hub";
6
- import { millis } from "@effect/data/Duration";
7
- import * as SendEvents from "./sendEvents.js";
8
- import { Reconnect } from "../WS.js";
9
- const payload = (ref, seqRef) => tsplus_module_3.tap(tsplus_module_3.map(tsplus_module_1.get(seqRef), a => SendEvents.heartbeat(tsplus_module_2.getOrNull(a))), () => tsplus_module_1.set(ref, false));
10
- const payloadOrReconnect = (ref, seqRef) => tsplus_module_3.flatMap(tsplus_module_1.get(ref), (acked) => acked ? payload(ref, seqRef) : tsplus_module_3.succeed(Reconnect));
11
- export const send = (hellos, acks, seqRef, send) => tsplus_module_3.flatMap(tsplus_module_1.make(true), ackedRef => {
12
- const heartbeats = tsplus_module_5.foreverSwitch(tsplus_module_3.tap(hellos
13
- .take(), () => tsplus_module_1.set(ackedRef, true)), p => tsplus_module_3.schedule(tsplus_module_3.tap(payloadOrReconnect(ackedRef, seqRef), send), tsplus_module_4.andThen(tsplus_module_4.duration(millis(p.d.heartbeat_interval * Math.random())), tsplus_module_4.fixed(millis(p.d.heartbeat_interval)))));
14
- const run = tsplus_module_3.forever(tsplus_module_3.tap(acks.take(), () => tsplus_module_1.set(ackedRef, true)));
15
- return tsplus_module_3.zipParLeft(run, heartbeats);
16
- });
17
- //# sourceMappingURL=heartbeats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"heartbeats.js","sourceRoot":"","sources":["../../src/DiscordGateway/Shard/heartbeats.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,OAAO,GAAG,CAAC,GAAiB,EAAE,MAA0B,EAAE,EAAE,CAChE,oBAAA,wCAAA,MAAM,GACC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,2BAAC,CAAC,EAAW,CAAC,EACvC,GAAG,EAAE,CAAC,oBAAA,GAAG,EAAK,KAAK,CAAC,CAAC,CAAA;AAE9B,MAAM,kBAAkB,GAAG,CAAC,GAAiB,EAAE,MAA0B,EAAE,EAAE,CAC3E,4CAAA,GAAG,GACD,CAAC,KAAK,EAA2C,EAAE,CACjD,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,wBAAe,SAAS,CAAC,CAC3D,CAAA;AAEH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAuC,EACvC,IAAqC,EACrC,MAA0B,EAC1B,IAA6D,EAC7D,EAAE,yBAEmB,qBAAS,IAAI,CAAC,EAA3B,QAAQ;IAEd,MAAM,UAAU,GAAG,8BAAA,oBAAA,MAAM;SACtB,IAAI,EAAE,EACF,GAAG,EAAE,CAAC,oBAAA,QAAQ,EAAK,IAAI,CAAC,CAAC,EACf,CAAC,CAAC,EAAE,CACjB,yBAAA,oBAAA,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC7B,IAAI,CAAC,EAER,wBAAA,yBACE,MAAM,CAAC,CAAC,CAAC,CAAE,CAAC,kBAAkB,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAChD,EAAS,sBAAe,MAAM,CAAC,CAAC,CAAC,CAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAC3D,CACJ,CAAA;IAEH,MAAM,GAAG,2BAAG,oBAAA,IAAI,CAAC,IAAI,EAAE,EAAK,GAAG,EAAE,CAAC,oBAAA,QAAQ,EAAK,IAAI,CAAC,CAAC,CAAQ,CAAA;WAEpD,2BAAA,GAAG,EAAY,UAAU,CAAC;EACnC,CAAA"}
@@ -1,12 +0,0 @@
1
- import { Discord, Ref, Maybe } from "dfx/_common";
2
- export interface Options {
3
- token: string;
4
- intents: number;
5
- shard: [number, number];
6
- presence?: Discord.UpdatePresence;
7
- }
8
- export interface Requirements {
9
- latestReady: Ref<Maybe<Discord.ReadyEvent>>;
10
- latestSequence: Ref<Maybe<number>>;
11
- }
12
- export declare const identifyOrResume: (opts: Options, ready: Ref<Maybe<Discord.ReadyEvent>>, seq: Ref<Maybe<number>>) => import("@effect/io/Effect").Effect<never, never, import("../../types.js").GatewayPayload<any>>;
@@ -1,26 +0,0 @@
1
- import * as tsplus_module_1 from "@effect/data/Option";
2
- import * as tsplus_module_2 from "@effect/io/Ref";
3
- import * as tsplus_module_3 from "@effect/io/Effect";
4
- import * as SendEvents from "./sendEvents.js";
5
- import * as OS from "os";
6
- const identify = ({ token, intents, shard, presence }) => SendEvents.identify({
7
- token,
8
- intents,
9
- properties: {
10
- os: OS.platform(),
11
- browser: "dfx",
12
- device: "dfx",
13
- },
14
- shard,
15
- presence,
16
- });
17
- const resume = (token, ready, seq) => SendEvents.resume({
18
- token,
19
- session_id: ready.session_id,
20
- seq,
21
- });
22
- export const identifyOrResume = (opts, ready, seq) => tsplus_module_3.flatMap(tsplus_module_2.get(ready), readyEvent => tsplus_module_3.map(tsplus_module_2.get(seq), seqNumber => tsplus_module_1.match(tsplus_module_1.struct({
23
- readyEvent,
24
- seqNumber,
25
- }), () => identify(opts), ({ readyEvent, seqNumber }) => resume(opts.token, readyEvent, seqNumber))));
26
- //# sourceMappingURL=identify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/DiscordGateway/Shard/identify.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAcxB,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAW,EAAE,EAAE,CAChE,UAAU,CAAC,QAAQ,CAAC;IAClB,KAAK;IACL,OAAO;IACP,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE;QACjB,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;KACd;IACD,KAAK;IACL,QAAQ;CACT,CAAC,CAAA;AAEJ,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,KAAyB,EAAE,GAAW,EAAE,EAAE,CACvE,UAAU,CAAC,MAAM,CAAC;IAChB,KAAK;IACL,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,GAAG;CACJ,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAa,EACb,KAAqC,EACrC,GAAuB,EACvB,EAAE,6CAEqB,KAAK,GAApB,UAAU,4CACI,GAAG,GAAjB,SAAS,IAER,sBAAA,uBAAa;IAClB,UAAU;IACV,SAAS;CACV,CAAC,EACA,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EACpB,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CACzE,EACD,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Discord, Ref, Maybe } from "dfx/_common";
2
- import { Message } from "../DiscordWS.js";
3
- export declare const fromPayload: (p: Discord.GatewayPayload, latestReady: Ref<Maybe<Discord.ReadyEvent>>) => import("@effect/io/Effect").Effect<never, never, Message>;
@@ -1,6 +0,0 @@
1
- import * as tsplus_module_1 from "@effect/io/Effect";
2
- import * as tsplus_module_2 from "@effect/data/Option";
3
- import * as tsplus_module_3 from "@effect/io/Ref";
4
- import { Reconnect } from "../WS.js";
5
- export const fromPayload = (p, latestReady) => tsplus_module_1.map((p.d ? tsplus_module_1.unit() : tsplus_module_3.set(latestReady, tsplus_module_2.none())), () => Reconnect);
6
- //# sourceMappingURL=invalidSession.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invalidSession.js","sourceRoot":"","sources":["../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,CAAyB,EACzB,WAA2C,EAC3C,EAAE,CACF,oBAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAa,CAAC,CAAC,CAAC,oBAAA,WAAW,EAAK,sBAAY,CAAC,CAAC,EACnD,GAAY,EAAE,CAAC,SAAS,CACzB,CAAA"}
@@ -1,7 +0,0 @@
1
- import { Discord } from "dfx/_common";
2
- export declare const heartbeat: (d: Discord.Heartbeat) => Discord.GatewayPayload;
3
- export declare const identify: (d: Discord.Identify) => Discord.GatewayPayload;
4
- export declare const resume: (d: Discord.Resume) => Discord.GatewayPayload;
5
- export declare const requestGuildMembers: (d: Discord.RequestGuildMember) => Discord.GatewayPayload;
6
- export declare const voiceStateUpdate: (d: Discord.UpdateVoiceState) => Discord.GatewayPayload;
7
- export declare const presenceUpdate: (d: Discord.UpdatePresence) => Discord.GatewayPayload;
@@ -1,25 +0,0 @@
1
- export const heartbeat = (d) => ({
2
- op: 1 /* Discord.GatewayOpcode.HEARTBEAT */,
3
- d,
4
- });
5
- export const identify = (d) => ({
6
- op: 2 /* Discord.GatewayOpcode.IDENTIFY */,
7
- d,
8
- });
9
- export const resume = (d) => ({
10
- op: 6 /* Discord.GatewayOpcode.RESUME */,
11
- d,
12
- });
13
- export const requestGuildMembers = (d) => ({
14
- op: 8 /* Discord.GatewayOpcode.REQUEST_GUILD_MEMBERS */,
15
- d,
16
- });
17
- export const voiceStateUpdate = (d) => ({
18
- op: 4 /* Discord.GatewayOpcode.VOICE_STATE_UPDATE */,
19
- d,
20
- });
21
- export const presenceUpdate = (d) => ({
22
- op: 3 /* Discord.GatewayOpcode.PRESENCE_UPDATE */,
23
- d,
24
- });
25
- //# sourceMappingURL=sendEvents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sendEvents.js","sourceRoot":"","sources":["../../src/DiscordGateway/Shard/sendEvents.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAoB,EAA0B,EAAE,CAAC,CAAC;IAC1E,EAAE,yCAAiC;IACnC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAmB,EAA0B,EAAE,CAAC,CAAC;IACxE,EAAE,wCAAgC;IAClC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAiB,EAA0B,EAAE,CAAC,CAAC;IACpE,EAAE,sCAA8B;IAChC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,CAA6B,EACL,EAAE,CAAC,CAAC;IAC5B,EAAE,qDAA6C;IAC/C,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,CAA2B,EACH,EAAE,CAAC,CAAC;IAC5B,EAAE,kDAA0C;IAC5C,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,CAAyB,EACD,EAAE,CAAC,CAAC;IAC5B,EAAE,+CAAuC;IACzC,CAAC;CACF,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Stream, Discord, Maybe, Ref } from "dfx/_common";
2
- export declare const opCode: <R, E>(source: import("@effect-http/client/_common").Stream<R, E, import("../../types.js").GatewayPayload<any>>) => <T = any>(code: Discord.GatewayOpcode) => import("@effect-http/client/_common").Stream<R, E, import("../../types.js").GatewayPayload<any>>;
3
- export declare const latest: <T>(f: (p: Discord.GatewayPayload) => import("@effect/data/Option").Option<T>) => import("@effect/io/Effect").Effect<never, never, readonly [import("../../_common.js").Ref<import("@effect/data/Option").Option<T>>, (p: import("../../types.js").GatewayPayload<any>) => import("@effect/io/Effect").Effect<never, never, void>]>;
@@ -1,9 +0,0 @@
1
- import * as tsplus_module_1 from "@effect/stream/Stream";
2
- import * as tsplus_module_2 from "@effect/io/Effect";
3
- import * as tsplus_module_3 from "@effect/data/Option";
4
- import * as tsplus_module_4 from "@effect/io/Ref";
5
- import * as tsplus_module_5 from "@effect/data/Function";
6
- export const opCode = (source) => (code) => tsplus_module_1.filter(source, (p) => p.op === code);
7
- const maybeUpdateRef = (f, ref) => tsplus_module_5.flow(f, o => tsplus_module_3.match(o, tsplus_module_2.unit, a => tsplus_module_4.set(ref, tsplus_module_3.some(a))));
8
- export const latest = (f) => tsplus_module_2.map(tsplus_module_4.make(tsplus_module_3.none()), ref => [ref, maybeUpdateRef(f, ref)]);
9
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/DiscordGateway/Shard/utils.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,CAAC,MAAM,MAAM,GACjB,CAAO,MAA4C,EAAE,EAAE,CACvD,CAAU,IAA2B,EAAE,EAAE,CACvC,uBAAA,MAAM,EAAQ,CAAC,CAAC,EAAkC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAA;AAEvE,MAAM,cAAc,GAAG,CACrB,CAA0C,EAC1C,GAAkB,EAClB,EAAE,CAAC,gBAAA,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,sBAAA,CAAC,wBAAoB,CAAC,CAAC,EAAE,CAAC,oBAAA,GAAG,EAAK,qBAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,CAA0C,EAAE,EAAE,CACtE,oBAAA,qBAAmB,sBAAY,CAAC,EAC9B,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAU,CAC9C,CAAA"}
@@ -1,16 +0,0 @@
1
- import { Hub, Discord, Effect } from "dfx/_common";
2
- import { DiscordConfig } from "dfx/DiscordConfig";
3
- import { RateLimiter } from "dfx/RateLimit";
4
- import { DiscordWS } from "./DiscordWS.js";
5
- import { Log } from "dfx/Log";
6
- export declare const make: import("@effect/io/Effect").Effect<DiscordConfig | Log | RateLimiter | DiscordWS, never, {
7
- readonly connect: (shard: [id: number, count: number], hub: Hub<Discord.GatewayPayload<Discord.ReceiveEvent>>) => import("@effect/io/Effect").Effect<never, never, {
8
- readonly run: import("@effect/io/Effect").Effect<never, import("./WS.js").WebSocketError | import("./WS.js").WebSocketCloseError, never>;
9
- readonly send: (p: Discord.GatewayPayload) => import("@effect/io/Effect").Effect<never, never, boolean>;
10
- readonly reconnect: import("@effect/io/Effect").Effect<never, never, boolean>;
11
- }>;
12
- }>;
13
- export interface Shard extends Effect.Success<typeof make> {
14
- }
15
- export declare const Shard: import("@effect/data/Context").Tag<Shard, Shard>;
16
- export declare const LiveShard: import("@effect-http/client/_common").Layer<DiscordConfig | Log | import("dfx/RateLimit").RateLimitStore | import("./DiscordWS.js").DiscordWSCodec, never, Shard>;
@@ -1,85 +0,0 @@
1
- import * as tsplus_module_1 from "@effect/io/Effect";
2
- import * as tsplus_module_2 from "dfx/_common";
3
- import * as tsplus_module_3 from "@effect/io/Config/Secret";
4
- import * as tsplus_module_4 from "@effect/io/Queue";
5
- import * as tsplus_module_5 from "@effect/data/Option";
6
- import * as tsplus_module_6 from "@effect/data/Chunk";
7
- import * as tsplus_module_7 from "@effect/io/Ref";
8
- import * as tsplus_module_8 from "@effect/data/Duration";
9
- import * as tsplus_module_9 from "@effect/io/Layer";
10
- import { DiscordConfig } from "dfx/DiscordConfig";
11
- import { LiveRateLimiter, RateLimiter } from "dfx/RateLimit";
12
- import { DiscordWS, LiveDiscordWS } from "./DiscordWS.js";
13
- import * as Heartbeats from "./Shard/heartbeats.js";
14
- import * as Identify from "./Shard/identify.js";
15
- import * as InvalidSession from "./Shard/invalidSession.js";
16
- import * as Utils from "./Shard/utils.js";
17
- import { Reconnect } from "./WS.js";
18
- import { Log } from "dfx/Log";
19
- export const make = tsplus_module_1.flatMap(DiscordConfig, ({ token, gateway }) => tsplus_module_1.flatMap(RateLimiter, limiter => tsplus_module_1.flatMap(DiscordWS, dws => tsplus_module_1.map(Log, log => {
20
- const connect = (shard, hub) => tsplus_module_1.flatMap(tsplus_module_4.unbounded(), outboundQueue => tsplus_module_1.flatMap(tsplus_module_4.unbounded(), pendingQueue => tsplus_module_1.flatMap(tsplus_module_7.make(0 /* Phase.Connecting */), phase => {
21
- const setPhase = (p) => tsplus_module_1.zipLeft(tsplus_module_7.set(phase, p), log.debug("Shard", shard, "phase", p));
22
- const outbound = tsplus_module_1.tap(outboundQueue
23
- .take(), () => limiter.maybeWait("dfx.shard.send", tsplus_module_8.minutes(1), 120));
24
- const send = (p) => tsplus_module_1.flatMap(tsplus_module_7.get(phase), _ => _ === 2 /* Phase.Connected */
25
- ? outboundQueue.offer(p)
26
- : pendingQueue.offer(p));
27
- const heartbeatSend = (p) => tsplus_module_1.flatMap(tsplus_module_7.get(phase), _ => _ !== 0 /* Phase.Connecting */
28
- ? outboundQueue.offer(p)
29
- : tsplus_module_1.succeed(false));
30
- const prioritySend = (p) => outboundQueue.offer(p);
31
- const resume = tsplus_module_1.asUnit(tsplus_module_1.tap(tsplus_module_1.zipRight(setPhase(2 /* Phase.Connected */), pendingQueue.takeAll()), _ => outboundQueue.offerAll(_)));
32
- const onConnecting = tsplus_module_1.zipRight(tsplus_module_1.tap(outboundQueue
33
- .takeAll(), _ => pendingQueue.offerAll(tsplus_module_6.filter(_, msg => msg !== Reconnect &&
34
- msg.op !== 2 /* Discord.GatewayOpcode.IDENTIFY */ &&
35
- msg.op !== 6 /* Discord.GatewayOpcode.RESUME */ &&
36
- msg.op !== 1 /* Discord.GatewayOpcode.HEARTBEAT */))), setPhase(0 /* Phase.Connecting */));
37
- return tsplus_module_1.flatMap(dws.connect({ outbound, onConnecting }), socket => tsplus_module_1.flatMap(Utils.latest(p => tsplus_module_5.map(tsplus_module_5.filter((p) => p.op === 0 /* Discord.GatewayOpcode.DISPATCH */ && p.t === "READY")(tsplus_module_5.some(p)), p => p.d)), ([latestReady, updateLatestReady]) => tsplus_module_1.flatMap(Utils.latest(p => tsplus_module_5.fromNullable(p.s)), ([latestSequence, updateLatestSequence]) => {
38
- const maybeUpdateUrl = (p) => tsplus_module_5.match(tsplus_module_5.map(tsplus_module_5.filter((p) => p.op === 0 /* Discord.GatewayOpcode.DISPATCH */ && p.t === "READY")(tsplus_module_5.some(p)), p => p.d), () => tsplus_module_1.unit(), a => socket.setUrl(a.resume_gateway_url));
39
- return tsplus_module_1.flatMap(tsplus_module_4.unbounded(), hellos => tsplus_module_1.map(tsplus_module_4.unbounded(), acks => {
40
- // heartbeats
41
- const heartbeats = Heartbeats.send(hellos, acks, latestSequence, heartbeatSend);
42
- // identify
43
- const identify = Identify.identifyOrResume({
44
- token: tsplus_module_3.value(token),
45
- shard,
46
- intents: gateway.intents,
47
- presence: gateway.presence,
48
- }, latestReady, latestSequence);
49
- const onPayload = (p) => tsplus_module_1.flatMap(tsplus_module_1.zipPar(tsplus_module_1.zipPar(updateLatestReady(p), updateLatestSequence(p)), maybeUpdateUrl(p)), () => {
50
- let effect = tsplus_module_1.unit();
51
- switch (p.op) {
52
- case 10 /* Discord.GatewayOpcode.HELLO */:
53
- effect = tsplus_module_1.zipPar(tsplus_module_1.tap(identify, prioritySend), tsplus_module_1.zipRight(setPhase(1 /* Phase.Handshake */), hellos.offer(p)));
54
- break;
55
- case 11 /* Discord.GatewayOpcode.HEARTBEAT_ACK */:
56
- effect = acks.offer(p);
57
- break;
58
- case 9 /* Discord.GatewayOpcode.INVALID_SESSION */:
59
- effect = tsplus_module_1.tap(InvalidSession.fromPayload(p, latestReady), send);
60
- break;
61
- case 0 /* Discord.GatewayOpcode.DISPATCH */:
62
- if (p.t === "READY" || p.t === "RESUMED") {
63
- effect = tsplus_module_1.zipRight(resume, hub.publish(p));
64
- }
65
- else {
66
- effect = hub.publish(p);
67
- }
68
- break;
69
- }
70
- return tsplus_module_1.map(effect, () => void 0);
71
- });
72
- const run = tsplus_module_1.zipParLeft(tsplus_module_1.zipParLeft(tsplus_module_1.forever(tsplus_module_1.flatMap(socket.take, onPayload)), heartbeats), socket.run);
73
- return {
74
- run,
75
- send: (p) => send(p),
76
- reconnect: send(Reconnect),
77
- };
78
- }));
79
- })));
80
- })));
81
- return { connect };
82
- }))));
83
- export const Shard = tsplus_module_2.Tag();
84
- export const LiveShard = tsplus_module_9.provide(tsplus_module_1.toLayer(make, Shard))((tsplus_module_9.merge(LiveRateLimiter)(LiveDiscordWS)));
85
- //# sourceMappingURL=Shard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Shard.js","sourceRoot":"","sources":["../src/DiscordGateway/Shard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAW,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAQ7B,MAAM,CAAC,MAAM,IAAI,2BACc,aAAa,GAApC,EAAE,KAAK,EAAE,OAAO,EAAE,6BACN,WAAW,EAAvB,OAAO,4BACC,SAAS,EAAjB,GAAG,wBACK,GAAG,EAAX,GAAG;IAET,MAAM,OAAO,GAAG,CACd,KAAkC,EAClC,GAAsD,EACtD,EAAE,yBAEwB,2BAA0B,EAA5C,aAAa,4BACI,2BAA0B,EAA3C,YAAY,4BACF,8CAA0B,EAApC,KAAK;QACX,MAAM,QAAQ,GAAG,CAAC,CAAQ,EAAE,EAAE,CAC5B,wBAAA,oBAAA,KAAK,EAAK,CAAC,CAAC,EAAS,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;QAC7D,MAAM,QAAQ,GAAG,oBAAA,aAAa;aAC3B,IAAI,EAAE,EACF,GAAG,EAAE,CACR,OAAO,CAAC,SAAS,CAAC,gBAAgB,EAAE,wBAAiB,CAAC,C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EAAS,CAAA;AACjC,MAAM,CAAC,MAAM,SAAS,2BACiB,wBAAA,IAAI,EAAS,KAAK,CAAC,EAAxD,uBAAiB,eAAe,EAA/B,aAAa,EAAmB,CAAuB,CAAA"}
@@ -1,12 +0,0 @@
1
- import { Effect, Maybe } from "dfx/_common";
2
- export interface ClaimIdContext {
3
- sharderCount: number;
4
- totalCount: number;
5
- }
6
- export interface ShardStore {
7
- claimId: (ctx: ClaimIdContext) => Effect<never, never, Maybe<number>>;
8
- allClaimed: (totalCount: number) => Effect<never, never, boolean>;
9
- heartbeat?: (shardId: number) => Effect<never, never, void>;
10
- }
11
- export declare const ShardStore: import("@effect/data/Context").Tag<ShardStore, ShardStore>;
12
- export declare const LiveMemoryShardStore: import("@effect-http/client/_common").Layer<never, never, ShardStore>;
@@ -1,22 +0,0 @@
1
- import * as tsplus_module_1 from "dfx/_common";
2
- import * as tsplus_module_2 from "@effect/data/Option";
3
- import * as tsplus_module_3 from "@effect/io/Effect";
4
- import * as tsplus_module_4 from "@effect/io/Layer";
5
- export const ShardStore = tsplus_module_1.Tag();
6
- // Very basic shard id store, that does no health checks
7
- const memoryStore = () => {
8
- let currentId = 0;
9
- return {
10
- claimId: ({ totalCount }) => tsplus_module_3.sync(() => {
11
- if (currentId >= totalCount) {
12
- return tsplus_module_2.none();
13
- }
14
- const id = currentId;
15
- currentId++;
16
- return tsplus_module_2.some(id);
17
- }),
18
- allClaimed: totalCount => tsplus_module_3.sync(() => currentId >= totalCount),
19
- };
20
- };
21
- export const LiveMemoryShardStore = tsplus_module_4.sync(ShardStore, memoryStore);
22
- //# sourceMappingURL=ShardStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShardStore.js","sourceRoot":"","sources":["../src/DiscordGateway/ShardStore.ts"],"names":[],"mappings":";;;;AAUA,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAA,GAAG,EAAc,CAAA;AAE3C,wDAAwD;AACxD,MAAM,WAAW,GAAG,GAAe,EAAE;IACnC,IAAI,SAAS,GAAG,CAAC,CAAA;IAEjB,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAC1B,qBAAY,GAAG,EAAE;YACf,IAAI,SAAS,IAAI,UAAU,EAAE;gBAC3B,OAAO,sBAAY,CAAA;aACpB;YAED,MAAM,EAAE,GAAG,SAAS,CAAA;YACpB,SAAS,EAAE,CAAA;YACX,OAAO,qBAAW,EAAE,CAAC,CAAA;QACvB,CAAC,CAAC;QAEJ,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,qBAAY,GAAG,EAAE,CAAC,SAAS,IAAI,UAAU,CAAC;KACrE,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAW,UAAU,EAAE,WAAW,CAAC,CAAA"}
@@ -1,15 +0,0 @@
1
- import { Effect, Discord, Hub } from "dfx/_common";
2
- import { DiscordConfig } from "dfx/DiscordConfig";
3
- import { DiscordREST } from "dfx/DiscordREST";
4
- import { RateLimiter } from "../RateLimit.js";
5
- import { Shard } from "./Shard.js";
6
- import { ShardStore } from "./ShardStore.js";
7
- import { WebSocketCloseError, WebSocketError } from "./WS.js";
8
- declare const make: import("@effect/io/Effect").Effect<DiscordREST | DiscordConfig | RateLimiter | Shard | ShardStore, never, {
9
- readonly run: (hub: Hub<Discord.GatewayPayload<Discord.ReceiveEvent>>) => import("@effect/io/Effect").Effect<never, WebSocketError | WebSocketCloseError, never>;
10
- }>;
11
- export interface Sharder extends Effect.Success<typeof make> {
12
- }
13
- export declare const Sharder: import("@effect/data/Context").Tag<Sharder, Sharder>;
14
- export declare const LiveSharder: import("@effect-http/client/_common").Layer<DiscordREST | DiscordConfig | import("../Log.js").Log | import("../RateLimit.js").RateLimitStore | import("./DiscordWS.js").DiscordWSCodec | ShardStore, never, Sharder>;
15
- export {};
@@ -1,49 +0,0 @@
1
- import * as tsplus_module_1 from "dfx/_common";
2
- import * as tsplus_module_2 from "@effect/io/Effect";
3
- import * as tsplus_module_3 from "@effect/data/Chunk";
4
- import * as tsplus_module_4 from "@effect/io/Deferred";
5
- import * as tsplus_module_5 from "@effect/io/Ref";
6
- import * as tsplus_module_6 from "@effect/data/Duration";
7
- import * as tsplus_module_7 from "@effect/data/Option";
8
- import * as tsplus_module_8 from "@effect/io/Layer";
9
- import { millis } from "@effect/data/Duration";
10
- import { DiscordConfig } from "dfx/DiscordConfig";
11
- import { DiscordREST } from "dfx/DiscordREST";
12
- import { LiveRateLimiter, RateLimiter } from "../RateLimit.js";
13
- import { LiveShard, Shard } from "./Shard.js";
14
- import { ShardStore } from "./ShardStore.js";
15
- const make = tsplus_module_2.flatMap(ShardStore, store => tsplus_module_2.flatMap(DiscordREST, rest => tsplus_module_2.flatMap(DiscordConfig, ({ gateway: config }) => tsplus_module_2.flatMap(RateLimiter, limiter => tsplus_module_2.flatMap(Shard, shard => {
16
- const takeConfig = (totalCount) => tsplus_module_2.map(tsplus_module_5.make(0), currentCount => {
17
- const claimId = (sharderCount) => tsplus_module_2.flatMap(store
18
- .claimId({
19
- totalCount,
20
- sharderCount,
21
- }), a => tsplus_module_7.match(a, () => tsplus_module_2.delay(claimId(sharderCount), tsplus_module_6.minutes(3)), id => tsplus_module_2.succeed(id)));
22
- return tsplus_module_2.map(tsplus_module_2.flatMap(tsplus_module_5.getAndUpdate(currentCount, _ => _ + 1), claimId), id => ({ id, totalCount }));
23
- });
24
- return tsplus_module_2.map(tsplus_module_2.catchAll(tsplus_module_2.flatMap(rest
25
- .getGatewayBot(), r => r.json), () => tsplus_module_2.succeed({
26
- url: "wss://gateway.discord.gg/",
27
- shards: 1,
28
- session_start_limit: {
29
- total: 0,
30
- remaining: 0,
31
- reset_after: 0,
32
- max_concurrency: 1,
33
- },
34
- })), gateway => {
35
- const run = (hub) => tsplus_module_2.flatMap(tsplus_module_4.make(), deferred => tsplus_module_2.flatMap(takeConfig(config.shardCount ?? gateway.shards), take => {
36
- const spawner = tsplus_module_2.forever(tsplus_module_2.flatMap(tsplus_module_2.flatMap(tsplus_module_2.tap(tsplus_module_2.map(take, config => ({
37
- ...config,
38
- url: gateway.url,
39
- concurrency: gateway.session_start_limit.max_concurrency,
40
- })), ({ id, concurrency }) => limiter.maybeWait(`dfx.sharder.${id % concurrency}`, millis(config.identifyRateLimit[0]), config.identifyRateLimit[1])), c => shard.connect([c.id, c.totalCount], hub)), shard => tsplus_module_2.fork(tsplus_module_2.catchAllCause(shard.run, _ => tsplus_module_4.failCause(deferred, _)))));
41
- const spawners = tsplus_module_3.map(tsplus_module_3.range(1, gateway.session_start_limit.max_concurrency), () => spawner);
42
- return tsplus_module_2.zipParLeft(tsplus_module_2.allParDiscard(spawners), tsplus_module_1.deferredAwait(deferred));
43
- }));
44
- return { run };
45
- });
46
- })))));
47
- export const Sharder = tsplus_module_1.Tag();
48
- export const LiveSharder = tsplus_module_8.provide(tsplus_module_2.toLayer(make, Sharder))((tsplus_module_8.merge(LiveShard)(LiveRateLimiter)));
49
- //# sourceMappingURL=Sharder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sharder.js","sourceRoot":"","sources":["../src/DiscordGateway/Sharder.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,MAAM,IAAI,2BACQ,UAAU,EAApB,KAAK,4BACI,WAAW,EAApB,IAAI,4BACoB,aAAa,GAArC,EAAE,OAAO,EAAE,MAAM,EAAE,6BACP,WAAW,EAAvB,OAAO,4BACG,KAAK,EAAf,KAAK;IAEX,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C,GAAG;gBAChB,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe;aACzD,CAAC,CAAC,EACE,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAC3B,OAAO,CAAC,SAAS,CACf,eAAe,EAAE,GAAG,WAAW,EAAE,EACjC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EACnC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAC5B,CACF,EACQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC,EAErD,KAAK,CAAC,EAAE,sBAAC,8BAAA,KAAK,CAAC,GAAG,EAAe,CAAC,CAAC,EAAE,CAAC,0BAAA,QAAQ,EAAW,CAAC,CAAC,CAAC,CAAK,CAClE,CAAQ,CAAA;YAEX,MAAM,QAAQ,GAAG,oBAAA,sBACf,CAAC,EACD,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAC5C,EAAK,GAAG,EAAE,CAAC,OAAO,CAAC,CAAA;mBAGlB,2BAAA,8BAAqB,QAAQ,CAAC,gCAAY,QAAQ,EAIjD;WAEH,CAAA;QAEJ,OAAO,EAAE,GAAG,EAAW,CAAA;;MACvB,CAAA;AAGF,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAA,GAAG,EAAW,CAAA;AACrC,MAAM,CAAC,MAAM,WAAW,2BACW,wBAAA,IAAI,EAAS,OAAO,CAAC,EAAtD,uBAAmB,SAAS,EAA3B,eAAe,EAAa,CAAyB,CAAA"}
@@ -1,31 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="ws" />
3
- import { Ref, Enqueue, Duration, Effect } from "dfx/_common";
4
- import { Log } from "dfx/Log";
5
- import WebSocket from "isomorphic-ws";
6
- export declare const Reconnect: unique symbol;
7
- export type Reconnect = typeof Reconnect;
8
- export type Message = string | Buffer | ArrayBuffer | Reconnect;
9
- export declare class WebSocketError {
10
- readonly reason: "open-timeout" | "error";
11
- readonly error?: unknown;
12
- readonly _tag = "WebSocketError";
13
- constructor(reason: "open-timeout" | "error", error?: unknown);
14
- }
15
- export declare class WebSocketCloseError {
16
- readonly code: number;
17
- readonly reason: string;
18
- readonly _tag = "WebSocketCloseError";
19
- constructor(code: number, reason: string);
20
- }
21
- declare const make: import("@effect/io/Effect").Effect<Log, never, {
22
- readonly connect: (url: Ref<string>, takeOutbound: Effect<never, never, Message>, onConnecting?: import("@effect/io/Effect").Effect<never, never, void>, openTimeout?: import("../_common.js").Duration) => import("@effect/io/Effect").Effect<never, never, {
23
- readonly run: import("@effect/io/Effect").Effect<never, WebSocketError | WebSocketCloseError, never>;
24
- readonly take: import("@effect/io/Effect").Effect<never, never, WebSocket.Data>;
25
- }>;
26
- }>;
27
- export interface WS extends Effect.Success<typeof make> {
28
- }
29
- export declare const WS: import("@effect/data/Context").Tag<WS, WS>;
30
- export declare const LiveWS: import("@effect-http/client/_common").Layer<Log, never, WS>;
31
- export {};