dfx 0.20.1 → 0.20.3

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.
Files changed (61) hide show
  1. package/Cache/driver.d.ts +1 -2
  2. package/Cache/index.d.ts +19 -20
  3. package/Cache/memory.d.ts +3 -3
  4. package/Cache/memoryTTL.d.ts +3 -5
  5. package/Cache/prelude.d.ts +1 -1
  6. package/DiscordConfig/index.d.ts +6 -6
  7. package/DiscordConfig/index.js +6 -7
  8. package/DiscordConfig/index.js.map +1 -1
  9. package/DiscordGateway/DiscordWS/index.d.ts +5 -6
  10. package/DiscordGateway/DiscordWS/index.js +1 -1
  11. package/DiscordGateway/Shard/heartbeats.d.ts +2 -4
  12. package/DiscordGateway/Shard/identify.d.ts +2 -3
  13. package/DiscordGateway/Shard/index.d.ts +4 -4
  14. package/DiscordGateway/Shard/invalidSession.d.ts +2 -3
  15. package/DiscordGateway/Shard/utils.d.ts +3 -4
  16. package/DiscordGateway/Shard/utils.js +1 -1
  17. package/DiscordGateway/ShardStore/index.d.ts +3 -4
  18. package/DiscordGateway/ShardStore/index.js +1 -1
  19. package/DiscordGateway/Sharder/index.d.ts +8 -9
  20. package/DiscordGateway/Sharder/index.js +1 -1
  21. package/DiscordGateway/WS/index.d.ts +2 -4
  22. package/DiscordGateway/index.d.ts +5 -6
  23. package/DiscordGateway/index.js +1 -1
  24. package/DiscordREST/index.d.ts +5 -5
  25. package/DiscordREST/index.js +1 -1
  26. package/DiscordREST/types.d.ts +1 -1
  27. package/DiscordREST/utils.d.ts +2 -2
  28. package/Helpers/interactions.d.ts +6 -5
  29. package/Helpers/interactions.js +1 -1
  30. package/Helpers/permissions.d.ts +3 -3
  31. package/Helpers/permissions.js +1 -1
  32. package/Http/index.d.ts +9 -9
  33. package/Http/index.js +1 -1
  34. package/Interactions/context.d.ts +8 -8
  35. package/Interactions/context.js +2 -3
  36. package/Interactions/context.js.map +1 -1
  37. package/Interactions/definitions.d.ts +2 -1
  38. package/Interactions/gateway.d.ts +2 -2
  39. package/Interactions/gateway.js +1 -1
  40. package/Interactions/handlers.d.ts +1 -1
  41. package/Interactions/handlers.js +1 -1
  42. package/Interactions/index.d.ts +8 -8
  43. package/Interactions/webhook.d.ts +5 -6
  44. package/Interactions/webhook.js +7 -8
  45. package/Interactions/webhook.js.map +1 -1
  46. package/Log/index.d.ts +7 -7
  47. package/Log/index.js +1 -1
  48. package/RateLimit/index.d.ts +7 -9
  49. package/RateLimit/index.js +1 -1
  50. package/RateLimit/index.js.map +1 -1
  51. package/RateLimit/utils.d.ts +1 -1
  52. package/gateway.d.ts +6 -6
  53. package/global.d.ts +2 -76
  54. package/global.js +1 -1
  55. package/global.js.map +1 -1
  56. package/package.json +3 -3
  57. package/utils/common.d.ts +18 -0
  58. package/utils/common.js +3 -0
  59. package/utils/common.js.map +1 -0
  60. package/utils/effect.d.ts +1 -2
  61. package/webhooks.d.ts +3 -3
package/Cache/driver.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { Effect } from "@effect/io/Effect";
2
- import { Maybe } from "dfx";
1
+ import { Effect, Maybe } from "dfx/utils/common";
3
2
  export interface ParentCacheDriver<E, T> {
4
3
  readonly size: Effect<never, E, number>;
5
4
  sizeForParent: (parentId: string) => Effect<never, E, number>;
package/Cache/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { EffectSource } from "callbag-effect-ts/Source";
2
- import { Effect } from "@effect/io/Effect";
1
+ import { EffectSource, Effect } from "dfx/utils/common";
3
2
  import { CacheDriver, ParentCacheDriver } from "./driver.js";
4
3
  export * from "./driver.js";
5
4
  export { create as memoryDriver, createWithParent as memoryParentDriver, } from "./memory.js";
@@ -37,30 +36,30 @@ export type CacheOp<T> = {
37
36
  export declare const makeWithParent: <EOps, EDriver, EMiss, EPMiss, A>({ driver, ops, onMiss, onParentMiss, }: {
38
37
  driver: ParentCacheDriver<EDriver, A>;
39
38
  ops?: import("callbag-effect-ts/Source").EffectSource<never, EOps, ParentCacheOp<A>> | undefined;
40
- onMiss: (parentId: string, id: string) => import("../global.js").Effect<never, EMiss, A>;
41
- onParentMiss: (parentId: string) => import("../global.js").Effect<never, EPMiss, [id: string, resource: A][]>;
39
+ onMiss: (parentId: string, id: string) => import("../utils/common.js").Effect<never, EMiss, A>;
40
+ onParentMiss: (parentId: string) => import("../utils/common.js").Effect<never, EPMiss, [id: string, resource: A][]>;
42
41
  }) => {
43
- get: (parentId: string, id: string) => import("../global.js").Effect<never, EDriver | EMiss, A>;
44
- getForParent: (parentId: string) => import("../global.js").Effect<never, EDriver | EPMiss, ReadonlyMap<string, A>>;
45
- run: import("../global.js").Effect<never, EOps | EDriver, void>;
46
- size: import("../global.js").Effect<never, EDriver, number>;
47
- sizeForParent: (parentId: string) => import("../global.js").Effect<never, EDriver, number>;
48
- set: (parentId: string, resourceId: string, resource: A) => import("../global.js").Effect<never, EDriver, void>;
49
- delete: (parentId: string, resourceId: string) => import("../global.js").Effect<never, EDriver, void>;
50
- parentDelete: (parentId: string) => import("../global.js").Effect<never, EDriver, void>;
51
- refreshTTL: (parentId: string, resourceId: string) => import("../global.js").Effect<never, EDriver, void>;
42
+ get: (parentId: string, id: string) => import("../utils/common.js").Effect<never, EDriver | EMiss, A>;
43
+ getForParent: (parentId: string) => import("../utils/common.js").Effect<never, EDriver | EPMiss, ReadonlyMap<string, A>>;
44
+ run: import("../utils/common.js").Effect<never, EOps | EDriver, void>;
45
+ size: import("../utils/common.js").Effect<never, EDriver, number>;
46
+ sizeForParent: (parentId: string) => import("../utils/common.js").Effect<never, EDriver, number>;
47
+ set: (parentId: string, resourceId: string, resource: A) => import("../utils/common.js").Effect<never, EDriver, void>;
48
+ delete: (parentId: string, resourceId: string) => import("../utils/common.js").Effect<never, EDriver, void>;
49
+ parentDelete: (parentId: string) => import("../utils/common.js").Effect<never, EDriver, void>;
50
+ refreshTTL: (parentId: string, resourceId: string) => import("../utils/common.js").Effect<never, EDriver, void>;
52
51
  };
53
52
  export declare const make: <EOps, EDriver, EMiss, A>({ driver, ops, onMiss, }: {
54
53
  driver: CacheDriver<EDriver, A>;
55
54
  ops?: import("callbag-effect-ts/Source").EffectSource<never, EOps, CacheOp<A>> | undefined;
56
- onMiss: (id: string) => import("../global.js").Effect<never, EMiss, A>;
55
+ onMiss: (id: string) => import("../utils/common.js").Effect<never, EMiss, A>;
57
56
  }) => {
58
- get: (id: string) => import("../global.js").Effect<never, EDriver | EMiss, A>;
59
- run: import("../global.js").Effect<never, EOps | EDriver, void>;
60
- size: import("../global.js").Effect<never, EDriver, number>;
61
- set: (resourceId: string, resource: A) => import("../global.js").Effect<never, EDriver, void>;
62
- delete: (resourceId: string) => import("../global.js").Effect<never, EDriver, void>;
63
- refreshTTL: (resourceId: string) => import("../global.js").Effect<never, EDriver, void>;
57
+ get: (id: string) => import("../utils/common.js").Effect<never, EDriver | EMiss, A>;
58
+ run: import("../utils/common.js").Effect<never, EOps | EDriver, void>;
59
+ size: import("../utils/common.js").Effect<never, EDriver, number>;
60
+ set: (resourceId: string, resource: A) => import("../utils/common.js").Effect<never, EDriver, void>;
61
+ delete: (resourceId: string) => import("../utils/common.js").Effect<never, EDriver, void>;
62
+ refreshTTL: (resourceId: string) => import("../utils/common.js").Effect<never, EDriver, void>;
64
63
  };
65
64
  export declare class CacheMissError {
66
65
  readonly cacheName: string;
package/Cache/memory.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { Maybe } from "dfx";
2
- export declare const createWithParent: <T>() => import("../global.js").Effect<never, never, import("./driver.js").ParentCacheDriver<never, T>>;
3
- export declare const create: <T>() => import("../global.js").Effect<never, never, import("./driver.js").CacheDriver<never, T>>;
1
+ import { Maybe } from "dfx/utils/common";
2
+ export declare const createWithParent: <T>() => import("../utils/common.js").Effect<never, never, import("./driver.js").ParentCacheDriver<never, T>>;
3
+ export declare const create: <T>() => import("../utils/common.js").Effect<never, never, import("./driver.js").CacheDriver<never, T>>;
@@ -1,6 +1,4 @@
1
- import { Duration } from "@fp-ts/data/Duration";
2
- import { Maybe } from "dfx";
3
- import { Effect } from "@effect/io/Effect";
1
+ import { Duration, Maybe, Effect } from "dfx/utils/common";
4
2
  export interface MemoryTTLOpts {
5
3
  /** The approx. number of milliseconds to keep items */
6
4
  ttl: Duration;
@@ -18,5 +16,5 @@ export interface MemoryTTLOpts {
18
16
  */
19
17
  strategy?: "activity" | "usage" | "expiry";
20
18
  }
21
- export declare const create: <T>(opts: MemoryTTLOpts) => import("../global.js").Effect<never, never, import("./driver.js").CacheDriver<never, T>>;
22
- export declare const createWithParent: <T>(opts: MemoryTTLOpts) => import("../global.js").Effect<never, never, import("./driver.js").ParentCacheDriver<never, T>>;
19
+ export declare const create: <T>(opts: MemoryTTLOpts) => import("../utils/common.js").Effect<never, never, import("./driver.js").CacheDriver<never, T>>;
20
+ export declare const createWithParent: <T>(opts: MemoryTTLOpts) => import("../utils/common.js").Effect<never, never, import("./driver.js").ParentCacheDriver<never, T>>;
@@ -1,4 +1,4 @@
1
- import { EffectSource } from "callbag-effect-ts/Source";
1
+ import { EffectSource } from "dfx/utils/common";
2
2
  import { Discord } from "dfx";
3
3
  import { Effect } from "@effect/io/Effect";
4
4
  import { ParentCacheOp, CacheOp, CacheDriver, ParentCacheDriver, CacheMissError } from "./index.js";
@@ -1,4 +1,4 @@
1
- import { Duration } from "@fp-ts/data/Duration";
1
+ import { Duration } from "dfx/utils/common";
2
2
  import { Discord } from "dfx";
3
3
  export interface DiscordConfig {
4
4
  token: string;
@@ -16,23 +16,23 @@ export interface DiscordConfig {
16
16
  identifyRateLimit: readonly [window: number, limit: number];
17
17
  };
18
18
  }
19
- export declare const DiscordConfig: import("../global.js").Tag<DiscordConfig>;
19
+ export declare const DiscordConfig: import("../utils/common.js").Tag<DiscordConfig>;
20
20
  export interface MakeOpts {
21
21
  token: string;
22
22
  rest?: Partial<DiscordConfig["rest"]>;
23
23
  gateway?: Partial<DiscordConfig["gateway"]>;
24
24
  }
25
25
  export declare const make: ({ token, rest, gateway }: MakeOpts) => DiscordConfig;
26
- export declare const makeLayer: (a_0: MakeOpts) => import("../global.js").Layer<never, never, DiscordConfig>;
27
- export declare const token: import("../global.js").Effect<DiscordConfig, never, string>;
28
- export declare const rest: import("../global.js").Effect<DiscordConfig, never, {
26
+ export declare const makeLayer: (a_0: MakeOpts) => import("../utils/common.js").Layer<never, never, DiscordConfig>;
27
+ export declare const token: import("../utils/common.js").Effect<DiscordConfig, never, string>;
28
+ export declare const rest: import("../utils/common.js").Effect<DiscordConfig, never, {
29
29
  baseUrl: string;
30
30
  globalRateLimit: {
31
31
  limit: number;
32
32
  window: Duration;
33
33
  };
34
34
  }>;
35
- export declare const gateway: import("../global.js").Effect<DiscordConfig, never, {
35
+ export declare const gateway: import("../utils/common.js").Effect<DiscordConfig, never, {
36
36
  intents: number;
37
37
  presence?: import("../types.js").UpdatePresence | undefined;
38
38
  shardCount?: number | undefined;
@@ -1,9 +1,8 @@
1
- import * as tsplus_module_1 from "@fp-ts/data/Context";
1
+ import * as tsplus_module_1 from "dfx/utils/common";
2
2
  import * as tsplus_module_2 from "@fp-ts/data/Duration";
3
3
  import * as tsplus_module_3 from "dfx";
4
4
  import * as tsplus_module_4 from "@effect/io/Layer";
5
- import * as tsplus_module_5 from "@fp-ts/data/Function";
6
- import * as tsplus_module_6 from "@effect/io/Effect";
5
+ import * as tsplus_module_5 from "@effect/io/Effect";
7
6
  const VERSION = 9;
8
7
  export const DiscordConfig = tsplus_module_1.Tag();
9
8
  export const make = ({ token, rest, gateway }) => ({
@@ -23,8 +22,8 @@ export const make = ({ token, rest, gateway }) => ({
23
22
  ...(gateway ?? {}),
24
23
  },
25
24
  });
26
- export const makeLayer = tsplus_module_5.flow(make, tsplus_module_4.succeed(DiscordConfig));
27
- export const token = tsplus_module_6.serviceWith(DiscordConfig)(({ token }) => token);
28
- export const rest = tsplus_module_6.serviceWith(DiscordConfig)(({ rest }) => rest);
29
- export const gateway = tsplus_module_6.serviceWith(DiscordConfig)(({ gateway }) => gateway);
25
+ export const makeLayer = tsplus_module_1.flow(make, tsplus_module_4.succeed(DiscordConfig));
26
+ export const token = tsplus_module_5.serviceWith(DiscordConfig)(({ token }) => token);
27
+ export const rest = tsplus_module_5.serviceWith(DiscordConfig)(({ rest }) => rest);
28
+ export const gateway = tsplus_module_5.serviceWith(DiscordConfig)(({ gateway }) => gateway);
30
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DiscordConfig/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,OAAO,GAAG,CAAC,CAAA;AAmBjB,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAA,GAAG,EAAiB,CAAA;AAQjD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAY,EAAiB,EAAE,CAAC,CAAC;IAC1E,KAAK;IACL,IAAI,EAAE;QACJ,OAAO,EAAE,4BAA4B,OAAO,EAAE;QAC9C,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACf,eAAe,EAAE;YACf,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,wBAAiB,CAAC,CAAC;YAC3B,GAAG,CAAC,IAAI,EAAE,eAAe,IAAI,EAAE,CAAC;SACjC;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,gBAAA,OAAO,CAAC,cAAc,CAAC,MAAM;QACtC,iBAAiB,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5B,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KACnB;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAA,IAAI,CAAC,IAAI,EAAE,wBAAc,aAAa,CAAC,CAAC,CAAA;AAEjE,MAAM,CAAC,MAAM,KAAK,GAAG,4BAAmB,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;AAC5E,MAAM,CAAC,MAAM,IAAI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AAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;AACzE,MAAM,CAAC,MAAM,OAAO,GAAG,4BAAmB,aAAa,CAAC,CACtD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CACzB,CAAA"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="ws" />
2
2
  import { Discord } from "dfx";
3
3
  import { WS } from "dfx/gateway";
4
- import { Effect } from "@effect/io/Effect";
5
- import { EffectSource } from "callbag-effect-ts/Source";
4
+ import { Effect, EffectSource } from "dfx/utils/common";
6
5
  import WebSocket from "isomorphic-ws";
7
6
  export type Message = Discord.GatewayPayload | WS.Reconnect;
8
7
  export interface OpenOpts {
@@ -16,9 +15,9 @@ export interface DiscordWSCodec {
16
15
  encode: (p: Discord.GatewayPayload) => string;
17
16
  decode: (p: WebSocket.Data) => Discord.GatewayPayload;
18
17
  }
19
- export declare const DiscordWSCodec: import("../../global.js").Tag<DiscordWSCodec>;
20
- export declare const LiveJsonDiscordWSCodec: import("../../global.js").Layer<never, never, DiscordWSCodec>;
21
- export declare const make: ({ url, version, outbound, }: OpenOpts) => import("../../global.js").Effect<DiscordWSCodec | import("../../Log/index.js").Log, never, {
18
+ export declare const DiscordWSCodec: import("../../utils/common.js").Tag<DiscordWSCodec>;
19
+ export declare const LiveJsonDiscordWSCodec: import("../../utils/common.js").Layer<never, never, DiscordWSCodec>;
20
+ export declare const make: ({ url, version, outbound, }: OpenOpts) => import("../../utils/common.js").Effect<DiscordWSCodec | import("../../Log/index.js").Log, never, {
22
21
  source: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
23
- setUrl: (url: string) => import("../../global.js").Effect<never, never, void>;
22
+ setUrl: (url: string) => import("../../utils/common.js").Effect<never, never, void>;
24
23
  }>;
@@ -1,4 +1,4 @@
1
- import * as tsplus_module_1 from "@fp-ts/data/Context";
1
+ import * as tsplus_module_1 from "dfx/utils/common";
2
2
  import * as tsplus_module_2 from "@effect/io/Layer";
3
3
  import * as tsplus_module_3 from "@fp-ts/data/Duration";
4
4
  import * as tsplus_module_4 from "@effect/io/Schedule";
@@ -1,6 +1,4 @@
1
- import { Ref } from "@effect/io/Ref";
2
- import { Maybe, Discord } from "dfx";
3
- import { Effect } from "@effect/io/Effect";
1
+ import { Ref, Maybe, Effect, EffectSource } from "dfx/utils/common";
4
2
  import { DiscordWS } from "dfx/gateway";
5
- import { EffectSource } from "callbag-effect-ts/Source";
3
+ import { Discord } from "dfx";
6
4
  export declare const fromRaw: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, seqRef: Ref<Maybe<number>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
@@ -1,6 +1,5 @@
1
- import { Discord, Maybe } from "dfx";
2
- import { Ref } from "@effect/io/Ref";
3
- import { EffectSource } from "callbag-effect-ts/Source";
1
+ import { Discord } from "dfx";
2
+ import { Ref, Maybe, EffectSource } from "dfx/utils/common";
4
3
  export interface Options {
5
4
  token: string;
6
5
  intents: number;
@@ -1,9 +1,9 @@
1
1
  import { DiscordWS } from "dfx/gateway";
2
2
  import { Discord } from "dfx";
3
- export declare const make: (shard: [id: number, count: number]) => import("../../global.js").Effect<import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").RateLimiter, never, {
4
- run: import("../../global.js").Effect<never, never, void>;
3
+ export declare const make: (shard: [id: number, count: number]) => import("../../utils/common.js").Effect<import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").RateLimiter, never, {
4
+ run: import("../../utils/common.js").Effect<never, never, void>;
5
5
  raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
6
6
  dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
7
- send: (p: Discord.GatewayPayload) => import("../../global.js").Effect<never, never, boolean>;
8
- reconnect: import("../../global.js").Effect<never, never, boolean>;
7
+ send: (p: Discord.GatewayPayload) => import("../../utils/common.js").Effect<never, never, boolean>;
8
+ reconnect: import("../../utils/common.js").Effect<never, never, boolean>;
9
9
  }>;
@@ -1,5 +1,4 @@
1
- import { EffectSource } from "callbag-effect-ts/Source";
2
- import { Discord, Maybe } from "dfx";
3
- import { Ref } from "@effect/io/Ref";
1
+ import { EffectSource, Ref, Maybe } from "dfx/utils/common";
2
+ import { Discord } from "dfx";
4
3
  import { DiscordWS } from "dfx/gateway";
5
4
  export declare const fromRaw: <R, E>(raw: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>, latestReady: Ref<Maybe<Discord.ReadyEvent>>) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../DiscordWS/index.js").Message>;
@@ -1,5 +1,4 @@
1
- import { EffectSource } from "callbag-effect-ts/Source";
2
- import { Discord, Maybe } from "dfx";
3
- import { Ref } from "@effect/io/Ref";
1
+ import { EffectSource, Maybe, Ref } from "dfx/utils/common";
2
+ import { Discord } from "dfx";
4
3
  export declare const opCode: <R, E>(source: import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<any>>) => <T = any>(code: Discord.GatewayOpcode) => import("callbag-effect-ts/Source").EffectSource<R, E, import("../../types.js").GatewayPayload<T>>;
5
- export declare const latest: <T>(f: (p: Discord.GatewayPayload) => import("../../index.js").Maybe<T>) => import("../../global.js").Effect<never, never, readonly [import("../../global.js").Ref<import("../../index.js").Maybe<T>>, (p: import("../../types.js").GatewayPayload<any>) => import("../../global.js").Effect<never, never, void>]>;
4
+ export declare const latest: <T>(f: (p: Discord.GatewayPayload) => import("../../index.js").Maybe<T>) => import("../../utils/common.js").Effect<never, never, readonly [import("../../utils/common.js").Ref<import("../../index.js").Maybe<T>>, (p: import("../../types.js").GatewayPayload<any>) => import("../../utils/common.js").Effect<never, never, void>]>;
@@ -2,7 +2,7 @@ import * as tsplus_module_1 from "callbag-effect-ts/Source/filter";
2
2
  import * as tsplus_module_2 from "@effect/io/Effect";
3
3
  import * as tsplus_module_3 from "@fp-ts/data/Option";
4
4
  import * as tsplus_module_4 from "@effect/io/Ref";
5
- import * as tsplus_module_5 from "@fp-ts/data/Function";
5
+ import * as tsplus_module_5 from "dfx/utils/common";
6
6
  export const opCode = (source) => (code) => tsplus_module_1.filter((p) => p.op === code)(source);
7
7
  const maybeUpdateRef = (f, ref) => tsplus_module_5.flow(f, (o) => tsplus_module_3.match(tsplus_module_2.unit, (a) => tsplus_module_4.set(tsplus_module_3.some(a))(ref))(o));
8
8
  export const latest = (f) => tsplus_module_2.map((ref) => [ref, maybeUpdateRef(f, ref)])(tsplus_module_4.make(tsplus_module_3.none));
@@ -1,5 +1,4 @@
1
- import { Effect } from "@effect/io/Effect";
2
- import { Maybe } from "dfx";
1
+ import { Effect, Maybe } from "dfx/utils/common";
3
2
  export interface ClaimIdContext {
4
3
  sharderCount: number;
5
4
  totalCount: number;
@@ -9,5 +8,5 @@ export interface ShardStore {
9
8
  allClaimed: (totalCount: number) => Effect<never, never, boolean>;
10
9
  heartbeat?: (shardId: number) => Effect<never, never, void>;
11
10
  }
12
- export declare const ShardStore: import("../../global.js").Tag<ShardStore>;
13
- export declare const LiveMemoryShardStore: import("../../global.js").Layer<never, never, ShardStore>;
11
+ export declare const ShardStore: import("../../utils/common.js").Tag<ShardStore>;
12
+ export declare const LiveMemoryShardStore: import("../../utils/common.js").Layer<never, never, ShardStore>;
@@ -1,4 +1,4 @@
1
- import * as tsplus_module_1 from "@fp-ts/data/Context";
1
+ import * as tsplus_module_1 from "dfx/utils/common";
2
2
  import * as tsplus_module_2 from "@fp-ts/data/Option";
3
3
  import * as tsplus_module_3 from "@effect/io/Effect";
4
4
  import * as tsplus_module_4 from "@effect/io/Layer";
@@ -1,19 +1,18 @@
1
- import { Effect } from "@effect/io/Effect";
2
- import { Maybe, Discord } from "dfx";
3
- import { EffectSource } from "callbag-effect-ts/Source";
1
+ import { Effect, Maybe, EffectSource } from "dfx/utils/common";
2
+ import { Discord } from "dfx";
4
3
  import { Success } from "dfx/utils/effect";
5
4
  import { ShardStore } from "../ShardStore/index.js";
6
- declare const make: import("../../global.js").Effect<import("../../index.js").DiscordREST | import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | ShardStore | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").RateLimiter, never, {
5
+ declare const make: import("../../utils/common.js").Effect<import("../../index.js").DiscordREST | import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | ShardStore | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").RateLimiter, never, {
7
6
  shards: import("callbag-effect-ts/Source").EffectSource<never, never, {
8
- run: import("../../global.js").Effect<never, never, void>;
7
+ run: import("../../utils/common.js").Effect<never, never, void>;
9
8
  raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<any>>;
10
9
  dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../../types.js").GatewayPayload<import("../../types.js").ReceiveEvent>>;
11
- send: (p: import("../../types.js").GatewayPayload<any>) => import("../../global.js").Effect<never, never, boolean>;
12
- reconnect: import("../../global.js").Effect<never, never, boolean>;
10
+ send: (p: import("../../types.js").GatewayPayload<any>) => import("../../utils/common.js").Effect<never, never, boolean>;
11
+ reconnect: import("../../utils/common.js").Effect<never, never, boolean>;
13
12
  }>;
14
13
  }>;
15
14
  export interface Sharder extends Success<typeof make> {
16
15
  }
17
- export declare const Sharder: import("../../global.js").Tag<Sharder>;
18
- export declare const LiveSharder: import("../../global.js").Layer<import("../../index.js").DiscordREST | import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | ShardStore | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").RateLimiter, never, Sharder>;
16
+ export declare const Sharder: import("../../utils/common.js").Tag<Sharder>;
17
+ export declare const LiveSharder: import("../../utils/common.js").Layer<import("../../index.js").DiscordREST | import("../DiscordWS/index.js").DiscordWSCodec | import("../../Log/index.js").Log | ShardStore | import("../../DiscordConfig/index.js").DiscordConfig | import("../../index.js").RateLimiter, never, Sharder>;
19
18
  export {};
@@ -15,7 +15,7 @@ import * as tsplus_module_14 from "@fp-ts/data/Option";
15
15
  import * as tsplus_module_15 from "callbag-effect-ts/Source/empty";
16
16
  import * as tsplus_module_16 from "callbag-effect-ts/Source/resource";
17
17
  import * as tsplus_module_17 from "dfx";
18
- import * as tsplus_module_18 from "@fp-ts/data/Context";
18
+ import * as tsplus_module_18 from "dfx/utils/common";
19
19
  import { millis } from "@fp-ts/data/Duration";
20
20
  import { overridePull } from "callbag-effect-ts/Source";
21
21
  import { ShardStore } from "../ShardStore/index.js";
@@ -1,8 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="ws" />
3
- import { Ref } from "@effect/io/Ref";
4
- import { Effect } from "@effect/io/Effect";
5
- import { EffectSource } from "callbag-effect-ts/Source";
3
+ import { Ref, Effect, EffectSource } from "dfx/utils/common";
6
4
  import WebSocket from "isomorphic-ws";
7
5
  export declare const Reconnect: unique symbol;
8
6
  export type Reconnect = typeof Reconnect;
@@ -18,4 +16,4 @@ export declare class WebSocketCloseError {
18
16
  readonly _tag = "WebSocketCloseError";
19
17
  constructor(code: number, reason: string);
20
18
  }
21
- export declare const make: (url: Ref<string>, takeOutbound: Effect<never, never, Message>) => import("../../global.js").Effect<import("../../Log/index.js").Log, never, import("callbag-effect-ts/Source").EffectSource<never, WebSocketError | WebSocketCloseError, WebSocket.Data>>;
19
+ export declare const make: (url: Ref<string>, takeOutbound: Effect<never, never, Message>) => import("../../utils/common.js").Effect<import("../../Log/index.js").Log, never, import("callbag-effect-ts/Source").EffectSource<never, WebSocketError | WebSocketCloseError, WebSocket.Data>>;
@@ -1,15 +1,14 @@
1
- import { EffectSource } from "callbag-effect-ts/Source";
1
+ import { EffectSource, Effect } from "dfx/utils/common";
2
2
  import { Discord } from "dfx";
3
- import { Effect } from "@effect/io/Effect";
4
3
  import { Success } from "dfx/utils/effect";
5
4
  import { Sharder } from "./Sharder/index.js";
6
- export declare const make: import("../global.js").Effect<Sharder, never, {
5
+ export declare const make: import("../utils/common.js").Effect<Sharder, never, {
7
6
  raw: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<any>>;
8
7
  dispatch: import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").GatewayPayload<import("../types.js").ReceiveEvent>>;
9
8
  fromDispatch: <K extends keyof import("../types.js").ReceiveEvents>(event: K) => import("callbag-effect-ts/Source").EffectSource<never, never, import("../types.js").ReceiveEvents[K]>;
10
- handleDispatch: <K_1 extends keyof import("../types.js").ReceiveEvents, R1, E1, A>(event: K_1, handle: (event: import("../types.js").ReceiveEvents[K_1]) => import("../global.js").Effect<R1, E1, A>) => import("../global.js").Effect<R1, E1, void>;
9
+ handleDispatch: <K_1 extends keyof import("../types.js").ReceiveEvents, R1, E1, A>(event: K_1, handle: (event: import("../types.js").ReceiveEvents[K_1]) => import("../utils/common.js").Effect<R1, E1, A>) => import("../utils/common.js").Effect<R1, E1, void>;
11
10
  }>;
12
11
  export interface DiscordGateway extends Success<typeof make> {
13
12
  }
14
- export declare const DiscordGateway: import("../global.js").Tag<DiscordGateway>;
15
- export declare const LiveDiscordGateway: import("../global.js").Layer<Sharder, never, DiscordGateway>;
13
+ export declare const DiscordGateway: import("../utils/common.js").Tag<DiscordGateway>;
14
+ export declare const LiveDiscordGateway: import("../utils/common.js").Layer<Sharder, never, DiscordGateway>;
@@ -5,7 +5,7 @@ import * as tsplus_module_4 from "callbag-effect-ts/Source/chainPar";
5
5
  import * as tsplus_module_5 from "callbag-effect-ts/Source/run";
6
6
  import * as tsplus_module_6 from "callbag-effect-ts/Source/share";
7
7
  import * as tsplus_module_7 from "@effect/io/Effect";
8
- import * as tsplus_module_8 from "@fp-ts/data/Context";
8
+ import * as tsplus_module_8 from "dfx/utils/common";
9
9
  import * as tsplus_module_9 from "@effect/io/Layer";
10
10
  import { Sharder } from "./Sharder/index.js";
11
11
  const fromDispatchFactory = (source) => (event) => tsplus_module_2.map((p) => p.d)(tsplus_module_1.filter((p) => p.t === event)(source));
@@ -1,8 +1,8 @@
1
1
  import { BucketDetails, FetchError, StatusCodeError, JsonParseError, Discord } from "dfx";
2
- import { Effect } from "@effect/io/Effect";
2
+ import { Effect } from "dfx/utils/common";
3
3
  import { Success } from "dfx/utils/effect";
4
4
  import { ResponseWithData, RestResponse } from "./types.js";
5
- declare const make: import("../global.js").Effect<import("../Log/index.js").Log | import("../DiscordConfig/index.js").DiscordConfig | import("../index.js").Http | import("../index.js").RateLimitStore | import("../index.js").RateLimiter, never, {
5
+ declare const make: import("../utils/common.js").Effect<import("../Log/index.js").Log | import("../DiscordConfig/index.js").DiscordConfig | import("../index.js").Http | import("../index.js").RateLimitStore | import("../index.js").RateLimiter, never, {
6
6
  addGuildMember: (guildId: string, userId: string, params?: Partial<import("../types.js").AddGuildMemberParams> | undefined, options?: RequestInit | undefined) => RestResponse<import("../types.js").GuildMember>;
7
7
  addGuildMemberRole: (guildId: string, userId: string, roleId: string, options?: RequestInit | undefined) => RestResponse<any>;
8
8
  addThreadMember: (channelId: string, userId: string, options?: RequestInit | undefined) => RestResponse<any>;
@@ -176,10 +176,10 @@ declare const make: import("../global.js").Effect<import("../Log/index.js").Log
176
176
  syncGuildTemplate: (guildId: string, templateCode: string, options?: RequestInit | undefined) => RestResponse<import("../types.js").GuildTemplate>;
177
177
  triggerTypingIndicator: (channelId: string, options?: RequestInit | undefined) => RestResponse<any>;
178
178
  unpinMessage: (channelId: string, messageId: string, options?: RequestInit | undefined) => RestResponse<any>;
179
- request: <A = unknown>(path: string, init?: RequestInit) => import("../global.js").Effect<never, import("../index.js").FetchError | import("../index.js").StatusCodeError | import("../index.js").JsonParseError, ResponseWithData<A>>;
179
+ request: <A = unknown>(path: string, init?: RequestInit) => import("../utils/common.js").Effect<never, import("../index.js").FetchError | import("../index.js").StatusCodeError | import("../index.js").JsonParseError, ResponseWithData<A>>;
180
180
  }>;
181
181
  export interface DiscordREST extends Success<typeof make> {
182
182
  }
183
- export declare const DiscordREST: import("../global.js").Tag<DiscordREST>;
184
- export declare const LiveDiscordREST: import("../global.js").Layer<import("../Log/index.js").Log | import("../DiscordConfig/index.js").DiscordConfig | import("../index.js").Http | import("../index.js").RateLimitStore | import("../index.js").RateLimiter, never, DiscordREST>;
183
+ export declare const DiscordREST: import("../utils/common.js").Tag<DiscordREST>;
184
+ export declare const LiveDiscordREST: import("../utils/common.js").Layer<import("../Log/index.js").Log | import("../DiscordConfig/index.js").DiscordConfig | import("../index.js").Http | import("../index.js").RateLimitStore | import("../index.js").RateLimiter, never, DiscordREST>;
185
185
  export {};
@@ -4,7 +4,7 @@ import * as tsplus_module_3 from "@fp-ts/data/Duration";
4
4
  import * as tsplus_module_4 from "@fp-ts/data/Option";
5
5
  import * as tsplus_module_5 from "@fp-ts/data/HashSet";
6
6
  import * as tsplus_module_6 from "@effect/io/Ref";
7
- import * as tsplus_module_7 from "@fp-ts/data/Context";
7
+ import * as tsplus_module_7 from "dfx/utils/common";
8
8
  import * as tsplus_module_8 from "@effect/io/Layer";
9
9
  import { millis } from "@fp-ts/data/Duration";
10
10
  import { rateLimitFromHeaders, routeFromConfig, retryAfter } from "./utils.js";
@@ -1,4 +1,4 @@
1
- import { Effect } from "@effect/io/Effect";
1
+ import { Effect } from "dfx/utils/common";
2
2
  import { JsonParseError, BlobError, FetchError, StatusCodeError } from "dfx";
3
3
  export interface ResponseWithData<A> {
4
4
  response: Response;
@@ -1,9 +1,9 @@
1
1
  export declare const routeFromConfig: (path: string, init: RequestInit) => string;
2
2
  export declare const numberHeader: (headers: Headers) => (key: string) => import("../index.js").Maybe<number>;
3
- export declare const retryAfter: (headers: Headers) => import("../index.js").Maybe<import("../global.js").Duration>;
3
+ export declare const retryAfter: (headers: Headers) => import("../index.js").Maybe<import("../utils/common.js").Duration>;
4
4
  export declare const rateLimitFromHeaders: (headers: Headers) => import("../index.js").Maybe<{
5
5
  readonly bucket: string;
6
- readonly retryAfter: import("../global.js").Duration;
6
+ readonly retryAfter: import("../utils/common.js").Duration;
7
7
  readonly limit: number;
8
8
  readonly remaining: number;
9
9
  }>;
@@ -1,4 +1,5 @@
1
- import { Discord, Maybe } from "dfx";
1
+ import { Discord } from "dfx";
2
+ import { Maybe } from "dfx/utils/common";
2
3
  /**
3
4
  * Maybe find a sub-command within the interaction options.
4
5
  */
@@ -22,11 +23,11 @@ export declare const optionsWithNested: (data: Pick<Discord.ApplicationCommandDa
22
23
  /**
23
24
  * Return the interaction options as a name / value map.
24
25
  */
25
- export declare const transformOptions: (options: Discord.ApplicationCommandInteractionDataOption[]) => import("../global.js").HashMap<string, string | undefined>;
26
+ export declare const transformOptions: (options: Discord.ApplicationCommandInteractionDataOption[]) => import("../utils/common.js").HashMap<string, string | undefined>;
26
27
  /**
27
28
  * Return the interaction options as a name / value map.
28
29
  */
29
- export declare const optionsMap: (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../global.js").HashMap<string, string | undefined>;
30
+ export declare const optionsMap: (data: Pick<import("../types.js").ApplicationCommandDatum, "options">) => import("../utils/common.js").HashMap<string, string | undefined>;
30
31
  /**
31
32
  * Try find a matching option from the interaction.
32
33
  */
@@ -62,11 +63,11 @@ export declare const componentsWithValue: (a: import("../types.js").ModalSubmitD
62
63
  /**
63
64
  * Return the interaction components as an id / value map.
64
65
  */
65
- export declare const transformComponents: (options: Discord.Component[]) => import("../global.js").HashMap<string, string | undefined>;
66
+ export declare const transformComponents: (options: Discord.Component[]) => import("../utils/common.js").HashMap<string, string | undefined>;
66
67
  /**
67
68
  * Return the interaction components as an id / value map.
68
69
  */
69
- export declare const componentsMap: (a: import("../types.js").ModalSubmitDatum) => import("../global.js").HashMap<string, string | undefined>;
70
+ export declare const componentsMap: (a: import("../types.js").ModalSubmitDatum) => import("../utils/common.js").HashMap<string, string | undefined>;
70
71
  /**
71
72
  * Try find a matching component from the interaction.
72
73
  */
@@ -1,5 +1,5 @@
1
1
  import * as tsplus_module_1 from "dfx";
2
- import * as tsplus_module_2 from "@fp-ts/data/Function";
2
+ import * as tsplus_module_2 from "dfx/utils/common";
3
3
  import * as tsplus_module_3 from "@fp-ts/data/Option";
4
4
  import * as tsplus_module_4 from "@fp-ts/data/HashMap";
5
5
  import * as Arr from "@fp-ts/data/ReadonlyArray";
@@ -1,5 +1,5 @@
1
1
  import { Discord } from "dfx";
2
- import { Effect } from "@effect/io/Effect";
2
+ import { Effect } from "dfx/utils/common";
3
3
  /**
4
4
  * A constant of all the permissions
5
5
  */
@@ -36,6 +36,6 @@ export declare const applyOverwrites: (permissions: bigint) => (overwrites: Disc
36
36
  interface RolesCache<E> {
37
37
  getForParent: (parentId: string) => Effect<never, E, ReadonlyMap<string, Discord.Role>>;
38
38
  }
39
- export declare const hasInChannel: <E>(rolesCache: RolesCache<E>, permission: bigint) => (channel: Discord.Channel, memberOrRole: Discord.GuildMember | Discord.Role) => import("../global.js").Effect<never, E, boolean>;
40
- export declare const hasInGuild: <E>(rolesCache: RolesCache<E>, permission: bigint) => (guildId: Discord.Snowflake, member: Discord.GuildMember) => import("../global.js").Effect<never, E, boolean>;
39
+ export declare const hasInChannel: <E>(rolesCache: RolesCache<E>, permission: bigint) => (channel: Discord.Channel, memberOrRole: Discord.GuildMember | Discord.Role) => import("../utils/common.js").Effect<never, E, boolean>;
40
+ export declare const hasInGuild: <E>(rolesCache: RolesCache<E>, permission: bigint) => (guildId: Discord.Snowflake, member: Discord.GuildMember) => import("../utils/common.js").Effect<never, E, boolean>;
41
41
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as tsplus_module_1 from "dfx";
2
- import * as tsplus_module_2 from "@fp-ts/data/Function";
2
+ import * as tsplus_module_2 from "dfx/utils/common";
3
3
  import * as tsplus_module_3 from "@effect/io/Effect";
4
4
  /**
5
5
  * A constant of all the permissions
package/Http/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  declare const make: () => {
2
- request: (url: URL | string, init?: RequestInit) => import("../global.js").Effect<never, FetchError | StatusCodeError, Response>;
3
- requestWithJson: <A = unknown>(url: URL | string, init?: RequestInit) => import("../global.js").Effect<never, FetchError | StatusCodeError, {
2
+ request: (url: URL | string, init?: RequestInit) => import("../utils/common.js").Effect<never, FetchError | StatusCodeError, Response>;
3
+ requestWithJson: <A = unknown>(url: URL | string, init?: RequestInit) => import("../utils/common.js").Effect<never, FetchError | StatusCodeError, {
4
4
  response: Response;
5
- json: import("../global.js").Effect<never, JsonParseError, A>;
6
- blob: import("../global.js").Effect<never, BlobError, Blob>;
7
- text: import("../global.js").Effect<never, never, string>;
5
+ json: import("../utils/common.js").Effect<never, JsonParseError, A>;
6
+ blob: import("../utils/common.js").Effect<never, BlobError, Blob>;
7
+ text: import("../utils/common.js").Effect<never, never, string>;
8
8
  }>;
9
9
  };
10
10
  export interface Http extends ReturnType<typeof make> {
11
11
  }
12
- export declare const Http: import("../global.js").Tag<Http>;
13
- export declare const LiveHttp: import("../global.js").Layer<never, never, Http>;
12
+ export declare const Http: import("../utils/common.js").Tag<Http>;
13
+ export declare const LiveHttp: import("../utils/common.js").Layer<never, never, Http>;
14
14
  export declare class FetchError {
15
15
  readonly reason: unknown;
16
16
  readonly _tag = "FetchError";
@@ -27,11 +27,11 @@ export declare class JsonParseError {
27
27
  readonly _tag = "JsonParseError";
28
28
  constructor(reason: unknown);
29
29
  }
30
- export declare const json: <A = unknown>(r: Response) => import("../global.js").Effect<never, JsonParseError, A>;
30
+ export declare const json: <A = unknown>(r: Response) => import("../utils/common.js").Effect<never, JsonParseError, A>;
31
31
  export declare class BlobError {
32
32
  readonly reason: unknown;
33
33
  readonly _tag = "BlobError";
34
34
  constructor(reason: unknown);
35
35
  }
36
- export declare const blob: (r: Response) => import("../global.js").Effect<never, BlobError, Blob>;
36
+ export declare const blob: (r: Response) => import("../utils/common.js").Effect<never, BlobError, Blob>;
37
37
  export {};
package/Http/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 "@fp-ts/data/Context";
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 = () => {
5
5
  const request = (url, init = {}) => tsplus_module_1.filterOrElseWith((r) => r.status < 300, (r) => tsplus_module_1.fail(new StatusCodeError(r)))(tsplus_module_1.tryCatchPromiseAbort((signal) => fetch(url, {
@@ -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("../global.js").Tag<import("../types.js").Interaction>;
4
- export declare const ApplicationCommandContext: import("../global.js").Tag<import("../types.js").ApplicationCommandDatum>;
5
- export declare const MessageComponentContext: import("../global.js").Tag<import("../types.js").MessageComponentDatum>;
6
- export declare const ModalSubmitContext: import("../global.js").Tag<import("../types.js").ModalSubmitDatum>;
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("../global.js").Tag<FocusedOptionContext>;
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("../global.js").Tag<SubCommandContext>;
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("../global.js").HashMap<string, string | undefined>>;
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("../global.js").HashMap<string, string | undefined>>;
51
+ export declare const modalValues: Effect<import("../types.js").ModalSubmitDatum, never, import("../utils/common.js").HashMap<string, string | undefined>>;
@@ -1,7 +1,6 @@
1
- import * as tsplus_module_1 from "@fp-ts/data/Context";
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) => tsplus_module_4.pipe(IxHelpers.allSubCommands(data), Arr.findFirst((a) => !!commands[a.name]), (o) => tsplus_module_3.toEither(() => new SubCommandNotFound(data))(o), tsplus_module_2.fromEither, (a) => tsplus_module_2.flatMap((command) => tsplus_module_4.pipe(commands[command.name], tsplus_module_2.provideService(SubCommandContext)({ command })))(a)))(tsplus_module_2.service(ApplicationCommandContext));
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":";;;;AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAChD,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAA;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAA,GAAG,EAAuB,CAAA;AAC5D,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAA,GAAG,EAAmC,CAAA;AAC/E,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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, Maybe } from "dfx";
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,4 +1,4 @@
1
- import { Effect } from "@effect/io/Effect";
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";
@@ -9,4 +9,4 @@ export interface RunOpts {
9
9
  * @tsplus pipeable dfx/InteractionBuilder runGateway
10
10
  * @tsplus location "dfx/Interactions/gateway"
11
11
  */
12
- export declare const run: <R, R2, E, E2>(postHandler: (effect: import("../global.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("../global.js").Effect<R2, E2, void>, { sync }?: RunOpts) => (ix: InteractionBuilder<R, E>) => import("../global.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>;
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>;
@@ -1,5 +1,5 @@
1
1
  import * as tsplus_module_1 from "@effect/io/Effect";
2
- import * as tsplus_module_2 from "@fp-ts/data/Function";
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";
@@ -1,5 +1,5 @@
1
1
  import { Discord } from "dfx";
2
- import { Effect } from "@effect/io/Effect";
2
+ import { Effect } from "dfx/utils/common";
3
3
  import * as D from "./definitions.js";
4
4
  export declare class DefinitionNotFound {
5
5
  readonly interaction: Discord.Interaction;
@@ -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 "@fp-ts/data/Function";
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";
@@ -1,4 +1,4 @@
1
- import { Effect } from "@effect/io/Effect";
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";
@@ -12,12 +12,12 @@ export declare class InteractionBuilder<R, E> {
12
12
  constructor(definitions: D.InteractionDefinition<R, E>[]);
13
13
  add<R1, E1>(definition: D.InteractionDefinition<R1, E1>): InteractionBuilder<R | R1, E | E1>;
14
14
  concat<R1, E1>(builder: InteractionBuilder<R1, E1>): InteractionBuilder<R | R1, E | E1>;
15
- get syncGlobal(): import("../global.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("../global.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[]>>;
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[]>>;
17
17
  }
18
18
  export declare const builder: InteractionBuilder<never, never>;
19
- export declare const id: (query: string) => (customId: string) => import("../global.js").Effect<never, never, boolean>;
20
- export declare const idStartsWith: (query: string) => (customId: string) => import("../global.js").Effect<never, never, boolean>;
21
- export declare const idRegex: (query: RegExp) => (customId: string) => import("../global.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("../global.js").Effect<never, never, boolean>;
23
- export declare const optionOnly: (optionName: string) => (_: unknown, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => import("../global.js").Effect<never, never, boolean>;
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>;
@@ -1,6 +1,5 @@
1
1
  import { Discord } from "dfx";
2
- import { Effect } from "@effect/io/Effect";
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("../global.js").Tag<WebhookConfig>;
21
- export declare const makeConfigLayer: (a_0: MakeConfigOpts) => import("../global.js").Layer<never, never, WebhookConfig>;
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";
@@ -34,7 +33,7 @@ export interface HandleWebhookOpts<E> {
34
33
  * @tsplus getter dfx/InteractionBuilder webhookHandler
35
34
  * @tsplus location "dfx/Interactions/webhook"
36
35
  */
37
- export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body, success, error, }: HandleWebhookOpts<DefinitionNotFound | BadWebhookSignature | WebhookParseError | E>) => import("../global.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, never, void>;
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>;
38
37
  /**
39
38
  * @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
40
39
  * @tsplus location "dfx/Interactions/webhook"
@@ -42,5 +41,5 @@ export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ hea
42
41
  export declare const makeSimpleHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body }: {
43
42
  headers: Headers;
44
43
  body: string;
45
- }) => import("../global.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, DefinitionNotFound | BadWebhookSignature | WebhookParseError | E, import("../types.js").InteractionResponse>;
44
+ }) => import("../utils/common.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, DefinitionNotFound | BadWebhookSignature | WebhookParseError | E, import("../types.js").InteractionResponse>;
46
45
  export {};
@@ -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 "@fp-ts/data/Context";
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 "@fp-ts/data/Function";
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 = tsplus_module_5.flow(makeConfig, tsplus_module_4.succeed(WebhookConfig));
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,11 +30,11 @@ export class WebhookParseError {
31
30
  this.reason = reason;
32
31
  }
33
32
  }
34
- const fromHeadersAndBody = (headers, body) => tsplus_module_6.flatMap(({ publicKey }) => tsplus_module_6.flatMap(() => tsplus_module_6.tryCatch(() => JSON.parse(body), (reason) => new WebhookParseError(reason)))(tsplus_module_6.fromEither(checkSignature(publicKey, headers, body))))(tsplus_module_6.service(WebhookConfig));
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) => tsplus_module_6.flatMap(interaction => {
38
- const provide = tsplus_module_6.provideService(InteractionContext)(interaction);
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
  };
@@ -44,7 +43,7 @@ const run = (definitions) => {
44
43
  */
45
44
  export const makeHandler = (ix) => {
46
45
  const handle = run(ix.definitions);
47
- return ({ headers, body, success, error, }) => tsplus_module_6.catchAllCause(error)(tsplus_module_6.flatMap(success)(handle(headers, body)));
46
+ return ({ headers, body, success, error, }) => tsplus_module_5.catchAllCause(error)(tsplus_module_5.flatMap(success)(handle(headers, body)));
48
47
  };
49
48
  /**
50
49
  * @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
@@ -1 +1 @@
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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BAAkB,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,GADrC,wBAAe,aAAa,CAAC,CAQrD,CAAA;AAEJ,MAAM,GAAG,GAAG,CAAO,WAA4C,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAA;IACrC,OAAO,CAAC,OAAgB,EAAE,IAAY,EAAE,EAAE,yBAEhC,WAAW;QACjB,MAAM,OAAO,GAAG,+BAAsB,kBAAkB,CAAC,CAAC,WAAW,CAAC,CAAA;eAC7D,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC;OAFlC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAGvD,CAAA;AACN,CAAC,CAAA;AASD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAO,EAA4B,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,GAAG,CAAC,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("../global.js").Effect<never, never, void>;
3
- debug: (...args: any[]) => import("../global.js").Effect<never, never, void>;
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("../global.js").Tag<Log>;
8
- export declare const LiveLog: import("../global.js").Layer<never, never, Log>;
9
- export declare const LiveLogDebug: import("../global.js").Layer<never, never, Log>;
10
- export declare const info: (...args: any[]) => import("../global.js").Effect<Log, never, void>;
11
- export declare const debug: (...args: any[]) => import("../global.js").Effect<Log, never, void>;
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 "@fp-ts/data/Context";
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(() => {
@@ -1,6 +1,4 @@
1
- import { Effect } from "@effect/io/Effect";
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("../global.js").Tag<RateLimitStore>;
18
- export declare const LiveMemoryRateLimitStore: import("../global.js").Layer<never, never, RateLimitStore>;
19
- declare const makeLimiter: import("../global.js").Effect<import("../Log/index.js").Log | RateLimitStore, never, {
20
- maybeWait: (key: string, window: Duration, limit: number, multiplier?: number) => import("../global.js").Effect<never, never, void>;
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("../global.js").Tag<RateLimiter>;
25
- export declare const LiveRateLimiter: import("../global.js").Layer<import("../Log/index.js").Log | RateLimitStore, never, RateLimiter>;
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 {};
@@ -1,4 +1,4 @@
1
- import * as tsplus_module_1 from "@fp-ts/data/Context";
1
+ import * as tsplus_module_1 from "dfx/utils/common";
2
2
  import * as tsplus_module_2 from "@effect/io/Layer";
3
3
  import * as tsplus_module_3 from "@effect/io/Effect";
4
4
  import * as tsplus_module_4 from "dfx";
@@ -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,CA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C,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"}
@@ -1,2 +1,2 @@
1
- import { Duration } from "@fp-ts/data/Duration";
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("./global.js").Layer<import("./Log/index.js").Log, never, import("./index.js").RateLimitStore | import("./index.js").RateLimiter>;
10
- export declare const MemoryREST: import("./global.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./index.js").DiscordREST>;
11
- export declare const MemorySharder: import("./global.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("./global.js").Layer<import("./Log/index.js").Log | import("./DiscordConfig/index.js").DiscordConfig, never, import("./DiscordGateway/index.js").DiscordGateway>;
13
- export declare const MemoryBot: import("./global.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("./global.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>;
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 type { Effect } from "@effect/io/Effect";
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 { Tag } from "@fp-ts/data/Context";
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":"AAqCA,OAAO,EAAW,GAAG,EAAE,MAAM,qBAAqB,CAAA"}
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.1",
3
+ "version": "0.20.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -28,7 +28,7 @@
28
28
  "typescript": "https://cdn.jsdelivr.net/npm/@tsplus/installer/compiler/typescript.tgz"
29
29
  },
30
30
  "dependencies": {
31
- "callbag-effect-ts": "1.0.0-alpha.20",
31
+ "callbag-effect-ts": "1.0.0-alpha.22",
32
32
  "ts-toolbelt": "^9.6.0",
33
33
  "tweetnacl": "^1.0.3"
34
34
  },
@@ -49,5 +49,5 @@
49
49
  "@fp-ts/data": "^0.0.25"
50
50
  }
51
51
  },
52
- "gitHead": "b723492f760de9df2f325e1c0684ce245b8e093e"
52
+ "gitHead": "437870424ec234e17f2841439fd321200db374ca"
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";
@@ -0,0 +1,3 @@
1
+ export { Tag } from "@fp-ts/data/Context";
2
+ export { pipe, flow, identity } from "@fp-ts/data/Function";
3
+ //# sourceMappingURL=common.js.map
@@ -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 "@effect/io/Effect";
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("./global.js").Layer<import("./Log/index.js").Log, never, import("./index.js").RateLimitStore | import("./index.js").RateLimiter>;
5
- export declare const MemoryREST: import("./global.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("./global.js").Layer<never, never, import("./index.js").DiscordREST | import("./index.js").RateLimitStore | import("./index.js").RateLimiter | import("./Interactions/webhook.js").WebhookConfig>;
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>;