mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
chore: Code changes & formatting and linting (#3552)
* Do some code changes & run prettier and eslint
* Fix test:test-type script
* Apply code review suggestions
* update heartbeat interval & add a reason for the specific value
* Fix husky error
* Update to TS 5.5
And use ${configDir}
* Fix test.json tsconfig base
---------
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
|
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
// "postCreateCommand": "yarn install",
|
"postCreateCommand": "yarn install",
|
||||||
|
|
||||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
"remoteUser": "node"
|
"remoteUser": "node"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
// This tells ESLint to load the config from the package `eslint-config-custom`
|
// This tells ESLint to load the config from the package `eslint-config-discordeno`
|
||||||
"extends": ["discordeno"]
|
"extends": ["discordeno"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Benchmark
|
- name: Benchmark
|
||||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||||
run: node --expose-gc ./packages/benchmark/dist/index.js | tee output.txt
|
run: node --expose-gc ./packages/benchmarks/dist/index.js | tee output.txt
|
||||||
|
|
||||||
- name: Download previous benchmark data
|
- name: Download previous benchmark data
|
||||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||||
@@ -69,7 +69,7 @@ jobs:
|
|||||||
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
if: ${{ steps.cpuCheck.outputs.match == 'true' }}
|
||||||
uses: benchmark-action/github-action-benchmark@v1
|
uses: benchmark-action/github-action-benchmark@v1
|
||||||
with:
|
with:
|
||||||
tool: "benchmarkjs"
|
tool: 'benchmarkjs'
|
||||||
output-file-path: output.txt
|
output-file-path: output.txt
|
||||||
external-data-json-path: benchmarksResult/data.json
|
external-data-json-path: benchmarksResult/data.json
|
||||||
|
|
||||||
@@ -96,9 +96,9 @@ jobs:
|
|||||||
uses: benchmark-action/github-action-benchmark@v1
|
uses: benchmark-action/github-action-benchmark@v1
|
||||||
if: ${{ github.ref == 'refs/heads/main' && steps.cpuCheck.outputs.match == 'true' }}
|
if: ${{ github.ref == 'refs/heads/main' && steps.cpuCheck.outputs.match == 'true' }}
|
||||||
with:
|
with:
|
||||||
tool: "benchmarkjs"
|
tool: 'benchmarkjs'
|
||||||
output-file-path: output.txt
|
output-file-path: output.txt
|
||||||
gh-pages-branch: "benchies"
|
gh-pages-branch: 'benchies'
|
||||||
benchmark-data-dir-path: benchmarksResult
|
benchmark-data-dir-path: benchmarksResult
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
auto-push: true
|
auto-push: true
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ jobs:
|
|||||||
echo "$MESSAGE" >> $GITHUB_ENV
|
echo "$MESSAGE" >> $GITHUB_ENV
|
||||||
echo "EOF" >> $GITHUB_ENV
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: "Comment on PR"
|
- name: 'Comment on PR'
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
node-version: 18
|
node-version: 18
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: "1.0.6"
|
bun-version: '1.0.6'
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
+12
-13
@@ -7,25 +7,24 @@ name: Mark stale issues and pull requests
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * 1'
|
- cron: '0 0 * * 1'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v9
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: 'This issue has gone stale for over a month. If this issue is useful, leave a comment below. Otherwise, it will be closed shortly.'
|
stale-issue-message: 'This issue has gone stale for over a month. If this issue is useful, leave a comment below. Otherwise, it will be closed shortly.'
|
||||||
stale-pr-message: 'This pull request has gone stale for over a month. If this pull request is still useful, leave a comment below. Otherwise, it will be closed shortly.'
|
stale-pr-message: 'This pull request has gone stale for over a month. If this pull request is still useful, leave a comment below. Otherwise, it will be closed shortly.'
|
||||||
stale-issue-label: 'no-issue-activity'
|
stale-issue-label: 'no-issue-activity'
|
||||||
stale-pr-label: 'no-pr-activity'
|
stale-pr-label: 'no-pr-activity'
|
||||||
only-labels: 'w-unverified'
|
only-labels: 'w-unverified'
|
||||||
exempt-issue-labels: 'api-docs-commits,help-wanted,w-verified,w-pending'
|
exempt-issue-labels: 'api-docs-commits,help-wanted,w-verified,w-pending'
|
||||||
exempt-pr-labels: 'w-verified'
|
exempt-pr-labels: 'w-verified'
|
||||||
close-issue-reason: 'not_planned'
|
close-issue-reason: 'not_planned'
|
||||||
|
|||||||
@@ -6,3 +6,6 @@
|
|||||||
!README.md
|
!README.md
|
||||||
!dist/**
|
!dist/**
|
||||||
!bin/**
|
!bin/**
|
||||||
|
|
||||||
|
# ignore the tsbuildinfo file
|
||||||
|
dist/.tsbuildinfo
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,6 @@ nodeLinker: node-modules
|
|||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
|
||||||
spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.5.0/bundles/@yarnpkg/plugin-after-install.js"
|
spec: 'https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.5.0/bundles/@yarnpkg/plugin-after-install.js'
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
||||||
|
|||||||
@@ -152,6 +152,9 @@ yarn test:unit-coverage
|
|||||||
# unit test with Deno
|
# unit test with Deno
|
||||||
yarn test:deno-unit
|
yarn test:deno-unit
|
||||||
|
|
||||||
|
# unit test with Bun
|
||||||
|
yarn test:bun-unit
|
||||||
|
|
||||||
# integration test
|
# integration test
|
||||||
yarn test:integration
|
yarn test:integration
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,4 +18,4 @@
|
|||||||
"@discordeno/gateway": "./packages/gateway/dist/esm/index.js",
|
"@discordeno/gateway": "./packages/gateway/dist/esm/index.js",
|
||||||
"@discordeno/bot": "./packages/bot/dist/esm/index.js"
|
"@discordeno/bot": "./packages/bot/dist/esm/index.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const GATEWAY_INTENTS = Intents.Guilds | Intents.GuildMessages
|
|||||||
// Helper functions
|
// Helper functions
|
||||||
|
|
||||||
function assertEnv(env: string): string {
|
function assertEnv(env: string): string {
|
||||||
if (process.env[env]) return process.env[env]!
|
if (process.env[env]) return process.env[env]
|
||||||
|
|
||||||
throw new TypeError(`The '${env}' environment variable must be set`)
|
throw new TypeError(`The '${env}' environment variable must be set`)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -15,9 +15,9 @@
|
|||||||
"fmt": "turbo run fmt --no-daemon",
|
"fmt": "turbo run fmt --no-daemon",
|
||||||
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
||||||
"lint": "turbo run lint --no-daemon",
|
"lint": "turbo run lint --no-daemon",
|
||||||
"prepare": "husky install",
|
"prepare": "husky",
|
||||||
"release-build": "turbo run release-build --no-daemon",
|
"release-build": "turbo run release-build --no-daemon",
|
||||||
"setup-dd": "husky install",
|
"setup-dd": "husky",
|
||||||
"test:bun-unit": "turbo run test:bun-unit --no-daemon",
|
"test:bun-unit": "turbo run test:bun-unit --no-daemon",
|
||||||
"test:deno-unit": "turbo run test:deno-unit --no-daemon",
|
"test:deno-unit": "turbo run test:deno-unit --no-daemon",
|
||||||
"test:e2e": "turbo run test:e2e --no-daemon",
|
"test:e2e": "turbo run test:e2e --no-daemon",
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
"lint-staged": "^15.2.7",
|
"lint-staged": "^15.2.7",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"turbo": "^1.11.3",
|
"turbo": "^1.11.3",
|
||||||
"typedoc": "0.25.11",
|
"typedoc": "^0.25.13",
|
||||||
"typedoc-plugin-markdown": "3.17.1",
|
"typedoc-plugin-markdown": "3.17.1",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "benchmark",
|
"name": "benchmarks",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"main": "./dist/esm/index.js",
|
"main": "./dist/index.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
"import": "./dist/esm/index.js",
|
"import": "./dist/index.js",
|
||||||
"require": "./dist/cjs/index.cjs",
|
|
||||||
"types": "./dist/types/index.d.ts"
|
"types": "./dist/types/index.d.ts"
|
||||||
},
|
},
|
||||||
"types": "./dist/types/index.d.ts",
|
"types": "./dist/types/index.d.ts",
|
||||||
@@ -29,19 +28,17 @@
|
|||||||
"@discordeno/rest": "19.0.0-alpha.1",
|
"@discordeno/rest": "19.0.0-alpha.1",
|
||||||
"@discordeno/types": "19.0.0-beta.1",
|
"@discordeno/types": "19.0.0-beta.1",
|
||||||
"@discordeno/utils": "19.0.0-beta.1",
|
"@discordeno/utils": "19.0.0-beta.1",
|
||||||
"benchmark": "^2.1.4",
|
"benchmark": "^2.1.4"
|
||||||
"microtime": "^3.1.1",
|
|
||||||
"node-fetch": "^3.3.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@swc/cli": "^0.3.9",
|
"@swc/cli": "^0.3.9",
|
||||||
"@swc/core": "^1.4.2",
|
"@swc/core": "^1.4.2",
|
||||||
"@types/benchmark": "^2.1.5",
|
"@types/benchmark": "^2.1.5",
|
||||||
"@types/node": "^20.11.25",
|
"@types/node": "^20.14.7",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-discordeno": "*",
|
"eslint-config-discordeno": "*",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -9,7 +9,7 @@ events.forEach((event) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
suite.add(`Camelize 1 event`, () => {
|
suite.add(`Camelize 1 event`, () => {
|
||||||
snakelize(events[1])
|
camelize(events[1])
|
||||||
})
|
})
|
||||||
|
|
||||||
suite.add(`Snakelize 1 event`, () => {
|
suite.add(`Snakelize 1 event`, () => {
|
||||||
+3
-7
@@ -1,4 +1,4 @@
|
|||||||
import { createBot, type Bot } from '@discordeno/bot'
|
import { createBot, snakeToCamelCase, type Bot } from '@discordeno/bot'
|
||||||
import { events as dbEvents } from '../utils/db.js'
|
import { events as dbEvents } from '../utils/db.js'
|
||||||
import { memoryBenchmark } from '../utils/memoryBenchmark.js'
|
import { memoryBenchmark } from '../utils/memoryBenchmark.js'
|
||||||
|
|
||||||
@@ -27,12 +27,8 @@ await memoryBenchmark(
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
(bot, event) => {
|
(bot, event) => {
|
||||||
// @ts-expect-error it works
|
const eventName = snakeToCamelCase(event.payload.t!)
|
||||||
bot.events[
|
bot.events[eventName as keyof typeof bot.events]?.(event.payload.d as never, {})
|
||||||
event.payload.t!.toLowerCase().replace(/_([a-z])/g, (g) => {
|
|
||||||
return g[1].toUpperCase()
|
|
||||||
})
|
|
||||||
]?.(event.payload.d, {})
|
|
||||||
},
|
},
|
||||||
dbEvents.filter((event) => event.payload.t),
|
dbEvents.filter((event) => event.payload.t),
|
||||||
)
|
)
|
||||||
+2
-2
@@ -95,11 +95,11 @@ await memoryBenchmark(
|
|||||||
'[transformer] message cache check',
|
'[transformer] message cache check',
|
||||||
() => ({
|
() => ({
|
||||||
cache: [] as any[],
|
cache: [] as any[],
|
||||||
}), // function reutrn a new instance of object wanted to test with
|
}), // function returns a new instance of object wanted to test with
|
||||||
(object, event: DiscordMessage) => object.cache.push(bot.transformers.message(bot, event)),
|
(object, event: DiscordMessage) => object.cache.push(bot.transformers.message(bot, event)),
|
||||||
// function specify how to add event to the object/ run the object
|
// function specify how to add event to the object/ run the object
|
||||||
[...new Array(MESSAGE_SIZE)].map(
|
[...new Array(MESSAGE_SIZE)].map(
|
||||||
(i) =>
|
() =>
|
||||||
({
|
({
|
||||||
activity: {
|
activity: {
|
||||||
party_id: 'party_id',
|
party_id: 'party_id',
|
||||||
@@ -4,8 +4,6 @@ const benchmarkData = await fetch(`https://raw.githubusercontent.com/discordeno/
|
|||||||
.then(async (res) => await res.text())
|
.then(async (res) => await res.text())
|
||||||
.then((text) => JSON.parse(text.slice(24)))
|
.then((text) => JSON.parse(text.slice(24)))
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
||||||
// const commitSha = await fs.readFile('./sha', 'utf-8')
|
|
||||||
const results = JSON.parse(await fs.readFile('./data.json', 'utf-8'))
|
const results = JSON.parse(await fs.readFile('./data.json', 'utf-8'))
|
||||||
|
|
||||||
interface BenchmarksData {
|
interface BenchmarksData {
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
import type { DiscordGatewayPayload } from '@discordeno/types'
|
import type { DiscordGatewayPayload } from '@discordeno/types'
|
||||||
import fetch from 'node-fetch'
|
|
||||||
import fs from 'node:fs/promises'
|
import fs from 'node:fs/promises'
|
||||||
|
|
||||||
export const events: Array<{
|
export const events: Array<{
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/base.json"
|
||||||
|
}
|
||||||
+1
-1
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"test:e2e": "c8 --r lcov mocha --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
"test:e2e": "c8 --r lcov mocha --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tsconfig.test.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordeno/gateway": "19.0.0-alpha.1",
|
"@discordeno/gateway": "19.0.0-alpha.1",
|
||||||
@@ -49,6 +49,6 @@
|
|||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Intents } from '@discordeno/types'
|
import { Intents } from '@discordeno/types'
|
||||||
import { delay, logger } from '@discordeno/utils'
|
import { delay, logger, snakeToCamelCase } from '@discordeno/utils'
|
||||||
import { use as chaiUse } from 'chai'
|
import { use as chaiUse } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
@@ -23,12 +23,9 @@ describe('[Bot] Delete any guild owned guilds', () => {
|
|||||||
|
|
||||||
// RUN DISPATCH CHECK
|
// RUN DISPATCH CHECK
|
||||||
await bot.events.dispatchRequirements?.(data, shard.id)
|
await bot.events.dispatchRequirements?.(data, shard.id)
|
||||||
bot.events[
|
|
||||||
data.t.toLowerCase().replace(/_([a-z])/g, function (g) {
|
const eventName = snakeToCamelCase(data.t)
|
||||||
return g[1].toUpperCase()
|
bot.events[eventName as keyof EventHandlers]?.(data.d as never, shard as never)
|
||||||
}) as keyof EventHandlers
|
|
||||||
// @ts-expect-error as any gets removed by linter
|
|
||||||
]?.(data.d, shard)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
intents: Intents.Guilds,
|
intents: Intents.Guilds,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/test.json"
|
||||||
|
}
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json"
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/test.json",
|
|
||||||
"include": ["tests"],
|
|
||||||
"exclude": ["node_modules", "dist", "src"]
|
|
||||||
}
|
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
|
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tsconfig.test.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordeno/bot": "19.0.0-beta.1",
|
"@discordeno/bot": "19.0.0-beta.1",
|
||||||
@@ -51,6 +51,6 @@
|
|||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/test.json"
|
||||||
|
}
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json"
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/test.json",
|
|
||||||
"include": ["tests"],
|
|
||||||
"exclude": ["node_modules", "dist", "src"]
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-require-extensions": "^0.1.3",
|
"eslint-plugin-require-extensions": "^0.1.3",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
||||||
"test:integration": "c8 --r lcov mocha --no-warnings 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
"test:integration": "c8 --r lcov mocha --no-warnings 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tsconfig.test.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordeno/types": "19.0.0-beta.1",
|
"@discordeno/types": "19.0.0-beta.1",
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5",
|
"typescript": "^5.5.2",
|
||||||
"uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js.git#commit=42c9c0d5d31f46ca4115dc75672b0037ec970f28"
|
"uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js.git#commit=42c9c0d5d31f46ca4115dc75672b0037ec970f28"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
import { Intents } from '@discordeno/types'
|
import { Intents } from '@discordeno/types'
|
||||||
import uWS from 'uWebSockets.js'
|
import uWS from 'uWebSockets.js'
|
||||||
import { createGatewayManager, ShardSocketCloseCodes } from '../../src/index.js'
|
import { ShardSocketCloseCodes, createGatewayManager, type GatewayManager } from '../../src/index.js'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
/**
|
||||||
const createGatewayManagerWithPort = (port: number) =>
|
* This value needs to be AT LEAST `1017`
|
||||||
createGatewayManager({
|
*
|
||||||
|
* The reason for this is because the calculation in Shard.calculateSafeRequests will return 0 not allowing any sort of message to the websocket server.
|
||||||
|
* Discord uses a way higher number for this value, but during this test we lower it since it would be annoying and useless make the test last 40+ seconds to test the heartbeat, but to make this work it needs to be at least 1017 so that calculateSafeRequests return 2 allowing for the shard to send messages.
|
||||||
|
*/
|
||||||
|
const heartbeatInterval = 1050
|
||||||
|
|
||||||
|
function createGatewayManagerWithPort(port: number): GatewayManager {
|
||||||
|
return createGatewayManager({
|
||||||
connection: {
|
connection: {
|
||||||
url: `ws://localhost:${port}`,
|
url: `ws://localhost:${port}`,
|
||||||
shards: 1,
|
shards: 1,
|
||||||
@@ -20,22 +27,22 @@ const createGatewayManagerWithPort = (port: number) =>
|
|||||||
intents: Intents.Guilds,
|
intents: Intents.Guilds,
|
||||||
events: {},
|
events: {},
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
async function createUws(options: {
|
||||||
const createUws = async (options: {
|
|
||||||
onOpen?: () => any
|
onOpen?: () => any
|
||||||
onMessage?: (message: any) => any
|
onMessage?: (message: any) => any
|
||||||
onClose?: (code: number, message: string) => any
|
onClose?: (code: number, message: string) => any
|
||||||
closing?: boolean
|
closing?: boolean
|
||||||
}) => {
|
}): Promise<{ port: number; uwsToken: uWS.us_listen_socket }> {
|
||||||
options.onOpen ??= () => {}
|
options.onOpen ??= () => {}
|
||||||
options.onMessage ??= (message: any) => {}
|
options.onMessage ??= (message: any) => {}
|
||||||
options.onClose ??= (code: number, message: string) => {}
|
options.onClose ??= (code: number, message: string) => {}
|
||||||
options.closing ??= false
|
options.closing ??= false
|
||||||
|
|
||||||
return await new Promise<{ port: number; uwsToken: any }>((resolve, reject) => {
|
return await new Promise<{ port: number; uwsToken: uWS.us_listen_socket }>((resolve, reject) => {
|
||||||
let port = 0
|
let port = 0
|
||||||
let uwsToken = 0
|
|
||||||
uWS
|
uWS
|
||||||
.App()
|
.App()
|
||||||
.ws('/*', {
|
.ws('/*', {
|
||||||
@@ -51,7 +58,7 @@ const createUws = async (options: {
|
|||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
op: 10,
|
op: 10,
|
||||||
d: {
|
d: {
|
||||||
heartbeat_interval: 1017,
|
heartbeat_interval: heartbeatInterval,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -118,10 +125,13 @@ const createUws = async (options: {
|
|||||||
if (!token) {
|
if (!token) {
|
||||||
reject(new Error())
|
reject(new Error())
|
||||||
}
|
}
|
||||||
// retrieve listening port
|
|
||||||
uwsToken = token
|
port = uWS.us_socket_local_port(token as uWS.us_listen_socket)
|
||||||
port = uWS.us_socket_local_port(token)
|
|
||||||
resolve({ port, uwsToken })
|
resolve({
|
||||||
|
port,
|
||||||
|
uwsToken: token,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -146,7 +156,7 @@ describe('gateway', () => {
|
|||||||
let resolveHeartbeat: () => void
|
let resolveHeartbeat: () => void
|
||||||
let resolveConnected: () => void
|
let resolveConnected: () => void
|
||||||
const connected = new Promise<void>((resolve) => (resolveConnected = resolve))
|
const connected = new Promise<void>((resolve) => (resolveConnected = resolve))
|
||||||
const Heartbeated = new Promise<void>((resolve) => (resolveHeartbeat = resolve))
|
const heartbeated = new Promise<void>((resolve) => (resolveHeartbeat = resolve))
|
||||||
const uwsOptions = {
|
const uwsOptions = {
|
||||||
onOpen: resolveConnected!,
|
onOpen: resolveConnected!,
|
||||||
onMessage: (message: any) => {
|
onMessage: (message: any) => {
|
||||||
@@ -159,10 +169,12 @@ describe('gateway', () => {
|
|||||||
const gateway = createGatewayManagerWithPort(port)
|
const gateway = createGatewayManagerWithPort(port)
|
||||||
await gateway.spawnShards()
|
await gateway.spawnShards()
|
||||||
await connected
|
await connected
|
||||||
|
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
throw new Error('Not heartbeat in time')
|
throw new Error('Not heartbeat in time')
|
||||||
}, 1017)
|
}, heartbeatInterval)
|
||||||
await Heartbeated
|
|
||||||
|
await heartbeated
|
||||||
clearTimeout(timeout)
|
clearTimeout(timeout)
|
||||||
uwsOptions.closing = true
|
uwsOptions.closing = true
|
||||||
await gateway.shutdown(ShardSocketCloseCodes.Shutdown, 'User requested bot stop')
|
await gateway.shutdown(ShardSocketCloseCodes.Shutdown, 'User requested bot stop')
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/test.json"
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json"
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/test.json",
|
|
||||||
"include": ["tests"],
|
|
||||||
"exclude": ["node_modules", "dist", "src"]
|
|
||||||
}
|
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,11 @@
|
|||||||
"test:e2e": "c8 --r lcov mocha --exit --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
"test:e2e": "c8 --r lcov mocha --exit --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tsconfig.test.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordeno/types": "19.0.0-beta.1",
|
"@discordeno/types": "19.0.0-beta.1",
|
||||||
"@discordeno/utils": "19.0.0-beta.1",
|
"@discordeno/utils": "19.0.0-beta.1"
|
||||||
"dotenv": "^16.4.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@swc/cli": "^0.3.9",
|
"@swc/cli": "^0.3.9",
|
||||||
@@ -45,13 +44,13 @@
|
|||||||
"c8": "^9.1.0",
|
"c8": "^9.1.0",
|
||||||
"chai": "^5.1.1",
|
"chai": "^5.1.1",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-discordeno": "*",
|
"eslint-config-discordeno": "*",
|
||||||
"mocha": "^10.5.1",
|
"mocha": "^10.5.1",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5",
|
"typescript": "^5.5.2"
|
||||||
"why-is-node-running": "^2.2.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
import type { Camelize, DiscordChannel } from '@discordeno/types'
|
import type { Camelize, DiscordChannel } from '@discordeno/types'
|
||||||
import { AutoModerationActionType, AutoModerationEventTypes, AutoModerationTriggerTypes } from '@discordeno/types'
|
import { AutoModerationActionType, AutoModerationEventTypes, AutoModerationTriggerTypes } from '@discordeno/types'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Run automod tests', async () => {
|
describe('Run automod tests', async () => {
|
||||||
it('Create a MessageSend rule for Keyword with BlockMessage action.', async () => {
|
it('Create a MessageSend rule for Keyword with BlockMessage action.', async () => {
|
||||||
const rule = await rest.createAutomodRule(e2ecache.guild.id, {
|
const rule = await rest.createAutomodRule(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
eventType: AutoModerationEventTypes.MessageSend,
|
eventType: AutoModerationEventTypes.MessageSend,
|
||||||
triggerType: AutoModerationTriggerTypes.Keyword,
|
triggerType: AutoModerationTriggerTypes.Keyword,
|
||||||
@@ -36,7 +36,7 @@ describe('Run automod tests', async () => {
|
|||||||
|
|
||||||
expect(rule.id).to.be.exist
|
expect(rule.id).to.be.exist
|
||||||
|
|
||||||
const fetchedRule = await rest.getAutomodRule(e2ecache.guild.id, rule.id)
|
const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
|
|
||||||
expect(fetchedRule.id).to.be.exist
|
expect(fetchedRule.id).to.be.exist
|
||||||
expect(fetchedRule.name).to.equal(rule.name)
|
expect(fetchedRule.name).to.equal(rule.name)
|
||||||
@@ -47,11 +47,11 @@ describe('Run automod tests', async () => {
|
|||||||
expect(fetchedRule.actions[0]).to.be.exist
|
expect(fetchedRule.actions[0]).to.be.exist
|
||||||
expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.BlockMessage)
|
expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.BlockMessage)
|
||||||
|
|
||||||
await rest.deleteAutomodRule(e2ecache.guild.id, rule.id)
|
await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Create a MessageSend rule for Keyword with Timeout action.', async () => {
|
it('Create a MessageSend rule for Keyword with Timeout action.', async () => {
|
||||||
const rule = await rest.createAutomodRule(e2ecache.guild.id, {
|
const rule = await rest.createAutomodRule(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
eventType: AutoModerationEventTypes.MessageSend,
|
eventType: AutoModerationEventTypes.MessageSend,
|
||||||
triggerType: AutoModerationTriggerTypes.Keyword,
|
triggerType: AutoModerationTriggerTypes.Keyword,
|
||||||
@@ -70,7 +70,7 @@ describe('Run automod tests', async () => {
|
|||||||
|
|
||||||
expect(rule.id).to.be.exist
|
expect(rule.id).to.be.exist
|
||||||
|
|
||||||
const fetchedRule = await rest.getAutomodRule(e2ecache.guild.id, rule.id)
|
const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
|
|
||||||
expect(fetchedRule.id).to.be.exist
|
expect(fetchedRule.id).to.be.exist
|
||||||
expect(fetchedRule.name).to.equal(rule.name)
|
expect(fetchedRule.name).to.equal(rule.name)
|
||||||
@@ -82,11 +82,11 @@ describe('Run automod tests', async () => {
|
|||||||
expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.Timeout)
|
expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.Timeout)
|
||||||
expect(fetchedRule.actions[0].metadata?.durationSeconds).to.equal(10)
|
expect(fetchedRule.actions[0].metadata?.durationSeconds).to.equal(10)
|
||||||
|
|
||||||
await rest.deleteAutomodRule(e2ecache.guild.id, rule.id)
|
await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Create a MessageSend rule for Keyword with BlockMessage & Timeout action.', async () => {
|
it('Create a MessageSend rule for Keyword with BlockMessage & Timeout action.', async () => {
|
||||||
const rule = await rest.createAutomodRule(e2ecache.guild.id, {
|
const rule = await rest.createAutomodRule(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
eventType: AutoModerationEventTypes.MessageSend,
|
eventType: AutoModerationEventTypes.MessageSend,
|
||||||
triggerType: AutoModerationTriggerTypes.Keyword,
|
triggerType: AutoModerationTriggerTypes.Keyword,
|
||||||
@@ -108,14 +108,14 @@ describe('Run automod tests', async () => {
|
|||||||
|
|
||||||
expect(rule.id).to.be.exist
|
expect(rule.id).to.be.exist
|
||||||
|
|
||||||
await rest.deleteAutomodRule(e2ecache.guild.id, rule.id)
|
await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('with a channel', () => {
|
describe('with a channel', () => {
|
||||||
let channel: Camelize<DiscordChannel>
|
let channel: Camelize<DiscordChannel>
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
channel = await rest.createChannel(e2ecache.guild.id, {
|
channel = await rest.createChannel(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -125,7 +125,7 @@ describe('Run automod tests', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Create a MessageSend rule for Keyword with SendAlertMessage action.', async () => {
|
it('Create a MessageSend rule for Keyword with SendAlertMessage action.', async () => {
|
||||||
const rule = await rest.createAutomodRule(e2ecache.guild.id, {
|
const rule = await rest.createAutomodRule(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
eventType: AutoModerationEventTypes.MessageSend,
|
eventType: AutoModerationEventTypes.MessageSend,
|
||||||
triggerType: AutoModerationTriggerTypes.Keyword,
|
triggerType: AutoModerationTriggerTypes.Keyword,
|
||||||
@@ -144,7 +144,7 @@ describe('Run automod tests', async () => {
|
|||||||
|
|
||||||
expect(rule.id).to.be.exist
|
expect(rule.id).to.be.exist
|
||||||
|
|
||||||
const fetchedRule = await rest.getAutomodRule(e2ecache.guild.id, rule.id)
|
const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
|
|
||||||
expect(fetchedRule.id).to.be.exist
|
expect(fetchedRule.id).to.be.exist
|
||||||
expect(fetchedRule.name).to.equal(rule.name)
|
expect(fetchedRule.name).to.equal(rule.name)
|
||||||
@@ -156,11 +156,11 @@ describe('Run automod tests', async () => {
|
|||||||
expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.SendAlertMessage)
|
expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.SendAlertMessage)
|
||||||
expect(fetchedRule.actions[0].metadata?.channelId).to.equal(channel.id)
|
expect(fetchedRule.actions[0].metadata?.channelId).to.equal(channel.id)
|
||||||
|
|
||||||
await rest.deleteAutomodRule(e2ecache.guild.id, rule.id)
|
await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Create a MessageSend rule for Keyword with SendAlertMessage & Timeout action.', async () => {
|
it('Create a MessageSend rule for Keyword with SendAlertMessage & Timeout action.', async () => {
|
||||||
const rule = await rest.createAutomodRule(e2ecache.guild.id, {
|
const rule = await rest.createAutomodRule(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
eventType: AutoModerationEventTypes.MessageSend,
|
eventType: AutoModerationEventTypes.MessageSend,
|
||||||
triggerType: AutoModerationTriggerTypes.Keyword,
|
triggerType: AutoModerationTriggerTypes.Keyword,
|
||||||
@@ -185,11 +185,11 @@ describe('Run automod tests', async () => {
|
|||||||
|
|
||||||
expect(rule.id).to.be.exist
|
expect(rule.id).to.be.exist
|
||||||
|
|
||||||
await rest.deleteAutomodRule(e2ecache.guild.id, rule.id)
|
await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Create a MessageSend rule for Keyword with BlockMessage & SendAlertMessage & Timeout action.', async () => {
|
it('Create a MessageSend rule for Keyword with BlockMessage & SendAlertMessage & Timeout action.', async () => {
|
||||||
const rule = await rest.createAutomodRule(e2ecache.guild.id, {
|
const rule = await rest.createAutomodRule(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
eventType: AutoModerationEventTypes.MessageSend,
|
eventType: AutoModerationEventTypes.MessageSend,
|
||||||
triggerType: AutoModerationTriggerTypes.Keyword,
|
triggerType: AutoModerationTriggerTypes.Keyword,
|
||||||
@@ -218,7 +218,7 @@ describe('Run automod tests', async () => {
|
|||||||
expect(rule.id).to.be.exist
|
expect(rule.id).to.be.exist
|
||||||
|
|
||||||
// Get the rule again to make sure it was created correctly
|
// Get the rule again to make sure it was created correctly
|
||||||
const fetchedRule = await rest.getAutomodRule(e2ecache.guild.id, rule.id)
|
const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
expect(fetchedRule.id).to.be.exist
|
expect(fetchedRule.id).to.be.exist
|
||||||
expect(fetchedRule.name).to.equal(rule.name)
|
expect(fetchedRule.name).to.equal(rule.name)
|
||||||
expect(fetchedRule.eventType).to.equal(AutoModerationEventTypes.MessageSend)
|
expect(fetchedRule.eventType).to.equal(AutoModerationEventTypes.MessageSend)
|
||||||
@@ -234,7 +234,7 @@ describe('Run automod tests', async () => {
|
|||||||
expect(fetchedRule.actions[1].type).to.equal(AutoModerationActionType.SendAlertMessage)
|
expect(fetchedRule.actions[1].type).to.equal(AutoModerationActionType.SendAlertMessage)
|
||||||
expect(fetchedRule.actions[2].type).to.equal(AutoModerationActionType.Timeout)
|
expect(fetchedRule.actions[2].type).to.equal(AutoModerationActionType.Timeout)
|
||||||
|
|
||||||
await rest.deleteAutomodRule(e2ecache.guild.id, rule.id)
|
await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,28 +3,28 @@ import { urlToBase64 } from '@discordeno/utils'
|
|||||||
import { use as chaiUse, expect } from 'chai'
|
import { use as chaiUse, expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { after, afterEach, before, beforeEach, describe, it } from 'mocha'
|
import { after, afterEach, before, beforeEach, describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
|
|
||||||
chaiUse(chaiAsPromised)
|
chaiUse(chaiAsPromised)
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Create and delete emojis', () => {
|
describe('Create and delete emojis', () => {
|
||||||
it('create an emoji', async () => {
|
it('create an emoji', async () => {
|
||||||
const emoji = await rest.createEmoji(e2ecache.guild.id, {
|
const emoji = await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'blamewolf',
|
name: 'blamewolf',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
||||||
roles: [],
|
roles: [],
|
||||||
@@ -32,12 +32,12 @@ describe('Create and delete emojis', () => {
|
|||||||
|
|
||||||
// Assertions
|
// Assertions
|
||||||
expect(emoji.id).to.be.exist
|
expect(emoji.id).to.be.exist
|
||||||
await rest.deleteEmoji(e2ecache.guild.id, emoji.id!)
|
await rest.deleteEmoji(e2eCache.guild.id, emoji.id!)
|
||||||
})
|
})
|
||||||
|
|
||||||
// delete an emoji without a reason
|
// delete an emoji without a reason
|
||||||
it('delete an emoji without a reason', async () => {
|
it('delete an emoji without a reason', async () => {
|
||||||
const emoji = await rest.createEmoji(e2ecache.guild.id, {
|
const emoji = await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'blamewolf',
|
name: 'blamewolf',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
||||||
roles: [],
|
roles: [],
|
||||||
@@ -46,14 +46,14 @@ describe('Create and delete emojis', () => {
|
|||||||
// Assertions
|
// Assertions
|
||||||
expect(emoji.id).to.be.exist
|
expect(emoji.id).to.be.exist
|
||||||
|
|
||||||
await rest.deleteEmoji(e2ecache.guild.id, emoji.id!)
|
await rest.deleteEmoji(e2eCache.guild.id, emoji.id!)
|
||||||
|
|
||||||
await expect(rest.getEmoji(e2ecache.guild.id, emoji.id!)).to.eventually.rejected
|
await expect(rest.getEmoji(e2eCache.guild.id, emoji.id!)).to.eventually.rejected
|
||||||
})
|
})
|
||||||
|
|
||||||
// delete an emoji with a reason
|
// delete an emoji with a reason
|
||||||
it('delete an emoji with a reason', async () => {
|
it('delete an emoji with a reason', async () => {
|
||||||
const emoji = await rest.createEmoji(e2ecache.guild.id, {
|
const emoji = await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'blamewolf',
|
name: 'blamewolf',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
||||||
roles: [],
|
roles: [],
|
||||||
@@ -62,9 +62,9 @@ describe('Create and delete emojis', () => {
|
|||||||
// Assertions
|
// Assertions
|
||||||
expect(emoji.id).to.be.exist
|
expect(emoji.id).to.be.exist
|
||||||
|
|
||||||
await rest.deleteEmoji(e2ecache.guild.id, emoji.id!, 'with a reason')
|
await rest.deleteEmoji(e2eCache.guild.id, emoji.id!, 'with a reason')
|
||||||
|
|
||||||
await expect(rest.getEmoji(e2ecache.guild.id, emoji.id!)).to.eventually.rejected
|
await expect(rest.getEmoji(e2eCache.guild.id, emoji.id!)).to.eventually.rejected
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ describe('Edit and get emojis', () => {
|
|||||||
let emoji: Camelize<DiscordEmoji> & { id: string }
|
let emoji: Camelize<DiscordEmoji> & { id: string }
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
emoji = (await rest.createEmoji(e2ecache.guild.id, {
|
emoji = (await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'blamewolf',
|
name: 'blamewolf',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
||||||
roles: [],
|
roles: [],
|
||||||
@@ -80,49 +80,49 @@ describe('Edit and get emojis', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await rest.deleteEmoji(e2ecache.guild.id, emoji.id)
|
await rest.deleteEmoji(e2eCache.guild.id, emoji.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
// edit an emoji name
|
// edit an emoji name
|
||||||
it('Edit an emoji name', async () => {
|
it('Edit an emoji name', async () => {
|
||||||
await rest.editEmoji(e2ecache.guild.id, emoji.id, {
|
await rest.editEmoji(e2eCache.guild.id, emoji.id, {
|
||||||
name: 'edited',
|
name: 'edited',
|
||||||
})
|
})
|
||||||
|
|
||||||
const edited = await rest.getEmoji(e2ecache.guild.id, emoji.id)
|
const edited = await rest.getEmoji(e2eCache.guild.id, emoji.id)
|
||||||
|
|
||||||
expect(edited.name).to.equal('edited')
|
expect(edited.name).to.equal('edited')
|
||||||
})
|
})
|
||||||
|
|
||||||
// edit an emoji roles
|
// edit an emoji roles
|
||||||
it("Edit an emoji's roles", async () => {
|
it("Edit an emoji's roles", async () => {
|
||||||
const role = await rest.createRole(e2ecache.guild.id, {
|
const role = await rest.createRole(e2eCache.guild.id, {
|
||||||
name: 'dd-test-emoji',
|
name: 'dd-test-emoji',
|
||||||
})
|
})
|
||||||
await rest.editEmoji(e2ecache.guild.id, emoji.id, {
|
await rest.editEmoji(e2eCache.guild.id, emoji.id, {
|
||||||
roles: [role.id],
|
roles: [role.id],
|
||||||
})
|
})
|
||||||
|
|
||||||
const edited = await rest.getEmoji(e2ecache.guild.id, emoji.id)
|
const edited = await rest.getEmoji(e2eCache.guild.id, emoji.id)
|
||||||
|
|
||||||
expect(edited.roles?.length).to.equal(1)
|
expect(edited.roles?.length).to.equal(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
// get an emoji
|
// get an emoji
|
||||||
it('get an emoji', async () => {
|
it('get an emoji', async () => {
|
||||||
const exists = await rest.getEmoji(e2ecache.guild.id, emoji.id)
|
const exists = await rest.getEmoji(e2eCache.guild.id, emoji.id)
|
||||||
expect(exists.id).to.be.exist
|
expect(exists.id).to.be.exist
|
||||||
expect(emoji.id).to.equal(exists.id)
|
expect(emoji.id).to.equal(exists.id)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('get all guild emojis', async () => {
|
it('get all guild emojis', async () => {
|
||||||
await rest.createEmoji(e2ecache.guild.id, {
|
await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'blamewolf2',
|
name: 'blamewolf2',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'),
|
||||||
roles: [],
|
roles: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
const exists = await rest.getEmojis(e2ecache.guild.id)
|
const exists = await rest.getEmojis(e2eCache.guild.id)
|
||||||
expect(exists.length).to.greaterThan(1)
|
expect(exists.length).to.greaterThan(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,21 +2,21 @@ import { ChannelTypes } from '@discordeno/types'
|
|||||||
import { use as chaiUse, expect } from 'chai'
|
import { use as chaiUse, expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
chaiUse(chaiAsPromised)
|
chaiUse(chaiAsPromised)
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ describe('Manage Guilds', async () => {
|
|||||||
const guild = await rest.createGuild({
|
const guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
expect(e2ecache.guild.id).to.be.exist
|
expect(e2eCache.guild.id).to.be.exist
|
||||||
await rest.deleteGuild(guild.id)
|
await rest.deleteGuild(guild.id)
|
||||||
// Make sure the guild was deleted
|
// Make sure the guild was deleted
|
||||||
const deleted = await rest.getGuild(guild.id).catch(() => undefined)
|
const deleted = await rest.getGuild(guild.id).catch(() => undefined)
|
||||||
@@ -33,31 +33,31 @@ describe('Manage Guilds', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Get a guild', async () => {
|
it('Get a guild', async () => {
|
||||||
const exists = await rest.getGuild(e2ecache.guild.id)
|
const exists = await rest.getGuild(e2eCache.guild.id)
|
||||||
expect(exists).to.be.exist
|
expect(exists).to.be.exist
|
||||||
expect(exists.id).to.be.exist
|
expect(exists.id).to.be.exist
|
||||||
expect(exists.name).to.equal(e2ecache.guild.name)
|
expect(exists.name).to.equal(e2eCache.guild.name)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('AFK channel', async () => {
|
it('AFK channel', async () => {
|
||||||
const voiceChannel = await rest.createChannel(e2ecache.guild.id, {
|
const voiceChannel = await rest.createChannel(e2eCache.guild.id, {
|
||||||
name: 'edit-guild-test',
|
name: 'edit-guild-test',
|
||||||
type: ChannelTypes.GuildVoice,
|
type: ChannelTypes.GuildVoice,
|
||||||
})
|
})
|
||||||
expect(voiceChannel.id).to.be.exist
|
expect(voiceChannel.id).to.be.exist
|
||||||
|
|
||||||
const edited = await rest.editGuild(e2ecache.guild.id, {
|
const edited = await rest.editGuild(e2eCache.guild.id, {
|
||||||
name: 'Discordeno-test-edited',
|
name: 'Discordeno-test-edited',
|
||||||
afkChannelId: voiceChannel.id,
|
afkChannelId: voiceChannel.id,
|
||||||
// afkTimeout: 5,
|
// afkTimeout: 5,
|
||||||
})
|
})
|
||||||
expect(edited.name).to.equal('Discordeno-test-edited')
|
expect(edited.name).to.equal('Discordeno-test-edited')
|
||||||
expect(e2ecache.guild.afkChannelId).to.not.equal(voiceChannel.id)
|
expect(e2eCache.guild.afkChannelId).to.not.equal(voiceChannel.id)
|
||||||
expect(edited.afkChannelId).to.equal(voiceChannel.id)
|
expect(edited.afkChannelId).to.equal(voiceChannel.id)
|
||||||
// expect(guild.afkTimeout).to.equal(0);
|
// expect(guild.afkTimeout).to.equal(0);
|
||||||
// expect(edited.afkTimeout).to.equal(5);
|
// expect(edited.afkTimeout).to.equal(5);
|
||||||
|
|
||||||
const edited2 = await rest.editGuild(e2ecache.guild.id, { afkChannelId: null })
|
const edited2 = await rest.editGuild(e2eCache.guild.id, { afkChannelId: null })
|
||||||
expect(edited.afkChannelId).to.not.equal(edited2.afkChannelId)
|
expect(edited.afkChannelId).to.not.equal(edited2.afkChannelId)
|
||||||
// Use boolean to check both undefined or null
|
// Use boolean to check both undefined or null
|
||||||
expect(!!edited2.afkChannelId).to.equal(false)
|
expect(!!edited2.afkChannelId).to.equal(false)
|
||||||
@@ -70,48 +70,48 @@ describe('Manage Guilds', async () => {
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
it('Get audit logs', async () => {
|
it('Get audit logs', async () => {
|
||||||
const auditLogs = await rest.getAuditLog(e2ecache.guild.id, { limit: 1 })
|
const auditLogs = await rest.getAuditLog(e2eCache.guild.id, { limit: 1 })
|
||||||
expect(auditLogs.auditLogEntries.length).to.be.exist
|
expect(auditLogs.auditLogEntries.length).to.be.exist
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get available voice regions
|
// Get available voice regions
|
||||||
it('Get available voice regions', async () => {
|
it('Get available voice regions', async () => {
|
||||||
const regions = await rest.getVoiceRegions(e2ecache.guild.id)
|
const regions = await rest.getVoiceRegions(e2eCache.guild.id)
|
||||||
expect(regions.length).to.be.exist
|
expect(regions.length).to.be.exist
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Banning members', async () => {
|
it('Banning members', async () => {
|
||||||
await rest.banMember(
|
await rest.banMember(
|
||||||
e2ecache.guild.id,
|
e2eCache.guild.id,
|
||||||
'379643682984296448',
|
'379643682984296448',
|
||||||
{
|
{
|
||||||
deleteMessageSeconds: 604800,
|
deleteMessageSeconds: 604800,
|
||||||
},
|
},
|
||||||
'Blame Wolf',
|
'Blame Wolf',
|
||||||
)
|
)
|
||||||
const fetchedBan = await rest.getBan(e2ecache.guild.id, '379643682984296448')
|
const fetchedBan = await rest.getBan(e2eCache.guild.id, '379643682984296448')
|
||||||
|
|
||||||
// Assertions
|
// Assertions
|
||||||
expect(fetchedBan).to.be.exist
|
expect(fetchedBan).to.be.exist
|
||||||
expect(fetchedBan.user.id).to.equal('379643682984296448')
|
expect(fetchedBan.user.id).to.equal('379643682984296448')
|
||||||
|
|
||||||
await rest.banMember(e2ecache.guild.id, '416477607966670869')
|
await rest.banMember(e2eCache.guild.id, '416477607966670869')
|
||||||
const fetchedBans = await rest.getBans(e2ecache.guild.id)
|
const fetchedBans = await rest.getBans(e2eCache.guild.id)
|
||||||
|
|
||||||
// Assertions
|
// Assertions
|
||||||
expect(fetchedBans).to.be.exist
|
expect(fetchedBans).to.be.exist
|
||||||
expect(fetchedBans.length).to.greaterThanOrEqual(2)
|
expect(fetchedBans.length).to.greaterThanOrEqual(2)
|
||||||
|
|
||||||
await rest.unbanMember(e2ecache.guild.id, '416477607966670869')
|
await rest.unbanMember(e2eCache.guild.id, '416477607966670869')
|
||||||
await rest.unbanMember(e2ecache.guild.id, '379643682984296448')
|
await rest.unbanMember(e2eCache.guild.id, '379643682984296448')
|
||||||
|
|
||||||
const unbanned = await rest.getBans(e2ecache.guild.id)
|
const unbanned = await rest.getBans(e2eCache.guild.id)
|
||||||
expect(unbanned.length).to.equal(0)
|
expect(unbanned.length).to.equal(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get vanity URL
|
// Get vanity URL
|
||||||
it('Get vanity URL', async () => {
|
it('Get vanity URL', async () => {
|
||||||
await expect(rest.getVanityUrl(e2ecache.guild.id)).to.eventually.rejected
|
await expect(rest.getVanityUrl(e2eCache.guild.id)).to.eventually.rejected
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get a welcome screen
|
// Get a welcome screen
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
import { use as chaiUse, expect } from 'chai'
|
import { use as chaiUse, expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
chaiUse(chaiAsPromised)
|
chaiUse(chaiAsPromised)
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Member tests', () => {
|
describe('Member tests', () => {
|
||||||
it("Fetches the bot and compares the bot's id with the fetched member's id", async () => {
|
it("Fetches the bot and compares the bot's id with the fetched member's id", async () => {
|
||||||
const member = await rest.getMember(e2ecache.communityGuildId, rest.applicationId)
|
const member = await rest.getMember(e2eCache.communityGuildId, rest.applicationId)
|
||||||
expect(member?.user.id).to.exist
|
expect(member?.user.id).to.exist
|
||||||
expect(member?.user.id).to.equal(rest.applicationId.toString())
|
expect(member?.user.id).to.equal(rest.applicationId.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Gets a member list and checks if the bot is in the member list', async () => {
|
it('Gets a member list and checks if the bot is in the member list', async () => {
|
||||||
const members = await rest.getMembers(e2ecache.communityGuildId, {
|
const members = await rest.getMembers(e2eCache.communityGuildId, {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
})
|
})
|
||||||
expect(members.some((m) => m.user.id === rest.applicationId.toString())).to.equal(true)
|
expect(members.some((m) => m.user.id === rest.applicationId.toString())).to.equal(true)
|
||||||
@@ -35,20 +35,20 @@ describe('Member tests', () => {
|
|||||||
|
|
||||||
// fetch a single member by id
|
// fetch a single member by id
|
||||||
it('Fetch a single member by id', async () => {
|
it('Fetch a single member by id', async () => {
|
||||||
const member = await rest.getMember(e2ecache.communityGuildId, rest.applicationId)
|
const member = await rest.getMember(e2eCache.communityGuildId, rest.applicationId)
|
||||||
|
|
||||||
expect(member?.user.id).to.exist
|
expect(member?.user.id).to.exist
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Edit a bot's nickname", async () => {
|
it("Edit a bot's nickname", async () => {
|
||||||
const nick = 'lts20050703'
|
const nick = 'lts20050703'
|
||||||
const member = await rest.editBotMember(e2ecache.communityGuildId, {
|
const member = await rest.editBotMember(e2eCache.communityGuildId, {
|
||||||
nick,
|
nick,
|
||||||
})
|
})
|
||||||
expect(member.nick).to.equal(nick)
|
expect(member.nick).to.equal(nick)
|
||||||
|
|
||||||
// Change nickname back
|
// Change nickname back
|
||||||
const member2 = await rest.editBotMember(e2ecache.communityGuildId, {
|
const member2 = await rest.editBotMember(e2eCache.communityGuildId, {
|
||||||
nick: null,
|
nick: null,
|
||||||
})
|
})
|
||||||
expect(member2.nick).to.null
|
expect(member2.nick).to.null
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
import { processReactionString, urlToBase64 } from '@discordeno/utils'
|
import { processReactionString, urlToBase64 } from '@discordeno/utils'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Send a message', () => {
|
describe('Send a message', () => {
|
||||||
it('With content', async () => {
|
it('With content', async () => {
|
||||||
const message = await rest.sendMessage(e2ecache.channel.id, { content: 'testing rate limit manager' })
|
const message = await rest.sendMessage(e2eCache.channel.id, { content: 'testing rate limit manager' })
|
||||||
expect(message.content).to.be.equal('testing rate limit manager')
|
expect(message.content).to.be.equal('testing rate limit manager')
|
||||||
|
|
||||||
const edited = await rest.editMessage(message.channelId, message.id, { content: 'testing rate limit manager edited' })
|
const edited = await rest.editMessage(message.channelId, message.id, { content: 'testing rate limit manager edited' })
|
||||||
@@ -36,7 +36,7 @@ describe('Send a message', () => {
|
|||||||
expect(image).to.not.be.undefined
|
expect(image).to.not.be.undefined
|
||||||
if (!image) throw new Error('Was not able to fetch the image.')
|
if (!image) throw new Error('Was not able to fetch the image.')
|
||||||
|
|
||||||
const message = await rest.sendMessage(e2ecache.channel.id, { files: [{ blob: image, name: 'gamer' }] })
|
const message = await rest.sendMessage(e2eCache.channel.id, { files: [{ blob: image, name: 'gamer' }] })
|
||||||
expect(message.attachments.length).to.be.greaterThan(0)
|
expect(message.attachments.length).to.be.greaterThan(0)
|
||||||
const [attachment] = message.attachments
|
const [attachment] = message.attachments
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ describe('Send a message', () => {
|
|||||||
it('With a file attachment', async () => {
|
it('With a file attachment', async () => {
|
||||||
const txtFile = new Blob(['hello world'], { type: 'text/plain' })
|
const txtFile = new Blob(['hello world'], { type: 'text/plain' })
|
||||||
|
|
||||||
const fileMsg = await rest.sendMessage(e2ecache.channel.id, {
|
const fileMsg = await rest.sendMessage(e2eCache.channel.id, {
|
||||||
content: '222',
|
content: '222',
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
@@ -64,7 +64,7 @@ describe('Send a message', () => {
|
|||||||
|
|
||||||
const txtFile2 = new Blob(['hello world edit'], { type: 'text/plain' })
|
const txtFile2 = new Blob(['hello world edit'], { type: 'text/plain' })
|
||||||
|
|
||||||
const edited = await rest.editMessage(e2ecache.channel.id, fileMsg.id, {
|
const edited = await rest.editMessage(e2eCache.channel.id, fileMsg.id, {
|
||||||
content: '222 edit',
|
content: '222 edit',
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
@@ -84,7 +84,7 @@ describe('Send a message', () => {
|
|||||||
|
|
||||||
describe('Manage reactions', async () => {
|
describe('Manage reactions', async () => {
|
||||||
it('Add and delete a unicode reaction', async () => {
|
it('Add and delete a unicode reaction', async () => {
|
||||||
const reactionChannel = await rest.createChannel(e2ecache.guild.id, { name: 'reactions' })
|
const reactionChannel = await rest.createChannel(e2eCache.guild.id, { name: 'reactions' })
|
||||||
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
||||||
|
|
||||||
await rest.addReaction(message.channelId, message.id, '📙')
|
await rest.addReaction(message.channelId, message.id, '📙')
|
||||||
@@ -98,13 +98,13 @@ describe('Manage reactions', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Add and delete a custom reaction', async () => {
|
it('Add and delete a custom reaction', async () => {
|
||||||
const emoji = await rest.createEmoji(e2ecache.guild.id, {
|
const emoji = await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'discordeno',
|
name: 'discordeno',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
|
||||||
})
|
})
|
||||||
const emojiCode = `<:${emoji.name!}:${emoji.id!}>`
|
const emojiCode = `<:${emoji.name!}:${emoji.id!}>`
|
||||||
|
|
||||||
const reactionChannel = await rest.createChannel(e2ecache.guild.id, { name: 'reactions' })
|
const reactionChannel = await rest.createChannel(e2eCache.guild.id, { name: 'reactions' })
|
||||||
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
||||||
|
|
||||||
await rest.addReaction(message.channelId, message.id, emojiCode)
|
await rest.addReaction(message.channelId, message.id, emojiCode)
|
||||||
@@ -121,13 +121,13 @@ describe('Manage reactions', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Add several reactions with random order and delete all of them', async () => {
|
it('Add several reactions with random order and delete all of them', async () => {
|
||||||
const emoji = await rest.createEmoji(e2ecache.guild.id, {
|
const emoji = await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'discordeno',
|
name: 'discordeno',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
|
||||||
})
|
})
|
||||||
const emojiCode = `<:${emoji.name!}:${emoji.id!}>`
|
const emojiCode = `<:${emoji.name!}:${emoji.id!}>`
|
||||||
|
|
||||||
const reactionChannel = await rest.createChannel(e2ecache.guild.id, { name: 'reactions' })
|
const reactionChannel = await rest.createChannel(e2eCache.guild.id, { name: 'reactions' })
|
||||||
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
||||||
|
|
||||||
await rest.addReactions(message.channelId, message.id, [emojiCode, '📙'])
|
await rest.addReactions(message.channelId, message.id, [emojiCode, '📙'])
|
||||||
@@ -141,13 +141,13 @@ describe('Manage reactions', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Add several reactions in an order and delete emoji reaction', async () => {
|
it('Add several reactions in an order and delete emoji reaction', async () => {
|
||||||
const emoji = await rest.createEmoji(e2ecache.guild.id, {
|
const emoji = await rest.createEmoji(e2eCache.guild.id, {
|
||||||
name: 'discordeno',
|
name: 'discordeno',
|
||||||
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
|
image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'),
|
||||||
})
|
})
|
||||||
const emojiCode = `<:${emoji.name!}:${emoji.id!}>`
|
const emojiCode = `<:${emoji.name!}:${emoji.id!}>`
|
||||||
|
|
||||||
const reactionChannel = await rest.createChannel(e2ecache.guild.id, { name: 'reactions' })
|
const reactionChannel = await rest.createChannel(e2eCache.guild.id, { name: 'reactions' })
|
||||||
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
const message = await rest.sendMessage(reactionChannel.id, { content: 'add reaction test' })
|
||||||
|
|
||||||
await rest.addReactions(message.channelId, message.id, [emojiCode, '📙'], true)
|
await rest.addReactions(message.channelId, message.id, [emojiCode, '📙'], true)
|
||||||
@@ -167,7 +167,7 @@ describe('Manage reactions', async () => {
|
|||||||
|
|
||||||
describe('Manage pins', () => {
|
describe('Manage pins', () => {
|
||||||
it('Pin, get, and unpin messages', async () => {
|
it('Pin, get, and unpin messages', async () => {
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, { name: 'pinning' })
|
const channel = await rest.createChannel(e2eCache.guild.id, { name: 'pinning' })
|
||||||
const message = await rest.sendMessage(channel.id, { content: 'pin me' })
|
const message = await rest.sendMessage(channel.id, { content: 'pin me' })
|
||||||
const message2 = await rest.sendMessage(channel.id, { content: 'pin me 2' })
|
const message2 = await rest.sendMessage(channel.id, { content: 'pin me 2' })
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ describe('Manage pins', () => {
|
|||||||
|
|
||||||
describe('Rate limit manager testing', () => {
|
describe('Rate limit manager testing', () => {
|
||||||
it('Send 10 messages to 1 channel', async () => {
|
it('Send 10 messages to 1 channel', async () => {
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, { name: 'rate-limit-1' })
|
const channel = await rest.createChannel(e2eCache.guild.id, { name: 'rate-limit-1' })
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(async (i) => {
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(async (i) => {
|
||||||
await rest.sendMessage(channel.id, { content: `10 messages to 1 channel testing rate limit manager ${i}` })
|
await rest.sendMessage(channel.id, { content: `10 messages to 1 channel testing rate limit manager ${i}` })
|
||||||
@@ -199,7 +199,7 @@ describe('Rate limit manager testing', () => {
|
|||||||
it('Send 10 messages to 10 channels', async () => {
|
it('Send 10 messages to 10 channels', async () => {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[...Array(10).keys()].map(async () => {
|
[...Array(10).keys()].map(async () => {
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, { name: 'rate-limit-x' })
|
const channel = await rest.createChannel(e2eCache.guild.id, { name: 'rate-limit-x' })
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[...Array(10).keys()].map(async (_, index) => {
|
[...Array(10).keys()].map(async (_, index) => {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe } from 'mocha'
|
import { describe } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
|
|
||||||
describe('Typings', () => {
|
describe('Typings', () => {
|
||||||
it('Trigger Typing Indication', async () => {
|
it('Trigger Typing Indication', async () => {
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, { name: 'typing' })
|
const channel = await rest.createChannel(e2eCache.guild.id, { name: 'typing' })
|
||||||
await rest.triggerTypingIndicator(channel.id)
|
await rest.triggerTypingIndicator(channel.id)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { calculateBits } from '@discordeno/utils'
|
import { calculateBits } from '@discordeno/utils'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { before, describe, it } from 'mocha'
|
import { before, describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ describe('Role tests', async () => {
|
|||||||
// Create a role with a reason
|
// Create a role with a reason
|
||||||
it('Create a role with a reason', async () => {
|
it('Create a role with a reason', async () => {
|
||||||
const role = await rest.createRole(
|
const role = await rest.createRole(
|
||||||
e2ecache.guild?.id,
|
e2eCache.guild?.id,
|
||||||
{
|
{
|
||||||
name: `test role ${Date.now()}`,
|
name: `test role ${Date.now()}`,
|
||||||
},
|
},
|
||||||
@@ -32,7 +32,7 @@ describe('Role tests', async () => {
|
|||||||
|
|
||||||
// Create a role without a reason
|
// Create a role without a reason
|
||||||
it('Create a role without a reason', async () => {
|
it('Create a role without a reason', async () => {
|
||||||
const role = await rest.createRole(e2ecache.guild.id, {
|
const role = await rest.createRole(e2eCache.guild.id, {
|
||||||
name: `test role ${Date.now()}`,
|
name: `test role ${Date.now()}`,
|
||||||
})
|
})
|
||||||
expect(role.id).to.exist
|
expect(role.id).to.exist
|
||||||
@@ -40,21 +40,21 @@ describe('Role tests', async () => {
|
|||||||
|
|
||||||
// Delete a role
|
// Delete a role
|
||||||
it('Delete a role', async () => {
|
it('Delete a role', async () => {
|
||||||
const role = await rest.createRole(e2ecache.guild.id, {
|
const role = await rest.createRole(e2eCache.guild.id, {
|
||||||
name: `test role ${Date.now()}`,
|
name: `test role ${Date.now()}`,
|
||||||
})
|
})
|
||||||
await rest.deleteRole(e2ecache.guild.id, role.id)
|
await rest.deleteRole(e2eCache.guild.id, role.id)
|
||||||
const deletedRoles = await rest.getRoles(e2ecache.guild.id)
|
const deletedRoles = await rest.getRoles(e2eCache.guild.id)
|
||||||
expect(deletedRoles.some((r) => r.id === role.id)).to.equal(false)
|
expect(deletedRoles.some((r) => r.id === role.id)).to.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Edit a role
|
// Edit a role
|
||||||
it('Edit a role', async () => {
|
it('Edit a role', async () => {
|
||||||
const role = await rest.createRole(e2ecache.guild.id, {
|
const role = await rest.createRole(e2eCache.guild.id, {
|
||||||
name: `test role ${Date.now()}`,
|
name: `test role ${Date.now()}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
const edited = await rest.editRole(e2ecache.guild.id, role.id, {
|
const edited = await rest.editRole(e2eCache.guild.id, role.id, {
|
||||||
name: 'test role 4',
|
name: 'test role 4',
|
||||||
color: 0x0000ff,
|
color: 0x0000ff,
|
||||||
hoist: true,
|
hoist: true,
|
||||||
@@ -67,11 +67,11 @@ describe('Role tests', async () => {
|
|||||||
expect(edited.mentionable).to.equal(true)
|
expect(edited.mentionable).to.equal(true)
|
||||||
expect(edited.permissions.toString()).to.equal(calculateBits(['SEND_MESSAGES', 'VIEW_CHANNEL']))
|
expect(edited.permissions.toString()).to.equal(calculateBits(['SEND_MESSAGES', 'VIEW_CHANNEL']))
|
||||||
|
|
||||||
await rest.editRole(e2ecache.guild.id, role.id, {
|
await rest.editRole(e2eCache.guild.id, role.id, {
|
||||||
hoist: false,
|
hoist: false,
|
||||||
mentionable: false,
|
mentionable: false,
|
||||||
})
|
})
|
||||||
const roles = await rest.getRoles(e2ecache.guild.id)
|
const roles = await rest.getRoles(e2eCache.guild.id)
|
||||||
const unedited = roles.find((r) => r.id === role.id)
|
const unedited = roles.find((r) => r.id === role.id)
|
||||||
|
|
||||||
expect(unedited?.hoist).to.equal(false)
|
expect(unedited?.hoist).to.equal(false)
|
||||||
@@ -79,27 +79,27 @@ describe('Role tests', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Add and remove role from user', async () => {
|
it('Add and remove role from user', async () => {
|
||||||
const role = await rest.createRole(e2ecache.guild.id, {
|
const role = await rest.createRole(e2eCache.guild.id, {
|
||||||
name: `test role ${Date.now()}`,
|
name: `test role ${Date.now()}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Assign the role to the user
|
// Assign the role to the user
|
||||||
await rest.addRole(e2ecache.guild.id, rest.applicationId, role.id)
|
await rest.addRole(e2eCache.guild.id, rest.applicationId, role.id)
|
||||||
const member = await rest.getMember(e2ecache.guild.id, rest.applicationId)
|
const member = await rest.getMember(e2eCache.guild.id, rest.applicationId)
|
||||||
expect(member?.roles.includes(role.id)).to.equal(true)
|
expect(member?.roles.includes(role.id)).to.equal(true)
|
||||||
|
|
||||||
await rest.removeRole(e2ecache.guild.id, rest.applicationId, role.id)
|
await rest.removeRole(e2eCache.guild.id, rest.applicationId, role.id)
|
||||||
const removed = await rest.getMember(e2ecache.guild.id, rest.applicationId)
|
const removed = await rest.getMember(e2eCache.guild.id, rest.applicationId)
|
||||||
// console.log('member', member.errors.userId.Errors)
|
// console.log('member', member.errors.userId.Errors)
|
||||||
expect(removed?.roles.includes(role.id)).to.equal(false)
|
expect(removed?.roles.includes(role.id)).to.equal(false)
|
||||||
|
|
||||||
// With a reason
|
// With a reason
|
||||||
await rest.addRole(e2ecache.guild.id, rest.applicationId, role.id, 'test reason')
|
await rest.addRole(e2eCache.guild.id, rest.applicationId, role.id, 'test reason')
|
||||||
const member2 = await rest.getMember(e2ecache.guild.id, rest.applicationId)
|
const member2 = await rest.getMember(e2eCache.guild.id, rest.applicationId)
|
||||||
expect(member2?.roles.includes(role.id)).to.equal(true)
|
expect(member2?.roles.includes(role.id)).to.equal(true)
|
||||||
|
|
||||||
await rest.removeRole(e2ecache.guild.id, rest.applicationId, role.id, 'test reason')
|
await rest.removeRole(e2eCache.guild.id, rest.applicationId, role.id, 'test reason')
|
||||||
const member3 = await rest.getMember(e2ecache.guild.id, rest.applicationId)
|
const member3 = await rest.getMember(e2eCache.guild.id, rest.applicationId)
|
||||||
expect(member3?.roles.includes(role.id)).to.equal(false)
|
expect(member3?.roles.includes(role.id)).to.equal(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,21 +2,21 @@ import { StickerFormatTypes } from '@discordeno/types'
|
|||||||
import { use as chaiUse, expect } from 'chai'
|
import { use as chaiUse, expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
chaiUse(chaiAsPromised)
|
chaiUse(chaiAsPromised)
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ describe('Sticker tests', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Create, edit, get, and delete guild sticker', async () => {
|
it('Create, edit, get, and delete guild sticker', async () => {
|
||||||
const sticker = await rest.createGuildSticker(e2ecache.guild.id, {
|
const sticker = await rest.createGuildSticker(e2eCache.guild.id, {
|
||||||
name: 'sticker name',
|
name: 'sticker name',
|
||||||
description: 'sticker description',
|
description: 'sticker description',
|
||||||
tags: 'sticker tags',
|
tags: 'sticker tags',
|
||||||
@@ -42,7 +42,7 @@ describe('Sticker tests', async () => {
|
|||||||
expect(sticker.description).to.equal('sticker description')
|
expect(sticker.description).to.equal('sticker description')
|
||||||
expect(sticker.tags).to.equal('sticker tags')
|
expect(sticker.tags).to.equal('sticker tags')
|
||||||
|
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, {
|
const channel = await rest.createChannel(e2eCache.guild.id, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
})
|
})
|
||||||
const message = await rest.sendMessage(channel.id, {
|
const message = await rest.sendMessage(channel.id, {
|
||||||
@@ -53,13 +53,13 @@ describe('Sticker tests', async () => {
|
|||||||
expect(message.stickerItems?.[0].id).to.equal(sticker.id)
|
expect(message.stickerItems?.[0].id).to.equal(sticker.id)
|
||||||
expect(message.stickerItems?.[0].name).to.equal(sticker.name)
|
expect(message.stickerItems?.[0].name).to.equal(sticker.name)
|
||||||
|
|
||||||
const getSticker = await rest.getGuildSticker(e2ecache.guild.id, sticker.id)
|
const getSticker = await rest.getGuildSticker(e2eCache.guild.id, sticker.id)
|
||||||
|
|
||||||
expect(getSticker.name).to.equal('sticker name')
|
expect(getSticker.name).to.equal('sticker name')
|
||||||
expect(getSticker.description).to.equal('sticker description')
|
expect(getSticker.description).to.equal('sticker description')
|
||||||
expect(getSticker.tags).to.equal('sticker tags')
|
expect(getSticker.tags).to.equal('sticker tags')
|
||||||
|
|
||||||
const editSticker = await rest.editGuildSticker(e2ecache.guild.id, sticker.id, {
|
const editSticker = await rest.editGuildSticker(e2eCache.guild.id, sticker.id, {
|
||||||
name: 'sticker name',
|
name: 'sticker name',
|
||||||
description: 'sticker description',
|
description: 'sticker description',
|
||||||
tags: 'sticker tags',
|
tags: 'sticker tags',
|
||||||
@@ -69,7 +69,7 @@ describe('Sticker tests', async () => {
|
|||||||
expect(editSticker.description).to.equal('sticker description')
|
expect(editSticker.description).to.equal('sticker description')
|
||||||
expect(editSticker.tags).to.equal('sticker tags')
|
expect(editSticker.tags).to.equal('sticker tags')
|
||||||
|
|
||||||
await rest.createGuildSticker(e2ecache.guild.id, {
|
await rest.createGuildSticker(e2eCache.guild.id, {
|
||||||
name: 'sticker 2',
|
name: 'sticker 2',
|
||||||
description: 'sticker 2',
|
description: 'sticker 2',
|
||||||
tags: 'sticker tags 2',
|
tags: 'sticker tags 2',
|
||||||
@@ -78,10 +78,10 @@ describe('Sticker tests', async () => {
|
|||||||
name: 'ddlogo.png',
|
name: 'ddlogo.png',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const stickers = await rest.getGuildStickers(e2ecache.guild.id)
|
const stickers = await rest.getGuildStickers(e2eCache.guild.id)
|
||||||
expect(stickers.length).to.greaterThan(1)
|
expect(stickers.length).to.greaterThan(1)
|
||||||
|
|
||||||
await rest.deleteGuildSticker(e2ecache.guild.id, sticker.id)
|
await rest.deleteGuildSticker(e2eCache.guild.id, sticker.id)
|
||||||
await expect(rest.getGuildSticker(e2ecache.guild.id, sticker.id)).to.eventually.rejected
|
await expect(rest.getGuildSticker(e2eCache.guild.id, sticker.id)).to.eventually.rejected
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import { use as chaiUse, expect } from 'chai'
|
import { use as chaiUse, expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
chaiUse(chaiAsPromised)
|
chaiUse(chaiAsPromised)
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ rest.deleteQueueDelay = 10000
|
|||||||
const guild = await rest.createGuild({ name: 'ddenotester' })
|
const guild = await rest.createGuild({ name: 'ddenotester' })
|
||||||
const channel = await rest.createChannel(guild.id, { name: 'ddenotestchannel' })
|
const channel = await rest.createChannel(guild.id, { name: 'ddenotestchannel' })
|
||||||
|
|
||||||
export const e2ecache = {
|
export const e2eCache = {
|
||||||
guild,
|
guild,
|
||||||
channel,
|
channel,
|
||||||
deletedGuild: false,
|
deletedGuild: false,
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
import { use as chaiUse, expect } from 'chai'
|
import { use as chaiUse, expect } from 'chai'
|
||||||
import chaiAsPromised from 'chai-as-promised'
|
import chaiAsPromised from 'chai-as-promised'
|
||||||
import { describe, it } from 'mocha'
|
import { describe, it } from 'mocha'
|
||||||
import { e2ecache, rest } from './utils.js'
|
import { e2eCache, rest } from './utils.js'
|
||||||
chaiUse(chaiAsPromised)
|
chaiUse(chaiAsPromised)
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
if (!e2ecache.guild) {
|
if (!e2eCache.guild) {
|
||||||
e2ecache.guild = await rest.createGuild({
|
e2eCache.guild = await rest.createGuild({
|
||||||
name: 'Discordeno-test',
|
name: 'Discordeno-test',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
if (e2eCache.guild.id && !e2eCache.deletedGuild) {
|
||||||
e2ecache.deletedGuild = true
|
e2eCache.deletedGuild = true
|
||||||
await rest.deleteGuild(e2ecache.guild.id)
|
await rest.deleteGuild(e2eCache.guild.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Webhook helpers', async () => {
|
describe('Webhook helpers', async () => {
|
||||||
it('Manage webhooks', async () => {
|
it('Manage webhooks', async () => {
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, {
|
const channel = await rest.createChannel(e2eCache.guild.id, {
|
||||||
name: 'wbhook',
|
name: 'wbhook',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ describe('Webhook helpers', async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('Manage webhook messages', async () => {
|
it('Manage webhook messages', async () => {
|
||||||
const channel = await rest.createChannel(e2ecache.guild.id, {
|
const channel = await rest.createChannel(e2eCache.guild.id, {
|
||||||
name: 'wbhook',
|
name: 'wbhook',
|
||||||
})
|
})
|
||||||
const webhook = await rest.createWebhook(channel.id, {
|
const webhook = await rest.createWebhook(channel.id, {
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/test.json"
|
||||||
|
}
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json"
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/test.json",
|
|
||||||
"include": ["tests"],
|
|
||||||
"exclude": ["node_modules", "dist", "src"]
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2022",
|
"target": "es2022",
|
||||||
"module": "es2022",
|
"module": "es2022",
|
||||||
|
"rootDir": "${configDir}/src",
|
||||||
|
"outDir": "${configDir}/dist",
|
||||||
|
"tsBuildInfoFile": "${configDir}/dist/.tsbuildinfo",
|
||||||
"composite": false,
|
"composite": false,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
@@ -16,11 +19,12 @@
|
|||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false,
|
||||||
"preserveWatchOutput": true,
|
"preserveWatchOutput": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"skipDefaultLibCheck": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist", "tests", "test"],
|
"include": ["${configDir}/src"],
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"swc": true,
|
"swc": true,
|
||||||
"esm": true
|
"esm": true
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"extends": "./base.json",
|
"extends": "./base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"incremental": false
|
"incremental": false,
|
||||||
}
|
"tsBuildInfoFile": null,
|
||||||
|
"rootDir": null,
|
||||||
|
"outDir": null,
|
||||||
|
},
|
||||||
|
"include": ["${configDir}"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,17 +29,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@swc/cli": "^0.3.9",
|
"@swc/cli": "^0.3.9",
|
||||||
"@swc/core": "^1.4.2",
|
"@swc/core": "^1.4.2",
|
||||||
"@types/chai": "^4.3.11",
|
|
||||||
"@types/mocha": "^10.0.7",
|
"@types/mocha": "^10.0.7",
|
||||||
"@types/node": "^20.11.25",
|
"@types/node": "^20.11.25",
|
||||||
"@types/sinon": "^17.0.3",
|
|
||||||
"c8": "^9.1.0",
|
"c8": "^9.1.0",
|
||||||
"chai": "^5.1.1",
|
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-discordeno": "*",
|
"eslint-config-discordeno": "*",
|
||||||
"mocha": "^10.5.1",
|
"mocha": "^10.5.1",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/test.json"
|
||||||
|
}
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json"
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/test.json",
|
|
||||||
"include": ["tests"],
|
|
||||||
"exclude": ["node_modules", "dist", "src"]
|
|
||||||
}
|
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
"noInterop": false
|
"noInterop": false
|
||||||
},
|
},
|
||||||
"sourceMaps": "inline"
|
"sourceMaps": "inline"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,10 @@
|
|||||||
"test:bun-unit": "node ../../scripts/fixBunTestExtension.js && bun test bunTestsDist",
|
"test:bun-unit": "node ../../scripts/fixBunTestExtension.js && bun test bunTestsDist",
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tsconfig.test.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordeno/types": "19.0.0-beta.1",
|
"@discordeno/types": "19.0.0-beta.1"
|
||||||
"tweetnacl": "^1.0.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@swc/cli": "^0.3.9",
|
"@swc/cli": "^0.3.9",
|
||||||
@@ -47,6 +46,6 @@
|
|||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "5.4.5"
|
"typescript": "^5.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tsconfig/test.json"
|
||||||
|
}
|
||||||
@@ -1,8 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json"
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
|
|
||||||
"exclude": ["node_modules", "dist", "test", "tests"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tsconfig/test.json",
|
|
||||||
"include": ["tests"],
|
|
||||||
"exclude": ["node_modules", "dist", "src"]
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@ import os from 'node:os'
|
|||||||
|
|
||||||
const hostCpu = os.cpus()[0].model.trim()
|
const hostCpu = os.cpus()[0].model.trim()
|
||||||
const targetCpu = await fetch('https://raw.githubusercontent.com/discordeno/discordeno/benchies/cpu')
|
const targetCpu = await fetch('https://raw.githubusercontent.com/discordeno/discordeno/benchies/cpu')
|
||||||
.then((res) => res.text())
|
.then(async (res) => await res.text())
|
||||||
.then((text) => text.slice(0, -1))
|
.then((text) => text.slice(0, -1))
|
||||||
console.dir(`host cpu: ${hostCpu} target cpu: ${targetCpu}`)
|
console.dir(`host cpu: ${hostCpu} target cpu: ${targetCpu}`)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import fs from 'node:fs'
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|
||||||
// these two paths may vary depending on where you place this script, and your project structure including where typedoc generates its output files.
|
// these two paths may vary depending on where you place this script, and your project structure including where typedoc generates its output files.
|
||||||
const typedocOutPath = await import('../typedoc.json', { assert: { type: 'json' } }).then((module) => module.default.out)
|
const typedocOutPath = await import('../typedoc.json', { with: { type: 'json' } }).then((module) => module.default.out)
|
||||||
|
|
||||||
async function* walk(dir) {
|
async function* walk(dir) {
|
||||||
for await (const d of await fs.promises.opendir(dir)) {
|
for await (const d of await fs.promises.opendir(dir)) {
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
// TODO: replace with fetch of live spec
|
// TODO: replace with fetch of live spec
|
||||||
const DISCORD_SPEC = {}
|
const DISCORD_SPEC = {}
|
||||||
|
|
||||||
function schemaRefToName(ref) {
|
function schemaRefToName(ref) {
|
||||||
if (!ref) return ""
|
if (!ref) return ''
|
||||||
return `Discord${ref?.substring(ref.lastIndexOf('/') + 1)}`
|
return `Discord${ref?.substring(ref.lastIndexOf('/') + 1)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,12 +63,12 @@ function generateFromSpec() {
|
|||||||
type === 'integer'
|
type === 'integer'
|
||||||
? 'number'
|
? 'number'
|
||||||
: type === 'array'
|
: type === 'array'
|
||||||
? property.items.$ref
|
? property.items.$ref
|
||||||
? `${schemaRefToName(property.items.$ref)}[]`
|
? `${schemaRefToName(property.items.$ref)}[]`
|
||||||
: Array.isArray(property.items.oneOf)
|
: Array.isArray(property.items.oneOf)
|
||||||
? `${property.items.oneOf.map((o) => `${schemaRefToName(o.$ref)}[]`).join(' | ')}`
|
? `${property.items.oneOf.map((o) => `${schemaRefToName(o.$ref)}[]`).join(' | ')}`
|
||||||
: `unknown[]`
|
: `unknown[]`
|
||||||
: type,
|
: type,
|
||||||
)
|
)
|
||||||
.join(' | ') ??
|
.join(' | ') ??
|
||||||
property.oneOf
|
property.oneOf
|
||||||
|
|||||||
+1
-5
@@ -1,8 +1,4 @@
|
|||||||
{
|
{
|
||||||
"extends": "tsconfig/base.json",
|
"extends": "tsconfig/base.json",
|
||||||
"compilerOptions": {
|
"include": ["."]
|
||||||
"outDir": "./dist"
|
|
||||||
},
|
|
||||||
"include": ["."],
|
|
||||||
"exclude": ["dist", "build", "node_modules"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -33,12 +33,8 @@
|
|||||||
"outputs": ["denoTestsDist/**"]
|
"outputs": ["denoTestsDist/**"]
|
||||||
},
|
},
|
||||||
"test:bun-unit": {
|
"test:bun-unit": {
|
||||||
"dependsOn": [
|
"dependsOn": ["^build"],
|
||||||
"^build"
|
"outputs": ["bunTestsDist/**"]
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
"bunTestsDist/**"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"test:e2e": {
|
"test:e2e": {
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": ["^build"],
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"arrowParens": "avoid"
|
"arrowParens": "avoid"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
---
|
---
|
||||||
sidebar_position: 2
|
sidebar_position: 2
|
||||||
---
|
---
|
||||||
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
||||||
|
import BrowserOnly from '@docusaurus/BrowserOnly'
|
||||||
|
|
||||||
# Architecture
|
# Architecture
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
import FlowChart from '@site/src/components/architecture/FlowChart'
|
import FlowChart from '@site/src/components/architecture/FlowChart'
|
||||||
|
|
||||||
<BrowserOnly>
|
<BrowserOnly>{() => <FlowChart />}</BrowserOnly>
|
||||||
{() => <FlowChart />}
|
|
||||||
</BrowserOnly>
|
|
||||||
|
|
||||||
Discordeno have three main components/process, gateway, bot and rest. Websocket events from Discord, such as connecting, restarting, heartbeating, and transmitting websocket messages to Discord, are handled and maintained by the Gateway process. All Discord events are handled and converted by the Bot process, which also activates your code, such as the execute function upon message creation. All http requests to Discord, including proxying and ratelimiting, are handled by the Rest process.
|
Discordeno have three main components/process, gateway, bot and rest. Websocket events from Discord, such as connecting, restarting, heartbeating, and transmitting websocket messages to Discord, are handled and maintained by the Gateway process. All Discord events are handled and converted by the Bot process, which also activates your code, such as the execute function upon message creation. All http requests to Discord, including proxying and ratelimiting, are handled by the Rest process.
|
||||||
|
|
||||||
## Gateway Process
|
## Gateway Process
|
||||||
|
|
||||||
import FlowChart2 from '@site/src/components/architecture/FlowChart2'
|
import FlowChart2 from '@site/src/components/architecture/FlowChart2'
|
||||||
|
|
||||||
<BrowserOnly>
|
<BrowserOnly>{() => <FlowChart2 />}</BrowserOnly>
|
||||||
{() => <FlowChart2 />}
|
|
||||||
</BrowserOnly>
|
|
||||||
|
|
||||||
The Gateway process have two part the gateway manager and the gateway [shard](https://discord.com/developers/docs/topics/gateway#sharding), the gateway manager oversees the gateway shard.
|
The Gateway process have two part the gateway manager and the gateway [shard](https://discord.com/developers/docs/topics/gateway#sharding), the gateway manager oversees the gateway shard.
|
||||||
|
|
||||||
@@ -32,10 +31,15 @@ The gateway manager spawns the right amount of shard acording to data from disco
|
|||||||
Any event is passed to the handleMessage method by the gateway shard, which also establishes a websocket connection to Discord. The handleMessage method will examine the event and only deliver genuine events to the bot by intercepting and processing websocket-related events like hello, resume, heartbeat, and ready. You can modify the handleMessage to suit your needs, but it is not advised unless you are certain of your actions because the connection depends on it. After the function has finished processing the event, it will either pass the event directly (in the same process), via the rest api, a message queue, or another mechanism depending on the user's customization.
|
Any event is passed to the handleMessage method by the gateway shard, which also establishes a websocket connection to Discord. The handleMessage method will examine the event and only deliver genuine events to the bot by intercepting and processing websocket-related events like hello, resume, heartbeat, and ready. You can modify the handleMessage to suit your needs, but it is not advised unless you are certain of your actions because the connection depends on it. After the function has finished processing the event, it will either pass the event directly (in the same process), via the rest api, a message queue, or another mechanism depending on the user's customization.
|
||||||
|
|
||||||
## Bot Process
|
## Bot Process
|
||||||
|
|
||||||
import FlowChart3 from '@site/src/components/architecture/FlowChart3'
|
import FlowChart3 from '@site/src/components/architecture/FlowChart3'
|
||||||
|
|
||||||
<BrowserOnly>
|
<BrowserOnly>
|
||||||
{() => <FlowChart3 handlerFilter={(handler) => handler.startsWith('handleChannel')}/>}
|
{() => (
|
||||||
|
<FlowChart3
|
||||||
|
handlerFilter={handler => handler.startsWith('handleChannel')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</BrowserOnly>
|
</BrowserOnly>
|
||||||
|
|
||||||
A simplified version of function used inside of the bot process, showing only the handlers, transformers and event related to channel event
|
A simplified version of function used inside of the bot process, showing only the handlers, transformers and event related to channel event
|
||||||
@@ -46,4 +50,4 @@ When an event arrives from the gateway, the bot process receives it and passes i
|
|||||||
|
|
||||||
## Rest Process
|
## Rest Process
|
||||||
|
|
||||||
TBC
|
TBC
|
||||||
|
|||||||
@@ -9,4 +9,3 @@ Benchmark runs on every commit pushed on the Discordeno's main branch
|
|||||||
import Benchmark from '@site/src/components/Benchmark'
|
import Benchmark from '@site/src/components/Benchmark'
|
||||||
|
|
||||||
<Benchmark />
|
<Benchmark />
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import ReactFlow, {
|
import ReactFlow, {
|
||||||
Background,
|
Background,
|
||||||
Controls,
|
Controls,
|
||||||
Edge,
|
type Edge,
|
||||||
Node,
|
type Node,
|
||||||
Position,
|
Position,
|
||||||
} from 'reactflow'
|
} from 'reactflow'
|
||||||
import 'reactflow/dist/style.css'
|
import 'reactflow/dist/style.css'
|
||||||
@@ -15,7 +15,7 @@ export const defaultNodeOptions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const genServer = (x: number, id: number) => {
|
const genServer = (x: number, id: number) => {
|
||||||
const server: Node<any, string>[] = [
|
const server: Array<Node<any, string>> = [
|
||||||
{
|
{
|
||||||
id: `s${id + 1}`,
|
id: `s${id + 1}`,
|
||||||
data: { label: `Server ${id + 1}` },
|
data: { label: `Server ${id + 1}` },
|
||||||
@@ -24,7 +24,7 @@ const genServer = (x: number, id: number) => {
|
|||||||
]
|
]
|
||||||
|
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
if (i == 2) {
|
if (i === 2) {
|
||||||
server.push(
|
server.push(
|
||||||
{
|
{
|
||||||
id: `baseLineNodeText-${id}-${i}`,
|
id: `baseLineNodeText-${id}-${i}`,
|
||||||
@@ -48,17 +48,17 @@ const genServer = (x: number, id: number) => {
|
|||||||
server.push(
|
server.push(
|
||||||
...[
|
...[
|
||||||
{
|
{
|
||||||
id: `w${id * 50 + (i == 3 ? 49 : i) + 1}`,
|
id: `w${id * 50 + (i === 3 ? 49 : i) + 1}`,
|
||||||
data: { label: `Worker ${id * 50 + (i == 3 ? 49 : i)}` },
|
data: { label: `Worker ${id * 50 + (i === 3 ? 49 : i)}` },
|
||||||
position: { x: x - 112.5 + 75 * i, y: 200 },
|
position: { x: x - 112.5 + 75 * i, y: 200 },
|
||||||
...defaultNodeOptions,
|
...defaultNodeOptions,
|
||||||
...{ style: { ...defaultNodeOptions.style, padding: '5px 10px' } },
|
...{ style: { ...defaultNodeOptions.style, padding: '5px 10px' } },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: `w${id * 50 + (i == 3 ? 49 : i) + 1}s`,
|
id: `w${id * 50 + (i === 3 ? 49 : i) + 1}s`,
|
||||||
data: {
|
data: {
|
||||||
label: `Shard ${id * 500 + (i == 3 ? 49 : i) * 10}-${
|
label: `Shard ${id * 500 + (i === 3 ? 49 : i) * 10}-${
|
||||||
id * 500 + (i == 3 ? 49 : i) * 10 + 9
|
id * 500 + (i === 3 ? 49 : i) * 10 + 9
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
position: { x: x - 112.5 + 75 * i, y: 300 },
|
position: { x: x - 112.5 + 75 * i, y: 300 },
|
||||||
@@ -67,10 +67,10 @@ const genServer = (x: number, id: number) => {
|
|||||||
...{
|
...{
|
||||||
style: {
|
style: {
|
||||||
...defaultNodeOptions.style,
|
...defaultNodeOptions.style,
|
||||||
...(id == 1 || (id == 0 && i == 3)
|
...(id === 1 || (id === 0 && i === 3)
|
||||||
? { padding: '5px 10px' }
|
? { padding: '5px 10px' }
|
||||||
: { padding: `5px 5px` }),
|
: { padding: `5px 5px` }),
|
||||||
...(id == 0 && i != 3 ? { padding: '5px 15px' } : {}),
|
...(id === 0 && i !== 3 ? { padding: '5px 15px' } : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -101,7 +101,7 @@ const nodes = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const edges: Edge<any>[] = [
|
const edges: Array<Edge<any>> = [
|
||||||
{ id: 'gwm-s1', source: 'gwm', target: 's1', type: 'step' },
|
{ id: 'gwm-s1', source: 'gwm', target: 's1', type: 'step' },
|
||||||
{ id: 'gwm-s2', source: 'gwm', target: 's2', type: 'step' },
|
{ id: 'gwm-s2', source: 'gwm', target: 's2', type: 'step' },
|
||||||
{ id: 'gwm-s10', source: 'gwm', target: 's10', type: 'step' },
|
{ id: 'gwm-s10', source: 'gwm', target: 's10', type: 'step' },
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ __metadata:
|
|||||||
sinon: "npm:^17.0.1"
|
sinon: "npm:^17.0.1"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ __metadata:
|
|||||||
sinon: "npm:^17.0.1"
|
sinon: "npm:^17.0.1"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
uWebSockets.js: "https://github.com/uNetworking/uWebSockets.js.git#commit=42c9c0d5d31f46ca4115dc75672b0037ec970f28"
|
uWebSockets.js: "https://github.com/uNetworking/uWebSockets.js.git#commit=42c9c0d5d31f46ca4115dc75672b0037ec970f28"
|
||||||
ws: "npm:^8.18.0"
|
ws: "npm:^8.18.0"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -104,8 +104,7 @@ __metadata:
|
|||||||
sinon: "npm:^17.0.1"
|
sinon: "npm:^17.0.1"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
why-is-node-running: "npm:^2.2.2"
|
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -115,18 +114,15 @@ __metadata:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@swc/cli": "npm:^0.3.9"
|
"@swc/cli": "npm:^0.3.9"
|
||||||
"@swc/core": "npm:^1.4.2"
|
"@swc/core": "npm:^1.4.2"
|
||||||
"@types/chai": "npm:^4.3.11"
|
|
||||||
"@types/mocha": "npm:^10.0.7"
|
"@types/mocha": "npm:^10.0.7"
|
||||||
"@types/node": "npm:^20.11.25"
|
"@types/node": "npm:^20.11.25"
|
||||||
"@types/sinon": "npm:^17.0.3"
|
|
||||||
c8: "npm:^9.1.0"
|
c8: "npm:^9.1.0"
|
||||||
chai: "npm:^5.1.1"
|
|
||||||
eslint: "npm:^8.57.0"
|
eslint: "npm:^8.57.0"
|
||||||
eslint-config-discordeno: "npm:*"
|
eslint-config-discordeno: "npm:*"
|
||||||
mocha: "npm:^10.5.1"
|
mocha: "npm:^10.5.1"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -149,8 +145,7 @@ __metadata:
|
|||||||
sinon: "npm:^17.0.1"
|
sinon: "npm:^17.0.1"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
tweetnacl: "npm:^1.0.3"
|
typescript: "npm:^5.5.2"
|
||||||
typescript: "npm:5.4.5"
|
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -717,6 +712,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/node@npm:^20.14.7":
|
||||||
|
version: 20.14.7
|
||||||
|
resolution: "@types/node@npm:20.14.7"
|
||||||
|
dependencies:
|
||||||
|
undici-types: "npm:~5.26.4"
|
||||||
|
checksum: f2cb458126a136719d9da6febdbc7afc9bb622047a30c5e6163db4206ff8c8002ec56b340d722fe1ad6280ebe7a505e0a5a10a39a3b5718837200201b94d5d07
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/responselike@npm:^1.0.0":
|
"@types/responselike@npm:^1.0.0":
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
resolution: "@types/responselike@npm:1.0.0"
|
resolution: "@types/responselike@npm:1.0.0"
|
||||||
@@ -1310,9 +1314,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"benchmark@workspace:packages/benchmark":
|
"benchmarks@workspace:packages/benchmarks":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "benchmark@workspace:packages/benchmark"
|
resolution: "benchmarks@workspace:packages/benchmarks"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@discordeno/bot": "npm:19.0.0-beta.1"
|
"@discordeno/bot": "npm:19.0.0-beta.1"
|
||||||
"@discordeno/gateway": "npm:19.0.0-alpha.1"
|
"@discordeno/gateway": "npm:19.0.0-alpha.1"
|
||||||
@@ -1322,15 +1326,13 @@ __metadata:
|
|||||||
"@swc/cli": "npm:^0.3.9"
|
"@swc/cli": "npm:^0.3.9"
|
||||||
"@swc/core": "npm:^1.4.2"
|
"@swc/core": "npm:^1.4.2"
|
||||||
"@types/benchmark": "npm:^2.1.5"
|
"@types/benchmark": "npm:^2.1.5"
|
||||||
"@types/node": "npm:^20.11.25"
|
"@types/node": "npm:^20.14.7"
|
||||||
benchmark: "npm:^2.1.4"
|
benchmark: "npm:^2.1.4"
|
||||||
eslint: "npm:^8.57.0"
|
eslint: "npm:^8.57.0"
|
||||||
eslint-config-discordeno: "npm:*"
|
eslint-config-discordeno: "npm:*"
|
||||||
microtime: "npm:^3.1.1"
|
|
||||||
node-fetch: "npm:^3.3.2"
|
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -1869,13 +1871,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"data-uri-to-buffer@npm:^4.0.0":
|
|
||||||
version: 4.0.1
|
|
||||||
resolution: "data-uri-to-buffer@npm:4.0.1"
|
|
||||||
checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4":
|
"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4":
|
||||||
version: 4.3.4
|
version: 4.3.4
|
||||||
resolution: "debug@npm:4.3.4"
|
resolution: "debug@npm:4.3.4"
|
||||||
@@ -2069,9 +2064,9 @@ __metadata:
|
|||||||
lint-staged: "npm:^15.2.7"
|
lint-staged: "npm:^15.2.7"
|
||||||
prettier: "npm:^3.2.5"
|
prettier: "npm:^3.2.5"
|
||||||
turbo: "npm:^1.11.3"
|
turbo: "npm:^1.11.3"
|
||||||
typedoc: "npm:0.25.11"
|
typedoc: "npm:^0.25.13"
|
||||||
typedoc-plugin-markdown: "npm:3.17.1"
|
typedoc-plugin-markdown: "npm:3.17.1"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -2099,7 +2094,7 @@ __metadata:
|
|||||||
sinon: "npm:^17.0.1"
|
sinon: "npm:^17.0.1"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
bin:
|
bin:
|
||||||
discordeno: ./bin/disocrdeno.js
|
discordeno: ./bin/disocrdeno.js
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -2306,7 +2301,7 @@ __metadata:
|
|||||||
eslint-plugin-promise: "npm:^6.1.1"
|
eslint-plugin-promise: "npm:^6.1.1"
|
||||||
eslint-plugin-require-extensions: "npm:^0.1.3"
|
eslint-plugin-require-extensions: "npm:^0.1.3"
|
||||||
prettier: "npm:^3.2.5"
|
prettier: "npm:^3.2.5"
|
||||||
typescript: "npm:5.4.5"
|
typescript: "npm:^5.5.2"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -2751,16 +2746,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4":
|
|
||||||
version: 3.2.0
|
|
||||||
resolution: "fetch-blob@npm:3.2.0"
|
|
||||||
dependencies:
|
|
||||||
node-domexception: "npm:^1.0.0"
|
|
||||||
web-streams-polyfill: "npm:^3.0.3"
|
|
||||||
checksum: 5264ecceb5fdc19eb51d1d0359921f12730941e333019e673e71eb73921146dceabcb0b8f534582be4497312d656508a439ad0f5edeec2b29ab2e10c72a1f86b
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"file-entry-cache@npm:^6.0.1":
|
"file-entry-cache@npm:^6.0.1":
|
||||||
version: 6.0.1
|
version: 6.0.1
|
||||||
resolution: "file-entry-cache@npm:6.0.1"
|
resolution: "file-entry-cache@npm:6.0.1"
|
||||||
@@ -2881,15 +2866,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"formdata-polyfill@npm:^4.0.10":
|
|
||||||
version: 4.0.10
|
|
||||||
resolution: "formdata-polyfill@npm:4.0.10"
|
|
||||||
dependencies:
|
|
||||||
fetch-blob: "npm:^3.1.2"
|
|
||||||
checksum: 9b5001d2edef3c9449ac3f48bd4f8cc92e7d0f2e7c1a5c8ba555ad4e77535cc5cf621fabe49e97f304067037282dd9093b9160a3cb533e46420b446c4e6bc06f
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"fs-minipass@npm:^2.0.0, fs-minipass@npm:^2.1.0":
|
"fs-minipass@npm:^2.0.0, fs-minipass@npm:^2.1.0":
|
||||||
version: 2.1.0
|
version: 2.1.0
|
||||||
resolution: "fs-minipass@npm:2.1.0"
|
resolution: "fs-minipass@npm:2.1.0"
|
||||||
@@ -4172,17 +4148,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"microtime@npm:^3.1.1":
|
|
||||||
version: 3.1.1
|
|
||||||
resolution: "microtime@npm:3.1.1"
|
|
||||||
dependencies:
|
|
||||||
node-addon-api: "npm:^5.0.0"
|
|
||||||
node-gyp: "npm:latest"
|
|
||||||
node-gyp-build: "npm:^4.4.0"
|
|
||||||
checksum: 62c29ac611a10e5ce9696c6f1167ba9f7b7955db166828fafccec16f3b8121b358a5066dec160ae7c54187c85ef75253df589e44454685f1aaff4d85cb3a4e53
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"mime-db@npm:^1.28.0":
|
"mime-db@npm:^1.28.0":
|
||||||
version: 1.52.0
|
version: 1.52.0
|
||||||
resolution: "mime-db@npm:1.52.0"
|
resolution: "mime-db@npm:1.52.0"
|
||||||
@@ -4455,33 +4420,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"node-addon-api@npm:^5.0.0":
|
|
||||||
version: 5.1.0
|
|
||||||
resolution: "node-addon-api@npm:5.1.0"
|
|
||||||
dependencies:
|
|
||||||
node-gyp: "npm:latest"
|
|
||||||
checksum: 595f59ffb4630564f587c502119cbd980d302e482781021f3b479f5fc7e41cf8f2f7280fdc2795f32d148e4f3259bd15043c52d4a3442796aa6f1ae97b959636
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"node-domexception@npm:^1.0.0":
|
|
||||||
version: 1.0.0
|
|
||||||
resolution: "node-domexception@npm:1.0.0"
|
|
||||||
checksum: e332522f242348c511640c25a6fc7da4f30e09e580c70c6b13cb0be83c78c3e71c8d4665af2527e869fc96848924a4316ae7ec9014c091e2156f41739d4fa233
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"node-fetch@npm:^3.3.2":
|
|
||||||
version: 3.3.2
|
|
||||||
resolution: "node-fetch@npm:3.3.2"
|
|
||||||
dependencies:
|
|
||||||
data-uri-to-buffer: "npm:^4.0.0"
|
|
||||||
fetch-blob: "npm:^3.1.4"
|
|
||||||
formdata-polyfill: "npm:^4.0.10"
|
|
||||||
checksum: 24207ca8c81231c7c59151840e3fded461d67a31cf3e3b3968e12201a42f89ce4a0b5fb7079b1fa0a4655957b1ca9257553200f03a9f668b45ebad265ca5593d
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"node-gyp-build@npm:^4.2.2":
|
"node-gyp-build@npm:^4.2.2":
|
||||||
version: 4.8.0
|
version: 4.8.0
|
||||||
resolution: "node-gyp-build@npm:4.8.0"
|
resolution: "node-gyp-build@npm:4.8.0"
|
||||||
@@ -4493,17 +4431,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"node-gyp-build@npm:^4.4.0":
|
|
||||||
version: 4.6.0
|
|
||||||
resolution: "node-gyp-build@npm:4.6.0"
|
|
||||||
bin:
|
|
||||||
node-gyp-build: bin.js
|
|
||||||
node-gyp-build-optional: optional.js
|
|
||||||
node-gyp-build-test: build-test.js
|
|
||||||
checksum: c8b57abe5e6e4a28dce450e3c0136bcce88d15602c33f1258ed9c9a52f156d34a00dd8864271b2f2acfd6ef4de0af3e75e5e76e771c4bc4f38dd0ee06ad178d8
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"node-gyp@npm:latest":
|
"node-gyp@npm:latest":
|
||||||
version: 9.3.1
|
version: 9.3.1
|
||||||
resolution: "node-gyp@npm:9.3.1"
|
resolution: "node-gyp@npm:9.3.1"
|
||||||
@@ -5366,13 +5293,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"siginfo@npm:^2.0.0":
|
|
||||||
version: 2.0.0
|
|
||||||
resolution: "siginfo@npm:2.0.0"
|
|
||||||
checksum: e93ff66c6531a079af8fb217240df01f980155b5dc408d2d7bebc398dd284e383eb318153bf8acd4db3c4fe799aa5b9a641e38b0ba3b1975700b1c89547ea4e7
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7":
|
"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7":
|
||||||
version: 3.0.7
|
version: 3.0.7
|
||||||
resolution: "signal-exit@npm:3.0.7"
|
resolution: "signal-exit@npm:3.0.7"
|
||||||
@@ -5497,13 +5417,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"stackback@npm:0.0.2":
|
|
||||||
version: 0.0.2
|
|
||||||
resolution: "stackback@npm:0.0.2"
|
|
||||||
checksum: 2d4dc4e64e2db796de4a3c856d5943daccdfa3dd092e452a1ce059c81e9a9c29e0b9badba91b43ef0d5ff5c04ee62feb3bcc559a804e16faf447bac2d883aa99
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"string-argv@npm:~0.3.2":
|
"string-argv@npm:~0.3.2":
|
||||||
version: 0.3.2
|
version: 0.3.2
|
||||||
resolution: "string-argv@npm:0.3.2"
|
resolution: "string-argv@npm:0.3.2"
|
||||||
@@ -5919,13 +5832,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"tweetnacl@npm:^1.0.3":
|
|
||||||
version: 1.0.3
|
|
||||||
resolution: "tweetnacl@npm:1.0.3"
|
|
||||||
checksum: ca122c2f86631f3c0f6d28efb44af2a301d4a557a62a3e2460286b08e97567b258c2212e4ad1cfa22bd6a57edcdc54ba76ebe946847450ab0999e6d48ccae332
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
|
"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
|
||||||
version: 0.4.0
|
version: 0.4.0
|
||||||
resolution: "type-check@npm:0.4.0"
|
resolution: "type-check@npm:0.4.0"
|
||||||
@@ -6014,39 +5920,39 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"typedoc@npm:0.25.11":
|
"typedoc@npm:^0.25.13":
|
||||||
version: 0.25.11
|
version: 0.25.13
|
||||||
resolution: "typedoc@npm:0.25.11"
|
resolution: "typedoc@npm:0.25.13"
|
||||||
dependencies:
|
dependencies:
|
||||||
lunr: "npm:^2.3.9"
|
lunr: "npm:^2.3.9"
|
||||||
marked: "npm:^4.3.0"
|
marked: "npm:^4.3.0"
|
||||||
minimatch: "npm:^9.0.3"
|
minimatch: "npm:^9.0.3"
|
||||||
shiki: "npm:^0.14.7"
|
shiki: "npm:^0.14.7"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x
|
typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x
|
||||||
bin:
|
bin:
|
||||||
typedoc: bin/typedoc
|
typedoc: bin/typedoc
|
||||||
checksum: ec1f617c16b5fca455853c329a9958fe41b247d0c1a72dc153654fd5ce323f2ccdfd10ef1f3349d340398e3770a036381d856b90fda4aafe554640b53f5b2a1c
|
checksum: 3c82603894b5830c4b027b4f4f9ca70f770b6752c6512a42e780c40cb67fe4c9a144e34a837bb35aab14a125e00a5893e1e6feac1ec86a2add80f46833b279d4
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"typescript@npm:5.4.5":
|
"typescript@npm:^5.5.2":
|
||||||
version: 5.4.5
|
version: 5.5.2
|
||||||
resolution: "typescript@npm:5.4.5"
|
resolution: "typescript@npm:5.5.2"
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
tsserver: bin/tsserver
|
||||||
checksum: d04a9e27e6d83861f2126665aa8d84847e8ebabcea9125b9ebc30370b98cb38b5dff2508d74e2326a744938191a83a69aa9fddab41f193ffa43eabfdf3f190a5
|
checksum: 9118b20f248e76b0dbff8737fef65dfa89d02668d4e633d2c5ceac99033a0ca5e8a1c1a53bc94da68e8f67677a88f318663dde859c9e9a09c1e116415daec2ba
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>":
|
"typescript@patch:typescript@npm%3A^5.5.2#optional!builtin<compat/typescript>":
|
||||||
version: 5.4.5
|
version: 5.5.2
|
||||||
resolution: "typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>::version=5.4.5&hash=e012d7"
|
resolution: "typescript@patch:typescript@npm%3A5.5.2#optional!builtin<compat/typescript>::version=5.5.2&hash=e012d7"
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
tsserver: bin/tsserver
|
||||||
checksum: 584be8bac7112ad49a9eb9992f71d542b1ff2fafb5bb315e1c196145e8feab589f1d7223cfb2d5df6770789582e6918f8287d1f2f89911b38eb80e29c560ad00
|
checksum: 28b3de2ddaf63a7620e7ddbe5d377af71ce93ecc558c41bf0e3d88661d8e6e7aa6c7739164fef98055f69819e41faca49252938ef3633a3dff2734cca6a9042e
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -6158,13 +6064,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"web-streams-polyfill@npm:^3.0.3":
|
|
||||||
version: 3.2.1
|
|
||||||
resolution: "web-streams-polyfill@npm:3.2.1"
|
|
||||||
checksum: 08fcf97b7883c1511dd3da794f50e9bde75a660884783baaddb2163643c21a94086f394dc4bd20dff0f55c98d98d60c4bea05a5809ef5005bdf835b63ada8900
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"which-boxed-primitive@npm:^1.0.2":
|
"which-boxed-primitive@npm:^1.0.2":
|
||||||
version: 1.0.2
|
version: 1.0.2
|
||||||
resolution: "which-boxed-primitive@npm:1.0.2"
|
resolution: "which-boxed-primitive@npm:1.0.2"
|
||||||
@@ -6220,18 +6119,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"why-is-node-running@npm:^2.2.2":
|
|
||||||
version: 2.2.2
|
|
||||||
resolution: "why-is-node-running@npm:2.2.2"
|
|
||||||
dependencies:
|
|
||||||
siginfo: "npm:^2.0.0"
|
|
||||||
stackback: "npm:0.0.2"
|
|
||||||
bin:
|
|
||||||
why-is-node-running: cli.js
|
|
||||||
checksum: f3582e0337f4b25537d492b1d40f00b978ce04b1d1eeea8f310bfa8aae8a7d11d118d672e2f0760c164ce3753a620a70aa29ff3620e340197624940cf9c08615
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"wide-align@npm:^1.1.5":
|
"wide-align@npm:^1.1.5":
|
||||||
version: 1.1.5
|
version: 1.1.5
|
||||||
resolution: "wide-align@npm:1.1.5"
|
resolution: "wide-align@npm:1.1.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user