From 544331d550bc5d858d7a89122f7e3aee9db02220 Mon Sep 17 00:00:00 2001 From: izzy Date: Fri, 4 Apr 2025 15:15:24 +0100 Subject: [PATCH] chore: switch to ESM-only & drop Axios dependency --- .github/workflows/build_and_publish.yml | 14 +- .gitignore | 4 +- nodemon.json | 10 - package.json | 27 +- pnpm-lock.yaml | 115 +++++ src/index.ts | 543 ++++++++++++++---------- src/schema.ts | 25 +- tsconfig.esm.json | 75 ---- tsconfig.json | 84 +--- yarn.lock | 114 ----- 10 files changed, 484 insertions(+), 527 deletions(-) delete mode 100644 nodemon.json create mode 100644 pnpm-lock.yaml delete mode 100644 tsconfig.esm.json delete mode 100644 yarn.lock diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index cdd188d..c382d9c 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -11,18 +11,16 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Use Node.js 18 + - uses: pnpm/action-setup@v4 + - name: Use Node.js LTS uses: actions/setup-node@v3 with: - node-version: 18.x - cache: "yarn" - - uses: pnpm/action-setup@v4 - with: - version: 7 + node-version: 22.x + cache: "pnpm" - name: Install packages - run: yarn install + run: pnpm install - name: Build package - run: yarn build + run: pnpm build - name: Commit changes uses: EndBug/add-and-commit@v9 with: diff --git a/.gitignore b/.gitignore index fd0b663..b5c6689 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ __temp.ts node_modules *.old -dist -out -esm +lib diff --git a/nodemon.json b/nodemon.json deleted file mode 100644 index c8850ec..0000000 --- a/nodemon.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json", - "watch": [ - "**/*.ts" - ], - "ext": "ts", - "ignore": [ - "__temp.ts" - ] -} \ No newline at end of file diff --git a/package.json b/package.json index fe86970..37e936c 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,23 @@ { "name": "revolt-api", - "version": "0.8.4", + "version": "0.8.4-rc.1", "description": "Revolt API Library", - "main": "dist/index.js", - "module": "esm/index.js", + "type": "module", + "module": "lib/index.js", + "types": "lib/index.d.ts", "homepage": "https://developers.revolt.chat", "repository": "https://github.com/revoltchat/api.git", "author": "Paul Makles ", "license": "MIT", "scripts": { - "build": "REWRITE_ANYOF=1 oapilib && tsc && tsc -p tsconfig.esm.json", - "prepublish": "in-publish && yarn build || echo Skipping build." + "build": "REWRITE_ANYOF=1 oapilib && tsc", + "prepublish": "in-publish && pnpm build || echo Skipping build." }, "devDependencies": { - "@insertish/oapi": "0.1.18", - "@types/lodash.defaultsdeep": "^4.6.6", + "@insertish/oapi": "0.2.0", "in-publish": "^2.0.1", - "openapi-typescript": "^5.2.0", - "typescript": "^4.6.2" - }, - "dependencies": { - "axios": "^0.26.1", - "lodash.defaultsdeep": "^4.6.1" + "openapi-typescript": "^5.4.2", + "typescript": "^5.8.2" }, "files": [ "src", @@ -30,5 +26,6 @@ "OpenAPI.json", "LICENSE", "README.md" - ] -} + ], + "packageManager": "pnpm@8.13.1+sha512.758bebc6989cb6462c5138129840193b10c258ddcdb0ab43ee0ef9dd87784bc218d6e41cb5beeac362b8ce33f1f8b08025b599933c0bce82050a9a36b8474d43" +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..deccee9 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,115 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +devDependencies: + '@insertish/oapi': + specifier: 0.2.0 + version: 0.2.0 + in-publish: + specifier: ^2.0.1 + version: 2.0.1 + openapi-typescript: + specifier: ^5.4.2 + version: 5.4.2 + typescript: + specifier: ^5.8.2 + version: 5.8.2 + +packages: + + /@fastify/busboy@2.1.1: + resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} + engines: {node: '>=14'} + dev: true + + /@insertish/oapi@0.2.0: + resolution: {integrity: sha512-pV+D4YvlixA7MhhsJ1BW1ATk3r5hI1xC42y+QpZ9MLzlK8fDfhpbgLDIjh3c+9J8ETw9MJmwNI3aollx/PUMkQ==} + hasBin: true + dependencies: + typescript: 4.9.5 + optionalDependencies: + openapi-typescript: 5.4.2 + dev: true + + /argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true + + /globalyzer@0.1.0: + resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} + dev: true + + /globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + dev: true + + /in-publish@2.0.1: + resolution: {integrity: sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==} + hasBin: true + dev: true + + /js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + dependencies: + argparse: 2.0.1 + dev: true + + /mime@3.0.0: + resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} + engines: {node: '>=10.0.0'} + hasBin: true + dev: true + + /openapi-typescript@5.4.2: + resolution: {integrity: sha512-tHeRv39Yh7brqJpbUntdjtUaXrTHmC4saoyTLU/0J2I8LEFQYDXRLgnmWTMiMOB2GXugJiqHa5n9sAyd6BRqiA==} + engines: {node: '>= 14.0.0'} + hasBin: true + dependencies: + js-yaml: 4.1.0 + mime: 3.0.0 + prettier: 2.8.8 + tiny-glob: 0.2.9 + undici: 5.29.0 + yargs-parser: 21.1.1 + dev: true + + /prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + dev: true + + /tiny-glob@0.2.9: + resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==} + dependencies: + globalyzer: 0.1.0 + globrex: 0.1.2 + dev: true + + /typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + + /typescript@5.8.2: + resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /undici@5.29.0: + resolution: {integrity: sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==} + engines: {node: '>=14.0'} + dependencies: + '@fastify/busboy': 2.1.1 + dev: true + + /yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: true diff --git a/src/index.ts b/src/index.ts index 450783d..37a5667 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,26 +1,27 @@ // This file was auto-generated by @insertish/oapi! -import Axios from 'axios'; -import type { AxiosRequestConfig } from 'axios'; +import type { APIRoutes } from "./routes.js"; -import defaultsDeep from 'lodash.defaultsdeep'; +export * from "./types.js"; -export * from './types'; -import type { APIRoutes } from './routes'; +import { defaultBaseURL } from "./baseURL.js"; +import { pathResolve, queryParams } from "./params.js"; -import { defaultBaseURL } from './baseURL'; -import { pathResolve, queryParams } from './params'; - -type Methods = APIRoutes['method']; +type Methods = APIRoutes["method"]; type PickRoutes = APIRoutes & { method: Method }; -type GetRoutes = PickRoutes<'get'>; -type PatchRoutes = PickRoutes<'patch'>; -type PutRoutes = PickRoutes<'put'>; -type DeleteRoutes = PickRoutes<'delete'>; -type PostRoutes = PickRoutes<'post'>; +type GetRoutes = PickRoutes<"get">; +type PatchRoutes = PickRoutes<"patch">; +type PutRoutes = PickRoutes<"put">; +type DeleteRoutes = PickRoutes<"delete">; +type PostRoutes = PickRoutes<"post">; -type Count = - Str extends `${infer _}${SubStr}${infer After}` ? Count : Matches['length']; +type Count< + Str extends string, + SubStr extends string, + Matches extends null[] = [] +> = Str extends `${infer _}${SubStr}${infer After}` + ? Count + : Matches["length"]; /** * Get the specific path name of any given path. @@ -28,244 +29,338 @@ type Count)[(segments.length - 1).toString()] || []; - for (const entry of list) { - let i = 1; - let copy = [...segments]; - for (i;i)[ + (segments.length - 1).toString() + ] || []; + for (const entry of list) { + let i = 1; + let copy = [...segments]; + for (i; i < segments.length; i++) { + if (Array.isArray(entry[i - 1])) { + copy[i] = entry[i - 1]; + continue; + } else if (entry[i - 1] !== segments[i]) break; } + + if (i === segments.length) return copy.join("/"); + } } /** * Client configuration options */ - export interface Options { - /** - * Base URL of the Revolt node - */ - baseURL: string; - /** - * Authentication used for requests - */ - authentication: { - rauth?: string | undefined; - revolt?: { token: string } | string | undefined; - }; +export interface Options { + /** + * Base URL of the Revolt node + */ + baseURL: string; + /** + * Additional headers to apply to requests + */ + headers?: Record; + /** + * Authentication used for requests + */ + authentication: { + rauth?: string | undefined; + revolt?: { token: string } | string | undefined; + headers?: Record; + }; +} + +/** + * Request options + */ +export interface RequestOptions { + /** + * The base URL used for this request + */ + baseURL?: string; + /** + * The type of response given + */ + responseType?: "blob" | "json" | "text" | "arrayBuffer"; + /** + * Headers to apply for this request + */ + headers?: Record; } /** * API Client */ export class API { - private baseURL: Options['baseURL']; - private authentication: Options['authentication']; + private baseURL: Options["baseURL"]; + private authentication: Options["authentication"]; + private headers: Options["headers"]; - constructor({ baseURL, authentication }: Partial = { }) { - this.baseURL = baseURL || defaultBaseURL; - this.authentication = authentication || { }; - } + constructor({ baseURL, authentication, headers }: Partial = {}) { + this.baseURL = baseURL || defaultBaseURL; + this.authentication = authentication || {}; + this.headers = headers || {}; + } - /** - * Generate authentication options. - */ - get auth(): AxiosRequestConfig { - if (this.authentication.rauth) { - if (typeof this.authentication.rauth === 'string') { - return { - headers: { - 'X-Session-Token': this.authentication.rauth - } - } - } - } else if (this.authentication.revolt) { - switch (typeof this.authentication.revolt) { - case 'string': { - return { - headers: { - 'X-Bot-Token': this.authentication.revolt - } - } - } - case 'object': { - return { - headers: { - 'X-Session-Token': this.authentication.revolt.token - } - } - } - } - } - - return { }; - } - - /** - * Generate config to pass through to API. - */ - get config(): AxiosRequestConfig { + /** + * Generate authentication options. + */ + get auth(): RequestOptions { + if (this.authentication.rauth) { + if (typeof this.authentication.rauth === "string") { return { - baseURL: this.baseURL, - ...this.auth, + headers: { + "X-Session-Token": this.authentication.rauth, + }, }; - } - - /** - * Send any arbitrary request. - * @param method HTTP Method - * @param path Path - * @param params Body or Query Parameters - * @param config Axios configuration - * @returns Typed Response Data - */ - req, Path extends Routes['path'], Route extends Routes & { path: Path, parts: Count }>(method: Method, path: Path, params: Route['params'], config?: AxiosRequestConfig): Promise { - let query, body; - let named = getPathName(path); - - // If we are aware of this route, then match the parameters given. - if (named && typeof params === 'object') { - const route = queryParams[named as keyof typeof queryParams]; - const allowed_query = (route as unknown as Record)[method]; - - // Map each parameter to the correct object. - for (const parameter of Object.keys(params)) { - if (allowed_query?.includes(parameter)) { - query = { - ...(query || {}), - [parameter]: (params as Record)[parameter] - }; - } else { - body = { - ...(body || {}), - [parameter]: (params as Record)[parameter] - }; - } - } + } + } else if (this.authentication.revolt) { + switch (typeof this.authentication.revolt) { + case "string": { + return { + headers: { + "X-Bot-Token": this.authentication.revolt, + }, + }; } - - return Axios(path, defaultsDeep({ - method, - params: query, - data: body - }, defaultsDeep( - config, - this.config - ))) - .then(res => res.data); + case "object": { + return { + headers: { + "X-Session-Token": this.authentication.revolt.token, + }, + }; + } + } + } else if (this.authentication.headers) { + return { headers: this.authentication.headers }; } - /** - * Send HTTP GET request. - * @param path Path - * @param params Body or Query Parameters - * @param config Axios configuration - * @returns Typed Response Data - */ - get }>(path: Path, params: Route['params'], config?: AxiosRequestConfig): Promise; + return {}; + } - /** - * Send HTTP GET request. - * @param path Path - * @returns Typed Response Data - */ - get }>(path: Path): Promise; + /** + * Generate config to pass through to API. + */ + get config(): RequestOptions { + return { + baseURL: this.baseURL, + ...this.auth, + headers: this.headers, + }; + } - get(path: any, params?: any, config?: AxiosRequestConfig): Promise { - // @ts-ignore-next-line - return this.req('get', path, params, config); + /** + * Send any arbitrary request. + * @param method HTTP Method + * @param path Path + * @param params Body or Query Parameters + * @param config Request configuration + * @returns Typed Response Data + */ + async req< + Method extends Methods, + Routes extends PickRoutes, + Path extends Routes["path"], + Route extends Routes & { path: Path; parts: Count } + >( + method: Method, + path: Path, + params: Route["params"], + config?: RequestOptions + ): Promise { + let query = new URLSearchParams(); + let body = {} as Record; + let named = getPathName(path); + + // If we are aware of this route, then match the parameters given. + if (named && typeof params === "object") { + const route = queryParams[named as keyof typeof queryParams]; + const allowed_query = (route as unknown as Record)[ + method + ]; + // Map each parameter to the correct object. + for (const parameter of Object.keys(params)) { + if (allowed_query?.includes(parameter)) { + query.append(parameter, (params as Record)[parameter]); + } else { + body[parameter] = (params as Record)[parameter]; + } + } } + const passbody = ["head", "get"].includes(method) + ? undefined + : JSON.stringify(body); + const fetchdata = await fetch( + new URL( + `${path}?${query.toString()}`, + config?.baseURL || this.baseURL + ).toString(), + { + method, + headers: { + ...(config?.headers || {}), + ...(this.config.headers || {}), + } as HeadersInit, + body: passbody, + } + ); + return await fetchdata[config?.responseType || "json"](); + } - /** - * Send HTTP PATCH request. - * @param path Path - * @param params Body or Query Parameters - * @param config Axios configuration - * @returns Typed Response Data - */ - patch }>(path: Path, params: Route['params'], config?: AxiosRequestConfig): Promise; + /** + * Send HTTP GET request. + * @param path Path + * @param params Body or Query Parameters + * @param config Axios configuration + * @returns Typed Response Data + */ + get< + Path extends GetRoutes["path"], + Route extends GetRoutes & { path: Path; parts: Count } + >( + path: Path, + params: Route["params"], + config?: RequestOptions + ): Promise; - /** - * Send HTTP PATCH request. - * @param path Path - * @returns Typed Response Data - */ - patch }>(path: Path): Promise; + /** + * Send HTTP GET request. + * @param path Path + * @returns Typed Response Data + */ + get< + Path extends (GetRoutes & { params: undefined })["path"], + Route extends GetRoutes & { path: Path; parts: Count } + >(path: Path): Promise; - patch(path: any, params?: any, config?: AxiosRequestConfig): Promise { - // @ts-ignore-next-line - return this.req('patch', path, params, config); - } + get(path: any, params?: any, config?: RequestOptions): Promise { + // @ts-ignore-next-line + return this.req("get", path, params, config); + } - /** - * Send HTTP PUT request. - * @param path Path - * @param params Body or Query Parameters - * @param config Axios configuration - * @returns Typed Response Data - */ - put }>(path: Path, params: Route['params'], config?: AxiosRequestConfig): Promise; - - /** - * Send HTTP PUT request. - * @param path Path - * @returns Typed Response Data - */ - put }>(path: Path): Promise; + /** + * Send HTTP PATCH request. + * @param path Path + * @param params Body or Query Parameters + * @param config Axios configuration + * @returns Typed Response Data + */ + patch< + Path extends PatchRoutes["path"], + Route extends PatchRoutes & { path: Path; parts: Count } + >( + path: Path, + params: Route["params"], + config?: RequestOptions + ): Promise; - put(path: any, params?: any, config?: AxiosRequestConfig): Promise { - // @ts-ignore-next-line - return this.req('put', path, params, config); - } + /** + * Send HTTP PATCH request. + * @param path Path + * @returns Typed Response Data + */ + patch< + Path extends (PatchRoutes & { params: undefined })["path"], + Route extends PatchRoutes & { path: Path; parts: Count } + >(path: Path): Promise; - /** - * Send HTTP DELETE request. - * @param path Path - * @param params Body or Query Parameters - * @param config Axios configuration - * @returns Typed Response Data - */ - delete }>(path: Path, params?: any, config?: AxiosRequestConfig): Promise; - - /** - * Send HTTP DELETE request. - * @param path Path - * @param params Body or Query Parameters - * @returns Typed Response Data - */ - delete }>(path: Path, params?: any): Promise; + patch(path: any, params?: any, config?: RequestOptions): Promise { + // @ts-ignore-next-line + return this.req("patch", path, params, config); + } - delete(path: any, params?: any, config?: AxiosRequestConfig): Promise { - // @ts-ignore-next-line - return this.req('delete', path, params, config); - } + /** + * Send HTTP PUT request. + * @param path Path + * @param params Body or Query Parameters + * @param config Axios configuration + * @returns Typed Response Data + */ + put< + Path extends PutRoutes["path"], + Route extends PutRoutes & { path: Path; parts: Count } + >( + path: Path, + params: Route["params"], + config?: RequestOptions + ): Promise; - /** - * Send HTTP POST request. - * @param path Path - * @param params Body or Query Parameters - * @param config Axios configuration - * @returns Typed Response Data - */ - post }>(path: Path, params: Route['params'], config?: AxiosRequestConfig): Promise; - - /** - * Send HTTP POST request. - * @param path Path - * @returns Typed Response Data - */ - post }>(path: Path): Promise; + /** + * Send HTTP PUT request. + * @param path Path + * @returns Typed Response Data + */ + put< + Path extends (PutRoutes & { params: undefined })["path"], + Route extends PutRoutes & { path: Path; parts: Count } + >(path: Path): Promise; - post(path: any, params?: any, config?: AxiosRequestConfig): Promise { - // @ts-ignore-next-line - return this.req('post', path, params, config); - } + put(path: any, params?: any, config?: RequestOptions): Promise { + // @ts-ignore-next-line + return this.req("put", path, params, config); + } + + /** + * Send HTTP DELETE request. + * @param path Path + * @param params Body or Query Parameters + * @param config Axios configuration + * @returns Typed Response Data + */ + delete< + Path extends DeleteRoutes["path"], + Route extends DeleteRoutes & { path: Path; parts: Count } + >( + path: Path, + params?: any, + config?: RequestOptions + ): Promise; + + /** + * Send HTTP DELETE request. + * @param path Path + * @param params Body or Query Parameters + * @returns Typed Response Data + */ + delete< + Path extends (DeleteRoutes & { params: undefined })["path"], + Route extends DeleteRoutes & { path: Path; parts: Count } + >(path: Path, params?: any): Promise; + + delete(path: any, params?: any, config?: RequestOptions): Promise { + // @ts-ignore-next-line + return this.req("delete", path, params, config); + } + + /** + * Send HTTP POST request. + * @param path Path + * @param params Body or Query Parameters + * @param config Axios configuration + * @returns Typed Response Data + */ + post< + Path extends PostRoutes["path"], + Route extends PostRoutes & { path: Path; parts: Count } + >( + path: Path, + params: Route["params"], + config?: RequestOptions + ): Promise; + + /** + * Send HTTP POST request. + * @param path Path + * @returns Typed Response Data + */ + post< + Path extends (PostRoutes & { params: undefined })["path"], + Route extends PostRoutes & { path: Path; parts: Count } + >(path: Path): Promise; + + post(path: any, params?: any, config?: RequestOptions): Promise { + // @ts-ignore-next-line + return this.req("post", path, params, config); + } } diff --git a/src/schema.ts b/src/schema.ts index 74ef49e..4584e76 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -1278,7 +1278,10 @@ export interface components { nsfw?: boolean | null; /** @description Whether this channel is archived */ archived?: boolean | null; - /** @description Fields to remove from channel */ + /** + * @description Fields to remove from channel + * @default null + */ remove?: components["schemas"]["FieldsChannel"][] | null; }; /** @@ -1794,7 +1797,7 @@ export interface components { * @description Array of user IDs to add to the group * * Must be friends with these users. - * @default + * @default [] */ users?: string[]; /** @description Whether this group is age-restricted */ @@ -1944,6 +1947,7 @@ export interface components { /** * Format: int64 * @description Ranking of this role + * @default 0 */ rank?: number; }; @@ -2281,14 +2285,20 @@ export interface components { name: string; /** @description Parent information */ parent: components["schemas"]["EmojiParent"]; - /** @description Whether the emoji is mature */ + /** + * @description Whether the emoji is mature + * @default false + */ nsfw?: boolean; }; /** Report Data */ DataReportContent: { /** @description Content being reported */ content: components["schemas"]["ReportedContent"]; - /** @description Additional report description */ + /** + * @description Additional report description + * @default + */ additional_context?: string; }; /** @description The content being reported */ @@ -2511,7 +2521,10 @@ export interface components { token: string; /** @description New password */ password: string; - /** @description Whether to logout all sessions */ + /** + * @description Whether to logout all sessions + * @default false + */ remove_sessions?: boolean; }; /** Reset Information */ @@ -2660,7 +2673,7 @@ export interface components { permissions?: number | null; /** * @description Fields to remove from webhook - * @default + * @default [] */ remove?: components["schemas"]["FieldsWebhook"][]; }; diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index 6c19af4..0000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./esm", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - }, - "include": [ - "src/**/*" - ] -} diff --git a/tsconfig.json b/tsconfig.json index 4880e06..a39ec41 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,75 +1,15 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "es2016", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "CommonJS", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./dist", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - }, - "include": [ - "src/**/*" - ] + "target": "ES2022", + "module": "ES6", + "moduleResolution": "node", + "rootDir": "./src", + "declaration": true, + "declarationMap": true, + "outDir": "./lib", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true + } } diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 2329710..0000000 --- a/yarn.lock +++ /dev/null @@ -1,114 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@insertish/oapi@0.1.18": - version "0.1.18" - resolved "https://registry.yarnpkg.com/@insertish/oapi/-/oapi-0.1.18.tgz#3544d021fbfe8cbe8ad4080860f1bcc97f21d0c1" - integrity sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA== - dependencies: - typescript "^4.6.2" - optionalDependencies: - axios "^0.26.1" - openapi-typescript "^5.2.0" - -"@types/lodash.defaultsdeep@^4.6.6": - version "4.6.6" - resolved "https://registry.yarnpkg.com/@types/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.6.tgz#d2e87c07ec8d0361e4b79aa000815732b210be04" - integrity sha512-k3bXTg1/54Obm6uFEtSwvDm2vCyK9jSROv0V9X3gFFNPu7eKmvqqadPSXx0SkVVixSilR30BxhFlnIj8OavXOA== - dependencies: - "@types/lodash" "*" - -"@types/lodash@*": - version "4.14.180" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.180.tgz#4ab7c9ddfc92ec4a887886483bc14c79fb380670" - integrity sha512-XOKXa1KIxtNXgASAnwj7cnttJxS4fksBRywK/9LzRV5YxrF80BXZIGeQSuoESQ/VkUj30Ae0+YcuHc15wJCB2g== - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -axios@^0.26.1: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - -follow-redirects@^1.14.8: - version "1.14.9" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" - integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== - -globalyzer@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.0.tgz#cb76da79555669a1519d5a8edf093afaa0bf1465" - integrity sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q== - -globrex@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" - integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== - -in-publish@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.1.tgz#948b1a535c8030561cea522f73f78f4be357e00c" - integrity sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ== - -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -lodash.defaultsdeep@^4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6" - integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA== - -mime@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7" - integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== - -openapi-typescript@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/openapi-typescript/-/openapi-typescript-5.2.0.tgz#c0712d7a17e4502ac083162c42f946c0e966a505" - integrity sha512-EGoPTmxrpiN40R6An5Wqol2l74sRb773pv/KXWYCQaMCXNtMGN7Jv+y/jY4B1Bd4hsIW2j9GFmQXxqfGmOXaxA== - dependencies: - js-yaml "^4.1.0" - mime "^3.0.0" - prettier "^2.5.1" - tiny-glob "^0.2.9" - undici "^4.14.1" - yargs-parser "^21.0.0" - -prettier@^2.5.1: - version "2.6.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4" - integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A== - -tiny-glob@^0.2.9: - version "0.2.9" - resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2" - integrity sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg== - dependencies: - globalyzer "0.1.0" - globrex "^0.1.2" - -typescript@^4.6.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4" - integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg== - -undici@^4.14.1: - version "4.16.0" - resolved "https://registry.yarnpkg.com/undici/-/undici-4.16.0.tgz#469bb87b3b918818d3d7843d91a1d08da357d5ff" - integrity sha512-tkZSECUYi+/T1i4u+4+lwZmQgLXd4BLGlrc7KZPcLIW7Jpq99+Xpc30ONv7nS6F5UNOxp/HBZSSL9MafUrvJbw== - -yargs-parser@^21.0.0: - version "21.0.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35" - integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==