@colijnit/ioneconnector 2.0.3 → 2.0.6

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.
Files changed (69) hide show
  1. package/build/connector.js +25 -57
  2. package/build/connector.unit.test.js +36 -67
  3. package/build/enum/backend-service-name.enum.js +4 -2
  4. package/build/enum/datasession-service-method.enum.js +4 -2
  5. package/build/enum/db-boolean-value-type.enum.js +15 -12
  6. package/build/enum/end-point.enum.js +4 -2
  7. package/build/enum/login-service-method.enum.js +4 -2
  8. package/build/enum/one-zero-bool-db-type.enum.js +6 -3
  9. package/build/enum/public-service-method.enum.js +4 -2
  10. package/build/enum/true-false-db-type.enum.js +6 -3
  11. package/build/enum/yes-no-db-type.enum.js +6 -3
  12. package/build/factory/decorators/boolean.decorator.js +34 -34
  13. package/build/factory/decorators/complex-array.decorator.js +18 -18
  14. package/build/factory/decorators/complex-field.decorator.js +18 -18
  15. package/build/factory/decorators/date-field.decorator.js +14 -14
  16. package/build/factory/decorators/db-field-alias.decorator.js +15 -15
  17. package/build/factory/decorators/json.decorator.js +12 -12
  18. package/build/factory/decorators/map-property.decorator.js +13 -13
  19. package/build/factory/decorators/no-db-field.decorator.js +13 -13
  20. package/build/factory/decorators/string-number.decorator.js +16 -16
  21. package/build/model/business-object.js +38 -39
  22. package/build/model/constant/java-constants.js +4 -2
  23. package/build/model/data-service-data.js +5 -6
  24. package/build/model/data-service-response-data.interface.js +2 -0
  25. package/build/model/data-service-response-data.js +31 -42
  26. package/build/model/data-service-response-exception.js +2 -0
  27. package/build/model/data-service-response-root.js +2 -0
  28. package/build/model/field-validation.interface.js +2 -0
  29. package/build/model/field-validation.js +14 -13
  30. package/build/model/field-validations-object.interface.js +2 -0
  31. package/build/model/field-validations-object.js +2 -0
  32. package/build/model/login-response.interface.js +2 -0
  33. package/build/model/login-response.js +6 -22
  34. package/build/model/login.js +20 -31
  35. package/build/model/options.js +6 -5
  36. package/build/model/paging-parameters.interface.js +5 -6
  37. package/build/model/paging-parameters.js +20 -23
  38. package/build/model/server-response-data.js +2 -0
  39. package/build/model/server-stack-trace-element.js +2 -0
  40. package/build/model/session.js +6 -5
  41. package/build/model/validation-message.interface.js +2 -0
  42. package/build/model/validation-message.js +22 -21
  43. package/build/model/validation-result.interface.js +2 -0
  44. package/build/model/validation-result.js +15 -15
  45. package/build/provider/ajax.service.js +70 -136
  46. package/build/provider/base-backend-connection.service.js +38 -73
  47. package/build/service/business-object-factory.js +47 -46
  48. package/build/service/datasession.service.js +18 -49
  49. package/build/service/encrypt.service.js +27 -18
  50. package/build/service/encrypt.service.unit.test.js +8 -6
  51. package/build/service/login.service.js +69 -110
  52. package/build/service/public.service.js +16 -16
  53. package/build/tests/int/connector.int.test.js +6 -4
  54. package/build/type/business-object-id-type.js +8 -6
  55. package/build/type/object-configuration-default-value-type.js +2 -0
  56. package/build/utils/array-utils.js +16 -17
  57. package/build/utils/business-object-utils.js +12 -13
  58. package/build/utils/date-utils.js +9 -10
  59. package/build/utils/function/is-nill.function.js +4 -1
  60. package/build/utils/function/not-nill.function.js +4 -1
  61. package/build/utils/image-utils.js +10 -11
  62. package/build/utils/number-utils.js +25 -28
  63. package/build/utils/object-utils.js +45 -51
  64. package/build/utils/parameter-value-conversion-utils.js +9 -10
  65. package/build/utils/promise-utils.js +14 -50
  66. package/build/utils/ref-code-utils.js +12 -17
  67. package/build/utils/string-utils.js +17 -19
  68. package/build/utils/url-utils.js +11 -12
  69. package/package.json +5 -2
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,42 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { Session } from "../model/session";
38
- import { LoginService } from "../service/login.service";
39
- import { Subject } from "rxjs";
40
- import { DatasessionService } from "../service/datasession.service";
41
- var BaseBackendConnectionService = (function () {
42
- function BaseBackendConnectionService(options) {
43
- this.showLoader = new Subject();
44
- this.connectionAborted = new Subject();
45
- this.connectionResetInactivity = new Subject();
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const session_1 = require("../model/session");
13
+ const login_service_1 = require("../service/login.service");
14
+ const rxjs_1 = require("rxjs");
15
+ const datasession_service_1 = require("../service/datasession.service");
16
+ class BaseBackendConnectionService {
17
+ constructor(options) {
18
+ this.showLoader = new rxjs_1.Subject();
19
+ this.connectionAborted = new rxjs_1.Subject();
20
+ this.connectionResetInactivity = new rxjs_1.Subject();
46
21
  this.callId = "1";
47
22
  this.options = options;
48
23
  this.url = options.url;
@@ -52,59 +27,49 @@ var BaseBackendConnectionService = (function () {
52
27
  else {
53
28
  this.session = this._createNewSession();
54
29
  }
55
- this._loginService = new LoginService(this);
56
- this._datasessionService = new DatasessionService(this);
30
+ this._loginService = new login_service_1.LoginService(this);
31
+ this._datasessionService = new datasession_service_1.DatasessionService(this);
57
32
  }
58
- BaseBackendConnectionService.prototype.commit = function () {
59
- return __awaiter(this, void 0, void 0, function () {
60
- return __generator(this, function (_a) {
61
- return [2, this._datasessionService.commit()];
62
- });
33
+ commit() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ return this._datasessionService.commit();
63
36
  });
64
- };
65
- BaseBackendConnectionService.prototype.closeDataSession = function () {
37
+ }
38
+ closeDataSession() {
66
39
  if (!this._loginService.loggingOut) {
67
40
  this._loginService.logout();
68
41
  }
69
- };
70
- BaseBackendConnectionService.prototype.resetConnection = function () {
42
+ }
43
+ resetConnection() {
71
44
  if (this.session) {
72
45
  this.session.created = false;
73
46
  }
74
- };
75
- BaseBackendConnectionService.prototype.waitForLogin = function () {
76
- return __awaiter(this, void 0, void 0, function () {
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
79
- case 0:
80
- if (this.session && this.session.created) {
81
- return [2, true];
82
- }
83
- if (!!this._loginService.initialized) return [3, 2];
84
- return [4, this._loginService.loginAndCreateDataSession()];
85
- case 1:
86
- _a.sent();
87
- _a.label = 2;
88
- case 2: return [2, true];
89
- }
90
- });
47
+ }
48
+ waitForLogin() {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ if (this.session && this.session.created) {
51
+ return true;
52
+ }
53
+ if (!this._loginService.initialized) {
54
+ yield this._loginService.loginAndCreateDataSession();
55
+ }
56
+ return true;
91
57
  });
92
- };
93
- BaseBackendConnectionService.prototype._createNewSession = function () {
94
- var session = new Session();
58
+ }
59
+ _createNewSession() {
60
+ const session = new session_1.Session();
95
61
  session.dataSessionId = 'webselector_' + this._generateUniqueId();
96
62
  session.id = this._generateUniqueId();
97
63
  session.windowsId = "1";
98
64
  return session;
99
- };
100
- BaseBackendConnectionService.prototype._generateUniqueId = function () {
65
+ }
66
+ _generateUniqueId() {
101
67
  function s4() {
102
68
  return Math.floor((1 + Math.random()) * 0x10000)
103
69
  .toString(16)
104
70
  .substring(1);
105
71
  }
106
72
  return s4() + s4() + s4();
107
- };
108
- return BaseBackendConnectionService;
109
- }());
110
- export { BaseBackendConnectionService };
73
+ }
74
+ }
75
+ exports.BaseBackendConnectionService = BaseBackendConnectionService;
@@ -1,54 +1,56 @@
1
- import { ComplexFieldDecorator } from "../factory/decorators/complex-field.decorator";
2
- import { ComplexArrayDecorator } from "../factory/decorators/complex-array.decorator";
3
- import { BooleanTextDecorator } from "../factory/decorators/boolean.decorator";
4
- import { DateFieldFieldDecorator } from "../factory/decorators/date-field.decorator";
5
- import { StringNumberDecorator } from "../factory/decorators/string-number.decorator";
6
- import { isNill } from "../utils/function/is-nill.function";
7
- import { ArrayUtils } from "../utils/array-utils";
8
- import { BusinessObject } from "../model/business-object";
9
- import { MapPropertyDecorator } from "../factory/decorators/map-property.decorator";
10
- var BusinessObjectFactory = (function () {
11
- function BusinessObjectFactory() {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const complex_field_decorator_1 = require("../factory/decorators/complex-field.decorator");
4
+ const complex_array_decorator_1 = require("../factory/decorators/complex-array.decorator");
5
+ const boolean_decorator_1 = require("../factory/decorators/boolean.decorator");
6
+ const date_field_decorator_1 = require("../factory/decorators/date-field.decorator");
7
+ const string_number_decorator_1 = require("../factory/decorators/string-number.decorator");
8
+ const is_nill_function_1 = require("../utils/function/is-nill.function");
9
+ const array_utils_1 = require("../utils/array-utils");
10
+ const business_object_1 = require("../model/business-object");
11
+ const map_property_decorator_1 = require("../factory/decorators/map-property.decorator");
12
+ class BusinessObjectFactory {
13
+ constructor() {
12
14
  }
13
- BusinessObjectFactory.prototype.makeWithRawBackendData = function (modelClass, rawData) {
15
+ makeWithRawBackendData(modelClass, rawData) {
14
16
  if (!modelClass) {
15
17
  return undefined;
16
18
  }
17
- if (typeof modelClass !== typeof BusinessObject) {
19
+ if (typeof modelClass !== typeof business_object_1.BusinessObject) {
18
20
  return undefined;
19
21
  }
20
- var model = new modelClass();
22
+ const model = new modelClass();
21
23
  this._copyAllPropertiesDecoratorProcessedFrom(rawData, model);
22
24
  return model;
23
- };
24
- BusinessObjectFactory.prototype.makeBOArrayFromRawBackendDataArray = function (modelClass, arrayOfRawDatas) {
25
+ }
26
+ makeBOArrayFromRawBackendDataArray(modelClass, arrayOfRawDatas) {
25
27
  if (!modelClass) {
26
28
  return undefined;
27
29
  }
28
- var trueClientBos = [];
30
+ const trueClientBos = [];
29
31
  if (arrayOfRawDatas) {
30
- for (var i = 0, len = arrayOfRawDatas.length; i < len; i++) {
32
+ for (let i = 0, len = arrayOfRawDatas.length; i < len; i++) {
31
33
  trueClientBos.push(this.makeWithRawBackendData(modelClass, arrayOfRawDatas[i]));
32
34
  }
33
35
  }
34
36
  return trueClientBos;
35
- };
36
- BusinessObjectFactory.prototype.instantiateNewBo = function (modelClass) {
37
+ }
38
+ instantiateNewBo(modelClass) {
37
39
  return this.makeWithRawBackendData(modelClass, {});
38
- };
39
- BusinessObjectFactory.prototype._copyAllPropertiesDecoratorProcessedFrom = function (sourceData, destinationModel) {
40
+ }
41
+ _copyAllPropertiesDecoratorProcessedFrom(sourceData, destinationModel) {
40
42
  if (!sourceData || !destinationModel) {
41
43
  return;
42
44
  }
43
- for (var srcPropKey in sourceData) {
45
+ for (let srcPropKey in sourceData) {
44
46
  if (!sourceData.hasOwnProperty(srcPropKey)) {
45
47
  continue;
46
48
  }
47
- var srcPropVal = sourceData[srcPropKey];
48
- for (var prop in destinationModel) {
49
+ const srcPropVal = sourceData[srcPropKey];
50
+ for (let prop in destinationModel) {
49
51
  if (destinationModel.hasOwnProperty(prop)) {
50
- if (MapPropertyDecorator.IsMapProperty(destinationModel, prop)) {
51
- var destPropKey = MapPropertyDecorator.GetMapProperty(destinationModel, prop);
52
+ if (map_property_decorator_1.MapPropertyDecorator.IsMapProperty(destinationModel, prop)) {
53
+ const destPropKey = map_property_decorator_1.MapPropertyDecorator.GetMapProperty(destinationModel, prop);
52
54
  if (srcPropKey === destPropKey) {
53
55
  srcPropKey = prop;
54
56
  break;
@@ -56,42 +58,42 @@ var BusinessObjectFactory = (function () {
56
58
  }
57
59
  }
58
60
  }
59
- if (ComplexFieldDecorator.IsComplexField(destinationModel, srcPropKey)) {
60
- var classOfField = ComplexFieldDecorator.GetComplexFieldType(destinationModel, srcPropKey);
61
+ if (complex_field_decorator_1.ComplexFieldDecorator.IsComplexField(destinationModel, srcPropKey)) {
62
+ const classOfField = complex_field_decorator_1.ComplexFieldDecorator.GetComplexFieldType(destinationModel, srcPropKey);
61
63
  destinationModel[srcPropKey] = this.makeWithRawBackendData(classOfField, srcPropVal);
62
64
  }
63
- else if (ComplexArrayDecorator.IsComplexArray(destinationModel, srcPropKey)) {
64
- var sourceArray = srcPropVal;
65
+ else if (complex_array_decorator_1.ComplexArrayDecorator.IsComplexArray(destinationModel, srcPropKey)) {
66
+ const sourceArray = srcPropVal;
65
67
  if (!sourceArray) {
66
68
  continue;
67
69
  }
68
- var classOfArrayItems = ComplexArrayDecorator.GetComplexArrayType(destinationModel, srcPropKey);
69
- var tempArray = [];
70
- for (var i = 0, len = sourceArray.length; i < len; i++) {
70
+ const classOfArrayItems = complex_array_decorator_1.ComplexArrayDecorator.GetComplexArrayType(destinationModel, srcPropKey);
71
+ const tempArray = [];
72
+ for (let i = 0, len = sourceArray.length; i < len; i++) {
71
73
  tempArray.push(this.makeWithRawBackendData(classOfArrayItems, sourceArray[i]));
72
74
  }
73
75
  destinationModel[srcPropKey] = tempArray;
74
76
  }
75
- else if (BooleanTextDecorator.IsBooleanTextField(destinationModel, srcPropKey)) {
77
+ else if (boolean_decorator_1.BooleanTextDecorator.IsBooleanTextField(destinationModel, srcPropKey)) {
76
78
  if (typeof srcPropVal === "boolean") {
77
79
  destinationModel[srcPropKey] = srcPropVal;
78
80
  }
79
81
  else {
80
- destinationModel[srcPropKey] = BooleanTextDecorator.GetLogicalBooleanValue(srcPropVal);
82
+ destinationModel[srcPropKey] = boolean_decorator_1.BooleanTextDecorator.GetLogicalBooleanValue(srcPropVal);
81
83
  }
82
84
  }
83
- else if (DateFieldFieldDecorator.IsDateField(destinationModel, srcPropKey)) {
84
- destinationModel[srcPropKey] = DateFieldFieldDecorator.StringAsDate(srcPropVal);
85
+ else if (date_field_decorator_1.DateFieldFieldDecorator.IsDateField(destinationModel, srcPropKey)) {
86
+ destinationModel[srcPropKey] = date_field_decorator_1.DateFieldFieldDecorator.StringAsDate(srcPropVal);
85
87
  }
86
- else if (StringNumberDecorator.IsStringNumber(destinationModel, srcPropKey)) {
87
- destinationModel[srcPropKey] = StringNumberDecorator.StringAsNumber(srcPropVal);
88
+ else if (string_number_decorator_1.StringNumberDecorator.IsStringNumber(destinationModel, srcPropKey)) {
89
+ destinationModel[srcPropKey] = string_number_decorator_1.StringNumberDecorator.StringAsNumber(srcPropVal);
88
90
  }
89
91
  else {
90
- if (isNill(srcPropVal)) {
92
+ if (is_nill_function_1.isNill(srcPropVal)) {
91
93
  destinationModel[srcPropKey] = undefined;
92
94
  }
93
95
  else if (Array.isArray(srcPropVal)) {
94
- destinationModel[srcPropKey] = ArrayUtils.CloneArray(srcPropVal);
96
+ destinationModel[srcPropKey] = array_utils_1.ArrayUtils.CloneArray(srcPropVal);
95
97
  }
96
98
  else if (typeof srcPropVal === "object") {
97
99
  if (srcPropVal instanceof Map) {
@@ -106,7 +108,6 @@ var BusinessObjectFactory = (function () {
106
108
  }
107
109
  }
108
110
  }
109
- };
110
- return BusinessObjectFactory;
111
- }());
112
- export { BusinessObjectFactory };
111
+ }
112
+ }
113
+ exports.BusinessObjectFactory = BusinessObjectFactory;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,61 +8,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { BackendServiceName } from "../enum/backend-service-name.enum";
38
- import { DatasessionServiceMethod } from "../enum/datasession-service-method.enum";
39
- var DatasessionService = (function () {
40
- function DatasessionService(backendConnection) {
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const backend_service_name_enum_1 = require("../enum/backend-service-name.enum");
13
+ const datasession_service_method_enum_1 = require("../enum/datasession-service-method.enum");
14
+ class DatasessionService {
15
+ constructor(backendConnection) {
41
16
  this.backendConnection = backendConnection;
42
17
  }
43
- DatasessionService.prototype.createDataSession = function (id) {
44
- return this._call(DatasessionServiceMethod.OpenDataSession, { moduleName: id }, true);
45
- };
46
- DatasessionService.prototype.commit = function () {
47
- return __awaiter(this, void 0, void 0, function () {
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
50
- case 0: return [4, this._call(DatasessionServiceMethod.Commit, {}, false)];
51
- case 1: return [2, _a.sent()];
52
- }
53
- });
18
+ createDataSession(id) {
19
+ return this._call(datasession_service_method_enum_1.DatasessionServiceMethod.OpenDataSession, { moduleName: id }, true);
20
+ }
21
+ commit() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ return yield this._call(datasession_service_method_enum_1.DatasessionServiceMethod.Commit, {}, false);
54
24
  });
55
- };
56
- DatasessionService.prototype._call = function (method, data, showLoader) {
25
+ }
26
+ _call(method, data, showLoader) {
57
27
  if (data === undefined) {
58
28
  data = {};
59
29
  }
60
30
  if (showLoader === undefined) {
61
31
  showLoader = true;
62
32
  }
63
- return this.backendConnection.call(method, data, showLoader, BackendServiceName.DatasessionService);
64
- };
65
- return DatasessionService;
66
- }());
67
- export { DatasessionService };
33
+ return this.backendConnection.call(method, data, showLoader, backend_service_name_enum_1.BackendServiceName.DatasessionService);
34
+ }
35
+ }
36
+ exports.DatasessionService = DatasessionService;
@@ -1,20 +1,29 @@
1
- import { JSEncrypt } from "jsencrypt";
2
- var EncryptService = (function () {
3
- function EncryptService() {
4
- this.rsa = new JSEncrypt({
5
- default_key_size: "2048"
6
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsencrypt_1 = require("jsencrypt");
4
+ let JSEncryptNode = null;
5
+ try {
6
+ JSEncryptNode = require("nodejs-jsencrypt").default;
7
+ }
8
+ catch (e) { }
9
+ class EncryptService {
10
+ constructor() {
11
+ if (JSEncryptNode) {
12
+ this.rsa = new JSEncryptNode({
13
+ default_key_size: "2048"
14
+ });
15
+ }
16
+ else {
17
+ this.rsa = new jsencrypt_1.JSEncrypt({
18
+ default_key_size: "2048"
19
+ });
20
+ }
7
21
  }
8
- Object.defineProperty(EncryptService.prototype, "publicKey", {
9
- set: function (key) {
10
- this.rsa.setPublicKey(key);
11
- },
12
- enumerable: true,
13
- configurable: true
14
- });
15
- EncryptService.prototype.encRsa = function (stringToEncrypt) {
22
+ set publicKey(key) {
23
+ this.rsa.setPublicKey(key);
24
+ }
25
+ encRsa(stringToEncrypt) {
16
26
  return this.rsa.encrypt(stringToEncrypt);
17
- };
18
- return EncryptService;
19
- }());
20
- export { EncryptService };
27
+ }
28
+ }
29
+ exports.EncryptService = EncryptService;
@@ -1,12 +1,14 @@
1
- import { EncryptService } from "./encrypt.service";
2
- var publicKey = "-----BEGIN PUBLIC KEY-----\n" +
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const encrypt_service_1 = require("./encrypt.service");
4
+ const publicKey = "-----BEGIN PUBLIC KEY-----\n" +
3
5
  "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArrb9f3obcZG3WETmxtzoJlfkMc2LuIT1n6J5WmPVCPwk8gYqI/bq7+/yLvdC0ZCB641YJa/hA9avCScOHbHqf5AHr3Tk7yYR52oitBuclOkHJdInTfTCMmK2mdtaPulPy1aOJFsIycnKqV8+iCAztXRq3vKqz/rbF7oZIeAZ0FSTh0E628meaEZhb07foaxXDu1vK0OYKB9axNX2EL2Pn886VeOE0sjdOTF49HG3b3Axgt/NLLF1FX0brwQDWt7HYXd3Pw/RCUWnyag7b/ap+9EDaxAvhcO5ZFYZklPgHFUTO7w2Dj2jCH2e1/l9+KFb8FvoLVh23PT9fpaZbcHVtwIDAQAB\n" +
4
6
  "-----END PUBLIC KEY-----";
5
- describe("EncryptService", function () {
6
- it('encRsa', function () {
7
- var encryptionService = new EncryptService();
7
+ describe("EncryptService", () => {
8
+ it('encRsa', () => {
9
+ const encryptionService = new encrypt_service_1.EncryptService();
8
10
  encryptionService.publicKey = publicKey;
9
- var encryptedString = encryptionService.encRsa("gast3");
11
+ const encryptedString = encryptionService.encRsa("gast3");
10
12
  expect(encryptedString.length).toBeGreaterThan(1);
11
13
  });
12
14
  });