@izara_project/izara-market-library-service-schemas 1.0.56 → 1.0.57
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 +4 -28
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +5 -6
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +6 -4
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +12 -8
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +12 -11
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +3 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +17 -9
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +4 -7
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +18 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +3 -2
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +4 -4
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +22 -2
package/package.json
CHANGED
|
@@ -762,7 +762,7 @@ function collectGetData(_izContext, getResults, objectSchema, returnSystemFields
|
|
|
762
762
|
}
|
|
763
763
|
|
|
764
764
|
|
|
765
|
-
async function createUpdateDataDetail(_izContext, objectSchema, settings = { bucketName:
|
|
765
|
+
async function createUpdateDataDetail(_izContext, objectSchema, settings = { bucketName: process.env.iz_serviceSchemaBucketName }) {
|
|
766
766
|
let getGraphDataDetails = {};
|
|
767
767
|
let getDynamoDbDataDetails = {};
|
|
768
768
|
let allUpdateDataDetail = {};
|
|
@@ -826,7 +826,7 @@ async function createUpdateDataDetail(_izContext, objectSchema, settings = { buc
|
|
|
826
826
|
return allUpdateDataDetail
|
|
827
827
|
}
|
|
828
828
|
|
|
829
|
-
async function createDataDetailsLib(_izContext, objectSchemas, settings = { bucketName:
|
|
829
|
+
async function createDataDetailsLib(_izContext, objectSchemas, settings = { bucketName: process.env.iz_serviceSchemaBucketName }) {
|
|
830
830
|
_izContext.logger.debug("Lib: createDataDetailsLib:", { objectSchemas: objectSchemas });
|
|
831
831
|
/**
|
|
832
832
|
* TODO: crate DataDetail now will get parent objectSchema if have extendObjType
|
|
@@ -857,7 +857,7 @@ async function createDataDetailsLib(_izContext, objectSchemas, settings = { buck
|
|
|
857
857
|
[eachStorageResourceTag]: {
|
|
858
858
|
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
859
859
|
tableName: storageResources[eachStorageResourceTag].tableName,
|
|
860
|
-
serviceTag: process.env.iz_serviceTag,
|
|
860
|
+
serviceTag: storageResources[eachStorageResourceTag].serviceTag || process.env.iz_serviceTag,
|
|
861
861
|
fieldNames: [keyFieldName]
|
|
862
862
|
}
|
|
863
863
|
});
|
|
@@ -894,34 +894,10 @@ async function createDataDetailsLib(_izContext, objectSchemas, settings = { buck
|
|
|
894
894
|
}; // end loop storageResourceTags
|
|
895
895
|
}; // end loop
|
|
896
896
|
|
|
897
|
-
if (objectSchemas.hasOwnProperty("extendObjType")) {
|
|
898
|
-
if (objectSchemas.extendObjType.serviceTag !== process.env.iz_serviceTag) {
|
|
899
|
-
let parentObjectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, objectSchemas.extendObjType, settings.bucketName);
|
|
900
|
-
_izContext.logger.debug("parentObjectSchema", parentObjectSchema);
|
|
901
|
-
for (const [fieldName, fieldNameSetting] of Object.entries(parentObjectSchema.fieldNames)) {
|
|
902
|
-
for (let eachParentStorageResourceTag of fieldNameSetting.storageResourceTags) {
|
|
903
|
-
let parentStorageResourceTag = objectSchemas.extendObjType.serviceTag + eachParentStorageResourceTag
|
|
904
|
-
if (storageResources[eachParentStorageResourceTag].storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
905
|
-
if (!createDataDetails.hasOwnProperty(parentStorageResourceTag)) {
|
|
906
|
-
createDataDetails[parentStorageResourceTag] = {
|
|
907
|
-
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
908
|
-
tableName: storageResources[eachParentStorageResourceTag].tableName,
|
|
909
|
-
serviceTag: objectSchemas.extendObjType.serviceTag,
|
|
910
|
-
fieldNames: [fieldName]
|
|
911
|
-
}
|
|
912
|
-
} else {
|
|
913
|
-
createDataDetails[parentStorageResourceTag].fieldNames.push(fieldName)
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
|
|
921
897
|
return createDataDetails;
|
|
922
898
|
};
|
|
923
899
|
|
|
924
|
-
async function createDeleteDataDetail(_izContext, objectSchema, settings = { bucketName:
|
|
900
|
+
async function createDeleteDataDetail(_izContext, objectSchema, settings = { bucketName: process.env.iz_serviceSchemaBucketName }) {
|
|
925
901
|
let deleteDynamoDataDetail = {};
|
|
926
902
|
let deleteGraphDataDetail = {};
|
|
927
903
|
let allDeleteDataDetail = {};
|
|
@@ -180,8 +180,8 @@ module.exports.createMain = async (
|
|
|
180
180
|
});
|
|
181
181
|
_izContext.logger.debug("Assign requestParams", requestParams)
|
|
182
182
|
|
|
183
|
-
} else if (
|
|
184
|
-
|
|
183
|
+
} else if (objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == false ||
|
|
184
|
+
objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == null) {
|
|
185
185
|
|
|
186
186
|
if ((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate == true) &&
|
|
187
187
|
(objectSchemas.fieldNames[identifier.fieldName].canUpdate == false)) {
|
|
@@ -197,8 +197,7 @@ module.exports.createMain = async (
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
}
|
|
201
|
-
if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("hashOnCreate")) {
|
|
200
|
+
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("hashOnCreate")) {
|
|
202
201
|
if (objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length &&
|
|
203
202
|
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length > 0) {
|
|
204
203
|
for (const fieldName of objectSchemas.fieldNames[identifier.fieldName].hashOnCreate) {
|
|
@@ -226,7 +225,7 @@ module.exports.createMain = async (
|
|
|
226
225
|
_izContext.logger.debug("requestParams is:", requestParams);
|
|
227
226
|
|
|
228
227
|
// check settingObjSchemas
|
|
229
|
-
for (
|
|
228
|
+
for (const [keyFieldNames, valueFieldNames] of Object.entries(objectSchemas.fieldNames)) {
|
|
230
229
|
|
|
231
230
|
if (valueFieldNames.hasOwnProperty("randomOnCreate") && valueFieldNames.randomOnCreate === true) {
|
|
232
231
|
listOfRequiredOnCreate.push(keyFieldNames)
|
|
@@ -288,7 +287,7 @@ module.exports.createMain = async (
|
|
|
288
287
|
for (let [storageTag, createDataDetail] of Object.entries(createDataDetails)) {
|
|
289
288
|
//(<beforeCreate>)
|
|
290
289
|
//(</beforeCreate>)
|
|
291
|
-
if (createDataDetail.storageType == consts.STORAGE_TYPES.dynamoDB) {
|
|
290
|
+
if (createDataDetail.storageType == consts.STORAGE_TYPES.dynamoDB && createDataDetail.serviceTag === process.env.iz_serviceTag) {
|
|
292
291
|
//(<beforeCreateRecordDynamo>)
|
|
293
292
|
//(</beforeCreateRecordDynamo>)
|
|
294
293
|
_izContext.logger.debug("::::::DynamoDB::::::", { storageTag, objInstanceFull });
|
|
@@ -103,6 +103,7 @@ module.exports.getMain = async (
|
|
|
103
103
|
|
|
104
104
|
const returnSystemFieldsName = requestParams.additionalRequest?.setting?.returnSystemFieldsName || false;
|
|
105
105
|
const throwWhenNotFoundSomeRecord = requestParams.additionalRequest?.setting?.throwWhenNotFoundSomeRecord || true;
|
|
106
|
+
const returnVersionedData = requestParams.additionalRequest?.setting?.returnVersionedData || true
|
|
106
107
|
|
|
107
108
|
//(<beforeQuery>)
|
|
108
109
|
//(</beforeQuery>)
|
|
@@ -151,10 +152,11 @@ module.exports.getMain = async (
|
|
|
151
152
|
let graphServiceName = await getGraphServiceTagWithCache(_izContext, getDataDetail.graphServiceTag);
|
|
152
153
|
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
if (!returnVersionedData) {
|
|
156
|
+
if (getDataDetail.versionedDatas && Object.keys(getDataDetail.versionedDatas).length) {
|
|
157
|
+
// have versionedData
|
|
158
|
+
versionedDataLabels = Object.keys(getDataDetail.versionedDatas);
|
|
159
|
+
}
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
|
|
@@ -111,7 +111,7 @@ module.exports.confirmNewReserved = async (
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
let sendMessageToUpdateEndpoint = {
|
|
114
|
-
Message: JSON.stringify(
|
|
114
|
+
Message: JSON.stringify(sendMessageToUpdateStatus),
|
|
115
115
|
TopicArn: await snsSharedLib.snsTopicArn(_izContext, "Update_In")
|
|
116
116
|
};
|
|
117
117
|
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs
CHANGED
|
@@ -28,6 +28,7 @@ const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
|
28
28
|
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
29
29
|
const { postToConnection } = require('../../../../libs/source/GenerateCodeLibs');
|
|
30
30
|
const createObject = require('./CreateObjectS3_Main');
|
|
31
|
+
const { createFlowTypeConcat } = require("@izara_project/izara-core-library-service-schemas").utils
|
|
31
32
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
32
33
|
|
|
33
34
|
event._izContext.logger.debug('Event:', event);
|
|
@@ -44,14 +45,17 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
44
45
|
console.log("event in route webSocket", event);
|
|
45
46
|
let eventParams = JSON.parse(event.body)
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
//(<createIdentifiersFlow>)
|
|
49
|
+
let identifiers
|
|
50
|
+
//(</createIdentifiersFlow>)
|
|
51
|
+
|
|
52
|
+
await dynamodbSharedLib.putItem(event._izContext,
|
|
53
|
+
await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
54
|
+
{
|
|
55
|
+
taskKey: `${createFlowTypeConcat(event._izContext, { flowTag: "<%- route %>", serviceTag: process.env.iz_serviceTag })}${identifiers}`,
|
|
56
|
+
connectionId: connectionId,
|
|
57
|
+
}
|
|
58
|
+
)
|
|
55
59
|
|
|
56
60
|
let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
|
|
57
61
|
await createObject.createObject(
|
|
@@ -67,6 +67,8 @@ module.exports.createObject = async (
|
|
|
67
67
|
_izContext.logger.debug("WebSocketInvoke requestParams", requestParams)
|
|
68
68
|
_izContext.logger.debug("WebSocketInvoke callingFlowConfig", callingFlowConfig)
|
|
69
69
|
|
|
70
|
+
let correlationIds = _izContext.correlationIds.get(coreConsts.X_CORRELATION_ID)
|
|
71
|
+
|
|
70
72
|
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
71
73
|
flowTag: "<%- flowTag %>",
|
|
72
74
|
serviceTag: process.env.iz_serviceTag
|
|
@@ -74,30 +76,29 @@ module.exports.createObject = async (
|
|
|
74
76
|
|
|
75
77
|
_izContext.logger.debug("getFlowSchema", flowSchema)
|
|
76
78
|
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
+
let getUserFromTableTask = await dynamodbSharedLib.getItem(_izContext,
|
|
80
|
+
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
81
|
+
{
|
|
82
|
+
taskKey: correlationIds
|
|
83
|
+
}
|
|
84
|
+
)
|
|
79
85
|
|
|
86
|
+
const { userId, submitByUserId } = getUserFromTableTask
|
|
87
|
+
|
|
80
88
|
if (!flowSchema) {
|
|
81
|
-
throw new NoRetryError(`flowTag not found ${requestParams.
|
|
89
|
+
throw new NoRetryError(`flowTag not found ${requestParams.action}`)
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
if (flowSchema.uploadS3 === true) {
|
|
85
|
-
if (!flowSchema.hasOwnProperty("objType")) {
|
|
86
|
-
throw new NoRetryError(`flowTag has uploadS3 setting should have objType in flowSchema`)
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
92
|
// get objectType
|
|
91
93
|
let objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, flowSchema.objType)
|
|
92
94
|
_izContext.logger.debug("objectSchema in flowSchema mainFunction", objectSchema)
|
|
93
95
|
|
|
94
|
-
_izContext.correlationIds.get(coreConsts.X_CORRELATION_ID)
|
|
95
96
|
|
|
96
97
|
//(<beforeCreateHook>)
|
|
97
98
|
//(</beforeCreateHook>)
|
|
98
99
|
// create message Object to create Endpoint
|
|
99
100
|
let messageObject = {
|
|
100
|
-
objectType: <%- objectType %>
|
|
101
|
+
objectType: "<%- objectType %>",
|
|
101
102
|
fieldNames: {
|
|
102
103
|
//(<fieldNamesHook>)
|
|
103
104
|
//(</fieldNamesHook>)
|
|
@@ -37,10 +37,12 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
37
37
|
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
38
38
|
let functionName = upperCase(FUNCTION_NAME.createPresignUrl)
|
|
39
39
|
let bucketName = flowSchema.bucketName
|
|
40
|
+
let flowTag = flowSchema.flowTag
|
|
40
41
|
return {
|
|
41
42
|
templatePath: templatePath,
|
|
42
43
|
templateData: {
|
|
43
|
-
bucketName
|
|
44
|
+
bucketName,
|
|
45
|
+
flowTag
|
|
44
46
|
},
|
|
45
47
|
setting: {
|
|
46
48
|
saveFileName: `${functionName}_Main`,
|
|
@@ -37,6 +37,8 @@ const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
|
37
37
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils');
|
|
38
38
|
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
39
39
|
const { EXTERNAL_SERVICE_NAME } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
40
|
+
const { createFlowTypeConcat } = require("@izara_project/izara-core-library-service-schemas").utils
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* description of function.
|
|
42
44
|
* @param {Object} _izContext
|
|
@@ -80,7 +82,7 @@ module.exports.createPresignUrl = async (
|
|
|
80
82
|
let getResult = await lambda.invokeSync(_izContext,
|
|
81
83
|
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv"),
|
|
82
84
|
{
|
|
83
|
-
objectType: objType.objectType
|
|
85
|
+
objectType: objType.objectType,
|
|
84
86
|
//(<identifiers>)
|
|
85
87
|
//(</identifiers>)
|
|
86
88
|
}
|
|
@@ -99,10 +101,9 @@ module.exports.createPresignUrl = async (
|
|
|
99
101
|
|
|
100
102
|
await dynamodbSharedLib.putItem(_izContext,
|
|
101
103
|
await dynamodbSharedLib.tableName(_izContext, "ReservedDataMain"),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
104
|
+
//(<createReservedDataMain>)
|
|
105
|
+
{}
|
|
106
|
+
//(</createReservedDataMain>)
|
|
106
107
|
);
|
|
107
108
|
|
|
108
109
|
if (passStatus === false) { // if passStatus false post message to client
|
|
@@ -157,6 +158,7 @@ module.exports.createPresignUrl = async (
|
|
|
157
158
|
connectionId: connectionId
|
|
158
159
|
}
|
|
159
160
|
)
|
|
161
|
+
return "reserved not pass"
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
//(<createKeyForUploadFile>)
|
|
@@ -198,14 +200,15 @@ module.exports.createPresignUrl = async (
|
|
|
198
200
|
let messageObject = {
|
|
199
201
|
objInstanceFull: {
|
|
200
202
|
identifiers: {
|
|
201
|
-
|
|
203
|
+
//(<identifiersForUpdateTable>)
|
|
204
|
+
//(</identifiersForUpdateTable>)
|
|
202
205
|
},
|
|
203
206
|
fields: {
|
|
204
207
|
importBatchStatus: "waitingToUpload",
|
|
205
|
-
expiryTimestamp: (startTime + (createPresignUrlParam.expires * 1000))
|
|
208
|
+
expiryTimestamp: (getResult.startTime + (createPresignUrlParam.expires * 1000))
|
|
206
209
|
}
|
|
207
210
|
},
|
|
208
|
-
objectType: objType
|
|
211
|
+
objectType: objType.objectType
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
@@ -227,10 +230,15 @@ module.exports.createPresignUrl = async (
|
|
|
227
230
|
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
228
231
|
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
229
232
|
|
|
233
|
+
|
|
234
|
+
//(<createIdentifiersFlow>)
|
|
235
|
+
let identifiers
|
|
236
|
+
//(</createIdentifiersFlow>)
|
|
237
|
+
|
|
230
238
|
await dynamodbSharedLib.updateItem(_izContext,
|
|
231
239
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
232
240
|
{
|
|
233
|
-
taskKey:
|
|
241
|
+
taskKey: `${createFlowTypeConcat(event._izContext, { flowTag: "<%- flowTag %>", serviceTag: process.env.iz_serviceTag })}${identifiers}`,
|
|
234
242
|
connectionId: connectionId
|
|
235
243
|
},
|
|
236
244
|
{
|
|
@@ -58,17 +58,16 @@ module.exports.reservedLimit = async (
|
|
|
58
58
|
callingFlowConfig
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
+
let connectionId = _izContext.correlationIds.get(coreConsts.CONNECTION_ID)
|
|
62
|
+
|
|
61
63
|
//(<beforeReserved>)
|
|
62
64
|
//(</beforeReserved>)
|
|
63
65
|
|
|
64
|
-
let connectionId = _izContext.correlationIds.get(coreConsts.CONNECTION_ID)
|
|
65
|
-
//* hard code
|
|
66
|
-
// _izContext['userId'] = 'this-is-uuid-for-user-superUserA'
|
|
67
66
|
|
|
68
67
|
// get static
|
|
69
68
|
let payloadBeforeInvokeStaticLimit = {
|
|
70
69
|
userId: _izContext.correlationIds.get(coreConsts.BASE_USER_ID),
|
|
71
|
-
|
|
70
|
+
targetId: _izContext.correlationIds.get(coreConsts.TARGET_ID),
|
|
72
71
|
//(<additionalPropertiesStaticLimit>)
|
|
73
72
|
//(</additionalPropertiesStaticLimit>)
|
|
74
73
|
}
|
|
@@ -88,13 +87,11 @@ module.exports.reservedLimit = async (
|
|
|
88
87
|
|
|
89
88
|
let sendMsgReservedDynamic = {
|
|
90
89
|
userId: _izContext.correlationIds.get(coreConsts.BASE_USER_ID),
|
|
91
|
-
targetUserId: _izContext.correlationIds.get(coreConsts.TARGET_ID)
|
|
90
|
+
targetUserId: _izContext.correlationIds.get(coreConsts.TARGET_ID),
|
|
92
91
|
//(<additionalPropertiesReservedDynamic>)
|
|
93
92
|
//(</additionalPropertiesReservedDynamic>)
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
const reservedDataId = `${consts.ACCOUNTLIMIT_TAG.reservedDynamic}_${userId}_${consts.LIMIT_TAG.uploadData}`
|
|
97
|
-
|
|
98
95
|
let callingFlowProperties = {
|
|
99
96
|
//(<baseCallingFlowProperties>)
|
|
100
97
|
//(</baseCallingFlowProperties>)
|
|
@@ -133,8 +133,8 @@ function getNestObject(_izContext, nestedObj, paths) {
|
|
|
133
133
|
|
|
134
134
|
module.exports = {
|
|
135
135
|
postToConnection,
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
processStaticLimit,
|
|
137
|
+
processStaticLimitWithCache,
|
|
138
138
|
getNestObject,
|
|
139
139
|
<% if (uploadS3) { %>
|
|
140
140
|
isValidCsv,
|
package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs
CHANGED
|
@@ -28,15 +28,33 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
28
28
|
const { eventType, connectionId } = event.requestContext
|
|
29
29
|
try {
|
|
30
30
|
|
|
31
|
+
let userId = event.queryStringParameters.userId
|
|
32
|
+
let submitByUserId = event.queryStringParameters.submitByUserId
|
|
33
|
+
let correlationIds = event._izContext.correlationIds.get(izara.consts.X_CORRELATION_ID)
|
|
34
|
+
|
|
31
35
|
if (event.requestContext) {
|
|
32
36
|
switch (eventType) {
|
|
33
37
|
case 'CONNECT':
|
|
34
38
|
console.log('Connect websocket')
|
|
39
|
+
await dynamodbSharedLib.putItem(event._izContext,
|
|
40
|
+
await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
41
|
+
{
|
|
42
|
+
taskKey: correlationIds,
|
|
43
|
+
userId: userId,
|
|
44
|
+
submitByUserId: submitByUserId
|
|
45
|
+
}
|
|
46
|
+
)
|
|
35
47
|
//(<webSocketConnect>)
|
|
36
48
|
//(</webSocketConnect>)
|
|
37
49
|
break
|
|
38
50
|
case 'DISCONNECT':
|
|
39
51
|
console.log('Websocket are Disconnection')
|
|
52
|
+
await dynamodbSharedLib.deleteItem(event._izContext,
|
|
53
|
+
await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
54
|
+
{
|
|
55
|
+
taskKey: correlationIds,
|
|
56
|
+
}
|
|
57
|
+
)
|
|
40
58
|
//(<webSocketDisconnect>)
|
|
41
59
|
//(</webSocketDisconnect>)
|
|
42
60
|
break
|
|
@@ -28,6 +28,7 @@ const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
|
28
28
|
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
29
29
|
const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
30
30
|
const <%- functionName %> = require('./<%- functionName %>_Main');
|
|
31
|
+
const { createFlowTypeConcat } = require("@izara_project/izara-core-library-service-schemas").utils
|
|
31
32
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
32
33
|
|
|
33
34
|
event._izContext.logger.debug('Event:', event);
|
|
@@ -63,7 +64,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
63
64
|
await dynamodbSharedLib.putItem(event._izContext,
|
|
64
65
|
await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
65
66
|
{
|
|
66
|
-
taskKey: `${
|
|
67
|
+
taskKey: `${createFlowTypeConcat(event._izContext, { flowTag: "<%- route %>", serviceTag: process.env.iz_serviceTag })}${identifiers}`,
|
|
67
68
|
connectionId: connectionId,
|
|
68
69
|
}
|
|
69
70
|
)
|
|
@@ -73,7 +74,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
73
74
|
event._izContext,
|
|
74
75
|
await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
75
76
|
{
|
|
76
|
-
taskKey: `${
|
|
77
|
+
taskKey: `${createFlowTypeConcat(event._izContext, { flowTag: "<%- route %>", serviceTag: process.env.iz_serviceTag })}${correlationId}`,
|
|
77
78
|
connectionId: connectionId,
|
|
78
79
|
}
|
|
79
80
|
)
|
|
@@ -54,10 +54,10 @@ module.exports.updateNodeComplete = async (
|
|
|
54
54
|
// start create AwaitingStepId
|
|
55
55
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
56
56
|
hash({
|
|
57
|
-
objectType: returnValue.
|
|
58
|
-
serviceTag: returnValue.
|
|
59
|
-
identifiers: returnValue.
|
|
60
|
-
fields: returnValue.
|
|
57
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
58
|
+
serviceTag: returnValue.requestParams.objType.objectType,
|
|
59
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
60
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
61
61
|
}),
|
|
62
62
|
PREFIX.updateNode
|
|
63
63
|
)
|
|
@@ -30,7 +30,7 @@ const STORAGE_TYPES = {
|
|
|
30
30
|
graph: "graph"
|
|
31
31
|
}
|
|
32
32
|
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts')
|
|
33
|
-
const { firstUpperCase: upperCase } = require('../../../../MainLibs/src/Utils')
|
|
33
|
+
const { firstUpperCase: upperCase, getLocalConfig } = require('../../../../MainLibs/src/Utils')
|
|
34
34
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
35
35
|
const { NoRetryError } = require("@izara_project/izara-core-library-core");
|
|
36
36
|
|
|
@@ -45,7 +45,13 @@ async function filterCreateResourceYaml(_izContext, createSourceParams, objSchem
|
|
|
45
45
|
}
|
|
46
46
|
}))
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const allLocalObjSchema = await getObjectSchema.getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
49
|
+
await Promise.all(allLocalObjSchema.records.map(async (objSchema) => {
|
|
50
|
+
if (objSchema.hasOwnProperty("extendObjType")) {
|
|
51
|
+
tableNamesToFilter.add(...await getParentTableFromObjSchema(_izContext, objSchema, objSchemaPath))
|
|
52
|
+
}
|
|
53
|
+
}))
|
|
54
|
+
let filteredCreateSourceParams = createSourceParams.filter(
|
|
49
55
|
(result) => !tableNamesToFilter.has(result.templateData.tableName)
|
|
50
56
|
)
|
|
51
57
|
|
|
@@ -69,3 +75,17 @@ async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema, objSche
|
|
|
69
75
|
}
|
|
70
76
|
return tableNameStoredCache;
|
|
71
77
|
}
|
|
78
|
+
|
|
79
|
+
async function getParentTableFromObjSchema(_izContext, objSchema, objSchemaPath) {
|
|
80
|
+
let parentTableNames = new Set();
|
|
81
|
+
let ownServiceTag = getLocalConfig(path.join(objSchemaPath, "../../"), "iz_serviceTag")
|
|
82
|
+
for (const storageResource of Object.values(objSchema.storageResources)) {
|
|
83
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
84
|
+
if (storageResource.serviceTag && storageResource.serviceTag !== ownServiceTag) {
|
|
85
|
+
parentTableNames.add(storageResource.tableName)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return parentTableNames
|
|
91
|
+
}
|