@izara_project/izara-core-library-service-schemas 1.0.74 → 1.0.76
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/package.json +5 -5
- package/src/Consts.js +8 -5
- package/src/GetObjectSchema.js +21 -10
- package/src/UploadObjSchema.js +5 -4
- package/src/Utils.js +19 -15
- package/src/libs/UploadUseCase.js +174 -194
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.76",
|
|
4
4
|
"description": "Schemas for the service and objects it controls",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
"license": "AGPL-3.0-or-later",
|
|
15
15
|
"homepage": "https://bitbucket.org/izara-core-libraries/izara-core-library-service-schemas/src/master/README.md",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"jest": "^30.0.
|
|
17
|
+
"jest": "^30.0.4"
|
|
18
18
|
},
|
|
19
19
|
"jest": {
|
|
20
20
|
"testEnvironment": "node"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@aws-sdk/client-api-gateway": "^3.840.0",
|
|
23
24
|
"@aws-sdk/client-lambda": "^3.840.0",
|
|
24
|
-
"@aws-sdk/client-s3": "^3.
|
|
25
|
+
"@aws-sdk/client-s3": "^3.842.0",
|
|
25
26
|
"@aws-sdk/crc64-nvme-crt": "^3.840.0",
|
|
26
|
-
"@aws-sdk/client-api-gateway": "^3.840.0",
|
|
27
27
|
"@izara_project/izara-core-library-core": "^1.0.19",
|
|
28
28
|
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
29
29
|
"@izara_project/izara-core-library-lambda": "^1.0.4",
|
|
30
30
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
31
31
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
32
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
32
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.22",
|
|
33
33
|
"glob": "^11.0.3",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
35
|
"object-hash": "^3.0.0",
|
package/src/Consts.js
CHANGED
|
@@ -297,13 +297,16 @@ function createValidationFieldNameForEachType(type, validation) {
|
|
|
297
297
|
}[type]
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
function flowSchemaPathS3(_izContext, flowType) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
300
|
+
// function flowSchemaPathS3(_izContext, flowType) {
|
|
301
|
+
// validateFlowType(flowType);
|
|
302
|
+
// return `${PREFIX_PATH_S3.perServiceSchemas}/${flowType.serviceTag}/FlowSchema/${flowType.flowTag}.json`
|
|
303
|
+
// }
|
|
304
304
|
|
|
305
305
|
function getEndpointPerObjectType(_izContext, objType) {
|
|
306
|
-
validateObjType(objType);
|
|
306
|
+
let validateObjTypeResult = validateObjType(objType);
|
|
307
|
+
if (validateObjTypeResult.errorsFound.length > 0) {
|
|
308
|
+
throw new NoRetryError(`function flowSchemaPathS3: invalid flowType ${flowType.name} - ${validateFlowTypeResult.errorsFound.join(", ")}`);
|
|
309
|
+
}
|
|
307
310
|
return `${PREFIX_PATH_S3.perServiceSchemas}/${objType.serviceTag}/FrontEnd/Endpoint/Endpoint_Get_${objType.objectType}.json`
|
|
308
311
|
}
|
|
309
312
|
|
package/src/GetObjectSchema.js
CHANGED
|
@@ -36,7 +36,9 @@ const {
|
|
|
36
36
|
getObjectRelationship: getObjectRelationshipShared,
|
|
37
37
|
getRequiredOnCreateLinks: getRequiredOnCreateLinksShared,
|
|
38
38
|
getLinkConfigByLinkTypeId: getLinkConfigByLinkTypeIdShared,
|
|
39
|
-
getObjTypeHierarchy: getObjTypeHierarchyShared
|
|
39
|
+
getObjTypeHierarchy: getObjTypeHierarchyShared,
|
|
40
|
+
getObjectSchemaForCreate: getObjectSchemaForCreateShared,
|
|
41
|
+
getObjectSchemaForUpdate: getObjectSchemaForUpdateShared,
|
|
40
42
|
} = sharedServiceSchema.getObjectSchema;
|
|
41
43
|
const { validateObjType, validateFlowType } = sharedServiceSchema.validateObjType;
|
|
42
44
|
const {
|
|
@@ -542,10 +544,7 @@ async function getObjSchemaS3WithoutHierarchy(_izContext, objType) {
|
|
|
542
544
|
async function getObjectSchemaCombineFieldNames(_izContext, objType) {
|
|
543
545
|
|
|
544
546
|
const objSchema = await getObjSchemaS3WithHierarchy(_izContext, objType);
|
|
545
|
-
|
|
546
|
-
throw new NoRetryError(`getObjectSchemaCombineFieldNames: ${objSchema.errorsFound.join(', ')}`);
|
|
547
|
-
}
|
|
548
|
-
const combinedSchema = generateObjectSchemaForCombineFieldNames(_izContext, objSchema.result);
|
|
547
|
+
const combinedSchema = generateObjectSchemaForCombineFieldNames(_izContext, objSchema);
|
|
549
548
|
return combinedSchema
|
|
550
549
|
}
|
|
551
550
|
|
|
@@ -875,15 +874,16 @@ const getRequiredOnCreateLinksWithCache = inMemoryCacheLib(
|
|
|
875
874
|
* @param {String} relationshipTag
|
|
876
875
|
* @returns {Promise<{from:Object, to:Object}>}
|
|
877
876
|
*/
|
|
878
|
-
async function getLinkConfig(_izContext, firstObjType, secondObjType, relType, direction) {
|
|
877
|
+
async function getLinkConfig(_izContext, firstObjType, secondObjType, relType, direction, settings = {}) {
|
|
879
878
|
_izContext.logger.debug("getLinkConfig: ", {
|
|
880
879
|
firstObjType,
|
|
881
880
|
secondObjType,
|
|
882
881
|
relType,
|
|
883
|
-
direction
|
|
882
|
+
direction,
|
|
883
|
+
settings
|
|
884
884
|
});
|
|
885
885
|
|
|
886
|
-
return await getLinkConfigByLinkTypeId(_izContext, firstObjType, secondObjType, relType, direction);
|
|
886
|
+
return await getLinkConfigByLinkTypeId(_izContext, firstObjType, secondObjType, relType, direction, settings);
|
|
887
887
|
}
|
|
888
888
|
|
|
889
889
|
/**
|
|
@@ -920,7 +920,7 @@ async function getLinkConfigByLinkTypeId(_izContext, firstObjType, secondObjType
|
|
|
920
920
|
settings
|
|
921
921
|
});
|
|
922
922
|
|
|
923
|
-
await getLinkConfigByLinkTypeIdShared(getSchemaByNameWithCache, firstObjType, secondObjType, relType, direction, settings).then(res => {
|
|
923
|
+
return await getLinkConfigByLinkTypeIdShared(getSchemaByNameWithCache, firstObjType, secondObjType, relType, direction, settings).then(res => {
|
|
924
924
|
if (res.errorsFound.length && res.errorsFound.length > 0) {
|
|
925
925
|
throw new NoRetryError(res.errorsFound.join(","))
|
|
926
926
|
} else {
|
|
@@ -1124,6 +1124,14 @@ const getObjTypeHierarchyWithCache = inMemoryCacheLib(
|
|
|
1124
1124
|
}
|
|
1125
1125
|
)
|
|
1126
1126
|
|
|
1127
|
+
async function getObjectSchemaForCreate(_izContext, objType) {
|
|
1128
|
+
return await getObjectSchemaForCreateShared(getSchemaByNameWithCache, objType)
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
async function getObjectSchemaForUpdate(_izContext, objType) {
|
|
1132
|
+
return await getObjectSchemaForUpdateShared(getSchemaByNameWithCache, objType)
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1127
1135
|
module.exports = {
|
|
1128
1136
|
// getObjectTypes,
|
|
1129
1137
|
getDataFromPath,
|
|
@@ -1178,7 +1186,10 @@ module.exports = {
|
|
|
1178
1186
|
getFlowSchemaS3WithCache,
|
|
1179
1187
|
|
|
1180
1188
|
getObjTypeHierarchy,
|
|
1181
|
-
getObjTypeHierarchyWithCache
|
|
1189
|
+
getObjTypeHierarchyWithCache,
|
|
1190
|
+
|
|
1191
|
+
getObjectSchemaForCreate,
|
|
1192
|
+
getObjectSchemaForUpdate,
|
|
1182
1193
|
}
|
|
1183
1194
|
|
|
1184
1195
|
|
package/src/UploadObjSchema.js
CHANGED
|
@@ -54,7 +54,7 @@ const {
|
|
|
54
54
|
|
|
55
55
|
const {
|
|
56
56
|
DEFAULT_REL_ID_SETTING,
|
|
57
|
-
|
|
57
|
+
// ORIGIN_TIMESTAMP_FIELDNAME,
|
|
58
58
|
generateObjectSchemaForCreate,
|
|
59
59
|
generateObjectSchemaForUpdate,
|
|
60
60
|
generateObjectSchemaForCombineFieldNames,
|
|
@@ -208,6 +208,7 @@ async function uploadObjectSchemaByUseCase(_izContext) {
|
|
|
208
208
|
_izContext.logger.debug("DEFAULT_REL_ID_SETTING: ", DEFAULT_REL_ID_SETTING);
|
|
209
209
|
|
|
210
210
|
Object.assign(relSchemaData.fieldNames, DEFAULT_REL_ID_SETTING);
|
|
211
|
+
// Object.assign(relSchemaData.fieldNames, DEFAULT_REL_ID_SETTING, ORIGIN_TIMESTAMP_FIELDNAME);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
|
|
@@ -484,7 +485,7 @@ async function uploadObjectSchemaByUseCase(_izContext) {
|
|
|
484
485
|
|
|
485
486
|
// upload relationshipTag
|
|
486
487
|
for (const relTagDetail of allObjectRelationships) {
|
|
487
|
-
|
|
488
|
+
// console.log("relTagDetail", JSON.stringify(relTagDetail, null, 2))
|
|
488
489
|
const relationshipTag = Object.keys(relTagDetail)[0];
|
|
489
490
|
|
|
490
491
|
|
|
@@ -545,9 +546,9 @@ async function uploadObjectSchemaByUseCase(_izContext) {
|
|
|
545
546
|
)
|
|
546
547
|
}
|
|
547
548
|
|
|
548
|
-
const
|
|
549
|
+
const linksPerObjectType = groupLinksPerObjectType(_izContext, allObjectRelationships, foundedObjectTypes)
|
|
549
550
|
|
|
550
|
-
for (const [relObjectType, relTagsData] of Object.entries(
|
|
551
|
+
for (const [relObjectType, relTagsData] of Object.entries(linksPerObjectType)) {
|
|
551
552
|
uploadList.push(
|
|
552
553
|
uploadObjectToS3(
|
|
553
554
|
_izContext,
|
package/src/Utils.js
CHANGED
|
@@ -35,6 +35,9 @@ const {
|
|
|
35
35
|
validateObjType,
|
|
36
36
|
validateRelType,
|
|
37
37
|
validateFlowType
|
|
38
|
+
},
|
|
39
|
+
reformatObjectSchema: {
|
|
40
|
+
getUsedFieldNamesOfIdentifiers: getUsedFieldNamesOfIdentifiersShared
|
|
38
41
|
}
|
|
39
42
|
} = require('@izara_project/izara-shared-service-schemas');
|
|
40
43
|
|
|
@@ -106,21 +109,22 @@ function getIdentifierTypeByPriority(_izContext, storageTypes = [], objSchema) {
|
|
|
106
109
|
* @returns {string[]} - array of fieldName from objectSchema.identifiers
|
|
107
110
|
*/
|
|
108
111
|
function getUsedFieldNamesOfIdentifiers(_izContext, identifiers, identifierTypes = []) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
return getUsedFieldNamesOfIdentifiersShared(identifiers, identifierTypes)
|
|
113
|
+
// let identifierFieldNames = [];
|
|
114
|
+
|
|
115
|
+
// for (let identifier of identifiers) {
|
|
116
|
+
// if (Array.isArray(identifierTypes) && identifierTypes.length && !identifierTypes.includes(identifier.type)) {
|
|
117
|
+
// continue;
|
|
118
|
+
// }
|
|
119
|
+
|
|
120
|
+
// if (identifier.fieldName) {
|
|
121
|
+
// identifierFieldNames.push(identifier.fieldName);
|
|
122
|
+
// } else if (identifier.fieldNames) {
|
|
123
|
+
// identifierFieldNames = identifierFieldNames.concat(identifier.fieldNames);
|
|
124
|
+
// }
|
|
125
|
+
// }
|
|
126
|
+
|
|
127
|
+
// return [...new Set(identifierFieldNames)];
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
|
|
@@ -18,7 +18,11 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
20
|
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
21
|
-
|
|
21
|
+
const {
|
|
22
|
+
generateObjectSchemaForCreate: generateObjectSchemaForCreateShared,
|
|
23
|
+
generateObjectSchemaForUpdate: generateObjectSchemaForUpdateShared,
|
|
24
|
+
generateObjectSchemaForCombineFieldNames: generateObjectSchemaForCombineFieldNamesShared
|
|
25
|
+
} = require('@izara_project/izara-shared-service-schemas').reformatObjectSchema
|
|
22
26
|
const {
|
|
23
27
|
getUsedFieldNamesOfIdentifiers,
|
|
24
28
|
findLinkByObjType,
|
|
@@ -45,44 +49,14 @@ const DEFAULT_REL_ID_SETTING = {
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
storageResourceTags: [storageTag],
|
|
57
|
-
requiredOnCreate: false,
|
|
58
|
-
optionalOnCreate: false,
|
|
59
|
-
canUpdate: false,
|
|
60
|
-
validation: {},
|
|
61
|
-
},
|
|
62
|
-
[`versionedDataField_${versionedDataLabel}_forMatchedId`]: {
|
|
63
|
-
type: "string",
|
|
64
|
-
generatedField: true,
|
|
65
|
-
versionedDataLabel: versionedDataLabel,
|
|
66
|
-
storageResourceTags: [storageTag],
|
|
67
|
-
requiredOnCreate: false,
|
|
68
|
-
optionalOnCreate: false,
|
|
69
|
-
canUpdate: false,
|
|
70
|
-
validation: {},
|
|
71
|
-
},
|
|
72
|
-
[`versionedDataField_${versionedDataLabel}_originTimestamp`]: {
|
|
73
|
-
type: "number",
|
|
74
|
-
generatedField: true,
|
|
75
|
-
versionedDataLabel: versionedDataLabel,
|
|
76
|
-
storageResourceTags: [storageTag],
|
|
77
|
-
requiredOnCreate: false,
|
|
78
|
-
optionalOnCreate: false,
|
|
79
|
-
canUpdate: false,
|
|
80
|
-
validation: {},
|
|
81
|
-
},
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
52
|
+
// const ORIGIN_TIMESTAMP_FIELDNAME = {
|
|
53
|
+
// originTimestamp: {
|
|
54
|
+
// type: "number",
|
|
55
|
+
// requiredOnCreate: true,
|
|
56
|
+
// canUpdate: false,
|
|
57
|
+
// validation: {}
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
86
60
|
/**
|
|
87
61
|
* create object schema for create case
|
|
88
62
|
*
|
|
@@ -92,55 +66,56 @@ function defaultVersionedDataFieldNames(_izContext, versionedDataLabel, storageT
|
|
|
92
66
|
*/
|
|
93
67
|
function generateObjectSchemaForCreate(_izContext, objSchema) {
|
|
94
68
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
69
|
+
return generateObjectSchemaForCreateShared(objSchema)
|
|
70
|
+
// // generate data for case create
|
|
71
|
+
// let initReturnObj = {
|
|
72
|
+
// objectType: objSchema.objectType,
|
|
73
|
+
// fieldNames: {}
|
|
74
|
+
// };
|
|
75
|
+
|
|
76
|
+
// for (let [fieldName, fieldNameSetting] of Object.entries(objSchema.fieldNames)) {
|
|
77
|
+
|
|
78
|
+
// if (!fieldNameSetting.requiredOnCreate && !fieldNameSetting.optionalOnCreate) {
|
|
79
|
+
// continue;
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// if (!initReturnObj.fieldNames.hasOwnProperty(fieldName)) {
|
|
83
|
+
// initReturnObj.fieldNames[fieldName] = {}
|
|
84
|
+
// }
|
|
85
|
+
|
|
86
|
+
// initReturnObj.fieldNames[fieldName].type = fieldNameSetting.type;
|
|
87
|
+
// initReturnObj.fieldNames[fieldName].validation = fieldNameSetting.validation || {};
|
|
88
|
+
// initReturnObj.fieldNames[fieldName].requiredOnCreate = (fieldNameSetting.requiredOnCreate === true) ? true : false;
|
|
89
|
+
// initReturnObj.fieldNames[fieldName].optionalOnCreate = (fieldNameSetting.optionalOnCreate === true) ? true : false;
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
// // add fieldNames from versionedData
|
|
93
|
+
// if (objSchema.addOnDataStructure?.length) {
|
|
94
|
+
// for (let addOn of objSchema.addOnDataStructure) {
|
|
95
|
+
// if (addOn.type === "versionedData") {
|
|
96
|
+
// for (let [versionedFieldName, fieldNameData] of Object.entries(addOn.fieldNames)) {
|
|
97
|
+
|
|
98
|
+
// if (!fieldNameData.requiredOnCreate && !fieldNameData.optionalOnCreate) {
|
|
99
|
+
// continue;
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
// Object.assign(
|
|
103
|
+
// initReturnObj.fieldNames,
|
|
104
|
+
// {
|
|
105
|
+
// [versionedFieldName]: {
|
|
106
|
+
// type: fieldNameData.type,
|
|
107
|
+
// validation: fieldNameData.validation || {},
|
|
108
|
+
// requiredOnCreate: fieldNameData.requiredOnCreate || false,
|
|
109
|
+
// optionalOnCreate: fieldNameData.optionalOnCreate || false,
|
|
110
|
+
// }
|
|
111
|
+
// });
|
|
112
|
+
// }
|
|
113
|
+
// }
|
|
114
|
+
// }
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
// return initReturnObj;
|
|
144
119
|
}
|
|
145
120
|
|
|
146
121
|
/**
|
|
@@ -151,65 +126,67 @@ function generateObjectSchemaForCreate(_izContext, objSchema) {
|
|
|
151
126
|
* @returns {Object} - objectSchema that has property for case update
|
|
152
127
|
*/
|
|
153
128
|
function generateObjectSchemaForUpdate(_izContext, objSchema) {
|
|
154
|
-
// generate data for case update
|
|
155
|
-
let initReturnObj = {
|
|
156
|
-
objectType: objSchema.objectType,
|
|
157
|
-
fieldNames: {},
|
|
158
|
-
identifiers: objSchema.identifiers,
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
if (objSchema.extendObjType) {
|
|
162
|
-
initReturnObj.extendObjType = objSchema.extendObjType;
|
|
163
|
-
} else {
|
|
164
|
-
initReturnObj.identifierFieldNames = getUsedFieldNamesOfIdentifiers(_izContext, objSchema.identifiers);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
for (let [fieldName, fieldNameSetting] of Object.entries(objSchema.fieldNames)) {
|
|
168
129
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
130
|
+
return generateObjectSchemaForUpdateShared(objSchema)
|
|
131
|
+
// // generate data for case update
|
|
132
|
+
// let initReturnObj = {
|
|
133
|
+
// objectType: objSchema.objectType,
|
|
134
|
+
// fieldNames: {},
|
|
135
|
+
// identifiers: objSchema.identifiers,
|
|
136
|
+
// };
|
|
137
|
+
|
|
138
|
+
// if (objSchema.extendObjType) {
|
|
139
|
+
// initReturnObj.extendObjType = objSchema.extendObjType;
|
|
140
|
+
// } else {
|
|
141
|
+
// initReturnObj.identifierFieldNames = getUsedFieldNamesOfIdentifiers(_izContext, objSchema.identifiers);
|
|
142
|
+
// }
|
|
143
|
+
|
|
144
|
+
// for (let [fieldName, fieldNameSetting] of Object.entries(objSchema.fieldNames)) {
|
|
145
|
+
|
|
146
|
+
// if (!initReturnObj.fieldNames.hasOwnProperty(fieldName)) {
|
|
147
|
+
// initReturnObj.fieldNames[fieldName] = {}
|
|
148
|
+
// }
|
|
149
|
+
|
|
150
|
+
// if (fieldNameSetting.canUpdate === true || fieldNameSetting.canUpdate === undefined) {
|
|
151
|
+
// initReturnObj.fieldNames[fieldName].type = fieldNameSetting.type;
|
|
152
|
+
// initReturnObj.fieldNames[fieldName].validation = fieldNameSetting.validation || {};
|
|
153
|
+
// initReturnObj.fieldNames[fieldName].canUpdate = true;
|
|
154
|
+
// } else {
|
|
155
|
+
// initReturnObj.fieldNames[fieldName].type = fieldNameSetting.type;
|
|
156
|
+
// }
|
|
157
|
+
// }
|
|
158
|
+
|
|
159
|
+
// // add fieldNames from versionedData
|
|
160
|
+
// if (objSchema.addOnDataStructure?.length) {
|
|
161
|
+
// for (let addOn of objSchema.addOnDataStructure) {
|
|
162
|
+
// if (addOn.type === "versionedData") {
|
|
163
|
+
// for (let [versionedFieldName, fieldNameData] of Object.entries(addOn.fieldNames)) {
|
|
164
|
+
|
|
165
|
+
// if (fieldNameData.canUpdate === true || fieldNameData.canUpdate === undefined) {
|
|
166
|
+
// Object.assign(
|
|
167
|
+
// initReturnObj.fieldNames,
|
|
168
|
+
// {
|
|
169
|
+
// [versionedFieldName]: {
|
|
170
|
+
// type: fieldNameData.type,
|
|
171
|
+
// canUpdate: true,
|
|
172
|
+
// validation: fieldNameData.validation || {},
|
|
173
|
+
// }
|
|
174
|
+
// });
|
|
175
|
+
// } else {
|
|
176
|
+
// Object.assign(
|
|
177
|
+
// initReturnObj.fieldNames,
|
|
178
|
+
// {
|
|
179
|
+
// [versionedFieldName]: {
|
|
180
|
+
// type: fieldNameData.type,
|
|
181
|
+
// }
|
|
182
|
+
// });
|
|
183
|
+
// }
|
|
184
|
+
// }
|
|
185
|
+
// }
|
|
186
|
+
// }
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// return initReturnObj;
|
|
213
190
|
}
|
|
214
191
|
|
|
215
192
|
|
|
@@ -223,55 +200,57 @@ function generateObjectSchemaForUpdate(_izContext, objSchema) {
|
|
|
223
200
|
* @returns {Object} - objectSchema that has property for case update
|
|
224
201
|
*/
|
|
225
202
|
function generateObjectSchemaForCombineFieldNames(_izContext, objSchema) {
|
|
226
|
-
// generate data for case update
|
|
227
|
-
let initReturnObj = {
|
|
228
|
-
objectType: objSchema.objectType,
|
|
229
|
-
fieldNames: objSchema.fieldNames,
|
|
230
|
-
canDelete: objSchema.canDelete,
|
|
231
|
-
storageResources: objSchema.storageResources
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
if (objSchema.extendObjType) {
|
|
235
|
-
initReturnObj.extendObjType = objSchema.extendObjType;
|
|
236
|
-
}
|
|
237
203
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
//
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
204
|
+
return generateObjectSchemaForCombineFieldNamesShared(objSchema)
|
|
205
|
+
// generate data for case update
|
|
206
|
+
// let initReturnObj = {
|
|
207
|
+
// objectType: objSchema.objectType,
|
|
208
|
+
// fieldNames: objSchema.fieldNames,
|
|
209
|
+
// canDelete: objSchema.canDelete,
|
|
210
|
+
// storageResources: objSchema.storageResources
|
|
211
|
+
// };
|
|
212
|
+
|
|
213
|
+
// if (objSchema.extendObjType) {
|
|
214
|
+
// initReturnObj.extendObjType = objSchema.extendObjType;
|
|
215
|
+
// }
|
|
216
|
+
|
|
217
|
+
// if (objSchema.identifiers) {
|
|
218
|
+
// initReturnObj.identifiers = objSchema.identifiers;
|
|
219
|
+
// initReturnObj.identifierFieldNames = getUsedFieldNamesOfIdentifiers(_izContext, objSchema.identifiers);
|
|
220
|
+
// }
|
|
221
|
+
|
|
222
|
+
// // add fieldNames from versionedData
|
|
223
|
+
// if (objSchema.addOnDataStructure?.length) {
|
|
224
|
+
// let versionedDataLabels = [];
|
|
225
|
+
// // versionedDataField_ceo_versionedDataId
|
|
226
|
+
// for (let addOn of objSchema.addOnDataStructure) {
|
|
227
|
+
// if (addOn.type === "versionedData") {
|
|
228
|
+
// // add default fieldNames of versionedData to main fieldNames
|
|
229
|
+
// Object.assign(
|
|
230
|
+
// initReturnObj.fieldNames,
|
|
231
|
+
// defaultVersionedDataFieldNames(_izContext, addOn.versionedDataLabel, addOn.storageResourceTag)
|
|
232
|
+
// );
|
|
233
|
+
|
|
234
|
+
// // add each versionedData fieldName to main fieldNames
|
|
235
|
+
// for (let [versionedFieldName, fieldNameData] of Object.entries(addOn.fieldNames)) {
|
|
236
|
+
// Object.assign(initReturnObj.fieldNames, {
|
|
237
|
+
// [versionedFieldName]: {
|
|
238
|
+
// ...fieldNameData,
|
|
239
|
+
// versionedDataLabel: addOn.versionedDataLabel,
|
|
240
|
+
// storageResourceTags: [addOn.storageResourceTag]
|
|
241
|
+
// }
|
|
242
|
+
// });
|
|
243
|
+
// }
|
|
244
|
+
// versionedDataLabels.push(addOn.versionedDataLabel);
|
|
245
|
+
// }
|
|
246
|
+
// }
|
|
247
|
+
|
|
248
|
+
// if (versionedDataLabels.length) {
|
|
249
|
+
// initReturnObj.versionedDataLabels = versionedDataLabels;
|
|
250
|
+
// }
|
|
251
|
+
// }
|
|
252
|
+
|
|
253
|
+
// return initReturnObj;
|
|
275
254
|
}
|
|
276
255
|
|
|
277
256
|
|
|
@@ -506,6 +485,7 @@ module.exports = {
|
|
|
506
485
|
generateLinksDataPerLinkTypeId,
|
|
507
486
|
groupRefObjectRelPerObjectType,
|
|
508
487
|
DEFAULT_REL_ID_SETTING,
|
|
488
|
+
// ORIGIN_TIMESTAMP_FIELDNAME,
|
|
509
489
|
|
|
510
490
|
// external service
|
|
511
491
|
refRelationshipPerObjectSchema
|