@erinjs/core 1.0.0 → 1.2.4

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 (394) hide show
  1. package/{core/LICENSE → LICENSE} +203 -203
  2. package/README.md +46 -0
  3. package/dist/index.d.mts +2084 -0
  4. package/dist/index.d.ts +2084 -0
  5. package/dist/index.js +3867 -0
  6. package/dist/index.mjs +3809 -0
  7. package/package.json +50 -15
  8. package/core/.changeset/README.md +0 -8
  9. package/core/.changeset/community-bootstrap-release.md +0 -17
  10. package/core/.changeset/config.json +0 -11
  11. package/core/.changeset/no-changelog.js +0 -16
  12. package/core/.changeset/pre.json +0 -17
  13. package/core/.editorconfig +0 -13
  14. package/core/.gitattributes +0 -2
  15. package/core/.github/CODE_OF_CONDUCT.md +0 -23
  16. package/core/.github/FUNDING.yml +0 -7
  17. package/core/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  18. package/core/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
  19. package/core/.github/PULL_REQUEST_TEMPLATE.md +0 -16
  20. package/core/.github/dependabot.yml +0 -16
  21. package/core/.github/workflows/autoapp.yml +0 -16
  22. package/core/.github/workflows/ci.yml +0 -187
  23. package/core/.github/workflows/codeql.yml +0 -30
  24. package/core/.github/workflows/deploy-docs.yml +0 -54
  25. package/core/.github/workflows/publish.yml +0 -43
  26. package/core/.lintstagedrc.json +0 -4
  27. package/core/.nvmrc +0 -1
  28. package/core/.prettierignore +0 -8
  29. package/core/.prettierrc +0 -11
  30. package/core/CONTRIBUTING.md +0 -70
  31. package/core/README.md +0 -61
  32. package/core/SECURITY.md +0 -21
  33. package/core/apps/docs/index.html +0 -28
  34. package/core/apps/docs/middleware.ts +0 -21
  35. package/core/apps/docs/package.json +0 -33
  36. package/core/apps/docs/public/@flux.png +0 -0
  37. package/core/apps/docs/public/docs/latest/guides.json +0 -1420
  38. package/core/apps/docs/public/docs/latest/main.json +0 -14981
  39. package/core/apps/docs/public/docs/latest/rag-index.json +0 -1
  40. package/core/apps/docs/public/docs/v1.0.5/guides.json +0 -226
  41. package/core/apps/docs/public/docs/v1.0.5/main.json +0 -7920
  42. package/core/apps/docs/public/docs/v1.0.6/guides.json +0 -226
  43. package/core/apps/docs/public/docs/v1.0.6/main.json +0 -7920
  44. package/core/apps/docs/public/docs/v1.0.7/guides.json +0 -259
  45. package/core/apps/docs/public/docs/v1.0.7/main.json +0 -8652
  46. package/core/apps/docs/public/docs/v1.0.8/guides.json +0 -313
  47. package/core/apps/docs/public/docs/v1.0.8/main.json +0 -9618
  48. package/core/apps/docs/public/docs/v1.0.9/guides.json +0 -319
  49. package/core/apps/docs/public/docs/v1.0.9/main.json +0 -10694
  50. package/core/apps/docs/public/docs/v1.1.0/guides.json +0 -589
  51. package/core/apps/docs/public/docs/v1.1.0/main.json +0 -12576
  52. package/core/apps/docs/public/docs/v1.1.2/guides.json +0 -650
  53. package/core/apps/docs/public/docs/v1.1.2/main.json +0 -13239
  54. package/core/apps/docs/public/docs/v1.1.3/guides.json +0 -650
  55. package/core/apps/docs/public/docs/v1.1.3/main.json +0 -13239
  56. package/core/apps/docs/public/docs/v1.1.4/guides.json +0 -708
  57. package/core/apps/docs/public/docs/v1.1.4/main.json +0 -13231
  58. package/core/apps/docs/public/docs/v1.1.5/guides.json +0 -1035
  59. package/core/apps/docs/public/docs/v1.1.5/main.json +0 -13838
  60. package/core/apps/docs/public/docs/v1.1.6/guides.json +0 -1041
  61. package/core/apps/docs/public/docs/v1.1.6/main.json +0 -14313
  62. package/core/apps/docs/public/docs/v1.1.8/guides.json +0 -1047
  63. package/core/apps/docs/public/docs/v1.1.8/main.json +0 -14421
  64. package/core/apps/docs/public/docs/v1.1.9/guides.json +0 -1047
  65. package/core/apps/docs/public/docs/v1.1.9/main.json +0 -14421
  66. package/core/apps/docs/public/docs/v1.2.0/guides.json +0 -1212
  67. package/core/apps/docs/public/docs/v1.2.0/main.json +0 -14663
  68. package/core/apps/docs/public/docs/v1.2.1/guides.json +0 -1293
  69. package/core/apps/docs/public/docs/v1.2.1/main.json +0 -14828
  70. package/core/apps/docs/public/docs/v1.2.2/guides.json +0 -1293
  71. package/core/apps/docs/public/docs/v1.2.2/main.json +0 -15025
  72. package/core/apps/docs/public/docs/v1.2.3/guides.json +0 -1420
  73. package/core/apps/docs/public/docs/v1.2.3/main.json +0 -14954
  74. package/core/apps/docs/public/docs/v1.2.4/guides.json +0 -1420
  75. package/core/apps/docs/public/docs/v1.2.4/main.json +0 -14981
  76. package/core/apps/docs/public/docs/versions.json +0 -24
  77. package/core/apps/docs/public/flux.png +0 -0
  78. package/core/apps/docs/public/locales/en.json +0 -50
  79. package/core/apps/docs/public/locales/guides-en.json +0 -512
  80. package/core/apps/docs/public/robots.txt +0 -4
  81. package/core/apps/docs/public/sitemap.xml +0 -33
  82. package/core/apps/docs/src/App.vue +0 -538
  83. package/core/apps/docs/src/components/ApiCategorySection.vue +0 -42
  84. package/core/apps/docs/src/components/ApiDiscordCompat.vue +0 -65
  85. package/core/apps/docs/src/components/ApiEndpointCard.vue +0 -313
  86. package/core/apps/docs/src/components/ApiSchemaBlock.vue +0 -131
  87. package/core/apps/docs/src/components/CodeBlock.vue +0 -177
  88. package/core/apps/docs/src/components/CommunityCallout.vue +0 -90
  89. package/core/apps/docs/src/components/ConstructorSection.vue +0 -82
  90. package/core/apps/docs/src/components/DocDescription.vue +0 -40
  91. package/core/apps/docs/src/components/FluxerLogo.vue +0 -3
  92. package/core/apps/docs/src/components/Footer.vue +0 -106
  93. package/core/apps/docs/src/components/GuideCodeBlock.vue +0 -102
  94. package/core/apps/docs/src/components/GuideDiscordCompat.vue +0 -77
  95. package/core/apps/docs/src/components/GuideDiscordCompatCallout.vue +0 -83
  96. package/core/apps/docs/src/components/GuideTable.vue +0 -77
  97. package/core/apps/docs/src/components/GuideTip.vue +0 -38
  98. package/core/apps/docs/src/components/MethodsSection.vue +0 -195
  99. package/core/apps/docs/src/components/ParamsTable.vue +0 -70
  100. package/core/apps/docs/src/components/PropertiesSection.vue +0 -143
  101. package/core/apps/docs/src/components/SearchBar.vue +0 -76
  102. package/core/apps/docs/src/components/SearchModal.vue +0 -361
  103. package/core/apps/docs/src/components/SidebarNav.vue +0 -225
  104. package/core/apps/docs/src/components/SponsorBanner.vue +0 -153
  105. package/core/apps/docs/src/components/TypeSignature.vue +0 -187
  106. package/core/apps/docs/src/components/VersionPicker.vue +0 -191
  107. package/core/apps/docs/src/composables/useSearchIndex.ts +0 -144
  108. package/core/apps/docs/src/composables/useVersionedPath.ts +0 -20
  109. package/core/apps/docs/src/data/apiEndpoints.ts +0 -1073
  110. package/core/apps/docs/src/data/changelog.ts +0 -717
  111. package/core/apps/docs/src/data/guides.ts +0 -2362
  112. package/core/apps/docs/src/env.d.ts +0 -7
  113. package/core/apps/docs/src/locales/guides-en.json +0 -512
  114. package/core/apps/docs/src/main.ts +0 -27
  115. package/core/apps/docs/src/pages/ApiReferenceLayout.vue +0 -175
  116. package/core/apps/docs/src/pages/ApiReferencePage.vue +0 -128
  117. package/core/apps/docs/src/pages/Changelog.vue +0 -288
  118. package/core/apps/docs/src/pages/ClassPage.vue +0 -319
  119. package/core/apps/docs/src/pages/ClassesList.vue +0 -100
  120. package/core/apps/docs/src/pages/DocsLayout.vue +0 -127
  121. package/core/apps/docs/src/pages/GuidePage.vue +0 -279
  122. package/core/apps/docs/src/pages/GuidesIndex.vue +0 -166
  123. package/core/apps/docs/src/pages/GuidesLayout.vue +0 -245
  124. package/core/apps/docs/src/pages/Home.vue +0 -125
  125. package/core/apps/docs/src/pages/NotFound.vue +0 -57
  126. package/core/apps/docs/src/pages/TypedefPage.vue +0 -230
  127. package/core/apps/docs/src/pages/TypedefsList.vue +0 -168
  128. package/core/apps/docs/src/pages/VersionLayout.vue +0 -15
  129. package/core/apps/docs/src/router.ts +0 -73
  130. package/core/apps/docs/src/stores/docs.ts +0 -54
  131. package/core/apps/docs/src/stores/guides.ts +0 -53
  132. package/core/apps/docs/src/stores/version.ts +0 -67
  133. package/core/apps/docs/src/styles/main.css +0 -278
  134. package/core/apps/docs/src/styles/prism.css +0 -95
  135. package/core/apps/docs/src/types/doc-schema.ts +0 -112
  136. package/core/apps/docs/tsconfig.json +0 -17
  137. package/core/apps/docs/tsconfig.node.json +0 -10
  138. package/core/apps/docs/vite.config.d.ts +0 -2
  139. package/core/apps/docs/vite.config.js +0 -26
  140. package/core/apps/docs/vite.config.ts +0 -28
  141. package/core/apps/docs-vitepress/.vitepress/config.ts +0 -141
  142. package/core/apps/docs-vitepress/api-data/latest/main.json +0 -15035
  143. package/core/apps/docs-vitepress/api-data/v1.2.4/main.json +0 -15035
  144. package/core/apps/docs-vitepress/api-data/versions.json +0 -6
  145. package/core/apps/docs-vitepress/index.md +0 -15
  146. package/core/apps/docs-vitepress/package-lock.json +0 -2924
  147. package/core/apps/docs-vitepress/package.json +0 -20
  148. package/core/apps/docs-vitepress/public/CNAME +0 -1
  149. package/core/apps/docs-vitepress/scripts/generate-api.ts +0 -243
  150. package/core/apps/docs-vitepress/scripts/migrate-guides.ts +0 -129
  151. package/core/apps/docs-vitepress/tsconfig.json +0 -11
  152. package/core/apps/docs-vitepress/v/latest/guides/attachments-by-url.md +0 -57
  153. package/core/apps/docs-vitepress/v/latest/guides/attachments.md +0 -62
  154. package/core/apps/docs-vitepress/v/latest/guides/basic-bot.md +0 -49
  155. package/core/apps/docs-vitepress/v/latest/guides/channels.md +0 -180
  156. package/core/apps/docs-vitepress/v/latest/guides/deprecated-apis.md +0 -58
  157. package/core/apps/docs-vitepress/v/latest/guides/discord-js-compatibility.md +0 -42
  158. package/core/apps/docs-vitepress/v/latest/guides/editing-embeds.md +0 -65
  159. package/core/apps/docs-vitepress/v/latest/guides/embed-media.md +0 -87
  160. package/core/apps/docs-vitepress/v/latest/guides/embeds.md +0 -166
  161. package/core/apps/docs-vitepress/v/latest/guides/emojis.md +0 -77
  162. package/core/apps/docs-vitepress/v/latest/guides/events.md +0 -202
  163. package/core/apps/docs-vitepress/v/latest/guides/gifs.md +0 -47
  164. package/core/apps/docs-vitepress/v/latest/guides/installation.md +0 -10
  165. package/core/apps/docs-vitepress/v/latest/guides/moderation.md +0 -89
  166. package/core/apps/docs-vitepress/v/latest/guides/permissions.md +0 -130
  167. package/core/apps/docs-vitepress/v/latest/guides/prefix-commands.md +0 -41
  168. package/core/apps/docs-vitepress/v/latest/guides/profile-urls.md +0 -58
  169. package/core/apps/docs-vitepress/v/latest/guides/reactions.md +0 -69
  170. package/core/apps/docs-vitepress/v/latest/guides/roles.md +0 -130
  171. package/core/apps/docs-vitepress/v/latest/guides/sending-without-reply.md +0 -172
  172. package/core/apps/docs-vitepress/v/latest/guides/voice.md +0 -109
  173. package/core/apps/docs-vitepress/v/latest/guides/wait-for-guilds.md +0 -37
  174. package/core/apps/docs-vitepress/v/latest/guides/webhook-attachments-embeds.md +0 -73
  175. package/core/apps/docs-vitepress/v/latest/guides/webhooks.md +0 -131
  176. package/core/eslint.config.js +0 -80
  177. package/core/examples/.env.example +0 -22
  178. package/core/examples/README.md +0 -68
  179. package/core/examples/first-steps-bot.js +0 -118
  180. package/core/examples/minimal-bot.js +0 -17
  181. package/core/examples/moderation-bot.js +0 -209
  182. package/core/examples/package.json +0 -14
  183. package/core/examples/ping-bot.js +0 -1146
  184. package/core/examples/reaction-bot.js +0 -70
  185. package/core/examples/reaction-roles-bot.js +0 -140
  186. package/core/examples/webhook-bot.js +0 -239
  187. package/core/flux.png +0 -0
  188. package/core/package.json +0 -78
  189. package/core/packages/builders/package.json +0 -51
  190. package/core/packages/builders/src/index.ts +0 -13
  191. package/core/packages/builders/src/messages/AttachmentBuilder.test.ts +0 -79
  192. package/core/packages/builders/src/messages/AttachmentBuilder.ts +0 -69
  193. package/core/packages/builders/src/messages/EmbedBuilder.test.ts +0 -266
  194. package/core/packages/builders/src/messages/EmbedBuilder.ts +0 -239
  195. package/core/packages/builders/src/messages/MessagePayload.test.ts +0 -118
  196. package/core/packages/builders/src/messages/MessagePayload.ts +0 -122
  197. package/core/packages/builders/tsconfig.json +0 -9
  198. package/core/packages/builders/tsup.config.ts +0 -9
  199. package/core/packages/builders/vitest.config.ts +0 -9
  200. package/core/packages/collection/package.json +0 -47
  201. package/core/packages/collection/src/Collection.test.ts +0 -232
  202. package/core/packages/collection/src/Collection.ts +0 -196
  203. package/core/packages/collection/src/index.ts +0 -1
  204. package/core/packages/collection/tsconfig.json +0 -9
  205. package/core/packages/collection/tsup.config.ts +0 -9
  206. package/core/packages/collection/vitest.config.ts +0 -9
  207. package/core/packages/docgen/package.json +0 -26
  208. package/core/packages/docgen/src/extract.ts +0 -262
  209. package/core/packages/docgen/src/formatType.ts +0 -24
  210. package/core/packages/docgen/src/index.ts +0 -103
  211. package/core/packages/docgen/src/schema.ts +0 -100
  212. package/core/packages/docgen/src/visitor.ts +0 -147
  213. package/core/packages/docgen/tsconfig.json +0 -9
  214. package/core/packages/docgen/tsup.config.ts +0 -9
  215. package/core/packages/fluxer-core/README.md +0 -26
  216. package/core/packages/fluxer-core/package.json +0 -60
  217. package/core/packages/fluxer-core/src/client/ChannelManager.ts +0 -143
  218. package/core/packages/fluxer-core/src/client/Client.gateway.test.ts +0 -84
  219. package/core/packages/fluxer-core/src/client/Client.resolveEmoji.test.ts +0 -45
  220. package/core/packages/fluxer-core/src/client/Client.ts +0 -558
  221. package/core/packages/fluxer-core/src/client/ClientUser.ts +0 -40
  222. package/core/packages/fluxer-core/src/client/EventHandlerRegistry.ts +0 -469
  223. package/core/packages/fluxer-core/src/client/GuildManager.ts +0 -79
  224. package/core/packages/fluxer-core/src/client/GuildMemberManager.ts +0 -91
  225. package/core/packages/fluxer-core/src/client/MessageManager.ts +0 -58
  226. package/core/packages/fluxer-core/src/client/UsersManager.ts +0 -122
  227. package/core/packages/fluxer-core/src/errors/ErrorCodes.test.ts +0 -19
  228. package/core/packages/fluxer-core/src/errors/ErrorCodes.ts +0 -12
  229. package/core/packages/fluxer-core/src/errors/FluxerError.test.ts +0 -32
  230. package/core/packages/fluxer-core/src/errors/FluxerError.ts +0 -15
  231. package/core/packages/fluxer-core/src/index.ts +0 -85
  232. package/core/packages/fluxer-core/src/structures/Base.ts +0 -7
  233. package/core/packages/fluxer-core/src/structures/Channel.ts +0 -508
  234. package/core/packages/fluxer-core/src/structures/Guild.test.ts +0 -189
  235. package/core/packages/fluxer-core/src/structures/Guild.ts +0 -734
  236. package/core/packages/fluxer-core/src/structures/GuildBan.ts +0 -35
  237. package/core/packages/fluxer-core/src/structures/GuildEmoji.ts +0 -57
  238. package/core/packages/fluxer-core/src/structures/GuildMember.test.ts +0 -203
  239. package/core/packages/fluxer-core/src/structures/GuildMember.ts +0 -213
  240. package/core/packages/fluxer-core/src/structures/GuildMemberRoleManager.ts +0 -121
  241. package/core/packages/fluxer-core/src/structures/GuildSticker.ts +0 -56
  242. package/core/packages/fluxer-core/src/structures/Invite.test.ts +0 -103
  243. package/core/packages/fluxer-core/src/structures/Invite.ts +0 -121
  244. package/core/packages/fluxer-core/src/structures/Message.test.ts +0 -109
  245. package/core/packages/fluxer-core/src/structures/Message.ts +0 -397
  246. package/core/packages/fluxer-core/src/structures/MessageReaction.ts +0 -72
  247. package/core/packages/fluxer-core/src/structures/PartialMessage.ts +0 -12
  248. package/core/packages/fluxer-core/src/structures/Role.test.ts +0 -77
  249. package/core/packages/fluxer-core/src/structures/Role.ts +0 -112
  250. package/core/packages/fluxer-core/src/structures/User.test.ts +0 -110
  251. package/core/packages/fluxer-core/src/structures/User.ts +0 -109
  252. package/core/packages/fluxer-core/src/structures/Webhook.test.ts +0 -109
  253. package/core/packages/fluxer-core/src/structures/Webhook.ts +0 -258
  254. package/core/packages/fluxer-core/src/util/Constants.test.ts +0 -16
  255. package/core/packages/fluxer-core/src/util/Constants.ts +0 -7
  256. package/core/packages/fluxer-core/src/util/Events.ts +0 -46
  257. package/core/packages/fluxer-core/src/util/MessageCollector.ts +0 -87
  258. package/core/packages/fluxer-core/src/util/Options.ts +0 -33
  259. package/core/packages/fluxer-core/src/util/ReactionCollector.ts +0 -116
  260. package/core/packages/fluxer-core/src/util/cdn.test.ts +0 -108
  261. package/core/packages/fluxer-core/src/util/cdn.ts +0 -130
  262. package/core/packages/fluxer-core/src/util/guildUtils.ts +0 -33
  263. package/core/packages/fluxer-core/src/util/messageUtils.test.ts +0 -74
  264. package/core/packages/fluxer-core/src/util/messageUtils.ts +0 -119
  265. package/core/packages/fluxer-core/src/util/permissions.test.ts +0 -95
  266. package/core/packages/fluxer-core/src/util/permissions.ts +0 -43
  267. package/core/packages/fluxer-core/tsconfig.json +0 -9
  268. package/core/packages/fluxer-core/tsup.config.ts +0 -9
  269. package/core/packages/fluxer-core/vitest.config.ts +0 -9
  270. package/core/packages/rest/package.json +0 -52
  271. package/core/packages/rest/src/REST.test.ts +0 -64
  272. package/core/packages/rest/src/REST.ts +0 -90
  273. package/core/packages/rest/src/RateLimitManager.test.ts +0 -71
  274. package/core/packages/rest/src/RateLimitManager.ts +0 -60
  275. package/core/packages/rest/src/RequestManager.test.ts +0 -87
  276. package/core/packages/rest/src/RequestManager.ts +0 -172
  277. package/core/packages/rest/src/errors/FluxerAPIError.test.ts +0 -57
  278. package/core/packages/rest/src/errors/FluxerAPIError.ts +0 -21
  279. package/core/packages/rest/src/errors/HTTPError.test.ts +0 -55
  280. package/core/packages/rest/src/errors/HTTPError.ts +0 -25
  281. package/core/packages/rest/src/errors/RateLimitError.test.ts +0 -41
  282. package/core/packages/rest/src/errors/RateLimitError.ts +0 -15
  283. package/core/packages/rest/src/errors/index.ts +0 -3
  284. package/core/packages/rest/src/index.ts +0 -6
  285. package/core/packages/rest/src/utils/constants.test.ts +0 -31
  286. package/core/packages/rest/src/utils/constants.ts +0 -5
  287. package/core/packages/rest/src/utils/files.test.ts +0 -37
  288. package/core/packages/rest/src/utils/files.ts +0 -75
  289. package/core/packages/rest/tsconfig.json +0 -9
  290. package/core/packages/rest/tsup.config.ts +0 -9
  291. package/core/packages/rest/vitest.config.ts +0 -9
  292. package/core/packages/types/package.json +0 -46
  293. package/core/packages/types/src/api/ban.ts +0 -8
  294. package/core/packages/types/src/api/channel.ts +0 -65
  295. package/core/packages/types/src/api/embed.ts +0 -82
  296. package/core/packages/types/src/api/emoji.ts +0 -12
  297. package/core/packages/types/src/api/errors.ts +0 -68
  298. package/core/packages/types/src/api/gateway.ts +0 -14
  299. package/core/packages/types/src/api/guild.ts +0 -123
  300. package/core/packages/types/src/api/index.ts +0 -15
  301. package/core/packages/types/src/api/instance.ts +0 -32
  302. package/core/packages/types/src/api/interaction.ts +0 -26
  303. package/core/packages/types/src/api/invite.ts +0 -28
  304. package/core/packages/types/src/api/message.ts +0 -140
  305. package/core/packages/types/src/api/role.ts +0 -41
  306. package/core/packages/types/src/api/sticker.ts +0 -14
  307. package/core/packages/types/src/api/user.ts +0 -79
  308. package/core/packages/types/src/api/webhook.ts +0 -41
  309. package/core/packages/types/src/common/index.ts +0 -1
  310. package/core/packages/types/src/common/snowflake.test.ts +0 -9
  311. package/core/packages/types/src/common/snowflake.ts +0 -8
  312. package/core/packages/types/src/gateway/events.ts +0 -189
  313. package/core/packages/types/src/gateway/index.ts +0 -3
  314. package/core/packages/types/src/gateway/opcodes.ts +0 -17
  315. package/core/packages/types/src/gateway/payloads.ts +0 -481
  316. package/core/packages/types/src/index.ts +0 -4
  317. package/core/packages/types/src/rest/index.ts +0 -1
  318. package/core/packages/types/src/rest/routes.test.ts +0 -169
  319. package/core/packages/types/src/rest/routes.ts +0 -109
  320. package/core/packages/types/tsconfig.json +0 -9
  321. package/core/packages/types/tsup.config.ts +0 -9
  322. package/core/packages/types/vitest.config.ts +0 -9
  323. package/core/packages/util/package.json +0 -51
  324. package/core/packages/util/src/BitField.test.ts +0 -96
  325. package/core/packages/util/src/BitField.ts +0 -105
  326. package/core/packages/util/src/MessageFlagsBitField.test.ts +0 -42
  327. package/core/packages/util/src/MessageFlagsBitField.ts +0 -20
  328. package/core/packages/util/src/PermissionsBitField.test.ts +0 -79
  329. package/core/packages/util/src/PermissionsBitField.ts +0 -97
  330. package/core/packages/util/src/SnowflakeUtil.test.ts +0 -69
  331. package/core/packages/util/src/SnowflakeUtil.ts +0 -65
  332. package/core/packages/util/src/UserFlagsBitField.test.ts +0 -39
  333. package/core/packages/util/src/UserFlagsBitField.ts +0 -48
  334. package/core/packages/util/src/deprecation.test.ts +0 -44
  335. package/core/packages/util/src/deprecation.ts +0 -28
  336. package/core/packages/util/src/emojiShortcodes.generated.ts +0 -5
  337. package/core/packages/util/src/emojiShortcodes.test.ts +0 -41
  338. package/core/packages/util/src/emojiShortcodes.ts +0 -22
  339. package/core/packages/util/src/formatters.test.ts +0 -65
  340. package/core/packages/util/src/formatters.ts +0 -35
  341. package/core/packages/util/src/index.ts +0 -34
  342. package/core/packages/util/src/resolvers.test.ts +0 -198
  343. package/core/packages/util/src/resolvers.ts +0 -127
  344. package/core/packages/util/src/tenorUtils.test.ts +0 -75
  345. package/core/packages/util/src/tenorUtils.ts +0 -86
  346. package/core/packages/util/tsconfig.json +0 -9
  347. package/core/packages/util/tsup.config.ts +0 -9
  348. package/core/packages/util/vitest.config.ts +0 -9
  349. package/core/packages/voice/README.md +0 -42
  350. package/core/packages/voice/package.json +0 -67
  351. package/core/packages/voice/src/LiveKitRtcConnection.receive.test.ts +0 -24
  352. package/core/packages/voice/src/LiveKitRtcConnection.ts +0 -1767
  353. package/core/packages/voice/src/VoiceConnection.ts +0 -413
  354. package/core/packages/voice/src/VoiceManager.receive.test.ts +0 -61
  355. package/core/packages/voice/src/VoiceManager.test.ts +0 -44
  356. package/core/packages/voice/src/VoiceManager.ts +0 -503
  357. package/core/packages/voice/src/exports.test.ts +0 -38
  358. package/core/packages/voice/src/index.ts +0 -51
  359. package/core/packages/voice/src/livekit.test.ts +0 -48
  360. package/core/packages/voice/src/livekit.ts +0 -33
  361. package/core/packages/voice/src/mp4box.d.ts +0 -32
  362. package/core/packages/voice/src/opusUtils.test.ts +0 -29
  363. package/core/packages/voice/src/opusUtils.ts +0 -86
  364. package/core/packages/voice/src/streamPreviewPlaceholder.test.ts +0 -16
  365. package/core/packages/voice/src/streamPreviewPlaceholder.ts +0 -8
  366. package/core/packages/voice/src/ws.d.ts +0 -1
  367. package/core/packages/voice/tsconfig.json +0 -5
  368. package/core/packages/voice/tsup.config.ts +0 -10
  369. package/core/packages/voice/vitest.config.ts +0 -9
  370. package/core/packages/ws/package.json +0 -52
  371. package/core/packages/ws/src/WebSocketManager.ts +0 -130
  372. package/core/packages/ws/src/WebSocketShard.ts +0 -296
  373. package/core/packages/ws/src/index.ts +0 -12
  374. package/core/packages/ws/src/utils/constants.test.ts +0 -46
  375. package/core/packages/ws/src/utils/constants.ts +0 -22
  376. package/core/packages/ws/src/utils/getWebSocket.ts +0 -55
  377. package/core/packages/ws/src/ws.d.ts +0 -10
  378. package/core/packages/ws/tsconfig.json +0 -9
  379. package/core/packages/ws/tsup.config.ts +0 -9
  380. package/core/pnpm-lock.yaml +0 -7033
  381. package/core/pnpm-workspace.yaml +0 -4
  382. package/core/scripts/generate-ai-rag.ts +0 -240
  383. package/core/scripts/generate-docs.ts +0 -143
  384. package/core/scripts/generate-emoji-shortcodes.ts +0 -58
  385. package/core/scripts/generate-types.ts +0 -6
  386. package/core/scripts/publish-ordered.js +0 -63
  387. package/core/scripts/test-cjs-require.mjs +0 -43
  388. package/core/scripts/test-esm-imports.mjs +0 -42
  389. package/core/scripts/test-package-exports.mjs +0 -98
  390. package/core/scripts/test-smoke.mjs +0 -103
  391. package/core/tsconfig.json +0 -18
  392. package/core/turbo.json +0 -30
  393. package/core/vitest.config.ts +0 -17
  394. package/core/wrangler.jsonc +0 -9
@@ -1,122 +0,0 @@
1
- import { APIEmbed, APIMessageReference } from '@erinjs/types';
2
- import { EmbedBuilder } from './EmbedBuilder.js';
3
- import { AttachmentBuilder } from './AttachmentBuilder.js';
4
-
5
- /** Data for a message payload (content, embeds, reply reference, etc.). */
6
- export interface MessagePayloadData {
7
- content?: string | null;
8
- embeds?: APIEmbed[] | null;
9
- attachments?: Array<{ id: number; filename: string; description?: string | null }>;
10
- message_reference?: APIMessageReference | null;
11
- tts?: boolean;
12
- flags?: number;
13
- }
14
-
15
- const CONTENT_MAX = 2000;
16
- const EMBEDS_MAX = 10;
17
-
18
- /** Builder for message payloads. Use with `channel.send()` or `message.reply()`. */
19
- export class MessagePayload {
20
- public static readonly ContentMaxLength = CONTENT_MAX;
21
-
22
- public readonly data: MessagePayloadData = {};
23
-
24
- /** Set message text. Max 2000 characters. */
25
- setContent(content: string | null): this {
26
- if (content !== null && content.length > CONTENT_MAX)
27
- throw new RangeError(`Content must be ≤${CONTENT_MAX} characters`);
28
- this.data.content = content ?? undefined;
29
- return this;
30
- }
31
-
32
- /** Set embeds. Max 10. Replaces existing. */
33
- setEmbeds(embeds: (APIEmbed | EmbedBuilder)[] | null): this {
34
- if (!embeds?.length) {
35
- this.data.embeds = undefined;
36
- return this;
37
- }
38
- if (embeds.length > EMBEDS_MAX) throw new RangeError(`Embeds must be ≤${EMBEDS_MAX}`);
39
- this.data.embeds = embeds.map((e) => (e instanceof EmbedBuilder ? e.toJSON() : e));
40
- return this;
41
- }
42
-
43
- /** Add one embed. Max 10 total. */
44
- addEmbed(embed: APIEmbed | EmbedBuilder): this {
45
- const list = (this.data.embeds ?? []).slice();
46
- if (list.length >= EMBEDS_MAX) throw new RangeError(`Embeds must be ≤${EMBEDS_MAX}`);
47
- list.push(embed instanceof EmbedBuilder ? embed.toJSON() : embed);
48
- this.data.embeds = list;
49
- return this;
50
- }
51
-
52
- /** Set attachment metadata (for files sent with the request). */
53
- setAttachments(
54
- attachments: Array<
55
- AttachmentBuilder | { id: number; filename: string; description?: string | null }
56
- > | null,
57
- ): this {
58
- if (!attachments?.length) {
59
- this.data.attachments = undefined;
60
- return this;
61
- }
62
- this.data.attachments = attachments.map((a) =>
63
- a instanceof AttachmentBuilder ? a.toJSON() : a,
64
- );
65
- return this;
66
- }
67
-
68
- /** Set reply reference (creates a reply to another message). */
69
- setReply(
70
- reference:
71
- | { channel_id: string; message_id: string; guild_id?: string | null }
72
- | APIMessageReference
73
- | null,
74
- ): this {
75
- if (!reference) {
76
- this.data.message_reference = undefined;
77
- return this;
78
- }
79
- this.data.message_reference = {
80
- channel_id: reference.channel_id,
81
- message_id: reference.message_id,
82
- guild_id: reference.guild_id ?? undefined,
83
- };
84
- return this;
85
- }
86
-
87
- /** Enable text-to-speech. */
88
- setTTS(tts: boolean): this {
89
- this.data.tts = tts;
90
- return this;
91
- }
92
-
93
- /** Set message flags (e.g. ephemeral, suppress embeds). */
94
- setFlags(flags: number): this {
95
- this.data.flags = flags;
96
- return this;
97
- }
98
-
99
- /** Get the payload as a plain object. */
100
- toJSON(): MessagePayloadData {
101
- return { ...this.data };
102
- }
103
-
104
- /** Create a MessagePayload from a string or options object. */
105
- static create(contentOrOptions?: string | MessagePayloadData): MessagePayload {
106
- const payload = new MessagePayload();
107
- if (typeof contentOrOptions === 'string') {
108
- payload.setContent(contentOrOptions);
109
- } else if (contentOrOptions && typeof contentOrOptions === 'object') {
110
- if (contentOrOptions.content !== undefined)
111
- payload.setContent(contentOrOptions.content ?? null);
112
- if (contentOrOptions.embeds?.length) payload.setEmbeds(contentOrOptions.embeds);
113
- if (contentOrOptions.attachments?.length)
114
- payload.setAttachments(contentOrOptions.attachments);
115
- if (contentOrOptions.message_reference)
116
- payload.setReply(contentOrOptions.message_reference as APIMessageReference);
117
- if (contentOrOptions.tts !== undefined) payload.setTTS(contentOrOptions.tts);
118
- if (contentOrOptions.flags !== undefined) payload.setFlags(contentOrOptions.flags);
119
- }
120
- return payload;
121
- }
122
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src",
6
- "noEmit": false
7
- },
8
- "include": ["src/**/*"]
9
- }
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts'],
5
- format: ['cjs', 'esm'],
6
- dts: true,
7
- splitting: false,
8
- clean: true,
9
- });
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- include: ['src/**/*.test.ts'],
8
- },
9
- });
@@ -1,47 +0,0 @@
1
- {
2
- "name": "@erinjs/collection",
3
- "publishConfig": {
4
- "access": "public"
5
- },
6
- "version": "1.2.4",
7
- "description": "Extended Map with utility methods for @erinjs/core",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/blstmo-abandoned-us-for-the-milk/core.git",
11
- "directory": "packages/collection"
12
- },
13
- "bugs": "https://github.com/blstmo-abandoned-us-for-the-milk/core/issues",
14
- "homepage": "https://github.com/blstmo-abandoned-us-for-the-milk/core#readme",
15
- "keywords": [
16
- "fluxer",
17
- "collection",
18
- "map"
19
- ],
20
- "license": "Apache-2.0",
21
- "main": "./dist/index.js",
22
- "module": "./dist/index.mjs",
23
- "types": "./dist/index.d.ts",
24
- "exports": {
25
- ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
28
- "require": "./dist/index.js"
29
- }
30
- },
31
- "files": [
32
- "dist"
33
- ],
34
- "scripts": {
35
- "build": "tsup",
36
- "clean": "rm -rf dist",
37
- "lint": "eslint src --max-warnings 0 --config ../../eslint.config.js",
38
- "lint:fix": "eslint src --fix --config ../../eslint.config.js",
39
- "test": "vitest run",
40
- "test:coverage": "vitest run --coverage"
41
- },
42
- "devDependencies": {
43
- "tsup": "^8.3.0",
44
- "typescript": "^5.6.0",
45
- "vitest": "^4.0.18"
46
- }
47
- }
@@ -1,232 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { Collection } from './Collection.js';
3
-
4
- describe('Collection', () => {
5
- it('creates empty collection', () => {
6
- const coll = new Collection<string, number>();
7
- expect(coll.size).toBe(0);
8
- });
9
-
10
- it('first returns undefined for empty', () => {
11
- const coll = new Collection<string, number>();
12
- expect(coll.first()).toBeUndefined();
13
- });
14
-
15
- it('first returns first value', () => {
16
- const coll = new Collection<string, number>([
17
- ['a', 1],
18
- ['b', 2],
19
- ['c', 3],
20
- ]);
21
- expect(coll.first()).toBe(1);
22
- });
23
-
24
- it('first(amount) returns first n values', () => {
25
- const coll = new Collection<string, number>([
26
- ['a', 1],
27
- ['b', 2],
28
- ['c', 3],
29
- ]);
30
- expect(coll.first(2)).toEqual([1, 2]);
31
- });
32
-
33
- it('last returns last value', () => {
34
- const coll = new Collection<string, number>([
35
- ['a', 1],
36
- ['b', 2],
37
- ['c', 3],
38
- ]);
39
- expect(coll.last()).toBe(3);
40
- });
41
-
42
- it('random returns undefined for empty', () => {
43
- const coll = new Collection<string, number>();
44
- expect(coll.random()).toBeUndefined();
45
- });
46
-
47
- it('find returns matching value', () => {
48
- const coll = new Collection<string, number>([
49
- ['a', 1],
50
- ['b', 2],
51
- ['c', 3],
52
- ]);
53
- expect(coll.find((v) => v === 2)).toBe(2);
54
- });
55
-
56
- it('filter returns matching subset', () => {
57
- const coll = new Collection<string, number>([
58
- ['a', 1],
59
- ['b', 2],
60
- ['c', 3],
61
- ]);
62
- const filtered = coll.filter((v) => v > 1);
63
- expect(filtered.size).toBe(2);
64
- expect(filtered.get('b')).toBe(2);
65
- expect(filtered.get('c')).toBe(3);
66
- });
67
-
68
- it('map transforms values', () => {
69
- const coll = new Collection<string, number>([
70
- ['a', 1],
71
- ['b', 2],
72
- ]);
73
- expect(coll.map((v) => v * 2)).toEqual([2, 4]);
74
- });
75
-
76
- it('reduce accumulates', () => {
77
- const coll = new Collection<string, number>([
78
- ['a', 1],
79
- ['b', 2],
80
- ['c', 3],
81
- ]);
82
- expect(coll.reduce((acc, v) => acc + v, 0)).toBe(6);
83
- });
84
-
85
- it('findKey returns matching key', () => {
86
- const coll = new Collection<string, number>([
87
- ['a', 1],
88
- ['b', 2],
89
- ['c', 3],
90
- ]);
91
- expect(coll.findKey((v) => v === 2)).toBe('b');
92
- expect(coll.findKey((v) => v === 99)).toBeUndefined();
93
- });
94
-
95
- it('some returns true when any element matches', () => {
96
- const coll = new Collection<string, number>([
97
- ['a', 1],
98
- ['b', 2],
99
- ]);
100
- expect(coll.some((v) => v === 2)).toBe(true);
101
- expect(coll.some((v) => v === 99)).toBe(false);
102
- });
103
-
104
- it('every returns true when all match', () => {
105
- const coll = new Collection<string, number>([
106
- ['a', 1],
107
- ['b', 2],
108
- ]);
109
- expect(coll.every((v) => v > 0)).toBe(true);
110
- expect(coll.every((v) => v > 1)).toBe(false);
111
- });
112
-
113
- it('partition splits into pass/fail collections', () => {
114
- const coll = new Collection<string, number>([
115
- ['a', 1],
116
- ['b', 2],
117
- ['c', 3],
118
- ]);
119
- const [pass, fail] = coll.partition((v) => v >= 2);
120
- expect(pass.size).toBe(2);
121
- expect(fail.size).toBe(1);
122
- expect(pass.get('b')).toBe(2);
123
- expect(pass.get('c')).toBe(3);
124
- expect(fail.get('a')).toBe(1);
125
- });
126
-
127
- it('clone creates shallow copy', () => {
128
- const coll = new Collection<string, number>([
129
- ['a', 1],
130
- ['b', 2],
131
- ]);
132
- const clone = coll.clone();
133
- expect(clone.size).toBe(coll.size);
134
- expect(clone.get('a')).toBe(1);
135
- clone.set('a', 99);
136
- expect(coll.get('a')).toBe(1); // original unchanged
137
- });
138
-
139
- it('concat merges collections', () => {
140
- const a = new Collection<string, number>([['x', 1]]);
141
- const b = new Collection<string, number>([
142
- ['y', 2],
143
- ['z', 3],
144
- ]);
145
- const c = a.concat(b);
146
- expect(c.size).toBe(3);
147
- expect(c.get('x')).toBe(1);
148
- expect(c.get('y')).toBe(2);
149
- expect(c.get('z')).toBe(3);
150
- });
151
-
152
- it('last(amount) returns last n values', () => {
153
- const coll = new Collection<string, number>([
154
- ['a', 1],
155
- ['b', 2],
156
- ['c', 3],
157
- ]);
158
- expect(coll.last(2)).toEqual([2, 3]);
159
- });
160
-
161
- it('tap invokes fn and returns this', () => {
162
- const coll = new Collection<string, number>([['a', 1]]);
163
- let tapped = false;
164
- const result = coll.tap(() => {
165
- tapped = true;
166
- });
167
- expect(tapped).toBe(true);
168
- expect(result).toBe(coll);
169
- });
170
-
171
- it('toString returns Collection(n)', () => {
172
- const coll = new Collection<string, number>([
173
- ['a', 1],
174
- ['b', 2],
175
- ]);
176
- expect(coll.toString()).toBe('Collection(2)');
177
- });
178
-
179
- it('first(0) and last(0) return empty array', () => {
180
- const coll = new Collection<string, number>([
181
- ['a', 1],
182
- ['b', 2],
183
- ]);
184
- expect(coll.first(0)).toEqual([]);
185
- expect(coll.last(0)).toEqual([]);
186
- });
187
-
188
- it('random(amount) returns requested count without duplicates', () => {
189
- const coll = new Collection<string, number>([
190
- ['a', 1],
191
- ['b', 2],
192
- ['c', 3],
193
- ]);
194
- const result = coll.random(2);
195
- expect(result).toHaveLength(2);
196
- expect(new Set(result).size).toBe(2);
197
- });
198
-
199
- it('random(amount) when amount exceeds size returns all', () => {
200
- const coll = new Collection<string, number>([
201
- ['a', 1],
202
- ['b', 2],
203
- ]);
204
- const result = coll.random(5);
205
- expect(result).toHaveLength(2);
206
- });
207
-
208
- it('sort orders by compareFn', () => {
209
- const coll = new Collection<string, number>([
210
- ['c', 3],
211
- ['a', 1],
212
- ['b', 2],
213
- ]);
214
- coll.sort((a, b) => a - b);
215
- expect(coll.toJSON()).toEqual([1, 2, 3]);
216
- });
217
-
218
- it('last returns undefined for empty', () => {
219
- const coll = new Collection<string, number>();
220
- expect(coll.last()).toBeUndefined();
221
- });
222
-
223
- it('every returns true for empty', () => {
224
- const coll = new Collection<string, number>();
225
- expect(coll.every(() => true)).toBe(true);
226
- });
227
-
228
- it('some returns false for empty', () => {
229
- const coll = new Collection<string, number>();
230
- expect(coll.some(() => true)).toBe(false);
231
- });
232
- });
@@ -1,196 +0,0 @@
1
- /**
2
- * Extended Map with utility methods for key-value collections.
3
- * Similar to discord.js Collection.
4
- */
5
- export class Collection<K, V> extends Map<K, V> {
6
- /**
7
- * Obtains the first value(s) in this collection.
8
- * @param amount - Amount of values to obtain (optional)
9
- */
10
- first(): V | undefined;
11
- first(amount: number): V[];
12
- first(amount?: number): V | V[] | undefined {
13
- if (amount === undefined) return this.values().next().value;
14
- const arr = this.toJSON();
15
- if (amount <= 0) return [];
16
- return arr.slice(0, amount);
17
- }
18
-
19
- /**
20
- * Obtains the last value(s) in this collection.
21
- * @param amount - Amount of values to obtain (optional)
22
- */
23
- last(): V | undefined;
24
- last(amount: number): V[];
25
- last(amount?: number): V | V[] | undefined {
26
- const arr = this.toJSON();
27
- if (amount === undefined) return arr[arr.length - 1];
28
- if (amount <= 0) return [];
29
- return arr.slice(-amount);
30
- }
31
-
32
- /**
33
- * Returns a random value from this collection.
34
- * @param amount - Amount of values to randomly obtain (optional)
35
- */
36
- random(): V | undefined;
37
- random(amount: number): V[];
38
- random(amount?: number): V | V[] | undefined {
39
- const arr = this.toJSON();
40
- if (arr.length === 0) return amount === undefined ? undefined : [];
41
- if (amount === undefined) return arr[Math.floor(Math.random() * arr.length)]!;
42
- const copy = [...arr];
43
- const result: V[] = [];
44
- for (let i = 0; i < Math.min(amount, arr.length); i++) {
45
- const index = Math.floor(Math.random() * copy.length);
46
- result.push(copy.splice(index, 1)[0]!);
47
- }
48
- return result;
49
- }
50
-
51
- /**
52
- * Searches for a single item where the given function returns a truthy value.
53
- */
54
- find(fn: (value: V, key: K) => boolean): V | undefined {
55
- for (const [key, value] of this) {
56
- if (fn(value, key)) return value;
57
- }
58
- return undefined;
59
- }
60
-
61
- /**
62
- * Returns the key of the first item where the given function returns a truthy value.
63
- */
64
- findKey(fn: (value: V, key: K) => boolean): K | undefined {
65
- for (const [key, value] of this) {
66
- if (fn(value, key)) return key;
67
- }
68
- return undefined;
69
- }
70
-
71
- /**
72
- * Creates a new collection with all elements that pass the test implemented by the provided function.
73
- */
74
- filter(fn: (value: V, key: K) => boolean): Collection<K, V> {
75
- const result = new Collection<K, V>();
76
- for (const [key, value] of this) {
77
- if (fn(value, key)) result.set(key, value);
78
- }
79
- return result;
80
- }
81
-
82
- /**
83
- * Creates a new array with the results of calling the provided function on every element.
84
- */
85
- map<T>(fn: (value: V, key: K) => T): T[] {
86
- const result: T[] = [];
87
- for (const [key, value] of this) {
88
- result.push(fn(value, key));
89
- }
90
- return result;
91
- }
92
-
93
- /**
94
- * Tests whether at least one element passes the test implemented by the provided function.
95
- */
96
- some(fn: (value: V, key: K) => boolean): boolean {
97
- for (const [key, value] of this) {
98
- if (fn(value, key)) return true;
99
- }
100
- return false;
101
- }
102
-
103
- /**
104
- * Tests whether all elements pass the test implemented by the provided function.
105
- */
106
- every(fn: (value: V, key: K) => boolean): boolean {
107
- for (const [key, value] of this) {
108
- if (!fn(value, key)) return false;
109
- }
110
- return true;
111
- }
112
-
113
- /**
114
- * Applies a function against an accumulator and each element to reduce the collection to a single value.
115
- */
116
- reduce<T>(fn: (accumulator: T, value: V, key: K) => T, initialValue: T): T {
117
- let acc = initialValue;
118
- for (const [key, value] of this) {
119
- acc = fn(acc, value, key);
120
- }
121
- return acc;
122
- }
123
-
124
- /**
125
- * Partitions the collection into two collections: one that passes the predicate and one that fails.
126
- */
127
- partition(fn: (value: V, key: K) => boolean): [Collection<K, V>, Collection<K, V>] {
128
- const pass = new Collection<K, V>();
129
- const fail = new Collection<K, V>();
130
- for (const [key, value] of this) {
131
- if (fn(value, key)) pass.set(key, value);
132
- else fail.set(key, value);
133
- }
134
- return [pass, fail];
135
- }
136
-
137
- /**
138
- * Invokes the given function and returns this collection (for chaining).
139
- */
140
- tap(fn: (collection: this) => void): this {
141
- fn(this);
142
- return this;
143
- }
144
-
145
- /**
146
- * Creates an identical shallow copy of this collection.
147
- */
148
- clone(): Collection<K, V> {
149
- return new Collection(this);
150
- }
151
-
152
- /**
153
- * Combines this collection with others into a new collection.
154
- */
155
- concat(...collections: ReadonlyCollection<K, V>[]): Collection<K, V> {
156
- const result = this.clone();
157
- for (const coll of collections) {
158
- for (const [key, value] of coll) result.set(key, value);
159
- }
160
- return result;
161
- }
162
-
163
- /**
164
- * Sorts the collection in place and returns it.
165
- */
166
- sort(compareFn?: (a: V, b: V, aKey: K, bKey: K) => number): this {
167
- const entries = [...this.entries()].sort((a, b) => {
168
- if (compareFn) return compareFn(a[1], b[1], a[0], b[0]);
169
- return 0;
170
- });
171
- this.clear();
172
- for (const [key, value] of entries) {
173
- this.set(key, value);
174
- }
175
- return this;
176
- }
177
-
178
- /**
179
- * Returns an array of the values in this collection.
180
- */
181
- toJSON(): V[] {
182
- return [...this.values()];
183
- }
184
-
185
- /**
186
- * Returns a string representation of the collection (array of values).
187
- */
188
- override toString(): string {
189
- return `Collection(${this.size})`;
190
- }
191
- }
192
-
193
- /**
194
- * Read-only view of a Collection (e.g. for method return types).
195
- */
196
- export type ReadonlyCollection<K, V> = Omit<Collection<K, V>, 'set' | 'delete' | 'clear'>;
@@ -1 +0,0 @@
1
- export { Collection, type ReadonlyCollection } from './Collection.js';
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src",
6
- "noEmit": false
7
- },
8
- "include": ["src/**/*"]
9
- }
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts'],
5
- format: ['cjs', 'esm'],
6
- dts: true,
7
- splitting: false,
8
- clean: true,
9
- });
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- include: ['src/**/*.test.ts'],
8
- },
9
- });
@@ -1,26 +0,0 @@
1
- {
2
- "name": "@erinjs/docgen",
3
- "version": "1.2.4",
4
- "private": true,
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "scripts": {
9
- "build": "tsup",
10
- "clean": "rm -rf dist",
11
- "lint": "eslint src --max-warnings 0 --config ../../eslint.config.js",
12
- "lint:fix": "eslint src --fix --config ../../eslint.config.js",
13
- "test": "vitest run --passWithNoTests",
14
- "test:coverage": "vitest run --coverage --passWithNoTests"
15
- },
16
- "dependencies": {
17
- "doctrine": "^3.0.0",
18
- "typescript": "^5.6.0"
19
- },
20
- "devDependencies": {
21
- "@types/doctrine": "^0.0.9",
22
- "@types/node": "^20.0.0",
23
- "tsup": "^8.3.0",
24
- "typescript": "^5.6.0"
25
- }
26
- }