commandkit 1.2.0-rc.13 → 1.2.0-rc.15

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 (350) hide show
  1. package/README.md +42 -23
  2. package/dist/{ActionRow-B-CGmjDp.d.ts → ActionRow-Bt9qi0Mb.d.ts} +2 -2
  3. package/dist/{Button-C-GPeFA3.d.ts → Button-DxJLcZIU.d.ts} +5 -5
  4. package/dist/{ButtonKit-DKu0VAe4.d.ts → ButtonKit-BfcyvWfj.d.ts} +35 -35
  5. package/dist/{ChannelSelectMenuKit-HQZ4hH5s.d.ts → ChannelSelectMenuKit-DYkudikb.d.ts} +33 -33
  6. package/dist/{CommandsRouter-C7dZEepB.d.ts → CommandsRouter-DiNoF0dq.d.ts} +48 -48
  7. package/dist/{EventInterceptor-CZmWpS08.d.ts → EventInterceptor-D9JKMcfi.d.ts} +39 -39
  8. package/dist/{EventsRouter-DZ37r54v.d.ts → EventsRouter-EuuSu6NH.d.ts} +34 -34
  9. package/dist/{MentionableSelectMenuKit-7URDUM3-.d.ts → MentionableSelectMenuKit-Mu4xqP6B.d.ts} +33 -33
  10. package/dist/MessageCommandParser-DPCbHXCS.d.ts +194 -0
  11. package/dist/{Modal-CZT9MZsy.d.ts → Modal-v9rrcMl-.d.ts} +7 -7
  12. package/dist/{ModalKit-BWXI3Z26.d.ts → ModalKit-XJSM65SV.d.ts} +32 -32
  13. package/dist/{RoleSelectMenuKit-BY-JJ18w.d.ts → RoleSelectMenuKit-CCjcp3HY.d.ts} +33 -33
  14. package/dist/{SelectMenu-q_b3Mjv9.d.ts → SelectMenu-CY0vvoSu.d.ts} +15 -11
  15. package/dist/{StringSelectMenuKit-lVhUMc3g.d.ts → StringSelectMenuKit-G5nBTicX.d.ts} +33 -33
  16. package/dist/{UserSelectMenuKit-CCj4Fpkr.d.ts → UserSelectMenuKit-D3SO_fXA.d.ts} +33 -33
  17. package/dist/analytics/analytics-engine.d.ts +1 -1
  18. package/dist/analytics/analytics-engine.js +2 -24
  19. package/dist/analytics/analytics-provider.d.ts +1 -1
  20. package/dist/analytics/analytics-provider.js +1 -0
  21. package/dist/analytics/constants.js +26 -3
  22. package/dist/analytics/constants.js.map +1 -0
  23. package/dist/analytics/utils.js +2 -24
  24. package/dist/{analytics-engine-WQhXmx3H.d.ts → analytics-engine-DnRsHBId.d.ts} +846 -841
  25. package/dist/app/commands/AppCommandRunner.d.ts +1 -1
  26. package/dist/app/commands/AppCommandRunner.js +2 -24
  27. package/dist/app/commands/Context.d.ts +1 -1
  28. package/dist/app/commands/Context.js +2 -24
  29. package/dist/app/commands/MessageCommandParser.d.ts +1 -1
  30. package/dist/app/commands/MessageCommandParser.js +261 -3
  31. package/dist/app/commands/MessageCommandParser.js.map +1 -0
  32. package/dist/app/commands/helpers.d.ts +1 -1
  33. package/dist/app/commands/helpers.js +25 -3
  34. package/dist/app/commands/helpers.js.map +1 -0
  35. package/dist/app/events/EventWorkerContext.d.ts +2 -2
  36. package/dist/app/events/EventWorkerContext.js +48 -5
  37. package/dist/app/events/EventWorkerContext.js.map +1 -0
  38. package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
  39. package/dist/app/handlers/AppCommandHandler.js +2 -24
  40. package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
  41. package/dist/app/handlers/AppEventsHandler.js +2 -24
  42. package/dist/app/index.d.ts +4 -4
  43. package/dist/app/index.js +13 -32
  44. package/dist/app/interrupt/signals.d.ts +1 -1
  45. package/dist/app/interrupt/signals.js +54 -6
  46. package/dist/app/interrupt/signals.js.map +1 -0
  47. package/dist/app/middlewares/permissions.d.ts +1 -1
  48. package/dist/app/middlewares/permissions.js +2 -24
  49. package/dist/app/register/CommandRegistrar.d.ts +1 -1
  50. package/dist/app/register/CommandRegistrar.js +2 -24
  51. package/dist/app/router/CommandsRouter.d.ts +1 -1
  52. package/dist/app/router/CommandsRouter.js +210 -2
  53. package/dist/app/router/CommandsRouter.js.map +1 -0
  54. package/dist/app/router/EventsRouter.d.ts +1 -1
  55. package/dist/app/router/EventsRouter.js +128 -2
  56. package/dist/app/router/EventsRouter.js.map +1 -0
  57. package/dist/app/router/index.d.ts +2 -2
  58. package/dist/app/router/index.js +5 -5
  59. package/dist/{chunk-kSYXY2_d.js → chunk-BE-pF4vm.js} +1 -1
  60. package/dist/cli/app-process.d.ts +2 -2
  61. package/dist/cli/app-process.js +6 -8
  62. package/dist/cli/app-process.js.map +1 -1
  63. package/dist/cli/build.d.ts +2 -2
  64. package/dist/cli/build.js +15 -35
  65. package/dist/cli/build.js.map +1 -1
  66. package/dist/cli/common.d.ts +5 -5
  67. package/dist/cli/common.js +182 -12
  68. package/dist/cli/common.js.map +1 -0
  69. package/dist/cli/development.d.ts +3 -3
  70. package/dist/cli/development.js +38 -59
  71. package/dist/cli/development.js.map +1 -1
  72. package/dist/cli/env.js +73 -9
  73. package/dist/cli/env.js.map +1 -0
  74. package/dist/cli/generators.js +10 -10
  75. package/dist/cli/generators.js.map +1 -1
  76. package/dist/cli/information.js +8 -7
  77. package/dist/cli/information.js.map +1 -1
  78. package/dist/cli/init.d.ts +2 -2
  79. package/dist/cli/init.js +14 -33
  80. package/dist/cli/init.js.map +1 -1
  81. package/dist/cli/production.d.ts +2 -2
  82. package/dist/cli/production.js +11 -33
  83. package/dist/cli/production.js.map +1 -1
  84. package/dist/cli/type-checker.js +83 -6
  85. package/dist/cli/type-checker.js.map +1 -0
  86. package/dist/cli/utils.js +1 -0
  87. package/dist/cli/utils.js.map +1 -1
  88. package/dist/{commandkit-SIjTLD2R.js → commandkit--k6yDJEr.js} +3157 -2699
  89. package/dist/commandkit--k6yDJEr.js.map +1 -0
  90. package/dist/commandkit.d.ts +1 -1
  91. package/dist/commandkit.js +2 -24
  92. package/dist/{common-DnwCYit8.d.ts → common-CCvvgnxi.d.ts} +2 -2
  93. package/dist/components/common/EventInterceptor.d.ts +1 -1
  94. package/dist/components/common/EventInterceptor.js +137 -2
  95. package/dist/components/common/EventInterceptor.js.map +1 -0
  96. package/dist/components/common/element.d.ts +2 -2
  97. package/dist/components/common/element.js +10 -8
  98. package/dist/components/common/types.d.ts +1 -1
  99. package/dist/components/common/types.js +1 -0
  100. package/dist/components/display/common.js +3 -2
  101. package/dist/components/display/container.d.ts +1 -1
  102. package/dist/components/display/container.js +3 -2
  103. package/dist/components/display/file.d.ts +1 -1
  104. package/dist/components/display/file.js +23 -2
  105. package/dist/components/display/file.js.map +1 -0
  106. package/dist/components/display/index.d.ts +8 -8
  107. package/dist/components/display/index.js +18 -21
  108. package/dist/components/display/label.d.ts +1 -1
  109. package/dist/components/display/label.js +3 -2
  110. package/dist/components/display/media-gallery.d.ts +1 -1
  111. package/dist/components/display/media-gallery.js +4 -3
  112. package/dist/components/display/poll.d.ts +1 -1
  113. package/dist/components/display/poll.js +85 -4
  114. package/dist/{poll-CFe8yvoJ.js.map → components/display/poll.js.map} +1 -1
  115. package/dist/components/display/section.d.ts +1 -1
  116. package/dist/components/display/section.js +4 -3
  117. package/dist/components/display/separator.d.ts +1 -1
  118. package/dist/components/display/separator.js +21 -2
  119. package/dist/components/display/separator.js.map +1 -0
  120. package/dist/components/display/text-display.d.ts +1 -1
  121. package/dist/components/display/text-display.js +26 -2
  122. package/dist/components/display/text-display.js.map +1 -0
  123. package/dist/components/index.d.ts +23 -23
  124. package/dist/components/index.js +28 -45
  125. package/dist/components/interactive/action-row/ActionRow.d.ts +1 -1
  126. package/dist/components/interactive/action-row/ActionRow.js +20 -2
  127. package/dist/{ActionRow-CSN_UKmM.js.map → components/interactive/action-row/ActionRow.js.map} +1 -1
  128. package/dist/components/interactive/button/Button.d.ts +1 -1
  129. package/dist/components/interactive/button/Button.js +2 -24
  130. package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
  131. package/dist/components/interactive/button/ButtonKit.js +2 -24
  132. package/dist/components/interactive/modal/Modal.d.ts +1 -1
  133. package/dist/components/interactive/modal/Modal.js +2 -24
  134. package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
  135. package/dist/components/interactive/modal/ModalKit.js +2 -24
  136. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
  137. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +2 -24
  138. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
  139. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +2 -24
  140. package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
  141. package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +2 -24
  142. package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
  143. package/dist/components/interactive/select-menu/SelectMenu.js +2 -24
  144. package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
  145. package/dist/components/interactive/select-menu/StringSelectMenuKit.js +2 -24
  146. package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
  147. package/dist/components/interactive/select-menu/UserSelectMenuKit.js +2 -24
  148. package/dist/components/interactive/select-menu/common.d.ts +1 -1
  149. package/dist/components/interactive/select-menu/common.js +1 -0
  150. package/dist/config/config.d.ts +1 -1
  151. package/dist/config/config.js +2 -24
  152. package/dist/config/default.d.ts +1 -1
  153. package/dist/config/default.js +2 -24
  154. package/dist/config/loader.d.ts +1 -1
  155. package/dist/config/loader.js +2 -24
  156. package/dist/config/types.d.ts +1 -1
  157. package/dist/config/types.js +1 -0
  158. package/dist/config/utils.d.ts +1 -1
  159. package/dist/config/utils.js +29 -2
  160. package/dist/config/utils.js.map +1 -0
  161. package/dist/{constants-EpKcj0dH.d.ts → constants-DqtJY0t-.d.ts} +2 -2
  162. package/dist/{constants-CuYW0K10.d.ts → constants-DwxpkIeH.d.ts} +7 -7
  163. package/dist/{container-DYcb7zGw.d.ts → container-CYojOA9d.d.ts} +1 -1
  164. package/dist/context/async-context.d.ts +1 -1
  165. package/dist/context/async-context.js +2 -24
  166. package/dist/context/environment.d.ts +1 -1
  167. package/dist/context/environment.js +2 -24
  168. package/dist/{element-wQo0heGj.d.ts → element-DeLvTMfZ.d.ts} +5 -4
  169. package/dist/events/CommandKitEventsChannel.d.ts +1 -1
  170. package/dist/events/CommandKitEventsChannel.js +83 -2
  171. package/dist/events/CommandKitEventsChannel.js.map +1 -0
  172. package/dist/{file-CrV4lSnl.d.ts → file-DLO1zEcH.d.ts} +1 -1
  173. package/dist/flags/FlagProvider.d.ts +1 -1
  174. package/dist/flags/FlagProvider.js +1 -0
  175. package/dist/flags/FlagProvider.js.map +1 -1
  176. package/dist/flags/feature-flags.d.ts +1 -1
  177. package/dist/flags/feature-flags.js +5 -165
  178. package/dist/flags/store.d.ts +1 -1
  179. package/dist/flags/store.js +13 -2
  180. package/dist/flags/store.js.map +1 -0
  181. package/dist/{helpers-AQPLVY35.d.ts → helpers-zmC44Mcu.d.ts} +1 -1
  182. package/dist/index.d.ts +31 -31
  183. package/dist/index.js +78 -97
  184. package/dist/kv/constants.d.ts +1 -1
  185. package/dist/kv/constants.js +22 -2
  186. package/dist/kv/constants.js.map +1 -0
  187. package/dist/kv/dotprops.js +1 -0
  188. package/dist/kv/dotprops.js.map +1 -1
  189. package/dist/kv/kv.d.ts +288 -288
  190. package/dist/kv/kv.js +2 -1
  191. package/dist/kv/kv.js.map +1 -1
  192. package/dist/kv/serde.d.ts +1 -1
  193. package/dist/kv/serde.js +29 -28
  194. package/dist/kv/serde.js.map +1 -1
  195. package/dist/{label-37kaNWMH.d.ts → label-DqGRqodo.d.ts} +3 -3
  196. package/dist/logger/DefaultLogger.d.ts +19 -19
  197. package/dist/logger/DefaultLogger.js +2 -24
  198. package/dist/logger/ILogger.d.ts +35 -35
  199. package/dist/logger/ILogger.js +1 -0
  200. package/dist/logger/Logger.d.ts +5 -5
  201. package/dist/logger/Logger.js +2 -24
  202. package/dist/logger/NoopLogger.d.ts +35 -35
  203. package/dist/logger/NoopLogger.js +1 -0
  204. package/dist/logger/NoopLogger.js.map +1 -1
  205. package/dist/{media-gallery-Ci3I4ElH.d.ts → media-gallery-Ca8es-eB.d.ts} +1 -1
  206. package/dist/plugins/CompilerPlugin.d.ts +1 -1
  207. package/dist/plugins/CompilerPlugin.js +33 -3
  208. package/dist/plugins/CompilerPlugin.js.map +1 -0
  209. package/dist/plugins/PluginCommon.d.ts +1 -1
  210. package/dist/plugins/PluginCommon.js +55 -4
  211. package/dist/plugins/PluginCommon.js.map +1 -0
  212. package/dist/plugins/RuntimePlugin.d.ts +1 -1
  213. package/dist/plugins/RuntimePlugin.js +124 -3
  214. package/dist/plugins/RuntimePlugin.js.map +1 -0
  215. package/dist/plugins/index.d.ts +1 -1
  216. package/dist/plugins/index.js +8 -30
  217. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
  218. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +2 -24
  219. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
  220. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +2 -24
  221. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
  222. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +2 -24
  223. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
  224. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +2 -24
  225. package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
  226. package/dist/plugins/plugin-runtime/runtime.js +1 -0
  227. package/dist/plugins/types.d.ts +1 -1
  228. package/dist/plugins/types.js +1 -0
  229. package/dist/{poll-Ddtapd6n.d.ts → poll-DQ6DX_Tt.d.ts} +8 -8
  230. package/dist/{section-DkUKULnB.d.ts → section-Q8nwx_-q.d.ts} +1 -1
  231. package/dist/{separator-CbXsIFCa.d.ts → separator-B8P-kdIK.d.ts} +1 -1
  232. package/dist/{signals-BbTgTc0i.d.ts → signals-CBXwugBW.d.ts} +1 -1
  233. package/dist/{text-display-D7j39VC-.d.ts → text-display-CL9C2yMc.d.ts} +1 -1
  234. package/dist/{types-BywA9d2Z.d.ts → types-DZy7U-Ld.d.ts} +1 -1
  235. package/dist/types.d.ts +1 -1
  236. package/dist/types.js +1 -0
  237. package/dist/utils/colors.js +9 -3
  238. package/dist/utils/colors.js.map +1 -0
  239. package/dist/utils/constants.d.ts +1 -1
  240. package/dist/utils/constants.js +50 -8
  241. package/dist/utils/constants.js.map +1 -0
  242. package/dist/utils/dev-hooks.d.ts +1 -1
  243. package/dist/utils/dev-hooks.js +2 -24
  244. package/dist/utils/error-codes.d.ts +10 -10
  245. package/dist/utils/error-codes.js +53 -5
  246. package/dist/utils/error-codes.js.map +1 -0
  247. package/dist/utils/resolve-file-url.js +18 -2
  248. package/dist/utils/resolve-file-url.js.map +1 -0
  249. package/dist/utils/types-package.js +61 -4
  250. package/dist/utils/types-package.js.map +1 -0
  251. package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
  252. package/dist/utils/useful-stuff/async-queue.js +1 -0
  253. package/dist/utils/useful-stuff/async-queue.js.map +1 -1
  254. package/dist/utils/useful-stuff/mutex.d.ts +62 -62
  255. package/dist/utils/useful-stuff/mutex.js +1 -0
  256. package/dist/utils/useful-stuff/mutex.js.map +1 -1
  257. package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
  258. package/dist/utils/useful-stuff/ratelimiter.js +1 -0
  259. package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
  260. package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
  261. package/dist/utils/useful-stuff/semaphore.js +1 -0
  262. package/dist/utils/useful-stuff/semaphore.js.map +1 -1
  263. package/dist/utils/utilities.d.ts +5 -5
  264. package/dist/utils/utilities.js +2 -24
  265. package/dist/utils/warning.js +38 -4
  266. package/dist/utils/warning.js.map +1 -0
  267. package/dist/version.js +2 -1
  268. package/dist/version.js.map +1 -1
  269. package/package.json +12 -15
  270. package/dist/ActionRow-CSN_UKmM.js +0 -25
  271. package/dist/CommandKitEventsChannel-CnT5ymYe.js +0 -88
  272. package/dist/CommandKitEventsChannel-CnT5ymYe.js.map +0 -1
  273. package/dist/CommandsRouter-C_HLsrGX.js +0 -215
  274. package/dist/CommandsRouter-C_HLsrGX.js.map +0 -1
  275. package/dist/CompilerPlugin-CUsGAfgl.js +0 -43
  276. package/dist/CompilerPlugin-CUsGAfgl.js.map +0 -1
  277. package/dist/EventInterceptor-BWoEJMHZ.js +0 -142
  278. package/dist/EventInterceptor-BWoEJMHZ.js.map +0 -1
  279. package/dist/EventWorkerContext-Dfhgv329.js +0 -68
  280. package/dist/EventWorkerContext-Dfhgv329.js.map +0 -1
  281. package/dist/EventsRouter-DZYIha6m.js +0 -133
  282. package/dist/EventsRouter-DZYIha6m.js.map +0 -1
  283. package/dist/MessageCommandParser-Bs9fimmd.js +0 -271
  284. package/dist/MessageCommandParser-Bs9fimmd.js.map +0 -1
  285. package/dist/MessageCommandParser-q3dQcE5N.d.ts +0 -194
  286. package/dist/PluginCommon-BLxWww5u.js +0 -70
  287. package/dist/PluginCommon-BLxWww5u.js.map +0 -1
  288. package/dist/RuntimePlugin-CtobluSU.js +0 -134
  289. package/dist/RuntimePlugin-CtobluSU.js.map +0 -1
  290. package/dist/colors-Csc0X4QJ.js +0 -14
  291. package/dist/colors-Csc0X4QJ.js.map +0 -1
  292. package/dist/commandkit-SIjTLD2R.js.map +0 -1
  293. package/dist/common-C2jAjX4U.js +0 -0
  294. package/dist/common-CEordwf3.js +0 -17
  295. package/dist/common-CEordwf3.js.map +0 -1
  296. package/dist/common-DSRs_mfw.js +0 -222
  297. package/dist/common-DSRs_mfw.js.map +0 -1
  298. package/dist/constants-BFFK-hfP.js +0 -27
  299. package/dist/constants-BFFK-hfP.js.map +0 -1
  300. package/dist/constants-Cw8VjCVz.js +0 -36
  301. package/dist/constants-Cw8VjCVz.js.map +0 -1
  302. package/dist/constants-CxkFFZ7p.js +0 -85
  303. package/dist/constants-CxkFFZ7p.js.map +0 -1
  304. package/dist/container-DCPljKVH.js +0 -43
  305. package/dist/container-DCPljKVH.js.map +0 -1
  306. package/dist/display-WDb9wMCv.js +0 -0
  307. package/dist/element-DibzzA5L.js +0 -84
  308. package/dist/element-DibzzA5L.js.map +0 -1
  309. package/dist/env-CmspDhHy.js +0 -113
  310. package/dist/env-CmspDhHy.js.map +0 -1
  311. package/dist/error-codes-Ds0bnPvT.js +0 -73
  312. package/dist/error-codes-Ds0bnPvT.js.map +0 -1
  313. package/dist/file-Ca1kpEtE.js +0 -28
  314. package/dist/file-Ca1kpEtE.js.map +0 -1
  315. package/dist/flags/feature-flags.js.map +0 -1
  316. package/dist/helpers-Btx1FSZx.js +0 -35
  317. package/dist/helpers-Btx1FSZx.js.map +0 -1
  318. package/dist/index.js.map +0 -1
  319. package/dist/label-B6vXvwLM.js +0 -35
  320. package/dist/label-B6vXvwLM.js.map +0 -1
  321. package/dist/media-gallery-u3gjX7yD.js +0 -61
  322. package/dist/media-gallery-u3gjX7yD.js.map +0 -1
  323. package/dist/poll-CFe8yvoJ.js +0 -100
  324. package/dist/resolve-file-url-CdHqwWs3.js +0 -23
  325. package/dist/resolve-file-url-CdHqwWs3.js.map +0 -1
  326. package/dist/router-BvamdzoF.js +0 -0
  327. package/dist/runtime-Skt5NiOc.js +0 -0
  328. package/dist/section-BC8LF-B2.js +0 -59
  329. package/dist/section-BC8LF-B2.js.map +0 -1
  330. package/dist/separator-BUTiW7uz.js +0 -26
  331. package/dist/separator-BUTiW7uz.js.map +0 -1
  332. package/dist/signals-B8z1wJ6W.js +0 -74
  333. package/dist/signals-B8z1wJ6W.js.map +0 -1
  334. package/dist/store-D8r_hryO.js +0 -18
  335. package/dist/store-D8r_hryO.js.map +0 -1
  336. package/dist/text-display-DANahMN3.js +0 -31
  337. package/dist/text-display-DANahMN3.js.map +0 -1
  338. package/dist/type-checker-cVd3Hpnh.js +0 -88
  339. package/dist/type-checker-cVd3Hpnh.js.map +0 -1
  340. package/dist/types-Cdh4uaFR.js +0 -0
  341. package/dist/types-TC4g3w91.js +0 -0
  342. package/dist/types-package-CsTNfvv2.js +0 -71
  343. package/dist/types-package-CsTNfvv2.js.map +0 -1
  344. package/dist/utils-Br3eenD1.js +0 -34
  345. package/dist/utils-Br3eenD1.js.map +0 -1
  346. package/dist/warning-CszH8HeS.js +0 -53
  347. package/dist/warning-CszH8HeS.js.map +0 -1
  348. /package/dist/{index-BJfko-dP.d.ts → index-BIsCUWAs.d.ts} +0 -0
  349. /package/dist/{index-CCggO_hw.d.ts → index-CwHYpK-f.d.ts} +0 -0
  350. /package/dist/{index-CLjpoGi1.d.ts → index-DHrsNvX1.d.ts} +0 -0
@@ -9,30 +9,30 @@
9
9
  */
10
10
  interface SemaphoreStorage {
11
11
  /**
12
- * Attempts to acquire a permit for a given key
13
- * @param key - The unique identifier for the semaphore
14
- * @param timeout - Optional timeout in milliseconds for permit acquisition
15
- * @param signal - Optional AbortSignal for cancelling the acquisition
16
- * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available
17
- */
12
+ * Attempts to acquire a permit for a given key
13
+ * @param key - The unique identifier for the semaphore
14
+ * @param timeout - Optional timeout in milliseconds for permit acquisition
15
+ * @param signal - Optional AbortSignal for cancelling the acquisition
16
+ * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available
17
+ */
18
18
  acquire(key: string, timeout?: number, signal?: AbortSignal): Promise<boolean>;
19
19
  /**
20
- * Releases a permit for a given key
21
- * @param key - The unique identifier for the semaphore
22
- * @returns Promise that resolves when the permit is released
23
- */
20
+ * Releases a permit for a given key
21
+ * @param key - The unique identifier for the semaphore
22
+ * @returns Promise that resolves when the permit is released
23
+ */
24
24
  release(key: string): Promise<void>;
25
25
  /**
26
- * Gets the number of available permits for a given key
27
- * @param key - The unique identifier for the semaphore
28
- * @returns Promise resolving to the number of available permits
29
- */
26
+ * Gets the number of available permits for a given key
27
+ * @param key - The unique identifier for the semaphore
28
+ * @returns Promise resolving to the number of available permits
29
+ */
30
30
  getAvailablePermits(key: string): Promise<number>;
31
31
  /**
32
- * Gets the total number of permits for a given key
33
- * @param key - The unique identifier for the semaphore
34
- * @returns Promise resolving to the total number of permits
35
- */
32
+ * Gets the total number of permits for a given key
33
+ * @param key - The unique identifier for the semaphore
34
+ * @returns Promise resolving to the total number of permits
35
+ */
36
36
  getTotalPermits(key: string): Promise<number>;
37
37
  }
38
38
  /**
@@ -53,36 +53,36 @@ interface SemaphoreOptions {
53
53
  declare class MemorySemaphoreStorage implements SemaphoreStorage {
54
54
  private readonly semaphores;
55
55
  /**
56
- * Attempts to acquire a permit for a given key
57
- * @param key - The unique identifier for the semaphore
58
- * @param timeout - Optional timeout in milliseconds for permit acquisition
59
- * @param signal - Optional AbortSignal for cancelling the acquisition
60
- * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available
61
- */
56
+ * Attempts to acquire a permit for a given key
57
+ * @param key - The unique identifier for the semaphore
58
+ * @param timeout - Optional timeout in milliseconds for permit acquisition
59
+ * @param signal - Optional AbortSignal for cancelling the acquisition
60
+ * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available
61
+ */
62
62
  acquire(key: string, timeout?: number, signal?: AbortSignal): Promise<boolean>;
63
63
  /**
64
- * Releases a permit for a given key
65
- * @param key - The unique identifier for the semaphore
66
- * @returns Promise that resolves when the permit is released
67
- */
64
+ * Releases a permit for a given key
65
+ * @param key - The unique identifier for the semaphore
66
+ * @returns Promise that resolves when the permit is released
67
+ */
68
68
  release(key: string): Promise<void>;
69
69
  /**
70
- * Gets the number of available permits for a given key
71
- * @param key - The unique identifier for the semaphore
72
- * @returns Promise resolving to the number of available permits
73
- */
70
+ * Gets the number of available permits for a given key
71
+ * @param key - The unique identifier for the semaphore
72
+ * @returns Promise resolving to the number of available permits
73
+ */
74
74
  getAvailablePermits(key: string): Promise<number>;
75
75
  /**
76
- * Gets the total number of permits for a given key
77
- * @param key - The unique identifier for the semaphore
78
- * @returns Promise resolving to the total number of permits
79
- */
76
+ * Gets the total number of permits for a given key
77
+ * @param key - The unique identifier for the semaphore
78
+ * @returns Promise resolving to the total number of permits
79
+ */
80
80
  getTotalPermits(key: string): Promise<number>;
81
81
  /**
82
- * Initializes a semaphore with the specified number of permits
83
- * @param key - The unique identifier for the semaphore
84
- * @param permits - The total number of permits to allocate
85
- */
82
+ * Initializes a semaphore with the specified number of permits
83
+ * @param key - The unique identifier for the semaphore
84
+ * @param permits - The total number of permits to allocate
85
+ */
86
86
  initialize(key: string, permits: number): void;
87
87
  private delay;
88
88
  }
@@ -95,66 +95,66 @@ declare class Semaphore {
95
95
  private readonly defaultPermits;
96
96
  private readonly defaultTimeout;
97
97
  /**
98
- * Creates a new semaphore instance
99
- * @param options - Configuration options for the semaphore
100
- */
98
+ * Creates a new semaphore instance
99
+ * @param options - Configuration options for the semaphore
100
+ */
101
101
  constructor(options?: SemaphoreOptions);
102
102
  /**
103
- * Sets the storage implementation for the semaphore
104
- * @param storage - The storage implementation to use
105
- */
103
+ * Sets the storage implementation for the semaphore
104
+ * @param storage - The storage implementation to use
105
+ */
106
106
  setStorage(storage: SemaphoreStorage): void;
107
107
  /**
108
- * Gets the storage implementation for the semaphore
109
- * @returns The storage implementation
110
- */
108
+ * Gets the storage implementation for the semaphore
109
+ * @returns The storage implementation
110
+ */
111
111
  getStorage(): SemaphoreStorage;
112
112
  /**
113
- * Acquires a permit for the given key
114
- * @param key - The unique identifier for the semaphore
115
- * @param timeout - Optional timeout in milliseconds for permit acquisition
116
- * @param signal - Optional AbortSignal for cancelling the acquisition
117
- * @returns Promise resolving to true if permit was acquired, false if timeout
118
- */
113
+ * Acquires a permit for the given key
114
+ * @param key - The unique identifier for the semaphore
115
+ * @param timeout - Optional timeout in milliseconds for permit acquisition
116
+ * @param signal - Optional AbortSignal for cancelling the acquisition
117
+ * @returns Promise resolving to true if permit was acquired, false if timeout
118
+ */
119
119
  acquire(key: string, timeout?: number, signal?: AbortSignal): Promise<boolean>;
120
120
  /**
121
- * Releases a permit for the given key
122
- * @param key - The unique identifier for the semaphore
123
- * @returns Promise that resolves when the permit is released
124
- */
121
+ * Releases a permit for the given key
122
+ * @param key - The unique identifier for the semaphore
123
+ * @returns Promise that resolves when the permit is released
124
+ */
125
125
  release(key: string): Promise<void>;
126
126
  /**
127
- * Gets the number of available permits for the given key
128
- * @param key - The unique identifier for the semaphore
129
- * @returns Promise resolving to the number of available permits
130
- */
127
+ * Gets the number of available permits for the given key
128
+ * @param key - The unique identifier for the semaphore
129
+ * @returns Promise resolving to the number of available permits
130
+ */
131
131
  getAvailablePermits(key: string): Promise<number>;
132
132
  /**
133
- * Gets the total number of permits for the given key
134
- * @param key - The unique identifier for the semaphore
135
- * @returns Promise resolving to the total number of permits
136
- */
133
+ * Gets the total number of permits for the given key
134
+ * @param key - The unique identifier for the semaphore
135
+ * @returns Promise resolving to the total number of permits
136
+ */
137
137
  getTotalPermits(key: string): Promise<number>;
138
138
  /**
139
- * Gets the number of acquired permits for the given key
140
- * @param key - The unique identifier for the semaphore
141
- * @returns Promise resolving to the number of acquired permits
142
- */
139
+ * Gets the number of acquired permits for the given key
140
+ * @param key - The unique identifier for the semaphore
141
+ * @returns Promise resolving to the number of acquired permits
142
+ */
143
143
  getAcquiredPermits(key: string): Promise<number>;
144
144
  /**
145
- * Executes a function with a permit from the semaphore
146
- * @param key - The unique identifier for the semaphore
147
- * @param fn - The function to execute with a permit
148
- * @param timeout - Optional timeout in milliseconds for permit acquisition
149
- * @param signal - Optional AbortSignal for cancelling the permit acquisition
150
- * @returns Promise resolving to the result of the function execution
151
- * @throws Error if permit acquisition fails or function execution fails
152
- */
145
+ * Executes a function with a permit from the semaphore
146
+ * @param key - The unique identifier for the semaphore
147
+ * @param fn - The function to execute with a permit
148
+ * @param timeout - Optional timeout in milliseconds for permit acquisition
149
+ * @param signal - Optional AbortSignal for cancelling the permit acquisition
150
+ * @returns Promise resolving to the result of the function execution
151
+ * @throws Error if permit acquisition fails or function execution fails
152
+ */
153
153
  withPermit<T>(key: string, fn: () => Promise<T> | T, timeout?: number, signal?: AbortSignal): Promise<T>;
154
154
  /**
155
- * Gets the current configuration of the semaphore
156
- * @returns Object containing the current permits and timeout values
157
- */
155
+ * Gets the current configuration of the semaphore
156
+ * @returns Object containing the current permits and timeout values
157
+ */
158
158
  getConfig(): Omit<SemaphoreOptions, 'storage'>;
159
159
  }
160
160
  /**
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/utils/useful-stuff/semaphore.ts
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"semaphore.js","names":[],"sources":["../../../src/utils/useful-stuff/semaphore.ts"],"sourcesContent":["/**\n * Async semaphore implementation for controlling access to a limited pool of resources.\n * Allows a specified number of concurrent operations while blocking additional requests.\n */\n\n/**\n * Interface for semaphore storage implementations.\n * Provides methods to store, retrieve, and manage semaphore permit data.\n */\nexport interface SemaphoreStorage {\n /**\n * Attempts to acquire a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available\n */\n acquire(\n key: string,\n timeout?: number,\n signal?: AbortSignal,\n ): Promise<boolean>;\n\n /**\n * Releases a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\n release(key: string): Promise<void>;\n\n /**\n * Gets the number of available permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\n getAvailablePermits(key: string): Promise<number>;\n\n /**\n * Gets the total number of permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the total number of permits\n */\n getTotalPermits(key: string): Promise<number>;\n}\n\n/**\n * Configuration options for semaphore\n */\nexport interface SemaphoreOptions {\n /** Maximum number of concurrent permits allowed. Default: 1 */\n permits?: number;\n /** Default timeout in milliseconds for permit acquisition. Default: 30000 */\n timeout?: number;\n /** Storage implementation for persisting semaphore data. Default: {@link MemorySemaphoreStorage} */\n storage?: SemaphoreStorage;\n}\n\n/**\n * In-memory storage implementation for semaphore permits.\n * Suitable for single-instance applications.\n */\nexport class MemorySemaphoreStorage implements SemaphoreStorage {\n private readonly semaphores = new Map<\n string,\n { total: number; available: number }\n >();\n\n /**\n * Attempts to acquire a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available\n */\n async acquire(\n key: string,\n timeout: number = 30000,\n signal?: AbortSignal,\n ): Promise<boolean> {\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n // Check if aborted\n if (signal?.aborted) {\n throw new Error('Permit acquisition was aborted');\n }\n\n const semaphore = this.semaphores.get(key);\n if (semaphore && semaphore.available > 0) {\n semaphore.available--;\n return true;\n }\n await this.delay(10);\n }\n\n return false;\n }\n\n /**\n * Releases a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\n async release(key: string): Promise<void> {\n const semaphore = this.semaphores.get(key);\n if (semaphore && semaphore.available < semaphore.total) {\n semaphore.available++;\n }\n }\n\n /**\n * Gets the number of available permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\n async getAvailablePermits(key: string): Promise<number> {\n const semaphore = this.semaphores.get(key);\n return semaphore ? semaphore.available : 0;\n }\n\n /**\n * Gets the total number of permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the total number of permits\n */\n async getTotalPermits(key: string): Promise<number> {\n const semaphore = this.semaphores.get(key);\n return semaphore ? semaphore.total : 0;\n }\n\n /**\n * Initializes a semaphore with the specified number of permits\n * @param key - The unique identifier for the semaphore\n * @param permits - The total number of permits to allocate\n */\n initialize(key: string, permits: number): void {\n this.semaphores.set(key, { total: permits, available: permits });\n }\n\n private delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n\n/**\n * Async semaphore implementation that controls access to a limited pool of resources.\n * Allows a specified number of concurrent operations while blocking additional requests.\n */\nexport class Semaphore {\n private storage: SemaphoreStorage;\n private readonly defaultPermits: number;\n private readonly defaultTimeout: number;\n\n /**\n * Creates a new semaphore instance\n * @param options - Configuration options for the semaphore\n */\n public constructor(options: SemaphoreOptions = {}) {\n this.storage = options.storage || new MemorySemaphoreStorage();\n this.defaultPermits = options.permits || 1;\n this.defaultTimeout = options.timeout || 30000;\n }\n\n /**\n * Sets the storage implementation for the semaphore\n * @param storage - The storage implementation to use\n */\n public setStorage(storage: SemaphoreStorage) {\n this.storage = storage;\n }\n\n /**\n * Gets the storage implementation for the semaphore\n * @returns The storage implementation\n */\n public getStorage(): SemaphoreStorage {\n return this.storage;\n }\n\n /**\n * Acquires a permit for the given key\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout\n */\n public async acquire(\n key: string,\n timeout?: number,\n signal?: AbortSignal,\n ): Promise<boolean> {\n // Initialize semaphore if it doesn't exist\n if (this.storage instanceof MemorySemaphoreStorage) {\n const totalPermits = await this.storage.getTotalPermits(key);\n if (totalPermits === 0) {\n (this.storage as MemorySemaphoreStorage).initialize(\n key,\n this.defaultPermits,\n );\n }\n }\n\n return this.storage.acquire(key, timeout || this.defaultTimeout, signal);\n }\n\n /**\n * Releases a permit for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\n public async release(key: string): Promise<void> {\n return this.storage.release(key);\n }\n\n /**\n * Gets the number of available permits for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\n public async getAvailablePermits(key: string): Promise<number> {\n return this.storage.getAvailablePermits(key);\n }\n\n /**\n * Gets the total number of permits for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the total number of permits\n */\n public async getTotalPermits(key: string): Promise<number> {\n return this.storage.getTotalPermits(key);\n }\n\n /**\n * Gets the number of acquired permits for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of acquired permits\n */\n public async getAcquiredPermits(key: string): Promise<number> {\n const total = await this.getTotalPermits(key);\n const available = await this.getAvailablePermits(key);\n return total - available;\n }\n\n /**\n * Executes a function with a permit from the semaphore\n * @param key - The unique identifier for the semaphore\n * @param fn - The function to execute with a permit\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the permit acquisition\n * @returns Promise resolving to the result of the function execution\n * @throws Error if permit acquisition fails or function execution fails\n */\n public async withPermit<T>(\n key: string,\n fn: () => Promise<T> | T,\n timeout?: number,\n signal?: AbortSignal,\n ): Promise<T> {\n const acquired = await this.acquire(key, timeout, signal);\n if (!acquired) {\n throw new Error(`Failed to acquire permit for key: ${key}`);\n }\n\n try {\n return await fn();\n } finally {\n await this.release(key);\n }\n }\n\n /**\n * Gets the current configuration of the semaphore\n * @returns Object containing the current permits and timeout values\n */\n public getConfig(): Omit<SemaphoreOptions, 'storage'> {\n return {\n permits: this.defaultPermits,\n timeout: this.defaultTimeout,\n };\n }\n}\n\n/**\n * Default semaphore instance for global use\n */\nexport const defaultSemaphore = new Semaphore();\n\n/**\n * Convenience function to execute a function with a permit using the default semaphore.\n *\n * @param key - The unique identifier for the semaphore\n * @param fn - The function to execute with a permit\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the permit acquisition\n * @returns Promise resolving to the result of the function execution\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const result = await withPermit('database-connection', async () => {\n * // This code runs with a permit from the semaphore\n * return await executeDatabaseQuery();\n * }, 30000, controller.signal);\n * controller.abort(); // Cancels the permit acquisition\n * ```\n */\nexport async function withPermit<T>(\n key: string,\n fn: () => Promise<T> | T,\n timeout?: number,\n signal?: AbortSignal,\n): Promise<T> {\n return defaultSemaphore.withPermit(key, fn, timeout, signal);\n}\n\n/**\n * Creates a new semaphore instance with the specified configuration\n * @param options - Configuration options for the semaphore\n * @returns New Semaphore instance\n *\n * @example\n * ```typescript\n * const semaphore = createSemaphore({\n * permits: 5,\n * timeout: 60000,\n * storage: new RedisSemaphoreStorage()\n * });\n * ```\n */\nexport function createSemaphore(options: SemaphoreOptions): Semaphore {\n return new Semaphore(options);\n}\n\n/**\n * Acquires a permit using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout\n */\nexport async function acquirePermit(\n key: string,\n timeout?: number,\n signal?: AbortSignal,\n): Promise<boolean> {\n return defaultSemaphore.acquire(key, timeout, signal);\n}\n\n/**\n * Releases a permit using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\nexport async function releasePermit(key: string): Promise<void> {\n return defaultSemaphore.release(key);\n}\n\n/**\n * Gets the number of available permits using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\nexport async function getAvailablePermits(key: string): Promise<number> {\n return defaultSemaphore.getAvailablePermits(key);\n}\n\n/**\n * Gets the number of acquired permits using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of acquired permits\n */\nexport async function getAcquiredPermits(key: string): Promise<number> {\n return defaultSemaphore.getAcquiredPermits(key);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"semaphore.js","names":[],"sources":["../../../src/utils/useful-stuff/semaphore.ts"],"sourcesContent":["/**\n * Async semaphore implementation for controlling access to a limited pool of resources.\n * Allows a specified number of concurrent operations while blocking additional requests.\n */\n\n/**\n * Interface for semaphore storage implementations.\n * Provides methods to store, retrieve, and manage semaphore permit data.\n */\nexport interface SemaphoreStorage {\n /**\n * Attempts to acquire a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available\n */\n acquire(\n key: string,\n timeout?: number,\n signal?: AbortSignal,\n ): Promise<boolean>;\n\n /**\n * Releases a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\n release(key: string): Promise<void>;\n\n /**\n * Gets the number of available permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\n getAvailablePermits(key: string): Promise<number>;\n\n /**\n * Gets the total number of permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the total number of permits\n */\n getTotalPermits(key: string): Promise<number>;\n}\n\n/**\n * Configuration options for semaphore\n */\nexport interface SemaphoreOptions {\n /** Maximum number of concurrent permits allowed. Default: 1 */\n permits?: number;\n /** Default timeout in milliseconds for permit acquisition. Default: 30000 */\n timeout?: number;\n /** Storage implementation for persisting semaphore data. Default: {@link MemorySemaphoreStorage} */\n storage?: SemaphoreStorage;\n}\n\n/**\n * In-memory storage implementation for semaphore permits.\n * Suitable for single-instance applications.\n */\nexport class MemorySemaphoreStorage implements SemaphoreStorage {\n private readonly semaphores = new Map<\n string,\n { total: number; available: number }\n >();\n\n /**\n * Attempts to acquire a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout or no permits available\n */\n async acquire(\n key: string,\n timeout: number = 30000,\n signal?: AbortSignal,\n ): Promise<boolean> {\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n // Check if aborted\n if (signal?.aborted) {\n throw new Error('Permit acquisition was aborted');\n }\n\n const semaphore = this.semaphores.get(key);\n if (semaphore && semaphore.available > 0) {\n semaphore.available--;\n return true;\n }\n await this.delay(10);\n }\n\n return false;\n }\n\n /**\n * Releases a permit for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\n async release(key: string): Promise<void> {\n const semaphore = this.semaphores.get(key);\n if (semaphore && semaphore.available < semaphore.total) {\n semaphore.available++;\n }\n }\n\n /**\n * Gets the number of available permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\n async getAvailablePermits(key: string): Promise<number> {\n const semaphore = this.semaphores.get(key);\n return semaphore ? semaphore.available : 0;\n }\n\n /**\n * Gets the total number of permits for a given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the total number of permits\n */\n async getTotalPermits(key: string): Promise<number> {\n const semaphore = this.semaphores.get(key);\n return semaphore ? semaphore.total : 0;\n }\n\n /**\n * Initializes a semaphore with the specified number of permits\n * @param key - The unique identifier for the semaphore\n * @param permits - The total number of permits to allocate\n */\n initialize(key: string, permits: number): void {\n this.semaphores.set(key, { total: permits, available: permits });\n }\n\n private delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n\n/**\n * Async semaphore implementation that controls access to a limited pool of resources.\n * Allows a specified number of concurrent operations while blocking additional requests.\n */\nexport class Semaphore {\n private storage: SemaphoreStorage;\n private readonly defaultPermits: number;\n private readonly defaultTimeout: number;\n\n /**\n * Creates a new semaphore instance\n * @param options - Configuration options for the semaphore\n */\n public constructor(options: SemaphoreOptions = {}) {\n this.storage = options.storage || new MemorySemaphoreStorage();\n this.defaultPermits = options.permits || 1;\n this.defaultTimeout = options.timeout || 30000;\n }\n\n /**\n * Sets the storage implementation for the semaphore\n * @param storage - The storage implementation to use\n */\n public setStorage(storage: SemaphoreStorage) {\n this.storage = storage;\n }\n\n /**\n * Gets the storage implementation for the semaphore\n * @returns The storage implementation\n */\n public getStorage(): SemaphoreStorage {\n return this.storage;\n }\n\n /**\n * Acquires a permit for the given key\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout\n */\n public async acquire(\n key: string,\n timeout?: number,\n signal?: AbortSignal,\n ): Promise<boolean> {\n // Initialize semaphore if it doesn't exist\n if (this.storage instanceof MemorySemaphoreStorage) {\n const totalPermits = await this.storage.getTotalPermits(key);\n if (totalPermits === 0) {\n (this.storage as MemorySemaphoreStorage).initialize(\n key,\n this.defaultPermits,\n );\n }\n }\n\n return this.storage.acquire(key, timeout || this.defaultTimeout, signal);\n }\n\n /**\n * Releases a permit for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\n public async release(key: string): Promise<void> {\n return this.storage.release(key);\n }\n\n /**\n * Gets the number of available permits for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\n public async getAvailablePermits(key: string): Promise<number> {\n return this.storage.getAvailablePermits(key);\n }\n\n /**\n * Gets the total number of permits for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the total number of permits\n */\n public async getTotalPermits(key: string): Promise<number> {\n return this.storage.getTotalPermits(key);\n }\n\n /**\n * Gets the number of acquired permits for the given key\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of acquired permits\n */\n public async getAcquiredPermits(key: string): Promise<number> {\n const total = await this.getTotalPermits(key);\n const available = await this.getAvailablePermits(key);\n return total - available;\n }\n\n /**\n * Executes a function with a permit from the semaphore\n * @param key - The unique identifier for the semaphore\n * @param fn - The function to execute with a permit\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the permit acquisition\n * @returns Promise resolving to the result of the function execution\n * @throws Error if permit acquisition fails or function execution fails\n */\n public async withPermit<T>(\n key: string,\n fn: () => Promise<T> | T,\n timeout?: number,\n signal?: AbortSignal,\n ): Promise<T> {\n const acquired = await this.acquire(key, timeout, signal);\n if (!acquired) {\n throw new Error(`Failed to acquire permit for key: ${key}`);\n }\n\n try {\n return await fn();\n } finally {\n await this.release(key);\n }\n }\n\n /**\n * Gets the current configuration of the semaphore\n * @returns Object containing the current permits and timeout values\n */\n public getConfig(): Omit<SemaphoreOptions, 'storage'> {\n return {\n permits: this.defaultPermits,\n timeout: this.defaultTimeout,\n };\n }\n}\n\n/**\n * Default semaphore instance for global use\n */\nexport const defaultSemaphore = new Semaphore();\n\n/**\n * Convenience function to execute a function with a permit using the default semaphore.\n *\n * @param key - The unique identifier for the semaphore\n * @param fn - The function to execute with a permit\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the permit acquisition\n * @returns Promise resolving to the result of the function execution\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const result = await withPermit('database-connection', async () => {\n * // This code runs with a permit from the semaphore\n * return await executeDatabaseQuery();\n * }, 30000, controller.signal);\n * controller.abort(); // Cancels the permit acquisition\n * ```\n */\nexport async function withPermit<T>(\n key: string,\n fn: () => Promise<T> | T,\n timeout?: number,\n signal?: AbortSignal,\n): Promise<T> {\n return defaultSemaphore.withPermit(key, fn, timeout, signal);\n}\n\n/**\n * Creates a new semaphore instance with the specified configuration\n * @param options - Configuration options for the semaphore\n * @returns New Semaphore instance\n *\n * @example\n * ```typescript\n * const semaphore = createSemaphore({\n * permits: 5,\n * timeout: 60000,\n * storage: new RedisSemaphoreStorage()\n * });\n * ```\n */\nexport function createSemaphore(options: SemaphoreOptions): Semaphore {\n return new Semaphore(options);\n}\n\n/**\n * Acquires a permit using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @param timeout - Optional timeout in milliseconds for permit acquisition\n * @param signal - Optional AbortSignal for cancelling the acquisition\n * @returns Promise resolving to true if permit was acquired, false if timeout\n */\nexport async function acquirePermit(\n key: string,\n timeout?: number,\n signal?: AbortSignal,\n): Promise<boolean> {\n return defaultSemaphore.acquire(key, timeout, signal);\n}\n\n/**\n * Releases a permit using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @returns Promise that resolves when the permit is released\n */\nexport async function releasePermit(key: string): Promise<void> {\n return defaultSemaphore.release(key);\n}\n\n/**\n * Gets the number of available permits using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of available permits\n */\nexport async function getAvailablePermits(key: string): Promise<number> {\n return defaultSemaphore.getAvailablePermits(key);\n}\n\n/**\n * Gets the number of acquired permits using the default semaphore\n * @param key - The unique identifier for the semaphore\n * @returns Promise resolving to the number of acquired permits\n */\nexport async function getAcquiredPermits(key: string): Promise<number> {\n return defaultSemaphore.getAcquiredPermits(key);\n}\n"],"mappings":"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"}
@@ -93,13 +93,13 @@ declare function noBuildOnly<T extends (...args: any[]) => any>(fn: T): T;
93
93
  */
94
94
  interface SimpleProxy<T extends object> {
95
95
  /**
96
- * The proxied object that mirrors the target.
97
- */
96
+ * The proxied object that mirrors the target.
97
+ */
98
98
  proxy: T;
99
99
  /**
100
- * Sets a new target object for the proxy.
101
- * @param newTarget The new target object to set.
102
- */
100
+ * Sets a new target object for the proxy.
101
+ * @param newTarget The new target object to set.
102
+ */
103
103
  setTarget(newTarget: T): void;
104
104
  }
105
105
  /**
@@ -1,27 +1,5 @@
1
- require('../colors-Csc0X4QJ.js');
2
- require('../ActionRow-CSN_UKmM.js');
3
- const require_commandkit = require('../commandkit-SIjTLD2R.js');
4
- require('../container-DCPljKVH.js');
5
- require('../file-Ca1kpEtE.js');
6
- require('../media-gallery-u3gjX7yD.js');
7
- require('../section-BC8LF-B2.js');
8
- require('../separator-BUTiW7uz.js');
9
- require('../text-display-DANahMN3.js');
10
- require('../label-B6vXvwLM.js');
11
- require('../poll-CFe8yvoJ.js');
12
- require('../display-WDb9wMCv.js');
13
- require('../constants-CxkFFZ7p.js');
14
- require('../types-package-CsTNfvv2.js');
15
- require('../constants-Cw8VjCVz.js');
16
- require('../EventWorkerContext-Dfhgv329.js');
17
- require('../signals-B8z1wJ6W.js');
18
- require('../helpers-Btx1FSZx.js');
19
- require('../MessageCommandParser-Bs9fimmd.js');
20
- require('../CommandsRouter-C_HLsrGX.js');
21
- require('../EventsRouter-DZYIha6m.js');
22
- require('../router-BvamdzoF.js');
23
- require('../common-DSRs_mfw.js');
24
- require('../store-D8r_hryO.js');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_commandkit = require('../commandkit--k6yDJEr.js');
25
3
 
26
4
  exports.JsonSerialize = require_commandkit.JsonSerialize;
27
5
  exports.buildOnly = require_commandkit.buildOnly;
@@ -1,5 +1,39 @@
1
- const require_warning = require('../warning-CszH8HeS.js');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- exports.emitWarning = require_warning.emitWarning;
4
- exports.warnDeprecated = require_warning.warnDeprecated;
5
- exports.warnUnstable = require_warning.warnUnstable;
3
+ //#region src/utils/warning.ts
4
+ const WARNED_KEYS = /* @__PURE__ */ new Set();
5
+ const DEPRECATED_KEYS = /* @__PURE__ */ new Set();
6
+ /**
7
+ * Emit a warning message to the console as a CommandKitWarning.
8
+ * @param message - The warning message to emit.
9
+ * @param code - The warning code (default is 'CommandKitWarning').
10
+ */
11
+ function emitWarning(message, code = "CommandKitWarning") {
12
+ process.emitWarning(message, { code });
13
+ }
14
+ /**
15
+ * Emit a warning for unstable features in CommandKit.
16
+ * @param name - The name of the unstable feature.
17
+ * @example warnUnstable('MyUnstableFeature');
18
+ */
19
+ function warnUnstable(name) {
20
+ if (WARNED_KEYS.has(name)) return;
21
+ WARNED_KEYS.add(name);
22
+ emitWarning(`${name} is unstable and may change in future versions.`, "CommandKitUnstableWarning");
23
+ }
24
+ function warnDeprecated({ what, message, where }) {
25
+ const name = `${what}:${where}`;
26
+ if (DEPRECATED_KEYS.has(name)) return;
27
+ DEPRECATED_KEYS.add(name);
28
+ emitWarning([
29
+ `${what} is deprecated`,
30
+ where ? `in ${where}` : "",
31
+ message || "and may be removed in future versions."
32
+ ].filter(Boolean).join(" "), "CommandKitDeprecatedWarning");
33
+ }
34
+
35
+ //#endregion
36
+ exports.emitWarning = emitWarning;
37
+ exports.warnDeprecated = warnDeprecated;
38
+ exports.warnUnstable = warnUnstable;
39
+ //# sourceMappingURL=warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warning.js","names":[],"sources":["../../src/utils/warning.ts"],"sourcesContent":["const WARNED_KEYS = new Set<string>();\nconst DEPRECATED_KEYS = new Set<string>();\n\n/**\n * Emit a warning message to the console as a CommandKitWarning.\n * @param message - The warning message to emit.\n * @param code - The warning code (default is 'CommandKitWarning').\n */\nexport function emitWarning(message: string, code = 'CommandKitWarning') {\n process.emitWarning(message, { code });\n}\n\n/**\n * Emit a warning for unstable features in CommandKit.\n * @param name - The name of the unstable feature.\n * @example warnUnstable('MyUnstableFeature');\n */\nexport function warnUnstable(name: string) {\n if (WARNED_KEYS.has(name)) return;\n\n WARNED_KEYS.add(name);\n\n emitWarning(\n `${name} is unstable and may change in future versions.`,\n 'CommandKitUnstableWarning',\n );\n}\nexport function warnDeprecated({\n what,\n message,\n where,\n}: {\n what: string;\n where?: string;\n message?: string;\n}) {\n const name = `${what}:${where}`;\n\n if (DEPRECATED_KEYS.has(name)) return;\n\n DEPRECATED_KEYS.add(name);\n\n emitWarning(\n [\n `${what} is deprecated`,\n where ? `in ${where}` : '',\n message || 'and may be removed in future versions.',\n ]\n .filter(Boolean)\n .join(' '),\n 'CommandKitDeprecatedWarning',\n );\n}\n"],"mappings":";;;AAAA,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAM,kCAAkB,IAAI,KAAa;;;;;;AAOzC,SAAgB,YAAY,SAAiB,OAAO,qBAAqB;AACvE,SAAQ,YAAY,SAAS,EAAE,MAAM,CAAC;;;;;;;AAQxC,SAAgB,aAAa,MAAc;AACzC,KAAI,YAAY,IAAI,KAAK,CAAE;AAE3B,aAAY,IAAI,KAAK;AAErB,aACE,GAAG,KAAK,kDACR,4BACD;;AAEH,SAAgB,eAAe,EAC7B,MACA,SACA,SAKC;CACD,MAAM,OAAO,GAAG,KAAK,GAAG;AAExB,KAAI,gBAAgB,IAAI,KAAK,CAAE;AAE/B,iBAAgB,IAAI,KAAK;AAEzB,aACE;EACA,GAAG,KAAE;EACL,QAAQ,MAAM,UAAU;EACxB,WAAW;EAAyC,CAEpD,OAAG,QAAO,CACV,KAAG,IAAM,EACT,8BACD"}
package/dist/version.js CHANGED
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/version.ts
3
4
  /**
@@ -6,7 +7,7 @@
6
7
  /**
7
8
  * The current version of CommandKit.
8
9
  */
9
- const version = "1.2.0-rc.13";
10
+ const version = "1.2.0-rc.15";
10
11
 
11
12
  //#endregion
12
13
  exports.version = version;
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["/**\n * @private\n */\nfunction $version(): string {\n 'use macro';\n return require('../package.json').version;\n}\n\n/**\n * The current version of CommandKit.\n */\nexport const version: string = $version();\n"],"mappings":";;;;;;;;AAWA,MAAa,UAA4B"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["/**\n * @private\n */\nfunction $version(): string {\n 'use macro';\n return require('../package.json').version;\n}\n\n/**\n * The current version of CommandKit.\n */\nexport const version: string = $version();\n"],"mappings":";;;;;;;;;AAWA,MAAa,UAA4B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "commandkit",
3
3
  "description": "Beginner friendly command & event handler for Discord.js",
4
- "version": "1.2.0-rc.13",
4
+ "version": "1.2.0-rc.15",
5
5
  "license": "GPL-3.0-only",
6
6
  "type": "commonjs",
7
7
  "main": "./dist/index.js",
@@ -168,26 +168,23 @@
168
168
  "dependencies": {
169
169
  "@rollup/plugin-json": "^6.1.0",
170
170
  "chokidar": "^4.0.3",
171
- "commander": "^13.0.0",
172
- "directive-to-hof": "^0.0.2",
173
- "dotenv": "^16.4.7",
171
+ "commander": "^14.0.3",
172
+ "directive-to-hof": "^0.0.3",
174
173
  "ms": "^2.1.3",
175
- "ora": "^8.0.1",
174
+ "ora": "^9.3.0",
176
175
  "picocolors": "^1.1.1",
177
- "rfdc": "^1.3.1",
178
- "rimraf": "^6.0.0",
179
- "tsdown": "^0.20.0-beta.3",
176
+ "rimraf": "^6.1.3",
177
+ "tsdown": "^0.21.0-beta.2",
180
178
  "use-macro": "^1.1.0"
181
179
  },
182
180
  "devDependencies": {
183
- "@types/ms": "^2.0.0",
184
- "@types/node": "^22.10.2",
185
- "@types/yargs": "^17.0.32",
186
- "discord.js": "^14.24.0",
187
- "tsx": "^4.19.2",
181
+ "@types/ms": "^2.1.0",
182
+ "@types/node": "^25.3.2",
183
+ "discord.js": "^14.25.1",
184
+ "tsx": "^4.21.0",
188
185
  "typescript": "^5.9.3",
189
- "vitest": "^3.0.5",
190
- "tsconfig": "0.0.0-rc.13"
186
+ "vitest": "^4.0.18",
187
+ "tsconfig": "0.0.0-rc.15"
191
188
  },
192
189
  "engines": {
193
190
  "node": ">=24"
@@ -1,25 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let discord_js = require("discord.js");
3
-
4
- //#region src/components/interactive/action-row/ActionRow.ts
5
- /**
6
- * The action row component.
7
- * @param props The action row properties.
8
- * @returns The commandkit element.
9
- * @example <ActionRow><Button label="Click me" style={ButtonStyle.Primary} customId="click_me" /></ActionRow>
10
- */
11
- function ActionRow(props) {
12
- const row = new discord_js.ActionRowBuilder();
13
- if (Array.isArray(props.children)) row.setComponents(...props.children);
14
- else if (props.children) row.setComponents(props.children);
15
- return row;
16
- }
17
-
18
- //#endregion
19
- Object.defineProperty(exports, 'ActionRow', {
20
- enumerable: true,
21
- get: function () {
22
- return ActionRow;
23
- }
24
- });
25
- //# sourceMappingURL=ActionRow-CSN_UKmM.js.map
@@ -1,88 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let node_events = require("node:events");
3
- node_events = require_chunk.__toESM(node_events);
4
-
5
- //#region src/events/CommandKitEventsChannel.ts
6
- /**
7
- * Represents a channel for emitting and listening to events in CommandKit.
8
- * This class provides methods to manage event listeners and emit events
9
- * within a specific namespace.
10
- */
11
- var CommandKitEventsChannel = class {
12
- emitter = new node_events.default();
13
- /**
14
- * Creates a new instance of CommandKitEventsChannel.
15
- * @param commandkit The CommandKit instance that this channel belongs to.
16
- */
17
- constructor(commandkit) {
18
- this.commandkit = commandkit;
19
- }
20
- /**
21
- * Creates a namespaced event channel. This allows you to manage events
22
- * within a specific namespace, preventing conflicts with other event channels.
23
- * This is useful for organizing events related to different parts of your application.
24
- * @param namespace The namespace for the event channel.
25
- * @returns An object containing methods for managing events within the namespace.
26
- * @example commandkit.events.to('customNamespace').emit('eventName', data);
27
- */
28
- to(namespace) {
29
- return {
30
- on: this.on.bind(this, namespace),
31
- off: this.off.bind(this, namespace),
32
- once: this.once.bind(this, namespace),
33
- emit: this.emit.bind(this, namespace),
34
- removeAllListeners: this.removeAllListeners.bind(this, namespace)
35
- };
36
- }
37
- /**
38
- * Register an event listener for a specific event within the namespace.
39
- * @param namespace The namespace for the event channel.
40
- * @param event The name of the event to listen for.
41
- * @param listener The function to call when the event is emitted.
42
- */
43
- on(namespace, event, listener) {
44
- this.emitter.on(`${namespace}:${event}`, listener);
45
- }
46
- /**
47
- * Unregister an event listener for a specific event within the namespace.
48
- * @param namespace The namespace for the event channel.
49
- * @param event The name of the event to stop listening for.
50
- * @param listener The function that was registered as the listener.
51
- */
52
- off(namespace, event, listener) {
53
- this.emitter.off(`${namespace}:${event}`, listener);
54
- }
55
- /**
56
- * Register an event listener that will be called only once for a specific event
57
- * within the namespace.
58
- * @param namespace The namespace for the event channel.
59
- * @param event The name of the event to listen for.
60
- * @param listener The function to call when the event is emitted.
61
- */
62
- once(namespace, event, listener) {
63
- this.emitter.once(`${namespace}:${event}`, listener);
64
- }
65
- /**
66
- * Emit an event within the specified namespace, calling all registered listeners.
67
- * @param namespace The namespace for the event channel.
68
- * @param event The name of the event to emit.
69
- * @param args The arguments to pass to the listeners.
70
- * @returns A boolean indicating whether any listeners were called.
71
- */
72
- emit(namespace, event, ...args) {
73
- return this.emitter.emit(`${namespace}:${event}`, ...args);
74
- }
75
- removeAllListeners(namespace, event) {
76
- if (event) this.emitter.removeAllListeners(`${namespace}:${event}`);
77
- else this.emitter.removeAllListeners(namespace);
78
- }
79
- };
80
-
81
- //#endregion
82
- Object.defineProperty(exports, 'CommandKitEventsChannel', {
83
- enumerable: true,
84
- get: function () {
85
- return CommandKitEventsChannel;
86
- }
87
- });
88
- //# sourceMappingURL=CommandKitEventsChannel-CnT5ymYe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CommandKitEventsChannel-CnT5ymYe.js","names":[],"sources":["../src/events/CommandKitEventsChannel.ts"],"sourcesContent":["import EventEmitter from 'node:events';\nimport type { CommandKit } from '../commandkit';\nimport type { AsyncFunction, GenericFunction } from '../context/async-context';\n\n/**\n * The function type for event listeners.\n */\nexport type ListenerFunction = GenericFunction | AsyncFunction;\n\n/**\n * Represents a channel for emitting and listening to events in CommandKit.\n * This class provides methods to manage event listeners and emit events\n * within a specific namespace.\n */\nexport class CommandKitEventsChannel {\n private emitter = new EventEmitter();\n\n /**\n * Creates a new instance of CommandKitEventsChannel.\n * @param commandkit The CommandKit instance that this channel belongs to.\n */\n public constructor(public readonly commandkit: CommandKit) {}\n\n /**\n * Creates a namespaced event channel. This allows you to manage events\n * within a specific namespace, preventing conflicts with other event channels.\n * This is useful for organizing events related to different parts of your application.\n * @param namespace The namespace for the event channel.\n * @returns An object containing methods for managing events within the namespace.\n * @example commandkit.events.to('customNamespace').emit('eventName', data);\n */\n public to(namespace: string) {\n return {\n on: this.on.bind(this, namespace),\n off: this.off.bind(this, namespace),\n once: this.once.bind(this, namespace),\n emit: this.emit.bind(this, namespace),\n removeAllListeners: this.removeAllListeners.bind(this, namespace),\n };\n }\n\n /**\n * Register an event listener for a specific event within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to listen for.\n * @param listener The function to call when the event is emitted.\n */\n public on(namespace: string, event: string, listener: ListenerFunction) {\n this.emitter.on(`${namespace}:${event}`, listener);\n }\n\n /**\n * Unregister an event listener for a specific event within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to stop listening for.\n * @param listener The function that was registered as the listener.\n */\n public off(namespace: string, event: string, listener: ListenerFunction) {\n this.emitter.off(`${namespace}:${event}`, listener);\n }\n\n /**\n * Register an event listener that will be called only once for a specific event\n * within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to listen for.\n * @param listener The function to call when the event is emitted.\n */\n public once(namespace: string, event: string, listener: ListenerFunction) {\n this.emitter.once(`${namespace}:${event}`, listener);\n }\n\n /**\n * Emit an event within the specified namespace, calling all registered listeners.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to emit.\n * @param args The arguments to pass to the listeners.\n * @returns A boolean indicating whether any listeners were called.\n */\n public emit(namespace: string, event: string, ...args: any[]) {\n return this.emitter.emit(`${namespace}:${event}`, ...args);\n }\n\n /**\n * Remove all listeners for a specific event or all events within the namespace.\n * @param namespace The namespace for the event channel.\n * @param event The name of the event to remove listeners for. If not provided, all listeners for all events in the namespace will be removed.\n */\n public removeAllListeners(namespace: string): void;\n public removeAllListeners(namespace: string, event: string): void;\n public removeAllListeners(namespace: string, event?: string): void {\n if (event) {\n this.emitter.removeAllListeners(`${namespace}:${event}`);\n } else {\n this.emitter.removeAllListeners(namespace);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAa,0BAAb,MAAqC;CACnC,AAAQ,UAAU,IAAI,qBAAc;;;;;CAMpC,AAAO,YAAY,AAAgB,YAAwB;EAAxB;;;;;;;;;;CAUnC,AAAO,GAAG,WAAmB;AAC3B,SAAO;GACL,IAAI,KAAK,GAAG,KAAK,MAAM,UAAU;GACjC,KAAK,KAAK,IAAI,KAAK,MAAM,UAAU;GACnC,MAAM,KAAK,KAAK,KAAK,MAAM,UAAU;GACrC,MAAM,KAAK,KAAK,KAAK,MAAM,UAAU;GACrC,oBAAoB,KAAK,mBAAmB,KAAK,MAAM,UAAU;GAClE;;;;;;;;CASH,AAAO,GAAG,WAAmB,OAAe,UAA4B;AACtE,OAAK,QAAQ,GAAG,GAAG,UAAU,GAAG,SAAS,SAAS;;;;;;;;CASpD,AAAO,IAAI,WAAmB,OAAe,UAA4B;AACvE,OAAK,QAAQ,IAAI,GAAG,UAAU,GAAG,SAAS,SAAS;;;;;;;;;CAUrD,AAAO,KAAK,WAAmB,OAAe,UAA4B;AACxE,OAAK,QAAQ,KAAK,GAAG,UAAU,GAAG,SAAS,SAAS;;;;;;;;;CAUtD,AAAO,KAAK,WAAmB,OAAe,GAAG,MAAa;AAC5D,SAAO,KAAK,QAAQ,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK;;CAU5D,AAAO,mBAAmB,WAAmB,OAAsB;AACjE,MAAI,MACF,MAAK,QAAQ,mBAAmB,GAAG,UAAU,GAAG,QAAQ;MAExD,MAAK,QAAQ,mBAAmB,UAAU"}