dfx 0.76.1 → 0.77.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.
- package/Cache/prelude.d.ts +3 -3
- package/DiscordConfig.d.ts +2 -2
- package/DiscordConfig.d.ts.map +1 -1
- package/DiscordConfig.js +5 -5
- package/DiscordConfig.js.map +1 -1
- package/DiscordGateway/DiscordWS.d.ts +1 -1
- package/DiscordGateway/DiscordWS.js +2 -2
- package/DiscordGateway/DiscordWS.js.map +1 -1
- package/DiscordGateway/Shard.d.ts +2 -2
- package/DiscordGateway/Shard.js +2 -2
- package/DiscordGateway/Shard.js.map +1 -1
- package/DiscordGateway/ShardStore.d.ts +1 -1
- package/DiscordGateway/ShardStore.js +2 -2
- package/DiscordGateway/ShardStore.js.map +1 -1
- package/DiscordGateway/Sharder.d.ts +2 -2
- package/DiscordGateway/Sharder.d.ts.map +1 -1
- package/DiscordGateway/Sharder.js +2 -2
- package/DiscordGateway/Sharder.js.map +1 -1
- package/DiscordGateway/WS.d.ts +1 -2
- package/DiscordGateway/WS.d.ts.map +1 -1
- package/DiscordGateway/WS.js +2 -2
- package/DiscordGateway/WS.js.map +1 -1
- package/DiscordGateway.d.ts +1 -1
- package/DiscordGateway.d.ts.map +1 -1
- package/DiscordGateway.js +2 -2
- package/DiscordGateway.js.map +1 -1
- package/DiscordREST.d.ts +1 -1
- package/DiscordREST.js +2 -2
- package/DiscordREST.js.map +1 -1
- package/Interactions/context.d.ts +1 -1
- package/Interactions/definitions.d.ts +3 -3
- package/Interactions/gateway.d.ts +5 -8
- package/Interactions/gateway.d.ts.map +1 -1
- package/Interactions/gateway.js +12 -12
- package/Interactions/gateway.js.map +1 -1
- package/Interactions/webhook.d.ts +2 -2
- package/Interactions/webhook.d.ts.map +1 -1
- package/Interactions/webhook.js +5 -5
- package/Interactions/webhook.js.map +1 -1
- package/Log.d.ts +2 -2
- package/Log.d.ts.map +1 -1
- package/Log.js +3 -3
- package/Log.js.map +1 -1
- package/RateLimit.d.ts +1 -1
- package/RateLimit.js +2 -2
- package/RateLimit.js.map +1 -1
- package/gateway.d.ts +4 -12
- package/gateway.d.ts.map +1 -1
- package/gateway.js +18 -14
- package/gateway.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/mjs/DiscordConfig.mjs +2 -2
- package/mjs/DiscordConfig.mjs.map +1 -1
- package/mjs/DiscordGateway/DiscordWS.mjs +2 -2
- package/mjs/DiscordGateway/DiscordWS.mjs.map +1 -1
- package/mjs/DiscordGateway/Shard.mjs +3 -3
- package/mjs/DiscordGateway/Shard.mjs.map +1 -1
- package/mjs/DiscordGateway/ShardStore.mjs +1 -1
- package/mjs/DiscordGateway/ShardStore.mjs.map +1 -1
- package/mjs/DiscordGateway/Sharder.mjs +3 -3
- package/mjs/DiscordGateway/Sharder.mjs.map +1 -1
- package/mjs/DiscordGateway/WS.mjs +1 -1
- package/mjs/DiscordGateway/WS.mjs.map +1 -1
- package/mjs/DiscordGateway.mjs +2 -2
- package/mjs/DiscordGateway.mjs.map +1 -1
- package/mjs/DiscordREST.mjs +2 -2
- package/mjs/DiscordREST.mjs.map +1 -1
- package/mjs/Interactions/gateway.mjs +10 -10
- package/mjs/Interactions/gateway.mjs.map +1 -1
- package/mjs/Interactions/webhook.mjs +2 -2
- package/mjs/Interactions/webhook.mjs.map +1 -1
- package/mjs/Log.mjs +2 -2
- package/mjs/Log.mjs.map +1 -1
- package/mjs/RateLimit.mjs +1 -1
- package/mjs/RateLimit.mjs.map +1 -1
- package/mjs/gateway.mjs +10 -17
- package/mjs/gateway.mjs.map +1 -1
- package/mjs/index.mjs +2 -2
- package/mjs/index.mjs.map +1 -1
- package/mjs/version.mjs +1 -1
- package/mjs/webhooks.mjs +5 -19
- package/mjs/webhooks.mjs.map +1 -1
- package/package.json +2 -2
- package/src/DiscordConfig.ts +2 -2
- package/src/DiscordGateway/DiscordWS.ts +3 -3
- package/src/DiscordGateway/Shard.ts +4 -4
- package/src/DiscordGateway/ShardStore.ts +1 -1
- package/src/DiscordGateway/Sharder.ts +4 -4
- package/src/DiscordGateway/WS.ts +1 -1
- package/src/DiscordGateway.ts +3 -3
- package/src/DiscordREST.ts +3 -3
- package/src/Interactions/gateway.ts +48 -46
- package/src/Interactions/webhook.ts +2 -2
- package/src/Log.ts +5 -2
- package/src/RateLimit.ts +1 -1
- package/src/gateway.ts +24 -47
- package/src/index.ts +5 -2
- package/src/version.ts +1 -1
- package/src/webhooks.ts +14 -53
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/webhooks.d.ts +3 -12
- package/webhooks.d.ts.map +1 -1
- package/webhooks.js +16 -26
- package/webhooks.js.map +1 -1
package/src/DiscordConfig.ts
CHANGED
|
@@ -60,12 +60,12 @@ export const make = ({
|
|
|
60
60
|
},
|
|
61
61
|
})
|
|
62
62
|
|
|
63
|
-
export const
|
|
63
|
+
export const layer = (
|
|
64
64
|
opts: MakeOpts,
|
|
65
65
|
): Layer.Layer<never, never, DiscordConfig> =>
|
|
66
66
|
Layer.succeed(DiscordConfig, make(opts))
|
|
67
67
|
|
|
68
|
-
export const
|
|
68
|
+
export const layerConfig = (
|
|
69
69
|
_: Config.Config.Wrap<MakeOpts>,
|
|
70
70
|
): Layer.Layer<never, ConfigError.ConfigError, DiscordConfig> =>
|
|
71
71
|
Layer.effect(DiscordConfig, Effect.map(Effect.config(Config.unwrap(_)), make))
|
|
@@ -2,7 +2,7 @@ import { Tag } from "effect/Context"
|
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
3
|
import * as Layer from "effect/Layer"
|
|
4
4
|
import * as Ref from "effect/Ref"
|
|
5
|
-
import {
|
|
5
|
+
import { WSLive, Reconnect, WS } from "dfx/DiscordGateway/WS"
|
|
6
6
|
import type * as Discord from "dfx/types"
|
|
7
7
|
import type WebSocket from "isomorphic-ws"
|
|
8
8
|
|
|
@@ -69,7 +69,7 @@ const make = Effect.gen(function* (_) {
|
|
|
69
69
|
|
|
70
70
|
export interface DiscordWS extends Effect.Effect.Success<typeof make> {}
|
|
71
71
|
export const DiscordWS = Tag<DiscordWS>()
|
|
72
|
-
export const
|
|
72
|
+
export const DiscordWSLive = Layer.provide(
|
|
73
73
|
Layer.effect(DiscordWS, make),
|
|
74
|
-
|
|
74
|
+
WSLive,
|
|
75
75
|
)
|
|
@@ -11,14 +11,14 @@ import * as Queue from "effect/Queue"
|
|
|
11
11
|
import * as Ref from "effect/Ref"
|
|
12
12
|
import { DiscordConfig } from "dfx/DiscordConfig"
|
|
13
13
|
import type { Message } from "dfx/DiscordGateway/DiscordWS"
|
|
14
|
-
import { DiscordWS,
|
|
14
|
+
import { DiscordWS, DiscordWSLive } from "dfx/DiscordGateway/DiscordWS"
|
|
15
15
|
import * as Heartbeats from "dfx/DiscordGateway/Shard/heartbeats"
|
|
16
16
|
import * as Identify from "dfx/DiscordGateway/Shard/identify"
|
|
17
17
|
import * as InvalidSession from "dfx/DiscordGateway/Shard/invalidSession"
|
|
18
18
|
import * as Utils from "dfx/DiscordGateway/Shard/utils"
|
|
19
19
|
import { Reconnect } from "dfx/DiscordGateway/WS"
|
|
20
20
|
import { Log } from "dfx/Log"
|
|
21
|
-
import {
|
|
21
|
+
import { RateLimiterLive, RateLimiter } from "dfx/RateLimit"
|
|
22
22
|
import * as Discord from "dfx/types"
|
|
23
23
|
|
|
24
24
|
const enum Phase {
|
|
@@ -191,9 +191,9 @@ export const make = Effect.gen(function* (_) {
|
|
|
191
191
|
|
|
192
192
|
export interface Shard extends Effect.Effect.Success<typeof make> {}
|
|
193
193
|
export const Shard = Tag<Shard>()
|
|
194
|
-
export const
|
|
194
|
+
export const ShardLive = Layer.provide(
|
|
195
195
|
Layer.effect(Shard, make),
|
|
196
|
-
Layer.merge(
|
|
196
|
+
Layer.merge(DiscordWSLive, RateLimiterLive),
|
|
197
197
|
)
|
|
198
198
|
|
|
199
199
|
export interface RunningShard
|
|
@@ -13,11 +13,11 @@ import * as Ref from "effect/Ref"
|
|
|
13
13
|
import * as Schedule from "effect/Schedule"
|
|
14
14
|
import { DiscordConfig } from "dfx/DiscordConfig"
|
|
15
15
|
import type { RunningShard } from "dfx/DiscordGateway/Shard"
|
|
16
|
-
import {
|
|
16
|
+
import { ShardLive, Shard } from "dfx/DiscordGateway/Shard"
|
|
17
17
|
import { ShardStore } from "dfx/DiscordGateway/ShardStore"
|
|
18
18
|
import type { WebSocketCloseError, WebSocketError } from "dfx/DiscordGateway/WS"
|
|
19
19
|
import { DiscordREST } from "dfx/DiscordREST"
|
|
20
|
-
import {
|
|
20
|
+
import { RateLimiterLive, RateLimiter } from "dfx/RateLimit"
|
|
21
21
|
import type * as Discord from "dfx/types"
|
|
22
22
|
|
|
23
23
|
const claimRepeatPolicy = Schedule.spaced("3 minutes").pipe(
|
|
@@ -134,7 +134,7 @@ const make = Effect.gen(function* (_) {
|
|
|
134
134
|
|
|
135
135
|
export interface Sharder extends Effect.Effect.Success<typeof make> {}
|
|
136
136
|
export const Sharder = Tag<Sharder>()
|
|
137
|
-
export const
|
|
137
|
+
export const SharedLive = Layer.provide(
|
|
138
138
|
Layer.effect(Sharder, make),
|
|
139
|
-
Layer.merge(
|
|
139
|
+
Layer.merge(RateLimiterLive, ShardLive),
|
|
140
140
|
)
|
package/src/DiscordGateway/WS.ts
CHANGED
package/src/DiscordGateway.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as Layer from "effect/Layer"
|
|
|
6
6
|
import * as Queue from "effect/Queue"
|
|
7
7
|
import * as Stream from "effect/Stream"
|
|
8
8
|
import type { RunningShard } from "dfx/DiscordGateway/Shard"
|
|
9
|
-
import {
|
|
9
|
+
import { SharedLive, Sharder } from "dfx/DiscordGateway/Sharder"
|
|
10
10
|
import type * as Discord from "dfx/types"
|
|
11
11
|
import * as EffectUtils from "dfx/utils/Effect"
|
|
12
12
|
import * as Schedule from "effect/Schedule"
|
|
@@ -97,7 +97,7 @@ export const make = Effect.gen(function* (_) {
|
|
|
97
97
|
}),
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
export const
|
|
100
|
+
export const DiscordGatewayLive = Layer.provide(
|
|
101
101
|
Layer.scoped(DiscordGateway, make),
|
|
102
|
-
|
|
102
|
+
SharedLive,
|
|
103
103
|
)
|
package/src/DiscordREST.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
routeFromConfig,
|
|
18
18
|
} from "dfx/DiscordREST/utils"
|
|
19
19
|
import { Log } from "dfx/Log"
|
|
20
|
-
import {
|
|
20
|
+
import { RateLimiterLive, RateLimiter, RateLimitStore } from "dfx/RateLimit"
|
|
21
21
|
import * as Discord from "dfx/types"
|
|
22
22
|
import { LIB_VERSION } from "dfx/version"
|
|
23
23
|
|
|
@@ -254,7 +254,7 @@ export interface DiscordREST
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
export const DiscordREST = Tag<DiscordREST>()
|
|
257
|
-
export const
|
|
258
|
-
Layer.provide(
|
|
257
|
+
export const DiscordRESTLive = Layer.effect(DiscordREST, make).pipe(
|
|
258
|
+
Layer.provide(RateLimiterLive),
|
|
259
259
|
Layer.provide(Http.client.layer),
|
|
260
260
|
)
|
|
@@ -21,14 +21,17 @@ import { builder, Interaction } from "dfx/Interactions/index"
|
|
|
21
21
|
import type * as Discord from "dfx/types"
|
|
22
22
|
import * as EffectUtils from "dfx/utils/Effect"
|
|
23
23
|
import * as Schedule from "effect/Schedule"
|
|
24
|
+
import { globalValue } from "effect/GlobalValue"
|
|
25
|
+
import * as FiberRef from "effect/FiberRef"
|
|
24
26
|
|
|
25
|
-
export
|
|
26
|
-
sync
|
|
27
|
-
|
|
27
|
+
export const interactionsSync: FiberRef.FiberRef<boolean> = globalValue(
|
|
28
|
+
"dfx/Interactions/sync",
|
|
29
|
+
() => FiberRef.unsafeMake(true),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
export const setInteractionsSync = (enabled: boolean) =>
|
|
33
|
+
Layer.locally(interactionsSync, enabled)
|
|
28
34
|
|
|
29
|
-
/**
|
|
30
|
-
* @tsplus pipeable dfx/InteractionBuilder runGateway
|
|
31
|
-
*/
|
|
32
35
|
export const run =
|
|
33
36
|
<R, R2, E, TE, E2>(
|
|
34
37
|
postHandler: (
|
|
@@ -38,7 +41,6 @@ export const run =
|
|
|
38
41
|
void
|
|
39
42
|
>,
|
|
40
43
|
) => Effect.Effect<R2, E2, void>,
|
|
41
|
-
{ sync = true }: RunOpts = {},
|
|
42
44
|
) =>
|
|
43
45
|
(
|
|
44
46
|
ix: InteractionBuilder<R, E, TE>,
|
|
@@ -100,6 +102,8 @@ export const run =
|
|
|
100
102
|
Effect.provideService(postHandler(handle[i.type](i)), Interaction, i),
|
|
101
103
|
)
|
|
102
104
|
|
|
105
|
+
const sync = yield* _(FiberRef.get(interactionsSync))
|
|
106
|
+
|
|
103
107
|
return yield* _(
|
|
104
108
|
sync
|
|
105
109
|
? Effect.forever(
|
|
@@ -112,49 +116,45 @@ export const run =
|
|
|
112
116
|
)
|
|
113
117
|
})
|
|
114
118
|
|
|
115
|
-
const makeRegistry = (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
119
|
+
const makeRegistry = Effect.gen(function* (_) {
|
|
120
|
+
const ref = yield* _(
|
|
121
|
+
Ref.make(builder as InteractionBuilder<never, never, never>),
|
|
122
|
+
)
|
|
123
|
+
const queue = yield* _(
|
|
124
|
+
Queue.sliding<InteractionBuilder<never, never, never>>(1),
|
|
125
|
+
)
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
const register = <E>(ix: InteractionBuilder<never, E, never>) =>
|
|
128
|
+
Effect.flatMap(
|
|
129
|
+
Ref.updateAndGet(ref, _ => _.concat(ix as any)),
|
|
130
|
+
_ => Queue.offer(queue, _),
|
|
131
|
+
)
|
|
129
132
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
options,
|
|
137
|
-
),
|
|
138
|
-
Effect.delay(Duration.seconds(0.1)),
|
|
139
|
-
),
|
|
133
|
+
yield* _(
|
|
134
|
+
EffectUtils.foreverSwitch(Queue.take(queue), ix =>
|
|
135
|
+
pipe(
|
|
136
|
+
ix,
|
|
137
|
+
run(Effect.catchAllCause(_ => Effect.logError("unhandled error", _))),
|
|
138
|
+
Effect.delay(Duration.seconds(0.1)),
|
|
140
139
|
),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
),
|
|
140
|
+
),
|
|
141
|
+
Effect.tapErrorCause(_ => Effect.logError("registry error", _)),
|
|
142
|
+
Effect.retry(
|
|
143
|
+
Schedule.exponential("1 seconds").pipe(
|
|
144
|
+
Schedule.union(Schedule.spaced("20 seconds")),
|
|
146
145
|
),
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return { register } as const
|
|
151
|
-
}).pipe(
|
|
152
|
-
Effect.annotateLogs({
|
|
153
|
-
package: "dfx",
|
|
154
|
-
service: "InteractionsRegistry",
|
|
155
|
-
}),
|
|
146
|
+
),
|
|
147
|
+
Effect.forkScoped,
|
|
156
148
|
)
|
|
157
149
|
|
|
150
|
+
return { register } as const
|
|
151
|
+
}).pipe(
|
|
152
|
+
Effect.annotateLogs({
|
|
153
|
+
package: "dfx",
|
|
154
|
+
service: "InteractionsRegistry",
|
|
155
|
+
}),
|
|
156
|
+
)
|
|
157
|
+
|
|
158
158
|
export interface InteractionsRegistry {
|
|
159
159
|
readonly register: <E>(
|
|
160
160
|
ix: InteractionBuilder<never, E, never>,
|
|
@@ -162,5 +162,7 @@ export interface InteractionsRegistry {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
export const InteractionsRegistry = Tag<InteractionsRegistry>()
|
|
165
|
-
export const InteractionsRegistryLive = (
|
|
166
|
-
|
|
165
|
+
export const InteractionsRegistryLive = Layer.scoped(
|
|
166
|
+
InteractionsRegistry,
|
|
167
|
+
makeRegistry,
|
|
168
|
+
)
|
|
@@ -71,10 +71,10 @@ const makeConfig = ({
|
|
|
71
71
|
export interface WebhookConfig extends ReturnType<typeof makeConfig> {}
|
|
72
72
|
export const WebhookConfig = Tag<WebhookConfig>()
|
|
73
73
|
|
|
74
|
-
export const
|
|
74
|
+
export const layer = (opts: MakeConfigOpts) =>
|
|
75
75
|
Layer.succeed(WebhookConfig, makeConfig(opts))
|
|
76
76
|
|
|
77
|
-
export const
|
|
77
|
+
export const layerConfig: (
|
|
78
78
|
a: Config.Config<MakeConfigOpts>,
|
|
79
79
|
) => Layer.Layer<never, ConfigError.ConfigError, WebhookConfig> = (
|
|
80
80
|
a: Config.Config<MakeConfigOpts>,
|
package/src/Log.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DiscordConfig } from "dfx/DiscordConfig"
|
|
1
2
|
import { Tag } from "effect/Context"
|
|
2
3
|
import * as Effect from "effect/Effect"
|
|
3
4
|
import * as Layer from "effect/Layer"
|
|
@@ -17,5 +18,7 @@ const make = (debug = false) => ({
|
|
|
17
18
|
|
|
18
19
|
export interface Log extends ReturnType<typeof make> {}
|
|
19
20
|
export const Log = Tag<Log>()
|
|
20
|
-
export const
|
|
21
|
-
|
|
21
|
+
export const LogLive = Layer.effect(
|
|
22
|
+
Log,
|
|
23
|
+
Effect.map(DiscordConfig, config => make(config.debug)),
|
|
24
|
+
)
|
package/src/RateLimit.ts
CHANGED
|
@@ -79,4 +79,4 @@ const makeLimiter = Effect.gen(function* (_) {
|
|
|
79
79
|
export interface RateLimiter
|
|
80
80
|
extends Effect.Effect.Success<typeof makeLimiter> {}
|
|
81
81
|
export const RateLimiter = Tag<RateLimiter>()
|
|
82
|
-
export const
|
|
82
|
+
export const RateLimiterLive = Layer.effect(RateLimiter, makeLimiter)
|
package/src/gateway.ts
CHANGED
|
@@ -1,65 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type * as ConfigError from "effect/ConfigError"
|
|
3
|
-
import * as Effect from "effect/Effect"
|
|
4
|
-
import * as Layer from "effect/Layer"
|
|
5
|
-
import type { DiscordREST } from "dfx"
|
|
6
|
-
import { DiscordConfig, LiveDiscordREST, Log } from "dfx"
|
|
1
|
+
import { LiveDiscordREST as DiscordRESTLive } from "dfx"
|
|
7
2
|
import * as CachePrelude from "dfx/Cache/prelude"
|
|
8
|
-
import
|
|
9
|
-
import { LiveDiscordGateway } from "dfx/DiscordGateway"
|
|
3
|
+
import { DiscordGatewayLive } from "dfx/DiscordGateway"
|
|
10
4
|
import * as DiscordWS from "dfx/DiscordGateway/DiscordWS"
|
|
11
|
-
import { LiveJsonDiscordWSCodec } from "dfx/DiscordGateway/DiscordWS"
|
|
5
|
+
import { LiveJsonDiscordWSCodec as JsonDiscordWSCodecLive } from "dfx/DiscordGateway/DiscordWS"
|
|
12
6
|
import * as Shard from "dfx/DiscordGateway/Shard"
|
|
13
7
|
import * as SendEvent from "dfx/DiscordGateway/Shard/sendEvents"
|
|
14
8
|
import * as ShardStore from "dfx/DiscordGateway/ShardStore"
|
|
15
|
-
import {
|
|
9
|
+
import { MemoryShardStoreLive as MemoryShardStoreLive } from "dfx/DiscordGateway/ShardStore"
|
|
16
10
|
import * as WS from "dfx/DiscordGateway/WS"
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
11
|
+
import { LogLive } from "dfx/Log"
|
|
12
|
+
import {
|
|
13
|
+
LiveMemoryRateLimitStore as MemoryRateLimitStoreLive,
|
|
14
|
+
RateLimiterLive as RateLimiterLive,
|
|
15
|
+
} from "dfx/RateLimit"
|
|
16
|
+
import * as Layer from "effect/Layer"
|
|
19
17
|
|
|
20
|
-
export {
|
|
18
|
+
export {
|
|
19
|
+
DiscordGateway,
|
|
20
|
+
DiscordGatewayLive as LiveDiscordGateway,
|
|
21
|
+
} from "dfx/DiscordGateway"
|
|
21
22
|
|
|
22
23
|
export {
|
|
23
24
|
InteractionsRegistry,
|
|
24
25
|
InteractionsRegistryLive,
|
|
26
|
+
interactionsSync,
|
|
25
27
|
run as runIx,
|
|
28
|
+
setInteractionsSync,
|
|
26
29
|
} from "dfx/Interactions/gateway"
|
|
27
30
|
|
|
28
31
|
export { CachePrelude, DiscordWS, SendEvent, Shard, ShardStore, WS }
|
|
29
32
|
|
|
30
|
-
export const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
export const MemoryBot = Layer.mergeAll(
|
|
36
|
-
MemoryRateLimit,
|
|
37
|
-
LiveDiscordGateway,
|
|
33
|
+
export const DiscordLive = Layer.mergeAll(
|
|
34
|
+
RateLimiterLive,
|
|
35
|
+
DiscordGatewayLive,
|
|
38
36
|
).pipe(
|
|
39
|
-
Layer.provideMerge(
|
|
40
|
-
Layer.provide(
|
|
41
|
-
Layer.provide(
|
|
42
|
-
Layer.provide(
|
|
37
|
+
Layer.provideMerge(DiscordRESTLive),
|
|
38
|
+
Layer.provide(JsonDiscordWSCodecLive),
|
|
39
|
+
Layer.provide(MemoryRateLimitStoreLive),
|
|
40
|
+
Layer.provide(MemoryShardStoreLive),
|
|
41
|
+
Layer.provideMerge(LogLive),
|
|
43
42
|
)
|
|
44
|
-
|
|
45
|
-
export const gatewayLayer = (
|
|
46
|
-
config: Config.Config.Wrap<DiscordConfig.MakeOpts>,
|
|
47
|
-
): Layer.Layer<
|
|
48
|
-
never,
|
|
49
|
-
ConfigError.ConfigError,
|
|
50
|
-
| RateLimiter
|
|
51
|
-
| Log.Log
|
|
52
|
-
| DiscordREST
|
|
53
|
-
| DiscordGateway
|
|
54
|
-
| DiscordConfig.DiscordConfig
|
|
55
|
-
> =>
|
|
56
|
-
Layer.unwrapEffect(
|
|
57
|
-
Effect.config(Config.unwrap(config)).pipe(
|
|
58
|
-
Effect.map(DiscordConfig.make),
|
|
59
|
-
Effect.map(config => {
|
|
60
|
-
const LiveLog = config.debug ? Log.LiveLogDebug : Log.LiveLog
|
|
61
|
-
const LiveConfig = Layer.succeed(DiscordConfig.DiscordConfig, config)
|
|
62
|
-
return Layer.provideMerge(MemoryBot, Layer.merge(LiveLog, LiveConfig))
|
|
63
|
-
}),
|
|
64
|
-
),
|
|
65
|
-
)
|
package/src/index.ts
CHANGED
|
@@ -10,12 +10,15 @@ import * as Ix from "dfx/Interactions/index"
|
|
|
10
10
|
import * as Log from "dfx/Log"
|
|
11
11
|
import * as Discord from "dfx/types"
|
|
12
12
|
|
|
13
|
-
export {
|
|
13
|
+
export {
|
|
14
|
+
DiscordREST,
|
|
15
|
+
DiscordRESTLive as LiveDiscordREST,
|
|
16
|
+
} from "dfx/DiscordREST"
|
|
14
17
|
|
|
15
18
|
export {
|
|
16
19
|
BucketDetails,
|
|
17
20
|
LiveMemoryRateLimitStore,
|
|
18
|
-
LiveRateLimiter,
|
|
21
|
+
RateLimiterLive as LiveRateLimiter,
|
|
19
22
|
RateLimiter,
|
|
20
23
|
RateLimitStore,
|
|
21
24
|
} from "dfx/RateLimit"
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.
|
|
1
|
+
export const LIB_VERSION = "0.77.0";
|
package/src/webhooks.ts
CHANGED
|
@@ -1,61 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type * as ConfigError from "effect/ConfigError"
|
|
3
|
-
import * as Effect from "effect/Effect"
|
|
4
|
-
import * as Layer from "effect/Layer"
|
|
5
|
-
import * as DiscordConfig from "dfx/DiscordConfig"
|
|
6
|
-
import type { DiscordREST } from "dfx/DiscordREST"
|
|
7
|
-
import { LiveDiscordREST } from "dfx/DiscordREST"
|
|
8
|
-
import type { MakeConfigOpts, WebhookConfig } from "dfx/Interactions/webhook"
|
|
9
|
-
import { makeConfigLayer } from "dfx/Interactions/webhook"
|
|
1
|
+
import { DiscordRESTLive } from "dfx/DiscordREST"
|
|
10
2
|
import * as Log from "dfx/Log"
|
|
11
|
-
import
|
|
12
|
-
|
|
3
|
+
import {
|
|
4
|
+
LiveMemoryRateLimitStore as MemoryRateLimitStoreLive,
|
|
5
|
+
RateLimiterLive as RateLimiterLive,
|
|
6
|
+
} from "dfx/RateLimit"
|
|
7
|
+
import * as Layer from "effect/Layer"
|
|
13
8
|
|
|
14
9
|
export {
|
|
15
10
|
BadWebhookSignature,
|
|
16
|
-
makeConfigLayer,
|
|
17
|
-
makeHandler,
|
|
18
|
-
makeSimpleHandler,
|
|
19
11
|
WebhookConfig,
|
|
20
12
|
WebhookParseError,
|
|
13
|
+
makeHandler,
|
|
14
|
+
makeSimpleHandler,
|
|
15
|
+
layer as webhookLayer,
|
|
16
|
+
layerConfig as webhookLayerConfig,
|
|
21
17
|
} from "dfx/Interactions/webhook"
|
|
22
18
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export const MemoryREST = Layer.provide(
|
|
29
|
-
LiveDiscordREST,
|
|
30
|
-
LiveMemoryRateLimitStore,
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
export const webhookLayer = (
|
|
34
|
-
options: DiscordConfig.MakeOpts & MakeConfigOpts,
|
|
35
|
-
): Layer.Layer<
|
|
36
|
-
never,
|
|
37
|
-
ConfigError.ConfigError,
|
|
38
|
-
RateLimiter | DiscordREST | WebhookConfig
|
|
39
|
-
> => {
|
|
40
|
-
const config = DiscordConfig.make(options)
|
|
41
|
-
const LiveConfig = Layer.succeed(DiscordConfig.DiscordConfig, config)
|
|
42
|
-
const LiveWebhook = makeConfigLayer(options)
|
|
43
|
-
const LiveLog = config.debug ? Log.LiveLogDebug : Log.LiveLog
|
|
44
|
-
const LiveEnv = Layer.provide(
|
|
45
|
-
Layer.mergeAll(MemoryREST, LiveWebhook, MemoryRateLimit),
|
|
46
|
-
Layer.merge(LiveLog, LiveConfig),
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
return LiveEnv
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const webhookLayerConfig = (
|
|
53
|
-
config: Config.Config.Wrap<DiscordConfig.MakeOpts & MakeConfigOpts>,
|
|
54
|
-
): Layer.Layer<
|
|
55
|
-
never,
|
|
56
|
-
ConfigError.ConfigError,
|
|
57
|
-
RateLimiter | DiscordREST | WebhookConfig
|
|
58
|
-
> =>
|
|
59
|
-
Layer.unwrapEffect(
|
|
60
|
-
Effect.map(Effect.config(Config.unwrap(config)), webhookLayer),
|
|
61
|
-
)
|
|
19
|
+
export const DiscordLive = Layer.mergeAll(
|
|
20
|
+
DiscordRESTLive,
|
|
21
|
+
RateLimiterLive,
|
|
22
|
+
).pipe(Layer.provide(MemoryRateLimitStoreLive), Layer.provideMerge(Log.LogLive))
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "0.
|
|
1
|
+
export declare const LIB_VERSION = "0.77.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/webhooks.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import * as Config from "effect/Config";
|
|
2
|
-
import type * as ConfigError from "effect/ConfigError";
|
|
3
|
-
import * as Layer from "effect/Layer";
|
|
4
|
-
import * as DiscordConfig from "dfx/DiscordConfig";
|
|
5
|
-
import type { DiscordREST } from "dfx/DiscordREST";
|
|
6
|
-
import type { MakeConfigOpts, WebhookConfig } from "dfx/Interactions/webhook";
|
|
7
1
|
import * as Log from "dfx/Log";
|
|
8
|
-
import
|
|
9
|
-
export { BadWebhookSignature,
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const MemoryREST: Layer.Layer<DiscordConfig.DiscordConfig | Log.Log, never, DiscordREST>;
|
|
12
|
-
export declare const webhookLayer: (options: DiscordConfig.MakeOpts & MakeConfigOpts) => Layer.Layer<never, ConfigError.ConfigError, RateLimiter | DiscordREST | WebhookConfig>;
|
|
13
|
-
export declare const webhookLayerConfig: (config: Config.Config.Wrap<DiscordConfig.MakeOpts & MakeConfigOpts>) => Layer.Layer<never, ConfigError.ConfigError, RateLimiter | DiscordREST | WebhookConfig>;
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
export { BadWebhookSignature, WebhookConfig, WebhookParseError, makeHandler, makeSimpleHandler, layer as webhookLayer, layerConfig as webhookLayerConfig, } from "dfx/Interactions/webhook";
|
|
4
|
+
export declare const DiscordLive: Layer.Layer<import("./DiscordConfig").DiscordConfig, never, Log.Log | import("dfx/RateLimit").RateLimiter | import("dfx/DiscordREST").DiscordREST>;
|
|
14
5
|
//# sourceMappingURL=webhooks.d.ts.map
|
package/webhooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["./src/webhooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["./src/webhooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,SAAS,CAAA;AAK9B,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,IAAI,YAAY,EACrB,WAAW,IAAI,kBAAkB,GAClC,MAAM,0BAA0B,CAAA;AAEjC,eAAO,MAAM,WAAW,oJAGwD,CAAA"}
|
package/webhooks.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "BadWebhookSignature", {
|
|
|
9
9
|
return _webhook.BadWebhookSignature;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
exports.
|
|
12
|
+
exports.DiscordLive = void 0;
|
|
13
13
|
Object.defineProperty(exports, "WebhookConfig", {
|
|
14
14
|
enumerable: true,
|
|
15
15
|
get: function () {
|
|
@@ -22,12 +22,6 @@ Object.defineProperty(exports, "WebhookParseError", {
|
|
|
22
22
|
return _webhook.WebhookParseError;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
Object.defineProperty(exports, "makeConfigLayer", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _webhook.makeConfigLayer;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
25
|
Object.defineProperty(exports, "makeHandler", {
|
|
32
26
|
enumerable: true,
|
|
33
27
|
get: function () {
|
|
@@ -40,28 +34,24 @@ Object.defineProperty(exports, "makeSimpleHandler", {
|
|
|
40
34
|
return _webhook.makeSimpleHandler;
|
|
41
35
|
}
|
|
42
36
|
});
|
|
43
|
-
exports
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
Object.defineProperty(exports, "webhookLayer", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _webhook.layer;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "webhookLayerConfig", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _webhook.layerConfig;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
48
49
|
var _DiscordREST = /*#__PURE__*/require("dfx/DiscordREST");
|
|
49
|
-
var _webhook = /*#__PURE__*/require("dfx/Interactions/webhook");
|
|
50
50
|
var Log = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("dfx/Log"));
|
|
51
51
|
var _RateLimit = /*#__PURE__*/require("dfx/RateLimit");
|
|
52
|
+
var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Layer"));
|
|
53
|
+
var _webhook = /*#__PURE__*/require("dfx/Interactions/webhook");
|
|
52
54
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
53
55
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
54
|
-
const
|
|
55
|
-
const MemoryREST = exports.MemoryREST = /*#__PURE__*/Layer.provide(_DiscordREST.LiveDiscordREST, _RateLimit.LiveMemoryRateLimitStore);
|
|
56
|
-
const webhookLayer = options => {
|
|
57
|
-
const config = DiscordConfig.make(options);
|
|
58
|
-
const LiveConfig = Layer.succeed(DiscordConfig.DiscordConfig, config);
|
|
59
|
-
const LiveWebhook = (0, _webhook.makeConfigLayer)(options);
|
|
60
|
-
const LiveLog = config.debug ? Log.LiveLogDebug : Log.LiveLog;
|
|
61
|
-
const LiveEnv = Layer.provide(Layer.mergeAll(MemoryREST, LiveWebhook, MemoryRateLimit), Layer.merge(LiveLog, LiveConfig));
|
|
62
|
-
return LiveEnv;
|
|
63
|
-
};
|
|
64
|
-
exports.webhookLayer = webhookLayer;
|
|
65
|
-
const webhookLayerConfig = config => Layer.unwrapEffect(Effect.map(Effect.config(Config.unwrap(config)), webhookLayer));
|
|
66
|
-
exports.webhookLayerConfig = webhookLayerConfig;
|
|
56
|
+
const DiscordLive = exports.DiscordLive = /*#__PURE__*/Layer.mergeAll(_DiscordREST.DiscordRESTLive, _RateLimit.RateLimiterLive).pipe( /*#__PURE__*/Layer.provide(_RateLimit.LiveMemoryRateLimitStore), /*#__PURE__*/Layer.provideMerge(Log.LogLive));
|
|
67
57
|
//# sourceMappingURL=webhooks.js.map
|
package/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","names":["
|
|
1
|
+
{"version":3,"file":"webhooks.js","names":["_DiscordREST","require","Log","_interopRequireWildcard","_RateLimit","Layer","_webhook","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","DiscordLive","exports","mergeAll","DiscordRESTLive","RateLimiterLive","pipe","provide","MemoryRateLimitStoreLive","provideMerge","LogLive"],"sources":["./src/webhooks.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,gBAAAC,OAAA;AACA,IAAAC,GAAA,gBAAAC,uBAAA,eAAAF,OAAA;AACA,IAAAG,UAAA,gBAAAH,OAAA;AAIA,IAAAI,KAAA,gBAAAF,uBAAA,eAAAF,OAAA;AAEA,IAAAK,QAAA,gBAAAL,OAAA;AAQiC,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAE1B,MAAMY,WAAW,GAAAC,OAAA,CAAAD,WAAA,gBAAGvB,KAAK,CAACyB,QAAQ,CACvCC,4BAAe,EACfC,0BAAe,CAChB,CAACC,IAAI,eAAC5B,KAAK,CAAC6B,OAAO,CAACC,mCAAwB,CAAC,eAAE9B,KAAK,CAAC+B,YAAY,CAAClC,GAAG,CAACmC,OAAO,CAAC,CAAC"}
|