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 1.6.3 to 1.7.0

dist/repositories/StatsRepository/index.d.ts

7

CHANGELOG.md

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

## [1.7.0](https://github.com/wolframdeus/vk-api/compare/v1.6.3...v1.7.0) (2020-06-20)
### Features
* **stats:** add stats repository ([502425c](https://github.com/wolframdeus/vk-api/commit/502425c4688bd17b04331ed896761ef157e1551f))
### [1.6.3](https://github.com/wolframdeus/vk-api/compare/v1.6.2...v1.6.3) (2020-06-19)

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

3

dist/multithreading/VKAPISlave/VKAPISlave.d.ts
import { VKAPIInterface } from '../../VKAPI';
import { UsersRepository, MessagesRepository, NotificationsRepository, DatabaseRepository, UtilsRepository } from '../../repositories';
import { UsersRepository, MessagesRepository, NotificationsRepository, DatabaseRepository, UtilsRepository, StatsRepository } from '../../repositories';
import { SendRequest } from '../../types';

@@ -13,2 +13,3 @@ import { VKAPISlaveConstructorProps } from './types';

notifications: NotificationsRepository;
stats: StatsRepository;
users: UsersRepository;

@@ -15,0 +16,0 @@ utils: UtilsRepository;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var utils_1=require("./utils"),repositories_1=require("../../repositories"),VKAPISlave=function(){return function(e){var s=this;if(void 0===e&&(e={}),this.requestId="0",this.addRequestToQueue=function(e){if(!process.send)throw new Error('Unable to process VKAPI request from slave due to there is no "process.send" method available. It looks like it was created in main thread, but not in fork');var t=(parseInt(s.requestId)+1).toString(16),r=process.pid,o={tunnelName:s.tunnelName,processId:r,requestId:t,isVKAPIMessage:!0,type:"process-request",config:e};return process.send(o),s.requestId=t,new Promise(function(e,o){var i=function(n){if(utils_1.isVKAPIRequestProcessedMessage(n)&&n.tunnelName===s.tunnelName&&n.requestId===t&&n.processId===r){if(process.off("message",i),n.error)return o(n.error);e(n.data)}};process.on("message",i)})},!process.send)throw new Error('Unable to create VKAPISlave due to there is no "process.send" method available. It looks like it was created in main thread, but not in fork');var t=e.tunnelName,r=void 0===t?"":t;this.tunnelName=r,this.database=new repositories_1.DatabaseRepository(this.addRequestToQueue),this.messages=new repositories_1.MessagesRepository(this.addRequestToQueue),this.notifications=new repositories_1.NotificationsRepository(this.addRequestToQueue),this.users=new repositories_1.UsersRepository(this.addRequestToQueue),this.utils=new repositories_1.UtilsRepository(this.addRequestToQueue)}}();exports.VKAPISlave=VKAPISlave;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var utils_1=require("./utils"),repositories_1=require("../../repositories"),VKAPISlave=function(){return function(e){var s=this;if(void 0===e&&(e={}),this.requestId="0",this.addRequestToQueue=function(e){if(!process.send)throw new Error('Unable to process VKAPI request from slave due to there is no "process.send" method available. It looks like it was created in main thread, but not in fork');var t=(parseInt(s.requestId)+1).toString(16),o=process.pid,r={tunnelName:s.tunnelName,processId:o,requestId:t,isVKAPIMessage:!0,type:"process-request",config:e};return process.send(r),s.requestId=t,new Promise(function(e,r){var i=function(a){if(utils_1.isVKAPIRequestProcessedMessage(a)&&a.tunnelName===s.tunnelName&&a.requestId===t&&a.processId===o){if(process.off("message",i),a.error)return r(a.error);e(a.data)}};process.on("message",i)})},!process.send)throw new Error('Unable to create VKAPISlave due to there is no "process.send" method available. It looks like it was created in main thread, but not in fork');var t=e.tunnelName,o=void 0===t?"":t;this.tunnelName=o,this.database=new repositories_1.DatabaseRepository(this.addRequestToQueue),this.messages=new repositories_1.MessagesRepository(this.addRequestToQueue),this.notifications=new repositories_1.NotificationsRepository(this.addRequestToQueue),this.stats=new repositories_1.StatsRepository(this.addRequestToQueue),this.users=new repositories_1.UsersRepository(this.addRequestToQueue),this.utils=new repositories_1.UtilsRepository(this.addRequestToQueue)}}();exports.VKAPISlave=VKAPISlave;
import { Repository } from '../Repository';
import { RepositoryMethod, SendRequest } from '../../types';
import { GetChairsParams, GetChairsResult, GetCitiesByIdParams, GetCitiesByIdResult, GetCitiesParams, GetCitiesResult, GetCountriesByIdParams, GetCountriesByIdResult, GetCountriesParams, GetFacultiesParams, GetMetroStationsByIdParams, GetMetroStationsByIdResult, GetMetroStationsParams, GetMetroStationsResult, GetRegionsParams, GetSchoolClassesParams, GetSchoolClassesResult, GetSchoolsParams, GetUniversitiesParams } from './types';
import { SendRequest } from '../../types';
import { GetChairsParams, GetCitiesByIdParams, GetCitiesByIdResult, GetCitiesParams, GetCitiesResult, GetCountriesByIdParams, GetCountriesByIdResult, GetCountriesParams, GetFacultiesParams, GetMetroStationsByIdParams, GetMetroStationsByIdResult, GetMetroStationsParams, GetMetroStationsResult, GetRegionsParams, GetSchoolClassesParams, GetSchoolClassesResult, GetSchoolsParams, GetUniversitiesParams } from './types';
/**

@@ -10,14 +10,6 @@ * Repository to work with users

/**
* Creates repo method
* @param {string} name
* @param {(params: Params) => any} prepare
* @returns {RepositoryMethod<Params, Response>}
*/
private createMethod;
private formatBooleans;
/**
* @see https://vk.com/dev/database.getChairs
* @type {RepositoryMethod<GetChairsParams, GetChairsResult>}
*/
getChairs: RepositoryMethod<GetChairsParams, GetChairsResult>;
getChairs: import("../../types").RepositoryMethod<GetChairsParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
/**

@@ -27,3 +19,3 @@ * @see https://vk.com/dev/database.getCities

*/
getCities: RepositoryMethod<GetCitiesParams, GetCitiesResult>;
getCities: import("../../types").RepositoryMethod<GetCitiesParams, GetCitiesResult>;
/**

@@ -33,3 +25,3 @@ * @see https://vk.com/dev/database.getCitiesById

*/
getCitiesById: RepositoryMethod<GetCitiesByIdParams, GetCitiesByIdResult>;
getCitiesById: import("../../types").RepositoryMethod<GetCitiesByIdParams, GetCitiesByIdResult>;
/**

@@ -39,3 +31,3 @@ * @see https://vk.com/dev/database.getCountries

*/
getCountries: RepositoryMethod<GetCountriesParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
getCountries: import("../../types").RepositoryMethod<GetCountriesParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
/**

@@ -45,3 +37,3 @@ * @see https://vk.com/dev/database.getCountriesById

*/
getCountriesById: RepositoryMethod<GetCountriesByIdParams, GetCountriesByIdResult>;
getCountriesById: import("../../types").RepositoryMethod<GetCountriesByIdParams, GetCountriesByIdResult>;
/**

@@ -51,3 +43,3 @@ * @see https://vk.com/dev/database.getFaculties

*/
getFaculties: RepositoryMethod<GetFacultiesParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
getFaculties: import("../../types").RepositoryMethod<GetFacultiesParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
/**

@@ -57,3 +49,3 @@ * @see https://vk.com/dev/database.getMetroStations

*/
getMetroStations: RepositoryMethod<GetMetroStationsParams, GetMetroStationsResult>;
getMetroStations: import("../../types").RepositoryMethod<GetMetroStationsParams, GetMetroStationsResult>;
/**

@@ -63,3 +55,3 @@ * @see https://vk.com/dev/database.getMetroStationsById

*/
getMetroStationsById: RepositoryMethod<GetMetroStationsByIdParams, GetMetroStationsByIdResult>;
getMetroStationsById: import("../../types").RepositoryMethod<GetMetroStationsByIdParams, GetMetroStationsByIdResult>;
/**

@@ -69,3 +61,3 @@ * @see https://vk.com/dev/database.getRegions

*/
getRegions: RepositoryMethod<GetRegionsParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
getRegions: import("../../types").RepositoryMethod<GetRegionsParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
/**

@@ -75,3 +67,3 @@ * @see https://vk.com/dev/database.getSchoolClasses

*/
getSchoolClasses: RepositoryMethod<GetSchoolClassesParams, GetSchoolClassesResult>;
getSchoolClasses: import("../../types").RepositoryMethod<GetSchoolClassesParams, GetSchoolClassesResult>;
/**

@@ -81,3 +73,3 @@ * @see https://vk.com/dev/database.getSchools

*/
getSchools: RepositoryMethod<GetSchoolsParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
getSchools: import("../../types").RepositoryMethod<GetSchoolsParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
/**

@@ -87,3 +79,3 @@ * @see https://vk.com/dev/database.getUniversities

*/
getUniversities: RepositoryMethod<GetUniversitiesParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
getUniversities: import("../../types").RepositoryMethod<GetUniversitiesParams, import("../../types").Pager<import("../../types").IdTitlePair>>;
}

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

"use strict";var __extends=this&&this.__extends||function(){var t=function(e,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(e,o)};return function(e,o){function r(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,o=1,r=arguments.length;o<r;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var o={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(o[r[s]]=t[r[s]])}return o};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),DatabaseRepository=function(t){function e(e){var o=t.call(this,"database",e)||this;return o.formatBooleans=function(t){var e=t.needAll,o=t.extended,r=__rest(t,["needAll","extended"]);return void 0!==e&&(r.needAll=utils_1.toPseudoBoolean(e)),void 0!==o&&(r.extended=utils_1.toPseudoBoolean(o)),r},o.getChairs=o.createMethod("getChairs"),o.getCities=o.createMethod("getCities",function(t){return o.formatBooleans(t)}),o.getCitiesById=o.createMethod("getCitiesById",function(t){var e=t.cityIds,o=__rest(t,["cityIds"]);return __assign(__assign({},o),{cityIds:void 0===e?e:utils_1.arrayToString(e)})}),o.getCountries=o.createMethod("getCountries",function(t){var e=t.code,r=__rest(t,["code"]);return o.formatBooleans(__assign(__assign({},r),{code:void 0===e?e:utils_1.arrayToString(e)}))}),o.getCountriesById=o.createMethod("getCountriesById",function(t){var e=t.countryIds,o=__rest(t,["countryIds"]);return __assign(__assign({},o),{countryIds:void 0===e?e:utils_1.arrayToString(e)})}),o.getFaculties=o.createMethod("getFaculties"),o.getMetroStations=o.createMethod("getMetroStations",o.formatBooleans),o.getMetroStationsById=o.createMethod("getMetroStationsById",function(t){var e=t.stationIds,o=__rest(t,["stationIds"]);return __assign(__assign({},o),{stationIds:void 0===e?e:utils_1.arrayToString(e)})}),o.getRegions=o.createMethod("getRegions"),o.getSchoolClasses=o.createMethod("getSchoolClasses"),o.getSchools=o.createMethod("getSchools"),o.getUniversities=o.createMethod("getUniversities"),o}return __extends(e,t),e.prototype.createMethod=function(t,e){var o=this;return function(r){return o.sendRequest({method:t,params:e?e(r):r})}},e}(Repository_1.Repository);exports.DatabaseRepository=DatabaseRepository;
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function s(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(s.prototype=r.prototype,new s)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),DatabaseRepository=function(t){function e(e){var r=t.call(this,"database",e)||this;return r.getChairs=r.r("getChairs"),r.getCities=r.r("getCities",function(t){var e=t.needAll,r=__rest(t,["needAll"]);return __assign(__assign({},r),{needAll:utils_1.formatOptionalBoolean(e)})}),r.getCitiesById=r.r("getCitiesById",function(t){var e=t.cityIds,r=__rest(t,["cityIds"]);return __assign(__assign({},r),{cityIds:utils_1.formatOptionalArray(e)})}),r.getCountries=r.r("getCountries",function(t){var e=t.code,r=t.needAll,s=__rest(t,["code","needAll"]);return __assign(__assign({},s),{needAll:utils_1.formatOptionalBoolean(r),code:utils_1.formatOptionalArray(e)})}),r.getCountriesById=r.r("getCountriesById",function(t){var e=t.countryIds,r=__rest(t,["countryIds"]);return __assign(__assign({},r),{countryIds:utils_1.formatOptionalArray(e)})}),r.getFaculties=r.r("getFaculties"),r.getMetroStations=r.r("getMetroStations",function(t){var e=t.extended,r=__rest(t,["extended"]);return __assign(__assign({},r),{extended:utils_1.formatOptionalBoolean(e)})}),r.getMetroStationsById=r.r("getMetroStationsById",function(t){var e=t.stationIds,r=__rest(t,["stationIds"]);return __assign(__assign({},r),{stationIds:utils_1.formatOptionalArray(e)})}),r.getRegions=r.r("getRegions"),r.getSchoolClasses=r.r("getSchoolClasses"),r.getSchools=r.r("getSchools"),r.getUniversities=r.r("getUniversities"),r}return __extends(e,t),e}(Repository_1.Repository);exports.DatabaseRepository=DatabaseRepository;

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

export * from './types';
export * from './DatabaseRepository';

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

import { IdTitlePair, PseudoBooleanType, Pager } from '../../types';
import { IdTitlePair, Pager } from '../../types';
/**

@@ -6,16 +6,3 @@ * Default pager with item as object with id and title

declare type DefaultPager = Pager<IdTitlePair>;
declare type FormatBooleansOverridableProps = 'needAll' | 'extended';
/**
* Format booleans overridable props
*/
export declare type FormatBooleansOverridable = {
[key in FormatBooleansOverridableProps]?: boolean;
};
/**
* Overridden by formatBooleans return type
*/
export declare type FormatBooleansOverridden<T> = Omit<T, FormatBooleansOverridableProps> & {
[key in FormatBooleansOverridableProps]?: PseudoBooleanType;
};
/**
* @see https://vk.com/dev/database.getChairs

@@ -28,3 +15,3 @@ */

}
export declare type GetChairsResult = IdTitlePair[];
export declare type GetChairsResult = DefaultPager;
/**

@@ -31,0 +18,0 @@ * @see https://vk.com/dev/database.getCities

export * from './DatabaseRepository';
export * from './MessagesRepository';
export * from './NotificationsRepository';
export * from './StatsRepository';
export * from './UsersRepository';
export * from './UtilsRepository';

@@ -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("./DatabaseRepository")),__export(require("./MessagesRepository")),__export(require("./NotificationsRepository")),__export(require("./UsersRepository")),__export(require("./UtilsRepository"));
"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("./DatabaseRepository")),__export(require("./MessagesRepository")),__export(require("./NotificationsRepository")),__export(require("./StatsRepository")),__export(require("./UsersRepository")),__export(require("./UtilsRepository"));
export * from './MessagesRepository';
export * from './types';
import { Repository } from '../Repository';
import { RepositoryMethod, SendRequest } from '../../types';
import { SendRequest } from '../../types';
import { SendParams, SendResult } from './types';

@@ -9,8 +9,3 @@ /**

constructor(sendRequest: SendRequest);
/**
* @see https://vk.com/dev/messages.send
* @param {SendParams & RequestOptionalParams} params
* @returns {Promise<any>}
*/
send: RepositoryMethod<SendParams, SendResult>;
send: import("../../types").RepositoryMethod<SendParams, SendResult>;
}

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

"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),MessagesRepository=function(t){function e(e){var r=t.call(this,"messages",e)||this;return r.send=function(t){var e=t.randomId,o=__rest(t,["randomId"]);return r.sendRequest({method:"send",params:__assign(__assign({},o),{randomId:e||Math.floor(1e7*Math.random())})})},r}return __extends(e,t),e}(Repository_1.Repository);exports.MessagesRepository=MessagesRepository;
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),MessagesRepository=function(t){function e(e){var r=t.call(this,"messages",e)||this;return r.send=r.r("send",function(t){var e=t.randomId,r=__rest(t,["randomId"]);return __assign(__assign({},r),{randomId:void 0===e?Math.floor(1e7*Math.random()):e})}),r}return __extends(e,t),e}(Repository_1.Repository);exports.MessagesRepository=MessagesRepository;
export * from './NotificationsRepository';
export * from './types';

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

import { MarkAsViewedResult, SendMessageResult, SendMessageParams, MarkAsViewedParams } from './types';
import { SendMessageResult, SendMessageParams, MarkAsViewedParams } from './types';
import { Repository } from '../Repository';
import { RepositoryMethod, SendRequest } from '../../types';
import { SendRequest } from '../../types';
/**

@@ -11,11 +11,10 @@ * Repository to work with notifications

* @see https://vk.com/dev/notifications.markAsViewed
* @returns {Promise<any>}
* @type {RepositoryMethod<MarkAsViewedParams, MarkAsViewedResult>}
*/
markAsViewed: RepositoryMethod<MarkAsViewedParams, MarkAsViewedResult>;
markAsViewed: import("../../types").RepositoryMethod<MarkAsViewedParams, import("../../types").PseudoBooleanType>;
/**
* @see https://vk.com/dev/notifications.sendMessage
* @param {SendMessageParams & RequestOptionalParams} params
* @returns {Promise<any>}
* @type {RepositoryMethod<SendMessageParams, SendMessageResult>}
*/
sendMessage: RepositoryMethod<SendMessageParams, SendMessageResult>;
sendMessage: import("../../types").RepositoryMethod<SendMessageParams, SendMessageResult>;
}

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

"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),NotificationsRepository=function(t){function e(e){var r=t.call(this,"notifications",e)||this;return r.markAsViewed=function(t){return r.sendRequest({method:"markAsViewed",params:t})},r.sendMessage=function(t){var e=t.userIds,o=__rest(t,["userIds"]);return r.sendRequest({method:"sendMessage",params:__assign(__assign({},o),{userIds:e.join(",")})})},r}return __extends(e,t),e}(Repository_1.Repository);exports.NotificationsRepository=NotificationsRepository;
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var n in r=arguments[e])Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(e[o[n]]=t[o[n]])}return e};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),NotificationsRepository=function(t){function r(r){var e=t.call(this,"notifications",r)||this;return e.markAsViewed=e.r("markAsViewed"),e.sendMessage=e.r("sendMessage",function(t){var r=t.userIds,e=__rest(t,["userIds"]);return __assign(__assign({},e),{userIds:utils_1.formatOptionalArray(r)})}),e}return __extends(r,t),r}(Repository_1.Repository);exports.NotificationsRepository=NotificationsRepository;

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

import { SendRequest } from '../types';
import { RepositoryMethod, SendRequest } from '../types';
/**

@@ -11,2 +11,9 @@ * Base class to create repositories

protected constructor(repoName: string, sendRequest: SendRequest);
/**
* Creates method
* @param {string} method
* @param prepare
* @returns {RepositoryMethod<P, R>}
*/
protected r<P, R>(method: string, prepare?: (params: P) => any): RepositoryMethod<P, R>;
}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Repository=function(){return function(e,t){this.sendRequest=function(r){var o=r.method,s=r.params;return t({method:e+"."+o,params:s})}}}();exports.Repository=Repository;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Repository=function(){function e(e,t){this.sendRequest=function(r){var o=r.method,n=r.params;return t({method:e+"."+o,params:n})}}return e.prototype.r=function(e,t){var r=this;return function(o){return r.sendRequest({method:e,params:t?t(o):o})}},e}();exports.Repository=Repository;

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

export * from './types';
export * from './UsersRepository';
import { Repository } from '../Repository';
import { RepositoryMethod, SendRequest } from '../../types';
import { SendRequest } from '../../types';
import { GetParams, GetResult } from './types';

@@ -11,6 +11,5 @@ /**

* @see https://vk.com/dev/users.get
* @param {GetParams & RequestOptionalParams} params
* @returns {Promise<any>}
* @type {RepositoryMethod<GetParams, GetResult>}
*/
get: RepositoryMethod<GetParams, GetResult>;
get: import("../../types").RepositoryMethod<GetParams, GetResult>;
}

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

"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function s(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,s=arguments.length;e<s;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&r.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)r.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(e[s[o]]=t[s[o]])}return e};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),UsersRepository=function(t){function r(r){var e=t.call(this,"users",r)||this;return e.get=function(t){var r=t.userIds,s=__rest(t,["userIds"]);return e.sendRequest({method:"get",params:__assign(__assign({},s),{userIds:utils_1.arrayToString(r)})})},e}return __extends(r,t),r}(Repository_1.Repository);exports.UsersRepository=UsersRepository;
"use strict";var __extends=this&&this.__extends||function(){var t=function(r,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(r,e)};return function(r,e){function o(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++)for(var s in r=arguments[e])Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,r){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&r.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(t);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(t,o[s])&&(e[o[s]]=t[o[s]])}return e};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),UsersRepository=function(t){function r(r){var e=t.call(this,"users",r)||this;return e.get=e.r("get",function(t){var r=t.userIds,e=t.fields,o=__rest(t,["userIds","fields"]);return __assign(__assign({},o),{userIds:utils_1.formatOptionalArray(r),fields:utils_1.formatOptionalArray(e)})}),e}return __extends(r,t),r}(Repository_1.Repository);exports.UsersRepository=UsersRepository;

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

export * from './types';
export * from './UtilsRepository';

@@ -32,3 +32,3 @@ import { Pager, PseudoBooleanType } from '../../types';

views: number;
accessKey: string;
accessKey?: string;
}>;

@@ -35,0 +35,0 @@ /**

import { Repository } from '../Repository';
import { RepositoryMethod, SendRequest } from '../../types';
import { SendRequest } from '../../types';
import { CheckLinkParams, CheckLinkResult, DeleteFromLastShortenedParams, GetLastShortenedLinksParams, GetLastShortenedLinksResult, GetLinkStatsParams, GetServerTimeParams, GetShortLinkParams, GetShortLinkResult, ResolveScreenNameParams, ResolveScreenNameResult } from './types';

@@ -10,13 +10,6 @@ /**

/**
* Creates method
* @param {string} method
* @param prepare
* @returns {RepositoryMethod<P, R>}
*/
private r;
/**
* @see https://vk.com/dev/utils.checkLink
* @type {RepositoryMethod<CheckLinkParams, CheckLinkResult>}
*/
checkLink: RepositoryMethod<CheckLinkParams, CheckLinkResult>;
checkLink: import("../../types").RepositoryMethod<CheckLinkParams, CheckLinkResult>;
/**

@@ -26,3 +19,3 @@ * @see https://vk.com/dev/utils.deleteFromLastShortened

*/
deleteFromLastShortened: RepositoryMethod<DeleteFromLastShortenedParams, 1>;
deleteFromLastShortened: import("../../types").RepositoryMethod<DeleteFromLastShortenedParams, 1>;
/**

@@ -32,3 +25,3 @@ * @see https://vk.com/dev/utils.getLastShortenedLinks

*/
getLastShortenedLinks: RepositoryMethod<GetLastShortenedLinksParams, GetLastShortenedLinksResult>;
getLastShortenedLinks: import("../../types").RepositoryMethod<GetLastShortenedLinksParams, GetLastShortenedLinksResult>;
/**

@@ -38,3 +31,3 @@ * @see https://vk.com/dev/utils.getLinkStats

*/
getLinkStats: RepositoryMethod<GetLinkStatsParams, GetLastShortenedLinksResult>;
getLinkStats: import("../../types").RepositoryMethod<GetLinkStatsParams, GetLastShortenedLinksResult>;
/**

@@ -44,3 +37,3 @@ * @see https://vk.com/dev/utils.getServerTime

*/
getServerTime: RepositoryMethod<GetServerTimeParams, number>;
getServerTime: import("../../types").RepositoryMethod<GetServerTimeParams, number>;
/**

@@ -50,3 +43,3 @@ * @see https://vk.com/dev/utils.getShortLink

*/
getShortLink: RepositoryMethod<GetShortLinkParams, GetShortLinkResult>;
getShortLink: import("../../types").RepositoryMethod<GetShortLinkParams, GetShortLinkResult>;
/**

@@ -56,3 +49,3 @@ * @see https://vk.com/dev/utils.resolveScreenName

*/
resolveScreenName: RepositoryMethod<ResolveScreenNameParams, ResolveScreenNameResult>;
resolveScreenName: import("../../types").RepositoryMethod<ResolveScreenNameParams, ResolveScreenNameResult>;
}

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

"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),UtilsRepository=function(t){function e(e){var r=t.call(this,"utils",e)||this;return r.checkLink=r.r("checkLink"),r.deleteFromLastShortened=r.r("deleteFromLastShortened"),r.getLastShortenedLinks=r.r("getLastShortenedLinks"),r.getLinkStats=r.r("getLinkStats",function(t){var e=t.extended,r=__rest(t,["extended"]);return __assign(__assign({},r),{extended:"boolean"==typeof e?utils_1.toPseudoBoolean(e):void 0})}),r.getServerTime=r.r("getServerTime"),r.getShortLink=r.r("getShortLink",function(t){var e=t.private,r=__rest(t,["private"]);return __assign(__assign({},r),{private:"boolean"==typeof e?utils_1.toPseudoBoolean(e):void 0})}),r.resolveScreenName=r.r("resolveScreenName"),r}return __extends(e,t),e.prototype.r=function(t,e){var r=this;return function(o){return r.sendRequest({method:t,params:e?e(o):o})}},e}(Repository_1.Repository);exports.UtilsRepository=UtilsRepository;
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},__rest=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};Object.defineProperty(exports,"__esModule",{value:!0});var Repository_1=require("../Repository"),utils_1=require("../../utils"),UtilsRepository=function(t){function e(e){var r=t.call(this,"utils",e)||this;return r.checkLink=r.r("checkLink"),r.deleteFromLastShortened=r.r("deleteFromLastShortened"),r.getLastShortenedLinks=r.r("getLastShortenedLinks"),r.getLinkStats=r.r("getLinkStats",function(t){var e=t.extended,r=__rest(t,["extended"]);return __assign(__assign({},r),{extended:utils_1.formatOptionalBoolean(e)})}),r.getServerTime=r.r("getServerTime"),r.getShortLink=r.r("getShortLink",function(t){var e=t.private,r=__rest(t,["private"]);return __assign(__assign({},r),{private:utils_1.formatOptionalBoolean(e)})}),r.resolveScreenName=r.r("resolveScreenName"),r}return __extends(e,t),e}(Repository_1.Repository);exports.UtilsRepository=UtilsRepository;

@@ -31,1 +31,13 @@ /**

export declare function arrayToString(arr: Array<string | number>): string;
/**
* Converts optional boolean type to PseudoBooleanType or undefined
* @param {boolean | undefined} value
* @returns {PseudoBooleanType | undefined}
*/
export declare function formatOptionalBoolean(value: boolean | undefined): PseudoBooleanType | undefined;
/**
* Converts optional array of strings or numbers to string or undefined
* @param {Array<string | number> | undefined} arr
* @returns {string | undefined}
*/
export declare function formatOptionalArray(arr: Array<string | number> | undefined): string | undefined;

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

"use strict";function createRecursiveKeysFormatter(e){var r=function(t){return null===t?null:Array.isArray(t)?t.map(r):"object"==typeof t?Object.keys(t).reduce(function(o,a){return o[e(a)]=r(t[a]),o},{}):t};return r}function toSnakeCase(e){return e.replace(/[A-Z]/g,function(e){return"_"+e.toLowerCase()})}function toCamelCase(e){return e.replace(/_./g,function(e){return e.slice(1).toUpperCase()})}function toPseudoBoolean(e){return e?1:0}function arrayToString(e){return e.join(",")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toSnakeCase=toSnakeCase,exports.recursiveToSnakeCase=createRecursiveKeysFormatter(toSnakeCase),exports.toCamelCase=toCamelCase,exports.recursiveToCamelCase=createRecursiveKeysFormatter(toCamelCase),exports.toPseudoBoolean=toPseudoBoolean,exports.arrayToString=arrayToString;
"use strict";function createRecursiveKeysFormatter(e){var o=function(r){return null===r?null:Array.isArray(r)?r.map(o):"object"==typeof r?Object.keys(r).reduce(function(t,a){return t[e(a)]=o(r[a]),t},{}):r};return o}function toSnakeCase(e){return e.replace(/[A-Z]/g,function(e){return"_"+e.toLowerCase()})}function toCamelCase(e){return e.replace(/_./g,function(e){return e.slice(1).toUpperCase()})}function toPseudoBoolean(e){return e?1:0}function arrayToString(e){return e.join(",")}function formatOptionalBoolean(e){return void 0===e?e:toPseudoBoolean(e)}function formatOptionalArray(e){return void 0===e?e:e.join(",")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toSnakeCase=toSnakeCase,exports.recursiveToSnakeCase=createRecursiveKeysFormatter(toSnakeCase),exports.toCamelCase=toCamelCase,exports.recursiveToCamelCase=createRecursiveKeysFormatter(toCamelCase),exports.toPseudoBoolean=toPseudoBoolean,exports.arrayToString=arrayToString,exports.formatOptionalBoolean=formatOptionalBoolean,exports.formatOptionalArray=formatOptionalArray;
import { SendRequest } from '../types';
import { VKAPIInterface, VKAPIConstructorProps } from './types';
import { UsersRepository, MessagesRepository, NotificationsRepository, DatabaseRepository, UtilsRepository } from '../repositories';
import { UsersRepository, MessagesRepository, NotificationsRepository, StatsRepository, DatabaseRepository, UtilsRepository } from '../repositories';
/**

@@ -11,2 +11,3 @@ * Class to perform request to VKontakte API

notifications: NotificationsRepository;
stats: StatsRepository;
users: UsersRepository;

@@ -13,0 +14,0 @@ utils: UtilsRepository;

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

"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(s,n){function o(e){try{a(i.next(e))}catch(e){n(e)}}function u(e){try{a(i.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,u)}a((i=i.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,i,s,n,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return n={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function u(n){return function(u){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(s=2&n[0]?i.return:n[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,n[1])).done)return s;switch(i=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,i=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!(s=(s=o.trys).length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){o=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){o.label=n[1];break}if(6===n[0]&&o.label<s[1]){o.label=s[1],s=n;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(n);break}s[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],i=0}finally{r=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,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")),VKError_1=require("../VKError"),EventEmitter_1=require("../EventEmitter"),utils_1=require("../utils"),repositories_1=require("../repositories"),VKAPI=function(){function e(e){var t=this;void 0===e&&(e={}),this.queue=[],this.isQueueProcessing=!1,this.eventEmitter=new EventEmitter_1.EventEmitter,this.accessToken=null,this.sendRequest=function(e){return __awaiter(t,void 0,void 0,function(){var t,r,i,s,n;return __generator(this,function(o){switch(o.label){case 0:return t=e.method,r=e.params,i=utils_1.recursiveToSnakeCase(__assign({v:this.v,accessToken:this.accessToken,lang:this.lang},r)),s=Object.entries(i).map(function(e){var t=e[0],r=e[1],i="object"==typeof r?JSON.stringify(r):String(r);return encodeURIComponent(t)+"="+encodeURIComponent(i)}).join("&"),[4,isomorphic_fetch_1.default("https://api.vk.com/method/"+t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s})];case 1:return[4,o.sent().json()];case 2:if((n=o.sent()).error)throw new VKError_1.VKError(utils_1.recursiveToCamelCase(n.error));return[2,utils_1.recursiveToCamelCase(n.response)]}})})},this.addRequestToQueue=function(e){var r=Symbol();t.queue.push({config:e,ref:r});var i=new Promise(function(e,i){var s=function(n,o,u){if(r===n){if(t.eventEmitter.off("request-performed",s),o)return i(o);e(u)}};t.eventEmitter.on("request-performed",s)});return t.processQueue(),i};var r=e.rps,i=void 0===r?3:r,s=e.accessToken,n=e.v,o=void 0===n?"5.110":n,u=e.lang,a=void 0===u?"ru":u;this.accessToken=s||null,this.v=o,this.lang=a,this.timeout=Math.ceil(1e3/i),this.database=new repositories_1.DatabaseRepository(this.addRequestToQueue),this.messages=new repositories_1.MessagesRepository(this.addRequestToQueue),this.notifications=new repositories_1.NotificationsRepository(this.addRequestToQueue),this.users=new repositories_1.UsersRepository(this.addRequestToQueue),this.utils=new repositories_1.UtilsRepository(this.addRequestToQueue)}return e.prototype.processQueue=function(){return __awaiter(this,void 0,void 0,function(){var e,t=this;return __generator(this,function(r){switch(r.label){case 0:return this.isQueueProcessing||0===this.queue.length?[2]:(this.isQueueProcessing=!0,(e=this.queue.map(function(e,r){return new Promise(function(i){setTimeout(function(){return __awaiter(t,void 0,void 0,function(){var t,r,s,n,o;return __generator(this,function(u){switch(u.label){case 0:t=e.config,r=e.ref,s=null,n=null,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.sendRequest(t)];case 2:return n=u.sent(),[3,4];case 3:return o=u.sent(),s=o,[3,4];case 4:return this.eventEmitter.emit("request-performed",r,s,n),this.queue.splice(this.queue.indexOf(e),1),i(),[2]}})})},r*t.timeout)})})).push(new Promise(function(e){setTimeout(e,t.queue.length*t.timeout)})),[4,Promise.all(e)]);case 1:return r.sent(),this.isQueueProcessing=!1,this.processQueue(),[2]}})})},e}();exports.VKAPI=VKAPI;
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(s,n){function o(e){try{a(i.next(e))}catch(e){n(e)}}function u(e){try{a(i.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,u)}a((i=i.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var r,i,s,n,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return n={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function u(n){return function(u){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(s=2&n[0]?i.return:n[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,n[1])).done)return s;switch(i=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,i=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!(s=(s=o.trys).length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){o=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){o.label=n[1];break}if(6===n[0]&&o.label<s[1]){o.label=s[1],s=n;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(n);break}s[2]&&o.ops.pop(),o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e],i=0}finally{r=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,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")),VKError_1=require("../VKError"),EventEmitter_1=require("../EventEmitter"),utils_1=require("../utils"),repositories_1=require("../repositories"),VKAPI=function(){function e(e){var t=this;void 0===e&&(e={}),this.queue=[],this.isQueueProcessing=!1,this.eventEmitter=new EventEmitter_1.EventEmitter,this.accessToken=null,this.sendRequest=function(e){return __awaiter(t,void 0,void 0,function(){var t,r,i,s,n;return __generator(this,function(o){switch(o.label){case 0:return t=e.method,r=e.params,i=utils_1.recursiveToSnakeCase(__assign({v:this.v,accessToken:this.accessToken,lang:this.lang},r)),s=Object.entries(i).map(function(e){var t=e[0],r=e[1],i="object"==typeof r?JSON.stringify(r):String(r);return encodeURIComponent(t)+"="+encodeURIComponent(i)}).join("&"),[4,isomorphic_fetch_1.default("https://api.vk.com/method/"+t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s})];case 1:return[4,o.sent().json()];case 2:if((n=o.sent()).error)throw new VKError_1.VKError(utils_1.recursiveToCamelCase(n.error));return[2,utils_1.recursiveToCamelCase(n.response)]}})})},this.addRequestToQueue=function(e){var r=Symbol();t.queue.push({config:e,ref:r});var i=new Promise(function(e,i){var s=function(n,o,u){if(r===n){if(t.eventEmitter.off("request-performed",s),o)return i(o);e(u)}};t.eventEmitter.on("request-performed",s)});return t.processQueue(),i};var r=e.rps,i=void 0===r?3:r,s=e.accessToken,n=e.v,o=void 0===n?"5.110":n,u=e.lang,a=void 0===u?"ru":u;this.accessToken=s||null,this.v=o,this.lang=a,this.timeout=Math.ceil(1e3/i),this.database=new repositories_1.DatabaseRepository(this.addRequestToQueue),this.messages=new repositories_1.MessagesRepository(this.addRequestToQueue),this.notifications=new repositories_1.NotificationsRepository(this.addRequestToQueue),this.stats=new repositories_1.StatsRepository(this.addRequestToQueue),this.users=new repositories_1.UsersRepository(this.addRequestToQueue),this.utils=new repositories_1.UtilsRepository(this.addRequestToQueue)}return e.prototype.processQueue=function(){return __awaiter(this,void 0,void 0,function(){var e,t=this;return __generator(this,function(r){switch(r.label){case 0:return this.isQueueProcessing||0===this.queue.length?[2]:(this.isQueueProcessing=!0,(e=this.queue.map(function(e,r){return new Promise(function(i){setTimeout(function(){return __awaiter(t,void 0,void 0,function(){var t,r,s,n,o;return __generator(this,function(u){switch(u.label){case 0:t=e.config,r=e.ref,s=null,n=null,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.sendRequest(t)];case 2:return n=u.sent(),[3,4];case 3:return o=u.sent(),s=o,[3,4];case 4:return this.eventEmitter.emit("request-performed",r,s,n),this.queue.splice(this.queue.indexOf(e),1),i(),[2]}})})},r*t.timeout)})})).push(new Promise(function(e){setTimeout(e,t.queue.length*t.timeout)})),[4,Promise.all(e)]);case 1:return r.sent(),this.isQueueProcessing=!1,this.processQueue(),[2]}})})},e}();exports.VKAPI=VKAPI;

@@ -39,2 +39,3 @@ /**

GroupAccessDenied = 203,
WallPostAccessDenied = 210,
AlbumFull = 300,

@@ -41,0 +42,0 @@ ApplicationVotesDisabled = 500,

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

"use strict";var ErrorsEnum;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e[e.Unknown=1]="Unknown",e[e.ApplicationDisabled=2]="ApplicationDisabled",e[e.UnknownMethod=3]="UnknownMethod",e[e.IncorrectSign=4]="IncorrectSign",e[e.AuthorizationFailed=5]="AuthorizationFailed",e[e.TooManyRequests=6]="TooManyRequests",e[e.PermissionDenied=7]="PermissionDenied",e[e.InvalidRequest=8]="InvalidRequest",e[e.FloodControl=9]="FloodControl",e[e.InternalError=10]="InternalError",e[e.ApplicationTestModeRestriction=11]="ApplicationTestModeRestriction",e[e.CaptchaRequired=14]="CaptchaRequired",e[e.AccessDenied=15]="AccessDenied",e[e.HttpAuthFailed=16]="HttpAuthFailed",e[e.ValidationRequired=17]="ValidationRequired",e[e.UserDeletedOrBanned=18]="UserDeletedOrBanned",e[e.PermissionForNonStandaloneDenied=20]="PermissionForNonStandaloneDenied",e[e.PermissionAllowedForStandaloneAndOpenAPI=21]="PermissionAllowedForStandaloneAndOpenAPI",e[e.MethodDisabled=23]="MethodDisabled",e[e.ConfirmationRequired=24]="ConfirmationRequired",e[e.GroupAuthFailed=27]="GroupAuthFailed",e[e.AppAuthFailed=28]="AppAuthFailed",e[e.RateLimitReached=29]="RateLimitReached",e[e.PrivateProfile=30]="PrivateProfile",e[e.NotImplemented=33]="NotImplemented",e[e.ParameterMissingOrInvalid=100]="ParameterMissingOrInvalid",e[e.InvalidAppId=101]="InvalidAppId",e[e.NotFound=104]="NotFound",e[e.InvalidUserId=113]="InvalidUserId",e[e.InvalidTimestamp=150]="InvalidTimestamp",e[e.AlbumAccessDenied=200]="AlbumAccessDenied",e[e.AudioAccessDenied=201]="AudioAccessDenied",e[e.GroupAccessDenied=203]="GroupAccessDenied",e[e.AlbumFull=300]="AlbumFull",e[e.ApplicationVotesDisabled=500]="ApplicationVotesDisabled",e[e.NoAccessToOperationsWithObject=600]="NoAccessToOperationsWithObject",e[e.Ads=603]="Ads",e[e.ApplicationNotInstalledInCommunity=711]="ApplicationNotInstalledInCommunity",e[e.UserInBlackList=900]="UserInBlackList",e[e.MessagesFromCommunityNotAllowed=901]="MessagesFromCommunityNotAllowed",e[e.MessagesPrivacyRestriction=902]="MessagesPrivacyRestriction",e[e.KeyboardFormatInvalid=911]="KeyboardFormatInvalid",e[e.ChatBotFeature=912]="ChatBotFeature",e[e.TooManyForwardedMessages=913]="TooManyForwardedMessages",e[e.MessageTooLong=914]="MessageTooLong",e[e.NoAccessToChat=917]="NoAccessToChat",e[e.UnableToForward=921]="UnableToForward",e[e.NotAdminOfChat=925]="NotAdminOfChat",e[e.ContactNotFound=936]="ContactNotFound",e[e.TooManyPostsInMessages=940]="TooManyPostsInMessages",e[e.InvalidIntent=943]="InvalidIntent",e[e.IntentLimitsOverflow=944]="IntentLimitsOverflow",e[e.ChatDisabled=945]="ChatDisabled",e[e.ChatNotSupported=946]="ChatNotSupported",e[e.CaptchaNeeded=3300]="CaptchaNeeded",e[e.PhoneValidationNeeded=3301]="PhoneValidationNeeded",e[e.PasswordValidationNeeded=3302]="PasswordValidationNeeded",e[e.OtpAppValidationNeeded=3303]="OtpAppValidationNeeded",e[e.EmailConfirmationNeeded=3304]="EmailConfirmationNeeded",e[e.AssertVotes=3305]="AssertVotes",e[e.TokenExtensionRequired=3609]="TokenExtensionRequired"}(ErrorsEnum=exports.ErrorsEnum||(exports.ErrorsEnum={}));
"use strict";var ErrorsEnum;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e[e.Unknown=1]="Unknown",e[e.ApplicationDisabled=2]="ApplicationDisabled",e[e.UnknownMethod=3]="UnknownMethod",e[e.IncorrectSign=4]="IncorrectSign",e[e.AuthorizationFailed=5]="AuthorizationFailed",e[e.TooManyRequests=6]="TooManyRequests",e[e.PermissionDenied=7]="PermissionDenied",e[e.InvalidRequest=8]="InvalidRequest",e[e.FloodControl=9]="FloodControl",e[e.InternalError=10]="InternalError",e[e.ApplicationTestModeRestriction=11]="ApplicationTestModeRestriction",e[e.CaptchaRequired=14]="CaptchaRequired",e[e.AccessDenied=15]="AccessDenied",e[e.HttpAuthFailed=16]="HttpAuthFailed",e[e.ValidationRequired=17]="ValidationRequired",e[e.UserDeletedOrBanned=18]="UserDeletedOrBanned",e[e.PermissionForNonStandaloneDenied=20]="PermissionForNonStandaloneDenied",e[e.PermissionAllowedForStandaloneAndOpenAPI=21]="PermissionAllowedForStandaloneAndOpenAPI",e[e.MethodDisabled=23]="MethodDisabled",e[e.ConfirmationRequired=24]="ConfirmationRequired",e[e.GroupAuthFailed=27]="GroupAuthFailed",e[e.AppAuthFailed=28]="AppAuthFailed",e[e.RateLimitReached=29]="RateLimitReached",e[e.PrivateProfile=30]="PrivateProfile",e[e.NotImplemented=33]="NotImplemented",e[e.ParameterMissingOrInvalid=100]="ParameterMissingOrInvalid",e[e.InvalidAppId=101]="InvalidAppId",e[e.NotFound=104]="NotFound",e[e.InvalidUserId=113]="InvalidUserId",e[e.InvalidTimestamp=150]="InvalidTimestamp",e[e.AlbumAccessDenied=200]="AlbumAccessDenied",e[e.AudioAccessDenied=201]="AudioAccessDenied",e[e.GroupAccessDenied=203]="GroupAccessDenied",e[e.WallPostAccessDenied=210]="WallPostAccessDenied",e[e.AlbumFull=300]="AlbumFull",e[e.ApplicationVotesDisabled=500]="ApplicationVotesDisabled",e[e.NoAccessToOperationsWithObject=600]="NoAccessToOperationsWithObject",e[e.Ads=603]="Ads",e[e.ApplicationNotInstalledInCommunity=711]="ApplicationNotInstalledInCommunity",e[e.UserInBlackList=900]="UserInBlackList",e[e.MessagesFromCommunityNotAllowed=901]="MessagesFromCommunityNotAllowed",e[e.MessagesPrivacyRestriction=902]="MessagesPrivacyRestriction",e[e.KeyboardFormatInvalid=911]="KeyboardFormatInvalid",e[e.ChatBotFeature=912]="ChatBotFeature",e[e.TooManyForwardedMessages=913]="TooManyForwardedMessages",e[e.MessageTooLong=914]="MessageTooLong",e[e.NoAccessToChat=917]="NoAccessToChat",e[e.UnableToForward=921]="UnableToForward",e[e.NotAdminOfChat=925]="NotAdminOfChat",e[e.ContactNotFound=936]="ContactNotFound",e[e.TooManyPostsInMessages=940]="TooManyPostsInMessages",e[e.InvalidIntent=943]="InvalidIntent",e[e.IntentLimitsOverflow=944]="IntentLimitsOverflow",e[e.ChatDisabled=945]="ChatDisabled",e[e.ChatNotSupported=946]="ChatNotSupported",e[e.CaptchaNeeded=3300]="CaptchaNeeded",e[e.PhoneValidationNeeded=3301]="PhoneValidationNeeded",e[e.PasswordValidationNeeded=3302]="PasswordValidationNeeded",e[e.OtpAppValidationNeeded=3303]="OtpAppValidationNeeded",e[e.EmailConfirmationNeeded=3304]="EmailConfirmationNeeded",e[e.AssertVotes=3305]="AssertVotes",e[e.TokenExtensionRequired=3609]="TokenExtensionRequired"}(ErrorsEnum=exports.ErrorsEnum||(exports.ErrorsEnum={}));
{
"name": "vkontakte-api",
"version": "1.6.3",
"version": "1.7.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

@@ -197,1 +197,29 @@ [npm-badge]: https://img.shields.io/npm/v/vkontakte-api.svg

```
#### Defining connection between master and slave
There is a rare case, when your project contains 2 masters with
different `VKAPI` instances. For example, you could create separate api
instances for group and application which use different access tokens.
So then, it is allowed to pass same property `tunnelName` for both master and
slave. Here is how it works:
```typescript
import {isMaster} from 'cluster';
import {VKAPIMaster, VKAPISlave} from 'vkontakte-api';
if (isMaster) {
// API provider for group API instance
const groupApiProvider = new VKAPIMaster({tunnelName: 'group'});
groupApiProvider.init();
// API provider for VK Mini Apps application API instance
const appApiProvider = new VKAPIMaster({tunnelName: 'app'});
appApiProvider.init();
} else {
// Create API instance consumers
const groupApi = new VKAPISlave({tunnelName: 'group'});
const appApi = new VKAPISlave({tunnelName: 'app'});
}
```
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