@izara_project/izara-market-library-service-schemas 1.0.41 → 1.0.42

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 (88) hide show
  1. package/package.json +1 -1
  2. package/src/MainLibs/src/Consts.js +1 -1
  3. package/src/reStructure/GenerateSchema.js +6 -6
  4. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +20 -12
  5. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +23 -8
  6. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +28 -21
  7. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +0 -32
  8. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/data.js +1 -1
  9. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +1 -0
  10. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/template.ejs +1 -0
  11. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +1 -1
  12. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/template.ejs +1 -0
  13. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/template.ejs +1 -0
  14. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +5 -2
  15. package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +0 -20
  16. package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/data.js +7 -16
  17. package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/data.js +2 -2
  18. package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/template.ejs +0 -1
  19. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/functionYaml/data.js +112 -0
  20. package/src/reStructure/TemplateData/flowSchema/externalTopic/{functionYaml → Complete/functionYaml}/template.ejs +1 -0
  21. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/handler/data.js +93 -0
  22. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/mainFunction/data.js +61 -0
  23. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/mainFunction/template.ejs +96 -0
  24. package/src/reStructure/TemplateData/flowSchema/externalTopic/{functionYaml → Process/functionYaml}/data.js +20 -4
  25. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → externalTopic/Process}/functionYaml/template.ejs +1 -0
  26. package/src/reStructure/TemplateData/flowSchema/externalTopic/{handler → Process/handler}/data.js +3 -3
  27. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +87 -0
  28. package/src/reStructure/TemplateData/flowSchema/externalTopic/{mainFunction → Process/mainFunction}/data.js +2 -2
  29. package/src/reStructure/TemplateData/flowSchema/externalTopic/{mainFunction → Process/mainFunction}/template.ejs +2 -2
  30. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +14 -4
  31. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/sqsTemplate.ejs +52 -0
  32. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +1 -1
  33. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +4 -4
  34. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +1 -0
  35. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/data.js +1 -2
  36. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/template.ejs +1 -1
  37. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +5 -5
  38. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +5 -2
  39. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +1 -1
  40. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -0
  41. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +1 -1
  42. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +2 -0
  43. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +3 -2
  44. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +2 -2
  45. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +1 -1
  46. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +1 -1
  47. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +2 -2
  48. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +9 -21
  49. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/sqsTemplate.ejs +0 -10
  50. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +1 -1
  51. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/functionYaml/data.js +36 -23
  52. package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/template.ejs +20 -0
  53. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/handler/data.js +22 -18
  54. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/mainFunction/data.js +22 -18
  55. package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +90 -0
  56. package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +45 -0
  57. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +41 -25
  58. package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/data.js +1 -0
  59. package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/template.ejs +1 -0
  60. package/src/reStructure/TemplateData/flowSchema/register/complete/handler/data.js +0 -1
  61. package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +16 -17
  62. package/src/reStructure/TemplateData/flowSchema/register/dynamoDB/register.js +0 -17
  63. package/src/reStructure/TemplateData/flowSchema/register/sns-in/data.js +0 -1
  64. package/src/reStructure/TemplateData/flowSchema/register/subscriptionOutAll/data.js +1 -3
  65. package/src/reStructure/TemplateData/flowSchema/register/subscriptionOutAll/template.ejs +2 -2
  66. package/src/reStructure/TemplateData/flowSchema/register/wbs/functionYaml/data.js +0 -29
  67. package/src/reStructure/TemplateData/flowSchema/register/wbs/handler/data.js +0 -1
  68. package/src/reStructure/TemplateData/flowSchema/register/wbs/handler/template.ejs +0 -5
  69. package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +16 -15
  70. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +7 -1
  71. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +1 -1
  72. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/template.ejs +2 -1
  73. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/data.js +97 -0
  74. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/template.ejs +52 -0
  75. package/src/reStructure/TemplateData/perActionComplete/create/yaml/template.ejs +1 -0
  76. package/src/reStructure/TemplateData/perActionComplete/delete/yaml/template.ejs +1 -0
  77. package/src/reStructure/TemplateData/perActionComplete/get/yaml/template.ejs +1 -0
  78. package/src/reStructure/TemplateData/perActionComplete/update/yaml/template.ejs +1 -0
  79. package/src/reStructure/TemplateData/propertyValueSchema/generateTemplateData.js +18 -18
  80. package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +82 -79
  81. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +33 -37
  82. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs +1 -0
  83. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/template.ejs +1 -0
  84. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/template.ejs +1 -0
  85. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/template.ejs +1 -0
  86. /package/src/reStructure/TemplateData/flowSchema/externalTopic/{handler → Complete/handler}/template.ejs +0 -0
  87. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/handler/template.ejs +0 -0
  88. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/mainFunction/template.ejs +0 -0
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
 
20
20
  // Import required modules
21
- console.log("generate main PropertyValue Schema");
21
+ // console.log("generate main PropertyValue Schema");
22
22
  const { join } = require('path');
23
23
 
24
24
 
@@ -38,25 +38,25 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath, settings) {
38
38
  let allCreateSource = [];
39
39
  const srcPath = join(objSchemaPath, '../');
40
40
 
41
- if (settings.generateName === "propertyValue") {
42
- let objSchemaPropertyNode = await modules.objectPropertyNodeSchema(
43
- _izContext,
44
- settings,
45
- srcPath
46
- );
47
- allCreateSource.push(...objSchemaPropertyNode);
41
+ // if (settings.generateName === "propertyValue") {
42
+ let objSchemaPropertyNode = await modules.objectPropertyNodeSchema(
43
+ _izContext,
44
+ settings,
45
+ srcPath
46
+ );
47
+ allCreateSource.push(...objSchemaPropertyNode);
48
48
 
49
- let relationshipSchemaPropertyNode = await modules.relationshipPropertyNodeSchema(
50
- _izContext,
51
- settings,
52
- srcPath
53
- );
54
- allCreateSource.push(relationshipSchemaPropertyNode);
55
-
56
- } else {
57
- throw Error(`Generate propertyNode schema Invalid generateName:${settings.generateName} `);
58
- }
49
+ let relationshipSchemaPropertyNode = await modules.relationshipPropertyNodeSchema(
50
+ _izContext,
51
+ settings,
52
+ srcPath
53
+ );
54
+ allCreateSource.push(relationshipSchemaPropertyNode);
59
55
 
56
+ // } else {
57
+ // throw Error(`Generate propertyNode schema Invalid generateName:${settings.generateName} `);
58
+ // }
59
+ console.log("allCreateSource propertyValues", JSON.stringify(allCreateSource, null, 2))
60
60
  return allCreateSource;
61
61
  } catch (error) {
62
62
  _izContext.logger.error('Error generating code with template propertyNode schema:', error);
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- console.log("=== property value schema ===");
20
+ // console.log("=== property value schema ===");
21
21
 
22
22
  const path = require('path');
23
23
  const fs = require('fs');
@@ -39,89 +39,92 @@ const objectschemaLocalByPath = require('@izara_project/izara-core-library-servi
39
39
 
40
40
 
41
41
  async function data(_izContext, settings, srcPath) {
42
-
43
- let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
44
- _izContext,
45
- settings.objType.objectType,
46
- path.join(srcPath, "./schemas")
47
- ).then(res => res.records[0]);
48
- _izContext.logger.debug("objectSchema objectSchema::", objectSchema)
49
-
50
- if (!objectSchema) {
51
- throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
52
- };
53
-
54
42
  let propertyValueObjectSchemas = [];
55
43
  let createSources = [];
56
-
57
- // let objectType = settings.objType.objectType;
58
- let propertyValueTag = settings.propertyValueTag
59
- // validate only addOnndataStructure is type propertyNode.
60
-
61
- if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
62
- console.log(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`);
63
- throw Error(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`)
64
-
65
- };
66
-
67
- const storageResources = objectSchema.storageResources; // storageResource from main objectType
68
- const storageResourceTag = Object.keys(storageResources); // storage ResourceTag from main objectType
69
- const compositeKeyDeliminator = objectSchema.compositeKeyDeliminator;
70
-
71
- propertyValueObjectSchemas.push(
72
- { // {subject}property
73
- objectType: propertyValueTag + PROPERTYVALUE_TAG.property,
74
- fieldNames: {
75
- [propertyValueTag + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
76
- },
77
- identifiers: [
78
- {
79
- type: "identifier",
80
- fieldName: propertyValueTag + PROPERTYVALUE_TAG.property + "Id"
44
+ for (const settingPropertyNode of settings) {
45
+ if (settingPropertyNode.generateName === "propertyValue") {
46
+ let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
47
+ _izContext,
48
+ [settingPropertyNode.objType.objectType],
49
+ path.join(srcPath, "./schemas")
50
+ ).then(res => res.records[0]);
51
+ _izContext.logger.debug("objectSchema objectSchema::", objectSchema)
52
+
53
+ if (!objectSchema) {
54
+ throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
55
+ };
56
+
57
+
58
+ // let objectType = settings.objType.objectType;
59
+ let propertyValueTag = settingPropertyNode.propertyValueTag
60
+ // validate only addOnndataStructure is type propertyNode.
61
+
62
+ if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
63
+ // console.log(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`);
64
+ throw Error(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`)
65
+
66
+ };
67
+
68
+ const storageResources = objectSchema.storageResources; // storageResource from main objectType
69
+ const storageResourceTag = Object.keys(storageResources); // storage ResourceTag from main objectType
70
+ const compositeKeyDeliminator = objectSchema.compositeKeyDeliminator;
71
+
72
+ propertyValueObjectSchemas.push(
73
+ { // {subject}property
74
+ objectType: propertyValueTag + PROPERTYVALUE_TAG.property,
75
+ fieldNames: {
76
+ [propertyValueTag + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
77
+ },
78
+ identifiers: [
79
+ {
80
+ type: "identifier",
81
+ fieldName: propertyValueTag + PROPERTYVALUE_TAG.property + "Id"
82
+ }
83
+ ]
84
+ },
85
+ { // {subject}propertyLabel
86
+ objectType: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel,
87
+ fieldNames: {
88
+ [propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
89
+ },
90
+ identifiers: [
91
+ {
92
+ type: "identifier",
93
+ fieldName: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"
94
+ }
95
+ ]
81
96
  }
82
- ]
83
- },
84
- { // {subject}propertyLabel
85
- objectType: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel,
86
- fieldNames: {
87
- [propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
88
- },
89
- identifiers: [
90
- {
91
- type: "identifier",
92
- fieldName: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"
97
+ );
98
+
99
+ for (let propertyValueObjectSchema of propertyValueObjectSchemas) {
100
+ Object.assign(propertyValueObjectSchema, {
101
+ storageResources: storageResources, // add storageResources
102
+ compositeKeyDeliminator: compositeKeyDeliminator
103
+ })
104
+ for (let attributeTreeFieldName of Object.values(propertyValueObjectSchema.fieldNames)) {
105
+ Object.assign(attributeTreeFieldName, { storageResourceTags: storageResourceTag }) // add storageResourceTags for each fieldName
93
106
  }
94
- ]
95
- }
96
- );
97
-
98
- for (let propertyValueObjectSchema of propertyValueObjectSchemas) {
99
- Object.assign(propertyValueObjectSchema, {
100
- storageResources: storageResources, // add storageResources
101
- compositeKeyDeliminator: compositeKeyDeliminator
102
- })
103
- for (let attributeTreeFieldName of Object.values(propertyValueObjectSchema.fieldNames)) {
104
- Object.assign(attributeTreeFieldName, { storageResourceTags: storageResourceTag }) // add storageResourceTags for each fieldName
105
- }
106
- };
107
- for (const propertyValueObjectSchema of propertyValueObjectSchemas) {
108
- createSources.push({
109
- templatePath: templatePath,
110
- templateData: {
111
- fieldNames: JSON.stringify(propertyValueObjectSchema.fieldNames, null, 2),
112
- identifiers: JSON.stringify(propertyValueObjectSchema.identifiers, null, 2),
113
- objectType: propertyValueObjectSchema.objectType,
114
- storageResources: JSON.stringify(propertyValueObjectSchema.storageResources, null, 2),
115
- compositeKeyDeliminator: propertyValueObjectSchema.compositeKeyDeliminator
116
- },
117
- setting: {
118
- savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyValue, propertyValueObjectSchema.objectType + "/"),
119
- hookPath: path.join(srcPath, "schemaHook", "propertyValue", propertyValueObjectSchema.objectType, "/"),
120
- saveFileName: SAVE_FILE_NAME.objectSchema,
121
- fileExtension: ".js",
122
- isAppend: false
107
+ };
108
+ for (const propertyValueObjectSchema of propertyValueObjectSchemas) {
109
+ createSources.push({
110
+ templatePath: templatePath,
111
+ templateData: {
112
+ fieldNames: JSON.stringify(propertyValueObjectSchema.fieldNames, null, 2),
113
+ identifiers: JSON.stringify(propertyValueObjectSchema.identifiers, null, 2),
114
+ objectType: propertyValueObjectSchema.objectType,
115
+ storageResources: JSON.stringify(propertyValueObjectSchema.storageResources, null, 2),
116
+ compositeKeyDeliminator: propertyValueObjectSchema.compositeKeyDeliminator
117
+ },
118
+ setting: {
119
+ savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyValue, propertyValueObjectSchema.objectType + "/"),
120
+ hookPath: path.join(srcPath, "schemaHook", "propertyValue", propertyValueObjectSchema.objectType, "/"),
121
+ saveFileName: SAVE_FILE_NAME.objectSchema,
122
+ fileExtension: ".js",
123
+ isAppend: false
124
+ }
125
+ })
123
126
  }
124
- })
127
+ }
125
128
  };
126
129
  return createSources;
127
130
 
@@ -33,37 +33,38 @@ const objectschemaLocalByPath = require('@izara_project/izara-core-library-servi
33
33
  const { firstLetterUpperCase: upperCase, getLocalServiceTag } = require("../../../../MainLibs/src/Utils");
34
34
  const { createBasicRelationshipsProperties } = require('../../../../GenerateCodeLibs/src/GenerateCodeLibs');
35
35
  const { ADD_ON_DATA_STRUCTURE_TYPE } = require('../../../../TemplateManager/src/libs/Consts');
36
- async function data(_izContext, settings, srcPath) {
37
-
38
-
39
- let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
40
- _izContext,
41
- settings.objType.objectType,
42
- path.join(srcPath, "./schemas")
43
- ).then(res => res.records[0]);
44
-
45
- if (!objectSchema) {
46
- throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
47
- };
48
-
49
- // validate addOnData type PropertyValues
50
- let addOn = objectSchema.addOnDataStructure.find(addOn => {
51
- return addOn.type === ADD_ON_DATA_STRUCTURE_TYPE.propertyValue && objectSchema.objectType === settings.objType.objectType
52
- })
53
- console.log("addOn in generate Relationship", addOn)
54
- if (!addOn) {
55
- throw Error(`Invalid objType:${objTypeString(objType)}, not have setting for generate propertyValues`)
56
- }
57
36
 
37
+ async function data(_izContext, settings, srcPath) {
38
+ console.log("create Data function ::", { settings })
58
39
  let createSourceRecords = []
59
- let generateRelationships = createSourceParams(
60
- _izContext,
61
- objectSchema,
62
- settings,
63
- srcPath
64
- );
65
- createSourceRecords.push(...generateRelationships);
40
+ for (const settingPropertyValue of settings) {
41
+ let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
42
+ _izContext,
43
+ settingPropertyValue.objType.objectType,
44
+ path.join(srcPath, "./schemas")
45
+ ).then(res => res.records[0]);
46
+
47
+ if (!objectSchema) {
48
+ throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
49
+ };
50
+
51
+ // validate addOnData type PropertyValues
52
+ let addOn = objectSchema.addOnDataStructure.find(addOn => {
53
+ return addOn.type === ADD_ON_DATA_STRUCTURE_TYPE.propertyValue && objectSchema.objectType === settingPropertyValue.objType.objectType
54
+ })
55
+
56
+ if (!addOn) {
57
+ throw Error(`Invalid objType:${objTypeString(objType)}, not have setting for generate propertyValues`)
58
+ }
66
59
 
60
+ let generateRelationships = createSourceParams(
61
+ _izContext,
62
+ objectSchema,
63
+ settingPropertyValue,
64
+ srcPath
65
+ );
66
+ createSourceRecords.push(...generateRelationships);
67
+ }
67
68
  if (createSourceRecords.length) {
68
69
  return {
69
70
  templatePath: templatePath,
@@ -82,12 +83,7 @@ async function data(_izContext, settings, srcPath) {
82
83
  };
83
84
 
84
85
 
85
- function createSourceParams(
86
- _izContext,
87
- objectSchema,
88
- settings,
89
- srcPath
90
- ) {
86
+ function createSourceParams(_izContext, objectSchema, settings, srcPath) {
91
87
  const attributeRelationships = [];
92
88
  // const objectType = objectSchema.objectType; // main objectType
93
89
  let propertyValue = settings.propertyValueTag
@@ -100,7 +96,7 @@ function createSourceParams(
100
96
  relationshipProperties: createBasicRelationshipsProperties(
101
97
  {
102
98
  serviceTag: serviceTag,
103
- objectType: propertyValue,
99
+ objectType: objectSchema.objectType,
104
100
  linkType: "one",
105
101
  requiredOnCreate: false
106
102
  },
@@ -120,7 +116,7 @@ function createSourceParams(
120
116
  relationshipProperties: createBasicRelationshipsProperties(
121
117
  {
122
118
  serviceTag: serviceTag,
123
- objectType: propertyValue,
119
+ objectType: objectSchema.objectType,
124
120
  linkType: "one",
125
121
  requiredOnCreate: false
126
122
  },
@@ -128,7 +124,7 @@ function createSourceParams(
128
124
  serviceTag: serviceTag,
129
125
  objectType: propertyValue + PROPERTYVALUE_TAG.property,
130
126
  linkType: "many",
131
- requiredOnCreate: true
127
+ requiredOnCreate: false
132
128
  },
133
129
  storageResources,
134
130
  "from"
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>