@sapphire/plugin-api
Advanced tools
Comparing version 3.0.0-next.9af3e85.0 to 3.0.0-next.9ffa2c1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./lib/structures/api/ApiRequest"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/api/ApiResponse"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/api/CookieStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/http/Auth"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/http/HttpCodes"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/http/HttpMethods"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/http/Server"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/MediaParser"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/MediaParserStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/Middleware"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/MiddlewareStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/Route"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/RouteStore"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/MimeTypes"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/RouteData"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/api/ApiRequest"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/api/ApiResponse"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/api/CookieStore"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/http/Auth"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/http/HttpCodes"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/http/HttpMethods"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/http/Server"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/MediaParser"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/MediaParserStore"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/Middleware"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/MiddlewareStore"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/Route"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/structures/RouteStore"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/utils/MimeTypes"), exports); | ||
(0, tslib_1.__exportStar)(require("./lib/utils/RouteData"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const psl_1 = tslib_1.__importDefault(require("psl")); | ||
const psl_1 = (0, tslib_1.__importDefault)(require("psl")); | ||
class CookieStore extends Map { | ||
@@ -10,0 +10,0 @@ constructor(request, response, secure, domainOverwrite) { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const crypto_1 = require("crypto"); | ||
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); | ||
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch")); | ||
class Auth { | ||
@@ -74,3 +74,3 @@ constructor(options) { | ||
this.redirect = options.redirect; | ||
tslib_1.__classPrivateFieldSet(this, _Auth_secret, options.secret, "f"); | ||
(0, tslib_1.__classPrivateFieldSet)(this, _Auth_secret, options.secret, "f"); | ||
this.transformers = options.transformers ?? []; | ||
@@ -84,3 +84,3 @@ this.domainOverwrite = options.domainOverwrite ?? null; | ||
get secret() { | ||
return tslib_1.__classPrivateFieldGet(this, _Auth_secret, "f"); | ||
return (0, tslib_1.__classPrivateFieldGet)(this, _Auth_secret, "f"); | ||
} | ||
@@ -94,4 +94,4 @@ /** | ||
encrypt(data) { | ||
const iv = crypto_1.randomBytes(16); | ||
const cipher = crypto_1.createCipheriv('aes-256-cbc', tslib_1.__classPrivateFieldGet(this, _Auth_secret, "f"), iv); | ||
const iv = (0, crypto_1.randomBytes)(16); | ||
const cipher = (0, crypto_1.createCipheriv)('aes-256-cbc', (0, tslib_1.__classPrivateFieldGet)(this, _Auth_secret, "f"), iv); | ||
return `${cipher.update(JSON.stringify(data), 'utf8', 'base64') + cipher.final('base64')}.${iv.toString('base64')}`; | ||
@@ -107,3 +107,3 @@ } | ||
const [data, iv] = token.split('.'); | ||
const decipher = crypto_1.createDecipheriv('aes-256-cbc', tslib_1.__classPrivateFieldGet(this, _Auth_secret, "f"), Buffer.from(iv, 'base64')); | ||
const decipher = (0, crypto_1.createDecipheriv)('aes-256-cbc', (0, tslib_1.__classPrivateFieldGet)(this, _Auth_secret, "f"), Buffer.from(iv, 'base64')); | ||
try { | ||
@@ -134,3 +134,3 @@ const parsed = JSON.parse(decipher.update(data, 'base64', 'utf8') + decipher.final('utf8')); | ||
const result = transformer(data); | ||
if (utilities_1.isThenable(result)) | ||
if ((0, utilities_1.isThenable)(result)) | ||
data = await result; | ||
@@ -145,3 +145,3 @@ else | ||
return undefined; | ||
const result = await node_fetch_1.default(url, { | ||
const result = await (0, node_fetch_1.default)(url, { | ||
headers: { | ||
@@ -148,0 +148,0 @@ authorization: `Bearer ${token}` |
@@ -96,3 +96,3 @@ "use strict"; | ||
this.options = options; | ||
this.server = http_1.createServer({ | ||
this.server = (0, http_1.createServer)({ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
@@ -99,0 +99,0 @@ IncomingMessage: ApiRequest_1.ApiRequest, |
@@ -59,3 +59,3 @@ "use strict"; | ||
case 'deflate': { | ||
const stream = zlib_1.createInflate(); | ||
const stream = (0, zlib_1.createInflate)(); | ||
request.pipe(stream); | ||
@@ -70,3 +70,3 @@ return stream; | ||
case 'gzip': { | ||
const stream = zlib_1.createGunzip(); | ||
const stream = (0, zlib_1.createGunzip)(); | ||
request.pipe(stream); | ||
@@ -79,3 +79,3 @@ return stream; | ||
case 'br': { | ||
const stream = zlib_1.createBrotliDecompress(); | ||
const stream = (0, zlib_1.createBrotliDecompress)(); | ||
request.pipe(stream); | ||
@@ -82,0 +82,0 @@ return stream; |
@@ -21,6 +21,6 @@ "use strict"; | ||
.register(this.server.middlewares); | ||
this.stores.get('listeners').registerPath(path_1.join(__dirname, 'listeners')); | ||
this.server.routes.registerPath(path_1.join(__dirname, 'routes')); | ||
this.server.middlewares.registerPath(path_1.join(__dirname, 'middlewares')); | ||
this.server.mediaParsers.registerPath(path_1.join(__dirname, 'mediaParsers')); | ||
this.stores.get('listeners').registerPath((0, path_1.join)(__dirname, 'listeners')); | ||
this.server.routes.registerPath((0, path_1.join)(__dirname, 'routes')); | ||
this.server.middlewares.registerPath((0, path_1.join)(__dirname, 'middlewares')); | ||
this.server.mediaParsers.registerPath((0, path_1.join)(__dirname, 'mediaParsers')); | ||
} | ||
@@ -27,0 +27,0 @@ /** |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); | ||
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch")); | ||
const querystring_1 = require("querystring"); | ||
@@ -59,5 +59,5 @@ require("../../lib/structures/http/HttpCodes"); | ||
}; | ||
const result = await node_fetch_1.default('https://discord.com/api/v8/oauth2/token', { | ||
const result = await (0, node_fetch_1.default)('https://discord.com/api/v8/oauth2/token', { | ||
method: 'POST', | ||
body: querystring_1.stringify(data), | ||
body: (0, querystring_1.stringify)(data), | ||
headers: { | ||
@@ -64,0 +64,0 @@ 'content-type': 'application/x-www-form-urlencoded' |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); | ||
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch")); | ||
const querystring_1 = require("querystring"); | ||
@@ -12,3 +12,3 @@ const util_1 = require("util"); | ||
const Route_1 = require("../../lib/structures/Route"); | ||
const sleep = util_1.promisify(setTimeout); | ||
const sleep = (0, util_1.promisify)(setTimeout); | ||
class PluginRoute extends Route_1.Route { | ||
@@ -74,5 +74,5 @@ constructor(context) { | ||
// The content of the response body is ignored by the client as all necessary information is conveyed in the response code. | ||
const result = await node_fetch_1.default('https://discord.com/api/v8/oauth2/token/revoke', { | ||
const result = await (0, node_fetch_1.default)('https://discord.com/api/v8/oauth2/token/revoke', { | ||
method: 'POST', | ||
body: querystring_1.stringify({ | ||
body: (0, querystring_1.stringify)({ | ||
token, | ||
@@ -79,0 +79,0 @@ /* eslint-disable @typescript-eslint/naming-convention */ |
{ | ||
"name": "@sapphire/plugin-api", | ||
"version": "3.0.0-next.9af3e85.0", | ||
"version": "3.0.0-next.9ffa2c1.0", | ||
"description": "Plugin for @sapphire/framework to expose a REST API", | ||
@@ -39,5 +39,5 @@ "author": "@sapphire", | ||
"@types/ws": "7.4.7", | ||
"node-fetch": "^2.6.1", | ||
"node-fetch": "^2.6.2", | ||
"psl": "^1.8.0", | ||
"tslib": "^2.3.0" | ||
"tslib": "^2.3.1" | ||
}, | ||
@@ -74,3 +74,3 @@ "repository": { | ||
}, | ||
"gitHead": "9af3e85a8641f852eaf114679ceed1e71034d16c" | ||
"gitHead": "9ffa2c170ede27cd4869217b3bfdd2e678a646a2" | ||
} |
@@ -34,3 +34,2 @@ <div align="center"> | ||
- [`@sapphire/framework`](https://www.npmjs.com/package/@sapphire/framework) | ||
- [`@sapphire/pieces v1.x`](https://www.npmjs.com/package/@sapphire/pieces/v/1.2.5) | ||
- [`discord.js`](https://www.npmjs.com/package/discord.js) | ||
@@ -42,3 +41,3 @@ - [`discord-api-types`](https://www.npmjs.com/package/discord-api-types) | ||
```sh | ||
npm install @sapphire/plugin-api @sapphire/framework @sapphire/pieces@1 discord.js discord-api-types | ||
npm install @sapphire/plugin-api @sapphire/framework discord.js discord-api-types | ||
``` | ||
@@ -135,2 +134,3 @@ | ||
<td align="center"><a href="https://github.com/PlatinBae"><img src="https://avatars.githubusercontent.com/u/50950966?v=4?s=100" width="100px;" alt=""/><br /><sub><b>PlatinBae</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=PlatinBae" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://kaname.netlify.app"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/plugins/commits?author=kaname-png" title="Code">π»</a> <a href="https://github.com/sapphiredev/plugins/commits?author=kaname-png" title="Documentation">π</a></td> | ||
</tr> | ||
@@ -137,0 +137,0 @@ </table> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199168
Updatednode-fetch@^2.6.2
Updatedtslib@^2.3.1