@izara_project/izara-core-generate-service-code 1.0.53 → 1.0.54
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 -2
- package/src/codeGenerators/app/initial_setup/InitialSetupGenerator.js +1 -1
- package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +23 -0
- package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +1 -1
- package/src/codeGenerators/app/sls_yaml/ProcessLogicalYamlGenerator.js +11 -25
- package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +1 -1
- package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +3 -3
- package/src/codeGenerators/app/sls_yaml/renderYamlTemplate.js +13 -0
- package/src/codeGenerators/app/sls_yaml/templates/SharedResource_Yaml.ejs +6 -2
- package/src/codeGenerators/app/src/generatedCode/FindData/FindDataGenerator.js +10 -44
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowEndpoints/EndpointsGenerator.js +119 -0
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/RbacFlowGenerator.js +91 -52
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationshipEndpoints/RelationshipFlowGenerator.js +20 -16
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/StatusFieldGenerator.js +1 -1
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ConfirmAfterUploadS3Generator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreateObjectGenerator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreatePreSignUrlGenerator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ProcessAfterUploadS3Generator.js +5 -5
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ReservedLimitGenerator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowEntryPointBase.js +6 -6
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowMainFunctionBase.js +3 -3
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepBase.js +11 -11
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/ProcessLogicalGenerator.js +18 -15
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrDsq.js → PaginateProcessLogical_HdrDsq.ejs} +1 -1
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/RegisterGenerator.js +133 -149
- package/src/codeGenerators/app/src/generatedCode/libs/ConstsGenerator.js +16 -8
- package/src/codeGenerators/app/src/generatedCode/libs/GenerateCodeLibsGenerator.js +17 -9
- package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +11 -2
- package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +31 -4
- package/src/core/renderTemplateFile.js +22 -0
- package/src/generateCode.js +143 -110
- package/src/generateIntTest.js +45 -69
- package/src/generateResourceIntTest.js +22 -47
- package/src/intTestGeneratorShared.js +36 -0
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/data.js +0 -119
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/template.ejs +0 -89
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +0 -30
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +0 -26
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +0 -44
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/index.js +0 -80
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/data.js +0 -129
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/template.ejs +0 -17
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/handler/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/data.js +0 -54
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/template.ejs +0 -129
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/template.ejs +0 -45
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/data.js +0 -117
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/template.ejs +0 -20
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/handler/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/template.ejs +0 -131
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/data.js +0 -122
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/template.ejs +0 -17
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/data.js +0 -66
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/template.ejs +0 -99
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/template.ejs +0 -82
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/data.js +0 -70
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/template.ejs +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/data.js +0 -139
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/template.ejs +0 -18
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/handler/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/template.ejs +0 -262
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/template.ejs +0 -45
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/data.js +0 -146
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +0 -14
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/handler/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/data.js +0 -59
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +0 -173
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/data.js +0 -67
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/template.ejs +0 -53
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/data.js +0 -140
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/template.ejs +0 -25
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/data.js +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/template.ejs +0 -50
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/ProcessCsvtemplate.ejs +0 -182
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/data.js +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/template.ejs +0 -66
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/data.js +0 -77
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/dsqTemplatePath.ejs +0 -32
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/s3Template.ejs +0 -59
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/data.js +0 -61
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/template.ejs +0 -13
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/sns-out/data.js +0 -70
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/websocket/dynamoDb/ReservedTableData.js +0 -69
- package/src/codeGenerators/app/src/generatedCode/Flow/SystemFlowDescriptorBuilder.js +0 -151
- /package/src/codeGenerators/app/{src/generatedCode/FindData → sls_yaml}/templates/FindData_Yaml.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared/endpoint → FlowEndpoints/templates}/FlowEndpointBeforeLogical_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_HdrWbs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEntryPoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowMain_Wbs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/confirmReserved/handler/template.ejs → s3/ConfirmReserved_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/createObject/handler/template.ejs → s3/CreateObject_HdrWbs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/createPreSignUrl/handler/template.ejs → s3/CreatePreSignUrl_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/reservedLimit/handler/template.ejs → s3/ReservedLimit_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowEndpointComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowStep_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Awaiting_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Paginated_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_PlugIn_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_RecievePlugIn_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateAwaitingStep.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateSendPlugin.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/BaseSqsHandler.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/eventBridge.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/extTopic.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncApi.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncInv.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/ownTopic.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/registry.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrApi.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrInv.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/eventTypes.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowClassifier.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowNaming.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowSelection.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepNormalizer.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowValidator.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/registry.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/triggerCacheBase.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrDsq.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheQueue_Yaml.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/yaml/SharedFunctionSqs_Yaml.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrSqs.js → PaginateProcessLogical_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_Main.js → PaginateProcessLogical_Main.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_HdrSqs.js → ProcessLogical_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_Main.js → ProcessLogical_Main.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/libs/templates/{Consts.js → Consts.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/libs/templates/{GenerateCodeLibs.js → GenerateCodeLibs.ejs} +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
-
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
-
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
-
role: <%- roleName %>Role
|
|
6
|
-
#<#<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
7
|
-
#<#/<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
8
|
-
events:
|
|
9
|
-
- sqs:
|
|
10
|
-
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
11
|
-
batchSize: 10
|
|
12
|
-
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
13
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>"]}}} # functionName of callingFlow
|
|
14
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
15
|
-
<%_ function firstLetterUpperCase(text){
|
|
16
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
17
|
-
} _%>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '#libs/Consts.js';
|
|
24
|
-
import utils from '#libs/Utils.js';
|
|
25
|
-
|
|
26
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
27
|
-
utils;
|
|
28
|
-
const { HANDLER, SOURCE_PATH } = consts;
|
|
29
|
-
|
|
30
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* receive objectSchema
|
|
34
|
-
*
|
|
35
|
-
* @param {Object} flowSchema
|
|
36
|
-
* @return {{ templatePath, templateData, setting } }
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
function createSourceParams(_izContext, flowSchema, appPath) {
|
|
40
|
-
let functionName = 'ConfirmNewReserved';
|
|
41
|
-
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
templatePath: templatePath,
|
|
45
|
-
templateData: {
|
|
46
|
-
functionName,
|
|
47
|
-
handlerType
|
|
48
|
-
},
|
|
49
|
-
setting: {
|
|
50
|
-
saveFileName: `${functionName}_${handlerType}`,
|
|
51
|
-
savePath: path.join(
|
|
52
|
-
appPath,
|
|
53
|
-
SOURCE_PATH.webSocket,
|
|
54
|
-
flowSchema.flowTag,
|
|
55
|
-
'source/'
|
|
56
|
-
),
|
|
57
|
-
fileExtension: '.js',
|
|
58
|
-
isAppend: true
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default createSourceParams;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '#libs/Consts.js';
|
|
24
|
-
|
|
25
|
-
const { SOURCE_PATH } = consts;
|
|
26
|
-
|
|
27
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
28
|
-
/**
|
|
29
|
-
* receive objectSchema
|
|
30
|
-
*
|
|
31
|
-
* @param {Object} flowSchema
|
|
32
|
-
* @return {{ templatePath, templateData, setting } }
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
function createSourceParams(_izContext, flowSchema, appPath) {
|
|
36
|
-
let functionName = 'ConfirmNewReserved';
|
|
37
|
-
return {
|
|
38
|
-
templatePath: templatePath,
|
|
39
|
-
templateData: {},
|
|
40
|
-
setting: {
|
|
41
|
-
saveFileName: `${functionName}_Main`,
|
|
42
|
-
savePath: path.join(
|
|
43
|
-
appPath,
|
|
44
|
-
SOURCE_PATH.webSocket,
|
|
45
|
-
flowSchema.flowTag,
|
|
46
|
-
'source/'
|
|
47
|
-
),
|
|
48
|
-
fileExtension: '.js',
|
|
49
|
-
isAppend: false
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default createSourceParams;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
|
|
19
|
-
|
|
20
|
-
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
21
|
-
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
22
|
-
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
23
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
24
|
-
import { getNestObject } from '../../../../libs/source/GenerateCodeLibs.js';
|
|
25
|
-
|
|
26
|
-
//(<optionalRequired>)
|
|
27
|
-
//(</optionalRequired>)
|
|
28
|
-
/**
|
|
29
|
-
* description of function.
|
|
30
|
-
* @param {Object} _izContext
|
|
31
|
-
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
32
|
-
* @param {Logger} _izContext.logger - property of _izContext
|
|
33
|
-
* @param {Logger} _izContext.logger - property of _izContext
|
|
34
|
-
* @param {Object} returnMessage - limitValue or limitFound
|
|
35
|
-
* @param {Array} errorsFound - array
|
|
36
|
-
* @param {boolean} passStatus - true || false
|
|
37
|
-
* @param {Object} passBackProperties - identifier
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
* @returns {object} returnResponse
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
export default async function <%= functionName %>(
|
|
44
|
-
_izContext,
|
|
45
|
-
returnMessage,
|
|
46
|
-
errorsFound,
|
|
47
|
-
passStatus,
|
|
48
|
-
//(<additionalProperties>)
|
|
49
|
-
//(</additionalProperties>)
|
|
50
|
-
passBackProperties = {}
|
|
51
|
-
) {
|
|
52
|
-
try {
|
|
53
|
-
_izContext.logger.debug('----- <%= functionName %> event params', {
|
|
54
|
-
_izContext: _izContext,
|
|
55
|
-
returnMessage: returnMessage,
|
|
56
|
-
errorsFound: errorsFound,
|
|
57
|
-
passStatus: passStatus,
|
|
58
|
-
passBackProperties: passBackProperties
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
let servicePendingId = passBackProperties.passBackProperties.identifier.servicePendingId;
|
|
62
|
-
let reservedDataId = passBackProperties.passBackProperties.identifier.reservedDataId;
|
|
63
|
-
let userId = passBackProperties.passBackProperties.identifier.userId;
|
|
64
|
-
let realFileSize = passBackProperties.passBackProperties.identifier.realFileSize;
|
|
65
|
-
|
|
66
|
-
let uniqueIdentify = getNestObject(
|
|
67
|
-
_izContext,
|
|
68
|
-
returnMessage.limitFound,
|
|
69
|
-
["runningTotal", "uniqueIdentify", "usedTimestampId"]
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
// confirmUsage
|
|
73
|
-
let confirmUsageMessage = {
|
|
74
|
-
userId: userId,
|
|
75
|
-
//(<optionalLimitTag>)
|
|
76
|
-
limitTag: consts.LIMIT_TAG.uploadData,
|
|
77
|
-
//(</optionalLimitTag>)
|
|
78
|
-
uniqueIdentify: uniqueIdentify,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
let sendMessageToConfirmUsage = {
|
|
82
|
-
Message: JSON.stringify(confirmUsageMessage),
|
|
83
|
-
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, 'ConfirmUsage_In', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
84
|
-
};
|
|
85
|
-
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
86
|
-
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
87
|
-
|
|
88
|
-
// update reservedDataValue as real size in ReservedDataMain table
|
|
89
|
-
await dynamodbSharedLib.updateItem(
|
|
90
|
-
_izContext,
|
|
91
|
-
await dynamodbSharedLib.tableName(_izContext, 'ReservedDataMain'),
|
|
92
|
-
{
|
|
93
|
-
servicePendingId: servicePendingId,
|
|
94
|
-
reservedDataId: reservedDataId
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
reservedValue: realFileSize
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
let sendMessageToUpdateStatus = {
|
|
102
|
-
//(<messageObjectHook>)
|
|
103
|
-
//(</messageObjectHook>)
|
|
104
|
-
objInstanceFull: {
|
|
105
|
-
identifiers: {
|
|
106
|
-
//(<identifiers>)
|
|
107
|
-
//(</identifiers>)
|
|
108
|
-
},
|
|
109
|
-
fields: {
|
|
110
|
-
//(<fields>)
|
|
111
|
-
//(</fields>)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let sendMessageToUpdateEndpoint = {
|
|
117
|
-
Message: JSON.stringify(sendMessageToUpdateStatus),
|
|
118
|
-
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "Update_In")
|
|
119
|
-
};
|
|
120
|
-
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
121
|
-
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
122
|
-
|
|
123
|
-
return { returnResponse: 'success' }
|
|
124
|
-
|
|
125
|
-
} catch (err) {
|
|
126
|
-
_izContext.logger.debug('error <%= functionName %>Main: ', err)
|
|
127
|
-
throw (err)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '#libs/Consts.js';
|
|
24
|
-
|
|
25
|
-
const { SOURCE_PATH, SAVE_FILE_NAME } = consts;
|
|
26
|
-
|
|
27
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* create data for dynamoDbYaml tempalte from objectSchema
|
|
31
|
-
* return array of dynamoDb data
|
|
32
|
-
* because one objectSchema can create multiple dynamoDb table
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} _izContext
|
|
35
|
-
* @param {Object} objectSchema
|
|
36
|
-
* @returns {Object[]} - data of multiple dynamoDb template
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
function data(_izContext, appPath) {
|
|
40
|
-
let resultForCreateSqs = [];
|
|
41
|
-
const WebSocketSqsQueueNames = [];
|
|
42
|
-
const setting = {
|
|
43
|
-
initialData: 'Resources:\n',
|
|
44
|
-
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
45
|
-
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
46
|
-
fileExtension: '.yml',
|
|
47
|
-
isAppend: true
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
WebSocketSqsQueueNames.push({
|
|
51
|
-
queueName: 'ConfirmNewReserved'
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
for (let WebSocketSqsQueueName of WebSocketSqsQueueNames) {
|
|
55
|
-
resultForCreateSqs.push({
|
|
56
|
-
templatePath: templatePath,
|
|
57
|
-
templateData: WebSocketSqsQueueName,
|
|
58
|
-
setting: setting
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return resultForCreateSqs;
|
|
62
|
-
}
|
|
63
|
-
export default data;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
##===== [Queue]
|
|
2
|
-
<%- queueName %>HdrSqs:
|
|
3
|
-
Type: "AWS::SQS::Queue"
|
|
4
|
-
Properties:
|
|
5
|
-
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
|
|
6
|
-
RedrivePolicy:
|
|
7
|
-
deadLetterTargetArn:
|
|
8
|
-
# !GetAtt
|
|
9
|
-
Fn::GetAtt:
|
|
10
|
-
- <%- queueName %>HdrSqsDLQ
|
|
11
|
-
- Arn
|
|
12
|
-
maxReceiveCount: 3
|
|
13
|
-
VisibilityTimeout: 120
|
|
14
|
-
##==== [QueueDLQ]
|
|
15
|
-
<%- queueName %>HdrSqsDLQ:
|
|
16
|
-
Type: AWS::SQS::Queue
|
|
17
|
-
Properties:
|
|
18
|
-
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
|
|
19
|
-
##==== [QueuePolicy]
|
|
20
|
-
<%- queueName %>HdrSqsPolicy:
|
|
21
|
-
Type: AWS::SQS::QueuePolicy
|
|
22
|
-
Properties:
|
|
23
|
-
PolicyDocument:
|
|
24
|
-
Version: "2012-10-17"
|
|
25
|
-
Statement:
|
|
26
|
-
- Sid: "allow-sns-messages"
|
|
27
|
-
Effect: Allow
|
|
28
|
-
Principal: "*"
|
|
29
|
-
Resource:
|
|
30
|
-
# !GetAtt
|
|
31
|
-
Fn::GetAtt:
|
|
32
|
-
- <%- queueName %>HdrSqs
|
|
33
|
-
- Arn
|
|
34
|
-
Action: "SQS:SendMessage"
|
|
35
|
-
Queues:
|
|
36
|
-
- Ref: <%- queueName %>HdrSqs
|
|
37
|
-
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
38
|
-
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
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
|
-
} _%>
|
|
@@ -1,117 +0,0 @@
|
|
|
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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '#libs/Consts.js';
|
|
24
|
-
import utils from '#libs/Utils.js';
|
|
25
|
-
import libs from '#libs/Libs.js';
|
|
26
|
-
|
|
27
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
28
|
-
utils;
|
|
29
|
-
const {
|
|
30
|
-
RESOURCE_CLASSES,
|
|
31
|
-
SNS_RESOURCE,
|
|
32
|
-
SOURCE_PATH,
|
|
33
|
-
SAVE_FILE_NAME,
|
|
34
|
-
DYNAMO_RESOURCE,
|
|
35
|
-
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
-
ACTIONS,
|
|
37
|
-
FUNCTION_NAME
|
|
38
|
-
} = consts;
|
|
39
|
-
|
|
40
|
-
const {
|
|
41
|
-
defaultIamRolePerAction,
|
|
42
|
-
createIamRole,
|
|
43
|
-
resourceNames,
|
|
44
|
-
shortNameHandler
|
|
45
|
-
} = libs;
|
|
46
|
-
|
|
47
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
48
|
-
/**
|
|
49
|
-
* receive objectSchema
|
|
50
|
-
* create data for WebScoket handler template
|
|
51
|
-
*
|
|
52
|
-
* @param {Object} objectSchema
|
|
53
|
-
* @return {{templatePath, templateData,setting}}
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
function createSourceParams(_izContext, flowSchema, appPath) {
|
|
57
|
-
let functionName = upperCase(FUNCTION_NAME.createObjectS3);
|
|
58
|
-
let handlerType = upperCase('hdrWbs');
|
|
59
|
-
let additionalResourcePermission = defaultIamRolePerAction();
|
|
60
|
-
let route = flowSchema.flowTag;
|
|
61
|
-
|
|
62
|
-
additionalResourcePermission.push(
|
|
63
|
-
createIamRole(
|
|
64
|
-
{
|
|
65
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
66
|
-
},
|
|
67
|
-
[resourceNames(RESOURCE_CLASSES.sns, upperCase(ACTIONS.create) + '_In')]
|
|
68
|
-
),
|
|
69
|
-
createIamRole(
|
|
70
|
-
{
|
|
71
|
-
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
72
|
-
DYNAMO_RESOURCE.putItem,
|
|
73
|
-
DYNAMO_RESOURCE.getItem,
|
|
74
|
-
DYNAMO_RESOURCE.query,
|
|
75
|
-
DYNAMO_RESOURCE.deleteItem,
|
|
76
|
-
DYNAMO_RESOURCE.updateItem
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
[
|
|
80
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, 'WebSocketTask'),
|
|
81
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, 'UserUploadRecords')
|
|
82
|
-
]
|
|
83
|
-
),
|
|
84
|
-
createIamRole(
|
|
85
|
-
{
|
|
86
|
-
'execute-api': ['ManageConnections']
|
|
87
|
-
},
|
|
88
|
-
[resourceNames(RESOURCE_CLASSES.webSocket)]
|
|
89
|
-
)
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
templatePath: templatePath,
|
|
94
|
-
templateData: {
|
|
95
|
-
resourceLocation: path.join(
|
|
96
|
-
SOURCE_PATH.resourceLocationWebSocket,
|
|
97
|
-
flowSchema.flowTag,
|
|
98
|
-
'source/'
|
|
99
|
-
),
|
|
100
|
-
functionName,
|
|
101
|
-
handlerType,
|
|
102
|
-
additionalResourcePermission,
|
|
103
|
-
route,
|
|
104
|
-
functionNameConfig:
|
|
105
|
-
upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
106
|
-
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
107
|
-
},
|
|
108
|
-
setting: {
|
|
109
|
-
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
110
|
-
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
111
|
-
fileExtension: '.yml',
|
|
112
|
-
isAppend: true
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default createSourceParams;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
-
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
-
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
-
role: <%- roleName %>Role
|
|
6
|
-
#<#<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
7
|
-
#<#/<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
8
|
-
events:
|
|
9
|
-
- websocket:
|
|
10
|
-
route: $default
|
|
11
|
-
- websocket:
|
|
12
|
-
route: <%- route %>
|
|
13
|
-
# authorizer: ${self:custom.iz_authorizerAppLevel}
|
|
14
|
-
# identifierResource: 'route.request.header.Auth'
|
|
15
|
-
<%_ function firstLetterUpperCase(text){
|
|
16
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
17
|
-
} _%>
|
|
18
|
-
<%_ function firstLetterLowerCase(str) {
|
|
19
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
20
|
-
} _%>
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '#libs/Consts.js';
|
|
24
|
-
import utils from '#libs/Utils.js';
|
|
25
|
-
|
|
26
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
27
|
-
utils;
|
|
28
|
-
const { SOURCE_PATH, FUNCTION_NAME } = consts;
|
|
29
|
-
|
|
30
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* receive objectSchema
|
|
34
|
-
* create data for WebScoket handler template
|
|
35
|
-
*
|
|
36
|
-
* @param {Object} objectSchema
|
|
37
|
-
* @return {{templatePath, templateData,setting}}
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
41
|
-
let functionName = upperCase(FUNCTION_NAME.createObjectS3);
|
|
42
|
-
let handlerType = 'HdrWbs';
|
|
43
|
-
let route = flowSchema.flowTag;
|
|
44
|
-
return {
|
|
45
|
-
templatePath: templatePath,
|
|
46
|
-
templateData: {
|
|
47
|
-
functionName,
|
|
48
|
-
handlerType,
|
|
49
|
-
route
|
|
50
|
-
},
|
|
51
|
-
setting: {
|
|
52
|
-
savePath: path.join(
|
|
53
|
-
appPath,
|
|
54
|
-
SOURCE_PATH.webSocket,
|
|
55
|
-
flowSchema.flowTag,
|
|
56
|
-
'source/'
|
|
57
|
-
),
|
|
58
|
-
saveFileName: `${functionName}_${handlerType}`,
|
|
59
|
-
fileExtension: '.js',
|
|
60
|
-
isAppend: false
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export default createParamsForCreateSource;
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '#libs/Consts.js';
|
|
24
|
-
import utils from '#libs/Utils.js';
|
|
25
|
-
|
|
26
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
27
|
-
utils;
|
|
28
|
-
const { SOURCE_PATH, FUNCTION_NAME } = consts;
|
|
29
|
-
|
|
30
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* receive objectSchema
|
|
34
|
-
* create data for WebSocket handler template
|
|
35
|
-
*
|
|
36
|
-
* @param {Object} objectSchema
|
|
37
|
-
* @return {{templatePath, templateData,setting}}
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
41
|
-
let functionName = upperCase(FUNCTION_NAME.createObjectS3);
|
|
42
|
-
let objectType = flowSchema.objType.objectType;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
templatePath: templatePath,
|
|
46
|
-
templateData: {
|
|
47
|
-
flowTag: flowSchema.flowTag,
|
|
48
|
-
objectType
|
|
49
|
-
},
|
|
50
|
-
setting: {
|
|
51
|
-
savePath: path.join(
|
|
52
|
-
appPath,
|
|
53
|
-
SOURCE_PATH.webSocket,
|
|
54
|
-
flowSchema.flowTag,
|
|
55
|
-
'source/'
|
|
56
|
-
),
|
|
57
|
-
saveFileName: `${functionName}_Main`,
|
|
58
|
-
fileExtension: '.js',
|
|
59
|
-
isAppend: false
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default createParamsForCreateSource;
|