Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vkontakte-api

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vkontakte-api - npm Package Compare versions

Comparing version 2.5.2 to 2.5.3

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [2.5.3](https://github.com/wolframdeus/vk-api/compare/v2.5.2...v2.5.3) (2021-06-24)
### Bug Fixes
* **vkapi:** check response.ok in sendRequest ([d291cf2](https://github.com/wolframdeus/vk-api/commit/d291cf212f445b2d28ce6b90b3ffd44f1abbe1fc))
### [2.5.2](https://github.com/wolframdeus/vk-api/compare/v2.5.1...v2.5.2) (2021-06-24)

@@ -7,0 +14,0 @@

3

dist/VKAPI/VKAPI-[source].js

@@ -141,2 +141,5 @@ "use strict";

response = _b.sent();
if (!response.ok) {
throw new Error('Unsuccessful response: ' + response.status + '. ' + response.statusText);
}
return [4 /*yield*/, response.json()];

@@ -143,0 +146,0 @@ case 2:

2

dist/VKAPI/VKAPI.js

@@ -1,1 +0,1 @@

"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,u)}a((n=n.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VKAPI=void 0;var isomorphic_fetch_1=__importDefault(require("isomorphic-fetch")),VKError_1=require("../VKError"),utils_1=require("../utils"),Core_1=require("../Core"),Queue_1=require("../Queue"),VKAPI=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;r.accessToken=null,r.sendRequest=function(e){return __awaiter(r,void 0,void 0,function(){var t,r,n,o,i,s,u,a,c;return __generator(this,function(l){switch(l.label){case 0:return t=e.method,r=e.params,n=e.format,o=void 0===n?function(e){return e}:n,i=__assign({v:this.v,accessToken:this.accessToken,lang:this.lang},r),s=utils_1.recursiveToSnakeCase(i),u=Object.entries(s).filter(function(e){return void 0!==e[1]}).map(function(e){var t=e[0],r=e[1],n="object"==typeof r?JSON.stringify(r):String(r);return encodeURIComponent(t)+"="+encodeURIComponent(n)}).join("&"),a=this.baseUrl+"/"+t,this.isBrowser?[2,new Promise(function(t,r){var n="__vkapicallback"+Math.random().toString().slice(2),s=document.createElement("script");s.src=a+"?"+u+"&callback="+n,window[n]=function(n){if(document.head.removeChild(s),null==n?void 0:n.response)return t(o(utils_1.recursiveToCamelCase(n.response),i));r(new VKError_1.VKError({errorInfo:utils_1.recursiveToCamelCase((null==n?void 0:n.error)||{}),config:e}))},document.head.appendChild(s)})]:[4,isomorphic_fetch_1.default(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:u})];case 1:return[4,l.sent().json()];case 2:if("response"in(c=l.sent()))return[2,o(utils_1.recursiveToCamelCase(c.response),i)];throw new VKError_1.VKError({errorInfo:utils_1.recursiveToCamelCase((null==c?void 0:c.error)||{}),config:e})}})})},r.addRequestToQueue=function(e){return __awaiter(r,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,this.queue.await()];case 1:return t.sent(),[2,this.sendRequest(e)]}})})},r.addRepository=function(t,n){return e.prototype.addRepository.call(r,t,n,r.addRequestToQueue)};var n=t.rps,o=void 0===n?3:n,i=t.accessToken,s=t.v,u=void 0===s?"5.110":s,a=t.lang,c=void 0===a?"ru":a,l=t.isBrowser,f=void 0!==l&&l,p=t.baseUrl,_=void 0===p?"https://api.vk.com/method":p;return r.accessToken=i||null,r.v=u,r.lang=c,r.isBrowser=f,r.queue=new Queue_1.Queue({timeout:Math.ceil(1e3/o)}),r.baseUrl=_.endsWith("/")?_.slice(0,_.length-1):_,r.init(r.addRequestToQueue),r}return __extends(t,e),t}(Core_1.Core);exports.VKAPI=VKAPI;
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,u)}a((n=n.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.VKAPI=void 0;var isomorphic_fetch_1=__importDefault(require("isomorphic-fetch")),VKError_1=require("../VKError"),utils_1=require("../utils"),Core_1=require("../Core"),Queue_1=require("../Queue"),VKAPI=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;r.accessToken=null,r.sendRequest=function(e){return __awaiter(r,void 0,void 0,function(){var t,r,n,o,i,s,u,a,c,l;return __generator(this,function(f){switch(f.label){case 0:return t=e.method,r=e.params,n=e.format,o=void 0===n?function(e){return e}:n,i=__assign({v:this.v,accessToken:this.accessToken,lang:this.lang},r),s=utils_1.recursiveToSnakeCase(i),u=Object.entries(s).filter(function(e){return void 0!==e[1]}).map(function(e){var t=e[0],r=e[1],n="object"==typeof r?JSON.stringify(r):String(r);return encodeURIComponent(t)+"="+encodeURIComponent(n)}).join("&"),a=this.baseUrl+"/"+t,this.isBrowser?[2,new Promise(function(t,r){var n="__vkapicallback"+Math.random().toString().slice(2),s=document.createElement("script");s.src=a+"?"+u+"&callback="+n,window[n]=function(n){if(document.head.removeChild(s),null==n?void 0:n.response)return t(o(utils_1.recursiveToCamelCase(n.response),i));r(new VKError_1.VKError({errorInfo:utils_1.recursiveToCamelCase((null==n?void 0:n.error)||{}),config:e}))},document.head.appendChild(s)})]:[4,isomorphic_fetch_1.default(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:u})];case 1:if(!(c=f.sent()).ok)throw new Error("Unsuccessful response: "+c.status+". "+c.statusText);return[4,c.json()];case 2:if("response"in(l=f.sent()))return[2,o(utils_1.recursiveToCamelCase(l.response),i)];throw new VKError_1.VKError({errorInfo:utils_1.recursiveToCamelCase((null==l?void 0:l.error)||{}),config:e})}})})},r.addRequestToQueue=function(e){return __awaiter(r,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return[4,this.queue.await()];case 1:return t.sent(),[2,this.sendRequest(e)]}})})},r.addRepository=function(t,n){return e.prototype.addRepository.call(r,t,n,r.addRequestToQueue)};var n=t.rps,o=void 0===n?3:n,i=t.accessToken,s=t.v,u=void 0===s?"5.110":s,a=t.lang,c=void 0===a?"ru":a,l=t.isBrowser,f=void 0!==l&&l,p=t.baseUrl,_=void 0===p?"https://api.vk.com/method":p;return r.accessToken=i||null,r.v=u,r.lang=c,r.isBrowser=f,r.queue=new Queue_1.Queue({timeout:Math.ceil(1e3/o)}),r.baseUrl=_.endsWith("/")?_.slice(0,_.length-1):_,r.init(r.addRequestToQueue),r}return __extends(t,e),t}(Core_1.Core);exports.VKAPI=VKAPI;
{
"name": "vkontakte-api",
"version": "2.5.2",
"version": "2.5.3",
"description": "TypeScript library to make requests performing to VK API simple",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/wolframdeus/vk-api",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc