dfx 0.21.5 → 0.21.7

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 (111) hide show
  1. package/Cache/driver.d.ts +16 -16
  2. package/Cache/driver.js.map +1 -1
  3. package/Cache/index.d.ts +21 -21
  4. package/Cache/index.js +2 -3
  5. package/Cache/index.js.map +1 -1
  6. package/Cache/memory.d.ts +3 -3
  7. package/Cache/memory.js +19 -18
  8. package/Cache/memory.js.map +1 -1
  9. package/Cache/memoryTTL.d.ts +5 -5
  10. package/Cache/memoryTTL.js +15 -15
  11. package/Cache/memoryTTL.js.map +1 -1
  12. package/Cache/prelude.d.ts +37 -37
  13. package/Cache/prelude.js +5 -6
  14. package/Cache/prelude.js.map +1 -1
  15. package/DiscordConfig/index.d.ts +4 -4
  16. package/DiscordConfig/index.js +8 -5
  17. package/DiscordConfig/index.js.map +1 -1
  18. package/DiscordGateway/DiscordWS/index.d.ts +8 -9
  19. package/DiscordGateway/DiscordWS/index.js +19 -16
  20. package/DiscordGateway/DiscordWS/index.js.map +1 -1
  21. package/DiscordGateway/Shard/heartbeats.d.ts +3 -3
  22. package/DiscordGateway/Shard/heartbeats.js +12 -10
  23. package/DiscordGateway/Shard/heartbeats.js.map +1 -1
  24. package/DiscordGateway/Shard/identify.d.ts +4 -5
  25. package/DiscordGateway/Shard/identify.js +4 -4
  26. package/DiscordGateway/Shard/identify.js.map +1 -1
  27. package/DiscordGateway/Shard/index.d.ts +7 -8
  28. package/DiscordGateway/Shard/index.js +17 -17
  29. package/DiscordGateway/Shard/index.js.map +1 -1
  30. package/DiscordGateway/Shard/invalidSession.d.ts +2 -2
  31. package/DiscordGateway/Shard/invalidSession.js +7 -5
  32. package/DiscordGateway/Shard/invalidSession.js.map +1 -1
  33. package/DiscordGateway/Shard/utils.d.ts +3 -3
  34. package/DiscordGateway/Shard/utils.js +5 -5
  35. package/DiscordGateway/Shard/utils.js.map +1 -1
  36. package/DiscordGateway/ShardStore/index.d.ts +6 -6
  37. package/DiscordGateway/ShardStore/index.js +10 -7
  38. package/DiscordGateway/ShardStore/index.js.map +1 -1
  39. package/DiscordGateway/Sharder/index.d.ts +10 -12
  40. package/DiscordGateway/Sharder/index.js +15 -14
  41. package/DiscordGateway/Sharder/index.js.map +1 -1
  42. package/DiscordGateway/WS/index.d.ts +3 -3
  43. package/DiscordGateway/WS/index.js +12 -11
  44. package/DiscordGateway/WS/index.js.map +1 -1
  45. package/DiscordGateway/index.d.ts +8 -8
  46. package/DiscordGateway/index.js +9 -8
  47. package/DiscordGateway/index.js.map +1 -1
  48. package/DiscordREST/index.d.ts +136 -136
  49. package/DiscordREST/index.js +39 -36
  50. package/DiscordREST/index.js.map +1 -1
  51. package/DiscordREST/types.d.ts +4 -4
  52. package/DiscordREST/utils.d.ts +4 -5
  53. package/DiscordREST/utils.js +5 -5
  54. package/DiscordREST/utils.js.map +1 -1
  55. package/Helpers/intents.js +9 -8
  56. package/Helpers/intents.js.map +1 -1
  57. package/Helpers/interactions.d.ts +18 -18
  58. package/Helpers/interactions.js +23 -22
  59. package/Helpers/interactions.js.map +1 -1
  60. package/Helpers/members.d.ts +3 -3
  61. package/Helpers/members.js.map +1 -1
  62. package/Helpers/permissions.d.ts +4 -5
  63. package/Helpers/permissions.js +14 -13
  64. package/Helpers/permissions.js.map +1 -1
  65. package/Http/index.d.ts +9 -10
  66. package/Http/index.js +8 -7
  67. package/Http/index.js.map +1 -1
  68. package/Interactions/context.d.ts +23 -22
  69. package/Interactions/context.js +25 -22
  70. package/Interactions/context.js.map +1 -1
  71. package/Interactions/definitions.d.ts +29 -30
  72. package/Interactions/definitions.js +2 -1
  73. package/Interactions/definitions.js.map +1 -1
  74. package/Interactions/gateway.d.ts +3 -4
  75. package/Interactions/gateway.js +6 -6
  76. package/Interactions/gateway.js.map +1 -1
  77. package/Interactions/handlers.d.ts +2 -2
  78. package/Interactions/handlers.js +18 -17
  79. package/Interactions/handlers.js.map +1 -1
  80. package/Interactions/index.d.ts +7 -7
  81. package/Interactions/index.js +7 -8
  82. package/Interactions/index.js.map +1 -1
  83. package/Interactions/webhook.d.ts +7 -7
  84. package/Interactions/webhook.js +13 -11
  85. package/Interactions/webhook.js.map +1 -1
  86. package/Log/index.d.ts +8 -8
  87. package/Log/index.js +11 -9
  88. package/Log/index.js.map +1 -1
  89. package/RateLimit/index.d.ts +12 -13
  90. package/RateLimit/index.js +12 -11
  91. package/RateLimit/index.js.map +1 -1
  92. package/RateLimit/memory.js +7 -7
  93. package/RateLimit/memory.js.map +1 -1
  94. package/RateLimit/utils.d.ts +1 -1
  95. package/RateLimit/utils.js.map +1 -1
  96. package/_common.d.ts +22 -18
  97. package/_common.js +0 -18
  98. package/_common.js.map +1 -1
  99. package/gateway.d.ts +6 -7
  100. package/gateway.js +0 -2
  101. package/gateway.js.map +1 -1
  102. package/global.d.ts +21 -0
  103. package/global.js +2 -0
  104. package/global.js.map +1 -0
  105. package/package.json +3 -3
  106. package/utils/effect.d.ts +9 -8
  107. package/utils/effect.js +4 -4
  108. package/utils/effect.js.map +1 -1
  109. package/webhooks.d.ts +4 -5
  110. package/webhooks.js +3 -5
  111. package/webhooks.js.map +1 -1
@@ -1,9 +1,10 @@
1
- import * as tsplus_module_1 from "@fp-ts/data/Option";
2
- import * as tsplus_module_2 from "@fp-ts/data/Chunk";
3
- import * as tsplus_module_3 from "@effect/io/Effect";
1
+ import * as tsplus_module_1 from "dfx/_common";
2
+ import * as tsplus_module_2 from "@effect/io/Effect";
3
+ import * as tsplus_module_3 from "@fp-ts/data/Option";
4
+ import * as tsplus_module_4 from "@fp-ts/data/Function";
5
+ import * as tsplus_module_5 from "@fp-ts/data/Chunk";
6
+ import * as tsplus_module_6 from "dfx";
4
7
  import * as Arr from "@fp-ts/data/ReadonlyArray";
5
- import { IxHelpers } from "dfx";
6
- import { Effect, Option, pipe } from "dfx/_common";
7
8
  import * as Ctx from "./context.js";
8
9
  import { splitDefinitions } from "./utils.js";
9
10
  export class DefinitionNotFound {
@@ -23,35 +24,35 @@ const context = {
23
24
  export const handlers = (definitions) => {
24
25
  const { Commands, Autocomplete, MessageComponent, ModalSubmit } = splitDefinitions(definitions);
25
26
  return {
26
- [1 /* Discord.InteractionType.PING */]: () => Effect.succeed({
27
+ [1 /* Discord.InteractionType.PING */]: () => tsplus_module_2.succeed({
27
28
  type: 1 /* Discord.InteractionCallbackType.PONG */,
28
29
  }),
29
30
  [2 /* Discord.InteractionType.APPLICATION_COMMAND */]: (i) => {
30
31
  const data = i.data;
31
- return pipe(tsplus_module_1.match(() => Effect.fail(new DefinitionNotFound(i)), (command) => Effect.isEffect(command.handle)
32
+ return tsplus_module_4.pipe(tsplus_module_3.match(() => tsplus_module_2.fail(new DefinitionNotFound(i)), (command) => tsplus_module_2.isEffect(command.handle)
32
33
  ? command.handle
33
- : command.handle(context))(Option.fromNullable(Commands[data.name])), (a) => a, Effect.provideService(Ctx.ApplicationCommandContext)(data));
34
+ : command.handle(context))(tsplus_module_3.fromNullable(Commands[data.name])), (a) => a, tsplus_module_2.provideService(Ctx.ApplicationCommandContext)(data));
34
35
  },
35
36
  [5 /* Discord.InteractionType.MODAL_SUBMIT */]: (i) => {
36
37
  const data = i.data;
37
- return pipe(ModalSubmit, Arr.map((a) => Effect.struct({
38
- command: Effect.succeed(a),
38
+ return tsplus_module_4.pipe(ModalSubmit, Arr.map((a) => tsplus_module_2.struct({
39
+ command: tsplus_module_2.succeed(a),
39
40
  match: a.predicate(data.custom_id),
40
- })), (a) => tsplus_module_3.flatMap((a) => tsplus_module_1.match(() => Effect.fail(new DefinitionNotFound(i)), (a) => a.command.handle)(tsplus_module_2.findFirst((a) => a.match)(a)))(tsplus_module_3.collectAllPar(a)), Effect.provideService(Ctx.ModalSubmitContext)(data));
41
+ })), (a) => tsplus_module_2.flatMap((a) => tsplus_module_3.match(() => tsplus_module_2.fail(new DefinitionNotFound(i)), (a) => a.command.handle)(tsplus_module_5.findFirst((a) => a.match)(a)))(tsplus_module_2.collectAllPar(a)), tsplus_module_2.provideService(Ctx.ModalSubmitContext)(data));
41
42
  },
42
43
  [3 /* Discord.InteractionType.MESSAGE_COMPONENT */]: (i) => {
43
44
  const data = i.data;
44
- return pipe(MessageComponent, Arr.map((a) => Effect.struct({
45
- command: Effect.succeed(a),
45
+ return tsplus_module_4.pipe(MessageComponent, Arr.map((a) => tsplus_module_2.struct({
46
+ command: tsplus_module_2.succeed(a),
46
47
  match: a.predicate(data.custom_id),
47
- })), (a) => tsplus_module_3.flatMap((a) => tsplus_module_1.match(() => Effect.fail(new DefinitionNotFound(i)), (a) => a.command.handle)(tsplus_module_2.findFirst((a) => a.match)(a)))(tsplus_module_3.collectAllPar(a)), Effect.provideService(Ctx.MessageComponentContext)(data));
48
+ })), (a) => tsplus_module_2.flatMap((a) => tsplus_module_3.match(() => tsplus_module_2.fail(new DefinitionNotFound(i)), (a) => a.command.handle)(tsplus_module_5.findFirst((a) => a.match)(a)))(tsplus_module_2.collectAllPar(a)), tsplus_module_2.provideService(Ctx.MessageComponentContext)(data));
48
49
  },
49
50
  [4 /* Discord.InteractionType.APPLICATION_COMMAND_AUTOCOMPLETE */]: (i) => {
50
51
  const data = i.data;
51
- return tsplus_module_1.getOrElse(() => Effect.fail(new DefinitionNotFound(i)))(tsplus_module_1.map((focusedOption) => pipe(Autocomplete, Arr.map((a) => Effect.struct({
52
- command: Effect.succeed(a),
52
+ return tsplus_module_3.getOrElse(() => tsplus_module_2.fail(new DefinitionNotFound(i)))(tsplus_module_3.map((focusedOption) => tsplus_module_4.pipe(Autocomplete, Arr.map((a) => tsplus_module_2.struct({
53
+ command: tsplus_module_2.succeed(a),
53
54
  match: a.predicate(data, focusedOption),
54
- })), (a) => tsplus_module_3.flatMap((a) => tsplus_module_1.match(() => Effect.fail(new DefinitionNotFound(i)), (a) => a.command.handle)(tsplus_module_2.findFirst((a) => a.match)(a)))(tsplus_module_3.collectAllPar(a)), Effect.provideService(Ctx.ApplicationCommandContext)(data), Effect.provideService(Ctx.FocusedOptionContext)({ focusedOption })))(IxHelpers.focusedOption(data)));
55
+ })), (a) => tsplus_module_2.flatMap((a) => tsplus_module_3.match(() => tsplus_module_2.fail(new DefinitionNotFound(i)), (a) => a.command.handle)(tsplus_module_5.findFirst((a) => a.match)(a)))(tsplus_module_2.collectAllPar(a)), tsplus_module_2.provideService(Ctx.ApplicationCommandContext)(data), tsplus_module_2.provideService(Ctx.FocusedOptionContext)({ focusedOption })))(tsplus_module_6.IxHelpers.focusedOption(data)));
55
56
  },
56
57
  };
57
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/Interactions/handlers.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAW,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,OAAO,kBAAkB;IAER;IADZ,IAAI,GAAG,oBAAoB,CAAA;IACpC,YAAqB,WAAgC;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IAAG,CAAC;CAC1D;AAQD,MAAM,OAAO,GAAyB;IACpC,OAAO,EAAE,GAAG,CAAC,QAAQ;IACrB,MAAM,EAAE,GAAG,CAAC,MAAM;IAClB,WAAW,EAAE,GAAG,CAAC,WAAW;IAC5B,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;IAC5C,WAAW,EAAE,GAAG,CAAC,iBAAiB;CAC5B,CAAA;AAER,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,WAA4C,EAI5C,EAAE;IACF,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAC7D,gBAAgB,CAAC,WAAW,CAAC,CAAA;IAE/B,O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,CAAC,CAAC,IAAI,CAAC,CACzD,CAAA;QACH,CAAC;QAED,kEAA0D,EAAE,CAAC,CAAC,EAAE,EAAE;YAChE,MAAM,IAAI,GAAG,CAAC,CAAC,IAAuC,CAAA;YAEtD,OAAO,0BAwBM,GAAG,EAAE,CAAC,qBAAY,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAxBlD,oBACA,CAAC,aAAa,EAAE,EAAE,CACrB,gBAAA,IAAI,CACF,YAAY,EACZ,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACZ,uBAAc;gBACZ,OAAO,EAAE,wBAAe,CAAC,CAAC;gBAC1B,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC;aACxC,CAAC,CACH,EACD,CAAC,CAAC,EAAE,EAAE,CACJ,wBAAwB,CAAC,CAAC,EAAE,EAAE,CAC5B,sBAGI,GAAG,EAAE,CACH,qBAAY,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAkB,EACzD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAL3B,0BACa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAD3B,CAAC,CAC2B,CAKzB,gCAPL,CAAC,EAQA,EACH,+BAAsB,GAAG,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,EAC1D,+BAAsB,GAAG,CAAC,oBAAoB,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CACnE,EAtBE,gBAAA,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAuBjC,CACuD,CAAA;QAC5D,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -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(): Effect.Effect<DiscordREST, import("dfx").FetchError | import("dfx").StatusCodeError | import("dfx").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<Discord.ApplicationCommand[]>>;
16
- syncGuild(appId: Discord.Snowflake, guildId: Discord.Snowflake): Effect.Effect<DiscordREST, import("dfx").FetchError | import("dfx").StatusCodeError | import("dfx").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<Discord.ApplicationCommand[]>>;
15
+ get syncGlobal(): Effect<DiscordREST, import("dfx").FetchError | import("dfx").StatusCodeError | import("dfx").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<Discord.ApplicationCommand[]>>;
16
+ syncGuild(appId: Discord.Snowflake, guildId: Discord.Snowflake): Effect<DiscordREST, import("dfx").FetchError | import("dfx").StatusCodeError | import("dfx").JsonParseError, import("../DiscordREST/types.js").ResponseWithData<Discord.ApplicationCommand[]>>;
17
17
  }
18
18
  export declare const builder: InteractionBuilder<never, never>;
19
- export declare const id: (query: string) => (customId: string) => Effect.Effect<never, never, boolean>;
20
- export declare const idStartsWith: (query: string) => (customId: string) => Effect.Effect<never, never, boolean>;
21
- export declare const idRegex: (query: RegExp) => (customId: string) => Effect.Effect<never, never, boolean>;
22
- export declare const option: (command: string, optionName: string) => (data: Pick<Discord.ApplicationCommandDatum, "name">, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => Effect.Effect<never, never, boolean>;
23
- export declare const optionOnly: (optionName: string) => (_: unknown, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => Effect.Effect<never, never, boolean>;
19
+ export declare const id: (query: string) => (customId: string) => Effect<never, never, boolean>;
20
+ export declare const idStartsWith: (query: string) => (customId: string) => Effect<never, never, boolean>;
21
+ export declare const idRegex: (query: RegExp) => (customId: string) => Effect<never, never, boolean>;
22
+ export declare const option: (command: string, optionName: string) => (data: Pick<Discord.ApplicationCommandDatum, "name">, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => Effect<never, never, boolean>;
23
+ export declare const optionOnly: (optionName: string) => (_: unknown, focusedOption: Pick<Discord.ApplicationCommandInteractionDataOption, "name">) => Effect<never, never, boolean>;
@@ -1,6 +1,5 @@
1
1
  import * as tsplus_module_1 from "@effect/io/Effect";
2
2
  import { DiscordREST } from "dfx";
3
- import { Effect } from "dfx/_common";
4
3
  export { response as r } from "../Helpers/interactions.js";
5
4
  export * from "./context.js";
6
5
  export { autocomplete, global, guild, messageComponent, modalSubmit, } from "./definitions.js";
@@ -28,7 +27,7 @@ export class InteractionBuilder {
28
27
  const commands = this.definitions
29
28
  .filter((c) => c._tag === "GlobalApplicationCommand")
30
29
  .map((c) => c.command);
31
- return Effect.serviceWithEffect(DiscordREST)((rest) => tsplus_module_1.flatMap((app) => rest.bulkOverwriteGlobalApplicationCommands(app.id, {
30
+ return tsplus_module_1.serviceWithEffect(DiscordREST)((rest) => tsplus_module_1.flatMap((app) => rest.bulkOverwriteGlobalApplicationCommands(app.id, {
32
31
  body: JSON.stringify(commands),
33
32
  }))(tsplus_module_1.flatMap((r) => r.json)(rest
34
33
  .getCurrentBotApplicationInformation())));
@@ -37,14 +36,14 @@ export class InteractionBuilder {
37
36
  const commands = this.definitions
38
37
  .filter((c) => c._tag === "GuildApplicationCommand")
39
38
  .map((c) => c.command);
40
- return Effect.serviceWithEffect(DiscordREST)((rest) => rest.bulkOverwriteGuildApplicationCommands(appId, guildId, commands));
39
+ return tsplus_module_1.serviceWithEffect(DiscordREST)((rest) => rest.bulkOverwriteGuildApplicationCommands(appId, guildId, commands));
41
40
  }
42
41
  }
43
42
  export const builder = new InteractionBuilder([]);
44
43
  // Filters
45
- export const id = (query) => (customId) => Effect.succeed(query === customId);
46
- export const idStartsWith = (query) => (customId) => Effect.succeed(customId.startsWith(query));
47
- export const idRegex = (query) => (customId) => Effect.succeed(query.test(customId));
48
- export const option = (command, optionName) => (data, focusedOption) => Effect.succeed(data.name === command && focusedOption.name === optionName);
49
- export const optionOnly = (optionName) => (_, focusedOption) => Effect.succeed(focusedOption.name === optionName);
44
+ export const id = (query) => (customId) => tsplus_module_1.succeed(query === customId);
45
+ export const idStartsWith = (query) => (customId) => tsplus_module_1.succeed(customId.startsWith(query));
46
+ export const idRegex = (query) => (customId) => tsplus_module_1.succeed(query.test(customId));
47
+ export const option = (command, optionName) => (data, focusedOption) => tsplus_module_1.succeed(data.name === command && focusedOption.name === optionName);
48
+ export const optionOnly = (optionName) => (_, focusedOption) => tsplus_module_1.succeed(focusedOption.name === optionName);
50
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Interactions/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AACjC,OAAO,EAAW,MAAM,EAAE,MAAM,aAAa,CAAA;AAG7C,OAAO,EAAE,QAAQ,IAAI,CAAC,EAAE,MAAM,4BAA4B,CAAA;AAC1D,cAAc,cAAc,CAAA;AAC5B,OAAO,EACL,YAAY,EACZ,MAAM,EACN,KAAK,EAEL,gBAAgB,EAChB,WAAW,GACZ,MAAM,kBAAkB,CAAA;AAEzB;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACR;IAArB,YAAqB,WAA4C;QAA5C,gBAAW,GAAX,WAAW,CAAiC;IAAG,CAAC;IAErE,GAAG,CAAS,UAA2C;QACrD,OAAO,IAAI,kBAAkB,CAAiB;YAC5C,GAAG,IAAI,CAAC,WAAW;YACnB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAS,OAAmC;QAChD,OAAO,IAAI,kBAAkB,CAAiB;YAC5C,GAAG,IAAI,CAAC,WAAW;YACnB,GAAG,OAAO,CAAC,WAAW;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,UAAU;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW;aAC9B,MAAM,CACL,CAAC,CAAC,EAAyC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AAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,QAAgB,EAAE,EAAE,CACxD,wBAAe,KAAK,KAAK,QAAQ,CAAC,CAAA;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,QAAgB,EAAE,EAAE,CAClE,wBAAe,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,QAAgB,EAAE,EAAE,CAC7D,wBAAe,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEtC,MAAM,CAAC,MAAM,MAAM,GACjB,CAAC,OAAe,EAAE,UAAkB,EAAE,EAAE,CACxC,CACE,IAAmD,EACnD,aAGC,EACD,EAAE,CACF,wBAAe,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,aAAa,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;AAE9E,MAAM,CAAC,MAAM,UAAU,GACrB,CAAC,UAAkB,EAAE,EAAE,CACvB,CACE,CAAU,EACV,aAGC,EACD,EAAE,CACF,wBAAe,aAAa,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Cause, Context, Discord, Effect, Layer } from "dfx/_common";
1
+ import { Discord, Effect, Cause } from "dfx/_common";
2
2
  import { DefinitionNotFound } from "./handlers.js";
3
3
  import { InteractionBuilder } from "./index.js";
4
4
  export declare class BadWebhookSignature {
@@ -15,8 +15,8 @@ declare const makeConfig: ({ applicationId, publicKey }: MakeConfigOpts) => {
15
15
  };
16
16
  export interface WebhookConfig extends ReturnType<typeof makeConfig> {
17
17
  }
18
- export declare const WebhookConfig: Context.Tag<WebhookConfig>;
19
- export declare const makeConfigLayer: (a_0: MakeConfigOpts) => Layer.Layer<never, never, WebhookConfig>;
18
+ export declare const WebhookConfig: import("../_common.js").Tag<WebhookConfig>;
19
+ export declare const makeConfigLayer: (a_0: MakeConfigOpts) => import("../_common.js").Layer<never, never, WebhookConfig>;
20
20
  export declare class WebhookParseError {
21
21
  readonly reason: unknown;
22
22
  readonly _tag = "WebhookParseError";
@@ -25,14 +25,14 @@ export declare class WebhookParseError {
25
25
  export interface HandleWebhookOpts<E> {
26
26
  headers: Headers;
27
27
  body: string;
28
- success: (a: Discord.InteractionResponse) => Effect.Effect<never, never, void>;
29
- error: (e: Cause.Cause<E>) => Effect.Effect<never, never, void>;
28
+ success: (a: Discord.InteractionResponse) => Effect<never, never, void>;
29
+ error: (e: Cause<E>) => Effect<never, never, void>;
30
30
  }
31
31
  /**
32
32
  * @tsplus getter dfx/InteractionBuilder webhookHandler
33
33
  * @tsplus location "dfx/Interactions/webhook"
34
34
  */
35
- export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body, success, error, }: HandleWebhookOpts<DefinitionNotFound | BadWebhookSignature | WebhookParseError | E>) => Effect.Effect<WebhookConfig | Exclude<R, Discord.Interaction>, never, void>;
35
+ export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body, success, error, }: HandleWebhookOpts<DefinitionNotFound | BadWebhookSignature | WebhookParseError | E>) => import("../_common.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, never, void>;
36
36
  /**
37
37
  * @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
38
38
  * @tsplus location "dfx/Interactions/webhook"
@@ -40,5 +40,5 @@ export declare const makeHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ hea
40
40
  export declare const makeSimpleHandler: <R, E>(ix: InteractionBuilder<R, E>) => ({ headers, body }: {
41
41
  headers: Headers;
42
42
  body: string;
43
- }) => Effect.Effect<WebhookConfig | Exclude<R, Discord.Interaction>, DefinitionNotFound | BadWebhookSignature | WebhookParseError | E, Discord.InteractionResponse>;
43
+ }) => import("../_common.js").Effect<WebhookConfig | Exclude<R, import("../types.js").Interaction>, DefinitionNotFound | BadWebhookSignature | WebhookParseError | E, import("../types.js").InteractionResponse>;
44
44
  export {};
@@ -1,7 +1,9 @@
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 "@effect/io/Effect";
4
- import { Context, Effect, flow, Layer, Option, } from "dfx/_common";
3
+ import * as tsplus_module_3 from "dfx/_common";
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
7
  import Nacl from "tweetnacl";
6
8
  import { handlers } from "./handlers.js";
7
9
  import { InteractionContext } from "./index.js";
@@ -12,16 +14,16 @@ export class BadWebhookSignature {
12
14
  const checkSignature = (publicKey, headers, body) => tsplus_module_2.asUnit(tsplus_module_1.toEither(() => new BadWebhookSignature())(tsplus_module_1.filter((a) => {
13
15
  const enc = new TextEncoder();
14
16
  return Nacl.sign.detached.verify(enc.encode(a.timestamp + body), fromHex(`${a.signature}`), publicKey);
15
- })(Option.struct({
16
- signature: Option.fromNullable(headers["x-signature-ed25519"]),
17
- timestamp: Option.fromNullable(headers["x-signature-timestamp"]),
17
+ })(tsplus_module_1.struct({
18
+ signature: tsplus_module_1.fromNullable(headers["x-signature-ed25519"]),
19
+ timestamp: tsplus_module_1.fromNullable(headers["x-signature-timestamp"]),
18
20
  }))));
19
21
  const makeConfig = ({ applicationId, publicKey }) => ({
20
22
  applicationId,
21
23
  publicKey: fromHex(publicKey),
22
24
  });
23
- export const WebhookConfig = Context.Tag();
24
- export const makeConfigLayer = flow(makeConfig, Layer.succeed(WebhookConfig));
25
+ export const WebhookConfig = tsplus_module_3.Tag();
26
+ export const makeConfigLayer = tsplus_module_5.flow(makeConfig, tsplus_module_4.succeed(WebhookConfig));
25
27
  export class WebhookParseError {
26
28
  reason;
27
29
  _tag = "WebhookParseError";
@@ -29,11 +31,11 @@ export class WebhookParseError {
29
31
  this.reason = reason;
30
32
  }
31
33
  }
32
- const fromHeadersAndBody = (headers, body) => tsplus_module_3.flatMap(({ publicKey }) => tsplus_module_3.flatMap(() => Effect.tryCatch(() => JSON.parse(body), (reason) => new WebhookParseError(reason)))(Effect.fromEither(checkSignature(publicKey, headers, body))))(Effect.service(WebhookConfig));
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
35
  const run = (definitions) => {
34
36
  const handler = handlers(definitions);
35
- return (headers, body) => tsplus_module_3.flatMap(interaction => {
36
- const provide = Effect.provideService(InteractionContext)(interaction);
37
+ return (headers, body) => tsplus_module_6.flatMap(interaction => {
38
+ const provide = tsplus_module_6.provideService(InteractionContext)(interaction);
37
39
  return provide(handler[interaction.type](interaction));
38
40
  })(fromHeadersAndBody(headers, body));
39
41
  };
@@ -42,7 +44,7 @@ const run = (definitions) => {
42
44
  */
43
45
  export const makeHandler = (ix) => {
44
46
  const handle = run(ix.definitions);
45
- return ({ headers, body, success, error, }) => tsplus_module_3.catchAllCause(error)(tsplus_module_3.flatMap(success)(handle(headers, body)));
47
+ return ({ headers, body, success, error, }) => tsplus_module_6.catchAllCause(error)(tsplus_module_6.flatMap(success)(handle(headers, body)));
46
48
  };
47
49
  /**
48
50
  * @tsplus getter dfx/InteractionBuilder simpleWebhookHandler
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/Interactions/webhook.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAEL,OAAO,EAEP,MAAM,EACN,IAAI,EACJ,KAAK,EACL,MAAM,GACP,MAAM,aAAa,CAAA;AACpB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EA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C,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,13 +1,13 @@
1
- import { Context, Effect, Layer } from "dfx/_common";
1
+ import { Effect, Layer } from "dfx/_common";
2
2
  declare const make: (debug?: boolean) => {
3
- info: (...args: any[]) => Effect.Effect<never, never, void>;
4
- debug: (...args: any[]) => Effect.Effect<never, never, void>;
3
+ info: (...args: any[]) => Effect<never, never, void>;
4
+ debug: (...args: any[]) => Effect<never, never, void>;
5
5
  };
6
6
  export interface Log extends ReturnType<typeof make> {
7
7
  }
8
- export declare const Log: Context.Tag<Log>;
9
- export declare const LiveLog: Layer.Layer<never, never, Log>;
10
- export declare const LiveLogDebug: Layer.Layer<never, never, Log>;
11
- export declare const info: (...args: any[]) => Effect.Effect<Log, never, void>;
12
- export declare const debug: (...args: any[]) => Effect.Effect<Log, never, void>;
8
+ export declare const Log: import("dfx/_common").Tag<Log>;
9
+ export declare const LiveLog: Layer<never, never, Log>;
10
+ export declare const LiveLogDebug: Layer<never, never, Log>;
11
+ export declare const info: (...args: any[]) => Effect<Log, never, void>;
12
+ export declare const debug: (...args: any[]) => Effect<Log, never, void>;
13
13
  export {};
package/Log/index.js CHANGED
@@ -1,17 +1,19 @@
1
- import { Context, Effect, Layer } from "dfx/_common";
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";
2
4
  const make = (debug = false) => ({
3
- info: (...args) => Effect.sync(() => {
5
+ info: (...args) => tsplus_module_1.sync(() => {
4
6
  console.error("INFO", ...args);
5
7
  }),
6
8
  debug: (...args) => debug
7
- ? Effect.sync(() => {
9
+ ? tsplus_module_1.sync(() => {
8
10
  console.error("DEBUG", ...args);
9
11
  })
10
- : Effect.unit(),
12
+ : tsplus_module_1.unit(),
11
13
  });
12
- export const Log = Context.Tag();
13
- export const LiveLog = Layer.succeed(Log)(make(false));
14
- export const LiveLogDebug = Layer.succeed(Log)(make(true));
15
- export const info = (...args) => Effect.serviceWithEffect(Log)(({ info: log }) => log(...args));
16
- export const debug = (...args) => Effect.serviceWithEffect(Log)(({ debug }) => debug(...args));
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
+ export const info = (...args) => tsplus_module_1.serviceWithEffect(Log)(({ info: log }) => log(...args));
18
+ export const debug = (...args) => tsplus_module_1.serviceWithEffect(Log)(({ debug }) => debug(...args));
17
19
  //# sourceMappingURL=index.js.map
package/Log/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEpD,MAAM,IAAI,GAAG,CAAC,KAAK,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE,CACvB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAA;IAChC,CAA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E,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,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAc,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAE1D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CACrC,kCAAyB,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;AAEhE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CACtC,kCAAyB,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA"}
@@ -1,5 +1,4 @@
1
- import { Context, Duration, Effect, Layer, Option } from "dfx/_common";
2
- import { Log } from "dfx";
1
+ import { Effect, Maybe, Duration } from "dfx/_common";
3
2
  import { Success } from "dfx/utils/effect";
4
3
  export type BucketDetails = {
5
4
  key: "global" | string;
@@ -7,19 +6,19 @@ export type BucketDetails = {
7
6
  limit: number;
8
7
  };
9
8
  export interface RateLimitStore {
10
- hasBucket: (bucketKey: string) => Effect.Effect<never, never, boolean>;
11
- putBucket: (bucket: BucketDetails) => Effect.Effect<never, never, void>;
12
- getBucketForRoute: (route: string) => Effect.Effect<never, never, Option.Option<BucketDetails>>;
13
- putBucketRoute: (route: string, bucketKey: string) => Effect.Effect<never, never, void>;
14
- incrementCounter: (key: string, window: number, limit: number) => Effect.Effect<never, never, readonly [count: number, ttl: number]>;
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]>;
15
14
  }
16
- export declare const RateLimitStore: Context.Tag<RateLimitStore>;
17
- export declare const LiveMemoryRateLimitStore: Layer.Layer<never, never, RateLimitStore>;
18
- declare const makeLimiter: Effect.Effect<Log.Log | RateLimitStore, never, {
19
- maybeWait: (key: string, window: Duration.Duration, limit: number, multiplier?: number) => Effect.Effect<never, never, void>;
15
+ export declare const RateLimitStore: import("../_common.js").Tag<RateLimitStore>;
16
+ export declare const LiveMemoryRateLimitStore: import("../_common.js").Layer<never, never, RateLimitStore>;
17
+ declare const makeLimiter: import("../_common.js").Effect<import("../Log/index.js").Log | RateLimitStore, never, {
18
+ maybeWait: (key: string, window: Duration, limit: number, multiplier?: number) => import("../_common.js").Effect<never, never, void>;
20
19
  }>;
21
20
  export interface RateLimiter extends Success<typeof makeLimiter> {
22
21
  }
23
- export declare const RateLimiter: Context.Tag<RateLimiter>;
24
- export declare const LiveRateLimiter: Layer.Layer<Log.Log | RateLimitStore, never, RateLimiter>;
22
+ export declare const RateLimiter: import("../_common.js").Tag<RateLimiter>;
23
+ export declare const LiveRateLimiter: import("../_common.js").Layer<import("../Log/index.js").Log | RateLimitStore, never, RateLimiter>;
25
24
  export {};
@@ -1,24 +1,25 @@
1
- import * as tsplus_module_1 from "@effect/io/Effect";
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 * as tsplus_module_4 from "dfx";
2
5
  import { delayFrom } from "./utils.js";
3
6
  import * as Memory from "./memory.js";
4
- import { Context, Effect, Layer } from "dfx/_common";
5
- import { Log } from "dfx";
6
- export const RateLimitStore = Context.Tag();
7
- export const LiveMemoryRateLimitStore = Layer.sync(RateLimitStore)(Memory.make);
8
- const makeLimiter = tsplus_module_1.flatMap(store => tsplus_module_1.map(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(store => tsplus_module_3.map(log => {
9
10
  const maybeWait = (key, window, limit, multiplier = 1.05) => {
10
11
  const windowMs = window.millis * multiplier;
11
- return tsplus_module_1.asUnit(tsplus_module_1.tap(Effect.sleep)(tsplus_module_1.tap((d) => log.debug("RateLimitStore maybeWait", {
12
+ return tsplus_module_3.asUnit(tsplus_module_3.tap(tsplus_module_3.sleep)(tsplus_module_3.tap((d) => log.debug("RateLimitStore maybeWait", {
12
13
  key,
13
14
  window: window.millis,
14
15
  windowMs,
15
16
  limit,
16
17
  delay: d.millis,
17
- }))(tsplus_module_1.map(([count, ttl]) => delayFrom(windowMs, limit, count, ttl))(store
18
+ }))(tsplus_module_3.map(([count, ttl]) => delayFrom(windowMs, limit, count, ttl))(store
18
19
  .incrementCounter(key, windowMs, limit)))));
19
20
  };
20
21
  return { maybeWait };
21
- })(Effect.service(Log.Log)))(Effect.service(RateLimitStore));
22
- export const RateLimiter = Context.Tag();
23
- export const LiveRateLimiter = Layer.fromEffect(RateLimiter)(makeLimiter);
22
+ })(tsplus_module_3.service(tsplus_module_4.Log.Log)))(tsplus_module_3.service(RateLimitStore));
23
+ export const RateLimiter = tsplus_module_1.Tag();
24
+ export const LiveRateLimiter = tsplus_module_2.fromEffect(RateLimiter)(makeLimiter);
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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,20 +1,20 @@
1
1
  import * as tsplus_module_1 from "@fp-ts/data/Option";
2
- import { Effect, Option } from "dfx/_common";
2
+ import * as tsplus_module_2 from "@effect/io/Effect";
3
3
  export const make = () => {
4
4
  const buckets = new Map();
5
5
  const routes = new Map();
6
6
  const counters = new Map();
7
- const getCounter = (key) => tsplus_module_1.filter((c) => c.expires > Date.now())(Option.fromNullable(counters.get(key)));
7
+ const getCounter = (key) => tsplus_module_1.filter((c) => c.expires > Date.now())(tsplus_module_1.fromNullable(counters.get(key)));
8
8
  return {
9
- hasBucket: (key) => Effect.sync(() => buckets.has(key)),
10
- putBucket: (bucket) => Effect.sync(() => {
9
+ hasBucket: (key) => tsplus_module_2.sync(() => buckets.has(key)),
10
+ putBucket: (bucket) => tsplus_module_2.sync(() => {
11
11
  buckets.set(bucket.key, bucket);
12
12
  }),
13
- getBucketForRoute: (route) => Effect.sync(() => Option.fromNullable(buckets.get(routes.get(route)))),
14
- putBucketRoute: (route, bucket) => Effect.sync(() => {
13
+ getBucketForRoute: (route) => tsplus_module_2.sync(() => tsplus_module_1.fromNullable(buckets.get(routes.get(route)))),
14
+ putBucketRoute: (route, bucket) => tsplus_module_2.sync(() => {
15
15
  routes.set(route, bucket);
16
16
  }),
17
- incrementCounter: (key, window, limit) => Effect.sync(() => {
17
+ incrementCounter: (key, window, limit) => tsplus_module_2.sync(() => {
18
18
  const now = Date.now();
19
19
  const perRequest = Math.ceil(window / limit);
20
20
  const counter = tsplus_module_1.getOrElse(() => ({
@@ -1 +1 @@
1
- {"version":3,"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CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC,CAAA;QAC/B,CAAC,CAAC;KACL,CAAA;AACH,CAAC,CAAA"}
@@ -1,2 +1,2 @@
1
1
  import { Duration } from "dfx/_common";
2
- export declare const delayFrom: (window: number, limit: number, count: number, ttl: number) => Duration.Duration;
2
+ export declare const delayFrom: (window: number, limit: number, count: number, ttl: number) => Duration;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/RateLimit/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAGnD,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAc,EACd,KAAa,EACb,KAAa,EACb,GAAW,EACQ,EAAE;IACrB,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"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/RateLimit/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAEnD,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/_common.d.ts CHANGED
@@ -1,19 +1,23 @@
1
- export * as Cause from "@effect/io/Cause";
2
- export * as Effect from "@effect/io/Effect";
3
- export * as Exit from "@effect/io/Exit";
4
- export * as Layer from "@effect/io/Layer";
5
- export * as Queue from "@effect/io/Queue";
6
- export * as Schedule from "@effect/io/Schedule";
7
- export * as Scope from "@effect/io/Scope";
8
- export * as Stream from "@effect/stream/Stream";
9
- export * as Chunk from "@fp-ts/data/Chunk";
10
- export * as Context from "@fp-ts/data/Context";
11
- export * as Duration from "@fp-ts/data/Duration";
12
- export * as Equal from "@fp-ts/data/Equal";
13
- export * as Either from "@fp-ts/data/Either";
14
- export * as HashMap from "@fp-ts/data/HashMap";
15
- export * as Option from "@fp-ts/data/Option";
16
- export * as Ref from "@effect/io/Ref";
17
- export * as HashSet from "@fp-ts/data/HashSet";
18
- export { pipe, flow, identity } from "@fp-ts/data/Function";
1
+ import type { Schedule as _Schedule } from "@effect/io/Schedule";
2
+ export type { Cause } from "@effect/io/Cause";
3
+ export type { Effect } from "@effect/io/Effect";
4
+ export type { Exit } from "@effect/io/Exit";
5
+ export type { Layer } from "@effect/io/Layer";
6
+ export type { Queue } from "@effect/io/Queue";
7
+ export type { Scope } from "@effect/io/Scope";
8
+ export type { Stream } from "@effect/stream/Stream";
9
+ export type { Chunk } from "@fp-ts/data/Chunk";
10
+ export type { Context, Tag } from "@fp-ts/data/Context";
11
+ export type { Duration } from "@fp-ts/data/Duration";
12
+ export type { Equal } from "@fp-ts/data/Equal";
13
+ export type { Either } from "@fp-ts/data/Either";
14
+ export type { HashMap } from "@fp-ts/data/HashMap";
15
+ export type { Option as Maybe } from "@fp-ts/data/Option";
16
+ export type { Ref } from "@effect/io/Ref";
17
+ export type { HashSet } from "@fp-ts/data/HashSet";
19
18
  export * as Discord from "./types.js";
19
+ /**
20
+ * @tsplus type effect/io/Schedule
21
+ * @tsplus companion effect/io/Schedule.Ops
22
+ */
23
+ export type Schedule<Env, In, Out> = _Schedule<Env, In, Out>;
package/_common.js CHANGED
@@ -1,20 +1,2 @@
1
- export * as Cause from "@effect/io/Cause";
2
- export * as Effect from "@effect/io/Effect";
3
- export * as Exit from "@effect/io/Exit";
4
- export * as Layer from "@effect/io/Layer";
5
- export * as Queue from "@effect/io/Queue";
6
- export * as Schedule from "@effect/io/Schedule";
7
- export * as Scope from "@effect/io/Scope";
8
- export * as Stream from "@effect/stream/Stream";
9
- export * as Chunk from "@fp-ts/data/Chunk";
10
- export * as Context from "@fp-ts/data/Context";
11
- export * as Duration from "@fp-ts/data/Duration";
12
- export * as Equal from "@fp-ts/data/Equal";
13
- export * as Either from "@fp-ts/data/Either";
14
- export * as HashMap from "@fp-ts/data/HashMap";
15
- export * as Option from "@fp-ts/data/Option";
16
- export * as Ref from "@effect/io/Ref";
17
- export * as HashSet from "@fp-ts/data/HashSet";
18
- export { pipe, flow, identity } from "@fp-ts/data/Function";
19
1
  export * as Discord from "./types.js";
20
2
  //# sourceMappingURL=_common.js.map
package/_common.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"_common.js","sourceRoot":"","sources":["../src/_common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE3D,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"_common.js","sourceRoot":"","sources":["../src/_common.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA"}
package/gateway.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Config, Log } from "dfx";
2
- import { Layer } from "./_common.js";
3
2
  export * as CachePrelude from "./Cache/prelude.js";
4
3
  export * as DiscordWS from "./DiscordGateway/DiscordWS/index.js";
5
4
  export * as Gateway from "./DiscordGateway/index.js";
@@ -7,9 +6,9 @@ export * as Shard from "./DiscordGateway/Shard/index.js";
7
6
  export * as ShardStore from "./DiscordGateway/ShardStore/index.js";
8
7
  export * as WS from "./DiscordGateway/WS/index.js";
9
8
  export { run as runIx } from "./Interactions/gateway.js";
10
- export declare const MemoryRateLimit: Layer.Layer<Log.Log, never, import("dfx").RateLimitStore | import("dfx").RateLimiter>;
11
- export declare const MemoryREST: Layer.Layer<Config.DiscordConfig | Log.Log, never, import("dfx").DiscordREST>;
12
- export declare const MemorySharder: Layer.Layer<Config.DiscordConfig | Log.Log, never, import("./DiscordGateway/Sharder/index.js").Sharder>;
13
- export declare const MemoryGateway: Layer.Layer<Config.DiscordConfig | Log.Log, never, import("./DiscordGateway/index.js").DiscordGateway>;
14
- export declare const MemoryBot: Layer.Layer<Config.DiscordConfig | Log.Log, never, import("dfx").DiscordREST | import("dfx").RateLimitStore | import("dfx").RateLimiter | import("./DiscordGateway/index.js").DiscordGateway>;
15
- export declare const make: (config: Config.MakeOpts, debug?: boolean) => Layer.Layer<never, never, import("dfx").DiscordREST | Config.DiscordConfig | Log.Log | import("dfx").RateLimitStore | import("dfx").RateLimiter | import("./DiscordGateway/index.js").DiscordGateway>;
9
+ export declare const MemoryRateLimit: import("./_common.js").Layer<Log.Log, never, import("dfx").RateLimitStore | import("dfx").RateLimiter>;
10
+ export declare const MemoryREST: import("./_common.js").Layer<Config.DiscordConfig | Log.Log, never, import("dfx").DiscordREST>;
11
+ export declare const MemorySharder: import("./_common.js").Layer<Config.DiscordConfig | Log.Log, never, import("./DiscordGateway/Sharder/index.js").Sharder>;
12
+ export declare const MemoryGateway: import("./_common.js").Layer<Config.DiscordConfig | Log.Log, never, import("./DiscordGateway/index.js").DiscordGateway>;
13
+ export declare const MemoryBot: import("./_common.js").Layer<Config.DiscordConfig | Log.Log, never, import("dfx").DiscordREST | import("dfx").RateLimitStore | import("dfx").RateLimiter | import("./DiscordGateway/index.js").DiscordGateway>;
14
+ export declare const make: (config: Config.MakeOpts, debug?: boolean) => import("./_common.js").Layer<never, never, import("dfx").DiscordREST | Config.DiscordConfig | Log.Log | import("dfx").RateLimitStore | import("dfx").RateLimiter | import("./DiscordGateway/index.js").DiscordGateway>;