@izara_project/izara-core-generate-service-code 1.0.70 → 1.0.72

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.
Files changed (66) hide show
  1. package/package.json +3 -3
  2. package/src/compile/loadSchemas.js +69 -1
  3. package/src/emit/coreFunction/emitCoreFunctionArtifacts.js +171 -44
  4. package/src/emit/coreFunction/templates/GenerateSeedDataDynamo_HdrInv.ejs +4 -1
  5. package/src/emit/coreFunction/templates/GenerateSeedDataGraphData_HdrInv.ejs +4 -1
  6. package/src/emit/coreFunction/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +4 -1
  7. package/src/emit/coreFunction/templates/GenerateSeedDataGraphSchema_Main.ejs +10 -2
  8. package/src/emit/coreFunction/templates/GeneratedGraphNodeSchemas.ejs +17 -17
  9. package/src/emit/coreFunction/templates/GeneratedGraphRelSchemas.ejs +6 -6
  10. package/src/emit/coreFunction/templates/GeneratedTableConfigs.ejs +12 -12
  11. package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +195 -58
  12. package/src/emit/coreFunction/templates/InitialSetupRunner.ejs +175 -0
  13. package/src/emit/coreFunction/templates/InitialSetupRunner_initialSetup.ejs +9 -0
  14. package/src/emit/coreFunction/templates/InitialSetupRunner_seedDynamo.ejs +22 -0
  15. package/src/emit/coreFunction/templates/InitialSetupRunner_seedGraph.ejs +8 -0
  16. package/src/emit/coreFunction/templates/InitialSetupRunner_seedRemove.ejs +5 -0
  17. package/src/emit/coreFunction/templates/InitialSetupRunner_uploadSchema.ejs +33 -0
  18. package/src/emit/coreFunction/templates/InitialSetup_Main.ejs +9 -11
  19. package/src/emit/coreFunction/templates/UploadSchema_HdrInv.ejs +1 -3
  20. package/src/emit/coreFunction/templates/UploadSchema_Main.ejs +1 -1
  21. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +1 -1
  22. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +1 -1
  23. package/src/emit/crud/templates/FlowMain_Wbs.ejs +1 -2
  24. package/src/emit/crud/templates/GetEndpoint_Main.ejs +1 -1
  25. package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +1 -1
  26. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +1 -1
  27. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +4 -1
  28. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +2 -2
  29. package/src/emit/custom/templates/FlowStep_Main.ejs +1 -1
  30. package/src/emit/custom/templates/s3/CreateObject_Main.ejs +1 -1
  31. package/src/emit/custom/templates/s3/ReservedLimit_Main.ejs +1 -1
  32. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +2 -2
  33. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +1 -1
  34. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +1 -1
  35. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +1 -1
  36. package/src/emit/relationship/templates/GetRelationship_Main.ejs +53 -32
  37. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +1 -1
  38. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +1 -1
  39. package/src/emit/resource/emitResourceArtifacts.js +65 -21
  40. package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +18 -18
  41. package/src/emit/resource/templates/FlowOut_Yaml.ejs +5 -5
  42. package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +9 -10
  43. package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +44 -44
  44. package/src/emit/resource/templates/ResourceSqsYaml.ejs +36 -36
  45. package/src/emit/resource/templates/ResourceYaml.ejs +48 -48
  46. package/src/emit/resource/templates/S3Bucket_Yaml.ejs +0 -1
  47. package/src/emit/resource/templates/S3Subscription_Yaml.ejs +6 -6
  48. package/src/emit/resource/templates/SharedResource_Yaml.ejs +4 -4
  49. package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +115 -115
  50. package/src/emit/resource/templates/WebSocketSubscription_Yaml.ejs +6 -6
  51. package/src/emit/shared/templates/FindData_HdrSqs.ejs +1 -1
  52. package/src/emit/shared/templates/FlowHandler_HdrApi.ejs +3 -1
  53. package/src/emit/shared/templates/FlowHandler_HdrDsq.ejs +5 -2
  54. package/src/emit/shared/templates/FlowHandler_HdrInv.ejs +3 -1
  55. package/src/emit/shared/templates/FlowHandler_HdrSqs.ejs +5 -2
  56. package/src/emit/shared/templates/PaginateProcessLogical_HdrDsq.ejs +1 -1
  57. package/src/emit/shared/templates/PaginateProcessLogical_HdrSqs.ejs +1 -1
  58. package/src/emit/shared/templates/PaginateProcessLogical_Main.ejs +2 -2
  59. package/src/emit/shared/templates/ProcessLogical_HdrSqs.ejs +1 -1
  60. package/src/generate.js +26 -5
  61. package/src/output/mergeHooks.js +13 -13
  62. package/src/output/validateArtifacts.js +10 -1
  63. package/test/publicApi.test.js +2 -2
  64. package/test/resourceArtifacts.test.js +8 -18
  65. package/docs/TriggeredCache Flow.drawio +0 -193
  66. package/docs/TriggeredCacheFlow.mmd +0 -47
@@ -1,7 +1,7 @@
1
1
  ##===== WebSocket completion subscription
2
- SubscriptionToOut<%= topicName %>WebSocketComplete:
3
- Type: AWS::SNS::Subscription
4
- Properties:
5
- TopicArn: !Ref Out<%= topicName %>
6
- Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}WebSocketCompleteHdrSqs"
7
- Protocol: "sqs"
2
+ SubscriptionToOut<%= topicName %>WebSocketComplete:
3
+ Type: AWS::SNS::Subscription
4
+ Properties:
5
+ TopicArn: !Ref Out<%= topicName %>
6
+ Endpoint: 'arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}WebSocketCompleteHdrSqs'
7
+ Protocol: 'sqs'
@@ -65,7 +65,7 @@ export const main = middleware.wrap(async (event, context) => {
65
65
 
66
66
  // loop each record and send to mainFunction
67
67
  await Promise.all(
68
- event.Records.map(async record => {
68
+ event.Records.map(async (record) => {
69
69
  // promise.all for map() function
70
70
 
71
71
  let passOnProperties = [];
@@ -3,9 +3,11 @@ import {
3
3
  response
4
4
  } from '@izara_project/izara-middleware';
5
5
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
6
-
7
6
  import <%= functionName %> from './<%= mainFileName %>.js';
8
7
 
8
+ //(<optionalRequire>)
9
+ //(</optionalRequire>)
10
+
9
11
  const validatorSchema = {
10
12
  //(<validatorSchema>)
11
13
  <% if (typeof startConfig !== 'undefined' && startConfig !== null && startConfig.properties && startConfig.properties.length > 0) { -%>
@@ -21,6 +21,9 @@ import Logger from '@izara_project/izara-core-library-logger';
21
21
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
22
22
  import <%= functionName %> from './<%= mainFileName %>.js';
23
23
 
24
+ //(<optionalRequire>)
25
+ //(</optionalRequire>)
26
+
24
27
  // validate event properties in body.Message of sqs event
25
28
  let perRecordsValidatorSchema = {
26
29
  //(<validatorSchema>)
@@ -29,7 +32,7 @@ let perRecordsValidatorSchema = {
29
32
  properties: {
30
33
  <% startConfig.properties.forEach((prop, index) => { %> <%- prop.propertyName %>: {
31
34
  type: '<%- prop.type || 'string' %>'
32
- },
35
+ }
33
36
  <% }) %>
34
37
  },
35
38
  required: [<%- startConfig.properties.filter(p => p.required === true).map(p => `'${p.propertyName}'`).join(', ') %>]
@@ -48,7 +51,7 @@ let messageAttributeValidatorSchema = {
48
51
  Value: { type: '<%- prop.type || 'string' %>' }
49
52
  },
50
53
  required: ['Type', 'Value']
51
- },
54
+ }
52
55
  <% }) %>
53
56
  },
54
57
  required: [<%- startConfig.messageAttributes.filter(p => p.required === true).map(p => `'${p.propertyName}'`).join(', ') %>]
@@ -1,8 +1,10 @@
1
1
  import { middlewareHandler as middleware } from '@izara_project/izara-middleware';
2
2
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
3
-
4
3
  import <%= functionName %> from './<%= mainFileName %>.js';
5
4
 
5
+ //(<optionalRequire>)
6
+ //(</optionalRequire>)
7
+
6
8
  const validatorSchema = {
7
9
  //(<validatorSchema>)
8
10
  <% if (typeof startConfig !== 'undefined' && startConfig !== null && startConfig.properties && startConfig.properties.length > 0) { -%>
@@ -21,6 +21,9 @@ import Logger from '@izara_project/izara-core-library-logger';
21
21
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
22
22
  import <%= functionName %> from './<%= mainFileName %>.js';
23
23
 
24
+ //(<optionalRequire>)
25
+ //(</optionalRequire>)
26
+
24
27
  // validate event properties in body.Message of sqs event
25
28
  let perRecordsValidatorSchema = {
26
29
  //(<validatorSchema>)
@@ -29,7 +32,7 @@ let perRecordsValidatorSchema = {
29
32
  properties: {
30
33
  <% startConfig.properties.forEach((prop, index) => { %> <%- prop.propertyName %>: {
31
34
  type: '<%- prop.type || 'string' %>'
32
- },
35
+ }
33
36
  <% }) %>
34
37
  },
35
38
  required: [<%- startConfig.properties.filter(p => p.required === true).map(p => `'${p.propertyName}'`).join(', ') %>]
@@ -48,7 +51,7 @@ let messageAttributeValidatorSchema = {
48
51
  Value: { type: '<%- prop.type || 'string' %>' }
49
52
  },
50
53
  required: ['Type', 'Value']
51
- },
54
+ }
52
55
  <% }) %>
53
56
  },
54
57
  required: [<%- startConfig.messageAttributes.filter(p => p.required === true).map(p => `'${p.propertyName}'`).join(', ') %>]
@@ -93,7 +93,7 @@ export const main = middleware.wrap(async (event, context) => {
93
93
 
94
94
  // loop each record and send to mainFunction
95
95
  await Promise.all(
96
- event.Records.map(async record => {
96
+ event.Records.map(async (record) => {
97
97
  // promise.all for map() function
98
98
 
99
99
  // --- reforming record.body for Dsq request
@@ -80,7 +80,7 @@ export const main = middleware.wrap(async (event, context) => {
80
80
 
81
81
  // loop each record and send to mainFunction
82
82
  await Promise.all(
83
- event.Records.map(async record => {
83
+ event.Records.map(async (record) => {
84
84
  // promise.all for map() function
85
85
 
86
86
  let passOnProperties = [];
@@ -183,7 +183,7 @@ export default async function paginateProcessLogical(
183
183
  if (conditionalFieldValue.hasOwnProperty('includeValues')) {
184
184
  let includeValues = conditionalFieldValue.includeValues; // array
185
185
 
186
- objInstanceBases = objInstanceBases.filter(objInstanceBase => {
186
+ objInstanceBases = objInstanceBases.filter((objInstanceBase) => {
187
187
  return includeValues.includes(
188
188
  objInstanceBase[conditionalFieldName]
189
189
  );
@@ -191,7 +191,7 @@ export default async function paginateProcessLogical(
191
191
  } else if (conditionalFieldValue.hasOwnProperty('excludeValues')) {
192
192
  let excludeValues = conditionalFieldValue.excludeValues; // array
193
193
 
194
- objInstanceBases = objInstanceBases.filter(objInstanceBase => {
194
+ objInstanceBases = objInstanceBases.filter((objInstanceBase) => {
195
195
  return !excludeValues.includes(
196
196
  objInstanceBase[conditionalFieldName]
197
197
  );
@@ -62,7 +62,7 @@ export const main = middleware.wrap(async (event, context) => {
62
62
 
63
63
  // loop each record and send to mainFunction
64
64
  await Promise.all(
65
- event.Records.map(async record => {
65
+ event.Records.map(async (record) => {
66
66
  // promise.all for map() function
67
67
 
68
68
  let passOnProperties = [];
package/src/generate.js CHANGED
@@ -35,7 +35,8 @@ import {
35
35
  } from './emit/resource/emitResourceArtifacts.js';
36
36
  import {
37
37
  loadLocalSchemaDirectory,
38
- resolveExtendedObjectSchemas
38
+ resolveExtendedObjectSchemas,
39
+ resolveGraphServiceTags
39
40
  } from './compile/loadSchemas.js';
40
41
  import {
41
42
  emitSystemWebSocketArtifacts,
@@ -68,6 +69,14 @@ export async function generate(rootPath, options = {}) {
68
69
  rawObjects,
69
70
  schemaBucketName
70
71
  );
72
+ const objectGraphServiceTags = await resolveGraphServiceTags(
73
+ objects,
74
+ schemaBucketName
75
+ );
76
+ const relationshipGraphServiceTags = await resolveGraphServiceTags(
77
+ relationships,
78
+ schemaBucketName
79
+ );
71
80
  logger?.debug?.(
72
81
  `[DEBUG] [Generate] STATUS=SCHEMAS_LOADED | objects=${objects.length} relationships=${relationships.length} flows=${flows.length}`
73
82
  );
@@ -75,7 +84,9 @@ export async function generate(rootPath, options = {}) {
75
84
  project,
76
85
  objects,
77
86
  relationships,
78
- flows
87
+ flows,
88
+ objectGraphServiceTags,
89
+ relationshipGraphServiceTags
79
90
  });
80
91
  logger?.debug?.(
81
92
  `[DEBUG] [Generate] STATUS=ARTIFACTS_EMITTED | ${groups.map((group) => `${group.scope}=${group.artifacts.length}`).join(' ')}`
@@ -109,7 +120,7 @@ export async function generate(rootPath, options = {}) {
109
120
  }
110
121
  }
111
122
 
112
- async function _emitGroups({ project, objects, relationships, flows }) {
123
+ async function _emitGroups({ project, objects, relationships, flows, objectGraphServiceTags, relationshipGraphServiceTags }) {
113
124
  const [crud, relationship, rbac, system, findData, resource, coreFunction] = await Promise.all([
114
125
  emitCrudApplicationArtifacts({
115
126
  objects,
@@ -125,12 +136,22 @@ async function _emitGroups({ project, objects, relationships, flows }) {
125
136
  emitSystemWebSocketArtifacts(flows, { includeRelationshipOwnTopic: true }),
126
137
  emitSystemFindDataArtifacts(objects),
127
138
  emitResourceArtifacts({ objects, relationships, flows }),
128
- emitCoreFunctionArtifacts({ project, objects, relationships })
139
+ emitCoreFunctionArtifacts({ project, objects, relationships, flows, objectGraphServiceTags, relationshipGraphServiceTags })
129
140
  ]);
130
141
  const custom = await emitCustomFlowApplicationArtifacts(flows, {
131
142
  systemFunctions: system.functions,
132
143
  objects
133
144
  });
145
+
146
+ let resolvedCoreFunctionManagedPaths = coreFunctionManagedPaths;
147
+ if (typeof coreFunctionManagedPaths === 'function') {
148
+ resolvedCoreFunctionManagedPaths = coreFunctionManagedPaths(
149
+ objects,
150
+ objectGraphServiceTags,
151
+ relationshipGraphServiceTags
152
+ );
153
+ }
154
+
134
155
  return [
135
156
  {
136
157
  scope: 'crud-flow-schemas',
@@ -191,7 +212,7 @@ async function _emitGroups({ project, objects, relationships, flows }) {
191
212
  },
192
213
  {
193
214
  scope: 'core-function',
194
- managedPaths: coreFunctionManagedPaths,
215
+ managedPaths: resolvedCoreFunctionManagedPaths,
195
216
  artifacts: coreFunction
196
217
  }
197
218
  ];
@@ -11,29 +11,29 @@ export async function mergeHooks(outputRoot, artifacts) {
11
11
  }
12
12
 
13
13
  async function mergeHook(outputRoot, artifact) {
14
- const matchers = hookMatchers(artifact.path);
15
- if (!matchers) {
16
- return artifact.content;
17
- }
18
-
19
14
  const targetPath = join(outputRoot, artifact.path);
20
15
 
21
- let sourceContent;
16
+ let sourceContent = null;
22
17
  try {
23
- if (!(await lstat(targetPath)).isFile()) {
24
- sourceContent = '';
25
- } else {
18
+ if ((await lstat(targetPath)).isFile()) {
26
19
  sourceContent = await readFile(targetPath, 'utf8');
27
20
  }
28
21
  } catch (error) {
29
- if (error.code === 'ENOENT') {
30
- sourceContent = '';
31
- } else {
22
+ if (error.code !== 'ENOENT') {
32
23
  throw error;
33
24
  }
34
25
  }
35
26
 
36
- if (!sourceContent) {
27
+ if (sourceContent !== null && (artifact.writeWhenFileExist === false || artifact.writeWhenFileExists === false)) {
28
+ return sourceContent;
29
+ }
30
+
31
+ if (sourceContent === null) {
32
+ return artifact.content;
33
+ }
34
+
35
+ const matchers = hookMatchers(artifact.path);
36
+ if (!matchers) {
37
37
  return artifact.content;
38
38
  }
39
39
 
@@ -29,7 +29,16 @@ export function normalizeArtifacts(artifacts) {
29
29
  throw new Error(`Duplicate artifact path: ${path}`);
30
30
  }
31
31
  paths.add(path);
32
- return Object.freeze({ path, content: artifact.content });
32
+ return Object.freeze({
33
+ path,
34
+ content: artifact.content,
35
+ ...(artifact.writeWhenFileExist !== undefined && {
36
+ writeWhenFileExist: artifact.writeWhenFileExist
37
+ }),
38
+ ...(artifact.writeWhenFileExists !== undefined && {
39
+ writeWhenFileExists: artifact.writeWhenFileExists
40
+ })
41
+ });
33
42
  })
34
43
  );
35
44
  }
@@ -23,7 +23,7 @@ test('generate commits schemas, application artifacts, and resources in one publ
23
23
  const rootPath = await createCrudProject();
24
24
  const result = await generate(rootPath);
25
25
 
26
- assert.strictEqual(result.files.length, 41);
26
+ assert.strictEqual(result.files.length, 63);
27
27
  assert.equal(result.project.rootPath, rootPath);
28
28
  assert.match(
29
29
  await readFile(
@@ -267,7 +267,7 @@ test('generate removes stale CRUD schemas and application artifacts', async () =
267
267
 
268
268
  const result = await generate(rootPath);
269
269
 
270
- assert.equal(result.files.length, 12);
270
+ assert.equal(result.files.length, 34);
271
271
  await assert.rejects(
272
272
  readFile(
273
273
  join(
@@ -19,7 +19,7 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
19
19
  const rootPath = await createProject();
20
20
  const result = await generateResourceArtifacts(rootPath);
21
21
 
22
- assert.equal(result.files.length, 7);
22
+ assert.equal(result.files.length, 6);
23
23
  const resources = await readFile(
24
24
  join(
25
25
  rootPath,
@@ -34,7 +34,7 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
34
34
  assert.match(resources, /TopicArn: !Ref OutCreate/);
35
35
  assert.match(
36
36
  resources,
37
- /Endpoint: "arn:aws:sqs:\${self:custom\.iz_region}:\${self:custom\.iz_accountId}:\${self:custom\.iz_resourcePrefix}UploadReservedLimitHdrSqs"/
37
+ /Endpoint: 'arn:aws:sqs:\${self:custom\.iz_region}:\${self:custom\.iz_accountId}:\${self:custom\.iz_resourcePrefix}UploadReservedLimitHdrSqs'/
38
38
  );
39
39
  assert.match(resources, /InCreate:/);
40
40
  for (const queueName of [
@@ -83,6 +83,11 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
83
83
  roleBlock(iam, 'FlowRbacRole'),
84
84
  /RolePermissions|ProcessCreateTargetRoleHdrSqs/
85
85
  );
86
+ // Per-object RBAC flow queue (e.g. OrderRbacFlowHdrSqs from Order with rbac add-on)
87
+ assert.match(
88
+ roleBlock(iam, 'FlowRbacRole'),
89
+ /OrderRbacFlowHdrSqs/
90
+ );
86
91
  assert.match(resources, /^ CreateRelationshipHdrSqs:/m);
87
92
  assert.equal(
88
93
  (resources.match(/^ CreateRelationshipHdrSqs:/gm) ?? []).length,
@@ -110,26 +115,11 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
110
115
  );
111
116
  assert.match(iam, /#<#\/\w+StatementHookCode#>\n\n \w+Role:/);
112
117
 
113
- const lambdaRoleConfig = await readFile(
114
- join(
115
- rootPath,
116
- 'app/initial_setup/generatedCode/source/generatedLambdaRoleServiceConfig.js'
117
- ),
118
- 'utf8'
119
- );
120
- assert.match(lambdaRoleConfig, /roleName: 'FlowObjects'/);
121
- assert.match(lambdaRoleConfig, /roleName: 'ProcFindData'/);
122
- assert.match(lambdaRoleConfig, /roleName: 'FlowRelationship'/);
123
- assert.doesNotMatch(lambdaRoleConfig, /roleName: 'FlowObjectsRole'/);
124
- assert.doesNotMatch(lambdaRoleConfig, /roleName: 'ProcFindDataRole'/);
125
- assert.doesNotMatch(lambdaRoleConfig, /roleName: 'FlowRelationshipRole'/);
126
-
127
118
  for (const filePath of [
128
119
  'resource/sls_yaml/generatedCode/source/generated-sns-in-sqs.yml',
129
120
  'resource/sls_yaml/generatedCode/source/generated-sns-out.yml',
130
121
  'resource/sls_yaml/generatedCode/source/generated-dynamoDB-table.yml',
131
- 'app/sls_yaml/generatedCode/source/generate-shared-resource.yml',
132
- 'app/initial_setup/generatedCode/source/generatedLambdaRoleServiceConfig.js'
122
+ 'app/sls_yaml/generatedCode/source/generate-shared-resource.yml'
133
123
  ]) {
134
124
  assert.doesNotMatch(
135
125
  await readFile(join(rootPath, filePath), 'utf8'),
@@ -1,193 +0,0 @@
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&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม&lt;/div&gt;" 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&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม&lt;/div&gt;" 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&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม&lt;/div&gt;" 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 ไปที่&lt;div&gt;triggerFlow&lt;/div&gt;" 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&lt;div&gt;Complete&lt;/div&gt;" 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&lt;div&gt;PrepComparisData&lt;/div&gt;" 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&lt;div&gt;PrepComparisData&lt;/div&gt;" 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="&lt;div&gt;&lt;span style=&quot;font-size: 11px; white-space: nowrap; background-color: rgb(74, 137, 12);&quot;&gt;checkTriggerResetedV2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;check&amp;nbsp;Timestamp Match&lt;span style=&quot;background-color: transparent; color: light-dark(rgb(255, 255, 255), rgb(18, 18, 18));&quot;&gt;&amp;nbsp;&lt;/span&gt;" 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>
@@ -1,47 +0,0 @@
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