@request/promise-core
Advanced tools
Comparing version 0.0.1 to 1.0.0-rc.1
{ | ||
"name": "@request/promise-core", | ||
"version": "0.0.1", | ||
"version": "1.0.0-rc.1", | ||
"description": "Core Promise support implementation for the simplified HTTP request client 'request'.", | ||
@@ -13,7 +13,10 @@ "keywords": [ | ||
"thenable", | ||
"native" | ||
"core" | ||
], | ||
"main": "./lib/rp.js", | ||
"main": "./lib/plumbing.js", | ||
"scripts": { | ||
"test": "./node_modules/.bin/gulp ci" | ||
"test": "./node_modules/.bin/gulp ci", | ||
"test-publish": "./node_modules/.bin/gulp ci-no-cov", | ||
"publish-please": "publish-please", | ||
"prepublish": "publish-please guard" | ||
}, | ||
@@ -32,3 +35,28 @@ "repository": { | ||
"node": ">=0.10.0" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.13.1" | ||
}, | ||
"peerDependencies": { | ||
"request": "^2.34" | ||
}, | ||
"devDependencies": { | ||
"@request/api": "^0.6.0", | ||
"@request/client": "^0.1.0", | ||
"bluebird": "~3.4.1", | ||
"body-parser": "~1.15.2", | ||
"chai": "~3.5.0", | ||
"chalk": "~1.1.3", | ||
"gulp": "~3.9.1", | ||
"gulp-coveralls": "~0.1.4", | ||
"gulp-eslint": "~2.1.0", | ||
"gulp-istanbul": "~1.0.0", | ||
"gulp-mocha": "~2.2.0", | ||
"node-version": "~1.0.0", | ||
"publish-please": "~2.1.4", | ||
"request": "^2.34.0", | ||
"rimraf": "~2.5.3", | ||
"run-sequence": "~1.2.2", | ||
"stealthy-require": "~0.1.0" | ||
} | ||
} |
105
README.md
@@ -0,10 +1,107 @@ | ||
<a href="http://promisesaplus.com/"> | ||
<img src="https://promises-aplus.github.io/promises-spec/assets/logo-small.png" align="right" alt="Promises/A+ logo" /> | ||
</a> | ||
# @request/promise-core | ||
[![Gitter](https://img.shields.io/badge/gitter-join_chat-blue.svg?style=flat-square)](https://gitter.im/request/request-promise?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Build Status](https://img.shields.io/travis/request/promise-core/master.svg?style=flat-square)](https://travis-ci.org/request/promise-core) | ||
[![Coverage Status](https://img.shields.io/coveralls/request/promise-core.svg?style=flat-square)](https://coveralls.io/r/request/promise-core) | ||
[![Dependency Status](https://img.shields.io/gemnasium/request/promise-core.svg?style=flat-square)](https://gemnasium.com/github.com/request/promise-core) | ||
[![Known Vulnerabilities](https://snyk.io/test/npm/promise-core/badge.svg?style=flat-square)](https://snyk.io/test/npm/promise-core) | ||
This package will shortly become the core for the following packages: | ||
- `request-promise` | ||
- `request-promise-any` | ||
- `request-promise-bluebird` | ||
- `request-promise-native` | ||
- [`request-promise`](https://github.com/request/request-promise) | ||
- [`request-promise-any`](https://github.com/request/request-promise-any) | ||
- [`request-promise-bluebird`](https://github.com/request/request-promise-bluebird) | ||
- [`request-promise-native`](https://github.com/request/request-promise-native) | ||
`@request/promise-core` contains the core logic to add Promise support to [`request`](https://github.com/request/request). | ||
## Installation for `request@^2.34` | ||
This module is installed via npm: | ||
``` | ||
npm install --save request | ||
npm install --save @request/promise-core | ||
``` | ||
`request` is defined as a peer-dependency and thus has to be installed separately. | ||
## Usage for `request@^2.34` | ||
``` js | ||
// 1. Load the request library | ||
// Only use a direct require if you are 100% sure that: | ||
// - Your project does not use request directly. That is without the Promise capabilities by calling require('request'). | ||
// - Any of the installed libraries use request. | ||
// ...because Request's prototype will be patched in step 2. | ||
/* var request = require('request'); */ | ||
// Instead use: | ||
var stealthyRequire = require('stealthy-require')(require); | ||
var request = stealthyRequire('request'); | ||
// 2. Add Promise support to request | ||
var configure = require('@request/promise-core/configure/request2'); | ||
configure({ | ||
request: request, | ||
// Pass your favorite ES6-compatible promise implementation | ||
PromiseImpl: Promise, | ||
// Expose all methods of the promise instance you want to call on the request(...) call | ||
expose: [ | ||
'then', // Allows to use request(...).then(...) | ||
'catch', // Allows to use request(...).catch(...) | ||
'promise' // Allows to use request(...).promise() which returns the promise instance | ||
] | ||
}); | ||
// 3. Use request with its promise capabilities | ||
// E.g. crawl a web page: | ||
request('http://www.google.com') | ||
.then(function (htmlString) { | ||
// Process html... | ||
}) | ||
.catch(function (err) { | ||
// Crawling failed... | ||
}); | ||
``` | ||
## Installation and Usage for `request@next` | ||
[Request Next](https://github.com/request/request/issues/1982) is still in alpha. However, `@request/promise-core` is already designed to be compatible and ships with a configuration helper -- `require('@request/promise-core/configure/request-next')` -- that is [used by `request-promise`](https://github.com/request/request-promise/blob/next/lib/rp.js) in its "next" branch. | ||
## Contributing | ||
To set up your development environment: | ||
1. clone the repo to your desktop, | ||
2. in the shell `cd` to the main folder, | ||
3. hit `npm install`, | ||
4. hit `npm install gulp -g` if you haven't installed gulp globally yet, and | ||
5. run `gulp dev`. (Or run `node ./node_modules/.bin/gulp dev` if you don't want to install gulp globally.) | ||
`gulp dev` watches all source files and if you save some changes it will lint the code and execute all tests. The test coverage report can be viewed from `./coverage/lcov-report/index.html`. | ||
If you want to debug a test you should use `gulp test-without-coverage` to run all tests without obscuring the code by the test coverage instrumentation. | ||
## Change History | ||
- 1.0.0-rc.1 (2016-07-10) | ||
- Reimplementation of core logic based on `request-promise@3.0.0` | ||
- Plus `transform2xxOnly` option (fixes https://github.com/request/request-promise/issues/131) | ||
## License (ISC) | ||
In case you never heard about the [ISC license](http://en.wikipedia.org/wiki/ISC_license) it is functionally equivalent to the MIT license. | ||
See the [LICENSE file](LICENSE) for details. |
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
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
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
17582
10
248
0
107
1
2
17
+ Addedlodash@^4.13.1
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.9.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)