@izara_project/izara-market-library-service-schemas 1.0.35 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -7
- package/src/GenerateCodeLibs/src/Consts.js +2 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +3 -2
- package/src/MainLibs/src/Consts.js +8 -8
- package/src/MainLibs/src/GenerateCodeUtils.js +3 -1
- 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/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +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 +35 -163
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +3 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +3 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -1
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +45 -19
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +5 -2
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +24 -14
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +4 -1
- package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +69 -34
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +10 -7
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +12 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +14 -9
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +16 -40
- 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/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +78 -27
- 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 +9 -32
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +30 -20
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +6 -6
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +32 -32
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +8 -9
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +116 -26
- 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 +6 -4
- 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 +43 -39
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +5 -7
- 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 +46 -48
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +5 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +3 -11
- 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 +60 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +7 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +22 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +27 -34
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +21 -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 +10 -6
- 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 +4 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +8 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +21 -14
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +23 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +11 -6
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +50 -45
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +3 -2
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +2 -28
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +10 -9
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +6 -2
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -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 +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +5 -5
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +6 -5
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +5 -4
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +3 -2
- 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/testTemplate/data.js +0 -27
- package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
- /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
|
@@ -18,7 +18,7 @@ along with this program. If not, see
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
const hash = require(
|
|
21
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
22
|
const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
|
|
23
23
|
|
|
24
24
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
@@ -29,16 +29,16 @@ const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
|
29
29
|
|
|
30
30
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
31
31
|
const sns = externalRequest.sns
|
|
32
|
-
const { postToConnection } = require("
|
|
32
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
33
33
|
|
|
34
34
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
35
|
-
const NoRetryError = require('@izara_project/izara-core-library-core')
|
|
35
|
+
const { NoRetryError } = require('@izara_project/izara-core-library-core')
|
|
36
36
|
const { v4: uuidv4 } = require('uuid')
|
|
37
37
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
38
|
-
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
|
+
// const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
39
|
+
const { generateCodeLibs: { consts: TOPIC_NAME_GENERATE_CODE } } = require('@izara_project/izara-market-library-service-schemas')
|
|
40
|
+
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
42
|
* description of function.
|
|
43
43
|
* @param {Object} _izContext
|
|
44
44
|
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
@@ -47,11 +47,9 @@ const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-librar
|
|
|
47
47
|
* @param {Object} requestParams.identifiers - identifiers for get data
|
|
48
48
|
* @param {Object} requestParams.additionalRequest - additionalRequest
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
50
|
* @returns {object} description of return value
|
|
52
51
|
*/
|
|
53
|
-
|
|
54
|
-
module.exports.<%- functionMain%> = async (
|
|
52
|
+
module.exports.registerCompleteMain = async (
|
|
55
53
|
_izContext,
|
|
56
54
|
requestParams,
|
|
57
55
|
callingFlowConfig = {},
|
|
@@ -63,14 +61,14 @@ module.exports.<%- functionMain%> = async (
|
|
|
63
61
|
_izContext.logger.debug("WebSocketInvoke requestParams", requestParams)
|
|
64
62
|
_izContext.logger.debug("WebSocketInvoke callingFlowConfig", callingFlowConfig)
|
|
65
63
|
|
|
66
|
-
const connectionId =
|
|
67
|
-
let correlationId =
|
|
64
|
+
const connectionId = requestContext.connectionId;
|
|
65
|
+
let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID);
|
|
68
66
|
|
|
69
67
|
const getRegisterRecords = await dynamodbSharedLib.getItem(
|
|
70
68
|
_izContext,
|
|
71
69
|
await dynamodbSharedLib.tableName(_izContext, "RegisterRecords"),
|
|
72
70
|
{
|
|
73
|
-
|
|
71
|
+
identifierTask: correlationId,
|
|
74
72
|
connectionId: connectionId,
|
|
75
73
|
}
|
|
76
74
|
);
|
|
@@ -90,40 +88,93 @@ module.exports.<%- functionMain%> = async (
|
|
|
90
88
|
throw new NoRetryError(`flowTag not found ${flowTag}`)
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
|
|
91
|
+
// get data from dynamoDB of objectType of flowSchema
|
|
92
|
+
const getStoredCache = async (objectType) => {
|
|
93
|
+
const objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
94
|
+
_izContext,
|
|
95
|
+
{
|
|
96
|
+
objectType: objectType,
|
|
97
|
+
serviceTag: process.env.iz_serviceTag,
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
_izContext.logger.debug("==> objectSchema", objectSchema)
|
|
101
|
+
|
|
102
|
+
// this returns the table name of the first storage resource with storageType "dynamoDB"
|
|
103
|
+
const tableName = Object.values(objectSchema.storageResources).find(
|
|
104
|
+
(storageResource) => storageResource.storageType === "dynamoDB"
|
|
105
|
+
)?.tableName
|
|
106
|
+
_izContext.logger.debug("==> tableName", tableName)
|
|
107
|
+
|
|
108
|
+
let identifierPK = null
|
|
109
|
+
let identifierSK = null
|
|
110
|
+
objectSchema.identifiers.map((identifier) => {
|
|
111
|
+
if (identifier.type === "partitionKey") {
|
|
112
|
+
identifierPK = identifier.fieldName
|
|
113
|
+
} else if (identifier.type === "sortKey") {
|
|
114
|
+
identifierSK = identifier.fieldName
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
_izContext.logger.debug("==> identifierPK", identifierPK)
|
|
119
|
+
_izContext.logger.debug("==> identifierSK", identifierSK)
|
|
120
|
+
|
|
121
|
+
const payloadGetStoredCache = {
|
|
122
|
+
[identifierPK]: requestParams.identifiers[identifierPK],
|
|
123
|
+
}
|
|
124
|
+
if (identifierSK) {
|
|
125
|
+
payloadGetStoredCache[identifierSK] = requestParams.identifiers[identifierSK]
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_izContext.logger.debug("==> payloadGetStoredCache", payloadGetStoredCache)
|
|
129
|
+
|
|
130
|
+
// const getStoredCache = await dynamodbSharedLib.getItem(
|
|
131
|
+
// _izContext,
|
|
132
|
+
// await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
133
|
+
// payloadGetStoredCache
|
|
134
|
+
// )
|
|
135
|
+
|
|
136
|
+
const getStoredCache = await dynamodbSharedLib.query(
|
|
137
|
+
_izContext,
|
|
138
|
+
await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
139
|
+
payloadGetStoredCache
|
|
140
|
+
)
|
|
141
|
+
_izContext.logger.debug("==> getStoredCache:::", getStoredCache)
|
|
142
|
+
return ({
|
|
143
|
+
data: getStoredCache.Items[0],
|
|
144
|
+
identifierPK: identifierPK,
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
switch (getFlowSchema.statusType) {
|
|
94
149
|
case "statusField":
|
|
95
150
|
let payload = {
|
|
96
151
|
identifiers: requestParams.identifiers,
|
|
97
|
-
objectType:
|
|
152
|
+
objectType: getFlowSchema.objType.objectType
|
|
98
153
|
}
|
|
99
154
|
let result = await externalRequest.lambda.invokeSync(
|
|
100
155
|
_izContext,
|
|
101
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv",
|
|
156
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv", getFlowSchema.objType.serviceTag),
|
|
102
157
|
payload
|
|
103
158
|
)
|
|
104
159
|
if (!result) {
|
|
105
160
|
throw new NoRetryError(`statusField not found ${requestParams.identifiers}`)
|
|
106
161
|
}
|
|
162
|
+
await postToConnection({message:result}, connectionId)
|
|
107
163
|
return result
|
|
108
|
-
|
|
164
|
+
case "storedCache":
|
|
109
165
|
// if statusType=storedCache then query storedCache > post message to client -> remove connectionId if status = error || complete
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
taskKey: requestParams.identifiers,
|
|
115
|
-
connectionId: requestParams.connectionId
|
|
116
|
-
}
|
|
117
|
-
)
|
|
118
|
-
if (!getStoredCache) {
|
|
166
|
+
const resultStoredCache = resultStoredCache(getFlowSchema.objType.objectType)
|
|
167
|
+
|
|
168
|
+
if (!resultStoredCache) {
|
|
119
169
|
throw new NoRetryError(`storedCache not found ${requestParams.identifiers}`)
|
|
120
170
|
}
|
|
121
|
-
|
|
171
|
+
await postToConnection({message:resultStoredCache }, connectionId)
|
|
172
|
+
return resultStoredCache
|
|
122
173
|
case "none":
|
|
123
174
|
// if statusType=none -> post message to client ---- not remove connectionId when post message, can remove connectionId when cannot use connectionId only(user disconnect)
|
|
124
175
|
break
|
|
125
176
|
default:
|
|
126
|
-
throw new NoRetryError(`statusType not found ${
|
|
177
|
+
throw new NoRetryError(`statusType not found ${getFlowSchema.statusType}`)
|
|
127
178
|
}
|
|
128
179
|
|
|
129
180
|
} catch (err) {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require("path")
|
|
21
|
+
|
|
22
|
+
const templatePath = path.join(__dirname, '../../../resourceYaml/dynamodb/template.ejs')
|
|
23
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, defaultIamRolePerAction, DYNAMO_RESOURCE, RESOURCE_CLASSES, resourceNames, createIamRole, SOURCE_GENERATE_IAM_ROLE } = require('../../../../../MainLibs/src/Consts.js')
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* create param of crateSouce for FindData And processLogical
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} _izContext
|
|
29
|
+
* @param {String} srcPath
|
|
30
|
+
* @returns {Object[]}
|
|
31
|
+
*/
|
|
32
|
+
const createRegisterTable = (_izContext, srcPath) => {
|
|
33
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
34
|
+
const tableName = "RegisterRecords";
|
|
35
|
+
additionalResourcePermission.push(
|
|
36
|
+
createIamRole(
|
|
37
|
+
{
|
|
38
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
39
|
+
DYNAMO_RESOURCE.putItem,
|
|
40
|
+
DYNAMO_RESOURCE.getItem,
|
|
41
|
+
DYNAMO_RESOURCE.query,
|
|
42
|
+
DYNAMO_RESOURCE.deleteItem,
|
|
43
|
+
DYNAMO_RESOURCE.updateItem
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
[
|
|
47
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
|
|
48
|
+
]
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return [{
|
|
53
|
+
templatePath: templatePath,
|
|
54
|
+
templateData: {
|
|
55
|
+
tableName: tableName,
|
|
56
|
+
resourceName: tableName,
|
|
57
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RegisterRole,
|
|
58
|
+
additionalResourcePermission,
|
|
59
|
+
attributes: [
|
|
60
|
+
{
|
|
61
|
+
keyType: "partitionKey",
|
|
62
|
+
AttributeName: "identifierTask",
|
|
63
|
+
AttributeType: "S"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
keyType: "sortKey",
|
|
67
|
+
AttributeName: "connectionId",
|
|
68
|
+
AttributeType: "S"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
setting: {
|
|
73
|
+
initialData: 'Resources:\n',
|
|
74
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
75
|
+
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
76
|
+
fileExtension: '.yml',
|
|
77
|
+
isAppend: true
|
|
78
|
+
}
|
|
79
|
+
}];
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
module.exports = createRegisterTable;
|
|
@@ -48,7 +48,7 @@ function createDataForSnsIn(_izContext, srcPath) {
|
|
|
48
48
|
return [{
|
|
49
49
|
templatePath: templatePath,
|
|
50
50
|
templateData: {
|
|
51
|
-
queueName: FUNCTION_NAME.flowSchemaRegister
|
|
51
|
+
queueName: upperCase(FUNCTION_NAME.flowSchemaRegister),
|
|
52
52
|
firstLetterUpperCase: upperCase,
|
|
53
53
|
roleName: SOURCE_GENERATE_IAM_ROLE.RegisterRole,
|
|
54
54
|
},
|
package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs
CHANGED
|
@@ -9,4 +9,37 @@
|
|
|
9
9
|
- <%- queueName %>DLQ
|
|
10
10
|
- Arn
|
|
11
11
|
maxReceiveCount: 3
|
|
12
|
-
VisibilityTimeout: 120
|
|
12
|
+
VisibilityTimeout: 120
|
|
13
|
+
##==== [QueueDLQ]
|
|
14
|
+
<%- queueName %>DLQ:
|
|
15
|
+
Type: AWS::SQS::Queue
|
|
16
|
+
Properties:
|
|
17
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
18
|
+
##==== [QueuePolicy]
|
|
19
|
+
<%- queueName %>Policy:
|
|
20
|
+
Type: AWS::SQS::QueuePolicy
|
|
21
|
+
Properties:
|
|
22
|
+
PolicyDocument:
|
|
23
|
+
Version: "2012-10-17"
|
|
24
|
+
Statement:
|
|
25
|
+
- Sid: "allow-sns-messages"
|
|
26
|
+
Effect: Allow
|
|
27
|
+
Principal: "*"
|
|
28
|
+
Resource:
|
|
29
|
+
# !GetAtt
|
|
30
|
+
Fn::GetAtt:
|
|
31
|
+
- <%- queueName %>
|
|
32
|
+
- Arn
|
|
33
|
+
Action: "SQS:SendMessage"
|
|
34
|
+
Queues:
|
|
35
|
+
- Ref: <%- queueName %>
|
|
36
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
37
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<%_ function firstLetterUpperCase(text){
|
|
41
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
42
|
+
} _%>
|
|
43
|
+
<%_ function firstLetterLowerCase(str) {
|
|
44
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
45
|
+
} _%>
|
package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
function createExpiryTime (_izContext, expiryInterval) {
|
|
3
|
-
const currentTime = new Date();
|
|
4
|
-
const expiryTime = new Date(currentTime);
|
|
5
|
-
expiryTime.setTime(expiryTime.getTime() + expiryInterval);
|
|
6
|
-
return expiryTime.getTime();
|
|
7
|
-
};
|
|
1
|
+
let expiryTime = storedCacheSharedLib.createExpiryTime(_izContext, 31536000);
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
<%- flowTag %>Id: hash({
|
|
13
|
-
//(<createStoredCacheId>)
|
|
14
|
-
//(</createStoredCacheId>)
|
|
15
|
-
}),
|
|
16
|
-
cacheExpiryTime: createExpiryTime(_izContext, 31536000000),
|
|
17
|
-
cacheStatus: "processing",
|
|
18
|
-
cacheUniqueRequestId: _izContext.uniqueRequestId
|
|
19
|
-
}
|
|
20
|
-
)
|
|
3
|
+
//(<createKeyValuesStoredCacheTable>)
|
|
4
|
+
//(</createKeyValuesStoredCacheTable>)
|
|
21
5
|
|
|
22
|
-
await
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
identifiersTask: hash({
|
|
30
|
-
//(<updateStoredCacheId>)
|
|
31
|
-
//(</updateStoredCacheId>)
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
)
|
|
6
|
+
let [ cacheMainStauts, cacheId, cacheMain ] = await storedCacheSharedLib.checkStoredCacheStatus(
|
|
7
|
+
_izContext,
|
|
8
|
+
"<%- tableName %>",
|
|
9
|
+
//(<keyValueStoredCacheTable>)
|
|
10
|
+
//(</keyValueStoredCacheTable>)
|
|
11
|
+
)
|
package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js
CHANGED
|
@@ -45,29 +45,39 @@ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../.
|
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
47
|
function createDataForSubscriptionOutAll(_izContext, allLocalFlowSchemas, srcPath) {
|
|
48
|
-
console.log("allLocalFlowSchemas", allLocalFlowSchemas.records)
|
|
48
|
+
// console.log("allLocalFlowSchemas", allLocalFlowSchemas.records)
|
|
49
49
|
const result = []
|
|
50
50
|
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
51
51
|
let event = flowSchema.event;
|
|
52
|
-
if (!event.includes("eventBridge")) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
if (!event.includes("eventBridge") || !event.includes("s3")) {
|
|
53
|
+
let flowSteps = flowSchema.flowSteps;
|
|
54
|
+
if (!flowSteps) {
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
let queueName;
|
|
58
|
+
if (flowSchema.outputTopic) {
|
|
59
|
+
let flowStepOut = Object.keys(flowSchema.flowSteps)[1].split("_")
|
|
60
|
+
queueName = flowStepOut[3] + flowStepOut[2]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (queueName) {
|
|
64
|
+
result.push({
|
|
65
|
+
templatePath: templatePath,
|
|
66
|
+
templateData: {
|
|
67
|
+
queueName: queueName,
|
|
68
|
+
endpoint: "Register",
|
|
69
|
+
firstLetterUpperCase: upperCase,
|
|
70
|
+
},
|
|
71
|
+
setting: {
|
|
72
|
+
initialData: "Resources:\n",
|
|
73
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
74
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
75
|
+
fileExtension: ".yml",
|
|
76
|
+
isAppend: true
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
}
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
return result
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
##===== [Topic In]
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Subscription<%- queueName %>:
|
|
3
|
+
Type: AWS::SNS::Subscription
|
|
4
|
+
Properties:
|
|
5
|
+
TopicArn: !Ref <%- queueName %>
|
|
6
|
+
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- endpoint %>"
|
|
7
|
+
Protocol: "sqs"
|
|
8
8
|
<%_ function firstLetterUpperCase(text){
|
|
9
9
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
10
|
} _%>
|
package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js
CHANGED
|
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
|
|
22
|
-
const { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { FLOW_SCHEMA_HOOK_STATE, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
|
|
25
25
|
const {
|
|
@@ -37,6 +37,7 @@ const {
|
|
|
37
37
|
SOURCE_GENERATE_IAM_ROLE,
|
|
38
38
|
LAMBDA_RESOURCE
|
|
39
39
|
} = require("../../../../../../MainLibs/src/Consts");
|
|
40
|
+
const { getLocalObjectSchemas } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
40
41
|
|
|
41
42
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
42
43
|
const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
@@ -47,12 +48,11 @@ const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
|
47
48
|
* @param {Object} objectSchema
|
|
48
49
|
* @return {{templatePath, templateData,setting}}
|
|
49
50
|
*/
|
|
50
|
-
function data(_izContext, srcPath) {
|
|
51
|
+
async function data(_izContext, allLocalFlowSchemas, srcPath) {
|
|
51
52
|
const handlerType = upperCase("hdrWbs");
|
|
52
53
|
const functionName = FUNCTION_NAME.flowSchemaRegister;
|
|
53
54
|
let functionNameConfig = upperCase(functionName) + upperCase(shortNameHandler(handlerType));
|
|
54
55
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
55
|
-
let route = "webSocket";
|
|
56
56
|
|
|
57
57
|
additionalResourcePermission.push(
|
|
58
58
|
createIamRole(
|
|
@@ -91,40 +91,40 @@ function data(_izContext, srcPath) {
|
|
|
91
91
|
)
|
|
92
92
|
)
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
94
|
+
let tableStoredCacheList = new Set();
|
|
95
|
+
await Promise.all(allLocalFlowSchemas.records.map(async (flowSchema) => {
|
|
96
|
+
if (flowSchema.statusType === "storedCache") {
|
|
97
|
+
let objectSchema = await getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
98
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
99
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
100
|
+
tableStoredCacheList.add(storageResource.tableName);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}))
|
|
105
|
+
if (tableStoredCacheList.size > 0) {
|
|
106
|
+
let tableNames = [...tableStoredCacheList]
|
|
107
|
+
additionalResourcePermission.push(
|
|
108
|
+
createIamRole(
|
|
109
|
+
{
|
|
110
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
111
|
+
DYNAMO_RESOURCE.getItem,
|
|
112
|
+
// DYNAMO_RESOURCE.putItem,
|
|
113
|
+
// DYNAMO_RESOURCE.query,
|
|
114
|
+
// DYNAMO_RESOURCE.deleteItem,
|
|
115
|
+
// DYNAMO_RESOURCE.updateItem
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
tableNames.map(tableName => resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName))
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
}
|
|
120
122
|
|
|
121
|
-
// console.log("additionalResourcePermission in createObjectS3", JSON.stringify(additionalResourcePermission))
|
|
122
123
|
return [{
|
|
123
124
|
templatePath: templatePath,
|
|
124
125
|
templateData: {
|
|
125
|
-
resourceLocation: SOURCE_PATH.resourceLocationFlowSchemaRegister,
|
|
126
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchemaRegister, "source/"),
|
|
126
127
|
additionalResourcePermission,
|
|
127
|
-
route,
|
|
128
128
|
functionName,
|
|
129
129
|
handlerType,
|
|
130
130
|
roleName: SOURCE_GENERATE_IAM_ROLE.RegisterRole,
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
6
6
|
- websocket:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
route: <%- functionName %>
|
|
8
|
+
# authorizer: ${self:custom.iz_authorizerAppLevel}
|
|
9
|
+
# identifierResource: 'route.request.header.Auth'
|
|
10
10
|
role: <%- roleName %>Role
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
12
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
13
13
|
<%_ function firstLetterUpperCase(text){
|
|
14
14
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
15
15
|
} _%>
|
package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs
CHANGED
|
@@ -21,11 +21,10 @@ const { middlewareHandler, consts } = require("@izara_project/izara-middleware")
|
|
|
21
21
|
// const AWS = require('aws-sdk');
|
|
22
22
|
// const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
|
|
23
23
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
24
|
-
const callingFlowSharedLib = require('@izara_project/izara-core-calling-flow');
|
|
25
|
-
const hash = require('
|
|
24
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
25
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
26
26
|
// const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
27
|
-
const
|
|
28
|
-
const { postToConnection } = require("../../libs/source/ImportDataLib");
|
|
27
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
29
28
|
const { <%- functionName%>Main } = require("./<%- firstLetterUpperCase(functionName) %>_Main");
|
|
30
29
|
|
|
31
30
|
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
@@ -58,13 +57,17 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
58
57
|
|
|
59
58
|
let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
|
|
60
59
|
|
|
61
|
-
await
|
|
60
|
+
const result = await registerMain(
|
|
62
61
|
event._izContext,
|
|
63
62
|
eventParams,
|
|
64
63
|
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
65
64
|
//(<additionalParams>)
|
|
66
65
|
//(</additionalParams>)
|
|
67
66
|
)
|
|
67
|
+
await postToConnection(
|
|
68
|
+
{ message: result },
|
|
69
|
+
connectionId
|
|
70
|
+
)
|
|
68
71
|
break
|
|
69
72
|
}
|
|
70
73
|
} else {
|
|
@@ -72,15 +75,11 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
72
75
|
// await postMessage({ message: event.message }, connId);
|
|
73
76
|
await postToConnection({ message: event.message }, connId);
|
|
74
77
|
}
|
|
75
|
-
|
|
76
|
-
return (izara.response.webSocketSuccess());
|
|
77
|
-
|
|
78
78
|
} catch (err) {
|
|
79
79
|
const connId = event.requestContext.connectionId
|
|
80
80
|
event._izContext.logger.error('Error, WebSocket: ', err);
|
|
81
81
|
// await sendErrorMessage({ message: err.message }, connId);
|
|
82
82
|
await postToConnection({ message: err.message }, connId);
|
|
83
|
-
return (izara.response.failure(err));
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
85
|
<%_ const join = require('path').join _%>
|