dfx 0.93.0 → 0.95.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 (71) hide show
  1. package/Cache/prelude.d.ts.map +1 -1
  2. package/Cache/prelude.js +18 -18
  3. package/Cache/prelude.js.map +1 -1
  4. package/Cache.d.ts +4 -1
  5. package/Cache.d.ts.map +1 -1
  6. package/Cache.js +8 -8
  7. package/Cache.js.map +1 -1
  8. package/DiscordGateway/DiscordWS.d.ts.map +1 -1
  9. package/DiscordGateway/DiscordWS.js +10 -10
  10. package/DiscordGateway/DiscordWS.js.map +1 -1
  11. package/DiscordGateway/Messaging.d.ts.map +1 -1
  12. package/DiscordGateway/Messaging.js +3 -3
  13. package/DiscordGateway/Messaging.js.map +1 -1
  14. package/DiscordGateway/Shard.d.ts +2 -2
  15. package/DiscordGateway/Shard.d.ts.map +1 -1
  16. package/DiscordGateway/Shard.js +18 -18
  17. package/DiscordGateway/Shard.js.map +1 -1
  18. package/DiscordGateway/Sharder.d.ts +1 -1
  19. package/DiscordGateway/Sharder.d.ts.map +1 -1
  20. package/DiscordGateway/Sharder.js +11 -11
  21. package/DiscordGateway/Sharder.js.map +1 -1
  22. package/DiscordGateway.d.ts +1 -1
  23. package/DiscordGateway.js +3 -3
  24. package/DiscordGateway.js.map +1 -1
  25. package/DiscordREST.d.ts +1 -1
  26. package/DiscordREST.js +6 -6
  27. package/DiscordREST.js.map +1 -1
  28. package/Interactions/context.d.ts +1 -1
  29. package/Interactions/definitions.d.ts +5 -5
  30. package/Interactions/gateway.d.ts.map +1 -1
  31. package/Interactions/gateway.js +11 -11
  32. package/Interactions/gateway.js.map +1 -1
  33. package/RateLimit.js +2 -2
  34. package/RateLimit.js.map +1 -1
  35. package/gateway.d.ts +2 -2
  36. package/mjs/Cache/prelude.mjs +18 -18
  37. package/mjs/Cache/prelude.mjs.map +1 -1
  38. package/mjs/Cache.mjs +8 -8
  39. package/mjs/Cache.mjs.map +1 -1
  40. package/mjs/DiscordGateway/DiscordWS.mjs +10 -10
  41. package/mjs/DiscordGateway/DiscordWS.mjs.map +1 -1
  42. package/mjs/DiscordGateway/Messaging.mjs +3 -3
  43. package/mjs/DiscordGateway/Messaging.mjs.map +1 -1
  44. package/mjs/DiscordGateway/Shard.mjs +18 -18
  45. package/mjs/DiscordGateway/Shard.mjs.map +1 -1
  46. package/mjs/DiscordGateway/Sharder.mjs +11 -11
  47. package/mjs/DiscordGateway/Sharder.mjs.map +1 -1
  48. package/mjs/DiscordGateway.mjs +3 -3
  49. package/mjs/DiscordGateway.mjs.map +1 -1
  50. package/mjs/DiscordREST.mjs +6 -6
  51. package/mjs/DiscordREST.mjs.map +1 -1
  52. package/mjs/Interactions/gateway.mjs +11 -11
  53. package/mjs/Interactions/gateway.mjs.map +1 -1
  54. package/mjs/RateLimit.mjs +2 -2
  55. package/mjs/RateLimit.mjs.map +1 -1
  56. package/mjs/version.mjs +1 -1
  57. package/package.json +4 -4
  58. package/src/Cache/prelude.ts +94 -100
  59. package/src/Cache.ts +28 -32
  60. package/src/DiscordGateway/DiscordWS.ts +13 -17
  61. package/src/DiscordGateway/Messaging.ts +7 -11
  62. package/src/DiscordGateway/Shard.ts +23 -30
  63. package/src/DiscordGateway/Sharder.ts +14 -16
  64. package/src/DiscordGateway.ts +3 -3
  65. package/src/DiscordREST.ts +6 -6
  66. package/src/Interactions/gateway.ts +24 -31
  67. package/src/RateLimit.ts +2 -2
  68. package/src/version.ts +1 -1
  69. package/version.d.ts +1 -1
  70. package/version.js +1 -1
  71. package/webhooks.d.ts +1 -1
@@ -139,30 +139,28 @@ export const guilds = <RM, EM, E>(
139
139
  EM,
140
140
  RM | DiscordGateway | DiscordREST | Scope.Scope
141
141
  > =>
142
- Effect.gen(function* (_) {
143
- const driver = yield* _(makeDriver)
144
- const gateway = yield* _(DiscordGateway)
145
- const rest = yield* _(DiscordREST)
142
+ Effect.gen(function* () {
143
+ const driver = yield* makeDriver
144
+ const gateway = yield* DiscordGateway
145
+ const rest = yield* DiscordREST
146
146
 
147
- return yield* _(
148
- make({
149
- driver,
150
- id: _ => _.id,
151
- ops: ops({
152
- id: (g: Discord.Guild) => g.id,
153
- create: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => ({
154
- ...g,
155
- channels: [],
156
- roles: [],
157
- emojis: [],
158
- members: [],
159
- })),
160
- update: gateway.fromDispatch("GUILD_UPDATE"),
161
- remove: Stream.map(gateway.fromDispatch("GUILD_DELETE"), a => a.id),
162
- }),
163
- onMiss: id => rest.getGuild(id).json,
147
+ return yield* make({
148
+ driver,
149
+ id: _ => _.id,
150
+ ops: ops({
151
+ id: (g: Discord.Guild) => g.id,
152
+ create: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => ({
153
+ ...g,
154
+ channels: [],
155
+ roles: [],
156
+ emojis: [],
157
+ members: [],
158
+ })),
159
+ update: gateway.fromDispatch("GUILD_UPDATE"),
160
+ remove: Stream.map(gateway.fromDispatch("GUILD_DELETE"), a => a.id),
164
161
  }),
165
- )
162
+ onMiss: id => rest.getGuild(id).json,
163
+ })
166
164
  })
167
165
 
168
166
  export const channels = <RM, EM, E>(
@@ -177,45 +175,43 @@ export const channels = <RM, EM, E>(
177
175
  EM,
178
176
  DiscordGateway | DiscordREST | RM | Scope.Scope
179
177
  > =>
180
- Effect.gen(function* (_) {
181
- const driver = yield* _(makeDriver)
182
- const gateway = yield* _(DiscordGateway)
183
- const rest = yield* _(DiscordREST)
178
+ Effect.gen(function* () {
179
+ const driver = yield* makeDriver
180
+ const gateway = yield* DiscordGateway
181
+ const rest = yield* DiscordREST
184
182
 
185
- return yield* _(
186
- makeWithParent({
187
- driver,
188
- id: _ => Effect.succeed([_.guild_id!, _.id]),
189
- ops: opsWithParent({
190
- id: (a: Discord.Channel) => a.id,
191
- fromParent: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => [
192
- g.id,
193
- g.channels.concat(g.threads),
194
- ]),
195
- create: Stream.merge(
196
- gateway.fromDispatch("CHANNEL_CREATE"),
197
- gateway.fromDispatch("THREAD_CREATE"),
198
- ).pipe(Stream.map(c => [c.guild_id!, c])),
199
- update: Stream.merge(
200
- gateway.fromDispatch("CHANNEL_UPDATE"),
201
- gateway.fromDispatch("THREAD_UPDATE"),
202
- ).pipe(Stream.map(c => [c.guild_id!, c])),
203
- remove: Stream.merge(
204
- gateway.fromDispatch("CHANNEL_DELETE"),
205
- gateway.fromDispatch("THREAD_DELETE"),
206
- ).pipe(Stream.map(a => [a.guild_id!, a.id])),
207
- parentRemove: Stream.map(
208
- gateway.fromDispatch("GUILD_DELETE"),
209
- g => g.id,
210
- ),
211
- }),
212
- onMiss: (_, id) => rest.getChannel(id).json,
213
- onParentMiss: guildId =>
214
- rest
215
- .getGuildChannels(guildId)
216
- .json.pipe(Effect.map(a => a.map(a => [a.id, a]))),
183
+ return yield* makeWithParent({
184
+ driver,
185
+ id: _ => Effect.succeed([_.guild_id!, _.id]),
186
+ ops: opsWithParent({
187
+ id: (a: Discord.Channel) => a.id,
188
+ fromParent: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => [
189
+ g.id,
190
+ g.channels.concat(g.threads),
191
+ ]),
192
+ create: Stream.merge(
193
+ gateway.fromDispatch("CHANNEL_CREATE"),
194
+ gateway.fromDispatch("THREAD_CREATE"),
195
+ ).pipe(Stream.map(c => [c.guild_id!, c])),
196
+ update: Stream.merge(
197
+ gateway.fromDispatch("CHANNEL_UPDATE"),
198
+ gateway.fromDispatch("THREAD_UPDATE"),
199
+ ).pipe(Stream.map(c => [c.guild_id!, c])),
200
+ remove: Stream.merge(
201
+ gateway.fromDispatch("CHANNEL_DELETE"),
202
+ gateway.fromDispatch("THREAD_DELETE"),
203
+ ).pipe(Stream.map(a => [a.guild_id!, a.id])),
204
+ parentRemove: Stream.map(
205
+ gateway.fromDispatch("GUILD_DELETE"),
206
+ g => g.id,
207
+ ),
217
208
  }),
218
- )
209
+ onMiss: (_, id) => rest.getChannel(id).json,
210
+ onParentMiss: guildId =>
211
+ rest
212
+ .getGuildChannels(guildId)
213
+ .json.pipe(Effect.map(a => a.map(a => [a.id, a]))),
214
+ })
219
215
  })
220
216
 
221
217
  export const roles = <RM, EM, E>(
@@ -230,47 +226,45 @@ export const roles = <RM, EM, E>(
230
226
  EM,
231
227
  DiscordGateway | DiscordREST | RM | Scope.Scope
232
228
  > =>
233
- Effect.gen(function* (_) {
234
- const driver = yield* _(makeDriver)
235
- const gateway = yield* _(DiscordGateway)
236
- const rest = yield* _(DiscordREST)
229
+ Effect.gen(function* () {
230
+ const driver = yield* makeDriver
231
+ const gateway = yield* DiscordGateway
232
+ const rest = yield* DiscordREST
237
233
 
238
- return yield* _(
239
- makeWithParent({
240
- driver,
241
- id: _ =>
242
- Effect.fail(
243
- new CacheMissError({ cacheName: "RolesCache/id", id: _.id }),
244
- ),
245
- ops: opsWithParent({
246
- id: (a: Discord.Role) => a.id,
247
- fromParent: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => [
248
- g.id,
249
- g.roles,
250
- ]),
251
- create: Stream.map(gateway.fromDispatch("GUILD_ROLE_CREATE"), r => [
252
- r.guild_id,
253
- r.role,
254
- ]),
255
- update: Stream.map(gateway.fromDispatch("GUILD_ROLE_UPDATE"), r => [
256
- r.guild_id,
257
- r.role,
258
- ]),
259
- remove: Stream.map(gateway.fromDispatch("GUILD_ROLE_DELETE"), r => [
260
- r.guild_id,
261
- r.role_id,
262
- ]),
263
- parentRemove: Stream.map(
264
- gateway.fromDispatch("GUILD_DELETE"),
265
- g => g.id,
266
- ),
267
- }),
268
- onMiss: (_, id) =>
269
- Effect.fail(new CacheMissError({ cacheName: "RolesCache", id })),
270
- onParentMiss: guildId =>
271
- rest
272
- .getGuildRoles(guildId)
273
- .json.pipe(Effect.map(_ => _.map(role => [role.id, role]))),
234
+ return yield* makeWithParent({
235
+ driver,
236
+ id: _ =>
237
+ Effect.fail(
238
+ new CacheMissError({ cacheName: "RolesCache/id", id: _.id }),
239
+ ),
240
+ ops: opsWithParent({
241
+ id: (a: Discord.Role) => a.id,
242
+ fromParent: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => [
243
+ g.id,
244
+ g.roles,
245
+ ]),
246
+ create: Stream.map(gateway.fromDispatch("GUILD_ROLE_CREATE"), r => [
247
+ r.guild_id,
248
+ r.role,
249
+ ]),
250
+ update: Stream.map(gateway.fromDispatch("GUILD_ROLE_UPDATE"), r => [
251
+ r.guild_id,
252
+ r.role,
253
+ ]),
254
+ remove: Stream.map(gateway.fromDispatch("GUILD_ROLE_DELETE"), r => [
255
+ r.guild_id,
256
+ r.role_id,
257
+ ]),
258
+ parentRemove: Stream.map(
259
+ gateway.fromDispatch("GUILD_DELETE"),
260
+ g => g.id,
261
+ ),
274
262
  }),
275
- )
263
+ onMiss: (_, id) =>
264
+ Effect.fail(new CacheMissError({ cacheName: "RolesCache", id })),
265
+ onParentMiss: guildId =>
266
+ rest
267
+ .getGuildRoles(guildId)
268
+ .json.pipe(Effect.map(_ => _.map(role => [role.id, role]))),
269
+ })
276
270
  })
package/src/Cache.ts CHANGED
@@ -78,30 +78,28 @@ export const makeWithParent = <EOps, EDriver, EMiss, EPMiss, A>({
78
78
  parentId: string,
79
79
  ) => Effect.Effect<Array<[id: string, resource: A]>, EPMiss>
80
80
  }): Effect.Effect<ParentCache<EDriver, EMiss, EPMiss, A>, never, Scope.Scope> =>
81
- Effect.gen(function* (_) {
82
- yield* _(
83
- Stream.runDrain(
84
- Stream.tap(ops, (op): Effect.Effect<void, EDriver> => {
85
- switch (op.op) {
86
- case "create":
87
- case "update":
88
- return driver.set(op.parentId, op.resourceId, op.resource)
81
+ Effect.gen(function* () {
82
+ yield Stream.runDrain(
83
+ Stream.tap(ops, (op): Effect.Effect<void, EDriver> => {
84
+ switch (op.op) {
85
+ case "create":
86
+ case "update":
87
+ return driver.set(op.parentId, op.resourceId, op.resource)
89
88
 
90
- case "delete":
91
- return driver.delete(op.parentId, op.resourceId)
89
+ case "delete":
90
+ return driver.delete(op.parentId, op.resourceId)
92
91
 
93
- case "parentDelete":
94
- return driver.parentDelete(op.parentId)
95
- }
96
- }),
97
- ),
92
+ case "parentDelete":
93
+ return driver.parentDelete(op.parentId)
94
+ }
95
+ }),
96
+ ).pipe(
98
97
  Effect.tapErrorCause(_ => Effect.logError("ops error, restarting", _)),
99
98
  Effect.retry(retryPolicy),
100
99
  Effect.forkScoped,
101
100
  Effect.interruptible,
102
101
  )
103
- yield* _(
104
- driver.run,
102
+ yield driver.run.pipe(
105
103
  Effect.tapErrorCause(_ =>
106
104
  Effect.logError("cache driver error, restarting", _),
107
105
  ),
@@ -194,28 +192,26 @@ export const make = <EOps, EDriver, EMiss, A>({
194
192
  id: (_: A) => string
195
193
  onMiss: (id: string) => Effect.Effect<A, EMiss>
196
194
  }): Effect.Effect<Cache<EDriver, EMiss, A>, never, Scope.Scope> =>
197
- Effect.gen(function* (_) {
198
- yield* _(
199
- Stream.runDrain(
200
- Stream.tap(ops, (op): Effect.Effect<void, EDriver> => {
201
- switch (op.op) {
202
- case "create":
203
- case "update":
204
- return driver.set(op.resourceId, op.resource)
195
+ Effect.gen(function* () {
196
+ yield Stream.runDrain(
197
+ Stream.tap(ops, (op): Effect.Effect<void, EDriver> => {
198
+ switch (op.op) {
199
+ case "create":
200
+ case "update":
201
+ return driver.set(op.resourceId, op.resource)
205
202
 
206
- case "delete":
207
- return driver.delete(op.resourceId)
208
- }
209
- }),
210
- ),
203
+ case "delete":
204
+ return driver.delete(op.resourceId)
205
+ }
206
+ }),
207
+ ).pipe(
211
208
  Effect.tapErrorCause(_ => Effect.logError("ops error, restarting", _)),
212
209
  Effect.retry(retryPolicy),
213
210
  Effect.forkScoped,
214
211
  Effect.interruptible,
215
212
  )
216
213
 
217
- yield* _(
218
- driver.run,
214
+ yield driver.run.pipe(
219
215
  Effect.tapErrorCause(_ =>
220
216
  Effect.logError("cache driver error, restarting", _),
221
217
  ),
@@ -40,8 +40,8 @@ export const JsonDiscordWSCodecLive = Layer.succeed(DiscordWSCodec, {
40
40
  decode: p => JSON.parse(typeof p === "string" ? p : decoder.decode(p)),
41
41
  })
42
42
 
43
- const make = Effect.gen(function* (_) {
44
- const encoding = yield* _(DiscordWSCodec)
43
+ const make = Effect.gen(function* () {
44
+ const encoding = yield* DiscordWSCodec
45
45
 
46
46
  const connect = ({
47
47
  onConnecting,
@@ -49,22 +49,19 @@ const make = Effect.gen(function* (_) {
49
49
  url = "wss://gateway.discord.gg/",
50
50
  version = 10,
51
51
  }: OpenOpts) =>
52
- Effect.gen(function* (_) {
53
- const urlRef = yield* _(
54
- Ref.make(`${url}?v=${version}&encoding=${encoding.type}`),
52
+ Effect.gen(function* () {
53
+ const urlRef = yield* Ref.make(
54
+ `${url}?v=${version}&encoding=${encoding.type}`,
55
55
  )
56
56
  const setUrl = (url: string) =>
57
57
  Ref.set(urlRef, `${url}?v=${version}&encoding=${encoding.type}`)
58
- const messages = yield* _(Queue.unbounded<Discord.GatewayPayload>())
59
- const socket = yield* _(
60
- Socket.makeWebSocket(Ref.get(urlRef), {
61
- closeCodeIsError: _ => true,
62
- openTimeout: 5000,
63
- }),
64
- )
65
- const write = yield* _(socket.writer)
66
- yield* _(
67
- outbound,
58
+ const messages = yield* Queue.unbounded<Discord.GatewayPayload>()
59
+ const socket = yield* Socket.makeWebSocket(Ref.get(urlRef), {
60
+ closeCodeIsError: _ => true,
61
+ openTimeout: 5000,
62
+ })
63
+ const write = yield* socket.writer
64
+ yield outbound.pipe(
68
65
  Effect.flatMap(_ => {
69
66
  if (_ === Reconnect) {
70
67
  return Effect.zipRight(
@@ -79,8 +76,7 @@ const make = Effect.gen(function* (_) {
79
76
  Effect.forkScoped,
80
77
  Effect.interruptible,
81
78
  )
82
- yield* _(
83
- onConnecting,
79
+ yield onConnecting.pipe(
84
80
  Effect.zipRight(
85
81
  socket.runRaw(_ => {
86
82
  const message = encoding.decode(_)
@@ -32,19 +32,15 @@ const handleDispatchFactory =
32
32
  return Effect.void as any
33
33
  })
34
34
 
35
- export const make = Effect.gen(function* (_) {
36
- const hub = yield* _(
37
- Effect.acquireRelease(
38
- PubSub.unbounded<Discord.GatewayPayload<Discord.ReceiveEvent>>(),
39
- PubSub.shutdown,
40
- ),
35
+ export const make = Effect.gen(function* () {
36
+ const hub = yield* Effect.acquireRelease(
37
+ PubSub.unbounded<Discord.GatewayPayload<Discord.ReceiveEvent>>(),
38
+ PubSub.shutdown,
41
39
  )
42
40
 
43
- const sendQueue = yield* _(
44
- Effect.acquireRelease(
45
- Queue.unbounded<Discord.GatewayPayload<Discord.SendEvent>>(),
46
- Queue.shutdown,
47
- ),
41
+ const sendQueue = yield* Effect.acquireRelease(
42
+ Queue.unbounded<Discord.GatewayPayload<Discord.SendEvent>>(),
43
+ Queue.shutdown,
48
44
  )
49
45
  const send = (payload: Discord.GatewayPayload<Discord.SendEvent>) =>
50
46
  sendQueue.offer(payload)
@@ -30,17 +30,17 @@ const enum Phase {
30
30
  Connected,
31
31
  }
32
32
 
33
- export const make = Effect.gen(function* (_) {
34
- const { gateway, token } = yield* _(DiscordConfig)
35
- const limiter = yield* _(RateLimiter)
36
- const dws = yield* _(DiscordWS)
37
- const { hub, sendQueue } = yield* _(Messaging)
33
+ export const make = Effect.gen(function* () {
34
+ const { gateway, token } = yield* DiscordConfig
35
+ const limiter = yield* RateLimiter
36
+ const dws = yield* DiscordWS
37
+ const { hub, sendQueue } = yield* Messaging
38
38
 
39
39
  const connect = (shard: [id: number, count: number]) =>
40
- Effect.gen(function* (_) {
41
- const outboundQueue = yield* _(Queue.unbounded<Message>())
42
- const pendingQueue = yield* _(Queue.unbounded<Message>())
43
- const phase = yield* _(Ref.make(Phase.Connecting))
40
+ Effect.gen(function* () {
41
+ const outboundQueue = yield* Queue.unbounded<Message>()
42
+ const pendingQueue = yield* Queue.unbounded<Message>()
43
+ const phase = yield* Ref.make(Phase.Connecting)
44
44
  const setPhase = (p: Phase) =>
45
45
  Effect.zipLeft(
46
46
  Ref.set(phase, p),
@@ -92,7 +92,7 @@ export const make = Effect.gen(function* (_) {
92
92
  Effect.zipRight(setPhase(Phase.Connecting)),
93
93
  )
94
94
 
95
- const socket = yield* _(dws.connect({ outbound, onConnecting }))
95
+ const socket = yield* dws.connect({ outbound, onConnecting })
96
96
 
97
97
  const isReady = Option.liftPredicate(
98
98
  (
@@ -101,11 +101,11 @@ export const make = Effect.gen(function* (_) {
101
101
  p.op === Discord.GatewayOpcode.DISPATCH && p.t === "READY",
102
102
  )
103
103
 
104
- const [latestReady, updateLatestReady] = yield* _(
105
- Utils.latest(p => Option.map(isReady(p), p => p.d!)),
104
+ const [latestReady, updateLatestReady] = yield* Utils.latest(p =>
105
+ Option.map(isReady(p), p => p.d!),
106
106
  )
107
- const [latestSequence, updateLatestSequence] = yield* _(
108
- Utils.latest(p => Option.fromNullable(p.s)),
107
+ const [latestSequence, updateLatestSequence] = yield* Utils.latest(p =>
108
+ Option.fromNullable(p.s),
109
109
  )
110
110
  const maybeUpdateUrl = (p: Discord.GatewayPayload) =>
111
111
  Option.match(
@@ -117,22 +117,17 @@ export const make = Effect.gen(function* (_) {
117
117
  },
118
118
  )
119
119
 
120
- const hellos = yield* _(
121
- Effect.acquireRelease(
122
- Queue.unbounded<Discord.GatewayPayload>(),
123
- Queue.shutdown,
124
- ),
120
+ const hellos = yield* Effect.acquireRelease(
121
+ Queue.unbounded<Discord.GatewayPayload>(),
122
+ Queue.shutdown,
125
123
  )
126
- const acks = yield* _(
127
- Effect.acquireRelease(
128
- Queue.unbounded<Discord.GatewayPayload>(),
129
- Queue.shutdown,
130
- ),
124
+ const acks = yield* Effect.acquireRelease(
125
+ Queue.unbounded<Discord.GatewayPayload>(),
126
+ Queue.shutdown,
131
127
  )
132
128
 
133
129
  // heartbeats
134
- yield* _(
135
- Heartbeats.send(hellos, acks, latestSequence, heartbeatSend),
130
+ yield Heartbeats.send(hellos, acks, latestSequence, heartbeatSend).pipe(
136
131
  Effect.forkScoped,
137
132
  Effect.interruptible,
138
133
  )
@@ -188,16 +183,14 @@ export const make = Effect.gen(function* (_) {
188
183
  }),
189
184
  )
190
185
 
191
- yield* _(
192
- Queue.take(sendQueue),
186
+ yield Queue.take(sendQueue).pipe(
193
187
  Effect.tap(send),
194
188
  Effect.forever,
195
189
  Effect.forkScoped,
196
190
  Effect.interruptible,
197
191
  )
198
192
 
199
- yield* _(
200
- socket.take,
193
+ yield socket.take.pipe(
201
194
  Effect.flatMap(onPayload),
202
195
  Effect.forever,
203
196
  Effect.forkScoped,
@@ -20,16 +20,15 @@ const claimRepeatPolicy = Schedule.spaced("3 minutes").pipe(
20
20
  Schedule.passthrough,
21
21
  ) as Schedule.Schedule<Option.Some<number>, Option.Option<number>>
22
22
 
23
- const make = Effect.gen(function* (_) {
24
- const store = yield* _(ShardStore)
25
- const rest = yield* _(DiscordREST)
26
- const { gateway: config } = yield* _(DiscordConfig)
27
- const limiter = yield* _(RateLimiter)
28
- const shard = yield* _(Shard)
29
- const currentShards = yield* _(Ref.make(HashSet.empty<RunningShard>()))
23
+ const make = Effect.gen(function* () {
24
+ const store = yield* ShardStore
25
+ const rest = yield* DiscordREST
26
+ const { gateway: config } = yield* DiscordConfig
27
+ const limiter = yield* RateLimiter
28
+ const shard = yield* Shard
29
+ const currentShards = yield* Ref.make(HashSet.empty<RunningShard>())
30
30
 
31
- const gateway = yield* _(
32
- rest.getGatewayBot(),
31
+ const gateway = yield* rest.getGatewayBot().pipe(
33
32
  Effect.flatMap(r => r.json),
34
33
  Effect.catchAll(() =>
35
34
  Effect.succeed<Discord.GetGatewayBotResponse>({
@@ -46,7 +45,7 @@ const make = Effect.gen(function* (_) {
46
45
  )
47
46
 
48
47
  const totalCount = config.shardCount ?? gateway.shards
49
- const currentCount = yield* _(Ref.make(0))
48
+ const currentCount = yield* Ref.make(0)
50
49
  const claimId = (sharderCount: number): Effect.Effect<number> =>
51
50
  pipe(
52
51
  store.claimId({
@@ -81,12 +80,11 @@ const make = Effect.gen(function* (_) {
81
80
  Effect.forever,
82
81
  )
83
82
 
84
- yield* _(
85
- Effect.replicateEffect(
86
- spawner,
87
- gateway.session_start_limit.max_concurrency,
88
- { concurrency: "unbounded", discard: true },
89
- ),
83
+ yield Effect.replicateEffect(
84
+ spawner,
85
+ gateway.session_start_limit.max_concurrency,
86
+ { concurrency: "unbounded", discard: true },
87
+ ).pipe(
90
88
  Effect.scoped,
91
89
  Effect.catchAllCause(Effect.logError),
92
90
  Effect.ensuring(Ref.set(currentShards, HashSet.empty())),
@@ -30,9 +30,9 @@ export interface DiscordGateway {
30
30
 
31
31
  export const DiscordGateway = GenericTag<DiscordGateway>("dfx/DiscordGateway")
32
32
 
33
- export const make = Effect.gen(function* (_) {
34
- const sharder = yield* _(Sharder)
35
- const messaging = yield* _(Messaging)
33
+ export const make = Effect.gen(function* () {
34
+ const sharder = yield* Sharder
35
+ const messaging = yield* Messaging
36
36
 
37
37
  return DiscordGateway.of({
38
38
  [TypeId]: TypeId,
@@ -42,12 +42,12 @@ export class DiscordRESTError extends TypeIdError(
42
42
  }
43
43
  }
44
44
 
45
- const make = Effect.gen(function* (_) {
46
- const { rest, token } = yield* _(DiscordConfig)
45
+ const make = Effect.gen(function* () {
46
+ const { rest, token } = yield* DiscordConfig
47
47
 
48
- const http = yield* _(Http.client.Client)
49
- const store = yield* _(RateLimitStore)
50
- const { maybeWait } = yield* _(RateLimiter)
48
+ const http = yield* Http.client.Client
49
+ const store = yield* RateLimitStore
50
+ const { maybeWait } = yield* RateLimiter
51
51
 
52
52
  const globalRateLimit = maybeWait(
53
53
  "dfx.rest.global",
@@ -56,7 +56,7 @@ const make = Effect.gen(function* (_) {
56
56
  )
57
57
 
58
58
  // Invalid route handling (40x)
59
- const badRoutesRef = yield* _(Ref.make(HashSet.empty<string>()))
59
+ const badRoutesRef = yield* Ref.make(HashSet.empty<string>())
60
60
  const tenMinutes = Duration.toMillis(Duration.minutes(10))
61
61
  const addBadRoute = (route: string) =>
62
62
  Effect.logDebug("bad route").pipe(