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.7.0 to 1.8.0

dist/multithreading/VKAPIConsumer/index.d.ts

7

CHANGELOG.md

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

## [1.8.0](https://github.com/wolframdeus/vk-api/compare/v1.7.0...v1.8.0) (2020-06-22)
### Features
* **streaming:** add streaming repository ([a17f38e](https://github.com/wolframdeus/vk-api/commit/a17f38e9c216296adecc892b584c3ab442a1ba41))
## [1.7.0](https://github.com/wolframdeus/vk-api/compare/v1.6.3...v1.7.0) (2020-06-20)

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

4

dist/multithreading/index.d.ts

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

export * from './VKAPIMaster';
export * from './VKAPISlave';
export * from './VKAPIProvider';
export * from './VKAPIConsumer';
export * from './types';

@@ -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("./VKAPIMaster")),__export(require("./VKAPISlave"));
"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("./VKAPIProvider")),__export(require("./VKAPIConsumer"));
import { Repository } from '../Repository';
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';
/**
* Repository to work with users
*/
export declare class DatabaseRepository extends Repository {

@@ -8,0 +5,0 @@ constructor(sendRequest: SendRequest);

@@ -5,3 +5,4 @@ export * from './DatabaseRepository';

export * from './StatsRepository';
export * from './StreamingRepository';
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("./StatsRepository")),__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("./StreamingRepository")),__export(require("./UsersRepository")),__export(require("./UtilsRepository"));
import { Repository } from '../Repository';
import { SendRequest } from '../../types';
import { SendParams, SendResult } from './types';
/**
* Repository to work with users
*/
export declare class MessagesRepository extends Repository {

@@ -8,0 +5,0 @@ constructor(sendRequest: SendRequest);

import { SendMessageResult, SendMessageParams, MarkAsViewedParams } from './types';
import { Repository } from '../Repository';
import { SendRequest } from '../../types';
/**
* Repository to work with notifications
*/
export declare class NotificationsRepository extends Repository {

@@ -8,0 +5,0 @@ constructor(sendRequest: SendRequest);

import { Repository } from '../Repository';
import { RepositoryMethod, SendRequest } from '../../types';
import { SendRequest } from '../../types';
import { GetParams, GetPostReachParams, GetPostReachResult, GetResult, TrackVisitorParams } from './types';
/**
* Repository to work with users
*/
export declare class StatsRepository extends Repository {

@@ -13,3 +10,3 @@ constructor(sendRequest: SendRequest);

*/
get: RepositoryMethod<GetParams, GetResult>;
get: import("../../types").RepositoryMethod<GetParams, GetResult>;
/**

@@ -19,3 +16,3 @@ * @see https://vk.com/dev/stats.getPostReach

*/
getPostReach: RepositoryMethod<GetPostReachParams, GetPostReachResult>;
getPostReach: import("../../types").RepositoryMethod<GetPostReachParams, GetPostReachResult>;
/**

@@ -25,3 +22,3 @@ * @see https://vk.com/dev/stats.trackVisitor

*/
trackVisitor: RepositoryMethod<TrackVisitorParams, 1>;
trackVisitor: import("../../types").RepositoryMethod<TrackVisitorParams, 1>;
}
import { Repository } from '../Repository';
import { SendRequest } from '../../types';
import { GetParams, GetResult } from './types';
/**
* Repository to work with users
*/
export declare class UsersRepository extends Repository {

@@ -8,0 +5,0 @@ constructor(sendRequest: SendRequest);

import { Repository } from '../Repository';
import { SendRequest } from '../../types';
import { CheckLinkParams, CheckLinkResult, DeleteFromLastShortenedParams, GetLastShortenedLinksParams, GetLastShortenedLinksResult, GetLinkStatsParams, GetServerTimeParams, GetShortLinkParams, GetShortLinkResult, ResolveScreenNameParams, ResolveScreenNameResult } from './types';
/**
* Repository to work with users
*/
export declare class UtilsRepository extends Repository {

@@ -8,0 +5,0 @@ constructor(sendRequest: SendRequest);

import { RequestConfig, RequestOptionalParams, SendRequest } from '../types';
import { UsersRepository } from '../repositories/UsersRepository';
import { MessagesRepository } from '../repositories/MessagesRepository';
import { NotificationsRepository } from '../repositories/NotificationsRepository';
import { DatabaseRepository } from '../repositories/DatabaseRepository';
import { UtilsRepository } from '../repositories/UtilsRepository';
import { UsersRepository, StatsRepository, UtilsRepository, NotificationsRepository, MessagesRepository, DatabaseRepository, StreamingRepository } from '../repositories';
export interface QueueRequest {

@@ -29,2 +25,4 @@ /**

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

@@ -31,0 +29,0 @@ utils: UtilsRepository;

import { SendRequest } from '../types';
import { VKAPIInterface, VKAPIConstructorProps } from './types';
import { UsersRepository, MessagesRepository, NotificationsRepository, StatsRepository, DatabaseRepository, UtilsRepository } from '../repositories';
import { UsersRepository, MessagesRepository, NotificationsRepository, StatsRepository, DatabaseRepository, UtilsRepository, StreamingRepository } from '../repositories';
/**

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

stats: StatsRepository;
streaming: StreamingRepository;
users: UsersRepository;

@@ -14,0 +15,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.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;
"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.streaming=new repositories_1.StreamingRepository(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;
{
"name": "vkontakte-api",
"version": "1.7.0",
"version": "1.8.0",
"main": "dist/index.js",

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

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