@izara_project/izara-core-generate-service-code 1.0.78 → 1.0.79

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 (61) hide show
  1. package/package.json +2 -2
  2. package/src/compile/flowValidator.js +163 -0
  3. package/src/compile/loadSchemas.js +15 -5
  4. package/src/emit/coreFunction/emitCoreFunctionArtifacts.js +137 -7
  5. package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +132 -17
  6. package/src/emit/crud/crudActionPlan.js +82 -0
  7. package/src/emit/crud/emitCrudApplicationArtifacts.js +162 -112
  8. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +43 -65
  9. package/src/emit/crud/generateDynamicCrudFlowSchemas.js +4 -1
  10. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +84 -512
  11. package/src/emit/crud/templates/CreateLogicalLib.ejs +536 -0
  12. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +87 -202
  13. package/src/emit/crud/templates/DeleteLogicalLib.ejs +213 -0
  14. package/src/emit/crud/templates/FlowEndpointRbacCallback_Main.ejs +217 -0
  15. package/src/emit/crud/templates/GetEndpoint_Main.ejs +1 -1
  16. package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +9 -2
  17. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +87 -444
  18. package/src/emit/crud/templates/UpdateLogicalLib.ejs +472 -0
  19. package/src/emit/custom/customFlows.js +27 -2
  20. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +1 -2
  21. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +10 -3
  22. package/src/emit/custom/templates/FlowStep_Main.ejs +1 -1
  23. package/src/emit/custom/templates/s3/CreateObject_Main.ejs +1 -1
  24. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +2 -2
  25. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +3 -9
  26. package/src/emit/rbac/emitRbacApplicationArtifacts.js +21 -16
  27. package/src/emit/rbac/rbacFlowTag.js +2 -7
  28. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +148 -21
  29. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +4 -2
  30. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +1 -1
  31. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +1 -1
  32. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +1 -1
  33. package/src/emit/relationship/templates/GetRelationship_Main.ejs +1 -1
  34. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +1 -1
  35. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +1 -1
  36. package/src/emit/resource/emitResourceArtifacts.js +83 -68
  37. package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +31 -5
  38. package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +21 -0
  39. package/src/emit/resource/templates/WebSocketSubscription_Yaml.ejs +7 -0
  40. package/src/emit/shared/templates/FlowHandler_HdrApi.ejs +1 -1
  41. package/src/emit/shared/templates/FlowHandler_HdrDsq.ejs +2 -2
  42. package/src/emit/shared/templates/FlowHandler_HdrInv.ejs +1 -1
  43. package/src/emit/shared/templates/FlowHandler_HdrSqs.ejs +2 -2
  44. package/src/emit/systemText/emitSystemTextSchemas.js +246 -0
  45. package/src/emit/systemText/templates/SystemTextSchemas.ejs +10 -0
  46. package/src/generate.js +55 -8
  47. package/test/crudApplicationArtifacts.test.js +147 -19
  48. package/test/customFlowApplicationArtifacts.test.js +308 -16
  49. package/test/dynamicCrudFlowSchemas.test.js +150 -14
  50. package/test/dynamicRbacFlowSchemas.test.js +2 -2
  51. package/test/dynamicRelationshipFlowSchemas.test.js +1 -1
  52. package/test/graphDrivenFlowSchema.test.js +257 -0
  53. package/test/publicApi.test.js +14 -5
  54. package/test/resourceArtifacts.test.js +25 -19
  55. package/test/systemTextSchemas.test.js +154 -0
  56. package/src/emit/crud/templates/CreateComplete_HdrSqs.ejs +0 -99
  57. package/src/emit/crud/templates/DeleteComplete_HdrSqs.ejs +0 -99
  58. package/src/emit/crud/templates/FlowEndpointBeforeLogical_Main.ejs +0 -174
  59. package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +0 -187
  60. package/src/emit/crud/templates/UpdateComplete_HdrSqs.ejs +0 -99
  61. package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +0 -47
@@ -0,0 +1,536 @@
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 {
19
+ objectHash as hash,
20
+ identifierUuid
21
+ } from '@izara_project/izara-shared-core';
22
+ import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
23
+ import snsSharedLib from '@izara_project/izara-core-library-sns';
24
+ import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
25
+ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
26
+ import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
27
+ import {
28
+ consts as coreConsts,
29
+ NoRetryError
30
+ } from '@izara_project/izara-core-library-core';
31
+ import { consts as middlewareConsts } from '@izara_project/izara-middleware';
32
+ import {
33
+ sns,
34
+ lambda
35
+ } from '@izara_project/izara-core-library-external-request';
36
+ import {
37
+ utils,
38
+ createNodeLib,
39
+ uploadUseCase,
40
+ consts,
41
+ getObjectSchema,
42
+ identifiersObject,
43
+ dataDetailsLib
44
+ } from '@izara_project/izara-core-library-service-schemas';
45
+ import graphSharedLibs from '@izara_project/izara-core-library-graph-service';
46
+
47
+ //(<optionalRequire>)
48
+ //(</optionalRequire>)
49
+
50
+ const { createObjType, firstLetterUpperCase } = utils;
51
+ const { createDataDetailsLib } = dataDetailsLib;
52
+ const { dynamoDbIdentifiersByStorageResource, createIdentifiersByUseCase } =
53
+ identifiersObject;
54
+ const { TOPIC_NAME_GENERATE_CODE, TOPIC_NAME_GRAPH_HANDLER } = consts;
55
+
56
+ const PREFIX = {
57
+ ONE: 'one',
58
+ MANY: 'many',
59
+ CREATE_OBJECT_ASYNC: 'CreateAsyncEndpoint',
60
+ CREATE_OBJECT_ASYNC_COMPLETE: 'CreateAsyncEndpointComplete',
61
+ CREATE_OBJECT_EXTERNAL_TOPIC: 'CreateExternalTopicEndpoint'
62
+ };
63
+
64
+ /**
65
+ * Core logical processing library
66
+ * @param {Object} _izContext - Context object with logger
67
+ * @param {Object} requestParams - { fieldNames, relationships[] }
68
+ * @param {Object} callingFlowConfig - Calling flow configuration
69
+ * @param {Object} phaseResults - Results from preceding phases
70
+ * @returns {Promise<Object>} Result with objType, objInstanceFull, relationships, status, errorsFound
71
+ */
72
+ export async function <%- flowTag %>LogicalLib(
73
+ _izContext,
74
+ requestParams,
75
+ callingFlowConfig = {},
76
+ errorsFound = [],
77
+ phaseResults = {}
78
+ ) {
79
+ try {
80
+ _izContext.logger.debug('[<%- flowTag %>LogicalLib] started', {
81
+ requestParams,
82
+ callingFlowConfig,
83
+ phaseResults
84
+ });
85
+
86
+ //(<beforeCreateMainLogical>)
87
+ //(</beforeCreateMainLogical>)
88
+
89
+ const objType = createObjType(requestParams.objectType);
90
+
91
+ // ── Load schema ───────────────────────────────────────────────────────────
92
+ const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
93
+ _izContext,
94
+ objType
95
+ );
96
+ _izContext.logger.debug('objectSchema', objectSchema);
97
+
98
+ const objectSchemas =
99
+ uploadUseCase.generateObjectSchemaForCombineFieldNames(
100
+ _izContext,
101
+ objectSchema
102
+ );
103
+ _izContext.logger.debug('objectSchemas', objectSchemas);
104
+
105
+ // ── Parent object ─────────────────────────────────────────────────────────
106
+ let parentObject;
107
+ if (objectSchemas.hasOwnProperty('extendObjType')) {
108
+ parentObject = await getObjectSchema.getObjSchemaS3WithHierarchy(
109
+ _izContext,
110
+ objectSchema.extendObjType
111
+ );
112
+ }
113
+
114
+ // ── Detect invocation type ────────────────────────────────────────────────
115
+ const directInvoke =
116
+ requestParams.hasOwnProperty('__context__') &&
117
+ requestParams.izEventSource?.eventSourceTag === 'DirectInvoke';
118
+
119
+ // ── Build createDataDetails ───────────────────────────────────────────────
120
+ const createDataDetails = await createDataDetailsLib(
121
+ _izContext,
122
+ objectSchemas
123
+ );
124
+ _izContext.logger.debug('createDataDetails:', createDataDetails);
125
+
126
+ // ── Build objInstanceFull identifiers ─────────────────────────────────────
127
+ const objInstanceFull = { identifiers: {}, fields: {} };
128
+
129
+ for (const fieldName of Object.keys(requestParams.fieldNames)) {
130
+ if (objectSchemas.identifierFieldNames.includes(fieldName)) {
131
+ Object.assign(objInstanceFull.identifiers, {
132
+ [fieldName]: requestParams.fieldNames[fieldName]
133
+ });
134
+ }
135
+ }
136
+
137
+ // ── Helper: extract fields per storageTag ─────────────────────────────────
138
+ function createObjInstanceFullFieldsByStorageTag(
139
+ _izContext,
140
+ storageTag,
141
+ createDataDetail
142
+ ) {
143
+ const fields = {};
144
+ for (const fieldName of Object.keys(requestParams.fieldNames)) {
145
+ if (
146
+ createDataDetails[storageTag].fieldNames.includes(fieldName) &&
147
+ createDataDetail.fieldNames.includes(fieldName) &&
148
+ !objInstanceFull.identifiers.hasOwnProperty(fieldName) &&
149
+ !fields.hasOwnProperty(fieldName)
150
+ ) {
151
+ Object.assign(fields, {
152
+ [fieldName]: requestParams.fieldNames[fieldName]
153
+ });
154
+ }
155
+ }
156
+ return fields;
157
+ }
158
+
159
+ // ── Process storage resources ─────────────────────────────────────────────
160
+ const objInstanceFullForDynamoDb = structuredClone(objInstanceFull);
161
+ const objInstanceFullForGraph = structuredClone(objInstanceFull);
162
+ const objInstanceFullForExternalTopic = structuredClone(objInstanceFull);
163
+ const parentFlowId = identifierUuid();
164
+ const allAwaitingStepsId = [];
165
+ const listOfObjectForCreates = [];
166
+ const listOfRecords = [];
167
+
168
+ if (errorsFound.length === 0) {
169
+ //(<validateBeforeCreate>)
170
+ //(</validateBeforeCreate>)
171
+
172
+ for (const [storageTag, createDataDetail] of Object.entries(
173
+ createDataDetails
174
+ )) {
175
+ //(<beforeCreate>)
176
+ //(</beforeCreate>)
177
+
178
+ // ── DynamoDB ──────────────────────────────────────────────────────────
179
+ if (createDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB) {
180
+ _izContext.logger.debug('::::::DynamoDB::::::', {
181
+ storageTag,
182
+ objInstanceFull
183
+ });
184
+
185
+ if (
186
+ parentObject &&
187
+ createDataDetail.tableName.includes(
188
+ firstLetterUpperCase(`${parentObject.objectType}Records`)
189
+ )
190
+ ) {
191
+ Object.assign(objInstanceFullForDynamoDb.fields, {
192
+ [`${parentObject.objectType}HandlerServiceTag`]:
193
+ process.env.iz_serviceTag
194
+ });
195
+ }
196
+
197
+ Object.assign(
198
+ objInstanceFullForDynamoDb.fields,
199
+ createObjInstanceFullFieldsByStorageTag(
200
+ _izContext,
201
+ storageTag,
202
+ createDataDetail
203
+ )
204
+ );
205
+
206
+ _izContext.logger.debug(
207
+ 'objInstanceFull before create item in dynamoDB',
208
+ objInstanceFullForDynamoDb
209
+ );
210
+
211
+ const identifiersForCreateData =
212
+ await dynamoDbIdentifiersByStorageResource(
213
+ _izContext,
214
+ objectSchema,
215
+ createDataDetails,
216
+ objInstanceFullForDynamoDb.identifiers
217
+ );
218
+ _izContext.logger.debug(
219
+ 'identifiersForCreateData',
220
+ identifiersForCreateData
221
+ );
222
+
223
+ //(<beforeCreateRecordDynamo>)
224
+ //(</beforeCreateRecordDynamo>)
225
+
226
+ if (
227
+ Object.values(createDataDetails).some(
228
+ (createDataDetail) =>
229
+ createDataDetail.storageType === consts.STORAGE_TYPES.graph
230
+ )
231
+ ) {
232
+ _izContext.logger.debug('must process graph first');
233
+ listOfRecords.push({
234
+ [storageTag]: {
235
+ serviceTag: createDataDetail.serviceTag,
236
+ tableName: createDataDetail.tableName,
237
+ objInstanceFull: {
238
+ identifiers: identifiersForCreateData,
239
+ fields: objInstanceFullForDynamoDb.fields
240
+ }
241
+ }
242
+ });
243
+ } else {
244
+ _izContext.logger.debug('can process record dynamo');
245
+ await dynamodbSharedLib.putItem(
246
+ _izContext,
247
+ dynamodbSharedLib.tableName(
248
+ _izContext,
249
+ createDataDetail.tableName,
250
+ createDataDetail.serviceTag
251
+ ),
252
+ {
253
+ ...identifiersForCreateData,
254
+ ...objInstanceFullForDynamoDb.fields
255
+ }
256
+ );
257
+
258
+ objInstanceFullForDynamoDb.fields = {};
259
+ }
260
+
261
+ //(<afterCreateRecordDynamo>)
262
+ //(</afterCreateRecordDynamo>)
263
+
264
+ // ── Graph ─────────────────────────────────────────────────────────────
265
+ } else if (
266
+ createDataDetail.storageType === consts.STORAGE_TYPES.graph
267
+ ) {
268
+ //(<beforeCreateNode>)
269
+ //(</beforeCreateNode>)
270
+ _izContext.logger.debug('::::::Graph::::::', {
271
+ storageTag,
272
+ objInstanceFull
273
+ });
274
+
275
+ Object.assign(
276
+ objInstanceFullForGraph.fields,
277
+ createObjInstanceFullFieldsByStorageTag(
278
+ _izContext,
279
+ storageTag,
280
+ createDataDetail
281
+ )
282
+ );
283
+ _izContext.logger.debug(
284
+ 'objInstanceFull before send to Graph',
285
+ objInstanceFullForGraph
286
+ );
287
+
288
+ //(<additionalAttributeCreateNode>)
289
+ const additionalAttributes = {};
290
+ //(</additionalAttributeCreateNode>)
291
+
292
+ const records = allAwaitingStepsId.length === 0 ? listOfRecords : [];
293
+ allAwaitingStepsId.push({
294
+ awaitingStepId: await asyncFlowSharedLib.createAwaitingStepId(
295
+ parentFlowId,
296
+ PREFIX.CREATE_OBJECT_ASYNC
297
+ ),
298
+ additionalAttributes: {
299
+ listOfRecords: records,
300
+ additionalAttributes: additionalAttributes
301
+ }
302
+ });
303
+
304
+ listOfObjectForCreates.push({
305
+ [storageTag]: {
306
+ objInstanceFull: {
307
+ identifiers: objInstanceFullForGraph.identifiers,
308
+ fields: objInstanceFullForGraph.fields
309
+ },
310
+ allStorageTagComplete: false
311
+ }
312
+ });
313
+
314
+ // ── External Topic ────────────────────────────────────────────────────
315
+ } else if (
316
+ createDataDetail.storageType === consts.STORAGE_TYPES.externalTopic
317
+ ) {
318
+ _izContext.logger.debug('::::::externalTopic::::::', {
319
+ storageTag,
320
+ createDataDetail
321
+ });
322
+ //(<beforeSendMessageToExternalTopic>)
323
+ //(</beforeSendMessageToExternalTopic>)
324
+
325
+ Object.assign(
326
+ objInstanceFullForExternalTopic.fields,
327
+ createObjInstanceFullFieldsByStorageTag(
328
+ _izContext,
329
+ storageTag,
330
+ createDataDetail
331
+ )
332
+ );
333
+ _izContext.logger.debug(
334
+ 'objInstanceFull before send to external topic',
335
+ objInstanceFullForExternalTopic
336
+ );
337
+
338
+ allAwaitingStepsId.push({
339
+ awaitingStepId: await asyncFlowSharedLib.createAwaitingStepId(
340
+ parentFlowId,
341
+ PREFIX.CREATE_OBJECT_EXTERNAL_TOPIC
342
+ ),
343
+ additionalAttributes: {}
344
+ });
345
+
346
+ Object.assign(objInstanceFullForExternalTopic, {
347
+ parentFlowId: parentFlowId
348
+ });
349
+
350
+ await sns.publishAsync(_izContext, {
351
+ Message: JSON.stringify(objInstanceFullForExternalTopic),
352
+ TopicArn: `arn:aws:sns:${createDataDetail.region}:${createDataDetail.accountId}:${createDataDetail.serviceTag}_${createDataDetail.stage}_Create_In`
353
+ });
354
+ }
355
+ }
356
+ }
357
+
358
+ // ── Create awaiting multiple steps ────────────────────────────────────────
359
+ if (allAwaitingStepsId.length > 0) {
360
+ _izContext.logger.debug('not api will create awaitingStep');
361
+ await asyncFlowSharedLib.createAwaitingMultipleSteps(
362
+ _izContext,
363
+ asyncFlowSharedLib.createPendingStepId(
364
+ _izContext.uniqueRequestId,
365
+ PREFIX.CREATE_OBJECT_ASYNC_COMPLETE
366
+ ),
367
+ allAwaitingStepsId
368
+ );
369
+ }
370
+
371
+ // ── Process graph objects ─────────────────────────────────────────────────
372
+ let messageObject = {};
373
+ for (const objectCreate of listOfObjectForCreates) {
374
+ for (const [graphServiceName, objectForCreate] of Object.entries(
375
+ objectCreate
376
+ )) {
377
+ _izContext.logger.debug('Loop each graph:', {
378
+ [graphServiceName]: objectForCreate
379
+ });
380
+
381
+ if (!objectForCreate.allStorageTagComplete) {
382
+ //(<beforeSendMessageToGraph>)
383
+ //(</beforeSendMessageToGraph>)
384
+ messageObject = {
385
+ objType,
386
+ objInstanceFull: objectForCreate.objInstanceFull,
387
+ deepPathConditional: requestParams.deepPathConditional || [],
388
+ setFieldConditionals: requestParams.setFieldConditionals || [],
389
+ relationships: requestParams.relationships || [],
390
+ parentFlowId: parentFlowId
391
+ };
392
+ }
393
+
394
+ if (errorsFound.length > 0) break;
395
+
396
+ Object.assign(messageObject, {
397
+ settings: { updatePropertiesOnMatch: false },
398
+ originTimestamp: Date.now()
399
+ });
400
+
401
+ messageObject =
402
+ callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
403
+ messageObject,
404
+ callingFlowSharedLib.addParentCallingFlowConfig(
405
+ callingFlowConfig,
406
+ callingFlowSharedLib.createCallingFlowConfig(
407
+ //(<callingFlowProperties>)
408
+ await lambdaSharedLib.lambdaFunctionName(
409
+ _izContext,
410
+ TOPIC_NAME_GENERATE_CODE.createNodeComplete
411
+ ),
412
+ {}
413
+ //(</callingFlowProperties>)
414
+ )
415
+ )
416
+ );
417
+
418
+ await sns.publishAsync(_izContext, {
419
+ Message: JSON.stringify(messageObject),
420
+ TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
421
+ _izContext,
422
+ TOPIC_NAME_GRAPH_HANDLER.inCreateNode,
423
+ graphServiceName
424
+ )
425
+ });
426
+
427
+ //(<afterSendMessageToGraph>)
428
+ //(</afterSendMessageToGraph>)
429
+ return {
430
+ objType,
431
+ objInstanceFull: objInstanceFullForGraph,
432
+ relationships: requestParams.relationships || [],
433
+ status: 'complete',
434
+ errorsFound
435
+ };
436
+ }
437
+ if (errorsFound.length > 0) break;
438
+ }
439
+
440
+ // ── Handle errors ─────────────────────────────────────────────────────────
441
+ if (errorsFound.length > 0) {
442
+ _izContext.logger.debug('Case have errorsFound:::', errorsFound);
443
+
444
+ await asyncFlowSharedLib.clearAllAwaitingSteps(
445
+ _izContext,
446
+ asyncFlowSharedLib.createPendingStepId(
447
+ _izContext.uniqueRequestId,
448
+ PREFIX.CREATE_OBJECT_ASYNC_COMPLETE
449
+ )
450
+ );
451
+
452
+ messageObject =
453
+ callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(
454
+ callingFlowConfig,
455
+ { objType, identifiers: null, errorsFound }
456
+ );
457
+
458
+ await sns.publishAsync(_izContext, {
459
+ Message: JSON.stringify(messageObject),
460
+ MessageAttributes: sns.createStringMessageAttributes(
461
+ _izContext,
462
+ callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
463
+ callingFlowConfig,
464
+ {}
465
+ )
466
+ ),
467
+ TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
468
+ _izContext,
469
+ TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete
470
+ )
471
+ });
472
+
473
+ return {
474
+ objType,
475
+ objInstanceFull,
476
+ relationships: requestParams.relationships || [],
477
+ status: 'error',
478
+ errorsFound
479
+ };
480
+ }
481
+
482
+ // ── DynamoDB-only complete path ───────────────────────────────────────────
483
+ if (
484
+ allAwaitingStepsId.length === 0 &&
485
+ listOfObjectForCreates.length === 0
486
+ ) {
487
+ const outMessage =
488
+ callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(
489
+ callingFlowConfig,
490
+ {
491
+ objType: objType,
492
+ objInstanceFull: {
493
+ identifiers: objInstanceFullForDynamoDb.identifiers,
494
+ fields: objInstanceFullForDynamoDb.fields
495
+ }
496
+ }
497
+ );
498
+
499
+ if (
500
+ callingFlowConfig[callingFlowSharedLib.consts.CALLINGFLOW_PROPERTYNAME]
501
+ ) {
502
+ _izContext.logger.debug('HAVE CallingFlow');
503
+ await sns.publishAsync(_izContext, {
504
+ Message: JSON.stringify(outMessage),
505
+ MessageAttributes: sns.createStringMessageAttributes(
506
+ _izContext,
507
+ callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
508
+ callingFlowConfig,
509
+ {}
510
+ )
511
+ ),
512
+ TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
513
+ _izContext,
514
+ TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete
515
+ )
516
+ });
517
+ }
518
+ }
519
+
520
+ return {
521
+ objType,
522
+ objInstanceFull: {
523
+ identifiers: objInstanceFullForDynamoDb.identifiers,
524
+ fields: objInstanceFullForDynamoDb.fields
525
+ },
526
+ relationships: requestParams.relationships || [],
527
+ status: 'complete',
528
+ errorsFound
529
+ };
530
+ } catch (err) {
531
+ throw err;
532
+ }
533
+ }
534
+
535
+ export const <%- flowTag %>MainLogical = <%- flowTag %>LogicalLib;
536
+ export default <%- flowTag %>LogicalLib;