@techextensor/tab-core-utility 2.1.7 → 2.1.8
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/esm2022/index.mjs +64 -0
- package/esm2022/lib/tab-core-utility/app/constants/api-constants.mjs +33 -0
- package/esm2022/lib/tab-core-utility/app/constants/common.mjs +25 -0
- package/esm2022/lib/tab-core-utility/app/constants/error-messages.mjs +13 -0
- package/esm2022/lib/tab-core-utility/app/constants/storage-constants.mjs +16 -0
- package/esm2022/lib/tab-core-utility/app/crud/tab-delete.service.mjs +145 -0
- package/esm2022/lib/tab-core-utility/app/crud/tab-get.service.mjs +131 -0
- package/esm2022/lib/tab-core-utility/app/crud/tab-insert.service.mjs +77 -0
- package/esm2022/lib/tab-core-utility/app/crud/tab-update.service.mjs +105 -0
- package/esm2022/lib/tab-core-utility/app/crud/tab-workflow.service.mjs +43 -0
- package/esm2022/lib/tab-core-utility/app/enums/controllers.enum.mjs +26 -0
- package/esm2022/lib/tab-core-utility/app/enums/dsq.enum.mjs +48 -0
- package/esm2022/lib/tab-core-utility/app/enums/permission.enum.mjs +20 -0
- package/esm2022/lib/tab-core-utility/app/enums/query.enum.mjs +14 -0
- package/esm2022/lib/tab-core-utility/app/enums/workflow.enum.mjs +37 -0
- package/esm2022/lib/tab-core-utility/app/helpers/common/app.helpers.mjs +68 -0
- package/esm2022/lib/tab-core-utility/app/helpers/common/dsq.helpers.mjs +70 -0
- package/esm2022/lib/tab-core-utility/app/helpers/common/req-res.helpers.mjs +64 -0
- package/esm2022/lib/tab-core-utility/app/helpers/common/where-clause.helpers.mjs +208 -0
- package/esm2022/lib/tab-core-utility/app/helpers/screen/forms.helpers.mjs +38 -0
- package/esm2022/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.mjs +78 -0
- package/esm2022/lib/tab-core-utility/app/helpers/screen/grid.helpers.mjs +112 -0
- package/esm2022/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.mjs +77 -0
- package/esm2022/lib/tab-core-utility/app/helpers/screen/plugin.helpers.mjs +55 -0
- package/esm2022/lib/tab-core-utility/app/helpers/screen/screen.helpers.mjs +26 -0
- package/esm2022/lib/tab-core-utility/app/interfaces/auth.interface.mjs +2 -0
- package/esm2022/lib/tab-core-utility/app/interfaces/common-api.interface.mjs +2 -0
- package/esm2022/lib/tab-core-utility/app/interfaces/grid.interface.mjs +3 -0
- package/esm2022/lib/tab-core-utility/app/interfaces/orgInfo.interface.mjs +2 -0
- package/esm2022/lib/tab-core-utility/app/interfaces/schema.interface.mjs +2 -0
- package/esm2022/lib/tab-core-utility/app/interfaces/user.interface.mjs +2 -0
- package/esm2022/lib/tab-core-utility/app/models/api-query.class.mjs +47 -0
- package/esm2022/lib/tab-core-utility/app/models/app-object.class.mjs +30 -0
- package/esm2022/lib/tab-core-utility/app/models/common.class.mjs +12 -0
- package/esm2022/lib/tab-core-utility/app/models/data-source-queries.class.mjs +31 -0
- package/esm2022/lib/tab-core-utility/app/utils/filter.util.mjs +75 -0
- package/esm2022/lib/tab-core-utility/app/utils/form-builder.util.mjs +39 -0
- package/esm2022/lib/tab-core-utility/app/utils/json.util.mjs +138 -0
- package/esm2022/lib/tab-core-utility/app/utils/operators.util.mjs +129 -0
- package/esm2022/lib/tab-core-utility/app/utils/req-res.util.mjs +168 -0
- package/esm2022/lib/tab-core-utility/app/utils/tab-app.util.mjs +99 -0
- package/esm2022/lib/tab-core-utility/auth/auth.service.mjs +74 -0
- package/esm2022/lib/tab-core-utility/auth/idb-storage.service.mjs +69 -0
- package/esm2022/lib/tab-core-utility/auth/local-storage.service.mjs +52 -0
- package/esm2022/lib/tab-core-utility/auth/session-storage.service.mjs +52 -0
- package/esm2022/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.mjs +26 -0
- package/esm2022/lib/tab-core-utility/core/error-handler/error-handler.store.mjs +21 -0
- package/esm2022/lib/tab-core-utility/core/error-handler/models/error-handler.state.mjs +5 -0
- package/esm2022/lib/tab-core-utility/core/http-client/api-url.token.mjs +4 -0
- package/esm2022/lib/tab-core-utility/core/http-client/api.service.mjs +99 -0
- package/esm2022/lib/tab-core-utility/core/util/auth.utils.mjs +21 -0
- package/esm2022/lib/tab-core-utility/store/auth.store.mjs +43 -0
- package/esm2022/lib/tab-core-utility/store/orginfo.store.mjs +42 -0
- package/esm2022/lib/tab-core-utility/store/schema.store.mjs +68 -0
- package/esm2022/techextensor-tab-core-utility.mjs +5 -0
- package/{src/index.ts → index.d.ts} +53 -77
- package/lib/tab-core-utility/app/constants/api-constants.d.ts +30 -0
- package/lib/tab-core-utility/app/constants/common.d.ts +8 -0
- package/lib/tab-core-utility/app/constants/error-messages.d.ts +6 -0
- package/lib/tab-core-utility/app/constants/storage-constants.d.ts +15 -0
- package/lib/tab-core-utility/app/crud/tab-delete.service.d.ts +51 -0
- package/lib/tab-core-utility/app/crud/tab-get.service.d.ts +58 -0
- package/lib/tab-core-utility/app/crud/tab-insert.service.d.ts +37 -0
- package/lib/tab-core-utility/app/crud/tab-update.service.d.ts +14 -0
- package/lib/tab-core-utility/app/crud/tab-workflow.service.d.ts +20 -0
- package/lib/tab-core-utility/app/enums/controllers.enum.d.ts +24 -0
- package/lib/tab-core-utility/app/enums/dsq.enum.d.ts +42 -0
- package/lib/tab-core-utility/app/enums/permission.enum.d.ts +16 -0
- package/lib/tab-core-utility/app/enums/query.enum.d.ts +11 -0
- package/lib/tab-core-utility/app/enums/workflow.enum.d.ts +30 -0
- package/lib/tab-core-utility/app/helpers/common/app.helpers.d.ts +31 -0
- package/lib/tab-core-utility/app/helpers/common/dsq.helpers.d.ts +32 -0
- package/lib/tab-core-utility/app/helpers/common/req-res.helpers.d.ts +62 -0
- package/lib/tab-core-utility/app/helpers/common/where-clause.helpers.d.ts +82 -0
- package/lib/tab-core-utility/app/helpers/screen/forms.helpers.d.ts +11 -0
- package/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.d.ts +33 -0
- package/lib/tab-core-utility/app/helpers/screen/grid.helpers.d.ts +63 -0
- package/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.d.ts +38 -0
- package/lib/tab-core-utility/app/helpers/screen/plugin.helpers.d.ts +25 -0
- package/lib/tab-core-utility/app/helpers/screen/screen.helpers.d.ts +11 -0
- package/{src/lib/tab-core-utility/app/interfaces/auth.interface.ts → lib/tab-core-utility/app/interfaces/auth.interface.d.ts} +15 -18
- package/lib/tab-core-utility/app/interfaces/common-api.interface.d.ts +24 -0
- package/lib/tab-core-utility/app/interfaces/grid.interface.d.ts +110 -0
- package/lib/tab-core-utility/app/interfaces/orgInfo.interface.d.ts +31 -0
- package/lib/tab-core-utility/app/interfaces/schema.interface.d.ts +11 -0
- package/lib/tab-core-utility/app/interfaces/user.interface.d.ts +84 -0
- package/lib/tab-core-utility/app/models/api-query.class.d.ts +69 -0
- package/lib/tab-core-utility/app/models/app-object.class.d.ts +74 -0
- package/lib/tab-core-utility/app/models/common.class.d.ts +24 -0
- package/lib/tab-core-utility/app/models/data-source-queries.class.d.ts +95 -0
- package/lib/tab-core-utility/app/utils/filter.util.d.ts +30 -0
- package/lib/tab-core-utility/app/utils/form-builder.util.d.ts +13 -0
- package/lib/tab-core-utility/app/utils/json.util.d.ts +25 -0
- package/lib/tab-core-utility/app/utils/operators.util.d.ts +21 -0
- package/lib/tab-core-utility/app/utils/req-res.util.d.ts +61 -0
- package/lib/tab-core-utility/app/utils/tab-app.util.d.ts +48 -0
- package/lib/tab-core-utility/auth/auth.service.d.ts +53 -0
- package/lib/tab-core-utility/auth/idb-storage.service.d.ts +14 -0
- package/lib/tab-core-utility/auth/local-storage.service.d.ts +22 -0
- package/lib/tab-core-utility/auth/session-storage.service.d.ts +22 -0
- package/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.d.ts +3 -0
- package/lib/tab-core-utility/core/error-handler/error-handler.store.d.ts +10 -0
- package/lib/tab-core-utility/core/error-handler/models/error-handler.state.d.ts +5 -0
- package/lib/tab-core-utility/core/http-client/api-url.token.d.ts +3 -0
- package/lib/tab-core-utility/core/http-client/api.service.d.ts +65 -0
- package/lib/tab-core-utility/core/util/auth.utils.d.ts +9 -0
- package/lib/tab-core-utility/store/auth.store.d.ts +19 -0
- package/lib/tab-core-utility/store/orginfo.store.d.ts +22 -0
- package/lib/tab-core-utility/store/schema.store.d.ts +32 -0
- package/package.json +31 -18
- package/.eslintrc.json +0 -92
- package/README.md +0 -7
- package/jest.config.ts +0 -22
- package/ng-package.json +0 -7
- package/project.json +0 -42
- package/src/lib/tab-core-utility/app/constants/api-constants.ts +0 -33
- package/src/lib/tab-core-utility/app/constants/common.ts +0 -34
- package/src/lib/tab-core-utility/app/constants/error-messages.ts +0 -21
- package/src/lib/tab-core-utility/app/constants/storage-constants.ts +0 -17
- package/src/lib/tab-core-utility/app/crud/tab-delete.service.ts +0 -144
- package/src/lib/tab-core-utility/app/crud/tab-get.service.ts +0 -160
- package/src/lib/tab-core-utility/app/crud/tab-insert.service.ts +0 -75
- package/src/lib/tab-core-utility/app/crud/tab-update.service.ts +0 -105
- package/src/lib/tab-core-utility/app/crud/tab-workflow.service.ts +0 -39
- package/src/lib/tab-core-utility/app/enums/controllers.enum.ts +0 -24
- package/src/lib/tab-core-utility/app/enums/dsq.enum.ts +0 -46
- package/src/lib/tab-core-utility/app/enums/permission.enum.ts +0 -18
- package/src/lib/tab-core-utility/app/enums/query.enum.ts +0 -12
- package/src/lib/tab-core-utility/app/enums/workflow.enum.ts +0 -35
- package/src/lib/tab-core-utility/app/helpers/common/app.helpers.ts +0 -65
- package/src/lib/tab-core-utility/app/helpers/common/dsq.helpers.ts +0 -80
- package/src/lib/tab-core-utility/app/helpers/common/req-res.helpers.ts +0 -75
- package/src/lib/tab-core-utility/app/helpers/common/where-clause.helpers.ts +0 -262
- package/src/lib/tab-core-utility/app/helpers/screen/forms.helpers.ts +0 -33
- package/src/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.ts +0 -88
- package/src/lib/tab-core-utility/app/helpers/screen/grid.helpers.ts +0 -113
- package/src/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.ts +0 -74
- package/src/lib/tab-core-utility/app/helpers/screen/plugin.helpers.ts +0 -52
- package/src/lib/tab-core-utility/app/helpers/screen/screen.helpers.ts +0 -20
- package/src/lib/tab-core-utility/app/interfaces/common-api.interface.ts +0 -27
- package/src/lib/tab-core-utility/app/interfaces/grid.interface.ts +0 -118
- package/src/lib/tab-core-utility/app/interfaces/orgInfo.interface.ts +0 -34
- package/src/lib/tab-core-utility/app/interfaces/schema.interface.ts +0 -11
- package/src/lib/tab-core-utility/app/interfaces/user.interface.ts +0 -91
- package/src/lib/tab-core-utility/app/models/api-query.class.ts +0 -92
- package/src/lib/tab-core-utility/app/models/app-object.class.ts +0 -87
- package/src/lib/tab-core-utility/app/models/common.class.ts +0 -30
- package/src/lib/tab-core-utility/app/models/data-source-queries.class.ts +0 -114
- package/src/lib/tab-core-utility/app/utils/filter.util.ts +0 -78
- package/src/lib/tab-core-utility/app/utils/form-builder.util.ts +0 -31
- package/src/lib/tab-core-utility/app/utils/json.util.ts +0 -137
- package/src/lib/tab-core-utility/app/utils/operators.util.ts +0 -129
- package/src/lib/tab-core-utility/app/utils/req-res.util.ts +0 -189
- package/src/lib/tab-core-utility/app/utils/tab-app.util.ts +0 -131
- package/src/lib/tab-core-utility/auth/auth.service.spec.ts +0 -167
- package/src/lib/tab-core-utility/auth/auth.service.ts +0 -91
- package/src/lib/tab-core-utility/auth/idb-storage.service.ts +0 -77
- package/src/lib/tab-core-utility/auth/local-storage.service.spec.ts +0 -47
- package/src/lib/tab-core-utility/auth/local-storage.service.ts +0 -46
- package/src/lib/tab-core-utility/auth/session-storage.service.spec.ts +0 -47
- package/src/lib/tab-core-utility/auth/session-storage.service.ts +0 -46
- package/src/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.ts +0 -32
- package/src/lib/tab-core-utility/core/error-handler/error-handler.store.spec.ts +0 -16
- package/src/lib/tab-core-utility/core/error-handler/error-handler.store.ts +0 -26
- package/src/lib/tab-core-utility/core/error-handler/models/error-handler.state.ts +0 -9
- package/src/lib/tab-core-utility/core/http-client/api-url.token.ts +0 -4
- package/src/lib/tab-core-utility/core/http-client/api.service.spec.ts +0 -18
- package/src/lib/tab-core-utility/core/http-client/api.service.ts +0 -105
- package/src/lib/tab-core-utility/core/util/auth.utils.ts +0 -22
- package/src/lib/tab-core-utility/store/auth.store.ts +0 -54
- package/src/lib/tab-core-utility/store/orginfo.store.ts +0 -57
- package/src/lib/tab-core-utility/store/schema.store.ts +0 -85
- package/src/test-setup.ts +0 -8
- package/tsconfig.json +0 -29
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -7
- package/tsconfig.spec.json +0 -16
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
/* eslint-disable no-prototype-builtins */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Validates if a string is a valid JSON.
|
|
7
|
-
* @param str The string to validate.
|
|
8
|
-
* @returns True if the string is a valid JSON, false otherwise.
|
|
9
|
-
*/
|
|
10
|
-
export function validateJSON(str: string): boolean {
|
|
11
|
-
try {
|
|
12
|
-
const json = JSON.parse(str);
|
|
13
|
-
return Object.prototype.toString.call(json).slice(8, -1) === 'Object';
|
|
14
|
-
} catch (e) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Creates dynamic data based on the input object
|
|
21
|
-
* @param obj The input object to create dynamic data from
|
|
22
|
-
* @returns The formatted array
|
|
23
|
-
*/
|
|
24
|
-
export function createDynamicData(obj: any) {
|
|
25
|
-
return formatArray(obj);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Formats the input object into a new array with AppFieldID and Value pairs
|
|
30
|
-
* @param input The input object to be formatted
|
|
31
|
-
* @returns The formatted array with AppFieldID and Value pairs
|
|
32
|
-
*/
|
|
33
|
-
function formatArray(input: any) {
|
|
34
|
-
if (input !== null) {
|
|
35
|
-
const newObj = Object.keys(input).map((key) => {
|
|
36
|
-
let Value: any = '';
|
|
37
|
-
if (Array.isArray(input[key])) {
|
|
38
|
-
if (key === 'Child_Relationship') {
|
|
39
|
-
Value = handleChildRelationship(input[key]);
|
|
40
|
-
} else {
|
|
41
|
-
Value = handleObject(input[key]);
|
|
42
|
-
}
|
|
43
|
-
} else if (typeof input[key] === 'object') {
|
|
44
|
-
Value = handleObject(input[key]);
|
|
45
|
-
} else {
|
|
46
|
-
Value = input[key];
|
|
47
|
-
}
|
|
48
|
-
return { AppFieldID: key, Value };
|
|
49
|
-
});
|
|
50
|
-
return newObj;
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Handles the Child_Relationship key in the input object
|
|
57
|
-
* @param child The value of the Child_Relationship key
|
|
58
|
-
* @returns The JSON stringified value if not null, empty, or 'null'; otherwise null
|
|
59
|
-
*/
|
|
60
|
-
function handleChildRelationship(child: any) {
|
|
61
|
-
if (child !== null && child !== '' && child !== 'null') {
|
|
62
|
-
return JSON.stringify(child);
|
|
63
|
-
} else {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Handles object keys in the input object based on specific cases
|
|
70
|
-
* @param obj The object to be handled
|
|
71
|
-
* @returns The JSON stringified value based on specific cases or recursively formats the object
|
|
72
|
-
*/
|
|
73
|
-
function handleObject(obj: any) {
|
|
74
|
-
if (obj === null) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
switch (Object.keys(obj)[0]) {
|
|
78
|
-
case 'Container':
|
|
79
|
-
case 'Setting_Value':
|
|
80
|
-
case 'Child_Relationship':
|
|
81
|
-
case 'ScreenConfiguration':
|
|
82
|
-
case 'AppObjectConfiguration':
|
|
83
|
-
case 'SchemaConfig':
|
|
84
|
-
case 'Criteria':
|
|
85
|
-
case 'ApplyCriteria':
|
|
86
|
-
case 'SLASetting':
|
|
87
|
-
return JSON.stringify(obj);
|
|
88
|
-
default:
|
|
89
|
-
return formatArray(obj);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Removes blank values from the input object
|
|
95
|
-
* @param dataObj The input object to remove blank values from
|
|
96
|
-
*/
|
|
97
|
-
export function removeBlankValue(dataObj: any) {
|
|
98
|
-
Object.keys(dataObj).forEach((key) => {
|
|
99
|
-
if (Array.isArray(dataObj[key])) {
|
|
100
|
-
dataObj[key].forEach((item: { Value: any }, i: any) => {
|
|
101
|
-
if (isValueBlank(item.Value)) {
|
|
102
|
-
dataObj[key].splice(i, 1);
|
|
103
|
-
} else {
|
|
104
|
-
removeBlankValue(item);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
if (dataObj[key].length === 0) {
|
|
108
|
-
delete dataObj[key];
|
|
109
|
-
}
|
|
110
|
-
} else if (dataObj[key] && typeof dataObj[key] === 'object') {
|
|
111
|
-
removeBlankValue(dataObj[key]);
|
|
112
|
-
if (Object.keys(dataObj[key]).length === 0) {
|
|
113
|
-
delete dataObj[key];
|
|
114
|
-
}
|
|
115
|
-
} else if (key === 'Value' && isValueBlank(dataObj[key])) {
|
|
116
|
-
delete dataObj[key];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Removes blank array keys from the input object
|
|
123
|
-
* @param dataObj The input object to remove blank array keys from
|
|
124
|
-
*/
|
|
125
|
-
export function removeBlankArrayKeys(dataObj: any) {
|
|
126
|
-
dataObj.forEach((element: any, i: any) => {
|
|
127
|
-
if (element && element.hasOwnProperty('Value')) {
|
|
128
|
-
if (typeof element.Value === 'object' && element.Value.length == 0) {
|
|
129
|
-
dataObj.splice(i, 1);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function isValueBlank(value: any): boolean {
|
|
136
|
-
return value === null || value === '';
|
|
137
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/**
|
|
3
|
-
* Converts a relational operator value to a number.
|
|
4
|
-
* @param dataType The relational operator value as a string.
|
|
5
|
-
* @returns The relational operator value as a number.
|
|
6
|
-
*/
|
|
7
|
-
export function getRelationalOperatorValueToNumber(dataType: string): number {
|
|
8
|
-
const operatorsMap: Record<string, number> = {
|
|
9
|
-
greaterthan: 1,
|
|
10
|
-
lessthan: 2,
|
|
11
|
-
equal: 3,
|
|
12
|
-
in: 4,
|
|
13
|
-
notin: 5,
|
|
14
|
-
isnull: 6,
|
|
15
|
-
isnotnull: 7,
|
|
16
|
-
notequal: 8,
|
|
17
|
-
greaterthanorequal: 9,
|
|
18
|
-
lessthanorequal: 10,
|
|
19
|
-
contains: 11,
|
|
20
|
-
notcontains: 12,
|
|
21
|
-
startswith: 13,
|
|
22
|
-
notstartswith: 14,
|
|
23
|
-
endswith: 15,
|
|
24
|
-
notendswith: 16,
|
|
25
|
-
between: 17,
|
|
26
|
-
notbetween: 18,
|
|
27
|
-
splitcontains: 19,
|
|
28
|
-
notsplitcontains: 20,
|
|
29
|
-
};
|
|
30
|
-
return operatorsMap[dataType] || 0;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Converts a relational operator value to a string.
|
|
35
|
-
* @param dataType The relational operator value as a number.
|
|
36
|
-
* @returns The relational operator value as a string.
|
|
37
|
-
*/
|
|
38
|
-
export function getRelationalOperatorValueToString(dataType: number): string {
|
|
39
|
-
const operatorsMap: Record<number, string> = {
|
|
40
|
-
1: 'greaterthan',
|
|
41
|
-
2: 'lessthan',
|
|
42
|
-
3: 'equal',
|
|
43
|
-
4: 'in',
|
|
44
|
-
5: 'notin',
|
|
45
|
-
6: 'isnull',
|
|
46
|
-
7: 'isnotnull',
|
|
47
|
-
8: 'notequal',
|
|
48
|
-
9: 'greaterthanorequal',
|
|
49
|
-
10: 'lessthanorequal',
|
|
50
|
-
11: 'contains',
|
|
51
|
-
12: 'notcontains',
|
|
52
|
-
13: 'startswith',
|
|
53
|
-
14: 'notstartswith',
|
|
54
|
-
15: 'endswith',
|
|
55
|
-
16: 'notendswith',
|
|
56
|
-
17: 'between',
|
|
57
|
-
18: 'notbetween',
|
|
58
|
-
19: 'splitcontains',
|
|
59
|
-
20: 'notsplitcontains',
|
|
60
|
-
};
|
|
61
|
-
return operatorsMap[dataType] || '';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Returns a list of operators for the query builder based on the data type.
|
|
66
|
-
* @param dataType The data type.
|
|
67
|
-
* @returns A list of operators.
|
|
68
|
-
*/
|
|
69
|
-
export function getOperatorListForQueryBuilder(
|
|
70
|
-
dataType: any
|
|
71
|
-
): { value: string; key: string }[] {
|
|
72
|
-
let operators: { value: string; key: string }[] = [];
|
|
73
|
-
if (dataType === 'string') {
|
|
74
|
-
operators = [
|
|
75
|
-
{ value: 'equal', key: 'Equal To' },
|
|
76
|
-
{ value: 'in', key: 'IN' },
|
|
77
|
-
{ value: 'notin', key: 'NOT IN' },
|
|
78
|
-
{ value: 'isnull', key: 'Is NULL' },
|
|
79
|
-
{ value: 'isnotnull', key: 'Is Not NULL' },
|
|
80
|
-
{ value: 'notequal', key: 'Not Equal To' },
|
|
81
|
-
{ value: 'contains', key: 'Contains' },
|
|
82
|
-
{ value: 'notcontains', key: 'Not Contains' },
|
|
83
|
-
{ value: 'startswith', key: 'Starts With' },
|
|
84
|
-
{ value: 'notstartswith', key: 'Not Starts With' },
|
|
85
|
-
{ value: 'endswith', key: 'Ends With' },
|
|
86
|
-
{ value: 'notendswith', key: 'Not Ends With' },
|
|
87
|
-
{ value: 'splitcontains', key: 'SplitContains' },
|
|
88
|
-
{ value: 'notsplitcontains', key: 'Not SplitContains' },
|
|
89
|
-
];
|
|
90
|
-
} else if (dataType === 'number') {
|
|
91
|
-
operators = [
|
|
92
|
-
{ value: 'greaterthan', key: 'Greater Than' },
|
|
93
|
-
{ value: 'lessthan', key: 'Less Than' },
|
|
94
|
-
{ value: 'equal', key: 'Equal To' },
|
|
95
|
-
{ value: 'isnull', key: 'Is NULL' },
|
|
96
|
-
{ value: 'isnotnull', key: 'Is Not NULL' },
|
|
97
|
-
{ value: 'notequal', key: 'Not Equal To' },
|
|
98
|
-
{ value: 'greaterthanorequal', key: 'Greater Than OR Equal To' },
|
|
99
|
-
{ value: 'lessthanorequal', key: 'Less Than OR Equal To' },
|
|
100
|
-
];
|
|
101
|
-
} else if (dataType === 'Date' || dataType === 'date') {
|
|
102
|
-
operators = [
|
|
103
|
-
{ value: 'greaterthan', key: 'Greater Than' },
|
|
104
|
-
{ value: 'lessthan', key: 'Less Than' },
|
|
105
|
-
{ value: 'equal', key: 'Equal To' },
|
|
106
|
-
{ value: 'isnull', key: 'Is NULL' },
|
|
107
|
-
{ value: 'isnotnull', key: 'Is Not NULL' },
|
|
108
|
-
{ value: 'notequal', key: 'Not Equal To' },
|
|
109
|
-
{ value: 'greaterthanorequal', key: 'Greater Than OR Equal To' },
|
|
110
|
-
{ value: 'lessthanorequal', key: 'Less Than OR Equal To' },
|
|
111
|
-
{ value: 'contains', key: 'Contains' },
|
|
112
|
-
{ value: 'notcontains', key: 'Not Contains' },
|
|
113
|
-
{ value: 'startswith', key: 'Starts With' },
|
|
114
|
-
{ value: 'notstartswith', key: 'Not Starts With' },
|
|
115
|
-
{ value: 'endswith', key: 'Ends With' },
|
|
116
|
-
{ value: 'notendswith', key: 'Not Ends With' },
|
|
117
|
-
];
|
|
118
|
-
} else if (dataType === 'boolean') {
|
|
119
|
-
operators = [
|
|
120
|
-
{ value: 'equal', key: 'Equal To' },
|
|
121
|
-
{ value: 'isnull', key: 'Is NULL' },
|
|
122
|
-
{ value: 'isnotnull', key: 'Is Not NULL' },
|
|
123
|
-
{ value: 'notequal', key: 'Not Equal To' },
|
|
124
|
-
{ value: 'contains', key: 'Contains' },
|
|
125
|
-
{ value: 'notcontains', key: 'Not Contains' },
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
return operators;
|
|
129
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-prototype-builtins */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
import { HttpHeaders } from '@angular/common/http';
|
|
4
|
-
import { Common } from '../constants/common';
|
|
5
|
-
import { AppObject } from '../models/app-object.class';
|
|
6
|
-
import {
|
|
7
|
-
getAppObject,
|
|
8
|
-
getDsqIdfromSelectedAppObjectDSQArray,
|
|
9
|
-
} from './tab-app.util';
|
|
10
|
-
import { AppFields } from '../models/data-source-queries.class';
|
|
11
|
-
import { API } from '../constants/api-constants';
|
|
12
|
-
import { getFormBuilderType } from './form-builder.util';
|
|
13
|
-
import { StorageConstants } from '../constants/storage-constants';
|
|
14
|
-
// import { inject } from '@angular/core';
|
|
15
|
-
import { SessionStorageService } from '../../auth/session-storage.service';
|
|
16
|
-
import { API_URL } from '../../core/http-client/api-url.token';
|
|
17
|
-
|
|
18
|
-
// const sessionStorageService = inject(SessionStorageService);
|
|
19
|
-
const sessionStorageService = new SessionStorageService();
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Delete a key from the response object
|
|
23
|
-
*
|
|
24
|
-
* @param response - The response object
|
|
25
|
-
* @param key - The key to be deleted
|
|
26
|
-
* @returns any - The updated response object
|
|
27
|
-
*/
|
|
28
|
-
export function deleteKeyFromResponse(response: any, key: string) {
|
|
29
|
-
delete response[key];
|
|
30
|
-
return response;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Remove the primary key from the response object
|
|
35
|
-
*
|
|
36
|
-
* @param response - The response object
|
|
37
|
-
* @param field - The field to be removed as primary key
|
|
38
|
-
* @returns any - The updated response object
|
|
39
|
-
*/
|
|
40
|
-
export function removePrimaryKey(response: any, field: string) {
|
|
41
|
-
if (field) {
|
|
42
|
-
deleteKeyFromResponse(response, field);
|
|
43
|
-
}
|
|
44
|
-
return response;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Remove multiple primary keys from the response object
|
|
49
|
-
*
|
|
50
|
-
* @param response - The response object
|
|
51
|
-
* @param fields - The array of fields to be removed as primary keys
|
|
52
|
-
* @returns any - The updated response object
|
|
53
|
-
*/
|
|
54
|
-
export function removeMultiplePrimaryKey(response: any, fields: any) {
|
|
55
|
-
fields.forEach((element: any) => {
|
|
56
|
-
delete response[element.FieldName];
|
|
57
|
-
});
|
|
58
|
-
return response;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Get the HttpHeaders for API requests
|
|
63
|
-
*
|
|
64
|
-
* @returns HttpHeaders | null - The HttpHeaders object or null
|
|
65
|
-
*/
|
|
66
|
-
export function getHeaders() {
|
|
67
|
-
const token = sessionStorageService.getSessionStorage(StorageConstants.token);
|
|
68
|
-
const staticToken = sessionStorageService.getSessionStorage(StorageConstants.staticToken);
|
|
69
|
-
|
|
70
|
-
if (!token && staticToken) {
|
|
71
|
-
// Token is empty but staticToken is not
|
|
72
|
-
return new HttpHeaders({
|
|
73
|
-
'Content-Type': 'application/json',
|
|
74
|
-
Authorization: staticToken,
|
|
75
|
-
ApplicationCode: Common.applicationCode,
|
|
76
|
-
});
|
|
77
|
-
} else if (token) {
|
|
78
|
-
// Token is not empty
|
|
79
|
-
return new HttpHeaders({
|
|
80
|
-
'Content-Type': 'application/json',
|
|
81
|
-
Authorization: token,
|
|
82
|
-
ApplicationCode: Common.applicationCode,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
// Handle the case when both tokens are empty
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Get the primary key fields from the AppObject
|
|
91
|
-
*
|
|
92
|
-
* @param appObject - The AppObject
|
|
93
|
-
* @returns AppFields[] | null - The array of primary key fields or null
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
export function getPrimaryKeyFields(appObject: AppObject) {
|
|
97
|
-
if (appObject.Fields.length) {
|
|
98
|
-
return appObject.Fields.filter((field) => field.IsPrimaryKey);
|
|
99
|
-
}
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Get the edit record ID from the response object
|
|
105
|
-
*
|
|
106
|
-
* @param response - The response object
|
|
107
|
-
* @param fieldName - The field name for the edit record ID
|
|
108
|
-
* @returns any - The edit record ID
|
|
109
|
-
*/
|
|
110
|
-
export function getEditRecordId(response: any, fieldName: any) {
|
|
111
|
-
let recordId = null;
|
|
112
|
-
if (fieldName) {
|
|
113
|
-
recordId = response[fieldName] || null;
|
|
114
|
-
} else {
|
|
115
|
-
recordId = response.Id || response.ID || null;
|
|
116
|
-
}
|
|
117
|
-
return recordId;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Generate the fields schema based on the AppFields
|
|
122
|
-
*
|
|
123
|
-
* @param fields - The AppFields object
|
|
124
|
-
* @returns any - The generated fields schema
|
|
125
|
-
*/
|
|
126
|
-
export function generateFieldsSchema(fields: AppFields) {
|
|
127
|
-
let schema = {};
|
|
128
|
-
if (fields.hasOwnProperty('LookUpDetails')) {
|
|
129
|
-
const selectedAppObject: AppObject = getAppObject(
|
|
130
|
-
fields.LookUpDetails.LookupObject
|
|
131
|
-
);
|
|
132
|
-
const dsqID = getDsqIdfromSelectedAppObjectDSQArray(
|
|
133
|
-
selectedAppObject?.DataSourceQueries,
|
|
134
|
-
fields.LookUpDetails.LookupObject,
|
|
135
|
-
'List'
|
|
136
|
-
);
|
|
137
|
-
schema = {
|
|
138
|
-
label: fields.DisplayName,
|
|
139
|
-
type: 'select',
|
|
140
|
-
key: fields.SystemDBFieldName,
|
|
141
|
-
input: true,
|
|
142
|
-
dataSrc: 'url',
|
|
143
|
-
valueProperty: fields.LookUpDetails.LookupField,
|
|
144
|
-
template: `<span>{{ item.${fields.LookUpDetails.DisplayField} }}</span>`,
|
|
145
|
-
selectValues: 'Result',
|
|
146
|
-
data: {
|
|
147
|
-
url: `${API_URL}${API.getListFromDsq}${dsqID}`,// API.getListFromDsq + dsqID,
|
|
148
|
-
headers: [
|
|
149
|
-
{
|
|
150
|
-
"key": "Applicationcode",
|
|
151
|
-
"value": sessionStorageService.getSessionStorage(StorageConstants.applicationCode)
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"key": "Authorization",
|
|
155
|
-
"value": sessionStorageService.getSessionStorage(StorageConstants.token)
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
} else {
|
|
162
|
-
schema = {
|
|
163
|
-
label: fields.DisplayName,
|
|
164
|
-
type: getFormBuilderType(fields.FieldType.DataType),
|
|
165
|
-
key: fields.SystemDBFieldName,
|
|
166
|
-
input: true,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return schema;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Get the HttpHeaders for form data requests
|
|
174
|
-
*
|
|
175
|
-
* @returns HttpHeaders | null - The HttpHeaders object or null
|
|
176
|
-
*/
|
|
177
|
-
export function getFormDataHeaders() {
|
|
178
|
-
const isToken = sessionStorageService.getSessionStorage(
|
|
179
|
-
StorageConstants.token
|
|
180
|
-
);
|
|
181
|
-
if (isToken) {
|
|
182
|
-
return new HttpHeaders({
|
|
183
|
-
Accept: '*/*',
|
|
184
|
-
Authorization: isToken,
|
|
185
|
-
ApplicationCode: Common.applicationCode,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
|
-
import { Common } from '../constants/common';
|
|
4
|
-
import { AppObject } from '../models/app-object.class';
|
|
5
|
-
import { deleteKeyFromResponse } from './req-res.util';
|
|
6
|
-
|
|
7
|
-
/** Get the DataSourceQuery ID from the selected AppObject's DataSourceQuery array
|
|
8
|
-
* @param dsqList - The list of DataSourceQueries
|
|
9
|
-
* @param table - The table name
|
|
10
|
-
* @param like - The like string
|
|
11
|
-
* @returns string - The ID of the DataSourceQuery
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export function getDsqIdfromSelectedAppObjectDSQArray(
|
|
15
|
-
dsqList: any,
|
|
16
|
-
table: string,
|
|
17
|
-
like: string
|
|
18
|
-
) {
|
|
19
|
-
if (dsqList) {
|
|
20
|
-
const matchName = like + '_' + table;
|
|
21
|
-
const result = dsqList.find((d: any) => d.QueryName === matchName);
|
|
22
|
-
return result?.ID;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Get the AppObject based on the provided ID
|
|
27
|
-
* @param id - The ID of the AppObject
|
|
28
|
-
* @returns AppObject | null - The found AppObject or null
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export function getAppObject(id: string) {
|
|
32
|
-
const tabData: any | null = Common.tabJson;
|
|
33
|
-
return (
|
|
34
|
-
tabData?.AppObjects.find((t: any) => t.ID === id?.toLowerCase()) || null
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get the AppObject from the DataSourceQuery ID
|
|
40
|
-
* @param dsqId - The DataSourceQuery ID
|
|
41
|
-
* @returns AppObject | null - The found AppObject or null
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
export function getAppObjectFromDataSourceQueryID(dsqId: string) {
|
|
45
|
-
const tabData: any = Common.tabJson;
|
|
46
|
-
if (!dsqId || !tabData) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
for (const appObject of tabData.AppObjects) {
|
|
51
|
-
const dsq = appObject.DataSourceQueries.find(
|
|
52
|
-
(l: any) => l.ID === dsqId?.toLowerCase()
|
|
53
|
-
);
|
|
54
|
-
if (dsq) {
|
|
55
|
-
return appObject;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Get the DataSourceQuery ID from the QueryName and table
|
|
64
|
-
* @param table - The table name
|
|
65
|
-
* @param dsq - The DataSourceQuery name
|
|
66
|
-
* @returns any - The found DataSourceQuery
|
|
67
|
-
*/
|
|
68
|
-
export function getDsqIDFromQueryName(table: string, dsq: string) {
|
|
69
|
-
const appObjectList = getAppObjectFromSystemDBTableName(table);
|
|
70
|
-
return appObjectList?.DataSourceQueries.find((d: any) => d.QueryName === dsq);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get the Data from the DataSourceQuery ID
|
|
75
|
-
*
|
|
76
|
-
* @param dsqId - The DataSourceQuery ID
|
|
77
|
-
* @returns any - The found Data
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
export function getDataFromDataSourceQueryID(dsqId: string) {
|
|
81
|
-
const tabData: any = Common.tabJson;
|
|
82
|
-
if (!tabData) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
for (const appObject of tabData.AppObjects) {
|
|
87
|
-
const DSQ = appObject.DataSourceQueries.find(
|
|
88
|
-
(l: any) => l.ID === dsqId?.toLowerCase()
|
|
89
|
-
);
|
|
90
|
-
if (DSQ) {
|
|
91
|
-
return DSQ;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Synchronize AppObject fields with the response
|
|
100
|
-
*
|
|
101
|
-
* @param response - The response object
|
|
102
|
-
* @param appObject - The AppObject
|
|
103
|
-
* @returns any - The synchronized response object
|
|
104
|
-
*/
|
|
105
|
-
export function syncAppObjectFields(response: any, appObject: AppObject) {
|
|
106
|
-
for (const key in response) {
|
|
107
|
-
const foundObj = appObject.Fields.find((f: any) => f.FieldName === key);
|
|
108
|
-
const chilData = appObject.ChildRelationShips?.map(
|
|
109
|
-
(x) => x.childDetails.LookupObject
|
|
110
|
-
);
|
|
111
|
-
if (!foundObj && !(chilData && chilData.some((x) => x.includes(key)))) {
|
|
112
|
-
deleteKeyFromResponse(response, key);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return response;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Get the AppObject based on the SystemDBTableName
|
|
120
|
-
*
|
|
121
|
-
* @param tableName - The SystemDBTableName
|
|
122
|
-
* @returns AppObject | null - The found AppObject or null
|
|
123
|
-
*/
|
|
124
|
-
export function getAppObjectFromSystemDBTableName(tableName: string) {
|
|
125
|
-
const tabData: any = Common.tabJson;
|
|
126
|
-
return (
|
|
127
|
-
tabData?.AppObjects.find(
|
|
128
|
-
(t: { SystemDBTableName: string }) => t.SystemDBTableName === tableName
|
|
129
|
-
) || null
|
|
130
|
-
);
|
|
131
|
-
}
|