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
@@ -1,113 +0,0 @@
1
-
2
- //#region src/cli/env.ts
3
- /**
4
- * @private
5
- * @internal
6
- */
7
- function DevEnv(_static = false) {
8
- const common = {
9
- NODE_ENV: "development",
10
- COMMANDKIT_IS_DEV: "true",
11
- COMMANDKIT_INTERNAL_IS_CLI_PROCESS: "false",
12
- COMMANDKIT_IS_BUILD: "false"
13
- };
14
- if (_static) return Object.assign({}, common);
15
- return Object.assign({}, process.env, common);
16
- }
17
- /**
18
- * @private
19
- * @internal
20
- */
21
- function ProdEnv(_static = false) {
22
- const common = {
23
- NODE_ENV: "production",
24
- COMMANDKIT_IS_DEV: "false",
25
- COMMANDKIT_INTERNAL_IS_CLI_PROCESS: "false",
26
- COMMANDKIT_IS_BUILD: "false"
27
- };
28
- if (_static) return Object.assign({}, common);
29
- return Object.assign({}, process.env, common);
30
- }
31
- /**
32
- * @private
33
- * @internal
34
- */
35
- const CommonEnvFiles = [".env", ".env.local"];
36
- /**
37
- * @private
38
- * @internal
39
- */
40
- const DevEnvFiles = [".env.development", ".env.development.local"];
41
- /**
42
- * @private
43
- * @internal
44
- */
45
- const ProdEnvFiles = [".env.production", ".env.production.local"];
46
- /**
47
- * @private
48
- * @internal
49
- */
50
- const devEnvFileArgs = [...CommonEnvFiles, ...DevEnvFiles];
51
- /**
52
- * @private
53
- * @internal
54
- */
55
- const prodEnvFileArgs = [...CommonEnvFiles, ...ProdEnvFiles];
56
- /**
57
- * @private
58
- * @internal
59
- */
60
- function setCLIEnv() {
61
- process.env.COMMANDKIT_IS_CLI = "true";
62
- }
63
-
64
- //#endregion
65
- Object.defineProperty(exports, 'CommonEnvFiles', {
66
- enumerable: true,
67
- get: function () {
68
- return CommonEnvFiles;
69
- }
70
- });
71
- Object.defineProperty(exports, 'DevEnv', {
72
- enumerable: true,
73
- get: function () {
74
- return DevEnv;
75
- }
76
- });
77
- Object.defineProperty(exports, 'DevEnvFiles', {
78
- enumerable: true,
79
- get: function () {
80
- return DevEnvFiles;
81
- }
82
- });
83
- Object.defineProperty(exports, 'ProdEnv', {
84
- enumerable: true,
85
- get: function () {
86
- return ProdEnv;
87
- }
88
- });
89
- Object.defineProperty(exports, 'ProdEnvFiles', {
90
- enumerable: true,
91
- get: function () {
92
- return ProdEnvFiles;
93
- }
94
- });
95
- Object.defineProperty(exports, 'devEnvFileArgs', {
96
- enumerable: true,
97
- get: function () {
98
- return devEnvFileArgs;
99
- }
100
- });
101
- Object.defineProperty(exports, 'prodEnvFileArgs', {
102
- enumerable: true,
103
- get: function () {
104
- return prodEnvFileArgs;
105
- }
106
- });
107
- Object.defineProperty(exports, 'setCLIEnv', {
108
- enumerable: true,
109
- get: function () {
110
- return setCLIEnv;
111
- }
112
- });
113
- //# sourceMappingURL=env-CmspDhHy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env-CmspDhHy.js","names":[],"sources":["../src/cli/env.ts"],"sourcesContent":["/**\n * @private\n * @internal\n */\nexport function DevEnv(_static = false) {\n const common = {\n NODE_ENV: 'development',\n COMMANDKIT_IS_DEV: 'true',\n COMMANDKIT_INTERNAL_IS_CLI_PROCESS: 'false',\n COMMANDKIT_IS_BUILD: 'false',\n };\n\n if (_static) return Object.assign({}, common);\n\n return Object.assign({}, process.env, common);\n}\n\n/**\n * @private\n * @internal\n */\nexport function ProdEnv(_static = false) {\n const common = {\n NODE_ENV: 'production',\n COMMANDKIT_IS_DEV: 'false',\n COMMANDKIT_INTERNAL_IS_CLI_PROCESS: 'false',\n COMMANDKIT_IS_BUILD: 'false',\n };\n\n if (_static) return Object.assign({}, common);\n\n return Object.assign({}, process.env, common);\n}\n\n/**\n * @private\n * @internal\n */\nexport const CommonEnvFiles = ['.env', '.env.local'];\n/**\n * @private\n * @internal\n */\nexport const DevEnvFiles = ['.env.development', '.env.development.local'];\n/**\n * @private\n * @internal\n */\nexport const ProdEnvFiles = ['.env.production', '.env.production.local'];\n/**\n * @private\n * @internal\n */\nexport const devEnvFileArgs = [...CommonEnvFiles, ...DevEnvFiles];\n/**\n * @private\n * @internal\n */\nexport const prodEnvFileArgs = [...CommonEnvFiles, ...ProdEnvFiles];\n/**\n * @private\n * @internal\n */\nexport function setCLIEnv() {\n process.env.COMMANDKIT_IS_CLI = 'true';\n}\n"],"mappings":";;;;;;AAIA,SAAgB,OAAO,UAAU,OAAO;CACtC,MAAM,SAAS;EACb,UAAU;EACV,mBAAmB;EACnB,oCAAoC;EACpC,qBAAqB;EACtB;AAED,KAAI,QAAS,QAAO,OAAO,OAAO,EAAE,EAAE,OAAO;AAE7C,QAAO,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK,OAAO;;;;;;AAO/C,SAAgB,QAAQ,UAAU,OAAO;CACvC,MAAM,SAAS;EACb,UAAU;EACV,mBAAmB;EACnB,oCAAoC;EACpC,qBAAqB;EACtB;AAED,KAAI,QAAS,QAAO,OAAO,OAAO,EAAE,EAAE,OAAO;AAE7C,QAAO,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK,OAAO;;;;;;AAO/C,MAAa,iBAAiB,CAAC,QAAQ,aAAa;;;;;AAKpD,MAAa,cAAc,CAAC,oBAAoB,yBAAyB;;;;;AAKzE,MAAa,eAAe,CAAC,mBAAmB,wBAAwB;;;;;AAKxE,MAAa,iBAAiB,CAAC,GAAG,gBAAgB,GAAG,YAAY;;;;;AAKjE,MAAa,kBAAkB,CAAC,GAAG,gBAAgB,GAAG,aAAa;;;;;AAKnE,SAAgB,YAAY;AAC1B,SAAQ,IAAI,oBAAoB"}
@@ -1,73 +0,0 @@
1
-
2
- //#region src/utils/error-codes.ts
3
- /**
4
- * The error codes used by CommandKit.
5
- */
6
- const CommandKitErrorCodes = {
7
- StopMiddlewares: Symbol("kStopMiddlewares"),
8
- ForwardedCommand: Symbol("kForwardedCommand"),
9
- InvalidCommandPrefix: Symbol("kInvalidCommandPrefix"),
10
- PluginCaptureHandle: Symbol("kPluginCaptureHandle"),
11
- StopEvents: Symbol("kStopEvents")
12
- };
13
- /**
14
- * Creates a new CommandKit error with the specified code.
15
- * @param code The error code to assign to the error.
16
- * @returns A new CommandKit error instance.
17
- */
18
- function createCommandKitError(code) {
19
- const error = /* @__PURE__ */ new Error();
20
- Reflect.set(error, "code", code);
21
- return error;
22
- }
23
- /**
24
- * Checks if the given error is a CommandKit error.
25
- * @param error The error to check.
26
- * @returns True if the error is a CommandKit error, false otherwise.
27
- */
28
- function isCommandKitError(error) {
29
- if (!(error instanceof Error)) return false;
30
- const code = Reflect.get(error, "code");
31
- for (const key in CommandKitErrorCodes) if (CommandKitErrorCodes[key] === code) return true;
32
- return false;
33
- }
34
- /**
35
- * Checks if the given error is of a specific CommandKit error type.
36
- * @param error The error to check.
37
- * @param code The error code or an array of error codes to check against.
38
- * @returns True if the error matches the specified code(s), false otherwise.
39
- */
40
- function isErrorType(error, code) {
41
- if (!isCommandKitError(error)) return false;
42
- const errorCode = Reflect.get(error, "code");
43
- if (!errorCode) return false;
44
- if (Array.isArray(code)) return code.includes(errorCode);
45
- return errorCode === code;
46
- }
47
-
48
- //#endregion
49
- Object.defineProperty(exports, 'CommandKitErrorCodes', {
50
- enumerable: true,
51
- get: function () {
52
- return CommandKitErrorCodes;
53
- }
54
- });
55
- Object.defineProperty(exports, 'createCommandKitError', {
56
- enumerable: true,
57
- get: function () {
58
- return createCommandKitError;
59
- }
60
- });
61
- Object.defineProperty(exports, 'isCommandKitError', {
62
- enumerable: true,
63
- get: function () {
64
- return isCommandKitError;
65
- }
66
- });
67
- Object.defineProperty(exports, 'isErrorType', {
68
- enumerable: true,
69
- get: function () {
70
- return isErrorType;
71
- }
72
- });
73
- //# sourceMappingURL=error-codes-Ds0bnPvT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-codes-Ds0bnPvT.js","names":[],"sources":["../src/utils/error-codes.ts"],"sourcesContent":["/**\n * The error codes used by CommandKit.\n */\nexport const CommandKitErrorCodes = {\n /**\n * Error code for exiting middleware.\n */\n StopMiddlewares: Symbol('kStopMiddlewares'),\n /**\n * Error code for forwarded commands.\n */\n ForwardedCommand: Symbol('kForwardedCommand'),\n /**\n * Error code for invalid command prefix.\n */\n InvalidCommandPrefix: Symbol('kInvalidCommandPrefix'),\n /**\n * Error code for plugin capture handle.\n */\n PluginCaptureHandle: Symbol('kPluginCaptureHandle'),\n /**\n * Error code for event interruption signal\n */\n StopEvents: Symbol('kStopEvents'),\n} as const;\n\n/**\n * The type for CommandKit errors.\n */\nexport type CommandKitError = Error & { code: symbol };\n\n/**\n * Creates a new CommandKit error with the specified code.\n * @param code The error code to assign to the error.\n * @returns A new CommandKit error instance.\n */\nexport function createCommandKitError(code: symbol): CommandKitError {\n const error = new Error() as CommandKitError;\n\n Reflect.set(error, 'code', code);\n\n return error;\n}\n\n/**\n * Checks if the given error is a CommandKit error.\n * @param error The error to check.\n * @returns True if the error is a CommandKit error, false otherwise.\n */\nexport function isCommandKitError(error: unknown): error is CommandKitError {\n if (!(error instanceof Error)) return false;\n const code = Reflect.get(error, 'code');\n\n for (const key in CommandKitErrorCodes) {\n if (CommandKitErrorCodes[key as keyof typeof CommandKitErrorCodes] === code)\n return true;\n }\n\n return false;\n}\n\n/**\n * Checks if the given error is of a specific CommandKit error type.\n * @param error The error to check.\n * @param code The error code or an array of error codes to check against.\n * @returns True if the error matches the specified code(s), false otherwise.\n */\nexport function isErrorType(error: unknown, code: symbol | symbol[]): boolean {\n if (!isCommandKitError(error)) return false;\n const errorCode = Reflect.get(error, 'code');\n\n if (!errorCode) return false;\n\n if (Array.isArray(code)) return code.includes(errorCode);\n\n return errorCode === code;\n}\n"],"mappings":";;;;;AAGA,MAAa,uBAAuB;CAIlC,iBAAiB,OAAO,mBAAmB;CAI3C,kBAAkB,OAAO,oBAAoB;CAI7C,sBAAsB,OAAO,wBAAwB;CAIrD,qBAAqB,OAAO,uBAAuB;CAInD,YAAY,OAAO,cAAc;CAClC;;;;;;AAYD,SAAgB,sBAAsB,MAA+B;CACnE,MAAM,wBAAQ,IAAI,OAAO;AAEzB,SAAQ,IAAI,OAAO,QAAQ,KAAK;AAEhC,QAAO;;;;;;;AAQT,SAAgB,kBAAkB,OAA0C;AAC1E,KAAI,EAAE,iBAAiB,OAAQ,QAAO;CACtC,MAAM,OAAO,QAAQ,IAAI,OAAO,OAAO;AAEvC,MAAK,MAAM,OAAO,qBAChB,KAAI,qBAAqB,SAA8C,KACvE,QAAE;AAGJ,QAAO;;;;;;;;AAST,SAAgB,YAAY,OAAgB,MAAkC;AAC5E,KAAI,CAAC,kBAAkB,MAAM,CAAE,QAAO;CACtC,MAAM,YAAY,QAAQ,IAAI,OAAO,OAAO;AAE5C,KAAI,CAAC,UAAW,QAAO;AAEvB,KAAI,MAAM,QAAQ,KAAK,CAAE,QAAO,KAAK,SAAS,UAAU;AAExD,QAAO,cAAc"}
@@ -1,28 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let discord_js = require("discord.js");
3
-
4
- //#region src/components/display/file.ts
5
- /**
6
- * The file component
7
- * @param props - The properties for the file component.
8
- * @returns The file builder instance.
9
- * @example ```tsx
10
- * import { File } from 'commandkit';
11
- *
12
- * const file = <File url="https://example.com/file.png" />;
13
- * ```
14
- */
15
- function File(props) {
16
- const file = new discord_js.FileBuilder(props);
17
- if (props.url != null) file.setURL(props.url);
18
- return file;
19
- }
20
-
21
- //#endregion
22
- Object.defineProperty(exports, 'File', {
23
- enumerable: true,
24
- get: function () {
25
- return File;
26
- }
27
- });
28
- //# sourceMappingURL=file-Ca1kpEtE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-Ca1kpEtE.js","names":[],"sources":["../src/components/display/file.ts"],"sourcesContent":["import { FileBuilder, FileComponentData } from 'discord.js';\n\n/**\n * Represents the properties for a file component.\n */\nexport interface FileProps extends Omit<FileComponentData, 'type' | 'file'> {\n url: string;\n}\n\n/**\n * The file component\n * @param props - The properties for the file component.\n * @returns The file builder instance.\n * @example ```tsx\n * import { File } from 'commandkit';\n *\n * const file = <File url=\"https://example.com/file.png\" />;\n * ```\n */\nexport function File(props: FileProps) {\n const file = new FileBuilder(props);\n\n if (props.url != null) {\n file.setURL(props.url);\n }\n\n return file;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,KAAK,OAAkB;CACrC,MAAM,OAAO,IAAI,uBAAY,MAAM;AAEnC,KAAI,MAAM,OAAO,KACf,MAAK,OAAO,MAAM,IAAI;AAGxB,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"feature-flags.js","names":[],"sources":["../../src/flags/feature-flags.ts"],"sourcesContent":["import { getCommandKit, getContext } from '../context/async-context';\nimport { eventWorkerContext } from '../app/events/EventWorkerContext';\nimport { ParsedEvent } from '../app/router';\nimport type { CommandKit } from '../commandkit';\nimport {\n AutocompleteInteraction,\n ChatInputCommandInteraction,\n Client,\n ClientEvents,\n ContextMenuCommandInteraction,\n Guild,\n Message,\n TextBasedChannel,\n} from 'discord.js';\nimport { LoadedCommand } from '../app';\nimport { defer, JsonSerialize } from '../utils/utilities';\nimport { AnalyticsEvents } from '../analytics/constants';\nimport { FlagProvider, FlagConfiguration } from './FlagProvider';\nimport { Logger } from '../logger/Logger';\n\n// Global flag provider\nlet flagProvider: FlagProvider | null = null;\n\n/**\n * Set the global flag provider for all feature flags\n */\nexport function setFlagProvider(provider: FlagProvider): void {\n flagProvider = provider;\n}\n\n/**\n * @private\n */\nexport type MaybePromise<T> = T | Promise<T>;\n\n/**\n * Function type for identifying entities in the context of feature flags.\n * This function should return an object representing the entity that will be used\n * to evaluate the feature flag.\n * It can be synchronous or asynchronous.\n */\nexport type IdentifyFunction<R> = (\n context: EvaluationContext,\n) => MaybePromise<R>;\n\n/**\n * Function type for deciding the outcome of a feature flag based on the provided entities.\n * This function receives an object containing the entities and optionally the provider configuration,\n * and should return the result of the decision.\n * It can be synchronous or asynchronous.\n */\nexport type DecideFunction<E, R> = (data: {\n entities: E;\n provider?: FlagConfiguration | null;\n}) => MaybePromise<R>;\n\n/**\n * Definition for a feature flag, including its key, description, identify function,\n * and decide function.\n * The identify function is used to determine the entities that will be evaluated\n * against the feature flag, while the decide function contains the logic for\n * determining the outcome of the flag based on those entities.\n */\nexport interface FeatureFlagDefinition<R, Entity> {\n /**\n * Unique key for the feature flag.\n * Should be a string that identifies the flag.\n */\n key: string;\n /**\n * Optional description of the feature flag.\n * This can be used for documentation or debugging purposes.\n */\n description?: string;\n /**\n * Optional flag to enable integration with an external flag provider.\n * If true, the flag will use the global flag provider to determine its state.\n * Default: false\n */\n identify?: IdentifyFunction<Entity>;\n /**\n * Function to decide the outcome of the feature flag.\n * This function receives the identified entities and should return the result of the decision.\n */\n decide: DecideFunction<Entity, R>;\n /**\n * Whether to disable analytics tracking for this flag.\n * Default: false\n */\n disableAnalytics?: boolean;\n}\n\n/**\n * Context for evaluating command flags in CommandKit.\n */\nexport interface CommandFlagContext {\n /**\n * The Discord client instance.\n * This is the main entry point for interacting with the Discord API.\n */\n client: Client<true>;\n /**\n * The CommandKit instance, which provides access to the command framework.\n * This includes commands, events, and other features of CommandKit.\n */\n commandkit: CommandKit;\n /**\n * The command context, which includes information about the command being executed.\n * This can include the interaction, message, guild, channel, and the loaded command.\n */\n command: {\n /**\n * The interaction object if the command was invoked via an interaction.\n * This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction.\n */\n interaction?:\n | ChatInputCommandInteraction\n | AutocompleteInteraction\n | ContextMenuCommandInteraction;\n /**\n * The message object if the command was invoked via a message.\n */\n message?: Message;\n /**\n * The guild where the command was invoked, if applicable.\n * This will be null for commands invoked in DMs.\n */\n guild: Guild | null;\n /**\n * The channel where the command was invoked.\n * This can be a text channel, DM channel, or any other type of text-based channel.\n */\n channel: TextBasedChannel | null;\n /**\n * The loaded command instance that is being executed.\n * This contains the command's metadata and logic.\n */\n command: LoadedCommand;\n };\n /**\n * The event context is null for command flags, as they are not tied to a specific event.\n * This is used to differentiate between command and event flags.\n */\n event: null;\n}\n\n/**\n * Context for evaluating event flags in CommandKit.\n */\nexport interface EventFlagContext {\n /**\n * The Discord client instance.\n * This is the main entry point for interacting with the Discord API.\n */\n client: Client<true>;\n /**\n * The CommandKit instance, which provides access to the command framework.\n * This includes commands, events, and other features of CommandKit.\n */\n commandkit: CommandKit;\n /**\n * The event context, which includes information about the event being processed.\n * This can include the parsed event data, the event name, and the namespace if applicable.\n */\n event: {\n /**\n * The parsed event data, which contains the raw data from the event.\n * This can include information like user IDs, channel IDs, and other relevant data.\n */\n data: ParsedEvent;\n /**\n * The name of the event being processed.\n * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'.\n */\n event: string;\n /**\n * The namespace of the event, if applicable.\n * This can be used to group related events or commands together.\n * It is null if the event does not belong to a specific namespace.\n */\n namespace: string | null;\n /**\n * The arguments passed to the event handler.\n * This is an array of arguments that were passed when the event was triggered.\n * It can be used to access specific data related to the event.\n */\n arguments: any[];\n /**\n * A function to retrieve the arguments for a specific event type.\n * This allows for type-safe access to the arguments based on the event name.\n * @param event - The name of the event to retrieve arguments for.\n */\n argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];\n };\n /**\n * The command context is null for event flags, as they are not tied to a specific command.\n * This is used to differentiate between command and event flags.\n */\n command: null;\n}\n\n/**\n * Combined context type for feature flag evaluation.\n */\nexport type EvaluationContext = CommandFlagContext | EventFlagContext;\n\n/**\n * Function type for custom evaluation of feature flags.\n * This function can be used to provide a custom evaluation context for the flag.\n * It should return an object representing the entities to be evaluated.\n */\nexport type CustomEvaluationFunction<E> = () => MaybePromise<E>;\n\n/**\n * Context for custom evaluation of feature flags.\n * This allows for more flexible evaluation based on custom logic or external data.\n * The identify function can be a direct object or a function that returns the entities.\n */\nexport type CustomEvaluationContext<E> = {\n /**\n * Optional function to identify the entities for evaluation.\n * This can be a function that returns the entities based on the current context.\n */\n identify: E | CustomEvaluationFunction<E>;\n};\n\nexport interface FlagRunner<E, R> {\n /**\n * Execute the feature flag evaluation with the provided entities.\n * This method will run the identify and decide functions to determine the flag's outcome.\n * @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.\n * @returns A promise that resolves to the result of the feature flag evaluation.\n */\n (): Promise<R>;\n /**\n * Run the feature flag evaluation with a custom context.\n * This allows for more flexible evaluation based on custom logic or external data.\n * @param context - The custom evaluation context containing the identify function or object.\n * @returns A promise that resolves to the result of the feature flag evaluation.\n */\n run(context: CustomEvaluationContext<E>): Promise<R>;\n}\n\n/**\n * Class representing a feature flag in CommandKit.\n */\nexport class FeatureFlag<R, T> {\n private commandkit: CommandKit;\n\n /**\n * Create a new feature flag.\n * @param options - The options for the feature flag.\n */\n public constructor(public readonly options: FeatureFlagDefinition<R, T>) {\n this.commandkit = getCommandKit(true);\n const FlagStore = this.commandkit.flags;\n\n if (FlagStore.has(options.key)) {\n throw new Error(`Feature flag with key \"${options.key}\" already exists.`);\n }\n\n FlagStore.set(options.key, this);\n }\n\n private getContext(): EvaluationContext {\n const env = getContext();\n\n if (env?.context) {\n const {\n client,\n commandkit,\n interaction,\n message,\n guild,\n channel,\n command,\n } = env.context;\n\n return {\n client: client as Client<true>,\n commandkit,\n command: {\n interaction,\n message,\n guild,\n channel,\n command,\n },\n event: null,\n };\n }\n\n const eventCtx = eventWorkerContext.getStore();\n\n if (eventCtx) {\n const { commandkit, data, event, namespace } = eventCtx;\n\n return {\n client: commandkit.client as Client<true>,\n commandkit,\n event: {\n data,\n event,\n namespace,\n arguments: eventCtx.arguments,\n argumentsAs: (eventName) => {\n const args = eventCtx.arguments as ClientEvents[typeof eventName];\n return args;\n },\n },\n command: null,\n };\n }\n\n throw new Error(\n 'Could not determine the execution context. Feature flags may only be used inside a command or event.',\n );\n }\n\n /**\n * Execute the feature flag evaluation.\n * @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.\n * @returns A promise that resolves to the result of the feature flag evaluation.\n */\n public async execute(res?: T): Promise<R> {\n const { decide, identify, disableAnalytics } = this.options;\n\n const identificationStart = performance.now();\n const entities =\n res ??\n (await (async () => {\n const ctx = this.getContext();\n return (await identify?.(ctx)) ?? ({} as T);\n })());\n const identificationTime = performance.now() - identificationStart;\n\n // Get provider configuration if global provider is available\n let providerConfig: FlagConfiguration | null = null;\n if (flagProvider) {\n try {\n providerConfig = await flagProvider.getFlag(this.options.key, entities);\n\n // If provider says flag is disabled, return early with default behavior\n if (providerConfig && !providerConfig.enabled) {\n // For boolean flags, return false; for others, let decide function handle it\n if (typeof decide === 'function') {\n const decisionResult = await decide({\n entities,\n provider: providerConfig,\n });\n return decisionResult as R;\n }\n }\n } catch (error) {\n Logger.error`Error fetching flag provider configuration for \"${this.options.key}\": ${error}`;\n // continue with local decision if provider fails\n }\n }\n\n const decisionStart = performance.now();\n const decisionResult = await decide({\n entities,\n provider: providerConfig,\n });\n const decisionTime = performance.now() - decisionStart;\n\n // Skip analytics if disabled\n if (!disableAnalytics) {\n defer(async () => {\n await this.commandkit.analytics.track({\n name: AnalyticsEvents.FEATURE_FLAG_METRICS,\n data: {\n flag: this.options.key,\n identificationTime: identificationTime.toFixed(2),\n decisionTime: decisionTime.toFixed(2),\n usedProvider: flagProvider !== null,\n providerEnabled: providerConfig?.enabled ?? null,\n },\n });\n });\n\n defer(async () => {\n await this.commandkit.analytics.track({\n name: AnalyticsEvents.FEATURE_FLAG_DECISION,\n id:\n entities &&\n typeof entities === 'object' &&\n 'id' in entities &&\n typeof entities.id === 'string'\n ? entities.id\n : undefined,\n data: {\n flag: this.options.key,\n decision: JsonSerialize(decisionResult, 'unknown'),\n providerUsed: flagProvider !== null,\n },\n });\n });\n }\n\n return decisionResult as R;\n }\n}\n\n/**\n * Create a new feature flag.\n * @param options - The options for the feature flag.\n * @returns A new instance of the FeatureFlag class.\n */\nexport function flag<Returns = boolean, Entity = Record<any, any>>(\n options: FeatureFlagDefinition<Returns, Entity>,\n): FlagRunner<Entity, Returns> {\n const flag = new FeatureFlag<Returns, Entity>(options);\n const runner = flag.execute.bind(flag, undefined) as FlagRunner<\n Entity,\n Returns\n >;\n\n runner.run = async function (ctx) {\n if (!ctx?.identify) {\n throw new Error(\n 'Custom evaluation context must have an identify function or object.',\n );\n }\n\n const context = (\n typeof ctx === 'function'\n ? await (ctx as CustomEvaluationFunction<Entity>)()\n : ctx\n ) as Entity;\n\n const decisionResult = await flag.execute(context);\n\n return decisionResult;\n };\n\n return runner;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAqBI,eAAoC;;;;AAKxC,SAAgB,gBAAgB,UAA8B;AAC5D,gBAAe;;;;;AA2NjB,IAAa,cAAb,MAA+B;CAC7B,AAAQ;;;;;CAMR,AAAO,YAAY,AAAgB,SAAsC;EAAtC;AACjC,OAAK,aAAa,iCAAc,KAAK;EACrC,MAAM,YAAY,KAAK,WAAW;AAElC,MAAI,UAAU,IAAI,QAAQ,IAAI,CAC5B,OAAM,IAAI,MAAM,0BAA0B,QAAQ,IAAI,mBAAmB;AAG3E,YAAU,IAAI,QAAQ,KAAK,KAAK;;CAGlC,AAAQ,aAAgC;EACtC,MAAM,MAAM,+BAAY;AAExB,gDAAI,IAAK,SAAS;GAChB,MAAM,EACJ,QACA,YACA,aACA,SACA,OACA,SACA,YACE,IAAI;AAER,UAAO;IACG;IACR;IACA,SAAS;KACP;KACA;KACA;KACA;KACA;KACD;IACD,OAAO;IACR;;EAGH,MAAM,WAAW,8CAAmB,UAAU;AAE9C,MAAI,UAAU;GACZ,MAAM,EAAE,YAAY,MAAM,OAAO,cAAc;AAE/C,UAAO;IACL,QAAQ,WAAW;IACnB;IACA,OAAO;KACL;KACA;KACA;KACA,WAAW,SAAS;KACpB,cAAc,cAAc;AAE1B,aADa,SAAS;;KAGzB;IACD,SAAS;IACV;;AAGH,QAAM,IAAI,MACR,uGACD;;;;;;;CAQH,MAAa,QAAQ,KAAqB;EACxC,MAAM,EAAE,QAAQ,UAAU,qBAAqB,KAAK;EAEpD,MAAM,sBAAsB,YAAY,KAAK;EAC7C,MAAM,WACN,OACA,OAAG,YAAgB;GACjB,MAAE,MAAU,KAAE,YAAe;AAC7B,UAAQ,2DAAE,SAAe,IAAE,KAAO,EAAE;MAClC;EACJ,MAAM,qBAAqB,YAAY,KAAK,GAAG;EAG/C,IAAI,iBAA2C;AAC/C,MAAI,aACF,KAAI;AACF,oBAAiB,MAAM,aAAa,QAAQ,KAAK,QAAQ,KAAK,SAAS;AAGvE,OAAI,kBAAkB,CAAC,eAAe,SAEpC;QAAI,OAAO,WAAW,WAKpB,QAJuB,MAAM,OAAO;KAClC;KACA,UAAU;KACX,CAAC;;WAIC,OAAO;AACd,6BAAO,KAAK,mDAAmD,KAAK,QAAQ,IAAI,KAAK;;EAKzF,MAAM,gBAAgB,YAAY,KAAK;EACvC,MAAM,iBAAiB,MAAM,OAAO;GAClC;GACA,UAAU;GACX,CAAC;EACF,MAAM,eAAe,YAAY,KAAK,GAAG;AAGzC,MAAI,CAAC,kBAAkB;AACrB,4BAAM,YAAY;AAChB,UAAM,KAAK,WAAW,UAAU,MAAM;KACpC,MAAM,oCAAgB;KACtB,MAAM;MACJ,MAAM,KAAK,QAAQ;MACnB,oBAAoB,mBAAmB,QAAQ,EAAE;MACjD,cAAc,aAAa,QAAQ,EAAE;MACrC,cAAc,iBAAiB;MAC/B,kFAAiB,eAAgB,YAAW;MAC7C;KACF,CAAC;KACF;AAEF,4BAAM,YAAY;AAChB,UAAM,KAAK,WAAW,UAAU,MAAM;KACpC,MAAM,oCAAgB;KACtB,IACA,YACA,OAAE,aAAkB,YACpB,QAAO,YACP,OAAE,SAAO,OAAc,WACvB,SAAM,KACN;KACA,MAAM;MACJ,MAAM,KAAK,QAAQ;MACnB,UAAU,iCAAc,gBAAgB,UAAU;MAClD,cAAc,iBAAiB;MAChC;KACF,CAAC;KACF;;AAGJ,SAAO;;;;;;;;AASX,SAAgB,KAChB,SAC8B;CAC5B,MAAM,OAAO,IAAI,YAA6B,QAAQ;CACtD,MAAM,SAAS,KAAK,QAAQ,KAAK,MAAM,OAAU;AAKjD,QAAO,MAAM,eAAgB,KAAK;AAChC,MAAI,4CAAC,IAAK,UACR,OAAM,IAAI,MACR,sEACD;EAGH,MAAM,UACN,OAAE,QAAa,aACf,MAAM,KAAuC,GAC7C;AAKA,SAFuB,MAAM,KAAK,QAAQ,QAAQ;;AAKpD,QAAO"}
@@ -1,35 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let discord_js = require("discord.js");
3
-
4
- //#region src/app/commands/helpers.ts
5
- /**
6
- * Type guard to check if a command source is a Discord message.
7
- * @param source - The command source to check
8
- * @returns True if the source is a Message
9
- */
10
- function isMessageSource(source) {
11
- return source instanceof discord_js.Message;
12
- }
13
- /**
14
- * Type guard to check if a command source is a Discord interaction.
15
- * @param source - The command source to check
16
- * @returns True if the source is an Interaction
17
- */
18
- function isInteractionSource(source) {
19
- return !isMessageSource(source);
20
- }
21
-
22
- //#endregion
23
- Object.defineProperty(exports, 'isInteractionSource', {
24
- enumerable: true,
25
- get: function () {
26
- return isInteractionSource;
27
- }
28
- });
29
- Object.defineProperty(exports, 'isMessageSource', {
30
- enumerable: true,
31
- get: function () {
32
- return isMessageSource;
33
- }
34
- });
35
- //# sourceMappingURL=helpers-Btx1FSZx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-Btx1FSZx.js","names":[],"sources":["../src/app/commands/helpers.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\n\n/**\n * Union type representing possible command sources.\n */\nexport type CommandSource = Interaction | Message;\n\n/**\n * Type guard to check if a command source is a Discord message.\n * @param source - The command source to check\n * @returns True if the source is a Message\n */\nexport function isMessageSource(source: CommandSource): source is Message {\n return source instanceof Message;\n}\n\n/**\n * Type guard to check if a command source is a Discord interaction.\n * @param source - The command source to check\n * @returns True if the source is an Interaction\n */\nexport function isInteractionSource(\n source: CommandSource,\n): source is Interaction {\n return !isMessageSource(source);\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,gBAAgB,QAA0C;AACxE,QAAO,kBAAkB;;;;;;;AAQ3B,SAAgB,oBAChB,QACwB;AACtB,QAAO,CAAC,gBAAgB,OAAO"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { CommandKit } from './commandkit';\n\nexport default CommandKit;\n\nexport * from './commandkit';\nexport * from './components';\nexport * from './components/common/EventInterceptor';\nexport * from './config/config';\nexport * from './context/async-context';\nexport {\n type CommandKitEnvironmentInternalData,\n CommandKitEnvironment,\n CommandKitEnvironmentType,\n cancelAfter as unstable_cancelAfter,\n after as unstable_after,\n} from './context/environment';\nexport * from './app/index';\nexport * from './logger/DefaultLogger';\nexport * from './logger/ILogger';\nexport * from './logger/Logger';\nexport * from './app/router/index';\nexport type * from './types';\nexport * from './version';\nexport * from './plugins/index';\nexport * from './flags/feature-flags';\nexport {\n getCurrentDirectory,\n getSourceDirectories,\n devOnly,\n debounce,\n defer,\n} from './utils/utilities';\nexport { warnDeprecated, emitWarning, warnUnstable } from './utils/warning';\nexport { toFileURL } from './utils/resolve-file-url';\nexport * from './app/interrupt/signals';\nexport type { CommandKitHMREvent } from './utils/dev-hooks';\nexport * from './utils/constants';\nexport * from './app/events/EventWorkerContext';\nexport { CommandKitErrorCodes, isErrorType } from './utils/error-codes';\nexport { Collection, type Client } from 'discord.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kBAAe"}
@@ -1,35 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- const require_common = require('./common-CEordwf3.js');
3
- let discord_js = require("discord.js");
4
-
5
- //#region src/components/display/label.ts
6
- /**
7
- * The label component wraps modal components with text as a label and optional description.
8
- * @param props The label properties.
9
- * @returns The label builder instance.
10
- * @example ```tsx
11
- * import { Label } from 'commandkit';
12
- *
13
- * const label = <Label label="Name" description="Enter your name">
14
- * <ShortInput customId="name" label="Name" placeholder="John" required />
15
- * </Label>;
16
- * ```
17
- */
18
- function Label(props) {
19
- const { children, id, ...rest } = props;
20
- const label = new discord_js.LabelBuilder({
21
- ...rest,
22
- component: children
23
- });
24
- require_common.applyId(props, label);
25
- return label;
26
- }
27
-
28
- //#endregion
29
- Object.defineProperty(exports, 'Label', {
30
- enumerable: true,
31
- get: function () {
32
- return Label;
33
- }
34
- });
35
- //# sourceMappingURL=label-B6vXvwLM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"label-B6vXvwLM.js","names":[],"sources":["../src/components/display/label.ts"],"sourcesContent":["import {\n APIComponentInLabel,\n LabelBuilder,\n type LabelBuilderData,\n} from 'discord.js';\nimport { applyId } from './common';\n\n/**\n * The label properties for the label component.\n */\nexport interface LabelProps\n extends Omit<LabelBuilderData, 'component' | 'type'> {\n /**\n * The component that will be wrapped by the label component.\n */\n children: LabelBuilderData['component'] & {};\n}\n\n/**\n * The label component wraps modal components with text as a label and optional description.\n * @param props The label properties.\n * @returns The label builder instance.\n * @example ```tsx\n * import { Label } from 'commandkit';\n *\n * const label = <Label label=\"Name\" description=\"Enter your name\">\n * <ShortInput customId=\"name\" label=\"Name\" placeholder=\"John\" required />\n * </Label>;\n * ```\n */\nexport function Label(props: LabelProps) {\n const { children, id, ...rest } = props;\n\n const label = new LabelBuilder({\n ...rest,\n // channel select menu builder is missing?\n component: children as unknown as APIComponentInLabel,\n });\n\n applyId(props, label);\n\n return label;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,SAAgB,MAAM,OAAmB;CACvC,MAAM,EAAE,UAAU,IAAI,GAAG,SAAS;CAElC,MAAM,QAAQ,IAAI,wBAAa;EAC7B,GAAG;EAEH,WAAW;EACZ,CAAC;AAEF,wBAAQ,OAAO,MAAM;AAErB,QAAO"}
@@ -1,61 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- const require_common = require('./common-CEordwf3.js');
3
- let discord_js = require("discord.js");
4
-
5
- //#region src/components/display/media-gallery.ts
6
- /**
7
- * The media gallery component
8
- * @param props The properties for the media gallery component.
9
- * @returns The media gallery builder instance.
10
- * @example ```tsx
11
- * import { MediaGallery } from 'commandkit';
12
- *
13
- * const gallery = (
14
- * <MediaGallery>
15
- * <MediaGalleryItem url="https://example.com/image1.png" description="Image 1" />
16
- * <MediaGalleryItem url="https://example.com/image2.png" description="Image 2" />
17
- * </MediaGallery>
18
- * );
19
- * ```
20
- */
21
- function MediaGallery(props) {
22
- const gallery = new discord_js.MediaGalleryBuilder();
23
- require_common.applyId(props, gallery);
24
- if (props.children != null) {
25
- if (!Array.isArray(props.children)) props.children = [props.children];
26
- gallery.addItems(props.children.flat());
27
- }
28
- return gallery;
29
- }
30
- /**
31
- * The media gallery item component
32
- * @param props The properties for the media gallery item component.
33
- * @returns The media gallery item builder instance.
34
- * @example ```tsx
35
- * import { MediaGalleryItem } from 'commandkit';
36
- *
37
- * const item = <MediaGalleryItem url="https://example.com/image.png" description="An image" />;
38
- * ```
39
- */
40
- function MediaGalleryItem(props) {
41
- const item = new discord_js.MediaGalleryItemBuilder();
42
- if (props.description != null) item.setDescription(props.description);
43
- if (props.spoiler != null) item.setSpoiler(props.spoiler);
44
- if (props.url != null) item.setURL(props.url);
45
- return item;
46
- }
47
-
48
- //#endregion
49
- Object.defineProperty(exports, 'MediaGallery', {
50
- enumerable: true,
51
- get: function () {
52
- return MediaGallery;
53
- }
54
- });
55
- Object.defineProperty(exports, 'MediaGalleryItem', {
56
- enumerable: true,
57
- get: function () {
58
- return MediaGalleryItem;
59
- }
60
- });
61
- //# sourceMappingURL=media-gallery-u3gjX7yD.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media-gallery-u3gjX7yD.js","names":[],"sources":["../src/components/display/media-gallery.ts"],"sourcesContent":["import { MediaGalleryBuilder, MediaGalleryItemBuilder } from 'discord.js';\nimport { applyId } from './common';\n\n/**\n * Represents the properties for a media gallery component.\n */\nexport interface MediaGalleryProps {\n id?: number;\n children?: MediaGalleryItemBuilder[];\n}\n\n/**\n * The media gallery component\n * @param props The properties for the media gallery component.\n * @returns The media gallery builder instance.\n * @example ```tsx\n * import { MediaGallery } from 'commandkit';\n *\n * const gallery = (\n * <MediaGallery>\n * <MediaGalleryItem url=\"https://example.com/image1.png\" description=\"Image 1\" />\n * <MediaGalleryItem url=\"https://example.com/image2.png\" description=\"Image 2\" />\n * </MediaGallery>\n * );\n * ```\n */\nexport function MediaGallery(props: MediaGalleryProps) {\n const gallery = new MediaGalleryBuilder();\n\n applyId(props, gallery);\n\n if (props.children != null) {\n if (!Array.isArray(props.children)) props.children = [props.children];\n gallery.addItems(props.children.flat());\n }\n\n return gallery;\n}\n\n/**\n * Represents the properties for a media gallery item component.\n */\nexport interface MediaGalleryItemProps {\n description?: string;\n spoiler?: boolean;\n url?: string;\n}\n\n/**\n * The media gallery item component\n * @param props The properties for the media gallery item component.\n * @returns The media gallery item builder instance.\n * @example ```tsx\n * import { MediaGalleryItem } from 'commandkit';\n *\n * const item = <MediaGalleryItem url=\"https://example.com/image.png\" description=\"An image\" />;\n * ```\n */\nexport function MediaGalleryItem(props: MediaGalleryItemProps) {\n const item = new MediaGalleryItemBuilder();\n\n if (props.description != null) {\n item.setDescription(props.description);\n }\n\n if (props.spoiler != null) {\n item.setSpoiler(props.spoiler);\n }\n\n if (props.url != null) {\n item.setURL(props.url);\n }\n\n return item;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,aAAa,OAA0B;CACrD,MAAM,UAAU,IAAI,gCAAqB;AAEzC,wBAAQ,OAAO,QAAQ;AAEvB,KAAI,MAAM,YAAY,MAAM;AAC1B,MAAI,CAAC,MAAM,QAAQ,MAAM,SAAS,CAAE,OAAM,WAAW,CAAC,MAAM,SAAS;AACrE,UAAQ,SAAS,MAAM,SAAS,MAAM,CAAC;;AAGzC,QAAO;;;;;;;;;;;;AAsBT,SAAgB,iBAAiB,OAA8B;CAC7D,MAAM,OAAO,IAAI,oCAAyB;AAE1C,KAAI,MAAM,eAAe,KACvB,MAAK,eAAe,MAAM,YAAY;AAGxC,KAAI,MAAM,WAAW,KACnB,MAAK,WAAW,MAAM,QAAQ;AAGhC,KAAI,MAAM,OAAO,KACf,MAAK,OAAO,MAAM,IAAI;AAGxB,QAAO"}
@@ -1,100 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let discord_js = require("discord.js");
3
-
4
- //#region src/components/display/poll.ts
5
- var PollChildType = /* @__PURE__ */ function(PollChildType) {
6
- PollChildType[PollChildType["Answer"] = 0] = "Answer";
7
- PollChildType[PollChildType["Question"] = 1] = "Question";
8
- return PollChildType;
9
- }(PollChildType || {});
10
- /**
11
- * The poll component creates a Discord poll with a question and multiple answer options.
12
- * @param props The poll properties.
13
- * @returns The poll data object.
14
- * @example ```tsx
15
- * import { Poll, PollQuestion, PollAnswer } from 'commandkit';
16
- *
17
- * const poll = <Poll duration={24} allowMultiselect={false}>
18
- * <PollQuestion>What's your favorite color?</PollQuestion>
19
- * <PollAnswer emoji="🟥">Red</PollAnswer>
20
- * <PollAnswer emoji="🟦">Blue</PollAnswer>
21
- * <PollAnswer emoji="🟩">Green</PollAnswer>
22
- * </Poll>;
23
- * ```
24
- */
25
- function Poll({ children, ...props }) {
26
- const question = children.find((child) => child.$$typeof === PollChildType.Question);
27
- if (!question) throw new Error("Poll question is required");
28
- const answers = children.filter((child) => child.$$typeof === PollChildType.Answer);
29
- const { children: questionChildren, ...questionProps } = question;
30
- const { duration, allowMultiselect, layoutType, ...restProps } = props;
31
- return {
32
- duration: duration ?? 24,
33
- allowMultiselect: allowMultiselect ?? false,
34
- layoutType: layoutType ?? discord_js.PollLayoutType.Default,
35
- ...restProps,
36
- question: {
37
- text: questionChildren,
38
- ...questionProps
39
- },
40
- answers: answers.map(({ children: answerChildren, $$typeof, ...answerProps }) => ({
41
- text: answerChildren,
42
- ...answerProps
43
- }))
44
- };
45
- }
46
- /**
47
- * The poll question component defines the question text for a Discord poll.
48
- * @param props The poll question properties.
49
- * @returns The poll question media object.
50
- * @example ```tsx
51
- * import { PollQuestion } from 'commandkit';
52
- *
53
- * const question = <PollQuestion>What's your favorite programming language?</PollQuestion>;
54
- * ```
55
- */
56
- function PollQuestion({ children, ...props }) {
57
- return {
58
- ...props,
59
- text: children,
60
- $$typeof: PollChildType.Question
61
- };
62
- }
63
- /**
64
- * The poll answer component defines an answer option for a Discord poll.
65
- * @param props The poll answer properties.
66
- * @returns The poll answer data object.
67
- * @example ```tsx
68
- * import { PollAnswer } from 'commandkit';
69
- *
70
- * const answer = <PollAnswer emoji="🟦">TypeScript</PollAnswer>;
71
- * ```
72
- */
73
- function PollAnswer({ children, ...props }) {
74
- return {
75
- ...props,
76
- text: children,
77
- $$typeof: PollChildType.Answer
78
- };
79
- }
80
-
81
- //#endregion
82
- Object.defineProperty(exports, 'Poll', {
83
- enumerable: true,
84
- get: function () {
85
- return Poll;
86
- }
87
- });
88
- Object.defineProperty(exports, 'PollAnswer', {
89
- enumerable: true,
90
- get: function () {
91
- return PollAnswer;
92
- }
93
- });
94
- Object.defineProperty(exports, 'PollQuestion', {
95
- enumerable: true,
96
- get: function () {
97
- return PollQuestion;
98
- }
99
- });
100
- //# sourceMappingURL=poll-CFe8yvoJ.js.map
@@ -1,23 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- let path = require("path");
3
- path = require_chunk.__toESM(path);
4
-
5
- //#region src/utils/resolve-file-url.ts
6
- /**
7
- * Convert a local file path to a file URL.
8
- * @param filePath - The local file's path.
9
- * @param withTs - Whether to append a timestamp to the URL.
10
- * @returns - The converted file URL.
11
- */
12
- function toFileURL(filePath, withTs = false) {
13
- return `${"file://" + path.default.resolve(filePath).replace(/\\\\|\\/g, "/")}${withTs ? `?ts=${Date.now()}` : ""}`;
14
- }
15
-
16
- //#endregion
17
- Object.defineProperty(exports, 'toFileURL', {
18
- enumerable: true,
19
- get: function () {
20
- return toFileURL;
21
- }
22
- });
23
- //# sourceMappingURL=resolve-file-url-CdHqwWs3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-file-url-CdHqwWs3.js","names":[],"sources":["../src/utils/resolve-file-url.ts"],"sourcesContent":["import path from 'path';\n\n/**\n * Convert a local file path to a file URL.\n * @param filePath - The local file's path.\n * @param withTs - Whether to append a timestamp to the URL.\n * @returns - The converted file URL.\n */\nexport function toFileURL(filePath: string, withTs = false) {\n const resolvedPath = path.resolve(filePath);\n return `${'file://' + resolvedPath.replace(/\\\\\\\\|\\\\/g, '/')}${withTs ? `?ts=${Date.now()}` : ''}`;\n}\n"],"mappings":";;;;;;;;;;;AAQA,SAAgB,UAAU,UAAkB,SAAS,OAAO;AAE1D,QAAO,GAAG,YADW,aAAK,QAAQ,SAAS,CACR,QAAQ,YAAY,IAAI,GAAG,SAAS,OAAO,KAAK,KAAK,KAAK"}
File without changes
File without changes
@@ -1,59 +0,0 @@
1
- const require_chunk = require('./chunk-kSYXY2_d.js');
2
- const require_common = require('./common-CEordwf3.js');
3
- let discord_js = require("discord.js");
4
-
5
- //#region src/components/display/section.ts
6
- /**
7
- * The components v2 section component
8
- * @param props The properties for the section component.
9
- * @returns The section builder instance.
10
- * @example ```tsx
11
- * import { Section } from 'commandkit';
12
- *
13
- * const section = <Section>...</Section>;
14
- * ```
15
- */
16
- function Section(props) {
17
- const section = new discord_js.SectionBuilder();
18
- require_common.applyId(props, section);
19
- if (props.children != null) {
20
- if (!Array.isArray(props.children)) props.children = [props.children];
21
- for (const accessory of props.children.flat()) if (accessory instanceof discord_js.ThumbnailBuilder) section.setThumbnailAccessory(accessory);
22
- else if (accessory instanceof discord_js.ButtonBuilder) section.setButtonAccessory(accessory);
23
- else if (accessory instanceof discord_js.TextDisplayBuilder) section.addTextDisplayComponents(accessory);
24
- }
25
- return section;
26
- }
27
- /**
28
- * The thumbnail component
29
- * @param props The properties for the thumbnail component.
30
- * @returns The thumbnail builder instance.
31
- * @example ```tsx
32
- * import { Thumbnail } from 'commandkit';
33
- *
34
- * const thumbnail = <Thumbnail url="https://example.com/image.png" description="An image" />;
35
- * ```
36
- */
37
- function Thumbnail(props) {
38
- return new discord_js.ThumbnailBuilder({
39
- description: props.description,
40
- spoiler: props.spoiler,
41
- id: props.id,
42
- media: { url: props.url }
43
- });
44
- }
45
-
46
- //#endregion
47
- Object.defineProperty(exports, 'Section', {
48
- enumerable: true,
49
- get: function () {
50
- return Section;
51
- }
52
- });
53
- Object.defineProperty(exports, 'Thumbnail', {
54
- enumerable: true,
55
- get: function () {
56
- return Thumbnail;
57
- }
58
- });
59
- //# sourceMappingURL=section-BC8LF-B2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"section-BC8LF-B2.js","names":[],"sources":["../src/components/display/section.ts"],"sourcesContent":["import {\n ButtonBuilder,\n SectionBuilder,\n TextDisplayBuilder,\n ThumbnailBuilder,\n} from 'discord.js';\nimport { applyId } from './common';\n\n/**\n * Represents the properties for a section component.\n */\nexport interface SectionProps {\n children?: (ThumbnailBuilder | ButtonBuilder | TextDisplayBuilder)[];\n id?: number;\n}\n\n/**\n * The components v2 section component\n * @param props The properties for the section component.\n * @returns The section builder instance.\n * @example ```tsx\n * import { Section } from 'commandkit';\n *\n * const section = <Section>...</Section>;\n * ```\n */\nexport function Section(props: SectionProps): SectionBuilder {\n const section = new SectionBuilder();\n\n applyId(props, section);\n\n if (props.children != null) {\n if (!Array.isArray(props.children)) props.children = [props.children];\n for (const accessory of props.children.flat()) {\n if (accessory instanceof ThumbnailBuilder) {\n section.setThumbnailAccessory(accessory);\n } else if (accessory instanceof ButtonBuilder) {\n section.setButtonAccessory(accessory);\n } else if (accessory instanceof TextDisplayBuilder) {\n section.addTextDisplayComponents(accessory);\n }\n }\n }\n\n return section;\n}\n\n/**\n * Represents the properties for a thumbnail component.\n */\nexport interface ThumbnailProps {\n id?: number;\n description?: string;\n spoiler?: boolean;\n url: string;\n}\n\n/**\n * The thumbnail component\n * @param props The properties for the thumbnail component.\n * @returns The thumbnail builder instance.\n * @example ```tsx\n * import { Thumbnail } from 'commandkit';\n *\n * const thumbnail = <Thumbnail url=\"https://example.com/image.png\" description=\"An image\" />;\n * ```\n */\nexport function Thumbnail(props: ThumbnailProps) {\n const thumbnail = new ThumbnailBuilder({\n description: props.description,\n spoiler: props.spoiler,\n id: props.id,\n media: { url: props.url },\n });\n\n return thumbnail;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,SAAgB,QAAQ,OAAqC;CAC3D,MAAM,UAAU,IAAI,2BAAgB;AAEpC,wBAAQ,OAAO,QAAQ;AAEvB,KAAI,MAAM,YAAY,MAAM;AAC1B,MAAI,CAAC,MAAM,QAAQ,MAAM,SAAS,CAAE,OAAM,WAAW,CAAC,MAAM,SAAS;AACrE,OAAK,MAAM,aAAa,MAAM,SAAS,MAAM,CAC3C,KAAI,qBAAqB,4BACvB,SAAQ,sBAAsB,UAAU;WAC/B,qBAAqB,yBAC9B,SAAQ,mBAAmB,UAAU;WAC5B,qBAAqB,8BAC9B,SAAQ,yBAAyB,UAAU;;AAKjD,QAAO;;;;;;;;;;;;AAuBT,SAAgB,UAAU,OAAuB;AAQ/C,QAPkB,IAAI,4BAAiB;EACrC,aAAa,MAAM;EACnB,SAAS,MAAM;EACf,IAAI,MAAM;EACV,OAAO,EAAE,KAAK,MAAM,KAAK;EAC1B,CAAC"}