Comparing version 0.0.3 to 0.0.4
77
index.js
@@ -1,1 +0,76 @@ | ||
module.exports = function (options) {}; | ||
"use strict"; | ||
var tslib_1 = require("tslib"); | ||
var fs = require("fs"); | ||
var superagent = require("superagent"); | ||
var LoadmillClient = (function () { | ||
function LoadmillClient(token) { | ||
var _this = this; | ||
this.token = token; | ||
this.run = function (config, paramsOrCallback) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var testId; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
config = toConfig(config, paramsOrCallback); | ||
return [4 /*yield*/, this._auth(superagent.post("https://www.loadmill.com/api/tests") | ||
.send(config))]; | ||
case 1: | ||
testId = (_a.sent()).body.testId; | ||
return [4 /*yield*/, this._auth(superagent.put("https://www.loadmill.com/api/tests/" + testId + "/load"))]; | ||
case 2: | ||
_a.sent(); | ||
return [2 /*return*/, testId]; | ||
} | ||
}); | ||
}); }; | ||
this.runFunctional = function (config, paramsOrCallback) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var _a, id, trialResult, incompleteMessage; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
config = toConfig(config, paramsOrCallback); | ||
return [4 /*yield*/, this._auth(superagent.post("https://www.loadmill.com/api/tests/trials") | ||
.send(config))]; | ||
case 1: | ||
_a = (_b.sent()).body, id = _a.id, trialResult = _a.trialResult, incompleteMessage = _a.incompleteMessage; | ||
if (incompleteMessage) { | ||
throw Error(incompleteMessage); | ||
} | ||
else { | ||
return [2 /*return*/, { | ||
id: id, | ||
url: "https://www.loadmill.com/app/functional/" + id, | ||
passed: trialResult && Object.keys(trialResult.failures || {}).length === 0 | ||
}]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
this._auth = function (req) { return req.auth(_this.token, ''); }; | ||
} | ||
return LoadmillClient; | ||
}()); | ||
function toConfig(config, paramsOrCallback) { | ||
if (typeof config === 'string') { | ||
var text = fs.readFileSync(config).toString(); | ||
config = JSON.parse(text); | ||
} | ||
if (typeof paramsOrCallback === 'object' && paramsOrCallback != null) { | ||
var parameters = config.parameters; | ||
if (!parameters) { | ||
config.parameters = paramsOrCallback; | ||
} | ||
else if (typeof parameters.push === 'function') { | ||
parameters.push(paramsOrCallback); | ||
} | ||
else { | ||
config.parameters = [parameters, paramsOrCallback]; | ||
} | ||
} | ||
return config; | ||
} | ||
module.exports = function (_a) { | ||
var token = _a.token; | ||
return new LoadmillClient(token); | ||
}; |
{ | ||
"name": "loadmill", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A node.js module for running load tests and functional tests on loadmill.com", | ||
@@ -15,3 +15,14 @@ "keywords": [ | ||
"author": "itaysabato <itay@loadmill.com>", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"scripts": { | ||
"postinstall": "tsc" | ||
}, | ||
"dependencies": { | ||
"superagent": "^3.5.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^8.0.10", | ||
"tslib": "^1.7.1", | ||
"typescript": "^2.4.1" | ||
} | ||
} |
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
10131
6
152
0
1
3
1
2
+ Addedsuperagent@^3.5.2
+ 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)
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddebug@3.2.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)
+ Addedextend@3.0.2(transitive)
+ Addedform-data@2.5.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)
+ Addedisarray@1.0.0(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@1.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)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedqs@6.13.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedsuperagent@3.8.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)