dfx 0.15.5 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DiscordGateway/DiscordWS/index.d.ts +3 -2
- package/DiscordGateway/DiscordWS/index.js +19 -18
- package/DiscordGateway/DiscordWS/index.js.map +1 -1
- package/DiscordGateway/Shard/index.d.ts +3 -3
- package/DiscordGateway/Shard/index.js +40 -45
- package/DiscordGateway/Shard/index.js.map +1 -1
- package/DiscordGateway/Sharder/index.d.ts +3 -3
- package/DiscordGateway/WS/index.d.ts +2 -4
- package/DiscordGateway/WS/index.js +17 -20
- package/DiscordGateway/WS/index.js.map +1 -1
- package/DiscordGateway/index.d.ts +4 -4
- package/DiscordREST/index.d.ts +2 -2
- package/Interactions/context.d.ts +1 -5
- package/Interactions/context.js +1 -5
- package/Interactions/context.js.map +1 -1
- package/Interactions/definitions.d.ts +10 -14
- package/Interactions/definitions.js.map +1 -1
- package/Interactions/handlers.js +0 -3
- package/Interactions/handlers.js.map +1 -1
- package/gateway.d.ts +2 -2
- package/global.d.ts +5 -0
- package/global.js.map +1 -1
- package/package.json +3 -3
- package/webhooks.d.ts +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="ws" />
|
|
3
3
|
import { Discord } from "dfx";
|
|
4
4
|
import { WS } from "dfx/gateway";
|
|
5
|
+
import { Effect } from "@effect/io/Effect";
|
|
5
6
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
6
7
|
import WebSocket from "isomorphic-ws";
|
|
7
8
|
export type Message = Discord.GatewayPayload | WS.Reconnect;
|
|
@@ -9,6 +10,7 @@ export interface OpenOpts {
|
|
|
9
10
|
url?: string;
|
|
10
11
|
version?: number;
|
|
11
12
|
encoding?: DiscordWSCodec;
|
|
13
|
+
outbound: Effect<never, never, Message>;
|
|
12
14
|
}
|
|
13
15
|
export interface DiscordWSCodec {
|
|
14
16
|
type: "json" | "etf";
|
|
@@ -17,8 +19,7 @@ export interface DiscordWSCodec {
|
|
|
17
19
|
}
|
|
18
20
|
export declare const DiscordWSCodec: import("../../global.js").Tag<DiscordWSCodec>;
|
|
19
21
|
export declare const LiveJsonDiscordWSCodec: import("../../global.js").Layer<never, never, DiscordWSCodec>;
|
|
20
|
-
export declare const make: ({ url, version, }
|
|
22
|
+
export declare const make: ({ url, version, outbound, }: OpenOpts) => import("../../global.js").Effect<import("../../Log/index.js").Log | DiscordWSCodec, never, {
|
|
21
23
|
source: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
22
|
-
sink: import("callbag-effect-ts/Sink").EffectSink<never, never, never, Message>;
|
|
23
24
|
setUrl: (url: string) => import("../../global.js").Effect<never, never, void>;
|
|
24
25
|
}>;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@fp-ts/data/Context";
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Layer";
|
|
3
|
-
import * as tsplus_module_3 from "
|
|
4
|
-
import * as tsplus_module_4 from "
|
|
5
|
-
import * as tsplus_module_5 from "
|
|
6
|
-
import * as tsplus_module_6 from "
|
|
7
|
-
import * as tsplus_module_7 from "callbag-effect-ts/Source/
|
|
8
|
-
import * as tsplus_module_8 from "
|
|
9
|
-
import * as tsplus_module_9 from "
|
|
10
|
-
import * as tsplus_module_10 from "dfx";
|
|
11
|
-
import * as tsplus_module_11 from "@effect/io/
|
|
12
|
-
import * as tsplus_module_12 from "@effect/io/Ref";
|
|
3
|
+
import * as tsplus_module_3 from "@fp-ts/data/Duration";
|
|
4
|
+
import * as tsplus_module_4 from "@effect/io/Schedule";
|
|
5
|
+
import * as tsplus_module_5 from "callbag-effect-ts/Source/tapError";
|
|
6
|
+
import * as tsplus_module_6 from "callbag-effect-ts/Source/retry";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/map";
|
|
8
|
+
import * as tsplus_module_8 from "dfx";
|
|
9
|
+
import * as tsplus_module_9 from "@effect/io/Effect";
|
|
10
|
+
import * as tsplus_module_10 from "dfx/gateway";
|
|
11
|
+
import * as tsplus_module_11 from "@effect/io/Ref";
|
|
13
12
|
export const DiscordWSCodec = tsplus_module_1.Tag();
|
|
14
13
|
export const LiveJsonDiscordWSCodec = tsplus_module_2.succeed(DiscordWSCodec)({
|
|
15
14
|
type: "json",
|
|
16
15
|
encode: (p) => JSON.stringify(p),
|
|
17
16
|
decode: (p) => JSON.parse(p.toString("utf8")),
|
|
18
17
|
});
|
|
19
|
-
export const make = ({ url = "wss://gateway.discord.gg/", version = 10,
|
|
20
|
-
const setUrl = (url) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
return { source,
|
|
25
|
-
})(
|
|
26
|
-
|
|
18
|
+
export const make = ({ url = "wss://gateway.discord.gg/", version = 10, outbound, }) => tsplus_module_9.flatMap(encoding => tsplus_module_9.flatMap(urlRef => {
|
|
19
|
+
const setUrl = (url) => tsplus_module_11.set(`${url}?v=${version}&encoding=${encoding.type}`)(urlRef);
|
|
20
|
+
const take = tsplus_module_9.map((a) => a === tsplus_module_10.WS.Reconnect ? a : encoding.encode(a))(outbound);
|
|
21
|
+
return tsplus_module_9.flatMap(ws => tsplus_module_9.map(log => {
|
|
22
|
+
const source = tsplus_module_7.map(encoding.decode)(tsplus_module_6.retry(tsplus_module_4.exponential(tsplus_module_3.seconds(0.5)))(tsplus_module_5.tapError((e) => log.info("DiscordWS", "ERROR", e))(ws)));
|
|
23
|
+
return { source, setUrl };
|
|
24
|
+
})(tsplus_module_9.service(tsplus_module_8.Log.Log)))(tsplus_module_10.WS.make(urlRef, take, {
|
|
25
|
+
perMessageDeflate: false,
|
|
26
|
+
}));
|
|
27
|
+
})(tsplus_module_11.make(`${url}?v=${version}&encoding=${encoding.type}`)))(tsplus_module_9.service(DiscordWSCodec));
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/DiscordWS/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAgBA,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,EACZ,QAAQ,GACC,EAAE,EAAE,yBAEL,QAAQ,4BACR,MAAM;IACZ,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,qBAAW,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,EAA1D,MAAM,CAAqD,CAAA;IAC7D,MAAM,IAAI,GAAG,oBAAa,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,KAAK,iBAAA,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EADhC,QAAQ,CAEpB,CAAA;mCACK,EAAE,wBAMF,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,CACyC,CACL,CAKpD,CAAA;QAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;OAVX,wBAAe,gBAAA,GAAG,CAAC,GAAG,CAAC,GALnC,iBAAA,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE;QACpB,iBAAiB,EAAE,KAAK;KACzB,CAAC;GATa,sBAAS,GAAG,GAAG,MAAM,OAAO,aAAa,QAAQ,CAAC,IAAI,EAAE,CAAC,GADvD,wBAAe,cAAc,CAAC,CAwBjD,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DiscordWS } from "dfx/gateway";
|
|
2
2
|
import { Discord } from "dfx";
|
|
3
|
-
export declare const make: (shard: [id: number, count: number]) => import("../../global.js").Effect<import("../../Log/index.js").Log | import("../DiscordWS/index.js").DiscordWSCodec | import("../../
|
|
3
|
+
export declare const make: (shard: [id: number, count: number]) => import("../../global.js").Effect<import("../../Log/index.js").Log | import("../DiscordWS/index.js").DiscordWSCodec | import("../../RateLimitStore/index.js").RateLimiter | import("../../DiscordConfig/index.js").DiscordConfig, never, {
|
|
4
4
|
run: import("../../global.js").Effect<never, never, void>;
|
|
5
5
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
6
6
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
7
|
-
send: (p: Discord.GatewayPayload) =>
|
|
8
|
-
reconnect: ()
|
|
7
|
+
send: (p: Discord.GatewayPayload) => import("../../global.js").Effect<never, never, boolean>;
|
|
8
|
+
reconnect: import("../../global.js").Effect<never, never, boolean>;
|
|
9
9
|
}>;
|
|
@@ -1,52 +1,47 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
2
|
import * as tsplus_module_2 from "dfx/gateway";
|
|
3
|
-
import * as tsplus_module_3 from "
|
|
4
|
-
import * as tsplus_module_4 from "
|
|
5
|
-
import * as tsplus_module_5 from "
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/
|
|
7
|
-
import * as tsplus_module_7 from "callbag-effect-ts/Source/
|
|
8
|
-
import * as tsplus_module_8 from "
|
|
9
|
-
import * as tsplus_module_9 from "
|
|
10
|
-
import * as tsplus_module_10 from "
|
|
11
|
-
import * as tsplus_module_11 from "
|
|
3
|
+
import * as tsplus_module_3 from "@fp-ts/data/Duration";
|
|
4
|
+
import * as tsplus_module_4 from "callbag-effect-ts/Source/forEach";
|
|
5
|
+
import * as tsplus_module_5 from "dfx";
|
|
6
|
+
import * as tsplus_module_6 from "callbag-effect-ts/Source/filter";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/tap";
|
|
8
|
+
import * as tsplus_module_8 from "callbag-effect-ts/Source/run";
|
|
9
|
+
import * as tsplus_module_9 from "@fp-ts/data/Option";
|
|
10
|
+
import * as tsplus_module_10 from "callbag-effect-ts/Source/share";
|
|
11
|
+
import * as tsplus_module_11 from "@effect/io/Queue";
|
|
12
12
|
import * as Heartbeats from "./heartbeats.js";
|
|
13
13
|
import * as Identify from "./identify.js";
|
|
14
14
|
import * as InvalidSession from "./invalidSession.js";
|
|
15
15
|
import * as Utils from "./utils.js";
|
|
16
|
-
export const make = (shard) => tsplus_module_1.flatMap(({ token, gateway }) => tsplus_module_1.flatMap(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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.RateLimit.RateLimiter));
|
|
51
|
-
})(tsplus_module_2.DiscordWS.make()))(tsplus_module_1.service(tsplus_module_4.Config.DiscordConfig));
|
|
16
|
+
export const make = (shard) => tsplus_module_1.flatMap(({ token, gateway }) => tsplus_module_1.flatMap(limiter => tsplus_module_1.flatMap(outboundQueue => {
|
|
17
|
+
const outbound = tsplus_module_1.tap(() => limiter.maybeWait("shard.send", tsplus_module_3.minutes(1), 120))(outboundQueue
|
|
18
|
+
.take());
|
|
19
|
+
const send = (p) => outboundQueue.offer(p);
|
|
20
|
+
return tsplus_module_1.flatMap(socket => tsplus_module_1.flatMap(raw => tsplus_module_1.flatMap(([latestReady, updateLatestReady]) => tsplus_module_1.map(([latestSequence, updateLatestSequence]) => {
|
|
21
|
+
const maybeUpdateUrl = (p) => tsplus_module_9.match(() => tsplus_module_1.unit(), (a) => socket.setUrl(a.resume_gateway_url))(tsplus_module_9.map((p) => p.d)(tsplus_module_9.filter((p) => p.op === tsplus_module_5.Discord.GatewayOpcode.DISPATCH && p.t === "READY")(tsplus_module_9.some(p))));
|
|
22
|
+
const updateRefs = tsplus_module_8.runDrain(tsplus_module_7.tap(maybeUpdateUrl)(tsplus_module_7.tap(updateLatestSequence)(tsplus_module_7.tap(updateLatestReady)(raw))));
|
|
23
|
+
// heartbeats
|
|
24
|
+
const heartbeatEffects = tsplus_module_4.forEach(send)(Heartbeats.fromRaw(raw, latestSequence));
|
|
25
|
+
const dispatch = tsplus_module_6.filter((p) => p.op === tsplus_module_5.Discord.GatewayOpcode.DISPATCH)(raw);
|
|
26
|
+
// identify
|
|
27
|
+
const identifyEffects = tsplus_module_4.forEach(send)(Identify.fromRaw(raw, {
|
|
28
|
+
token,
|
|
29
|
+
shard,
|
|
30
|
+
intents: gateway.intents,
|
|
31
|
+
presence: gateway.presence,
|
|
32
|
+
latestSequence,
|
|
33
|
+
latestReady,
|
|
34
|
+
}));
|
|
35
|
+
// invalid session
|
|
36
|
+
const invalidEffects = tsplus_module_4.forEach(send)(InvalidSession.fromRaw(raw, latestReady));
|
|
37
|
+
const reconnectSoon = tsplus_module_1.delay(tsplus_module_3.seconds(15))(send(tsplus_module_2.WS.Reconnect));
|
|
38
|
+
return {
|
|
39
|
+
run: tsplus_module_1.asUnit(tsplus_module_1.zipPar(reconnectSoon)(tsplus_module_1.zipPar(invalidEffects)(tsplus_module_1.zipPar(identifyEffects)(tsplus_module_1.zipPar(heartbeatEffects)(updateRefs))))),
|
|
40
|
+
raw,
|
|
41
|
+
dispatch,
|
|
42
|
+
send: (p) => send(p),
|
|
43
|
+
reconnect: send(tsplus_module_2.WS.Reconnect),
|
|
44
|
+
};
|
|
45
|
+
})(Utils.latest((p) => tsplus_module_9.fromNullable(p.s))))(Utils.latest((p) => tsplus_module_9.map((p) => p.d)(tsplus_module_9.filter((p) => p.op === tsplus_module_5.Discord.GatewayOpcode.DISPATCH && p.t === "READY")(tsplus_module_9.some(p))))))(tsplus_module_10.share(socket.source)))(tsplus_module_2.DiscordWS.make({ outbound }));
|
|
46
|
+
})(tsplus_module_11.unbounded()))(tsplus_module_1.service(tsplus_module_5.RateLimit.RateLimiter)))(tsplus_module_1.service(tsplus_module_5.Config.DiscordConfig));
|
|
52
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/Shard/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OA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;YACR,IAAI,EAAE,CAAC,CAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAC5C,SAAS,EAAE,IAAI,CAAC,gBAAA,EAAE,CAAC,SAAS,CAAC;SAC9B,CAAA;OAxDC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,6BAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,GAV5C,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACjB,oBAKO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EALlB,uBAEI,CAAC,CAAC,EAAmD,EAAE,CACrD,CAAC,CAAC,EAAE,KAAK,gBAAA,OAAO,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAHhE,qBAAW,CAAC,CAAC,CAIV,CACgB,CACpB,0BAVW,MAAM,CAAC,MAAM,IAFV,gBAAA,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;GANrB,4BAAoC,GAF1C,wBAAe,gBAAA,SAAS,CAAC,WAAW,CAAC,GAD1B,wBAAe,gBAAA,MAAM,CAAC,aAAa,CAAC,CAiFjE,CAAA"}
|
|
@@ -2,10 +2,10 @@ import { Effect } from "@effect/io/Effect";
|
|
|
2
2
|
import { Maybe, Discord } from "dfx";
|
|
3
3
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
4
4
|
import { ShardStore } from "../ShardStore/index.js";
|
|
5
|
-
export declare const spawn: import("callbag-effect-ts/Source").EffectSource<import("../../Log/index.js").Log | import("../DiscordWS/index.js").DiscordWSCodec | import("../../
|
|
5
|
+
export declare const spawn: import("callbag-effect-ts/Source").EffectSource<import("../../Log/index.js").Log | import("../DiscordWS/index.js").DiscordWSCodec | import("../../RateLimitStore/index.js").RateLimiter | import("../../DiscordConfig/index.js").DiscordConfig | ShardStore | import("../../index.js").DiscordREST, never, {
|
|
6
6
|
run: import("../../global.js").Effect<never, never, void>;
|
|
7
7
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
|
|
8
8
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
|
|
9
|
-
send: (p: import("../../types.js").GatewayPayload<any>) =>
|
|
10
|
-
reconnect: ()
|
|
9
|
+
send: (p: import("../../types.js").GatewayPayload<any>) => import("../../global.js").Effect<never, never, boolean>;
|
|
10
|
+
reconnect: import("../../global.js").Effect<never, never, boolean>;
|
|
11
11
|
}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="ws" />
|
|
3
3
|
import { Ref } from "@effect/io/Ref";
|
|
4
|
+
import { Effect } from "@effect/io/Effect";
|
|
4
5
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
5
6
|
import WebSocket from "isomorphic-ws";
|
|
6
7
|
export declare const Reconnect: unique symbol;
|
|
@@ -22,7 +23,4 @@ export declare class WebSocketWriteError {
|
|
|
22
23
|
readonly _tag = "WebSocketWriteError";
|
|
23
24
|
constructor(reason: Error);
|
|
24
25
|
}
|
|
25
|
-
export declare const make: (url: Ref<string>, options?: WebSocket.ClientOptions) => import("../../global.js").Effect<import("../../Log/index.js").Log, never,
|
|
26
|
-
source: import("callbag-effect-ts/Source").EffectSource<never, WebSocketError | WebSocketCloseError | WebSocketWriteError, WebSocket.RawData>;
|
|
27
|
-
sink: import("callbag-effect-ts/Sink").EffectSink<never, never, never, Message>;
|
|
28
|
-
}>;
|
|
26
|
+
export declare const make: (url: Ref<string>, takeOutbound: Effect<never, never, Message>, options?: WebSocket.ClientOptions) => import("../../global.js").Effect<import("../../Log/index.js").Log, never, import("callbag-effect-ts/Source").EffectSource<never, WebSocketError | WebSocketCloseError | WebSocketWriteError, WebSocket.RawData>>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Ref";
|
|
3
3
|
import * as tsplus_module_3 from "callbag-effect-ts/Source/async";
|
|
4
|
-
import * as tsplus_module_4 from "callbag-effect-ts/Source/
|
|
5
|
-
import * as tsplus_module_5 from "callbag-effect-ts/Source/
|
|
6
|
-
import * as tsplus_module_6 from "callbag-effect-ts/Source/
|
|
7
|
-
import * as tsplus_module_7 from "
|
|
8
|
-
import * as tsplus_module_8 from "
|
|
9
|
-
import * as tsplus_module_9 from "
|
|
10
|
-
import * as tsplus_module_10 from "callbag-effect-ts/Source/
|
|
11
|
-
import * as tsplus_module_11 from "callbag-effect-ts/Source/
|
|
4
|
+
import * as tsplus_module_4 from "callbag-effect-ts/Source/repeatEffectOption";
|
|
5
|
+
import * as tsplus_module_5 from "callbag-effect-ts/Source/unwrap";
|
|
6
|
+
import * as tsplus_module_6 from "callbag-effect-ts/Source/tap";
|
|
7
|
+
import * as tsplus_module_7 from "callbag-effect-ts/Source/drain";
|
|
8
|
+
import * as tsplus_module_8 from "dfx";
|
|
9
|
+
import * as tsplus_module_9 from "@effect/io/Schedule";
|
|
10
|
+
import * as tsplus_module_10 from "callbag-effect-ts/Source/merge";
|
|
11
|
+
import * as tsplus_module_11 from "callbag-effect-ts/Source/unwrapScope";
|
|
12
|
+
import * as tsplus_module_12 from "callbag-effect-ts/Source/retry";
|
|
12
13
|
import WebSocket from "isomorphic-ws";
|
|
13
14
|
export const Reconnect = Symbol();
|
|
14
15
|
const socket = (urlRef, options) => tsplus_module_1.acquireRelease(tsplus_module_1.map(url => new WebSocket(url, options))(tsplus_module_2.get(urlRef)), (ws) => tsplus_module_1.sync(() => {
|
|
@@ -49,10 +50,10 @@ export class WebSocketWriteError {
|
|
|
49
50
|
this.reason = reason;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
const send = (ws,
|
|
53
|
+
const send = (ws, take) => tsplus_module_1.map(log => tsplus_module_7.drain(tsplus_module_6.tap((data) => tsplus_module_1.async((resume) => {
|
|
53
54
|
if (data === Reconnect) {
|
|
54
55
|
ws.close(1012, "reconnecting");
|
|
55
|
-
resume(tsplus_module_1.
|
|
56
|
+
resume(tsplus_module_1.fail(new WebSocketCloseError(1012, "reconnecting")));
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
59
|
ws.send(data, (err) => {
|
|
@@ -61,7 +62,7 @@ const send = (ws, out) => tsplus_module_1.map(log => tsplus_module_6.drain(tsplu
|
|
|
61
62
|
: tsplus_module_1.unit());
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
|
-
}))(
|
|
65
|
+
}))(tsplus_module_6.tap((p) => log.debug("WS", "send", p))(tsplus_module_5.unwrap(tsplus_module_1.map(() => tsplus_module_4.repeatEffectOption(take))(tsplus_module_1.async((resume) => {
|
|
65
66
|
if (ws.readyState & ws.OPEN) {
|
|
66
67
|
resume(tsplus_module_1.unit());
|
|
67
68
|
}
|
|
@@ -70,13 +71,9 @@ const send = (ws, out) => tsplus_module_1.map(log => tsplus_module_6.drain(tsplu
|
|
|
70
71
|
resume(tsplus_module_1.unit());
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
})))))))(tsplus_module_1.service(
|
|
74
|
-
export const make = (url, options) => (
|
|
75
|
-
const
|
|
76
|
-
return tsplus_module_1.map(
|
|
77
|
-
|
|
78
|
-
const source = tsplus_module_11.retry(tsplus_module_8.recurWhile((e) => e._tag === "WebSocketCloseError" && e.code === 1012))(tsplus_module_10.unwrapScope(tsplus_module_1.flatMap(ws => tsplus_module_1.map(sendEffect => tsplus_module_9.merge(sendEffect)(recv(ws)))(withLog(send(ws, outbound))))(socket(url, options))));
|
|
79
|
-
return { source, sink };
|
|
80
|
-
})(tsplus_module_1.service(tsplus_module_7.Log.Log));
|
|
81
|
-
})();
|
|
74
|
+
})))))))(tsplus_module_1.service(tsplus_module_8.Log.Log));
|
|
75
|
+
export const make = (url, takeOutbound, options) => tsplus_module_1.map(log => {
|
|
76
|
+
const withLog = tsplus_module_1.provideService(tsplus_module_8.Log.Log)(log);
|
|
77
|
+
return tsplus_module_12.retry(tsplus_module_9.recurWhile((e) => e._tag === "WebSocketCloseError" && e.code === 1012))(tsplus_module_11.unwrapScope(tsplus_module_1.flatMap(ws => tsplus_module_1.map(sendEffect => tsplus_module_10.merge(sendEffect)(recv(ws)))(withLog(send(ws, takeOutbound))))(socket(url, options))));
|
|
78
|
+
})(tsplus_module_1.service(tsplus_module_8.Log.Log));
|
|
82
79
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/WS/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/DiscordGateway/WS/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,EAAE,CAAA;AAIjC,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAE,OAAiC,EAAE,EAAE,CACxE,mDACQ,GAAG,IACF,IAAI,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,sBADpB,MAAM,IAEJ,CAAC,EAAE,EAAE,EAAE,CACvB,qBAAY,GAAG,EAAE;IACf,EAAE,CAAC,KAAK,EAAE,CAAA;IACV,EAAE,CAAC,kBAAkB,EAAE,CAAA;AACzB,CAAC,CAAC,CACH,CAAA;AAEH,MAAM,OAAO,cAAc;IAEJ;IADZ,IAAI,GAAG,gBAAgB,CAAA;IAChC,YAAqB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;CACzC;AAED,MAAM,OAAO,mBAAmB;IAET;IAAuB;IADnC,IAAI,GAAG,qBAAqB,CAAA;IACrC,YAAqB,IAAY,EAAW,MAAc;QAArC,SAAI,GAAJ,IAAI,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAQ;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|
|
@@ -2,13 +2,13 @@ import { EffectSource } from "callbag-effect-ts/Source";
|
|
|
2
2
|
import { Discord } from "dfx";
|
|
3
3
|
import { Effect } from "@effect/io/Effect";
|
|
4
4
|
import { Success } from "dfx/utils/effect";
|
|
5
|
-
export declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("./DiscordWS/index.js").DiscordWSCodec | import("../
|
|
5
|
+
export declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("./DiscordWS/index.js").DiscordWSCodec | import("../RateLimitStore/index.js").RateLimiter | import("../DiscordConfig/index.js").DiscordConfig | import("./ShardStore/index.js").ShardStore | import("../index.js").DiscordREST, never, {
|
|
6
6
|
shards: import("callbag-effect-ts/Source").EffectSource<never, never, {
|
|
7
7
|
run: import("../global.js").Effect<never, never, void>;
|
|
8
8
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<any>>;
|
|
9
9
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<import("../types.js").ReceiveEvent>>;
|
|
10
|
-
send: (p: import("../types.js").GatewayPayload<any>) =>
|
|
11
|
-
reconnect: ()
|
|
10
|
+
send: (p: import("../types.js").GatewayPayload<any>) => import("../global.js").Effect<never, never, boolean>;
|
|
11
|
+
reconnect: import("../global.js").Effect<never, never, boolean>;
|
|
12
12
|
}>;
|
|
13
13
|
raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<any>>;
|
|
14
14
|
dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<import("../types.js").ReceiveEvent>>;
|
|
@@ -18,5 +18,5 @@ export declare const make: import("../global.js").Effect<import("../Log/index.js
|
|
|
18
18
|
export interface DiscordGateway extends Success<typeof make> {
|
|
19
19
|
}
|
|
20
20
|
export declare const DiscordGateway: import("../global.js").Tag<DiscordGateway>;
|
|
21
|
-
export declare const LiveDiscordGateway: import("../global.js").Layer<import("../Log/index.js").Log | import("./DiscordWS/index.js").DiscordWSCodec | import("../
|
|
21
|
+
export declare const LiveDiscordGateway: import("../global.js").Layer<import("../Log/index.js").Log | import("./DiscordWS/index.js").DiscordWSCodec | import("../RateLimitStore/index.js").RateLimiter | import("../DiscordConfig/index.js").DiscordConfig | import("./ShardStore/index.js").ShardStore | import("../index.js").DiscordREST, never, DiscordGateway>;
|
|
22
22
|
export declare const handleDispatch: <K extends keyof import("../types.js").ReceiveEvents, R1, E1, A>(event: K, handle: (event: import("../types.js").ReceiveEvents[K]) => import("../global.js").Effect<R1, E1, A>) => import("../global.js").Effect<DiscordGateway | R1, E1, void>;
|
package/DiscordREST/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { Effect } from "@effect/io/Effect";
|
|
|
2
2
|
import { Http } from "dfx";
|
|
3
3
|
import { Success } from "dfx/utils/effect";
|
|
4
4
|
import { ResponseWithData } from "./types.js";
|
|
5
|
-
declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("
|
|
5
|
+
declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("dfx/RateLimitStore/index").RateLimiter | import("dfx/RateLimitStore/index").RateLimitStore | import("../DiscordConfig/index.js").DiscordConfig, never, {
|
|
6
6
|
request: <A = unknown>(path: string, init?: RequestInit) => import("../global.js").Effect<never, import("../Http/index.js").FetchError | import("../Http/index.js").StatusCodeError | import("../Http/index.js").JsonParseError, ResponseWithData<A>>;
|
|
7
7
|
}>;
|
|
8
8
|
export interface DiscordREST extends Success<typeof make> {
|
|
9
9
|
}
|
|
10
10
|
export declare const DiscordREST: import("../global.js").Tag<DiscordREST>;
|
|
11
|
-
export declare const LiveDiscordREST: import("../global.js").Layer<import("../Log/index.js").Log | import("
|
|
11
|
+
export declare const LiveDiscordREST: import("../global.js").Layer<import("../Log/index.js").Log | import("dfx/RateLimitStore/index").RateLimiter | import("dfx/RateLimitStore/index").RateLimitStore | import("../DiscordConfig/index.js").DiscordConfig, never, DiscordREST>;
|
|
12
12
|
export declare const rest: import("../types.js").Endpoints<RequestInit>;
|
|
13
13
|
export {};
|
|
@@ -36,7 +36,7 @@ export declare const handleSubCommands: <NER extends Record<string, Effect<any,
|
|
|
36
36
|
_E: (_: never) => infer E;
|
|
37
37
|
};
|
|
38
38
|
}] ? E : never), import("../types.js").InteractionResponse>;
|
|
39
|
-
export declare const
|
|
39
|
+
export declare const currentSubCommand: Effect<SubCommandContext, never, import("../types.js").ApplicationCommandInteractionDataOption>;
|
|
40
40
|
export declare const optionsMap: Effect<import("../types.js").ApplicationCommandDatum, never, Record<string, string | undefined>>;
|
|
41
41
|
export declare class RequiredOptionNotFound {
|
|
42
42
|
readonly data: Discord.ApplicationCommandDatum | Discord.ApplicationCommandInteractionDataOption;
|
|
@@ -47,8 +47,4 @@ export declare class RequiredOptionNotFound {
|
|
|
47
47
|
export declare const findOption: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>>;
|
|
48
48
|
export declare const optionValue: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, RequiredOptionNotFound, string>;
|
|
49
49
|
export declare const optionValueOptional: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../index.js").Maybe<string>>;
|
|
50
|
-
export declare const subCommandOptionsMap: Effect<SubCommandContext, never, Record<string, string | undefined>>;
|
|
51
|
-
export declare const findSubCommandOption: (name: string) => Effect<SubCommandContext, never, import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>>;
|
|
52
|
-
export declare const subCommandOptionValue: (name: string) => Effect<SubCommandContext, RequiredOptionNotFound, string>;
|
|
53
|
-
export declare const subCommandOptionValueOptional: (name: string) => Effect<SubCommandContext, RequiredOptionNotFound, string>;
|
|
54
50
|
export declare const modalValues: Effect<import("../types.js").ModalSubmitDatum, never, Record<string, string | undefined>>;
|
package/Interactions/context.js
CHANGED
|
@@ -32,7 +32,7 @@ export class SubCommandNotFound {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
export const handleSubCommands = (commands) => tsplus_module_2.flatMap((data) => tsplus_module_4.pipe(IxHelpers.allSubCommands(data), Arr.findFirst((a) => !!commands[a.name]), (o) => tsplus_module_3.toEither(() => new SubCommandNotFound(data))(o), tsplus_module_2.fromEither, (a) => tsplus_module_2.flatMap((command) => tsplus_module_4.pipe(commands[command.name], tsplus_module_2.provideService(SubCommandContext)({ command })))(a)))(tsplus_module_2.service(ApplicationCommandContext));
|
|
35
|
-
export const
|
|
35
|
+
export const currentSubCommand = tsplus_module_2.serviceWith(SubCommandContext)((a) => a.command);
|
|
36
36
|
export const optionsMap = tsplus_module_2.serviceWith(ApplicationCommandContext)(IxHelpers.optionsMap);
|
|
37
37
|
export class RequiredOptionNotFound {
|
|
38
38
|
data;
|
|
@@ -46,9 +46,5 @@ export class RequiredOptionNotFound {
|
|
|
46
46
|
export const findOption = (name) => tsplus_module_2.serviceWith(ApplicationCommandContext)(IxHelpers.getOption(name));
|
|
47
47
|
export const optionValue = (name) => tsplus_module_2.flatMap((o) => tsplus_module_3.match(() => tsplus_module_2.flatMap((data) => tsplus_module_2.fail(new RequiredOptionNotFound(data, name)))(getCommand), tsplus_module_2.succeed)(tsplus_module_3.flatMapNullable((a) => a.value)(o)))(findOption(name));
|
|
48
48
|
export const optionValueOptional = (name) => tsplus_module_2.map((o) => tsplus_module_3.flatMapNullable((a) => a.value)(o))(findOption(name));
|
|
49
|
-
export const subCommandOptionsMap = tsplus_module_2.map(IxHelpers.optionsMap)(getSubCommand);
|
|
50
|
-
export const findSubCommandOption = (name) => tsplus_module_2.serviceWith(SubCommandContext)(({ command }) => IxHelpers.getOption(name)(command));
|
|
51
|
-
export const subCommandOptionValue = (name) => tsplus_module_2.flatMap((o) => tsplus_module_3.match(() => tsplus_module_2.flatMap((data) => tsplus_module_2.fail(new RequiredOptionNotFound(data, name)))(getSubCommand), tsplus_module_2.succeed)(tsplus_module_3.flatMapNullable((a) => a.value)(o)))(findSubCommandOption(name));
|
|
52
|
-
export const subCommandOptionValueOptional = (name) => tsplus_module_2.flatMap((o) => tsplus_module_3.match(() => tsplus_module_2.flatMap((data) => tsplus_module_2.fail(new RequiredOptionNotFound(data, name)))(getSubCommand), tsplus_module_2.succeed)(tsplus_module_3.flatMapNullable((a) => a.value)(o)))(findSubCommandOption(name));
|
|
53
49
|
export const modalValues = tsplus_module_2.serviceWith(ModalSubmitContext)(IxHelpers.componentsMap);
|
|
54
50
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/Interactions/context.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAChD,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAA;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAA,GAAG,EAAuB,CAAA;AAC5D,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAA,GAAG,EAAmC,CAAA;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAA,GAAG,EAAiC,CAAA;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAA,GAAG,EAA4B,CAAA;AAKjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAA,GAAG,EAAwB,CAAA;AAK/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAA,GAAG,EAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAe,yBAAyB,CAAC,CAAA;AAEnE,MAAM,OAAO,oBAAoB;IAEV;IAAoC;IADhD,IAAI,GAAG,sBAAsB,CAAA;IACtC,YAAqB,IAAyB,EAAW,IAAa;QAAjD,SAAI,GAAJ,IAAI,CAAqB;QAAW,SAAI,GAAJ,IAAI,CAAS;IAAG,CAAC;CAC3E;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,CAAwE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CAAC,gCAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAhC,CAAC,CAAgC,EAA7D,UAAU,CAAC,IAAI,CAAC,CAA8C,CAAA;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,4BAAmB,kBAAkB,CAAC,CAC/D,SAAS,CAAC,aAAa,CACxB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Discord, Maybe } from "dfx";
|
|
2
2
|
import { Effect, EffectTypeId } from "@effect/io/Effect";
|
|
3
|
-
import { FocusedOptionContext,
|
|
3
|
+
import { FocusedOptionContext, ResolvedDataNotFound, SubCommandContext } from "./context.js";
|
|
4
4
|
import type { F } from "ts-toolbelt";
|
|
5
5
|
type DescriptionMissing<A> = A extends {
|
|
6
6
|
type: Exclude<Discord.ApplicationCommandType, 1>;
|
|
@@ -47,11 +47,8 @@ type CommandHandler<R, E, A = any> = Effect<R, E, Discord.InteractionResponse> |
|
|
|
47
47
|
export interface CommandHelper<A> {
|
|
48
48
|
resolve: <T>(name: Resolvables<A>["name"], f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => Effect<Discord.Interaction, ResolvedDataNotFound, T>;
|
|
49
49
|
option: (name: CommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<Discord.ApplicationCommandInteractionDataOption>>;
|
|
50
|
-
optionValue: (name: RequiredCommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum,
|
|
50
|
+
optionValue: (name: RequiredCommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, string>;
|
|
51
51
|
optionValueOptional: (name: CommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<string>>;
|
|
52
|
-
subCommandOption: (name: SubCommandOptions<A>["name"]) => Effect<SubCommandContext, never, Maybe<Discord.ApplicationCommandInteractionDataOption>>;
|
|
53
|
-
subCommandOptionValue: (name: RequiredSubCommandOptions<A>["name"]) => Effect<SubCommandContext, RequiredOptionNotFound, string>;
|
|
54
|
-
subCommandOptionValueOptional: (name: SubCommandOptions<A>["name"]) => Effect<SubCommandContext, never, Maybe<string>>;
|
|
55
52
|
subCommands: <NER extends SubCommands<A> extends never ? never : Record<SubCommands<A>["name"], Effect<any, any, Discord.InteractionResponse>>>(commands: NER) => Effect<Exclude<[
|
|
56
53
|
NER[keyof NER]
|
|
57
54
|
] extends [
|
|
@@ -60,13 +57,13 @@ export interface CommandHelper<A> {
|
|
|
60
57
|
_R: (_: never) => infer R;
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
|
-
] ? R : never, SubCommandContext> | Discord.Interaction | Discord.ApplicationCommandDatum,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
] ? E : never
|
|
60
|
+
] ? R : never, SubCommandContext> | Discord.Interaction | Discord.ApplicationCommandDatum, [
|
|
61
|
+
NER[keyof NER]
|
|
62
|
+
] extends [{
|
|
63
|
+
[EffectTypeId]: {
|
|
64
|
+
_E: (_: never) => infer E;
|
|
65
|
+
};
|
|
66
|
+
}] ? E : never, Discord.InteractionResponse>;
|
|
70
67
|
}
|
|
71
68
|
type CommandHandlerFn<R, E, A> = (i: CommandHelper<A>) => Effect<R, E, Discord.InteractionResponse>;
|
|
72
69
|
type ExtractOptions<A, T> = A extends {
|
|
@@ -83,11 +80,10 @@ type RequiredOptions<A, T> = A extends {
|
|
|
83
80
|
required: true;
|
|
84
81
|
}> : never;
|
|
85
82
|
type CommandOptions<A> = ExtractOptions<A, Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>>;
|
|
86
|
-
type RequiredCommandOptions<A> = RequiredOptions<A, Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>>;
|
|
87
83
|
type SubCommands<A> = ExtractOptions<A, Discord.ApplicationCommandOptionType.SUB_COMMAND>;
|
|
88
|
-
type SubCommandOptions<A> = Exclude<SubCommands<A>["options"], undefined>[number];
|
|
89
84
|
type RequiredSubCommandOptions<A> = Extract<Exclude<SubCommands<A>["options"], undefined>[number], {
|
|
90
85
|
required: true;
|
|
91
86
|
}>;
|
|
87
|
+
type RequiredCommandOptions<A> = RequiredOptions<A, Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>> | RequiredSubCommandOptions<A>;
|
|
92
88
|
type Resolvables<A> = ExtractOptions<A, Discord.ApplicationCommandOptionType.ROLE | Discord.ApplicationCommandOptionType.USER | Discord.ApplicationCommandOptionType.MENTIONABLE | Discord.ApplicationCommandOptionType.CHANNEL>;
|
|
93
89
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/Interactions/definitions.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/Interactions/definitions.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAuBxD,MAAM,OAAO,wBAAwB;IAGxB;IACA;IAHF,IAAI,GAAG,0BAA0B,CAAA;IAC1C,YACW,OAAqD,EACrD,MAA4B;QAD5B,YAAO,GAAP,OAAO,CAA8C;QACrD,WAAM,GAAN,MAAM,CAAsB;IACpC,CAAC;CACL;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAKpB,OAAoB,EACpB,MAE2B,EAC3B,EAAE,CACF,IAAI,wBAAwB,CAG1B,OAAc,EAAE,MAAa,CAAC,CAAA;AAElC,MAAM,OAAO,uBAAuB;IAGvB;IACA;IAHF,IAAI,GAAG,yBAAyB,CAAA;IACzC,YACW,OA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Ctx.findOption,
|
|
19
19
|
optionValue: Ctx.optionValue,
|
|
20
20
|
optionValueOptional: Ctx.optionValueOptional,
|
|
21
|
-
subCommandOption: Ctx.findSubCommandOption,
|
|
22
|
-
subCommandOptionValue: Ctx.subCommandOptionValue,
|
|
23
|
-
subCommandOptionValueOptional: Ctx.subCommandOptionValueOptional,
|
|
24
21
|
subCommands: Ctx.handleSubCommands,
|
|
25
22
|
};
|
|
26
23
|
export const handlers = (definitions) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/Interactions/handlers.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAEnC,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,OAAO,kBAAkB;IAER;IADZ,IAAI,GAAG,oBAAoB,CAAA;IACpC,YAAqB,WAAgC;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IAAG,CAAC;CAC1D;AAQD,MAAM,OAAO,GAAyB;IACpC,OAAO,EAAE,GAAG,CAAC,WAAW;IACxB,MAAM,EAAE,GAAG,CAAC,UAAU;IACtB,WAAW,EAAE,GAAG,CAAC,WAAW;IAC5B,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;IAC5C,
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/Interactions/handlers.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAEnC,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,OAAO,kBAAkB;IAER;IADZ,IAAI,GAAG,oBAAoB,CAAA;IACpC,YAAqB,WAAgC;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IAAG,CAAC;CAC1D;AAQD,MAA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D,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/gateway.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export * as Gateway from "./DiscordGateway/index.js";
|
|
|
7
7
|
export { run as runIx } from "./Interactions/gateway.js";
|
|
8
8
|
export declare const LiveRateLimit: import("./global.js").Layer<import("./Log/index.js").Log, never, import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore>;
|
|
9
9
|
export declare const LiveREST: import("./global.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore | import("./index.js").DiscordREST>;
|
|
10
|
-
export declare const LiveGateway: import("./global.js").Layer<import("./Log/index.js").Log | import("./
|
|
10
|
+
export declare const LiveGateway: import("./global.js").Layer<import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordConfig/index.js").DiscordConfig | import("./index.js").DiscordREST, never, import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordGateway/index.js").DiscordGateway>;
|
|
11
11
|
export declare const LiveBot: import("./global.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore | import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./index.js").DiscordREST | import("./DiscordGateway/index.js").DiscordGateway>;
|
|
12
|
-
export declare const make: (config: Config.MakeOpts, debug?: boolean) => import("./global.js").Layer<never, never, import("./Log/index.js").Log | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./
|
|
12
|
+
export declare const make: (config: Config.MakeOpts, debug?: boolean) => import("./global.js").Layer<never, never, import("./Log/index.js").Log | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore | import("./DiscordConfig/index.js").DiscordConfig | import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./index.js").DiscordREST | import("./DiscordGateway/index.js").DiscordGateway>;
|
package/global.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import type { Effect } from "@effect/io/Effect";
|
|
|
6
6
|
* @tsplus global
|
|
7
7
|
*/
|
|
8
8
|
import type { Layer } from "@effect/io/Layer";
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus global
|
|
11
|
+
*/
|
|
12
|
+
import type { Dequeue, Queue } from "@effect/io/Queue";
|
|
9
13
|
/**
|
|
10
14
|
* @tsplus global
|
|
11
15
|
*/
|
|
@@ -84,6 +88,7 @@ import type { Success } from "dfx/utils/effect";
|
|
|
84
88
|
import { pipe, flow, identity } from "@fp-ts/data/Function";
|
|
85
89
|
export type { Effect } from "@effect/io/Effect";
|
|
86
90
|
export type { Layer } from "@effect/io/Layer";
|
|
91
|
+
export type {} from "@effect/io/Queue";
|
|
87
92
|
export { Context, Tag } from "@fp-ts/data/Context";
|
|
88
93
|
export type { Duration } from "@fp-ts/data/Duration";
|
|
89
94
|
export type { Ref } from "@effect/io/Ref";
|
package/global.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.js","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAW,GAAG,EAAE,MAAM,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"typescript": "https://cdn.jsdelivr.net/npm/@tsplus/installer/compiler/typescript.tgz"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"callbag-effect-ts": "1.0.0-alpha.
|
|
31
|
+
"callbag-effect-ts": "1.0.0-alpha.20",
|
|
32
32
|
"ts-toolbelt": "^9.6.0",
|
|
33
33
|
"tweetnacl": "^1.0.3"
|
|
34
34
|
},
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@fp-ts/data": "^0.0.20"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "54a64aa821495f1c1ad02ba1d270e19a7110abf5"
|
|
52
52
|
}
|
package/webhooks.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import { MakeConfigOpts } from "./Interactions/webhook.js";
|
|
|
3
3
|
export { makeConfigLayer, makeHandler, makeSimpleHandler, WebhookConfig, WebhookParseError, BadWebhookSignature, } from "./Interactions/webhook.js";
|
|
4
4
|
export declare const LiveRateLimit: import("./global.js").Layer<import("./Log/index.js").Log, never, import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore>;
|
|
5
5
|
export declare const LiveREST: import("./global.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore | import("./index.js").DiscordREST>;
|
|
6
|
-
export declare const make: (config: Config.MakeOpts & MakeConfigOpts, debug?: boolean) => import("./global.js").Layer<never, never, import("./Log/index.js").Log | import("./
|
|
6
|
+
export declare const make: (config: Config.MakeOpts & MakeConfigOpts, debug?: boolean) => import("./global.js").Layer<never, never, import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimiter | import("./RateLimitStore/index.js").RateLimitStore | import("./DiscordConfig/index.js").DiscordConfig | import("./index.js").DiscordREST | import("./Interactions/webhook.js").WebhookConfig>;
|