diff --git a/.github/workflows/deno.yml b/.github/workflows/cicd.yml similarity index 51% rename from .github/workflows/deno.yml rename to .github/workflows/cicd.yml index 032f38f0..f15c8529 100644 --- a/.github/workflows/deno.yml +++ b/.github/workflows/cicd.yml @@ -1,22 +1,47 @@ -name: Deno Deploy +name: Continuous Integration / Deployment on: push: branches: - '**' + pull_request: jobs: - BuildDeno: - name: Publish Deno Types + testing: + name: ESLint and TypeScript compilation runs-on: ubuntu-latest - if: contains(github.event.head_commit.message, 'release') + steps: + - name: Checkout Project + uses: actions/checkout@v2 + + - name: Use Node.js 14 + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Install Dependencies + run: npm ci + + - name: Run ESLint + run: npm run test:lint + + - name: Run TSC + run: npm run build:ci + + deno: + name: Generate Deno compatible code + runs-on: ubuntu-latest + + needs: testing + # Run workflow only if testing passes + if: needs.testing.result == 'success' steps: - name: Checkout Project uses: actions/checkout@v2 - name: Use Node.js 14 - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: 14 diff --git a/.github/workflows/codequality.yml b/.github/workflows/codequality.yml deleted file mode 100644 index 79eb4692..00000000 --- a/.github/workflows/codequality.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Code Quality - -on: - push: - branches: - - master - - main - - stable - pull_request: - -jobs: - ESLint: - name: ESLint - runs-on: ubuntu-latest - steps: - - name: Checkout Project - uses: actions/checkout@v1 - - name: Use Node.js 14 - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Install Dependencies - run: npm ci - - name: Run ESLint - uses: icrawl/action-eslint@v1 - with: - custom-glob: '{v*,default,common}/**' - - TypeScript: - name: TypeScript - runs-on: ubuntu-latest - steps: - - name: Checkout Project - uses: actions/checkout@v1 - - name: Use Node.js 14 - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Install Dependencies - run: npm ci - - name: Run TSC - uses: icrawl/action-tsc@v1 diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..eba3f407 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "printWidth": 120, + "useTabs": true, + "singleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "all", + "endOfLine": "lf" +} diff --git a/README.md b/README.md index edf0120b..c6f7412f 100644 --- a/README.md +++ b/README.md @@ -34,19 +34,13 @@ import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api 2. From [deno.land/x](https://deno.land/x) ```ts -// Importing the default API version -import { APIUser } from 'https://deno.land/x/discord_api_types@0.12.0/mod.ts'; - // Importing a specific API version -import { APIUser } from 'https://deno.land/x/discord_api_types@0.12.0/v8/mod.ts'; +import { APIUser } from 'https://deno.land/x/discord_api_types/v8/mod.ts'; ``` 3. From [skypack.dev](https://www.skypack.dev/) ```ts -// Importing the default API version -import { APIUser } from 'https://cdn.skypack.dev/discord-api-types?dts'; - // Importing a specific API version import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v8?dts'; ``` @@ -81,18 +75,7 @@ The exports of each API version is split into three main parts: You can `require` / `import` the module directly, which will give you the latest types as of the current API version. This is considered the `default` version and will be updated according to Discord's default API version; this means it may break at any point in time. -> We **strongly recommend** you use a version when importing this module! This will prevent breaking changes when updating the module. - -```js -const { APIUser } = require('discord-api-types'); -``` - -```ts -// TypeScript/ES Module support -import { APIUser } from 'discord-api-types'; -``` - -You should instead consider adding the API version you want to target by appending `/v*`, where the `*` represents the API version. +You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where the `*` represents the API version. Below are some examples ```js const { APIUser } = require('discord-api-types/v8'); diff --git a/deno/README.md b/deno/README.md index edf0120b..c6f7412f 100644 --- a/deno/README.md +++ b/deno/README.md @@ -34,19 +34,13 @@ import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api 2. From [deno.land/x](https://deno.land/x) ```ts -// Importing the default API version -import { APIUser } from 'https://deno.land/x/discord_api_types@0.12.0/mod.ts'; - // Importing a specific API version -import { APIUser } from 'https://deno.land/x/discord_api_types@0.12.0/v8/mod.ts'; +import { APIUser } from 'https://deno.land/x/discord_api_types/v8/mod.ts'; ``` 3. From [skypack.dev](https://www.skypack.dev/) ```ts -// Importing the default API version -import { APIUser } from 'https://cdn.skypack.dev/discord-api-types?dts'; - // Importing a specific API version import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v8?dts'; ``` @@ -81,18 +75,7 @@ The exports of each API version is split into three main parts: You can `require` / `import` the module directly, which will give you the latest types as of the current API version. This is considered the `default` version and will be updated according to Discord's default API version; this means it may break at any point in time. -> We **strongly recommend** you use a version when importing this module! This will prevent breaking changes when updating the module. - -```js -const { APIUser } = require('discord-api-types'); -``` - -```ts -// TypeScript/ES Module support -import { APIUser } from 'discord-api-types'; -``` - -You should instead consider adding the API version you want to target by appending `/v*`, where the `*` represents the API version. +You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where the `*` represents the API version. Below are some examples ```js const { APIUser } = require('discord-api-types/v8'); diff --git a/deno/common/mod.ts b/deno/common/mod.ts index 73280d01..09aae408 100644 --- a/deno/common/mod.ts +++ b/deno/common/mod.ts @@ -30,6 +30,10 @@ export const enum RESTJSONErrorCodes { UnknownRedistributable = 10036, + UnknownGuildTemplate = 10057, + + UnknownApplicationCommand = 10063, + BotsCannotUseThisEndpoint = 20001, OnlyBotsCanUseThisEndpoint, @@ -87,6 +91,8 @@ export const enum RESTJSONErrorCodes { CannotExecuteActionOnThisChannelType = 50024, InvalidOauth2AccessToken, + InvalidWebhookToken = 50027, + InvalidRecipients = 50033, OneOfTheMessagesProvidedWasTooOldForBulkDelete, InvalidFormBodyOrContentType, @@ -158,3 +164,63 @@ export type Snowflake = `${bigint}`; * @internal */ export type Permissions = `${bigint}`; + +/** + * https://discord.com/developers/docs/reference#message-formatting-formats + */ +export const FormattingPatterns = { + /** + * Regular expression for matching a user mention, strictly without a nickname + * + * The `id` group property is present on the `exec` result of this expression + */ + User: /<@(?\d{17,20})>/, + /** + * Regular expression for matching a user mention, strictly with a nickname + * + * The `id` group property is present on the `exec` result of this expression + */ + UserWithNickname: /<@!(?\d{17,20})>/, + /** + * Regular expression for matching a user mention, with or without a nickname + * + * The `id` group property is present on the `exec` result of this expression + */ + UserWithOptionalNickname: /<@!?(?\d{17,20})>/, + /** + * Regular expression for matching a channel mention + * + * The `id` group property is present on the `exec` result of this expression + */ + Channel: /<#(?\d{17,20})>/, + /** + * Regular expression for matching a role mention + * + * The `id` group property is present on the `exec` result of this expression + */ + Role: /<@&(?\d{17,20})>/, + /** + * Regular expression for matching a custom emoji, either static or animated + * + * The `animated`, `name` and `id` group properties are present on the `exec` result of this expression + */ + Emoji: /<(?a)?:(?\w{2,32}):(?\d{17,20})>/, + /** + * Regular expression for matching strictly an animated custom emoji + * + * The `animated`, `name` and `id` group properties are present on the `exec` result of this expression + */ + AnimatedEmoji: /<(?a):(?\w{2,32}):(?\d{17,20})>/, + /** + * Regular expression for matching strictly a static custom emoji + * + * The `name` and `id` group properties are present on the `exec` result of this expression + */ + StaticEmoji: /<:(?\w{2,32}):(?\d{17,20})>/, +} as const; + +/** + * Freezes the formatting patterns + * @internal + */ +Object.freeze(FormattingPatterns); diff --git a/deno/mod.ts b/deno/mod.ts deleted file mode 100644 index 8933584a..00000000 --- a/deno/mod.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file exports all the types available in the default API version -// Thereby, things MAY break in the future - -export * from './v8/mod.ts'; diff --git a/deno/v8/gateway/mod.ts b/deno/v8/gateway/mod.ts index 621b514b..ab5f9f38 100644 --- a/deno/v8/gateway/mod.ts +++ b/deno/v8/gateway/mod.ts @@ -4,6 +4,9 @@ import type { Snowflake } from '../../common/mod.ts'; import type { + APIApplication, + APIApplicationCommand, + APIApplicationCommandInteraction, APIChannel, APIEmoji, APIGuild, @@ -17,8 +20,6 @@ import type { GatewayVoiceState, InviteTargetUserType, PresenceUpdateStatus, - APIApplicationCommandInteraction, - APIApplication, } from '../payloads/mod.ts'; export const GatewayVersion = '8'; @@ -290,42 +291,45 @@ export const enum GatewayIntentBits { * https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events */ export const enum GatewayDispatchEvents { - Ready = 'READY', - Resumed = 'RESUMED', + ApplicationCommandCreate = 'APPLICATION_COMMAND_CREATE', + ApplicationCommandUpdate = 'APPLICATION_COMMAND_UPDATE', + ApplicationCommandDelete = 'APPLICATION_COMMAND_DELETE', ChannelCreate = 'CHANNEL_CREATE', - ChannelUpdate = 'CHANNEL_UPDATE', ChannelDelete = 'CHANNEL_DELETE', ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE', - GuildCreate = 'GUILD_CREATE', - GuildUpdate = 'GUILD_UPDATE', - GuildDelete = 'GUILD_DELETE', + ChannelUpdate = 'CHANNEL_UPDATE', GuildBanAdd = 'GUILD_BAN_ADD', GuildBanRemove = 'GUILD_BAN_REMOVE', + GuildCreate = 'GUILD_CREATE', + GuildDelete = 'GUILD_DELETE', GuildEmojisUpdate = 'GUILD_EMOJIS_UPDATE', GuildIntegrationsUpdate = 'GUILD_INTEGRATIONS_UPDATE', GuildMemberAdd = 'GUILD_MEMBER_ADD', GuildMemberRemove = 'GUILD_MEMBER_REMOVE', - GuildMemberUpdate = 'GUILD_MEMBER_UPDATE', GuildMembersChunk = 'GUILD_MEMBERS_CHUNK', + GuildMemberUpdate = 'GUILD_MEMBER_UPDATE', GuildRoleCreate = 'GUILD_ROLE_CREATE', - GuildRoleUpdate = 'GUILD_ROLE_UPDATE', GuildRoleDelete = 'GUILD_ROLE_DELETE', + GuildRoleUpdate = 'GUILD_ROLE_UPDATE', + GuildUpdate = 'GUILD_UPDATE', InteractionCreate = 'INTERACTION_CREATE', InviteCreate = 'INVITE_CREATE', InviteDelete = 'INVITE_DELETE', MessageCreate = 'MESSAGE_CREATE', - MessageUpdate = 'MESSAGE_UPDATE', MessageDelete = 'MESSAGE_DELETE', MessageDeleteBulk = 'MESSAGE_DELETE_BULK', MessageReactionAdd = 'MESSAGE_REACTION_ADD', MessageReactionRemove = 'MESSAGE_REACTION_REMOVE', MessageReactionRemoveAll = 'MESSAGE_REACTION_REMOVE_ALL', MessageReactionRemoveEmoji = 'MESSAGE_REACTION_REMOVE_EMOJI', + MessageUpdate = 'MESSAGE_UPDATE', PresenceUpdate = 'PRESENCE_UPDATE', + Ready = 'READY', + Resumed = 'RESUMED', TypingStart = 'TYPING_START', UserUpdate = 'USER_UPDATE', - VoiceStateUpdate = 'VOICE_STATE_UPDATE', VoiceServerUpdate = 'VOICE_SERVER_UPDATE', + VoiceStateUpdate = 'VOICE_STATE_UPDATE', WebhooksUpdate = 'WEBHOOKS_UPDATE', } @@ -346,41 +350,92 @@ export type GatewayReceivePayload = | GatewayDispatchPayload; export type GatewayDispatchPayload = - | GatewayReadyDispatch - | GatewayResumedDispatch | GatewayChannelModifyDispatch | GatewayChannelPinsUpdateDispatch - | GatewayGuildModifyDispatch - | GatewayGuildDeleteDispatch | GatewayGuildBanModifyDispatch + | GatewayGuildDeleteDispatch | GatewayGuildEmojisUpdateDispatch | GatewayGuildIntegrationsUpdateDispatch | GatewayGuildMemberAddDispatch | GatewayGuildMemberRemoveDispatch - | GatewayGuildMemberUpdateDispatch | GatewayGuildMembersChunkDispatch - | GatewayGuildRoleModifyDispatch + | GatewayGuildMemberUpdateDispatch + | GatewayGuildModifyDispatch | GatewayGuildRoleDeleteDispatch + | GatewayGuildRoleModifyDispatch | GatewayInteractionCreateDispatch | GatewayInviteCreateDispatch | GatewayInviteDeleteDispatch | GatewayMessageCreateDispatch - | GatewayMessageUpdateDispatch - | GatewayMessageDeleteDispatch | GatewayMessageDeleteBulkDispatch + | GatewayMessageDeleteDispatch | GatewayMessageReactionAddDispatch - | GatewayMessageReactionRemoveDispatch | GatewayMessageReactionRemoveAllDispatch + | GatewayMessageReactionRemoveDispatch | GatewayMessageReactionRemoveEmojiDispatch + | GatewayMessageUpdateDispatch | GatewayPresenceUpdateDispatch + | GatewayReadyDispatch + | GatewayResumedDispatch | GatewayTypingStartDispatch | GatewayUserUpdateDispatch - | GatewayVoiceStateUpdateDispatch | GatewayVoiceServerUpdateDispatch + | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch; // #region Dispatch Payloads +/** + * https://discord.com/developers/docs/topics/gateway#application-command-create + * https://discord.com/developers/docs/topics/gateway#application-command-update + * https://discord.com/developers/docs/topics/gateway#application-command-delete + */ +export type GatewayApplicationCommandModifyDispatch = DataPayload< + | GatewayDispatchEvents.ApplicationCommandCreate + | GatewayDispatchEvents.ApplicationCommandUpdate + | GatewayDispatchEvents.ApplicationCommandDelete, + GatewayApplicationCommandModifyDispatchData +>; + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-create + * https://discord.com/developers/docs/topics/gateway#application-command-update + * https://discord.com/developers/docs/topics/gateway#application-command-delete + */ +export interface GatewayApplicationCommandModifyDispatchData extends APIApplicationCommand { + guild_id?: string; +} + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-create + */ +export type GatewayApplicationCommandCreateDispatch = GatewayApplicationCommandModifyDispatch; + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-create + */ +export type GatewayApplicationCommandCreateDispatchData = GatewayApplicationCommandModifyDispatchData; + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-update + */ +export type GatewayApplicationCommandUpdateDispatch = GatewayApplicationCommandModifyDispatch; + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-update + */ +export type GatewayApplicationCommandUpdateDispatchData = GatewayApplicationCommandModifyDispatchData; + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-delete + */ +export type GatewayApplicationCommandDeleteDispatch = GatewayApplicationCommandModifyDispatch; + +/** + * https://discord.com/developers/docs/topics/gateway#application-command-delete + */ +export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationCommandModifyDispatchData; + /** * https://discord.com/developers/docs/topics/gateway#hello */ diff --git a/deno/v8/payloads/auditLog.ts b/deno/v8/payloads/auditLog.ts index 57ffdb27..9eadf385 100644 --- a/deno/v8/payloads/auditLog.ts +++ b/deno/v8/payloads/auditLog.ts @@ -233,12 +233,18 @@ export const enum AuditLogOptionsType { */ export type APIAuditLogChange = | APIAuditLogChangeKeyName + | APIAuditLogChangeKeyDescription | APIAuditLogChangeKeyIconHash | APIAuditLogChangeKeySplashHash + | APIAuditLogChangeKeyDiscoverySplashHash + | APIAuditLogChangeKeyBannerHash | APIAuditLogChangeKeyOwnerID | APIAuditLogChangeKeyRegion + | APIAuditLogChangeKeyPreferredLocale | APIAuditLogChangeKeyAFKChannelID | APIAuditLogChangeKeyAFKTimeout + | APIAuditLogChangeKeyRulesChannelID + | APIAuditLogChangeKeyPublicUpdatesChannelID | APIAuditLogChangeKeyMFALevel | APIAuditLogChangeKeyVerificationLevel | APIAuditLogChangeKeyExplicitContentFilter @@ -278,13 +284,19 @@ export type APIAuditLogChange = | APIAuditLogChangeKeyType | APIAuditLogChangeKeyEnableEmoticons | APIAuditLogChangeKeyExpireBehavior - | APIAuditLogChangeKeyExpireGracePeriod; + | APIAuditLogChangeKeyExpireGracePeriod + | APIAuditLogChangeKeyUserLimit; /** * Returned when a guild's name is changed */ export type APIAuditLogChangeKeyName = AuditLogChangeData<'name', string>; +/** + * Returned when a guild's description is changed + */ +export type APIAuditLogChangeKeyDescription = AuditLogChangeData<'description', string>; + /** * Returned when a guild's icon is changed */ @@ -296,7 +308,17 @@ export type APIAuditLogChangeKeyIconHash = AuditLogChangeData<'icon_hash', strin export type APIAuditLogChangeKeySplashHash = AuditLogChangeData<'splash_hash', string>; /** - * Returned when a guild's owner ID is changed + * Returned when a guild's discovery splash is changed + */ +export type APIAuditLogChangeKeyDiscoverySplashHash = AuditLogChangeData<'discovery_splash_hash', string>; + +/** + * Returned when a guild's banner hash is changed + */ +export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', string>; + +/** + * Returned when a guild's owner_id is changed */ export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>; @@ -305,6 +327,11 @@ export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowfla */ export type APIAuditLogChangeKeyRegion = AuditLogChangeData<'region', string>; +/** + * Returned when a guild's preferred_locale is changed + */ +export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_locale', string>; + /** * Returned when a guild's afk_channel_id is changed */ @@ -315,6 +342,16 @@ export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_i */ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', number>; +/** + * Returned when a guild's rules_channel_id is changed + */ +export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>; + +/** + * Returned when a guild's public_updates_channel_id is changed + */ +export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>; + /** * Returned when a guild's mfa_level is changed */ @@ -523,10 +560,18 @@ export type APIAuditLogChangeKeyExpireBehavior = AuditLogChangeData<'expire_beha export type APIAuditLogChangeKeyExpireGracePeriod = AuditLogChangeData<'expire_grace_period', number>; /** - * @internal + * Returned when a voice channel's user_limit is changed */ +export type APIAuditLogChangeKeyUserLimit = AuditLogChangeData<'user_limit', number>; + interface AuditLogChangeData { key: K; + /** + * The new value + * + * If `new_value` is not present in the change object, while `old_value` is, + * that means the property that was changed has been reset, or set to `null` + */ new_value?: D; old_value?: D; } diff --git a/deno/v8/payloads/interactions.ts b/deno/v8/payloads/interactions.ts index 20558787..b0109693 100644 --- a/deno/v8/payloads/interactions.ts +++ b/deno/v8/payloads/interactions.ts @@ -1,6 +1,6 @@ import type { Permissions, Snowflake } from '../../common/mod.ts'; -import type { APIGuildMember, APIUser, MessageFlags } from './mod.ts'; import type { RESTPostAPIWebhookWithTokenJSONBody } from '../rest/mod.ts'; +import type { APIGuildMember, APIUser, MessageFlags } from './mod.ts'; /** * https://discord.com/developers/docs/interactions/slash-commands#applicationcommand @@ -46,7 +46,7 @@ export interface APIApplicationCommandSubCommandOptions extends Omit { diff --git a/deno/v8/payloads/template.ts b/deno/v8/payloads/template.ts index b30dc8e4..e1090d7e 100644 --- a/deno/v8/payloads/template.ts +++ b/deno/v8/payloads/template.ts @@ -3,8 +3,8 @@ */ import type { Snowflake } from '../../common/mod.ts'; -import type { APIUser } from './user.ts'; import type { RESTPostAPIGuildsJSONBody } from '../rest/mod.ts'; +import type { APIUser } from './user.ts'; /** * https://discord.com/developers/docs/resources/template#template-object diff --git a/deno/v8/rest/channel.ts b/deno/v8/rest/channel.ts index 0740d507..d51cc0db 100644 --- a/deno/v8/rest/channel.ts +++ b/deno/v8/rest/channel.ts @@ -134,7 +134,18 @@ export type RESTGetAPIChannelMessagesResult = APIMessage[]; */ export type RESTGetAPIChannelMessageResult = APIMessage; -export type APIMessageReferenceSend = Partial & Required>; +/** + * https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure + */ +export type APIMessageReferenceSend = Partial & + Required> & { + /** + * Whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message + * + * @default true + */ + fail_if_not_exists?: boolean; + }; /** * https://discord.com/developers/docs/resources/channel#create-message diff --git a/deno/v8/rest/interactions.ts b/deno/v8/rest/interactions.ts index 6611a5f9..4d807ac1 100644 --- a/deno/v8/rest/interactions.ts +++ b/deno/v8/rest/interactions.ts @@ -5,6 +5,11 @@ import type { APIApplicationCommand, APIInteractionResponse } from '../payloads/ */ export type RESTGetAPIApplicationCommandsResult = APIApplicationCommand[]; +/** + * https://discord.com/developers/docs/interactions/slash-commands#get-global-application-command + */ +export type RESTGetAPIApplicationCommandResult = APIApplicationCommand; + /** * https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command */ @@ -30,6 +35,11 @@ export type RESTPatchAPIApplicationCommandResult = APIApplicationCommand; */ export type RESTGetAPIApplicationGuildCommandsResult = APIApplicationCommand[]; +/** + * https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command + */ +export type RESTGetAPIApplicationGuildCommandResult = APIApplicationCommand; + /** * https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command */ diff --git a/deno/v8/rest/mod.ts b/deno/v8/rest/mod.ts index 7632e7f0..a4059e87 100644 --- a/deno/v8/rest/mod.ts +++ b/deno/v8/rest/mod.ts @@ -20,7 +20,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/audit-logs` */ guildAuditLog(guildID: Snowflake) { - return `/guilds/${guildID}/audit-logs`; + return `/guilds/${guildID}/audit-logs` as const; }, /** @@ -30,7 +30,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}` */ channel(channelID: Snowflake) { - return `/channels/${channelID}`; + return `/channels/${channelID}` as const; }, /** @@ -39,7 +39,7 @@ export const Routes = { * - POST `/channels/{channel.id}/messages` */ channelMessages(channelID: Snowflake) { - return `/channels/${channelID}/messages`; + return `/channels/${channelID}/messages` as const; }, /** @@ -49,7 +49,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/messages/{message.id}` */ channelMessage(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}`; + return `/channels/${channelID}/messages/${messageID}` as const; }, /** @@ -57,7 +57,7 @@ export const Routes = { * - POST `/channels/{channel.id}/messages/{message.id}/crosspost` */ channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}/crosspost`; + return `/channels/${channelID}/messages/${messageID}/crosspost` as const; }, /** @@ -68,7 +68,7 @@ export const Routes = { * **Note**: You need to URL encode the emoji yourself */ channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) { - return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me`; + return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const; }, /** @@ -78,7 +78,7 @@ export const Routes = { * **Note**: You need to URL encode the emoji yourself */ channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}`; + return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const; }, /** @@ -89,7 +89,7 @@ export const Routes = { * **Note**: You need to URL encode the emoji yourself */ channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) { - return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}`; + return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const; }, /** @@ -97,7 +97,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/messages/{message.id}/reactions` */ channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}/reactions`; + return `/channels/${channelID}/messages/${messageID}/reactions` as const; }, /** @@ -105,7 +105,7 @@ export const Routes = { * - POST `/channels/{channel.id}/messages/bulk-delete` */ channelBulkDelete(channelID: Snowflake) { - return `/channels/${channelID}/messages/bulk-delete`; + return `/channels/${channelID}/messages/bulk-delete` as const; }, /** @@ -114,7 +114,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/permissions/{overwrite.id}` */ channelPermission(channelID: Snowflake, overwriteID: Snowflake) { - return `/channels/${channelID}/permissions/${overwriteID}`; + return `/channels/${channelID}/permissions/${overwriteID}` as const; }, /** @@ -123,7 +123,7 @@ export const Routes = { * - POST `/channels/{channel.id}/invites` */ channelInvites(channelID: Snowflake) { - return `/channels/${channelID}/invites`; + return `/channels/${channelID}/invites` as const; }, /** @@ -131,7 +131,7 @@ export const Routes = { * - POST `/channels/{channel.id}/followers` */ channelFollowers(channelID: Snowflake) { - return `/channels/${channelID}/followers`; + return `/channels/${channelID}/followers` as const; }, /** @@ -139,7 +139,7 @@ export const Routes = { * - POST `/channels/{channel.id}/typing` */ channelTyping(channelID: Snowflake) { - return `/channels/${channelID}/typing`; + return `/channels/${channelID}/typing` as const; }, /** @@ -147,7 +147,7 @@ export const Routes = { * - GET `/channels/{channel.id}/pins` */ channelPins(channelID: Snowflake) { - return `/channels/${channelID}/pins`; + return `/channels/${channelID}/pins` as const; }, /** @@ -156,7 +156,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/pins/{message.id}` */ channelPin(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/pins/${messageID}`; + return `/channels/${channelID}/pins/${messageID}` as const; }, /** @@ -165,7 +165,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/recipients/{user.id}` */ channelRecipient(channelID: Snowflake, userID: Snowflake) { - return `/channels/${channelID}/recipients/${userID}`; + return `/channels/${channelID}/recipients/${userID}` as const; }, /** @@ -174,7 +174,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/emojis` */ guildEmojis(guildID: Snowflake) { - return `/guilds/${guildID}/emojis`; + return `/guilds/${guildID}/emojis` as const; }, /** @@ -184,7 +184,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/emojis/{emoji.id}` */ guildEmoji(guildID: Snowflake, emojiID: Snowflake) { - return `/guilds/${guildID}/emojis/${emojiID}`; + return `/guilds/${guildID}/emojis/${emojiID}` as const; }, /** @@ -192,7 +192,7 @@ export const Routes = { * - POST `/guilds` */ guilds() { - return '/guilds'; + return '/guilds' as const; }, /** @@ -202,7 +202,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}` */ guild(guildID: Snowflake) { - return `/guilds/${guildID}`; + return `/guilds/${guildID}` as const; }, /** @@ -210,7 +210,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/preview` */ guildPreview(guildID: Snowflake) { - return `/guilds/${guildID}/preview`; + return `/guilds/${guildID}/preview` as const; }, /** @@ -220,7 +220,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/channels` */ guildChannels(guildID: Snowflake) { - return `/guilds/${guildID}/channels`; + return `/guilds/${guildID}/channels` as const; }, /** @@ -231,7 +231,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/members/{user.id}` */ guildMember(guildID: Snowflake, userID: Snowflake) { - return `/guilds/${guildID}/members/${userID}`; + return `/guilds/${guildID}/members/${userID}` as const; }, /** @@ -239,7 +239,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/members` */ guildMembers(guildID: Snowflake) { - return `/guilds/${guildID}/members`; + return `/guilds/${guildID}/members` as const; }, /** @@ -247,7 +247,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/members/search` */ guildMembersSearch(guildID: Snowflake) { - return `/guilds/${guildID}/members/search`; + return `/guilds/${guildID}/members/search` as const; }, /** @@ -255,7 +255,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/members/@me/nick` */ guildCurrentMemberNickname(guildID: Snowflake) { - return `/guilds/${guildID}/members/@me/nick`; + return `/guilds/${guildID}/members/@me/nick` as const; }, /** @@ -264,7 +264,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}` */ guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) { - return `/guilds/${guildID}/members/${memberID}/roles/${roleID}`; + return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const; }, /** @@ -272,7 +272,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/bans` */ guildBans(guildID: Snowflake) { - return `/guilds/${guildID}/bans`; + return `/guilds/${guildID}/bans` as const; }, /** @@ -282,7 +282,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/bans/{user.id}` */ guildBan(guildID: Snowflake, userID: Snowflake) { - return `/guilds/${guildID}/bans/${userID}`; + return `/guilds/${guildID}/bans/${userID}` as const; }, /** @@ -292,7 +292,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/roles` */ guildRoles(guildID: Snowflake) { - return `/guilds/${guildID}/roles`; + return `/guilds/${guildID}/roles` as const; }, /** @@ -301,7 +301,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/roles/{role.id}` */ guildRole(guildID: Snowflake, roleID: Snowflake) { - return `/guilds/${guildID}/roles/${roleID}`; + return `/guilds/${guildID}/roles/${roleID}` as const; }, /** @@ -310,7 +310,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/prune` */ guildPrune(guildID: Snowflake) { - return `/guilds/${guildID}/prune`; + return `/guilds/${guildID}/prune` as const; }, /** @@ -318,7 +318,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/regions` */ guildVoiceRegions(guildID: Snowflake) { - return `/guilds/${guildID}/regions`; + return `/guilds/${guildID}/regions` as const; }, /** @@ -326,7 +326,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/invites` */ guildInvites(guildID: Snowflake) { - return `/guilds/${guildID}/invites`; + return `/guilds/${guildID}/invites` as const; }, /** @@ -335,7 +335,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/integrations` */ guildIntegrations(guildID: Snowflake) { - return `/guilds/${guildID}/integrations`; + return `/guilds/${guildID}/integrations` as const; }, /** @@ -344,7 +344,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/integrations/{integration.id}` */ guildIntegration(guildID: Snowflake, integrationID: Snowflake) { - return `/guilds/${guildID}/integrations/${integrationID}`; + return `/guilds/${guildID}/integrations/${integrationID}` as const; }, /** @@ -352,7 +352,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/integrations/{integration.id}/sync` */ guildIntegrationSync(guildID: Snowflake, integrationID: Snowflake) { - return `/guilds/${guildID}/integrations/${integrationID}/sync`; + return `/guilds/${guildID}/integrations/${integrationID}/sync` as const; }, /** @@ -361,7 +361,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/widget` */ guildWidgetSettings(guildID: Snowflake) { - return `/guilds/${guildID}/widget`; + return `/guilds/${guildID}/widget` as const; }, /** @@ -369,7 +369,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/widget.json` */ guildWidgetJSON(guildID: Snowflake) { - return `/guilds/${guildID}/widget.json`; + return `/guilds/${guildID}/widget.json` as const; }, /** @@ -377,7 +377,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/vanity-url` */ guildVanityUrl(guildID: Snowflake) { - return `/guilds/${guildID}/vanity-url`; + return `/guilds/${guildID}/vanity-url` as const; }, /** @@ -385,7 +385,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/widget.png` */ guildWidgetImage(guildID: Snowflake) { - return `/guilds/${guildID}/widget.png`; + return `/guilds/${guildID}/widget.png` as const; }, /** @@ -394,7 +394,7 @@ export const Routes = { * - DELETE `/invites/{invite.code}` */ invite(code: string) { - return `/invites/${code}`; + return `/invites/${code}` as const; }, /** @@ -403,7 +403,7 @@ export const Routes = { * - POST `/guilds/templates/{template.code}` */ template(code: string) { - return `/guilds/templates/${code}`; + return `/guilds/templates/${code}` as const; }, /** @@ -412,7 +412,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/templates` */ guildTemplates(guildID: Snowflake) { - return `/guilds/${guildID}/templates`; + return `/guilds/${guildID}/templates` as const; }, /** @@ -422,7 +422,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/templates/{template.code}` */ guildTemplate(guildID: Snowflake, code: string) { - return `/guilds/${guildID}/templates/${code}`; + return `/guilds/${guildID}/templates/${code}` as const; }, /** @@ -434,7 +434,7 @@ export const Routes = { * @param [userID='@me'] The user ID, defaulted to `@me` */ user(userID = '@me') { - return `/users/${userID}`; + return `/users/${userID}` as const; }, /** @@ -442,7 +442,7 @@ export const Routes = { * - GET `/users/@me/guilds` */ userGuilds() { - return `/users/@me/guilds`; + return `/users/@me/guilds` as const; }, /** @@ -450,7 +450,7 @@ export const Routes = { * - DELETE `/users/@me/guilds/{guild.id}` */ userGuild(guildID: Snowflake) { - return `/users/@me/guilds/${guildID}`; + return `/users/@me/guilds/${guildID}` as const; }, /** @@ -458,7 +458,7 @@ export const Routes = { * - POST `/users/@me/channels` */ userChannels() { - return `/users/@me/channels`; + return `/users/@me/channels` as const; }, /** @@ -466,7 +466,7 @@ export const Routes = { * - GET `/users/@me/connections` */ userConnections() { - return `/users/@me/connections`; + return `/users/@me/connections` as const; }, /** @@ -474,7 +474,7 @@ export const Routes = { * - GET `/voice/regions` */ voiceRegions() { - return `/voice/regions`; + return `/voice/regions` as const; }, /** @@ -483,7 +483,7 @@ export const Routes = { * - POST `/channels/{channel.id}/webhooks` */ channelWebhooks(channelID: Snowflake) { - return `/channels/${channelID}/webhooks`; + return `/channels/${channelID}/webhooks` as const; }, /** @@ -491,7 +491,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/webhooks` */ guildWebhooks(guildID: Snowflake) { - return `/guilds/${guildID}/webhooks`; + return `/guilds/${guildID}/webhooks` as const; }, /** @@ -511,7 +511,7 @@ export const Routes = { if (webhookToken) parts.push(webhookToken); - return parts.join('/'); + return parts.join('/') as `/webhooks/${Snowflake}` | `/webhooks/${Snowflake}/${string}`; }, /** @@ -528,7 +528,7 @@ export const Routes = { * @param [messageID='@original'] The message ID to change, defaulted to `@original` */ webhookMessage(webhookID: Snowflake, webhookToken: string, messageID = '@original') { - return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}`; + return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const; }, /** @@ -537,7 +537,7 @@ export const Routes = { * - POST `/webhooks/{webhook.id}/{webhook.token}/slack` */ webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') { - return `/webhooks/${webhookID}/${webhookToken}/${platform}`; + return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const; }, /** @@ -545,7 +545,7 @@ export const Routes = { * - GET `/gateway` */ gateway() { - return `/gateway`; + return `/gateway` as const; }, /** @@ -553,7 +553,7 @@ export const Routes = { * - GET `/gateway/bot` */ gatewayBot() { - return `/gateway/bot`; + return `/gateway/bot` as const; }, /** @@ -561,7 +561,15 @@ export const Routes = { * - GET `/oauth2/applications/@me` */ oauth2CurrentApplication() { - return `/oauth2/applications/@me`; + return `/oauth2/applications/@me` as const; + }, + + /** + * Route for: + * - GET `/oauth2/@me` + */ + oauth2CurrentAuthorization() { + return `/oauth2/@me` as const; }, /** @@ -570,16 +578,17 @@ export const Routes = { * - POST `/applications/{application.id}/commands` */ applicationCommands(applicationID: Snowflake) { - return `/applications/${applicationID}/commands`; + return `/applications/${applicationID}/commands` as const; }, /** * Route for: + * - GET `/applications/{application.id}/commands/{command.id}` * - PATCH `/applications/{application.id}/commands/{command.id}` * - DELETE `/applications/{application.id}/commands/{command.id}` */ applicationCommand(applicationID: Snowflake, commandID: Snowflake) { - return `/applications/${applicationID}/commands/${commandID}`; + return `/applications/${applicationID}/commands/${commandID}` as const; }, /** @@ -588,16 +597,17 @@ export const Routes = { * - POST `/applications/{application.id}/guilds/{guild.id}/commands` */ applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) { - return `/applications/${applicationID}/guilds/${guildID}/commands`; + return `/applications/${applicationID}/guilds/${guildID}/commands` as const; }, /** * Route for: + * - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}` * - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}` * - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}` */ applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) { - return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`; + return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const; }, /** @@ -605,7 +615,7 @@ export const Routes = { * - POST `/interactions/{interaction.id}/{interaction.token}/callback` */ interactionCallback(interactionID: Snowflake, interactionToken: string) { - return `/interactions/${interactionID}/${interactionToken}/callback`; + return `/interactions/${interactionID}/${interactionToken}/callback` as const; }, /** @@ -614,10 +624,24 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/member-verification` */ guildMemberVerification(guildID: Snowflake) { - return `/guilds/${guildID}/member-verification`; + return `/guilds/${guildID}/member-verification` as const; }, }; +export const RouteBases = { + api: 'https://discord.com/api', + cdn: 'https://cdn.discordapp.com', + invite: 'https://discord.gg', + template: 'https://discord.new', + gift: 'https://discord.gift', +} as const; + +/** + * Freeze bases object + * @internal + */ +Object.freeze(RouteBases); + export const OAuth2Routes = { authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`, tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`, @@ -628,7 +652,7 @@ export const OAuth2Routes = { } as const; /** - * Freeze route object + * Freeze OAuth2 route object * @internal */ Object.freeze(OAuth2Routes); diff --git a/deno/v8/rest/oauth2.ts b/deno/v8/rest/oauth2.ts index 5dccbb88..0f339237 100644 --- a/deno/v8/rest/oauth2.ts +++ b/deno/v8/rest/oauth2.ts @@ -1,11 +1,33 @@ import type { Permissions, Snowflake } from '../../common/mod.ts'; -import type { APIApplication, APIGuild, APIWebhook, OAuth2Scopes } from '../payloads/mod.ts'; +import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../payloads/mod.ts'; /** * https://discord.com/developers/docs/topics/oauth2#get-current-application-information */ export type RESTGetAPIOauth2CurrentApplicationResult = Omit; +/** + * https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information + */ +export interface RESTGetAPIOauth2CurrentAuthorizationResult { + /** + * the current application + */ + application: Partial; + /** + * the scopes the user has authorized the application for + */ + scopes: OAuth2Scopes[]; + /** + * when the access token expires + */ + expires: string; + /** + * the user who has authorized, if the user has authorized with the `identify` scope + */ + user?: APIUser; +} + /** * https://discord.com/developers/docs/topics/oauth2#authorization-code-grant */ diff --git a/deno/v8/rest/webhook.ts b/deno/v8/rest/webhook.ts index af3f85dd..57248965 100644 --- a/deno/v8/rest/webhook.ts +++ b/deno/v8/rest/webhook.ts @@ -207,12 +207,20 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable< Pick >; +/** + * https://discord.com/developers/docs/resources/webhook#edit-webhook-message + */ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody = | { payload_json: string; } | RESTPatchAPIWebhookWithTokenMessageJSONBody; +/** + * https://discord.com/developers/docs/resources/webhook#edit-webhook-message + */ +export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage; + /** * https://discord.com/developers/docs/resources/webhook#delete-webhook-message */ diff --git a/package-lock.json b/package-lock.json index 32b10172..306f8b90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "discord-api-types", - "version": "0.12.1", + "version": "0.13.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -301,9 +301,9 @@ "dev": true }, "@eslint/eslintrc": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.2.tgz", - "integrity": "sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", + "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -313,7 +313,7 @@ "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" }, @@ -327,35 +327,35 @@ } }, "@nodelib/fs.scandir": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", - "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", "dev": true, "requires": { - "@nodelib/fs.stat": "2.0.3", + "@nodelib/fs.stat": "2.0.4", "run-parallel": "^1.1.9" } }, "@nodelib/fs.stat": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", - "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", "dev": true }, "@nodelib/fs.walk": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", - "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", "dev": true, "requires": { - "@nodelib/fs.scandir": "2.1.3", + "@nodelib/fs.scandir": "2.1.4", "fastq": "^1.6.0" } }, "@types/json-schema": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", - "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", "dev": true }, "@types/minimist": { @@ -377,70 +377,71 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.10.0.tgz", - "integrity": "sha512-h6/V46o6aXpKRlarP1AiJEXuCJ7cMQdlpfMDrcllIgX3dFkLwEBTXAoNP98ZoOmqd1xvymMVRAI4e7yVvlzWEg==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.2.tgz", + "integrity": "sha512-uMGfG7GFYK/nYutK/iqYJv6K/Xuog/vrRRZX9aEP4Zv1jsYXuvFUMDFLhUnc8WFv3D2R5QhNQL3VYKmvLS5zsQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.10.0", - "@typescript-eslint/scope-manager": "4.10.0", + "@typescript-eslint/experimental-utils": "4.14.2", + "@typescript-eslint/scope-manager": "4.14.2", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", "regexpp": "^3.0.0", "semver": "^7.3.2", "tsutils": "^3.17.1" } }, "@typescript-eslint/experimental-utils": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.10.0.tgz", - "integrity": "sha512-opX+7ai1sdWBOIoBgpVJrH5e89ra1KoLrJTz0UtWAa4IekkKmqDosk5r6xqRaNJfCXEfteW4HXQAwMdx+jjEmw==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.2.tgz", + "integrity": "sha512-mV9pmET4C2y2WlyHmD+Iun8SAEqkLahHGBkGqDVslHkmoj3VnxnGP4ANlwuxxfq1BsKdl/MPieDbohCEQgKrwA==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.10.0", - "@typescript-eslint/types": "4.10.0", - "@typescript-eslint/typescript-estree": "4.10.0", + "@typescript-eslint/scope-manager": "4.14.2", + "@typescript-eslint/types": "4.14.2", + "@typescript-eslint/typescript-estree": "4.14.2", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.10.0.tgz", - "integrity": "sha512-amBvUUGBMadzCW6c/qaZmfr3t9PyevcSWw7hY2FuevdZVp5QPw/K76VSQ5Sw3BxlgYCHZcK6DjIhSZK0PQNsQg==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.2.tgz", + "integrity": "sha512-ipqSP6EuUsMu3E10EZIApOJgWSpcNXeKZaFeNKQyzqxnQl8eQCbV+TSNsl+s2GViX2d18m1rq3CWgnpOxDPgHg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.10.0", - "@typescript-eslint/types": "4.10.0", - "@typescript-eslint/typescript-estree": "4.10.0", + "@typescript-eslint/scope-manager": "4.14.2", + "@typescript-eslint/types": "4.14.2", + "@typescript-eslint/typescript-estree": "4.14.2", "debug": "^4.1.1" } }, "@typescript-eslint/scope-manager": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.10.0.tgz", - "integrity": "sha512-WAPVw35P+fcnOa8DEic0tQUhoJJsgt+g6DEcz257G7vHFMwmag58EfowdVbiNcdfcV27EFR0tUBVXkDoIvfisQ==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.2.tgz", + "integrity": "sha512-cuV9wMrzKm6yIuV48aTPfIeqErt5xceTheAgk70N1V4/2Ecj+fhl34iro/vIssJlb7XtzcaD07hWk7Jk0nKghg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.10.0", - "@typescript-eslint/visitor-keys": "4.10.0" + "@typescript-eslint/types": "4.14.2", + "@typescript-eslint/visitor-keys": "4.14.2" } }, "@typescript-eslint/types": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.10.0.tgz", - "integrity": "sha512-+dt5w1+Lqyd7wIPMa4XhJxUuE8+YF+vxQ6zxHyhLGHJjHiunPf0wSV8LtQwkpmAsRi1lEOoOIR30FG5S2HS33g==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.2.tgz", + "integrity": "sha512-LltxawRW6wXy4Gck6ZKlBD05tCHQUj4KLn4iR69IyRiDHX3d3NCAhO+ix5OR2Q+q9bjCrHE/HKt+riZkd1At8Q==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.10.0.tgz", - "integrity": "sha512-mGK0YRp9TOk6ZqZ98F++bW6X5kMTzCRROJkGXH62d2azhghmq+1LNLylkGe6uGUOQzD452NOAEth5VAF6PDo5g==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.2.tgz", + "integrity": "sha512-ESiFl8afXxt1dNj8ENEZT12p+jl9PqRur+Y19m0Z/SPikGL6rqq4e7Me60SU9a2M28uz48/8yct97VQYaGl0Vg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.10.0", - "@typescript-eslint/visitor-keys": "4.10.0", + "@typescript-eslint/types": "4.14.2", + "@typescript-eslint/visitor-keys": "4.14.2", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -450,12 +451,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.10.0.tgz", - "integrity": "sha512-hPyz5qmDMuZWFtHZkjcCpkAKHX8vdu1G3YsCLEd25ryZgnJfj6FQuJ5/O7R+dB1ueszilJmAFMtlU4CA6se3Jg==", + "version": "4.14.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.2.tgz", + "integrity": "sha512-KBB+xLBxnBdTENs/rUgeUKO0UkPBRs2vD09oMRRIkj5BEN8PX1ToXV532desXfpQnZsYTyLLviS7JrPhdL154w==", "dev": true, "requires": { - "@typescript-eslint/types": "4.10.0", + "@typescript-eslint/types": "4.14.2", "eslint-visitor-keys": "^2.0.0" } }, @@ -579,9 +580,9 @@ } }, "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, "at-least-node": { @@ -689,12 +690,6 @@ "string-width": "^4.2.0" }, "dependencies": { - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, "slice-ansi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", @@ -981,13 +976,13 @@ "dev": true }, "eslint": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.15.0.tgz", - "integrity": "sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz", + "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.2.2", + "@eslint/eslintrc": "^0.3.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1011,7 +1006,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -1020,7 +1015,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^5.2.3", + "table": "^6.0.4", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, @@ -1034,30 +1029,30 @@ } }, "eslint-config-aqua": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/eslint-config-aqua/-/eslint-config-aqua-7.3.0.tgz", - "integrity": "sha512-rSOMrG5fpv/DtITtGKeOwTWYMeLiCaNLIsJlLABp2oeDs4qTaIE4Y3UdWc/10/C7Vuy/aNGiOidb/XAa6veFFg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-aqua/-/eslint-config-aqua-8.0.0.tgz", + "integrity": "sha512-TKvuVmjsb9b31dAWDptI9vY2DlUGidhL2slX20GZtnWALRdoH8cjSOeLpDF2H+yU+wSVDL/Ni0oFWPaG8L8lWA==", "dev": true }, "eslint-config-marine": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-marine/-/eslint-config-marine-7.2.0.tgz", - "integrity": "sha512-emIoQpexPl5Of4d/qZ+lf91JObvnJefGdsuNUQWH8p2E7iSSw8nQmOSocVdEUWjZoTzhf1z0x/UP4g9g6S2Kdw==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-marine/-/eslint-config-marine-8.1.0.tgz", + "integrity": "sha512-BSYZe12AZoOi83Up2KhfmvVRzaqgMIgTC8q73/M8AvL/bsLxi3cz0hNKPx+NL9KHFeopGaaGiE3h0o/fXBdFCQ==", "dev": true, "requires": { - "eslint-config-aqua": "^7.3.0" + "eslint-config-aqua": "^8.0.0" } }, "eslint-config-prettier": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz", - "integrity": "sha512-8Y8lGLVPPZdaNA7JXqnvETVC7IiVRgAP6afQu9gOQRn90YY3otMNh+x7Vr2vMePQntF+5erdSUBqSzCmU/AxaQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", + "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", "dev": true }, "eslint-plugin-prettier": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.0.tgz", - "integrity": "sha512-tMTwO8iUWlSRZIwS9k7/E4vrTsfvsrcM5p1eftyuqWH25nKsz/o6/54I7jwQ/3zobISyC7wMy9ZsFwgTxOcOpQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz", + "integrity": "sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0" @@ -1122,9 +1117,9 @@ "dev": true }, "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -1197,9 +1192,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", - "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -1223,9 +1218,9 @@ "dev": true }, "fastq": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.9.0.tgz", - "integrity": "sha512-i7FVWL8HhVY+CTkwFxkN2mk3h+787ixS5S63eb78diVRc1MCssarHq3W5cj0av7YDSwmaV928RNag+U1etRQ7w==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.10.1.tgz", + "integrity": "sha512-AWuv6Ery3pM+dY7LYS8YIaCiQvUaos9OB1RyNgaOWnaX+Tik7Onvcsf8x8c+YtDeT0maYLniBip2hox5KtEXXA==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -1269,12 +1264,12 @@ } }, "find-versions": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", - "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz", + "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==", "dev": true, "requires": { - "semver-regex": "^2.0.0" + "semver-regex": "^3.1.2" } }, "flat-cache": { @@ -1288,9 +1283,9 @@ } }, "flatted": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz", - "integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", "dev": true }, "fs-extra": { @@ -1433,9 +1428,9 @@ } }, "globby": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", - "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -1495,18 +1490,18 @@ "dev": true }, "husky": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.6.tgz", - "integrity": "sha512-o6UjVI8xtlWRL5395iWq9LKDyp/9TE7XMOTvIpEVzW638UcGxTmV5cfel6fsk/jbZSTlvfGVJf2svFtybcIZag==", + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", + "integrity": "sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow==", "dev": true, "requires": { "chalk": "^4.0.0", "ci-info": "^2.0.0", "compare-versions": "^3.6.0", "cosmiconfig": "^7.0.0", - "find-versions": "^3.2.0", + "find-versions": "^4.0.0", "opencollective-postinstall": "^2.0.2", - "pkg-dir": "^4.2.0", + "pkg-dir": "^5.0.0", "please-upgrade-node": "^3.2.0", "slash": "^3.0.0", "which-pm-runs": "^1.0.0" @@ -1789,9 +1784,9 @@ "dev": true }, "lint-staged": { - "version": "10.5.3", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.5.3.tgz", - "integrity": "sha512-TanwFfuqUBLufxCc3RUtFEkFraSPNR3WzWcGF39R3f2J7S9+iF9W0KTVLfSy09lYGmZS5NDCxjNvhGMSJyFCWg==", + "version": "10.5.4", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.5.4.tgz", + "integrity": "sha512-EechC3DdFic/TdOPgj/RB3FicqE6932LTHCUm0Y2fsD9KGlLB+RwJl2q1IYBIvEsKzDOgn0D4gll+YxG5RsrKg==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -1812,9 +1807,9 @@ } }, "listr2": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.2.3.tgz", - "integrity": "sha512-vUb80S2dSUi8YxXahO8/I/s29GqnOL8ozgHVLjfWQXa03BNEeS1TpBLjh2ruaqq5ufx46BRGvfymdBSuoXET5w==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.3.1.tgz", + "integrity": "sha512-8Zoxe7s/8nNr4bJ8bdAduHD8uJce+exmMmUWTXlq0WuUdffnH3muisHPHPFtW2vvOfohIsq7FGCaguUxN/h3Iw==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -1824,7 +1819,21 @@ "log-update": "^4.0.0", "p-map": "^4.0.0", "rxjs": "^6.6.3", - "through": "^2.3.8" + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } } }, "load-json-file": { @@ -1910,25 +1919,6 @@ "cli-cursor": "^3.1.0", "slice-ansi": "^4.0.0", "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - } } }, "lru-cache": { @@ -2397,12 +2387,51 @@ "dev": true }, "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", "dev": true, "requires": { - "find-up": "^4.0.0" + "find-up": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + } } }, "please-upgrade-node": { @@ -2581,6 +2610,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -2671,9 +2706,9 @@ "dev": true }, "semver-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", - "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.2.tgz", + "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==", "dev": true }, "set-blocking": { @@ -2716,46 +2751,14 @@ "dev": true }, "slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" } }, "spdx-correct": { @@ -2939,54 +2942,34 @@ } }, "table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", "dev": true, "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" + "ajv": "^7.0.2", + "lodash": "^4.17.20", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "ajv": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.4.tgz", + "integrity": "sha512-xzzzaqgEQfmuhbhAoqjJ8T/1okb6gAzXn/eQRNpAN1AEUoHJTNF9xCDRTtf/s3SKldtZfa+RJeTs+BQq+eZ/sw==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" } }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true } } }, @@ -3058,9 +3041,9 @@ "dev": true }, "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz", + "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -3094,9 +3077,9 @@ "dev": true }, "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, "requires": { "punycode": "^2.1.0" diff --git a/package.json b/package.json index 3ffa6331..fce0d63d 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "main": "./default/index.js", "types": "./default/index.d.ts", "exports": { - ".": { - "require": "./default/index.js", - "import": "./default/index.mjs" + "./common": { + "require": "./common/index.js", + "import": "./common/index.mjs" }, "./v6": { "require": "./v6/index.js", @@ -23,8 +23,8 @@ "postpublish": "run-s clean:node build:deno", "build:deno": "node ./scripts/deno.mjs", "build:node": "tsc && run-p esm:*", + "build:ci": "tsc --noEmit --incremental false", "esm:common": "gen-esm-wrapper ./common/index.js ./common/index.mjs", - "esm:default": "gen-esm-wrapper ./default/index.js ./default/index.mjs", "esm:v6": "gen-esm-wrapper ./v6/index.js ./v6/index.mjs", "esm:v8": "gen-esm-wrapper ./v8/index.js ./v8/index.mjs", "lint": "eslint --fix --ext mjs,js,ts {v*,default,common}/**", @@ -55,15 +55,15 @@ "devDependencies": { "@commitlint/cli": "^11.0.0", "@commitlint/config-angular": "^11.0.0", - "@typescript-eslint/eslint-plugin": "^4.10.0", - "@typescript-eslint/parser": "^4.10.0", - "eslint": "^7.15.0", - "eslint-config-marine": "^7.2.0", - "eslint-config-prettier": "^7.0.0", - "eslint-plugin-prettier": "^3.3.0", + "@typescript-eslint/eslint-plugin": "^4.14.2", + "@typescript-eslint/parser": "^4.14.2", + "eslint": "^7.19.0", + "eslint-config-marine": "^8.1.0", + "eslint-config-prettier": "^7.2.0", + "eslint-plugin-prettier": "^3.3.1", "gen-esm-wrapper": "^1.1.1", - "husky": "^4.3.6", - "lint-staged": "^10.5.3", + "husky": "^4.3.8", + "lint-staged": "^10.5.4", "npm-run-all": "^4.1.5", "prettier": "^2.2.1", "rimraf": "^3.0.2", diff --git a/scripts/deno.mjs b/scripts/deno.mjs index 09bbb342..7ea7d347 100644 --- a/scripts/deno.mjs +++ b/scripts/deno.mjs @@ -1,12 +1,5 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions */ -import { - copyFile, // - mkdir, - opendir, - readFile, - rm, - writeFile, -} from 'fs/promises'; +import { copyFile, mkdir, opendir, readFile, rm, writeFile } from 'fs/promises'; const baseDirectory = new URL('../', import.meta.url); const denoPath = new URL('deno/', baseDirectory); @@ -50,7 +43,7 @@ async function adaptFolderToDeno(folderName, node = baseDirectory, deno = denoPa for await (const file of await opendir(nodeDirectory)) { if (file.isDirectory()) { - await adaptFolderToDeno(`${file.name}/`, new URL(folderName, node), new URL(folderName, deno)); + await adaptFolderToDeno(`${file.name}/`, nodeDirectory, denoDirectory); continue; } @@ -65,17 +58,6 @@ async function adaptFolderToDeno(folderName, node = baseDirectory, deno = denoPa } } -async function createModTS() { - const defaultFile = await readFile(new URL('./default/index.ts', baseDirectory), { encoding: 'utf8' }); - - const converted = convertImports(defaultFile).replace('../v', './v'); - - await writeFile(new URL('mod.ts', denoPath), converted); -} - -// Create mod.ts which is the default/index.ts -await createModTS(); - await Promise.all( [ 'common/', // diff --git a/v8/gateway/index.ts b/v8/gateway/index.ts index 4f8de86e..8bae994d 100644 --- a/v8/gateway/index.ts +++ b/v8/gateway/index.ts @@ -4,6 +4,9 @@ import type { Snowflake } from '../../common/index'; import type { + APIApplication, + APIApplicationCommand, + APIApplicationCommandInteraction, APIChannel, APIEmoji, APIGuild, @@ -17,9 +20,6 @@ import type { GatewayVoiceState, InviteTargetUserType, PresenceUpdateStatus, - APIApplicationCommandInteraction, - APIApplication, - APIApplicationCommand, } from '../payloads/index'; export const GatewayVersion = '8'; diff --git a/v8/payloads/auditLog.ts b/v8/payloads/auditLog.ts index 853b9d3d..d82a2169 100644 --- a/v8/payloads/auditLog.ts +++ b/v8/payloads/auditLog.ts @@ -569,7 +569,8 @@ interface AuditLogChangeData { /** * The new value * - * If not present, it can mean the value the key denotes has been set to `null` + * If `new_value` is not present in the change object, while `old_value` is, + * that means the property that was changed has been reset, or set to `null` */ new_value?: D; old_value?: D; diff --git a/v8/payloads/guild.ts b/v8/payloads/guild.ts index 291e56bc..77f5078c 100644 --- a/v8/payloads/guild.ts +++ b/v8/payloads/guild.ts @@ -542,7 +542,7 @@ export interface APIGuildMember { * * See https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting- */ - premium_since: string | null; + premium_since?: string | null; /** * Whether the user is deafened in voice channels */ diff --git a/v8/payloads/interactions.ts b/v8/payloads/interactions.ts index 41d99c20..6d90f7bb 100644 --- a/v8/payloads/interactions.ts +++ b/v8/payloads/interactions.ts @@ -1,6 +1,6 @@ import type { Permissions, Snowflake } from '../../common/index'; -import type { APIGuildMember, APIUser, MessageFlags } from './index'; import type { RESTPostAPIWebhookWithTokenJSONBody } from '../rest/index'; +import type { APIGuildMember, APIUser, MessageFlags } from './index'; /** * https://discord.com/developers/docs/interactions/slash-commands#applicationcommand @@ -46,7 +46,7 @@ export interface APIApplicationCommandSubCommandOptions extends Omit { diff --git a/v8/payloads/template.ts b/v8/payloads/template.ts index c6cbcea2..544ee4b0 100644 --- a/v8/payloads/template.ts +++ b/v8/payloads/template.ts @@ -3,8 +3,8 @@ */ import type { Snowflake } from '../../common/index'; -import type { APIUser } from './user'; import type { RESTPostAPIGuildsJSONBody } from '../rest/index'; +import type { APIUser } from './user'; /** * https://discord.com/developers/docs/resources/template#template-object diff --git a/v8/rest/index.ts b/v8/rest/index.ts index 311a495b..34115e2d 100644 --- a/v8/rest/index.ts +++ b/v8/rest/index.ts @@ -20,7 +20,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/audit-logs` */ guildAuditLog(guildID: Snowflake) { - return `/guilds/${guildID}/audit-logs`; + return `/guilds/${guildID}/audit-logs` as const; }, /** @@ -30,7 +30,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}` */ channel(channelID: Snowflake) { - return `/channels/${channelID}`; + return `/channels/${channelID}` as const; }, /** @@ -39,7 +39,7 @@ export const Routes = { * - POST `/channels/{channel.id}/messages` */ channelMessages(channelID: Snowflake) { - return `/channels/${channelID}/messages`; + return `/channels/${channelID}/messages` as const; }, /** @@ -49,7 +49,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/messages/{message.id}` */ channelMessage(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}`; + return `/channels/${channelID}/messages/${messageID}` as const; }, /** @@ -57,7 +57,7 @@ export const Routes = { * - POST `/channels/{channel.id}/messages/{message.id}/crosspost` */ channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}/crosspost`; + return `/channels/${channelID}/messages/${messageID}/crosspost` as const; }, /** @@ -68,7 +68,7 @@ export const Routes = { * **Note**: You need to URL encode the emoji yourself */ channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) { - return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me`; + return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const; }, /** @@ -78,7 +78,7 @@ export const Routes = { * **Note**: You need to URL encode the emoji yourself */ channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}`; + return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const; }, /** @@ -89,7 +89,7 @@ export const Routes = { * **Note**: You need to URL encode the emoji yourself */ channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) { - return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}`; + return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const; }, /** @@ -97,7 +97,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/messages/{message.id}/reactions` */ channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/messages/${messageID}/reactions`; + return `/channels/${channelID}/messages/${messageID}/reactions` as const; }, /** @@ -105,7 +105,7 @@ export const Routes = { * - POST `/channels/{channel.id}/messages/bulk-delete` */ channelBulkDelete(channelID: Snowflake) { - return `/channels/${channelID}/messages/bulk-delete`; + return `/channels/${channelID}/messages/bulk-delete` as const; }, /** @@ -114,7 +114,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/permissions/{overwrite.id}` */ channelPermission(channelID: Snowflake, overwriteID: Snowflake) { - return `/channels/${channelID}/permissions/${overwriteID}`; + return `/channels/${channelID}/permissions/${overwriteID}` as const; }, /** @@ -123,7 +123,7 @@ export const Routes = { * - POST `/channels/{channel.id}/invites` */ channelInvites(channelID: Snowflake) { - return `/channels/${channelID}/invites`; + return `/channels/${channelID}/invites` as const; }, /** @@ -131,7 +131,7 @@ export const Routes = { * - POST `/channels/{channel.id}/followers` */ channelFollowers(channelID: Snowflake) { - return `/channels/${channelID}/followers`; + return `/channels/${channelID}/followers` as const; }, /** @@ -139,7 +139,7 @@ export const Routes = { * - POST `/channels/{channel.id}/typing` */ channelTyping(channelID: Snowflake) { - return `/channels/${channelID}/typing`; + return `/channels/${channelID}/typing` as const; }, /** @@ -147,7 +147,7 @@ export const Routes = { * - GET `/channels/{channel.id}/pins` */ channelPins(channelID: Snowflake) { - return `/channels/${channelID}/pins`; + return `/channels/${channelID}/pins` as const; }, /** @@ -156,7 +156,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/pins/{message.id}` */ channelPin(channelID: Snowflake, messageID: Snowflake) { - return `/channels/${channelID}/pins/${messageID}`; + return `/channels/${channelID}/pins/${messageID}` as const; }, /** @@ -165,7 +165,7 @@ export const Routes = { * - DELETE `/channels/{channel.id}/recipients/{user.id}` */ channelRecipient(channelID: Snowflake, userID: Snowflake) { - return `/channels/${channelID}/recipients/${userID}`; + return `/channels/${channelID}/recipients/${userID}` as const; }, /** @@ -174,7 +174,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/emojis` */ guildEmojis(guildID: Snowflake) { - return `/guilds/${guildID}/emojis`; + return `/guilds/${guildID}/emojis` as const; }, /** @@ -184,7 +184,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/emojis/{emoji.id}` */ guildEmoji(guildID: Snowflake, emojiID: Snowflake) { - return `/guilds/${guildID}/emojis/${emojiID}`; + return `/guilds/${guildID}/emojis/${emojiID}` as const; }, /** @@ -192,7 +192,7 @@ export const Routes = { * - POST `/guilds` */ guilds() { - return '/guilds'; + return '/guilds' as const; }, /** @@ -202,7 +202,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}` */ guild(guildID: Snowflake) { - return `/guilds/${guildID}`; + return `/guilds/${guildID}` as const; }, /** @@ -210,7 +210,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/preview` */ guildPreview(guildID: Snowflake) { - return `/guilds/${guildID}/preview`; + return `/guilds/${guildID}/preview` as const; }, /** @@ -220,7 +220,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/channels` */ guildChannels(guildID: Snowflake) { - return `/guilds/${guildID}/channels`; + return `/guilds/${guildID}/channels` as const; }, /** @@ -231,7 +231,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/members/{user.id}` */ guildMember(guildID: Snowflake, userID: Snowflake) { - return `/guilds/${guildID}/members/${userID}`; + return `/guilds/${guildID}/members/${userID}` as const; }, /** @@ -239,7 +239,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/members` */ guildMembers(guildID: Snowflake) { - return `/guilds/${guildID}/members`; + return `/guilds/${guildID}/members` as const; }, /** @@ -247,7 +247,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/members/search` */ guildMembersSearch(guildID: Snowflake) { - return `/guilds/${guildID}/members/search`; + return `/guilds/${guildID}/members/search` as const; }, /** @@ -255,7 +255,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/members/@me/nick` */ guildCurrentMemberNickname(guildID: Snowflake) { - return `/guilds/${guildID}/members/@me/nick`; + return `/guilds/${guildID}/members/@me/nick` as const; }, /** @@ -264,7 +264,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}` */ guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) { - return `/guilds/${guildID}/members/${memberID}/roles/${roleID}`; + return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const; }, /** @@ -272,7 +272,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/bans` */ guildBans(guildID: Snowflake) { - return `/guilds/${guildID}/bans`; + return `/guilds/${guildID}/bans` as const; }, /** @@ -282,7 +282,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/bans/{user.id}` */ guildBan(guildID: Snowflake, userID: Snowflake) { - return `/guilds/${guildID}/bans/${userID}`; + return `/guilds/${guildID}/bans/${userID}` as const; }, /** @@ -292,7 +292,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/roles` */ guildRoles(guildID: Snowflake) { - return `/guilds/${guildID}/roles`; + return `/guilds/${guildID}/roles` as const; }, /** @@ -301,7 +301,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/roles/{role.id}` */ guildRole(guildID: Snowflake, roleID: Snowflake) { - return `/guilds/${guildID}/roles/${roleID}`; + return `/guilds/${guildID}/roles/${roleID}` as const; }, /** @@ -310,7 +310,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/prune` */ guildPrune(guildID: Snowflake) { - return `/guilds/${guildID}/prune`; + return `/guilds/${guildID}/prune` as const; }, /** @@ -318,7 +318,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/regions` */ guildVoiceRegions(guildID: Snowflake) { - return `/guilds/${guildID}/regions`; + return `/guilds/${guildID}/regions` as const; }, /** @@ -326,7 +326,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/invites` */ guildInvites(guildID: Snowflake) { - return `/guilds/${guildID}/invites`; + return `/guilds/${guildID}/invites` as const; }, /** @@ -335,7 +335,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/integrations` */ guildIntegrations(guildID: Snowflake) { - return `/guilds/${guildID}/integrations`; + return `/guilds/${guildID}/integrations` as const; }, /** @@ -344,7 +344,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/integrations/{integration.id}` */ guildIntegration(guildID: Snowflake, integrationID: Snowflake) { - return `/guilds/${guildID}/integrations/${integrationID}`; + return `/guilds/${guildID}/integrations/${integrationID}` as const; }, /** @@ -352,7 +352,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/integrations/{integration.id}/sync` */ guildIntegrationSync(guildID: Snowflake, integrationID: Snowflake) { - return `/guilds/${guildID}/integrations/${integrationID}/sync`; + return `/guilds/${guildID}/integrations/${integrationID}/sync` as const; }, /** @@ -361,7 +361,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/widget` */ guildWidgetSettings(guildID: Snowflake) { - return `/guilds/${guildID}/widget`; + return `/guilds/${guildID}/widget` as const; }, /** @@ -369,7 +369,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/widget.json` */ guildWidgetJSON(guildID: Snowflake) { - return `/guilds/${guildID}/widget.json`; + return `/guilds/${guildID}/widget.json` as const; }, /** @@ -377,7 +377,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/vanity-url` */ guildVanityUrl(guildID: Snowflake) { - return `/guilds/${guildID}/vanity-url`; + return `/guilds/${guildID}/vanity-url` as const; }, /** @@ -385,7 +385,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/widget.png` */ guildWidgetImage(guildID: Snowflake) { - return `/guilds/${guildID}/widget.png`; + return `/guilds/${guildID}/widget.png` as const; }, /** @@ -394,7 +394,7 @@ export const Routes = { * - DELETE `/invites/{invite.code}` */ invite(code: string) { - return `/invites/${code}`; + return `/invites/${code}` as const; }, /** @@ -403,7 +403,7 @@ export const Routes = { * - POST `/guilds/templates/{template.code}` */ template(code: string) { - return `/guilds/templates/${code}`; + return `/guilds/templates/${code}` as const; }, /** @@ -412,7 +412,7 @@ export const Routes = { * - POST `/guilds/{guild.id}/templates` */ guildTemplates(guildID: Snowflake) { - return `/guilds/${guildID}/templates`; + return `/guilds/${guildID}/templates` as const; }, /** @@ -422,7 +422,7 @@ export const Routes = { * - DELETE `/guilds/{guild.id}/templates/{template.code}` */ guildTemplate(guildID: Snowflake, code: string) { - return `/guilds/${guildID}/templates/${code}`; + return `/guilds/${guildID}/templates/${code}` as const; }, /** @@ -434,7 +434,7 @@ export const Routes = { * @param [userID='@me'] The user ID, defaulted to `@me` */ user(userID = '@me') { - return `/users/${userID}`; + return `/users/${userID}` as const; }, /** @@ -442,7 +442,7 @@ export const Routes = { * - GET `/users/@me/guilds` */ userGuilds() { - return `/users/@me/guilds`; + return `/users/@me/guilds` as const; }, /** @@ -450,7 +450,7 @@ export const Routes = { * - DELETE `/users/@me/guilds/{guild.id}` */ userGuild(guildID: Snowflake) { - return `/users/@me/guilds/${guildID}`; + return `/users/@me/guilds/${guildID}` as const; }, /** @@ -458,7 +458,7 @@ export const Routes = { * - POST `/users/@me/channels` */ userChannels() { - return `/users/@me/channels`; + return `/users/@me/channels` as const; }, /** @@ -466,7 +466,7 @@ export const Routes = { * - GET `/users/@me/connections` */ userConnections() { - return `/users/@me/connections`; + return `/users/@me/connections` as const; }, /** @@ -474,7 +474,7 @@ export const Routes = { * - GET `/voice/regions` */ voiceRegions() { - return `/voice/regions`; + return `/voice/regions` as const; }, /** @@ -483,7 +483,7 @@ export const Routes = { * - POST `/channels/{channel.id}/webhooks` */ channelWebhooks(channelID: Snowflake) { - return `/channels/${channelID}/webhooks`; + return `/channels/${channelID}/webhooks` as const; }, /** @@ -491,7 +491,7 @@ export const Routes = { * - GET `/guilds/{guild.id}/webhooks` */ guildWebhooks(guildID: Snowflake) { - return `/guilds/${guildID}/webhooks`; + return `/guilds/${guildID}/webhooks` as const; }, /** @@ -511,7 +511,7 @@ export const Routes = { if (webhookToken) parts.push(webhookToken); - return parts.join('/'); + return parts.join('/') as `/webhooks/${Snowflake}` | `/webhooks/${Snowflake}/${string}`; }, /** @@ -528,7 +528,7 @@ export const Routes = { * @param [messageID='@original'] The message ID to change, defaulted to `@original` */ webhookMessage(webhookID: Snowflake, webhookToken: string, messageID = '@original') { - return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}`; + return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const; }, /** @@ -537,7 +537,7 @@ export const Routes = { * - POST `/webhooks/{webhook.id}/{webhook.token}/slack` */ webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') { - return `/webhooks/${webhookID}/${webhookToken}/${platform}`; + return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const; }, /** @@ -545,7 +545,7 @@ export const Routes = { * - GET `/gateway` */ gateway() { - return `/gateway`; + return `/gateway` as const; }, /** @@ -553,7 +553,7 @@ export const Routes = { * - GET `/gateway/bot` */ gatewayBot() { - return `/gateway/bot`; + return `/gateway/bot` as const; }, /** @@ -561,7 +561,7 @@ export const Routes = { * - GET `/oauth2/applications/@me` */ oauth2CurrentApplication() { - return `/oauth2/applications/@me`; + return `/oauth2/applications/@me` as const; }, /** @@ -569,7 +569,7 @@ export const Routes = { * - GET `/oauth2/@me` */ oauth2CurrentAuthorization() { - return `/oauth2/@me`; + return `/oauth2/@me` as const; }, /** @@ -578,7 +578,7 @@ export const Routes = { * - POST `/applications/{application.id}/commands` */ applicationCommands(applicationID: Snowflake) { - return `/applications/${applicationID}/commands`; + return `/applications/${applicationID}/commands` as const; }, /** @@ -588,7 +588,7 @@ export const Routes = { * - DELETE `/applications/{application.id}/commands/{command.id}` */ applicationCommand(applicationID: Snowflake, commandID: Snowflake) { - return `/applications/${applicationID}/commands/${commandID}`; + return `/applications/${applicationID}/commands/${commandID}` as const; }, /** @@ -597,7 +597,7 @@ export const Routes = { * - POST `/applications/{application.id}/guilds/{guild.id}/commands` */ applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) { - return `/applications/${applicationID}/guilds/${guildID}/commands`; + return `/applications/${applicationID}/guilds/${guildID}/commands` as const; }, /** @@ -607,7 +607,7 @@ export const Routes = { * - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}` */ applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) { - return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`; + return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const; }, /** @@ -615,7 +615,7 @@ export const Routes = { * - POST `/interactions/{interaction.id}/{interaction.token}/callback` */ interactionCallback(interactionID: Snowflake, interactionToken: string) { - return `/interactions/${interactionID}/${interactionToken}/callback`; + return `/interactions/${interactionID}/${interactionToken}/callback` as const; }, /** @@ -624,7 +624,7 @@ export const Routes = { * - PATCH `/guilds/{guild.id}/member-verification` */ guildMemberVerification(guildID: Snowflake) { - return `/guilds/${guildID}/member-verification`; + return `/guilds/${guildID}/member-verification` as const; }, }; @@ -652,7 +652,7 @@ export const OAuth2Routes = { } as const; /** - * Freeze route object + * Freeze OAuth2 route object * @internal */ Object.freeze(OAuth2Routes);