dfx 0.0.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/DiscordConfig/index.d.ts +29 -0
  2. package/DiscordConfig/index.js +31 -0
  3. package/DiscordConfig/index.js.map +1 -0
  4. package/DiscordConfig/index.ts +45 -0
  5. package/DiscordGateway/index.d.ts +23 -0
  6. package/DiscordGateway/index.js +25 -0
  7. package/DiscordGateway/index.js.map +1 -0
  8. package/DiscordGateway/index.ts +34 -0
  9. package/DiscordGateway/utils.d.ts +3 -0
  10. package/DiscordGateway/utils.js +12 -0
  11. package/DiscordGateway/utils.js.map +1 -0
  12. package/DiscordGateway/utils.ts +17 -0
  13. package/DiscordREST/http.d.ts +3 -0
  14. package/DiscordREST/http.js +20 -0
  15. package/DiscordREST/http.js.map +1 -0
  16. package/DiscordREST/http.ts +21 -0
  17. package/DiscordREST/index.d.ts +18 -0
  18. package/DiscordREST/index.js +67 -0
  19. package/DiscordREST/index.js.map +1 -0
  20. package/DiscordREST/index.ts +97 -0
  21. package/DiscordREST/types.d.ts +12 -0
  22. package/DiscordREST/types.ts +9 -1
  23. package/DiscordShard/commands.d.ts +7 -0
  24. package/DiscordShard/heartbeats.d.ts +6 -0
  25. package/DiscordShard/heartbeats.js +9 -13
  26. package/DiscordShard/heartbeats.js.map +1 -1
  27. package/DiscordShard/heartbeats.ts +23 -28
  28. package/DiscordShard/identify.d.ts +15 -0
  29. package/DiscordShard/identify.js +5 -5
  30. package/DiscordShard/identify.js.map +1 -1
  31. package/DiscordShard/identify.ts +11 -12
  32. package/DiscordShard/index.d.ts +32 -0
  33. package/DiscordShard/index.js +24 -21
  34. package/DiscordShard/index.js.map +1 -1
  35. package/DiscordShard/index.ts +45 -33
  36. package/DiscordShard/invalidSession.d.ts +6 -0
  37. package/DiscordShard/invalidSession.js +4 -4
  38. package/DiscordShard/invalidSession.js.map +1 -1
  39. package/DiscordShard/invalidSession.ts +7 -8
  40. package/DiscordShard/utils.d.ts +7 -0
  41. package/DiscordShard/utils.js +5 -12
  42. package/DiscordShard/utils.js.map +1 -1
  43. package/DiscordShard/utils.ts +22 -37
  44. package/DiscordWS/index.d.ts +36 -0
  45. package/DiscordWS/index.js +10 -8
  46. package/DiscordWS/index.js.map +1 -1
  47. package/DiscordWS/index.ts +34 -31
  48. package/Log/index.d.ts +15 -0
  49. package/Log/index.js +16 -7
  50. package/Log/index.js.map +1 -1
  51. package/Log/index.ts +21 -11
  52. package/Utils/memoize.d.ts +3 -0
  53. package/Utils/memoize.js +16 -0
  54. package/Utils/memoize.js.map +1 -0
  55. package/Utils/memoize.ts +15 -0
  56. package/WS/index.d.ts +30 -0
  57. package/WS/index.js +16 -16
  58. package/WS/index.js.map +1 -1
  59. package/WS/index.ts +33 -34
  60. package/bot.d.ts +1 -0
  61. package/bot.js +15 -20
  62. package/bot.js.map +1 -1
  63. package/bot.ts +33 -36
  64. package/esm/DiscordConfig/index.js +26 -0
  65. package/esm/DiscordConfig/index.js.map +1 -0
  66. package/esm/DiscordGateway/index.js +20 -0
  67. package/esm/DiscordGateway/index.js.map +1 -0
  68. package/esm/DiscordGateway/utils.js +7 -0
  69. package/esm/DiscordGateway/utils.js.map +1 -0
  70. package/esm/DiscordREST/http.js +15 -0
  71. package/esm/DiscordREST/http.js.map +1 -0
  72. package/esm/DiscordREST/index.js +62 -0
  73. package/esm/DiscordREST/index.js.map +1 -0
  74. package/esm/DiscordREST/types.js +3 -0
  75. package/esm/DiscordREST/types.js.map +1 -0
  76. package/esm/DiscordShard/commands.js +28 -0
  77. package/esm/DiscordShard/commands.js.map +1 -0
  78. package/esm/DiscordShard/heartbeats.js +24 -0
  79. package/esm/DiscordShard/heartbeats.js.map +1 -0
  80. package/esm/DiscordShard/identify.js +30 -0
  81. package/esm/DiscordShard/identify.js.map +1 -0
  82. package/esm/DiscordShard/index.js +58 -0
  83. package/esm/DiscordShard/index.js.map +1 -0
  84. package/esm/DiscordShard/invalidSession.js +12 -0
  85. package/esm/DiscordShard/invalidSession.js.map +1 -0
  86. package/esm/DiscordShard/utils.js +11 -0
  87. package/esm/DiscordShard/utils.js.map +1 -0
  88. package/esm/DiscordWS/index.js +34 -0
  89. package/esm/DiscordWS/index.js.map +1 -0
  90. package/esm/Log/index.js +22 -0
  91. package/esm/Log/index.js.map +1 -0
  92. package/esm/Utils/memoize.js +12 -0
  93. package/esm/Utils/memoize.js.map +1 -0
  94. package/esm/WS/index.js +65 -0
  95. package/esm/WS/index.js.map +1 -0
  96. package/esm/bot.js +25 -0
  97. package/esm/bot.js.map +1 -0
  98. package/esm/mod.js +16 -0
  99. package/esm/mod.js.map +1 -0
  100. package/esm/types.js +1559 -0
  101. package/esm/types.js.map +1 -0
  102. package/mod.d.ts +7 -0
  103. package/mod.js +16 -2
  104. package/mod.js.map +1 -1
  105. package/mod.ts +14 -3
  106. package/package.json +26 -10
  107. package/types.d.ts +3598 -0
  108. package/types.js +2 -1
  109. package/types.js.map +1 -1
  110. package/types.ts +170 -149
@@ -0,0 +1,29 @@
1
+ import * as T from "@effect-ts/core/Effect";
2
+ import { UpdatePresence } from "../types";
3
+ export interface DiscordConfig {
4
+ _tag: "DiscordConfig";
5
+ token: string;
6
+ rest: {
7
+ baseUrl: string;
8
+ };
9
+ gateway: {
10
+ intents: number;
11
+ presence?: UpdatePresence;
12
+ };
13
+ }
14
+ export declare const DiscordConfig: import("@effect-ts/system/Has").Tag<DiscordConfig>;
15
+ export interface MakeOpts {
16
+ token: string;
17
+ rest?: Partial<DiscordConfig["rest"]>;
18
+ gateway?: Partial<DiscordConfig["gateway"]>;
19
+ }
20
+ export declare const make: ({ token, rest, gateway }: MakeOpts) => DiscordConfig;
21
+ export declare const makeLayer: (a_0: MakeOpts) => import("@effect-ts/system/Layer").Layer<{}, never, import("@effect-ts/system/Has").Has<DiscordConfig>>;
22
+ export declare const token: T.Effect<import("@effect-ts/system/Has").Has<DiscordConfig>, never, string>;
23
+ export declare const rest: T.Effect<import("@effect-ts/system/Has").Has<DiscordConfig>, never, {
24
+ baseUrl: string;
25
+ }>;
26
+ export declare const gateway: T.Effect<import("@effect-ts/system/Has").Has<DiscordConfig>, never, {
27
+ intents: number;
28
+ presence?: UpdatePresence | undefined;
29
+ }>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gateway = exports.rest = exports.token = exports.makeLayer = exports.make = exports.DiscordConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tracing_1 = tslib_1.__importStar(require("@effect-ts/core/Tracing"));
6
+ const fileName_1 = "DiscordConfig/index.ts";
7
+ const Has_1 = require("@effect-ts/system/Has");
8
+ const T = tslib_1.__importStar(require("@effect-ts/core/Effect"));
9
+ const Function_1 = require("@effect-ts/system/Function");
10
+ const Layer_1 = require("@effect-ts/system/Layer");
11
+ const types_1 = require("../types");
12
+ const VERSION = 9;
13
+ exports.DiscordConfig = (0, Has_1.tag)();
14
+ const make = ({ token, rest, gateway }) => ({
15
+ _tag: "DiscordConfig",
16
+ token,
17
+ rest: {
18
+ baseUrl: `https://discord.com/api/v${VERSION}`,
19
+ ...(rest ?? {}),
20
+ },
21
+ gateway: {
22
+ intents: types_1.GatewayIntents.GUILDS,
23
+ ...(gateway ?? {}),
24
+ },
25
+ });
26
+ exports.make = make;
27
+ exports.makeLayer = (0, Function_1.flow)(exports.make, (0, Layer_1.fromValue)(exports.DiscordConfig));
28
+ exports.token = T.accessService(exports.DiscordConfig)(({ token }) => token, fileName_1 + ":43:52");
29
+ exports.rest = T.accessService(exports.DiscordConfig)(({ rest }) => rest, fileName_1 + ":44:51");
30
+ exports.gateway = T.accessService(exports.DiscordConfig)(({ gateway }) => gateway, fileName_1 + ":45:54");
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA2C;AAC3C,kEAA2C;AAC3C,yDAAiD;AACjD,mDAAmD;AACnD,oCAAyD;AAEzD,MAAM,OAAO,GAAG,CAAC,CAAA;AAaJ,QAAA,aAAa,GAAG,IAAA,SAAG,GAAiB,CAAA;AAQ1C,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAY,EAAiB,EAAE,CAAC,CAAC;IAC1E,IAAI,EAAE,eAAe;IACrB,KAAK;IACL,IAAI,EAAE;QACJ,OAAO,EAAE,4BAA4B,OAAO,EAAE;QAC9C,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;KAChB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,sBAAc,CAAC,MAAM;QAC9B,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KACnB;CACF,CAAC,CAAA;AAXW,QAAA,IAAI,QAWf;AAEW,QAAA,SAAS,GAAG,IAAA,eAAI,EAAC,YAAI,EAAE,IAAA,iBAAS,EAAC,qBAAa,CAAC,CAAC,CAAA;AAEhD,QAAA,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,qBAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,wBAAC,CAAA;AAC5D,QAAA,IAAI,GAAG,CAAC,CAAC,aAAa,CAAC,qBAAa,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,wBAAC,CAAA;AACzD,QAAA,OAAO,GAAG,CAAC,CAAC,aAAa,CAAC,qBAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,wBAAC,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { tag } from "@effect-ts/system/Has"
2
+ import * as T from "@effect-ts/core/Effect"
3
+ import { flow } from "@effect-ts/system/Function"
4
+ import { fromValue } from "@effect-ts/system/Layer"
5
+ import { GatewayIntents, UpdatePresence } from "../types"
6
+
7
+ const VERSION = 9
8
+
9
+ export interface DiscordConfig {
10
+ _tag: "DiscordConfig"
11
+ token: string
12
+ rest: {
13
+ baseUrl: string
14
+ }
15
+ gateway: {
16
+ intents: number
17
+ presence?: UpdatePresence
18
+ }
19
+ }
20
+ export const DiscordConfig = tag<DiscordConfig>()
21
+
22
+ export interface MakeOpts {
23
+ token: string
24
+ rest?: Partial<DiscordConfig["rest"]>
25
+ gateway?: Partial<DiscordConfig["gateway"]>
26
+ }
27
+
28
+ export const make = ({ token, rest, gateway }: MakeOpts): DiscordConfig => ({
29
+ _tag: "DiscordConfig",
30
+ token,
31
+ rest: {
32
+ baseUrl: `https://discord.com/api/v${VERSION}`,
33
+ ...(rest ?? {}),
34
+ },
35
+ gateway: {
36
+ intents: GatewayIntents.GUILDS,
37
+ ...(gateway ?? {}),
38
+ },
39
+ })
40
+
41
+ export const makeLayer = flow(make, fromValue(DiscordConfig))
42
+
43
+ export const token = T.accessService(DiscordConfig)(({ token }) => token)
44
+ export const rest = T.accessService(DiscordConfig)(({ rest }) => rest)
45
+ export const gateway = T.accessService(DiscordConfig)(({ gateway }) => gateway)
@@ -0,0 +1,23 @@
1
+ import * as T from "@effect-ts/core/Effect";
2
+ import * as M from "@effect-ts/core/Effect/Managed";
3
+ import { _A } from "@effect-ts/core/Utils";
4
+ import * as Shard from "../DiscordShard";
5
+ import * as CB from "callbag-effect-ts";
6
+ import { GatewayEvents } from "../types";
7
+ declare const make: M.Managed<import("@effect-ts/system/Has").Has<import("../DiscordConfig").DiscordConfig> & import("@effect-ts/system/Has").Has<Shard.DiscordShard>, never, {
8
+ readonly fromDispatch: <K extends keyof GatewayEvents>(event: K) => CB.EffectSource<import("@effect-ts/system/Has").Has<import("../DiscordWS").DiscordWS> & import("@effect-ts/system/Has").Has<import("../WS").WS> & import("@effect-ts/system/Has").Has<import("../Log").Log> & import("@effect-ts/system/Clock").HasClock, never, GatewayEvents[K]>;
9
+ readonly run: T.RIO<import("@effect-ts/system/Has").Has<import("../DiscordWS").DiscordWS> & import("@effect-ts/system/Has").Has<import("../WS").WS> & import("@effect-ts/system/Has").Has<import("../Log").Log> & import("@effect-ts/system/Clock").HasClock, void>;
10
+ readonly raw: CB.EffectSource<import("@effect-ts/system/Has").Has<import("../DiscordWS").DiscordWS> & import("@effect-ts/system/Has").Has<import("../WS").WS> & import("@effect-ts/system/Has").Has<import("../Log").Log> & import("@effect-ts/system/Clock").HasClock, never, import("../types").GatewayPayload<any>>;
11
+ readonly dispatch: CB.EffectSource<import("@effect-ts/system/Has").Has<import("../DiscordWS").DiscordWS> & import("@effect-ts/system/Has").Has<import("../WS").WS> & import("@effect-ts/system/Has").Has<import("../Log").Log> & import("@effect-ts/system/Clock").HasClock, never, import("../types").GatewayPayload<import("../types").GatewayEvent>>;
12
+ readonly send: (p: import("../types").GatewayPayload<any>) => T.Effect<unknown, never, boolean>;
13
+ readonly reconnect: () => T.Effect<unknown, never, boolean>;
14
+ readonly _tag: "DiscordGatewayService";
15
+ }>;
16
+ export interface DiscordGateway extends _A<typeof make> {
17
+ }
18
+ export declare const DiscordGateway: import("@effect-ts/system/Has").Tag<DiscordGateway>;
19
+ export declare const LiveDiscordGateway: import("@effect-ts/system/Layer").Layer<import("@effect-ts/system/Has").Has<import("../DiscordConfig").DiscordConfig> & import("@effect-ts/system/Has").Has<Shard.DiscordShard>, never, import("@effect-ts/system/Has").Has<DiscordGateway>>;
20
+ export declare const gateway: T.Effect<import("@effect-ts/system/Has").Has<DiscordGateway>, never, DiscordGateway>;
21
+ export declare const run: T.Effect<import("@effect-ts/system/Has").Has<import("../DiscordWS").DiscordWS> & import("@effect-ts/system/Has").Has<import("../WS").WS> & import("@effect-ts/system/Has").Has<import("../Log").Log> & import("@effect-ts/system/Clock").HasClock & import("@effect-ts/system/Has").Has<DiscordGateway>, never, void>;
22
+ export declare const fromDispatch: <K extends keyof GatewayEvents>(event: K) => CB.EffectSource<import("@effect-ts/system/Has").Has<DiscordGateway> & import("@effect-ts/system/Has").Has<import("../DiscordWS").DiscordWS> & import("@effect-ts/system/Has").Has<import("../WS").WS> & import("@effect-ts/system/Has").Has<import("../Log").Log> & import("@effect-ts/system/Clock").HasClock, never, GatewayEvents[K]>;
23
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fromDispatch = exports.run = exports.gateway = exports.LiveDiscordGateway = exports.DiscordGateway = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tracing_1 = tslib_1.__importStar(require("@effect-ts/core/Tracing"));
6
+ const fileName_1 = "DiscordGateway/index.ts";
7
+ const T = tslib_1.__importStar(require("@effect-ts/core/Effect"));
8
+ const M = tslib_1.__importStar(require("@effect-ts/core/Effect/Managed"));
9
+ const Function_1 = require("@effect-ts/core/Function");
10
+ const Has_1 = require("@effect-ts/core/Has");
11
+ const Shard = tslib_1.__importStar(require("../DiscordShard"));
12
+ const Utils = tslib_1.__importStar(require("./utils"));
13
+ const CB = tslib_1.__importStar(require("callbag-effect-ts"));
14
+ const make = (M.map_(Shard.make([0, 1]), (shard) => ({
15
+ _tag: "DiscordGatewayService",
16
+ ...shard,
17
+ fromDispatch: Utils.fromDispatch(shard.dispatch),
18
+ }), fileName_1 + ":13:8"));
19
+ exports.DiscordGateway = (0, Has_1.tag)();
20
+ exports.LiveDiscordGateway = M.toLayer_(make, exports.DiscordGateway);
21
+ exports.gateway = T.accessService(exports.DiscordGateway)(Function_1.identity, fileName_1 + ":27:55");
22
+ exports.run = T.accessServiceM(exports.DiscordGateway)(({ run }) => run, fileName_1 + ":28:52");
23
+ const fromDispatch = (event) => (CB.unwrap(T.accessService(exports.DiscordGateway)(({ fromDispatch }) => fromDispatch(event), fileName_1 + ":32:36")));
24
+ exports.fromDispatch = fromDispatch;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA2C;AAC3C,0EAAmD;AACnD,uDAAyD;AACzD,6CAAyC;AAEzC,+DAAwC;AACxC,uDAAgC;AAChC,8DAAuC;AAGvC,MAAM,IAAI,IAER,CAAC,MADD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAEhB,CAAC,KAAK,EAAE,EAAE,CACR,CAAC;IACC,IAAI,EAAE,uBAAuB;IAC7B,GAAG,KAAK;IACR,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC;CACvC,CAAA,wBAEhB,CAAA;AAGY,QAAA,cAAc,GAAG,IAAA,SAAG,GAAkB,CAAA;AACtC,QAAA,kBAAkB,GAAG,CAAC,UAAyB,IAAI,EAApB,sBAAc,EAAO;AAEpD,QAAA,OAAO,GAAG,CAAC,CAAC,aAAa,CAAC,sBAAc,CAAC,CAAC,mBAAQ,wBAAC,CAAA;AACnD,QAAA,GAAG,GAAG,CAAC,CAAC,cAAc,CAAC,sBAAc,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,wBAAC,CAAA;AAE9D,MAAM,YAAY,GAAG,CAAgC,KAAQ,EAAE,EAAE,EAGpE,EAAE,CAAC,MAAM,CADT,CAAC,CAAC,aAAa,CAAC,sBAAc,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,wBAAC,EAE3E,CAAA;AAJU,QAAA,YAAY,gBAItB"}
@@ -0,0 +1,34 @@
1
+ import * as T from "@effect-ts/core/Effect"
2
+ import * as M from "@effect-ts/core/Effect/Managed"
3
+ import { identity, pipe } from "@effect-ts/core/Function"
4
+ import { tag } from "@effect-ts/core/Has"
5
+ import { _A } from "@effect-ts/core/Utils"
6
+ import * as Shard from "../DiscordShard"
7
+ import * as Utils from "./utils"
8
+ import * as CB from "callbag-effect-ts"
9
+ import { GatewayEvents } from "../types"
10
+
11
+ const make = pipe(
12
+ Shard.make([0, 1]),
13
+ M.map(
14
+ (shard) =>
15
+ ({
16
+ _tag: "DiscordGatewayService",
17
+ ...shard,
18
+ fromDispatch: Utils.fromDispatch(shard.dispatch),
19
+ } as const),
20
+ ),
21
+ )
22
+
23
+ export interface DiscordGateway extends _A<typeof make> {}
24
+ export const DiscordGateway = tag<DiscordGateway>()
25
+ export const LiveDiscordGateway = M.toLayer(DiscordGateway)(make)
26
+
27
+ export const gateway = T.accessService(DiscordGateway)(identity)
28
+ export const run = T.accessServiceM(DiscordGateway)(({ run }) => run)
29
+
30
+ export const fromDispatch = <K extends keyof GatewayEvents>(event: K) =>
31
+ pipe(
32
+ T.accessService(DiscordGateway)(({ fromDispatch }) => fromDispatch(event)),
33
+ CB.unwrap,
34
+ )
@@ -0,0 +1,3 @@
1
+ import * as CB from "callbag-effect-ts";
2
+ import { GatewayEvent, GatewayEvents, GatewayPayload } from "../types";
3
+ export declare const fromDispatch: <R, E>(source: CB.EffectSource<R, E, GatewayPayload<GatewayEvent>>) => <K extends keyof GatewayEvents>(event: K) => CB.EffectSource<R, E, GatewayEvents[K]>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fromDispatch = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tracing_1 = tslib_1.__importStar(require("@effect-ts/core/Tracing"));
6
+ const fileName_1 = "DiscordGateway/utils.ts";
7
+ const Function_1 = require("@effect-ts/core/Function");
8
+ const CB = tslib_1.__importStar(require("callbag-effect-ts"));
9
+ const memoize_1 = require("../Utils/memoize");
10
+ const fromDispatch = (source) => (0, memoize_1.memoize)((event) => (CB.share(CB.map_(CB.filter_(source, (p) => p.t === event), (p) => p.d))));
11
+ exports.fromDispatch = fromDispatch;
12
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";;;;;;AAAA,uDAA+C;AAC/C,8DAAuC;AAEvC,8CAA0C;AAEnC,MAAM,YAAY,GAAG,CAC1B,MAA2D,EAGf,EAAE,CAC9C,IAAA,iBAAO,EAAC,CAAC,KAAK,EAAE,EAAE,EAId,EAAE,CAAC,KAAK,CADR,EAAE,MADF,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,EACjC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAQ,GAEzB,CACF,CAAA;AAXU,QAAA,YAAY,gBAWtB"}
@@ -0,0 +1,17 @@
1
+ import { pipe } from "@effect-ts/core/Function"
2
+ import * as CB from "callbag-effect-ts"
3
+ import { GatewayEvent, GatewayEvents, GatewayPayload } from "../types"
4
+ import { memoize } from "../Utils/memoize"
5
+
6
+ export const fromDispatch = <R, E>(
7
+ source: CB.EffectSource<R, E, GatewayPayload<GatewayEvent>>,
8
+ ): (<K extends keyof GatewayEvents>(
9
+ event: K,
10
+ ) => CB.EffectSource<R, E, GatewayEvents[K]>) =>
11
+ memoize((event) =>
12
+ pipe(
13
+ CB.filter_(source, (p) => p.t === event),
14
+ CB.map((p) => p.d as any),
15
+ CB.share,
16
+ ),
17
+ )
@@ -0,0 +1,3 @@
1
+ import * as Axios from "axios";
2
+ import { Response } from "./types";
3
+ export declare const request: (axios: Axios.AxiosInstance) => <A>(config: Axios.AxiosRequestConfig) => Response<A>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.request = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tracing_1 = tslib_1.__importStar(require("@effect-ts/core/Tracing"));
6
+ const fileName_1 = "DiscordREST/http.ts";
7
+ const T = tslib_1.__importStar(require("@effect-ts/core/Effect"));
8
+ const request = (axios) => (config) => T.tryCatchPromise(() => axios.request(config).then((r) => r.data), (err) => {
9
+ const axiosErr = err;
10
+ return axiosErr.response
11
+ ? {
12
+ _tag: "http",
13
+ config: axiosErr.config,
14
+ code: axiosErr.response.status,
15
+ body: axiosErr.response.data,
16
+ }
17
+ : { _tag: "axios", cause: axiosErr };
18
+ }, fileName_1 + ":8:22");
19
+ exports.request = request;
20
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["http.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA2C;AAIpC,MAAM,OAAO,GAClB,CAAC,KAA0B,EAAE,EAAE,CAC/B,CAAI,MAAgC,EAAe,EAAE,CACnD,CAAC,CAAC,eAAe,CACf,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAI,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAClD,CAAC,GAAG,EAAE,EAAE;IACN,MAAM,QAAQ,GAAG,GAA0B,CAAA;IAC3C,OAAO,QAAQ,CAAC,QAAQ;QACtB,CAAC,CAAC;YACE,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;YAC9B,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;SAC7B;QACH,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAmC,EAAE,CAAA;AACnE,CAAC,uBACF,CAAA;AAhBQ,QAAA,OAAO,WAgBf"}
@@ -0,0 +1,21 @@
1
+ import * as T from "@effect-ts/core/Effect"
2
+ import * as Axios from "axios"
3
+ import { RESTError, Response } from "./types"
4
+
5
+ export const request =
6
+ (axios: Axios.AxiosInstance) =>
7
+ <A>(config: Axios.AxiosRequestConfig): Response<A> =>
8
+ T.tryCatchPromise<RESTError, A>(
9
+ () => axios.request<A>(config).then((r) => r.data),
10
+ (err) => {
11
+ const axiosErr = err as Axios.AxiosError<A>
12
+ return axiosErr.response
13
+ ? {
14
+ _tag: "http",
15
+ config: axiosErr.config,
16
+ code: axiosErr.response.status,
17
+ body: axiosErr.response.data,
18
+ }
19
+ : { _tag: "axios", cause: axiosErr as Axios.AxiosError<never> }
20
+ },
21
+ )
@@ -0,0 +1,18 @@
1
+ import * as T from "@effect-ts/core/Effect";
2
+ import { Has } from "@effect-ts/system/Has";
3
+ import { AxiosInstance, AxiosRequestConfig } from "axios";
4
+ import * as Config from "../DiscordConfig";
5
+ import { Endpoints } from "../types";
6
+ import { Response, RESTError } from "./types";
7
+ interface AxiosEndpoints extends Endpoints<AxiosRequestConfig> {
8
+ }
9
+ export interface DiscordREST extends AxiosEndpoints {
10
+ _tag: "DiscordREST";
11
+ axios: AxiosInstance;
12
+ }
13
+ export declare const DiscordREST: import("@effect-ts/system/Has").Tag<DiscordREST>;
14
+ export declare const LiveDiscordREST: import("@effect-ts/system/Layer").Layer<Has<Config.DiscordConfig>, never, Has<DiscordREST>>;
15
+ export declare const rest: <R, E, B>(f: (a: DiscordREST) => T.Effect<R, E, B>, __trace?: string | undefined) => T.Effect<R & Has<DiscordREST>, E, B>;
16
+ declare type InferResponse<T extends (...args: any[]) => Response<any>> = T extends (...args: any[]) => Response<infer R> ? R : never;
17
+ export declare const call: <K extends keyof AxiosEndpoints>(method: K, ...args: Parameters<AxiosEndpoints[K]>) => T.Effect<Has<DiscordREST>, RESTError, InferResponse<AxiosEndpoints[K]>>;
18
+ export {};
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.call = exports.rest = exports.LiveDiscordREST = exports.DiscordREST = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tracing_1 = tslib_1.__importStar(require("@effect-ts/core/Tracing"));
6
+ const fileName_1 = "DiscordREST/index.ts";
7
+ const T = tslib_1.__importStar(require("@effect-ts/core/Effect"));
8
+ const Has_1 = require("@effect-ts/system/Has");
9
+ const axios_1 = tslib_1.__importDefault(require("axios"));
10
+ const Config = tslib_1.__importStar(require("../DiscordConfig"));
11
+ const types_1 = require("../types");
12
+ const Http = tslib_1.__importStar(require("./http"));
13
+ exports.DiscordREST = (0, Has_1.tag)();
14
+ const make = T.gen(function* (_) {
15
+ const token = yield* _(Config.token, fileName_1 + ":22:25");
16
+ const config = yield* _(Config.rest, fileName_1 + ":23:26");
17
+ const axios = axios_1.default.create({
18
+ baseURL: config.baseUrl,
19
+ headers: {
20
+ Authorization: `Bot ${token}`,
21
+ },
22
+ });
23
+ const request = Http.request(axios);
24
+ const routes = (0, types_1.createRoutes)(({ method, url, params = {}, options = {} }) => {
25
+ const hasBody = method !== "GET" && method !== "DELETE";
26
+ let hasFormData = false;
27
+ if (typeof options.data?.append === "function") {
28
+ hasFormData = true;
29
+ options.data.append("payload_json", JSON.stringify(params));
30
+ }
31
+ const qsParams = hasBody
32
+ ? options.params
33
+ : {
34
+ ...(options.params || {}),
35
+ ...params,
36
+ };
37
+ const data = hasFormData || !hasBody
38
+ ? options.data
39
+ : {
40
+ ...(options.data || {}),
41
+ ...params,
42
+ };
43
+ const config = {
44
+ ...options,
45
+ headers: {
46
+ ...(options.headers || {}),
47
+ ...(hasFormData ? data.getHeaders() : {}),
48
+ },
49
+ method: method,
50
+ url,
51
+ params: qsParams,
52
+ data,
53
+ };
54
+ return request(config);
55
+ });
56
+ const rest = {
57
+ _tag: "DiscordREST",
58
+ axios,
59
+ ...routes,
60
+ };
61
+ return rest;
62
+ }, fileName_1 + ":21:19");
63
+ exports.LiveDiscordREST = T.toLayer(exports.DiscordREST)(make);
64
+ exports.rest = T.accessServiceM(exports.DiscordREST);
65
+ const call = (method, ...args) => (0, exports.rest)((r) => r[method](...args), fileName_1 + ":97:7");
66
+ exports.call = call;
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA2C;AAC3C,+CAAgD;AAChD,0DAAwE;AACxE,iEAA0C;AAC1C,oCAAkD;AAClD,qDAA8B;AAQjB,QAAA,WAAW,GAAG,IAAA,SAAG,GAAe,CA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AAI,IAAI,EAAE,CAAC;gBACvB,GAAG,MAAM;aACV,CAAA;QAEP,MAAM,MAAM,GAAG;YACb,GAAG,OAAO;YACV,OAAO,EAAE;gBACP,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;gBAC1B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC1C;YACD,MAAM,EAAE,MAAgB;YACxB,GAAG;YACH,MAAM,EAAE,QAAQ;YAChB,IAAI;SACL,CAAA;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAA;IACxB,CAAC,CACF,CAAA;IAED,MAAM,IAAI,GAAgB;QACxB,IAAI,EAAE,aAAa;QACnB,KAAK;QACL,GAAG,MAAM;KACV,CAAA;IAED,OAAO,IAAI,CAAA;AACb,CAAC,wBAAC,CAAA;AAEW,QAAA,eAAe,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAW,CAAC,CAAC,IAAI,CAAC,CAAA;AAE9C,QAAA,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,mBAAW,CAAC,CAAA;AAQ1C,MAAM,IAAI,GAAG,CAClB,MAAS,EACT,GAAG,IAAmC,EACmC,EAAE,CAC3E,IAAA,YAAI,EAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAC,CAAC,MAAM,CAAS,CAAC,GAAG,IAAI,CAAC,uBAAC,CAAA;AAJ7B,QAAA,IAAI,QAIyB"}
@@ -0,0 +1,97 @@
1
+ import * as T from "@effect-ts/core/Effect"
2
+ import { Has, tag } from "@effect-ts/system/Has"
3
+ import Axios, { AxiosInstance, AxiosRequestConfig, Method } from "axios"
4
+ import * as Config from "../DiscordConfig"
5
+ import { createRoutes, Endpoints } from "../types"
6
+ import * as Http from "./http"
7
+ import { Response, RESTError } from "./types"
8
+
9
+ interface AxiosEndpoints extends Endpoints<AxiosRequestConfig> {}
10
+ export interface DiscordREST extends AxiosEndpoints {
11
+ _tag: "DiscordREST"
12
+ axios: AxiosInstance
13
+ }
14
+ export const DiscordREST = tag<DiscordREST>()
15
+
16
+ interface FormData {
17
+ append: (key: string, value: unknown) => void
18
+ getHeaders: () => Record<string, string>
19
+ }
20
+
21
+ const make = T.gen(function* (_) {
22
+ const token = yield* _(Config.token)
23
+ const config = yield* _(Config.rest)
24
+
25
+ const axios = Axios.create({
26
+ baseURL: config.baseUrl,
27
+ headers: {
28
+ Authorization: `Bot ${token}`,
29
+ },
30
+ })
31
+ const request = Http.request(axios)
32
+ const routes = createRoutes<AxiosRequestConfig>(
33
+ ({ method, url, params = {}, options = {} }) => {
34
+ const hasBody = method !== "GET" && method !== "DELETE"
35
+ let hasFormData = false
36
+
37
+ if (typeof options.data?.append === "function") {
38
+ hasFormData = true
39
+ ;(options.data as FormData).append(
40
+ "payload_json",
41
+ JSON.stringify(params),
42
+ )
43
+ }
44
+
45
+ const qsParams = hasBody
46
+ ? options.params
47
+ : {
48
+ ...(options.params || {}),
49
+ ...params,
50
+ }
51
+ const data =
52
+ hasFormData || !hasBody
53
+ ? options.data
54
+ : {
55
+ ...(options.data || {}),
56
+ ...params,
57
+ }
58
+
59
+ const config = {
60
+ ...options,
61
+ headers: {
62
+ ...(options.headers || {}),
63
+ ...(hasFormData ? data.getHeaders() : {}),
64
+ },
65
+ method: method as Method,
66
+ url,
67
+ params: qsParams,
68
+ data,
69
+ }
70
+ return request(config)
71
+ },
72
+ )
73
+
74
+ const rest: DiscordREST = {
75
+ _tag: "DiscordREST",
76
+ axios,
77
+ ...routes,
78
+ }
79
+
80
+ return rest
81
+ })
82
+
83
+ export const LiveDiscordREST = T.toLayer(DiscordREST)(make)
84
+
85
+ export const rest = T.accessServiceM(DiscordREST)
86
+
87
+ type InferResponse<T extends (...args: any[]) => Response<any>> = T extends (
88
+ ...args: any[]
89
+ ) => Response<infer R>
90
+ ? R
91
+ : never
92
+
93
+ export const call = <K extends keyof AxiosEndpoints>(
94
+ method: K,
95
+ ...args: Parameters<AxiosEndpoints[K]>
96
+ ): T.Effect<Has<DiscordREST>, RESTError, InferResponse<AxiosEndpoints[K]>> =>
97
+ rest((r) => (r[method] as any)(...args))
@@ -0,0 +1,12 @@
1
+ import * as T from "@effect-ts/core/Effect";
2
+ import { AxiosError, AxiosRequestConfig } from "axios";
3
+ export declare type RESTError = {
4
+ _tag: "http";
5
+ config: AxiosRequestConfig<unknown>;
6
+ code: number;
7
+ body?: unknown;
8
+ } | {
9
+ _tag: "axios";
10
+ cause: AxiosError<never>;
11
+ };
12
+ export declare type Response<T> = T.IO<RESTError, T>;
@@ -1,5 +1,13 @@
1
1
  import * as T from "@effect-ts/core/Effect"
2
+ import { AxiosError, AxiosRequestConfig } from "axios"
2
3
 
3
- export type RESTError = { _tag: "http"; code: number; body?: unknown }
4
+ export type RESTError =
5
+ | {
6
+ _tag: "http"
7
+ config: AxiosRequestConfig<unknown>
8
+ code: number
9
+ body?: unknown
10
+ }
11
+ | { _tag: "axios"; cause: AxiosError<never> }
4
12
 
5
13
  export type Response<T> = T.IO<RESTError, T>
@@ -0,0 +1,7 @@
1
+ import { GatewayPayload, Heartbeat, Identify, RequestGuildMember, Resume, UpdatePresence, UpdateVoiceState } from "../types";
2
+ export declare const heartbeat: (d: Heartbeat) => GatewayPayload;
3
+ export declare const identify: (d: Identify) => GatewayPayload;
4
+ export declare const resume: (d: Resume) => GatewayPayload;
5
+ export declare const requestGuildMembers: (d: RequestGuildMember) => GatewayPayload;
6
+ export declare const voiceStateUpdate: (d: UpdateVoiceState) => GatewayPayload;
7
+ export declare const presenceUpdate: (d: UpdatePresence) => GatewayPayload;
@@ -0,0 +1,6 @@
1
+ import * as R from "@effect-ts/core/Effect/Ref";
2
+ import * as O from "@effect-ts/core/Option";
3
+ import * as CB from "callbag-effect-ts";
4
+ import * as DWS from "../DiscordWS";
5
+ import { GatewayPayload } from "../types";
6
+ export declare const fromRaw: <R, E>(source: CB.EffectSource<R, E, GatewayPayload<any>>, seqRef: R.Ref<O.Option<number>>) => CB.EffectSource<R & import("@effect-ts/system/Clock").HasClock, E, DWS.Message>;
@@ -1,33 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fromHub = void 0;
3
+ exports.fromRaw = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const tracing_1 = tslib_1.__importStar(require("@effect-ts/core/Tracing"));
6
6
  const fileName_1 = "DiscordShard/heartbeats.ts";
7
7
  const T = tslib_1.__importStar(require("@effect-ts/core/Effect"));
8
- const S = tslib_1.__importStar(require("@effect-ts/core/Effect/Experimental/Stream"));
9
8
  const R = tslib_1.__importStar(require("@effect-ts/core/Effect/Ref"));
9
+ const SC = tslib_1.__importStar(require("@effect-ts/core/Effect/Schedule"));
10
10
  const Function_1 = require("@effect-ts/core/Function");
11
11
  const O = tslib_1.__importStar(require("@effect-ts/core/Option"));
12
+ const CB = tslib_1.__importStar(require("callbag-effect-ts"));
12
13
  const types_1 = require("../types");
13
14
  const WS_1 = require("../WS");
14
15
  const Commands = tslib_1.__importStar(require("./commands"));
15
16
  const Utils = tslib_1.__importStar(require("./utils"));
16
17
  const send = (ref, seqRef) => (T.tap_(T.map_(R.get(seqRef), (o) => Commands.heartbeat(O.toNullable(o)), fileName_1 + ":16:10"), () => R.set_(ref, false), fileName_1 + ":17:10"));
17
18
  const maybeSend = (ref, seqRef) => (T.chain_(R.get(ref), (acked) => acked ? send(ref, seqRef) : T.succeed(WS_1.Reconnect, fileName_1 + ":25:46"), fileName_1 + ":23:12"));
18
- const fromHub = (hub, seqRef) => (S.unwrap(T.map_(R.makeRef(true), (ackedRef) => {
19
+ const fromRaw = (source, seqRef) => (CB.unwrap(T.map_(R.makeRef(true), (ackedRef) => {
19
20
  const heartbeats = (
20
21
  // Map to gateway message depending on ack state
21
- S.mapEffect_(S.chainParSwitch_(
22
+ CB.mapEffect_(CB.switchMap_(
22
23
  // Reset ack state for each hello
23
- S.tap_(Utils.opCode(hub)(types_1.GatewayOpcode.HELLO), () => R.set_(ackedRef, true)), (p) => {
24
- const initial = p.d.heartbeat_interval * Math.random();
25
- return S.merge_(
26
- // First random heartbeat
27
- S.fromEffect(T.sleep(initial, fileName_1 + ":47:33")), (S.chain_(S.fromEffect(T.sleep(initial, fileName_1 + ":50:35")), () => S.repeatEffect(T.sleep(p.d.heartbeat_interval, fileName_1 + ":51:51")))));
28
- }, 1), () => maybeSend(ackedRef, seqRef)));
29
- const acks = (S.drain(S.tap_(Utils.opCode(hub)(types_1.GatewayOpcode.HEARTBEAT_ACK), () => R.set_(ackedRef, true))));
30
- return S.merge_(heartbeats, acks);
24
+ CB.tap_(Utils.opCode(source)(types_1.GatewayOpcode.HELLO), () => R.set_(ackedRef, true)), (p) => CB.fromSchedule(SC.duration(p.d.heartbeat_interval * Math.random())["++"](SC.spaced(p.d.heartbeat_interval)))), () => maybeSend(ackedRef, seqRef)));
25
+ const acks = (CB.drain(CB.tap_(Utils.opCode(source)(types_1.GatewayOpcode.HEARTBEAT_ACK), () => R.set_(ackedRef, true))));
26
+ return CB.merge_(heartbeats, acks);
31
27
  }, fileName_1 + ":36:10")));
32
- exports.fromHub = fromHub;
28
+ exports.fromRaw = fromRaw;
33
29
  //# sourceMappingURL=heartbeats.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"heartbeats.js","sourceRoot":"","sources":["heartbeats.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA2C;AAC3C,sFAA+D;AAE/D,sEAA+C;AAC/C,uDAA+C;AAC/C,kEAA2C;AAE3C,oCAAoE;AACpE,8BAAiC;AACjC,6DAAsC;AACtC,uDAAgC;AAEhC,MAAM,IAAI,GAAG,CAAC,GAAmB,EAAE,MAA+B,EAAE,EAAE,EAIlE,CAAC,MADD,CAAC,MADD,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EACP,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,0BAC1C,GAA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