@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.
- package/build/connector.js +25 -57
- package/build/connector.unit.test.js +36 -67
- package/build/enum/backend-service-name.enum.js +4 -2
- package/build/enum/datasession-service-method.enum.js +4 -2
- package/build/enum/db-boolean-value-type.enum.js +15 -12
- package/build/enum/end-point.enum.js +4 -2
- package/build/enum/login-service-method.enum.js +4 -2
- package/build/enum/one-zero-bool-db-type.enum.js +6 -3
- package/build/enum/public-service-method.enum.js +4 -2
- package/build/enum/true-false-db-type.enum.js +6 -3
- package/build/enum/yes-no-db-type.enum.js +6 -3
- package/build/factory/decorators/boolean.decorator.js +34 -34
- package/build/factory/decorators/complex-array.decorator.js +18 -18
- package/build/factory/decorators/complex-field.decorator.js +18 -18
- package/build/factory/decorators/date-field.decorator.js +14 -14
- package/build/factory/decorators/db-field-alias.decorator.js +15 -15
- package/build/factory/decorators/json.decorator.js +12 -12
- package/build/factory/decorators/map-property.decorator.js +13 -13
- package/build/factory/decorators/no-db-field.decorator.js +13 -13
- package/build/factory/decorators/string-number.decorator.js +16 -16
- package/build/model/business-object.js +38 -39
- package/build/model/constant/java-constants.js +4 -2
- package/build/model/data-service-data.js +5 -6
- package/build/model/data-service-response-data.interface.js +2 -0
- package/build/model/data-service-response-data.js +31 -42
- package/build/model/data-service-response-exception.js +2 -0
- package/build/model/data-service-response-root.js +2 -0
- package/build/model/field-validation.interface.js +2 -0
- package/build/model/field-validation.js +14 -13
- package/build/model/field-validations-object.interface.js +2 -0
- package/build/model/field-validations-object.js +2 -0
- package/build/model/login-response.interface.js +2 -0
- package/build/model/login-response.js +6 -22
- package/build/model/login.js +20 -31
- package/build/model/options.js +6 -5
- package/build/model/paging-parameters.interface.js +5 -6
- package/build/model/paging-parameters.js +20 -23
- package/build/model/server-response-data.js +2 -0
- package/build/model/server-stack-trace-element.js +2 -0
- package/build/model/session.js +6 -5
- package/build/model/validation-message.interface.js +2 -0
- package/build/model/validation-message.js +22 -21
- package/build/model/validation-result.interface.js +2 -0
- package/build/model/validation-result.js +15 -15
- package/build/provider/ajax.service.js +70 -136
- package/build/provider/base-backend-connection.service.js +38 -73
- package/build/service/business-object-factory.js +47 -46
- package/build/service/datasession.service.js +18 -49
- package/build/service/encrypt.service.js +27 -18
- package/build/service/encrypt.service.unit.test.js +8 -6
- package/build/service/login.service.js +69 -110
- package/build/service/public.service.js +16 -16
- package/build/tests/int/connector.int.test.js +6 -4
- package/build/type/business-object-id-type.js +8 -6
- package/build/type/object-configuration-default-value-type.js +2 -0
- package/build/utils/array-utils.js +16 -17
- package/build/utils/business-object-utils.js +12 -13
- package/build/utils/date-utils.js +9 -10
- package/build/utils/function/is-nill.function.js +4 -1
- package/build/utils/function/not-nill.function.js +4 -1
- package/build/utils/image-utils.js +10 -11
- package/build/utils/number-utils.js +25 -28
- package/build/utils/object-utils.js +45 -51
- package/build/utils/parameter-value-conversion-utils.js +9 -10
- package/build/utils/promise-utils.js +14 -50
- package/build/utils/ref-code-utils.js +12 -17
- package/build/utils/string-utils.js +17 -19
- package/build/utils/url-utils.js +11 -12
- package/package.json +5 -2
package/build/model/login.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Login {
|
|
4
|
+
constructor() {
|
|
3
5
|
this.upId = "";
|
|
4
6
|
this.clientVersion = "";
|
|
5
7
|
this.clientTimeZoneOffset = "0";
|
|
@@ -8,31 +10,19 @@ var Login = (function () {
|
|
|
8
10
|
this._passWord = "gast3";
|
|
9
11
|
this._userType = "H";
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(Login.prototype, "userName", {
|
|
29
|
-
set: function (value) {
|
|
30
|
-
this._userName = value;
|
|
31
|
-
},
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
35
|
-
Login.prototype.getSerialized = function () {
|
|
13
|
+
set passWord(value) {
|
|
14
|
+
this._passWord = value;
|
|
15
|
+
}
|
|
16
|
+
get passWordClean() {
|
|
17
|
+
return this._passWordClean;
|
|
18
|
+
}
|
|
19
|
+
set userName(value) {
|
|
20
|
+
this._userName = value;
|
|
21
|
+
}
|
|
22
|
+
set passWordClean(value) {
|
|
23
|
+
this._passWordClean = value;
|
|
24
|
+
}
|
|
25
|
+
getSerialized() {
|
|
36
26
|
return {
|
|
37
27
|
userName: this._userName,
|
|
38
28
|
userPassword: this._passWord,
|
|
@@ -42,7 +32,6 @@ var Login = (function () {
|
|
|
42
32
|
userType: this._userType,
|
|
43
33
|
clientTimeZoneOffset: this.clientTimeZoneOffset
|
|
44
34
|
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export { Login };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Login = Login;
|
package/build/model/options.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Options {
|
|
4
|
+
constructor() {
|
|
3
5
|
this.useWebsocket = false;
|
|
4
6
|
this.useGroups = true;
|
|
5
7
|
this.useRenders = false;
|
|
@@ -7,6 +9,5 @@ var Options = (function () {
|
|
|
7
9
|
this.use3D = false;
|
|
8
10
|
this.useLoginEncryption = false;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export { Options };
|
|
12
|
+
}
|
|
13
|
+
exports.Options = Options;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { IPagingParameters };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class IPagingParameters {
|
|
4
|
+
}
|
|
5
|
+
exports.IPagingParameters = IPagingParameters;
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (maximumRows === void 0) { maximumRows = PagingParameters.DEFAULT_UPPER_BOUND; }
|
|
7
|
-
if (isLastPage === void 0) { isLastPage = false; }
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const not_nill_function_1 = require("../utils/function/not-nill.function");
|
|
4
|
+
class PagingParameters {
|
|
5
|
+
constructor(pageLowerBound = 1, pageUpperBound = PagingParameters.DEFAULT_UPPER_BOUND, maximumRows = PagingParameters.DEFAULT_UPPER_BOUND, isLastPage = false) {
|
|
8
6
|
this.pageLowerBound = pageLowerBound;
|
|
9
7
|
this.pageUpperBound = pageUpperBound;
|
|
10
8
|
this.maximumRows = maximumRows;
|
|
11
9
|
this.isLastPage = isLastPage;
|
|
12
10
|
}
|
|
13
|
-
|
|
11
|
+
setData(rawData) {
|
|
14
12
|
if (!rawData) {
|
|
15
13
|
return;
|
|
16
14
|
}
|
|
17
|
-
if (notNill(rawData.pageLowerBound)) {
|
|
15
|
+
if (not_nill_function_1.notNill(rawData.pageLowerBound)) {
|
|
18
16
|
this.pageLowerBound = rawData.pageLowerBound;
|
|
19
17
|
}
|
|
20
|
-
if (notNill(rawData.pageUpperBound)) {
|
|
18
|
+
if (not_nill_function_1.notNill(rawData.pageUpperBound)) {
|
|
21
19
|
this.pageUpperBound = rawData.pageUpperBound;
|
|
22
20
|
}
|
|
23
|
-
if (notNill(rawData.maximumRows)) {
|
|
21
|
+
if (not_nill_function_1.notNill(rawData.maximumRows)) {
|
|
24
22
|
this.maximumRows = rawData.maximumRows;
|
|
25
23
|
}
|
|
26
|
-
if (notNill(rawData.isLastPage)) {
|
|
24
|
+
if (not_nill_function_1.notNill(rawData.isLastPage)) {
|
|
27
25
|
this.isLastPage = rawData.isLastPage;
|
|
28
26
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export { PagingParameters };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.PagingParameters = PagingParameters;
|
|
30
|
+
PagingParameters.DEFAULT_UPPER_BOUND = 1000;
|
|
31
|
+
PagingParameters.DEFAULTS = new PagingParameters(1, PagingParameters.DEFAULT_UPPER_BOUND, PagingParameters.DEFAULT_UPPER_BOUND);
|
|
32
|
+
PagingParameters.HUNDRED_RESULTS = new PagingParameters(1, 100, 100);
|
|
33
|
+
PagingParameters.FIFTY_RESULTS = new PagingParameters(1, 50, 50);
|
|
34
|
+
PagingParameters.TWENTY_RESULTS = new PagingParameters(1, 20, 20);
|
|
35
|
+
PagingParameters.TEN_RESULTS = new PagingParameters(1, 10, 10);
|
|
36
|
+
PagingParameters.ONE_RESULT = new PagingParameters(1, 1, 1);
|
package/build/model/session.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Session {
|
|
4
|
+
constructor() {
|
|
3
5
|
this.created = false;
|
|
4
6
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { Session };
|
|
7
|
+
}
|
|
8
|
+
exports.Session = Session;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -7,35 +8,35 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const business_object_id_type_1 = require("../type/business-object-id-type");
|
|
13
|
+
const no_db_field_decorator_1 = require("../factory/decorators/no-db-field.decorator");
|
|
14
|
+
const not_nill_function_1 = require("../utils/function/not-nill.function");
|
|
15
|
+
class ValidationMessage {
|
|
16
|
+
constructor(rawData) {
|
|
15
17
|
this.setData(rawData);
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
setData(rawData) {
|
|
18
20
|
if (!rawData) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
|
-
if (notNill(rawData.code)) {
|
|
23
|
+
if (not_nill_function_1.notNill(rawData.code)) {
|
|
22
24
|
this.code = rawData.code;
|
|
23
25
|
}
|
|
24
|
-
if (notNill(rawData.message)) {
|
|
26
|
+
if (not_nill_function_1.notNill(rawData.message)) {
|
|
25
27
|
this.message = rawData.message;
|
|
26
28
|
}
|
|
27
|
-
if (notNill(rawData.fieldId)) {
|
|
29
|
+
if (not_nill_function_1.notNill(rawData.fieldId)) {
|
|
28
30
|
this.fieldId = rawData.fieldId;
|
|
29
31
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export { ValidationMessage };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
__decorate([
|
|
35
|
+
no_db_field_decorator_1.NoDbField(),
|
|
36
|
+
__metadata("design:type", Object)
|
|
37
|
+
], ValidationMessage.prototype, "boId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
no_db_field_decorator_1.NoDbField(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], ValidationMessage.prototype, "fieldLabel", void 0);
|
|
42
|
+
exports.ValidationMessage = ValidationMessage;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const object_utils_1 = require("../utils/object-utils");
|
|
4
|
+
const validation_message_1 = require("./validation-message");
|
|
5
|
+
const field_validation_1 = require("./field-validation");
|
|
6
|
+
class ValidationResult {
|
|
7
|
+
constructor(rawData) {
|
|
6
8
|
this.messages = [];
|
|
7
9
|
this.fieldValidations = {};
|
|
8
10
|
this.setData(rawData);
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
var _this = this;
|
|
12
|
+
setData(rawData) {
|
|
12
13
|
if (!rawData) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
@@ -21,17 +22,16 @@ var ValidationResult = (function () {
|
|
|
21
22
|
this.validationId = rawData.validationId;
|
|
22
23
|
if (rawData.messages) {
|
|
23
24
|
this.messages.length = 0;
|
|
24
|
-
for (
|
|
25
|
-
this.messages.push(new ValidationMessage(rawData.messages[i]));
|
|
25
|
+
for (let i = 0, len = rawData.messages.length; i < len; i++) {
|
|
26
|
+
this.messages.push(new validation_message_1.ValidationMessage(rawData.messages[i]));
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
if (rawData.fieldValidations) {
|
|
29
30
|
this.fieldValidations = {};
|
|
30
|
-
ObjectUtils.ForOwnProperty(rawData.fieldValidations,
|
|
31
|
-
|
|
31
|
+
object_utils_1.ObjectUtils.ForOwnProperty(rawData.fieldValidations, (validationFieldData, propKey) => {
|
|
32
|
+
this.fieldValidations[propKey] = new field_validation_1.FieldValidation(validationFieldData);
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export { ValidationResult };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ValidationResult = ValidationResult;
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
1
|
+
"use strict";
|
|
14
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -20,129 +8,83 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
9
|
});
|
|
22
10
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
-
if (t[2]) _.ops.pop();
|
|
43
|
-
_.trys.pop(); continue;
|
|
44
|
-
}
|
|
45
|
-
op = body.call(thisArg, _);
|
|
46
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
import { BackendServiceName } from "../enum/backend-service-name.enum";
|
|
51
|
-
import { BaseBackendConnectionService } from "./base-backend-connection.service";
|
|
52
|
-
import axios from "axios";
|
|
53
|
-
import { UrlUtils } from "../utils/url-utils";
|
|
54
|
-
import { DatasessionServiceMethod } from "../enum/datasession-service-method.enum";
|
|
55
|
-
import { EndPoint } from "../enum/end-point.enum";
|
|
56
|
-
var AjaxService = (function (_super) {
|
|
57
|
-
__extends(AjaxService, _super);
|
|
58
|
-
function AjaxService(options) {
|
|
59
|
-
var _this = _super.call(this, options) || this;
|
|
60
|
-
_this._showLoaderRequests = 0;
|
|
61
|
-
_this._usePublicToken = true;
|
|
62
|
-
_this._token = undefined;
|
|
63
|
-
_this._timeout = 180000;
|
|
64
|
-
_this._schema = options.schema;
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const backend_service_name_enum_1 = require("../enum/backend-service-name.enum");
|
|
13
|
+
const base_backend_connection_service_1 = require("./base-backend-connection.service");
|
|
14
|
+
const axios_1 = require("axios");
|
|
15
|
+
const url_utils_1 = require("../utils/url-utils");
|
|
16
|
+
const datasession_service_method_enum_1 = require("../enum/datasession-service-method.enum");
|
|
17
|
+
const end_point_enum_1 = require("../enum/end-point.enum");
|
|
18
|
+
class AjaxService extends base_backend_connection_service_1.BaseBackendConnectionService {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super(options);
|
|
21
|
+
this._showLoaderRequests = 0;
|
|
22
|
+
this._usePublicToken = true;
|
|
23
|
+
this._token = undefined;
|
|
24
|
+
this._timeout = 180000;
|
|
25
|
+
this._schema = options.schema;
|
|
65
26
|
if (options && options.timeoutInMs) {
|
|
66
|
-
|
|
27
|
+
this._timeout = options.timeoutInMs;
|
|
67
28
|
}
|
|
68
|
-
if (options && options.username && options.password) {
|
|
69
|
-
|
|
29
|
+
if (options && ((options.username && options.password) || options.session)) {
|
|
30
|
+
this._usePublicToken = false;
|
|
70
31
|
}
|
|
71
|
-
return _this;
|
|
72
32
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
_a._token = _b.sent();
|
|
88
|
-
_b.label = 2;
|
|
89
|
-
case 2:
|
|
90
|
-
if (!(this._usePublicToken || (service === BackendServiceName.PublicService ||
|
|
91
|
-
service === BackendServiceName.LoginService ||
|
|
92
|
-
service === BackendServiceName.DatasessionService))) return [3, 3];
|
|
93
|
-
return [2, this._doCall(method, data, showLoader, service, endPoint)];
|
|
94
|
-
case 3: return [4, this.waitForLogin()];
|
|
95
|
-
case 4:
|
|
96
|
-
_b.sent();
|
|
97
|
-
return [2, this._doCall(method, data, showLoader, service, endPoint)];
|
|
98
|
-
}
|
|
99
|
-
});
|
|
33
|
+
call(method, data = {}, showLoader = true, service = backend_service_name_enum_1.BackendServiceName.LoginService, endPoint = end_point_enum_1.EndPoint.AjaxService) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (this._usePublicToken && !this._token) {
|
|
36
|
+
this._token = yield this._createPublicSession();
|
|
37
|
+
}
|
|
38
|
+
if (this._usePublicToken || (service === backend_service_name_enum_1.BackendServiceName.PublicService ||
|
|
39
|
+
service === backend_service_name_enum_1.BackendServiceName.LoginService ||
|
|
40
|
+
service === backend_service_name_enum_1.BackendServiceName.DatasessionService)) {
|
|
41
|
+
return this._doCall(method, data, showLoader, service, endPoint);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
yield this.waitForLogin();
|
|
45
|
+
return this._doCall(method, data, showLoader, service, endPoint);
|
|
46
|
+
}
|
|
100
47
|
});
|
|
101
|
-
}
|
|
102
|
-
|
|
48
|
+
}
|
|
49
|
+
close() {
|
|
103
50
|
if (this._usePublicToken) {
|
|
104
|
-
this._doCall(DatasessionServiceMethod.ClosePublicSession, {});
|
|
51
|
+
this._doCall(datasession_service_method_enum_1.DatasessionServiceMethod.ClosePublicSession, {});
|
|
105
52
|
}
|
|
106
53
|
else {
|
|
107
54
|
this.closeDataSession();
|
|
108
55
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var _this = this;
|
|
112
|
-
if (data === void 0) { data = {}; }
|
|
113
|
-
if (showLoader === void 0) { showLoader = true; }
|
|
114
|
-
if (service === void 0) { service = BackendServiceName.LoginService; }
|
|
115
|
-
if (endPoint === void 0) { endPoint = EndPoint.AjaxService; }
|
|
56
|
+
}
|
|
57
|
+
_doCall(method, data = {}, showLoader = true, service = backend_service_name_enum_1.BackendServiceName.LoginService, endPoint = end_point_enum_1.EndPoint.AjaxService) {
|
|
116
58
|
if (showLoader) {
|
|
117
59
|
this.setShowLoaderRequests(this._showLoaderRequests + 1);
|
|
118
60
|
}
|
|
119
|
-
return new Promise(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const url = url_utils_1.UrlUtils.createReadableUrl(method, data, this.url, endPoint);
|
|
63
|
+
let message;
|
|
64
|
+
if (this._usePublicToken) {
|
|
123
65
|
message = JSON.stringify({
|
|
124
66
|
method: method,
|
|
125
67
|
data: data,
|
|
126
|
-
token:
|
|
68
|
+
token: this._token
|
|
127
69
|
});
|
|
128
70
|
}
|
|
129
71
|
else {
|
|
130
72
|
message = JSON.stringify({
|
|
131
73
|
service: service,
|
|
132
74
|
method: method,
|
|
133
|
-
id:
|
|
75
|
+
id: this.callId,
|
|
134
76
|
data: data,
|
|
135
|
-
dataSessionId:
|
|
136
|
-
windowSessionId:
|
|
137
|
-
sessionId:
|
|
77
|
+
dataSessionId: this.session ? this.session.dataSessionId : "",
|
|
78
|
+
windowSessionId: this.session ? this.session.windowsId : "1",
|
|
79
|
+
sessionId: this.session ? this.session.id : ""
|
|
138
80
|
});
|
|
139
81
|
}
|
|
140
|
-
|
|
82
|
+
axios_1.default({
|
|
141
83
|
method: 'post',
|
|
142
84
|
url: url,
|
|
143
85
|
data: message,
|
|
144
|
-
timeout:
|
|
145
|
-
}).then(
|
|
86
|
+
timeout: this._timeout
|
|
87
|
+
}).then(response => {
|
|
146
88
|
if (response.data) {
|
|
147
89
|
if (response.data.exception) {
|
|
148
90
|
resolve(response.data.exception);
|
|
@@ -151,27 +93,27 @@ var AjaxService = (function (_super) {
|
|
|
151
93
|
resolve(response.data.data);
|
|
152
94
|
}
|
|
153
95
|
}
|
|
154
|
-
}).catch(
|
|
96
|
+
}).catch(error => {
|
|
155
97
|
if (showLoader) {
|
|
156
|
-
|
|
98
|
+
this.setShowLoaderRequests(0);
|
|
157
99
|
}
|
|
158
100
|
if (error.code === "ECONNABORTED") {
|
|
159
|
-
|
|
101
|
+
this.connectionAborted.next();
|
|
160
102
|
}
|
|
161
103
|
else if (error.response && error.response.status === 500) {
|
|
162
|
-
|
|
163
|
-
|
|
104
|
+
this.resetConnection();
|
|
105
|
+
this.connectionResetInactivity.next();
|
|
164
106
|
}
|
|
165
107
|
reject(error);
|
|
166
108
|
});
|
|
167
|
-
}).then(
|
|
109
|
+
}).then(response => {
|
|
168
110
|
if (showLoader) {
|
|
169
|
-
|
|
111
|
+
this.setShowLoaderRequests(this._showLoaderRequests - 1);
|
|
170
112
|
}
|
|
171
|
-
return new Promise(
|
|
113
|
+
return new Promise((resolve) => { return resolve(response); });
|
|
172
114
|
});
|
|
173
|
-
}
|
|
174
|
-
|
|
115
|
+
}
|
|
116
|
+
setShowLoaderRequests(amount) {
|
|
175
117
|
this._showLoaderRequests = amount;
|
|
176
118
|
if (this._showLoaderRequests > 0) {
|
|
177
119
|
this.showLoader.next(true);
|
|
@@ -179,22 +121,14 @@ var AjaxService = (function (_super) {
|
|
|
179
121
|
else {
|
|
180
122
|
this.showLoader.next(false);
|
|
181
123
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
data = {
|
|
190
|
-
upId: this._schema
|
|
191
|
-
};
|
|
192
|
-
return [4, this._doCall(DatasessionServiceMethod.CreatePublicSession, data, false, BackendServiceName.PublicService, EndPoint.PublicService)];
|
|
193
|
-
case 1: return [2, _a.sent()];
|
|
194
|
-
}
|
|
195
|
-
});
|
|
124
|
+
}
|
|
125
|
+
_createPublicSession() {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const data = {
|
|
128
|
+
upId: this._schema
|
|
129
|
+
};
|
|
130
|
+
return yield this._doCall(datasession_service_method_enum_1.DatasessionServiceMethod.CreatePublicSession, data, false, backend_service_name_enum_1.BackendServiceName.PublicService, end_point_enum_1.EndPoint.PublicService);
|
|
196
131
|
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
export { AjaxService };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.AjaxService = AjaxService;
|