dfx 1.0.10 → 1.0.12
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/dist/DiscordConfig.d.ts +2 -2
- package/dist/DiscordConfig.d.ts.map +1 -1
- package/dist/DiscordConfig.js +2 -2
- package/dist/DiscordConfig.js.map +1 -1
- package/dist/DiscordGateway/DiscordWS.d.ts +3 -3
- package/dist/DiscordGateway/DiscordWS.d.ts.map +1 -1
- package/dist/DiscordGateway/DiscordWS.js +3 -3
- package/dist/DiscordGateway/DiscordWS.js.map +1 -1
- package/dist/DiscordGateway/Messaging.d.ts +2 -2
- package/dist/DiscordGateway/Messaging.d.ts.map +1 -1
- package/dist/DiscordGateway/Messaging.js +2 -2
- package/dist/DiscordGateway/Messaging.js.map +1 -1
- package/dist/DiscordGateway/Shard/StateStore.d.ts +2 -2
- package/dist/DiscordGateway/Shard/StateStore.d.ts.map +1 -1
- package/dist/DiscordGateway/Shard/StateStore.js +2 -2
- package/dist/DiscordGateway/Shard/StateStore.js.map +1 -1
- package/dist/DiscordGateway/Shard.d.ts +2 -2
- package/dist/DiscordGateway/Shard.d.ts.map +1 -1
- package/dist/DiscordGateway/Shard.js +2 -2
- package/dist/DiscordGateway/Shard.js.map +1 -1
- package/dist/DiscordGateway/ShardStore.d.ts +2 -2
- package/dist/DiscordGateway/ShardStore.d.ts.map +1 -1
- package/dist/DiscordGateway/ShardStore.js +2 -2
- package/dist/DiscordGateway/ShardStore.js.map +1 -1
- package/dist/DiscordGateway/Sharder.d.ts +2 -2
- package/dist/DiscordGateway/Sharder.d.ts.map +1 -1
- package/dist/DiscordGateway/Sharder.js +3 -3
- package/dist/DiscordGateway/Sharder.js.map +1 -1
- package/dist/DiscordGateway.d.ts +2 -2
- package/dist/DiscordGateway.d.ts.map +1 -1
- package/dist/DiscordGateway.js +2 -2
- package/dist/DiscordGateway.js.map +1 -1
- package/dist/DiscordREST/Generated.d.ts +544 -58
- package/dist/DiscordREST/Generated.d.ts.map +1 -1
- package/dist/DiscordREST/Generated.js +377 -0
- package/dist/DiscordREST/Generated.js.map +1 -1
- package/dist/DiscordREST/utils.d.ts.map +1 -1
- package/dist/DiscordREST/utils.js +2 -2
- package/dist/DiscordREST/utils.js.map +1 -1
- package/dist/DiscordREST.d.ts +3 -3
- package/dist/DiscordREST.d.ts.map +1 -1
- package/dist/DiscordREST.js +4 -4
- package/dist/DiscordREST.js.map +1 -1
- package/dist/Interactions/context.d.ts +8 -8
- package/dist/Interactions/context.d.ts.map +1 -1
- package/dist/Interactions/context.js +7 -7
- package/dist/Interactions/context.js.map +1 -1
- package/dist/Interactions/gateway.d.ts +3 -3
- package/dist/Interactions/gateway.d.ts.map +1 -1
- package/dist/Interactions/gateway.js +3 -3
- package/dist/Interactions/gateway.js.map +1 -1
- package/dist/Interactions/webhook.d.ts +3 -3
- package/dist/Interactions/webhook.d.ts.map +1 -1
- package/dist/Interactions/webhook.js +2 -2
- package/dist/Interactions/webhook.js.map +1 -1
- package/dist/RateLimit.d.ts +3 -3
- package/dist/RateLimit.d.ts.map +1 -1
- package/dist/RateLimit.js +3 -3
- package/dist/RateLimit.js.map +1 -1
- package/dist/utils/Effect.js +1 -1
- package/dist/utils/Effect.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/src/DiscordConfig.ts +2 -2
- package/src/DiscordGateway/DiscordWS.ts +3 -3
- package/src/DiscordGateway/Messaging.ts +2 -2
- package/src/DiscordGateway/Shard/StateStore.ts +2 -2
- package/src/DiscordGateway/Shard.ts +2 -2
- package/src/DiscordGateway/ShardStore.ts +2 -2
- package/src/DiscordGateway/Sharder.ts +3 -3
- package/src/DiscordGateway.ts +2 -2
- package/src/DiscordREST/Generated.ts +650 -62
- package/src/DiscordREST/utils.ts +1 -2
- package/src/DiscordREST.ts +4 -4
- package/src/Interactions/context.ts +7 -7
- package/src/Interactions/gateway.ts +3 -3
- package/src/Interactions/webhook.ts +2 -2
- package/src/RateLimit.ts +3 -3
- package/src/utils/Effect.ts +1 -1
- package/src/version.ts +1 -1
package/src/DiscordREST/utils.ts
CHANGED
|
@@ -21,7 +21,6 @@ export const routeFromConfig = (path: string, method: string) => {
|
|
|
21
21
|
export const numberHeader = (headers: Headers.Headers) => (key: string) =>
|
|
22
22
|
pipe(
|
|
23
23
|
Headers.get(headers, key),
|
|
24
|
-
Option.fromUndefinedOr,
|
|
25
24
|
Option.map(parseFloat),
|
|
26
25
|
Option.filter(n => !isNaN(n)),
|
|
27
26
|
)
|
|
@@ -34,7 +33,7 @@ export const retryAfter = (headers: Headers.Headers) =>
|
|
|
34
33
|
|
|
35
34
|
export const rateLimitFromHeaders = (headers: Headers.Headers) =>
|
|
36
35
|
Option.all({
|
|
37
|
-
bucket:
|
|
36
|
+
bucket: Headers.get(headers, "x-ratelimit-bucket"),
|
|
38
37
|
retryAfter: retryAfter(headers),
|
|
39
38
|
limit: numberHeader(headers)("x-ratelimit-limit"),
|
|
40
39
|
remaining: numberHeader(headers)("x-ratelimit-remaining"),
|
package/src/DiscordREST.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { flow } from "effect/Function"
|
|
|
15
15
|
import * as Layer from "effect/Layer"
|
|
16
16
|
import * as Option from "effect/Option"
|
|
17
17
|
import * as Redacted from "effect/Redacted"
|
|
18
|
-
import * as
|
|
18
|
+
import * as Context from "effect/Context"
|
|
19
19
|
import * as HttpBody from "effect/unstable/http/HttpBody"
|
|
20
20
|
import * as HttpClient from "effect/unstable/http/HttpClient"
|
|
21
21
|
import type { HttpClientError } from "effect/unstable/http/HttpClientError"
|
|
@@ -185,7 +185,7 @@ const make = Effect.gen(function* () {
|
|
|
185
185
|
"User-Agent": `DiscordBot (https://github.com/tim-smart/dfx, ${LIB_VERSION})`,
|
|
186
186
|
}),
|
|
187
187
|
)
|
|
188
|
-
const formData =
|
|
188
|
+
const formData = Context.getOption(fiber.context, DiscordFormData)
|
|
189
189
|
if (Option.isSome(formData)) {
|
|
190
190
|
if (request.body._tag === "Uint8Array") {
|
|
191
191
|
formData.value.set(
|
|
@@ -230,7 +230,7 @@ export type DiscordRESTError =
|
|
|
230
230
|
| Discord.DiscordRestError<"RatelimitedResponse", Discord.RatelimitedResponse>
|
|
231
231
|
| Discord.DiscordRestError<"ErrorResponse", Discord.ErrorResponse>
|
|
232
232
|
|
|
233
|
-
export class DiscordFormData extends
|
|
233
|
+
export class DiscordFormData extends Context.Service<
|
|
234
234
|
DiscordFormData,
|
|
235
235
|
FormData
|
|
236
236
|
>()("dfx/DiscordREST/DiscordFormData") {}
|
|
@@ -244,7 +244,7 @@ export interface DiscordRestService extends Discord.DiscordRest {
|
|
|
244
244
|
): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
export class DiscordREST extends
|
|
247
|
+
export class DiscordREST extends Context.Service<
|
|
248
248
|
DiscordREST,
|
|
249
249
|
DiscordRestService
|
|
250
250
|
>()("dfx/DiscordREST") {}
|
|
@@ -3,33 +3,33 @@ import type * as Discord from "../types.ts"
|
|
|
3
3
|
import type { NoSuchElementError } from "effect/Cause"
|
|
4
4
|
import * as Data from "effect/Data"
|
|
5
5
|
import * as Effect from "effect/Effect"
|
|
6
|
-
import * as
|
|
6
|
+
import * as Context from "effect/Context"
|
|
7
7
|
|
|
8
|
-
export class Interaction extends
|
|
8
|
+
export class Interaction extends Context.Service<
|
|
9
9
|
Interaction,
|
|
10
10
|
Discord.APIInteraction
|
|
11
11
|
>()("dfx/Interactions/Interaction") {}
|
|
12
12
|
export type DiscordInteraction = Interaction
|
|
13
13
|
|
|
14
|
-
export class ApplicationCommand extends
|
|
14
|
+
export class ApplicationCommand extends Context.Service<
|
|
15
15
|
ApplicationCommand,
|
|
16
16
|
Discord.APIApplicationCommandInteraction["data"]
|
|
17
17
|
>()("dfx/Interactions/ApplicationCommand") {}
|
|
18
18
|
export type DiscordApplicationCommand = ApplicationCommand
|
|
19
19
|
|
|
20
|
-
export class MessageComponentData extends
|
|
20
|
+
export class MessageComponentData extends Context.Service<
|
|
21
21
|
MessageComponentData,
|
|
22
22
|
Discord.APIMessageComponentInteractionData
|
|
23
23
|
>()("dfx/Interactions/MessageComponentData") {}
|
|
24
24
|
export type DiscordMessageComponent = MessageComponentData
|
|
25
25
|
|
|
26
|
-
export class ModalSubmitData extends
|
|
26
|
+
export class ModalSubmitData extends Context.Service<
|
|
27
27
|
ModalSubmitData,
|
|
28
28
|
Discord.APIModalSubmission
|
|
29
29
|
>()("dfx/Interactions/ModalSubmitData") {}
|
|
30
30
|
export type DiscordModalSubmit = ModalSubmitData
|
|
31
31
|
|
|
32
|
-
export class FocusedOptionContext extends
|
|
32
|
+
export class FocusedOptionContext extends Context.Service<
|
|
33
33
|
FocusedOptionContext,
|
|
34
34
|
Discord.APIApplicationCommandInteractionDataOption
|
|
35
35
|
>()("dfx/Interactions/FocusedOptionContext") {}
|
|
@@ -38,7 +38,7 @@ export type DiscordFocusedOption = FocusedOptionContext
|
|
|
38
38
|
export interface SubCommandContextData {
|
|
39
39
|
readonly command: Discord.APIApplicationCommandInteractionDataSubcommandOption
|
|
40
40
|
}
|
|
41
|
-
export class SubCommandContext extends
|
|
41
|
+
export class SubCommandContext extends Context.Service<
|
|
42
42
|
SubCommandContext,
|
|
43
43
|
SubCommandContextData
|
|
44
44
|
>()("dfx/Interactions/SubCommandContext") {}
|
|
@@ -7,7 +7,7 @@ import * as Layer from "effect/Layer"
|
|
|
7
7
|
import * as Queue from "effect/Queue"
|
|
8
8
|
import * as Ref from "effect/Ref"
|
|
9
9
|
import * as Schedule from "effect/Schedule"
|
|
10
|
-
import * as
|
|
10
|
+
import * as Context from "effect/Context"
|
|
11
11
|
import { DiscordGateway } from "../DiscordGateway.ts"
|
|
12
12
|
import type { DiscordRESTError } from "../DiscordREST.ts"
|
|
13
13
|
import { DiscordREST } from "../DiscordREST.ts"
|
|
@@ -22,7 +22,7 @@ import type { DiscordInteraction, InteractionBuilder } from "./index.ts"
|
|
|
22
22
|
import { builder, Interaction } from "./index.ts"
|
|
23
23
|
import * as EffectUtils from "../utils/Effect.ts"
|
|
24
24
|
|
|
25
|
-
export const interactionsSync =
|
|
25
|
+
export const interactionsSync = Context.Reference("dfx/Interactions/sync", {
|
|
26
26
|
defaultValue: () => true,
|
|
27
27
|
})
|
|
28
28
|
|
|
@@ -181,7 +181,7 @@ export interface InteractionsRegistryService {
|
|
|
181
181
|
) => Effect.Effect<void>
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
export class InteractionsRegistry extends
|
|
184
|
+
export class InteractionsRegistry extends Context.Service<
|
|
185
185
|
InteractionsRegistry,
|
|
186
186
|
InteractionsRegistryService
|
|
187
187
|
>()("dfx/Interactions/InteractionsRegistry") {}
|
|
@@ -6,7 +6,7 @@ import type * as Config from "effect/Config"
|
|
|
6
6
|
import * as Redacted from "effect/Redacted"
|
|
7
7
|
import * as Effect from "effect/Effect"
|
|
8
8
|
import * as Layer from "effect/Layer"
|
|
9
|
-
import * as
|
|
9
|
+
import * as Context from "effect/Context"
|
|
10
10
|
import type * as D from "./definitions.ts"
|
|
11
11
|
import type { DefinitionNotFound } from "./handlers.ts"
|
|
12
12
|
import { handlers } from "./handlers.ts"
|
|
@@ -70,7 +70,7 @@ const makeConfig = ({
|
|
|
70
70
|
algorithm: Verify.PlatformAlgorithm[algorithm],
|
|
71
71
|
})
|
|
72
72
|
|
|
73
|
-
export class WebhookConfig extends
|
|
73
|
+
export class WebhookConfig extends Context.Service<
|
|
74
74
|
WebhookConfig,
|
|
75
75
|
ReturnType<typeof makeConfig>
|
|
76
76
|
>()("dfx/Interactions/WebhookConfig") {}
|
package/src/RateLimit.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as Effect from "effect/Effect"
|
|
|
4
4
|
import * as Layer from "effect/Layer"
|
|
5
5
|
import * as Memory from "./RateLimit/memory.ts"
|
|
6
6
|
import { delayFrom } from "./RateLimit/utils.ts"
|
|
7
|
-
import * as
|
|
7
|
+
import * as Context from "effect/Context"
|
|
8
8
|
|
|
9
9
|
export type BucketDetails = {
|
|
10
10
|
key: "global" | string
|
|
@@ -35,7 +35,7 @@ export interface RateLimitStoreService {
|
|
|
35
35
|
readonly removeCounter: (key: string) => Effect.Effect<void>
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export class RateLimitStore extends
|
|
38
|
+
export class RateLimitStore extends Context.Service<
|
|
39
39
|
RateLimitStore,
|
|
40
40
|
RateLimitStoreService
|
|
41
41
|
>()("dfx/RateLimit/RateLimitStore") {}
|
|
@@ -75,7 +75,7 @@ const makeLimiter = Effect.gen(function* () {
|
|
|
75
75
|
return { maybeWait }
|
|
76
76
|
})
|
|
77
77
|
|
|
78
|
-
export class RateLimiter extends
|
|
78
|
+
export class RateLimiter extends Context.Service<
|
|
79
79
|
RateLimiter,
|
|
80
80
|
{
|
|
81
81
|
maybeWait: (
|
package/src/utils/Effect.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const subscribeForEachPar = <R, E, A, X>(
|
|
|
14
14
|
Effect.fnUntraced(function* (scope) {
|
|
15
15
|
const deferred = yield* Deferred.make<never, E>()
|
|
16
16
|
const sub = yield* PubSub.subscribe(self).pipe(Scope.provide(scope))
|
|
17
|
-
const services = yield* Effect.
|
|
17
|
+
const services = yield* Effect.context<R>()
|
|
18
18
|
const runFork = Effect.runForkWith(services)
|
|
19
19
|
const track = Fiber.runIn(scope)
|
|
20
20
|
function onExit(exit: Exit.Exit<X, E>) {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.
|
|
1
|
+
export const LIB_VERSION = "1.0.12";
|