@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
|
@@ -34,6 +34,7 @@ const utils = require('@izara_project/izara-market-library-service-schemas/src/M
|
|
|
34
34
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
35
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
36
36
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
37
|
+
const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
*
|
|
@@ -50,7 +51,7 @@ const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-librar
|
|
|
50
51
|
* @returns {object} description of return value
|
|
51
52
|
*/
|
|
52
53
|
|
|
53
|
-
module.exports
|
|
54
|
+
module.exports.<%- functionName %> = async (
|
|
54
55
|
_izContext,
|
|
55
56
|
requestParams,
|
|
56
57
|
callingFlowConfig = {},
|
|
@@ -59,9 +60,9 @@ module.exports.flowSchemaOwnTopic = async (
|
|
|
59
60
|
) => {
|
|
60
61
|
|
|
61
62
|
try {
|
|
62
|
-
_izContext.logger.debug("
|
|
63
|
-
_izContext.logger.debug("
|
|
64
|
-
_izContext.logger.debug("
|
|
63
|
+
_izContext.logger.debug("<%- functionName %> _izContext", _izContext)
|
|
64
|
+
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
65
|
+
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
65
66
|
|
|
66
67
|
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
67
68
|
flowTag: requestParams.action,
|
|
@@ -70,14 +71,19 @@ module.exports.flowSchemaOwnTopic = async (
|
|
|
70
71
|
|
|
71
72
|
_izContext.logger.debug("flowSchema", flowSchema)
|
|
72
73
|
|
|
74
|
+
let connectionId = _izContext.correlationIds.get(coreConsts.CONNECTION_ID);
|
|
73
75
|
|
|
74
76
|
if (!flowSchema) {
|
|
75
|
-
|
|
77
|
+
await postToConnection({
|
|
78
|
+
message: {
|
|
79
|
+
error: `flowTag not found ${requestParams.action}`
|
|
80
|
+
}
|
|
81
|
+
},connectionId)
|
|
82
|
+
throw new NoRetryError(`flowTag not found ${requestParams.action}`);
|
|
76
83
|
}
|
|
77
84
|
|
|
78
|
-
let messageObject =
|
|
79
|
-
|
|
80
|
-
}
|
|
85
|
+
let messageObject = requestParams
|
|
86
|
+
|
|
81
87
|
// create callingFlow
|
|
82
88
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
83
89
|
messageObject,
|
|
@@ -89,12 +95,12 @@ module.exports.flowSchemaOwnTopic = async (
|
|
|
89
95
|
)
|
|
90
96
|
)
|
|
91
97
|
|
|
92
|
-
let
|
|
98
|
+
let sendMessageToEndpoint = {
|
|
93
99
|
Message: JSON.stringify(messageObject),
|
|
94
100
|
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "<%- topicArn %>")
|
|
95
101
|
}
|
|
96
|
-
_izContext.logger.debug("
|
|
97
|
-
await sns.publishAsync(_izContext,
|
|
102
|
+
_izContext.logger.debug("sendMessageToEndpoint", sendMessageToEndpoint);
|
|
103
|
+
await sns.publishAsync(_izContext, sendMessageToEndpoint);
|
|
98
104
|
|
|
99
105
|
} catch (err) {
|
|
100
106
|
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
@@ -58,9 +58,15 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
58
58
|
|
|
59
59
|
// GCTpBasTestInPersonCreate => GCTpBas_Test_PersonCreate_In
|
|
60
60
|
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
61
|
+
let flowStepsIn = flowSteps[0];
|
|
62
|
+
let flowStepOut = flowSteps[1];
|
|
63
|
+
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
64
|
+
let splitFlowStepsOut = flowStepOut.split("_")
|
|
65
|
+
let topicIn = splitFlowStepsIn[3]
|
|
66
|
+
let topicOut = splitFlowStepsOut[3]
|
|
61
67
|
const generatedSnsTopicInForFlowSchema = [
|
|
62
68
|
{
|
|
63
|
-
queueName: upperCase(
|
|
69
|
+
queueName: upperCase(topicIn),
|
|
64
70
|
},
|
|
65
71
|
];
|
|
66
72
|
|
|
@@ -75,12 +81,9 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
75
81
|
|
|
76
82
|
let defaultDsqQueueDataList = [
|
|
77
83
|
{
|
|
78
|
-
queueName: upperCase(
|
|
79
|
-
subscribeTo:
|
|
80
|
-
}
|
|
81
|
-
// {
|
|
82
|
-
// queueName: upperCase(FUNCTION_NAME.flowSchemaOwnTopicComplete) + upperCase(HANDLER.hdrSqs)
|
|
83
|
-
// }
|
|
84
|
+
queueName: `${upperCase(flowSchema.flowTag)}Complete` + upperCase(HANDLER.hdrSqs),
|
|
85
|
+
subscribeTo: topicOut
|
|
86
|
+
}
|
|
84
87
|
]
|
|
85
88
|
for (let defaultDsqQueueData of defaultDsqQueueDataList) {
|
|
86
89
|
resultsForCreateDefaultSnsInSqs.push({
|
|
@@ -89,7 +92,10 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
89
92
|
setting: setting
|
|
90
93
|
})
|
|
91
94
|
}
|
|
92
|
-
console.log(
|
|
95
|
+
// console.log({
|
|
96
|
+
// resultsForCreateDefaultSnsInSqs: JSON.stringify(resultsForCreateDefaultSnsInSqs, null, 2
|
|
97
|
+
// )
|
|
98
|
+
// })
|
|
93
99
|
return resultsForCreateDefaultSnsInSqs;
|
|
94
100
|
}
|
|
95
101
|
|
|
@@ -49,9 +49,12 @@ function createDataForSnsOut(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
|
|
50
50
|
// GCTpBasTestInPersonCreate => GCTpBas_Test_PersonCreate_In
|
|
51
51
|
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
52
|
+
let flowStepsOut = flowSteps[0];
|
|
53
|
+
let splitFlowStepsIn = flowStepsOut.split("_");
|
|
54
|
+
let topicOut = splitFlowStepsIn[3]
|
|
52
55
|
const generatedSnsTopicOutForFlowSchema = [
|
|
53
56
|
{
|
|
54
|
-
queueName: upperCase(
|
|
57
|
+
queueName: upperCase(topicOut)
|
|
55
58
|
}
|
|
56
59
|
];
|
|
57
60
|
|
|
@@ -107,7 +107,7 @@ const createFlowSchemaEventBridgeFunctionYaml = require('./eventBridge/functionY
|
|
|
107
107
|
const createFlowSchemaEventBridgeHandler = require('./eventBridge/handler/inv/data');
|
|
108
108
|
const createFlowSchemaEventBridgeMainFunction = require('./eventBridge/mainFunction/data');
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const createAwaitingMultipleStepDynamoDbData = require('./dynamoDb/data');
|
|
111
111
|
// create record status Field Complete
|
|
112
112
|
const createCreateObjectCompleteFuntionYaml = require('./CreateRecordComplete/functionYaml/data');
|
|
113
113
|
const createCreateObjectCompleteHandler = require('./CreateRecordComplete/handler/data');
|
|
@@ -122,6 +122,7 @@ const createFlowSchemaRegisterMainCompleteFuncYaml = require('./createRecordBySt
|
|
|
122
122
|
const createFlowSchemaRegisterMainWbsFuncYaml = require('./createRecordByStatusType/wbs/functionYaml/data');
|
|
123
123
|
const createFlowSchemaRegisterSubscribeOutAll = require('./createRecordByStatusType/subscriptionOutAll/data');
|
|
124
124
|
const createFlowSchemaRegisterSnsInSqs = require('./createRecordByStatusType/sns-in/data');
|
|
125
|
+
const createFlowSchemaRegisterDynamoDb = require('./createRecordByStatusType/dynamoDB/register');
|
|
125
126
|
|
|
126
127
|
/**
|
|
127
128
|
* Generates code with templates for different actions
|
|
@@ -130,11 +131,13 @@ const createFlowSchemaRegisterSnsInSqs = require('./createRecordByStatusType/sns
|
|
|
130
131
|
* @returns {Array} Array of generated code parameters
|
|
131
132
|
*/
|
|
132
133
|
async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
133
|
-
console.log("objSchemaPath", objSchemaPath);
|
|
134
|
+
console.log("objSchemaPath in flowSchema generateTemplateAndData", objSchemaPath);
|
|
134
135
|
try {
|
|
135
136
|
const saveFilePath = join(objSchemaPath, '../');
|
|
137
|
+
console.log("saveFilePath in flowSchema generateTemplateAndData", saveFilePath)
|
|
136
138
|
let createSourceParams = [];
|
|
137
139
|
const allLocalFlowSchemas = await getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
140
|
+
const allLocalObjectSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
138
141
|
|
|
139
142
|
// default webSocket setting
|
|
140
143
|
const webSocketTaskTable = createWebSocketDynamoDb(_izContext, saveFilePath);
|
|
@@ -143,10 +146,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
143
146
|
|
|
144
147
|
const webSocketResource = [...webSocketTaskTable, ...webSocketConnectYaml, ...webSocketConnectHandler]
|
|
145
148
|
if (allLocalFlowSchemas.records.length) {
|
|
146
|
-
const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, saveFilePath)
|
|
147
149
|
createSourceParams.push(
|
|
148
150
|
...webSocketResource,
|
|
149
|
-
...webSocketGenerateCodeLibs
|
|
150
151
|
)
|
|
151
152
|
}
|
|
152
153
|
|
|
@@ -155,6 +156,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
155
156
|
|
|
156
157
|
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
157
158
|
console.log("flowSchema in Generate TemplateData", flowSchema);
|
|
159
|
+
const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, flowSchema, saveFilePath)
|
|
160
|
+
createSourceParams.push(...webSocketGenerateCodeLibs)
|
|
158
161
|
|
|
159
162
|
if (flowSchema.statusType === "none" || flowSchema.handlerObj === "multi") {
|
|
160
163
|
continue;
|
|
@@ -275,7 +278,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
275
278
|
...externalTopicSnsOut
|
|
276
279
|
];
|
|
277
280
|
|
|
278
|
-
console.log("event externalTopic generated")
|
|
279
281
|
createSourceParams.push(...externalTopic)
|
|
280
282
|
|
|
281
283
|
} else if (event.includes("ownTopic")) {
|
|
@@ -283,7 +285,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
283
285
|
// flowSchema OwnTopic components
|
|
284
286
|
const flowSchemaOwnTopicFunctionYaml = createFlowSchemaOwnTopicFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
285
287
|
const flowSchemaOwnTopicHandler = createFlowSchemaOwnTopicHandler(_izContext, flowSchema, saveFilePath);
|
|
286
|
-
const flowSchemaOwnTopicMainFunction = createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, saveFilePath);
|
|
288
|
+
const flowSchemaOwnTopicMainFunction = await createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, saveFilePath);
|
|
287
289
|
const flowSchemaOwnTopicComponent = [...flowSchemaOwnTopicFunctionYaml, ...flowSchemaOwnTopicHandler, ...flowSchemaOwnTopicMainFunction]
|
|
288
290
|
// flowSchema OwnTopic Complete component
|
|
289
291
|
const flowSchemaOwnTopicCompleteFunctionYaml = createFlowSchemaOwnTopicCompleteFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
@@ -291,22 +293,23 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
291
293
|
const flowSchemaOwnTopicCompleteMainFunction = createFlowSchemaOwnTopicCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
292
294
|
const flowSchemaOwnTopicCompleteComponent = [...flowSchemaOwnTopicCompleteFunctionYaml, ...flowSchemaOwnTopicCompleteHandler, ...flowSchemaOwnTopicCompleteMainFunction]
|
|
293
295
|
// flowSchemaOwnTopic Endpoint
|
|
294
|
-
const flowSchemaOwnTopicEndpointFuntionYaml = createFlowSchemaOwnTopicEndpointFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
296
|
+
const flowSchemaOwnTopicEndpointFuntionYaml = await createFlowSchemaOwnTopicEndpointFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
295
297
|
const flowSchemaOwnTopicEndpointHandler = createFlowSchemaOwnTopicEndpointHandler(_izContext, flowSchema, saveFilePath);
|
|
296
|
-
const flowSchemaOwnTopicEndpointMainFunction = createFlowSchemaOwnTopicEndpointMainFunction(_izContext, flowSchema, saveFilePath);
|
|
298
|
+
const flowSchemaOwnTopicEndpointMainFunction = await createFlowSchemaOwnTopicEndpointMainFunction(_izContext, flowSchema, saveFilePath);
|
|
297
299
|
const flowSchemaOwnTopicEndpointComponent = [...flowSchemaOwnTopicEndpointFuntionYaml, ...flowSchemaOwnTopicEndpointHandler, ...flowSchemaOwnTopicEndpointMainFunction]
|
|
298
300
|
|
|
299
301
|
// flowSchemaOwnTopic EndpointComplete
|
|
300
|
-
const flowSchemaOwnTopicEndpointCompleteFuntionYaml = createFlowSchemaOwnTopicEndpointCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
301
|
-
const flowSchemaOwnTopicEndpointCompleteHandler = createFlowSchemaOwnTopicEndpointCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
302
|
-
const flowSchemaOwnTopicEndpointCompleteMainFunction = createFlowSchemaOwnTopicEndpointCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
303
|
-
const flowSchemaOwnTopicEndpointCompleteComponent = [...flowSchemaOwnTopicEndpointCompleteFuntionYaml, ...flowSchemaOwnTopicEndpointCompleteHandler, ...flowSchemaOwnTopicEndpointCompleteMainFunction];
|
|
302
|
+
// const flowSchemaOwnTopicEndpointCompleteFuntionYaml = createFlowSchemaOwnTopicEndpointCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
303
|
+
// const flowSchemaOwnTopicEndpointCompleteHandler = createFlowSchemaOwnTopicEndpointCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
304
|
+
// const flowSchemaOwnTopicEndpointCompleteMainFunction = createFlowSchemaOwnTopicEndpointCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
305
|
+
// const flowSchemaOwnTopicEndpointCompleteComponent = [...flowSchemaOwnTopicEndpointCompleteFuntionYaml, ...flowSchemaOwnTopicEndpointCompleteHandler, ...flowSchemaOwnTopicEndpointCompleteMainFunction];
|
|
304
306
|
|
|
305
307
|
const flowSchemaOwnTopicQueue = createFlowSchemaOwnTopicQueue(_izContext, flowSchema, saveFilePath);
|
|
306
308
|
const flowSchemaOwnTopicSnsOut = createFlowSchemaOwnTopicSnsOut(_izContext, flowSchema, saveFilePath);
|
|
307
309
|
// Group the resources
|
|
308
310
|
const ownTopicResources = [
|
|
309
|
-
...flowSchemaOwnTopicComponent, ...flowSchemaOwnTopicCompleteComponent, ...flowSchemaOwnTopicEndpointComponent, ...flowSchemaOwnTopicQueue, ...flowSchemaOwnTopicSnsOut,
|
|
311
|
+
...flowSchemaOwnTopicComponent, ...flowSchemaOwnTopicCompleteComponent, ...flowSchemaOwnTopicEndpointComponent, ...flowSchemaOwnTopicQueue, ...flowSchemaOwnTopicSnsOut,
|
|
312
|
+
// ...flowSchemaOwnTopicEndpointCompleteComponent
|
|
310
313
|
];
|
|
311
314
|
|
|
312
315
|
console.log("event ownTopic generated")
|
|
@@ -328,15 +331,16 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
328
331
|
console.log("event eventBridge generated")
|
|
329
332
|
createSourceParams.push(...eventBridgeResources);
|
|
330
333
|
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (flowSchema.statusType === "storedCache") {
|
|
337
|
+
const flowSchemaDynamoDb = createAwaitingMultipleStepDynamoDbData(_izContext, flowSchema, allLocalObjectSchemas, saveFilePath)
|
|
338
|
+
console.log("generated code storedCache flowSchema")
|
|
339
|
+
createSourceParams.push(...flowSchemaDynamoDb);
|
|
340
|
+
} else if (flowSchema.statusType === "statusField") {
|
|
341
|
+
// wait
|
|
331
342
|
|
|
332
|
-
if (flowSchema.statusType === "storedCache") {
|
|
333
|
-
const flowSchemaDynamoDb = createFlowSchemaDynamoDb(_izContext, flowSchema, saveFilePath)
|
|
334
|
-
console.log("generated code storedCache flowSchema")
|
|
335
|
-
createSourceParams.push(...flowSchemaDynamoDb);
|
|
336
|
-
} else if (flowSchema.statusType === "statusField") {
|
|
337
|
-
// wait
|
|
338
343
|
|
|
339
|
-
|
|
340
344
|
// if (flowSchema.statusType === "statusField") {
|
|
341
345
|
// const createRecordCompleteFunctionYaml = createCreateObjectCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
342
346
|
// const createRecordCompleteHandler = createCreateObjectCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
@@ -353,29 +357,33 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
353
357
|
// createSourceParams.push(...recordCompleteResources);
|
|
354
358
|
// }
|
|
355
359
|
}
|
|
356
|
-
}
|
|
357
360
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
361
|
+
if (allLocalFlowSchemas.records.length) {
|
|
362
|
+
console.log("flowSchema Register");
|
|
363
|
+
const flowSchemaRegisterHandlerComplete = createFlowSchemaRegisterHandlerComplete(_izContext, saveFilePath);
|
|
364
|
+
const flowSchemaRegisterMainComplete = createFlowSchemaRegisterMainCompleteFunc(_izContext, saveFilePath);
|
|
365
|
+
const flowSchemaRegisterHandlerWbs = createFlowSchemaRegisterHandlerWbsFunc(_izContext, saveFilePath);
|
|
366
|
+
const flowSchemaRegisterMainWbs = createFlowSchemaRegisterMainWbsFunc(_izContext, saveFilePath);
|
|
367
|
+
const flowSchemaRegisterFunctionYamlComplete = createFlowSchemaRegisterMainCompleteFuncYaml(_izContext, saveFilePath);
|
|
368
|
+
const flowSchemaRegisterFunctionYamlWbs = createFlowSchemaRegisterMainWbsFuncYaml(_izContext, allLocalFlowSchemas, saveFilePath);
|
|
369
|
+
const flowSchemaRegisterSubscribeOutAll = createFlowSchemaRegisterSubscribeOutAll(_izContext, allLocalFlowSchemas, saveFilePath);
|
|
370
|
+
const flowSchemaRegisterSnsInSqs = createFlowSchemaRegisterSnsInSqs(_izContext, saveFilePath);
|
|
371
|
+
|
|
372
|
+
const flowSchemaRegisterDynamoDb = createFlowSchemaRegisterDynamoDb(_izContext, saveFilePath);
|
|
373
|
+
|
|
374
|
+
const flowSchemaRegisters = [
|
|
375
|
+
...flowSchemaRegisterHandlerComplete,
|
|
376
|
+
...flowSchemaRegisterMainComplete,
|
|
377
|
+
...flowSchemaRegisterHandlerWbs,
|
|
378
|
+
...flowSchemaRegisterMainWbs,
|
|
379
|
+
...flowSchemaRegisterFunctionYamlComplete,
|
|
380
|
+
...flowSchemaRegisterFunctionYamlWbs,
|
|
381
|
+
...flowSchemaRegisterSnsInSqs,
|
|
382
|
+
...flowSchemaRegisterSubscribeOutAll,
|
|
383
|
+
...flowSchemaRegisterDynamoDb
|
|
384
|
+
];
|
|
385
|
+
createSourceParams.push(...flowSchemaRegisters);
|
|
386
|
+
}
|
|
379
387
|
|
|
380
388
|
return createSourceParams;
|
|
381
389
|
} catch (error) {
|
|
@@ -239,7 +239,7 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
|
|
|
239
239
|
templateData.additionalResourcePermission,
|
|
240
240
|
groupedByObjectType["WebsocketConnect"].resources
|
|
241
241
|
)
|
|
242
|
-
} else if (templateData
|
|
242
|
+
} else if (templateData?.roleName?.includes(SOURCE_GENERATE_IAM_ROLE.EventBridge)) {
|
|
243
243
|
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.EventBridge].handlerType.push(templateData);
|
|
244
244
|
processResourcePermissions(
|
|
245
245
|
templateData.additionalResourcePermission,
|
|
@@ -251,7 +251,7 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
|
|
|
251
251
|
templateData.additionalResourcePermission,
|
|
252
252
|
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.CreateRecordComplete].resources
|
|
253
253
|
)
|
|
254
|
-
} else if (templateData
|
|
254
|
+
} else if (templateData?.roleName?.includes(SOURCE_GENERATE_IAM_ROLE.RegisterRole)) {
|
|
255
255
|
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RegisterRole].handlerType.push(templateData);
|
|
256
256
|
processResourcePermissions(
|
|
257
257
|
templateData.additionalResourcePermission,
|
|
@@ -264,6 +264,7 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
|
|
|
264
264
|
}
|
|
265
265
|
return item;
|
|
266
266
|
});
|
|
267
|
+
|
|
267
268
|
// Process "Other" items that might belong to existing object types
|
|
268
269
|
groupedByObjectType.Other = groupedByObjectType.Other.filter(item => {
|
|
269
270
|
const templateData = item.templateData;
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- s3:PutObject
|
|
25
25
|
- s3:GetObject
|
|
26
26
|
- s3:ListBucket
|
|
27
|
+
- s3:DeleteObject
|
|
27
28
|
Resource:
|
|
28
29
|
- arn:aws:s3:::object-schema/*
|
|
29
30
|
- arn:aws:s3:::object-schema/perServiceSchemas/${self:custom.iz_serviceTag}/*
|
|
@@ -54,5 +55,7 @@
|
|
|
54
55
|
Resource:<% statement.Resource.forEach(function(resource) { %>
|
|
55
56
|
- <%= resource -%><% }); %><% } else { %>
|
|
56
57
|
Resource: <%= statement.Resource %><% } %><% }); %>
|
|
58
|
+
#<#<%- role.roleName %>AdditionalRole#>
|
|
59
|
+
#<#/<%- role.roleName %>AdditionalRole#>
|
|
57
60
|
<% }); %>
|
|
58
61
|
<% } %>
|
|
@@ -27,6 +27,8 @@ const PREFIX = {
|
|
|
27
27
|
CREATE_OBJECT_ASYNC: "createObjectAsync",
|
|
28
28
|
CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete"
|
|
29
29
|
}
|
|
30
|
+
//(<optionalRequire>)
|
|
31
|
+
//(</optionalRequire>)
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
*
|
|
@@ -36,14 +38,8 @@ const PREFIX = {
|
|
|
36
38
|
* @param {*} errorsFounds
|
|
37
39
|
* @param {*} graphServiceTag
|
|
38
40
|
* @param {*} passBackProperties
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
objType,
|
|
42
|
-
objInstance,
|
|
43
|
-
relationships,
|
|
44
|
-
settings
|
|
45
|
-
}
|
|
46
|
-
*/
|
|
41
|
+
*/
|
|
42
|
+
|
|
47
43
|
module.exports.createObjectComplete = async (
|
|
48
44
|
_izContext,
|
|
49
45
|
returnValue,
|
|
@@ -145,9 +141,14 @@ module.exports.createObjectComplete = async (
|
|
|
145
141
|
};
|
|
146
142
|
_izContext.logger.debug("Send message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
|
|
147
143
|
await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete);
|
|
144
|
+
|
|
145
|
+
//(<afterSendMessage>)
|
|
146
|
+
//(</afterSendMessage>)
|
|
148
147
|
}
|
|
149
148
|
})
|
|
150
149
|
)
|
|
150
|
+
//(<beforeReturn>)
|
|
151
|
+
//(</beforeReturn>)
|
|
151
152
|
return {
|
|
152
153
|
returnValue: returnValue,
|
|
153
154
|
status: status,
|
|
@@ -27,7 +27,8 @@ const sns = require("@izara_project/izara-core-library-external-request").sns;
|
|
|
27
27
|
const NoRetryError = require("@izara_project/izara-core-library-core/src/NoRetryError");
|
|
28
28
|
|
|
29
29
|
const { explodedObjectTypeId, explodedRelationshipTypeId, createLinkTypeId } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
|
|
30
|
-
|
|
30
|
+
//(<optionalRequire>)
|
|
31
|
+
//(</optionalRequire>)
|
|
31
32
|
const {
|
|
32
33
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
34
|
TOPIC_NAME_GRAPH_HANDLER,
|
|
@@ -77,6 +78,9 @@ module.exports.deleteNodeComplete = async (
|
|
|
77
78
|
_izContext.logger.debug("Send Message to DeleteNodeComplete::", sendMessageToOutUpdateNodeComplete);
|
|
78
79
|
await sns.publishAsync(_izContext, sendMessageToOutUpdateNodeComplete)
|
|
79
80
|
|
|
81
|
+
//(<beforeReturn>)
|
|
82
|
+
//(</beforeReturn>)
|
|
83
|
+
|
|
80
84
|
return {
|
|
81
85
|
objType: returnValue.objType,
|
|
82
86
|
objInstanceFull: returnValue.objInstanceFull,
|
|
@@ -33,7 +33,8 @@ const {
|
|
|
33
33
|
TOPIC_NAME_GRAPH_HANDLER,
|
|
34
34
|
PREFIX
|
|
35
35
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
36
|
-
|
|
36
|
+
//(<optionalRequire>)
|
|
37
|
+
//(</optionalRequire>)
|
|
37
38
|
module.exports.updateNodeComplete = async (
|
|
38
39
|
_izContext,
|
|
39
40
|
returnValue,
|
|
@@ -22,6 +22,7 @@ const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
|
22
22
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
23
23
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
24
24
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
25
|
+
const logicalResultsSharedLib = require('@izara_project/izara-core-library-logical-result');
|
|
25
26
|
|
|
26
27
|
const serviceSchemas = require('@izara_project/izara-core-library-service-schemas');
|
|
27
28
|
const getObjectSchemas = serviceSchemas.getObjectSchema;
|
|
@@ -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
|
|
21
|
+
console.log("generate main PropertyValue Schema");
|
|
22
22
|
const { join } = require('path');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
const modules = {
|
|
26
|
-
objectPropertyNodeSchema: require('
|
|
27
|
-
relationshipPropertyNodeSchema: require('
|
|
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 === "
|
|
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
|