Comparing version 3.1.3 to 3.2.0
{ | ||
"name": "shoukaku", | ||
"version": "3.1.3", | ||
"version": "3.2.0", | ||
"description": "A stable and updated wrapper around Lavalink", | ||
@@ -42,4 +42,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"petitio": "^1.4.0", | ||
"ws": "^8.7.0" | ||
"undici": "^5.8.0", | ||
"ws": "^8.8.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "devDependencies": { |
export * from './DiscordJS'; | ||
export * from './Eris'; | ||
export * from './OceanicJS'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,2 +19,3 @@ "use strict"; | ||
__exportStar(require("./Eris"), exports); | ||
__exportStar(require("./OceanicJS"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -98,3 +98,3 @@ import { Node } from './Node'; | ||
* @param fetchOptions.endpoint Lavalink endpoint | ||
* @param fetchOptions.options Options passed to petitio | ||
* @param fetchOptions.options Options passed to fetch | ||
* @internal | ||
@@ -101,0 +101,0 @@ */ |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Rest = void 0; | ||
const petitio_1 = __importDefault(require("petitio")); | ||
const undici_1 = require("undici"); | ||
/** | ||
@@ -35,3 +32,3 @@ * Wrapper around Lavalink REST API | ||
}; | ||
return this.fetch(options); | ||
return await this.fetch(options); | ||
} | ||
@@ -48,3 +45,3 @@ /** | ||
}; | ||
return this.fetch(options); | ||
return await this.fetch(options); | ||
} | ||
@@ -61,3 +58,3 @@ /** | ||
}; | ||
return this.fetch(options); | ||
return await this.fetch(options); | ||
} | ||
@@ -78,3 +75,3 @@ /** | ||
}; | ||
return this.fetch(options); | ||
return await this.fetch(options); | ||
} | ||
@@ -84,3 +81,3 @@ /** | ||
* @param fetchOptions.endpoint Lavalink endpoint | ||
* @param fetchOptions.options Options passed to petitio | ||
* @param fetchOptions.options Options passed to fetch | ||
* @internal | ||
@@ -99,14 +96,19 @@ */ | ||
url.search = new URLSearchParams(options.params).toString(); | ||
const request = await (0, petitio_1.default)(url.toString()) | ||
.method(options.method?.toUpperCase() || 'GET') | ||
.header(headers) | ||
.body(options.body ?? {}) | ||
.timeout(this.node.manager.options.restTimeout || 15000) | ||
.send(); | ||
if (request.statusCode && (request.statusCode >= 400)) | ||
throw new Error(`Rest request failed with response code: ${request.statusCode}`); | ||
const body = request.body.toString('utf8'); | ||
if (!body?.length) | ||
const abortController = new AbortController(); | ||
const timeout = setTimeout(() => abortController.abort(), this.node.manager.options.restTimeout || 15000); | ||
const request = await (0, undici_1.fetch)(url.toString(), { | ||
method: options.method?.toUpperCase() || 'GET', | ||
headers: { ...headers, ...options.headers }, | ||
...((['GET', 'HEAD'].includes(options.method?.toUpperCase() || 'GET')) && options.body ? { body: JSON.stringify(options.body ?? {}) } : {}), | ||
signal: abortController.signal | ||
}); | ||
clearTimeout(timeout); | ||
if (request.status && (request.status >= 400)) | ||
throw new Error(`Rest request failed with response code: ${request.status}`); | ||
if (!request.body) | ||
return null; | ||
return JSON.parse(body); | ||
const body = await request.json().catch(() => null); | ||
if (!body) | ||
return null; | ||
return body; | ||
} | ||
@@ -113,0 +115,0 @@ } |
{ | ||
"name": "shoukaku", | ||
"version": "3.1.3", | ||
"version": "3.2.0", | ||
"description": "A stable and updated wrapper around Lavalink", | ||
@@ -42,4 +42,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"petitio": "^1.4.0", | ||
"ws": "^8.7.0" | ||
"undici": "^5.8.0", | ||
"ws": "^8.8.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "devDependencies": { |
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
161968
61
2539
+ Addedundici@^5.8.0
+ Added@fastify/busboy@2.1.1(transitive)
+ Addedundici@5.28.4(transitive)
- Removedpetitio@^1.4.0
- Removedpetitio@1.4.0(transitive)
Updatedws@^8.8.1