@izara_project/izara-market-library-service-schemas 1.0.35 → 1.0.37

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 (139) hide show
  1. package/package.json +8 -7
  2. package/src/GenerateCodeLibs/src/Consts.js +2 -2
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +3 -2
  4. package/src/MainLibs/src/Consts.js +8 -8
  5. package/src/MainLibs/src/GenerateCodeUtils.js +3 -1
  6. package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/generateTemplateData.js +35 -20
  7. package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/data.js +84 -0
  8. package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/tempReferenceRelationshipSchema.ejs +9 -0
  9. package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/relationshipSchema/data.js +1 -1
  10. package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
  11. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
  12. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
  13. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
  14. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
  15. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
  16. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
  17. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +1 -1
  18. package/src/reStructure/SchemaConfig.js +1 -4
  19. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +701 -0
  20. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +35 -163
  21. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +3 -1
  22. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +3 -4
  23. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -1
  24. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +45 -19
  25. package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +5 -2
  26. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +24 -14
  27. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +4 -1
  28. package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
  29. package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
  30. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
  31. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +69 -34
  32. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
  33. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
  34. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
  35. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -2
  36. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
  37. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +10 -7
  38. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
  39. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +1 -1
  40. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
  41. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +12 -4
  42. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +14 -9
  43. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
  44. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +16 -40
  45. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/template.ejs +9 -9
  46. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/data.js +1 -1
  47. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/data.js +3 -3
  48. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +78 -27
  49. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/dynamoDB/register.js +82 -0
  50. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/data.js +1 -1
  51. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs +34 -1
  52. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +9 -32
  53. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +30 -20
  54. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +6 -6
  55. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +32 -32
  56. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +5 -5
  57. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +8 -9
  58. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +116 -26
  59. package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +83 -44
  60. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +4 -5
  61. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -7
  62. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +6 -4
  63. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +2 -4
  64. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +31 -3
  65. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +4 -4
  66. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +7 -8
  67. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template.ejs +13 -13
  68. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +4 -4
  69. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +43 -39
  70. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +5 -7
  71. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +2 -2
  72. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +2 -9
  73. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +46 -48
  74. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +5 -4
  75. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +3 -11
  76. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +17 -3
  77. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +2 -2
  78. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +6 -2
  79. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +49 -84
  80. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +60 -10
  81. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -1
  82. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +7 -3
  83. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +1 -1
  84. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +22 -7
  85. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +27 -34
  86. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +21 -5
  87. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +1 -3
  88. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/data.js +2 -2
  89. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/template.ejs +5 -5
  90. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/data.js +5 -3
  91. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/template.ejs +10 -6
  92. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +6 -3
  93. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/template.ejs +0 -2
  94. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +2 -2
  95. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +4 -4
  96. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +8 -3
  97. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +21 -14
  98. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +23 -8
  99. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +11 -6
  100. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +50 -45
  101. package/src/reStructure/TemplateData/generateRole/createSharedResource.js +3 -2
  102. package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +2 -28
  103. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
  104. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +10 -9
  105. package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +6 -2
  106. package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -2
  107. package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -2
  108. package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
  109. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
  110. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
  111. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -1
  112. package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +1 -0
  113. package/src/reStructure/TemplateData/{propertyNodeSchema → propertyValueSchema}/generateTemplateData.js +4 -4
  114. package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +131 -0
  115. package/src/reStructure/TemplateData/{propertyNodeSchema/relationshipPropertyNodeSchema → propertyValueSchema/relationshipPropertyValueSchema}/data.js +32 -55
  116. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/tempRelationship.ejs +13 -0
  117. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/templateRelationshipPropertyValueSchema.ejs +7 -0
  118. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +3 -2
  119. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +3 -2
  120. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +3 -2
  121. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +5 -5
  122. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +6 -5
  123. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +3 -3
  124. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +4 -4
  125. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +5 -4
  126. package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +3 -2
  127. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +3 -2
  128. package/src/reStructure/TemplateData/resourceYaml/dynamodb/template.ejs +1 -3
  129. package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +61 -0
  130. package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +13 -4
  131. package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/data.js +0 -151
  132. package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/templateRelationshipPropertyNodeSchema.ejs +0 -7
  133. package/src/reStructure/TemplateData/testTemplate/data.js +0 -27
  134. package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
  135. /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/attributeLinkTemplate.ejs +0 -0
  136. /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/data.js +0 -0
  137. /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/request.json +0 -0
  138. /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/relationshipSchema/template.ejs +0 -0
  139. /package/src/reStructure/TemplateData/{propertyNodeSchema/objectPropertyNodeSchema/templateObjectPropertyNodeSchema.ejs → propertyValueSchema/objectPropertyValueSchema/templateObjectPropertyValueSchema.ejs} +0 -0
@@ -18,13 +18,13 @@ 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 PropertySchema");
21
+ console.log("generate main PropertyValue Schema");
22
22
  const { join } = require('path');
23
23
 
24
24
 
25
25
  const modules = {
26
- objectPropertyNodeSchema: require('@izara_project/izara-market-library-service-schemas/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/data'),
27
- relationshipPropertyNodeSchema: require('@izara_project/izara-market-library-service-schemas/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/data')
26
+ objectPropertyNodeSchema: require('./objectPropertyValueSchema/data'),
27
+ relationshipPropertyNodeSchema: require('./relationshipPropertyValueSchema/data')
28
28
  };
29
29
  /**
30
30
  * Generates code with templates for different actions
@@ -37,7 +37,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath, settings) {
37
37
  let allCreateSource = [];
38
38
  const srcPath = join(objSchemaPath, '../');
39
39
 
40
- if (settings.generateName === "propertyNode") {
40
+ if (settings.generateName === "propertyValue") {
41
41
  let objSchemaPropertyNode = await modules.objectPropertyNodeSchema(
42
42
  _izContext,
43
43
  settings,
@@ -0,0 +1,131 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ console.log("=== property value schema ===");
21
+
22
+ const path = require('path');
23
+ const fs = require('fs');
24
+ const {
25
+ SOURCE_PATH,
26
+ fieldNameSetting,
27
+ FIELD_NAME_TPYE,
28
+ PROPERTYVALUE_TAG,
29
+ SAVE_FILE_NAME
30
+ } = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
31
+
32
+ const templatePath = path.join(__dirname, "./templateObjectPropertyValueSchema.ejs");
33
+
34
+ const modules = {
35
+ validateAddOnDataStructure: require('../../../libs/ValidateAddOnDataStructure')
36
+ };
37
+ const yaml = require("yaml")
38
+ const objectschemaLocalByPath = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
39
+ const Consts = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts')
40
+ // const objectSchemasBySrc = srcPath
41
+
42
+
43
+ async function data(_izContext, settings, srcPath) {
44
+
45
+ let objectSchema = await objectschemaLocalByPath.getObjSchemaS3(
46
+ _izContext,
47
+ settings.objType
48
+ );
49
+ _izContext.logger.debug("objectSchema objectSchema::", objectSchema)
50
+
51
+ if (!objectSchema) {
52
+ throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
53
+ };
54
+
55
+ let propertyValueObjectSchemas = [];
56
+ let createSources = [];
57
+
58
+ let objectType = settings.objType.objectType;
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:${objectType}`);
63
+ throw Error(`Not have data in addOnDataStructure in objectType:${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: objectType + PROPERTYVALUE_TAG.property,
74
+ fieldNames: {
75
+ [objectType + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
76
+ },
77
+ identifiers: [
78
+ {
79
+ type: "identifier",
80
+ fieldName: objectType + PROPERTYVALUE_TAG.property + "Id"
81
+ }
82
+ ]
83
+ },
84
+ { // {subject}propertyLabel
85
+ objectType: objectType + PROPERTYVALUE_TAG.propertyLabel,
86
+ fieldNames: {
87
+ [objectType + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
88
+ },
89
+ identifiers: [
90
+ {
91
+ type: "identifier",
92
+ fieldName: objectType + PROPERTYVALUE_TAG.propertyLabel + "Id"
93
+ }
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
123
+ }
124
+ })
125
+ };
126
+ return createSources;
127
+
128
+ };//End loop addOn
129
+
130
+
131
+ module.exports = data
@@ -17,67 +17,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- console.log("=== relationship property node schema ===");
20
+ console.log("=== relationship property value schema ===");
21
21
 
22
22
  const path = require('path');
23
23
  const fs = require('fs');
24
24
  const {
25
25
  SOURCE_PATH,
26
26
  PREFIX_RELATIONSHIP,
27
- PROPERTYNODE_TAG,
27
+ PROPERTYVALUE_TAG,
28
28
  SAVE_FILE_NAME
29
29
  } = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
30
30
 
31
- const templatePath = path.join(__dirname, "./templateRelationshipPropertyNodeSchema.ejs");
32
-
31
+ const templatePath = path.join(__dirname, "./tempRelationship.ejs");
33
32
  const yaml = require("yaml")
33
+
34
34
  const objectschemaLocalByPath = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
35
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
36
- const Consts = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
35
+
37
36
  const { firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
38
37
  const { createBasicRelationshipsProperties } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
39
38
 
40
39
  async function data(_izContext, settings, srcPath) {
41
40
 
42
- let objectSchemaPath = path.join(srcPath, "schemas")
43
- let allObjectSchemas = await objectschemaLocalByPath.getAllLocalObjectSchemas(
41
+
42
+ let objectSchema = await objectschemaLocalByPath.getObjSchemaS3(
44
43
  _izContext,
45
- objectSchemaPath
44
+ settings.objType
46
45
  );
47
46
 
48
- let createSourceRecords = [];
49
-
50
- if (allObjectSchemas.records.length == 0) {
47
+ if (!objectSchema) {
51
48
  throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
52
49
  };
53
- nextObjectSchema:
54
- for (const objectSchema of allObjectSchemas.records) {
55
50
 
56
- // validate only addOnndataStructure is type propertyNode.
57
- if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
58
- console.log("Not have data in addOnDataStructure ,continute nextObjectSchema")
59
- continue
60
- };
61
51
 
62
- for (let eachAddOnDataStructure of objectSchema.addOnDataStructure) {
63
52
 
64
- if (eachAddOnDataStructure.type !== Consts.ADD_ON_DATA_STRUCTURE_TYPE.propertyNode) {
65
- console.log("continute,AddOnDataStructure not type propertyNode")
66
- continue
67
- };
68
-
69
- let generateRelationships = createSourceParams(
70
- _izContext,
71
- objectSchema,
72
- srcPath
73
- );
74
- console.log("generateRelationship", generateRelationships);
75
-
76
- createSourceRecords.push(...generateRelationships);
77
-
78
- };//End loop addOn
79
- }; //End loop objectSchema
80
- console.log("createSourceRecords: ", createSourceRecords);
53
+ let createSourceRecords = []
54
+ let generateRelationships = createSourceParams(
55
+ _izContext,
56
+ objectSchema,
57
+ srcPath
58
+ );
59
+ createSourceRecords.push(...generateRelationships);
81
60
 
82
61
  if (createSourceRecords.length) {
83
62
  return {
@@ -86,12 +65,11 @@ async function data(_izContext, settings, srcPath) {
86
65
  datas: createSourceRecords
87
66
  },
88
67
  setting: {
89
- savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyNode),
90
- hookPath: path.join(srcPath, "schemaHook", "propertyNode", "/"),
68
+ savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyValue),
69
+ hookPath: path.join(srcPath, "schemaHook", "propertyValue", "/"),
91
70
  saveFileName: SAVE_FILE_NAME.objectRelationship,
92
71
  fileExtension: ".js",
93
72
  isAppend: false,
94
- // encloseTemplate: "\n ]",
95
73
  }
96
74
  }
97
75
  };
@@ -111,42 +89,41 @@ function createSourceParams(
111
89
  const config = yaml.parse(serverlessConfig);
112
90
  const serviceTag = config.main_config.iz_serviceTag;
113
91
 
114
-
115
92
  attributeRelationships.push(
116
- { // has{objectType}property
117
- relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(objectType) + PROPERTYNODE_TAG.property,
93
+ { // has{objectType}propertyValue
94
+ relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(objectType) + PROPERTYVALUE_TAG.property,
118
95
  relationshipProperties: createBasicRelationshipsProperties(
119
96
  {
120
97
  serviceTag: serviceTag,
121
98
  objectType: objectType,
122
- linkType: "many",
99
+ linkType: "one",
123
100
  requiredOnCreate: false
124
101
  },
125
102
  {
126
103
  serviceTag: serviceTag,
127
- objectType: upperCase(objectType) + PROPERTYNODE_TAG.property,
104
+ objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
128
105
  linkType: "many",
129
- requiredOnCreate: false
106
+ requiredOnCreate: true
130
107
  },
131
108
  storageResources,
132
109
  "from"
133
110
  )
134
111
  },
135
- // disabled{objectType}property
112
+ // disabled{objectType}propertyValue
136
113
  {
137
- relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + PROPERTYNODE_TAG.property,
114
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + PROPERTYVALUE_TAG.property,
138
115
  relationshipProperties: createBasicRelationshipsProperties(
139
116
  {
140
117
  serviceTag: serviceTag,
141
118
  objectType: objectType,
142
- linkType: "many",
119
+ linkType: "one",
143
120
  requiredOnCreate: false
144
121
  },
145
122
  {
146
123
  serviceTag: serviceTag,
147
- objectType: upperCase(objectType) + PROPERTYNODE_TAG.property,
124
+ objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
148
125
  linkType: "many",
149
- requiredOnCreate: false
126
+ requiredOnCreate: true
150
127
  },
151
128
  storageResources,
152
129
  "from"
@@ -154,18 +131,18 @@ function createSourceParams(
154
131
  },
155
132
 
156
133
  { // is{objectType}PropertyLabel
157
- relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + PROPERTYNODE_TAG.propertyLabel,
134
+ relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + PROPERTYVALUE_TAG.propertyLabel,
158
135
  relationshipProperties: createBasicRelationshipsProperties(
159
136
  {
160
137
  serviceTag: serviceTag,
161
- objectType: upperCase(objectType) + PROPERTYNODE_TAG.property,
138
+ objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
162
139
  linkType: "many",
163
140
  requiredOnCreate: true
164
141
  },
165
142
  {
166
143
  serviceTag: serviceTag,
167
- objectType: upperCase(objectType) + PROPERTYNODE_TAG.propertyLabel,
168
- linkType: "many",
144
+ objectType: upperCase(objectType) + PROPERTYVALUE_TAG.propertyLabel,
145
+ linkType: "one",
169
146
  requiredOnCreate: false
170
147
  },
171
148
  storageResources,
@@ -0,0 +1,13 @@
1
+ module.exports = [
2
+ <%datas.forEach(data=> {%>
3
+ {
4
+ <%- data.relationshipTag %>: {
5
+ fieldNames:{
6
+ //(<fieldNames>)
7
+ //(<fieldNames>)
8
+ },
9
+ storageResources:<%- JSON.stringify(data.relationshipProperties.storageResources,null,2) %>,
10
+ links:<%- JSON.stringify(data.relationshipProperties.links,null,2) %>,
11
+ }
12
+ },<%})%>
13
+ ]
@@ -0,0 +1,7 @@
1
+ module.exports = [
2
+ <%datas.forEach(data=> {%>
3
+ {
4
+ <%- data.relationshipTag %>: <%- JSON.stringify(data.relationshipProperties,null,2) %>
5
+ },
6
+ <%})%>
7
+ ]
@@ -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
- const hash = require("object-hash");
20
+ const hash = require('@izara_project/izara-shared-core').objectHash;
21
21
 
22
22
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
23
23
  const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
@@ -54,7 +54,8 @@ const {
54
54
  TOPIC_NAME_GENERATE_CODE,
55
55
  TOPIC_NAME_GRAPH_HANDLER
56
56
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
57
-
57
+ //(<optionalRequire>)
58
+ //(</optionalRequire>)
58
59
  /**
59
60
  * update relationship endpoint
60
61
  *
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
22
22
  const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
@@ -34,7 +34,8 @@ const {
34
34
  TOPIC_NAME_GRAPH_HANDLER,
35
35
  PREFIX
36
36
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
37
-
37
+ //(<optionalRequire>)
38
+ //(</optionalRequire>)
38
39
  module.exports.createRelationshipComplete = async (
39
40
  _izContext,
40
41
  returnValue,
@@ -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
- const hash = require("object-hash");
20
+ const hash = require('@izara_project/izara-shared-core').objectHash;
21
21
 
22
22
 
23
23
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
@@ -51,7 +51,8 @@ const {
51
51
  TOPIC_NAME_GENERATE_CODE,
52
52
  TOPIC_NAME_GRAPH_HANDLER
53
53
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
54
-
54
+ //(<optionalRequire>)
55
+ //(</optionalRequire>)
55
56
  /**
56
57
  * update relationship endpoint
57
58
  *
@@ -26,7 +26,7 @@ const izaraShared = require('@izara_project/izara-shared');
26
26
  const recordHandlerSharedLib = izaraShared.recordHandlerSharedLib
27
27
  const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
28
28
 
29
- const createRelationshipComplete = require('./CreateRelationshipComplete_Main');
29
+ const deleteRelationshipComplete = require('./DeleteRelationshipComplete_Main');
30
30
  const Logger = require('@izara_project/izara-core-library-logger');
31
31
  // validate event properties in body.Message of sqs event
32
32
  middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
@@ -82,7 +82,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
82
82
  //validate message (and MessageAttributes)
83
83
  await recordHandlerSharedLib.validateRecord(
84
84
  record, // one record will send to mainFunction
85
- "CreateRelationshipComplete", // queue name that need to retry or send to dlq
85
+ "DeleteRelationshipComplete", // queue name that need to retry or send to dlq
86
86
  perRecordsValidatorSchema, // schema for record.Message
87
87
  // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
88
88
  );
@@ -98,8 +98,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
98
98
  // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
99
99
  let recordPromise = recordHandlerSharedLib.recordHandler(
100
100
  record, // one record will send to mainFunction
101
- createRelationshipComplete.createRelationshipComplete, // mainFunction that need to invoke.
102
- "CreateRelationshipComplete", // queue name that need to retry or send to dlq
101
+ deleteRelationshipComplete.deleteRelationshipComplete, // mainFunction that need to invoke.
102
+ "DeleteRelationshipComplete", // queue name that need to retry or send to dlq
103
103
  passOnProperties, // all parameters that mainFunction needed.
104
104
  );
105
105
  record._izContext.logger.debug('after recordPromise in handler');
@@ -119,7 +119,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
119
119
  Logger.debug('after Promise.all(recordPromises) in handler');
120
120
 
121
121
  } catch (err) {
122
- Logger.error('Unhandled Error, CreateRelationshipCompleteHdrSqs: ', err);
122
+ Logger.error('Unhandled Error, deleteRelationshipComplete: ', err);
123
123
  throw (err);
124
124
  }
125
125
  });
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const izaraShared = require('@izara_project/izara-shared');
22
22
  const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
@@ -35,8 +35,9 @@ const {
35
35
  TOPIC_NAME_GRAPH_HANDLER,
36
36
  PREFIX
37
37
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
38
-
39
- module.exports.createRelationshipComplete = async (
38
+ //(<optionalRequire>)
39
+ //(</optionalRequire>)
40
+ module.exports.deleteRelationshipComplete = async (
40
41
  _izContext,
41
42
  returnValue,
42
43
  status,
@@ -45,7 +46,7 @@ module.exports.createRelationshipComplete = async (
45
46
 
46
47
  ) => {
47
48
  try {
48
- _izContext.logger.debug("Function:createRelationshipComplete", {
49
+ _izContext.logger.debug("Function:deleteRelationshipComplete", {
49
50
  returnValue: returnValue,
50
51
  status: status,
51
52
  errorsFound: errorsFound,
@@ -112,7 +113,7 @@ module.exports.createRelationshipComplete = async (
112
113
  MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
113
114
  TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, TOPIC_NAME_GENERATE_CODE.outDeleteRelComplete)
114
115
  };
115
- _izContext.logger.debug("Send message to OutCreateRelationshipComplete :::>", sendMessageToOutDeleteRelatonshipComplete);
116
+ _izContext.logger.debug("Send message to OutdeleteRelationshipComplete :::>", sendMessageToOutDeleteRelatonshipComplete);
116
117
  await sns.publishAsync(_izContext, sendMessageToOutDeleteRelatonshipComplete);
117
118
 
118
119
 
@@ -17,8 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- const hash = require("object-hash");
21
-
20
+ const hash = require('@izara_project/izara-shared-core').objectHash;
22
21
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
23
22
  const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
24
23
  const snsSharedLib = require("@izara_project/izara-core-library-sns");
@@ -53,7 +52,8 @@ const {
53
52
  TOPIC_NAME_GENERATE_CODE,
54
53
  TOPIC_NAME_GRAPH_HANDLER
55
54
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
56
-
55
+ //(<optionalRequire>)
56
+ //(</optionalRequire>)
57
57
  /**
58
58
  * update relationship endpoint
59
59
  *
@@ -26,7 +26,7 @@ const izaraShared = require('@izara_project/izara-shared');
26
26
  const recordHandlerSharedLib = izaraShared.recordHandlerSharedLib
27
27
  const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
28
28
 
29
- const createRelationshipComplete = require('./CreateRelationshipComplete_Main');
29
+ const getRelationshipComplete = require('./GetRelationshipComplete_Main');
30
30
  const Logger = require('@izara_project/izara-core-library-logger');
31
31
  // validate event properties in body.Message of sqs event
32
32
  middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
@@ -82,7 +82,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
82
82
  //validate message (and MessageAttributes)
83
83
  await recordHandlerSharedLib.validateRecord(
84
84
  record, // one record will send to mainFunction
85
- "CreateRelationshipComplete", // queue name that need to retry or send to dlq
85
+ "GetRelationshipComplete", // queue name that need to retry or send to dlq
86
86
  perRecordsValidatorSchema, // schema for record.Message
87
87
  // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
88
88
  );
@@ -98,8 +98,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
98
98
  // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
99
99
  let recordPromise = recordHandlerSharedLib.recordHandler(
100
100
  record, // one record will send to mainFunction
101
- createRelationshipComplete.createRelationshipComplete, // mainFunction that need to invoke.
102
- "CreateRelationshipComplete", // queue name that need to retry or send to dlq
101
+ getRelationshipComplete.getRelationshipComplete, // mainFunction that need to invoke.
102
+ "GetRelationshipComplete", // queue name that need to retry or send to dlq
103
103
  passOnProperties, // all parameters that mainFunction needed.
104
104
  );
105
105
  record._izContext.logger.debug('after recordPromise in handler');
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const izaraShared = require('@izara_project/izara-shared');
22
22
  const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
@@ -35,8 +35,9 @@ const {
35
35
  TOPIC_NAME_GRAPH_HANDLER,
36
36
  PREFIX
37
37
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
38
-
39
- module.exports.createRelationshipComplete = async (
38
+ //(<optionalRequire>)
39
+ //(</optionalRequire>)
40
+ module.exports.getRelationshipComplete = async (
40
41
  _izContext,
41
42
  returnValue,
42
43
  status,
@@ -45,7 +46,7 @@ module.exports.createRelationshipComplete = async (
45
46
 
46
47
  ) => {
47
48
  try {
48
- _izContext.logger.debug("Function:createRelationshipComplete", {
49
+ _izContext.logger.debug("Function:getRelationshipComplete", {
49
50
  returnValue: returnValue,
50
51
  status: status,
51
52
  errorsFound: errorsFound,
@@ -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
- const hash = require("object-hash");
20
+ const hash = require('@izara_project/izara-shared-core').objectHash;
21
21
 
22
22
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
23
23
  const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
@@ -57,7 +57,8 @@ const {
57
57
  TOPIC_NAME_GRAPH_HANDLER,
58
58
  TOPIC_NAME_GENERATE_CODE
59
59
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
60
-
60
+ //(<optionalRequire>)
61
+ //(</optionalRequire>)
61
62
  /**
62
63
  * update relationship endpoint
63
64
  *
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const izaraShared = require('@izara_project/izara-shared');
22
22
  const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
@@ -35,7 +35,8 @@ const {
35
35
  TOPIC_NAME_GRAPH_HANDLER,
36
36
  TOPIC_NAME_GENERATE_CODE
37
37
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
38
-
38
+ //(<optionalRequire>)
39
+ //(</optionalRequire>)
39
40
  module.exports.updateRelationshipComplete = async (
40
41
  _izContext,
41
42
  returnValue,
@@ -2,6 +2,7 @@
2
2
  Type: "AWS::DynamoDB::Table"
3
3
  Properties:
4
4
  TableName: ${self:custom.iz_resourcePrefix}<%- tableName %>
5
+ BillingMode: PAY_PER_REQUEST
5
6
  AttributeDefinitions:
6
7
  <%_ attributes.forEach(attribute => { -%>
7
8
  - AttributeName: <%- attribute['AttributeName'] %>
@@ -18,9 +19,6 @@
18
19
  KeyType: RANGE
19
20
  <%_ } -%>
20
21
  <%_ }) _%>
21
- ProvisionedThroughput:
22
- ReadCapacityUnits: 1
23
- WriteCapacityUnits: 1
24
22
  #<#<%- firstLetterUpperCase(tableName) %>DynamoDbSetting#>
25
23
  #<#/<%- firstLetterUpperCase(tableName) %>DynamoDbSetting#>
26
24
  <%_ function firstLetterUpperCase(text){