You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP →

eservices-back-core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eservices-back-core - npm Package Compare versions

Comparing version

to
2.0.32

@@ -7,2 +7,3 @@ "use strict";

const path_1 = __importDefault(require("path"));
const configuration_json_1 = __importDefault(require("./configuration.json"));
const dotenv_1 = require("dotenv");

@@ -13,2 +14,3 @@ const Server_1 = require("./Server");

});
Object.assign(process.env, configuration_json_1.default || {});
(0, Server_1.createServer)({

@@ -15,0 +17,0 @@ version: "1.2.4",

@@ -36,4 +36,4 @@ "use strict";

app.use(routerForOpenArea);
// test
app.use("/test-api", (0, test_close_router_1.default)());
if (Server_1.default.isDev)
app.use("/test-api", (0, test_close_router_1.default)());
app.use("/open-api", open_api_router_1.default);

@@ -40,0 +40,0 @@ app.use((0, auth_middleware_1.authModule)().useAuthMiddleware());

@@ -46,2 +46,4 @@ /// <reference types="node" />

get staticDir(): string;
static get mode(): string;
static get isDev(): boolean;
/**

@@ -48,0 +50,0 @@ * @description Version of current realize.

@@ -51,2 +51,4 @@ "use strict";

const constants_1 = require("./constants");
const create_debug_1 = __importDefault(require("./utils/create-debug"));
const debug = (0, create_debug_1.default)('server');
class Server {

@@ -56,2 +58,11 @@ get staticDir() {

}
static get mode() {
return process.env['MODE'];
}
static get isDev() {
const mode = Server.mode;
if (typeof mode !== 'string')
return false;
return Server.mode.toLowerCase() === 'development';
}
static getServer() {

@@ -69,2 +80,3 @@ return Server.instance;

use_logger_1.Logger.info(`Server was created with params %o`, params);
debug("Office type %s", params.type);
this.app = (0, express_1.default)();

@@ -71,0 +83,0 @@ this.httpServer = http_1.default.createServer(this.app);

@@ -15,5 +15,5 @@ import InterfaceAuthService from "./interface-auth-service";

/**
* @description Reading entity using GraphQL.
* @description Чтение сущности по её идентификатору.
*/
getById<T extends {}>(entityName: string, entityId: number, options?: IGetValuesOptions): Promise<T>;
getById<T extends {}>(entityName: string, entityId: number, options?: Partial<Pick<IListOptions, 'fields'>>): Promise<T>;
/**

@@ -40,6 +40,2 @@ * @description Updating entity using id. Provide version if entity using versioning

}
interface IGetValuesOptions {
fields?: string;
}
export {};
//# sourceMappingURL=data-service.d.ts.map

@@ -23,4 +23,2 @@ "use strict";

const Filter_1 = __importDefault(require("../utils/Filter"));
const create_debug_1 = __importDefault(require("../utils/create-debug"));
const debug = (0, create_debug_1.default)('data-service');
class DataService extends interface_auth_service_1.default {

@@ -36,11 +34,7 @@ /**

return __awaiter(this, void 0, void 0, function* () {
console.log(rule);
const paramsUrl = new URLSearchParams();
paramsUrl.set('rule', rule);
const strQuery = paramsUrl.toString();
debug(strQuery);
console.log(strQuery);
debug(rule);
const paramsUrl = new URLSearchParams({
rule
});
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, 'api/Data/UsageContext', context, 'Entity', entityName);
return (0, nodeFetch_1.default)(url + '?' + strQuery, {
return (0, nodeFetch_1.default)(url + '?' + paramsUrl.toString(), {
method: 'POST',

@@ -58,3 +52,3 @@ headers: {

/**
* @description Reading entity using GraphQL.
* @description Чтение сущности по её идентификатору.
*/

@@ -84,4 +78,4 @@ getById(entityName, entityId, options = {}) {

}));
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, 'api/Data/UsageContext', context, 'Entity', entityName, `${entityId}?` + paramsUrl.toString());
return (0, nodeFetch_1.default)(url, {
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, 'api/Data/UsageContext', context, 'Entity', entityName, entityId.toString());
return (0, nodeFetch_1.default)(url + '?' + paramsUrl.toString(), {
method: 'PUT',

@@ -116,4 +110,4 @@ headers: {

}));
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, 'api/Data/Entity', `${entityName}?${queryUrl.toString()}`);
const requestResult = yield (0, nodeFetch_1.default)(url, {
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, 'api/Data/Entity', entityName);
const requestResult = yield (0, nodeFetch_1.default)(url + '?' + queryUrl.toString(), {
method: 'GET',

@@ -145,3 +139,3 @@ headers: {

return __awaiter(this, void 0, void 0, function* () {
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, `api/Anonymous/Entity/${entityName}`);
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, `api/Anonymous/Entity`, entityName);
const result = yield (0, nodeFetch_1.default)(url).then(res => res.json());

@@ -156,9 +150,8 @@ return utils_1.default.joinArrayFieldsWithData(result.fields, result.data);

return __awaiter(this, void 0, void 0, function* () {
const params = new URLSearchParams();
if (version !== undefined)
params.set('version', version);
if (typeof rule === 'string')
params.set('rule', rule);
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, `api/Data/UsageContext/${context}/Entity/${entityName}/${JSON.stringify(keys)}?${params.toString()}`);
return (0, nodeFetch_1.default)(url, {
const query = new URLSearchParams(utils_1.default.omitEmpty({
version,
rule
}));
const url = (0, utils_2.joinURL)(Server_1.default.instance.params.apiUrl, 'api/Data/UsageContext', context, 'Entity', entityName, JSON.stringify(keys));
return (0, nodeFetch_1.default)(url + '?' + query.toString(), {
method: 'delete',

@@ -165,0 +158,0 @@ headers: {

@@ -174,5 +174,5 @@ "use strict";

ws.send(JSON.stringify({
requestId,
event,
data: response,
requestId
}));

@@ -201,7 +201,7 @@ }

ws.send(JSON.stringify({
requestId,
event: constants_2.SOCKET_EVENT_ERROR,
data,
requestId
}));
}
//# sourceMappingURL=connect-socket.js.map

@@ -50,3 +50,2 @@ "use strict";

setInterval(() => {
debug('ping-pong');
this.getAllSockets().forEach(socket => {

@@ -53,0 +52,0 @@ if (!socket.isAlive) {

import { ISocketOptions } from "./socket-type";
export type ICustomerRequestInfo = ISocketOptions;
export interface IRequestUpdateResult {
/**
* @description Используется как дочерний интерфейс при изменении состояния сущности.
*/
interface IEntityAffect {
catalogId: string;
id: number;
utcModified: UtcDate;
version: number;
}
export type UtcDate = string;
export interface IRequestCreateResult {
catalogId: string;
id: number;
export interface IRequestUpdateResult extends IEntityAffect {
utcModified: UtcDate;
}
export interface IRequestCreateResult extends IEntityAffect {
date: string;
version: number;
}
export type UtcDate = string;
export interface IUser {

@@ -17,0 +19,0 @@ FullName: string;

{
"name": "eservices-back-core",
"version": "2.0.31",
"version": "2.0.32",
"description": "",

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

@@ -14,4 +14,4 @@ {

"allowJs": true,
"resolveJsonModule": false,
"typeRoots": ["node_modules/@types"]
"typeRoots": ["node_modules/@types"],
"resolveJsonModule": true
},

@@ -18,0 +18,0 @@ "lib": ["es2015"],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet