From beb45dfae8ba14c5c08c24262a19bb71caaae1a5 Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 8 Jan 2017 16:49:18 +0530 Subject: [PATCH] version 1.1 release --- angular-httpshooter.js | 6 -- angular-httpshooter.min.js | 1 + bower.json | 2 +- npm-debug.log | 115 +++++++++++++++++++++++++++++++++++++ package.json | 6 +- 5 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 angular-httpshooter.min.js create mode 100644 npm-debug.log diff --git a/angular-httpshooter.js b/angular-httpshooter.js index e76d907..9cb408d 100644 --- a/angular-httpshooter.js +++ b/angular-httpshooter.js @@ -290,9 +290,3 @@ })(); - -(function(){ - 'use strict'; -})(); - - diff --git a/angular-httpshooter.min.js b/angular-httpshooter.min.js new file mode 100644 index 0000000..f3f6bf3 --- /dev/null +++ b/angular-httpshooter.min.js @@ -0,0 +1 @@ +!function(){"use strict";function e(e,t,a,o,u){var r={error:"timeout",statusCode:599,message:"timeout"},l=function(e,a){var r=!0;console.info(o.httpshooter_queuedCalls),o.httpshooter_queuedCalls?u.blockDuplicateCalls&&o.httpshooter_queuedCalls.length&&o.httpshooter_queuedCalls.forEach(function(t,a){u.compareDuplicateParam.url&&t.config.url==e.url&&(r=!1),u.compareDuplicateParam.data&&angular.equals(t.config.data,e.data)&&(r=!1)}):o.httpshooter_queuedCalls=[];var l=t.defer();return r?(o.httpshooter_queuedCalls.push({config:e,deferred:l,time:a?a:u.defaultTimeOut}),1===o.httpshooter_queuedCalls.length&&("get"!=e.method&&o.$broadcast("HTTP_CALL_STARTED",e),n()),l.promise):t.reject({data:"",headers:{},status:400,config:e})},n=function(){var e=o.httpshooter_queuedCalls[0].config;switch(e.method.toLowerCase()){case"get":h(e,o.httpshooter_queuedCalls[0].time);break;case"delete":p(e,o.httpshooter_queuedCalls[0].time);break;case"head":m(e,o.httpshooter_queuedCalls[0].time);break;case"post":c(e,o.httpshooter_queuedCalls[0].time);break;case"patch":i(e,o.httpshooter_queuedCalls[0].time);break;case"put":f(e,o.httpshooter_queuedCalls[0].time)}},s=function(e){o.$broadcast("HTTP_CALL_STOPPED",o.httpshooter_queuedCalls[0].config),o.httpshooter_queuedCalls[0].deferred.resolve(e),o.httpshooter_queuedCalls.shift(),o.httpshooter_queuedCalls.length>0&&n()},d=function(e){o.$broadcast("HTTP_CALL_STOPPED",o.httpshooter_queuedCalls[0].config),o.httpshooter_queuedCalls[0].deferred.reject(e),o.httpshooter_queuedCalls.shift(),o.httpshooter_queuedCalls.length>0&&n()},h=function(t,u){var l=o.httpshooter_queuedCalls[0].deferred,n=a(function(){l.reject(r)},u);e({url:t.url,method:"GET",headers:t.headers,timeout:n}).then(function(e){s(e.data)},function(e){d(e.data)})["finally"](function(){a.cancel(n)})},c=function(t,u){var l=o.httpshooter_queuedCalls[0].deferred,n=a(function(){l.reject(r)},u);e({url:t.url,method:"POST",headers:t.headers,data:t.data,timeout:n}).then(function(e){s(e.data)},function(e){d(e.data)})["finally"](function(){a.cancel(n)})},i=function(t,u){var l=o.httpshooter_queuedCalls[0].deferred,n=a(function(){l.reject(r)},u);e({url:t.url,method:"POST",headers:t.headers,data:t.data,timeout:n}).then(function(e){s(e.data)},function(e){d(e.data)})["finally"](function(){a.cancel(n)})},f=function(t,u){var l=o.httpshooter_queuedCalls[0].deferred,n=a(function(){l.reject(r)},u);e({url:t.url,method:"POST",headers:t.headers,data:t.data,timeout:n}).then(function(e){s(e.data)},function(e){d(e.data)})["finally"](function(){a.cancel(n)})},p=function(t,u){var l=o.httpshooter_queuedCalls[0].deferred,n=a(function(){l.reject(r)},u);return e({url:t.url,method:"DELETE",data:t.data,headers:t.headers,timeout:n}).then(function(e){s(e.data)},function(e){d(e.data)})["finally"](function(){a.cancel(n)}),l.promise},m=function(t,u){var l=o.httpshooter_queuedCalls[0].deferred,n=a(function(){l.reject(r)},u);e({url:url,method:"HEAD",timeout:n}).then(function(e){s(e.data)},function(e){d(e.data)})["finally"](function(){a.cancel(n)})};return{queue:l}}angular.module("angular-httpshooter",[]).factory("$httpshooter",e),e.$inject=["$http","$q","$timeout","$rootScope","shootConfig"],angular.module("angular-httpshooter").constant("shootConfig",{defaultTimeOut:36e3,blockDuplicateCalls:!0,compareDuplicateParam:{url:!0,data:!1}})}(); \ No newline at end of file diff --git a/bower.json b/bower.json index 3c8e7f9..e638b45 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-httpshooter", "description": "An angular js factory which shoots http calls asynchronously.", - "main": "index.js", + "main": "angular-httpshooter.min.js", "authors": [ "siddarthvader (siddharthjn93@gmail.com)" ], diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..4d5be07 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,115 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'publish' ] +2 info using npm@3.10.5 +3 info using node@v5.6.0 +4 verbose publish [ '.' ] +5 silly cache add args [ '.', null ] +6 verbose cache add spec . +7 silly cache add parsed spec Result { +7 silly cache add raw: '.', +7 silly cache add scope: null, +7 silly cache add escapedName: null, +7 silly cache add name: null, +7 silly cache add rawSpec: '.', +7 silly cache add spec: '/Users/acetonewebdev4/Desktop/siddarthvader/angular-httpshooter', +7 silly cache add type: 'directory' } +8 verbose addLocalDirectory /Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package.tgz not in flight; packing +9 verbose correctMkdir /Users/acetonewebdev4/.npm correctMkdir not in flight; initializing +10 info lifecycle angular-httpshooter@1.0.1~prepublish: angular-httpshooter@1.0.1 +11 silly lifecycle angular-httpshooter@1.0.1~prepublish: no script for prepublish, continuing +12 verbose tar pack [ '/Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package.tgz', +12 verbose tar pack '/Users/acetonewebdev4/Desktop/siddarthvader/angular-httpshooter' ] +13 verbose tarball /Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package.tgz +14 verbose folder /Users/acetonewebdev4/Desktop/siddarthvader/angular-httpshooter +15 verbose addLocalTarball adding from inside cache /Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package.tgz +16 verbose correctMkdir /Users/acetonewebdev4/.npm correctMkdir not in flight; initializing +17 silly cache afterAdd angular-httpshooter@1.0.1 +18 verbose afterAdd /Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package/package.json not in flight; writing +19 verbose correctMkdir /Users/acetonewebdev4/.npm correctMkdir not in flight; initializing +20 verbose afterAdd /Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package/package.json written +21 silly publish { name: 'angular-httpshooter', +21 silly publish version: '1.0.1', +21 silly publish description: 'An angular js factory which shoots http calls asynchronously.', +21 silly publish main: 'index.js', +21 silly publish scripts: { test: 'echo "Error: no test specified" && exit 1' }, +21 silly publish repository: +21 silly publish { type: 'git', +21 silly publish url: 'git+https://github.com/siddarthvader/angular-httpshooter.git' }, +21 silly publish keywords: +21 silly publish [ 'loader', +21 silly publish 'httploader', +21 silly publish 'spinners', +21 silly publish 'blockUI', +21 silly publish 'angular', +21 silly publish 'async', +21 silly publish 'http', +21 silly publish 'calls' ], +21 silly publish author: { name: 'siddarthvader', url: 'siddharthjn93@gmail.com' }, +21 silly publish license: 'MIT', +21 silly publish bugs: { url: 'https://github.com/siddarthvader/angular-httpshooter/issues' }, +21 silly publish homepage: 'https://github.com/siddarthvader/angular-httpshooter#readme', +21 silly publish readme: '# Angular-httpshooter\n> A factory written in angular 1.0+ which makes/shoots http calls asynchronously.\n\nAngular-httpshooter makes all your api calls asynchronous, idea behind it to make the connection between server and client single threaded, it means shooting only one call at a point of time and wait for the response from server to launch the next call.\n\n\n> It blocks duplicate calls on the basis or either `url` or `data`, you can configure it according to your need.\n\nIt is based on `promise` chaining, it maintains a `queue` and push every call into it and then treat them on the basis of `FIFO`. it makes a promise for every `http` call and `reject`/`resolve` promise on the basis of response from server;\n\n> Angular-httpshooter is here to provide enhanced support to maintain ACID property of DB.\n\nAlmost all new databases handle it on their level and serialize read/write calls using lock-based protocols and other measures, but it is always preferred that client handles the concurrency on its level.\n\n>> NOTE: it will only matches the calls which are yet to take place, past calls are removed from queue as soon as the server returns response.\n\n\n> ![Example network panel](http://i.imgur.com/7i9FSkZ.png)\n\n\n\n## Features\n\n* One api/server call in action at one point of time.\n* it blocks duplicate server calls which generally happens when user press some button twice, read options for more details.\n* \'timeout\' defines the max-time wait limit, it server does not respond before timeout limit, it rejects the promise and you will get 599 status in error block.\n* it releases two events on $rootScope `HTTP_CALL_STARTED` and `HTTP_CALL_STOPPED`, also sends config objects with events, you can catch this event and do many things. e.g. show loader or block UI from interaction.\n\n\n## Use Angular-httpshooter in your webapp\n\ninstall using npm\n```bash\nnpm install angular-httpshooter --save\n```\n\ninstall using bower\n```bash\nbower install angular-httpshooter media-all --save\n```\n\nclone the git repo\n\n```bash\ngit clone https://github.com/siddarthvader/angular-httpshooter.github\n```\n\nOnce you have downloded the package you will have to inject the dependency in your angular app.\n\nIn your Module\n````bash\n app.module(\'angularApp\',[\'angular-httpshooter\']);\n````\n\nIn your Controller\n````bash\n app.controller(\'appCtrl\',[\'$httpshooter\',function($httpshooter){\n\n $httpshooter.queue({\n method:\'POST\',\n url:\'http://example.com/postData\',\n data:data,\n headers:headers \n },timeout).then(function(data){\n // if server returns success response\n console.log(data);// will be main response returned from server, stripped of all other data\n },function(data){\n // if server returns error response\n })\n\n }]);\n````\n\nYes it is as simple as this.\n\n\n\n## Options\n\nHere are defaults values and possible values that can be passed to the factory for further processing.\n\n````bash\n| Property | Acceptable options | Default options |\n|-----------|---------------------------------|-----------------|\n| Method | get,post,delete,head,put,patch | none |\n| url | | none |\n| data | | none |\n| headers | | none |\n| timeout | time in miliseconds | 36000ms |\n\n````\n\n## Events\n \n\n ````bash\n $rootScope.$on(\'HTTP_CALL_STARTED\', function (event,data) {\n console.log(data.url) // url of http call in action\n console.log(data.data) // data of http call\n console.log(data.headers) // headers of http call\n\n // basically you get whole config object in here, including a promise\n // you can start a loader here, or freeze UI or can do anything\n });\n\n $rootScope.$on(\'HTTP_CALL_STOPPED\', function (event,data) {\n // same data as above event\n\n // you can stop a loader here, or enable submit button or anything else\n });\n\n\n ````\n\n\n## Customization\n\nHere are the default values of params used in factory, you can configure them, like this:\n\n````bash\napp.config(function(shootConfig) {\n angular.extend(shootConfig, {\n defaultTimeOut:36000 // miliseconds\n blockDuplicateCalls: true,\n compareDuplicateParam:{\n url:true,\n data:false\n }\n });\n})\n````\n\n* **defaultTimeOut** : default value 36000ms, you can change it if you want to.\n\n* **blockDuplicateCalls** : default value `true`, change if you want to allow all calls to reach server.\n\n* **compareDuplicateParam.url** : default value `true`, if `true` factory matches the calls on the basis of `url` string.\n\n* **compareDuplicateParam.data** : default value `false`, if `true` factory matches the calls on the basis on `data` object\n\n\n## Licence\n\nMIT\n\n### Feel free to fork or report issues, I am here to help. \\m/', +21 silly publish readmeFilename: 'README.md', +21 silly publish gitHead: 'b7d4d50def152d9ff5b75c5b290b10dc9afd8889', +21 silly publish _id: 'angular-httpshooter@1.0.1', +21 silly publish _shasum: '85e12ef2b881e943a394f023a221fffe7742c1c1', +21 silly publish _from: '.' } +22 verbose getPublishConfig undefined +23 silly mapToRegistry name angular-httpshooter +24 silly mapToRegistry using default registry +25 silly mapToRegistry registry https://registry.npmjs.org/ +26 silly mapToRegistry data Result { +26 silly mapToRegistry raw: 'angular-httpshooter', +26 silly mapToRegistry scope: null, +26 silly mapToRegistry escapedName: 'angular-httpshooter', +26 silly mapToRegistry name: 'angular-httpshooter', +26 silly mapToRegistry rawSpec: '', +26 silly mapToRegistry spec: 'latest', +26 silly mapToRegistry type: 'tag' } +27 silly mapToRegistry uri https://registry.npmjs.org/angular-httpshooter +28 verbose publish registryBase https://registry.npmjs.org/ +29 silly publish uploading /Users/acetonewebdev4/.npm/angular-httpshooter/1.0.1/package.tgz +30 verbose request uri https://registry.npmjs.org/angular-httpshooter +31 verbose request sending authorization for write operation +32 info attempt registry request try #1 at 1:18:29 PM +33 verbose request using bearer token for auth +34 verbose request id bce5241d9202697e +35 http request PUT https://registry.npmjs.org/angular-httpshooter +36 http 403 https://registry.npmjs.org/angular-httpshooter +37 verbose headers { 'content-type': 'application/json', +37 verbose headers 'cache-control': 'max-age=300', +37 verbose headers 'content-length': '95', +37 verbose headers 'accept-ranges': 'bytes', +37 verbose headers date: 'Sun, 08 Jan 2017 07:48:32 GMT', +37 verbose headers via: '1.1 varnish', +37 verbose headers connection: 'keep-alive', +37 verbose headers 'x-served-by': 'cache-ams4147-AMS', +37 verbose headers 'x-cache': 'MISS', +37 verbose headers 'x-cache-hits': '0', +37 verbose headers 'x-timer': 'S1483861711.420631,VS0,VE940', +37 verbose headers vary: 'Accept-Encoding' } +38 verbose request invalidating /Users/acetonewebdev4/.npm/registry.npmjs.org/angular-httpshooter on PUT +39 error publish Failed PUT 403 +40 verbose stack Error: "You cannot publish over the previously published version 1.0.1." : angular-httpshooter +40 verbose stack at makeError (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:264:12) +40 verbose stack at CachingRegistryClient. (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:252:14) +40 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14) +40 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:200:22) +40 verbose stack at emitTwo (events.js:100:13) +40 verbose stack at Request.emit (events.js:185:7) +40 verbose stack at Request. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1067:10) +40 verbose stack at emitOne (events.js:95:20) +40 verbose stack at Request.emit (events.js:182:7) +40 verbose stack at IncomingMessage. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:988:12) +41 verbose statusCode 403 +42 verbose pkgid angular-httpshooter +43 verbose cwd /Users/acetonewebdev4/Desktop/siddarthvader/angular-httpshooter +44 error Darwin 16.0.0 +45 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "publish" +46 error node v5.6.0 +47 error npm v3.10.5 +48 error code E403 +49 error "You cannot publish over the previously published version 1.0.1." : angular-httpshooter +50 error If you need help, you may report this error at: +50 error +51 verbose exit [ 1, true ] diff --git a/package.json b/package.json index 6eee30c..7b8cd41 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "angular-httpshooter", - "version": "1.0.1", + "version": "1.1.0", "description": "An angular js factory which shoots http calls asynchronously.", - "main": "index.js", + "main": "angular-httpshooter.min.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -26,4 +26,4 @@ "url": "https://github.com/siddarthvader/angular-httpshooter/issues" }, "homepage": "https://github.com/siddarthvader/angular-httpshooter#readme" -} +} \ No newline at end of file