dfx 0.17.5 → 0.17.7

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.
@@ -45,10 +45,10 @@ export declare class Autocomplete<R, E> {
45
45
  export declare const autocomplete: <R1, R2, E1, E2>(pred: (data: Discord.ApplicationCommandDatum, focusedOption: Discord.ApplicationCommandInteractionDataOption) => Effect<R1, E1, boolean>, handle: Effect<R2, E2, import("../types.js").InteractionResponse>) => Autocomplete<Exclude<R1, import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum | FocusedOptionContext> | Exclude<R2, import("../types.js").Interaction | import("../types.js").ApplicationCommandDatum | FocusedOptionContext>, E1 | E2>;
46
46
  type CommandHandler<R, E, A = any> = Effect<R, E, Discord.InteractionResponse> | CommandHandlerFn<R, E, A>;
47
47
  export interface CommandHelper<A> {
48
- resolve: <T>(name: Resolvables<A>["name"], f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => Effect<Discord.Interaction, ResolvedDataNotFound, T>;
49
- option: (name: CommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<Discord.ApplicationCommandInteractionDataOption>>;
48
+ resolve: <T>(name: AllResolvables<A>["name"], f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined) => Effect<Discord.Interaction, ResolvedDataNotFound, T>;
49
+ option: (name: AllCommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<Discord.ApplicationCommandInteractionDataOption>>;
50
50
  optionValue: (name: AllRequiredCommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, string>;
51
- optionValueOptional: (name: CommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<string>>;
51
+ optionValueOptional: (name: AllCommandOptions<A>["name"]) => Effect<Discord.ApplicationCommandDatum, never, Maybe<string>>;
52
52
  subCommands: <NER extends SubCommandNames<A> extends never ? never : Record<SubCommandNames<A>, Effect<any, any, Discord.InteractionResponse>>>(commands: NER) => Effect<Exclude<[
53
53
  NER[keyof NER]
54
54
  ] extends [
@@ -66,43 +66,42 @@ export interface CommandHelper<A> {
66
66
  }] ? E : never, Discord.InteractionResponse>;
67
67
  }
68
68
  type CommandHandlerFn<R, E, A> = (i: CommandHelper<A>) => Effect<R, E, Discord.InteractionResponse>;
69
- type StringLiteral<T> = T extends string ? string extends T ? never : T : never;
70
- type Option<A> = A extends {
71
- name: infer N;
72
- } ? N extends StringLiteral<N> ? A : never : never;
73
- type Options<A, T> = A extends T ? T : A extends {
74
- options: Discord.ApplicationCommandOption[];
75
- } ? Options<A["options"][number], T> : never;
76
- type OptionsWithLiteral<A, T> = A extends {
77
- options: Discord.ApplicationCommandOption[];
78
- } ? Extract<A["options"][number], Option<A["options"][number]> & T> : never;
79
- type CommandOptionType = Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>;
80
- type CommandOptions<A> = OptionsWithLiteral<A, {
81
- name: string;
82
- type: CommandOptionType;
83
- }>;
84
- type RequiredCommandOptions<A> = OptionsWithLiteral<A, {
85
- type: CommandOptionType;
86
- name: string;
87
- required: true;
88
- }>;
89
69
  type SubCommands<A> = A extends {
90
- name: string;
91
70
  type: Discord.ApplicationCommandOptionType.SUB_COMMAND;
92
71
  options?: Discord.ApplicationCommandOption[];
93
72
  } ? A : A extends {
94
73
  options: Discord.ApplicationCommandOption[];
95
74
  } ? SubCommands<A["options"][number]> : never;
96
75
  type SubCommandNames<A> = Option<SubCommands<A>>["name"];
97
- type SubCommandOptions<A> = Extract<Option<SubCommands<A>["options"]>, {
76
+ type CommandOptionType = Exclude<Discord.ApplicationCommandOptionType, Discord.ApplicationCommandOptionType.SUB_COMMAND | Discord.ApplicationCommandOptionType.SUB_COMMAND_GROUP>;
77
+ type CommandOptions<A> = OptionsWithLiteral<A, {
78
+ type: CommandOptionType;
79
+ }>;
80
+ type SubCommandOptions<A> = Extract<Option<Exclude<SubCommands<A>["options"], undefined>[number]>, {
98
81
  type: CommandOptionType;
99
82
  }>;
83
+ type AllCommandOptions<A> = CommandOptions<A> | SubCommandOptions<A>;
84
+ type RequiredCommandOptions<A> = OptionsWithLiteral<A, {
85
+ type: CommandOptionType;
86
+ required: true;
87
+ }>;
100
88
  type RequiredSubCommandOptions<A> = Extract<SubCommandOptions<A>, {
101
89
  required: true;
102
90
  }>;
103
91
  type AllRequiredCommandOptions<A> = RequiredCommandOptions<A> | RequiredSubCommandOptions<A>;
104
- type Resolvables<A> = Options<A, {
105
- name: string;
106
- type: Discord.ApplicationCommandOptionType.ROLE | Discord.ApplicationCommandOptionType.USER | Discord.ApplicationCommandOptionType.MENTIONABLE | Discord.ApplicationCommandOptionType.CHANNEL;
92
+ type ResolvableType = Discord.ApplicationCommandOptionType.ROLE | Discord.ApplicationCommandOptionType.USER | Discord.ApplicationCommandOptionType.MENTIONABLE | Discord.ApplicationCommandOptionType.CHANNEL;
93
+ type Resolvables<A> = OptionsWithLiteral<A, {
94
+ type: ResolvableType;
107
95
  }>;
96
+ type SubCommandResolvables<A> = Extract<Option<Exclude<SubCommands<A>["options"], undefined>[number]>, {
97
+ type: ResolvableType;
98
+ }>;
99
+ type AllResolvables<A> = Resolvables<A> | SubCommandResolvables<A>;
100
+ type StringLiteral<T> = T extends string ? string extends T ? never : T : never;
101
+ type Option<A> = A extends {
102
+ name: infer N;
103
+ } ? N extends StringLiteral<N> ? A : never : never;
104
+ type OptionsWithLiteral<A, T> = A extends {
105
+ options: Discord.ApplicationCommandOption[];
106
+ } ? Extract<A["options"][number], Option<A["options"][number]> & T> : never;
108
107
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dfx",
3
- "version": "0.17.5",
3
+ "version": "0.17.7",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -49,5 +49,5 @@
49
49
  "@fp-ts/data": "^0.0.20"
50
50
  }
51
51
  },
52
- "gitHead": "a0f69c0023c9b346eaf490f314c18479b6618457"
52
+ "gitHead": "6c36bdae0ae5fb003b8a275887e3f728034ca7b8"
53
53
  }