vkontakte-api
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [1.3.0](https://github.com/wolframdeus/vk-api/compare/v1.2.2...v1.3.0) (2020-06-11) | ||
### Features | ||
* **vkerror:** added custom error ([7b58756](https://github.com/wolframdeus/vk-api/commit/7b58756242ec25e1a26ffee627b650abe2457e16)) | ||
### [1.2.2](https://github.com/wolframdeus/vk-api/compare/v1.2.1...v1.2.2) (2020-06-11) | ||
@@ -7,0 +14,0 @@ |
export * from './multithreading'; | ||
export * from './types'; | ||
export * from './VKAPI'; | ||
export * from './VKError'; |
@@ -1,1 +0,1 @@ | ||
"use strict";function __export(e){for(var r in e)exports.hasOwnProperty(r)||(exports[r]=e[r])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(require("./multithreading")),__export(require("./types")),__export(require("./VKAPI")); | ||
"use strict";function __export(e){for(var r in e)exports.hasOwnProperty(r)||(exports[r]=e[r])}Object.defineProperty(exports,"__esModule",{value:!0}),__export(require("./multithreading")),__export(require("./types")),__export(require("./VKAPI")),__export(require("./VKError")); |
@@ -1,1 +0,1 @@ | ||
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))(function(n,o){function i(e){try{a(s.next(e))}catch(e){o(e)}}function u(e){try{a(s.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,u)}a((s=s.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,s,n,o,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,s&&(n=2&o[0]?s.return:o[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,o[1])).done)return n;switch(s=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,s=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){i.label=o[1];break}if(6===o[0]&&i.label<n[1]){i.label=n[1],n=o;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(o);break}n[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],s=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var isomorphic_fetch_1=__importDefault(require("isomorphic-fetch")),RequestsQueue_1=require("../RequestsQueue"),repositories_1=require("../repositories"),utils_1=require("./utils"),utils_2=require("../utils"),VKAPI=function(){return function(e){var t=this;this.accessToken=null,this.processRequest=function(e){return t.requestsQueue.add(e)},this.sendRequest=function(e){return __awaiter(t,void 0,void 0,function(){var t,r,s,n,o,i,u;return __generator(this,function(a){switch(a.label){case 0:return t=e.method,r=e.options,s=utils_2.formatQuery(__assign({v:this.version,accessToken:this.accessToken},r)),[4,isomorphic_fetch_1.default("https://api.vk.com/method/"+t+"?"+s).then(function(e){return e.json()})];case 1:if((n=a.sent()).error)throw o=utils_1.recursiveToCamelCase(n.error),i=o.errorCode,u=o.errorMsg,new Error(i+": "+u);return[2,utils_1.recursiveToCamelCase(n.response)]}})})};var r=e.requestsPerSecond,s=e.accessToken,n=e.version;this.accessToken=s||null,this.version=n||"5.122",this.requestsQueue=new RequestsQueue_1.RequestsQueue({requestsPerSecond:r,sendRequest:this.sendRequest}),this.users=new repositories_1.UsersRepository({processRequest:this.processRequest}),this.notifications=new repositories_1.NotificationsRepository({processRequest:this.processRequest}),this.messages=new repositories_1.MessagesRepository({processRequest:this.processRequest})}}();exports.VKAPI=VKAPI; | ||
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))(function(n,o){function i(e){try{a(s.next(e))}catch(e){o(e)}}function u(e){try{a(s.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,u)}a((s=s.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,s,n,o,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,s&&(n=2&o[0]?s.return:o[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,o[1])).done)return n;switch(s=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,s=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){i.label=o[1];break}if(6===o[0]&&i.label<n[1]){i.label=n[1],n=o;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(o);break}n[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],s=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});var isomorphic_fetch_1=__importDefault(require("isomorphic-fetch")),RequestsQueue_1=require("../RequestsQueue"),repositories_1=require("../repositories"),utils_1=require("./utils"),utils_2=require("../utils"),VKError_1=require("../VKError"),VKAPI=function(){return function(e){var t=this;this.accessToken=null,this.processRequest=function(e){return t.requestsQueue.add(e)},this.sendRequest=function(e){return __awaiter(t,void 0,void 0,function(){var t,r,s,n;return __generator(this,function(o){switch(o.label){case 0:return t=e.method,r=e.options,s=utils_2.formatQuery(__assign({v:this.version,accessToken:this.accessToken},r)),[4,isomorphic_fetch_1.default("https://api.vk.com/method/"+t+"?"+s).then(function(e){return e.json()})];case 1:if((n=o.sent()).error)throw new VKError_1.VKError(n.error);return[2,utils_1.recursiveToCamelCase(n.response)]}})})};var r=e.requestsPerSecond,s=e.accessToken,n=e.version;this.accessToken=s||null,this.version=n||"5.122",this.requestsQueue=new RequestsQueue_1.RequestsQueue({requestsPerSecond:r,sendRequest:this.sendRequest}),this.users=new repositories_1.UsersRepository({processRequest:this.processRequest}),this.notifications=new repositories_1.NotificationsRepository({processRequest:this.processRequest}),this.messages=new repositories_1.MessagesRepository({processRequest:this.processRequest})}}();exports.VKAPI=VKAPI; |
{ | ||
"name": "vkontakte-api", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
49129
66
751