dfx 0.9.0 → 0.9.2

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 (67) hide show
  1. package/dist/DiscordGateway/DiscordWS/index.d.ts +2 -1
  2. package/dist/DiscordGateway/DiscordWS/index.d.ts.map +1 -1
  3. package/dist/DiscordGateway/DiscordWS/index.js +16 -15
  4. package/dist/DiscordGateway/DiscordWS/index.js.map +1 -1
  5. package/dist/DiscordGateway/Shard/heartbeats.d.ts +2 -1
  6. package/dist/DiscordGateway/Shard/heartbeats.d.ts.map +1 -1
  7. package/dist/DiscordGateway/Shard/heartbeats.js +12 -11
  8. package/dist/DiscordGateway/Shard/heartbeats.js.map +1 -1
  9. package/dist/DiscordGateway/Shard/index.d.ts +2 -1
  10. package/dist/DiscordGateway/Shard/index.d.ts.map +1 -1
  11. package/dist/DiscordGateway/Shard/index.js +18 -17
  12. package/dist/DiscordGateway/Shard/index.js.map +1 -1
  13. package/dist/DiscordGateway/Shard/invalidSession.d.ts +2 -1
  14. package/dist/DiscordGateway/Shard/invalidSession.d.ts.map +1 -1
  15. package/dist/DiscordGateway/Shard/invalidSession.js +5 -4
  16. package/dist/DiscordGateway/Shard/invalidSession.js.map +1 -1
  17. package/dist/DiscordGateway/Sharder/index.d.ts +1 -1
  18. package/dist/DiscordGateway/Sharder/index.js +9 -8
  19. package/dist/DiscordGateway/Sharder/index.js.map +1 -1
  20. package/dist/DiscordGateway/index.d.ts +2 -2
  21. package/dist/DiscordREST/index.d.ts +2 -2
  22. package/dist/Interactions/context.d.ts +1 -1
  23. package/dist/Interactions/definitions.d.ts +3 -3
  24. package/dist/Interactions/gateway.d.ts +2 -2
  25. package/dist/Interactions/gateway.d.ts.map +1 -1
  26. package/dist/Interactions/gateway.js +6 -5
  27. package/dist/Interactions/gateway.js.map +1 -1
  28. package/dist/Interactions/index.d.ts +3 -14
  29. package/dist/Interactions/index.d.ts.map +1 -1
  30. package/dist/Interactions/index.js +6 -15
  31. package/dist/Interactions/index.js.map +1 -1
  32. package/dist/Interactions/utils.d.ts.map +1 -1
  33. package/dist/Interactions/utils.js +7 -1
  34. package/dist/Interactions/utils.js.map +1 -1
  35. package/dist/Interactions/webhook.d.ts +10 -3
  36. package/dist/Interactions/webhook.d.ts.map +1 -1
  37. package/dist/Interactions/webhook.js +8 -1
  38. package/dist/Interactions/webhook.js.map +1 -1
  39. package/dist/RateLimitStore/index.d.ts +2 -2
  40. package/dist/common-gateway.d.ts +6 -0
  41. package/dist/common-gateway.d.ts.map +1 -0
  42. package/dist/common-gateway.js +6 -0
  43. package/dist/common-gateway.js.map +1 -0
  44. package/dist/common.d.ts +1 -6
  45. package/dist/common.d.ts.map +1 -1
  46. package/dist/common.js +1 -6
  47. package/dist/common.js.map +1 -1
  48. package/dist/global.d.ts +5 -1
  49. package/dist/global.d.ts.map +1 -1
  50. package/dist/index.d.ts +6 -6
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +3 -8
  53. package/dist/index.js.map +1 -1
  54. package/dist/webhooks.d.ts +16 -0
  55. package/dist/webhooks.d.ts.map +1 -0
  56. package/dist/webhooks.js +23 -0
  57. package/dist/webhooks.js.map +1 -0
  58. package/package.json +6 -6
  59. package/src/Interactions/gateway.ts +4 -4
  60. package/src/Interactions/index.ts +2 -39
  61. package/src/Interactions/utils.ts +7 -1
  62. package/src/Interactions/webhook.ts +37 -9
  63. package/src/common-gateway.ts +5 -0
  64. package/src/common.ts +1 -6
  65. package/src/global.ts +5 -5
  66. package/src/index.ts +1 -12
  67. package/src/webhooks.ts +30 -0
@@ -2,7 +2,13 @@ export const splitDefinitions = (definitions) => {
2
2
  const grouped = definitions.reduce((acc, a) => ({
3
3
  ...acc,
4
4
  [a._tag]: [...(acc[a._tag] ?? []), a],
5
- }), {});
5
+ }), {
6
+ Autocomplete: [],
7
+ GlobalApplicationCommand: [],
8
+ GuildApplicationCommand: [],
9
+ MessageComponent: [],
10
+ ModalSubmit: [],
11
+ });
6
12
  const Commands = [
7
13
  ...grouped.GlobalApplicationCommand,
8
14
  ...grouped.GuildApplicationCommand,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/Interactions/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,WAA4C,EAC5C,EAAE;IACF,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAMhC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,GAAG;QACN,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;KACtC,CAAC,EACF,EAAS,CACV,CAAA;IAED,MAAM,QAAQ,GAAG;QACf,GAAG,OAAO,CAAC,wBAAwB;QACnC,GAAG,OAAO,CAAC,uBAAuB;KACnC,CAAC,MAAM,CACN,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,GAAG;QACN,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;KACpB,CAAC,EACF,EAGC,CACF,CAAA;IAED,OAAO;QACL,GAAG,OAAO;QACV,QAAQ;KACT,CAAA;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/Interactions/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,WAA4C,EAC5C,EAAE;IACF,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAMhC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,GAAG;QACN,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;KACtC,CAAC,EACF;QACE,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,EAAE;QAC5B,uBAAuB,EAAE,EAAE;QAC3B,gBAAgB,EAAE,EAAE;QACpB,WAAW,EAAE,EAAE;KAChB,CACF,CAAA;IAED,MAAM,QAAQ,GAAG;QACf,GAAG,OAAO,CAAC,wBAAwB;QACnC,GAAG,OAAO,CAAC,uBAAuB;KACnC,CAAC,MAAM,CACN,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,GAAG,GAAG;QACN,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;KACpB,CAAC,EACF,EAGC,CACF,CAAA;IAED,OAAO;QACL,GAAG,OAAO;QACV,QAAQ;KACT,CAAA;AACH,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
- import { Discord } from "dfx/common";
2
- import * as D from "./definitions.js";
1
+ import { Discord, Effect, Cause } from "dfx/common";
2
+ import { InteractionBuilder } from "./index.js";
3
3
  export declare class BadWebhookSignature {
4
4
  readonly _tag = "BadWebhookSignature";
5
5
  }
@@ -15,5 +15,12 @@ export declare class WebhookParseError {
15
15
  readonly _tag = "WebhookParseError";
16
16
  constructor(reason: unknown);
17
17
  }
18
- export declare const run: <R, E>(definitions: D.InteractionDefinition<R, E>[], headers: Headers, body: string) => import("../common.js").Effect<WebhookConfig | R, BadWebhookSignature | WebhookParseError | E, import("../common.js").Maybe<import("../types.js").InteractionResponse>>;
18
+ export interface HandleWebhookOpts<E> {
19
+ headers: Headers;
20
+ body: string;
21
+ success: (a: Discord.InteractionResponse) => Effect<never, never, void>;
22
+ error: (e: Cause<E>) => Effect<never, never, void>;
23
+ empty: Effect<never, never, void>;
24
+ }
25
+ export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body, success, empty, error, }: HandleWebhookOpts<BadWebhookSignature | WebhookParseError | E>) => import("../common.js").Effect<WebhookConfig | R, never, void>;
19
26
  //# sourceMappingURL=webhook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/Interactions/webhook.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,CAAC,MAAM,kBAAkB,CAAA;AAGrC,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,IAAI,yBAAwB;CACtC;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;AAgBnE,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB;AACD,eAAO,MAAM,aAAa,2CAAuB,CAAA;AACjD,eAAO,MAAM,UAAU,MAAO,aAAa,8DAAoC,CAAA;AAE/E,qBAAa,iBAAiB;IAEhB,QAAQ,CAAC,MAAM,EAAE,OAAO;IADpC,QAAQ,CAAC,IAAI,uBAAsB;gBACd,MAAM,EAAE,OAAO;CACrC;AAcD,eAAO,MAAM,GAAG,gEAEL,OAAO,QACV,MAAM,2KAKV,CAAA"}
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/Interactions/webhook.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,IAAI,yBAAwB;CACtC;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;AAgBnE,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB;AACD,eAAO,MAAM,aAAa,2CAAuB,CAAA;AACjD,eAAO,MAAM,UAAU,MAAO,aAAa,8DAAoC,CAAA;AAE/E,qBAAa,iBAAiB;IAEhB,QAAQ,CAAC,MAAM,EAAE,OAAO;IADpC,QAAQ,CAAC,IAAI,uBAAsB;gBACd,MAAM,EAAE,OAAO;CACrC;AAuBD,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IACvE,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IAClD,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;CAClC;AAED,eAAO,MAAM,WAAW,sNAkBvB,CAAA"}
@@ -22,5 +22,12 @@ export class WebhookParseError {
22
22
  }
23
23
  }
24
24
  const fromHeadersAndBody = (headers, body) => tsplus_module_5.flatMap(({ publicKey }) => tsplus_module_5.flatMap(() => tsplus_module_5.tryCatch(() => JSON.parse(body), (reason) => new WebhookParseError(reason)))(tsplus_module_5.fromEither(checkSignature(publicKey, headers, body))))(tsplus_module_5.service(WebhookConfig));
25
- export const run = (definitions, headers, body) => tsplus_module_5.flatMap(interaction => handlers(definitions)[interaction.type](interaction))(fromHeadersAndBody(headers, body));
25
+ const run = (definitions) => {
26
+ const handler = handlers(definitions);
27
+ return (headers, body) => tsplus_module_5.flatMap(interaction => handler[interaction.type](interaction))(fromHeadersAndBody(headers, body));
28
+ };
29
+ export const makeHandler = (ix) => {
30
+ const handle = run(ix.definitions);
31
+ return ({ headers, body, success, empty, error, }) => tsplus_module_5.catchAllCause(error)(tsplus_module_5.flatMap((o) => tsplus_module_1.match(() => empty, (a) => success(a))(o))(handle(headers, body)));
32
+ };
26
33
  //# sourceMappingURL=webhook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/Interactions/webhook.ts"],"names":[],"mappings":";;;;;AA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AAE,CAAC,KAAK,EACX,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAFnB,CAAC,CAGA,EALL,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAMlB,CACoB,CAAA;AAC3B,CAAC,CAAA"}
@@ -14,12 +14,12 @@ export interface RateLimitStore {
14
14
  }
15
15
  export declare const RateLimitStore: import("../common.js").Tag<RateLimitStore>;
16
16
  export declare const LiveMemoryRateLimitStore: import("../common.js").Layer<never, never, RateLimitStore>;
17
- declare const makeLimiter: import("../common.js").Effect<RateLimitStore | import("../Log/index.js").Log, never, {
17
+ declare const makeLimiter: import("../common.js").Effect<import("../Log/index.js").Log | RateLimitStore, never, {
18
18
  maybeWait: (key: string, window: Duration, limit: number, multiplier?: number) => import("../common.js").Effect<never, never, void>;
19
19
  }>;
20
20
  export interface RateLimiter extends Success<typeof makeLimiter> {
21
21
  }
22
22
  export declare const RateLimiter: import("../common.js").Tag<RateLimiter>;
23
- export declare const LiveRateLimiter: import("../common.js").Layer<RateLimitStore | import("../Log/index.js").Log, never, RateLimiter>;
23
+ export declare const LiveRateLimiter: import("../common.js").Layer<import("../Log/index.js").Log | RateLimitStore, never, RateLimiter>;
24
24
  export {};
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ export * as Gateway from "dfx/DiscordGateway/index";
2
+ export * as WS from "dfx/DiscordGateway/WS/index";
3
+ export * as DWS from "dfx/DiscordGateway/DiscordWS/index";
4
+ export * as Shard from "dfx/DiscordGateway/Shard/index";
5
+ export * as ShardStore from "dfx/DiscordGateway/ShardStore/index";
6
+ //# sourceMappingURL=common-gateway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-gateway.d.ts","sourceRoot":"","sources":["../src/common-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACjD,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,gCAAgC,CAAA;AACvD,OAAO,KAAK,UAAU,MAAM,qCAAqC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * as Gateway from "dfx/DiscordGateway/index";
2
+ export * as WS from "dfx/DiscordGateway/WS/index";
3
+ export * as DWS from "dfx/DiscordGateway/DiscordWS/index";
4
+ export * as Shard from "dfx/DiscordGateway/Shard/index";
5
+ export * as ShardStore from "dfx/DiscordGateway/ShardStore/index";
6
+ //# sourceMappingURL=common-gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-gateway.js","sourceRoot":"","sources":["../src/common-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACjD,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,gCAAgC,CAAA;AACvD,OAAO,KAAK,UAAU,MAAM,qCAAqC,CAAA"}
package/dist/common.d.ts CHANGED
@@ -19,15 +19,10 @@ export * as Http from "dfx/Http/index";
19
19
  export * as Log from "dfx/Log/index";
20
20
  export * as RateLimitStore from "dfx/RateLimitStore/index";
21
21
  export * as Rest from "dfx/DiscordREST/index";
22
- export * as Gateway from "dfx/DiscordGateway/index";
23
- export * as WS from "dfx/DiscordGateway/WS/index";
24
- export * as DWS from "dfx/DiscordGateway/DiscordWS/index";
25
- export * as Shard from "dfx/DiscordGateway/Shard/index";
26
- export * as ShardStore from "dfx/DiscordGateway/ShardStore/index";
27
22
  export * as Ix from "dfx/Interactions/index";
28
23
  export * as Flags from "./Helpers/flags.js";
29
- export * as Intents from "./Helpers/intents.js";
30
24
  export * as IxHelpers from "./Helpers/interactions.js";
25
+ export * as Intents from "./Helpers/intents.js";
31
26
  export * as Members from "./Helpers/members.js";
32
27
  export * as Perms from "./Helpers/permissions.js";
33
28
  export *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BAAwB,CAAA;AACxD,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAA;AAC7C,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE5C,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/common.js CHANGED
@@ -6,15 +6,10 @@ export * as Http from "dfx/Http/index";
6
6
  export * as Log from "dfx/Log/index";
7
7
  export * as RateLimitStore from "dfx/RateLimitStore/index";
8
8
  export * as Rest from "dfx/DiscordREST/index";
9
- export * as Gateway from "dfx/DiscordGateway/index";
10
- export * as WS from "dfx/DiscordGateway/WS/index";
11
- export * as DWS from "dfx/DiscordGateway/DiscordWS/index";
12
- export * as Shard from "dfx/DiscordGateway/Shard/index";
13
- export * as ShardStore from "dfx/DiscordGateway/ShardStore/index";
14
9
  export * as Ix from "dfx/Interactions/index";
15
10
  export * as Flags from "./Helpers/flags.js";
16
- export * as Intents from "./Helpers/intents.js";
17
11
  export * as IxHelpers from "./Helpers/interactions.js";
12
+ export * as Intents from "./Helpers/intents.js";
18
13
  export * as Members from "./Helpers/members.js";
19
14
  export * as Perms from "./Helpers/permissions.js";
20
15
  export * as UI from "./Helpers/ui.js";
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKxD,OAAO,EAAW,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAWlD,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,6BAA6B,CAAA;AACjD,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,gCAAgC,CAAA;AACvD,OAAO,KAAK,UAAU,MAAM,qCAAqC,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE5C,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKxD,OAAO,EAAW,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAWlD,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAA;AAC7C,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE5C,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/global.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * @tsplus global
3
3
  */
4
- import type { Effect, EffectTypeId, Layer, Either, Maybe, Tag, Context, Cause, Chunk, Duration, Equal, Exit, HashMap, Schedule, EffectSource, EffectSink, Ref, Config, Discord, Http, Log, RateLimitStore, Rest, Gateway, WS, DWS, Shard, ShardStore, Ix, Flags, Intents, IxHelpers, Members, Perms, UI, } from "dfx/common";
4
+ import type { Effect, EffectTypeId, Layer, Either, Maybe, Tag, Context, Cause, Chunk, Duration, Equal, Exit, HashMap, Schedule, EffectSource, EffectSink, Ref, Config, Discord, Http, Log, RateLimitStore, Rest, Ix, Flags, Intents, IxHelpers, Members, Perms, UI, } from "dfx/common";
5
+ /**
6
+ * @tsplus global
7
+ */
8
+ import type { Gateway, WS, DWS, Shard, ShardStore } from "dfx/common-gateway";
5
9
  /**
6
10
  * @tsplus global
7
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,KAAK,EACL,MAAM,EACN,KAAK,EACL,GAAG,EACH,OAAO,EACP,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,GAAG,EACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,GAAG,EACH,cAAc,EACd,IAAI,EACJ,OAAO,EACP,EAAE,EACF,GAAG,EACH,KAAK,EACL,UAAU,EACV,EAAE,EACF,KAAK,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,KAAK,EACL,EAAE,GACH,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,KAAK,EACL,MAAM,EACN,KAAK,EACL,GAAG,EACH,OAAO,EACP,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,GAAG,EACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,GAAG,EACH,cAAc,EACd,IAAI,EACJ,EAAE,EACF,KAAK,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,KAAK,EACL,EAAE,GACH,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE7E;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { Config, Ix } from "dfx/common";
1
+ import { Config } from "dfx/common";
2
2
  export * as Discord from "./types.js";
3
3
  export * as Config from "./DiscordConfig/index.js";
4
4
  export * as DiscordWS from "./DiscordGateway/DiscordWS/index.js";
5
5
  export * as Gateway from "./DiscordGateway/index.js";
6
6
  export { DiscordREST, LiveDiscordREST, rest } from "./DiscordREST/index.js";
7
7
  export * as Ix from "./Interactions/index.js";
8
+ export { run as IxRunGateway } from "./Interactions/gateway.js";
8
9
  export * as Log from "./Log/index.js";
9
10
  export * as RateLimitStore from "./RateLimitStore/index.js";
10
11
  export * as Flags from "./Helpers/flags.js";
@@ -14,9 +15,8 @@ export * as Members from "./Helpers/members.js";
14
15
  export * as Perms from "./Helpers/permissions.js";
15
16
  export * as UI from "./Helpers/ui.js";
16
17
  export declare const LiveRateLimit: import("./common.js").Layer<import("./Log/index.js").Log, never, import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter>;
17
- export declare const LiveREST: import("./common.js").Layer<import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log, never, import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordREST/index.js").DiscordREST>;
18
- export declare const LiveGateway: import("./common.js").Layer<import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordREST/index.js").DiscordREST, never, import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/index.js").DiscordGateway>;
19
- export declare const LiveBot: import("./common.js").Layer<import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log, never, import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordREST/index.js").DiscordREST | import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/index.js").DiscordGateway>;
20
- export declare const makeLayer: (config: Config.MakeOpts, debug?: boolean) => import("./common.js").Layer<never, never, import("./DiscordConfig/index.js").DiscordConfig | import("./RateLimitStore/index.js").RateLimitStore | import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordREST/index.js").DiscordREST | import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/index.js").DiscordGateway>;
21
- export declare const makeWebhookLayer: (config: Config.MakeOpts & Ix.WebhookConfig, debug?: boolean) => import("./common.js").Layer<never, never, import("./DiscordConfig/index.js").DiscordConfig | import("./RateLimitStore/index.js").RateLimitStore | import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordREST/index.js").DiscordREST | import("./Interactions/webhook.js").WebhookConfig>;
18
+ export declare const LiveREST: import("./common.js").Layer<import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log, never, import("./DiscordREST/index.js").DiscordREST | import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter>;
19
+ export declare const LiveGateway: import("./common.js").Layer<import("./DiscordREST/index.js").DiscordREST | import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimiter, never, import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/index.js").DiscordGateway>;
20
+ export declare const LiveBot: import("./common.js").Layer<import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log, never, import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordREST/index.js").DiscordREST | import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/index.js").DiscordGateway>;
21
+ export declare const makeLayer: (config: Config.MakeOpts, debug?: boolean) => import("./common.js").Layer<never, never, import("./DiscordGateway/ShardStore/index.js").ShardStore | import("./DiscordREST/index.js").DiscordREST | import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter | import("./DiscordGateway/DiscordWS/index.js").DiscordWSCodec | import("./DiscordGateway/index.js").DiscordGateway>;
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAA;AAChE,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAE3D,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAErC,eAAO,MAAM,aAAa,wKACgD,CAAA;AAE1E,eAAO,MAAM,QAAQ,0QAAuC,CAAA;AAE5D,eAAO,MAAM,WAAW,qYAEI,CAAA;AAE5B,eAAO,MAAM,OAAO,0bAAyB,CAAA;AAE7C,eAAO,MAAM,SAAS,WAAY,OAAO,QAAQ,sdAMhD,CAAA;AAED,eAAO,MAAM,gBAAgB,WACnB,OAAO,QAAQ,GAAG,GAAG,aAAa,0VAS3C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAA;AAChE,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAE3D,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAErC,eAAO,MAAM,aAAa,wKACgD,CAAA;AAE1E,eAAO,MAAM,QAAQ,0QAAuC,CAAA;AAE5D,eAAO,MAAM,WAAW,qYAEI,CAAA;AAE5B,eAAO,MAAM,OAAO,0bAAyB,CAAA;AAE7C,eAAO,MAAM,SAAS,WAAY,OAAO,QAAQ,sdAMhD,CAAA"}
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import * as tsplus_module_1 from "dfx/common";
2
2
  import * as tsplus_module_2 from "@effect/io/Layer";
3
+ import * as tsplus_module_3 from "dfx/common-gateway";
3
4
  export * as Discord from "./types.js";
4
5
  export * as Config from "./DiscordConfig/index.js";
5
6
  export * as DiscordWS from "./DiscordGateway/DiscordWS/index.js";
6
7
  export * as Gateway from "./DiscordGateway/index.js";
7
8
  export { DiscordREST, LiveDiscordREST, rest } from "./DiscordREST/index.js";
8
9
  export * as Ix from "./Interactions/index.js";
10
+ export { run as IxRunGateway } from "./Interactions/gateway.js";
9
11
  export * as Log from "./Log/index.js";
10
12
  export * as RateLimitStore from "./RateLimitStore/index.js";
11
13
  export * as Flags from "./Helpers/flags.js";
@@ -16,7 +18,7 @@ export * as Perms from "./Helpers/permissions.js";
16
18
  export * as UI from "./Helpers/ui.js";
17
19
  export const LiveRateLimit = tsplus_module_2.provideToAndMerge(tsplus_module_1.RateLimitStore.LiveRateLimiter)(tsplus_module_1.RateLimitStore.LiveMemoryRateLimitStore);
18
20
  export const LiveREST = tsplus_module_2.provideToAndMerge(tsplus_module_1.Rest.LiveDiscordREST)(LiveRateLimit);
19
- export const LiveGateway = tsplus_module_2.provideToAndMerge(tsplus_module_1.Gateway.LiveDiscordGateway)(tsplus_module_2.merge(tsplus_module_1.DWS.LiveJsonDiscordWSCodec)(tsplus_module_1.ShardStore.LiveMemoryShardStore));
21
+ export const LiveGateway = tsplus_module_2.provideToAndMerge(tsplus_module_3.Gateway.LiveDiscordGateway)(tsplus_module_2.merge(tsplus_module_3.DWS.LiveJsonDiscordWSCodec)(tsplus_module_3.ShardStore.LiveMemoryShardStore));
20
22
  export const LiveBot = tsplus_module_2.provideToAndMerge(LiveGateway)(LiveREST);
21
23
  export const makeLayer = (config, debug = false) => {
22
24
  const LiveLog = debug ? tsplus_module_1.Log.LiveLogDebug : tsplus_module_1.Log.LiveLog;
@@ -24,11 +26,4 @@ export const makeLayer = (config, debug = false) => {
24
26
  const LiveEnv = tsplus_module_2.provideToAndMerge(LiveBot)(tsplus_module_2.merge(LiveConfig)(LiveLog));
25
27
  return LiveEnv;
26
28
  };
27
- export const makeWebhookLayer = (config, debug = false) => {
28
- const LiveWebhook = tsplus_module_1.Ix.makeWebhookConfig(config);
29
- const LiveLog = debug ? tsplus_module_1.Log.LiveLogDebug : tsplus_module_1.Log.LiveLog;
30
- const LiveConfig = tsplus_module_1.Config.makeLayer(config);
31
- const LiveEnv = tsplus_module_2.provideToAndMerge(LiveREST)(tsplus_module_2.merge(LiveWebhook)(tsplus_module_2.merge(LiveConfig)(LiveLog)));
32
- return LiveEnv;
33
- };
34
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAA;AAChE,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAE3D,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAErC,MAAM,CAAC,MAAM,aAAa,qCACkB,gBAAA,cAAc,CAAC,eAAe,EAAxE,gBAAA,cAAc,CAAC,wBAAwB,CAAiC,CAAA;A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KAAK,GAAG,KAAK,EAAE,EAAE;IAClE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,gBAAA,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAA,GAAG,CAAC,OAAO,CAAA;IACtD,MAAM,UAAU,GAAG,gBAAA,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,OAAO,qCAA0B,OAAO,wBAApB,UAAU,EAApB,OAAO,EAAuB,CAAA;IAE9C,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { Config, Ix } from "dfx/common";
2
+ export * as Discord from "./types.js";
3
+ export * as Config from "./DiscordConfig/index.js";
4
+ export { DiscordREST, LiveDiscordREST, rest } from "./DiscordREST/index.js";
5
+ export * as Ix from "./Interactions/index.js";
6
+ export * as Log from "./Log/index.js";
7
+ export * as RateLimitStore from "./RateLimitStore/index.js";
8
+ export * as Flags from "./Helpers/flags.js";
9
+ export * as IxHelpers from "./Helpers/interactions.js";
10
+ export * as Members from "./Helpers/members.js";
11
+ export * as Perms from "./Helpers/permissions.js";
12
+ export * as UI from "./Helpers/ui.js";
13
+ export declare const LiveRateLimit: import("./common.js").Layer<import("./Log/index.js").Log, never, import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter>;
14
+ export declare const LiveREST: import("./common.js").Layer<import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log, never, import("./DiscordREST/index.js").DiscordREST | import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter>;
15
+ export declare const makeLayer: (config: Config.MakeOpts & Ix.WebhookConfig, debug?: boolean) => import("./common.js").Layer<never, never, import("./DiscordREST/index.js").DiscordREST | import("./DiscordConfig/index.js").DiscordConfig | import("./Log/index.js").Log | import("./RateLimitStore/index.js").RateLimitStore | import("./RateLimitStore/index.js").RateLimiter | import("./Interactions/webhook.js").WebhookConfig>;
16
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAE3D,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAErC,eAAO,MAAM,aAAa,wKACgD,CAAA;AAE1E,eAAO,MAAM,QAAQ,0QAAuC,CAAA;AAE5D,eAAO,MAAM,SAAS,WACZ,OAAO,QAAQ,GAAG,GAAG,aAAa,0VAS3C,CAAA"}
@@ -0,0 +1,23 @@
1
+ import * as tsplus_module_1 from "dfx/common";
2
+ import * as tsplus_module_2 from "@effect/io/Layer";
3
+ export * as Discord from "./types.js";
4
+ export * as Config from "./DiscordConfig/index.js";
5
+ export { DiscordREST, LiveDiscordREST, rest } from "./DiscordREST/index.js";
6
+ export * as Ix from "./Interactions/index.js";
7
+ export * as Log from "./Log/index.js";
8
+ export * as RateLimitStore from "./RateLimitStore/index.js";
9
+ export * as Flags from "./Helpers/flags.js";
10
+ export * as IxHelpers from "./Helpers/interactions.js";
11
+ export * as Members from "./Helpers/members.js";
12
+ export * as Perms from "./Helpers/permissions.js";
13
+ export * as UI from "./Helpers/ui.js";
14
+ export const LiveRateLimit = tsplus_module_2.provideToAndMerge(tsplus_module_1.RateLimitStore.LiveRateLimiter)(tsplus_module_1.RateLimitStore.LiveMemoryRateLimitStore);
15
+ export const LiveREST = tsplus_module_2.provideToAndMerge(tsplus_module_1.Rest.LiveDiscordREST)(LiveRateLimit);
16
+ export const makeLayer = (config, debug = false) => {
17
+ const LiveWebhook = tsplus_module_1.Ix.makeWebhookConfig(config);
18
+ const LiveLog = debug ? tsplus_module_1.Log.LiveLogDebug : tsplus_module_1.Log.LiveLog;
19
+ const LiveConfig = tsplus_module_1.Config.makeLayer(config);
20
+ const LiveEnv = tsplus_module_2.provideToAndMerge(LiveREST)(tsplus_module_2.merge(LiveWebhook)(tsplus_module_2.merge(LiveConfig)(LiveLog)));
21
+ return LiveEnv;
22
+ };
23
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAE3D,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAErC,MAAM,CAAC,MAAM,aAAa,qCACkB,gBAAA,cAAc,CAAC,eAAe,EAAxE,gBAAA,cAAc,CAAC,wBAAwB,CAAiC,CAAA;AAE1E,MAAM,CAAC,MAAM,QAAQ,qCAAmB,gBAAA,IAAI,CAAC,eAAe,EAApC,aAAa,CAAuB,CAAA;AAE5D,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAA0C,EAC1C,KAAK,GAAG,KAAK,EACb,EAAE;IACF,MAAM,WAAW,GAAG,gBAAA,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,gBAAA,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAA,GAAG,CAAC,OAAO,CAAA;IACtD,MAAM,UAAU,GAAG,gBAAA,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,OAAO,qCAAwC,QAAQ,wBAAtB,WAAW,wBAAxB,UAAU,EAApB,OAAO,GAAsC,CAAA;IAE7D,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dfx",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,8 +23,8 @@
23
23
  "./*": "./dist/*.js"
24
24
  },
25
25
  "devDependencies": {
26
- "@effect/io": "^0.0.29",
27
- "@fp-ts/data": "^0.0.19",
26
+ "@effect/io": "^0.0.30",
27
+ "@fp-ts/data": "^0.0.20",
28
28
  "@tim-smart/discord-api-docs-parser": "^0.4.1",
29
29
  "@types/ws": "^8.5.3",
30
30
  "lerna": "^4.0.0",
@@ -46,9 +46,9 @@
46
46
  },
47
47
  "pnpm": {
48
48
  "overrides": {
49
- "@effect/io": "^0.0.28",
50
- "@fp-ts/data": "^0.0.19"
49
+ "@effect/io": "^0.0.30",
50
+ "@fp-ts/data": "^0.0.20"
51
51
  }
52
52
  },
53
- "gitHead": "e093d8df9e08c12f61c0c9046f1dcb8e0839eed3"
53
+ "gitHead": "a74b559c2509260d6e48fa62d07edb84b7d2ee07"
54
54
  }
@@ -1,5 +1,5 @@
1
- import * as D from "./definitions.js"
2
1
  import { handlers } from "./handlers.js"
2
+ import { InteractionBuilder } from "./index.js"
3
3
  import { splitDefinitions } from "./utils.js"
4
4
 
5
5
  export interface RunOpts {
@@ -7,7 +7,7 @@ export interface RunOpts {
7
7
  }
8
8
 
9
9
  export const run = <R, R2, E, E2>(
10
- definitions: D.InteractionDefinition<R, E>[],
10
+ ix: InteractionBuilder<R, E>,
11
11
  catchAll: (
12
12
  e: Http.FetchError | Http.StatusCodeError | Http.JsonParseError | E,
13
13
  ) => Effect<R2, E2, any>,
@@ -15,7 +15,7 @@ export const run = <R, R2, E, E2>(
15
15
  ) =>
16
16
  Do(($) => {
17
17
  const { GlobalApplicationCommand, GuildApplicationCommand } =
18
- splitDefinitions(definitions)
18
+ splitDefinitions(ix.definitions)
19
19
 
20
20
  const application = $(
21
21
  Rest.rest.getCurrentBotApplicationInformation().flatMap((a) => a.json),
@@ -38,7 +38,7 @@ export const run = <R, R2, E, E2>(
38
38
  )
39
39
  : Effect.unit()
40
40
 
41
- const handle = handlers(definitions)
41
+ const handle = handlers(ix.definitions)
42
42
 
43
43
  const run = Gateway.handleDispatch("INTERACTION_CREATE", (i) =>
44
44
  handle[i.type](i)
@@ -1,6 +1,4 @@
1
1
  import * as D from "./definitions.js"
2
- import * as Gateway from "./gateway.js"
3
- import * as Webhook from "./webhook.js"
4
2
 
5
3
  export * from "./context.js"
6
4
 
@@ -16,20 +14,13 @@ export {
16
14
 
17
15
  export {
18
16
  makeConfig as makeWebhookConfig,
17
+ makeHandler as makeWebhookHandler,
19
18
  WebhookConfig,
20
19
  WebhookParseError,
21
20
  BadWebhookSignature,
22
21
  } from "./webhook.js"
23
22
 
24
- export interface HandleWebhookOpts<E> {
25
- headers: Webhook.Headers
26
- body: string
27
- success: (a: Discord.InteractionResponse) => Effect<never, never, void>
28
- error: (e: Cause<E>) => Effect<never, never, void>
29
- empty: Effect<never, never, void>
30
- }
31
-
32
- class InteractionBuilder<R, E> {
23
+ export class InteractionBuilder<R, E> {
33
24
  constructor(readonly definitions: D.InteractionDefinition<R, E>[]) {}
34
25
 
35
26
  add<R1, E1>(definition: D.InteractionDefinition<R1, E1>) {
@@ -39,34 +30,6 @@ class InteractionBuilder<R, E> {
39
30
  ])
40
31
  }
41
32
 
42
- runGateway<R2, E2>(
43
- catchAll: (
44
- e: E | Http.FetchError | Http.StatusCodeError | Http.JsonParseError,
45
- ) => Effect<R2, E2, any>,
46
- opts: Gateway.RunOpts = {},
47
- ) {
48
- return Gateway.run<R, R2, E, E2>(this.definitions, catchAll, opts)
49
- }
50
-
51
- handleWebhook({
52
- headers,
53
- body,
54
- success,
55
- empty,
56
- error,
57
- }: HandleWebhookOpts<
58
- E | Webhook.WebhookParseError | Webhook.BadWebhookSignature
59
- >) {
60
- return Webhook.run(this.definitions, headers, body)
61
- .flatMap((o) =>
62
- o.match(
63
- () => empty,
64
- (a) => success(a),
65
- ),
66
- )
67
- .catchAllCause(error)
68
- }
69
-
70
33
  get syncGlobal() {
71
34
  const commands = this.definitions
72
35
  .filter(
@@ -13,7 +13,13 @@ export const splitDefinitions = <R, E>(
13
13
  ...acc,
14
14
  [a._tag]: [...(acc[a._tag] ?? []), a],
15
15
  }),
16
- {} as any,
16
+ {
17
+ Autocomplete: [],
18
+ GlobalApplicationCommand: [],
19
+ GuildApplicationCommand: [],
20
+ MessageComponent: [],
21
+ ModalSubmit: [],
22
+ },
17
23
  )
18
24
 
19
25
  const Commands = [
@@ -1,6 +1,7 @@
1
1
  import Nacl from "tweetnacl"
2
2
  import * as D from "./definitions.js"
3
3
  import { handlers } from "./handlers.js"
4
+ import { InteractionBuilder } from "./index.js"
4
5
 
5
6
  export class BadWebhookSignature {
6
7
  readonly _tag = "BadWebhookSignature"
@@ -46,12 +47,39 @@ const fromHeadersAndBody = (headers: Headers, body: string) =>
46
47
  )
47
48
  })
48
49
 
49
- export const run = <R, E>(
50
- definitions: D.InteractionDefinition<R, E>[],
51
- headers: Headers,
52
- body: string,
53
- ) =>
54
- Do(($) => {
55
- const interaction = $(fromHeadersAndBody(headers, body))
56
- return $(handlers(definitions)[interaction.type](interaction))
57
- })
50
+ const run = <R, E>(definitions: D.InteractionDefinition<R, E>[]) => {
51
+ const handler = handlers(definitions)
52
+ return (headers: Headers, body: string) =>
53
+ Do(($) => {
54
+ const interaction = $(fromHeadersAndBody(headers, body))
55
+ return $(handler[interaction.type](interaction))
56
+ })
57
+ }
58
+
59
+ export interface HandleWebhookOpts<E> {
60
+ headers: Headers
61
+ body: string
62
+ success: (a: Discord.InteractionResponse) => Effect<never, never, void>
63
+ error: (e: Cause<E>) => Effect<never, never, void>
64
+ empty: Effect<never, never, void>
65
+ }
66
+
67
+ export const makeHandler = <R, E>(ix: InteractionBuilder<R, E>) => {
68
+ const handle = run(ix.definitions)
69
+
70
+ return ({
71
+ headers,
72
+ body,
73
+ success,
74
+ empty,
75
+ error,
76
+ }: HandleWebhookOpts<E | WebhookParseError | BadWebhookSignature>) =>
77
+ handle(headers, body)
78
+ .flatMap((o) =>
79
+ o.match(
80
+ () => empty,
81
+ (a) => success(a),
82
+ ),
83
+ )
84
+ .catchAllCause(error)
85
+ }
@@ -0,0 +1,5 @@
1
+ export * as Gateway from "dfx/DiscordGateway/index"
2
+ export * as WS from "dfx/DiscordGateway/WS/index"
3
+ export * as DWS from "dfx/DiscordGateway/DiscordWS/index"
4
+ export * as Shard from "dfx/DiscordGateway/Shard/index"
5
+ export * as ShardStore from "dfx/DiscordGateway/ShardStore/index"
package/src/common.ts CHANGED
@@ -20,16 +20,11 @@ export * as Http from "dfx/Http/index"
20
20
  export * as Log from "dfx/Log/index"
21
21
  export * as RateLimitStore from "dfx/RateLimitStore/index"
22
22
  export * as Rest from "dfx/DiscordREST/index"
23
- export * as Gateway from "dfx/DiscordGateway/index"
24
- export * as WS from "dfx/DiscordGateway/WS/index"
25
- export * as DWS from "dfx/DiscordGateway/DiscordWS/index"
26
- export * as Shard from "dfx/DiscordGateway/Shard/index"
27
- export * as ShardStore from "dfx/DiscordGateway/ShardStore/index"
28
23
  export * as Ix from "dfx/Interactions/index"
29
24
 
30
25
  export * as Flags from "./Helpers/flags.js"
31
- export * as Intents from "./Helpers/intents.js"
32
26
  export * as IxHelpers from "./Helpers/interactions.js"
27
+ export * as Intents from "./Helpers/intents.js"
33
28
  export * as Members from "./Helpers/members.js"
34
29
  export * as Perms from "./Helpers/permissions.js"
35
30
  export * as UI from "./Helpers/ui.js"
package/src/global.ts CHANGED
@@ -25,11 +25,6 @@ import type {
25
25
  Log,
26
26
  RateLimitStore,
27
27
  Rest,
28
- Gateway,
29
- WS,
30
- DWS,
31
- Shard,
32
- ShardStore,
33
28
  Ix,
34
29
  Flags,
35
30
  Intents,
@@ -39,6 +34,11 @@ import type {
39
34
  UI,
40
35
  } from "dfx/common"
41
36
 
37
+ /**
38
+ * @tsplus global
39
+ */
40
+ import type { Gateway, WS, DWS, Shard, ShardStore } from "dfx/common-gateway"
41
+
42
42
  /**
43
43
  * @tsplus global
44
44
  */
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ export * as DiscordWS from "./DiscordGateway/DiscordWS/index.js"
5
5
  export * as Gateway from "./DiscordGateway/index.js"
6
6
  export { DiscordREST, LiveDiscordREST, rest } from "./DiscordREST/index.js"
7
7
  export * as Ix from "./Interactions/index.js"
8
+ export { run as IxRunGateway } from "./Interactions/gateway.js"
8
9
  export * as Log from "./Log/index.js"
9
10
  export * as RateLimitStore from "./RateLimitStore/index.js"
10
11
 
@@ -33,15 +34,3 @@ export const makeLayer = (config: Config.MakeOpts, debug = false) => {
33
34
 
34
35
  return LiveEnv
35
36
  }
36
-
37
- export const makeWebhookLayer = (
38
- config: Config.MakeOpts & Ix.WebhookConfig,
39
- debug = false,
40
- ) => {
41
- const LiveWebhook = Ix.makeWebhookConfig(config)
42
- const LiveLog = debug ? Log.LiveLogDebug : Log.LiveLog
43
- const LiveConfig = Config.makeLayer(config)
44
- const LiveEnv = LiveLog + LiveConfig + LiveWebhook > LiveREST
45
-
46
- return LiveEnv
47
- }