hubeau-api
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -42,27 +42,20 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var https_1 = __importDefault(require("https")); | ||
var superagent_1 = __importDefault(require("superagent")); | ||
var constants_1 = require("../constants"); | ||
function getRequest(entryPoint, args) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res, err_1; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
var options = { | ||
hostname: constants_1.hostname, | ||
path: "".concat(entryPoint).concat(args), | ||
port: 443, | ||
method: 'GET', | ||
}; | ||
var body = []; | ||
var req = https_1.default.request(options, function (res) { | ||
res.on('data', function (chunk) { return body.push(chunk); }); | ||
res.on('end', function () { | ||
var data = Buffer.concat(body).toString(); | ||
resolve(data); | ||
}); | ||
}); | ||
req.on('error', function (e) { | ||
reject(e); | ||
}); | ||
req.end(); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, superagent_1.default.get("https://".concat(constants_1.hostname).concat(entryPoint).concat(args))]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.text]; | ||
case 2: | ||
err_1 = _a.sent(); | ||
return [2 /*return*/, err_1.toString()]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -69,0 +62,0 @@ }); |
@@ -37,27 +37,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import https from 'https'; | ||
import superagent from 'superagent'; | ||
import { hostname } from '../constants'; | ||
function getRequest(entryPoint, args) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res, err_1; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
var options = { | ||
hostname: hostname, | ||
path: "".concat(entryPoint).concat(args), | ||
port: 443, | ||
method: 'GET', | ||
}; | ||
var body = []; | ||
var req = https.request(options, function (res) { | ||
res.on('data', function (chunk) { return body.push(chunk); }); | ||
res.on('end', function () { | ||
var data = Buffer.concat(body).toString(); | ||
resolve(data); | ||
}); | ||
}); | ||
req.on('error', function (e) { | ||
reject(e); | ||
}); | ||
req.end(); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, superagent.get("https://".concat(hostname).concat(entryPoint).concat(args))]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.text]; | ||
case 2: | ||
err_1 = _a.sent(); | ||
return [2 /*return*/, err_1.toString()]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -64,0 +57,0 @@ }); |
{ | ||
"name": "hubeau-api", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "hubeau api wrapper in javascript", | ||
@@ -49,3 +49,6 @@ "keywords": [ | ||
"license": "ISC", | ||
"dependencies": {} | ||
"dependencies": { | ||
"@types/superagent": "^4.1.13", | ||
"superagent": "^6.1.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import https from 'https'; | ||
import superagent from 'superagent'; | ||
import { hostname } from '../constants'; | ||
@@ -8,26 +8,10 @@ | ||
): Promise<string> { | ||
return new Promise((resolve, reject) => { | ||
const options = { | ||
hostname, | ||
path: `${entryPoint}${args}`, | ||
port: 443, | ||
method: 'GET', | ||
}; | ||
const body: Uint8Array[] = []; | ||
const req = https.request(options, res => { | ||
res.on('data', chunk => body.push(chunk)); | ||
res.on('end', () => { | ||
const data = Buffer.concat(body).toString(); | ||
resolve(data); | ||
}); | ||
}); | ||
req.on('error', e => { | ||
reject(e); | ||
}); | ||
req.end(); | ||
}); | ||
try { | ||
const res = await superagent.get(`https://${hostname}${entryPoint}${args}`); | ||
return res.text; | ||
} catch (err: any) { | ||
return err.toString(); | ||
} | ||
} | ||
export default getRequest; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
231882
2
4770
+ Added@types/superagent@^4.1.13
+ Addedsuperagent@^6.1.0
+ Added@types/cookiejar@2.1.5(transitive)
+ Added@types/node@22.9.3(transitive)
+ Added@types/superagent@4.1.24(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcookiejar@2.1.4(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedform-data@3.0.2(transitive)
+ Addedformidable@1.2.6(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@2.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.1.3(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedqs@6.13.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedsuperagent@6.1.0(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedutil-deprecate@1.0.2(transitive)