Comparing version 0.0.2 to 0.0.3
@@ -1,2 +0,2 @@ | ||
#!/usr/bin/env node | ||
//reAxios (c) 2018, Sandeep Vattapparambil | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -11,3 +11,3 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
root["reAxios"] = factory(); | ||
})(this, function() { | ||
})(typeof self !== 'undefined' ? self : this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -138,10 +138,6 @@ /******/ // The module cache | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/** | ||
* Get Oobservables from RxJs | ||
* Get Observables from RxJs | ||
*/ | ||
@@ -181,2 +177,3 @@ | ||
* @memberof ReAxios | ||
* @inner | ||
* @function makeRequest | ||
@@ -275,2 +272,3 @@ * A function to construct a http request using any http-method and | ||
* @memberof ReAxios | ||
* @inner | ||
* @function get | ||
@@ -293,2 +291,3 @@ * A helper function to get a url with passed in parameters | ||
* @memberof ReAxios | ||
* @inner | ||
* @function post | ||
@@ -309,2 +308,3 @@ * A helper function to post a url with paramerters passed in | ||
* @memberof ReAxios | ||
* @inner | ||
* @function put | ||
@@ -325,2 +325,3 @@ * A helper function to put a url with paramerters passed in | ||
* @memberof ReAxios | ||
* @inner | ||
* @function patch | ||
@@ -341,2 +342,3 @@ * A helper function to patch a url with paramerters passed in | ||
* @memberof ReAxios | ||
* @inner | ||
* @function delete | ||
@@ -355,3 +357,3 @@ * A helper function to delete a url with paramerters passed in | ||
exports.default = ReAxios; | ||
module.exports = ReAxios; | ||
@@ -358,0 +360,0 @@ /***/ }), |
@@ -1,3 +0,2 @@ | ||
#!/usr/bin/env node | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("reAxios",[],t):"object"==typeof exports?exports.reAxios=t():e.reAxios=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(1)),u=n(2);var i=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=Object.assign({},t),this.http=o.default.create(t)}return r(e,[{key:"makeRequest",value:function(e,t,n,r){var o=void 0;switch(e){case"GET":o=this.http.get(t,{params:n});break;case"POST":o=this.http.post(t,r,{params:n});break;case"PUT":o=this.http.put(t,r,{params:n});break;case"PATCH":o=this.http.patch(t,r,{params:n});break;case"DELETE":o=this.http.delete(t,{params:n});break;default:throw new Error("Unsupported Method encountered")}return new u.Observable(function(e){o.then(function(t){e.next(t),e.complete()}).catch(function(t){e.error(t),e.complete()})})}},{key:"get",value:function(e,t){return this.makeRequest("GET",e,t)}},{key:"post",value:function(e,t,n){return this.makeRequest("POST",e,n,t)}},{key:"put",value:function(e,t,n){return this.makeRequest("PUT",e,n,t)}},{key:"patch",value:function(e,t,n){return this.makeRequest("PATCH",e,n,t)}},{key:"delete",value:function(e,t){return this.makeRequest("DELETE",e,t)}}]),e}();t.default=i},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("rxjs")}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("reAxios",[],t):"object"==typeof exports?exports.reAxios=t():e.reAxios=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(1)),u=n(2);var i=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=Object.assign({},t),this.http=o.default.create(t)}return r(e,[{key:"makeRequest",value:function(e,t,n,r){var o=void 0;switch(e){case"GET":o=this.http.get(t,{params:n});break;case"POST":o=this.http.post(t,r,{params:n});break;case"PUT":o=this.http.put(t,r,{params:n});break;case"PATCH":o=this.http.patch(t,r,{params:n});break;case"DELETE":o=this.http.delete(t,{params:n});break;default:throw new Error("Unsupported Method encountered")}return new u.Observable(function(e){o.then(function(t){e.next(t),e.complete()}).catch(function(t){e.error(t),e.complete()})})}},{key:"get",value:function(e,t){return this.makeRequest("GET",e,t)}},{key:"post",value:function(e,t,n){return this.makeRequest("POST",e,n,t)}},{key:"put",value:function(e,t,n){return this.makeRequest("PUT",e,n,t)}},{key:"patch",value:function(e,t,n){return this.makeRequest("PATCH",e,n,t)}},{key:"delete",value:function(e,t){return this.makeRequest("DELETE",e,t)}}]),e}();e.exports=i},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("rxjs")}])}); | ||
//# sourceMappingURL=reAxios.min.js.map |
{ | ||
"name": "reaxios", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Axios ajax library wrapped in RxJs observables, The popular kids are doing it.", | ||
@@ -5,0 +5,0 @@ "private": false, |
![logo](public/reAxios.png) | ||
# reAxios v0.0.2 | ||
# reAxios v0.0.3 | ||
@@ -30,6 +30,6 @@ [![GitHub license](https://img.shields.io/github/license/SandeepVattapparambil/reaxios.svg?style=flat-square)](https://github.com/SandeepVattapparambil/reaxios/blob/master/LICENSE) ![travisci](https://api.travis-ci.org/SandeepVattapparambil/reaxios.svg?branch=master) [![CircleCI](https://circleci.com/gh/SandeepVattapparambil/reaxios.svg?style=svg)](https://circleci.com/gh/SandeepVattapparambil/reaxios) [![Known Vulnerabilities](https://snyk.io/test/github/SandeepVattapparambil/reaxios/badge.svg?targetFile=package.json)](https://snyk.io/test/github/SandeepVattapparambil/reaxios?targetFile=package.json) [![CodeFactor](https://www.codefactor.io/repository/github/sandeepvattapparambil/reaxios/badge/master)](https://www.codefactor.io/repository/github/sandeepvattapparambil/reaxios/overview/master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a6988d53e74246649974096fcdbe55bb)](https://www.codacy.com/project/sandeepv68/reaxios/dashboard?utm_source=github.com&utm_medium=referral&utm_content=SandeepVattapparambil/reaxios&utm_campaign=Badge_Grade_Dashboard) [![codecov](https://codecov.io/gh/SandeepVattapparambil/reaxios/branch/master/graph/badge.svg)](https://codecov.io/gh/SandeepVattapparambil/reaxios) [![GitHub issues](https://img.shields.io/github/issues/SandeepVattapparambil/reaxios.svg?style=flat-square)](https://github.com/SandeepVattapparambil/reaxios/issues) [![GitHub forks](https://img.shields.io/github/forks/SandeepVattapparambil/reaxios.svg?style=flat-square)](https://github.com/SandeepVattapparambil/reaxios/network) [![GitHub stars](https://img.shields.io/github/stars/SandeepVattapparambil/reaxios.svg?style=flat-square)](https://github.com/SandeepVattapparambil/reaxios/stargazers) [![Twitter](https://img.shields.io/twitter/url/https/github.com/SandeepVattapparambil/reaxios.svg?style=flat-square)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2FSandeepVattapparambil%2Freaxios) | ||
| --- | --- | --- | | ||
| compressed | reAxios.min.js | 3KB | | ||
| compressed | reAxios.min.js | 2.73KB | | ||
| uncompressed | reAxios.js | 12KB | | ||
#### Dependecy | ||
#### Dependency | ||
This library is dependent on the following Npm packages: | ||
@@ -42,3 +42,3 @@ - [rxjs](https://www.npmjs.com/package/rxjs) | ||
#### Installation | ||
**reAxios** is a UMD module, which means it can be run across all javascript environments ranging from browsers to servers(node). reAxios can be used on browsers in conjunction with RxJs and axios, or in node-like browser environments as in ReactJS, AngularJS, VueJS or MarkoJS or it can be used in NodeJS apps. | ||
**reAxios** is a UMD module, which means it can be run across all javascript environments ranging from browsers to servers(node). reAxios can be used on browsers in conjunction with RxJs and axios in node-like browser environments as in ReactJS, AngularJS, VueJS or MarkoJS or it can be used in NodeJS apps. | ||
@@ -49,2 +49,8 @@ Using npm | ||
``` | ||
Using yarn | ||
```sh | ||
yarn add reaxios | ||
``` | ||
#### Usage | ||
@@ -83,10 +89,14 @@ ```js | ||
#### Changelog | ||
- **v0.0.3** | ||
- UMD Tweaks | ||
- Documentation updates | ||
- **v0.0.2** - **v0.0.1** | ||
- es6 code base | ||
- UMD build, can be used on browser and server side | ||
- 100% code coverage | ||
- Tests using jest | ||
- Vulnerabilities check added | ||
- Travis CI added | ||
- Circle CI added | ||
- es6 code base | ||
- UMD build, can be used on browser and server side | ||
- 100% code coverage | ||
- Tests using jest | ||
- Vulnerabilities check added | ||
- Travis CI added | ||
- Circle CI added | ||
@@ -124,3 +134,3 @@ #### API Documentation | ||
``` | ||
##### Paraneters | ||
##### Parameters | ||
| **Parameter** | **Type** | **Description** | | ||
@@ -149,3 +159,3 @@ | -- | -- | -- | | ||
``` | ||
##### Paraneters | ||
##### Parameters | ||
| **Parameter** | **Type** | **Description** | | ||
@@ -174,3 +184,3 @@ | -- | -- | -- | | ||
``` | ||
##### Paraneters | ||
##### Parameters | ||
| **Parameter** | **Type** | **Description** | | ||
@@ -199,3 +209,3 @@ | -- | -- | -- | | ||
``` | ||
##### Paraneters | ||
##### Parameters | ||
| **Parameter** | **Type** | **Description** | | ||
@@ -202,0 +212,0 @@ | -- | -- | -- | |
@@ -15,7 +15,10 @@ /** | ||
mode: env && env.production === true ? 'production' : 'development', | ||
/** | ||
* set target as server (node) | ||
* Node polyfills for browser | ||
*/ | ||
target: 'node', | ||
node: { | ||
process: true | ||
}, | ||
/** | ||
@@ -31,3 +34,3 @@ * ignore all modules in node_modules folder | ||
new webpack.BannerPlugin({ | ||
banner: '#!/usr/bin/env node', | ||
banner: '//reAxios (c) 2018, Sandeep Vattapparambil', | ||
raw: true | ||
@@ -51,3 +54,3 @@ }) | ||
umdNamedDefine: true, | ||
globalObject: 'this' | ||
globalObject: 'typeof self !== \'undefined\' ? self : this' | ||
}, | ||
@@ -54,0 +57,0 @@ module: { |
@@ -32,3 +32,3 @@ /** | ||
/** | ||
* Get Oobservables from RxJs | ||
* Get Observables from RxJs | ||
*/ | ||
@@ -57,2 +57,3 @@ import { | ||
* @memberof ReAxios | ||
* @inner | ||
* @function makeRequest | ||
@@ -147,2 +148,3 @@ * A function to construct a http request using any http-method and | ||
* @memberof ReAxios | ||
* @inner | ||
* @function get | ||
@@ -159,2 +161,3 @@ * A helper function to get a url with passed in parameters | ||
* @memberof ReAxios | ||
* @inner | ||
* @function post | ||
@@ -172,2 +175,3 @@ * A helper function to post a url with paramerters passed in | ||
* @memberof ReAxios | ||
* @inner | ||
* @function put | ||
@@ -185,2 +189,3 @@ * A helper function to put a url with paramerters passed in | ||
* @memberof ReAxios | ||
* @inner | ||
* @function patch | ||
@@ -198,2 +203,3 @@ * A helper function to patch a url with paramerters passed in | ||
* @memberof ReAxios | ||
* @inner | ||
* @function delete | ||
@@ -209,2 +215,2 @@ * A helper function to delete a url with paramerters passed in | ||
export default ReAxios; | ||
module.exports = ReAxios; |
@@ -189,6 +189,2 @@ /** | ||
const body = { | ||
id: 1 | ||
}; | ||
/** | ||
@@ -213,2 +209,47 @@ * Create a server stub | ||
}); | ||
it('reAxiosInstance makes a successful GET request to JSON API', async () => { | ||
reAxiosInstance = new reAxios({ | ||
baseURL: 'https://jsonplaceholder.typicode.com', | ||
}); | ||
const promise = new Promise((resolve, reject) => { | ||
reAxiosInstance.get('/todos/1').subscribe( | ||
resp => { | ||
resolve(resp.status); | ||
}, | ||
err => { | ||
reject(err); | ||
} | ||
); | ||
}); | ||
await expect(promise).resolves.toEqual(200); | ||
}); | ||
it('reAxiosInstance makes a successful GET request to JSON API and retreives data', async () => { | ||
reAxiosInstance = new reAxios({ | ||
baseURL: 'https://jsonplaceholder.typicode.com', | ||
}); | ||
const response = { | ||
"userId": 1, | ||
"id": 1, | ||
"title": "delectus aut autem", | ||
"completed": false | ||
}; | ||
const promise = new Promise((resolve, reject) => { | ||
reAxiosInstance.get('/todos/1').subscribe( | ||
resp => { | ||
resolve(resp.data); | ||
}, | ||
err => { | ||
reject(err); | ||
} | ||
); | ||
}); | ||
await expect(promise).resolves.toEqual(response); | ||
}); | ||
}); |
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
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
797623
804
302
0