eservices-back-core 2.1.50 → 2.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
1
  {
2
- "TYPE": "back",
3
- "NAME": "back",
2
+ "TYPE": "front",
3
+ "NAME": "front",
4
4
  "PORT": 3000,
5
5
  "BASE_URL": "http://localhost:3000",
6
6
  "FRONTEND_FOLDER": "frontend",
7
7
  "LOG_PATH": "Logs",
8
- "API_URL": "https://cst.eservices.dev:17062",
9
- "OIDC_ISSUE": "https://idi.eservices.dev",
10
- "OIDC_CLIENT_ID": "AppRegister.CST.OFC.Dev",
11
- "OIDC_SECRET": "0332794a-2c7d-432f-a250-e9e89abc9bf7",
12
- "OIDC_SCOPE": "openid offline_access",
8
+ "API_URL": "https://cst.eservices.dev:17060",
9
+ "OIDC_ISSUE": "https://id.eservices.dev",
10
+ "OIDC_CLIENT_ID": "AppRegister.CST.BSN.Dev",
11
+ "OIDC_SECRET": "59f83079-a805-4db1-bebc-f8a7d2d1b591",
12
+ "OIDC_SCOPE": "openid profile offline_access",
13
13
  "WEBSERVER_SESSION_SECRET": "123",
14
14
  "MODE": "DEVELOPMENT",
15
15
  "INDEX_PAGE": "index-ofc.html"
@@ -12,6 +12,7 @@ export default class CoreError extends Error {
12
12
  * @param details {any} Любая дополнительная информация
13
13
  */
14
14
  constructor(displayMessage: string, insideError?: unknown, details?: unknown);
15
+ toString(): string;
15
16
  displayMessage: string;
16
17
  /**
17
18
  * @description Ошибка связана с получением информации о пользователе по его externalId. Одна из причин является
@@ -39,5 +40,11 @@ export default class CoreError extends Error {
39
40
  * @constructor
40
41
  */
41
42
  static HTTPError(status: number, message: string, details?: any): CoreError;
43
+ /**
44
+ * @description Самая ленивая ошибка. Т.к. функция сама определяет, что ей делать с данными.
45
+ * @param data
46
+ * @constructor
47
+ */
48
+ static Any(data: unknown): CoreError;
42
49
  }
43
50
  //# sourceMappingURL=core-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-error.d.ts","sourceRoot":"","sources":["../../src/errors/core-error.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK;IAC3C,OAAO,EAAE,GAAG,CAAA;IAEZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;gBACS,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,GAAE,OAAY;IAkBhF,cAAc,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM;IAItC;;;;OAIG;IACH,MAAM,CAAC,kCAAkC,CAAC,GAAG,CAAC,EAAE,MAAM;IAKtD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,GAAE,MAAM,EAAE,GAAG,MAAW;IAKrD;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAK/D"}
1
+ {"version":3,"file":"core-error.d.ts","sourceRoot":"","sources":["../../src/errors/core-error.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK;IAC3C,OAAO,EAAE,GAAG,CAAA;IAEZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;gBACS,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,GAAE,OAAY;IAiBhF,QAAQ;IAUR,cAAc,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM;IAItC;;;;OAIG;IACH,MAAM,CAAC,kCAAkC,CAAC,GAAG,CAAC,EAAE,MAAM;IAKtD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,GAAE,MAAM,EAAE,GAAG,MAAW;IAKrD;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IAM/D;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO;CAqBxB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const constants_1 = require("../constants");
4
+ const use_logger_1 = require("../logger/use-logger");
4
5
  class CoreError extends Error {
5
6
  /**
6
7
  * @description Класс используется для более удобной работы с ошибками. Добавляет полей displayMessage, которое в
@@ -23,6 +24,15 @@ class CoreError extends Error {
23
24
  this.message = this.displayMessage;
24
25
  this.details = details || [];
25
26
  }
27
+ toString() {
28
+ const answerArray = [this.displayMessage];
29
+ if (this.message !== this.displayMessage)
30
+ answerArray.push(this.message);
31
+ if (this.httpStatus)
32
+ answerArray.push(this.httpStatus.toString());
33
+ answerArray.push(this.details.toString());
34
+ return answerArray.join(' ');
35
+ }
26
36
  /**
27
37
  * @description Ошибка связана с получением информации о пользователе по его externalId. Одна из причин является
28
38
  * отсутствие пользователя: он не был добавлен в таблицу User.
@@ -61,6 +71,31 @@ class CoreError extends Error {
61
71
  error.httpStatus = status;
62
72
  return error;
63
73
  }
74
+ /**
75
+ * @description Самая ленивая ошибка. Т.к. функция сама определяет, что ей делать с данными.
76
+ * @param data
77
+ * @constructor
78
+ */
79
+ static Any(data) {
80
+ if (data instanceof CoreError)
81
+ return data;
82
+ if (typeof data === 'string')
83
+ return new CoreError(constants_1.DEFAULT_ERROR_MESSAGE, data);
84
+ try {
85
+ // @ts-ignore
86
+ const error = new CoreError(constants_1.DEFAULT_ERROR_MESSAGE, data === null || data === void 0 ? void 0 : data.message);
87
+ // @ts-ignore
88
+ if (data === null || data === void 0 ? void 0 : data.status)
89
+ error.httpStatus = data.status;
90
+ error.details = [JSON.stringify(data)];
91
+ return error;
92
+ }
93
+ catch (e) {
94
+ use_logger_1.Logger.error('Error occurred while trying to parse error by CoreError.Any.');
95
+ use_logger_1.Logger.error(e);
96
+ }
97
+ return new CoreError(constants_1.DEFAULT_ERROR_MESSAGE, "Unknown error occurred. Check logs.");
98
+ }
64
99
  }
65
100
  exports.default = CoreError;
66
101
  //# sourceMappingURL=core-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-error.js","sourceRoot":"","sources":["../../src/errors/core-error.ts"],"names":[],"mappings":";;AAAA,4CAAmD;AAEnD,MAAqB,SAAU,SAAQ,KAAK;IAO3C;;;;;;OAMG;IACH,YAAY,cAAsB,EAAE,WAAqB,EAAE,UAAmB,EAAE;QAC/E,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QAErC,IAAI,WAAW,YAAY,KAAK,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;YAC/B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA;QACnC,CAAC;QAED,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC;QAEtD,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAC9B,CAAC;IAGD;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAkB;QACrC,OAAO,IAAI,SAAS,CAAC,4CAA4C,UAAU,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,kCAAkC,CAAC,GAAY;QACrD,OAAO,IAAI,SAAS,CAAC,2CAA2C,GAAG,iCAAiC,CAAC,CAAA;IACtG,CAAC;IAGD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAA6B,EAAE;Q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AAqB,EAAE,IAAI,CAAC,CAAC;QAEhF,IAAI,CAAC;YACJ,aAAa;YACb,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,iCAAqB,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,CAAC;YAClE,aAAa;YACb,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM;gBAAE,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;YAEhD,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAEvC,OAAO,KAAK,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,mBAAM,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;YAC7E,mBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,SAAS,CAAC,iCAAqB,EAAE,qCAAqC,CAAC,CAAC;IACpF,CAAC;CACD;AA9GD,4BA8GC"}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import ValueHooks from "./utils/value-hooks";
10
10
  import SocketMessage from "./socket/SocketMessage";
11
11
  import { ISocketOptions, ISocketUtils } from "./types/socket-type";
12
12
  import { IValueHook } from "./types/value-hooks";
13
+ import { IBatchResult, IResultRunPromisesOneAfterAnother } from "./types/batch-type";
13
14
  import ApiError from "./errors/api-error";
14
15
  import DataService from "./services/data-service";
15
16
  import dtoTemplateRenderError from "./dtos/dto-template-render-error";
@@ -23,7 +24,9 @@ import valuesToUpperCase from "./utils/values-to-upper-case";
23
24
  import getCriterionConfig from "./utils/get-criterion-config";
24
25
  import { getCriterionPresetFromCustomerRequestInfo } from "./utils/get-criterion-preset";
25
26
  import convertMasterEntity from "./utils/convert-master-entity";
26
- export { ISocketUtils, SocketMessage, createServer, Server, Logger, Criterion, authModule, ValueHooks, ISocketOptions, IValueHook, DataService, Filter, nodeFetch, joinURL, arrayToUpperCase, valuesToUpperCase, getCriterionConfig, getCriterionPresetFromCustomerRequestInfo, convertMasterEntity, CoreError, ApiError, MetadataStore, TemplateStore, dtoTemplateRenderError, renderResponseTemplate, utils };
27
+ import { runPromisesOneAfterAnother } from "./utils/run-promises-one-after-another";
28
+ import getTriggerProgress from "./utils/get-trigger-progress";
29
+ export { IBatchResult, IResultRunPromisesOneAfterAnother, ISocketUtils, SocketMessage, createServer, Server, Logger, Criterion, authModule, ValueHooks, ISocketOptions, IValueHook, DataService, Filter, nodeFetch, joinURL, arrayToUpperCase, valuesToUpperCase, getCriterionConfig, getCriterionPresetFromCustomerRequestInfo, convertMasterEntity, CoreError, ApiError, MetadataStore, TemplateStore, dtoTemplateRenderError, runPromisesOneAfterAnother, getTriggerProgress, renderResponseTemplate, utils };
27
30
  import { ICustomerRequestInfo } from "./types/main";
28
31
  export type { ICustomerRequestInfo };
29
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAC3C,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAA;AAC9C,OAAO,QAAQ,MA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EV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,yCAAyC,EACzC,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EAEb,sBAAsB,EAEtB,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,EACL,CAAA;AAED,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAClD,YAAY,EACX,oBAAoB,EACpB,CAAA"}
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.utils = exports.renderResponseTemplate = exports.dtoTemplateRenderError = exports.TemplateStore = exports.MetadataStore = exports.ApiError = exports.CoreError = exports.convertMasterEntity = exports.getCriterionPresetFromCustomerRequestInfo = exports.getCriterionConfig = exports.valuesToUpperCase = exports.arrayToUpperCase = exports.joinURL = exports.nodeFetch = exports.Filter = exports.DataService = exports.ValueHooks = exports.authModule = exports.Criterion = exports.Logger = exports.Server = exports.createServer = exports.SocketMessage = void 0;
6
+ exports.utils = exports.renderResponseTemplate = exports.getTriggerProgress = exports.runPromisesOneAfterAnother = exports.dtoTemplateRenderError = exports.TemplateStore = exports.MetadataStore = exports.ApiError = exports.CoreError = exports.convertMasterEntity = exports.getCriterionPresetFromCustomerRequestInfo = exports.getCriterionConfig = exports.valuesToUpperCase = exports.arrayToUpperCase = exports.joinURL = exports.nodeFetch = exports.Filter = exports.DataService = exports.ValueHooks = exports.authModule = exports.Criterion = exports.Logger = exports.Server = exports.createServer = exports.SocketMessage = void 0;
7
7
  const Server_1 = require("./Server");
8
8
  Object.defineProperty(exports, "createServer", { enumerable: true, get: function () { return Server_1.createServer; } });
9
9
  const Server_2 = __importDefault(require("./Server"));
@@ -52,4 +52,8 @@ const get_criterion_preset_1 = require("./utils/get-criterion-preset");
52
52
  Object.defineProperty(exports, "getCriterionPresetFromCustomerRequestInfo", { enumerable: true, get: function () { return get_criterion_preset_1.getCriterionPresetFromCustomerRequestInfo; } });
53
53
  const convert_master_entity_1 = __importDefault(require("./utils/convert-master-entity"));
54
54
  exports.convertMasterEntity = convert_master_entity_1.default;
55
+ const run_promises_one_after_another_1 = require("./utils/run-promises-one-after-another");
56
+ Object.defineProperty(exports, "runPromisesOneAfterAnother", { enumerable: true, get: function () { return run_promises_one_after_another_1.runPromisesOneAfterAnother; } });
57
+ const get_trigger_progress_1 = __importDefault(require("./utils/get-trigger-progress"));
58
+ exports.getTriggerProgress = get_trigger_progress_1.default;
55
59
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAsC;AAkCrC,6FAlCO,qBAAY,OAkCP;AAjCb,sDAA8B;AAkC7B,iBAlCM,gBAAM,CAkCN;AAjCP,kEAAwD;AAoCvD,2FApCO,4BAAU,OAoCP;AAnCX,kEAA0C;AAkCzC,oBAlCM,mBAAS,CAkCN;AAjCV,oDAA2C;AAgC1C,uFAhCO,mBAAM,OAgCP;AA/BP,qEAA4C;AAiD3C,oBAjDM,oBAAS,CAiDN;AAhDV,4EAAmD;AAkDlD,wBAlDM,wBAAa,CAkDN;AAjDd,4EAAmD;AAkDlD,wBAlDM,wBAAa,CAkDN;AAjDd,sEAA6C;AA+B5C,qBA/BM,qBAAU,CA+BN;AA9BX,2EAAmD;AAwBlD,wBAxBM,uBAAa,CAwBN;AApBd,mEAA0C;AA0CzC,mBA1CM,mBAAQ,CA0CN;AAzCT,WAAW;AACX,2EAAkD;AA6BjD,sBA7BM,sBAAW,CA6BN;AA3BZ,iGAAsE;AA0CrE,iCA1CM,mCAAsB,CA0CN;AAxCvB,+EAAwE;AA0CvE,uGA1CO,iDAAsB,OA0CP;AA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9CN,QAAQ;AACR,4DAAoC;AA2BnC,iBA3BM,gBAAM,CA2BN;AA1BP,kEAA0C;AA2BzC,oBA3BM,mBAAS,CA2BN;AA1BV,mCAAgC;AA2B/B,wFA3BO,eAAO,OA2BP;AA1BR,oFAA0D;AA2BzD,2BA3BM,4BAAgB,CA2BN;AA1BjB,wFAA6D;AA2B5D,4BA3BM,8BAAiB,CA2BN;AA1BlB,wFAA8D;AA2B7D,6BA3BM,8BAAkB,CA2BN;AA1BnB,uEAAuF;AA2BtF,0HA3BO,gEAAyC,OA2BP;AA1B1C,0FAAgE;AA2B/D,8BA3BM,+BAAmB,CA2BN;AA1BpB,2FAAkF;AAkCjF,2GAlCO,2DAA0B,OAkCP;AAjC3B,wFAA8D;AAkC7D,6BAlCM,8BAAkB,CAkCN"}
@@ -0,0 +1,3 @@
1
+ declare const Router: import("express-serve-static-core").Router;
2
+ export default Router;
3
+ //# sourceMappingURL=file-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-route.d.ts","sourceRoot":"","sources":["../../../src/router/close/file-route.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,MAAM,4CAAmB,CAAC;AA6EhC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const express_1 = __importDefault(require("express"));
39
+ const formidable_1 = __importDefault(require("formidable"));
40
+ const fs_1 = __importDefault(require("fs"));
41
+ const utils_1 = require("../../utils");
42
+ const Server_1 = __importDefault(require("../../Server"));
43
+ const use_logger_1 = require("../../logger/use-logger");
44
+ const nodeFetch_1 = __importDefault(require("../../utils/nodeFetch"));
45
+ const https = __importStar(require("node:https"));
46
+ const render_response_template_1 = require("../../utils/render-response-template");
47
+ const constants_1 = require("../../constants");
48
+ const Router = express_1.default.Router();
49
+ Router.get("/:descriptorId", (req, clientResponse, next) => __awaiter(void 0, void 0, void 0, function* () {
50
+ const descriptorId = req.params.descriptorId;
51
+ const url = (0, utils_1.joinURL)(Server_1.default.instance.params.apiUrl, `api/Files`, descriptorId);
52
+ function resolveDefaultErrorPage(response) {
53
+ return (0, render_response_template_1.renderResponseTemplate)(response, "error", {
54
+ title: "File upload failed",
55
+ message: constants_1.DEFAULT_ERROR_MESSAGE
56
+ });
57
+ }
58
+ https.get(url, {
59
+ headers: {
60
+ authorization: req.infoAccessToken,
61
+ },
62
+ }, response => {
63
+ let body = "";
64
+ response.on('data', function (chunk) {
65
+ body += chunk.toString();
66
+ });
67
+ const contentType = response.headers["content-type"];
68
+ const isFile = !(/application\/\D*json/.test(contentType));
69
+ response.on('end', function () {
70
+ if (!isFile) {
71
+ use_logger_1.Logger.info("Loading file problem: %s %d %s", response.statusMessage, response.statusCode, body);
72
+ return resolveDefaultErrorPage(clientResponse);
73
+ }
74
+ });
75
+ if (isFile) {
76
+ const stream = response.pipe(clientResponse);
77
+ stream.on("finish", () => use_logger_1.Logger.debug('Loading file %s finished.', descriptorId));
78
+ }
79
+ })
80
+ .on('error', e => {
81
+ use_logger_1.Logger.error(e.message);
82
+ resolveDefaultErrorPage(clientResponse);
83
+ });
84
+ }));
85
+ Router.post('/', (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
86
+ try {
87
+ const formData = new FormData();
88
+ // formidable вернёт массив, где первое значение - объект полей, а второе значение объект,
89
+ // где каждое поле - массив файлов
90
+ const data = yield (0, formidable_1.default)({}).parse(req);
91
+ const file = data[1].file[0];
92
+ const entityName = data[0].entityName.toString();
93
+ let buffer = fs_1.default.readFileSync(file.filepath);
94
+ use_logger_1.Logger.debug(`Uploading file %s for entity.`, file.originalFilename, entityName);
95
+ // Добавляем file.
96
+ formData.append('file', new File([buffer], file.originalFilename));
97
+ const query = new URLSearchParams({ entityName });
98
+ const url = (0, utils_1.joinURL)(Server_1.default.instance.params.apiUrl, `api/Files?` + query.toString());
99
+ const answer = yield (0, nodeFetch_1.default)(url, {
100
+ method: "POST",
101
+ headers: {
102
+ authorization: req.infoAccessToken,
103
+ },
104
+ body: formData
105
+ })
106
+ .then(res => res.json());
107
+ res.json(answer);
108
+ }
109
+ catch (e) {
110
+ next(e);
111
+ }
112
+ }));
113
+ exports.default = Router;
114
+ //# sourceMappingURL=file-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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CAAC,CAAC;QAE5C,mBAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;QACjF,kBAAkB;QAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAEnE,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;QACjD,MAAM,GAAG,GAAG,IAAA,eAAO,EAAC,gBAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEnF,MAAM,MAAM,GAAI,MAAM,IAAA,mBAAS,EAAC,GAAG,EAAE;YACpC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACR,aAAa,EAAE,GAAG,CAAC,eAAe;aAClC;YACD,IAAI,EAAE,QAAQ;SACd,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;QAExB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,IAAI,CAAC,CAAC,CAAC,CAAA;IACR,CAAC;AACF,CAAC,CAAA,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/close/index.ts"],"names":[],"mappings":";AAaA,wBA+DE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/close/index.ts"],"names":[],"mappings":";AAWA,wBAmBE"}
@@ -4,17 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const express_1 = __importDefault(require("express"));
7
- const http_proxy_middleware_1 = require("http-proxy-middleware");
8
7
  const metadata_route_1 = __importDefault(require("./metadata-route"));
9
8
  const data_router_1 = __importDefault(require("./data-router"));
10
9
  const view_router_1 = __importDefault(require("./view-router"));
11
10
  const billing_router_1 = __importDefault(require("./billing-router"));
12
11
  const account_route_1 = __importDefault(require("./account-route"));
13
- const Server_1 = __importDefault(require("../../Server"));
14
12
  const executors_route_1 = __importDefault(require("./executors-route"));
15
- const utils_1 = require("../../utils");
13
+ const file_route_1 = __importDefault(require("./file-route"));
16
14
  exports.default = () => {
17
- const server = Server_1.default.getServer();
18
15
  const closeRouter = express_1.default.Router();
19
16
  closeRouter.get("/", (req, res) => {
20
17
  res.send("Api-close");
@@ -22,49 +19,7 @@ exports.default = () => {
22
19
  closeRouter.use('/metadata', metadata_route_1.default);
23
20
  closeRouter.use('/views', view_router_1.default);
24
21
  closeRouter.use('/executors', executors_route_1.default);
25
- closeRouter.use('/files', (0, http_proxy_middleware_1.createProxyMiddleware)({
26
- target: (0, utils_1.joinURL)(server.params.apiUrl, `api/Files`),
27
- changeOrigin: true,
28
- pathRewrite: (path, req) => {
29
- return path.replace(/^.*\/files/, '');
30
- },
31
- on: {
32
- proxyReq: ((proxyReq, req, res) => {
33
- // @ts-ignore
34
- proxyReq.setHeader('authorization', req.infoAccessToken);
35
- proxyReq.setHeader('cookie', req.headers.cookie);
36
- })
37
- }
38
- }));
39
- /*
40
- closeRouter.use('/proxy', createProxyMiddleware({
41
- target: joinURL(server.params.apiUrl, `api`),
42
- changeOrigin: true,
43
- pathRewrite: (path) => {
44
- return path.replace(/^.*\/proxy/, '');
45
- },
46
- on: {
47
- proxyReq: ((proxyReq, req, res) => {
48
- // @ts-ignore
49
- proxyReq.setHeader('authorization', req.infoAccessToken);
50
- proxyReq.setHeader('cookie', req.headers.cookie);
51
-
52
- // Используется для решения конфликта с body-parser
53
- // https://stackoverflow.com/a/39850524/11879100
54
- // @ts-ignore
55
- if (req.body) {
56
- // @ts-ignore
57
- const bodyData = JSON.stringify(req.body);
58
- // incase if content-type is application/x-www-form-urlencoded -> we need to change to application/json
59
- proxyReq.setHeader('Content-Type','application/json');
60
- proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
61
- // stream the content
62
- proxyReq.write(bodyData);
63
- }
64
- })
65
- }
66
- }))
67
- */
22
+ closeRouter.use("/files", file_route_1.default);
68
23
  closeRouter.use('/data', data_router_1.default);
69
24
  closeRouter.use('/billing', billing_router_1.default);
70
25
  closeRouter.use('/accounts', account_route_1.default);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/close/index.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAE9B,iEAA2D;AAC3D,sEAA6C;AAC7C,gEAAuC;AAEvC,gEAAsC;AACtC,sEAA6C;AAC7C,oEAA2C;AAC3C,0DAAkC;AAClC,wEAA+C;AAC/C,uCAAoC;AAEpC,kBAAe,GAAG,EAAE;IACnB,MAAM,MAAM,GAAG,gBAAM,CAAC,SAAS,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,iBAAO,CAAC,MAAM,EAAE,CAAC;IAErC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACjC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,CAAC,CAAA;IAEF,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,wBAAa,CAAC,CAAC;IAC5C,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,qBAAS,CAAC,CAAC;IACrC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,yBAAc,CAAC,CAAA;IAE7C,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,6CAAqB,EAAC;QAC/C,MAAM,EAAE,IAAA,eAAO,EAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;QAClD,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,CAAC,IA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,CAAC,CAAC;IACrC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,yBAAc,CAAC,CAAA;IAE7C,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAS,CAAC,CAAC;IACrC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAU,CAAC,CAAC;IAErC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,wBAAa,CAAC,CAAC;IAC3C,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,uBAAY,CAAC,CAAC;IAG3C,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC"}
@@ -2,5 +2,5 @@ import { ICustomerRequestInfo, ISocketUtils } from "../../index";
2
2
  /**
3
3
  * @description Пакетное обновление. Не безопасная операция
4
4
  */
5
- export declare function updateBatchSocket(options: ICustomerRequestInfo, data: unknown, requestUtils?: ISocketUtils): Promise<import("../../types/batch-type").IResultRunPromisesOneAfterAnother[]>;
5
+ export declare function updateBatchSocket(options: ICustomerRequestInfo, data: unknown, requestUtils?: ISocketUtils): Promise<import("../../index").IResultRunPromisesOneAfterAnother[]>;
6
6
  //# sourceMappingURL=batch_update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch_update.d.ts","sourceRoot":"","sources":["../../../src/socket/events/batch_update.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,oBAAoB,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAO/D;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,YAAY,iFAiBhH"}
1
+ {"version":3,"file":"batch_update.d.ts","sourceRoot":"","sources":["../../../src/socket/events/batch_update.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,oBAAoB,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAO/D;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,YAAY,sEAiBhH"}
@@ -34,12 +34,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  const use_logger_1 = require("../logger/use-logger");
36
36
  const index_1 = require("../index");
37
- const fetch = (...args) => Promise.resolve().then(() => __importStar(require('node-fetch'))).then(({ default: fetch }) => fetch(...args));
37
+ const oldFetch = (...args) => Promise.resolve().then(() => __importStar(require('node-fetch'))).then(({ default: fetch }) => fetch(...args));
38
38
  exports.default = (url, init) => __awaiter(void 0, void 0, void 0, function* () {
39
39
  use_logger_1.Logger.info(`%s %s %o`, (init === null || init === void 0 ? void 0 : init.method) || '', url, (init === null || init === void 0 ? void 0 : init.body) || {});
40
40
  let response;
41
41
  try {
42
- response = yield fetch(url, init);
42
+ response = yield (!!fetch ? fetch : oldFetch)(url, init);
43
43
  }
44
44
  catch (err) {
45
45
  use_logger_1.Logger.error(err);
@@ -58,8 +58,15 @@ function parseAppServerError(res) {
58
58
  throw index_1.CoreError.AppServerError('res:Response is undefined.');
59
59
  const status = res.status;
60
60
  const contentType = res.headers.get('content-type');
61
- if (!contentType)
62
- throw index_1.CoreError.AppServerError('nodeFetch parsing: Content-Type is not detected.');
61
+ if (!contentType) {
62
+ try {
63
+ console.log(res);
64
+ }
65
+ catch (e) {
66
+ console.log(e);
67
+ }
68
+ throw index_1.CoreError.AppServerError(['nodeFetch parsing: Content-Type is not detected.', res.statusText, res.status.toString()]);
69
+ }
63
70
  /**
64
71
  * Any application/json data
65
72
  */
@@ -1 +1 @@
1
- {"version":3,"file":"nodeFetch.js","sourceRoot":"","sources":["../../src/utils/nodeFetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAA4C;AAC5C,oCAAmC;AAEnC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,kDAAO,YAAY,IAAE,IAAI,CAAC,CAA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
2
  "name": "eservices-back-core",
3
- "version": "2.1.50",
3
+ "version": "2.1.52",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -26,6 +26,7 @@
26
26
  "author": "",
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
+ "@types/formidable": "^3.4.5",
29
30
  "amqplib": "^0.10.3",
30
31
  "connect-redis": "^6.1.3",
31
32
  "cookie-parser": "^1.4.6",
@@ -35,6 +36,7 @@
35
36
  "express": "^4.18.2",
36
37
  "express-openid-connect": "^2.7.2",
37
38
  "express-session": "^1.17.3",
39
+ "formidable": "^3.5.2",
38
40
  "http-proxy-middleware": "3.0.0",
39
41
  "jenesius-vue-form": "^3.0.4",
40
42
  "jwt-decode": "^3.1.2",