dfx 0.45.6 → 0.45.8
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 +23 -0
- package/Cache/driver.d.ts.map +1 -0
- package/Cache/driver.js +3 -0
- package/Cache/driver.js.map +1 -0
- package/Cache/memory.d.ts +4 -0
- package/Cache/memory.d.ts.map +1 -0
- package/Cache/memory.js +48 -0
- package/Cache/memory.js.map +1 -0
- package/Cache/memoryTTL.d.ts +21 -0
- package/Cache/memoryTTL.d.ts.map +1 -0
- package/Cache/memoryTTL.js +121 -0
- package/Cache/memoryTTL.js.map +1 -0
- package/Cache/prelude.d.ts +57 -0
- package/Cache/prelude.d.ts.map +1 -0
- package/Cache/prelude.js +108 -0
- package/Cache/prelude.js.map +1 -0
- package/Cache.d.ts +76 -0
- package/Cache.d.ts.map +1 -0
- package/Cache.js +62 -0
- package/Cache.js.map +1 -0
- package/DiscordConfig.d.ts +29 -0
- package/DiscordConfig.d.ts.map +1 -0
- package/DiscordConfig.js +29 -0
- package/DiscordConfig.js.map +1 -0
- package/DiscordGateway/DiscordWS.d.ts +32 -0
- package/DiscordGateway/DiscordWS.d.ts.map +1 -0
- package/DiscordGateway/DiscordWS.js +31 -0
- package/DiscordGateway/DiscordWS.js.map +1 -0
- package/DiscordGateway/Shard/heartbeats.d.ts +4 -0
- package/DiscordGateway/Shard/heartbeats.d.ts.map +1 -0
- package/DiscordGateway/Shard/heartbeats.js +17 -0
- package/DiscordGateway/Shard/heartbeats.js.map +1 -0
- package/DiscordGateway/Shard/identify.d.ts +13 -0
- package/DiscordGateway/Shard/identify.d.ts.map +1 -0
- package/DiscordGateway/Shard/identify.js +26 -0
- package/DiscordGateway/Shard/identify.js.map +1 -0
- package/DiscordGateway/Shard/invalidSession.d.ts +4 -0
- package/DiscordGateway/Shard/invalidSession.d.ts.map +1 -0
- package/DiscordGateway/Shard/invalidSession.js +6 -0
- package/DiscordGateway/Shard/invalidSession.js.map +1 -0
- package/DiscordGateway/Shard/sendEvents.d.ts +8 -0
- package/DiscordGateway/Shard/sendEvents.d.ts.map +1 -0
- package/DiscordGateway/Shard/sendEvents.js +25 -0
- package/DiscordGateway/Shard/sendEvents.js.map +1 -0
- package/DiscordGateway/Shard/utils.d.ts +4 -0
- package/DiscordGateway/Shard/utils.d.ts.map +1 -0
- package/DiscordGateway/Shard/utils.js +9 -0
- package/DiscordGateway/Shard/utils.js.map +1 -0
- package/DiscordGateway/Shard.d.ts +17 -0
- package/DiscordGateway/Shard.d.ts.map +1 -0
- package/DiscordGateway/Shard.js +85 -0
- package/DiscordGateway/Shard.js.map +1 -0
- package/DiscordGateway/ShardStore.d.ts +13 -0
- package/DiscordGateway/ShardStore.d.ts.map +1 -0
- package/DiscordGateway/ShardStore.js +22 -0
- package/DiscordGateway/ShardStore.js.map +1 -0
- package/DiscordGateway/Sharder.d.ts +16 -0
- package/DiscordGateway/Sharder.d.ts.map +1 -0
- package/DiscordGateway/Sharder.js +51 -0
- package/DiscordGateway/Sharder.js.map +1 -0
- package/DiscordGateway/WS.d.ts +32 -0
- package/DiscordGateway/WS.d.ts.map +1 -0
- package/DiscordGateway/WS.js +77 -0
- package/DiscordGateway/WS.js.map +1 -0
- package/DiscordGateway.d.ts +13 -0
- package/DiscordGateway.d.ts.map +1 -0
- package/DiscordGateway.js +29 -0
- package/DiscordGateway.js.map +1 -0
- package/DiscordREST/types.d.ts +8 -0
- package/DiscordREST/types.d.ts.map +1 -0
- package/DiscordREST/types.js +2 -0
- package/DiscordREST/types.js.map +1 -0
- package/DiscordREST/utils.d.ts +11 -0
- package/DiscordREST/utils.d.ts.map +1 -0
- package/DiscordREST/utils.js +21 -0
- package/DiscordREST/utils.js.map +1 -0
- package/DiscordREST.d.ts +18 -0
- package/DiscordREST.d.ts.map +1 -0
- package/DiscordREST.js +124 -0
- package/DiscordREST.js.map +1 -0
- package/Helpers/flags.d.ts +28 -0
- package/Helpers/flags.d.ts.map +1 -0
- package/Helpers/flags.js +36 -0
- package/Helpers/flags.js.map +1 -0
- package/Helpers/intents.d.ts +25 -0
- package/Helpers/intents.d.ts.map +1 -0
- package/Helpers/intents.js +29 -0
- package/Helpers/intents.js.map +1 -0
- package/Helpers/interactions.d.ts +97 -0
- package/Helpers/interactions.d.ts.map +1 -0
- package/Helpers/interactions.js +97 -0
- package/Helpers/interactions.js.map +1 -0
- package/Helpers/members.d.ts +10 -0
- package/Helpers/members.d.ts.map +1 -0
- package/Helpers/members.js +10 -0
- package/Helpers/members.js.map +1 -0
- package/Helpers/permissions.d.ts +41 -0
- package/Helpers/permissions.d.ts.map +1 -0
- package/Helpers/permissions.js +83 -0
- package/Helpers/permissions.js.map +1 -0
- package/Helpers/ui.d.ts +48 -0
- package/Helpers/ui.d.ts.map +1 -0
- package/Helpers/ui.js +66 -0
- package/Helpers/ui.js.map +1 -0
- package/Interactions/builder.d.ts +49 -0
- package/Interactions/builder.d.ts.map +1 -0
- package/Interactions/builder.js +68 -0
- package/Interactions/builder.js.map +1 -0
- package/Interactions/context.d.ts +59 -0
- package/Interactions/context.d.ts.map +1 -0
- package/Interactions/context.js +61 -0
- package/Interactions/context.js.map +1 -0
- package/Interactions/definitions.d.ts +127 -0
- package/Interactions/definitions.d.ts.map +1 -0
- package/Interactions/definitions.js +53 -0
- package/Interactions/definitions.js.map +1 -0
- package/Interactions/gateway.d.ts +21 -0
- package/Interactions/gateway.d.ts.map +1 -0
- package/Interactions/gateway.js +39 -0
- package/Interactions/gateway.js.map +1 -0
- package/Interactions/handlers.d.ts +11 -0
- package/Interactions/handlers.d.ts.map +1 -0
- package/Interactions/handlers.js +45 -0
- package/Interactions/handlers.js.map +1 -0
- package/Interactions/index.d.ts +11 -0
- package/Interactions/index.d.ts.map +1 -0
- package/Interactions/index.js +12 -0
- package/Interactions/index.js.map +1 -0
- package/Interactions/utils.d.ts +79 -0
- package/Interactions/utils.d.ts.map +1 -0
- package/Interactions/utils.js +74 -0
- package/Interactions/utils.js.map +1 -0
- package/Interactions/webhook.d.ts +46 -0
- package/Interactions/webhook.d.ts.map +1 -0
- package/Interactions/webhook.js +56 -0
- package/Interactions/webhook.js.map +1 -0
- package/Log.d.ts +11 -0
- package/Log.d.ts.map +1 -0
- package/Log.js +17 -0
- package/Log.js.map +1 -0
- package/RateLimit/memory.d.ts +3 -0
- package/RateLimit/memory.d.ts.map +1 -0
- package/RateLimit/memory.js +35 -0
- package/RateLimit/memory.js.map +1 -0
- package/RateLimit/utils.d.ts +3 -0
- package/RateLimit/utils.d.ts.map +1 -0
- package/RateLimit/utils.js +18 -0
- package/RateLimit/utils.js.map +1 -0
- package/RateLimit.d.ts +26 -0
- package/RateLimit.d.ts.map +1 -0
- package/RateLimit.js +25 -0
- package/RateLimit.js.map +1 -0
- package/_common.d.ts +37 -0
- package/_common.d.ts.map +1 -0
- package/_common.js +8 -0
- package/_common.js.map +1 -0
- package/gateway.d.ts +14 -0
- package/gateway.d.ts.map +1 -0
- package/gateway.js +25 -0
- package/gateway.js.map +1 -0
- package/global.d.ts +18 -0
- package/global.d.ts.map +1 -0
- package/global.js +2 -0
- package/global.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.d.ts.map +1 -0
- package/index.js +14 -0
- package/index.js.map +1 -0
- package/package.json +4 -4
- package/src/DiscordREST.ts +2 -0
- package/src/package.json +4 -4
- package/types.d.ts +4450 -0
- package/types.d.ts.map +1 -0
- package/types.js +1204 -0
- package/types.js.map +1 -0
- package/utils/effect.d.ts +2 -0
- package/utils/effect.d.ts.map +1 -0
- package/utils/effect.js +2 -0
- package/utils/effect.js.map +1 -0
- package/utils/hub.d.ts +12 -0
- package/utils/hub.d.ts.map +1 -0
- package/utils/hub.js +23 -0
- package/utils/hub.js.map +1 -0
- package/utils/tsplus.d.ts +13 -0
- package/utils/tsplus.d.ts.map +1 -0
- package/utils/tsplus.js +2 -0
- package/utils/tsplus.js.map +1 -0
- package/webhooks.d.ts +10 -0
- package/webhooks.d.ts.map +1 -0
- package/webhooks.js +22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tE,IAAI,CAAC,CAAA;IACL,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACnC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACvC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS,EAAE;YACtC,MAAK;SACN;QACD,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;KACxB;IACD,OAAO,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ConfigSecret, Config, Discord, Chunk, Effect, Cause } from "dfx/_common";
|
|
2
|
+
import { DefinitionNotFound } from "./handlers.js";
|
|
3
|
+
import { InteractionBuilder } from "./index.js";
|
|
4
|
+
export declare class BadWebhookSignature {
|
|
5
|
+
readonly _tag = "BadWebhookSignature";
|
|
6
|
+
}
|
|
7
|
+
export type Headers = Record<string, string | string[] | undefined>;
|
|
8
|
+
export interface MakeConfigOpts {
|
|
9
|
+
applicationId: string;
|
|
10
|
+
publicKey: ConfigSecret;
|
|
11
|
+
}
|
|
12
|
+
declare const makeConfig: ({ applicationId, publicKey }: MakeConfigOpts) => {
|
|
13
|
+
applicationId: string;
|
|
14
|
+
publicKey: Uint8Array;
|
|
15
|
+
};
|
|
16
|
+
export interface WebhookConfig extends ReturnType<typeof makeConfig> {
|
|
17
|
+
}
|
|
18
|
+
export declare const WebhookConfig: import("@effect/data/Context").Tag<WebhookConfig, WebhookConfig>;
|
|
19
|
+
export declare const makeConfigLayer: (a_0: MakeConfigOpts) => import("@effect-http/client/_common").Layer<never, never, WebhookConfig>;
|
|
20
|
+
export declare const makeFromConfig: (a: Config<MakeConfigOpts>) => import("@effect-http/client/_common").Layer<never, import("../_common.js").ConfigError, WebhookConfig>;
|
|
21
|
+
export declare class WebhookParseError {
|
|
22
|
+
readonly reason: unknown;
|
|
23
|
+
readonly _tag = "WebhookParseError";
|
|
24
|
+
constructor(reason: unknown);
|
|
25
|
+
}
|
|
26
|
+
export interface HandleWebhookOpts<E> {
|
|
27
|
+
headers: Headers;
|
|
28
|
+
body: string;
|
|
29
|
+
success: (a: Discord.InteractionResponse) => Effect<never, never, void>;
|
|
30
|
+
error: (e: Cause<E>) => Effect<never, never, void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus getter dfx/InteractionBuilder webhookHandler
|
|
34
|
+
* @tsplus location "dfx/Interactions/webhook"
|
|
35
|
+
*/
|
|
36
|
+
export declare const makeHandler: <R, E, TE>(ix: InteractionBuilder<R, E, TE>) => ({ headers, body, success, error, }: HandleWebhookOpts<DefinitionNotFound | BadWebhookSignature | WebhookParseError | E>) => import("@effect/io/Effect").Effect<WebhookConfig, never, void>;
|
|
37
|
+
/**
|
|
38
|
+
* @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
|
|
39
|
+
* @tsplus location "dfx/Interactions/webhook"
|
|
40
|
+
*/
|
|
41
|
+
export declare const makeSimpleHandler: <R, E, TE>(ix: InteractionBuilder<R, E, TE>) => ({ headers, body }: {
|
|
42
|
+
headers: Headers;
|
|
43
|
+
body: string;
|
|
44
|
+
}) => import("@effect/io/Effect").Effect<WebhookConfig, DefinitionNotFound | BadWebhookSignature | WebhookParseError, import("../types.js").InteractionResponse>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=webhook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as tsplus_module_1 from "@effect/data/Option";
|
|
2
|
+
import * as tsplus_module_2 from "@effect/data/Either";
|
|
3
|
+
import * as tsplus_module_3 from "@effect/io/Config/Secret";
|
|
4
|
+
import * as tsplus_module_4 from "dfx/_common";
|
|
5
|
+
import * as tsplus_module_5 from "@effect/io/Layer";
|
|
6
|
+
import * as tsplus_module_6 from "@effect/data/Function";
|
|
7
|
+
import * as tsplus_module_7 from "@effect/io/Effect";
|
|
8
|
+
import * as tsplus_module_8 from "@effect/data/Chunk";
|
|
9
|
+
import Nacl from "tweetnacl";
|
|
10
|
+
import { handlers } from "./handlers.js";
|
|
11
|
+
import { Interaction } from "./index.js";
|
|
12
|
+
import { fromHex } from "./utils.js";
|
|
13
|
+
export class BadWebhookSignature {
|
|
14
|
+
_tag = "BadWebhookSignature";
|
|
15
|
+
}
|
|
16
|
+
const checkSignature = (publicKey, headers, body) => tsplus_module_2.asUnit(tsplus_module_1.toEither(() => new BadWebhookSignature())(tsplus_module_1.filter(a => {
|
|
17
|
+
const enc = new TextEncoder();
|
|
18
|
+
return Nacl.sign.detached.verify(enc.encode(a.timestamp + body), fromHex(`${a.signature}`), publicKey);
|
|
19
|
+
})(tsplus_module_1.struct({
|
|
20
|
+
signature: tsplus_module_1.fromNullable(headers["x-signature-ed25519"]),
|
|
21
|
+
timestamp: tsplus_module_1.fromNullable(headers["x-signature-timestamp"]),
|
|
22
|
+
}))));
|
|
23
|
+
const makeConfig = ({ applicationId, publicKey }) => ({
|
|
24
|
+
applicationId,
|
|
25
|
+
publicKey: fromHex(tsplus_module_3.value(publicKey)),
|
|
26
|
+
});
|
|
27
|
+
export const WebhookConfig = tsplus_module_4.Tag();
|
|
28
|
+
export const makeConfigLayer = tsplus_module_6.flow(makeConfig, _ => tsplus_module_5.succeed(WebhookConfig, _));
|
|
29
|
+
export const makeFromConfig = (a) => tsplus_module_7.toLayer(tsplus_module_7.map(tsplus_module_7.config(a), makeConfig), WebhookConfig);
|
|
30
|
+
export class WebhookParseError {
|
|
31
|
+
reason;
|
|
32
|
+
_tag = "WebhookParseError";
|
|
33
|
+
constructor(reason) {
|
|
34
|
+
this.reason = reason;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const fromHeadersAndBody = (headers, body) => tsplus_module_7.flatMap(WebhookConfig, ({ publicKey }) => tsplus_module_7.flatMap(checkSignature(publicKey, headers, body), () => tsplus_module_7.tryCatch(() => JSON.parse(body), reason => new WebhookParseError(reason))));
|
|
38
|
+
const run = (definitions, handleResponse) => {
|
|
39
|
+
const handler = handlers(definitions, handleResponse);
|
|
40
|
+
return (headers, body) => tsplus_module_7.flatMap(fromHeadersAndBody(headers, body), interaction => tsplus_module_7.provideService(handler[interaction.type](interaction), Interaction, interaction));
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @tsplus getter dfx/InteractionBuilder webhookHandler
|
|
44
|
+
*/
|
|
45
|
+
export const makeHandler = (ix) => {
|
|
46
|
+
const handle = run(tsplus_module_8.map(ix.definitions, ([d]) => [d, tsplus_module_6.identity]), (_i, r) => tsplus_module_7.succeed(r));
|
|
47
|
+
return ({ headers, body, success, error, }) => tsplus_module_7.catchAllCause(tsplus_module_7.flatMap(handle(headers, body), success), error);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
|
|
51
|
+
*/
|
|
52
|
+
export const makeSimpleHandler = (ix) => {
|
|
53
|
+
const handle = run(tsplus_module_8.map(ix.definitions, ([d]) => [d, tsplus_module_6.identity]), (_i, r) => tsplus_module_7.succeed(r));
|
|
54
|
+
return ({ headers, body }) => handle(headers, body);
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../src/Interactions/webhook.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,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AO,EACP,KAAK,GAGN,EAAE,EAAE,CAAC,8BAAA,wBAAA,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,EAAS,OAAO,CAAC,EAAe,KAAK,CAAC,CAAA;AACnE,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,EAAgC,EAChC,EAAE;IACF,MAAM,MAAM,GAAG,GAAG,CAChB,oBAAA,EAAE,CAAC,WAAW,EAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAE,QAAQ,CAAQ,CAAC,EACjD,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,wBAAe,CAAC,CAAC,CAC7B,CAAA;IAED,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAsC,EAAE,EAAE,CAC/D,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACzB,CAAC,CAAA"}
|
package/Log.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const make: (debug?: boolean) => {
|
|
2
|
+
info: (...args: any[]) => import("@effect/io/Effect").Effect<never, never, void>;
|
|
3
|
+
debug: (...args: any[]) => import("@effect/io/Effect").Effect<never, never, void>;
|
|
4
|
+
};
|
|
5
|
+
export interface Log extends ReturnType<typeof make> {
|
|
6
|
+
}
|
|
7
|
+
export declare const Log: import("@effect/data/Context").Tag<Log, Log>;
|
|
8
|
+
export declare const LiveLog: import("@effect-http/client/_common").Layer<never, never, Log>;
|
|
9
|
+
export declare const LiveLogDebug: import("@effect-http/client/_common").Layer<never, never, Log>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=Log.d.ts.map
|
package/Log.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Log.d.ts","sourceRoot":"","sources":["src/Log.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI;oBACQ,GAAG,EAAE;qBAIJ,GAAG,EAAE;CAMtB,CAAA;AAEF,MAAM,WAAW,GAAI,SAAQ,UAAU,CAAC,OAAO,IAAI,CAAC;CAAG;AACvD,eAAO,MAAM,GAAG,8CAAa,CAAA;AAC7B,eAAO,MAAM,OAAO,gEAAkC,CAAA;AACtD,eAAO,MAAM,YAAY,gEAAiC,CAAA"}
|
package/Log.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as tsplus_module_1 from "@effect/io/Effect";
|
|
2
|
+
import * as tsplus_module_2 from "dfx/_common";
|
|
3
|
+
import * as tsplus_module_3 from "@effect/io/Layer";
|
|
4
|
+
const make = (debug = false) => ({
|
|
5
|
+
info: (...args) => tsplus_module_1.sync(() => {
|
|
6
|
+
console.error("INFO", ...args);
|
|
7
|
+
}),
|
|
8
|
+
debug: (...args) => debug
|
|
9
|
+
? tsplus_module_1.sync(() => {
|
|
10
|
+
console.error("DEBUG", ...args);
|
|
11
|
+
})
|
|
12
|
+
: tsplus_module_1.unit(),
|
|
13
|
+
});
|
|
14
|
+
export const Log = tsplus_module_2.Tag();
|
|
15
|
+
export const LiveLog = tsplus_module_3.succeed(Log, make(false));
|
|
16
|
+
export const LiveLogDebug = tsplus_module_3.succeed(Log, make(true));
|
|
17
|
+
//# sourceMappingURL=Log.js.map
|
package/Log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Log.js","sourceRoot":"","sources":["src/Log.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,CAAC,KAAK,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CACvB,qBAAY,GAAG,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAA;IAChC,CAAC,CAAC;IACJ,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CACxB,KAAK;QACH,CAAC,CAAC,qBAAY,GAAG,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAA;QACjC,CAAC,CAAC;QACJ,CAAC,CAAC,sBAAa;CACpB,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAA,GAAG,EAAO,CAAA;AAC7B,MAAM,CAAC,MAAM,OAAO,GAAG,wBAAc,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAc,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/RateLimit/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAO/D,eAAO,MAAM,IAAI,QAAO,cAiDvB,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as tsplus_module_1 from "@effect/data/Option";
|
|
2
|
+
import * as tsplus_module_2 from "@effect/io/Effect";
|
|
3
|
+
export const make = () => {
|
|
4
|
+
const buckets = new Map();
|
|
5
|
+
const routes = new Map();
|
|
6
|
+
const counters = new Map();
|
|
7
|
+
const getCounter = (key) => tsplus_module_1.filter(c => c.expires > Date.now())(tsplus_module_1.fromNullable(counters.get(key)));
|
|
8
|
+
const getBucketForRoute = (route) => tsplus_module_2.sync(() => tsplus_module_1.fromNullable(buckets.get(routes.get(route))));
|
|
9
|
+
return {
|
|
10
|
+
hasBucket: key => tsplus_module_2.sync(() => buckets.has(key)),
|
|
11
|
+
putBucket: bucket => tsplus_module_2.sync(() => {
|
|
12
|
+
buckets.set(bucket.key, bucket);
|
|
13
|
+
}),
|
|
14
|
+
getBucketForRoute,
|
|
15
|
+
putBucketRoute: (route, bucket) => tsplus_module_2.sync(() => {
|
|
16
|
+
routes.set(route, bucket);
|
|
17
|
+
}),
|
|
18
|
+
removeCounter: key => tsplus_module_2.sync(() => {
|
|
19
|
+
counters.delete(key);
|
|
20
|
+
}),
|
|
21
|
+
incrementCounter: (key, window, limit) => tsplus_module_2.sync(() => {
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
const perRequest = Math.ceil(window / limit);
|
|
24
|
+
const counter = tsplus_module_1.getOrElse(getCounter(key), () => ({
|
|
25
|
+
expires: now,
|
|
26
|
+
count: 0,
|
|
27
|
+
}));
|
|
28
|
+
const count = counter.count + 1;
|
|
29
|
+
const expires = counter.expires + perRequest;
|
|
30
|
+
counters.set(key, { ...counter, count, expires });
|
|
31
|
+
return [count, expires - now];
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/RateLimit/memory.ts"],"names":[],"mappings":";;AAOA,MAAM,CAAC,MAAM,IAAI,GAAG,GAAmB,EAAE;IACvC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAA;IAChD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IACxC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAA;IAE3C,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CACjC,uBAA6C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,EAAxE,6BAAmB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAoC,CAAA;IAE3E,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE,CAC1C,qBAAY,GAAG,EAAE,CAAC,6BAAmB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,CAAA;IAExE,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,qBAAY,GAAG,EAAE,CAAC,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1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/RateLimit/utils.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,SAAS,WACZ,MAAM,SACP,MAAM,SACN,MAAM,OACR,MAAM,KACV,QAmBF,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { millis, zero } from "@effect/data/Duration";
|
|
2
|
+
export const delayFrom = (window, limit, count, ttl) => {
|
|
3
|
+
const perRequest = Math.ceil(window / limit);
|
|
4
|
+
const totalTime = count * perRequest;
|
|
5
|
+
const elapsedTime = totalTime - ttl;
|
|
6
|
+
const elapsedWindows = Math.floor(elapsedTime / window);
|
|
7
|
+
const completedRequests = elapsedWindows * limit;
|
|
8
|
+
const remainingRequests = count - completedRequests;
|
|
9
|
+
const remainingWindows = Math.floor((remainingRequests - 1) / limit);
|
|
10
|
+
const delayRemainder = elapsedTime % window;
|
|
11
|
+
const requestRemainder = count % limit;
|
|
12
|
+
const staggerDelay = requestRemainder * 50;
|
|
13
|
+
if (remainingWindows === 0) {
|
|
14
|
+
return zero;
|
|
15
|
+
}
|
|
16
|
+
return millis(remainingWindows * window - delayRemainder + staggerDelay);
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/RateLimit/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAc,EACd,KAAa,EACb,KAAa,EACb,GAAW,EACD,EAAE;IACZ,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;IAE5C,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,CAAA;IACpC,MAAM,WAAW,GAAG,SAAS,GAAG,GAAG,CAAA;IACnC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,CAAA;IACvD,MAAM,iBAAiB,GAAG,cAAc,GAAG,KAAK,CAAA;IAChD,MAAM,iBAAiB,GAAG,KAAK,GAAG,iBAAiB,CAAA;IACnD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAA;IACpE,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,CAAA;IAE3C,MAAM,gBAAgB,GAAG,KAAK,GAAG,KAAK,CAAA;IACtC,MAAM,YAAY,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAE1C,IAAI,gBAAgB,KAAK,CAAC,EAAE;QAC1B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,MAAM,CAAC,gBAAgB,GAAG,MAAM,GAAG,cAAc,GAAG,YAAY,CAAC,CAAA;AAC1E,CAAC,CAAA"}
|
package/RateLimit.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Effect, Maybe, Duration } from "dfx/_common";
|
|
2
|
+
import { Log } from "dfx/Log";
|
|
3
|
+
export type BucketDetails = {
|
|
4
|
+
key: "global" | string;
|
|
5
|
+
resetAfter: number;
|
|
6
|
+
limit: number;
|
|
7
|
+
};
|
|
8
|
+
export interface RateLimitStore {
|
|
9
|
+
hasBucket: (bucketKey: string) => Effect<never, never, boolean>;
|
|
10
|
+
putBucket: (bucket: BucketDetails) => Effect<never, never, void>;
|
|
11
|
+
getBucketForRoute: (route: string) => Effect<never, never, Maybe<BucketDetails>>;
|
|
12
|
+
putBucketRoute: (route: string, bucketKey: string) => Effect<never, never, void>;
|
|
13
|
+
incrementCounter: (key: string, window: number, limit: number) => Effect<never, never, readonly [count: number, ttl: number]>;
|
|
14
|
+
removeCounter: (key: string) => Effect<never, never, void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const RateLimitStore: import("@effect/data/Context").Tag<RateLimitStore, RateLimitStore>;
|
|
17
|
+
export declare const LiveMemoryRateLimitStore: import("@effect-http/client/_common").Layer<never, never, RateLimitStore>;
|
|
18
|
+
declare const makeLimiter: import("@effect/io/Effect").Effect<Log | RateLimitStore, never, {
|
|
19
|
+
maybeWait: (key: string, window: Duration, limit: number, multiplier?: number) => import("@effect/io/Effect").Effect<never, never, void>;
|
|
20
|
+
}>;
|
|
21
|
+
export interface RateLimiter extends Effect.Success<typeof makeLimiter> {
|
|
22
|
+
}
|
|
23
|
+
export declare const RateLimiter: import("@effect/data/Context").Tag<RateLimiter, RateLimiter>;
|
|
24
|
+
export declare const LiveRateLimiter: import("@effect-http/client/_common").Layer<Log | RateLimitStore, never, RateLimiter>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=RateLimit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimit.d.ts","sourceRoot":"","sources":["src/RateLimit.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAE7B,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IAE/D,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IAEhE,iBAAiB,EAAE,CACjB,KAAK,EAAE,MAAM,KACV,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;IAE/C,cAAc,EAAE,CACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KACd,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IAE/B,gBAAgB,EAAE,CAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,KACV,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;IAEhE,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;CAC3D;AAED,eAAO,MAAM,cAAc,oEAAwB,CAAA;AACnD,eAAO,MAAM,wBAAwB,2EAA0C,CAAA;AAE/E,QAAA,MAAM,WAAW;qBAKR,MAAM,UACH,QAAQ,SACT,MAAM;EAqBf,CAAA;AAEF,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC;CAAG;AAC1E,eAAO,MAAM,WAAW,8DAAqB,CAAA;AAC7C,eAAO,MAAM,eAAe,uFAAyC,CAAA"}
|
package/RateLimit.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as tsplus_module_1 from "dfx/_common";
|
|
2
|
+
import * as tsplus_module_2 from "@effect/io/Layer";
|
|
3
|
+
import * as tsplus_module_3 from "@effect/io/Effect";
|
|
4
|
+
import { delayFrom } from "./RateLimit/utils.js";
|
|
5
|
+
import * as Memory from "./RateLimit/memory.js";
|
|
6
|
+
import { Log } from "dfx/Log";
|
|
7
|
+
export const RateLimitStore = tsplus_module_1.Tag();
|
|
8
|
+
export const LiveMemoryRateLimitStore = tsplus_module_2.sync(RateLimitStore, Memory.make);
|
|
9
|
+
const makeLimiter = tsplus_module_3.flatMap(RateLimitStore, store => tsplus_module_3.map(Log, log => {
|
|
10
|
+
const maybeWait = (key, window, limit, multiplier = 1.05) => {
|
|
11
|
+
const windowMs = window.millis * multiplier;
|
|
12
|
+
return tsplus_module_3.asUnit(tsplus_module_3.tap(tsplus_module_3.tap(tsplus_module_3.map(store
|
|
13
|
+
.incrementCounter(key, windowMs, limit), ([count, ttl]) => delayFrom(windowMs, limit, count, ttl)), d => log.debug("RateLimitStore maybeWait", {
|
|
14
|
+
key,
|
|
15
|
+
window: window.millis,
|
|
16
|
+
windowMs,
|
|
17
|
+
limit,
|
|
18
|
+
delay: d.millis,
|
|
19
|
+
})), _ => (_.millis === 0 ? tsplus_module_3.unit() : tsplus_module_3.sleep(_))));
|
|
20
|
+
};
|
|
21
|
+
return { maybeWait };
|
|
22
|
+
}));
|
|
23
|
+
export const RateLimiter = tsplus_module_1.Tag();
|
|
24
|
+
export const LiveRateLimiter = tsplus_module_2.effect(RateLimiter, makeLimiter);
|
|
25
|
+
//# sourceMappingURL=RateLimit.js.map
|
package/RateLimit.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimit.js","sourceRoot":"","sources":["src/RateLimit.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AA+B7B,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAA,GAAG,EAAkB,CAAA;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAW,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;AAE/E,MAAM,WAAW,2BACC,cAAc,EAAxB,KAAK,wBACG,GAAG,EAAX,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,oBAAA,oBAAA,oBAAA,KAAK;aACT,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,EAClC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EACzD,CAAC,CAAC,EAAE,CACP,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,CACH,EACI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAa,CAAC,CAAC,CAAC,sBAAa,CAAC,CAAC,CAAC,CAAC,EAAO;IACxE,CAAC,CAAA;IAED,OAAO,EAAE,SAAS,EAAE,CAAA;GACpB,CAAA;AAGF,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAA,GAAG,EAAe,CAAA;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAa,WAAW,EAAE,WAAW,CAAC,CAAA"}
|
package/_common.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Effect } from "dfx/_common";
|
|
2
|
+
import type { Schedule as _Schedule } from "@effect/io/Schedule";
|
|
3
|
+
import * as Deferred from "@effect/io/Deferred";
|
|
4
|
+
export type { Cause } from "@effect/io/Cause";
|
|
5
|
+
export type { Config } from "@effect/io/Config";
|
|
6
|
+
export type { ConfigSecret } from "@effect/io/Config/Secret";
|
|
7
|
+
export type { ConfigError } from "@effect/io/Config/Error";
|
|
8
|
+
export type { Deferred } from "@effect/io/Deferred";
|
|
9
|
+
export type { Effect } from "@effect/io/Effect";
|
|
10
|
+
export type { Exit } from "@effect/io/Exit";
|
|
11
|
+
export type { RuntimeFiber } from "@effect/io/Fiber";
|
|
12
|
+
export type { Hub } from "@effect/io/Hub";
|
|
13
|
+
export type { Layer } from "@effect/io/Layer";
|
|
14
|
+
export type { Dequeue, Enqueue, Queue } from "@effect/io/Queue";
|
|
15
|
+
export type { Ref } from "@effect/io/Ref";
|
|
16
|
+
export type { Scope } from "@effect/io/Scope";
|
|
17
|
+
export type { Stream } from "@effect/stream/Stream";
|
|
18
|
+
export type { Chunk } from "@effect/data/Chunk";
|
|
19
|
+
export { Context, Tag } from "@effect/data/Context";
|
|
20
|
+
export type { Duration } from "@effect/data/Duration";
|
|
21
|
+
export type { Equal } from "@effect/data/Equal";
|
|
22
|
+
export type { HashMap } from "@effect/data/HashMap";
|
|
23
|
+
export type { HashSet } from "@effect/data/HashSet";
|
|
24
|
+
export type { Option as Maybe } from "@effect/data/Option";
|
|
25
|
+
export type { Either } from "@effect/data/Either";
|
|
26
|
+
export * as Discord from "./types.js";
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus type effect/io/Schedule
|
|
29
|
+
* @tsplus companion effect/io/Schedule.Ops
|
|
30
|
+
*/
|
|
31
|
+
export type Schedule<Env, In, Out> = _Schedule<Env, In, Out>;
|
|
32
|
+
/**
|
|
33
|
+
* @tsplus getter effect/io/Deferred await
|
|
34
|
+
* @tsplus location "dfx/_common"
|
|
35
|
+
*/
|
|
36
|
+
export declare const deferredAwait: <E, A>(self: Deferred.Deferred<E, A>) => Effect<never, E, A>;
|
|
37
|
+
//# sourceMappingURL=_common.d.ts.map
|
package/_common.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common.d.ts","sourceRoot":"","sources":["src/_common.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAE/C,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,YAAY,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CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,KAC1B,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAkB,CAAA"}
|
package/_common.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Deferred from "@effect/io/Deferred";
|
|
2
|
+
export { Tag } from "@effect/data/Context";
|
|
3
|
+
export * as Discord from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* @tsplus getter effect/io/Deferred await
|
|
6
|
+
*/
|
|
7
|
+
export const deferredAwait = Deferred.await;
|
|
8
|
+
//# sourceMappingURL=_common.js.map
|
package/_common.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common.js","sourceRoot":"","sources":["src/_common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAmB/C,OAAO,EAAW,GAAG,EAAE,MAAM,sBAAsB,CAAA;AASnD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAQrC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAEC,QAAQ,CAAC,KAAK,CAAA"}
|
package/gateway.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Config } from "dfx/_common";
|
|
2
|
+
import { DiscordConfig, Log } from "dfx";
|
|
3
|
+
export * as CachePrelude from "./Cache/prelude.js";
|
|
4
|
+
export { DiscordGateway, LiveDiscordGateway } from "./DiscordGateway.js";
|
|
5
|
+
export * as DiscordWS from "./DiscordGateway/DiscordWS.js";
|
|
6
|
+
export * as Shard from "./DiscordGateway/Shard.js";
|
|
7
|
+
export * as ShardStore from "./DiscordGateway/ShardStore.js";
|
|
8
|
+
export * as WS from "./DiscordGateway/WS.js";
|
|
9
|
+
export { InteractionsRegistry, InteractionsRegistryLive, run as runIx, } from "./Interactions/gateway.js";
|
|
10
|
+
export declare const MemoryRateLimit: import("@effect-http/client/_common").Layer<Log.Log, never, import("dfx").RateLimiter>;
|
|
11
|
+
export declare const MemoryBot: import("@effect-http/client/_common").Layer<DiscordConfig.DiscordConfig | Log.Log | import("@effect-http/client").HttpRequestExecutor, never, import("dfx").DiscordREST | import("dfx").RateLimiter | import("./DiscordGateway.js").DiscordGateway>;
|
|
12
|
+
export declare const makeLiveWithoutFetch: (config: Config.Wrap<DiscordConfig.MakeOpts>) => import("@effect-http/client/_common").Layer<import("@effect-http/client").HttpRequestExecutor, import("./_common.js").ConfigError, import("dfx").DiscordREST | DiscordConfig.DiscordConfig | Log.Log | import("dfx").RateLimiter | import("./DiscordGateway.js").DiscordGateway>;
|
|
13
|
+
export declare const makeLive: (config: Config.Wrap<DiscordConfig.MakeOpts>) => import("@effect-http/client/_common").Layer<never, import("./_common.js").ConfigError, import("dfx").DiscordREST | DiscordConfig.DiscordConfig | Log.Log | import("dfx").RateLimiter | import("./DiscordGateway.js").DiscordGateway>;
|
|
14
|
+
//# sourceMappingURL=gateway.d.ts.map
|
package/gateway.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["src/gateway.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAmB,GAAG,EAAE,MAAM,KAAK,CAAA;AAMzD,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAA;AAClD,OAAO,KAAK,UAAU,MAAM,gCAAgC,CAAA;AAC5D,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,GAAG,IAAI,KAAK,GACb,MAAM,2BAA2B,CAAA;AAElC,eAAO,MAAM,eAAe,wFAA8C,CAAA;AAE1E,eAAO,MAAM,SAAS,qPAEsC,CAAA;AAE5D,eAAO,MAAM,oBAAoB,WACvB,OAAO,IAAI,CAAC,cAAc,QAAQ,CAAC,qRAU1C,CAAA;AAEH,eAAO,MAAM,QAAQ,WAAY,OAAO,IAAI,CAAC,cAAc,QAAQ,CAAC,yOACV,CAAA"}
|
package/gateway.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as tsplus_module_1 from "@effect/io/Layer";
|
|
2
|
+
import * as tsplus_module_2 from "@effect/io/Config";
|
|
3
|
+
import * as tsplus_module_3 from "@effect/io/Effect";
|
|
4
|
+
import { LiveFetchRequestExecutor } from "@effect-http/client";
|
|
5
|
+
import { DiscordConfig, LiveDiscordREST, Log } from "dfx";
|
|
6
|
+
import { LiveDiscordGateway } from "./DiscordGateway.js";
|
|
7
|
+
import { LiveJsonDiscordWSCodec } from "./DiscordGateway/DiscordWS.js";
|
|
8
|
+
import { LiveMemoryShardStore } from "./DiscordGateway/ShardStore.js";
|
|
9
|
+
import { LiveMemoryRateLimitStore, LiveRateLimiter } from "./RateLimit.js";
|
|
10
|
+
export * as CachePrelude from "./Cache/prelude.js";
|
|
11
|
+
export { DiscordGateway, LiveDiscordGateway } from "./DiscordGateway.js";
|
|
12
|
+
export * as DiscordWS from "./DiscordGateway/DiscordWS.js";
|
|
13
|
+
export * as Shard from "./DiscordGateway/Shard.js";
|
|
14
|
+
export * as ShardStore from "./DiscordGateway/ShardStore.js";
|
|
15
|
+
export * as WS from "./DiscordGateway/WS.js";
|
|
16
|
+
export { InteractionsRegistry, InteractionsRegistryLive, run as runIx, } from "./Interactions/gateway.js";
|
|
17
|
+
export const MemoryRateLimit = tsplus_module_1.provide(LiveRateLimiter)(LiveMemoryRateLimitStore);
|
|
18
|
+
export const MemoryBot = tsplus_module_1.provide((tsplus_module_1.merge(MemoryRateLimit)((tsplus_module_1.provideMerge(LiveDiscordGateway)(LiveDiscordREST)))))((tsplus_module_1.merge(LiveJsonDiscordWSCodec)(tsplus_module_1.merge(LiveMemoryRateLimitStore)(LiveMemoryShardStore))));
|
|
19
|
+
export const makeLiveWithoutFetch = (config) => tsplus_module_1.unwrapEffect(tsplus_module_3.map(tsplus_module_3.map(tsplus_module_3.config(tsplus_module_2.unwrap(config)), DiscordConfig.make), config => {
|
|
20
|
+
const LiveLog = config.debug ? Log.LiveLogDebug : Log.LiveLog;
|
|
21
|
+
const LiveConfig = tsplus_module_1.succeed(DiscordConfig.DiscordConfig, config);
|
|
22
|
+
return tsplus_module_1.provideMerge(MemoryBot)(tsplus_module_1.merge(LiveConfig)(LiveLog));
|
|
23
|
+
}));
|
|
24
|
+
export const makeLive = (config) => tsplus_module_1.provide(makeLiveWithoutFetch(config))(LiveFetchRequestExecutor);
|
|
25
|
+
//# sourceMappingURL=gateway.js.map
|
package/gateway.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["src/gateway.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE1E,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAA;AAClD,OAAO,KAAK,UAAU,MAAM,gCAAgC,CAAA;AAC5D,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC5C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,GAAG,IAAI,KAAK,GACb,MAAM,2BAA2B,CAAA;AAElC,MAAM,CAAC,MAAM,eAAe,2BAA+B,eAAe,EAA3C,wBAAwB,CAAmB,CAAA;AAE1E,MAAM,CAAC,MAAM,SAAS,2BAEpB,uBAA0C,eAAe,EAAxD,8BAAmB,kBAAkB,EAApC,eAAe,EAAsB,EAAmB,EAD1D,uBAAmD,sBAAsB,wBAAjD,wBAAwB,EAA/C,oBAAoB,GAAqD,CAChB,CAAA;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,MAA2C,EAC3C,EAAE,CACF,6BACE,oBAAA,2CAAA,uBAAc,MAAM,CAAC,GACP,aAAa,CAAC,IAAI,CAAC,EAC1B,MAAM,CAAC,EAAE;IACZ,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAA;IAC7D,MAAM,UAAU,GAAG,wBAAc,aAAa,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;IACrE,oCAA8B,SAAS,wBAAtB,UAAU,EAApB,OAAO,GAAyB;AACzC,CAAC,CAAC,CACL,CAAA;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAA2C,EAAE,EAAE,yBAC1C,oBAAoB,CAAC,MAAM,CAAC,EAAxD,wBAAwB,CAAgC,CAAA"}
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tsplus global
|
|
3
|
+
*/
|
|
4
|
+
import type { Cause, Config, ConfigSecret, ConfigError, Deferred, Effect, Exit, Hub, Layer, RuntimeFiber, Dequeue, Enqueue, Queue, Schedule, Scope, Stream, Chunk, Context, Duration, Equal, Either, HashMap, Maybe, Ref, HashSet, } from "dfx/_common";
|
|
5
|
+
/**
|
|
6
|
+
* @tsplus global
|
|
7
|
+
*/
|
|
8
|
+
import { Tag, Discord } from "dfx/_common";
|
|
9
|
+
/**
|
|
10
|
+
* @tsplus global
|
|
11
|
+
*/
|
|
12
|
+
import { pipe, flow, identity } from "@effect/data/Function";
|
|
13
|
+
/**
|
|
14
|
+
* @tsplus global
|
|
15
|
+
*/
|
|
16
|
+
import type { LazyArg } from "@effect/data/Function";
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=global.d.ts.map
|
package/global.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["src/global.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACN,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,GAAG,EACH,KAAK,EACL,YAAY,EACZ,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,GAAG,EACH,OAAO,GACR,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE5D;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA"}
|
package/global.js
ADDED
package/global.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["src/global.ts"],"names":[],"mappings":""}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * as Discord from "./types.js";
|
|
2
|
+
export * as DiscordConfig from "./DiscordConfig.js";
|
|
3
|
+
export { DiscordREST, LiveDiscordREST } from "./DiscordREST.js";
|
|
4
|
+
export * as Ix from "./Interactions/index.js";
|
|
5
|
+
export * as Log from "./Log.js";
|
|
6
|
+
export { BucketDetails, RateLimitStore, LiveMemoryRateLimitStore, RateLimiter, LiveRateLimiter, } from "./RateLimit.js";
|
|
7
|
+
export * as Cache from "./Cache.js";
|
|
8
|
+
export * as Flags from "./Helpers/flags.js";
|
|
9
|
+
export * as Intents from "./Helpers/intents.js";
|
|
10
|
+
export * as IxHelpers from "./Helpers/interactions.js";
|
|
11
|
+
export * as Members from "./Helpers/members.js";
|
|
12
|
+
export * as Perms from "./Helpers/permissions.js";
|
|
13
|
+
export * as UI from "./Helpers/ui.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,EACL,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * as Discord from "./types.js";
|
|
2
|
+
export * as DiscordConfig from "./DiscordConfig.js";
|
|
3
|
+
export { DiscordREST, LiveDiscordREST } from "./DiscordREST.js";
|
|
4
|
+
export * as Ix from "./Interactions/index.js";
|
|
5
|
+
export * as Log from "./Log.js";
|
|
6
|
+
export { RateLimitStore, LiveMemoryRateLimitStore, RateLimiter, LiveRateLimiter, } from "./RateLimit.js";
|
|
7
|
+
export * as Cache from "./Cache.js";
|
|
8
|
+
export * as Flags from "./Helpers/flags.js";
|
|
9
|
+
export * as Intents from "./Helpers/intents.js";
|
|
10
|
+
export * as IxHelpers from "./Helpers/interactions.js";
|
|
11
|
+
export * as Members from "./Helpers/members.js";
|
|
12
|
+
export * as Perms from "./Helpers/permissions.js";
|
|
13
|
+
export * as UI from "./Helpers/ui.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC7C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,EAEL,cAAc,EACd,wBAAwB,EACxB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"typescript": "https://cdn.jsdelivr.net/npm/@tsplus/installer@0.0.171/compiler/typescript.tgz"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@effect-http/client": "^0.
|
|
38
|
+
"@effect-http/client": "^0.26.0",
|
|
39
39
|
"@effect/data": "^0.12.2",
|
|
40
|
-
"@effect/io": "~0.25.
|
|
40
|
+
"@effect/io": "~0.25.12",
|
|
41
41
|
"@effect/stream": "~0.21.1",
|
|
42
42
|
"tweetnacl": "^1.0.3"
|
|
43
43
|
},
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"ws": "^8.13.0"
|
|
49
49
|
},
|
|
50
50
|
"sideEffects": false,
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b43a004b6c2657dfd463826fe4d8c61f5ed127fd"
|
|
52
52
|
}
|
package/src/DiscordREST.ts
CHANGED
package/src/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dfx",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"typescript": "https://cdn.jsdelivr.net/npm/@tsplus/installer@0.0.171/compiler/typescript.tgz"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@effect-http/client": "^0.
|
|
38
|
+
"@effect-http/client": "^0.26.0",
|
|
39
39
|
"@effect/data": "^0.12.2",
|
|
40
|
-
"@effect/io": "~0.25.
|
|
40
|
+
"@effect/io": "~0.25.12",
|
|
41
41
|
"@effect/stream": "~0.21.1",
|
|
42
42
|
"tweetnacl": "^1.0.3"
|
|
43
43
|
},
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"ws": "^8.13.0"
|
|
49
49
|
},
|
|
50
50
|
"sideEffects": false,
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b43a004b6c2657dfd463826fe4d8c61f5ed127fd"
|
|
52
52
|
}
|