@izara_project/izara-core-generate-service-code 1.0.66 → 1.0.68
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/.prettierrc +11 -0
- package/docs/TriggeredCache Flow.drawio +193 -0
- package/docs/TriggeredCacheFlow.mmd +47 -0
- package/package.json +16 -12
- package/scripts/format-ejs.js +105 -0
- package/src/compile/compileProject.js +16 -1
- package/src/compile/loadSchemas.js +108 -1
- package/src/emit/crud/emitCrudApplicationArtifacts.js +9 -5
- package/src/emit/crud/emitDynamicCrudFlowSchemas.js +1 -2
- package/src/emit/crud/templates/CreateEndpoint_Main.ejs +300 -109
- package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +221 -143
- package/src/emit/crud/templates/FlowEndpointBeforeLogical_Main.ejs +22 -6
- package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +150 -38
- package/src/emit/crud/templates/FlowEndpoint_HdrWbs.ejs +51 -31
- package/src/emit/crud/templates/FlowHandler_HdrApi.ejs +57 -31
- package/src/emit/crud/templates/FlowHandler_HdrInv.ejs +28 -26
- package/src/emit/crud/templates/FlowHandler_HdrSqs.ejs +15 -11
- package/src/emit/crud/templates/FlowMain_Wbs.ejs +53 -38
- package/src/emit/crud/templates/GetEndpoint_Main.ejs +6 -3
- package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +2 -2
- package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +407 -252
- package/src/emit/custom/customFlows.js +112 -31
- package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +89 -77
- package/src/emit/custom/templates/FlowEndpoint_Main.ejs +49 -37
- package/src/emit/custom/templates/FlowStep_Main.ejs +7 -9
- package/src/emit/custom/templates/s3/ConfirmReserved_HdrSqs.ejs +59 -54
- package/src/emit/custom/templates/s3/ConfirmReserved_Main.ejs +33 -23
- package/src/emit/custom/templates/s3/CreateObject_HdrWbs.ejs +30 -23
- package/src/emit/custom/templates/s3/CreateObject_Main.ejs +56 -39
- package/src/emit/custom/templates/s3/CreatePreSignUrl_HdrSqs.ejs +56 -51
- package/src/emit/custom/templates/s3/CreatePreSignUrl_Main.ejs +112 -75
- package/src/emit/custom/templates/s3/FlowHandler_HdrS3.ejs +12 -7
- package/src/emit/custom/templates/s3/ProcessS3File_Main.ejs +11 -8
- package/src/emit/custom/templates/s3/ReservedLimit_HdrSqs.ejs +64 -55
- package/src/emit/custom/templates/s3/ReservedLimit_Main.ejs +74 -52
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +58 -14
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +12 -17
- package/src/emit/custom/templates/triggerCache/TriggerCacheComplete_Main.ejs +20 -13
- package/src/emit/custom/templates/triggerCache/TriggerCache_Main.ejs +4 -1
- package/src/emit/function/functionYamlArtifact.js +46 -12
- package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +28 -15
- package/src/emit/rbac/emitRbacApplicationArtifacts.js +179 -66
- package/src/emit/rbac/templates/CreateTargetRole_HdrSqs.ejs +41 -18
- package/src/emit/rbac/templates/CreateTargetRole_Main.ejs +23 -3
- package/src/emit/rbac/templates/ListRbac_HdrApi.ejs +27 -5
- package/src/emit/rbac/templates/ListRbac_HdrSqs.ejs +41 -8
- package/src/emit/rbac/templates/ListRbac_Main.ejs +26 -6
- package/src/emit/rbac/templates/RbacMutation_Main.ejs +23 -3
- package/src/emit/rbac/templates/UserRbacFlow_HdrSqs.ejs +46 -0
- package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +152 -33
- package/src/emit/rbac/templates/UserRoleMutation_Main.ejs +24 -4
- package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -2
- package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +6 -5
- package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +64 -37
- package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +260 -144
- package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +68 -43
- package/src/emit/relationship/templates/CreateRelationship_Main.ejs +315 -171
- package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +67 -41
- package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +226 -115
- package/src/emit/relationship/templates/FlowHandler_HdrApi.ejs +41 -33
- package/src/emit/relationship/templates/FlowHandler_HdrDsq.ejs +15 -11
- package/src/emit/relationship/templates/FlowHandler_HdrInv.ejs +28 -26
- package/src/emit/relationship/templates/FlowHandler_HdrSqs.ejs +15 -11
- package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +46 -26
- package/src/emit/relationship/templates/GetRelationship_Main.ejs +233 -126
- package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +72 -44
- package/src/emit/relationship/templates/MoveRelationship_Main.ejs +266 -150
- package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +74 -45
- package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +285 -152
- package/src/emit/resource/emitResourceArtifacts.js +499 -108
- package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +18 -18
- package/src/emit/resource/templates/FlowOut_Yaml.ejs +5 -5
- package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +138 -0
- package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +44 -44
- package/src/emit/resource/templates/ResourceSqsYaml.ejs +36 -36
- package/src/emit/resource/templates/ResourceYaml.ejs +48 -48
- package/src/emit/resource/templates/S3Bucket_Yaml.ejs +19 -0
- package/src/emit/resource/templates/SharedResource_Yaml.ejs +11 -11
- package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +105 -105
- package/src/emit/system/emitSystemWebSocketArtifacts.js +2 -1
- package/src/generate.js +8 -4
- package/test/createTargetRoleHandler.test.js +63 -14
- package/test/crudApplicationArtifacts.test.js +1 -1
- package/test/customFlowApplicationArtifacts.test.js +71 -43
- package/test/dynamicCrudFlowSchemas.test.js +6 -6
- package/test/dynamicRbacFlowSchemas.test.js +8 -12
- package/test/dynamicRelationshipFlowSchemas.test.js +3 -3
- package/test/publicApi.test.js +11 -13
- package/test/resourceArtifacts.test.js +13 -3
- package/src/emit/rbac/templates/UserRbacFlow_HdrInv.ejs +0 -10
package/.prettierrc
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<mxfile host="app.diagrams.net">
|
|
2
|
+
<diagram name="Page-1" id="pXYk_RwGkFAkQVFTFBd9">
|
|
3
|
+
<mxGraphModel grid="1" page="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
|
4
|
+
<root>
|
|
5
|
+
<mxCell id="0" />
|
|
6
|
+
<mxCell id="1" parent="0" />
|
|
7
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-1" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="PrepComparisData_Main" vertex="1">
|
|
8
|
+
<mxGeometry height="120" width="120" x="354" y="120" as="geometry" />
|
|
9
|
+
</mxCell>
|
|
10
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-2" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-1" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" value="">
|
|
11
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
12
|
+
<mxPoint x="370" y="330" as="sourcePoint" />
|
|
13
|
+
<mxPoint x="414" y="340" as="targetPoint" />
|
|
14
|
+
</mxGeometry>
|
|
15
|
+
</mxCell>
|
|
16
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-3" connectable="0" parent="tqax0Luh1uLb62xYIonj-2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#60a917;fontColor=#ffffff;labelBorderColor=#2D7600;" value="checkTriggeredCacheV2&nbsp;<div><br></div><div>ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม</div>" vertex="1">
|
|
17
|
+
<mxGeometry relative="1" x="-0.1668" y="2" as="geometry">
|
|
18
|
+
<mxPoint x="-2" y="78" as="offset" />
|
|
19
|
+
</mxGeometry>
|
|
20
|
+
</mxCell>
|
|
21
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-15" connectable="0" parent="tqax0Luh1uLb62xYIonj-2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#60a917;fontColor=#ffffff;labelBorderColor=#2D7600;" value="checkTriggerFlowCompleteAwaitingStepV2&nbsp;<div><br></div><div>ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม</div>" vertex="1">
|
|
22
|
+
<mxGeometry relative="1" x="-0.1668" y="2" as="geometry">
|
|
23
|
+
<mxPoint x="4" y="339" as="offset" />
|
|
24
|
+
</mxGeometry>
|
|
25
|
+
</mxCell>
|
|
26
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-23" connectable="0" parent="tqax0Luh1uLb62xYIonj-2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#60a917;fontColor=#ffffff;labelBorderColor=#2D7600;" value="checkTriggerResetedV2&nbsp;<div><br></div><div>ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม</div>" vertex="1">
|
|
27
|
+
<mxGeometry relative="1" x="-0.1668" y="2" as="geometry">
|
|
28
|
+
<mxPoint x="764" y="218" as="offset" />
|
|
29
|
+
</mxGeometry>
|
|
30
|
+
</mxCell>
|
|
31
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-4" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
|
|
32
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
33
|
+
<mxPoint x="360" y="380" as="sourcePoint" />
|
|
34
|
+
<mxPoint x="360" y="480" as="targetPoint" />
|
|
35
|
+
</mxGeometry>
|
|
36
|
+
</mxCell>
|
|
37
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-5" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
|
|
38
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
39
|
+
<mxPoint x="480" y="380" as="sourcePoint" />
|
|
40
|
+
<mxPoint x="480" y="480" as="targetPoint" />
|
|
41
|
+
</mxGeometry>
|
|
42
|
+
</mxCell>
|
|
43
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-6" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="มี" vertex="1">
|
|
44
|
+
<mxGeometry height="30" width="80" x="320" y="480" as="geometry" />
|
|
45
|
+
</mxCell>
|
|
46
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-7" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="ไม่มี" vertex="1">
|
|
47
|
+
<mxGeometry height="30" width="80" x="440" y="480" as="geometry" />
|
|
48
|
+
</mxCell>
|
|
49
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-9" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-6" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" value="">
|
|
50
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
51
|
+
<mxPoint x="320" y="495" as="sourcePoint" />
|
|
52
|
+
<mxPoint x="200" y="495" as="targetPoint" />
|
|
53
|
+
</mxGeometry>
|
|
54
|
+
</mxCell>
|
|
55
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-11" parent="1" style="shape=tape;whiteSpace=wrap;html=1;" value="สร้าง request ไปที่<div>triggerFlow</div>" vertex="1">
|
|
56
|
+
<mxGeometry height="135" width="120" x="80" y="427.5" as="geometry" />
|
|
57
|
+
</mxCell>
|
|
58
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-12" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="CheckTriggerCache<div>Complete</div>" vertex="1">
|
|
59
|
+
<mxGeometry height="104" width="104" x="370" y="800" as="geometry" />
|
|
60
|
+
</mxCell>
|
|
61
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-16" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-12" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" value="">
|
|
62
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
63
|
+
<mxPoint x="210" y="680" as="sourcePoint" />
|
|
64
|
+
<mxPoint x="420" y="640" as="targetPoint" />
|
|
65
|
+
</mxGeometry>
|
|
66
|
+
</mxCell>
|
|
67
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-17" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-6" value="">
|
|
68
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
69
|
+
<mxPoint x="360" y="600" as="sourcePoint" />
|
|
70
|
+
<mxPoint x="330" y="530" as="targetPoint" />
|
|
71
|
+
</mxGeometry>
|
|
72
|
+
</mxCell>
|
|
73
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-18" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" value="">
|
|
74
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
75
|
+
<mxPoint x="479.65999999999997" y="600" as="sourcePoint" />
|
|
76
|
+
<mxPoint x="479.65999999999997" y="510" as="targetPoint" />
|
|
77
|
+
</mxGeometry>
|
|
78
|
+
</mxCell>
|
|
79
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-19" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" value="">
|
|
80
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
81
|
+
<mxPoint x="520" y="494.65647058823527" as="sourcePoint" />
|
|
82
|
+
<mxPoint x="640" y="494.65647058823527" as="targetPoint" />
|
|
83
|
+
</mxGeometry>
|
|
84
|
+
</mxCell>
|
|
85
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-20" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="ProcessTriggerCache<div>PrepComparisData</div>" vertex="1">
|
|
86
|
+
<mxGeometry height="104" width="104" x="640" y="443" as="geometry" />
|
|
87
|
+
</mxCell>
|
|
88
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-21" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-22" value="">
|
|
89
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
90
|
+
<mxPoint x="744" y="494.6464705882353" as="sourcePoint" />
|
|
91
|
+
<mxPoint x="864" y="494.6464705882353" as="targetPoint" />
|
|
92
|
+
</mxGeometry>
|
|
93
|
+
</mxCell>
|
|
94
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-22" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="ProcessTriggerCache<div>PrepComparisData</div>" vertex="1">
|
|
95
|
+
<mxGeometry height="104" width="104" x="864" y="443" as="geometry" />
|
|
96
|
+
</mxCell>
|
|
97
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-24" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-22" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" value="">
|
|
98
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
99
|
+
<mxPoint x="990" y="520" as="sourcePoint" />
|
|
100
|
+
<mxPoint x="1080" y="495" as="targetPoint" />
|
|
101
|
+
</mxGeometry>
|
|
102
|
+
</mxCell>
|
|
103
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-25" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-26" value="">
|
|
104
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
105
|
+
<mxPoint x="1180" y="480" as="sourcePoint" />
|
|
106
|
+
<mxPoint x="1150" y="410" as="targetPoint" />
|
|
107
|
+
</mxGeometry>
|
|
108
|
+
</mxCell>
|
|
109
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-26" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="มี" vertex="1">
|
|
110
|
+
<mxGeometry height="30" width="80" x="1140" y="360" as="geometry" />
|
|
111
|
+
</mxCell>
|
|
112
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-27" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-26" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" target="tqax0Luh1uLb62xYIonj-11" value="">
|
|
113
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
114
|
+
<Array as="points">
|
|
115
|
+
<mxPoint x="1180" y="80" />
|
|
116
|
+
<mxPoint x="170" y="80" />
|
|
117
|
+
</Array>
|
|
118
|
+
<mxPoint x="860" y="240" as="sourcePoint" />
|
|
119
|
+
<mxPoint x="910" y="190" as="targetPoint" />
|
|
120
|
+
</mxGeometry>
|
|
121
|
+
</mxCell>
|
|
122
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-28" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
|
|
123
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
124
|
+
<mxPoint x="1180" y="520" as="sourcePoint" />
|
|
125
|
+
<mxPoint x="1180" y="600" as="targetPoint" />
|
|
126
|
+
</mxGeometry>
|
|
127
|
+
</mxCell>
|
|
128
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-29" parent="1" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" value="<div><span style="font-size: 11px; white-space: nowrap; background-color: rgb(74, 137, 12);">checkTriggerResetedV2</span></div><div><br></div>check&nbsp;Timestamp Match<span style="background-color: transparent; color: light-dark(rgb(255, 255, 255), rgb(18, 18, 18));">&nbsp;</span>" vertex="1">
|
|
129
|
+
<mxGeometry height="60" width="200" x="1080" y="720" as="geometry" />
|
|
130
|
+
</mxCell>
|
|
131
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-30" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="ไม่มี" vertex="1">
|
|
132
|
+
<mxGeometry height="30" width="80" x="1140" y="600" as="geometry" />
|
|
133
|
+
</mxCell>
|
|
134
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-31" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-30" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" value="">
|
|
135
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
136
|
+
<mxPoint x="1179.41" y="640" as="sourcePoint" />
|
|
137
|
+
<mxPoint x="1179.4099999999999" y="720" as="targetPoint" />
|
|
138
|
+
</mxGeometry>
|
|
139
|
+
</mxCell>
|
|
140
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-33" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="match" vertex="1">
|
|
141
|
+
<mxGeometry height="30" width="80" x="1360" y="735" as="geometry" />
|
|
142
|
+
</mxCell>
|
|
143
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-34" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="not match" vertex="1">
|
|
144
|
+
<mxGeometry height="30" width="80" x="920" y="735" as="geometry" />
|
|
145
|
+
</mxCell>
|
|
146
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-35" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-29" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-34" value="">
|
|
147
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
148
|
+
<mxPoint x="1120" y="680" as="sourcePoint" />
|
|
149
|
+
<mxPoint x="1170" y="630" as="targetPoint" />
|
|
150
|
+
</mxGeometry>
|
|
151
|
+
</mxCell>
|
|
152
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-36" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-29" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" target="tqax0Luh1uLb62xYIonj-33" value="">
|
|
153
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
154
|
+
<mxPoint x="1120" y="680" as="sourcePoint" />
|
|
155
|
+
<mxPoint x="1170" y="630" as="targetPoint" />
|
|
156
|
+
</mxGeometry>
|
|
157
|
+
</mxCell>
|
|
158
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-37" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-34" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" target="tqax0Luh1uLb62xYIonj-20" value="">
|
|
159
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
160
|
+
<Array as="points">
|
|
161
|
+
<mxPoint x="690" y="750" />
|
|
162
|
+
</Array>
|
|
163
|
+
<mxPoint x="930" y="680" as="sourcePoint" />
|
|
164
|
+
<mxPoint x="980" y="630" as="targetPoint" />
|
|
165
|
+
</mxGeometry>
|
|
166
|
+
</mxCell>
|
|
167
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-38" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
|
|
168
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
169
|
+
<mxPoint x="1440" y="750" as="sourcePoint" />
|
|
170
|
+
<mxPoint x="1560" y="750" as="targetPoint" />
|
|
171
|
+
</mxGeometry>
|
|
172
|
+
</mxCell>
|
|
173
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-39" parent="1" style="shape=tape;whiteSpace=wrap;html=1;" value="PrepComparisData_Out" vertex="1">
|
|
174
|
+
<mxGeometry height="100" width="230" x="1560" y="690" as="geometry" />
|
|
175
|
+
</mxCell>
|
|
176
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-40" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-11" style="endArrow=classic;html=1;rounded=0;exitX=0.25;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-12" value="">
|
|
177
|
+
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
|
178
|
+
<Array as="points">
|
|
179
|
+
<mxPoint x="110" y="852" />
|
|
180
|
+
</Array>
|
|
181
|
+
<mxPoint x="780" y="680" as="sourcePoint" />
|
|
182
|
+
<mxPoint x="830" y="630" as="targetPoint" />
|
|
183
|
+
</mxGeometry>
|
|
184
|
+
</mxCell>
|
|
185
|
+
<mxCell id="tqax0Luh1uLb62xYIonj-41" connectable="0" parent="tqax0Luh1uLb62xYIonj-40" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" value="Sub to Out topic" vertex="1">
|
|
186
|
+
<mxGeometry relative="1" x="-0.6336" y="-2" as="geometry">
|
|
187
|
+
<mxPoint as="offset" />
|
|
188
|
+
</mxGeometry>
|
|
189
|
+
</mxCell>
|
|
190
|
+
</root>
|
|
191
|
+
</mxGraphModel>
|
|
192
|
+
</diagram>
|
|
193
|
+
</mxfile>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
flowchart TD
|
|
2
|
+
classDef process fill:#d4edda,stroke:#28a745,stroke-width:2px,color:#000;
|
|
3
|
+
classDef check fill:#fff3cd,stroke:#ffc107,stroke-width:2px,color:#000;
|
|
4
|
+
classDef complete fill:#cce5ff,stroke:#007bff,stroke-width:2px,color:#000;
|
|
5
|
+
classDef subflow fill:#e2e3e5,stroke:#6c757d,stroke-width:2px,color:#000;
|
|
6
|
+
classDef decision fill:#f8d7da,stroke:#dc3545,stroke-width:2px,color:#000;
|
|
7
|
+
|
|
8
|
+
Start((จุดเริ่มต้น)) --> ProcessMain
|
|
9
|
+
|
|
10
|
+
subgraph Process [1. Process Step]
|
|
11
|
+
ProcessMain["PrepComparisData_Main<br/>(Process Step)"]:::process
|
|
12
|
+
CheckReset{"checkTriggerResetedV2<br/>(Timestamp Match)"}:::decision
|
|
13
|
+
CheckCache{"checkTriggeredCacheV2<br/>(เช็คว่ามีงานย่อยต้องทำไหม?)"}:::decision
|
|
14
|
+
CreateReq["สร้าง request ไปที่ triggerFlow<br/>(ยิงงานย่อย)"]:::process
|
|
15
|
+
|
|
16
|
+
ProcessMain --> CheckReset
|
|
17
|
+
CheckReset -- "not match" --> ProcessMain
|
|
18
|
+
CheckReset -- "match" --> CheckCache
|
|
19
|
+
CheckCache -- "มีงาน" --> CreateReq
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
SubFlow["triggerFlow<br/>(งานย่อย)"]:::subflow
|
|
23
|
+
|
|
24
|
+
subgraph Check [2. Check Step]
|
|
25
|
+
SubOut["Sub to Out topic<br/>(รับ Message งานย่อยที่เสร็จ)"]:::check
|
|
26
|
+
CheckComplete["CheckTriggerCacheComplete<br/>(Check Step)"]:::check
|
|
27
|
+
CheckFlow{"checkTriggerFlowComplete<br/>AwaitingStepV2<br/>(ตรวจว่าทุกงานเสร็จหรือยัง?)"}:::decision
|
|
28
|
+
|
|
29
|
+
SubOut --> CheckComplete
|
|
30
|
+
CheckComplete --> CheckFlow
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
subgraph Complete [3. Complete Step]
|
|
34
|
+
OutMain["PrepComparisData_Out<br/>(Complete Step)"]:::complete
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
%% เส้นทางเชื่อมต่อระหว่างกลุ่ม
|
|
38
|
+
CreateReq -- "ส่งงาน" --> SubFlow
|
|
39
|
+
SubFlow -- "ทำงานเสร็จ ส่ง passBack" --> SubOut
|
|
40
|
+
|
|
41
|
+
CheckCache -- "ไม่มีงาน (ข้ามไปทำ Complete)" --> OutMain
|
|
42
|
+
|
|
43
|
+
CheckFlow -- "มีงานค้าง (รอตัวถัดไป)" --> Wait((รอ Message ถัดไป))
|
|
44
|
+
CheckFlow -- "ไม่มีงานค้าง (เสร็จหมด 100%)" --> OutMain
|
|
45
|
+
|
|
46
|
+
%% เส้นสีแดงสำหรับ Loop Not Match
|
|
47
|
+
linkStyle 1 stroke:#dc3545,stroke-width:2px
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-generate-service-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.68",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
|
|
6
6
|
"repository": {
|
|
@@ -10,31 +10,35 @@
|
|
|
10
10
|
"license": "AGPL-3.0-or-later",
|
|
11
11
|
"author": "Sven Mason <thebarbariansven@gmail.com>",
|
|
12
12
|
"type": "module",
|
|
13
|
-
"main": "index.js",
|
|
14
13
|
"exports": "./index.js",
|
|
14
|
+
"main": "index.js",
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "jest"
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"format:ejs": "node scripts/format-ejs.js"
|
|
17
18
|
},
|
|
18
19
|
"jest": {
|
|
19
20
|
"testEnvironment": "node"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
23
|
+
"@izara_project/izara-attribute-tree": "^1.0.15",
|
|
22
24
|
"@izara_project/izara-core-library-core": "^1.0.32",
|
|
23
|
-
"@izara_project/izara-
|
|
25
|
+
"@izara_project/izara-property-nodes": "^1.0.16",
|
|
24
26
|
"@izara_project/izara-shared-core": "^1.0.13",
|
|
25
27
|
"ejs": "^6.0.1",
|
|
26
28
|
"js-beautify": "^2.0.3",
|
|
27
|
-
"yaml": "^2.9.0"
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
"yaml": "^2.9.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@izara_project/izara-core-library-logger": "^1.0.11",
|
|
33
|
+
"@izara_project/izara-core-library-service-schemas": "1.0.158",
|
|
34
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.67",
|
|
35
|
+
"jest": "^30.4.2",
|
|
36
|
+
"prettier": "^3.9.6",
|
|
37
|
+
"prettier-plugin-ejs": "^1.0.3"
|
|
30
38
|
},
|
|
31
39
|
"peerDependencies": {
|
|
40
|
+
"@izara_project/izara-core-library-logger": "^1.0.11",
|
|
32
41
|
"@izara_project/izara-core-library-service-schemas": "^1.0.157",
|
|
33
42
|
"@izara_project/izara-shared-service-schemas": "^1.0.65"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.158",
|
|
37
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.66",
|
|
38
|
-
"jest": "^30.4.2"
|
|
39
43
|
}
|
|
40
44
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* Copyright (C) 2026 Sven Mason <http://izara.io>
|
|
2
|
+
* Prettier formatting script for EJS template files under src/emit
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import prettier from 'prettier';
|
|
8
|
+
|
|
9
|
+
function getAllEjsFiles(dirPath, arrayOfFiles = []) {
|
|
10
|
+
const files = fs.readdirSync(dirPath);
|
|
11
|
+
for (const file of files) {
|
|
12
|
+
const fullPath = path.join(dirPath, file);
|
|
13
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
14
|
+
arrayOfFiles = getAllEjsFiles(fullPath, arrayOfFiles);
|
|
15
|
+
} else if (file.endsWith('.ejs')) {
|
|
16
|
+
arrayOfFiles.push(fullPath);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return arrayOfFiles;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function formatEjsFiles(targetDir = 'src/emit') {
|
|
23
|
+
const ejsFiles = getAllEjsFiles(targetDir);
|
|
24
|
+
let updatedCount = 0;
|
|
25
|
+
|
|
26
|
+
for (const filePath of ejsFiles) {
|
|
27
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
28
|
+
const isYaml = filePath.includes('Yaml.ejs') || filePath.includes('Yaml');
|
|
29
|
+
|
|
30
|
+
const placeholders = [];
|
|
31
|
+
let masked = content;
|
|
32
|
+
|
|
33
|
+
masked = masked.replace(/<%[_-]?\s*([\s\S]*?)\s*[_-]?%>/g, (match) => {
|
|
34
|
+
const id = placeholders.length;
|
|
35
|
+
const isExpr = match.startsWith('<%=') || match.startsWith('<%-');
|
|
36
|
+
const isConditionalComma =
|
|
37
|
+
match.includes('?') &&
|
|
38
|
+
(match.includes("','") || match.includes('","'));
|
|
39
|
+
|
|
40
|
+
let replacement;
|
|
41
|
+
if (isYaml) {
|
|
42
|
+
replacement = isExpr ? `EJS_VAL_${id}` : `# __EJS_TAG_${id}__`;
|
|
43
|
+
} else {
|
|
44
|
+
if (isConditionalComma) {
|
|
45
|
+
replacement = `, /*__EJS_COMMA_${id}__*/`;
|
|
46
|
+
} else if (isExpr) {
|
|
47
|
+
replacement = `__EJS_VAR_${id}__`;
|
|
48
|
+
} else {
|
|
49
|
+
replacement = `/*__EJS_STMT_${id}__*/`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
placeholders.push({
|
|
53
|
+
id,
|
|
54
|
+
original: match,
|
|
55
|
+
replacement,
|
|
56
|
+
isConditionalComma
|
|
57
|
+
});
|
|
58
|
+
return replacement;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const parser = isYaml ? 'yaml' : 'babel';
|
|
62
|
+
let formatted = await prettier.format(masked, {
|
|
63
|
+
parser,
|
|
64
|
+
singleQuote: true,
|
|
65
|
+
semi: true,
|
|
66
|
+
tabWidth: 2,
|
|
67
|
+
useTabs: false,
|
|
68
|
+
trailingComma: 'none',
|
|
69
|
+
printWidth: 80,
|
|
70
|
+
endOfLine: 'lf'
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
for (const item of placeholders) {
|
|
74
|
+
if (item.isConditionalComma) {
|
|
75
|
+
formatted = formatted.replace(item.replacement, item.original);
|
|
76
|
+
formatted = formatted.replace(
|
|
77
|
+
`, /*__EJS_COMMA_${item.id}__*/`,
|
|
78
|
+
item.original
|
|
79
|
+
);
|
|
80
|
+
} else {
|
|
81
|
+
formatted = formatted.replace(item.replacement, item.original);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Ensure unix newline at EOF
|
|
86
|
+
if (!formatted.endsWith('\n')) {
|
|
87
|
+
formatted += '\n';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (formatted !== content) {
|
|
91
|
+
fs.writeFileSync(filePath, formatted, 'utf8');
|
|
92
|
+
updatedCount++;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return { total: ejsFiles.length, updated: updatedCount };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (process.argv[1] === new URL(import.meta.url).pathname) {
|
|
100
|
+
formatEjsFiles().then(({ total, updated }) => {
|
|
101
|
+
console.log(
|
|
102
|
+
`Successfully formatted ${updated} / ${total} EJS template files in src/emit.`
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { join, resolve } from 'node:path';
|
|
2
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
3
|
+
import { parse as parseYaml } from 'yaml';
|
|
2
4
|
|
|
3
5
|
export function compileProject(request = {}) {
|
|
4
6
|
if (!isNonEmptyString(request.rootPath)) {
|
|
@@ -11,12 +13,25 @@ export function compileProject(request = {}) {
|
|
|
11
13
|
request.configPath ?? join(rootPath, 'config', 'serverless.config.yml')
|
|
12
14
|
);
|
|
13
15
|
|
|
16
|
+
let serviceTag = request.serviceTag;
|
|
17
|
+
if (!serviceTag && existsSync(configPath)) {
|
|
18
|
+
try {
|
|
19
|
+
const configContent = readFileSync(configPath, 'utf8');
|
|
20
|
+
const parsedConfig = parseYaml(configContent);
|
|
21
|
+
if (parsedConfig && parsedConfig.main_config) {
|
|
22
|
+
serviceTag = parsedConfig.main_config.iz_serviceTag || parsedConfig.main_config.iz_serviceName;
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
// Ignore configuration read error
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
return Object.freeze({
|
|
15
30
|
rootPath,
|
|
16
31
|
outputPath,
|
|
17
32
|
configPath,
|
|
18
33
|
schemaRoot: join(rootPath, 'app', 'src', 'schemas'),
|
|
19
|
-
serviceTag
|
|
34
|
+
serviceTag,
|
|
20
35
|
schemaTemplateConfig: request.schemaTemplateConfig ?? []
|
|
21
36
|
});
|
|
22
37
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { readdir, stat } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { getObjectSchema, utils } from '@izara_project/izara-core-library-service-schemas';
|
|
5
|
+
import Logger from '@izara_project/izara-core-library-logger';
|
|
4
6
|
|
|
5
7
|
export async function loadLocalSchemaDirectory(project, directoryName) {
|
|
6
8
|
const directoryPath = join(project.schemaRoot, directoryName);
|
|
@@ -22,7 +24,112 @@ export async function loadLocalSchemaDirectory(project, directoryName) {
|
|
|
22
24
|
if (!module.default || typeof module.default !== 'object') {
|
|
23
25
|
throw new TypeError(`Schema module must default-export an object or array: ${filePath}`);
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
const loadedSchemas = Array.isArray(module.default) ? module.default : [module.default];
|
|
28
|
+
|
|
29
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
30
|
+
for (const schema of loadedSchemas) {
|
|
31
|
+
let status = true;
|
|
32
|
+
let errors = [];
|
|
33
|
+
|
|
34
|
+
if (directoryName === 'ObjectSchemas') {
|
|
35
|
+
[status, errors] = utils.validateObjectSchema({ logger: Logger }, schema);
|
|
36
|
+
} else if (directoryName === 'RelationshipSchemas') {
|
|
37
|
+
if (entry.name.toLowerCase() === 'refobjectrelationships.js') {
|
|
38
|
+
[status, errors] = utils.validateRefRelationshipSchema({ logger: Logger }, schema);
|
|
39
|
+
} else {
|
|
40
|
+
[status, errors] = utils.validateRelationshipSchema({ logger: Logger }, schema);
|
|
41
|
+
}
|
|
42
|
+
} else if (directoryName === 'FlowSchemas') {
|
|
43
|
+
[status, errors] = utils.validateBasicFlowSchema({ logger: Logger }, schema);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!status) {
|
|
47
|
+
throw new Error(`Schema validation failed for ${entry.name}:\n${errors.join('\n')}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
schemas.push(...loadedSchemas);
|
|
26
53
|
}
|
|
27
54
|
return schemas;
|
|
28
55
|
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Resolves extendObjType for ObjectSchemas by fetching the parent schema
|
|
59
|
+
* from S3 and merging its storageResources into the child schema.
|
|
60
|
+
*
|
|
61
|
+
* Only schemas with `extendObjType` are processed; others are returned as-is.
|
|
62
|
+
* If `bucketName` is not provided, falls back to the
|
|
63
|
+
* `iz_serviceSchemaBucketName` environment variable.
|
|
64
|
+
*
|
|
65
|
+
* @param {Object[]} objectSchemas - Array of local ObjectSchemas from
|
|
66
|
+
* loadLocalSchemaDirectory.
|
|
67
|
+
* @param {string} [bucketName] - S3 bucket name for fetching parent schemas.
|
|
68
|
+
* @returns {Promise<Object[]>} The same array with extended storageResources
|
|
69
|
+
* merged in.
|
|
70
|
+
*/
|
|
71
|
+
export async function resolveExtendedObjectSchemas(
|
|
72
|
+
objectSchemas,
|
|
73
|
+
bucketName
|
|
74
|
+
) {
|
|
75
|
+
if (!Array.isArray(objectSchemas)) {
|
|
76
|
+
throw new TypeError('objectSchemas must be an array');
|
|
77
|
+
}
|
|
78
|
+
const resolvedSchemas = [];
|
|
79
|
+
for (const schema of objectSchemas) {
|
|
80
|
+
if (!schema.hasOwnProperty('extendObjType')) {
|
|
81
|
+
resolvedSchemas.push(schema);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
// Track which storageResource keys existed in the child before merge
|
|
86
|
+
const childStorageResourceKeys = new Set(
|
|
87
|
+
Object.keys(schema.storageResources ?? {})
|
|
88
|
+
);
|
|
89
|
+
const parentServiceTag = schema.extendObjType.serviceTag;
|
|
90
|
+
|
|
91
|
+
const mergedSchema = await getObjectSchema.mergeExtendObjSchema(
|
|
92
|
+
{ logger: Logger },
|
|
93
|
+
schema,
|
|
94
|
+
bucketName
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Separate parent DynamoDB resources from child's own storageResources.
|
|
98
|
+
// Parent DynamoDB tables exist in the parent service — they must NOT be
|
|
99
|
+
// re-created here. Instead, track them as external references so that
|
|
100
|
+
// emitResourceArtifacts can add cross-service ARNs to IAM roles.
|
|
101
|
+
const externalDynamoResources = [];
|
|
102
|
+
const ownStorageResources = {};
|
|
103
|
+
for (const [key, resource] of Object.entries(
|
|
104
|
+
mergedSchema.storageResources ?? {}
|
|
105
|
+
)) {
|
|
106
|
+
if (
|
|
107
|
+
resource?.storageType === 'dynamoDB' &&
|
|
108
|
+
!childStorageResourceKeys.has(key)
|
|
109
|
+
) {
|
|
110
|
+
externalDynamoResources.push({
|
|
111
|
+
serviceTag: parentServiceTag,
|
|
112
|
+
tableName: resource.tableName
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
ownStorageResources[key] = resource;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
mergedSchema.storageResources = ownStorageResources;
|
|
120
|
+
if (externalDynamoResources.length > 0) {
|
|
121
|
+
mergedSchema.externalDynamoResources = externalDynamoResources;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
resolvedSchemas.push(mergedSchema);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
Logger.error(
|
|
127
|
+
`resolveExtendedObjectSchemas: failed to merge extendObjType` +
|
|
128
|
+
` for objectType=${schema.objectType}`,
|
|
129
|
+
{ error }
|
|
130
|
+
);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return resolvedSchemas;
|
|
135
|
+
}
|
|
@@ -83,12 +83,14 @@ async function emitAction(action, objects, flows, serviceTag) {
|
|
|
83
83
|
return {
|
|
84
84
|
artifacts,
|
|
85
85
|
functions: [
|
|
86
|
-
{ type: 'inv', functionName: 'GetHdrInv', handlerPath: `${handlerRoot}/Get_HdrInv.main`, roleName: 'FlowObjectsRole' },
|
|
86
|
+
{ type: 'inv', functionName: 'GetHdrInv', handlerPath: `${handlerRoot}/Get_HdrInv.main`, roleName: 'FlowObjectsRole', flowTag: action, flowStepName: '' },
|
|
87
87
|
{
|
|
88
88
|
type: 'api',
|
|
89
89
|
functionName: 'GetHdrApi',
|
|
90
90
|
handlerPath: `${handlerRoot}/Get_HdrApi.main`,
|
|
91
91
|
roleName: 'FlowObjectsRole',
|
|
92
|
+
flowTag: action,
|
|
93
|
+
flowStepName: '',
|
|
92
94
|
routes: objects.filter(isCrudObject).map(object => ({
|
|
93
95
|
path: `/${serviceTag ?? '${self:custom.iz_serviceName}'}/${object.objectType}/get`,
|
|
94
96
|
upperName: upperFirst(object.objectType)
|
|
@@ -99,6 +101,8 @@ async function emitAction(action, objects, flows, serviceTag) {
|
|
|
99
101
|
functionName: 'GetRangeHdrApi',
|
|
100
102
|
handlerPath: `${handlerRoot}/GetRange_HdrApi.main`,
|
|
101
103
|
roleName: 'FlowObjectsRole',
|
|
104
|
+
flowTag: 'GetRange',
|
|
105
|
+
flowStepName: '',
|
|
102
106
|
routes: objects.filter(isCrudObject)
|
|
103
107
|
.filter(object => object.identifiers && object.identifiers.some(i => i.type === 'sortKey'))
|
|
104
108
|
.map(object => ({
|
|
@@ -116,22 +120,22 @@ async function emitAction(action, objects, flows, serviceTag) {
|
|
|
116
120
|
{ path: `${source}/${action}_HdrWbs.js`, content: await render('FlowEndpoint_HdrWbs.ejs', { ...shared, mainFileName: `${action}_WbsMain`, functionName: action, route: action }) }
|
|
117
121
|
);
|
|
118
122
|
const functions = [
|
|
119
|
-
{ type: 'wbs', functionName: `${action}HdrWbs`, handlerPath: `${handlerRoot}/${action}_HdrWbs.main`, roleName: 'FlowObjectsRole', routeName: action },
|
|
120
|
-
{ type: 'sqs', functionName: `${action}HdrSqs`, handlerPath: `${handlerRoot}/${action}_HdrSqs.main`, roleName: 'FlowObjectsRole', queueName: `${action}HdrSqs
|
|
123
|
+
{ type: 'wbs', functionName: `${action}HdrWbs`, handlerPath: `${handlerRoot}/${action}_HdrWbs.main`, roleName: 'FlowObjectsRole', routeName: action, flowTag: action, flowStepName: '' },
|
|
124
|
+
{ type: 'sqs', functionName: `${action}HdrSqs`, handlerPath: `${handlerRoot}/${action}_HdrSqs.main`, roleName: 'FlowObjectsRole', queueName: `${action}HdrSqs`, flowTag: action, flowStepName: '' }
|
|
121
125
|
];
|
|
122
126
|
const complete = `${action}Complete`;
|
|
123
127
|
artifacts.push(
|
|
124
128
|
{ path: `${source}/${complete}_Main.js`, content: await render('FlowEndpointComplete_Main.ejs', { action }) },
|
|
125
129
|
{ path: `${source}/${complete}_HdrSqs.js`, content: await render('FlowHandler_HdrSqs.ejs', { ...shared, mainFileName: `${complete}_Main`, functionName: complete, queueName: `${action}CompleteHdrSqs` }) }
|
|
126
130
|
);
|
|
127
|
-
functions.push({ type: 'sqs', functionName: `${action}CompleteHdrSqs`, handlerPath: `${handlerRoot}/${complete}_HdrSqs.main`, roleName: 'FlowObjectsRole', queueName: `${action}CompleteHdrSqs
|
|
131
|
+
functions.push({ type: 'sqs', functionName: `${action}CompleteHdrSqs`, handlerPath: `${handlerRoot}/${complete}_HdrSqs.main`, roleName: 'FlowObjectsRole', queueName: `${action}CompleteHdrSqs`, flowTag: action, flowStepName: 'Complete' });
|
|
128
132
|
if (generateCode.some(config => config.codeHookTag === 'beforeLogical')) {
|
|
129
133
|
const beforeMain = `${action}BeforeLogical_Main`;
|
|
130
134
|
artifacts.push(
|
|
131
135
|
{ path: `${source}/${beforeMain}.js`, content: await render('FlowEndpointBeforeLogical_Main.ejs', shared) },
|
|
132
136
|
{ path: `${source}/${action}BeforeLogical_HdrSqs.js`, content: await render('FlowHandler_HdrSqs.ejs', { ...shared, mainFileName: beforeMain, functionName: `${action}BeforeLogicalMain`, queueName: `${action}BeforeLogicalHdrSqs` }) }
|
|
133
137
|
);
|
|
134
|
-
functions.push({ type: 'sqs', functionName: `${action}BeforeLogicalHdrSqs`, handlerPath: `${handlerRoot}/${action}BeforeLogical_HdrSqs.main`, roleName: 'FlowObjectsRole', queueName: `${action}BeforeLogicalHdrSqs
|
|
138
|
+
functions.push({ type: 'sqs', functionName: `${action}BeforeLogicalHdrSqs`, handlerPath: `${handlerRoot}/${action}BeforeLogical_HdrSqs.main`, roleName: 'FlowObjectsRole', queueName: `${action}BeforeLogicalHdrSqs`, flowTag: action, flowStepName: 'BeforeLogical' });
|
|
135
139
|
}
|
|
136
140
|
return { artifacts, functions };
|
|
137
141
|
}
|
|
@@ -4,7 +4,7 @@ const ACTIONS = ['Create', 'Update', 'Delete', 'Get'];
|
|
|
4
4
|
const MESSAGE_ATTRIBUTES = ['userId', 'correlationId'];
|
|
5
5
|
|
|
6
6
|
export const dynamicCrudFlowSchemaPaths = ACTIONS.map(
|
|
7
|
-
action => `app/src/schemas/FlowSchemas/generateCode/${action}.js`
|
|
7
|
+
action => `app/src/schemas/FlowSchemas/generateCode/FlowObjects/${action}.js`
|
|
8
8
|
);
|
|
9
9
|
|
|
10
10
|
export function emitDynamicCrudFlowSchemas({ objects, flows = [] }) {
|
|
@@ -59,7 +59,6 @@ function createDynamicFlow(action, hasBeforeLogicalStep) {
|
|
|
59
59
|
|
|
60
60
|
return {
|
|
61
61
|
flowTag: action,
|
|
62
|
-
isDynamicObjectType: true,
|
|
63
62
|
initiateBy: 'system',
|
|
64
63
|
handleObj: 'one',
|
|
65
64
|
statusType: 'none',
|