dfx 0.90.2 → 0.91.0
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/prelude.d.ts.map +1 -1
- package/Cache/prelude.js +8 -2
- package/Cache/prelude.js.map +1 -1
- package/Cache.d.ts +11 -7
- package/Cache.d.ts.map +1 -1
- package/Cache.js +8 -9
- package/Cache.js.map +1 -1
- package/DiscordGateway/Shard.d.ts +2 -2
- package/DiscordGateway/Sharder.d.ts +1 -1
- package/DiscordGateway/Sharder.d.ts.map +1 -1
- package/DiscordGateway.d.ts +1 -1
- package/DiscordGateway.d.ts.map +1 -1
- package/DiscordREST.d.ts +11 -6
- package/DiscordREST.d.ts.map +1 -1
- package/DiscordREST.js +16 -10
- package/DiscordREST.js.map +1 -1
- package/Interactions/context.d.ts +15 -22
- package/Interactions/context.d.ts.map +1 -1
- package/Interactions/context.js +12 -34
- package/Interactions/context.js.map +1 -1
- package/Interactions/definitions.d.ts +3 -2
- package/Interactions/definitions.d.ts.map +1 -1
- package/Interactions/error.d.ts +2 -0
- package/Interactions/error.d.ts.map +1 -0
- package/Interactions/error.js +8 -0
- package/Interactions/error.js.map +1 -0
- package/Interactions/webhook.d.ts +9 -4
- package/Interactions/webhook.d.ts.map +1 -1
- package/Interactions/webhook.js +6 -8
- package/Interactions/webhook.js.map +1 -1
- package/gateway.d.ts +2 -2
- package/gateway.d.ts.map +1 -1
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +5 -3
- package/index.js.map +1 -1
- package/mjs/Cache/prelude.mjs +8 -2
- package/mjs/Cache/prelude.mjs.map +1 -1
- package/mjs/Cache.mjs +6 -8
- package/mjs/Cache.mjs.map +1 -1
- package/mjs/DiscordREST.mjs +15 -9
- package/mjs/DiscordREST.mjs.map +1 -1
- package/mjs/Interactions/context.mjs +11 -31
- package/mjs/Interactions/context.mjs.map +1 -1
- package/mjs/Interactions/error.mjs +2 -0
- package/mjs/Interactions/error.mjs.map +1 -0
- package/mjs/Interactions/webhook.mjs +6 -8
- package/mjs/Interactions/webhook.mjs.map +1 -1
- package/mjs/index.mjs +5 -1
- package/mjs/index.mjs.map +1 -1
- package/mjs/version.mjs +1 -1
- package/package.json +2 -2
- package/src/Cache/prelude.ts +6 -2
- package/src/Cache.ts +15 -8
- package/src/DiscordREST.ts +21 -10
- package/src/Interactions/context.ts +24 -45
- package/src/Interactions/definitions.ts +2 -2
- package/src/Interactions/error.ts +3 -0
- package/src/Interactions/webhook.ts +7 -5
- package/src/index.ts +9 -2
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/webhooks.d.ts +1 -1
- package/webhooks.d.ts.map +1 -1
|
@@ -1,34 +1,23 @@
|
|
|
1
|
+
import { TypeIdError } from "@effect/platform/Error";
|
|
2
|
+
import * as IxHelpers from "dfx/Helpers/interactions";
|
|
3
|
+
import { InteractionsErrorTypeId } from "dfx/Interactions/error";
|
|
1
4
|
import { GenericTag } from "effect/Context";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
2
6
|
import * as Option from "effect/Option";
|
|
3
7
|
import * as Arr from "effect/ReadonlyArray";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as IxHelpers from "dfx/Helpers/interactions";
|
|
6
8
|
export const Interaction = /*#__PURE__*/GenericTag("dfx/Interactions/Interaction");
|
|
7
9
|
export const ApplicationCommand = /*#__PURE__*/GenericTag("dfx/Interactions/ApplicationCommand");
|
|
8
10
|
export const MessageComponentData = /*#__PURE__*/GenericTag("dfx/Interactions/MessageComponentData");
|
|
9
11
|
export const ModalSubmitData = /*#__PURE__*/GenericTag("dfx/Interactions/ModalSubmitData");
|
|
10
12
|
export const FocusedOptionContext = /*#__PURE__*/GenericTag("dfx/Interactions/FocusedOptionContext");
|
|
11
13
|
export const SubCommandContext = /*#__PURE__*/GenericTag("dfx/Interactions/SubCommandContext");
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
name;
|
|
15
|
-
_tag = "ResolvedDataNotFound";
|
|
16
|
-
constructor(data, name) {
|
|
17
|
-
this.data = data;
|
|
18
|
-
this.name = name;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export const resolvedValues = f => Effect.flatMap(Interaction, ix => Effect.mapError(IxHelpers.resolveValues(f)(ix), () => new ResolvedDataNotFound(ix)));
|
|
22
|
-
export const resolved = (name, f) => Effect.flatMap(Interaction, ix => Effect.mapError(IxHelpers.resolveOptionValue(name, f)(ix), () => new ResolvedDataNotFound(ix, name)));
|
|
14
|
+
export const resolvedValues = f => Effect.flatMap(Interaction, ix => IxHelpers.resolveValues(f)(ix));
|
|
15
|
+
export const resolved = (name, f) => Effect.flatMap(Interaction, ix => IxHelpers.resolveOptionValue(name, f)(ix));
|
|
23
16
|
export const focusedOptionValue = /*#__PURE__*/Effect.map(FocusedOptionContext, _ => _.focusedOption.value ?? "");
|
|
24
|
-
export class SubCommandNotFound {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.data = data;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export const handleSubCommands = commands => ApplicationCommand.pipe(Effect.flatMap(data => Effect.mapError(Arr.findFirst(IxHelpers.allSubCommands(data), _ => !!commands[_.name]), () => new SubCommandNotFound(data))), Effect.flatMap(command => Effect.provideService(commands[command.name], SubCommandContext, {
|
|
17
|
+
export class SubCommandNotFound extends TypeIdError(InteractionsErrorTypeId, "SubCommandNotFound") {}
|
|
18
|
+
export const handleSubCommands = commands => ApplicationCommand.pipe(Effect.flatMap(data => Effect.mapError(Arr.findFirst(IxHelpers.allSubCommands(data), _ => !!commands[_.name]), () => new SubCommandNotFound({
|
|
19
|
+
data
|
|
20
|
+
}))), Effect.flatMap(command => Effect.provideService(commands[command.name], SubCommandContext, {
|
|
32
21
|
command
|
|
33
22
|
})));
|
|
34
23
|
export const currentSubCommand = /*#__PURE__*/Effect.map(SubCommandContext, _ => _.command);
|
|
@@ -50,14 +39,5 @@ export const optionValue = name => Effect.flatMap(option(name), _ => Option.matc
|
|
|
50
39
|
export const optionValueOptional = name => Effect.map(option(name), Option.flatMapNullable(o => o.value));
|
|
51
40
|
export const modalValues = /*#__PURE__*/Effect.map(ModalSubmitData, IxHelpers.componentsMap);
|
|
52
41
|
export const modalValueOption = name => Effect.map(ModalSubmitData, IxHelpers.componentValue(name));
|
|
53
|
-
export
|
|
54
|
-
data;
|
|
55
|
-
name;
|
|
56
|
-
_tag = "ModalValueNotFound";
|
|
57
|
-
constructor(data, name) {
|
|
58
|
-
this.data = data;
|
|
59
|
-
this.name = name;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export const modalValue = name => Effect.flatMap(ModalSubmitData, data => Effect.mapError(IxHelpers.componentValue(name)(data), () => new ModalValueNotFound(data, name)));
|
|
42
|
+
export const modalValue = name => Effect.flatMap(ModalSubmitData, data => IxHelpers.componentValue(name)(data));
|
|
63
43
|
//# sourceMappingURL=context.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","names":["
|
|
1
|
+
{"version":3,"file":"context.mjs","names":["TypeIdError","IxHelpers","InteractionsErrorTypeId","GenericTag","Effect","Option","Arr","Interaction","ApplicationCommand","MessageComponentData","ModalSubmitData","FocusedOptionContext","SubCommandContext","resolvedValues","f","flatMap","ix","resolveValues","resolved","name","resolveOptionValue","focusedOptionValue","map","_","focusedOption","value","SubCommandNotFound","handleSubCommands","commands","pipe","data","mapError","findFirst","allSubCommands","command","provideService","currentSubCommand","optionsMap","RequiredOptionNotFound","_tag","constructor","option","getOption","optionValue","match","flatMapNullable","a","onNone","fail","onSome","succeed","optionValueOptional","o","modalValues","componentsMap","modalValueOption","componentValue","modalValue"],"sources":["../../src/Interactions/context.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAW,QAAQ,wBAAwB;AACpD,OAAO,KAAKC,SAAS,MAAM,0BAA0B;AACrD,SAASC,uBAAuB,QAAQ,wBAAwB;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OAAO,CAACP,kBAAkB,EAAEsB,IAAI,IACrC1B,MAAM,CAAC4C,IAAI,CAAC,IAAIV,sBAAsB,CAACR,IAAI,EAAEX,IAAI,CAAC,CAAC,CACpD;EACH8B,MAAM,EAAE7C,MAAM,CAAC8C;CAChB,CACF,CACF;AAEH,OAAO,MAAMC,mBAAmB,GAAIhC,IAAY,IAC9Cf,MAAM,CAACkB,GAAG,CACRmB,MAAM,CAACtB,IAAI,CAAC,EACZd,MAAM,CAACwC,eAAe,CAACO,CAAC,IAAIA,CAAC,CAAC3B,KAAK,CAAC,CACrC;AAEH,OAAO,MAAM4B,WAAW,gBAAGjD,MAAM,CAACkB,GAAG,CAACZ,eAAe,EAAET,SAAS,CAACqD,aAAa,CAAC;AAE/E,OAAO,MAAMC,gBAAgB,GAAIpC,IAAY,IAC3Cf,MAAM,CAACkB,GAAG,CAACZ,eAAe,EAAET,SAAS,CAACuD,cAAc,CAACrC,IAAI,CAAC,CAAC;AAE7D,OAAO,MAAMsC,UAAU,GACrBtC,IAAY,IAEZf,MAAM,CAACW,OAAO,CAACL,eAAe,EAAEoB,IAAI,IAAI7B,SAAS,CAACuD,cAAc,CAACrC,IAAI,CAAC,CAACW,IAAI,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","names":["InteractionsErrorTypeId","Symbol","for"],"sources":["../../src/Interactions/error.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,MAAMA,uBAAuB,gBAAGC,MAAM,CAACC,GAAG,CAC/C,oCAAoC,CACrC","ignoreList":[]}
|
|
@@ -8,6 +8,8 @@ import * as Layer from "effect/Layer";
|
|
|
8
8
|
import { handlers } from "dfx/Interactions/handlers";
|
|
9
9
|
import { Interaction } from "dfx/Interactions/index";
|
|
10
10
|
import * as Verify from "discord-verify";
|
|
11
|
+
import { RefailError } from "@effect/platform/Error";
|
|
12
|
+
import { InteractionsErrorTypeId } from "dfx/Interactions/error";
|
|
11
13
|
export class BadWebhookSignature {
|
|
12
14
|
_tag = "BadWebhookSignature";
|
|
13
15
|
}
|
|
@@ -29,20 +31,16 @@ const makeConfig = ({
|
|
|
29
31
|
export const WebhookConfig = /*#__PURE__*/GenericTag("dfx/Interactions/WebhookConfig");
|
|
30
32
|
export const layer = opts => Layer.succeed(WebhookConfig, makeConfig(opts));
|
|
31
33
|
export const layerConfig = config => Layer.effect(WebhookConfig, Effect.map(config, makeConfig));
|
|
32
|
-
export class WebhookParseError {
|
|
33
|
-
reason;
|
|
34
|
-
_tag = "WebhookParseError";
|
|
35
|
-
constructor(reason) {
|
|
36
|
-
this.reason = reason;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
34
|
+
export class WebhookParseError extends RefailError(InteractionsErrorTypeId, "WebhookParseError") {}
|
|
39
35
|
const fromHeadersAndBody = (headers, body) => Effect.tap(WebhookConfig, ({
|
|
40
36
|
algorithm,
|
|
41
37
|
crypto,
|
|
42
38
|
publicKey
|
|
43
39
|
}) => checkSignature(publicKey, headers, body, crypto, algorithm)).pipe(Effect.flatMap(() => Effect.try({
|
|
44
40
|
try: () => JSON.parse(body),
|
|
45
|
-
catch:
|
|
41
|
+
catch: error => new WebhookParseError({
|
|
42
|
+
error
|
|
43
|
+
})
|
|
46
44
|
})));
|
|
47
45
|
const run = (definitions, handleResponse) => {
|
|
48
46
|
const handler = handlers(definitions, handleResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.mjs","names":["Chunk","GenericTag","identity","Option","Secret","Effect","Layer","handlers","Interaction","Verify","BadWebhookSignature","_tag","checkSignature","publicKey","headers","body","crypto","algorithm","all","signature","fromNullable","timestamp","pipe","flatMap","_","promise","verify","filterOrFail","catchAllCause","fail","asUnit","makeConfig","applicationId","value","PlatformAlgorithm","WebhookConfig","layer","opts","succeed","layerConfig","config","effect","map","WebhookParseError","
|
|
1
|
+
{"version":3,"file":"webhook.mjs","names":["Chunk","GenericTag","identity","Option","Secret","Effect","Layer","handlers","Interaction","Verify","RefailError","InteractionsErrorTypeId","BadWebhookSignature","_tag","checkSignature","publicKey","headers","body","crypto","algorithm","all","signature","fromNullable","timestamp","pipe","flatMap","_","promise","verify","filterOrFail","catchAllCause","fail","asUnit","makeConfig","applicationId","value","PlatformAlgorithm","WebhookConfig","layer","opts","succeed","layerConfig","config","effect","map","WebhookParseError","fromHeadersAndBody","tap","try","JSON","parse","catch","error","run","definitions","handleResponse","handler","interaction","provideService","type","makeHandler","ix","handle","d","_i","r","success","makeSimpleHandler"],"sources":["../../src/Interactions/webhook.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,MAAM,MAAM,eAAe;AAIvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAGrC,SAASC,QAAQ,QAAQ,2BAA2B;AAKpD,SAASC,WAAW,QAAQ,wBAAwB;AAEpD,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,uBAAuB,QAAQ,wBAAwB;AAEhE,OAAM,MAAOC,mBAAmB;EACrBC,IAAI,GAAG,qBAAqB;;AAKvC,MAAMC,cAAc,GAAGA,CACrBC,SAAiB,EACjBC,OAAgB,EAChBC,IAAY,EACZC,MAAoB,EACpBC,SAAc,KAEdhB,MAAM,CAACiB,GAAG,CAAC;EACTC,SAAS,EAAElB,MAAM,CAACmB,YAAY,CAACN,OAAO,CAAC,qBAAqB,CAAC,CAAC;EAC9DO,SAAS,EAAEpB,MAAM,CAACmB,YAAY,CAACN,OAAO,CAAC,uBAAuB,CAAC;CAChE,CAAC,CAACQ,IAAI,CACLnB,MAAM,CAACoB,OAAO,CAACC,CAAC,IACdrB,MAA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B;AACL,CAAC;AAED;;;AAGA,OAAO,MAAMe,iBAAiB,GAC5BN,EAAgC,IAW7B;EACH,MAAMC,MAAM,GAAGT,GAAG,CAChBrD,KAAK,CAAC4C,GAAG,CAACiB,EAAE,CAACP,WAAW,EAAE,CAAC,CAACS,CAAC,CAAC,KAAK,CAACA,CAAC,EAAE7D,QAAQ,CAAQ,CAAC,EACxD,CAAC8D,EAAE,EAAEC,CAAC,KAAK5D,MAAM,CAACmC,OAAO,CAACyB,CAAC,CAAC,CAC7B;EAED,OAAO,CAAC;IAAEhD,IAAI;IAAED;EAAO,CAAsC,KAC3D8C,MAAM,CAAC9C,OAAO,EAAEC,IAAI,CAAC;AACzB,CAAC","ignoreList":[]}
|
package/mjs/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Cache from "dfx/Cache";
|
|
2
2
|
import * as DiscordConfig from "dfx/DiscordConfig";
|
|
3
|
+
import { DiscordRESTLive } from "dfx/DiscordREST";
|
|
3
4
|
import * as Flags from "dfx/Helpers/flags";
|
|
4
5
|
import * as Intents from "dfx/Helpers/intents";
|
|
5
6
|
import * as IxHelpers from "dfx/Helpers/interactions";
|
|
@@ -7,8 +8,11 @@ import * as Members from "dfx/Helpers/members";
|
|
|
7
8
|
import * as Perms from "dfx/Helpers/permissions";
|
|
8
9
|
import * as UI from "dfx/Helpers/ui";
|
|
9
10
|
import * as Ix from "dfx/Interactions/index";
|
|
11
|
+
import { MemoryRateLimitStoreLive } from "dfx/RateLimit";
|
|
10
12
|
import * as Discord from "dfx/types";
|
|
13
|
+
import * as Layer from "effect/Layer";
|
|
11
14
|
export { DiscordREST, DiscordRESTLive } from "dfx/DiscordREST";
|
|
12
|
-
export { MemoryRateLimitStoreLive,
|
|
15
|
+
export { MemoryRateLimitStoreLive, RateLimitStore, RateLimiter, RateLimiterLive } from "dfx/RateLimit";
|
|
13
16
|
export { Cache, Discord, DiscordConfig, Flags, Intents, Ix, IxHelpers, Members, Perms, UI };
|
|
17
|
+
export const DiscordRESTMemoryLive = /*#__PURE__*/DiscordRESTLive.pipe( /*#__PURE__*/Layer.provide(MemoryRateLimitStoreLive));
|
|
14
18
|
//# sourceMappingURL=index.mjs.map
|
package/mjs/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Cache","DiscordConfig","Flags","Intents","IxHelpers","Members","Perms","UI","Ix","Discord","DiscordREST","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Cache","DiscordConfig","DiscordRESTLive","Flags","Intents","IxHelpers","Members","Perms","UI","Ix","MemoryRateLimitStoreLive","Discord","Layer","DiscordREST","RateLimitStore","RateLimiter","RateLimiterLive","DiscordRESTMemoryLive","pipe","provide"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,WAAW;AAClC,OAAO,KAAKC,aAAa,MAAM,mBAAmB;AAClD,SAASC,eAAe,QAAQ,iBAAiB;AACjD,OAAO,KAAKC,KAAK,MAAM,mBAAmB;AAC1C,OAAO,KAAKC,OAAO,MAAM,qBAAqB;AAC9C,OAAO,KAAKC,SAAS,MAAM,0BAA0B;AACrD,OAAO,KAAKC,OAAO,MAAM,qBAAqB;AAC9C,OAAO,KAAKC,KAAK,MAAM,yBAAyB;AAChD,OAAO,KAAKC,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,wBAAwB;AAC5C,SAASC,wBAAwB,QAAQ,eAAe;AACxD,OAAO,KAAKC,OAAO,MAAM,WAAW;AACpC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,SAASC,WAAW,EAAEX,eAAe,QAAQ,iBAAiB;AAE9D,SAEEQ,wBAAwB,EACxBI,cAAc,EACdC,WAAW,EACXC,eAAe,QACV,eAAe;AAEtB,SACEhB,KAAK,EACLW,OAAO,EACPV,aAAa,EACbE,KAAK,EACLC,OAAO,EACPK,EAAE,EACFJ,SAAS,EACTC,OAAO,EACPC,KAAK,EACLC,EAAE;AAGJ,OAAO,MAAMS,qBAAqB,gBAAGf,eAAe,CAACgB,IAAI,eACvDN,KAAK,CAACO,OAAO,CAACT,wBAAwB,CAAC,CACxC","ignoreList":[]}
|
package/mjs/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.
|
|
1
|
+
export const LIB_VERSION = "0.91.0";
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"description": "Effect-TS discord library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"utf-8-validate": "^6.0.3",
|
|
45
45
|
"zlib-sync": "^0.1.9"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "2707397ecfb7f30c500cd27abbb45f6d3cac4057",
|
|
48
48
|
"main": "./index.js"
|
|
49
49
|
}
|
package/src/Cache/prelude.ts
CHANGED
|
@@ -238,7 +238,10 @@ export const roles = <RM, EM, E>(
|
|
|
238
238
|
return yield* _(
|
|
239
239
|
makeWithParent({
|
|
240
240
|
driver,
|
|
241
|
-
id: _ =>
|
|
241
|
+
id: _ =>
|
|
242
|
+
Effect.fail(
|
|
243
|
+
new CacheMissError({ cacheName: "RolesCache/id", id: _.id }),
|
|
244
|
+
),
|
|
242
245
|
ops: opsWithParent({
|
|
243
246
|
id: (a: Discord.Role) => a.id,
|
|
244
247
|
fromParent: Stream.map(gateway.fromDispatch("GUILD_CREATE"), g => [
|
|
@@ -262,7 +265,8 @@ export const roles = <RM, EM, E>(
|
|
|
262
265
|
g => g.id,
|
|
263
266
|
),
|
|
264
267
|
}),
|
|
265
|
-
onMiss: (_, id) =>
|
|
268
|
+
onMiss: (_, id) =>
|
|
269
|
+
Effect.fail(new CacheMissError({ cacheName: "RolesCache", id })),
|
|
266
270
|
onParentMiss: guildId =>
|
|
267
271
|
rest
|
|
268
272
|
.getGuildRoles(guildId)
|
package/src/Cache.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { TypeIdError } from "@effect/platform/Error"
|
|
2
|
+
import type { CacheDriver, ParentCacheDriver } from "dfx/Cache/driver"
|
|
3
|
+
import * as Effect from "effect/Effect"
|
|
1
4
|
import * as Option from "effect/Option"
|
|
2
5
|
import * as Schedule from "effect/Schedule"
|
|
3
6
|
import type * as Scope from "effect/Scope"
|
|
4
|
-
import * as Effect from "effect/Effect"
|
|
5
7
|
import * as Stream from "effect/Stream"
|
|
6
|
-
import type { CacheDriver, ParentCacheDriver } from "dfx/Cache/driver"
|
|
7
8
|
|
|
8
9
|
export * from "dfx/Cache/driver"
|
|
9
10
|
export {
|
|
@@ -253,10 +254,16 @@ export const make = <EOps, EDriver, EMiss, A>({
|
|
|
253
254
|
}),
|
|
254
255
|
)
|
|
255
256
|
|
|
256
|
-
export
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
export const CacheErrorTypeId = Symbol.for("dfx/Cache/CacheError")
|
|
258
|
+
|
|
259
|
+
export class CacheMissError extends TypeIdError(
|
|
260
|
+
CacheErrorTypeId,
|
|
261
|
+
"CacheMissError",
|
|
262
|
+
)<{
|
|
263
|
+
cacheName: string
|
|
264
|
+
id: string
|
|
265
|
+
}> {
|
|
266
|
+
get message() {
|
|
267
|
+
return `Cache miss for "${this.cacheName}" with id: ${this.id}`
|
|
268
|
+
}
|
|
262
269
|
}
|
package/src/DiscordREST.ts
CHANGED
|
@@ -21,13 +21,25 @@ import * as Discord from "dfx/types"
|
|
|
21
21
|
import { LIB_VERSION } from "dfx/version"
|
|
22
22
|
import type { Scope } from "effect/Scope"
|
|
23
23
|
import * as Effectable from "effect/Effectable"
|
|
24
|
+
import { TypeIdError } from "@effect/platform/Error"
|
|
24
25
|
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export const DiscordRESTErrorTypeId = Symbol.for(
|
|
27
|
+
"dfx/DiscordREST/DiscordRESTError",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export class DiscordRESTError extends TypeIdError(
|
|
31
|
+
DiscordRESTErrorTypeId,
|
|
32
|
+
"DiscordRESTError",
|
|
33
|
+
)<{
|
|
34
|
+
error: Http.error.HttpClientError
|
|
35
|
+
body?: unknown
|
|
36
|
+
}> {
|
|
37
|
+
get message() {
|
|
38
|
+
const httpMessage = this.error.message
|
|
39
|
+
return this.body !== undefined
|
|
40
|
+
? `${httpMessage}: ${JSON.stringify(this.body)}`
|
|
41
|
+
: httpMessage
|
|
42
|
+
}
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
const make = Effect.gen(function* (_) {
|
|
@@ -146,12 +158,12 @@ const make = Effect.gen(function* (_) {
|
|
|
146
158
|
Http.client.catchAll(error =>
|
|
147
159
|
error.reason === "StatusCode"
|
|
148
160
|
? error.response.json.pipe(
|
|
149
|
-
Effect.mapError(_ => new DiscordRESTError(
|
|
161
|
+
Effect.mapError(_ => new DiscordRESTError({ error })),
|
|
150
162
|
Effect.flatMap(body =>
|
|
151
|
-
Effect.fail(new DiscordRESTError(error, body)),
|
|
163
|
+
Effect.fail(new DiscordRESTError({ error, body })),
|
|
152
164
|
),
|
|
153
165
|
)
|
|
154
|
-
: Effect.fail(new DiscordRESTError(error)),
|
|
166
|
+
: Effect.fail(new DiscordRESTError({ error })),
|
|
155
167
|
),
|
|
156
168
|
)
|
|
157
169
|
|
|
@@ -298,5 +310,4 @@ export const DiscordREST = GenericTag<DiscordREST, DiscordRESTService>(
|
|
|
298
310
|
)
|
|
299
311
|
export const DiscordRESTLive = Layer.effect(DiscordREST, make).pipe(
|
|
300
312
|
Layer.provide(RateLimiterLive),
|
|
301
|
-
Layer.provide(Http.client.layer),
|
|
302
313
|
)
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { TypeIdError } from "@effect/platform/Error"
|
|
2
|
+
import * as IxHelpers from "dfx/Helpers/interactions"
|
|
3
|
+
import { InteractionsErrorTypeId } from "dfx/Interactions/error"
|
|
4
|
+
import type * as Discord from "dfx/types"
|
|
5
|
+
import type { NoSuchElementException } from "effect/Cause"
|
|
1
6
|
import { GenericTag } from "effect/Context"
|
|
7
|
+
import * as Effect from "effect/Effect"
|
|
2
8
|
import type * as HashMap from "effect/HashMap"
|
|
3
9
|
import * as Option from "effect/Option"
|
|
4
10
|
import * as Arr from "effect/ReadonlyArray"
|
|
5
|
-
import * as Effect from "effect/Effect"
|
|
6
|
-
import * as IxHelpers from "dfx/Helpers/interactions"
|
|
7
|
-
import type * as Discord from "dfx/types"
|
|
8
11
|
|
|
9
12
|
export interface DiscordInteraction {
|
|
10
13
|
readonly _: unique symbol
|
|
@@ -59,44 +62,31 @@ export const SubCommandContext = GenericTag<
|
|
|
59
62
|
SubCommandContext
|
|
60
63
|
>("dfx/Interactions/SubCommandContext")
|
|
61
64
|
|
|
62
|
-
export class ResolvedDataNotFound {
|
|
63
|
-
readonly _tag = "ResolvedDataNotFound"
|
|
64
|
-
constructor(
|
|
65
|
-
readonly data: Discord.Interaction,
|
|
66
|
-
readonly name?: string,
|
|
67
|
-
) {}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
65
|
export const resolvedValues = <A>(
|
|
71
66
|
f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => A | undefined,
|
|
72
|
-
): Effect.Effect<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
),
|
|
78
|
-
)
|
|
67
|
+
): Effect.Effect<
|
|
68
|
+
ReadonlyArray<A>,
|
|
69
|
+
NoSuchElementException,
|
|
70
|
+
DiscordInteraction
|
|
71
|
+
> => Effect.flatMap(Interaction, ix => IxHelpers.resolveValues(f)(ix))
|
|
79
72
|
|
|
80
73
|
export const resolved = <A>(
|
|
81
74
|
name: string,
|
|
82
75
|
f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => A | undefined,
|
|
83
|
-
): Effect.Effect<A,
|
|
84
|
-
Effect.flatMap(Interaction, ix =>
|
|
85
|
-
Effect.mapError(
|
|
86
|
-
IxHelpers.resolveOptionValue(name, f)(ix),
|
|
87
|
-
() => new ResolvedDataNotFound(ix, name),
|
|
88
|
-
),
|
|
89
|
-
)
|
|
76
|
+
): Effect.Effect<A, NoSuchElementException, DiscordInteraction> =>
|
|
77
|
+
Effect.flatMap(Interaction, ix => IxHelpers.resolveOptionValue(name, f)(ix))
|
|
90
78
|
|
|
91
79
|
export const focusedOptionValue = Effect.map(
|
|
92
80
|
FocusedOptionContext,
|
|
93
81
|
_ => _.focusedOption.value ?? "",
|
|
94
82
|
)
|
|
95
83
|
|
|
96
|
-
export class SubCommandNotFound
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
export class SubCommandNotFound extends TypeIdError(
|
|
85
|
+
InteractionsErrorTypeId,
|
|
86
|
+
"SubCommandNotFound",
|
|
87
|
+
)<{
|
|
88
|
+
data: Discord.ApplicationCommandDatum
|
|
89
|
+
}> {}
|
|
100
90
|
|
|
101
91
|
export const handleSubCommands = <
|
|
102
92
|
NER extends Record<
|
|
@@ -128,7 +118,7 @@ export const handleSubCommands = <
|
|
|
128
118
|
Effect.flatMap(data =>
|
|
129
119
|
Effect.mapError(
|
|
130
120
|
Arr.findFirst(IxHelpers.allSubCommands(data), _ => !!commands[_.name]),
|
|
131
|
-
() => new SubCommandNotFound(data),
|
|
121
|
+
() => new SubCommandNotFound({ data }),
|
|
132
122
|
),
|
|
133
123
|
),
|
|
134
124
|
Effect.flatMap(command =>
|
|
@@ -188,18 +178,7 @@ export const modalValues = Effect.map(ModalSubmitData, IxHelpers.componentsMap)
|
|
|
188
178
|
export const modalValueOption = (name: string) =>
|
|
189
179
|
Effect.map(ModalSubmitData, IxHelpers.componentValue(name))
|
|
190
180
|
|
|
191
|
-
export
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
readonly name: string,
|
|
196
|
-
) {}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export const modalValue = (name: string) =>
|
|
200
|
-
Effect.flatMap(ModalSubmitData, data =>
|
|
201
|
-
Effect.mapError(
|
|
202
|
-
IxHelpers.componentValue(name)(data),
|
|
203
|
-
() => new ModalValueNotFound(data, name),
|
|
204
|
-
),
|
|
205
|
-
)
|
|
181
|
+
export const modalValue = (
|
|
182
|
+
name: string,
|
|
183
|
+
): Effect.Effect<string, NoSuchElementException, DiscordModalSubmit> =>
|
|
184
|
+
Effect.flatMap(ModalSubmitData, data => IxHelpers.componentValue(name)(data))
|
|
@@ -6,10 +6,10 @@ import type {
|
|
|
6
6
|
DiscordInteraction,
|
|
7
7
|
DiscordMessageComponent,
|
|
8
8
|
DiscordModalSubmit,
|
|
9
|
-
ResolvedDataNotFound,
|
|
10
9
|
SubCommandContext,
|
|
11
10
|
} from "dfx/Interactions/context"
|
|
12
11
|
import type * as Discord from "dfx/types"
|
|
12
|
+
import type { NoSuchElementException } from "effect/Cause"
|
|
13
13
|
|
|
14
14
|
export type InteractionDefinition<R, E> =
|
|
15
15
|
| GlobalApplicationCommand<R, E>
|
|
@@ -143,7 +143,7 @@ export interface CommandHelper<A> {
|
|
|
143
143
|
resolve: <T>(
|
|
144
144
|
name: AllResolvables<A>["name"],
|
|
145
145
|
f: (id: Discord.Snowflake, data: Discord.ResolvedDatum) => T | undefined,
|
|
146
|
-
) => Effect.Effect<T,
|
|
146
|
+
) => Effect.Effect<T, NoSuchElementException, DiscordInteraction>
|
|
147
147
|
|
|
148
148
|
option: (
|
|
149
149
|
name: AllCommandOptions<A>["name"],
|
|
@@ -18,6 +18,8 @@ import type {
|
|
|
18
18
|
import { Interaction } from "dfx/Interactions/index"
|
|
19
19
|
import type * as Discord from "dfx/types"
|
|
20
20
|
import * as Verify from "discord-verify"
|
|
21
|
+
import { RefailError } from "@effect/platform/Error"
|
|
22
|
+
import { InteractionsErrorTypeId } from "dfx/Interactions/error"
|
|
21
23
|
|
|
22
24
|
export class BadWebhookSignature {
|
|
23
25
|
readonly _tag = "BadWebhookSignature"
|
|
@@ -88,10 +90,10 @@ export const layerConfig: (
|
|
|
88
90
|
config: Config.Config<MakeConfigOpts>,
|
|
89
91
|
) => Layer.effect(WebhookConfig, Effect.map(config, makeConfig))
|
|
90
92
|
|
|
91
|
-
export class WebhookParseError
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
93
|
+
export class WebhookParseError extends RefailError(
|
|
94
|
+
InteractionsErrorTypeId,
|
|
95
|
+
"WebhookParseError",
|
|
96
|
+
)<{}> {}
|
|
95
97
|
|
|
96
98
|
const fromHeadersAndBody = (headers: Headers, body: string) =>
|
|
97
99
|
Effect.tap(WebhookConfig, ({ algorithm, crypto, publicKey }) =>
|
|
@@ -100,7 +102,7 @@ const fromHeadersAndBody = (headers: Headers, body: string) =>
|
|
|
100
102
|
Effect.flatMap(() =>
|
|
101
103
|
Effect.try({
|
|
102
104
|
try: () => JSON.parse(body) as Discord.Interaction,
|
|
103
|
-
catch:
|
|
105
|
+
catch: error => new WebhookParseError({ error }),
|
|
104
106
|
}),
|
|
105
107
|
),
|
|
106
108
|
)
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Cache from "dfx/Cache"
|
|
2
2
|
import * as DiscordConfig from "dfx/DiscordConfig"
|
|
3
|
+
import { DiscordRESTLive } from "dfx/DiscordREST"
|
|
3
4
|
import * as Flags from "dfx/Helpers/flags"
|
|
4
5
|
import * as Intents from "dfx/Helpers/intents"
|
|
5
6
|
import * as IxHelpers from "dfx/Helpers/interactions"
|
|
@@ -7,16 +8,18 @@ import * as Members from "dfx/Helpers/members"
|
|
|
7
8
|
import * as Perms from "dfx/Helpers/permissions"
|
|
8
9
|
import * as UI from "dfx/Helpers/ui"
|
|
9
10
|
import * as Ix from "dfx/Interactions/index"
|
|
11
|
+
import { MemoryRateLimitStoreLive } from "dfx/RateLimit"
|
|
10
12
|
import * as Discord from "dfx/types"
|
|
13
|
+
import * as Layer from "effect/Layer"
|
|
11
14
|
|
|
12
15
|
export { DiscordREST, DiscordRESTLive } from "dfx/DiscordREST"
|
|
13
16
|
|
|
14
17
|
export {
|
|
15
18
|
BucketDetails,
|
|
16
19
|
MemoryRateLimitStoreLive,
|
|
17
|
-
RateLimiterLive,
|
|
18
|
-
RateLimiter,
|
|
19
20
|
RateLimitStore,
|
|
21
|
+
RateLimiter,
|
|
22
|
+
RateLimiterLive,
|
|
20
23
|
} from "dfx/RateLimit"
|
|
21
24
|
|
|
22
25
|
export {
|
|
@@ -31,3 +34,7 @@ export {
|
|
|
31
34
|
Perms,
|
|
32
35
|
UI,
|
|
33
36
|
}
|
|
37
|
+
|
|
38
|
+
export const DiscordRESTMemoryLive = DiscordRESTLive.pipe(
|
|
39
|
+
Layer.provide(MemoryRateLimitStoreLive),
|
|
40
|
+
)
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.
|
|
1
|
+
export const LIB_VERSION = "0.91.0";
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "0.
|
|
1
|
+
export declare const LIB_VERSION = "0.91.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/webhooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as Layer from "effect/Layer";
|
|
2
2
|
export { BadWebhookSignature, WebhookConfig, WebhookParseError, makeHandler, makeSimpleHandler, layer as webhookLayer, layerConfig as webhookLayerConfig, } from "dfx/Interactions/webhook";
|
|
3
|
-
export declare const DiscordLive: Layer.Layer<import("dfx/RateLimit").RateLimiter | import("dfx/DiscordREST").DiscordREST, never, import("./DiscordConfig").DiscordConfig>;
|
|
3
|
+
export declare const DiscordLive: Layer.Layer<import("dfx/RateLimit").RateLimiter | import("dfx/DiscordREST").DiscordREST, never, import("./DiscordConfig").DiscordConfig | import("@effect/platform/Http/Client").Client.Default>;
|
|
4
4
|
//# sourceMappingURL=webhooks.d.ts.map
|
package/webhooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["./src/webhooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,IAAI,YAAY,EACrB,WAAW,IAAI,kBAAkB,GAClC,MAAM,0BAA0B,CAAA;AAEjC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["./src/webhooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,IAAI,YAAY,EACrB,WAAW,IAAI,kBAAkB,GAClC,MAAM,0BAA0B,CAAA;AAEjC,eAAO,MAAM,WAAW,kMAGuB,CAAA"}
|