dfx 0.20.0 → 0.20.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.
- package/Cache/driver.d.ts +1 -2
- package/Cache/index.d.ts +19 -20
- package/Cache/memory.d.ts +3 -3
- package/Cache/memoryTTL.d.ts +3 -5
- package/Cache/prelude.d.ts +1 -1
- package/DiscordConfig/index.d.ts +6 -6
- package/DiscordConfig/index.js +6 -7
- package/DiscordConfig/index.js.map +1 -1
- package/DiscordGateway/DiscordWS/index.d.ts +5 -6
- package/DiscordGateway/DiscordWS/index.js +1 -1
- package/DiscordGateway/Shard/heartbeats.d.ts +2 -4
- package/DiscordGateway/Shard/identify.d.ts +2 -3
- package/DiscordGateway/Shard/index.d.ts +4 -4
- package/DiscordGateway/Shard/invalidSession.d.ts +2 -3
- package/DiscordGateway/Shard/utils.d.ts +3 -4
- package/DiscordGateway/Shard/utils.js +1 -1
- package/DiscordGateway/ShardStore/index.d.ts +3 -4
- package/DiscordGateway/ShardStore/index.js +1 -1
- package/DiscordGateway/Sharder/index.d.ts +8 -9
- package/DiscordGateway/Sharder/index.js +1 -1
- package/DiscordGateway/WS/index.d.ts +2 -4
- package/DiscordGateway/index.d.ts +5 -6
- package/DiscordGateway/index.js +1 -1
- package/DiscordREST/index.d.ts +5 -5
- package/DiscordREST/index.js +1 -1
- package/DiscordREST/types.d.ts +1 -1
- package/DiscordREST/utils.d.ts +2 -2
- package/Helpers/interactions.d.ts +6 -5
- package/Helpers/interactions.js +1 -1
- package/Helpers/permissions.d.ts +3 -3
- package/Helpers/permissions.js +1 -1
- package/Http/index.d.ts +9 -9
- package/Http/index.js +1 -1
- package/Interactions/context.d.ts +8 -8
- package/Interactions/context.js +2 -3
- package/Interactions/context.js.map +1 -1
- package/Interactions/definitions.d.ts +2 -1
- package/Interactions/gateway.d.ts +6 -2
- package/Interactions/gateway.js +4 -1
- package/Interactions/gateway.js.map +1 -1
- package/Interactions/handlers.d.ts +1 -1
- package/Interactions/handlers.js +1 -1
- package/Interactions/index.d.ts +11 -8
- package/Interactions/index.js +3 -0
- package/Interactions/index.js.map +1 -1
- package/Interactions/webhook.d.ts +13 -6
- package/Interactions/webhook.js +13 -8
- package/Interactions/webhook.js.map +1 -1
- package/Log/index.d.ts +7 -7
- package/Log/index.js +1 -1
- package/RateLimit/index.d.ts +7 -9
- package/RateLimit/index.js +1 -1
- package/RateLimit/index.js.map +1 -1
- package/RateLimit/utils.d.ts +1 -1
- package/gateway.d.ts +6 -6
- package/global.d.ts +2 -76
- package/global.js +1 -1
- package/global.js.map +1 -1
- package/package.json +2 -2
- package/utils/common.d.ts +18 -0
- package/utils/common.js +3 -0
- package/utils/common.js.map +1 -0
- package/utils/effect.d.ts +1 -2
- package/webhooks.d.ts +3 -3
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Discord } from "dfx";
|
|
2
2
|
import { Effect, EffectTypeId } from "@effect/io/Effect";
|
|
3
|
-
export declare const InteractionContext: import("../
|
|
4
|
-
export declare const ApplicationCommandContext: import("../
|
|
5
|
-
export declare const MessageComponentContext: import("../
|
|
6
|
-
export declare const ModalSubmitContext: import("../
|
|
3
|
+
export declare const InteractionContext: import("../utils/common.js").Tag<import("../types.js").Interaction>;
|
|
4
|
+
export declare const ApplicationCommandContext: import("../utils/common.js").Tag<import("../types.js").ApplicationCommandDatum>;
|
|
5
|
+
export declare const MessageComponentContext: import("../utils/common.js").Tag<import("../types.js").MessageComponentDatum>;
|
|
6
|
+
export declare const ModalSubmitContext: import("../utils/common.js").Tag<import("../types.js").ModalSubmitDatum>;
|
|
7
7
|
export interface FocusedOptionContext {
|
|
8
8
|
readonly focusedOption: Discord.ApplicationCommandInteractionDataOption;
|
|
9
9
|
}
|
|
10
|
-
export declare const FocusedOptionContext: import("../
|
|
10
|
+
export declare const FocusedOptionContext: import("../utils/common.js").Tag<FocusedOptionContext>;
|
|
11
11
|
export interface SubCommandContext {
|
|
12
12
|
readonly command: Discord.ApplicationCommandInteractionDataOption;
|
|
13
13
|
}
|
|
14
|
-
export declare const SubCommandContext: import("../
|
|
14
|
+
export declare const SubCommandContext: import("../utils/common.js").Tag<SubCommandContext>;
|
|
15
15
|
export declare const interaction: Effect<import("../types.js").Interaction, never, import("../types.js").Interaction>;
|
|
16
16
|
export declare const command: Effect<import("../types.js").ApplicationCommandDatum, never, import("../types.js").ApplicationCommandDatum>;
|
|
17
17
|
export declare class ResolvedDataNotFound {
|
|
@@ -38,7 +38,7 @@ export declare const handleSubCommands: <NER extends Record<string, Effect<any,
|
|
|
38
38
|
};
|
|
39
39
|
}] ? E : never), import("../types.js").InteractionResponse>;
|
|
40
40
|
export declare const currentSubCommand: Effect<SubCommandContext, never, import("../types.js").ApplicationCommandInteractionDataOption>;
|
|
41
|
-
export declare const optionsMap: Effect<import("../types.js").ApplicationCommandDatum, never, import("../
|
|
41
|
+
export declare const optionsMap: Effect<import("../types.js").ApplicationCommandDatum, never, import("../utils/common.js").HashMap<string, string | undefined>>;
|
|
42
42
|
export declare class RequiredOptionNotFound {
|
|
43
43
|
readonly data: Discord.ApplicationCommandDatum | Discord.ApplicationCommandInteractionDataOption;
|
|
44
44
|
readonly name: string;
|
|
@@ -48,4 +48,4 @@ export declare class RequiredOptionNotFound {
|
|
|
48
48
|
export declare const option: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../index.js").Maybe<import("../types.js").ApplicationCommandInteractionDataOption>>;
|
|
49
49
|
export declare const optionValue: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, RequiredOptionNotFound, string>;
|
|
50
50
|
export declare const optionValueOptional: (name: string) => Effect<import("../types.js").ApplicationCommandDatum, never, import("../index.js").Maybe<string>>;
|
|
51
|
-
export declare const modalValues: Effect<import("../types.js").ModalSubmitDatum, never, import("../
|
|
51
|
+
export declare const modalValues: Effect<import("../types.js").ModalSubmitDatum, never, import("../utils/common.js").HashMap<string, string | undefined>>;
|
package/Interactions/context.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as tsplus_module_1 from "
|
|
1
|
+
import * as tsplus_module_1 from "dfx/utils/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
|
-
import * as tsplus_module_4 from "@fp-ts/data/Function";
|
|
5
4
|
import { EffectTypeId } from "@effect/io/Effect";
|
|
6
5
|
import * as Arr from "@fp-ts/data/ReadonlyArray";
|
|
7
6
|
import * as IxHelpers from "../Helpers/interactions.js";
|
|
@@ -32,7 +31,7 @@ export class SubCommandNotFound {
|
|
|
32
31
|
this.data = data;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
export const handleSubCommands = (commands) => tsplus_module_2.flatMap((data) =>
|
|
34
|
+
export const handleSubCommands = (commands) => tsplus_module_2.flatMap((data) => tsplus_module_1.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_1.pipe(commands[command.name], tsplus_module_2.provideService(SubCommandContext)({ command })))(a)))(tsplus_module_2.service(ApplicationCommandContext));
|
|
36
35
|
export const currentSubCommand = tsplus_module_2.serviceWith(SubCommandContext)((a) => a.command);
|
|
37
36
|
export const optionsMap = tsplus_module_2.serviceWith(ApplicationCommandContext)(IxHelpers.optionsMap);
|
|
38
37
|
export class RequiredOptionNotFound {
|
|
@@ -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,C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,CAAA;AAED,MAAM,OAAO,sBAAsB;IAGtB;IAGA;IALF,IAAI,GAAG,wBAAwB,CAAA;IACxC,YACW,IAE0C,EAC1C,IAAY;QAHZ,SAAI,GAAJ,IAAI,CAEsC;QAC1C,SAAI,GAAJ,IAAI,CAAQ;IACpB,CAAC;CACL;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CACrC,4BAAmB,yBAAyB,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAC1C,wBAAqB,CAAC,CAAC,EAAE,EAAE,CACzB,sBAGI,GAAG,EAAE,CACH,wBAAgB,CAAC,IAAI,EAAE,EAAE,CACvB,qBAAY,IAAI,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EADrD,OAAO,CAEN,2BANP,gCACmB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EADjC,CAAC,CACiC,CAO/B,EATL,MAAM,CAAC,IAAI,CAAC,CAUX,CAAA;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,EAAE,CAClD,oBAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,gCAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAhC,CAAC,CAAgC,EAAzD,MAAM,CAAC,IAAI,CAAC,CAA8C,CAAA;AAE5D,MAAM,CAAC,MAAM,WAAW,GAAG,4BAAmB,kBAAkB,CAAC,CAC/D,SAAS,CAAC,aAAa,CACxB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Discord
|
|
1
|
+
import { Discord } from "dfx";
|
|
2
|
+
import { Maybe } from "dfx/utils/common";
|
|
2
3
|
import { Effect, EffectTypeId } from "@effect/io/Effect";
|
|
3
4
|
import { FocusedOptionContext, ResolvedDataNotFound, SubCommandContext } from "./context.js";
|
|
4
5
|
import type { F } from "ts-toolbelt";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { Effect } from "
|
|
1
|
+
import { Effect } from "dfx/utils/common";
|
|
2
2
|
import { DiscordREST, Discord, FetchError, StatusCodeError, JsonParseError } from "dfx";
|
|
3
3
|
import { DefinitionNotFound } from "./handlers.js";
|
|
4
4
|
import { InteractionBuilder } from "./index.js";
|
|
5
5
|
export interface RunOpts {
|
|
6
6
|
sync?: boolean;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus pipeable dfx/InteractionBuilder runGateway
|
|
10
|
+
* @tsplus location "dfx/Interactions/gateway"
|
|
11
|
+
*/
|
|
12
|
+
export declare const run: <R, R2, E, E2>(postHandler: (effect: import("../utils/common.js").Effect<R | import("../index.js").DiscordREST | import("../types.js").Interaction, E | import("../index.js").FetchError | import("../index.js").StatusCodeError | import("../index.js").JsonParseError | DefinitionNotFound, void>) => import("../utils/common.js").Effect<R2, E2, void>, { sync }?: RunOpts) => (ix: InteractionBuilder<R, E>) => import("../utils/common.js").Effect<import("../index.js").DiscordREST | import("../DiscordGateway/index.js").DiscordGateway | Exclude<R2, import("../types.js").Interaction>, E2 | import("../index.js").FetchError | import("../index.js").StatusCodeError | import("../index.js").JsonParseError, void>;
|
package/Interactions/gateway.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
-
import * as tsplus_module_2 from "
|
|
2
|
+
import * as tsplus_module_2 from "dfx/utils/common";
|
|
3
3
|
import * as tsplus_module_3 from "dfx";
|
|
4
4
|
import * as tsplus_module_4 from "dfx/gateway";
|
|
5
5
|
import { handlers } from "./handlers.js";
|
|
6
6
|
import { InteractionContext } from "./index.js";
|
|
7
7
|
import { splitDefinitions } from "./utils.js";
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus pipeable dfx/InteractionBuilder runGateway
|
|
10
|
+
*/
|
|
8
11
|
export const run = (postHandler, { sync = true } = {}) => (ix) => (() => {
|
|
9
12
|
const { GlobalApplicationCommand, GuildApplicationCommand } = splitDefinitions(ix.definitions);
|
|
10
13
|
return tsplus_module_1.flatMap(gateway => tsplus_module_1.flatMap(rest => tsplus_module_1.flatMap(application => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/Interactions/gateway.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAsB,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAM7C,MAAM,CAAC,MAAM,GAAG,GACd,CACE,WAMyB,EACzB,EAAE,IAAI,GAAG,IAAI,KAAc,EAAE,EAC7B,EAAE,CACJ,CAAC,EAA4B,EAAE,EAAE;IAE7B,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,GACzD,gBAAgB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;mCAE5B,OAAO,4BACP,IAAI,4BAEJ,WAAW;QAIjB,MAAM,UAAU,GAAG,IAAI,CAAC,sCAAsC,CAC5D,WAAW,CAAC,EAAE,EACd;YACE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;SACrE,CACF,CAAA;QAED,MAAM,SAAS,GAAG,uBAAuB,CAAC,MAAM;YAC9C,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAC3C,IAAI,CAAC,qCAAqC,CACxC,WAAW,CAAC,EAAE,EACd,CAAC,CAAC,EAAE,EACJ,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CA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C,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAhE,IAAI,CAAC,mCAAmC,EAAE,CAAuB,GAHpD,wCAAe,WAAW,CAAC,GADxB,wBAAe,gBAAA,OAAO,CAAC,cAAc,CAAC;IAqCxD,CAAA"}
|
package/Interactions/handlers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "dfx";
|
|
2
2
|
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
3
|
import * as tsplus_module_3 from "@fp-ts/data/Option";
|
|
4
|
-
import * as tsplus_module_4 from "
|
|
4
|
+
import * as tsplus_module_4 from "dfx/utils/common";
|
|
5
5
|
import * as tsplus_module_5 from "@fp-ts/data/Chunk";
|
|
6
6
|
import * as Ctx from "./context.js";
|
|
7
7
|
import * as Arr from "@fp-ts/data/ReadonlyArray";
|
package/Interactions/index.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { Effect } from "
|
|
1
|
+
import { Effect } from "dfx/utils/common";
|
|
2
2
|
import { DiscordREST, Discord } from "dfx";
|
|
3
3
|
import * as D from "./definitions.js";
|
|
4
4
|
export * from "./context.js";
|
|
5
5
|
export { global, guild, messageComponent, modalSubmit, autocomplete, InteractionDefinition, } from "./definitions.js";
|
|
6
6
|
export { response as r } from "../Helpers/interactions.js";
|
|
7
|
+
/**
|
|
8
|
+
* @tsplus type dfx/InteractionBuilder
|
|
9
|
+
*/
|
|
7
10
|
export declare class InteractionBuilder<R, E> {
|
|
8
11
|
readonly definitions: D.InteractionDefinition<R, E>[];
|
|
9
12
|
constructor(definitions: D.InteractionDefinition<R, E>[]);
|
|
10
13
|
add<R1, E1>(definition: D.InteractionDefinition<R1, E1>): InteractionBuilder<R | R1, E | E1>;
|
|
11
14
|
concat<R1, E1>(builder: InteractionBuilder<R1, E1>): InteractionBuilder<R | R1, E | E1>;
|
|
12
|
-
get syncGlobal(): import("../
|
|
13
|
-
syncGuild(appId: Discord.Snowflake, guildId: Discord.Snowflake): import("../
|
|
15
|
+
get syncGlobal(): import("../utils/common.js").Effect<import("../index.js").DiscordREST, import("../index.js").FetchError | import("../index.js").StatusCodeError | import("../index.js").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<import("../types.js").ApplicationCommand[]>>;
|
|
16
|
+
syncGuild(appId: Discord.Snowflake, guildId: Discord.Snowflake): import("../utils/common.js").Effect<import("../index.js").DiscordREST, import("../index.js").FetchError | import("../index.js").StatusCodeError | import("../index.js").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<import("../types.js").ApplicationCommand[]>>;
|
|
14
17
|
}
|
|
15
18
|
export declare const builder: InteractionBuilder<never, never>;
|
|
16
|
-
export declare const id: (query: string) => (customId: string) => import("../
|
|
17
|
-
export declare const idStartsWith: (query: string) => (customId: string) => import("../
|
|
18
|
-
export declare const idRegex: (query: RegExp) => (customId: string) => import("../
|
|
19
|
-
export declare const option: (command: string, optionName: string) => (data: Pick<Discord.ApplicationCommandDatum, "name">, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => import("../
|
|
20
|
-
export declare const optionOnly: (optionName: string) => (_: unknown, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => import("../
|
|
19
|
+
export declare const id: (query: string) => (customId: string) => import("../utils/common.js").Effect<never, never, boolean>;
|
|
20
|
+
export declare const idStartsWith: (query: string) => (customId: string) => import("../utils/common.js").Effect<never, never, boolean>;
|
|
21
|
+
export declare const idRegex: (query: RegExp) => (customId: string) => import("../utils/common.js").Effect<never, never, boolean>;
|
|
22
|
+
export declare const option: (command: string, optionName: string) => (data: Pick<Discord.ApplicationCommandDatum, "name">, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => import("../utils/common.js").Effect<never, never, boolean>;
|
|
23
|
+
export declare const optionOnly: (optionName: string) => (_: unknown, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => import("../utils/common.js").Effect<never, never, boolean>;
|
package/Interactions/index.js
CHANGED
|
@@ -3,6 +3,9 @@ import * as tsplus_module_2 from "dfx";
|
|
|
3
3
|
export * from "./context.js";
|
|
4
4
|
export { global, guild, messageComponent, modalSubmit, autocomplete, } from "./definitions.js";
|
|
5
5
|
export { response as r } from "../Helpers/interactions.js";
|
|
6
|
+
/**
|
|
7
|
+
* @tsplus type dfx/InteractionBuilder
|
|
8
|
+
*/
|
|
6
9
|
export class InteractionBuilder {
|
|
7
10
|
definitions;
|
|
8
11
|
constructor(definitions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Interactions/index.ts"],"names":[],"mappings":";;AAEA,cAAc,cAAc,CAAA;AAE5B,OAAO,EACL,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,GAEb,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,QAAQ,IAAI,CAAC,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,OAAO,kBAAkB;IACR;IAArB,YAAqB,WAA4C;QAA5C,gBAAW,GAAX,WAAW,CAAiC;IAAG,CAAC;IAErE,GAAG,CAAS,UAA2C;QACrD,OAAO,IAAI,kBAAkB,CAAiB;YAC5C,GAAG,IAAI,CAAC,WAAW;YACnB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAS,OAAmC;QAChD,OAAO,IAAI,kBAAkB,CAAiB;YAC5C,GAAG,IAAI,CAAC,WAAW;YACnB,GAAG,OAAO,CAAC,WAAW;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW;aAC9B,MAAM,CACL,CAAC,CAAC,EAAyC,EAAE,CAC3C,CAAC,CAAC,IAAI,KAAK,0BAA0B,CACxC;aACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QAExB,OAAO,kDAAyB,WAAW,CAAC,CA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AAC,QAAgB,EAAE,EAAE,CAC7D,wBAAe,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEtC,MAAM,CAAC,MAAM,MAAM,GACjB,CAAC,OAAe,EAAE,UAAkB,EAAE,EAAE,CACxC,CACE,IAAmD,EACnD,aAGC,EACD,EAAE,CACF,wBAAe,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,aAAa,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;AAE9E,MAAM,CAAC,MAAM,UAAU,GACrB,CAAC,UAAkB,EAAE,EAAE,CACvB,CACE,CAAU,EACV,aAGC,EACD,EAAE,CACF,wBAAe,aAAa,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Discord } from "dfx";
|
|
2
|
-
import { Effect } from "
|
|
3
|
-
import { Cause } from "@effect/io/Cause";
|
|
2
|
+
import { Effect, Cause } from "dfx/utils/common";
|
|
4
3
|
import { DefinitionNotFound } from "./handlers.js";
|
|
5
4
|
import { InteractionBuilder } from "./index.js";
|
|
6
5
|
export declare class BadWebhookSignature {
|
|
@@ -17,8 +16,8 @@ declare const makeConfig: ({ applicationId, publicKey }: MakeConfigOpts) => {
|
|
|
17
16
|
};
|
|
18
17
|
export interface WebhookConfig extends ReturnType<typeof makeConfig> {
|
|
19
18
|
}
|
|
20
|
-
export declare const WebhookConfig: import("../
|
|
21
|
-
export declare const makeConfigLayer: (a_0: MakeConfigOpts) => import("../
|
|
19
|
+
export declare const WebhookConfig: import("../utils/common.js").Tag<WebhookConfig>;
|
|
20
|
+
export declare const makeConfigLayer: (a_0: MakeConfigOpts) => import("../utils/common.js").Layer<never, never, WebhookConfig>;
|
|
22
21
|
export declare class WebhookParseError {
|
|
23
22
|
readonly reason: unknown;
|
|
24
23
|
readonly _tag = "WebhookParseError";
|
|
@@ -30,9 +29,17 @@ export interface HandleWebhookOpts<E> {
|
|
|
30
29
|
success: (a: Discord.InteractionResponse) => Effect<never, never, void>;
|
|
31
30
|
error: (e: Cause<E>) => Effect<never, never, void>;
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus getter dfx/InteractionBuilder webhookHandler
|
|
34
|
+
* @tsplus location "dfx/Interactions/webhook"
|
|
35
|
+
*/
|
|
36
|
+
export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body, success, error, }: HandleWebhookOpts<DefinitionNotFound | BadWebhookSignature | WebhookParseError | E>) => import("../utils/common.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, never, void>;
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
|
|
39
|
+
* @tsplus location "dfx/Interactions/webhook"
|
|
40
|
+
*/
|
|
34
41
|
export declare const makeSimpleHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body }: {
|
|
35
42
|
headers: Headers;
|
|
36
43
|
body: string;
|
|
37
|
-
}) => import("../
|
|
44
|
+
}) => import("../utils/common.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, DefinitionNotFound | BadWebhookSignature | WebhookParseError | E, import("../types.js").InteractionResponse>;
|
|
38
45
|
export {};
|
package/Interactions/webhook.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@fp-ts/data/Option";
|
|
2
2
|
import * as tsplus_module_2 from "@fp-ts/data/Either";
|
|
3
|
-
import * as tsplus_module_3 from "
|
|
3
|
+
import * as tsplus_module_3 from "dfx/utils/common";
|
|
4
4
|
import * as tsplus_module_4 from "@effect/io/Layer";
|
|
5
|
-
import * as tsplus_module_5 from "@
|
|
6
|
-
import * as tsplus_module_6 from "@effect/io/Effect";
|
|
5
|
+
import * as tsplus_module_5 from "@effect/io/Effect";
|
|
7
6
|
import Nacl from "tweetnacl";
|
|
8
7
|
import { handlers } from "./handlers.js";
|
|
9
8
|
import { InteractionContext } from "./index.js";
|
|
@@ -23,7 +22,7 @@ const makeConfig = ({ applicationId, publicKey }) => ({
|
|
|
23
22
|
publicKey: fromHex(publicKey),
|
|
24
23
|
});
|
|
25
24
|
export const WebhookConfig = tsplus_module_3.Tag();
|
|
26
|
-
export const makeConfigLayer =
|
|
25
|
+
export const makeConfigLayer = tsplus_module_3.flow(makeConfig, tsplus_module_4.succeed(WebhookConfig));
|
|
27
26
|
export class WebhookParseError {
|
|
28
27
|
reason;
|
|
29
28
|
_tag = "WebhookParseError";
|
|
@@ -31,18 +30,24 @@ export class WebhookParseError {
|
|
|
31
30
|
this.reason = reason;
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
const fromHeadersAndBody = (headers, body) =>
|
|
33
|
+
const fromHeadersAndBody = (headers, body) => tsplus_module_5.flatMap(({ publicKey }) => tsplus_module_5.flatMap(() => tsplus_module_5.tryCatch(() => JSON.parse(body), (reason) => new WebhookParseError(reason)))(tsplus_module_5.fromEither(checkSignature(publicKey, headers, body))))(tsplus_module_5.service(WebhookConfig));
|
|
35
34
|
const run = (definitions) => {
|
|
36
35
|
const handler = handlers(definitions);
|
|
37
|
-
return (headers, body) =>
|
|
38
|
-
const provide =
|
|
36
|
+
return (headers, body) => tsplus_module_5.flatMap(interaction => {
|
|
37
|
+
const provide = tsplus_module_5.provideService(InteractionContext)(interaction);
|
|
39
38
|
return provide(handler[interaction.type](interaction));
|
|
40
39
|
})(fromHeadersAndBody(headers, body));
|
|
41
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* @tsplus getter dfx/InteractionBuilder webhookHandler
|
|
43
|
+
*/
|
|
42
44
|
export const makeHandler = (ix) => {
|
|
43
45
|
const handle = run(ix.definitions);
|
|
44
|
-
return ({ headers, body, success, error, }) =>
|
|
46
|
+
return ({ headers, body, success, error, }) => tsplus_module_5.catchAllCause(error)(tsplus_module_5.flatMap(success)(handle(headers, body)));
|
|
45
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
|
|
50
|
+
*/
|
|
46
51
|
export const makeSimpleHandler = (ix) => {
|
|
47
52
|
const handle = run(ix.definitions);
|
|
48
53
|
return ({ headers, body }) => handle(headers, body);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/Interactions/webhook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/Interactions/webhook.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAsB,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,OAAO,mBAAmB;IACrB,IAAI,GAAG,qBAAqB,CAAA;CACtC;AAID,MAAM,cAAc,GAAG,CACrB,SAAqB,EACrB,OAAgB,EAChB,IAAY,EACZ,EAAE,wBACF,yBAYY,GAAG,EAAE,CAAC,IAAI,mBAAmB,EAAE,EAZ3C,uBAIU,CAAC,CAAC,EAAE,EAAE;IACZ,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC9B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,EAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EACzB,SAAS,CACV,CAAA;AACH,CAAC,EAXH,uBAAa;IACX,SAAS,EAAE,6BAAmB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7D,SAAS,EAAE,6BAAmB,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAChE,CAAC,CAQE,CACwC,CAAO,CAAA;AAMrD,MAAM,UAAU,GAAG,CAAC,EAAE,aAAa,EAAE,SAAS,EAAkB,E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AC,EAAE,CAAC,WAAW,CAAC,CAAA;IAElC,OAAO,CAAC,EACN,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAK,GAGN,EAAE,EAAE,CAAC,8BAAqD,KAAK,EAA1D,wBAA8B,OAAO,EAArC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAiB,CAAqB,CAAA;AACnE,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAO,EAA4B,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;IAElC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAsC,EAAE,EAAE,CAC/D,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACzB,CAAC,CAAA"}
|
package/Log/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
declare const make: (debug?: boolean) => {
|
|
2
|
-
info: (...args: any[]) => import("../
|
|
3
|
-
debug: (...args: any[]) => import("../
|
|
2
|
+
info: (...args: any[]) => import("../utils/common.js").Effect<never, never, void>;
|
|
3
|
+
debug: (...args: any[]) => import("../utils/common.js").Effect<never, never, void>;
|
|
4
4
|
};
|
|
5
5
|
export interface Log extends ReturnType<typeof make> {
|
|
6
6
|
}
|
|
7
|
-
export declare const Log: import("../
|
|
8
|
-
export declare const LiveLog: import("../
|
|
9
|
-
export declare const LiveLogDebug: import("../
|
|
10
|
-
export declare const info: (...args: any[]) => import("../
|
|
11
|
-
export declare const debug: (...args: any[]) => import("../
|
|
7
|
+
export declare const Log: import("../utils/common.js").Tag<Log>;
|
|
8
|
+
export declare const LiveLog: import("../utils/common.js").Layer<never, never, Log>;
|
|
9
|
+
export declare const LiveLogDebug: import("../utils/common.js").Layer<never, never, Log>;
|
|
10
|
+
export declare const info: (...args: any[]) => import("../utils/common.js").Effect<Log, never, void>;
|
|
11
|
+
export declare const debug: (...args: any[]) => import("../utils/common.js").Effect<Log, never, void>;
|
|
12
12
|
export {};
|
package/Log/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
-
import * as tsplus_module_2 from "
|
|
2
|
+
import * as tsplus_module_2 from "dfx/utils/common";
|
|
3
3
|
import * as tsplus_module_3 from "@effect/io/Layer";
|
|
4
4
|
const make = (debug = false) => ({
|
|
5
5
|
info: (...args) => tsplus_module_1.sync(() => {
|
package/RateLimit/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Effect } from "
|
|
2
|
-
import { Maybe } from "dfx";
|
|
3
|
-
import { Duration } from "@fp-ts/data/Duration";
|
|
1
|
+
import { Effect, Maybe, Duration } from "dfx/utils/common";
|
|
4
2
|
import { Success } from "dfx/utils/effect";
|
|
5
3
|
export type BucketDetails = {
|
|
6
4
|
key: "global" | string;
|
|
@@ -14,13 +12,13 @@ export interface RateLimitStore {
|
|
|
14
12
|
putBucketRoute: (route: string, bucketKey: string) => Effect<never, never, void>;
|
|
15
13
|
incrementCounter: (key: string, window: number, limit: number) => Effect<never, never, readonly [count: number, ttl: number]>;
|
|
16
14
|
}
|
|
17
|
-
export declare const RateLimitStore: import("../
|
|
18
|
-
export declare const LiveMemoryRateLimitStore: import("../
|
|
19
|
-
declare const makeLimiter: import("../
|
|
20
|
-
maybeWait: (key: string, window: Duration, limit: number, multiplier?: number) => import("../
|
|
15
|
+
export declare const RateLimitStore: import("../utils/common.js").Tag<RateLimitStore>;
|
|
16
|
+
export declare const LiveMemoryRateLimitStore: import("../utils/common.js").Layer<never, never, RateLimitStore>;
|
|
17
|
+
declare const makeLimiter: import("../utils/common.js").Effect<import("../Log/index.js").Log | RateLimitStore, never, {
|
|
18
|
+
maybeWait: (key: string, window: Duration, limit: number, multiplier?: number) => import("../utils/common.js").Effect<never, never, void>;
|
|
21
19
|
}>;
|
|
22
20
|
export interface RateLimiter extends Success<typeof makeLimiter> {
|
|
23
21
|
}
|
|
24
|
-
export declare const RateLimiter: import("../
|
|
25
|
-
export declare const LiveRateLimiter: import("../
|
|
22
|
+
export declare const RateLimiter: import("../utils/common.js").Tag<RateLimiter>;
|
|
23
|
+
export declare const LiveRateLimiter: import("../utils/common.js").Layer<import("../Log/index.js").Log | RateLimitStore, never, RateLimiter>;
|
|
26
24
|
export {};
|
package/RateLimit/index.js
CHANGED
package/RateLimit/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/RateLimit/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AA6BrC,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAW,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAE/E,MAAM,WAAW,2BACT,KAAK,wBACL,GAAG;IAET,MAAM,SAAS,GAAG,CAChB,GAAW,EACX,MAAgB,EAChB,KAAa,EACb,UAAU,GAAG,IAAI,EACjB,EAAE;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,GAAG,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/RateLimit/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AA6BrC,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAW,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAE/E,MAAM,WAAW,2BACT,KAAK,wBACL,GAAG;IAET,MAAM,SAAS,GAAG,CAChB,GAAW,EACX,MAAgB,EAChB,KAAa,EACb,UAAU,GAAG,IAAI,EACjB,EAAE;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,GAAG,UAAU,CAAA;QAE3C,8BAAO,2CAAA,oBAGA,CAAC,CAAC,EAAE,EAAE,CACT,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE;YACpC,GAAG;YACH,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ;YACR,KAAK;YACL,KAAK,EAAE,CAAC,CAAC,MAAM;SAChB,CAAC,EAVC,oBAEA,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,EAFxD,KAAK;aACT,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CACuB,CAS7D,CACiB,EAAO;IAC7B,CAAC,CAAA;IAED,OAAO,EAAE,SAAS,EAAE,CAAA;GAzBN,wBAAe,gBAAA,GAAG,CAAC,GAAG,CAAC,GADrB,wBAAe,cAAc,CAAC,CA2B9C,CAAA;AAGF,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAA,GAAG,EAAe,CAAA;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,2BAAiB,WAAW,CAAC,CAAC,WAAW,CAAC,CAAA"}
|
package/RateLimit/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Duration } from "
|
|
1
|
+
import { Duration } from "dfx/utils/common";
|
|
2
2
|
export declare const delayFrom: (window: number, limit: number, count: number, ttl: number) => Duration;
|
package/gateway.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export * as ShardStore from "./DiscordGateway/ShardStore/index.js";
|
|
|
6
6
|
export * as Gateway from "./DiscordGateway/index.js";
|
|
7
7
|
export * as CachePrelude from "./Cache/prelude.js";
|
|
8
8
|
export { run as runIx } from "./Interactions/gateway.js";
|
|
9
|
-
export declare const MemoryRateLimit: import("./
|
|
10
|
-
export declare const MemoryREST: import("./
|
|
11
|
-
export declare const MemorySharder: import("./
|
|
12
|
-
export declare const MemoryGateway: import("./
|
|
13
|
-
export declare const MemoryBot: import("./
|
|
14
|
-
export declare const make: (config: Config.MakeOpts, debug?: boolean) => import("./
|
|
9
|
+
export declare const MemoryRateLimit: import("./utils/common.js").Layer<import("./Log/index.js").Log, never, import("./index.js").RateLimitStore | import("./index.js").RateLimiter>;
|
|
10
|
+
export declare const MemoryREST: import("./utils/common.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./index.js").DiscordREST>;
|
|
11
|
+
export declare const MemorySharder: import("./utils/common.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./DiscordGateway/Sharder/index.js").Sharder>;
|
|
12
|
+
export declare const MemoryGateway: import("./utils/common.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./DiscordGateway/index.js").DiscordGateway>;
|
|
13
|
+
export declare const MemoryBot: import("./utils/common.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./index.js").DiscordREST | import("./index.js").RateLimitStore | import("./index.js").RateLimiter | import("./DiscordGateway/index.js").DiscordGateway>;
|
|
14
|
+
export declare const make: (config: Config.MakeOpts, debug?: boolean) => import("./utils/common.js").Layer<never, never, import("./index.js").DiscordREST | import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig | import("./index.js").RateLimitStore | import("./index.js").RateLimiter | import("./DiscordGateway/index.js").DiscordGateway>;
|
package/global.d.ts
CHANGED
|
@@ -1,71 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @tsplus global
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
/**
|
|
6
|
-
* @tsplus global
|
|
7
|
-
*/
|
|
8
|
-
import type { Layer } from "@effect/io/Layer";
|
|
9
|
-
/**
|
|
10
|
-
* @tsplus global
|
|
11
|
-
*/
|
|
12
|
-
import type { Dequeue, Queue } from "@effect/io/Queue";
|
|
13
|
-
/**
|
|
14
|
-
* @tsplus global
|
|
15
|
-
*/
|
|
16
|
-
import type { Schedule } from "@effect/io/Schedule";
|
|
17
|
-
/**
|
|
18
|
-
* @tsplus global
|
|
19
|
-
*/
|
|
20
|
-
import type { Cause } from "@effect/io/Cause";
|
|
21
|
-
/**
|
|
22
|
-
* @tsplus global
|
|
23
|
-
*/
|
|
24
|
-
import type { Chunk } from "@fp-ts/data/Chunk";
|
|
25
|
-
/**
|
|
26
|
-
* @tsplus global
|
|
27
|
-
*/
|
|
28
|
-
import { Context, Tag } from "@fp-ts/data/Context";
|
|
29
|
-
/**
|
|
30
|
-
* @tsplus global
|
|
31
|
-
*/
|
|
32
|
-
import type { Duration } from "@fp-ts/data/Duration";
|
|
33
|
-
/**
|
|
34
|
-
* @tsplus global
|
|
35
|
-
*/
|
|
36
|
-
import type { Equal } from "@fp-ts/data/Equal";
|
|
37
|
-
/**
|
|
38
|
-
* @tsplus global
|
|
39
|
-
*/
|
|
40
|
-
import type { Maybe } from "dfx";
|
|
41
|
-
/**
|
|
42
|
-
* @tsplus global
|
|
43
|
-
*/
|
|
44
|
-
import type { Either } from "@fp-ts/data/Either";
|
|
45
|
-
/**
|
|
46
|
-
* @tsplus global
|
|
47
|
-
*/
|
|
48
|
-
import type { Exit } from "@effect/io/Exit";
|
|
49
|
-
/**
|
|
50
|
-
* @tsplus global
|
|
51
|
-
*/
|
|
52
|
-
import type { EffectSource } from "callbag-effect-ts/Source";
|
|
53
|
-
/**
|
|
54
|
-
* @tsplus global
|
|
55
|
-
*/
|
|
56
|
-
import type { EffectSink } from "callbag-effect-ts/Sink";
|
|
57
|
-
/**
|
|
58
|
-
* @tsplus global
|
|
59
|
-
*/
|
|
60
|
-
import type { HashMap } from "@fp-ts/data/HashMap";
|
|
61
|
-
/**
|
|
62
|
-
* @tsplus global
|
|
63
|
-
*/
|
|
64
|
-
import type { Ref } from "@effect/io/Ref";
|
|
65
|
-
/**
|
|
66
|
-
* @tsplus global
|
|
67
|
-
*/
|
|
68
|
-
import type { HashSet } from "@fp-ts/data/HashSet";
|
|
4
|
+
import { Cause, Duration, Effect, EffectSource, HashMap, HashSet, Layer, Maybe, Queue, Ref, Schedule, Tag, flow, identity, pipe, } from "dfx/utils/common";
|
|
69
5
|
/**
|
|
70
6
|
* @tsplus global
|
|
71
7
|
*/
|
|
@@ -82,14 +18,4 @@ import {} from "dfx/webhooks";
|
|
|
82
18
|
* @tsplus global
|
|
83
19
|
*/
|
|
84
20
|
import type { Success } from "dfx/utils/effect";
|
|
85
|
-
|
|
86
|
-
* @tsplus global
|
|
87
|
-
*/
|
|
88
|
-
import { pipe, flow, identity } from "@fp-ts/data/Function";
|
|
89
|
-
export type { Effect } from "@effect/io/Effect";
|
|
90
|
-
export type { Layer } from "@effect/io/Layer";
|
|
91
|
-
export type {} from "@effect/io/Queue";
|
|
92
|
-
export { Context, Tag } from "@fp-ts/data/Context";
|
|
93
|
-
export type { Duration } from "@fp-ts/data/Duration";
|
|
94
|
-
export type { HashMap } from "@fp-ts/data/HashMap";
|
|
95
|
-
export type { Ref } from "@effect/io/Ref";
|
|
21
|
+
export {};
|
package/global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=global.js.map
|
package/global.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.js","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"@fp-ts/data": "^0.0.25"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "b3974878407648fd54d36710965964b26513cc2c"
|
|
53
53
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type { Cause } from "@effect/io/Cause";
|
|
2
|
+
export type { Effect } from "@effect/io/Effect";
|
|
3
|
+
export type { Exit } from "@effect/io/Exit";
|
|
4
|
+
export type { Layer } from "@effect/io/Layer";
|
|
5
|
+
export type { Dequeue, Queue } from "@effect/io/Queue";
|
|
6
|
+
export type { Schedule } from "@effect/io/Schedule";
|
|
7
|
+
export type { Chunk } from "@fp-ts/data/Chunk";
|
|
8
|
+
export { Context, Tag } from "@fp-ts/data/Context";
|
|
9
|
+
export type { Duration } from "@fp-ts/data/Duration";
|
|
10
|
+
export type { Equal } from "@fp-ts/data/Equal";
|
|
11
|
+
export type { Either } from "@fp-ts/data/Either";
|
|
12
|
+
export type { HashMap } from "@fp-ts/data/HashMap";
|
|
13
|
+
export type { Option as Maybe } from "@fp-ts/data/Option";
|
|
14
|
+
export type { Ref } from "@effect/io/Ref";
|
|
15
|
+
export type { HashSet } from "@fp-ts/data/HashSet";
|
|
16
|
+
export { pipe, flow, identity } from "@fp-ts/data/Function";
|
|
17
|
+
export type { EffectSource } from "callbag-effect-ts/Source";
|
|
18
|
+
export type { EffectSink } from "callbag-effect-ts/Sink";
|
package/utils/common.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAQA,OAAO,EAAW,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAQlD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA"}
|
package/utils/effect.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Effect } from "
|
|
2
|
-
import { Tag } from "@fp-ts/data/Context";
|
|
1
|
+
import { Effect, Tag } from "dfx/utils/common";
|
|
3
2
|
export type Success<A extends Effect<any, any, any>> = A extends Effect<any, any, infer R> ? R : never;
|
|
4
3
|
export type ShapeFn<T> = Pick<T, {
|
|
5
4
|
[k in keyof T]: T[k] extends (...args: infer ARGS) => Effect<infer R, infer E, infer A> ? ((...args: ARGS) => Effect<R, E, A>) extends T[k] ? k : never : never;
|
package/webhooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Config } from "dfx";
|
|
2
2
|
import { MakeConfigOpts } from "./Interactions/webhook.js";
|
|
3
3
|
export { makeConfigLayer, makeHandler, makeSimpleHandler, WebhookConfig, WebhookParseError, BadWebhookSignature, } from "./Interactions/webhook.js";
|
|
4
|
-
export declare const MemoryRateLimit: import("./
|
|
5
|
-
export declare const MemoryREST: import("./
|
|
6
|
-
export declare const make: (config: Config.MakeOpts & MakeConfigOpts, debug?: boolean) => import("./
|
|
4
|
+
export declare const MemoryRateLimit: import("./utils/common.js").Layer<import("./Log/index.js").Log, never, import("./index.js").RateLimitStore | import("./index.js").RateLimiter>;
|
|
5
|
+
export declare const MemoryREST: import("./utils/common.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./index.js").DiscordREST>;
|
|
6
|
+
export declare const make: (config: Config.MakeOpts & MakeConfigOpts, debug?: boolean) => import("./utils/common.js").Layer<never, never, import("./index.js").DiscordREST | import("./index.js").RateLimitStore | import("./index.js").RateLimiter | import("./Interactions/webhook.js").WebhookConfig>;
|