@izara_project/izara-market-library-service-schemas 1.0.48 → 1.0.50

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 (72) hide show
  1. package/index.js +3 -1
  2. package/package.json +3 -3
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +28 -29
  4. package/src/GenerateCodeLibs/src/TranslateIdsLibs.js +9 -6
  5. package/src/MainLibs/src/Consts.js +29 -23
  6. package/src/MainLibs/src/Utils.js +4 -4
  7. package/src/reStructure/GenerateCode.js +3 -3
  8. package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +1 -1
  9. package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +2 -2
  10. package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +1 -1
  11. package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +3 -3
  12. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +24 -8
  13. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +8 -3
  14. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +11 -5
  15. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +7 -2
  16. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +0 -1
  17. package/src/reStructure/TemplateData/findData/GetByStorage/getByDynamo.ejs +5 -4
  18. package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +12 -32
  19. package/src/reStructure/TemplateData/findData/findDataYaml/data.js +32 -62
  20. package/src/reStructure/TemplateData/findData/generateTemplateData.js +2 -2
  21. package/src/reStructure/TemplateData/findData/handler/template.ejs +1 -2
  22. package/src/reStructure/TemplateData/findData/mainFunction/data.js +19 -12
  23. package/src/reStructure/TemplateData/findData/mainFunction/template.ejs +2 -2
  24. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/mainFunction/template.ejs +0 -15
  25. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/mainFunction/data.js +4 -3
  26. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/mainFunction/template.ejs +9 -42
  27. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +0 -10
  28. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +1 -1
  29. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +1 -1
  30. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +2 -14
  31. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +2 -1
  32. package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +14 -17
  33. package/src/reStructure/TemplateData/flowSchema/flowStep/handler/data.js +15 -18
  34. package/src/reStructure/TemplateData/flowSchema/flowStep/handler/template.ejs +1 -1
  35. package/src/reStructure/TemplateData/flowSchema/flowStep/mainFunction/data.js +16 -19
  36. package/src/reStructure/TemplateData/flowSchema/flowStep/mainFunction/template.ejs +1 -1
  37. package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +21 -19
  38. package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +20 -6
  39. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +33 -12
  40. package/src/reStructure/TemplateData/flowSchema/lambdaSync/functionYaml/data.js +128 -0
  41. package/src/reStructure/TemplateData/flowSchema/lambdaSync/functionYaml/templateApi.ejs +20 -0
  42. package/src/reStructure/TemplateData/flowSchema/lambdaSync/functionYaml/templateInv.ejs +13 -0
  43. package/src/reStructure/TemplateData/flowSchema/lambdaSync/handler/data.js +85 -0
  44. package/src/reStructure/TemplateData/flowSchema/lambdaSync/handler/templateApi.ejs +80 -0
  45. package/src/reStructure/TemplateData/flowSchema/lambdaSync/handler/templateInv.ejs +47 -0
  46. package/src/reStructure/TemplateData/flowSchema/lambdaSync/mainFunction/data.js +74 -0
  47. package/src/reStructure/TemplateData/flowSchema/lambdaSync/mainFunction/template.ejs +96 -0
  48. package/src/reStructure/TemplateData/flowSchema/register/complete/handler/template.ejs +1 -0
  49. package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +6 -7
  50. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +4 -5
  51. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +2 -6
  52. package/src/reStructure/TemplateData/generateRole/data.js +0 -20
  53. package/src/reStructure/TemplateData/generateRole/template.ejs +4 -2
  54. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +18 -7
  55. package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +10 -10
  56. package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +10 -10
  57. package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +1 -1
  58. package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +2 -2
  59. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +5 -5
  60. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +5 -5
  61. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +5 -1
  62. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +3 -1
  63. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +2 -2
  64. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +6 -1
  65. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +7 -7
  66. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -2
  67. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +8 -4
  68. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +8 -7
  69. package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +2 -2
  70. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs +8 -4
  71. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +8 -7
  72. package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +2 -2
@@ -76,7 +76,8 @@ module.exports.deleteMain = async (
76
76
 
77
77
  let objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
78
78
  _izContext,
79
- objType
79
+ objType,
80
+ process.env.iz_serviceSchemaBucketName
80
81
  );
81
82
  _izContext.logger.debug("objectSchema", objectSchema);
82
83
 
@@ -100,9 +101,13 @@ module.exports.deleteMain = async (
100
101
 
101
102
  /*
102
103
  create deleteDataDetail that decade what storage that have to access or not
103
- becuase it only use identifier and dont care fieldName
104
+ because it only use identifier and don't care fieldName
104
105
  */
105
- let deleteDataDetails = await createDeleteDataDetail(_izContext, objectSchema);
106
+ let deleteDataDetails = await createDeleteDataDetail(
107
+ _izContext,
108
+ objectSchema,
109
+ {bucketName: process.env.iz_serviceSchemaBucketName}
110
+ );
106
111
  _izContext.logger.debug("deleteDataDetails", deleteDataDetails);
107
112
 
108
113
 
@@ -90,12 +90,17 @@ module.exports.getMain = async (
90
90
  const objType = createObjType(requestParams.objectType)
91
91
  let objectSchema = await getObjSchemaS3WithHierarchy(
92
92
  _izContext,
93
- objType
93
+ objType,
94
+ process.env.iz_serviceSchemaBucketName
94
95
  );
95
96
 
96
97
  _izContext.logger.debug("objectSchema: ", objectSchema);
97
98
 
98
- let getDataDetails = await createGetDataDetails(_izContext, objectSchema);
99
+ let getDataDetails = await createGetDataDetails(
100
+ _izContext,
101
+ objectSchema,
102
+ {bucketName: process.env.iz_serviceSchemaBucketName}
103
+ );
99
104
  _izContext.logger.debug("getDataDetails:", getDataDetails)
100
105
 
101
106
  // start to get data
@@ -167,7 +172,7 @@ module.exports.getMain = async (
167
172
  };
168
173
 
169
174
  _izContext.logger.debug("messageParams OutUpdateNode ::::::: ", messageParams);
170
- await sns.publishAsync(_izContext, messageParams);
175
+ await sns.publishAsync(_izContext, messageParams);
171
176
  }
172
177
 
173
178
 
@@ -221,7 +226,7 @@ module.exports.getMain = async (
221
226
  let identifiersForGetData = await dynamoDbIdentifiersByStorageResource(
222
227
  _izContext,
223
228
  objectSchema,
224
- createDataDetails,
229
+ getDataDetail,
225
230
  requestParams.identifiers
226
231
  )
227
232
  _izContext.logger.debug("identifiersForGetData", identifiersForGetData);
@@ -235,9 +240,10 @@ module.exports.getMain = async (
235
240
  ),
236
241
  identifiersForGetData
237
242
  );
243
+
244
+ getResults.push([getParent, getDataDetail]);
238
245
  }
239
246
 
240
- getResults.push([getParent, getDataDetail]);
241
247
 
242
248
  }
243
249
  })
@@ -75,7 +75,8 @@ module.exports.updateMain = async (
75
75
 
76
76
  let objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
77
77
  _izContext,
78
- objType
78
+ objType,
79
+ process.env.iz_serviceSchemaBucketName
79
80
  );
80
81
  _izContext.logger.debug("objectSchema", objectSchema);
81
82
 
@@ -107,7 +108,11 @@ module.exports.updateMain = async (
107
108
  versionedDataIds: versionedDataIds
108
109
  })
109
110
 
110
- let updateDataDetails = await createUpdateDataDetail(_izContext, objectSchema);
111
+ let updateDataDetails = await createUpdateDataDetail(
112
+ _izContext,
113
+ objectSchema,
114
+ {bucketName: process.env.iz_serviceSchemaBucketName}
115
+ );
111
116
 
112
117
  _izContext.logger.debug("updateDataDetails", updateDataDetails);
113
118
 
@@ -41,7 +41,6 @@ const {
41
41
  externalResourceYaml
42
42
  } = require("../../../../MainLibs/src/Consts.js");
43
43
  const {
44
- getLocalServiceTag,
45
44
  firstLetterLowerCase: lowerCase,
46
45
  firstLetterUpperCase: upperCase,
47
46
  } = require('../../../../MainLibs/src/Utils.js');
@@ -1,7 +1,8 @@
1
1
  let identifiersBase = await identifierObj.identifiersBaseFromIdentifiers(
2
2
  _izContext,
3
3
  objType,
4
- identifiers
4
+ identifiers,
5
+ process.env.iz_serviceSchemaBucketName
5
6
  );
6
7
  _izContext.logger.debug("create identifiersBase from identifiers: ", identifiersBase) // object
7
8
 
@@ -21,8 +22,8 @@ if (!objInstanceBase) {
21
22
  return;
22
23
  }
23
24
 
24
- if (!objInstanceBase.hasOwnProperty(fieldName)) {
25
- errorsFound.push(`data in dynamoDB have no ${fieldName}`)
25
+ if (!objInstanceBase.hasOwnProperty(fieldName.fieldName)) {
26
+ errorsFound.push(`data in dynamoDB have no ${fieldName.fieldName}`)
26
27
  standardErrorParams.push(errorsFound)
27
28
  await findDataSharedLib.completeFindDataMain(...standardErrorParams);
28
29
  return;
@@ -30,7 +31,7 @@ if (!objInstanceBase.hasOwnProperty(fieldName)) {
30
31
 
31
32
  <%- createNameTagAfter(objectType, fieldName) %>
32
33
 
33
- let dataValue = objInstanceBase[fieldName];
34
+ let dataValue = objInstanceBase[fieldName.fieldName];
34
35
  _izContext.logger.debug("dataValue: ", dataValue)
35
36
 
36
37
  await findDataSharedLib.completeFindDataMain(
@@ -2,7 +2,8 @@
2
2
 
3
3
  const graphHandlerServiceTag = await serviceConfig.getGraphServiceTagWithCache(
4
4
  _izContext,
5
- <%- JSON.stringify(graphServerTag) %>
5
+ <%- JSON.stringify(graphServerTag) %>,
6
+ process.env.iz_serviceSchemaBucketName
6
7
  );
7
8
  _izContext.logger.debug("graphHandlerServiceTag: ", graphHandlerServiceTag)
8
9
 
@@ -28,59 +29,38 @@ if (!getDataByGraph) {
28
29
 
29
30
  <%- createNameTagAfter(objectType, fieldName) %>
30
31
 
31
- <% if (versionedDataLabel.length > 0) { _%>
32
- // The fieldName is a key in the versionedData object.
33
- let versionedDataLabel = getDataByGraph.versionedDatas<%- JSON.stringify(versionedDataLabel) %>;
34
-
35
- if (versionedDataLabel == null) {
36
- errorsFound.push(`can't find versionedData of ${objType.objectType}`)
37
- standardErrorParams.push(errorsFound)
38
- await findDataSharedLib.completeFindDataMain(...standardErrorParams);
39
- return;
40
- }
41
-
42
- let versionedProperties = versionedDataLabel.properties;
43
-
44
- if (!versionedProperties.hasOwnProperty(fieldName)) {
45
- errorsFound.push(`versionedData have no ${fieldName}`)
46
- standardErrorParams.push(errorsFound)
47
- await findDataSharedLib.completeFindDataMain(...standardErrorParams);
48
- return;
49
- }
50
-
51
- let dataValue = versionedProperties[fieldName];
52
- _izContext.logger.debug("dataValue: ", dataValue)
53
- <% } else { _%>
54
- let objInstanceFull = getDataByGraph.objInstanceFull;
32
+ let objInstanceFull = getDataByGraph.returnValue.queryResults.refactoredNodes.objInstanceFull;
55
33
  _izContext.logger.debug("objInstanceFull: ", objInstanceFull)
34
+
35
+
56
36
  <% if (getInIdentifiers) { _%>
57
37
 
58
38
  // objInstanceFull.identifiers // Object
59
- if (!objInstanceFull.identifiers.hasOwnProperty(fieldName)) {
60
- errorsFound.push(`nodeProperties have no this ${fieldName}`)
39
+ if (!objInstanceFull.identifiers.hasOwnProperty(fieldName.fieldName)) {
40
+ errorsFound.push(`nodeProperties have no this ${fieldName.fieldName}`)
61
41
  standardErrorParams.push(errorsFound)
62
42
  await findDataSharedLib.completeFindDataMain(...standardErrorParams);
63
43
  return;
64
44
  }
65
45
 
66
- let dataValue = objInstanceFull.identifiers[fieldName];
46
+ let dataValue = objInstanceFull.identifiers[fieldName.fieldName];
67
47
  _izContext.logger.debug("this fieldName is identifier, get dataValue in identifiers: ", dataValue)
68
48
 
69
49
  <% } else { _%>
70
50
 
71
51
  // objInstanceFull.fields // Object
72
- if (!objInstanceFull.fields.hasOwnProperty(fieldName)) {
73
- errorsFound.push(`nodeProperties have no this ${fieldName}`)
52
+ if (!objInstanceFull.fields.hasOwnProperty(fieldName.fieldName)) {
53
+ errorsFound.push(`nodeProperties have no this ${fieldName.fieldName}`)
74
54
  standardErrorParams.push(errorsFound)
75
55
  await findDataSharedLib.completeFindDataMain(...standardErrorParams);
76
56
  return;
77
57
  }
78
58
 
79
- let dataValue = objInstanceFull.fields[fieldName];
59
+ let dataValue = objInstanceFull.fields[fieldName.fieldName];
80
60
  _izContext.logger.debug("this fieldName is not identifier, get dataValue in fields: ", dataValue)
81
61
 
82
62
  <% }_%>
83
- <% } _%>
63
+
84
64
  await findDataSharedLib.completeFindDataMain(
85
65
  _izContext,
86
66
  findDataMain.fieldName,
@@ -37,70 +37,12 @@ const {
37
37
  FUNCTION_NAME,
38
38
  SOURCE_GENERATE_IAM_ROLE,
39
39
  shortNameHandler,
40
+ defaultIamRolePerAction
40
41
  } = require("../../../../MainLibs/src/Consts");
41
42
 
42
43
  const serviceSchemas = require('@izara_project/izara-core-library-service-schemas');
43
44
  const serviceConfig = serviceSchemas.serviceConfig;
44
45
 
45
- function defaultIamRolePerAction() {
46
-
47
- let defaultIamRole = [];
48
-
49
-
50
- defaultIamRole.push(
51
- createIamRole(
52
- {
53
- [RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
54
- },
55
- [
56
- resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
57
- resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
58
- resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
59
- ]
60
- )
61
- );
62
-
63
- defaultIamRole.push(
64
- createIamRole(
65
- { [RESOURCE_CLASSES.s3]: ["ListBucket"] },
66
- [
67
- resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
68
- ]
69
- )
70
- );
71
-
72
- defaultIamRole.push(
73
- createIamRole(
74
- {
75
- [RESOURCE_CLASSES.sns]: ["Publish"]
76
- },
77
- [
78
- resourceNames(RESOURCE_CLASSES.sns, "FindData_In"),
79
- resourceNames(RESOURCE_CLASSES.sns, "FindDataComplete_Out")
80
- ]
81
- )
82
- )
83
-
84
-
85
-
86
- defaultIamRole.push(
87
- createIamRole(
88
- {
89
- [RESOURCE_CLASSES.dynamoDbTable]: [
90
- DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.get].dynamoDbPermission,
91
- DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.update].dynamoDbPermission,
92
- DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.delete].dynamoDbPermission
93
- ]
94
- },
95
- [
96
- resourceNames(RESOURCE_CLASSES.dynamoDbTable, "FindDataMain")
97
- ]
98
- )
99
- )
100
- // console.log("defaultIamRole Api", defaultIamRole)
101
- return defaultIamRole
102
- }
103
-
104
46
  /**
105
47
  * receive objectSchema
106
48
  * create data for FindData Yaml template
@@ -108,7 +50,7 @@ function defaultIamRolePerAction() {
108
50
  * @param {Object} objectSchemas
109
51
  * @return {{ templatePath, templateData, setting } }
110
52
  */
111
- async function data(_izContext, objectSchemas, srcPath) {
53
+ async function data(_izContext, objectSchemas, srcPath, settings) {
112
54
 
113
55
  let additionalResourcePermission = defaultIamRolePerAction();
114
56
  let tableForGetItem = [];
@@ -130,7 +72,8 @@ async function data(_izContext, objectSchemas, srcPath) {
130
72
 
131
73
  const graphHandlerServiceTag = await serviceConfig.getGraphServiceTagWithCache(
132
74
  _izContext,
133
- storageResource.graphServerTag
75
+ storageResource.graphServerTag,
76
+ settings.bucketName
134
77
  );
135
78
  // _izContext.logger.debug("graphHandlerServiceTag: ", graphHandlerServiceTag)
136
79
 
@@ -171,8 +114,35 @@ async function data(_izContext, objectSchemas, srcPath) {
171
114
  )
172
115
  )
173
116
 
174
- // console.log("additionalResourcePermission", additionalResourcePermission)
117
+ additionalResourcePermission.push(
118
+ createIamRole(
119
+ {
120
+ [RESOURCE_CLASSES.sns]: ["Publish"]
121
+ },
122
+ [
123
+ resourceNames(RESOURCE_CLASSES.sns, "FindData_In"),
124
+ resourceNames(RESOURCE_CLASSES.sns, "FindDataComplete_Out")
125
+ ]
126
+ )
127
+ )
175
128
 
129
+ additionalResourcePermission.push(
130
+ createIamRole(
131
+ {
132
+ [RESOURCE_CLASSES.dynamoDbTable]: [
133
+ DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.get].dynamoDbPermission,
134
+ DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.update].dynamoDbPermission,
135
+ DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.delete].dynamoDbPermission
136
+ ]
137
+ },
138
+ [
139
+ resourceNames(RESOURCE_CLASSES.dynamoDbTable, "FindDataMain")
140
+ ]
141
+ )
142
+ )
143
+
144
+ // console.log("additionalResourcePermission", additionalResourcePermission)
145
+ console.log("findData template generated")
176
146
  return {
177
147
  templatePath: templatePath,
178
148
  templateData: {
@@ -38,13 +38,13 @@ const createFindDataMainFunction = require('./mainFunction/data');
38
38
  * @param {string} objSchemaPath - Path to the schema
39
39
  * @returns {Array} Array of generated code parameters
40
40
  */
41
- async function generateCodeWithTemplate(_izContext, objSchemaPath) {
41
+ async function generateCodeWithTemplate(_izContext, objSchemaPath, settings) {
42
42
  try {
43
43
  const saveFilePath = join(objSchemaPath, '../');
44
44
  const createSourceParams = [];
45
45
  let allObjSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
46
46
 
47
- const findDataFunctionYaml = await createFindDataFunctionYaml(_izContext, allObjSchemas, saveFilePath);
47
+ const findDataFunctionYaml = await createFindDataFunctionYaml(_izContext, allObjSchemas, saveFilePath, settings);
48
48
  const findDataHandlerSqs = createFindDataHandler(_izContext, saveFilePath);
49
49
  const findDataMainFunction = await createFindDataMainFunction(_izContext, saveFilePath);
50
50
 
@@ -40,8 +40,7 @@ const perRecordsValidatorSchema = {
40
40
  ],
41
41
  properties: {
42
42
  fieldName: {
43
- type: 'string',
44
-
43
+ type: 'object',
45
44
  },
46
45
  objType: {
47
46
  type: 'object',
@@ -171,14 +171,14 @@ async function data(_izContext, srcPath) {
171
171
 
172
172
  // fieldName in versionedData
173
173
  if (objectSchema.hasOwnProperty("addOnDataStructure")) { // array
174
- // console.log(("objectSchemas have addOnDataStructure: ", objectSchema.addOnDataStructure)
174
+ // console.log("objectSchemas have addOnDataStructure: ", objectSchema.addOnDataStructure)
175
175
  for (const versionedData of objectSchema.addOnDataStructure) { // object // loop versionedData
176
- // console.log("versionedData: ", versionedData)
177
- if (versionedData === ADD_ON_DATA_STRUCTURE_TYPE.versionedData) {
178
-
176
+ console.log("versionedData: ", versionedData)
177
+ if (versionedData.type === ADD_ON_DATA_STRUCTURE_TYPE.versionedData) {
179
178
  let versionedStorageDetail = {};
180
179
  let versioendStorageResourceTag = versionedData.storageResourceTag;
181
- let versionedFieldNames = versionedData.fieldNames; // array
180
+ let versionedFieldNames = versionedData.fieldNames; // object
181
+
182
182
 
183
183
  Object.entries(storageResources).map(([storageTag, storageDetail]) => {
184
184
 
@@ -195,15 +195,22 @@ async function data(_izContext, srcPath) {
195
195
  }
196
196
  }
197
197
  })
198
- // console.log(("versionedStorageDetail: ", versionedStorageDetail)
199
-
200
- for (const versionedFieldName of versionedFieldNames) { // object // loop versionedFieldNames
198
+ console.log("versionedStorageDetail: ", versionedStorageDetail)
201
199
 
202
- if (versionedFieldName.type === "string" || versionedFieldName.type === "number") {
203
- fieldNameDatas.push({ [versionedFieldName.fieldName]: versionedStorageDetail })
200
+ Object.keys(versionedFieldNames).forEach(key => {
201
+ console.log("key", key)
202
+ if (versionedFieldNames[key].type === "string" || versionedFieldNames[key].type === "number") {
203
+ fieldNameDatas.push({ [key]: versionedStorageDetail })
204
204
  }
205
+ })
206
+
207
+ // for (const versionedFieldName of versionedFieldNames) { // object // loop versionedFieldNames
208
+
209
+ // if (versionedFieldName.type === "string" || versionedFieldName.type === "number") {
210
+ // fieldNameDatas.push({ [versionedFieldName.fieldName]: versionedStorageDetail })
211
+ // }
205
212
 
206
- } // end loop versionedFieldNames
213
+ // } // end loop versionedFieldNames
207
214
 
208
215
  } // end loop versionedData
209
216
  //fieldNameDatas.push(collectVersionedFieldNames)
@@ -215,7 +222,7 @@ async function data(_izContext, srcPath) {
215
222
  objectType: objectType,
216
223
  fieldNames: fieldNameDatas
217
224
  };
218
- // console.log(("fieldNameDatasPerObjectType: ", fieldNameDatasPerObjectType)
225
+ console.log("fieldNameDatasPerObjectType: ", fieldNameDatasPerObjectType)
219
226
 
220
227
  datas.push(fieldNameDatasPerObjectType)
221
228
  } // end loop objectType
@@ -108,8 +108,8 @@ exports.findData = async (
108
108
  <% for (let idx = 0; idx < fieldNames.length; idx++) { _%>
109
109
  <% let fieldName = Object.keys(fieldNames[idx])[0] _%>
110
110
  <% let storageDetails = (Object.values(fieldNames[idx])[0]) _%>
111
- if (fieldName == <%- JSON.stringify(fieldName) %>) {
112
- _izContext.logger.debug("fieldName: ", fieldName)
111
+ if (fieldName.fieldName == <%- JSON.stringify(fieldName) %>) {
112
+ _izContext.logger.debug("fieldName: ", fieldName.fieldName)
113
113
 
114
114
  <% Object.entries(storageDetails).map(([storage, details]) => { _%>
115
115
  <% let versionedDataLabel = [] _%>
@@ -71,24 +71,9 @@ module.exports.<%- functionName %> = async (
71
71
  _izContext.logger.debug("<%- functionName %> requestParams", requestParams)
72
72
  _izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
73
73
 
74
- let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID)
75
- let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
76
-
77
74
  //(<endpointHookMainFunction>)
78
75
  //(</endpointHookMainFunction>)
79
76
 
80
- const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
81
- flowTag: "<%- flowTag %>",
82
- serviceTag: process.env.iz_serviceTag
83
- })
84
-
85
- //(<endpointHook>)
86
- //(</endpointHook>)
87
-
88
- return {
89
- //(<endpointReturn>)
90
- //(</endpointReturn>)
91
- }
92
77
  } catch (err) {
93
78
  _izContext.logger.error('error WebSocketInvoke: ', err)
94
79
  throw (err)
@@ -24,9 +24,9 @@ const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/
24
24
  const templatePath = path.join(__dirname, "template.ejs");
25
25
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
26
26
  const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
27
- const statusFieldTemplate = path.join(__dirname, "../../createRecordByStatusType/statusFieldTemplate.ejs")
28
- const storedCacheTemplate = path.join(__dirname, "../../createRecordByStatusType/storedCacheTemplate.ejs")
29
-
27
+ const statusFieldTemplate = path.join(__dirname, "../../../templateBystatusType/statusFieldTemplate.ejs");
28
+ const storedCacheTemplate = path.join(__dirname, "../../../templateBystatusType/storedCacheTemplate.ejs");
29
+ const triggerCacheTemplate = path.join(__dirname, "../../../templateBystatusType/triggerCacheTemplate.ejs");
30
30
  /**
31
31
  * receive objectSchema
32
32
  * create data for WebScoket handler template
@@ -58,6 +58,7 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
58
58
  statusType: flowSchema.statusType,
59
59
  statusFieldTemplate,
60
60
  storedCacheTemplate,
61
+ triggerCacheTemplate,
61
62
  flowTag: flowSchema.flowTag,
62
63
  functionName,
63
64
  tableName,
@@ -74,56 +74,23 @@ module.exports.<%- functionName %> = async (
74
74
  let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID)
75
75
  let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
76
76
 
77
- //(<endpointHookMainFunction>)
78
- //(</endpointHookMainFunction>)
79
-
80
- const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
81
- flowTag: "<%- flowTag %>",
82
- serviceTag: process.env.iz_serviceTag
83
- })
84
-
85
77
  <% if (statusType === "statusField") { %>
86
78
  <%- include(statusFieldTemplate) %>
87
79
  <% } else if (statusType === "storedCache") { %>
88
- <%- include(storedCacheTemplate, {tableName:tableName}) %>
89
- let messageObject = requestParams
90
-
91
- //(<beforeSendMessage>)
92
- //(</beforeSendMessage>)
93
- // create callingFlow
94
- messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
95
- messageObject,
96
- callingFlowSharedLib.addParentCallingFlowConfig(
97
- callingFlowConfig,
98
- callingFlowSharedLib.createCallingFlowConfig(
99
- await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
100
- )
101
- )
102
- )
103
-
104
- <% } else if (statusType === "none") { %>
105
-
106
- let messageObject = requestParams
107
-
108
- // create callingFlow
109
- messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
110
- messageObject,
111
- callingFlowSharedLib.addParentCallingFlowConfig(
112
- callingFlowConfig,
113
- callingFlowSharedLib.createCallingFlowConfig(
114
- await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.flowSchemaOwnTopicComplete), {}
115
- )
116
- )
117
- )
80
+ <%- include(storedCacheTemplate, {tableName:tableName,flowSchemaComplete:flowSchemaComplete}) %>
81
+
82
+ <% } else if (statusType === "triggerCache") { %>
83
+ <%- include(triggerCacheTemplate, {
84
+ tableName: tableName,
85
+ flowSchemaComplete: flowSchemaComplete,
86
+ triggerType: triggerType
87
+ }) %>
118
88
  <% } %>
119
89
 
90
+
120
91
  //(<endpointHook>)
121
92
  //(</endpointHook>)
122
93
 
123
- return {
124
- //(<endpointReturn>)
125
- //(</endpointReturn>)
126
- }
127
94
  } catch (err) {
128
95
  _izContext.logger.error('error WebSocketInvoke: ', err)
129
96
  throw (err)
@@ -76,17 +76,7 @@ module.exports.<%- functionName %> = async (
76
76
 
77
77
  //(<endpointHook>)
78
78
  //(</endpointHook>)
79
- const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
80
- flowTag: "<%- flowTag %>",
81
- serviceTag: process.env.iz_serviceTag
82
- })
83
- //(<beforeReturn>)
84
- //(</beforeReturn>)
85
79
 
86
- return {
87
- //(<endpointReturn>)
88
- //(</endpointReturn>)
89
- }
90
80
  } catch (err) {
91
81
  _izContext.logger.error('error WebSocketInvoke: ', err)
92
82
  throw (err)
@@ -50,7 +50,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
50
50
  queueName
51
51
  },
52
52
  setting: {
53
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
53
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
54
54
  saveFileName: `${functionName}_${handlerType}`,
55
55
  fileExtension: ".js",
56
56
  isAppend: false
@@ -73,7 +73,7 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
73
73
  triggerType
74
74
  },
75
75
  setting: {
76
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
76
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
77
77
  saveFileName: `${functionName}_Main`,
78
78
  fileExtension: ".js",
79
79
  isAppend: false
@@ -71,16 +71,8 @@ module.exports.<%- functionName %> = async (
71
71
  _izContext.logger.debug("<%- functionName %> requestParams", requestParams)
72
72
  _izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
73
73
 
74
- _izContext.correlationIds.get(consts.X_CORRELATION_ID)
75
- _izContext.correlationIds.get(consts.CONNECTION_ID);
76
-
77
- const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
78
- flowTag: "<%- flowTag %>",
79
- serviceTag: process.env.iz_serviceTag
80
- })
81
-
82
- //(<endpointHookMainFunction>)
83
- //(</endpointHookMainFunction>)
74
+ //(<beforeCheckStatus>)
75
+ //(</beforeCheckStatus>)
84
76
 
85
77
  <% if (statusType === "statusField") { %>
86
78
  <%- include(statusFieldTemplate) %>
@@ -99,10 +91,6 @@ module.exports.<%- functionName %> = async (
99
91
  //(<endpointHook>)
100
92
  //(</endpointHook>)
101
93
 
102
- return {
103
- //(<endpointReturn>)
104
- //(</endpointReturn>)
105
- }
106
94
  } catch (err) {
107
95
  _izContext.logger.error('error WebSocketInvoke: ', err)
108
96
  throw (err)
@@ -67,7 +67,8 @@ module.exports.<%- functionName %> = async (
67
67
 
68
68
  let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
69
69
  flowTag: "<%- flowTag %>",
70
- serviceTag: process.env.iz_serviceTag
70
+ serviceTag: process.env.iz_serviceTag,
71
+ process.env.iz_serviceSchemaBucketName
71
72
  })
72
73
 
73
74
  _izContext.logger.debug("flowSchema", flowSchema)