vkontakte-api
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [3.0.3](https://github.com/wolframdeus/vk-api/compare/v3.0.2...v3.0.3) (2022-03-09) | ||
### Bug Fixes | ||
* **vkapi:** accept other format of baseURL ([2896cb1](https://github.com/wolframdeus/vk-api/commit/2896cb19f65e6e92ea8793681e32cbbdb9778398)) | ||
### [3.0.2](https://github.com/wolframdeus/vk-api/compare/v3.0.1...v3.0.2) (2021-07-05) | ||
@@ -7,0 +14,0 @@ |
@@ -17,3 +17,3 @@ import { IRepositories, TAddRepository, TLang, TSendRequest } from '../types'; | ||
* API URL. | ||
* @default "https://api.vk.com/method" | ||
* @default "https://api.vk.com" | ||
*/ | ||
@@ -20,0 +20,0 @@ baseUrl?: string; |
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},__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")),Core_1=require("../Core"),Queue_1=require("../Queue"),utils_1=require("./utils"),VKAPI=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;n.accessToken=null,n.sendRequest=function(e){return __awaiter(n,void 0,void 0,function(){var t,n,r,o,i,s,a,u,c;return __generator(this,function(l){switch(l.label){case 0:return t=e.method,n=e.params,r=e.format,o=void 0===r?function(e){return e}:r,i=__assign({v:this.v,access_token:this.accessToken,lang:this.lang},n),s=Object.entries(i).filter(function(e){return void 0!==e[1]}).map(function(e){var t=e[0],n=e[1],r="object"==typeof n?JSON.stringify(n):String(n);return encodeURIComponent(t)+"="+encodeURIComponent(r)}).join("&"),a=this.baseUrl+"/"+t,this.isBrowser?[2,new Promise(function(t,n){var r="__vkapicallback"+Math.random().toString().slice(2),u=document.createElement("script");u.src=a+"?"+s+"&callback="+r,window[r]=function(r){document.head.removeChild(u);try{t(o(utils_1.validateResponse(r,e),i))}catch(e){n(e)}},document.head.appendChild(u)})]:[4,isomorphic_fetch_1.default(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s})];case 1:if(!(u=l.sent()).ok)throw new Error("Unsuccessful response: "+u.status+". "+u.statusText);l.label=2;case 2:return l.trys.push([2,4,,5]),[4,u.json()];case 3:return c=l.sent(),[3,5];case 4:throw l.sent(),new Error("Response from server was not JSON");case 5:return[2,o(utils_1.validateResponse(c,e),i)]}})})},n.addRequestToQueue=function(e){return __awaiter(n,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)]}})})},n.addRepository=function(t,r){return e.prototype.addRepository.call(n,t,r,n.addRequestToQueue)};var r=t.rps,o=void 0===r?3:r,i=t.accessToken,s=t.v,a=void 0===s?"5.110":s,u=t.lang,c=void 0===u?"ru":u,l=t.isBrowser,f=void 0!==l&&l,p=t.baseUrl,h=void 0===p?"https://api.vk.com/method":p;return n.accessToken=i||null,n.v=a,n.lang=c,n.isBrowser=f,n.queue=new Queue_1.Queue({timeout:Math.ceil(1e3/o)}),n.baseUrl=h.endsWith("/")?h.slice(0,h.length-1):h,n.init(n.addRequestToQueue),n}return __extends(t,e),t}(Core_1.Core);exports.VKAPI=VKAPI; | ||
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},__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")),Core_1=require("../Core"),Queue_1=require("../Queue"),utils_1=require("./utils"),VKAPI=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;n.accessToken=null,n.sendRequest=function(e){return __awaiter(n,void 0,void 0,function(){var t,n,r,o,i,s,a,u,c;return __generator(this,function(l){switch(l.label){case 0:return t=e.method,n=e.params,r=e.format,o=void 0===r?function(e){return e}:r,i=__assign({v:this.v,access_token:this.accessToken,lang:this.lang},n),s=Object.entries(i).filter(function(e){return void 0!==e[1]}).map(function(e){var t=e[0],n=e[1],r="object"==typeof n?JSON.stringify(n):String(n);return encodeURIComponent(t)+"="+encodeURIComponent(r)}).join("&"),a=this.baseUrl+"/method/"+t,this.isBrowser?[2,new Promise(function(t,n){var r="__vkapicallback"+Math.random().toString().slice(2),u=document.createElement("script");u.src=a+"?"+s+"&callback="+r,window[r]=function(r){document.head.removeChild(u);try{t(o(utils_1.validateResponse(r,e),i))}catch(e){n(e)}},document.head.appendChild(u)})]:[4,isomorphic_fetch_1.default(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s})];case 1:if(!(u=l.sent()).ok)throw new Error("Unsuccessful response: "+u.status+". "+u.statusText);l.label=2;case 2:return l.trys.push([2,4,,5]),[4,u.json()];case 3:return c=l.sent(),[3,5];case 4:throw l.sent(),new Error("Response from server was not JSON");case 5:return[2,o(utils_1.validateResponse(c,e),i)]}})})},n.addRequestToQueue=function(e){return __awaiter(n,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)]}})})},n.addRepository=function(t,r){return e.prototype.addRepository.call(n,t,r,n.addRequestToQueue)};var r=t.rps,o=void 0===r?3:r,i=t.accessToken,s=t.v,a=void 0===s?"5.110":s,u=t.lang,c=void 0===u?"ru":u,l=t.isBrowser,f=void 0!==l&&l,p=t.baseUrl,h=void 0===p?"https://api.vk.com":p;return n.accessToken=i||null,n.v=a,n.lang=c,n.isBrowser=f,n.queue=new Queue_1.Queue({timeout:Math.ceil(1e3/o)}),n.baseUrl=h.endsWith("/")?h.slice(0,h.length-1):h,n.init(n.addRequestToQueue),n}return __extends(t,e),t}(Core_1.Core);exports.VKAPI=VKAPI; |
{ | ||
"name": "vkontakte-api", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "TypeScript library to make requests performing to VK API simple", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/wolframdeus/vk-api", |
@@ -0,0 +0,0 @@ [npm-badge]: https://img.shields.io/npm/v/vkontakte-api.svg |
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
204758