@izara_project/izara-core-generate-service-code 1.0.23 → 1.0.25
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/generateCode/generateFlowSchema/GenerateCodeFlowSchema.js +10 -7
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/template.ejs +3 -10
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/template.ejs +8 -15
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/index.js +1 -1
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js +2 -6
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/template.ejs +4 -11
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/template.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-out/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +1 -5
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs +12 -21
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/template.ejs +1 -3
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +9 -7
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs +3 -10
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/template.ejs +1 -1
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +1 -0
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/DsqHandlerTemplate.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/SqsHandlerTemplate.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +5 -8
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +12 -10
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs +6 -9
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +30 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +26 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +44 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/index.js +17 -17
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +1 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +3 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +1 -1
- package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/template.ejs +4 -6
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/functionYaml/data.js +9 -9
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/handler/data.js +1 -5
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/index.js +6 -18
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/mainFunction/data.js +15 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +4 -8
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/index.js +13 -33
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/functionYaml/data.js +4 -8
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/handler/data.js +12 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/mainFunction/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +4 -9
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js +4 -9
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheQueue/data.js +2 -3
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +185 -103
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/delete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/get/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +137 -71
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/beforeLogical/template.ejs +14 -6
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +21 -3
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/delete/main/template.ejs +24 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/update/main/template.ejs +25 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +6 -4
- package/src/generateCode/generateSchema/findDataComponent/mainFunction/data.js +1 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/create/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/create/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/get/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/mainFunction/template.ejs +1 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/sns-out/data.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/data.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/template.ejs +2 -6
- package/src/generateCode.js +9 -7
- package/src/libs/Utils.js +26 -1
- package/src/__TemplateData/flowSchema/event/externalTopic/Process/handler/data.js +0 -64
- package/src/__TemplateData/flowSchema/event/externalTopic/sns-out/data.js +0 -75
|
@@ -15,119 +15,185 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
18
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
21
19
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
22
20
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
23
21
|
import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
|
|
24
22
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
25
|
-
import { sns } from
|
|
23
|
+
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
24
|
+
import {
|
|
25
|
+
consts,
|
|
26
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
26
27
|
|
|
27
|
-
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { TOPIC_NAME_GENERATE_CODE } = consts;
|
|
29
|
+
const PREFIX = {
|
|
30
|
+
updateNode: 'updateNode',
|
|
31
|
+
};
|
|
29
32
|
|
|
30
33
|
//(<optionalRequire>)
|
|
31
34
|
//(</optionalRequire>)
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @param {*} returnValue
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
function buildAwaitingStepId(returnValue) {
|
|
41
|
+
const { objType, objInstanceFull } = returnValue.requestParams;
|
|
42
|
+
return asyncFlowSharedLib.createAwaitingStepId(
|
|
43
|
+
hash({
|
|
44
|
+
objectType: objType.objectType,
|
|
45
|
+
serviceTag: objType.serviceTag,
|
|
46
|
+
identifiers: objInstanceFull.identifiers,
|
|
47
|
+
fields: objInstanceFull.fields,
|
|
48
|
+
}),
|
|
49
|
+
PREFIX.updateNode,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {*} returnValue
|
|
55
|
+
* @param {*} status
|
|
56
|
+
* @param {*} errorsFound
|
|
57
|
+
* @returns {object}
|
|
58
|
+
*/
|
|
59
|
+
function buildUpdateCompleteMsg(returnValue, status, errorsFound) {
|
|
60
|
+
const { objType, objInstanceFull } = returnValue.requestParams;
|
|
61
|
+
return {
|
|
62
|
+
objType: {
|
|
63
|
+
objectType: objType.objectType,
|
|
64
|
+
serviceTag: objType.serviceTag,
|
|
65
|
+
},
|
|
66
|
+
objInstanceFull: {
|
|
67
|
+
identifiers: objInstanceFull.identifiers,
|
|
68
|
+
fields: objInstanceFull.fields,
|
|
69
|
+
},
|
|
70
|
+
status,
|
|
71
|
+
errorsFound,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @param {*} _izContext
|
|
77
|
+
* @param {*} passBackProperties
|
|
78
|
+
* @param {*} message
|
|
79
|
+
*/
|
|
80
|
+
async function sendSnsMessage(_izContext, passBackProperties, message) {
|
|
81
|
+
const enrichedMessage =
|
|
82
|
+
callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(
|
|
83
|
+
passBackProperties,
|
|
84
|
+
message,
|
|
85
|
+
);
|
|
86
|
+
_izContext.logger.debug(
|
|
87
|
+
'after addCallingFlow to SnsResponseMessageObject',
|
|
88
|
+
enrichedMessage,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const messageAttributes =
|
|
92
|
+
callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(
|
|
93
|
+
passBackProperties,
|
|
94
|
+
{},
|
|
95
|
+
);
|
|
96
|
+
_izContext.logger.debug(
|
|
97
|
+
'after addCallingFlow to SnsResponseMessageAttributes',
|
|
98
|
+
enrichedMessage,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const snsPayload = {
|
|
102
|
+
Message: JSON.stringify(enrichedMessage),
|
|
103
|
+
MessageAttributes: sns.createStringMessageAttributes(
|
|
104
|
+
_izContext,
|
|
105
|
+
messageAttributes,
|
|
106
|
+
),
|
|
107
|
+
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(
|
|
108
|
+
_izContext,
|
|
109
|
+
TOPIC_NAME_GENERATE_CODE.outUpdateNodeComplete,
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
_izContext.logger.debug(
|
|
113
|
+
'Send Message to OutUpdateNodeComplete::',
|
|
114
|
+
snsPayload,
|
|
115
|
+
);
|
|
116
|
+
await sns.publishAsync(_izContext, snsPayload);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param {*} _izContext
|
|
121
|
+
* @param {*} returnValue
|
|
122
|
+
* @param {*} status
|
|
123
|
+
* @param {*} errorsFound
|
|
124
|
+
* @param {*} passBackProperties
|
|
125
|
+
*/
|
|
33
126
|
export default async function updateNodeComplete(
|
|
34
127
|
_izContext,
|
|
35
128
|
returnValue,
|
|
36
129
|
status,
|
|
37
130
|
errorsFound,
|
|
38
|
-
passBackProperties = {}
|
|
131
|
+
passBackProperties = {},
|
|
39
132
|
) {
|
|
40
133
|
try {
|
|
41
|
-
_izContext.logger.debug(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
passBackProperties: passBackProperties
|
|
134
|
+
_izContext.logger.debug('Function:updateNodeComplete', {
|
|
135
|
+
returnValue,
|
|
136
|
+
status,
|
|
137
|
+
errorsFound,
|
|
138
|
+
passBackProperties,
|
|
47
139
|
});
|
|
48
140
|
|
|
49
|
-
|
|
50
|
-
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
51
|
-
hash({
|
|
52
|
-
objectType: returnValue.requestParams.objType.objectType,
|
|
53
|
-
serviceTag: returnValue.requestParams.objType.serviceTag,
|
|
54
|
-
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
55
|
-
fields: returnValue.requestParams.objInstanceFull.fields
|
|
56
|
-
}),
|
|
57
|
-
PREFIX.updateNode
|
|
58
|
-
)
|
|
141
|
+
const awaitingStepId = buildAwaitingStepId(returnValue);
|
|
59
142
|
|
|
60
|
-
|
|
143
|
+
const updateNodePendingObjects = await dynamodbSharedLib.query(
|
|
61
144
|
_izContext,
|
|
62
|
-
await dynamodbSharedLib.tableName(_izContext,
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
145
|
+
await dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleSteps'),
|
|
146
|
+
{ awaitingStepId },
|
|
147
|
+
);
|
|
148
|
+
_izContext.logger.debug(
|
|
149
|
+
'updateNodePendingObjects',
|
|
150
|
+
updateNodePendingObjects,
|
|
66
151
|
);
|
|
67
|
-
_izContext.logger.debug("updateNodePendingObjects", updateNodePendingObjects);
|
|
68
152
|
|
|
69
153
|
await Promise.all(
|
|
70
154
|
updateNodePendingObjects.Items.map(async ({ pendingStepId }) => {
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
fields: returnValue.requestParams.objInstanceFull.fields
|
|
87
|
-
},
|
|
88
|
-
status: status,
|
|
89
|
-
errorsFound: errorsFound,
|
|
90
|
-
};
|
|
155
|
+
if (
|
|
156
|
+
await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
157
|
+
_izContext,
|
|
158
|
+
pendingStepId,
|
|
159
|
+
awaitingStepId,
|
|
160
|
+
errorsFound,
|
|
161
|
+
)
|
|
162
|
+
) {
|
|
163
|
+
_izContext.logger.debug('finished all awaitingStep');
|
|
164
|
+
|
|
165
|
+
const updateCompleteMsg = buildUpdateCompleteMsg(
|
|
166
|
+
returnValue,
|
|
167
|
+
status,
|
|
168
|
+
errorsFound,
|
|
169
|
+
);
|
|
91
170
|
|
|
92
171
|
//(<additionalProperties>)
|
|
93
172
|
//(</additionalProperties>)
|
|
94
173
|
|
|
95
|
-
|
|
96
|
-
_izContext.logger.debug("after addCallingFlow to SnsResponseMessageObject", updateCompleteMsg);
|
|
97
|
-
|
|
98
|
-
let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {});
|
|
99
|
-
_izContext.logger.debug("after addCallingFlow to SnsResponseMessageAttributes", updateCompleteMsg);
|
|
100
|
-
|
|
101
|
-
let sendMessageToOutUpdateNodeComplete = {
|
|
102
|
-
Message: JSON.stringify(updateCompleteMsg),
|
|
103
|
-
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
104
|
-
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, TOPIC_NAME_GENERATE_CODE.outUpdateNodeComplete)
|
|
105
|
-
};
|
|
106
|
-
_izContext.logger.debug("Send Message to OutUpdateNodeComplete::", sendMessageToOutUpdateNodeComplete);
|
|
107
|
-
await sns.publishAsync(_izContext, sendMessageToOutUpdateNodeComplete)
|
|
108
|
-
|
|
174
|
+
await sendSnsMessage(_izContext, passBackProperties, updateCompleteMsg);
|
|
109
175
|
}
|
|
110
176
|
|
|
111
177
|
await asyncFlowSharedLib.removeAwaitingMultipleStep(
|
|
112
178
|
_izContext,
|
|
113
179
|
awaitingStepId,
|
|
114
180
|
pendingStepId,
|
|
115
|
-
errorsFound
|
|
181
|
+
errorsFound,
|
|
116
182
|
);
|
|
117
|
-
})
|
|
118
|
-
)
|
|
183
|
+
}),
|
|
184
|
+
);
|
|
119
185
|
|
|
120
186
|
//(<beforeReturn>)
|
|
121
187
|
//(</beforeReturn>)
|
|
122
188
|
|
|
189
|
+
const { queryResult } = returnValue;
|
|
123
190
|
return {
|
|
124
|
-
objType:
|
|
125
|
-
objInstanceFull:
|
|
126
|
-
errorsFound
|
|
127
|
-
}
|
|
128
|
-
|
|
191
|
+
objType: queryResult.objType,
|
|
192
|
+
objInstanceFull: queryResult.objInstanceFull,
|
|
193
|
+
errorsFound,
|
|
194
|
+
};
|
|
129
195
|
} catch (err) {
|
|
130
|
-
_izContext.logger.error(
|
|
131
|
-
throw
|
|
196
|
+
_izContext.logger.error('error UpdateNodeComplete:', err);
|
|
197
|
+
throw err;
|
|
132
198
|
}
|
|
133
199
|
}
|
package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js
CHANGED
|
@@ -57,7 +57,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
57
57
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
58
58
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
59
59
|
fileExtension: '.yml',
|
|
60
|
-
isAppend: true
|
|
60
|
+
isAppend: true,
|
|
61
|
+
fromFile: 'actionEndpointCom/update/sns-out/data.js'
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
}
|
|
@@ -76,8 +76,7 @@ import { <%= action %>MainLogical } from './<%= functionName %>_Main.js';
|
|
|
76
76
|
}
|
|
77
77
|
<%_ } _%>
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
console.debug('identifiers:::: ', identifiers);
|
|
79
|
+
_izContext.logger.debug('identifiers:::: ', identifiers);
|
|
81
80
|
|
|
82
81
|
// ── Verify + remove awaitingStep ──────────────────────────────────────────
|
|
83
82
|
const awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
@@ -90,9 +89,12 @@ import { <%= action %>MainLogical } from './<%= functionName %>_Main.js';
|
|
|
90
89
|
`beforeLogical_${requestParams.returnRequestParams.objectType}`
|
|
91
90
|
);
|
|
92
91
|
|
|
93
|
-
_izContext.logger.debug('createBeforeLogicalMain: checking awaitingStep', {
|
|
92
|
+
_izContext.logger.debug('createBeforeLogicalMain: checking awaitingStep', {
|
|
93
|
+
awaitingStepId,
|
|
94
|
+
pendingStepId
|
|
95
|
+
});
|
|
94
96
|
|
|
95
|
-
const [allComplete, collectedAttributes] =
|
|
97
|
+
const [allComplete, collectedAttributes, errorsFound] =
|
|
96
98
|
await asyncFlowSharedLib.syncAndCheckStepsCompletion(
|
|
97
99
|
_izContext,
|
|
98
100
|
pendingStepId,
|
|
@@ -103,6 +105,12 @@ import { <%= action %>MainLogical } from './<%= functionName %>_Main.js';
|
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
|
|
108
|
+
_izContext.logger.debug('validate step::: ', {
|
|
109
|
+
allComplete,
|
|
110
|
+
collectedAttributes,
|
|
111
|
+
errorsFound
|
|
112
|
+
});
|
|
113
|
+
|
|
106
114
|
if (allComplete === false) {
|
|
107
115
|
_izContext.logger.debug(
|
|
108
116
|
'createBeforeLogicalMain: pendingStepId not completed',
|
|
@@ -130,13 +138,13 @@ import { <%= action %>MainLogical } from './<%= functionName %>_Main.js';
|
|
|
130
138
|
//(<beforeLogicalMain>)
|
|
131
139
|
//(</beforeLogicalMain>)
|
|
132
140
|
|
|
133
|
-
return await
|
|
141
|
+
return await createMainLogical(
|
|
134
142
|
_izContext,
|
|
135
143
|
requestParams.returnRequestParams,
|
|
136
144
|
callingFlowConfig,
|
|
145
|
+
errorsFound,
|
|
137
146
|
beforeLogicalResults
|
|
138
147
|
);
|
|
139
|
-
|
|
140
148
|
} catch (err) {
|
|
141
149
|
throw err;
|
|
142
150
|
}
|
|
@@ -60,6 +60,7 @@ const PREFIX = {
|
|
|
60
60
|
_izContext,
|
|
61
61
|
requestParams,
|
|
62
62
|
callingFlowConfig = {},
|
|
63
|
+
errorsFound = [],
|
|
63
64
|
beforeLogicalResults = {}
|
|
64
65
|
) {
|
|
65
66
|
try {
|
|
@@ -69,7 +70,9 @@ const PREFIX = {
|
|
|
69
70
|
beforeLogicalResults
|
|
70
71
|
});
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
//(<beforeCreateMainLogical>)
|
|
74
|
+
//(</beforeCreateMainLogical>)
|
|
75
|
+
|
|
73
76
|
const objType = createObjType(requestParams.objectType);
|
|
74
77
|
|
|
75
78
|
// ── Load schema ───────────────────────────────────────────────────────────
|
|
@@ -443,6 +446,14 @@ export default async function createMain(
|
|
|
443
446
|
errorsFound.push(...errors);
|
|
444
447
|
_izContext.logger.debug('errorsFound::', errorsFound);
|
|
445
448
|
|
|
449
|
+
if (errorsFound.length > 0)
|
|
450
|
+
return await createMainLogical(
|
|
451
|
+
_izContext,
|
|
452
|
+
requestParams,
|
|
453
|
+
callingFlowConfig,
|
|
454
|
+
errorsFound
|
|
455
|
+
);
|
|
456
|
+
|
|
446
457
|
// ── Validate fieldNames ───────────────────────────────────────────────────
|
|
447
458
|
const objInstanceFull = { identifiers: {}, fields: {} };
|
|
448
459
|
|
|
@@ -468,7 +479,6 @@ export default async function createMain(
|
|
|
468
479
|
}
|
|
469
480
|
|
|
470
481
|
// ── beforeLogical phase check ─────────────────────────────────────────────
|
|
471
|
-
//(<beforeLogical>)
|
|
472
482
|
<%_
|
|
473
483
|
const groupedByObjType = generatedCodeConfig
|
|
474
484
|
.filter(c => c.codeHookTag === 'beforeLogical')
|
|
@@ -504,6 +514,9 @@ export default async function createMain(
|
|
|
504
514
|
|
|
505
515
|
<%_ } _%>
|
|
506
516
|
|
|
517
|
+
//(<afterBeforeLogical_<%= objectType %>>)
|
|
518
|
+
//(</afterBeforeLogical_<%= objectType %>>)
|
|
519
|
+
|
|
507
520
|
<%_ if (hasOwnTopic) { _%>
|
|
508
521
|
// ── ownTopic (async — create awaitingSteps and then publish) ──────────────
|
|
509
522
|
const awaitingMultipleStepIds = [];
|
|
@@ -565,6 +578,9 @@ export default async function createMain(
|
|
|
565
578
|
)
|
|
566
579
|
);
|
|
567
580
|
|
|
581
|
+
//(<beforePublish_<%= objectType %>>)
|
|
582
|
+
//(</beforePublish_<%= objectType %>>)
|
|
583
|
+
|
|
568
584
|
for (const recordMsg of recordMsgs) {
|
|
569
585
|
const messageAttributes = sns.createStringMessageAttributes(
|
|
570
586
|
_izContext,
|
|
@@ -604,7 +620,9 @@ export default async function createMain(
|
|
|
604
620
|
<%_ } _%>
|
|
605
621
|
}
|
|
606
622
|
<%_ }) _%>
|
|
607
|
-
|
|
623
|
+
|
|
624
|
+
//(<beforeCreateMainLogical>)
|
|
625
|
+
//(</beforeCreateMainLogical>)
|
|
608
626
|
|
|
609
627
|
// ── No beforeLogical → proceed directly to logical ────────────────────────
|
|
610
628
|
return await createMainLogical(
|
|
@@ -49,12 +49,15 @@ export async function deleteMainLogical(
|
|
|
49
49
|
_izContext,
|
|
50
50
|
requestParams,
|
|
51
51
|
callingFlowConfig = {},
|
|
52
|
+
errorsFound = [],
|
|
52
53
|
beforeLogicalResults = {}
|
|
53
54
|
) {
|
|
54
55
|
try {
|
|
55
56
|
_izContext.logger.debug('deleteMainLogical:', { requestParams, callingFlowConfig, beforeLogicalResults });
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
//(<beforeDeleteMainLogical>)
|
|
59
|
+
//(</beforeDeleteMainLogical>)
|
|
60
|
+
|
|
58
61
|
const objType = createObjType(requestParams.objectType);
|
|
59
62
|
|
|
60
63
|
// ── Load schema ───────────────────────────────────────────────────────────
|
|
@@ -159,6 +162,9 @@ export default async function deleteMain(
|
|
|
159
162
|
const errorsFound = [];
|
|
160
163
|
const objType = createObjType(requestParams.objectType);
|
|
161
164
|
|
|
165
|
+
//(<beforeDelete>)
|
|
166
|
+
//(</beforeDelete>)
|
|
167
|
+
|
|
162
168
|
// ── Load schema ───────────────────────────────────────────────────────────
|
|
163
169
|
const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, objType);
|
|
164
170
|
_izContext.logger.debug('objectSchema', objectSchema);
|
|
@@ -177,8 +183,15 @@ export default async function deleteMain(
|
|
|
177
183
|
// ── Build identifiers (used for hash in beforeLogical) ──────────────────
|
|
178
184
|
const identifiers = requestParams.identifiers;
|
|
179
185
|
|
|
186
|
+
if (errorsFound.length > 0)
|
|
187
|
+
return await createMainLogical(
|
|
188
|
+
_izContext,
|
|
189
|
+
requestParams,
|
|
190
|
+
callingFlowConfig,
|
|
191
|
+
errorsFound
|
|
192
|
+
);
|
|
193
|
+
|
|
180
194
|
// ── beforeLogical phase check ─────────────────────────────────────────────
|
|
181
|
-
//(<beforeLogical>)
|
|
182
195
|
<%_
|
|
183
196
|
const groupedByObjType = generatedCodeConfig
|
|
184
197
|
.filter(c => c.codeHookTag === 'beforeLogical')
|
|
@@ -211,9 +224,11 @@ export default async function deleteMain(
|
|
|
211
224
|
// lambdaSyncInv <%= config.flowTag %>
|
|
212
225
|
<%_ }) _%>
|
|
213
226
|
]);
|
|
214
|
-
|
|
215
227
|
<%_ } _%>
|
|
216
228
|
|
|
229
|
+
//(<afterBeforeLogical_<%= objectType %>>)
|
|
230
|
+
//(</afterBeforeLogical_<%= objectType %>>)
|
|
231
|
+
|
|
217
232
|
<%_ if (hasOwnTopic) { _%>
|
|
218
233
|
// ── ownTopic (async — create awaitingSteps and then publish) ──────────
|
|
219
234
|
const awaitingMultipleStepIds = [];
|
|
@@ -275,6 +290,9 @@ export default async function deleteMain(
|
|
|
275
290
|
)
|
|
276
291
|
);
|
|
277
292
|
|
|
293
|
+
//(<beforePublish_<%= objectType %>>)
|
|
294
|
+
//(</beforePublish_<%= objectType %>>)
|
|
295
|
+
|
|
278
296
|
for (const recordMsg of recordMsgs) {
|
|
279
297
|
const messageAttributes = sns.createStringMessageAttributes(
|
|
280
298
|
_izContext,
|
|
@@ -314,7 +332,9 @@ export default async function deleteMain(
|
|
|
314
332
|
<%_ } _%>
|
|
315
333
|
}
|
|
316
334
|
<%_ }) _%>
|
|
317
|
-
|
|
335
|
+
|
|
336
|
+
//(<beforeDeleteMainLogical>)
|
|
337
|
+
//(</beforeDeleteMainLogical>)
|
|
318
338
|
|
|
319
339
|
// ── No beforeLogical → proceed directly to logical ────────────────────────
|
|
320
340
|
return await deleteMainLogical(
|
|
@@ -53,17 +53,20 @@ export async function updateMainLogical(
|
|
|
53
53
|
_izContext,
|
|
54
54
|
requestParams,
|
|
55
55
|
callingFlowConfig = {},
|
|
56
|
+
errorsFound = [],
|
|
56
57
|
beforeLogicalResults = {}
|
|
57
58
|
) {
|
|
58
59
|
try {
|
|
59
60
|
_izContext.logger.debug('updateMainLogical:', { requestParams, callingFlowConfig, beforeLogicalResults });
|
|
60
61
|
|
|
62
|
+
//(<beforeUpdateMainLogical>)
|
|
63
|
+
//(</beforeUpdateMainLogical>)
|
|
64
|
+
|
|
61
65
|
// ── Settings ──────────────────────────────────────────────────────────────
|
|
62
66
|
const settings = requestParams.additionalParams?.settings ?? {};
|
|
63
67
|
const returnSystemFieldsName = settings.returnSystemFieldsName === true;
|
|
64
68
|
const returnOldData = settings.returnOldData === true;
|
|
65
69
|
|
|
66
|
-
const errorsFound = [];
|
|
67
70
|
const objType = createObjType(requestParams.objectType);
|
|
68
71
|
const identifiers = requestParams.objInstanceFull.identifiers;
|
|
69
72
|
const fields = requestParams.objInstanceFull.fields;
|
|
@@ -311,9 +314,20 @@ export default async function updateMain(
|
|
|
311
314
|
|
|
312
315
|
// ── Build identifiers (used for hash in beforeLogical) ──────────────────
|
|
313
316
|
const identifiers = requestParams.objInstanceFull.identifiers;
|
|
317
|
+
const errorsFound = [];
|
|
318
|
+
|
|
319
|
+
//(<validateBeforeUpdate>)
|
|
320
|
+
//(</validateBeforeUpdate>)
|
|
321
|
+
|
|
322
|
+
if (errorsFound.length > 0)
|
|
323
|
+
return await createMainLogical(
|
|
324
|
+
_izContext,
|
|
325
|
+
requestParams,
|
|
326
|
+
callingFlowConfig,
|
|
327
|
+
errorsFound
|
|
328
|
+
);
|
|
314
329
|
|
|
315
330
|
// ── beforeLogical phase check ─────────────────────────────────────────────
|
|
316
|
-
//(<beforeLogical>)
|
|
317
331
|
<%_
|
|
318
332
|
const groupedByObjType = generatedCodeConfig
|
|
319
333
|
.filter(c => c.codeHookTag === 'beforeLogical')
|
|
@@ -346,9 +360,11 @@ export default async function updateMain(
|
|
|
346
360
|
// lambdaSyncInv <%= config.flowTag %>
|
|
347
361
|
<%_ }) _%>
|
|
348
362
|
]);
|
|
349
|
-
|
|
350
363
|
<%_ } _%>
|
|
351
364
|
|
|
365
|
+
//(<afterBeforeLogical_<%= objectType %>>)
|
|
366
|
+
//(</afterBeforeLogical_<%= objectType %>>)
|
|
367
|
+
|
|
352
368
|
<%_ if (hasOwnTopic) { _%>
|
|
353
369
|
// ── ownTopic (async — create awaitingSteps and then publish) ──────────
|
|
354
370
|
const awaitingMultipleStepIds = [];
|
|
@@ -410,6 +426,9 @@ export default async function updateMain(
|
|
|
410
426
|
)
|
|
411
427
|
);
|
|
412
428
|
|
|
429
|
+
//(<beforePublish_<%= objectType %>>)
|
|
430
|
+
//(</beforePublish_<%= objectType %>>)
|
|
431
|
+
|
|
413
432
|
for (const recordMsg of recordMsgs) {
|
|
414
433
|
const messageAttributes = sns.createStringMessageAttributes(
|
|
415
434
|
_izContext,
|
|
@@ -449,7 +468,9 @@ export default async function updateMain(
|
|
|
449
468
|
<%_ } _%>
|
|
450
469
|
}
|
|
451
470
|
<%_ }) _%>
|
|
452
|
-
|
|
471
|
+
|
|
472
|
+
//(<beforeUpdateMainLogical>)
|
|
473
|
+
//(</beforeUpdateMainLogical>)
|
|
453
474
|
|
|
454
475
|
// ── No beforeLogical → proceed directly to logical ────────────────────────
|
|
455
476
|
return await updateMainLogical(
|
|
@@ -68,7 +68,7 @@ const HTTP_METHOD = {
|
|
|
68
68
|
* Generates yaml source params for a given action and handler
|
|
69
69
|
* @param {Object} _izContext - Context object with logger
|
|
70
70
|
* @param {Array} allObjSchemas - All object schemas
|
|
71
|
-
* @param {string}
|
|
71
|
+
* @param {string} appPath - Source path
|
|
72
72
|
* @param {string} action - Action name (create/update/get/delete)
|
|
73
73
|
* @param {string} handler - Handler type (hdrApi/hdrSqs/hdrDsq/hdrInv)
|
|
74
74
|
* @param {string|null} functionNameConfig - Override for yaml key (null = derive from action+handler)
|
|
@@ -78,7 +78,7 @@ const HTTP_METHOD = {
|
|
|
78
78
|
async function data(
|
|
79
79
|
_izContext,
|
|
80
80
|
allObjSchemas,
|
|
81
|
-
|
|
81
|
+
appPath,
|
|
82
82
|
action,
|
|
83
83
|
handler,
|
|
84
84
|
handlerSuffix = '',
|
|
@@ -187,7 +187,9 @@ async function data(
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// ── Service config ────────────────────────────────────────────────────────
|
|
190
|
-
const configPath = path.join(
|
|
190
|
+
const configPath = path.join(appPath, '../config/serverless.config.yml');
|
|
191
|
+
|
|
192
|
+
// console.debug('###### configPath:', configPath);
|
|
191
193
|
const ownServiceTag = yaml.parse(fs.readFileSync(configPath, 'utf8'))
|
|
192
194
|
.main_config.iz_serviceTag;
|
|
193
195
|
|
|
@@ -294,7 +296,7 @@ async function data(
|
|
|
294
296
|
}))
|
|
295
297
|
},
|
|
296
298
|
setting: {
|
|
297
|
-
savePath: path.join(
|
|
299
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
298
300
|
saveFileName: SAVE_FILE_NAME.functionPerActionYaml,
|
|
299
301
|
fileExtension: '.yml',
|
|
300
302
|
isAppend: true
|
|
@@ -74,7 +74,7 @@ async function data(_izContext, appPath, getObjectTypes) {
|
|
|
74
74
|
objectType,
|
|
75
75
|
schemaPath
|
|
76
76
|
);
|
|
77
|
-
// console.log('objectSchemaRecord: ', objectSchemaRecord);
|
|
77
|
+
// console.log('#### objectSchemaRecord: ', objectSchemaRecord);
|
|
78
78
|
|
|
79
79
|
let objectSchema = objectSchemaRecord.records[0];
|
|
80
80
|
// console.log(("objectSchema: ", objectSchema)
|
|
@@ -56,7 +56,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
56
56
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
57
57
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
58
58
|
fileExtension: '.yml',
|
|
59
|
-
isAppend: true
|
|
59
|
+
isAppend: true,
|
|
60
|
+
fromFile: 'relationShip/changeComplete/sns-out/data.js'
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
}
|
|
@@ -55,7 +55,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
55
55
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
56
56
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
57
57
|
fileExtension: '.yml',
|
|
58
|
-
isAppend: true
|
|
58
|
+
isAppend: true,
|
|
59
|
+
fromFile: 'relationShip/createComplete/sns-out/data.js'
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
}
|
|
@@ -57,7 +57,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
57
57
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
58
58
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
59
59
|
fileExtension: '.yml',
|
|
60
|
-
isAppend: true
|
|
60
|
+
isAppend: true,
|
|
61
|
+
fromFile: 'relationShip/deleteComplete/sns-out/data.js'
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
}
|
package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js
CHANGED
|
@@ -58,7 +58,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
58
58
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
59
59
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
60
60
|
fileExtension: '.yml',
|
|
61
|
-
isAppend: true
|
|
61
|
+
isAppend: true,
|
|
62
|
+
fromFile: 'relationShip/getComplete/sns-out/data.js'
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
}
|
|
@@ -57,7 +57,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
57
57
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
58
58
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
59
59
|
fileExtension: '.yml',
|
|
60
|
-
isAppend: true
|
|
60
|
+
isAppend: true,
|
|
61
|
+
fromFile: 'relationShip/moveComplete/sns-out/data.js'
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
}
|