Compare commits
98 Commits
Author | SHA1 | Date | |
---|---|---|---|
36472b7306 | |||
e86f14b8d8 | |||
2b9e7f6dd2 | |||
5e4afccf9c | |||
3de7a1a210 | |||
bd2a5eedff | |||
aa18357d75 | |||
9960aff219 | |||
03d884ed59 | |||
9a0ac6fc62 | |||
ad35ea4eb8 | |||
ffb0195f04 | |||
78737c24df | |||
6e276eda00 | |||
021d26a23a | |||
c9c8a1234c | |||
dffabd905f | |||
36f2707141 | |||
b00d674b6f | |||
b09598d465 | |||
acc7b2d46f | |||
16a97a420c | |||
a73c78e54b | |||
1f408b5123 | |||
284f4967f4 | |||
55c80c1403 | |||
7a3e565dbb | |||
6f5d10ccd3 | |||
f1ddab72f6 | |||
376225888c | |||
63e8660f6c | |||
2358b1d48f | |||
9db29bacc2 | |||
5f27b6834c | |||
6717ecf80c | |||
7784f99878 | |||
54a0521f9e | |||
ef25315d59 | |||
74b6bf230f | |||
fe693e6383 | |||
6014e94ee0 | |||
88927fa6f8 | |||
e8133247f7 | |||
4e51ed315e | |||
0ffc44b3ef | |||
a8291febec | |||
c0704eb2d8 | |||
9eeb9c16b6 | |||
52bf520eb9 | |||
c9f6198114 | |||
0a17591eae | |||
3417f09cdb | |||
20dc3c9230 | |||
6f865a356f | |||
71a6ffef96 | |||
189916e62b | |||
33e36b5d44 | |||
dbe999eea7 | |||
31b326cf51 | |||
0c03763281 | |||
21e85062f7 | |||
33670bb4d5 | |||
6893e1f460 | |||
3a1943417b | |||
8e6834da02 | |||
7d78890e14 | |||
5c413947a4 | |||
5de63a1ef3 | |||
ee7fa87b25 | |||
4b65674fb2 | |||
14f48c99d0 | |||
e9f1d5697f | |||
b4a9d1aa0c | |||
d77d2b13da | |||
aaa2394b36 | |||
99efccd827 | |||
b1cfca5f35 | |||
ca4ef6d5c0 | |||
a7516c86e6 | |||
abece86511 | |||
8eca91145b | |||
d7a9d173b8 | |||
fcef5fcb6c | |||
93595a222b | |||
5f8b5f7690 | |||
980ea344e7 | |||
9c69fb6c1c | |||
fe33cfdeaa | |||
f0c74b1568 | |||
a6920b18d4 | |||
85a647cd10 | |||
df48a06d3e | |||
52fa217fda | |||
97bbb8b38b | |||
8c941fe1b7 | |||
b821ca60cc | |||
06c945ad0f | |||
48d839b9b9 |
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,4 +1,22 @@
|
|||||||
node_modules/
|
.nogit/
|
||||||
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_web/
|
||||||
|
dist_serve/
|
||||||
|
dist_ts_web/
|
||||||
|
|
||||||
|
# custom
|
110
.gitlab-ci.yml
110
.gitlab-ci.yml
@ -1,71 +1,119 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .yarn/
|
- .npmci_cache/
|
||||||
key: "$CI_BUILD_STAGE"
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- trigger
|
- metadata
|
||||||
- pages
|
|
||||||
|
|
||||||
testLEGACY:
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
|
mirror:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci git mirror
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
snyk:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install -g snyk
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command snyk test
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# test stage
|
||||||
|
# ====================
|
||||||
|
|
||||||
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci npm prepare
|
||||||
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
- priv
|
||||||
|
|
||||||
testLTS:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci npm prepare
|
||||||
|
- npmci node install lts
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
testSTABLE:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci test stable
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci node install lts
|
||||||
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# metadata stage
|
||||||
|
# ====================
|
||||||
|
codequality:
|
||||||
|
stage: metadata
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- npmci command npm install -g tslint typescript
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: trigger
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-dbase:npmci
|
||||||
stage: pages
|
services:
|
||||||
|
- docker:stable-dind
|
||||||
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command yarn global add npmpage
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
- npmci command npmpage
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
37
README.md
37
README.md
@ -1,24 +1,23 @@
|
|||||||
# smartrequest
|
# @pushrocks/smartrequest
|
||||||
dropin replacement for request
|
dropin replacement for request
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty and Links
|
||||||
[](https://www.npmjs.com/package/smartrequest)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartrequest)
|
||||||
[](https://GitLab.com/pushrocks/smartrequest)
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartrequest)
|
||||||
[](https://github.com/pushrocks/smartrequest)
|
* [github.com (source mirror)](https://github.com/pushrocks/smartrequest)
|
||||||
[](https://pushrocks.gitlab.io/smartrequest/)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/smartrequest/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://GitLab.com/pushrocks/smartrequest/commits/master)
|
[](https://gitlab.com/pushrocks/smartrequest/commits/master)
|
||||||
[](https://GitLab.com/pushrocks/smartrequest/commits/master)
|
[](https://gitlab.com/pushrocks/smartrequest/commits/master)
|
||||||
[](https://www.npmjs.com/package/smartrequest)
|
[](https://www.npmjs.com/package/@pushrocks/smartrequest)
|
||||||
[](https://david-dm.org/pushrocks/smartrequest)
|
[](https://snyk.io/test/npm/@pushrocks/smartrequest)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartrequest/master/dependencies/npm)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartrequest)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
[](https://prettier.io/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
> note: smartrequest uses the **native** node request module under the hood (not the one from npm)
|
> note: smartrequest uses the **native** node request module under the hood (not the one from npm)
|
||||||
@ -60,7 +59,11 @@ smartrequest.get('https://example.com/bigfile.mp4', optionsArg, true).then(res =
|
|||||||
// do something when things have ended
|
// do something when things have ended
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[](https://push.rocks)
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
||||||
|
7
dist/index.d.ts
vendored
7
dist/index.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
import * as interfaces from './smartrequest.interfaces';
|
|
||||||
export { request } from './smartrequest.request';
|
|
||||||
export { ISmartRequestOptions } from './smartrequest.interfaces';
|
|
||||||
export declare let get: (domainArg: string, optionsArg?: interfaces.ISmartRequestOptions) => Promise<Response>;
|
|
||||||
export declare let post: (domainArg: string, optionsArg?: interfaces.ISmartRequestOptions) => Promise<Response>;
|
|
||||||
export declare let put: (domainArg: string, optionsArg?: interfaces.ISmartRequestOptions) => Promise<Response>;
|
|
||||||
export declare let del: (domainArg: string, optionsArg?: interfaces.ISmartRequestOptions) => Promise<Response>;
|
|
34
dist/index.js
vendored
34
dist/index.js
vendored
@ -1,34 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const smartrequest_request_1 = require("./smartrequest.request");
|
|
||||||
var smartrequest_request_2 = require("./smartrequest.request");
|
|
||||||
exports.request = smartrequest_request_2.request;
|
|
||||||
exports.get = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
optionsArg.method = 'GET';
|
|
||||||
let response = yield smartrequest_request_1.request(domainArg, optionsArg);
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
exports.post = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
optionsArg.method = 'POST';
|
|
||||||
let response = yield smartrequest_request_1.request(domainArg, optionsArg);
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
exports.put = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
optionsArg.method = 'PUT';
|
|
||||||
let response = yield smartrequest_request_1.request(domainArg, optionsArg);
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
exports.del = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
optionsArg.method = 'DELETE';
|
|
||||||
let response = yield smartrequest_request_1.request(domainArg, optionsArg);
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBS0EsaUVBQWdEO0FBRWhELCtEQUFnRDtBQUF2Qyx5Q0FBQSxPQUFPLENBQUE7QUFHTCxRQUFBLEdBQUcsR0FBRyxDQUFPLFNBQWlCLEVBQUUsYUFBOEMsRUFBRTtJQUN6RixVQUFVLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQTtJQUN6QixJQUFJLFFBQVEsR0FBRyxNQUFNLDhCQUFPLENBQUMsU0FBUyxFQUFFLFVBQVUsQ0FBQyxDQUFBO0lBQ25ELE1BQU0sQ0FBQyxRQUFRLENBQUE7QUFDakIsQ0FBQyxDQUFBLENBQUE7QUFFVSxRQUFBLElBQUksR0FBRyxDQUFPLFNBQWlCLEVBQUUsYUFBOEMsRUFBRTtJQUMxRixVQUFVLENBQUMsTUFBTSxHQUFHLE1BQU0sQ0FBQTtJQUMxQixJQUFJLFFBQVEsR0FBRyxNQUFNLDhCQUFPLENBQUMsU0FBUyxFQUFFLFVBQVUsQ0FBQyxDQUFBO0lBQ25ELE1BQU0sQ0FBQyxRQUFRLENBQUE7QUFDakIsQ0FBQyxDQUFBLENBQUE7QUFFVSxRQUFBLEdBQUcsR0FBRyxDQUFPLFNBQWlCLEVBQUUsYUFBOEMsRUFBRTtJQUN6RixVQUFVLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQTtJQUN6QixJQUFJLFFBQVEsR0FBRyxNQUFNLDhCQUFPLENBQUMsU0FBUyxFQUFFLFVBQVUsQ0FBQyxDQUFBO0lBQ25ELE1BQU0sQ0FBQyxRQUFRLENBQUE7QUFDakIsQ0FBQyxDQUFBLENBQUE7QUFFVSxRQUFBLEdBQUcsR0FBRyxDQUFPLFNBQWlCLEVBQUUsYUFBOEMsRUFBRTtJQUN6RixVQUFVLENBQUMsTUFBTSxHQUFHLFFBQVEsQ0FBQTtJQUM1QixJQUFJLFFBQVEsR0FBRyxNQUFNLDhCQUFPLENBQUMsU0FBUyxFQUFFLFVBQVUsQ0FBQyxDQUFBO0lBQ25ELE1BQU0sQ0FBQyxRQUFRLENBQUE7QUFDakIsQ0FBQyxDQUFBLENBQUEifQ==
|
|
4
dist/smartrequest.interfaces.d.ts
vendored
4
dist/smartrequest.interfaces.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
import * as https from 'https';
|
|
||||||
export interface ISmartRequestOptions extends https.RequestOptions {
|
|
||||||
requestBody?: any;
|
|
||||||
}
|
|
3
dist/smartrequest.interfaces.js
vendored
3
dist/smartrequest.interfaces.js
vendored
@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRyZXF1ZXN0LmludGVyZmFjZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHJlcXVlc3QuaW50ZXJmYWNlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
|
|
6
dist/smartrequest.plugins.d.ts
vendored
6
dist/smartrequest.plugins.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
import 'typings-global';
|
|
||||||
import * as url from 'url';
|
|
||||||
import * as http from 'http';
|
|
||||||
import * as https from 'https';
|
|
||||||
import * as q from 'smartq';
|
|
||||||
export { url, http, https, q };
|
|
12
dist/smartrequest.plugins.js
vendored
12
dist/smartrequest.plugins.js
vendored
@ -1,12 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
require("typings-global");
|
|
||||||
const url = require("url");
|
|
||||||
exports.url = url;
|
|
||||||
const http = require("http");
|
|
||||||
exports.http = http;
|
|
||||||
const https = require("https");
|
|
||||||
exports.https = https;
|
|
||||||
const q = require("smartq");
|
|
||||||
exports.q = q;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRyZXF1ZXN0LnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHJlcXVlc3QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QiwyQkFBMEI7QUFPeEIsa0JBQUc7QUFOTCw2QkFBNEI7QUFPMUIsb0JBQUk7QUFOTiwrQkFBOEI7QUFPNUIsc0JBQUs7QUFMUCw0QkFBMkI7QUFNekIsY0FBQyJ9
|
|
2
dist/smartrequest.request.d.ts
vendored
2
dist/smartrequest.request.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
import * as interfaces from './smartrequest.interfaces';
|
|
||||||
export declare let request: (domainArg: string, optionsArg?: interfaces.ISmartRequestOptions, streamArg?: boolean) => Promise<Response>;
|
|
86
dist/smartrequest.request.js
vendored
86
dist/smartrequest.request.js
vendored
@ -1,86 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const plugins = require("./smartrequest.plugins");
|
|
||||||
let buildResponse = (responseArg) => {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
// Continuously update stream with data
|
|
||||||
let body = '';
|
|
||||||
responseArg.on('data', function (chunkArg) {
|
|
||||||
body += chunkArg;
|
|
||||||
});
|
|
||||||
responseArg.on('end', function () {
|
|
||||||
try {
|
|
||||||
responseArg.body = JSON.parse(body);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
responseArg.body = body;
|
|
||||||
}
|
|
||||||
done.resolve(responseArg);
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
exports.request = (domainArg, optionsArg = {}, streamArg = false) => __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
let parsedUrl;
|
|
||||||
if (domainArg) {
|
|
||||||
parsedUrl = plugins.url.parse(domainArg);
|
|
||||||
optionsArg.hostname = parsedUrl.hostname;
|
|
||||||
if (parsedUrl.port) {
|
|
||||||
optionsArg.port = parseInt(parsedUrl.port);
|
|
||||||
}
|
|
||||||
optionsArg.path = parsedUrl.path;
|
|
||||||
}
|
|
||||||
if (!parsedUrl || parsedUrl.protocol === 'https:') {
|
|
||||||
let request = plugins.https.request(optionsArg, response => {
|
|
||||||
if (streamArg) {
|
|
||||||
done.resolve(response);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buildResponse(response).then(done.resolve);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (optionsArg.requestBody) {
|
|
||||||
if (typeof optionsArg.requestBody !== 'string') {
|
|
||||||
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody);
|
|
||||||
}
|
|
||||||
request.write(optionsArg.requestBody);
|
|
||||||
}
|
|
||||||
request.on('error', (e) => {
|
|
||||||
console.error(e);
|
|
||||||
});
|
|
||||||
request.end();
|
|
||||||
}
|
|
||||||
else if (parsedUrl.protocol === 'http:') {
|
|
||||||
let request = plugins.http.request(optionsArg, response => {
|
|
||||||
if (streamArg) {
|
|
||||||
done.resolve(response);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buildResponse(response).then(done.resolve);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (optionsArg.requestBody) {
|
|
||||||
if (typeof optionsArg.requestBody !== 'string') {
|
|
||||||
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody);
|
|
||||||
}
|
|
||||||
request.write(optionsArg.requestBody);
|
|
||||||
}
|
|
||||||
request.on('error', (e) => {
|
|
||||||
console.error(e);
|
|
||||||
});
|
|
||||||
request.end();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`unsupported protocol: ${parsedUrl.protocol}`);
|
|
||||||
}
|
|
||||||
return done.promise;
|
|
||||||
});
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRyZXF1ZXN0LnJlcXVlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHJlcXVlc3QucmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQ0Esa0RBQWlEO0FBR2pELElBQUksYUFBYSxHQUFHLENBQUMsV0FBVztJQUM5QixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFBO0lBQzVCLHVDQUF1QztJQUN2QyxJQUFJLElBQUksR0FBRyxFQUFFLENBQUE7SUFDYixXQUFXLENBQUMsRUFBRSxDQUFDLE1BQU0sRUFBRSxVQUFVLFFBQVE7UUFDdkMsSUFBSSxJQUFJLFFBQVEsQ0FBQTtJQUNsQixDQUFDLENBQUMsQ0FBQTtJQUNGLFdBQVcsQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFO1FBQ3BCLElBQUksQ0FBQztZQUNILFdBQVcsQ0FBQyxJQUFJLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUNyQyxDQUFDO1FBQUMsS0FBSyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztZQUNiLFdBQVcsQ0FBQyxJQUFJLEdBQUcsSUFBSSxDQUFBO1FBQ3pCLENBQUM7UUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFBO0lBQzNCLENBQUMsQ0FBQyxDQUFBO0lBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDckIsQ0FBQyxDQUFBO0FBRVUsUUFBQSxPQUFPLEdBQUcsQ0FBTyxTQUFpQixFQUFFLGFBQThDLEVBQUUsRUFBRSxZQUFxQixLQUFLO0lBQ3pILElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFPLENBQUE7SUFDakMsSUFBSSxTQUEwQixDQUFBO0lBQzlCLEVBQUUsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7UUFDZCxTQUFTLEdBQUcsT0FBTyxDQUFD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
|
|
@ -1,7 +1,19 @@
|
|||||||
{
|
{
|
||||||
|
"npmts": {
|
||||||
|
"coverageTreshold": 50
|
||||||
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"globalNpmTools": [
|
"npmGlobalTools": [],
|
||||||
"npmts"
|
"npmAccessLevel": "public"
|
||||||
]
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "smartrequest",
|
||||||
|
"shortDescription": "dropin replacement for request",
|
||||||
|
"npmPackagename": "@pushrocks/smartrequest",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
1720
package-lock.json
generated
Normal file
1720
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "smartrequest",
|
"name": "@pushrocks/smartrequest",
|
||||||
"version": "1.0.6",
|
"version": "1.1.35",
|
||||||
|
"private": false,
|
||||||
"description": "dropin replacement for request",
|
"description": "dropin replacement for request",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -21,11 +23,29 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartrequest#README",
|
"homepage": "https://gitlab.com/pushrocks/smartrequest#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"smartq": "^1.1.1",
|
"@pushrocks/smartpromise": "^3.0.5",
|
||||||
"typings-global": "^1.0.17"
|
"@types/form-data": "^2.5.0",
|
||||||
|
"agentkeepalive": "^4.0.2",
|
||||||
|
"form-data": "^2.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tapbundle": "^1.0.14",
|
"@gitzone/tsbuild": "^2.1.17",
|
||||||
"typings-test": "^1.0.3"
|
"@gitzone/tsrun": "^1.2.8",
|
||||||
}
|
"@gitzone/tstest": "^1.0.24",
|
||||||
|
"@pushrocks/tapbundle": "^3.0.13",
|
||||||
|
"@types/node": "^12.7.8",
|
||||||
|
"tslint": "^5.20.0",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/*",
|
||||||
|
"ts_web/*",
|
||||||
|
"dist/*",
|
||||||
|
"dist_web/*",
|
||||||
|
"dist_ts_web/*",
|
||||||
|
"assets/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
import 'typings-test';
|
|
18
test/test.js
18
test/test.js
@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-test");
|
|
||||||
const smartchai_1 = require("smartchai");
|
|
||||||
const smartrequest = require("../dist/index");
|
|
||||||
describe('smartrequest', function () {
|
|
||||||
it('should request a html document over https', function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
return smartchai_1.expect(smartrequest.get('https://encrypted.google.com/')).to.eventually.property('body').be.a('string');
|
|
||||||
});
|
|
||||||
it('should request a JSON document over https', function () {
|
|
||||||
return smartchai_1.expect(smartrequest.get('https://jsonplaceholder.typicode.com/posts/1')).to.eventually.property('body').property('id').equal(1);
|
|
||||||
});
|
|
||||||
it('should post a JSON document over http', function () {
|
|
||||||
this.timeout(5000);
|
|
||||||
return smartchai_1.expect(smartrequest.post('http://md5.jsontest.com/?text=example_text')).to.eventually.property('body').property('md5').equal('fa4c6baa0812e5b5c80ed8885e55a8a6');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUVyQix5Q0FBa0M7QUFFbEMsOENBQTZDO0FBRTdDLFFBQVEsQ0FBQyxjQUFjLEVBQUU7SUFDckIsRUFBRSxDQUFDLDJDQUEyQyxFQUFFO1FBQzVDLElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUE7UUFDbkIsTUFBTSxDQUFDLGtCQUFNLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQywrQkFBK0IsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsQ0FBQTtJQUNsSCxDQUFDLENBQUMsQ0FBQTtJQUVGLEVBQUUsQ0FBQywyQ0FBMkMsRUFBRTtRQUM1QyxNQUFNLENBQUMsa0JBQU0sQ0FBQyxZQUFZLENBQUMsR0FBRyxDQUFDLDhDQUE4QyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQzFJLENBQUMsQ0FBQyxDQUFBO0lBRUYsRUFBRSxDQUFDLHVDQUF1QyxFQUFFO1FBQ3hDLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDbEIsTUFBTSxDQUFDLGtCQUFNLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyw0Q0FBNEMsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDLEtBQUssQ0FBQyxrQ0FBa0MsQ0FBQyxDQUFBO0lBQzNLLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
|
57
test/test.ts
57
test/test.ts
@ -1,25 +1,46 @@
|
|||||||
import 'typings-test'
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import { tap, expect } from 'tapbundle'
|
import * as smartrequest from '../ts/index';
|
||||||
|
|
||||||
import * as smartrequest from '../dist/index'
|
|
||||||
|
|
||||||
tap.test('should request a html document over https', async () => {
|
tap.test('should request a html document over https', async () => {
|
||||||
await expect(
|
await expect(smartrequest.getJson('https://encrypted.google.com/'))
|
||||||
smartrequest.get('https://encrypted.google.com/')
|
.to.eventually.property('body')
|
||||||
).to.eventually.property('body').be.a('string')
|
.be.a('string');
|
||||||
})
|
await expect(smartrequest.getJson('https://encrypted.google.com/'))
|
||||||
|
.to.eventually.property('body')
|
||||||
|
.be.a('string');
|
||||||
|
await expect(smartrequest.getJson('https://encrypted.google.com/'))
|
||||||
|
.to.eventually.property('body')
|
||||||
|
.be.a('string');
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('should request a JSON document over https', async () => {
|
tap.test('should request a JSON document over https', async () => {
|
||||||
await expect(
|
await expect(smartrequest.getJson('https://jsonplaceholder.typicode.com/posts/1'))
|
||||||
smartrequest.get('https://jsonplaceholder.typicode.com/posts/1')
|
.to.eventually.property('body')
|
||||||
).to.eventually.property('body').property('id').equal(1)
|
.property('id')
|
||||||
})
|
.equal(1);
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('should post a JSON document over http', async () => {
|
tap.skip.test('should post a JSON document over http', async () => {
|
||||||
await expect(
|
await expect(smartrequest.postJson('http://md5.jsontest.com/?text=example_text'))
|
||||||
smartrequest.post('http://md5.jsontest.com/?text=example_text')
|
.to.eventually.property('body')
|
||||||
).to.eventually.property('body').property('md5').equal('fa4c6baa0812e5b5c80ed8885e55a8a6')
|
.property('md5')
|
||||||
})
|
.equal('fa4c6baa0812e5b5c80ed8885e55a8a6');
|
||||||
|
});
|
||||||
|
|
||||||
tap.start()
|
tap.skip.test('should deal with unix socks', async () => {
|
||||||
|
const socketResponse = await smartrequest.request(
|
||||||
|
'http://unix:/var/run/docker.sock:/containers/json',
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Host: 'docker.sock'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log(socketResponse.body);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.skip.test('should correctly upload a file using formData', async () => {});
|
||||||
|
|
||||||
|
tap.start();
|
||||||
|
37
ts/index.ts
37
ts/index.ts
@ -1,33 +1,6 @@
|
|||||||
import * as https from 'https'
|
export { request, IExtendedIncomingMessage } from './smartrequest.request';
|
||||||
|
export { ISmartRequestOptions } from './smartrequest.interfaces';
|
||||||
|
|
||||||
import * as plugins from './smartrequest.plugins'
|
export * from './smartrequest.jsonrest';
|
||||||
import * as interfaces from './smartrequest.interfaces'
|
export * from './smartrequest.binaryrest';
|
||||||
|
export * from './smartrequest.formdata';
|
||||||
import { request } from './smartrequest.request'
|
|
||||||
|
|
||||||
export { request } from './smartrequest.request'
|
|
||||||
export { ISmartRequestOptions } from './smartrequest.interfaces'
|
|
||||||
|
|
||||||
export let get = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
|
||||||
optionsArg.method = 'GET'
|
|
||||||
let response = await request(domainArg, optionsArg)
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
|
|
||||||
export let post = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
|
||||||
optionsArg.method = 'POST'
|
|
||||||
let response = await request(domainArg, optionsArg)
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
|
|
||||||
export let put = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
|
||||||
optionsArg.method = 'PUT'
|
|
||||||
let response = await request(domainArg, optionsArg)
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
|
|
||||||
export let del = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
|
|
||||||
optionsArg.method = 'DELETE'
|
|
||||||
let response = await request(domainArg, optionsArg)
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
|
29
ts/smartrequest.binaryrest.ts
Normal file
29
ts/smartrequest.binaryrest.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// this file implements methods to get and post binary data.
|
||||||
|
import * as interfaces from './smartrequest.interfaces';
|
||||||
|
import { request } from './smartrequest.request';
|
||||||
|
|
||||||
|
import * as plugins from './smartrequest.plugins';
|
||||||
|
|
||||||
|
export const getBinary = async (
|
||||||
|
domainArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {}
|
||||||
|
) => {
|
||||||
|
const done = plugins.smartpromise.defer();
|
||||||
|
const response = await request(domainArg, optionsArg, true);
|
||||||
|
const data = [];
|
||||||
|
|
||||||
|
response
|
||||||
|
.on('data', function(chunk) {
|
||||||
|
data.push(chunk);
|
||||||
|
})
|
||||||
|
.on('end', function() {
|
||||||
|
//at this point data is an array of Buffers
|
||||||
|
//so Buffer.concat() can make us a new Buffer
|
||||||
|
//of all of them together
|
||||||
|
const buffer = Buffer.concat(data);
|
||||||
|
response.body = buffer.toString('binary');
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
await done.promise;
|
||||||
|
return response;
|
||||||
|
};
|
44
ts/smartrequest.formdata.ts
Normal file
44
ts/smartrequest.formdata.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import * as plugins from './smartrequest.plugins';
|
||||||
|
import * as interfaces from './smartrequest.interfaces';
|
||||||
|
import { request } from './smartrequest.request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the interfae for FormFieldData
|
||||||
|
*/
|
||||||
|
export interface IFormField {
|
||||||
|
name: string;
|
||||||
|
type: 'string' | 'filePath' | 'Buffer';
|
||||||
|
payload: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const appendFormField = async (formDataArg: plugins.formData, formDataField: IFormField) => {
|
||||||
|
if (formDataField.type === 'filePath') {
|
||||||
|
const fileData = plugins.fs.readFileSync(plugins.path.join(process.cwd(), formDataField.payload));
|
||||||
|
formDataArg.append('file', fileData, {
|
||||||
|
filename: 'upload.pdf',
|
||||||
|
contentType: 'application/pdf'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const postFormData = async (
|
||||||
|
urlArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {},
|
||||||
|
payloadArg: IFormField[]
|
||||||
|
) => {
|
||||||
|
const form = new plugins.formData();
|
||||||
|
for (const formField of payloadArg) {
|
||||||
|
await appendFormField(form, formField);
|
||||||
|
}
|
||||||
|
const requestOptions = {...optionsArg,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
...optionsArg.headers,
|
||||||
|
...form.getHeaders()
|
||||||
|
},
|
||||||
|
requestBody: form};
|
||||||
|
|
||||||
|
// lets fire the actual request for sending the formdata
|
||||||
|
const response = await request(urlArg, requestOptions);
|
||||||
|
return response;
|
||||||
|
};
|
@ -1,6 +1,8 @@
|
|||||||
import * as plugins from './smartrequest.plugins'
|
import * as plugins from './smartrequest.plugins';
|
||||||
import * as https from 'https'
|
import * as https from 'https';
|
||||||
|
|
||||||
export interface ISmartRequestOptions extends https.RequestOptions {
|
export interface ISmartRequestOptions extends https.RequestOptions {
|
||||||
requestBody?: any
|
keepAlive?: boolean;
|
||||||
|
requestBody?: any;
|
||||||
|
autoJsonParse?: boolean;
|
||||||
}
|
}
|
||||||
|
63
ts/smartrequest.jsonrest.ts
Normal file
63
ts/smartrequest.jsonrest.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// This file implements methods to get and post JSON in a simple manner.
|
||||||
|
|
||||||
|
import * as interfaces from './smartrequest.interfaces';
|
||||||
|
import { request } from './smartrequest.request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets Json and puts the right headers + handles response aggregation
|
||||||
|
* @param domainArg
|
||||||
|
* @param optionsArg
|
||||||
|
*/
|
||||||
|
export const getJson = async (
|
||||||
|
domainArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {}
|
||||||
|
) => {
|
||||||
|
optionsArg.method = 'GET';
|
||||||
|
optionsArg.headers = {
|
||||||
|
...optionsArg.headers
|
||||||
|
};
|
||||||
|
let response = await request(domainArg, optionsArg);
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const postJson = async (
|
||||||
|
domainArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {}
|
||||||
|
) => {
|
||||||
|
optionsArg.method = 'POST';
|
||||||
|
if (
|
||||||
|
typeof optionsArg.requestBody === 'object' &&
|
||||||
|
(!optionsArg.headers || !optionsArg.headers['Content-Type'])
|
||||||
|
) {
|
||||||
|
// make sure headers exist
|
||||||
|
if (!optionsArg.headers) {
|
||||||
|
optionsArg.headers = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// assign the right Content-Type, leaving all other headers in place
|
||||||
|
optionsArg.headers = {
|
||||||
|
...optionsArg.headers,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
let response = await request(domainArg, optionsArg);
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const putJson = async (
|
||||||
|
domainArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {}
|
||||||
|
) => {
|
||||||
|
optionsArg.method = 'PUT';
|
||||||
|
let response = await request(domainArg, optionsArg);
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const delJson = async (
|
||||||
|
domainArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {}
|
||||||
|
) => {
|
||||||
|
optionsArg.method = 'DELETE';
|
||||||
|
let response = await request(domainArg, optionsArg);
|
||||||
|
return response;
|
||||||
|
};
|
@ -1,13 +1,17 @@
|
|||||||
import 'typings-global'
|
import formData from 'form-data';
|
||||||
import * as url from 'url'
|
import * as fs from 'fs';
|
||||||
import * as http from 'http'
|
import * as http from 'http';
|
||||||
import * as https from 'https'
|
import * as https from 'https';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as url from 'url';
|
||||||
|
|
||||||
import * as q from 'smartq'
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
export { formData, http, https, fs, path, url, smartpromise };
|
||||||
|
|
||||||
|
// third party scope
|
||||||
|
import * as agentkeepalive from 'agentkeepalive';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
url,
|
agentkeepalive
|
||||||
http,
|
};
|
||||||
https,
|
|
||||||
q
|
|
||||||
}
|
|
||||||
|
@ -1,72 +1,176 @@
|
|||||||
import * as https from 'https'
|
import * as plugins from './smartrequest.plugins';
|
||||||
import * as plugins from './smartrequest.plugins'
|
import * as interfaces from './smartrequest.interfaces';
|
||||||
import * as interfaces from './smartrequest.interfaces'
|
|
||||||
|
|
||||||
let buildResponse = (responseArg): Promise<any> => {
|
import { IncomingMessage } from 'http';
|
||||||
let done = plugins.q.defer()
|
|
||||||
|
export interface IExtendedIncomingMessage extends IncomingMessage {
|
||||||
|
body: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildUtf8Response = (
|
||||||
|
incomingMessageArg: IncomingMessage,
|
||||||
|
autoJsonParse = true
|
||||||
|
): Promise<IExtendedIncomingMessage> => {
|
||||||
|
const done = plugins.smartpromise.defer<IExtendedIncomingMessage>();
|
||||||
// Continuously update stream with data
|
// Continuously update stream with data
|
||||||
let body = ''
|
let body = '';
|
||||||
responseArg.on('data', function (chunkArg) {
|
incomingMessageArg.on('data', chunkArg => {
|
||||||
body += chunkArg
|
body += chunkArg;
|
||||||
})
|
});
|
||||||
responseArg.on('end', function () {
|
|
||||||
try {
|
|
||||||
responseArg.body = JSON.parse(body)
|
|
||||||
} catch (err) {
|
|
||||||
responseArg.body = body
|
|
||||||
}
|
|
||||||
done.resolve(responseArg)
|
|
||||||
})
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
export let request = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}, streamArg: boolean = false): Promise<Response> => {
|
incomingMessageArg.on('end', () => {
|
||||||
let done = plugins.q.defer<any>()
|
if (autoJsonParse) {
|
||||||
let parsedUrl: plugins.url.Url
|
try {
|
||||||
if (domainArg) {
|
(incomingMessageArg as IExtendedIncomingMessage).body = JSON.parse(body);
|
||||||
parsedUrl = plugins.url.parse(domainArg)
|
} catch (err) {
|
||||||
optionsArg.hostname = parsedUrl.hostname
|
(incomingMessageArg as IExtendedIncomingMessage).body = body;
|
||||||
if (parsedUrl.port) { optionsArg.port = parseInt(parsedUrl.port) }
|
}
|
||||||
optionsArg.path = parsedUrl.path
|
} else {
|
||||||
|
(incomingMessageArg as IExtendedIncomingMessage).body = body;
|
||||||
|
}
|
||||||
|
done.resolve(incomingMessageArg as IExtendedIncomingMessage);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determine wether a url is a unix sock
|
||||||
|
* @param urlArg
|
||||||
|
*/
|
||||||
|
const testForUnixSock = (urlArg: string): boolean => {
|
||||||
|
const unixRegex = /^(http:\/\/|https:\/\/|)unix:/;
|
||||||
|
return unixRegex.test(urlArg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determine socketPath and path for unixsock
|
||||||
|
*/
|
||||||
|
const parseSocketPathAndRoute = (stringToParseArg: string) => {
|
||||||
|
const parseRegex = /(.*):(.*)/;
|
||||||
|
const result = parseRegex.exec(stringToParseArg);
|
||||||
|
return {
|
||||||
|
socketPath: result[1],
|
||||||
|
path: result[2]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a custom http agent to make sure we can set custom keepAlive options for speedy subsequent calls
|
||||||
|
*/
|
||||||
|
const httpAgent = new plugins.agentkeepalive.default();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a custom http agent to make sure we can set custom keepAlive options for speedy subsequent calls
|
||||||
|
*/
|
||||||
|
const httpAgentKeepAliveFalse = new plugins.http.Agent({
|
||||||
|
maxFreeSockets: 0,
|
||||||
|
keepAlive: false,
|
||||||
|
keepAliveMsecs: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a custom https agent to make sure we can set custom keepAlive options for speedy subsequent calls
|
||||||
|
*/
|
||||||
|
const httpsAgent = new plugins.agentkeepalive.HttpsAgent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a custom https agent to make sure we can set custom keepAlive options for speedy subsequent calls
|
||||||
|
*/
|
||||||
|
const httpsAgentKeepAliveFalse = new plugins.https.Agent({
|
||||||
|
maxFreeSockets: 0,
|
||||||
|
keepAlive: false,
|
||||||
|
keepAliveMsecs: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
export let request = async (
|
||||||
|
domainArg: string,
|
||||||
|
optionsArg: interfaces.ISmartRequestOptions = {},
|
||||||
|
responseStreamArg: boolean = false,
|
||||||
|
requestDataFunc: (req: plugins.http.ClientRequest) => void = null
|
||||||
|
): Promise<IExtendedIncomingMessage> => {
|
||||||
|
const done = plugins.smartpromise.defer<any>();
|
||||||
|
|
||||||
|
// merge options
|
||||||
|
const defaultOptions: interfaces.ISmartRequestOptions = {
|
||||||
|
// agent: agent,
|
||||||
|
autoJsonParse: true,
|
||||||
|
keepAlive: true
|
||||||
|
};
|
||||||
|
|
||||||
|
optionsArg = {
|
||||||
|
...defaultOptions,
|
||||||
|
...optionsArg
|
||||||
|
};
|
||||||
|
|
||||||
|
// parse url
|
||||||
|
const parsedUrl = plugins.url.parse(domainArg);
|
||||||
|
optionsArg.hostname = parsedUrl.hostname;
|
||||||
|
if (parsedUrl.port) {
|
||||||
|
optionsArg.port = parseInt(parsedUrl.port, 10);
|
||||||
}
|
}
|
||||||
if (!parsedUrl || parsedUrl.protocol === 'https:') {
|
optionsArg.path = parsedUrl.path;
|
||||||
let request = plugins.https.request(optionsArg, response => {
|
|
||||||
if (streamArg) {
|
// determine if unixsock
|
||||||
done.resolve(response)
|
if (testForUnixSock(domainArg)) {
|
||||||
} else {
|
const detailedUnixPath = parseSocketPathAndRoute(optionsArg.path);
|
||||||
buildResponse(response).then(done.resolve)
|
optionsArg.socketPath = detailedUnixPath.socketPath;
|
||||||
}
|
optionsArg.path = detailedUnixPath.path;
|
||||||
})
|
}
|
||||||
if (optionsArg.requestBody) {
|
|
||||||
if (typeof optionsArg.requestBody !== 'string') {
|
// TODO: support tcp sockets
|
||||||
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody)
|
|
||||||
}
|
// lets determine the request module to use
|
||||||
request.write(optionsArg.requestBody)
|
const requestModule = (() => {
|
||||||
|
switch (true) {
|
||||||
|
case parsedUrl.protocol === 'https:' && optionsArg.keepAlive:
|
||||||
|
optionsArg.agent = httpsAgent;
|
||||||
|
return plugins.https;
|
||||||
|
case parsedUrl.protocol === 'https:' && (!optionsArg.keepAlive):
|
||||||
|
optionsArg.agent = httpsAgentKeepAliveFalse;
|
||||||
|
return plugins.https;
|
||||||
|
case parsedUrl.protocol === 'http:' && optionsArg.keepAlive:
|
||||||
|
optionsArg.agent = httpAgent;
|
||||||
|
return plugins.http;
|
||||||
|
case parsedUrl.protocol === 'http:' && (!optionsArg.keepAlive):
|
||||||
|
optionsArg.agent = httpAgentKeepAliveFalse;
|
||||||
|
return plugins.http;
|
||||||
}
|
}
|
||||||
request.on('error', (e) => {
|
})() as typeof plugins.https;
|
||||||
console.error(e)
|
|
||||||
})
|
// lets perform the actual request
|
||||||
request.end()
|
const requestToFire = requestModule.request(optionsArg, async response => {
|
||||||
} else if (parsedUrl.protocol === 'http:') {
|
if (responseStreamArg) {
|
||||||
let request = plugins.http.request(optionsArg, response => {
|
done.resolve(response);
|
||||||
if (streamArg) {
|
} else {
|
||||||
done.resolve(response)
|
const builtResponse = await buildUtf8Response(response, optionsArg.autoJsonParse);
|
||||||
} else {
|
done.resolve(builtResponse);
|
||||||
buildResponse(response).then(done.resolve)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (optionsArg.requestBody) {
|
|
||||||
if (typeof optionsArg.requestBody !== 'string') {
|
|
||||||
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody)
|
|
||||||
}
|
|
||||||
request.write(optionsArg.requestBody)
|
|
||||||
}
|
}
|
||||||
request.on('error', (e) => {
|
});
|
||||||
console.error(e)
|
|
||||||
})
|
// lets write the requestBody
|
||||||
request.end()
|
if (optionsArg.requestBody) {
|
||||||
|
if (optionsArg.requestBody instanceof plugins.formData) {
|
||||||
|
optionsArg.requestBody.pipe(requestToFire).on('finish', event => {
|
||||||
|
requestToFire.end();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (typeof optionsArg.requestBody !== 'string') {
|
||||||
|
optionsArg.requestBody = JSON.stringify(optionsArg.requestBody);
|
||||||
|
}
|
||||||
|
requestToFire.write(optionsArg.requestBody);
|
||||||
|
requestToFire.end();
|
||||||
|
}
|
||||||
|
} else if (requestDataFunc) {
|
||||||
|
requestDataFunc(requestToFire);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`unsupported protocol: ${parsedUrl.protocol}`)
|
requestToFire.end();
|
||||||
}
|
}
|
||||||
return done.promise
|
|
||||||
}
|
// lets handle an error
|
||||||
|
requestToFire.on('error', e => {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await done.promise;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
310
yarn.lock
310
yarn.lock
@ -1,310 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@types/chai-as-promised@0.0.29":
|
|
||||||
version "0.0.29"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "*"
|
|
||||||
"@types/promises-a-plus" "*"
|
|
||||||
|
|
||||||
"@types/chai-string@^1.1.30":
|
|
||||||
version "1.1.30"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "*"
|
|
||||||
|
|
||||||
"@types/chai@*", "@types/chai@^3.4.35":
|
|
||||||
version "3.5.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
|
|
||||||
|
|
||||||
"@types/mocha@^2.2.31":
|
|
||||||
version "2.2.41"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608"
|
|
||||||
|
|
||||||
"@types/node@*", "@types/node@^7.0.29":
|
|
||||||
version "7.0.29"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.29.tgz#ccfcec5b7135c7caf6c4ffb8c7f33102340d99df"
|
|
||||||
|
|
||||||
"@types/promises-a-plus@*":
|
|
||||||
version "0.0.27"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
|
||||||
|
|
||||||
"@types/shelljs@^0.6.0":
|
|
||||||
version "0.6.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.6.0.tgz#090b705c102ce7fc5c0c5ea9b524418ff15840df"
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "*"
|
|
||||||
|
|
||||||
"@types/which@^1.0.28":
|
|
||||||
version "1.0.28"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
|
|
||||||
|
|
||||||
ansi-256-colors@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
|
||||||
|
|
||||||
assertion-error@^1.0.1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
|
||||||
|
|
||||||
balanced-match@^0.4.1:
|
|
||||||
version "0.4.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
|
||||||
|
|
||||||
beautycolor@^1.0.7:
|
|
||||||
version "1.0.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
|
|
||||||
dependencies:
|
|
||||||
ansi-256-colors "^1.1.0"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
bindings@^1.2.1:
|
|
||||||
version "1.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
|
||||||
|
|
||||||
brace-expansion@^1.1.7:
|
|
||||||
version "1.1.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59"
|
|
||||||
dependencies:
|
|
||||||
balanced-match "^0.4.1"
|
|
||||||
concat-map "0.0.1"
|
|
||||||
|
|
||||||
chai-as-promised@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
|
||||||
dependencies:
|
|
||||||
check-error "^1.0.2"
|
|
||||||
|
|
||||||
chai-string@^1.3.0:
|
|
||||||
version "1.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7"
|
|
||||||
|
|
||||||
chai@^3.5.0:
|
|
||||||
version "3.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
|
||||||
dependencies:
|
|
||||||
assertion-error "^1.0.1"
|
|
||||||
deep-eql "^0.1.3"
|
|
||||||
type-detect "^1.0.0"
|
|
||||||
|
|
||||||
check-error@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
|
||||||
|
|
||||||
concat-map@0.0.1:
|
|
||||||
version "0.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
|
||||||
|
|
||||||
deep-eql@^0.1.3:
|
|
||||||
version "0.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
|
||||||
dependencies:
|
|
||||||
type-detect "0.1.1"
|
|
||||||
|
|
||||||
early@^2.1.1:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
|
||||||
dependencies:
|
|
||||||
beautycolor "^1.0.7"
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.16"
|
|
||||||
|
|
||||||
es6-error@^4.0.2:
|
|
||||||
version "4.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
|
|
||||||
|
|
||||||
fs.realpath@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
|
||||||
|
|
||||||
glob@^7.0.0:
|
|
||||||
version "7.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
|
||||||
dependencies:
|
|
||||||
fs.realpath "^1.0.0"
|
|
||||||
inflight "^1.0.4"
|
|
||||||
inherits "2"
|
|
||||||
minimatch "^3.0.4"
|
|
||||||
once "^1.3.0"
|
|
||||||
path-is-absolute "^1.0.0"
|
|
||||||
|
|
||||||
inflight@^1.0.4:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
|
||||||
dependencies:
|
|
||||||
once "^1.3.0"
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
inherits@2:
|
|
||||||
version "2.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
|
||||||
|
|
||||||
interpret@^1.0.0:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
|
|
||||||
|
|
||||||
isexe@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
|
||||||
|
|
||||||
leakage@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
|
|
||||||
dependencies:
|
|
||||||
es6-error "^4.0.2"
|
|
||||||
left-pad "^1.1.3"
|
|
||||||
memwatch-next "^0.3.0"
|
|
||||||
minimist "^1.2.0"
|
|
||||||
pretty-bytes "^4.0.2"
|
|
||||||
|
|
||||||
left-pad@^1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
|
||||||
|
|
||||||
memwatch-next@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
|
||||||
dependencies:
|
|
||||||
bindings "^1.2.1"
|
|
||||||
nan "^2.3.2"
|
|
||||||
|
|
||||||
minimatch@^3.0.4:
|
|
||||||
version "3.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
|
||||||
dependencies:
|
|
||||||
brace-expansion "^1.1.7"
|
|
||||||
|
|
||||||
minimist@^1.2.0:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
|
||||||
|
|
||||||
nan@^2.3.2:
|
|
||||||
version "2.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
|
||||||
|
|
||||||
once@^1.3.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
|
||||||
dependencies:
|
|
||||||
wrappy "1"
|
|
||||||
|
|
||||||
path-is-absolute@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
|
||||||
|
|
||||||
path-parse@^1.0.5:
|
|
||||||
version "1.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
|
|
||||||
|
|
||||||
pretty-bytes@^4.0.2:
|
|
||||||
version "4.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
|
||||||
|
|
||||||
rechoir@^0.6.2:
|
|
||||||
version "0.6.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
|
||||||
dependencies:
|
|
||||||
resolve "^1.1.6"
|
|
||||||
|
|
||||||
resolve@^1.1.6:
|
|
||||||
version "1.3.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
|
|
||||||
dependencies:
|
|
||||||
path-parse "^1.0.5"
|
|
||||||
|
|
||||||
semver@^5.3.0:
|
|
||||||
version "5.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
|
||||||
|
|
||||||
shelljs@^0.7.6:
|
|
||||||
version "0.7.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
|
|
||||||
dependencies:
|
|
||||||
glob "^7.0.0"
|
|
||||||
interpret "^1.0.0"
|
|
||||||
rechoir "^0.6.2"
|
|
||||||
|
|
||||||
smartchai@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
|
||||||
dependencies:
|
|
||||||
"@types/chai" "^3.4.35"
|
|
||||||
"@types/chai-as-promised" "0.0.29"
|
|
||||||
"@types/chai-string" "^1.1.30"
|
|
||||||
chai "^3.5.0"
|
|
||||||
chai-as-promised "^6.0.0"
|
|
||||||
chai-string "^1.3.0"
|
|
||||||
|
|
||||||
smartdelay@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579"
|
|
||||||
dependencies:
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.16"
|
|
||||||
|
|
||||||
smartq@^1.1.0, smartq@^1.1.1:
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3"
|
|
||||||
dependencies:
|
|
||||||
typed-promisify "^0.3.0"
|
|
||||||
typings-global "^1.0.14"
|
|
||||||
|
|
||||||
smartshell@^1.0.6:
|
|
||||||
version "1.0.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.6.tgz#27b1c79029784abe72ac7e91fe698b7ebecc6629"
|
|
||||||
dependencies:
|
|
||||||
"@types/shelljs" "^0.6.0"
|
|
||||||
"@types/which" "^1.0.28"
|
|
||||||
shelljs "^0.7.6"
|
|
||||||
smartq "^1.1.0"
|
|
||||||
which "^1.2.12"
|
|
||||||
|
|
||||||
tapbundle@^1.0.14:
|
|
||||||
version "1.0.14"
|
|
||||||
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.0.14.tgz#75827e335fcb02216f0267a26a26d702ddc02e3c"
|
|
||||||
dependencies:
|
|
||||||
early "^2.1.1"
|
|
||||||
leakage "^0.3.0"
|
|
||||||
smartchai "^1.0.3"
|
|
||||||
smartdelay "^1.0.3"
|
|
||||||
smartq "^1.1.1"
|
|
||||||
typings-global "^1.0.16"
|
|
||||||
|
|
||||||
type-detect@0.1.1:
|
|
||||||
version "0.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
|
||||||
|
|
||||||
type-detect@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
|
||||||
|
|
||||||
typed-promisify@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
|
||||||
|
|
||||||
typings-global@*, typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.17:
|
|
||||||
version "1.0.17"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.17.tgz#41edc331ccec3168289adc8849e1e255efbe7152"
|
|
||||||
dependencies:
|
|
||||||
"@types/node" "^7.0.29"
|
|
||||||
semver "^5.3.0"
|
|
||||||
smartshell "^1.0.6"
|
|
||||||
|
|
||||||
typings-test@^1.0.3:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369"
|
|
||||||
dependencies:
|
|
||||||
"@types/mocha" "^2.2.31"
|
|
||||||
typings-global "*"
|
|
||||||
|
|
||||||
which@^1.2.12:
|
|
||||||
version "1.2.14"
|
|
||||||
resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
|
|
||||||
dependencies:
|
|
||||||
isexe "^2.0.0"
|
|
||||||
|
|
||||||
wrappy@1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
|
Reference in New Issue
Block a user