dfx 0.45.5 → 0.45.6

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 (144) hide show
  1. package/package.json +2 -2
  2. package/src/package.json +2 -2
  3. package/tsconfig.json +2 -15
  4. package/Cache/driver.d.ts +0 -22
  5. package/Cache/driver.js +0 -3
  6. package/Cache/driver.js.map +0 -1
  7. package/Cache/memory.d.ts +0 -3
  8. package/Cache/memory.js +0 -48
  9. package/Cache/memory.js.map +0 -1
  10. package/Cache/memoryTTL.d.ts +0 -20
  11. package/Cache/memoryTTL.js +0 -121
  12. package/Cache/memoryTTL.js.map +0 -1
  13. package/Cache/prelude.d.ts +0 -56
  14. package/Cache/prelude.js +0 -108
  15. package/Cache/prelude.js.map +0 -1
  16. package/Cache.d.ts +0 -75
  17. package/Cache.js +0 -62
  18. package/Cache.js.map +0 -1
  19. package/DiscordConfig.d.ts +0 -28
  20. package/DiscordConfig.js +0 -29
  21. package/DiscordConfig.js.map +0 -1
  22. package/DiscordGateway/DiscordWS.d.ts +0 -31
  23. package/DiscordGateway/DiscordWS.js +0 -31
  24. package/DiscordGateway/DiscordWS.js.map +0 -1
  25. package/DiscordGateway/Shard/heartbeats.d.ts +0 -3
  26. package/DiscordGateway/Shard/heartbeats.js +0 -17
  27. package/DiscordGateway/Shard/heartbeats.js.map +0 -1
  28. package/DiscordGateway/Shard/identify.d.ts +0 -12
  29. package/DiscordGateway/Shard/identify.js +0 -26
  30. package/DiscordGateway/Shard/identify.js.map +0 -1
  31. package/DiscordGateway/Shard/invalidSession.d.ts +0 -3
  32. package/DiscordGateway/Shard/invalidSession.js +0 -6
  33. package/DiscordGateway/Shard/invalidSession.js.map +0 -1
  34. package/DiscordGateway/Shard/sendEvents.d.ts +0 -7
  35. package/DiscordGateway/Shard/sendEvents.js +0 -25
  36. package/DiscordGateway/Shard/sendEvents.js.map +0 -1
  37. package/DiscordGateway/Shard/utils.d.ts +0 -3
  38. package/DiscordGateway/Shard/utils.js +0 -9
  39. package/DiscordGateway/Shard/utils.js.map +0 -1
  40. package/DiscordGateway/Shard.d.ts +0 -16
  41. package/DiscordGateway/Shard.js +0 -85
  42. package/DiscordGateway/Shard.js.map +0 -1
  43. package/DiscordGateway/ShardStore.d.ts +0 -12
  44. package/DiscordGateway/ShardStore.js +0 -22
  45. package/DiscordGateway/ShardStore.js.map +0 -1
  46. package/DiscordGateway/Sharder.d.ts +0 -15
  47. package/DiscordGateway/Sharder.js +0 -51
  48. package/DiscordGateway/Sharder.js.map +0 -1
  49. package/DiscordGateway/WS.d.ts +0 -31
  50. package/DiscordGateway/WS.js +0 -77
  51. package/DiscordGateway/WS.js.map +0 -1
  52. package/DiscordGateway.d.ts +0 -12
  53. package/DiscordGateway.js +0 -29
  54. package/DiscordGateway.js.map +0 -1
  55. package/DiscordREST/types.d.ts +0 -7
  56. package/DiscordREST/types.js +0 -2
  57. package/DiscordREST/types.js.map +0 -1
  58. package/DiscordREST/utils.d.ts +0 -10
  59. package/DiscordREST/utils.js +0 -21
  60. package/DiscordREST/utils.js.map +0 -1
  61. package/DiscordREST.d.ts +0 -16
  62. package/DiscordREST.js +0 -123
  63. package/DiscordREST.js.map +0 -1
  64. package/Helpers/flags.d.ts +0 -27
  65. package/Helpers/flags.js +0 -36
  66. package/Helpers/flags.js.map +0 -1
  67. package/Helpers/intents.d.ts +0 -24
  68. package/Helpers/intents.js +0 -29
  69. package/Helpers/intents.js.map +0 -1
  70. package/Helpers/interactions.d.ts +0 -96
  71. package/Helpers/interactions.js +0 -97
  72. package/Helpers/interactions.js.map +0 -1
  73. package/Helpers/members.d.ts +0 -9
  74. package/Helpers/members.js +0 -10
  75. package/Helpers/members.js.map +0 -1
  76. package/Helpers/permissions.d.ts +0 -40
  77. package/Helpers/permissions.js +0 -83
  78. package/Helpers/permissions.js.map +0 -1
  79. package/Helpers/ui.d.ts +0 -47
  80. package/Helpers/ui.js +0 -66
  81. package/Helpers/ui.js.map +0 -1
  82. package/Interactions/builder.d.ts +0 -48
  83. package/Interactions/builder.js +0 -68
  84. package/Interactions/builder.js.map +0 -1
  85. package/Interactions/context.d.ts +0 -58
  86. package/Interactions/context.js +0 -61
  87. package/Interactions/context.js.map +0 -1
  88. package/Interactions/definitions.d.ts +0 -126
  89. package/Interactions/definitions.js +0 -53
  90. package/Interactions/definitions.js.map +0 -1
  91. package/Interactions/gateway.d.ts +0 -20
  92. package/Interactions/gateway.js +0 -39
  93. package/Interactions/gateway.js.map +0 -1
  94. package/Interactions/handlers.d.ts +0 -10
  95. package/Interactions/handlers.js +0 -45
  96. package/Interactions/handlers.js.map +0 -1
  97. package/Interactions/index.d.ts +0 -10
  98. package/Interactions/index.js +0 -12
  99. package/Interactions/index.js.map +0 -1
  100. package/Interactions/utils.d.ts +0 -78
  101. package/Interactions/utils.js +0 -74
  102. package/Interactions/utils.js.map +0 -1
  103. package/Interactions/webhook.d.ts +0 -45
  104. package/Interactions/webhook.js +0 -56
  105. package/Interactions/webhook.js.map +0 -1
  106. package/Log.d.ts +0 -10
  107. package/Log.js +0 -17
  108. package/Log.js.map +0 -1
  109. package/RateLimit/memory.d.ts +0 -2
  110. package/RateLimit/memory.js +0 -35
  111. package/RateLimit/memory.js.map +0 -1
  112. package/RateLimit/utils.d.ts +0 -2
  113. package/RateLimit/utils.js +0 -18
  114. package/RateLimit/utils.js.map +0 -1
  115. package/RateLimit.d.ts +0 -25
  116. package/RateLimit.js +0 -25
  117. package/RateLimit.js.map +0 -1
  118. package/_common.d.ts +0 -36
  119. package/_common.js +0 -8
  120. package/_common.js.map +0 -1
  121. package/gateway.d.ts +0 -13
  122. package/gateway.js +0 -25
  123. package/gateway.js.map +0 -1
  124. package/global.d.ts +0 -17
  125. package/global.js +0 -2
  126. package/global.js.map +0 -1
  127. package/index.d.ts +0 -13
  128. package/index.js +0 -14
  129. package/index.js.map +0 -1
  130. package/types.d.ts +0 -4449
  131. package/types.js +0 -1204
  132. package/types.js.map +0 -1
  133. package/utils/effect.d.ts +0 -1
  134. package/utils/effect.js +0 -2
  135. package/utils/effect.js.map +0 -1
  136. package/utils/hub.d.ts +0 -11
  137. package/utils/hub.js +0 -23
  138. package/utils/hub.js.map +0 -1
  139. package/utils/tsplus.d.ts +0 -12
  140. package/utils/tsplus.js +0 -2
  141. package/utils/tsplus.js.map +0 -1
  142. package/webhooks.d.ts +0 -9
  143. package/webhooks.js +0 -22
  144. package/webhooks.js.map +0 -1
@@ -1 +0,0 @@
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,WAAW,EAAE,MAAM,YAAY,CAAA;AAC5D,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;IACV,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAA;IAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC9B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,EAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EACzB,SAAS,CACV,CAAA;AACH,CAAC,EAXH,uBAAa;IACX,SAAS,EAAE,6BAAmB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7D,SAAS,EAAE,6BAAmB,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAChE,CAAC,CAQE,CACwC,CAAO,CAAA;AAMrD,MAAM,UAAU,GAA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Z,CAEH,CAAA;AACN,CAAC,CAAA;AASD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAW,EAAgC,EAAE,EAAE;IACxE,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,EACN,OAAO,EACP,IAAI,EACJ,OAAO,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 DELETED
@@ -1,10 +0,0 @@
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 {};
package/Log.js DELETED
@@ -1,17 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- import { RateLimitStore } from "../RateLimit.js";
2
- export declare const make: () => RateLimitStore;
@@ -1,35 +0,0 @@
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
@@ -1 +0,0 @@
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,IA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,0BAAA,UAAU,CAAC,GAAG,CAAC,EAC7B,GAAY,EAAE,CAAC,CAAC;gBACd,OAAO,EAAE,GAAG;gBACZ,KAAK,EAAE,CAAC;aACT,CAAC,CACH,CAAA;YAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAA;YAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,UAAU,CAAA;YAC5C,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;YAEjD,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC,CAAA;QAC/B,CAAC,CAAC;KACL,CAAA;AACH,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- import { Duration } from "dfx/_common";
2
- export declare const delayFrom: (window: number, limit: number, count: number, ttl: number) => Duration;
@@ -1,18 +0,0 @@
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
@@ -1 +0,0 @@
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 DELETED
@@ -1,25 +0,0 @@
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 {};
package/RateLimit.js DELETED
@@ -1,25 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,36 +0,0 @@
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>;
package/_common.js DELETED
@@ -1,8 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
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>;
package/gateway.js DELETED
@@ -1,25 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,17 +0,0 @@
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 {};
package/global.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=global.js.map
package/global.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["src/global.ts"],"names":[],"mappings":""}
package/index.d.ts DELETED
@@ -1,13 +0,0 @@
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";
package/index.js DELETED
@@ -1,14 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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"}