diff --git a/.changeset/broker-mark-forwarded-dispatches.md b/.changeset/broker-mark-forwarded-dispatches.md deleted file mode 100644 index 13fb8bf0..00000000 --- a/.changeset/broker-mark-forwarded-dispatches.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-broker": minor ---- - -`forwardGatewayDispatches` marks a `GatewayClient` as forwarding (`forwardsDispatches`) until its stop function is called, through the new optional `GatewayDispatchEmitterLike#markDispatchesForwarded`, so listeners registered with `RegisterAsDispatchListener` from `@wolfstar/plugin-gateway` run on the workers only. Emitters without it forward as before. diff --git a/.changeset/ci-pnpm-setup-pin-comment.md b/.changeset/ci-pnpm-setup-pin-comment.md deleted file mode 100644 index a845151c..00000000 --- a/.changeset/ci-pnpm-setup-pin-comment.md +++ /dev/null @@ -1,2 +0,0 @@ ---- ---- diff --git a/.changeset/gateway-application-commands.md b/.changeset/gateway-application-commands.md deleted file mode 100644 index b4de9a86..00000000 --- a/.changeset/gateway-application-commands.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -Add `ApplicationCommand` and its managers, fetch-only like `WebhookManager`: `client.application.commands` (`ApplicationCommandManager`) and `guild.commands` (`GuildApplicationCommandManager`, a new instance on every access, also `client.guilds.commands(guildId)`) have `fetch`, `create`, `set`, `edit`, `delete`, `commandPath` and the static `transformCommand`, which accepts camel-cased data, raw payloads and builders. `ApplicationCommand` has the command's fields, `edit()`, the `set*()` helpers, `delete()`, `permissions`, `equals(command, enforceOptionOrder?)` (`false` for a foreign argument) and the static `optionsEqual()` and `transformOption()`. `ApplicationCommandPermissionsManager` (`fetch`, `has`, and `set`, `add` and `remove` taking an explicit bearer `token`, with no OAuth handling) reads through the existing `applicationCommandPermissions` cache, kept up to date by `APPLICATION_COMMAND_PERMISSIONS_UPDATE`. `GatewayError` gains the `ApplicationCommandPermissionsTokenMissing` and `GlobalCommandPermissions` codes. `set()` is the bulk overwrite and replaces whatever `@wolfstar/http-framework` registered, nothing calls it for you. diff --git a/.changeset/gateway-application-emoji.md b/.changeset/gateway-application-emoji.md deleted file mode 100644 index f922f371..00000000 --- a/.changeset/gateway-application-emoji.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -Add `ApplicationEmoji` and `ApplicationEmojiManager`, discord.js's emojis owned by the application rather than a guild, reachable as `client.application.emojis`. The manager is fetch-only (Discord sends no event for these emojis, so nothing is cached): `fetch()` lists them in a `Collection` and `fetch(id)` gets one, with `create`, `edit`, `delete` and `fetchAuthor`. An `ApplicationEmoji` extends `Emoji` with `author`, `application`, `edit`, `setName`, `delete`, `fetchAuthor` and `equals`, which compares only the ID, name and `animated`, the fields the API sends. diff --git a/.changeset/gateway-crosspost-create-message.md b/.changeset/gateway-crosspost-create-message.md deleted file mode 100644 index 3745fb68..00000000 --- a/.changeset/gateway-crosspost-create-message.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -`channel.messages.crosspost` takes a message or its ID, and `client.channels.createMessage(channel, options)` sends a message to a channel or its ID, like discord.js. diff --git a/.changeset/gateway-expected-guilds-by-shard.md b/.changeset/gateway-expected-guilds-by-shard.md deleted file mode 100644 index adde23b0..00000000 --- a/.changeset/gateway-expected-guilds-by-shard.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": patch ---- - -Track the guilds `clientReady` waits for by shard, like discord.js: a shard's new `READY` now replaces the unavailable guilds its previous one listed instead of adding to them, so a guild the bot left between two `READY`s of a shard (a session invalidated during startup) no longer holds `clientReady` back until `waitGuildTimeout`. The client also stops collecting these guild IDs once `clientReady` fired, where every reconnect's `READY` used to add them to a set that was never emptied. diff --git a/.changeset/gateway-forward-ready-guild-delete.md b/.changeset/gateway-forward-ready-guild-delete.md deleted file mode 100644 index 08dcc56f..00000000 --- a/.changeset/gateway-forward-ready-guild-delete.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@wolfstar/plugin-gateway": patch -"@wolfstar/plugin-broker": patch ---- - -Forward the `guildDelete` of a guild a `READY` drops: when a `READY` no longer lists a cached guild (the bot left it while offline), `GatewayClient` now emits `dispatch` for the `GUILD_DELETE` it applies, after the cache write and with the cached guild as its state, before `guildDelete`. `forwardGatewayDispatches` publishes it like any other dispatch, so a `plugin-broker` worker's `guildDelete` listeners clean these guilds up too. The made-up dispatch carries `s: 0` and is not emitted as `raw`. diff --git a/.changeset/gateway-message-threadable.md b/.changeset/gateway-message-threadable.md deleted file mode 100644 index 47d66a19..00000000 --- a/.changeset/gateway-message-threadable.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -Add `Message#threadable`, like discord.js: whether the bot can start a thread from the message (a text or announcement channel, no thread yet, and `ViewChannel` plus `CreatePublicThreads`). It reads the cache, so it is a promise with an asynchronous cache and throws `ChannelUncached`, `GuildUncachedMe` or `GuildUncached` on a miss, like the other message checks. Unlike discord.js, an administrator bot is threadable, as the API allows it. diff --git a/.changeset/gateway-monetization-managers.md b/.changeset/gateway-monetization-managers.md deleted file mode 100644 index 59f091cb..00000000 --- a/.changeset/gateway-monetization-managers.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -Add the monetization managers. `client.application.entitlements` is an `EntitlementManager`, cached from `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE` and `ENTITLEMENT_DELETE` (which emit the new `entitlementCreate`, `entitlementUpdate` and `entitlementDelete` events), with `fetch()` for one entitlement or a filtered `Collection`, `createTest()`, `deleteTest()` and `consume()`. `client.application.fetchSKUs()` returns the `SKU`s of the application, and `sku.subscriptions` (or `client.application.subscriptions(sku)`) is a fetch-only `SubscriptionManager`. Adds the `Entitlement`, `SKU` and `Subscription` structures, `SKUFlagsBitField`, and the `EntitlementCreateInvalidOwner` error; `EntitlementResolvable`, `SKUResolvable` and `SubscriptionResolvable` now also accept the structures. diff --git a/.changeset/gateway-register-as-dispatch-listener.md b/.changeset/gateway-register-as-dispatch-listener.md deleted file mode 100644 index a9ac7283..00000000 --- a/.changeset/gateway-register-as-dispatch-listener.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -Add `RegisterAsDispatchListener`, a `RegisterAsGatewayListener` whose listener runs on one process only: the workers replaying the dispatches while the gateway client forwards them, the gateway client otherwise, so a bot loading the same pieces on both no longer handles each dispatch twice. `GatewayClient` gains `forwardsDispatches` and `markDispatchesForwarded()` for `forwardGatewayDispatches` to set, and `DispatchEventName`, `GatewayOnlyEventName` and `gatewayOnlyEvents` tell the events a worker receives from the ones only the gateway client emits, which the decorator rejects. diff --git a/.changeset/gateway-util-followups.md b/.changeset/gateway-util-followups.md deleted file mode 100644 index f9b3bfe1..00000000 --- a/.changeset/gateway-util-followups.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -`transformResolved` now also resolves `messages` (IDs read from the cache of the new `channelId` option, raw data resolved to the cached message or built from it) and `attachments` (built as `Attachment`), like discord.js. `MessageMentions#parsedUsers` now includes the users the payload mentions even when they are not cached, as discord.js does by adding them to its cache; nothing is written to the cache. diff --git a/.changeset/gateway-verify-thread-dm-managers.md b/.changeset/gateway-verify-thread-dm-managers.md deleted file mode 100644 index 9aaca6de..00000000 --- a/.changeset/gateway-verify-thread-dm-managers.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-gateway": minor ---- - -Check the options of `threads.create` and the guild-only message paths against discord.js. `ThreadCreateOptions` is now `TextThreadCreateOptions | ForumThreadCreateOptions`, so mixing the options of a thread (`type`, `invitable`) with those of a forum or media post (`message`, `appliedTags`) is a compile error, and throws a `GatewayTypeError` before any request instead of being dropped silently: `ThreadOptionsPostOnly`, `ThreadOptionsThreadOnly`, and, in a forum or media channel without `message`, `ThreadPostMessageRequired`. `ChannelThreadManager` and `ChannelMessageManager` take the channel type as an optional last constructor argument (`channelType`), which `channel.threads` and `channel.messages` pass. In a direct message or group direct message, `messages.crosspost`, `messages.bulkDelete`, and `messages.startThread` now throw `ChannelMessagesGuildOnly` before any request, as discord.js's `DMMessageManager` has no such methods. diff --git a/.changeset/subcommands-advanced-sort-order.md b/.changeset/subcommands-advanced-sort-order.md deleted file mode 100644 index 90a62982..00000000 --- a/.changeset/subcommands-advanced-sort-order.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@wolfstar/plugin-subcommands-advanced": patch ---- - -Register modular subcommands (and groups) sorted by name instead of in the order the stores loaded them. The load order is not stable between starts, so the same pieces could produce differently ordered options, and `@wolfstar/http-framework` compares deployed commands by position, which updated every parent with modular subcommands on each start. The first start after upgrading may update those commands once; the order is stable after that. Subcommands the parent declares itself keep their place before the registered ones. diff --git a/packages/plugin-broker/CHANGELOG.md b/packages/plugin-broker/CHANGELOG.md index e06ba941..3f342457 100644 --- a/packages/plugin-broker/CHANGELOG.md +++ b/packages/plugin-broker/CHANGELOG.md @@ -1,5 +1,15 @@ # @wolfstar/plugin-broker +## 0.6.0 + +### Minor Changes + +- [#245](https://github.com/wolfstar-project/plugins/pull/245) [`7257223`](https://github.com/wolfstar-project/plugins/commit/7257223baea1785c72737e103243ab381f6f29f7) - `forwardGatewayDispatches` marks a `GatewayClient` as forwarding (`forwardsDispatches`) until its stop function is called, through the new optional `GatewayDispatchEmitterLike#markDispatchesForwarded`, so listeners registered with `RegisterAsDispatchListener` from `@wolfstar/plugin-gateway` run on the workers only. Emitters without it forward as before. + +### Patch Changes + +- [#247](https://github.com/wolfstar-project/plugins/pull/247) [`6012bd9`](https://github.com/wolfstar-project/plugins/commit/6012bd9d16cc73abd5e0c866a6ab2d407e3c3b79) - Forward the `guildDelete` of a guild a `READY` drops: when a `READY` no longer lists a cached guild (the bot left it while offline), `GatewayClient` now emits `dispatch` for the `GUILD_DELETE` it applies, after the cache write and with the cached guild as its state, before `guildDelete`. `forwardGatewayDispatches` publishes it like any other dispatch, so a `plugin-broker` worker's `guildDelete` listeners clean these guilds up too. The made-up dispatch carries `s: 0` and is not emitted as `raw`. + ## 0.5.1 ### Patch Changes diff --git a/packages/plugin-broker/package.json b/packages/plugin-broker/package.json index a93160cf..cec3e012 100644 --- a/packages/plugin-broker/package.json +++ b/packages/plugin-broker/package.json @@ -1,6 +1,6 @@ { "name": "@wolfstar/plugin-broker", - "version": "0.5.1", + "version": "0.6.0", "description": "Plugin for @wolfstar/http-framework distributing gateway events across processes over Redis Streams, with at-least-once delivery", "keywords": [ "broker", diff --git a/packages/plugin-gateway/CHANGELOG.md b/packages/plugin-gateway/CHANGELOG.md index 18b3fe01..ed125b39 100644 --- a/packages/plugin-gateway/CHANGELOG.md +++ b/packages/plugin-gateway/CHANGELOG.md @@ -1,5 +1,31 @@ # @wolfstar/plugin-gateway +## 0.15.0 + +### Minor Changes + +- [#252](https://github.com/wolfstar-project/plugins/pull/252) [`97aaaea`](https://github.com/wolfstar-project/plugins/commit/97aaaeaeb348f968a8bbb21d43147cbdd35d0bf1) - Add `ApplicationCommand` and its managers, fetch-only like `WebhookManager`: `client.application.commands` (`ApplicationCommandManager`) and `guild.commands` (`GuildApplicationCommandManager`, a new instance on every access, also `client.guilds.commands(guildId)`) have `fetch`, `create`, `set`, `edit`, `delete`, `commandPath` and the static `transformCommand`, which accepts camel-cased data, raw payloads and builders. `ApplicationCommand` has the command's fields, `edit()`, the `set*()` helpers, `delete()`, `permissions`, `equals(command, enforceOptionOrder?)` (`false` for a foreign argument) and the static `optionsEqual()` and `transformOption()`. `ApplicationCommandPermissionsManager` (`fetch`, `has`, and `set`, `add` and `remove` taking an explicit bearer `token`, with no OAuth handling) reads through the existing `applicationCommandPermissions` cache, kept up to date by `APPLICATION_COMMAND_PERMISSIONS_UPDATE`. `GatewayError` gains the `ApplicationCommandPermissionsTokenMissing` and `GlobalCommandPermissions` codes. `set()` is the bulk overwrite and replaces whatever `@wolfstar/http-framework` registered, nothing calls it for you. + +- [#250](https://github.com/wolfstar-project/plugins/pull/250) [`10a18a5`](https://github.com/wolfstar-project/plugins/commit/10a18a5af98fcc5fc46dd923334c7d415af8ce3e) - Add `ApplicationEmoji` and `ApplicationEmojiManager`, discord.js's emojis owned by the application rather than a guild, reachable as `client.application.emojis`. The manager is fetch-only (Discord sends no event for these emojis, so nothing is cached): `fetch()` lists them in a `Collection` and `fetch(id)` gets one, with `create`, `edit`, `delete` and `fetchAuthor`. An `ApplicationEmoji` extends `Emoji` with `author`, `application`, `edit`, `setName`, `delete`, `fetchAuthor` and `equals`, which compares only the ID, name and `animated`, the fields the API sends. + +- [#255](https://github.com/wolfstar-project/plugins/pull/255) [`1ca7f9e`](https://github.com/wolfstar-project/plugins/commit/1ca7f9e0a2da15a4b77afc7abe338f96e81b7eac) - `channel.messages.crosspost` takes a message or its ID, and `client.channels.createMessage(channel, options)` sends a message to a channel or its ID, like discord.js. + +- [#248](https://github.com/wolfstar-project/plugins/pull/248) [`12a880f`](https://github.com/wolfstar-project/plugins/commit/12a880ffa1c3b3f3f2c4d79f197cb893f3fb5045) - Add `Message#threadable`, like discord.js: whether the bot can start a thread from the message (a text or announcement channel, no thread yet, and `ViewChannel` plus `CreatePublicThreads`). It reads the cache, so it is a promise with an asynchronous cache and throws `ChannelUncached`, `GuildUncachedMe` or `GuildUncached` on a miss, like the other message checks. Unlike discord.js, an administrator bot is threadable, as the API allows it. + +- [#253](https://github.com/wolfstar-project/plugins/pull/253) [`17d2cfd`](https://github.com/wolfstar-project/plugins/commit/17d2cfd71cd8a5274ef435a96e059cc0d5df2293) - Add the monetization managers. `client.application.entitlements` is an `EntitlementManager`, cached from `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE` and `ENTITLEMENT_DELETE` (which emit the new `entitlementCreate`, `entitlementUpdate` and `entitlementDelete` events), with `fetch()` for one entitlement or a filtered `Collection`, `createTest()`, `deleteTest()` and `consume()`. `client.application.fetchSKUs()` returns the `SKU`s of the application, and `sku.subscriptions` (or `client.application.subscriptions(sku)`) is a fetch-only `SubscriptionManager`. Adds the `Entitlement`, `SKU` and `Subscription` structures, `SKUFlagsBitField`, and the `EntitlementCreateInvalidOwner` error; `EntitlementResolvable`, `SKUResolvable` and `SubscriptionResolvable` now also accept the structures. + +- [#245](https://github.com/wolfstar-project/plugins/pull/245) [`7257223`](https://github.com/wolfstar-project/plugins/commit/7257223baea1785c72737e103243ab381f6f29f7) - Add `RegisterAsDispatchListener`, a `RegisterAsGatewayListener` whose listener runs on one process only: the workers replaying the dispatches while the gateway client forwards them, the gateway client otherwise, so a bot loading the same pieces on both no longer handles each dispatch twice. `GatewayClient` gains `forwardsDispatches` and `markDispatchesForwarded()` for `forwardGatewayDispatches` to set, and `DispatchEventName`, `GatewayOnlyEventName` and `gatewayOnlyEvents` tell the events a worker receives from the ones only the gateway client emits, which the decorator rejects. + +- [#249](https://github.com/wolfstar-project/plugins/pull/249) [`e55801b`](https://github.com/wolfstar-project/plugins/commit/e55801b8a33b217dc6ef3ad9b17732962136b7ea) - `transformResolved` now also resolves `messages` (IDs read from the cache of the new `channelId` option, raw data resolved to the cached message or built from it) and `attachments` (built as `Attachment`), like discord.js. `MessageMentions#parsedUsers` now includes the users the payload mentions even when they are not cached, as discord.js does by adding them to its cache; nothing is written to the cache. + +- [#254](https://github.com/wolfstar-project/plugins/pull/254) [`b787c53`](https://github.com/wolfstar-project/plugins/commit/b787c53f830a01012ee7c6a43df3c744ae187b80) - Check the options of `threads.create` and the guild-only message paths against discord.js. `ThreadCreateOptions` is now `TextThreadCreateOptions | ForumThreadCreateOptions`, so mixing the options of a thread (`type`, `invitable`) with those of a forum or media post (`message`, `appliedTags`) is a compile error, and throws a `GatewayTypeError` before any request instead of being dropped silently: `ThreadOptionsPostOnly`, `ThreadOptionsThreadOnly`, and, in a forum or media channel without `message`, `ThreadPostMessageRequired`. `ChannelThreadManager` and `ChannelMessageManager` take the channel type as an optional last constructor argument (`channelType`), which `channel.threads` and `channel.messages` pass. In a direct message or group direct message, `messages.crosspost`, `messages.bulkDelete`, and `messages.startThread` now throw `ChannelMessagesGuildOnly` before any request, as discord.js's `DMMessageManager` has no such methods. + +### Patch Changes + +- [#247](https://github.com/wolfstar-project/plugins/pull/247) [`6012bd9`](https://github.com/wolfstar-project/plugins/commit/6012bd9d16cc73abd5e0c866a6ab2d407e3c3b79) - Track the guilds `clientReady` waits for by shard, like discord.js: a shard's new `READY` now replaces the unavailable guilds its previous one listed instead of adding to them, so a guild the bot left between two `READY`s of a shard (a session invalidated during startup) no longer holds `clientReady` back until `waitGuildTimeout`. The client also stops collecting these guild IDs once `clientReady` fired, where every reconnect's `READY` used to add them to a set that was never emptied. + +- [#247](https://github.com/wolfstar-project/plugins/pull/247) [`6012bd9`](https://github.com/wolfstar-project/plugins/commit/6012bd9d16cc73abd5e0c866a6ab2d407e3c3b79) - Forward the `guildDelete` of a guild a `READY` drops: when a `READY` no longer lists a cached guild (the bot left it while offline), `GatewayClient` now emits `dispatch` for the `GUILD_DELETE` it applies, after the cache write and with the cached guild as its state, before `guildDelete`. `forwardGatewayDispatches` publishes it like any other dispatch, so a `plugin-broker` worker's `guildDelete` listeners clean these guilds up too. The made-up dispatch carries `s: 0` and is not emitted as `raw`. + ## 0.14.0 ### Minor Changes diff --git a/packages/plugin-gateway/package.json b/packages/plugin-gateway/package.json index 43db8a97..69a0e463 100644 --- a/packages/plugin-gateway/package.json +++ b/packages/plugin-gateway/package.json @@ -1,6 +1,6 @@ { "name": "@wolfstar/plugin-gateway", - "version": "0.14.0", + "version": "0.15.0", "description": "Gateway (WebSocket) support for @wolfstar/http-framework: a GatewayClient emitting Structures, backed by a pluggable cache", "keywords": [ "discord", diff --git a/packages/plugin-subcommands-advanced/CHANGELOG.md b/packages/plugin-subcommands-advanced/CHANGELOG.md index edb883c1..7b9a0b19 100644 --- a/packages/plugin-subcommands-advanced/CHANGELOG.md +++ b/packages/plugin-subcommands-advanced/CHANGELOG.md @@ -1,5 +1,11 @@ # @wolfstar/plugin-subcommands-advanced +## 2.2.1 + +### Patch Changes + +- [#257](https://github.com/wolfstar-project/plugins/pull/257) [`481d536`](https://github.com/wolfstar-project/plugins/commit/481d53697243a48416bc0117bf77c9dbc247f820) - Register modular subcommands (and groups) sorted by name instead of in the order the stores loaded them. The load order is not stable between starts, so the same pieces could produce differently ordered options, and `@wolfstar/http-framework` compares deployed commands by position, which updated every parent with modular subcommands on each start. The first start after upgrading may update those commands once; the order is stable after that. Subcommands the parent declares itself keep their place before the registered ones. + ## 2.2.0 ### Minor Changes diff --git a/packages/plugin-subcommands-advanced/package.json b/packages/plugin-subcommands-advanced/package.json index 641fc89f..6b57a9c1 100644 --- a/packages/plugin-subcommands-advanced/package.json +++ b/packages/plugin-subcommands-advanced/package.json @@ -1,6 +1,6 @@ { "name": "@wolfstar/plugin-subcommands-advanced", - "version": "2.2.0", + "version": "2.2.1", "description": "Plugin for @wolfstar/http-framework to modularize slash subcommands into separate command classes", "keywords": [ "discord",