dfx 0.15.2 → 0.15.3
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/DiscordGateway/Shard/heartbeats.d.ts +1 -2
- package/DiscordGateway/Shard/identify.d.ts +1 -2
- package/DiscordGateway/Shard/invalidSession.d.ts +1 -2
- package/DiscordGateway/Shard/utils.d.ts +2 -3
- package/DiscordGateway/ShardStore/index.d.ts +1 -1
- package/DiscordGateway/Sharder/index.d.ts +1 -2
- package/DiscordREST/utils.d.ts +3 -3
- package/Helpers/interactions.d.ts +11 -12
- package/Interactions/context.d.ts +3 -3
- package/Interactions/definitions.d.ts +16 -9
- package/RateLimitStore/index.d.ts +1 -1
- package/global.d.ts +1 -2
- package/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Ref } from "@effect/io/Ref";
|
|
2
|
-
import { Maybe } from "
|
|
2
|
+
import { Maybe, Discord } from "dfx";
|
|
3
3
|
import { Effect } from "@effect/io/Effect";
|
|
4
4
|
import { DiscordWS } from "dfx/gateway";
|
|
5
5
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
6
|
-
import { Discord } from "dfx";
|
|
7
6
|
export declare const fromRaw: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, seqRef: Ref<Maybe<number>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
2
|
-
import { Discord } from "dfx";
|
|
2
|
+
import { Discord, Maybe } from "dfx";
|
|
3
3
|
import { Ref } from "@effect/io/Ref";
|
|
4
|
-
import { Maybe } from "@fp-ts/data/Option";
|
|
5
4
|
import { DiscordWS } from "dfx/gateway";
|
|
6
5
|
export declare const fromRaw: <R, E>(raw: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, latestReady: Ref<Maybe<Discord.ReadyEvent>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
2
|
-
import { Discord } from "dfx";
|
|
3
|
-
import { Maybe } from "@fp-ts/data/Option";
|
|
2
|
+
import { Discord, Maybe } from "dfx";
|
|
4
3
|
import { Ref } from "@effect/io/Ref";
|
|
5
4
|
export declare const opCode: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>) => <T = any>(code: Discord.GatewayOpcode) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<T>>;
|
|
6
|
-
export declare const latest: <T>(f: (p: Discord.GatewayPayload) => import("../../
|
|
5
|
+
export declare const latest: <T>(f: (p: Discord.GatewayPayload) => import("../../index.js").Maybe<T>) => import("../../global.js").Effect<never, never, readonly [import("../../global.js").Ref<import("../../index.js").Maybe<T>>, (p: import("../../types.js").GatewayPayload<any>) => import("../../global.js").Effect<never, never, void>]>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Effect } from "@effect/io/Effect";
|
|
2
|
-
import { Maybe } from "
|
|
2
|
+
import { Maybe, Discord } from "dfx";
|
|
3
3
|
import { EffectSource } from "callbag-effect-ts/Source";
|
|
4
|
-
import { Discord } from "dfx";
|
|
5
4
|
import { ShardStore } from "../ShardStore/index.js";
|
|
6
5
|
export declare const spawn: import("callbag-effect-ts/Source").EffectSource<import("../../Log/index.js").Log | import("../DiscordWS/index.js").DiscordWSCodec | import("../../DiscordConfig/index.js").DiscordConfig | import("../../RateLimitStore/index.js").RateLimiter | ShardStore | import("../../index.js").DiscordREST, never, {
|
|
7
6
|
run: import("../../global.js").Effect<never, never, void>;
|
package/DiscordREST/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const routeFromConfig: (path: string, init: RequestInit) => string;
|
|
2
|
-
export declare const numberHeader: (headers: Headers) => (key: string) => import("../
|
|
3
|
-
export declare const retryAfter: (headers: Headers) => import("../
|
|
4
|
-
export declare const rateLimitFromHeaders: (headers: Headers) => import("../
|
|
2
|
+
export declare const numberHeader: (headers: Headers) => (key: string) => import("../index.js").Maybe<number>;
|
|
3
|
+
export declare const retryAfter: (headers: Headers) => import("../index.js").Maybe<import("../global.js").Duration>;
|
|
4
|
+
export declare const rateLimitFromHeaders: (headers: Headers) => import("../index.js").Maybe<{
|
|
5
5
|
readonly bucket: string;
|
|
6
6
|
readonly retryAfter: import("../global.js").Duration;
|
|
7
7
|
readonly limit: number;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Discord } from "dfx";
|
|
2
|
-
import { Maybe } from "@fp-ts/data/Option";
|
|
1
|
+
import { Discord, Maybe } from "dfx";
|
|
3
2
|
/**
|
|
4
3
|
* Maybe find a sub-command within the interaction options.
|
|
5
4
|
*/
|
|
@@ -7,7 +6,7 @@ export declare const allSubCommands: (interaction: Discord.ApplicationCommandDat
|
|
|
7
6
|
/**
|
|
8
7
|
* Maybe find a sub-command within the interaction options.
|
|
9
8
|
*/
|
|
10
|
-
export declare const findSubCommand: (name: string) => (interaction: Discord.ApplicationCommandDatum) => import("../
|
|
9
|
+
export declare const findSubCommand: (name: string) => (interaction: Discord.ApplicationCommandDatum) => import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>;
|
|
11
10
|
/**
|
|
12
11
|
* If the sub-command exists return `true`, else `false`.
|
|
13
12
|
*/
|
|
@@ -15,7 +14,7 @@ export declare const isSubCommand: (name: string) => (interaction: import("../ty
|
|
|
15
14
|
/**
|
|
16
15
|
* Maybe get the options for a sub-command
|
|
17
16
|
*/
|
|
18
|
-
export declare const subCommandOptions: (name: string) => (interaction: import("../types.js").ApplicationCommandDatum) => import("../
|
|
17
|
+
export declare const subCommandOptions: (name: string) => (interaction: import("../types.js").ApplicationCommandDatum) => import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption[]>;
|
|
19
18
|
/**
|
|
20
19
|
* A lens for accessing nested options in a interaction.
|
|
21
20
|
*/
|
|
@@ -31,27 +30,27 @@ export declare const optionsMap: (data: Pick<import("../types.js").ApplicationCo
|
|
|
31
30
|
/**
|
|
32
31
|
* Try find a matching option from the interaction.
|
|
33
32
|
*/
|
|
34
|
-
export declare const getOption: (name: string) => (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../
|
|
33
|
+
export declare const getOption: (name: string) => (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>;
|
|
35
34
|
/**
|
|
36
35
|
* Try find a matching option from the interaction.
|
|
37
36
|
*/
|
|
38
|
-
export declare const focusedOption: (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../
|
|
37
|
+
export declare const focusedOption: (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>;
|
|
39
38
|
/**
|
|
40
39
|
* Try find a matching option value from the interaction.
|
|
41
40
|
*/
|
|
42
|
-
export declare const optionValue: (name: string) => (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../
|
|
41
|
+
export declare const optionValue: (name: string) => (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../index.js").Maybe<string>;
|
|
43
42
|
/**
|
|
44
43
|
* Try extract resolved data
|
|
45
44
|
*/
|
|
46
|
-
export declare const resolved: (data: Discord.Interaction) => import("../
|
|
45
|
+
export declare const resolved: (data: Discord.Interaction) => import("../index.js").Maybe<import("../types.js").ResolvedDatum>;
|
|
47
46
|
/**
|
|
48
47
|
* Try find a matching option value from the interaction.
|
|
49
48
|
*/
|
|
50
|
-
export declare const resolveOptionValue: <T>(name: string, f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => (a: Discord.Interaction) => import("../
|
|
49
|
+
export declare const resolveOptionValue: <T>(name: string, f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => (a: Discord.Interaction) => import("../index.js").Maybe<T>;
|
|
51
50
|
/**
|
|
52
51
|
* Try find matching option values from the interaction.
|
|
53
52
|
*/
|
|
54
|
-
export declare const resolveValues: <T>(f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => (a: Discord.Interaction) => import("../
|
|
53
|
+
export declare const resolveValues: <T>(f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => (a: Discord.Interaction) => import("../index.js").Maybe<readonly T[]>;
|
|
55
54
|
/**
|
|
56
55
|
* A lens for accessing the components in a interaction.
|
|
57
56
|
*/
|
|
@@ -71,11 +70,11 @@ export declare const componentsMap: (a: import("../types.js").ModalSubmitDatum)
|
|
|
71
70
|
/**
|
|
72
71
|
* Try find a matching component from the interaction.
|
|
73
72
|
*/
|
|
74
|
-
export declare const getComponent: (id: string) => (a: import("../types.js").ModalSubmitDatum) => import("../
|
|
73
|
+
export declare const getComponent: (id: string) => (a: import("../types.js").ModalSubmitDatum) => import("../index.js").Maybe<import("../types.js").Component>;
|
|
75
74
|
/**
|
|
76
75
|
* Try find a matching component value from the interaction.
|
|
77
76
|
*/
|
|
78
|
-
export declare const componentValue: (id: string) => (a: import("../types.js").ModalSubmitDatum) => import("../
|
|
77
|
+
export declare const componentValue: (id: string) => (a: import("../types.js").ModalSubmitDatum) => import("../index.js").Maybe<string>;
|
|
79
78
|
export type InteractionResponse = {
|
|
80
79
|
type: Discord.InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE;
|
|
81
80
|
data: Discord.InteractionCallbackMessage;
|
|
@@ -44,11 +44,11 @@ export declare class RequiredOptionNotFound {
|
|
|
44
44
|
readonly _tag = "RequiredOptionNotFound";
|
|
45
45
|
constructor(data: Discord.ApplicationCommandDatum | Discord.ApplicationCommandInteractionDataOption, name: string);
|
|
46
46
|
}
|
|
47
|
-
export declare const findOption: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../
|
|
47
|
+
export declare const findOption: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>>;
|
|
48
48
|
export declare const optionValue: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, RequiredOptionNotFound, string>;
|
|
49
|
-
export declare const optionValueOptional: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../
|
|
49
|
+
export declare const optionValueOptional: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../index.js").Maybe<string>>;
|
|
50
50
|
export declare const subCommandOptionsMap: Effect<SubCommandContext, never, Record<string, string | undefined>>;
|
|
51
|
-
export declare const findSubCommandOption: (name: string) => Effect<SubCommandContext, never, import("../
|
|
51
|
+
export declare const findSubCommandOption: (name: string) => Effect<SubCommandContext, never, import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>>;
|
|
52
52
|
export declare const subCommandOptionValue: (name: string) => Effect<SubCommandContext, RequiredOptionNotFound, string>;
|
|
53
53
|
export declare const subCommandOptionValueOptional: (name: string) => Effect<SubCommandContext, RequiredOptionNotFound, string>;
|
|
54
54
|
export declare const modalValues: Effect<import("../types.js").ModalSubmitDatum, never, Record<string, string | undefined>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Discord } from "dfx";
|
|
2
|
-
import { Maybe } from "@fp-ts/data/Option";
|
|
1
|
+
import { Discord, Maybe } from "dfx";
|
|
3
2
|
import { Effect, EffectTypeId } from "@effect/io/Effect";
|
|
4
3
|
import { RequiredOptionNotFound, ResolvedDataNotFound, SubCommandContext, SubCommandNotFound } from "./context.js";
|
|
5
4
|
import type { F } from "ts-toolbelt";
|
|
@@ -48,12 +47,12 @@ type CommandHandler<R, E, A = any> = Effect<R, E, Discord.InteractionResponse> |
|
|
|
48
47
|
export interface CommandHelper<A> {
|
|
49
48
|
resolve: <T>(name: Resolvables<A>["name"], f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => Effect<Discord.Interaction, ResolvedDataNotFound, T>;
|
|
50
49
|
option: (name: CommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<Discord.ApplicationCommandInteractionDataOption>>;
|
|
51
|
-
optionValue: (name:
|
|
50
|
+
optionValue: (name: RequiredCommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, RequiredOptionNotFound, string>;
|
|
52
51
|
optionValueOptional: (name: CommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<string>>;
|
|
53
52
|
subCommandOption: (name: SubCommandOptions<A>["name"]) => Effect<SubCommandContext, never, Maybe<Discord.ApplicationCommandInteractionDataOption>>;
|
|
54
|
-
subCommandOptionValue: (name:
|
|
53
|
+
subCommandOptionValue: (name: RequiredSubCommandOptions<A>["name"]) => Effect<SubCommandContext, RequiredOptionNotFound, string>;
|
|
55
54
|
subCommandOptionValueOptional: (name: SubCommandOptions<A>["name"]) => Effect<SubCommandContext, never, Maybe<string>>;
|
|
56
|
-
subCommands: <NER extends Record<SubCommands<A>["name"], Effect<any, any, Discord.InteractionResponse>>>(commands: NER) => Effect<Exclude<[
|
|
55
|
+
subCommands: <NER extends SubCommands<A> extends never ? never : Record<SubCommands<A>["name"], Effect<any, any, Discord.InteractionResponse>>>(commands: NER) => Effect<Exclude<[
|
|
57
56
|
NER[keyof NER]
|
|
58
57
|
] extends [
|
|
59
58
|
{
|
|
@@ -71,16 +70,24 @@ export interface CommandHelper<A> {
|
|
|
71
70
|
}
|
|
72
71
|
type CommandHandlerFn<R, E, A> = (i: CommandHelper<A>) => Effect<R, E, Discord.InteractionResponse>;
|
|
73
72
|
type ExtractOptions<A, T> = A extends {
|
|
74
|
-
name: string;
|
|
75
73
|
type: T;
|
|
74
|
+
name: string;
|
|
76
75
|
options?: Discord.ApplicationCommandOption[];
|
|
77
|
-
} ? A
|
|
78
|
-
options: Discord.ApplicationCommandOption[];
|
|
79
|
-
} ? ExtractOptions<A["options"][number], T> : never) : A extends {
|
|
76
|
+
} ? A : A extends {
|
|
80
77
|
options: Discord.ApplicationCommandOption[];
|
|
81
78
|
} ? ExtractOptions<A["options"][number], T> : never;
|
|
79
|
+
type RequiredOptions<A, T> = A extends {
|
|
80
|
+
options: Discord.ApplicationCommandOption[];
|
|
81
|
+
} ? Extract<A["options"][number], {
|
|
82
|
+
type: T;
|
|
83
|
+
required: true;
|
|
84
|
+
}> : never;
|
|
82
85
|
type CommandOptions<A> = ExtractOptions<A, Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>>;
|
|
86
|
+
type RequiredCommandOptions<A> = RequiredOptions<A, Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>>;
|
|
83
87
|
type SubCommands<A> = ExtractOptions<A, Discord.ApplicationCommandOptionType.SUB_COMMAND>;
|
|
84
88
|
type SubCommandOptions<A> = Exclude<SubCommands<A>["options"], undefined>[number];
|
|
89
|
+
type RequiredSubCommandOptions<A> = Extract<Exclude<SubCommands<A>["options"], undefined>[number], {
|
|
90
|
+
required: true;
|
|
91
|
+
}>;
|
|
85
92
|
type Resolvables<A> = ExtractOptions<A, Discord.ApplicationCommandOptionType.ROLE | Discord.ApplicationCommandOptionType.USER | Discord.ApplicationCommandOptionType.MENTIONABLE | Discord.ApplicationCommandOptionType.CHANNEL>;
|
|
86
93
|
export {};
|
package/global.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ import type { Equal } from "@fp-ts/data/Equal";
|
|
|
33
33
|
/**
|
|
34
34
|
* @tsplus global
|
|
35
35
|
*/
|
|
36
|
-
import type {
|
|
36
|
+
import type { Maybe } from "dfx";
|
|
37
37
|
/**
|
|
38
38
|
* @tsplus global
|
|
39
39
|
*/
|
|
@@ -86,5 +86,4 @@ export type { Effect } from "@effect/io/Effect";
|
|
|
86
86
|
export type { Layer } from "@effect/io/Layer";
|
|
87
87
|
export { Context, Tag } from "@fp-ts/data/Context";
|
|
88
88
|
export type { Duration } from "@fp-ts/data/Duration";
|
|
89
|
-
export type { Option as Maybe } from "@fp-ts/data/Option";
|
|
90
89
|
export type { Ref } from "@effect/io/Ref";
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@fp-ts/data": "^0.0.20"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "c834316c54f806a80a87418f6c496dfc190df02d"
|
|
52
52
|
}
|