Socket
Socket
Sign inDemoInstall

api-devup

Package Overview
Dependencies
2
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.3.1

31

dist/cjs/core.d.ts

@@ -0,5 +1,36 @@

declare class DevUpError extends Error {
/**
* Error code
*/
code: string | number;
/**
* Error level
*/
level: string;
/**
* Error stack
*/
stack: string;
/**
* Constructor
*/
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }: {
err_code: number;
err_critical_lvl: string;
err_msg: string;
});
/**
* Returns custom tag
*/
get [Symbol.toStringTag](): string;
/**
* Returns property for json
*/
toJSON(): Pick<this, keyof this>;
}
declare const _default: {
version: string;
url: string;
error: typeof DevUpError;
};
export default _default;

30

dist/cjs/core.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const MODULE_VERSION = "1.3.0";
const MODULE_VERSION = "1.3.1";
const DEFAULT_API_URL = "https://api.dev-up.ru/method/";
class DevUpError extends Error {
/**
* Constructor
*/
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }) {
super(message);
this.code = code;
this.level = level;
this.name = this.constructor.name;
}
/**
* Returns custom tag
*/
get [Symbol.toStringTag]() {
return this.constructor.name;
}
/**
* Returns property for json
*/
toJSON() {
const json = {};
for (const key of Object.getOwnPropertyNames(this)) {
json[key] = this[key];
}
return json;
}
}
exports.default = {
version: MODULE_VERSION,
url: DEFAULT_API_URL,
error: DevUpError,
};

@@ -40,3 +40,10 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
return (yield axios_1.default.post(this.apiURL + method, Object.assign({ key: this.token }, data), this.RequestConfig)).data;
try {
const Response = yield axios_1.default.post(this.apiURL + method, Object.assign({ key: this.token }, data), this.RequestConfig);
return Response.data;
}
catch (error) {
console.log(error.response.data.err);
throw new core_1.default.error(error.response.data.err);
}
});

@@ -43,0 +50,0 @@ }

40

dist/cjs/lib/DevUp.d.ts

@@ -8,16 +8,3 @@ import { Builder } from "./API/main";

/**
* @class
* @classdesc DevUp constructor
* @param {Object|string} - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
* DevUp API constructor
*/

@@ -29,10 +16,27 @@ declare class DevUp extends Builder {

utils: Utils;
/**
*
* @param {Object|string} params - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
*/
constructor(params: IOptions | string);
/**
* @description Метод для выполнения запроса к недобавленным методам
* @param method {string} - Метод
* @param params {Record<string, any>} - Параметры
* Метод для выполнения запроса к недобавленным методам
* @param {string} method - Метод
* @param {Record<string, any>} [params={}] - Параметры
* @example
* API.call("profile.get").then(res => console.log(res));
*/
call: (method: string, params: Record<string, any>) => API_Response<any>;
call(method: string, params?: Record<string, any>): API_Response<any>;
}
export default DevUp;

@@ -21,28 +21,22 @@ "use strict";

/**
* @class
* @classdesc DevUp constructor
* @param {Object|string} - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
* DevUp API constructor
*/
class DevUp extends main_1.Builder {
/**
*
* @param {Object|string} params - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
*/
constructor(params) {
super(params);
/**
* @description Метод для выполнения запроса к недобавленным методам
* @param method {string} - Метод
* @param params {Record<string, any>} - Параметры
*/
this.call = (method,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
params) => __awaiter(this, void 0, void 0, function* () { return this.postRequest(method, params); });
this.vk = new main_2.default(params);

@@ -53,3 +47,17 @@ this.profile = new main_3.default(params);

}
/**
* Метод для выполнения запроса к недобавленным методам
* @param {string} method - Метод
* @param {Record<string, any>} [params={}] - Параметры
* @example
* API.call("profile.get").then(res => console.log(res));
*/
call(method,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
params = {}) {
return __awaiter(this, void 0, void 0, function* () {
return this.postRequest(method, params);
});
}
}
exports.default = DevUp;

@@ -24,1 +24,4 @@ /**

}>;
export interface ICustomRequest {
method: string;
}

@@ -0,5 +1,36 @@

declare class DevUpError extends Error {
/**
* Error code
*/
code: string | number;
/**
* Error level
*/
level: string;
/**
* Error stack
*/
stack: string;
/**
* Constructor
*/
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }: {
err_code: number;
err_critical_lvl: string;
err_msg: string;
});
/**
* Returns custom tag
*/
get [Symbol.toStringTag](): string;
/**
* Returns property for json
*/
toJSON(): Pick<this, keyof this>;
}
declare const _default: {
version: string;
url: string;
error: typeof DevUpError;
};
export default _default;

@@ -1,6 +0,34 @@

const MODULE_VERSION = "1.3.0";
const MODULE_VERSION = "1.3.1";
const DEFAULT_API_URL = "https://api.dev-up.ru/method/";
class DevUpError extends Error {
/**
* Constructor
*/
constructor({ err_code: code, err_critical_lvl: level, err_msg: message, }) {
super(message);
this.code = code;
this.level = level;
this.name = this.constructor.name;
}
/**
* Returns custom tag
*/
get [Symbol.toStringTag]() {
return this.constructor.name;
}
/**
* Returns property for json
*/
toJSON() {
const json = {};
for (const key of Object.getOwnPropertyNames(this)) {
json[key] = this[key];
}
return json;
}
}
export default {
version: MODULE_VERSION,
url: DEFAULT_API_URL,
error: DevUpError,
};

@@ -34,5 +34,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

return __awaiter(this, void 0, void 0, function* () {
return (yield axios.post(this.apiURL + method, Object.assign({ key: this.token }, data), this.RequestConfig)).data;
try {
const Response = yield axios.post(this.apiURL + method, Object.assign({ key: this.token }, data), this.RequestConfig);
return Response.data;
}
catch (error) {
console.log(error.response.data.err);
throw new Core.error(error.response.data.err);
}
});
}
}

@@ -8,16 +8,3 @@ import { Builder } from "./API/main";

/**
* @class
* @classdesc DevUp constructor
* @param {Object|string} - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
* DevUp API constructor
*/

@@ -29,10 +16,27 @@ declare class DevUp extends Builder {

utils: Utils;
/**
*
* @param {Object|string} params - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
*/
constructor(params: IOptions | string);
/**
* @description Метод для выполнения запроса к недобавленным методам
* @param method {string} - Метод
* @param params {Record<string, any>} - Параметры
* Метод для выполнения запроса к недобавленным методам
* @param {string} method - Метод
* @param {Record<string, any>} [params={}] - Параметры
* @example
* API.call("profile.get").then(res => console.log(res));
*/
call: (method: string, params: Record<string, any>) => API_Response<any>;
call(method: string, params?: Record<string, any>): API_Response<any>;
}
export default DevUp;

@@ -16,28 +16,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

/**
* @class
* @classdesc DevUp constructor
* @param {Object|string} - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
* DevUp API constructor
*/
class DevUp extends Builder {
/**
*
* @param {Object|string} params - Можно передать либо токен, либо набор параметров ({@link IOptions})
* @example
* const { DevUp } = require(`api-devup`);
*
* const API = new DevUp("token");
* // Or
* const API = new DevUp({
* token: "token",
* apiHeader: {
* "User-Agent": "Custom-UserAgent"
* }
* });
*/
constructor(params) {
super(params);
/**
* @description Метод для выполнения запроса к недобавленным методам
* @param method {string} - Метод
* @param params {Record<string, any>} - Параметры
*/
this.call = (method,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
params) => __awaiter(this, void 0, void 0, function* () { return this.postRequest(method, params); });
this.vk = new VK(params);

@@ -48,3 +42,17 @@ this.profile = new Profile(params);

}
/**
* Метод для выполнения запроса к недобавленным методам
* @param {string} method - Метод
* @param {Record<string, any>} [params={}] - Параметры
* @example
* API.call("profile.get").then(res => console.log(res));
*/
call(method,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
params = {}) {
return __awaiter(this, void 0, void 0, function* () {
return this.postRequest(method, params);
});
}
}
export default DevUp;

@@ -24,1 +24,4 @@ /**

}>;
export interface ICustomRequest {
method: string;
}
{
"name": "api-devup",
"version": "1.3.0",
"version": "1.3.1",
"description": "This library is intended for interaction with the service https://dev-up.ru",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/main.js",

@@ -6,1 +6,3 @@ /* eslint-disable */

const test = new DevUp("te");
test.call("hello").then((res) => console.log(res));
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc