dfx 0.9.7 → 0.9.8
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/package.json +7 -6
- package/README.md +0 -41
- package/dist/DiscordConfig/index.d.ts +0 -40
- package/dist/DiscordConfig/index.d.ts.map +0 -1
- package/dist/DiscordConfig/index.js +0 -29
- package/dist/DiscordConfig/index.js.map +0 -1
- package/dist/DiscordGateway/DiscordWS/index.d.ts +0 -24
- package/dist/DiscordGateway/DiscordWS/index.d.ts.map +0 -1
- package/dist/DiscordGateway/DiscordWS/index.js +0 -26
- package/dist/DiscordGateway/DiscordWS/index.js.map +0 -1
- package/dist/DiscordGateway/Shard/heartbeats.d.ts +0 -4
- package/dist/DiscordGateway/Shard/heartbeats.d.ts.map +0 -1
- package/dist/DiscordGateway/Shard/heartbeats.js +0 -24
- package/dist/DiscordGateway/Shard/heartbeats.js.map +0 -1
- package/dist/DiscordGateway/Shard/identify.d.ts +0 -13
- package/dist/DiscordGateway/Shard/identify.d.ts.map +0 -1
- package/dist/DiscordGateway/Shard/identify.js +0 -30
- package/dist/DiscordGateway/Shard/identify.js.map +0 -1
- package/dist/DiscordGateway/Shard/index.d.ts +0 -10
- package/dist/DiscordGateway/Shard/index.d.ts.map +0 -1
- package/dist/DiscordGateway/Shard/index.js +0 -52
- package/dist/DiscordGateway/Shard/index.js.map +0 -1
- package/dist/DiscordGateway/Shard/invalidSession.d.ts +0 -4
- package/dist/DiscordGateway/Shard/invalidSession.d.ts.map +0 -1
- package/dist/DiscordGateway/Shard/invalidSession.js +0 -10
- package/dist/DiscordGateway/Shard/invalidSession.js.map +0 -1
- package/dist/DiscordGateway/Shard/sendEvents.d.ts +0 -8
- package/dist/DiscordGateway/Shard/sendEvents.d.ts.map +0 -1
- package/dist/DiscordGateway/Shard/sendEvents.js +0 -26
- package/dist/DiscordGateway/Shard/sendEvents.js.map +0 -1
- package/dist/DiscordGateway/Shard/utils.d.ts +0 -4
- package/dist/DiscordGateway/Shard/utils.d.ts.map +0 -1
- package/dist/DiscordGateway/Shard/utils.js +0 -9
- package/dist/DiscordGateway/Shard/utils.js.map +0 -1
- package/dist/DiscordGateway/ShardStore/index.d.ts +0 -13
- package/dist/DiscordGateway/ShardStore/index.d.ts.map +0 -1
- package/dist/DiscordGateway/ShardStore/index.js +0 -22
- package/dist/DiscordGateway/ShardStore/index.js.map +0 -1
- package/dist/DiscordGateway/Sharder/index.d.ts +0 -10
- package/dist/DiscordGateway/Sharder/index.d.ts.map +0 -1
- package/dist/DiscordGateway/Sharder/index.js +0 -61
- package/dist/DiscordGateway/Sharder/index.js.map +0 -1
- package/dist/DiscordGateway/WS/index.d.ts +0 -28
- package/dist/DiscordGateway/WS/index.d.ts.map +0 -1
- package/dist/DiscordGateway/WS/index.js +0 -82
- package/dist/DiscordGateway/WS/index.js.map +0 -1
- package/dist/DiscordGateway/index.d.ts +0 -21
- package/dist/DiscordGateway/index.d.ts.map +0 -1
- package/dist/DiscordGateway/index.js +0 -27
- package/dist/DiscordGateway/index.js.map +0 -1
- package/dist/DiscordREST/index.d.ts +0 -13
- package/dist/DiscordREST/index.d.ts.map +0 -1
- package/dist/DiscordREST/index.js +0 -85
- package/dist/DiscordREST/index.js.map +0 -1
- package/dist/DiscordREST/types.d.ts +0 -10
- package/dist/DiscordREST/types.d.ts.map +0 -1
- package/dist/DiscordREST/types.js +0 -2
- package/dist/DiscordREST/types.js.map +0 -1
- package/dist/DiscordREST/utils.d.ts +0 -11
- package/dist/DiscordREST/utils.d.ts.map +0 -1
- package/dist/DiscordREST/utils.js +0 -22
- package/dist/DiscordREST/utils.js.map +0 -1
- package/dist/Helpers/flags.d.ts +0 -28
- package/dist/Helpers/flags.d.ts.map +0 -1
- package/dist/Helpers/flags.js +0 -36
- package/dist/Helpers/flags.js.map +0 -1
- package/dist/Helpers/intents.d.ts +0 -25
- package/dist/Helpers/intents.d.ts.map +0 -1
- package/dist/Helpers/intents.js +0 -28
- package/dist/Helpers/intents.js.map +0 -1
- package/dist/Helpers/interactions.d.ts +0 -74
- package/dist/Helpers/interactions.d.ts.map +0 -1
- package/dist/Helpers/interactions.js +0 -93
- package/dist/Helpers/interactions.js.map +0 -1
- package/dist/Helpers/members.d.ts +0 -10
- package/dist/Helpers/members.d.ts.map +0 -1
- package/dist/Helpers/members.js +0 -10
- package/dist/Helpers/members.js.map +0 -1
- package/dist/Helpers/permissions.d.ts +0 -35
- package/dist/Helpers/permissions.d.ts.map +0 -1
- package/dist/Helpers/permissions.js +0 -69
- package/dist/Helpers/permissions.js.map +0 -1
- package/dist/Helpers/ui.d.ts +0 -48
- package/dist/Helpers/ui.d.ts.map +0 -1
- package/dist/Helpers/ui.js +0 -67
- package/dist/Helpers/ui.js.map +0 -1
- package/dist/Http/index.d.ts +0 -31
- package/dist/Http/index.d.ts.map +0 -1
- package/dist/Http/index.js +0 -53
- package/dist/Http/index.js.map +0 -1
- package/dist/Interactions/context.d.ts +0 -37
- package/dist/Interactions/context.d.ts.map +0 -1
- package/dist/Interactions/context.js +0 -34
- package/dist/Interactions/context.js.map +0 -1
- package/dist/Interactions/definitions.d.ts +0 -61
- package/dist/Interactions/definitions.d.ts.map +0 -1
- package/dist/Interactions/definitions.js +0 -52
- package/dist/Interactions/definitions.js.map +0 -1
- package/dist/Interactions/gateway.d.ts +0 -7
- package/dist/Interactions/gateway.d.ts.map +0 -1
- package/dist/Interactions/gateway.js +0 -21
- package/dist/Interactions/gateway.js.map +0 -1
- package/dist/Interactions/handlers.d.ts +0 -9
- package/dist/Interactions/handlers.d.ts.map +0 -1
- package/dist/Interactions/handlers.js +0 -49
- package/dist/Interactions/handlers.js.map +0 -1
- package/dist/Interactions/index.d.ts +0 -18
- package/dist/Interactions/index.d.ts.map +0 -1
- package/dist/Interactions/index.js +0 -39
- package/dist/Interactions/index.js.map +0 -1
- package/dist/Interactions/utils.d.ts +0 -11
- package/dist/Interactions/utils.d.ts.map +0 -1
- package/dist/Interactions/utils.js +0 -61
- package/dist/Interactions/utils.js.map +0 -1
- package/dist/Interactions/webhook.d.ts +0 -33
- package/dist/Interactions/webhook.d.ts.map +0 -1
- package/dist/Interactions/webhook.js +0 -42
- package/dist/Interactions/webhook.js.map +0 -1
- package/dist/Log/index.d.ts +0 -13
- package/dist/Log/index.d.ts.map +0 -1
- package/dist/Log/index.js +0 -19
- package/dist/Log/index.js.map +0 -1
- package/dist/RateLimitStore/index.d.ts +0 -25
- package/dist/RateLimitStore/index.d.ts.map +0 -1
- package/dist/RateLimitStore/index.js +0 -24
- package/dist/RateLimitStore/index.js.map +0 -1
- package/dist/RateLimitStore/memory.d.ts +0 -3
- package/dist/RateLimitStore/memory.d.ts.map +0 -1
- package/dist/RateLimitStore/memory.js +0 -31
- package/dist/RateLimitStore/memory.js.map +0 -1
- package/dist/RateLimitStore/utils.d.ts +0 -3
- package/dist/RateLimitStore/utils.d.ts.map +0 -1
- package/dist/RateLimitStore/utils.js +0 -18
- package/dist/RateLimitStore/utils.js.map +0 -1
- package/dist/common-gateway.d.ts +0 -6
- package/dist/common-gateway.d.ts.map +0 -1
- package/dist/common-gateway.js +0 -6
- package/dist/common-gateway.js.map +0 -1
- package/dist/common.d.ts +0 -29
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js +0 -16
- package/dist/common.js.map +0 -1
- package/dist/global.d.ts +0 -18
- package/dist/global.d.ts.map +0 -1
- package/dist/global.js +0 -2
- package/dist/global.js.map +0 -1
- package/dist/index.d.ts +0 -22
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -29
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts +0 -4229
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1796
- package/dist/types.js.map +0 -1
- package/dist/utils/effect.d.ts +0 -3
- package/dist/utils/effect.d.ts.map +0 -1
- package/dist/utils/effect.js +0 -2
- package/dist/utils/effect.js.map +0 -1
- package/dist/utils/tsplus.d.ts +0 -14
- package/dist/utils/tsplus.d.ts.map +0 -1
- package/dist/utils/tsplus.js +0 -2
- package/dist/utils/tsplus.js.map +0 -1
- package/dist/webhooks.d.ts +0 -16
- package/dist/webhooks.d.ts.map +0 -1
- package/dist/webhooks.js +0 -23
- package/dist/webhooks.js.map +0 -1
- package/src/DiscordConfig/index.ts +0 -52
- package/src/DiscordGateway/DiscordWS/index.ts +0 -50
- package/src/DiscordGateway/Shard/heartbeats.ts +0 -39
- package/src/DiscordGateway/Shard/identify.ts +0 -61
- package/src/DiscordGateway/Shard/index.ts +0 -90
- package/src/DiscordGateway/Shard/invalidSession.ts +0 -11
- package/src/DiscordGateway/Shard/sendEvents.ts +0 -35
- package/src/DiscordGateway/Shard/utils.ts +0 -14
- package/src/DiscordGateway/ShardStore/index.ts +0 -33
- package/src/DiscordGateway/Sharder/index.ts +0 -95
- package/src/DiscordGateway/WS/index.ts +0 -99
- package/src/DiscordGateway/index.ts +0 -55
- package/src/DiscordREST/index.ts +0 -132
- package/src/DiscordREST/types.ts +0 -14
- package/src/DiscordREST/utils.ts +0 -35
- package/src/Helpers/flags.ts +0 -68
- package/src/Helpers/intents.ts +0 -32
- package/src/Helpers/interactions.ts +0 -180
- package/src/Helpers/members.ts +0 -14
- package/src/Helpers/permissions.ts +0 -102
- package/src/Helpers/ui.ts +0 -103
- package/src/Http/index.ts +0 -65
- package/src/Interactions/context.ts +0 -100
- package/src/Interactions/definitions.ts +0 -144
- package/src/Interactions/gateway.ts +0 -55
- package/src/Interactions/handlers.ts +0 -139
- package/src/Interactions/index.ts +0 -83
- package/src/Interactions/utils.ts +0 -81
- package/src/Interactions/webhook.ts +0 -96
- package/src/Log/index.ts +0 -23
- package/src/RateLimitStore/index.ts +0 -65
- package/src/RateLimitStore/memory.ts +0 -48
- package/src/RateLimitStore/utils.ts +0 -27
- package/src/common-gateway.ts +0 -5
- package/src/common.ts +0 -30
- package/src/global.ts +0 -50
- package/src/index.ts +0 -36
- package/src/json.d.ts +0 -1
- package/src/types.ts +0 -6095
- package/src/utils/effect.ts +0 -7
- package/src/utils/tsplus.ts +0 -11
- package/src/webhooks.ts +0 -30
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
6
|
+
"access": "public",
|
|
7
|
+
"directory": "dist"
|
|
7
8
|
},
|
|
8
9
|
"files": [
|
|
9
10
|
"dist/**/*",
|
|
@@ -13,14 +14,14 @@
|
|
|
13
14
|
"author": "Tim Smart <hello@timsmart.co>",
|
|
14
15
|
"license": "MIT",
|
|
15
16
|
"scripts": {
|
|
16
|
-
"prepublishOnly": "pnpm run clean && pnpm run build:tsc",
|
|
17
|
+
"prepublishOnly": "pnpm run clean && pnpm run build:tsc && cp package.json dist/",
|
|
17
18
|
"build:tsc": "tsc -p tsconfig.json",
|
|
18
19
|
"types": "discord-api-codegen ./discord-api-docs -l typescript -o 'imports=RestResponse|dfx/DiscordREST/types' 'endpointReturnType=RestResponse' > src/types.ts && prettier -w src/types.ts",
|
|
19
20
|
"clean": "rm -rf dist/ *.tsbuildinfo"
|
|
20
21
|
},
|
|
21
22
|
"exports": {
|
|
22
|
-
".": "./
|
|
23
|
-
"./*": "
|
|
23
|
+
".": "./index.js",
|
|
24
|
+
"./*": "./*.js"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@effect/io": "^0.0.30",
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"@fp-ts/data": "^0.0.20"
|
|
51
52
|
}
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "0ab77f759cddf4f9a2ac80dda27618ec436f931a"
|
|
54
55
|
}
|
package/README.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# dfx
|
|
2
|
-
|
|
3
|
-
A Discord library built on top of @effect/io
|
|
4
|
-
|
|
5
|
-
- Supports both the gateway and webhooks
|
|
6
|
-
- Simple yet powerful abstractions to build Discord bots
|
|
7
|
-
|
|
8
|
-
## Example
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
import * as Effect from "@effect/io/Effect"
|
|
12
|
-
import { pipe } from "@fp-ts/data/Function"
|
|
13
|
-
import { Ix, runIxGateway, makeLayer } from "dfx"
|
|
14
|
-
|
|
15
|
-
// Create the dependencies layer
|
|
16
|
-
const Dependencies = makeLayer({
|
|
17
|
-
token: "xxx",
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
// Create hello command that responds with "Hello!"
|
|
21
|
-
const hello = Ix.global(
|
|
22
|
-
{
|
|
23
|
-
name: "hello",
|
|
24
|
-
description: "A basic command",
|
|
25
|
-
},
|
|
26
|
-
Effect.succeedSome({
|
|
27
|
-
type: 4,
|
|
28
|
-
data: {
|
|
29
|
-
content: "Hello!",
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
// Run it
|
|
35
|
-
pipe(
|
|
36
|
-
Ix.builder.add(hello),
|
|
37
|
-
runIxGateway((error) => Effect.fail(error)),
|
|
38
|
-
Effect.providerLayer(Dependencies),
|
|
39
|
-
Effect.unsafeRunPromise,
|
|
40
|
-
)
|
|
41
|
-
```
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Duration, Discord } from "dfx/common";
|
|
2
|
-
export interface DiscordConfig {
|
|
3
|
-
token: string;
|
|
4
|
-
rest: {
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
globalRateLimit: {
|
|
7
|
-
limit: number;
|
|
8
|
-
window: Duration;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
gateway: {
|
|
12
|
-
intents: number;
|
|
13
|
-
presence?: Discord.UpdatePresence;
|
|
14
|
-
shardCount?: number;
|
|
15
|
-
identifyRateLimit: readonly [window: number, limit: number];
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const DiscordConfig: import("../common.js").Tag<DiscordConfig>;
|
|
19
|
-
export interface MakeOpts {
|
|
20
|
-
token: string;
|
|
21
|
-
rest?: Partial<DiscordConfig["rest"]>;
|
|
22
|
-
gateway?: Partial<DiscordConfig["gateway"]>;
|
|
23
|
-
}
|
|
24
|
-
export declare const make: ({ token, rest, gateway }: MakeOpts) => DiscordConfig;
|
|
25
|
-
export declare const makeLayer: (a_0: MakeOpts) => import("../common.js").Layer<never, never, DiscordConfig>;
|
|
26
|
-
export declare const token: import("../common.js").Effect<DiscordConfig, never, string>;
|
|
27
|
-
export declare const rest: import("../common.js").Effect<DiscordConfig, never, {
|
|
28
|
-
baseUrl: string;
|
|
29
|
-
globalRateLimit: {
|
|
30
|
-
limit: number;
|
|
31
|
-
window: Duration;
|
|
32
|
-
};
|
|
33
|
-
}>;
|
|
34
|
-
export declare const gateway: import("../common.js").Effect<DiscordConfig, never, {
|
|
35
|
-
intents: number;
|
|
36
|
-
presence?: import("../types.js").UpdatePresence | undefined;
|
|
37
|
-
shardCount?: number | undefined;
|
|
38
|
-
identifyRateLimit: readonly [window: number, limit: number];
|
|
39
|
-
}>;
|
|
40
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DiscordConfig/index.ts"],"names":[],"mappings":";AAEA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAA;QACf,eAAe,EAAE;YACf,KAAK,EAAE,MAAM,CAAA;YACb,MAAM,EAAE,QAAQ,CAAA;SACjB,CAAA;KACF,CAAA;IACD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAA;QACjC,UAAU,CAAC,EAAE,MAAM,CAAA;QAEnB,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;KAC5D,CAAA;CACF;AACD,eAAO,MAAM,aAAa,2CAAuB,CAAA;AAEjD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAA;CAC5C;AAED,eAAO,MAAM,IAAI,6BAA8B,QAAQ,KAAG,aAgBxD,CAAA;AAEF,eAAO,MAAM,SAAS,8EAA2C,CAAA;AAEjE,eAAO,MAAM,KAAK,6DAA0D,CAAA;AAC5E,eAAO,MAAM,IAAI;aA3CJ,MAAM;qBACE;QACf,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,QAAQ,CAAA;KACjB;EAuCoE,CAAA;AACzE,eAAO,MAAM,OAAO;aArCP,MAAM;;;uBAII,SAAS,CAAC,QAAQ,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;EAmC9D,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "dfx/common";
|
|
2
|
-
import * as tsplus_module_2 from "@fp-ts/data/Duration";
|
|
3
|
-
import * as tsplus_module_3 from "@effect/io/Layer";
|
|
4
|
-
import * as tsplus_module_4 from "@fp-ts/data/Function";
|
|
5
|
-
import * as tsplus_module_5 from "@effect/io/Effect";
|
|
6
|
-
const VERSION = 9;
|
|
7
|
-
export const DiscordConfig = tsplus_module_1.Tag();
|
|
8
|
-
export const make = ({ token, rest, gateway }) => ({
|
|
9
|
-
token,
|
|
10
|
-
rest: {
|
|
11
|
-
baseUrl: `https://discord.com/api/v${VERSION}`,
|
|
12
|
-
...(rest ?? {}),
|
|
13
|
-
globalRateLimit: {
|
|
14
|
-
limit: 50,
|
|
15
|
-
window: tsplus_module_2.seconds(1),
|
|
16
|
-
...(rest?.globalRateLimit ?? {}),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
gateway: {
|
|
20
|
-
intents: tsplus_module_1.Discord.GatewayIntents.GUILDS,
|
|
21
|
-
identifyRateLimit: [5000, 1],
|
|
22
|
-
...(gateway ?? {}),
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
export const makeLayer = tsplus_module_4.flow(make, tsplus_module_3.succeed(DiscordConfig));
|
|
26
|
-
export const token = tsplus_module_5.serviceWith(DiscordConfig)(({ token }) => token);
|
|
27
|
-
export const rest = tsplus_module_5.serviceWith(DiscordConfig)(({ rest }) => rest);
|
|
28
|
-
export const gateway = tsplus_module_5.serviceWith(DiscordConfig)(({ gateway }) => gateway);
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordConfig/index.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,OAAO,GAAG,CAAC,CAAA;AAmBjB,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAA,GAAG,EAAiB,CAAA;AAQjD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAY,EAAiB,EAAE,CAAC,CAAC;IAC1E,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,wBAAc,aAAa,CAAC,CAAC,CAAA;AAEjE,MAAM,CAAC,MAAM,KAAK,GAAG,4BAAmB,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;AAC5E,MAAM,CAAC,MAAM,IAAI,GAAG,4BAAmB,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;AACzE,MAAM,CAAC,MAAM,OAAO,GAAG,4BAAmB,aAAa,CAAC,CACtD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CACzB,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="ws" />
|
|
3
|
-
import { Discord, EffectSource } from "dfx/common";
|
|
4
|
-
import { WS } from "dfx/common-gateway";
|
|
5
|
-
import WebSocket from "isomorphic-ws";
|
|
6
|
-
export type Message = Discord.GatewayPayload | WS.Reconnect;
|
|
7
|
-
export interface OpenOpts {
|
|
8
|
-
url?: string;
|
|
9
|
-
version?: number;
|
|
10
|
-
encoding?: DiscordWSCodec;
|
|
11
|
-
}
|
|
12
|
-
export interface DiscordWSCodec {
|
|
13
|
-
type: "json" | "etf";
|
|
14
|
-
encode: (p: Discord.GatewayPayload) => string | Buffer | ArrayBuffer;
|
|
15
|
-
decode: (p: WebSocket.RawData) => Discord.GatewayPayload;
|
|
16
|
-
}
|
|
17
|
-
export declare const DiscordWSCodec: import("../../common.js").Tag<DiscordWSCodec>;
|
|
18
|
-
export declare const LiveJsonDiscordWSCodec: import("../../common.js").Layer<never, never, DiscordWSCodec>;
|
|
19
|
-
export declare const make: ({ url, version, }?: OpenOpts) => import("../../common.js").Effect<import("../../Log/index.js").Log | DiscordWSCodec, never, {
|
|
20
|
-
source: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
21
|
-
sink: import("callbag-effect-ts/Sink").EffectSink<never, never, never, Message>;
|
|
22
|
-
setUrl: (url: string) => import("../../common.js").Effect<never, never, void>;
|
|
23
|
-
}>;
|
|
24
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,GAAG,EAAE,CAAC,SAAS,CAAA;AAE3D,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;IACpB,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,KAAK,MAAM,GAAG,MAAM,GAAG,WAAW,CAAA;IACpE,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,OAAO,KAAK,OAAO,CAAC,cAAc,CAAA;CACzD;AACD,eAAO,MAAM,cAAc,+CAAwB,CAAA;AACnD,eAAO,MAAM,sBAAsB,+DAIjC,CAAA;AAEF,eAAO,MAAM,IAAI,uBAGd,QAAQ;;;kBAIc,MAAM;EAoB3B,CAAA"}
|
|
@@ -1,26 +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 "dfx/common-gateway";
|
|
4
|
-
import * as tsplus_module_4 from "callbag-effect-ts/Sink/map";
|
|
5
|
-
import * as tsplus_module_5 from "@fp-ts/data/Duration";
|
|
6
|
-
import * as tsplus_module_6 from "@effect/io/Schedule";
|
|
7
|
-
import * as tsplus_module_7 from "callbag-effect-ts/Source/tapError";
|
|
8
|
-
import * as tsplus_module_8 from "callbag-effect-ts/Source/retry";
|
|
9
|
-
import * as tsplus_module_9 from "callbag-effect-ts/Source/map";
|
|
10
|
-
import * as tsplus_module_10 from "@effect/io/Effect";
|
|
11
|
-
import * as tsplus_module_11 from "@effect/io/Ref";
|
|
12
|
-
export const DiscordWSCodec = tsplus_module_1.Tag();
|
|
13
|
-
export const LiveJsonDiscordWSCodec = tsplus_module_2.succeed(DiscordWSCodec)({
|
|
14
|
-
type: "json",
|
|
15
|
-
encode: (p) => JSON.stringify(p),
|
|
16
|
-
decode: (p) => JSON.parse(p.toString("utf8")),
|
|
17
|
-
});
|
|
18
|
-
export const make = ({ url = "wss://gateway.discord.gg/", version = 10, } = {}) => tsplus_module_10.flatMap(encoding => tsplus_module_10.flatMap(urlRef => {
|
|
19
|
-
const setUrl = (url) => tsplus_module_11.set(`${url}?v=${version}&encoding=${encoding.type}`)(urlRef);
|
|
20
|
-
return tsplus_module_10.flatMap(ws => tsplus_module_10.map(log => {
|
|
21
|
-
const source = tsplus_module_9.map(encoding.decode)(tsplus_module_8.retry(tsplus_module_6.exponential(tsplus_module_5.seconds(0.5)))(tsplus_module_7.tapError((e) => log.info("DiscordWS", "ERROR", e))(ws.source)));
|
|
22
|
-
const sink = tsplus_module_4.map((msg) => msg === tsplus_module_3.WS.Reconnect ? msg : encoding.encode(msg))(ws.sink);
|
|
23
|
-
return { source, sink, setUrl };
|
|
24
|
-
})(tsplus_module_10.service(tsplus_module_1.Log.Log)))(tsplus_module_3.WS.make(urlRef, { perMessageDeflate: false }));
|
|
25
|
-
})(tsplus_module_11.make(`${url}?v=${version}&encoding=${encoding.type}`)))(tsplus_module_10.service(DiscordWSCodec));
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAeA,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAc,cAAc,CAAC,CAAC;IAClE,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,GAAG,GAAG,2BAA2B,EACjC,OAAO,GAAG,EAAE,MACA,EAAE,EAAE,EAAE,0BAEV,QAAQ,6BACR,MAAM;IACZ,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,qBAAW,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,EAA1D,MAAM,CAAqD,CAAA;oCAEvD,EAAE,yBAEF,GAAG;QACT,MAAM,MAAM,GAAG,oBAGR,QAAQ,CAAC,MAAM,EAHP,sBAEN,4BAAqB,wBAAiB,GAAG,CAAC,CAAC,EAFrC,yBACH,CAAC,CAAM,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,EAD1C,EAAE,CAAC,MAAM,CACkC,CACL,CAKpD,CAAA;QAED,MAAM,IAAI,GAAG,oBAAY,CAAC,GAAY,EAAE,EAAE,CACxC,GAAG,KAAK,gBAAA,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EADtC,EAAE,CAAC,IAAI,CAEnB,CAAA;QAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;OAdjB,yBAAe,gBAAA,GAAG,CAAC,GAAG,CAAC,GAFxB,gBAAA,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;GAJzC,sBAAS,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,CAAC,GADvD,yBAAe,cAAc,CAAC,CAsBjD,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Ref, Maybe, Effect, EffectSource, Discord } from "dfx/common";
|
|
2
|
-
import { DWS } from "dfx/common-gateway";
|
|
3
|
-
export declare const fromRaw: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, seqRef: Ref<Maybe<number>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
|
|
4
|
-
//# sourceMappingURL=heartbeats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeats.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/heartbeats.ts"],"names":[],"mappings":";;AAeA,eAAO,MAAM,OAAO,8HAEV,IAAI,MAAM,MAAM,CAAC,CAAC,mGAqBjB,CAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "@effect/io/Ref";
|
|
2
|
-
import * as tsplus_module_2 from "@fp-ts/data/Option";
|
|
3
|
-
import * as tsplus_module_3 from "@effect/io/Effect";
|
|
4
|
-
import * as tsplus_module_4 from "dfx/common-gateway";
|
|
5
|
-
import * as tsplus_module_5 from "@effect/io/Schedule";
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/fromSchedule";
|
|
7
|
-
import * as tsplus_module_7 from "dfx/common";
|
|
8
|
-
import * as tsplus_module_8 from "callbag-effect-ts/Source/tap";
|
|
9
|
-
import * as tsplus_module_9 from "callbag-effect-ts/Source/switchMap";
|
|
10
|
-
import * as tsplus_module_10 from "callbag-effect-ts/Source/mapEffect";
|
|
11
|
-
import * as tsplus_module_11 from "callbag-effect-ts/Source/drain";
|
|
12
|
-
import * as tsplus_module_12 from "callbag-effect-ts/Source/merge";
|
|
13
|
-
import * as tsplus_module_13 from "callbag-effect-ts/Source/unwrap";
|
|
14
|
-
import { millis } from "@fp-ts/data/Duration";
|
|
15
|
-
import * as SendEvents from "./sendEvents.js";
|
|
16
|
-
import * as Utils from "./utils.js";
|
|
17
|
-
const send = (ref, seqRef) => tsplus_module_3.tap(() => tsplus_module_1.set(false)(ref))(tsplus_module_3.map((a) => SendEvents.heartbeat(tsplus_module_2.getOrNull(a)))(tsplus_module_1.get(seqRef)));
|
|
18
|
-
const maybeSend = (ref, seqRef) => tsplus_module_3.flatMap((acked) => acked ? send(ref, seqRef) : tsplus_module_3.succeed(tsplus_module_4.WS.Reconnect))(tsplus_module_1.get(ref));
|
|
19
|
-
export const fromRaw = (source, seqRef) => tsplus_module_13.unwrap(tsplus_module_3.map((ackedRef) => {
|
|
20
|
-
const heartbeats = tsplus_module_10.mapEffect(() => maybeSend(ackedRef, seqRef))(tsplus_module_9.switchMap((p) => tsplus_module_6.fromSchedule(tsplus_module_5.andThen(tsplus_module_5.spaced(millis(p.d.heartbeat_interval)))(tsplus_module_5.duration(millis(p.d.heartbeat_interval * Math.random())))))(tsplus_module_8.tap(() => tsplus_module_1.set(true)(ackedRef))(Utils.opCode(source)(tsplus_module_7.Discord.GatewayOpcode.HELLO))));
|
|
21
|
-
const acks = tsplus_module_11.drain(tsplus_module_8.tap(() => tsplus_module_1.set(true)(ackedRef))(Utils.opCode(source)(tsplus_module_7.Discord.GatewayOpcode.HEARTBEAT_ACK)));
|
|
22
|
-
return tsplus_module_12.merge(acks)(heartbeats);
|
|
23
|
-
})(tsplus_module_1.make(true)));
|
|
24
|
-
//# 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,sBAAsB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,MAAM,IAAI,GAAG,CAAC,GAAiB,EAAE,MAA0B,EAAE,EAAE,CAC7D,oBAEO,GAAG,EAAE,CAAC,oBAAQ,KAAK,EAAb,GAAG,CAAW,EAF3B,oBACO,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,2BAAC,CAAC,EAAW,sBAD/C,MAAM,EAC0C,CACpB,CAAA;AAE9B,MAAM,SAAS,GAAG,CAAC,GAAiB,EAAE,MAA0B,EAAE,EAAE,CAClE,wBACE,CAAC,KAAK,EAAqC,EAAE,CAC3C,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,wBAAe,gBAAA,EAAE,CAAC,SAAS,CAAC,sBAF5D,GAAG,EAGF,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAAkD,EAClD,MAA0B,EAC1B,EAAE,yBACF,oBAAmB,CAAC,QAAQ,EAAE,EAAE;IAC9B,MAAM,UAAU,GAAG,2BAWN,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,EAX3B,0BAIN,CAAC,CAAC,EAAE,EAAE,CACf,6BACE,wBAEU,uBAAgB,MAAM,CAAC,CAAC,CAAC,CAAE,CAAC,kBAAkB,CAAC,CAAC,EAF1D,yBACE,MAAM,CAAC,CAAC,CAAC,CAAE,CAAC,kBAAkB,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAChD,CAA0D,CAC5D,EATc,oBAGZ,GAAG,EAAE,CAAC,oBAAa,IAAI,EAAjB,QAAQ,CAAU,EAHZ,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CACrC,gBAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAC5B,CAC+B,CAO7B,CAC4C,CAAA;IAE/C,MAAM,IAAI,0BAAG,oBACX,GAAG,EAAE,CAAC,oBAAa,IAAI,EAAjB,QAAQ,CAAU,EADb,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,gBAAA,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAErE,CAAM,CAAA;IAEP,OAAO,uBAAiB,IAAI,EAArB,UAAU,CAAY,CAAA;AAC/B,CAAC,EAnBD,qBAAS,IAAI,CAAC,CAmBZ,CAAO,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Discord, Ref, Maybe, EffectSource } 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 fromRaw: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, { latestReady, latestSequence, ...opts }: Options & Requirements) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>;
|
|
13
|
-
//# sourceMappingURL=identify.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/identify.ts"],"names":[],"mappings":";AAIA,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAA;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;IAC3C,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;CACnC;AAwCD,eAAO,MAAM,OAAO,gKAEwB,OAAO,GAAG,YAAY,wGAI/D,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "@fp-ts/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 tsplus_module_4 from "dfx/common";
|
|
5
|
-
import * as tsplus_module_5 from "callbag-effect-ts/Source/mapEffect";
|
|
6
|
-
import * as SendEvents from "./sendEvents.js";
|
|
7
|
-
import * as OS from "os";
|
|
8
|
-
import { opCode } from "./utils.js";
|
|
9
|
-
const identify = ({ token, intents, shard, presence }) => SendEvents.identify({
|
|
10
|
-
token,
|
|
11
|
-
intents,
|
|
12
|
-
properties: {
|
|
13
|
-
os: OS.platform(),
|
|
14
|
-
browser: "dfx",
|
|
15
|
-
device: "dfx",
|
|
16
|
-
},
|
|
17
|
-
shard,
|
|
18
|
-
presence,
|
|
19
|
-
});
|
|
20
|
-
const resume = (token, ready, seq) => SendEvents.resume({
|
|
21
|
-
token,
|
|
22
|
-
session_id: ready.session_id,
|
|
23
|
-
seq,
|
|
24
|
-
});
|
|
25
|
-
const identifyOrResume = (opts, ready, seq) => tsplus_module_3.flatMap(readyEvent => tsplus_module_3.map(seqNumber => tsplus_module_1.match(() => identify(opts), ({ readyEvent, seqNumber }) => resume(opts.token, readyEvent, seqNumber))(tsplus_module_1.struct({
|
|
26
|
-
readyEvent,
|
|
27
|
-
seqNumber,
|
|
28
|
-
})))(tsplus_module_2.get(seq)))(tsplus_module_2.get(ready));
|
|
29
|
-
export const fromRaw = (source, { latestReady, latestSequence, ...opts }) => tsplus_module_5.mapEffect(() => identifyOrResume(opts, latestReady, latestSequence))(opCode(source)(tsplus_module_4.Discord.GatewayOpcode.HELLO));
|
|
30
|
-
//# 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,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAcnC,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,gBAAgB,GAAG,CACvB,IAAa,EACb,KAAqC,EACrC,GAAuB,EACvB,EAAE,yBAEM,UAAU,wBACV,SAAS,IAER,sBAIL,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,EALnE,uBAAa;IAClB,UAAU;IACV,SAAS;CACV,CAAC,CAGD,sBARmB,GAAG,wBADF,KAAK,EAU1B,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAAkD,EAClD,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI,EAA0B,EAChE,EAAE,CACF,0BACE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,EAD3D,MAAM,CAAC,MAAM,CAAC,CAAqB,gBAAA,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAE9D,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DWS } from "dfx/common-gateway";
|
|
2
|
-
import { Discord } from "dfx/common";
|
|
3
|
-
export declare const make: (shard: [id: number, count: number]) => import("../../common.js").Effect<import("../../DiscordConfig/index.js").DiscordConfig | import("../../Log/index.js").Log | import("../../RateLimitStore/index.js").RateLimiter | import("../DiscordWS/index.js").DiscordWSCodec, never, {
|
|
4
|
-
run: import("../../common.js").Effect<never, never, readonly [readonly [readonly [readonly [void, void], void], void], void]>;
|
|
5
|
-
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
6
|
-
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
7
|
-
send: (p: Discord.GatewayPayload) => void;
|
|
8
|
-
reconnect: () => void;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":";;AAKA,eAAO,MAAM,IAAI,UAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;;;;cAiFvC,QAAQ,cAAc;;EAGlC,CAAA"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
-
import * as tsplus_module_2 from "dfx/common-gateway";
|
|
3
|
-
import * as tsplus_module_3 from "callbag-effect-ts/Source/forEach";
|
|
4
|
-
import * as tsplus_module_4 from "dfx/common";
|
|
5
|
-
import * as tsplus_module_5 from "callbag-effect-ts/Source/filter";
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/tap";
|
|
7
|
-
import * as tsplus_module_7 from "callbag-effect-ts/Source/run";
|
|
8
|
-
import * as tsplus_module_8 from "@fp-ts/data/Option";
|
|
9
|
-
import * as tsplus_module_9 from "callbag-effect-ts/Source/share";
|
|
10
|
-
import * as tsplus_module_10 from "@fp-ts/data/Duration";
|
|
11
|
-
import * as tsplus_module_11 from "callbag-effect-ts/Source/async";
|
|
12
|
-
import * as Heartbeats from "./heartbeats.js";
|
|
13
|
-
import * as Identify from "./identify.js";
|
|
14
|
-
import * as InvalidSession from "./invalidSession.js";
|
|
15
|
-
import * as Utils from "./utils.js";
|
|
16
|
-
export const make = (shard) => tsplus_module_1.flatMap(({ token, gateway }) => tsplus_module_1.flatMap(socket => {
|
|
17
|
-
const [emit, outgoing] = tsplus_module_11.asyncEmitter();
|
|
18
|
-
return tsplus_module_1.flatMap(limiter => {
|
|
19
|
-
const sendEffect = tsplus_module_7.run(tsplus_module_6.tap(() => limiter.maybeWait("shard.send", tsplus_module_10.minutes(1), 120))(outgoing), socket.sink);
|
|
20
|
-
return tsplus_module_1.flatMap(raw => {
|
|
21
|
-
const sendMessage = (a) => tsplus_module_1.sync(() => {
|
|
22
|
-
emit.data(a);
|
|
23
|
-
});
|
|
24
|
-
return tsplus_module_1.flatMap(([latestReady, updateLatestReady]) => tsplus_module_1.map(([latestSequence, updateLatestSequence]) => {
|
|
25
|
-
const maybeUpdateUrl = (p) => tsplus_module_8.match(() => tsplus_module_1.unit(), (a) => socket.setUrl(a.resume_gateway_url))(tsplus_module_8.map((p) => p.d)(tsplus_module_8.filter((p) => p.op === tsplus_module_4.Discord.GatewayOpcode.DISPATCH && p.t === "READY")(tsplus_module_8.some(p))));
|
|
26
|
-
const updateRefs = tsplus_module_7.runDrain(tsplus_module_6.tap(maybeUpdateUrl)(tsplus_module_6.tap(updateLatestSequence)(tsplus_module_6.tap(updateLatestReady)(raw))));
|
|
27
|
-
// heartbeats
|
|
28
|
-
const heartbeatEffects = tsplus_module_3.forEach(sendMessage)(Heartbeats.fromRaw(raw, latestSequence));
|
|
29
|
-
const dispatch = tsplus_module_5.filter((p) => p.op === tsplus_module_4.Discord.GatewayOpcode.DISPATCH)(raw);
|
|
30
|
-
// identify
|
|
31
|
-
const identifyEffects = tsplus_module_3.forEach(sendMessage)(Identify.fromRaw(raw, {
|
|
32
|
-
token,
|
|
33
|
-
shard,
|
|
34
|
-
intents: gateway.intents,
|
|
35
|
-
presence: gateway.presence,
|
|
36
|
-
latestSequence,
|
|
37
|
-
latestReady,
|
|
38
|
-
}));
|
|
39
|
-
// invalid session
|
|
40
|
-
const invalidEffects = tsplus_module_3.forEach(sendMessage)(InvalidSession.fromRaw(raw, latestReady));
|
|
41
|
-
return {
|
|
42
|
-
run: tsplus_module_1.zipPar(sendEffect)(tsplus_module_1.zipPar(invalidEffects)(tsplus_module_1.zipPar(identifyEffects)(tsplus_module_1.zipPar(heartbeatEffects)(updateRefs)))),
|
|
43
|
-
raw,
|
|
44
|
-
dispatch,
|
|
45
|
-
send: (p) => emit.data(p),
|
|
46
|
-
reconnect: () => emit.data(tsplus_module_2.WS.Reconnect),
|
|
47
|
-
};
|
|
48
|
-
})(Utils.latest((p) => tsplus_module_8.fromNullable(p.s))))(Utils.latest((p) => tsplus_module_8.map((p) => p.d)(tsplus_module_8.filter((p) => p.op === tsplus_module_4.Discord.GatewayOpcode.DISPATCH && p.t === "READY")(tsplus_module_8.some(p)))));
|
|
49
|
-
})(tsplus_module_9.share(socket.source));
|
|
50
|
-
})(tsplus_module_1.service(tsplus_module_4.RateLimitStore.RateLimiter));
|
|
51
|
-
})(tsplus_module_2.DWS.make()))(tsplus_module_1.service(tsplus_module_4.Config.DiscordConfig));
|
|
52
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { EffectSource, Discord, Ref, Maybe } from "dfx/common";
|
|
2
|
-
import { DWS } from "dfx/common-gateway";
|
|
3
|
-
export declare const fromRaw: <R, E>(raw: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, latestReady: Ref<Maybe<Discord.ReadyEvent>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
|
|
4
|
-
//# sourceMappingURL=invalidSession.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invalidSession.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":";;AAEA,eAAO,MAAM,OAAO,gIAEL,IAAI,MAAM,QAAQ,UAAU,CAAC,CAAC,mGAMJ,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "dfx/common-gateway";
|
|
2
|
-
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
|
-
import * as tsplus_module_3 from "@fp-ts/data/Option";
|
|
4
|
-
import * as tsplus_module_4 from "@effect/io/Ref";
|
|
5
|
-
import * as tsplus_module_5 from "dfx/common";
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/tap";
|
|
7
|
-
import * as tsplus_module_7 from "callbag-effect-ts/Source/map";
|
|
8
|
-
import { opCode } from "./utils.js";
|
|
9
|
-
export const fromRaw = (raw, latestReady) => tsplus_module_7.map(() => tsplus_module_1.WS.Reconnect)(tsplus_module_6.tap((p) => (p.d ? tsplus_module_2.unit() : tsplus_module_4.set(tsplus_module_3.none)(latestReady)))(opCode(raw)(tsplus_module_5.Discord.GatewayOpcode.INVALID_SESSION)));
|
|
10
|
-
//# sourceMappingURL=invalidSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invalidSession.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/invalidSession.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,GAA+C,EAC/C,WAA2C,EAC3C,EAAE,CACF,oBAIO,GAAgB,EAAE,CAAC,gBAAA,EAAE,CAAC,SAAS,EAJtC,oBAGO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAa,CAAC,CAAC,CAAC,0CAAA,WAAW,CAAgB,CAAC,EAHjE,MAAM,CAAC,GAAG,CAAC,CACT,gBAAA,OAAO,CAAC,aAAa,CAAC,eAAe,CACtC,CACiE,CAC3B,CAAA"}
|
|
@@ -1,8 +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;
|
|
8
|
-
//# sourceMappingURL=sendEvents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sendEvents.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/sendEvents.ts"],"names":[],"mappings":";AAAA,eAAO,MAAM,SAAS,MAAO,QAAQ,SAAS,KAAG,QAAQ,cAGvD,CAAA;AAEF,eAAO,MAAM,QAAQ,MAAO,QAAQ,QAAQ,KAAG,QAAQ,cAGrD,CAAA;AAEF,eAAO,MAAM,MAAM,MAAO,QAAQ,MAAM,KAAG,QAAQ,cAGjD,CAAA;AAEF,eAAO,MAAM,mBAAmB,MAC3B,QAAQ,kBAAkB,KAC5B,QAAQ,cAGT,CAAA;AAEF,eAAO,MAAM,gBAAgB,MACxB,QAAQ,gBAAgB,KAC1B,QAAQ,cAGT,CAAA;AAEF,eAAO,MAAM,cAAc,MACtB,QAAQ,cAAc,KACxB,QAAQ,cAGT,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "dfx/common";
|
|
2
|
-
export const heartbeat = (d) => ({
|
|
3
|
-
op: tsplus_module_1.Discord.GatewayOpcode.HEARTBEAT,
|
|
4
|
-
d,
|
|
5
|
-
});
|
|
6
|
-
export const identify = (d) => ({
|
|
7
|
-
op: tsplus_module_1.Discord.GatewayOpcode.IDENTIFY,
|
|
8
|
-
d,
|
|
9
|
-
});
|
|
10
|
-
export const resume = (d) => ({
|
|
11
|
-
op: tsplus_module_1.Discord.GatewayOpcode.RESUME,
|
|
12
|
-
d,
|
|
13
|
-
});
|
|
14
|
-
export const requestGuildMembers = (d) => ({
|
|
15
|
-
op: tsplus_module_1.Discord.GatewayOpcode.REQUEST_GUILD_MEMBERS,
|
|
16
|
-
d,
|
|
17
|
-
});
|
|
18
|
-
export const voiceStateUpdate = (d) => ({
|
|
19
|
-
op: tsplus_module_1.Discord.GatewayOpcode.VOICE_STATE_UPDATE,
|
|
20
|
-
d,
|
|
21
|
-
});
|
|
22
|
-
export const presenceUpdate = (d) => ({
|
|
23
|
-
op: tsplus_module_1.Discord.GatewayOpcode.PRESENCE_UPDATE,
|
|
24
|
-
d,
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=sendEvents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sendEvents.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/sendEvents.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAoB,EAA0B,EAAE,CAAC,CAAC;IAC1E,EAAE,EAAE,gBAAA,OAAO,CAAC,aAAa,CAAC,SAAS;IACnC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAmB,EAA0B,EAAE,CAAC,CAAC;IACxE,EAAE,EAAE,gBAAA,OAAO,CAAC,aAAa,CAAC,QAAQ;IAClC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAiB,EAA0B,EAAE,CAAC,CAAC;IACpE,EAAE,EAAE,gBAAA,OAAO,CAAC,aAAa,CAAC,MAAM;IAChC,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,CAA6B,EACL,EAAE,CAAC,CAAC;IAC5B,EAAE,EAAE,gBAAA,OAAO,CAAC,aAAa,CAAC,qBAAqB;IAC/C,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,CAA2B,EACH,EAAE,CAAC,CAAC;IAC5B,EAAE,EAAE,gBAAA,OAAO,CAAC,aAAa,CAAC,kBAAkB;IAC5C,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,CAAyB,EACD,EAAE,CAAC,CAAC;IAC5B,EAAE,EAAE,gBAAA,OAAO,CAAC,aAAa,CAAC,eAAe;IACzC,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { EffectSource, Discord, Maybe, Ref } from "dfx/common";
|
|
2
|
-
export declare const opCode: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>) => <T = any>(code: Discord.GatewayOpcode) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<T>>;
|
|
3
|
-
export declare const latest: <T>(f: (p: Discord.GatewayPayload) => import("../../common.js").Maybe<T>) => import("../../common.js").Effect<never, never, readonly [import("../../common.js").Ref<import("../../common.js").Maybe<T>>, (p: import("../../types.js").GatewayPayload<any>) => import("../../common.js").Effect<never, never, void>]>;
|
|
4
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/utils.ts"],"names":[],"mappings":";AAAA,eAAO,MAAM,MAAM,yIAED,QAAQ,aAAa,sGACgC,CAAA;AAOvE,eAAO,MAAM,MAAM,aAAc,QAAQ,cAAc,mRAGpD,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "callbag-effect-ts/Source/filter";
|
|
2
|
-
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
|
-
import * as tsplus_module_3 from "@fp-ts/data/Option";
|
|
4
|
-
import * as tsplus_module_4 from "@effect/io/Ref";
|
|
5
|
-
import * as tsplus_module_5 from "@fp-ts/data/Function";
|
|
6
|
-
export const opCode = (source) => (code) => tsplus_module_1.filter((p) => p.op === code)(source);
|
|
7
|
-
const maybeUpdateRef = (f, ref) => tsplus_module_5.flow(f, (o) => tsplus_module_3.match(tsplus_module_2.unit, (a) => tsplus_module_4.set(tsplus_module_3.some(a))(ref))(o));
|
|
8
|
-
export const latest = (f) => tsplus_module_2.map((ref) => [ref, maybeUpdateRef(f, ref)])(tsplus_module_4.make(tsplus_module_3.none));
|
|
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,MAAkD,EAAE,EAAE,CAC7D,CAAU,IAA2B,EAAE,EAAE,CACvC,uBAAc,CAAC,CAAC,EAAkC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAlE,MAAM,CAA6D,CAAA;AAEvE,MAAM,cAAc,GAAG,CACrB,CAA0C,EAC1C,GAAkB,EAClB,EAAE,CAAC,gBAAA,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,4CAAqB,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAQ,qBAAW,CAAC,CAAC,EAArB,GAAG,CAAmB,EAAlD,CAAC,CAAkD,CAAC,CAAA;AAExE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,CAA0C,EAAE,EAAE,CACtE,oBACE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAU,EADjD,0CAA8B,CAE7B,CAAA"}
|
|
@@ -1,13 +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("../../common.js").Tag<ShardStore>;
|
|
12
|
-
export declare const LiveMemoryShardStore: import("../../common.js").Layer<never, never, ShardStore>;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/ShardStore/index.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;IACrE,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IACjE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;CAC5D;AACD,eAAO,MAAM,UAAU,2CAAoB,CAAA;AAsB3C,eAAO,MAAM,oBAAoB,2DAAsC,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "dfx/common";
|
|
2
|
-
import * as tsplus_module_2 from "@fp-ts/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=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/ShardStore/index.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,4BAAiB;aAClB;YAED,MAAM,EAAE,GAAG,SAAS,CAAA;YACpB,SAAS,EAAE,CAAA;YACX,OAAO,qBAAW,EAAE,CAAC,CAAA;QACvB,CAAC,CAAC;QAEJ,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,qBAAY,GAAG,EAAE,CAAC,SAAS,IAAI,UAAU,CAAC;KACvE,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAW,UAAU,CAAC,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Effect, Maybe, EffectSource, Discord } from "dfx/common";
|
|
2
|
-
import { ShardStore } from "../ShardStore/index.js";
|
|
3
|
-
export declare const spawn: import("callbag-effect-ts/Source").EffectSource<ShardStore | import("../../index.js").DiscordREST | import("../../DiscordConfig/index.js").DiscordConfig | import("../../Log/index.js").Log | import("../../RateLimitStore/index.js").RateLimiter | import("../DiscordWS/index.js").DiscordWSCodec, never, {
|
|
4
|
-
run: import("../../common.js").Effect<never, never, readonly [readonly [readonly [readonly [void, void], void], void], void]>;
|
|
5
|
-
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
6
|
-
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
7
|
-
send: (p: import("../../types.js").GatewayPayload<any>) => void;
|
|
8
|
-
reconnect: () => void;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DiscordGateway/Sharder/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AA0FnD,eAAO,MAAM,KAAK;;;;;;EAEjB,CAAA"}
|