dfx 0.126.1 → 1.0.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 (342) hide show
  1. package/.babel.cjs.json +11 -0
  2. package/.babel.mjs.json +10 -0
  3. package/.envrc +1 -0
  4. package/.gitmodules +3 -0
  5. package/.husky/pre-commit +2 -0
  6. package/.oxlintrc.json +72 -0
  7. package/.prettierignore +0 -0
  8. package/.prettierrc.json +5 -0
  9. package/.tool-versions +1 -0
  10. package/.vscode/debug.cjs +8 -0
  11. package/.vscode/launch.json +23 -0
  12. package/.vscode/settings.json +29 -0
  13. package/.vscode/tasks.json +44 -0
  14. package/AGENTS.md +15 -0
  15. package/CHANGELOG.md +1554 -0
  16. package/examples/.env.example +5 -0
  17. package/examples/interactions.ts +79 -0
  18. package/examples/readme.ts +56 -0
  19. package/examples/registry.ts +66 -0
  20. package/flake.lock +27 -0
  21. package/flake.nix +21 -0
  22. package/lerna.json +12 -0
  23. package/package.json +79 -36
  24. package/pnpm-workspace.yaml +7 -0
  25. package/scripts/generate-client.sh +10 -0
  26. package/scripts/worktree-setup.sh +8 -0
  27. package/src/Cache/memory.ts +5 -5
  28. package/src/Cache/memoryTTL.ts +11 -7
  29. package/src/Cache/prelude.ts +10 -8
  30. package/src/Cache.ts +31 -35
  31. package/src/DiscordConfig.ts +12 -16
  32. package/src/DiscordGateway/DiscordWS.ts +58 -32
  33. package/src/DiscordGateway/Messaging.ts +13 -15
  34. package/src/DiscordGateway/Shard/StateStore.ts +30 -25
  35. package/src/DiscordGateway/Shard/heartbeats.ts +25 -28
  36. package/src/DiscordGateway/Shard/identify.ts +11 -6
  37. package/src/DiscordGateway/Shard/sendEvents.ts +1 -1
  38. package/src/DiscordGateway/Shard/utils.ts +1 -1
  39. package/src/DiscordGateway/Shard.ts +39 -35
  40. package/src/DiscordGateway/ShardStore.ts +6 -7
  41. package/src/DiscordGateway/Sharder.ts +31 -29
  42. package/src/DiscordGateway.ts +15 -14
  43. package/src/DiscordREST/Generated.ts +660 -341
  44. package/src/DiscordREST/utils.ts +6 -3
  45. package/src/DiscordREST.ts +37 -41
  46. package/src/Helpers/flags.ts +10 -5
  47. package/src/Helpers/intents.ts +2 -2
  48. package/src/Helpers/interactions.ts +16 -14
  49. package/src/Helpers/members.ts +3 -3
  50. package/src/Helpers/permissions.ts +5 -5
  51. package/src/Helpers/ui.ts +16 -16
  52. package/src/Interactions/builder.ts +10 -10
  53. package/src/Interactions/commandHelper.ts +18 -29
  54. package/src/Interactions/context.ts +51 -65
  55. package/src/Interactions/definitions.ts +3 -3
  56. package/src/Interactions/gateway.ts +33 -45
  57. package/src/Interactions/handlers.ts +8 -5
  58. package/src/Interactions/index.ts +5 -5
  59. package/src/Interactions/utils.ts +6 -6
  60. package/src/Interactions/webhook.ts +31 -38
  61. package/src/RateLimit/memory.ts +3 -3
  62. package/src/RateLimit.ts +18 -15
  63. package/src/gateway.ts +21 -21
  64. package/src/index.ts +17 -17
  65. package/src/types.ts +18 -16
  66. package/src/utils/Effect.ts +38 -27
  67. package/src/webhooks.ts +7 -7
  68. package/test/index.test.ts +5 -0
  69. package/tsconfig.base.json +12 -6
  70. package/tsconfig.examples.json +0 -1
  71. package/vitest.config.ts +22 -0
  72. package/Cache/driver.d.ts +0 -24
  73. package/Cache/driver.d.ts.map +0 -1
  74. package/Cache/driver.js +0 -11
  75. package/Cache/driver.js.map +0 -1
  76. package/Cache/memory.d.ts +0 -5
  77. package/Cache/memory.d.ts.map +0 -1
  78. package/Cache/memory.js +0 -57
  79. package/Cache/memory.js.map +0 -1
  80. package/Cache/memoryTTL.d.ts +0 -23
  81. package/Cache/memoryTTL.d.ts.map +0 -1
  82. package/Cache/memoryTTL.js +0 -128
  83. package/Cache/memoryTTL.js.map +0 -1
  84. package/Cache/prelude.d.ts +0 -32
  85. package/Cache/prelude.d.ts.map +0 -1
  86. package/Cache/prelude.js +0 -143
  87. package/Cache/prelude.js.map +0 -1
  88. package/Cache.d.ts +0 -82
  89. package/Cache.d.ts.map +0 -1
  90. package/Cache.js +0 -144
  91. package/Cache.js.map +0 -1
  92. package/DiscordConfig.d.ts +0 -35
  93. package/DiscordConfig.d.ts.map +0 -1
  94. package/DiscordConfig.js +0 -42
  95. package/DiscordConfig.js.map +0 -1
  96. package/DiscordGateway/DiscordWS.d.ts +0 -37
  97. package/DiscordGateway/DiscordWS.d.ts.map +0 -1
  98. package/DiscordGateway/DiscordWS.js +0 -73
  99. package/DiscordGateway/DiscordWS.js.map +0 -1
  100. package/DiscordGateway/Messaging.d.ts +0 -393
  101. package/DiscordGateway/Messaging.d.ts.map +0 -1
  102. package/DiscordGateway/Messaging.js +0 -40
  103. package/DiscordGateway/Messaging.js.map +0 -1
  104. package/DiscordGateway/Shard/StateStore.d.ts +0 -24
  105. package/DiscordGateway/Shard/StateStore.d.ts.map +0 -1
  106. package/DiscordGateway/Shard/StateStore.js +0 -48
  107. package/DiscordGateway/Shard/StateStore.js.map +0 -1
  108. package/DiscordGateway/Shard/heartbeats.d.ts +0 -8
  109. package/DiscordGateway/Shard/heartbeats.d.ts.map +0 -1
  110. package/DiscordGateway/Shard/heartbeats.js +0 -28
  111. package/DiscordGateway/Shard/heartbeats.js.map +0 -1
  112. package/DiscordGateway/Shard/identify.d.ts +0 -12
  113. package/DiscordGateway/Shard/identify.d.ts.map +0 -1
  114. package/DiscordGateway/Shard/identify.js +0 -38
  115. package/DiscordGateway/Shard/identify.js.map +0 -1
  116. package/DiscordGateway/Shard/sendEvents.d.ts +0 -8
  117. package/DiscordGateway/Shard/sendEvents.d.ts.map +0 -1
  118. package/DiscordGateway/Shard/sendEvents.js +0 -39
  119. package/DiscordGateway/Shard/sendEvents.js.map +0 -1
  120. package/DiscordGateway/Shard/utils.d.ts +0 -6
  121. package/DiscordGateway/Shard/utils.d.ts.map +0 -1
  122. package/DiscordGateway/Shard/utils.js +0 -11
  123. package/DiscordGateway/Shard/utils.js.map +0 -1
  124. package/DiscordGateway/Shard.d.ts +0 -28
  125. package/DiscordGateway/Shard.d.ts.map +0 -1
  126. package/DiscordGateway/Shard.js +0 -149
  127. package/DiscordGateway/Shard.js.map +0 -1
  128. package/DiscordGateway/ShardStore.d.ts +0 -18
  129. package/DiscordGateway/ShardStore.d.ts.map +0 -1
  130. package/DiscordGateway/ShardStore.js +0 -31
  131. package/DiscordGateway/ShardStore.js.map +0 -1
  132. package/DiscordGateway/Sharder.d.ts +0 -13
  133. package/DiscordGateway/Sharder.d.ts.map +0 -1
  134. package/DiscordGateway/Sharder.js +0 -73
  135. package/DiscordGateway/Sharder.js.map +0 -1
  136. package/DiscordGateway.d.ts +0 -32
  137. package/DiscordGateway.d.ts.map +0 -1
  138. package/DiscordGateway.js +0 -28
  139. package/DiscordGateway.js.map +0 -1
  140. package/DiscordREST/Generated.d.ts +0 -5399
  141. package/DiscordREST/Generated.d.ts.map +0 -1
  142. package/DiscordREST/Generated.js +0 -2405
  143. package/DiscordREST/Generated.js.map +0 -1
  144. package/DiscordREST/utils.d.ts +0 -14
  145. package/DiscordREST/utils.d.ts.map +0 -1
  146. package/DiscordREST/utils.js +0 -31
  147. package/DiscordREST/utils.js.map +0 -1
  148. package/DiscordREST.d.ts +0 -23
  149. package/DiscordREST.d.ts.map +0 -1
  150. package/DiscordREST.js +0 -132
  151. package/DiscordREST.js.map +0 -1
  152. package/Helpers/flags.d.ts +0 -28
  153. package/Helpers/flags.d.ts.map +0 -1
  154. package/Helpers/flags.js +0 -48
  155. package/Helpers/flags.js.map +0 -1
  156. package/Helpers/intents.d.ts +0 -25
  157. package/Helpers/intents.d.ts.map +0 -1
  158. package/Helpers/intents.js +0 -34
  159. package/Helpers/intents.js.map +0 -1
  160. package/Helpers/interactions.d.ts +0 -116
  161. package/Helpers/interactions.d.ts.map +0 -1
  162. package/Helpers/interactions.js +0 -143
  163. package/Helpers/interactions.js.map +0 -1
  164. package/Helpers/members.d.ts +0 -10
  165. package/Helpers/members.d.ts.map +0 -1
  166. package/Helpers/members.js +0 -17
  167. package/Helpers/members.js.map +0 -1
  168. package/Helpers/permissions.d.ts +0 -42
  169. package/Helpers/permissions.d.ts.map +0 -1
  170. package/Helpers/permissions.js +0 -97
  171. package/Helpers/permissions.js.map +0 -1
  172. package/Helpers/ui.d.ts +0 -105
  173. package/Helpers/ui.d.ts.map +0 -1
  174. package/Helpers/ui.js +0 -162
  175. package/Helpers/ui.js.map +0 -1
  176. package/Interactions/builder.d.ts +0 -48
  177. package/Interactions/builder.d.ts.map +0 -1
  178. package/Interactions/builder.js +0 -64
  179. package/Interactions/builder.js.map +0 -1
  180. package/Interactions/commandHelper.d.ts +0 -99
  181. package/Interactions/commandHelper.d.ts.map +0 -1
  182. package/Interactions/commandHelper.js +0 -53
  183. package/Interactions/commandHelper.js.map +0 -1
  184. package/Interactions/context.d.ts +0 -54
  185. package/Interactions/context.d.ts.map +0 -1
  186. package/Interactions/context.js +0 -42
  187. package/Interactions/context.js.map +0 -1
  188. package/Interactions/definitions.d.ts +0 -44
  189. package/Interactions/definitions.d.ts.map +0 -1
  190. package/Interactions/definitions.js +0 -67
  191. package/Interactions/definitions.js.map +0 -1
  192. package/Interactions/error.d.ts +0 -2
  193. package/Interactions/error.d.ts.map +0 -1
  194. package/Interactions/error.js +0 -8
  195. package/Interactions/error.js.map +0 -1
  196. package/Interactions/gateway.d.ts +0 -21
  197. package/Interactions/gateway.d.ts.map +0 -1
  198. package/Interactions/gateway.js +0 -90
  199. package/Interactions/gateway.js.map +0 -1
  200. package/Interactions/handlers.d.ts +0 -15
  201. package/Interactions/handlers.d.ts.map +0 -1
  202. package/Interactions/handlers.js +0 -72
  203. package/Interactions/handlers.js.map +0 -1
  204. package/Interactions/index.d.ts +0 -16
  205. package/Interactions/index.d.ts.map +0 -1
  206. package/Interactions/index.js +0 -94
  207. package/Interactions/index.js.map +0 -1
  208. package/Interactions/utils.d.ts +0 -61
  209. package/Interactions/utils.d.ts.map +0 -1
  210. package/Interactions/utils.js +0 -35
  211. package/Interactions/utils.js.map +0 -1
  212. package/Interactions/webhook.d.ts +0 -73
  213. package/Interactions/webhook.d.ts.map +0 -1
  214. package/Interactions/webhook.js +0 -89
  215. package/Interactions/webhook.js.map +0 -1
  216. package/RateLimit/memory.d.ts +0 -3
  217. package/RateLimit/memory.d.ts.map +0 -1
  218. package/RateLimit/memory.js +0 -47
  219. package/RateLimit/memory.js.map +0 -1
  220. package/RateLimit/utils.d.ts +0 -3
  221. package/RateLimit/utils.d.ts.map +0 -1
  222. package/RateLimit/utils.js +0 -25
  223. package/RateLimit/utils.js.map +0 -1
  224. package/RateLimit.d.ts +0 -30
  225. package/RateLimit.d.ts.map +0 -1
  226. package/RateLimit.js +0 -35
  227. package/RateLimit.js.map +0 -1
  228. package/gateway.d.ts +0 -19
  229. package/gateway.d.ts.map +0 -1
  230. package/gateway.js +0 -72
  231. package/gateway.js.map +0 -1
  232. package/index.d.ts +0 -18
  233. package/index.d.ts.map +0 -1
  234. package/index.js +0 -71
  235. package/index.js.map +0 -1
  236. package/mjs/Cache/driver.mjs +0 -3
  237. package/mjs/Cache/driver.mjs.map +0 -1
  238. package/mjs/Cache/memory.mjs +0 -48
  239. package/mjs/Cache/memory.mjs.map +0 -1
  240. package/mjs/Cache/memoryTTL.mjs +0 -119
  241. package/mjs/Cache/memoryTTL.mjs.map +0 -1
  242. package/mjs/Cache/prelude.mjs +0 -131
  243. package/mjs/Cache/prelude.mjs.map +0 -1
  244. package/mjs/Cache.mjs +0 -89
  245. package/mjs/Cache.mjs.map +0 -1
  246. package/mjs/DiscordConfig.mjs +0 -32
  247. package/mjs/DiscordConfig.mjs.map +0 -1
  248. package/mjs/DiscordGateway/DiscordWS.mjs +0 -66
  249. package/mjs/DiscordGateway/DiscordWS.mjs.map +0 -1
  250. package/mjs/DiscordGateway/Messaging.mjs +0 -33
  251. package/mjs/DiscordGateway/Messaging.mjs.map +0 -1
  252. package/mjs/DiscordGateway/Shard/StateStore.mjs +0 -40
  253. package/mjs/DiscordGateway/Shard/StateStore.mjs.map +0 -1
  254. package/mjs/DiscordGateway/Shard/heartbeats.mjs +0 -20
  255. package/mjs/DiscordGateway/Shard/heartbeats.mjs.map +0 -1
  256. package/mjs/DiscordGateway/Shard/identify.mjs +0 -30
  257. package/mjs/DiscordGateway/Shard/identify.mjs.map +0 -1
  258. package/mjs/DiscordGateway/Shard/sendEvents.mjs +0 -26
  259. package/mjs/DiscordGateway/Shard/sendEvents.mjs.map +0 -1
  260. package/mjs/DiscordGateway/Shard/utils.mjs +0 -3
  261. package/mjs/DiscordGateway/Shard/utils.mjs.map +0 -1
  262. package/mjs/DiscordGateway/Shard.mjs +0 -142
  263. package/mjs/DiscordGateway/Shard.mjs.map +0 -1
  264. package/mjs/DiscordGateway/ShardStore.mjs +0 -24
  265. package/mjs/DiscordGateway/ShardStore.mjs.map +0 -1
  266. package/mjs/DiscordGateway/Sharder.mjs +0 -66
  267. package/mjs/DiscordGateway/Sharder.mjs.map +0 -1
  268. package/mjs/DiscordGateway.mjs +0 -21
  269. package/mjs/DiscordGateway.mjs.map +0 -1
  270. package/mjs/DiscordREST/Generated.mjs +0 -2396
  271. package/mjs/DiscordREST/Generated.mjs.map +0 -1
  272. package/mjs/DiscordREST/utils.mjs +0 -20
  273. package/mjs/DiscordREST/utils.mjs.map +0 -1
  274. package/mjs/DiscordREST.mjs +0 -124
  275. package/mjs/DiscordREST.mjs.map +0 -1
  276. package/mjs/Helpers/flags.mjs +0 -36
  277. package/mjs/Helpers/flags.mjs.map +0 -1
  278. package/mjs/Helpers/intents.mjs +0 -27
  279. package/mjs/Helpers/intents.mjs.map +0 -1
  280. package/mjs/Helpers/interactions.mjs +0 -115
  281. package/mjs/Helpers/interactions.mjs.map +0 -1
  282. package/mjs/Helpers/members.mjs +0 -9
  283. package/mjs/Helpers/members.mjs.map +0 -1
  284. package/mjs/Helpers/permissions.mjs +0 -84
  285. package/mjs/Helpers/permissions.mjs.map +0 -1
  286. package/mjs/Helpers/ui.mjs +0 -137
  287. package/mjs/Helpers/ui.mjs.map +0 -1
  288. package/mjs/Interactions/builder.mjs +0 -56
  289. package/mjs/Interactions/builder.mjs.map +0 -1
  290. package/mjs/Interactions/commandHelper.mjs +0 -45
  291. package/mjs/Interactions/commandHelper.mjs.map +0 -1
  292. package/mjs/Interactions/context.mjs +0 -29
  293. package/mjs/Interactions/context.mjs.map +0 -1
  294. package/mjs/Interactions/definitions.mjs +0 -51
  295. package/mjs/Interactions/definitions.mjs.map +0 -1
  296. package/mjs/Interactions/error.mjs +0 -2
  297. package/mjs/Interactions/error.mjs.map +0 -1
  298. package/mjs/Interactions/gateway.mjs +0 -81
  299. package/mjs/Interactions/gateway.mjs.map +0 -1
  300. package/mjs/Interactions/handlers.mjs +0 -63
  301. package/mjs/Interactions/handlers.mjs.map +0 -1
  302. package/mjs/Interactions/index.mjs +0 -11
  303. package/mjs/Interactions/index.mjs.map +0 -1
  304. package/mjs/Interactions/utils.mjs +0 -26
  305. package/mjs/Interactions/utils.mjs.map +0 -1
  306. package/mjs/Interactions/webhook.mjs +0 -76
  307. package/mjs/Interactions/webhook.mjs.map +0 -1
  308. package/mjs/RateLimit/memory.mjs +0 -39
  309. package/mjs/RateLimit/memory.mjs.map +0 -1
  310. package/mjs/RateLimit/utils.mjs +0 -18
  311. package/mjs/RateLimit/utils.mjs.map +0 -1
  312. package/mjs/RateLimit.mjs +0 -28
  313. package/mjs/RateLimit.mjs.map +0 -1
  314. package/mjs/gateway.mjs +0 -19
  315. package/mjs/gateway.mjs.map +0 -1
  316. package/mjs/index.mjs +0 -18
  317. package/mjs/index.mjs.map +0 -1
  318. package/mjs/types.mjs +0 -356
  319. package/mjs/types.mjs.map +0 -1
  320. package/mjs/utils/Effect.mjs +0 -18
  321. package/mjs/utils/Effect.mjs.map +0 -1
  322. package/mjs/version.mjs +0 -2
  323. package/mjs/version.mjs.map +0 -1
  324. package/mjs/webhooks.mjs +0 -6
  325. package/mjs/webhooks.mjs.map +0 -1
  326. package/src/version.ts +0 -1
  327. package/types.d.ts +0 -2457
  328. package/types.d.ts.map +0 -1
  329. package/types.js +0 -408
  330. package/types.js.map +0 -1
  331. package/utils/Effect.d.ts +0 -5
  332. package/utils/Effect.d.ts.map +0 -1
  333. package/utils/Effect.js +0 -27
  334. package/utils/Effect.js.map +0 -1
  335. package/version.d.ts +0 -2
  336. package/version.d.ts.map +0 -1
  337. package/version.js +0 -8
  338. package/version.js.map +0 -1
  339. package/webhooks.d.ts +0 -8
  340. package/webhooks.d.ts.map +0 -1
  341. package/webhooks.js +0 -55
  342. package/webhooks.js.map +0 -1
@@ -1,75 +1,56 @@
1
- import { TypeIdError } from "@effect/platform/Error"
2
- import * as IxHelpers from "dfx/Helpers/interactions"
3
- import { InteractionsErrorTypeId } from "dfx/Interactions/error"
4
- import type * as Discord from "dfx/types"
5
- import type { NoSuchElementException } from "effect/Cause"
6
- import { GenericTag } from "effect/Context"
1
+ import * as IxHelpers from "../Helpers/interactions.ts"
2
+ import type * as Discord from "../types.ts"
3
+ import type { NoSuchElementError } from "effect/Cause"
4
+ import * as Data from "effect/Data"
7
5
  import * as Effect from "effect/Effect"
8
- // @ts-ignore
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- import * as Types from "effect/Types"
6
+ import * as ServiceMap from "effect/ServiceMap"
11
7
 
12
- export interface DiscordInteraction {
13
- readonly _: unique symbol
14
- }
15
- export const Interaction = GenericTag<
16
- DiscordInteraction,
8
+ export class Interaction extends ServiceMap.Service<
9
+ Interaction,
17
10
  Discord.APIInteraction
18
- >("dfx/Interactions/Interaction")
11
+ >()("dfx/Interactions/Interaction") {}
12
+ export type DiscordInteraction = Interaction
19
13
 
20
- export interface DiscordApplicationCommand {
21
- readonly _: unique symbol
22
- }
23
- export const ApplicationCommand = GenericTag<
24
- DiscordApplicationCommand,
14
+ export class ApplicationCommand extends ServiceMap.Service<
15
+ ApplicationCommand,
25
16
  Discord.APIApplicationCommandInteraction["data"]
26
- >("dfx/Interactions/ApplicationCommand")
17
+ >()("dfx/Interactions/ApplicationCommand") {}
18
+ export type DiscordApplicationCommand = ApplicationCommand
27
19
 
28
- export interface DiscordMessageComponent {
29
- readonly _: unique symbol
30
- }
31
- export const MessageComponentData = GenericTag<
32
- DiscordMessageComponent,
20
+ export class MessageComponentData extends ServiceMap.Service<
21
+ MessageComponentData,
33
22
  Discord.APIMessageComponentInteractionData
34
- >("dfx/Interactions/MessageComponentData")
23
+ >()("dfx/Interactions/MessageComponentData") {}
24
+ export type DiscordMessageComponent = MessageComponentData
35
25
 
36
- export interface DiscordModalSubmit {
37
- readonly _: unique symbol
38
- }
39
- export const ModalSubmitData = GenericTag<
40
- DiscordModalSubmit,
26
+ export class ModalSubmitData extends ServiceMap.Service<
27
+ ModalSubmitData,
41
28
  Discord.APIModalSubmission
42
- >("dfx/Interactions/ModalSubmitData")
29
+ >()("dfx/Interactions/ModalSubmitData") {}
30
+ export type DiscordModalSubmit = ModalSubmitData
43
31
 
44
- export interface DiscordFocusedOption {
45
- readonly _: unique symbol
46
- }
47
- export const FocusedOptionContext = GenericTag<
48
- DiscordFocusedOption,
32
+ export class FocusedOptionContext extends ServiceMap.Service<
33
+ FocusedOptionContext,
49
34
  Discord.APIApplicationCommandInteractionDataOption
50
- >("dfx/Interactions/FocusedOptionContext")
35
+ >()("dfx/Interactions/FocusedOptionContext") {}
36
+ export type DiscordFocusedOption = FocusedOptionContext
51
37
 
52
- export interface DiscordSubCommand {
53
- readonly _: unique symbol
54
- }
55
- export interface SubCommandContext {
38
+ export interface SubCommandContextData {
56
39
  readonly command: Discord.APIApplicationCommandInteractionDataSubcommandOption
57
40
  }
58
- export const SubCommandContext = GenericTag<
59
- DiscordSubCommand,
60
- SubCommandContext
61
- >("dfx/Interactions/SubCommandContext")
41
+ export class SubCommandContext extends ServiceMap.Service<
42
+ SubCommandContext,
43
+ SubCommandContextData
44
+ >()("dfx/Interactions/SubCommandContext") {}
45
+ export type DiscordSubCommand = SubCommandContext
62
46
 
63
47
  export const resolvedValues = <A>(
64
48
  f: (
65
49
  id: Discord.Snowflake,
66
50
  data: Discord.InteractionDataResolved,
67
51
  ) => A | undefined,
68
- ): Effect.Effect<
69
- ReadonlyArray<A>,
70
- NoSuchElementException,
71
- DiscordInteraction
72
- > => Effect.flatMap(Interaction, ix => IxHelpers.resolveValues(f)(ix))
52
+ ): Effect.Effect<ReadonlyArray<A>, NoSuchElementError, DiscordInteraction> =>
53
+ Interaction.use(ix => Effect.fromOption(IxHelpers.resolveValues(f)(ix)))
73
54
 
74
55
  export const resolved = <A>(
75
56
  name: string,
@@ -77,17 +58,16 @@ export const resolved = <A>(
77
58
  id: Discord.Snowflake,
78
59
  data: Discord.InteractionDataResolved,
79
60
  ) => A | undefined,
80
- ): Effect.Effect<A, NoSuchElementException, DiscordInteraction> =>
81
- Effect.flatMap(Interaction, ix => IxHelpers.resolveOptionValue(name, f)(ix))
61
+ ): Effect.Effect<A, NoSuchElementError, DiscordInteraction> =>
62
+ Interaction.use(ix =>
63
+ Effect.fromOption(IxHelpers.resolveOptionValue(name, f)(ix)),
64
+ )
82
65
 
83
- export const focusedOptionValue = Effect.map(FocusedOptionContext, _ =>
84
- "value" in _ ? _.value : "",
66
+ export const focusedOptionValue = FocusedOptionContext.use(_ =>
67
+ Effect.succeed("value" in _ ? _.value : ""),
85
68
  )
86
69
 
87
- export class SubCommandNotFound extends TypeIdError(
88
- InteractionsErrorTypeId,
89
- "SubCommandNotFound",
90
- )<{
70
+ export class SubCommandNotFound extends Data.TaggedError("SubCommandNotFound")<{
91
71
  data: Discord.APIApplicationCommandInteraction["data"]
92
72
  }> {}
93
73
 
@@ -95,7 +75,7 @@ export const currentSubCommand: Effect.Effect<
95
75
  Discord.APIApplicationCommandInteractionDataSubcommandOption,
96
76
  never,
97
77
  DiscordSubCommand
98
- > = Effect.map(SubCommandContext, _ => _.command)
78
+ > = SubCommandContext.use(_ => Effect.succeed(_.command))
99
79
 
100
80
  export class RequiredOptionNotFound {
101
81
  readonly _tag = "RequiredOptionNotFound"
@@ -107,12 +87,18 @@ export class RequiredOptionNotFound {
107
87
  ) {}
108
88
  }
109
89
 
110
- export const modalValues = Effect.map(ModalSubmitData, IxHelpers.componentsMap)
90
+ export const modalValues = ModalSubmitData.use(data =>
91
+ Effect.succeed(IxHelpers.componentsMap(data)),
92
+ )
111
93
 
112
94
  export const modalValueOption = (name: string) =>
113
- Effect.map(ModalSubmitData, IxHelpers.componentValue(name))
95
+ ModalSubmitData.use(data =>
96
+ Effect.succeed(IxHelpers.componentValue(name)(data)),
97
+ )
114
98
 
115
99
  export const modalValue = (
116
100
  name: string,
117
- ): Effect.Effect<string, NoSuchElementException, DiscordModalSubmit> =>
118
- Effect.flatMap(ModalSubmitData, data => IxHelpers.componentValue(name)(data))
101
+ ): Effect.Effect<string, NoSuchElementError, DiscordModalSubmit> =>
102
+ ModalSubmitData.use(data =>
103
+ Effect.fromOption(IxHelpers.componentValue(name)(data)),
104
+ )
@@ -5,10 +5,10 @@ import type {
5
5
  DiscordInteraction,
6
6
  DiscordMessageComponent,
7
7
  DiscordModalSubmit,
8
- } from "dfx/Interactions/context"
9
- import type * as Discord from "dfx/types"
8
+ } from "./context.ts"
9
+ import type * as Discord from "../types.ts"
10
10
  import type { Scope } from "effect/Scope"
11
- import type { CommandHelper } from "./commandHelper"
11
+ import type { CommandHelper } from "./commandHelper.ts"
12
12
 
13
13
  export type InteractionDefinition<R, E> =
14
14
  | GlobalApplicationCommand<R, E>
@@ -1,40 +1,37 @@
1
+ import * as Arr from "effect/Array"
1
2
  import * as Chunk from "effect/Chunk"
2
- import type { Tag } from "effect/Context"
3
- import { GenericTag } from "effect/Context"
4
3
  import * as Duration from "effect/Duration"
5
- import { pipe } from "effect/Function"
6
4
  import * as Effect from "effect/Effect"
5
+ import { pipe } from "effect/Function"
7
6
  import * as Layer from "effect/Layer"
8
7
  import * as Queue from "effect/Queue"
9
8
  import * as Ref from "effect/Ref"
10
- import { DiscordGateway } from "dfx/DiscordGateway"
11
- import type { DiscordRESTError } from "dfx/DiscordREST"
12
- import { DiscordREST } from "dfx/DiscordREST"
9
+ import * as Schedule from "effect/Schedule"
10
+ import * as ServiceMap from "effect/ServiceMap"
11
+ import { DiscordGateway } from "../DiscordGateway.ts"
12
+ import type { DiscordRESTError } from "../DiscordREST.ts"
13
+ import { DiscordREST } from "../DiscordREST.ts"
14
+ import type { ListMyGuilds200, MyGuildResponse } from "../types.ts"
13
15
  import type {
14
16
  GlobalApplicationCommand,
15
17
  GuildApplicationCommand,
16
- } from "dfx/Interactions/definitions"
17
- import type { DefinitionNotFound } from "dfx/Interactions/handlers"
18
- import { handlers } from "dfx/Interactions/handlers"
19
- import type {
20
- DiscordInteraction,
21
- InteractionBuilder,
22
- } from "dfx/Interactions/index"
23
- import { builder, Interaction } from "dfx/Interactions/index"
24
- import * as EffectUtils from "dfx/utils/Effect"
25
- import * as Schedule from "effect/Schedule"
26
- import { globalValue } from "effect/GlobalValue"
27
- import * as FiberRef from "effect/FiberRef"
28
- import type { ListMyGuilds200, MyGuildResponse } from "dfx/types"
29
- import * as Arr from "effect/Array"
18
+ } from "./definitions.ts"
19
+ import type { DefinitionNotFound } from "./handlers.ts"
20
+ import { handlers } from "./handlers.ts"
21
+ import type { DiscordInteraction, InteractionBuilder } from "./index.ts"
22
+ import { builder, Interaction } from "./index.ts"
23
+ import * as EffectUtils from "../utils/Effect.ts"
30
24
 
31
- export const interactionsSync: FiberRef.FiberRef<boolean> = globalValue(
32
- "dfx/Interactions/sync",
33
- () => FiberRef.unsafeMake(true),
34
- )
25
+ export const interactionsSync = ServiceMap.Reference("dfx/Interactions/sync", {
26
+ defaultValue: () => true,
27
+ })
35
28
 
36
29
  export const setInteractionsSync = (enabled: boolean) =>
37
- Layer.locally(interactionsSync, enabled)
30
+ Layer.provide(Layer.succeed(interactionsSync, enabled))
31
+
32
+ const retryPolicy = Schedule.exponential("1 seconds").pipe(
33
+ Schedule.either(Schedule.spaced("20 seconds")),
34
+ )
38
35
 
39
36
  export const run =
40
37
  <R, R2, E, TE, E2>(
@@ -89,7 +86,7 @@ export const run =
89
86
  const next: ListMyGuilds200 = yield* rest.listMyGuilds({
90
87
  after: results && Arr.lastNonEmpty(results).id,
91
88
  })
92
- if (!Arr.isNonEmptyReadonlyArray(next)) break
89
+ if (!Arr.isReadonlyArrayNonEmpty(next)) break
93
90
  results = next
94
91
  yield* Effect.forEach(
95
92
  results!,
@@ -125,7 +122,7 @@ export const run =
125
122
  return hasFiles ? rest.withFiles(r.files as any)(effect) : effect
126
123
  })
127
124
 
128
- const run = gateway.handleDispatch("INTERACTION_CREATE", i =>
125
+ const interactionRun = gateway.handleDispatch("INTERACTION_CREATE", i =>
129
126
  Effect.withSpan(
130
127
  Effect.provideService(postHandler(handle[i.type](i)), Interaction, i),
131
128
  "dfx.Interaction",
@@ -133,16 +130,16 @@ export const run =
133
130
  ),
134
131
  )
135
132
 
136
- const sync = yield* FiberRef.get(interactionsSync)
133
+ const sync = yield* interactionsSync
137
134
 
138
135
  return yield* sync
139
136
  ? Effect.forever(
140
- Effect.all([run, globalSync, guildSync], {
137
+ Effect.all([interactionRun, globalSync, guildSync], {
141
138
  concurrency: "unbounded",
142
139
  discard: true,
143
140
  }),
144
141
  )
145
- : run
142
+ : interactionRun
146
143
  })
147
144
 
148
145
  const makeRegistry = Effect.gen(function* () {
@@ -160,16 +157,12 @@ const makeRegistry = Effect.gen(function* () {
160
157
  yield* EffectUtils.foreverSwitch(Queue.take(queue), ix =>
161
158
  pipe(
162
159
  ix,
163
- run(Effect.catchAllCause(_ => Effect.logError("unhandled error", _))),
160
+ run(Effect.catchCause(_ => Effect.logError("unhandled error", _))),
164
161
  Effect.delay(Duration.seconds(5)),
165
162
  ),
166
163
  ).pipe(
167
- Effect.tapErrorCause(_ => Effect.logError("registry error", _)),
168
- Effect.retry(
169
- Schedule.exponential("1 seconds").pipe(
170
- Schedule.union(Schedule.spaced("20 seconds")),
171
- ),
172
- ),
164
+ Effect.tapCause(_ => Effect.logError("registry error", _)),
165
+ Effect.retry(retryPolicy),
173
166
  Effect.forkScoped,
174
167
  Effect.interruptible,
175
168
  )
@@ -187,19 +180,14 @@ export interface InteractionsRegistryService {
187
180
  ix: InteractionBuilder<never, E, never>,
188
181
  ) => Effect.Effect<void>
189
182
  }
190
- export interface InteractionsRegistry {
191
- readonly _: unique symbol
192
- }
193
183
 
194
- export const InteractionsRegistry: Tag<
184
+ export class InteractionsRegistry extends ServiceMap.Service<
195
185
  InteractionsRegistry,
196
186
  InteractionsRegistryService
197
- > = GenericTag<InteractionsRegistry, InteractionsRegistryService>(
198
- "dfx/Interactions/InteractionsRegistry",
199
- )
187
+ >()("dfx/Interactions/InteractionsRegistry") {}
200
188
 
201
189
  export const InteractionsRegistryLive: Layer.Layer<
202
190
  InteractionsRegistry,
203
191
  never,
204
192
  DiscordREST | DiscordGateway
205
- > = Layer.scoped(InteractionsRegistry, makeRegistry)
193
+ > = Layer.effect(InteractionsRegistry, makeRegistry)
@@ -1,10 +1,10 @@
1
1
  import type * as Chunk from "effect/Chunk"
2
2
  import * as Effect from "effect/Effect"
3
- import * as IxHelpers from "dfx/Helpers/interactions"
4
- import * as Ctx from "dfx/Interactions/context"
5
- import type * as D from "dfx/Interactions/definitions"
6
- import { flattenDefinitions, splitDefinitions } from "dfx/Interactions/utils"
7
- import * as Discord from "dfx/types"
3
+ import * as IxHelpers from "../Helpers/interactions.ts"
4
+ import * as Ctx from "./context.ts"
5
+ import type * as D from "./definitions.ts"
6
+ import { flattenDefinitions, splitDefinitions } from "./utils.ts"
7
+ import * as Discord from "../types.ts"
8
8
  import type { Scope } from "effect/Scope"
9
9
 
10
10
  export class DefinitionNotFound {
@@ -58,6 +58,9 @@ export const handlers = <R, E, TE, A, B>(
58
58
  ) as Handler<Exclude<R, Scope>, E, B>
59
59
  },
60
60
 
61
+ [Discord.InteractionTypes.SOCIAL_LAYER_SKU_PURCHASE_ELIGIBILITY]: i =>
62
+ Effect.fail(new DefinitionNotFound(i)),
63
+
61
64
  [Discord.InteractionTypes.MODAL_SUBMIT]: i => {
62
65
  const data = i.data as Discord.APIModalSubmission
63
66
  const match = ModalSubmit.find(_ => _.predicate(data.custom_id))
@@ -1,14 +1,14 @@
1
- export { response } from "dfx/Helpers/interactions"
2
- export * from "dfx/Interactions/builder"
3
- export * from "dfx/Interactions/context"
1
+ export { response } from "../Helpers/interactions.ts"
2
+ export * from "./builder.ts"
3
+ export * from "./context.ts"
4
+ export type { InteractionDefinition } from "./definitions.ts"
4
5
  export {
5
6
  autocomplete,
6
7
  global,
7
8
  guild,
8
- InteractionDefinition,
9
9
  messageComponent,
10
10
  modalSubmit,
11
- } from "dfx/Interactions/definitions"
11
+ } from "./definitions.ts"
12
12
 
13
13
  // Filters
14
14
  export const id = (query: string) => (customId: string) => query === customId
@@ -1,16 +1,16 @@
1
1
  import * as Chunk from "effect/Chunk"
2
2
  import * as Effect from "effect/Effect"
3
- import type * as D from "dfx/Interactions/definitions"
4
- import type * as Discord from "dfx/types"
3
+ import type * as D from "./definitions.ts"
4
+ import type * as Discord from "../types.ts"
5
5
  import * as Array from "effect/Array"
6
- import { CommandHelper } from "dfx/Interactions/commandHelper"
6
+ import { CommandHelper } from "./commandHelper.ts"
7
7
 
8
8
  export type DefinitionFlattened<R, E, TE, A> =
9
- D.InteractionDefinition<R, E> extends infer D
9
+ D.InteractionDefinition<R, E> extends infer Def
10
10
  ? {
11
- [K in keyof D]: K extends "handle"
11
+ [K in keyof Def]: K extends "handle"
12
12
  ? (_: Discord.APIInteraction) => Effect.Effect<A, TE, R>
13
- : D[K]
13
+ : Def[K]
14
14
  }
15
15
  : never
16
16
 
@@ -1,25 +1,20 @@
1
1
  import * as Chunk from "effect/Chunk"
2
- import { GenericTag } from "effect/Context"
3
2
  import { identity } from "effect/Function"
4
3
  import * as Option from "effect/Option"
5
4
  import type * as Cause from "effect/Cause"
6
5
  import type * as Config from "effect/Config"
7
- import type * as ConfigError from "effect/ConfigError"
8
6
  import * as Redacted from "effect/Redacted"
9
7
  import * as Effect from "effect/Effect"
10
8
  import * as Layer from "effect/Layer"
11
- import type * as D from "dfx/Interactions/definitions"
12
- import type { DefinitionNotFound } from "dfx/Interactions/handlers"
13
- import { handlers } from "dfx/Interactions/handlers"
14
- import type {
15
- DiscordInteraction,
16
- InteractionBuilder,
17
- } from "dfx/Interactions/index"
18
- import { Interaction } from "dfx/Interactions/index"
19
- import type * as Discord from "dfx/types"
9
+ import * as ServiceMap from "effect/ServiceMap"
10
+ import type * as D from "./definitions.ts"
11
+ import type { DefinitionNotFound } from "./handlers.ts"
12
+ import { handlers } from "./handlers.ts"
13
+ import type { DiscordInteraction, InteractionBuilder } from "./index.ts"
14
+ import { Interaction } from "./index.ts"
15
+ import type * as Discord from "../types.ts"
20
16
  import * as Verify from "discord-verify"
21
- import { TypeIdError } from "@effect/platform/Error"
22
- import { InteractionsErrorTypeId } from "dfx/Interactions/error"
17
+ import * as Data from "effect/Data"
23
18
 
24
19
  export class BadWebhookSignature {
25
20
  readonly _tag = "BadWebhookSignature"
@@ -34,10 +29,12 @@ const checkSignature = (
34
29
  crypto: SubtleCrypto,
35
30
  algorithm: any,
36
31
  ) =>
37
- Option.all({
38
- signature: Option.fromNullable(headers["x-signature-ed25519"]),
39
- timestamp: Option.fromNullable(headers["x-signature-timestamp"]),
40
- }).pipe(
32
+ Effect.fromOption(
33
+ Option.all({
34
+ signature: Option.fromNullishOr(headers["x-signature-ed25519"]),
35
+ timestamp: Option.fromNullishOr(headers["x-signature-timestamp"]),
36
+ }),
37
+ ).pipe(
41
38
  Effect.flatMap(_ =>
42
39
  Effect.promise(() =>
43
40
  Verify.verify(
@@ -51,7 +48,7 @@ const checkSignature = (
51
48
  ),
52
49
  ),
53
50
  Effect.filterOrFail(identity, () => new BadWebhookSignature()),
54
- Effect.catchAllCause(() => Effect.fail(new BadWebhookSignature())),
51
+ Effect.catchCause(() => Effect.fail(new BadWebhookSignature())),
55
52
  Effect.asVoid,
56
53
  )
57
54
 
@@ -73,37 +70,33 @@ const makeConfig = ({
73
70
  algorithm: Verify.PlatformAlgorithm[algorithm],
74
71
  })
75
72
 
76
- export interface WebhookConfig {
77
- readonly _: unique symbol
78
- }
79
- export const WebhookConfig = GenericTag<
73
+ export class WebhookConfig extends ServiceMap.Service<
80
74
  WebhookConfig,
81
75
  ReturnType<typeof makeConfig>
82
- >("dfx/Interactions/WebhookConfig")
76
+ >()("dfx/Interactions/WebhookConfig") {}
83
77
 
84
78
  export const layer = (opts: MakeConfigOpts) =>
85
79
  Layer.succeed(WebhookConfig, makeConfig(opts))
86
80
 
87
81
  export const layerConfig: (
88
82
  config: Config.Config<MakeConfigOpts>,
89
- ) => Layer.Layer<WebhookConfig, ConfigError.ConfigError> = (
83
+ ) => Layer.Layer<WebhookConfig, Config.ConfigError> = (
90
84
  config: Config.Config<MakeConfigOpts>,
91
- ) => Layer.effect(WebhookConfig, Effect.map(config, makeConfig))
85
+ ) => Layer.effect(WebhookConfig, Effect.map(config.asEffect(), makeConfig))
92
86
 
93
- export class WebhookParseError extends TypeIdError(
94
- InteractionsErrorTypeId,
95
- "WebhookParseError",
96
- )<{ cause: unknown }> {}
87
+ export class WebhookParseError extends Data.TaggedError("WebhookParseError")<{
88
+ cause: unknown
89
+ }> {}
97
90
 
98
91
  const fromHeadersAndBody = (headers: Headers, body: string) =>
99
- Effect.tap(WebhookConfig, ({ algorithm, crypto, publicKey }) =>
100
- checkSignature(publicKey, headers, body, crypto, algorithm),
101
- ).pipe(
102
- Effect.flatMap(() =>
103
- Effect.try({
104
- try: () => JSON.parse(body) as Discord.APIInteraction,
105
- catch: cause => new WebhookParseError({ cause }),
106
- }),
92
+ WebhookConfig.use(({ algorithm, crypto, publicKey }) =>
93
+ checkSignature(publicKey, headers, body, crypto, algorithm).pipe(
94
+ Effect.andThen(
95
+ Effect.try({
96
+ try: () => JSON.parse(body) as Discord.APIInteraction,
97
+ catch: cause => new WebhookParseError({ cause }),
98
+ }),
99
+ ),
107
100
  ),
108
101
  )
109
102
 
@@ -181,7 +174,7 @@ export const makeHandler = <R, E, TE>(
181
174
  >): Effect.Effect<void, never, WebhookConfig> =>
182
175
  handle(headers, body).pipe(
183
176
  Effect.flatMap(success),
184
- Effect.catchAllCause(error),
177
+ Effect.catchCause(error),
185
178
  )
186
179
  }
187
180
 
@@ -1,6 +1,6 @@
1
1
  import * as Option from "effect/Option"
2
2
  import * as Effect from "effect/Effect"
3
- import type { BucketDetails, RateLimitStoreService } from "dfx/RateLimit"
3
+ import type { BucketDetails, RateLimitStoreService } from "../RateLimit.ts"
4
4
 
5
5
  interface Counter {
6
6
  count: number
@@ -14,12 +14,12 @@ export const make = (): RateLimitStoreService => {
14
14
 
15
15
  const getCounter = (key: string) =>
16
16
  Option.filter(
17
- Option.fromNullable(counters.get(key)),
17
+ Option.fromNullishOr(counters.get(key)),
18
18
  c => c.expires > Date.now(),
19
19
  )
20
20
 
21
21
  const getBucketForRoute = (route: string) =>
22
- Effect.sync(() => Option.fromNullable(buckets.get(routes.get(route)!)))
22
+ Effect.sync(() => Option.fromNullishOr(buckets.get(routes.get(route)!)))
23
23
 
24
24
  return {
25
25
  hasBucket: key => Effect.sync(() => buckets.has(key)),
package/src/RateLimit.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { GenericTag } from "effect/Context"
2
1
  import * as Duration from "effect/Duration"
3
2
  import type * as Option from "effect/Option"
4
3
  import * as Effect from "effect/Effect"
5
4
  import * as Layer from "effect/Layer"
6
- import * as Memory from "dfx/RateLimit/memory"
7
- import { delayFrom } from "dfx/RateLimit/utils"
5
+ import * as Memory from "./RateLimit/memory.ts"
6
+ import { delayFrom } from "./RateLimit/utils.ts"
7
+ import * as ServiceMap from "effect/ServiceMap"
8
8
 
9
9
  export type BucketDetails = {
10
10
  key: "global" | string
@@ -35,13 +35,11 @@ export interface RateLimitStoreService {
35
35
  readonly removeCounter: (key: string) => Effect.Effect<void>
36
36
  }
37
37
 
38
- export interface RateLimitStore {
39
- readonly _: unique symbol
40
- }
38
+ export class RateLimitStore extends ServiceMap.Service<
39
+ RateLimitStore,
40
+ RateLimitStoreService
41
+ >()("dfx/RateLimit/RateLimitStore") {}
41
42
 
42
- export const RateLimitStore = GenericTag<RateLimitStore, RateLimitStoreService>(
43
- "dfx/RateLimit/RateLimitStore",
44
- )
45
43
  export const MemoryRateLimitStoreLive = Layer.sync(RateLimitStore, Memory.make)
46
44
 
47
45
  const makeLimiter = Effect.gen(function* () {
@@ -77,11 +75,16 @@ const makeLimiter = Effect.gen(function* () {
77
75
  return { maybeWait }
78
76
  })
79
77
 
80
- export interface RateLimiter {
81
- readonly _: unique symbol
82
- }
83
- export const RateLimiter = GenericTag<
78
+ export class RateLimiter extends ServiceMap.Service<
84
79
  RateLimiter,
85
- Effect.Effect.Success<typeof makeLimiter>
86
- >("dfx/RateLimit/RateLimiter")
80
+ {
81
+ maybeWait: (
82
+ key: string,
83
+ window: Duration.Duration,
84
+ limit: number,
85
+ multiplier?: number,
86
+ ) => Effect.Effect<void, never, never>
87
+ }
88
+ >()("dfx/RateLimit/RateLimiter") {}
89
+
87
90
  export const RateLimiterLive = Layer.effect(RateLimiter, makeLimiter)
package/src/gateway.ts CHANGED
@@ -1,25 +1,25 @@
1
- import * as CachePrelude from "dfx/Cache/prelude"
2
- import type { DiscordGateway } from "dfx/DiscordGateway"
3
- import { DiscordGatewayLive } from "dfx/DiscordGateway"
4
- import * as DiscordWS from "dfx/DiscordGateway/DiscordWS"
5
- import { JsonDiscordWSCodecLive } from "dfx/DiscordGateway/DiscordWS"
6
- import * as Shard from "dfx/DiscordGateway/Shard"
7
- import { ShardStateStore } from "dfx/DiscordGateway/Shard/StateStore"
8
- import * as SendEvent from "dfx/DiscordGateway/Shard/sendEvents"
9
- import * as ShardStore from "dfx/DiscordGateway/ShardStore"
10
- import { MemoryShardStoreLive } from "dfx/DiscordGateway/ShardStore"
11
- import type { DiscordREST } from "dfx/DiscordREST"
12
- import { DiscordRESTLive } from "dfx/DiscordREST"
13
- import type { InteractionsRegistry } from "dfx/Interactions/gateway"
14
- import { InteractionsRegistryLive } from "dfx/Interactions/gateway"
15
- import type { RateLimiter } from "dfx/RateLimit"
16
- import { MemoryRateLimitStoreLive, RateLimiterLive } from "dfx/RateLimit"
1
+ import * as CachePrelude from "./Cache/prelude.ts"
2
+ import type { DiscordGateway } from "./DiscordGateway.ts"
3
+ import { DiscordGatewayLive } from "./DiscordGateway.ts"
4
+ import * as DiscordWS from "./DiscordGateway/DiscordWS.ts"
5
+ import { JsonDiscordWSCodecLive } from "./DiscordGateway/DiscordWS.ts"
6
+ import * as Shard from "./DiscordGateway/Shard.ts"
7
+ import { ShardStateStore } from "./DiscordGateway/Shard/StateStore.ts"
8
+ import * as SendEvent from "./DiscordGateway/Shard/sendEvents.ts"
9
+ import * as ShardStore from "./DiscordGateway/ShardStore.ts"
10
+ import { MemoryShardStoreLive } from "./DiscordGateway/ShardStore.ts"
11
+ import type { DiscordREST } from "./DiscordREST.ts"
12
+ import { DiscordRESTLive } from "./DiscordREST.ts"
13
+ import type { InteractionsRegistry } from "./Interactions/gateway.ts"
14
+ import { InteractionsRegistryLive } from "./Interactions/gateway.ts"
15
+ import type { RateLimiter } from "./RateLimit.ts"
16
+ import { MemoryRateLimitStoreLive, RateLimiterLive } from "./RateLimit.ts"
17
17
  import * as Layer from "effect/Layer"
18
- import type * as HttpClient from "@effect/platform/HttpClient"
19
- import type { DiscordConfig } from "dfx/DiscordConfig"
20
- import type { WebSocketConstructor } from "@effect/platform/Socket"
18
+ import type * as HttpClient from "effect/unstable/http/HttpClient"
19
+ import type { DiscordConfig } from "./DiscordConfig.ts"
20
+ import type { WebSocketConstructor } from "effect/unstable/socket/Socket"
21
21
 
22
- export { DiscordGateway, DiscordGatewayLive } from "dfx/DiscordGateway"
22
+ export { DiscordGateway, DiscordGatewayLive } from "./DiscordGateway.ts"
23
23
 
24
24
  export {
25
25
  InteractionsRegistry,
@@ -27,7 +27,7 @@ export {
27
27
  interactionsSync,
28
28
  run as runIx,
29
29
  setInteractionsSync,
30
- } from "dfx/Interactions/gateway"
30
+ } from "./Interactions/gateway.ts"
31
31
 
32
32
  export { CachePrelude, DiscordWS, SendEvent, Shard, ShardStore }
33
33