@izara_project/izara-market-library-service-schemas 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +2 -1
- package/src/MainLibs/src/Consts.js +8 -8
- package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
- package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/generateTemplateData.js +35 -20
- package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/data.js +84 -0
- package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/tempReferenceRelationshipSchema.ejs +9 -0
- package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/relationshipSchema/data.js +1 -1
- package/src/reStructure/SchemaConfig.js +1 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +701 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +34 -162
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +2 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +3 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +2 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +38 -12
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +5 -2
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +22 -14
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +4 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +68 -33
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +12 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +13 -8
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +16 -13
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/template.ejs +9 -9
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +7 -9
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/dynamoDB/register.js +82 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs +34 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +10 -33
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +5 -5
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +6 -6
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +26 -4
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +7 -8
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +118 -16
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +83 -44
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +4 -5
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -7
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +2 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +2 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +31 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +7 -8
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template.ejs +13 -13
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +44 -69
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +4 -6
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +2 -9
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +40 -87
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +5 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +2 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +17 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +6 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +49 -84
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +55 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +20 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +24 -33
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +20 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +1 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/data.js +5 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/template.ejs +7 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +6 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/template.ejs +0 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +8 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +17 -11
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +14 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +4 -1
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +50 -42
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +3 -2
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +3 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +9 -8
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +5 -1
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +1 -0
- package/src/reStructure/TemplateData/{propertyNodeSchema → propertyValueSchema}/generateTemplateData.js +4 -4
- package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +131 -0
- package/src/reStructure/TemplateData/{propertyNodeSchema/relationshipPropertyNodeSchema → propertyValueSchema/relationshipPropertyValueSchema}/data.js +32 -55
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/tempRelationship.ejs +13 -0
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/templateRelationshipPropertyValueSchema.ejs +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +5 -5
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +5 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +4 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/template.ejs +1 -3
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +61 -0
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +13 -4
- package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/data.js +0 -151
- package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/templateRelationshipPropertyNodeSchema.ejs +0 -7
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/attributeLinkTemplate.ejs +0 -0
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/data.js +0 -0
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/request.json +0 -0
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/relationshipSchema/template.ejs +0 -0
- /package/src/reStructure/TemplateData/{propertyNodeSchema/objectPropertyNodeSchema/templateObjectPropertyNodeSchema.ejs → propertyValueSchema/objectPropertyValueSchema/templateObjectPropertyValueSchema.ejs} +0 -0
|
@@ -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
|
|
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
|
-
|
|
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, "./
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
let
|
|
41
|
+
|
|
42
|
+
let objectSchema = await objectschemaLocalByPath.getObjSchemaS3(
|
|
44
43
|
_izContext,
|
|
45
|
-
|
|
44
|
+
settings.objType
|
|
46
45
|
);
|
|
47
46
|
|
|
48
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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.
|
|
90
|
-
hookPath: path.join(srcPath, "schemaHook", "
|
|
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}
|
|
117
|
-
relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(objectType) +
|
|
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: "
|
|
99
|
+
linkType: "one",
|
|
123
100
|
requiredOnCreate: false
|
|
124
101
|
},
|
|
125
102
|
{
|
|
126
103
|
serviceTag: serviceTag,
|
|
127
|
-
objectType: upperCase(objectType) +
|
|
104
|
+
objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
|
|
128
105
|
linkType: "many",
|
|
129
|
-
requiredOnCreate:
|
|
106
|
+
requiredOnCreate: true
|
|
130
107
|
},
|
|
131
108
|
storageResources,
|
|
132
109
|
"from"
|
|
133
110
|
)
|
|
134
111
|
},
|
|
135
|
-
// disabled{objectType}
|
|
112
|
+
// disabled{objectType}propertyValue
|
|
136
113
|
{
|
|
137
|
-
relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) +
|
|
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: "
|
|
119
|
+
linkType: "one",
|
|
143
120
|
requiredOnCreate: false
|
|
144
121
|
},
|
|
145
122
|
{
|
|
146
123
|
serviceTag: serviceTag,
|
|
147
|
-
objectType: upperCase(objectType) +
|
|
124
|
+
objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
|
|
148
125
|
linkType: "many",
|
|
149
|
-
requiredOnCreate:
|
|
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) +
|
|
134
|
+
relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + PROPERTYVALUE_TAG.propertyLabel,
|
|
158
135
|
relationshipProperties: createBasicRelationshipsProperties(
|
|
159
136
|
{
|
|
160
137
|
serviceTag: serviceTag,
|
|
161
|
-
objectType: upperCase(objectType) +
|
|
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) +
|
|
168
|
-
linkType: "
|
|
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
|
+
]
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs
CHANGED
|
@@ -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
|
*
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs
CHANGED
|
@@ -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,
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs
CHANGED
|
@@ -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
|
*
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs
CHANGED
|
@@ -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
|
|
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
|
-
"
|
|
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
|
-
|
|
102
|
-
"
|
|
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,
|
|
122
|
+
Logger.error('Unhandled Error, deleteRelationshipComplete: ', err);
|
|
123
123
|
throw (err);
|
|
124
124
|
}
|
|
125
125
|
});
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
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
|
|
116
|
+
_izContext.logger.debug("Send message to OutdeleteRelationshipComplete :::>", sendMessageToOutDeleteRelatonshipComplete);
|
|
116
117
|
await sns.publishAsync(_izContext, sendMessageToOutDeleteRelatonshipComplete);
|
|
117
118
|
|
|
118
119
|
|
package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs
CHANGED
|
@@ -53,7 +53,8 @@ const {
|
|
|
53
53
|
TOPIC_NAME_GENERATE_CODE,
|
|
54
54
|
TOPIC_NAME_GRAPH_HANDLER
|
|
55
55
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
56
|
-
|
|
56
|
+
//(<optionalRequire>)
|
|
57
|
+
//(</optionalRequire>)
|
|
57
58
|
/**
|
|
58
59
|
* update relationship endpoint
|
|
59
60
|
*
|
package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs
CHANGED
|
@@ -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
|
|
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
|
-
"
|
|
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
|
-
|
|
102
|
-
"
|
|
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');
|
package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
49
|
+
_izContext.logger.debug("Function:getRelationshipComplete", {
|
|
49
50
|
returnValue: returnValue,
|
|
50
51
|
status: status,
|
|
51
52
|
errorsFound: errorsFound,
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs
CHANGED
|
@@ -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
|
*
|
package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs
CHANGED
|
@@ -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){
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
const path = require("path")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// const {
|
|
24
|
+
// HANDLER,
|
|
25
|
+
// STORAGE_TYPES
|
|
26
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
+
|
|
28
|
+
const STORAGE_TYPES = {
|
|
29
|
+
dynamoDB: "dynamoDB",
|
|
30
|
+
graph: "graph"
|
|
31
|
+
}
|
|
32
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts')
|
|
33
|
+
const { firstUpperCase: upperCase } = require('../../../../MainLibs/src/Utils')
|
|
34
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
35
|
+
const { NoRetryError } = require("@izara_project/izara-core-library-core");
|
|
36
|
+
|
|
37
|
+
async function filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath) {
|
|
38
|
+
let tableNamesToFilter = new Set();
|
|
39
|
+
const allLocalFlowSchema = await getObjectSchema.getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
40
|
+
for (const flowSchema of allLocalFlowSchema.records) {
|
|
41
|
+
if (flowSchema.statusType === "storedCache") {
|
|
42
|
+
const objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objSchemaPath).then(res => res.records[0])
|
|
43
|
+
if (objectSchema) {
|
|
44
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
45
|
+
tableNamesToFilter.add(storageResource.tableName);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
throw new NoRetryError('not have objectSchema in service to get')
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const filteredCreateSourceParams = createSourceParams.filter(
|
|
54
|
+
(result) => !tableNamesToFilter.has(result.templateData.tableName)
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
// console.log("filteredCreateSourceParams", filteredCreateSourceParams)
|
|
58
|
+
return filteredCreateSourceParams
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = filterCreateResourceYaml;
|
|
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
const { join } = require('path');
|
|
21
21
|
|
|
22
22
|
// lib of generateCode
|
|
23
|
-
const { checkValidTableYaml } = require('../../../MainLibs/
|
|
23
|
+
const { checkValidTableYaml } = require('../../../MainLibs/src/GenerateCodeUtils.js');
|
|
24
24
|
|
|
25
25
|
const {
|
|
26
26
|
getAllLocalObjectSchemasWithHierarchy,
|
|
@@ -37,6 +37,8 @@ const createDefaultSnsOutForFindDataAndProcessLogical = require('./sns-out/defau
|
|
|
37
37
|
const createDataForCreateSourceSnsOut = require('./sns-out/data');
|
|
38
38
|
const createFindDataAndProcessLogicalDefaultSnsInSqs = require('./sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical');
|
|
39
39
|
const createDynamoPerRelationshipLink = require('./dynamodb/generateDynamoPerLink.js')
|
|
40
|
+
const filterCreateResourceYaml = require('./filterGenerateResource/data.js');
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* Generates code from templates based on object schemas
|
|
42
44
|
* @param {Object} _izContext - Context object
|
|
@@ -48,7 +50,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
48
50
|
const saveFilePath = join(objSchemaPath, '../');
|
|
49
51
|
const allObjSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
50
52
|
const allLocalRelationshipSchema = getAllLocalRelationshipSchema(_izContext, objSchemaPath);
|
|
51
|
-
|
|
53
|
+
const allLocalFlowSchema = await getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
54
|
+
|
|
52
55
|
let createSourceParams = [];
|
|
53
56
|
let createdTableYaml = {}; // Declare createdTableYaml
|
|
54
57
|
|
|
@@ -56,9 +59,12 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
56
59
|
if (allObjSchemas && allObjSchemas.records) {
|
|
57
60
|
for (const objectSchema of allObjSchemas.records) {
|
|
58
61
|
try {
|
|
62
|
+
|
|
63
|
+
let createSourceDynamoDb = createSourceDataDynamoDB(_izContext, objectSchema, saveFilePath)
|
|
64
|
+
|
|
59
65
|
const [dynamoResources, updatedTableYaml] = checkValidTableYaml(
|
|
60
66
|
_izContext,
|
|
61
|
-
|
|
67
|
+
createSourceDynamoDb,
|
|
62
68
|
createdTableYaml
|
|
63
69
|
);
|
|
64
70
|
|
|
@@ -91,8 +97,11 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
91
97
|
...dynamoDbResourcePerRelationshipLink
|
|
92
98
|
)
|
|
93
99
|
}
|
|
100
|
+
const filteredCreateSourceParams = await filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath);
|
|
101
|
+
|
|
102
|
+
// console.log("filteredCreateSourceParams", filteredCreateSourceParams);
|
|
94
103
|
|
|
95
|
-
return
|
|
104
|
+
return filteredCreateSourceParams;
|
|
96
105
|
} catch (error) {
|
|
97
106
|
_izContext.logger.error('Error generating code with template resourceYaml: ', error);
|
|
98
107
|
return [];
|