@izara_project/izara-market-library-service-schemas 1.0.38 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-market-library-service-schemas",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Schemas for Izara Market project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -86,20 +86,7 @@ module.exports.<%- functionName %> = async (
86
86
  <%- include(statusFieldTemplate) %>
87
87
  <% } else if (statusType === "storedCache") { %>
88
88
  <%- include(storedCacheTemplate, {tableName:tableName,flowSchemaComplete:flowSchemaComplete}) %>
89
- <% } else if (statusType === "none") { %>
90
-
91
- let messageObject = requestParams
92
-
93
- // create callingFlow
94
- messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
95
- messageObject,
96
- callingFlowSharedLib.addParentCallingFlowConfig(
97
- callingFlowConfig,
98
- callingFlowSharedLib.createCallingFlowConfig(
99
- await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.flowSchemaOwnTopicComplete), {}
100
- )
101
- )
102
- )
89
+
103
90
  <% } else if (statusType === "triggerCache") { %>
104
91
  <%- include(triggerCacheTemplate, {
105
92
  tableName: tableName,
@@ -74,13 +74,14 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
74
74
 
75
75
  if (flowSchema.outputTopic) {
76
76
  if (flowSteps.includes("Out")) {
77
- let topicOut = `${upperCase(flowSchema.flowTag)}`;
78
- defaultDsqQueueDataList.push({
79
- queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
80
- subscribeTo: topicOut
77
+ if (flowSchema.outputTopic) {
78
+ let topicOut = `${upperCase(flowSchema.flowTag)}`;
79
+ defaultDsqQueueDataList.push({
80
+ queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
81
+ subscribeTo: topicOut
82
+ }
83
+ )
81
84
  }
82
- )
83
-
84
85
  }
85
86
  }
86
87
 
@@ -48,14 +48,16 @@ function createDataForSnsOut(_izContext, flowSchema, srcPath) {
48
48
  let resultsForCreateDefaultSnsInSqs = [];
49
49
 
50
50
  let generatedSnsTopicOutForFlowSchema = []
51
+ let flowSteps = Object.keys(flowSchema.flowSteps);
51
52
  let topicOut = `${upperCase(flowSchema.flowTag)}`
52
- if (flowSchema.outputTopic) {
53
- generatedSnsTopicOutForFlowSchema.push(
54
- {
55
- queueName: upperCase(topicOut)
56
- }
57
- )
58
-
53
+ if (flowSteps.includes("Out")) {
54
+ if (flowSchema.outputTopic) {
55
+ generatedSnsTopicOutForFlowSchema.push(
56
+ {
57
+ queueName: upperCase(topicOut)
58
+ }
59
+ )
60
+ }
59
61
  for (let defaultSnsOutData of generatedSnsTopicOutForFlowSchema) {
60
62
  resultsForCreateDefaultSnsInSqs.push({
61
63
  templatePath: templatePath,
@@ -114,15 +114,15 @@ const createCreateObjectCompleteHandler = require('./CreateRecordComplete/handle
114
114
  const createCreateObjectCompleteMainFunction = require('./CreateRecordComplete/mainFunction/data');
115
115
  const createCreateObjectCompleteQueue = require('./CreateRecordComplete/queue/data');// flowSchema Register component //
116
116
 
117
- const createFlowSchemaRegisterHandlerComplete = require('./createRecordByStatusType/complete/handler/data');
118
- const createFlowSchemaRegisterMainCompleteFunc = require('./createRecordByStatusType/complete/mainFunction/data');
119
- const createFlowSchemaRegisterHandlerWbsFunc = require('./createRecordByStatusType/wbs/handler/data');
120
- const createFlowSchemaRegisterMainWbsFunc = require('./createRecordByStatusType/wbs/mainFunction/data');
121
- const createFlowSchemaRegisterMainCompleteFuncYaml = require('./createRecordByStatusType/complete/functionYaml/data');
122
- const createFlowSchemaRegisterMainWbsFuncYaml = require('./createRecordByStatusType/wbs/functionYaml/data');
123
- const createFlowSchemaRegisterSubscribeOutAll = require('./createRecordByStatusType/subscriptionOutAll/data');
124
- const createFlowSchemaRegisterSnsInSqs = require('./createRecordByStatusType/sns-in/data');
125
- const createFlowSchemaRegisterDynamoDb = require('./createRecordByStatusType/dynamoDB/register');
117
+ const createFlowSchemaRegisterHandlerComplete = require('./register/complete/handler/data');
118
+ const createFlowSchemaRegisterMainCompleteFunc = require('./register/complete/mainFunction/data');
119
+ const createFlowSchemaRegisterHandlerWbsFunc = require('./register/wbs/handler/data');
120
+ const createFlowSchemaRegisterMainWbsFunc = require('./register/wbs/mainFunction/data');
121
+ const createFlowSchemaRegisterMainCompleteFuncYaml = require('./register/complete/functionYaml/data');
122
+ const createFlowSchemaRegisterMainWbsFuncYaml = require('./register/wbs/functionYaml/data');
123
+ const createFlowSchemaRegisterSubscribeOutAll = require('./register/subscriptionOutAll/data');
124
+ const createFlowSchemaRegisterSnsInSqs = require('./register/sns-in/data');
125
+ const createFlowSchemaRegisterDynamoDb = require('./register/dynamoDB/register');
126
126
 
127
127
  /**
128
128
  * Generates code with templates for different actions
@@ -19,9 +19,4 @@ let result = await lambda.invokeSync(_izContext,
19
19
 
20
20
  _izContext.logger.debug("result from createRecordByStatusType", result)
21
21
 
22
- let messageObject = {
23
- requestParams: requestParams
24
- //(<messageObject>)
25
- //(</messageObject>)
26
- }
27
22
 
@@ -22,17 +22,3 @@ if (cacheMainStatus !== "process") {
22
22
  }
23
23
  }
24
24
 
25
- let messageObject = requestParams
26
-
27
- //(<beforeSendMessage>)
28
- //(</beforeSendMessage>)
29
- // create callingFlow
30
- messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
31
- messageObject,
32
- callingFlowSharedLib.addParentCallingFlowConfig(
33
- callingFlowConfig,
34
- callingFlowSharedLib.createCallingFlowConfig(
35
- await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
36
- )
37
- )
38
- )
@@ -1,5 +1,4 @@
1
- <% if (triggerType === 'storedCache') { %>
2
- let [mustValidate, validateCache] = await triggeredCacheSharedLib.checkTriggeredCache(
1
+ let [triggerCacheStatus, triggerCache] = await triggeredCacheSharedLib.checkTriggeredCache(
3
2
  _izContext,
4
3
  <%- tableName %>,
5
4
  {
@@ -9,31 +8,13 @@
9
8
  //(<triggerCacheConfig>)
10
9
  //(</triggerCacheConfig>)
11
10
  )
12
- <% } else if (triggerType === "switch") { %>
13
-
14
- <% } %>
15
11
 
16
12
  //(<afterCheckTriggerCache>)
17
13
  //(</afterCheckTriggerCache>)
18
14
 
19
- if (mustValidate !== "process") {
20
- if (mustValidate === "error" || mustValidate === "complete") {
15
+ if (triggerCacheStatus !== "process") {
16
+ if (triggerCacheStatus === "error" || triggerCacheStatus === "complete") {
21
17
  //(<afterValidateTriggerCacheStatus>)
22
18
  //(</afterValidateTriggerCacheStatus>)
23
19
  }
24
20
  }
25
-
26
- let messageObject = requestParams
27
-
28
- //(<beforeSendMessage>)
29
- //(</beforeSendMessage>)
30
- // create callingFlow
31
- messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
32
- messageObject,
33
- callingFlowSharedLib.addParentCallingFlowConfig(
34
- callingFlowConfig,
35
- callingFlowSharedLib.createCallingFlowConfig(
36
- await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
37
- )
38
- )
39
- )
@@ -37,18 +37,13 @@ const { NoRetryError } = require("@izara_project/izara-core-library-core");
37
37
  async function filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath) {
38
38
  let tableNamesToFilter = new Set();
39
39
  const allLocalFlowSchema = await getObjectSchema.getAllLocalFlowSchemas(_izContext, objSchemaPath);
40
- for (const flowSchema of allLocalFlowSchema.records) {
40
+ await Promise.all(allLocalFlowSchema.records.map(async (flowSchema) => {
41
41
  if (flowSchema.statusType === "storedCache") {
42
- const objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objSchemaPath).then(res => res.records[0])
43
- if (objectSchema) {
44
- for (const storageResource of Object.values(objectSchema.storageResources)) {
45
- tableNamesToFilter.add(storageResource.tableName);
46
- }
47
- } else {
48
- throw new NoRetryError('not have objectSchema in service to get')
49
- }
42
+ tableNamesToFilter.add(...await getStoredCacheTableFromFlowSchema(_izContext, flowSchema))
43
+ } else if (flowSchema.statusType === "triggerCache" && flowSchema?.triggerType === "storedCache") {
44
+ tableNamesToFilter.add(...await getStoredCacheTableFromFlowSchema(_izContext, flowSchema))
50
45
  }
51
- }
46
+ }))
52
47
 
53
48
  const filteredCreateSourceParams = createSourceParams.filter(
54
49
  (result) => !tableNamesToFilter.has(result.templateData.tableName)
@@ -58,4 +53,18 @@ async function filterCreateResourceYaml(_izContext, createSourceParams, objSchem
58
53
  return filteredCreateSourceParams
59
54
  }
60
55
 
61
- module.exports = filterCreateResourceYaml;
56
+ module.exports = filterCreateResourceYaml;
57
+
58
+ async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema) {
59
+ let tableNameStoredCache = new Set();
60
+ const objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objSchemaPath).then(res => res.records[0])
61
+ if (objectSchema) {
62
+ for (const storageResource of Object.values(objectSchema.storageResources)) {
63
+ if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
64
+ tableNameStoredCache.add(storageResource.tableName);
65
+ }
66
+ }
67
+ } else {
68
+ throw new NoRetryError('not have objectSchema in service to get')
69
+ }
70
+ }