dfx 0.13.1 → 0.13.2
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Discord } from "dfx/common";
|
|
2
|
+
import { Effect, EffectTypeId } from "@effect/io/Effect";
|
|
2
3
|
import { InteractionResponse } from "./definitions.js";
|
|
3
|
-
import { EffectTypeId, Effect } from "@effect/io/Effect";
|
|
4
4
|
export declare const InteractionContext: import("../common.js").Tag<import("../types.js").Interaction>;
|
|
5
5
|
export declare const ApplicationCommandContext: import("../common.js").Tag<import("../types.js").ApplicationCommandDatum>;
|
|
6
6
|
export declare const MessageComponentContext: import("../common.js").Tag<import("../types.js").MessageComponentDatum>;
|
package/Interactions/context.js
CHANGED
|
@@ -2,8 +2,9 @@ import * as tsplus_module_1 from "dfx/common";
|
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
3
|
import * as tsplus_module_3 from "@fp-ts/data/Option";
|
|
4
4
|
import * as tsplus_module_4 from "@fp-ts/data/Function";
|
|
5
|
-
import * as Arr from "@fp-ts/data/ReadonlyArray";
|
|
6
5
|
import { EffectTypeId } from "@effect/io/Effect";
|
|
6
|
+
import * as Arr from "@fp-ts/data/ReadonlyArray";
|
|
7
|
+
import * as IxHelpers from "../Helpers/interactions.js";
|
|
7
8
|
export const InteractionContext = tsplus_module_1.Tag();
|
|
8
9
|
export const ApplicationCommandContext = tsplus_module_1.Tag();
|
|
9
10
|
export const MessageComponentContext = tsplus_module_1.Tag();
|
|
@@ -20,7 +21,7 @@ export class ResolvedDataNotFound {
|
|
|
20
21
|
this.name = name;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
export const getResolved = (name, f) => tsplus_module_2.serviceWithEffect(ApplicationCommandContext)((a) => tsplus_module_3.match(() => tsplus_module_2.fail(new ResolvedDataNotFound(a, name)), tsplus_module_2.succeed)(
|
|
24
|
+
export const getResolved = (name, f) => tsplus_module_2.serviceWithEffect(ApplicationCommandContext)((a) => tsplus_module_3.match(() => tsplus_module_2.fail(new ResolvedDataNotFound(a, name)), tsplus_module_2.succeed)(IxHelpers.resolveOptionValue(name, f)(a)));
|
|
24
25
|
export const focusedOptionValue = tsplus_module_2.serviceWith(FocusedOptionContext)((a) => a.focusedOption.value ?? "");
|
|
25
26
|
export class SubCommandNotFound {
|
|
26
27
|
data;
|
|
@@ -29,9 +30,9 @@ export class SubCommandNotFound {
|
|
|
29
30
|
this.data = data;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
export const handleSubCommands = (commands) => tsplus_module_2.flatMap((data) => tsplus_module_4.pipe(
|
|
33
|
+
export const handleSubCommands = (commands) => tsplus_module_2.flatMap((data) => tsplus_module_4.pipe(IxHelpers.allSubCommands(data), Arr.findFirst((a) => !!commands[a.name]), (o) => tsplus_module_3.toEither(() => new SubCommandNotFound(data))(o), tsplus_module_2.fromEither, (a) => tsplus_module_2.flatMap((command) => tsplus_module_4.pipe(commands[command.name], tsplus_module_2.provideService(SubCommandContext)({ command })))(a)))(tsplus_module_2.service(ApplicationCommandContext));
|
|
33
34
|
export const getSubCommand = tsplus_module_2.serviceWith(SubCommandContext)((a) => a.command);
|
|
34
|
-
export const optionsMap = tsplus_module_2.serviceWith(ApplicationCommandContext)(
|
|
35
|
+
export const optionsMap = tsplus_module_2.serviceWith(ApplicationCommandContext)(IxHelpers.optionsMap);
|
|
35
36
|
export class RequiredOptionNotFound {
|
|
36
37
|
data;
|
|
37
38
|
name;
|
|
@@ -41,10 +42,10 @@ export class RequiredOptionNotFound {
|
|
|
41
42
|
this.name = name;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
export const findOption = (name) => tsplus_module_2.serviceWith(ApplicationCommandContext)(
|
|
45
|
+
export const findOption = (name) => tsplus_module_2.serviceWith(ApplicationCommandContext)(IxHelpers.getOption(name));
|
|
45
46
|
export const requiredOptionValue = (name) => tsplus_module_2.flatMap((o) => tsplus_module_3.match(() => tsplus_module_2.flatMap((data) => tsplus_module_2.fail(new RequiredOptionNotFound(data, name)))(getCommand), tsplus_module_2.succeed)(tsplus_module_3.flatMapNullable((a) => a.value)(o)))(findOption(name));
|
|
46
|
-
export const subCommandOptionsMap = tsplus_module_2.map(
|
|
47
|
-
export const findSubCommandOption = (name) => tsplus_module_2.serviceWith(SubCommandContext)(({ command }) =>
|
|
47
|
+
export const subCommandOptionsMap = tsplus_module_2.map(IxHelpers.optionsMap)(getSubCommand);
|
|
48
|
+
export const findSubCommandOption = (name) => tsplus_module_2.serviceWith(SubCommandContext)(({ command }) => IxHelpers.getOption(name)(command));
|
|
48
49
|
export const requiredSubCommandOptionValue = (name) => tsplus_module_2.flatMap((o) => tsplus_module_3.match(() => tsplus_module_2.flatMap((data) => tsplus_module_2.fail(new RequiredOptionNotFound(data, name)))(getSubCommand), tsplus_module_2.succeed)(tsplus_module_3.flatMapNullable((a) => a.value)(o)))(findSubCommandOption(name));
|
|
49
|
-
export const modalValues = tsplus_module_2.serviceWith(ModalSubmitContext)(
|
|
50
|
+
export const modalValues = tsplus_module_2.serviceWith(ModalSubmitContext)(IxHelpers.componentsMap);
|
|
50
51
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/Interactions/context.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/Interactions/context.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAChD,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAA;AAGvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAA,GAAG,EAAuB,CAAA;AAC5D,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAA,GAAG,EAAmC,CAAA;AAC/E,MAAM,CAAC,MA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BAAY,IAAI,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EADrD,UAAU,CAET,2BANP,gCACmB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EADjC,CAAC,CACiC,CAO/B,EATL,UAAU,CAAC,IAAI,CAAC,CAUf,CAAA;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAkB,SAAS,CAAC,UAAU,EAAtC,aAAa,CAA0B,CAAA;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE,CACnD,4BAAmB,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CACpD,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CACnC,CAAA;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,IAAY,EAAE,EAAE,CAC5D,wBAAmC,CAAC,CAAC,EAAE,EAAE,CACvC,sBAGI,GAAG,EAAE,CACH,wBAAsB,CAAC,IAAI,EAAE,EAAE,CAC7B,qBAAY,IAAI,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EADrD,aAAa,CAEZ,2BANP,gCACmB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EADjC,CAAC,CACiC,CAO/B,EATL,oBAAoB,CAAC,IAAI,CAAC,CAUzB,CAAA;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,4BAAmB,kBAAkB,CAAC,CAC/D,SAAS,CAAC,aAAa,CACxB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"@fp-ts/data": "^0.0.20"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d37a64b24f3dbb44d1bf3807b3ad2031f078e2ac"
|
|
51
51
|
}
|