@izara_project/izara-market-library-service-schemas 1.0.16 → 1.0.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-market-library-service-schemas",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Schemas for Izara Market project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -247,21 +247,19 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
247
247
  // _izContext.logger.debug("allObjectRelationships::", allObjectRelationships);
248
248
 
249
249
  const allLocalFlowSchemas = await getAllLocalFlowSchemas(_izContext, objSchemaPath);
250
- // _izContext.logger.debug("allLocalFlowSchemas::", allLocalFlowSchemas)
251
- if (allLocalFlowSchemas) {
252
- for (const flowSchema of allLocalFlowSchemas.records) {
253
- /*
254
- webSocketHandler to send to queue
255
- */
256
- }
257
- const webSocketTaskTable = createWebSocketDynamoDb(_izContext, saveFilePath);
258
- const webSocketConnectYaml = createWebSocketConnectYaml(_izContext, saveFilePath);
259
- const webSocketConnectHandler = createWebSocketConnectHandler(_izContext, saveFilePath);
260
- const webSocketHandlerYaml = createWebSocketHandlerYaml(_izContext, saveFilePath);
261
- const webSocketHandler = createWebSocketHandler(_izContext, saveFilePath);
262
- // const webSocketHandler
263
-
264
- const webSocketResource = [...webSocketTaskTable, ...webSocketConnectYaml, ...webSocketConnectHandler, ...webSocketHandler, ...webSocketHandlerYaml]
250
+ _izContext.logger.debug("allLocalFlowSchemas::", allLocalFlowSchemas)
251
+ for (const flowSchema of allLocalFlowSchemas.records) {
252
+
253
+ }
254
+ const webSocketTaskTable = createWebSocketDynamoDb(_izContext, saveFilePath);
255
+ const webSocketConnectYaml = createWebSocketConnectYaml(_izContext, saveFilePath);
256
+ const webSocketConnectHandler = createWebSocketConnectHandler(_izContext, saveFilePath);
257
+ const webSocketHandlerYaml = createWebSocketHandlerYaml(_izContext, saveFilePath);
258
+ const webSocketHandler = createWebSocketHandler(_izContext, saveFilePath);
259
+ // const webSocketHandler
260
+
261
+ const webSocketResource = [...webSocketTaskTable, ...webSocketConnectYaml, ...webSocketConnectHandler, ...webSocketHandler, ...webSocketHandlerYaml]
262
+ if (allLocalFlowSchemas.records.length) {
265
263
  createSourceParams.push(
266
264
  ...webSocketResource
267
265
  )
@@ -79,7 +79,7 @@ module.exports.<%- functionName %>Main = async (
79
79
  errorFounds.push("Not Have UserId")
80
80
  }
81
81
 
82
- const OBJECT_TYPE = "Address"
82
+ const OBJECT_TYPE = "<%- objectType %>"
83
83
  const SERVICE_TAG = process.env.iz_serviceTag;
84
84
  //(<beforeQuery>)
85
85
  //(</beforeQuery>)
@@ -108,6 +108,50 @@ module.exports.<%- functionName %>Main = async (
108
108
 
109
109
  let originTimestamp = Date.now();
110
110
 
111
+ let haveVersionedDataIdsToUpdate = (requestParams.versionedDataIds && Object.keys(requestParams.versionedDataIds).length) ? true : false
112
+ if (haveVersionedDataIdsToUpdate) {
113
+
114
+ let updateMainNodeData = {};
115
+ let updateVersionedData = {};
116
+ _izContext.logger.debug("have versionedDataIds to update")
117
+ for (const fieldProp in requestParams.objInstanceFull.fields) {
118
+ const fieldSetting = objectSchema.fieldNames[fieldProp];
119
+ // collect updateData
120
+ if (fieldSetting.hasOwnProperty("versionedDataLabel")) {
121
+ if (!updateVersionedData.hasOwnProperty(fieldSetting.versionedDataLabel)) {
122
+ updateVersionedData[fieldSetting.versionedDataLabel] = {};
123
+ }
124
+ Object.assign(updateVersionedData[fieldSetting.versionedDataLabel], { [fieldProp]: requestParams.objInstanceFull.fields[fieldProp] })
125
+ } else {
126
+ Object.assign(updateMainNodeData, { [fieldProp]: requestParams.objInstanceFull.fields[fieldProp] })
127
+ }
128
+ }
129
+ _izContext.logger.debug("updateMainNodeData::", updateMainNodeData);
130
+ _izContext.logger.debug("updateVersionedData::", updateVersionedData);
131
+
132
+ const versionedDataIdLabelKeys = Object.keys(requestParams.versionedDataIds);
133
+ const updateVersionedDataLabelKeys = Object.keys(updateVersionedData);
134
+
135
+ _izContext.logger.debug("versionedDataIdLabelKeys:: ", versionedDataIdLabelKeys);
136
+ _izContext.logger.debug("updateVersionedDataLabelKeys:: ", updateVersionedDataLabelKeys);
137
+ //check missing versionedDataIds
138
+ const missingVersionedDataIdLabels = updateVersionedDataLabelKeys.filter(label => !versionedDataIdLabelKeys.includes(label));
139
+ _izContext.logger.debug("missingVersionedDataIdLabels:: ", missingVersionedDataIdLabels);
140
+
141
+ if (missingVersionedDataIdLabels.length) {
142
+ errorFounds.push(`missing versionedDataIds of versionedDataLabel '${missingVersionedDataIdLabels.join(", ")}'`)
143
+ }
144
+
145
+ // check missing update data of versionedDataLabels
146
+ const missingDataVersionedDataLabels = versionedDataIdLabelKeys.filter(label => !versionedDataIdLabelKeys.includes(label))
147
+ if (missingDataVersionedDataLabels.length) {
148
+ errorFounds.push(`missing data of versionedDataLabels '${missingDataVersionedDataLabels.join(", ")}'`);
149
+ }
150
+ // check mainNode Data should not exists
151
+ if (Object.keys(updateMainNodeData).length) {
152
+ errorsFound.push("cannot update mainNode if have versionedDataIds");
153
+ }
154
+ }
111
155
 
112
156
  let messageAttributes
113
157
 
@@ -245,7 +245,7 @@ module.exports.deleteRelationship = async (
245
245
 
246
246
 
247
247
  // before create awaitingStepId per graph storageResource
248
- const linkTypeId = createLinkTypeId(_izContext, objects[0].objType, objects[1].objType, relType, relationshipDirection);
248
+ const linkTypeId = createLinkTypeId(_izContext, firstObject.objType, secondObject.objType, relType, relationshipDirection);
249
249
 
250
250
  let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
251
251
  let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out