@izara_project/izara-market-library-service-schemas 1.0.15 → 1.0.17

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 (63) hide show
  1. package/package.json +2 -2
  2. package/src/GenerateCodeLibs/src/Consts.js +3 -1
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +94 -73
  4. package/src/MainLibs/src/Utils.js +10 -9
  5. package/src/TemplateManager/src/GenerateCode.js +53 -12
  6. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/functionYaml/data.js +86 -0
  7. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/functionYaml/template.ejs +33 -0
  8. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/handler/data.js +59 -0
  9. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/handler/template.ejs +129 -0
  10. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/mainFunction/data.js +53 -0
  11. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/mainFunction/template.ejs +130 -0
  12. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/sns-out/data.js +62 -0
  13. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/sqs-in-sns/data.js +58 -0
  14. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/sqs-in-sns/template.ejs +47 -0
  15. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +15 -7
  16. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +14 -6
  17. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +14 -4
  18. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +14 -4
  19. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrWbs/data.js +171 -0
  20. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrWbs/request.json +19 -0
  21. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrWbs/template.ejs +29 -0
  22. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/webSocketConnect/data.js +60 -0
  23. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/webSocketConnect/template.ejs +10 -0
  24. package/src/TemplateManager/src/PerActionEndpoint/Handler/WebSocket/data.js +76 -0
  25. package/src/TemplateManager/src/PerActionEndpoint/Handler/WebSocket/template.ejs +141 -0
  26. package/src/TemplateManager/src/PerActionEndpoint/Handler/WebSocketConnect/data.js +56 -0
  27. package/src/TemplateManager/src/PerActionEndpoint/Handler/WebSocketConnect/template.ejs +55 -0
  28. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +40 -36
  29. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +54 -22
  30. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +59 -25
  31. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/template.ejs +4 -0
  32. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +2 -1
  33. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +1 -5
  34. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +1 -5
  35. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/mainFunction/template.ejs +11 -7
  36. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/template.ejs +4 -0
  37. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/template.ejs +1 -1
  38. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrApi/template.ejs +5 -4
  39. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv/template.ejs +3 -2
  40. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/mainFunction/template.ejs +16 -13
  41. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/template.ejs +9 -6
  42. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/template.ejs +4 -0
  43. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/template.ejs +8 -5
  44. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +1 -1
  45. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/template.ejs +10 -8
  46. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +1 -1
  47. package/src/TemplateManager/src/ResourceYaml/dynamodb/{awaitingMultipleStepData.js → defaultDynamoDbTable.js} +39 -3
  48. package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +6 -3
  49. package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +1 -1
  50. package/src/TemplateManager/src/externalService/LambdaRole/data.js +5 -10
  51. package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +14 -0
  52. package/src/TemplateManager/src/flowTag/resources/dynamoDb/data.js +65 -0
  53. package/src/TemplateManager/src/flowTag/webSocket/webSocketConnect/functionYaml/data.js +56 -0
  54. package/src/TemplateManager/src/flowTag/webSocket/webSocketConnect/functionYaml/template.ejs +10 -0
  55. package/src/TemplateManager/src/flowTag/webSocket/webSocketConnect/handler/data.js +55 -0
  56. package/src/TemplateManager/src/flowTag/webSocket/webSocketConnect/handler/template.ejs +63 -0
  57. package/src/TemplateManager/src/flowTag/webSocket/websocketHandler/functionYaml/data.js +75 -0
  58. package/src/TemplateManager/src/flowTag/webSocket/websocketHandler/functionYaml/template.ejs +33 -0
  59. package/src/TemplateManager/src/flowTag/webSocket/websocketHandler/lambda/data.js +57 -0
  60. package/src/TemplateManager/src/flowTag/webSocket/websocketHandler/lambda/template.ejs +131 -0
  61. package/src/TemplateManager/src/libs/Consts.js +7 -2
  62. package/src/TemplateManager/src/libs/GenerateCodeUtils.js +3 -1
  63. package/src/TemplateManager/src/ResourceYaml/dynamodb/processLogicalAndFindData.js +0 -99
@@ -56,11 +56,10 @@ module.exports.createRelationshipComplete = async (
56
56
  // start create awaitingStepId
57
57
  const linkTypeId = createLinkTypeId(
58
58
  _izContext,
59
- [
60
- returnValue.objects[0].objType,
61
- returnValue.objects[1].objType,
62
- ],
63
- returnValue.relType
59
+ returnValue.firstObject.objType,
60
+ returnValue.secondObject.objType,
61
+ returnValue.relType,
62
+ returnValue.direction
64
63
  );
65
64
 
66
65
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
@@ -93,22 +92,23 @@ module.exports.createRelationshipComplete = async (
93
92
  )) {
94
93
  _izContext.logger.debug("finished all awaitingStep");
95
94
 
96
- let createCompleteMsg = {
97
- objects: returnValue.objects,
95
+ let deleteRelComp = {
96
+ firstObject: returnValue.firstObject,
97
+ secondObject: returnValue.secondObject,
98
98
  relType: returnValue.relType,
99
99
  relationshipProperties: returnValue.relationshipProperties,
100
100
  status: status,
101
101
  errorFounds: errorsFound
102
102
  };
103
103
 
104
- createCompleteMsg = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, createCompleteMsg);
105
- _izContext.logger.debug("After addCallingFlowToSnsResponseMessageObject", createCompleteMsg);
104
+ deleteRelComp = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, deleteRelComp);
105
+ _izContext.logger.debug("After addCallingFlowToSnsResponseMessageObject", deleteRelComp);
106
106
 
107
107
  let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {});
108
- _izContext.logger.debug("After addCallingFlowToSnsResponseMessageAttributes", createCompleteMsg);
108
+ _izContext.logger.debug("After addCallingFlowToSnsResponseMessageAttributes", deleteRelComp);
109
109
 
110
110
  let sendMessageToOutCreateRelatonshipComplete = {
111
- Message: JSON.stringify(createCompleteMsg),
111
+ Message: JSON.stringify(deleteRelComp),
112
112
  MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
113
113
  TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outCreateRelComplete)
114
114
  };
@@ -128,8 +128,11 @@ module.exports.createRelationshipComplete = async (
128
128
  );
129
129
 
130
130
 
131
- return { returnValue: 'function:createRelationshipComplete' };
132
-
131
+ return {
132
+ returnValue,
133
+ status,
134
+ errorsFound
135
+ }
133
136
  } catch (err) {
134
137
  _izContext.logger.error('error createRelationshipComplete:', err)
135
138
  throw (err)
@@ -57,11 +57,10 @@ module.exports.updateRelationshipComplete = async (
57
57
  // start create awaitingStepId
58
58
  const linkTypeId = createLinkTypeId(
59
59
  _izContext,
60
- [
61
- returnValue.objects[0].objType,
62
- returnValue.objects[1].objType,
63
- ],
64
- returnValue.relType
60
+ returnValue.firstObject.objType,
61
+ returnValue.secondObject.objType,
62
+ returnValue.relType,
63
+ returnValue.direction
65
64
  );
66
65
 
67
66
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
@@ -131,7 +130,11 @@ module.exports.updateRelationshipComplete = async (
131
130
  );
132
131
 
133
132
 
134
- return { returnValue: 'function:updateRelationshipComplete' };
133
+ return {
134
+ returnValue,
135
+ status,
136
+ errorsFound
137
+ }
135
138
 
136
139
  } catch (err) {
137
140
  _izContext.logger.error('error updateRelationshipComplete:', err)
@@ -2,6 +2,10 @@
2
2
  <%- firstLetterUpperCase(functionNameConfig) %>:
3
3
  handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
4
  name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
5
+ events:
6
+ - sqs:
7
+ arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
8
+ batchSize: 10
5
9
  iamRoleStatements:
6
10
  <%_ additionalResourcePermission.forEach(resourcePermission => { _%>
7
11
  - Effect: <%- resourcePermission.effect %>
@@ -27,7 +27,7 @@ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>
27
27
  // validate event params in middleware before into function
28
28
  let validatorSchema = {
29
29
  type: "object",
30
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
30
+ required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
31
31
  properties: {
32
32
  firstObject: {
33
33
  type: "object",
@@ -109,11 +109,14 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
109
109
  let lambdaFunctionResponse = await <%- functionName %>.<%- functionName %>(
110
110
  event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId/userId
111
111
  {
112
- objects: event.objects,
112
+ firstObject: event.firstObject,
113
+ secondObject: event.secondObject,
113
114
  relType: event.relType,
114
- relId: event.relId,
115
- relationshipProperties: event.relationshipProperties
116
- }
115
+ relationshipDirection: event.relationshipDirection,
116
+ relationshipProperties: event.relationshipProperties,
117
+ relId: event.relId
118
+ },
119
+ callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
117
120
  );
118
121
 
119
122
  // return error to client
@@ -47,7 +47,7 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
47
47
  // validate event params in middleware before into function
48
48
  let validatorSchema = {
49
49
  type: "object",
50
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
50
+ required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
51
51
  properties: {
52
52
  firstObject: {
53
53
  type: "object",
@@ -29,7 +29,7 @@ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>
29
29
  // validate event params in middlewware before into function.
30
30
  let validatorSchema = {
31
31
  type: "object",
32
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
32
+ required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
33
33
  properties: {
34
34
  firstObject: {
35
35
  type: "object",
@@ -111,13 +111,15 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
111
111
  // invoke LambdaFunction
112
112
  let lambdaFunctionResponse = await <%- functionName %>.<%- functionName %>(
113
113
  event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId/userId
114
- {
115
- objects: event.objects,
116
- relType: event.relType,
117
- relId: event.relId,
118
- relationshipProperties: event.relationshipProperties
119
- },
120
- callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
114
+ {
115
+ firstObject: event.firstObject,
116
+ secondObject: event.secondObject,
117
+ relType: event.relType,
118
+ relationshipDirection: event.relationshipDirection,
119
+ relationshipProperties: event.relationshipProperties,
120
+ relId: event.relId
121
+ },
122
+ callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
121
123
  //(<afterPutParamIntoMainFunction>)
122
124
  //(</afterPutParamIntoMainFunction>)
123
125
  );
@@ -32,7 +32,7 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
32
32
  // validate event params in middleware before into function
33
33
  let validatorSchema = {
34
34
  type: "object",
35
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
35
+ required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
36
36
  properties: {
37
37
  firstObject: {
38
38
  type: "object",
@@ -42,8 +42,9 @@ const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../libs/Consts');
42
42
  const createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) => {
43
43
 
44
44
  let resultsForCreateSource = [];
45
+ const defaultDynamoDataLists = []
45
46
 
46
- const awaitingStepDynamoDbDataList = [
47
+ defaultDynamoDataLists.push(
47
48
  {
48
49
  "tableName": "AwaitingMultipleSteps",
49
50
  "attributes": [
@@ -73,10 +74,45 @@ const createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) => {
73
74
  "AttributeType": "S"
74
75
  }
75
76
  ]
77
+ },
78
+ {
79
+ "tableName": "FindDataMain",
80
+ "attributes": [
81
+ {
82
+ "keyType": "partitionKey",
83
+ "AttributeName": "findDataId",
84
+ "AttributeType": "S"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "tableName": "LogicalResultsMain",
90
+ "attributes": [
91
+ {
92
+ "keyType": "partitionKey",
93
+ "AttributeName": "logicalResultId",
94
+ "AttributeType": "S"
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "tableName": "LogicalResultsData",
100
+ "attributes": [
101
+ {
102
+ "keyType": "partitionKey",
103
+ "AttributeName": "logicalResultId",
104
+ "AttributeType": "S"
105
+ },
106
+ {
107
+ "keyType": "sortKey",
108
+ "AttributeName": "identifiersId",
109
+ "AttributeType": "S"
110
+ }
111
+ ]
76
112
  }
77
- ];
113
+ )
78
114
 
79
- for (let defaultlDynamoData of awaitingStepDynamoDbDataList) {
115
+ for (let defaultlDynamoData of defaultDynamoDataLists) {
80
116
  resultsForCreateSource.push({
81
117
  templatePath: templatePath,
82
118
  templateData: defaultlDynamoData,
@@ -47,6 +47,8 @@ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../l
47
47
  */
48
48
 
49
49
  function createDataForDefaultSnsInSqs(_izContext, srcPath) {
50
+ let resultsForCreateDefaultSnsInSqs = [];
51
+ const defaultSnsInSqsDataList = [];
50
52
  const setting = {
51
53
  initialData: "Resources:\n",
52
54
  savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
@@ -54,8 +56,9 @@ function createDataForDefaultSnsInSqs(_izContext, srcPath) {
54
56
  fileExtension: ".yml",
55
57
  isAppend: true
56
58
  }
57
- let resultsForCreateDefaultSnsInSqs = [];
58
- const defaultSnsInSqsDataList = [
59
+
60
+
61
+ defaultSnsInSqsDataList.push(
59
62
  {
60
63
  queueName: upperCase(FUNCTION_NAME.findData)
61
64
  },
@@ -65,7 +68,7 @@ function createDataForDefaultSnsInSqs(_izContext, srcPath) {
65
68
  {
66
69
  queueName: upperCase(FUNCTION_NAME.paginateProcessLogical)
67
70
  }
68
- ]
71
+ )
69
72
 
70
73
  for (let defaultSnsInSqsData of defaultSnsInSqsDataList) {
71
74
  resultsForCreateDefaultSnsInSqs.push({
@@ -30,7 +30,7 @@ function data(_izContext, createSourceParams, srcPath) {
30
30
  const functionNameConfigs = new Set();
31
31
  let createFunctionNameConfig = []
32
32
  for (let { templatePath, templateData, setting } of createSourceParams) {
33
- if (templateData.functionNameConfig !== undefined) {
33
+ if (templateData?.functionNameConfig !== undefined) {
34
34
  functionNameConfigs.add(templateData.functionNameConfig)
35
35
  }
36
36
  }
@@ -24,12 +24,8 @@ const { getGraphServiceNameFromGraphServerTagWithCache,
24
24
  getGraphServiceTagWithCache
25
25
  } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
26
26
 
27
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, renameObjectType } = require("../../../../MainLibs/src/Utils")
28
- const {
29
- DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, externalResourceSns, FUNCTION_NAME, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, getComplexFilterServiceTag,
30
- LAMBDA_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, getGraphServiceNameFromObjectSchema,
31
- shortNameHandler,
32
- SHORT_FUNCTION_NAME } = require("../../libs/Consts");
27
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
28
+ const { DEFAULT_HANDLER_PER_ACTION, createIamRole, RESOURCE_CLASSES, SOURCE_PATH, externalResourceName, externalResourceSns, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, LAMBDA_RESOURCE, SNS_RESOURCE, getGraphServiceNameFromObjectSchema, shortNameHandler, SHORT_FUNCTION_NAME } = require("../../libs/Consts");
33
29
  // const templatePath = path.join(__dirname, "./template.ejs");
34
30
  const templatePath = path.join(__dirname, "./template.ejs");
35
31
  const { getAllLocalRelationshipSchemas } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
@@ -40,18 +36,17 @@ const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas
40
36
  const externalLambdaIamRoleArray = [];
41
37
  for (const objectSchema of allObjSchemas) {
42
38
 
43
- const newObjectSchema = renameObjectType(objectSchema, srcPath)
44
39
  // per action external lambda role
45
40
  for (const action of Object.values(ACTIONS)) {
46
41
  if (objectSchema.overWriteHandlers?.[action]) {
47
42
  for (const handler of objectSchema.overWriteHandlers[action]) {
48
- const externalLambdaIamRole = await externalLambdaIamRoleDataPerAction(_izContext, newObjectSchema, action, handler)
43
+ const externalLambdaIamRole = await externalLambdaIamRoleDataPerAction(_izContext, objectSchema, action, handler)
49
44
  externalLambdaIamRole && externalLambdaIamRoleArray.push(externalLambdaIamRole);
50
45
  }
51
46
 
52
47
  } else {
53
48
  for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
54
- const externalLambdaIamRole = await externalLambdaIamRoleDataPerAction(_izContext, newObjectSchema, action, handler)
49
+ const externalLambdaIamRole = await externalLambdaIamRoleDataPerAction(_izContext, objectSchema, action, handler)
55
50
  externalLambdaIamRole && externalLambdaIamRoleArray.push(externalLambdaIamRole);
56
51
  }
57
52
  }
@@ -250,7 +245,7 @@ async function externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, all
250
245
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
251
246
  },
252
247
  graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
253
- externalResourceSns("InDeleteRelationship", graphServiceName)
248
+ externalResourceSns("InDeleteRelationshipV2", graphServiceName)
254
249
  )
255
250
  )
256
251
  )
@@ -39,6 +39,9 @@ const createExternalSnsSubscriptions = async (_izContext, allRelSchemas, allObjS
39
39
  const snsServiceConfigCreateRelationshipComplete = await snsSubscriptionCreateRelationshipComplete(_izContext, allRelSchemas)
40
40
  snsServiceConfigCreateRelationshipComplete && snsServiceConfigArray.push(snsServiceConfigCreateRelationshipComplete)
41
41
 
42
+ const snsServiceConfigDeleteRelationshipComplete = await snsSubscriptionDeleteRelatipnshipComplete(_izContext, allRelSchemas)
43
+ snsServiceConfigDeleteRelationshipComplete && snsServiceConfigArray.push(snsServiceConfigDeleteRelationshipComplete);
44
+
42
45
  const snsServiceConfigUpdateNodeComplete = await snsSubscriptionOutUpdateNodeComplete(_izContext, allObjSchemas)
43
46
  snsServiceConfigUpdateNodeComplete && snsServiceConfigArray.push(snsServiceConfigUpdateNodeComplete)
44
47
 
@@ -48,6 +51,8 @@ const createExternalSnsSubscriptions = async (_izContext, allRelSchemas, allObjS
48
51
  const snsServiceConfigDeleteNodeComplete = await snsSubscriptionDeleteNodeComplate(_izContext, allObjSchemas)
49
52
  snsServiceConfigDeleteNodeComplete && snsServiceConfigArray.push(snsServiceConfigDeleteNodeComplete);
50
53
 
54
+
55
+
51
56
  return {
52
57
  templatePath: templatePath,
53
58
  templateData: { datas: snsServiceConfigArray },
@@ -115,6 +120,15 @@ async function snsSubscriptionDeleteNodeComplate(_izContext, allObjectSchemas) {
115
120
  // }
116
121
  }
117
122
 
123
+ async function snsSubscriptionDeleteRelatipnshipComplete(_izContext, allRelSchemas) {
124
+ let serviceNames = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas)
125
+
126
+ return {
127
+ serviceNames: serviceNames,
128
+ topicName: TOPIC_NAME_GRAPH_HANDLER.outDeleteRel,
129
+ sqsEndpoint: TOPIC_NAME_GENERATE_CODE.deleteRelComplete
130
+ }
131
+ }
118
132
  // not done yet wait for comfirmation
119
133
 
120
134
 
@@ -0,0 +1,65 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const path = require('path');
20
+ const fs = require('fs');
21
+ const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../libs/Consts');
22
+
23
+
24
+
25
+ const templatePath = path.join(__dirname, "../../../ResourceYaml/dynamodb/template.ejs")
26
+
27
+ function data(_izContext, srcPath) {
28
+ let resultForCreateSources = [];
29
+ const webSocketTaskTables = [
30
+ {
31
+ tableName: "WebSocketTask",
32
+ attributes: [
33
+ {
34
+ keyType: "partitionKey",
35
+ AttributeName: "taskKey",
36
+ AttributeType: "S"
37
+ },
38
+ {
39
+ keyType: "sortKey",
40
+ AttributeName: "connectionId",
41
+ AttributeType: "S"
42
+ }
43
+ ]
44
+ }
45
+ ];
46
+
47
+ for (let webSocketTaskTable of webSocketTaskTables) {
48
+ resultForCreateSources.push(
49
+ {
50
+ templatePath: templatePath,
51
+ templateData: webSocketTaskTable,
52
+ setting: {
53
+ initialData: 'Resources:\n',
54
+ savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
55
+ saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
56
+ fileExtension: ".yml",
57
+ isAppend: true
58
+ }
59
+ }
60
+ )
61
+ }
62
+ return resultForCreateSources;
63
+ }
64
+
65
+ module.exports = data;
@@ -0,0 +1,56 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const path = require('path');
20
+ const fs = require('fs');
21
+
22
+ const { SOURCE_PATH, SAVE_FILE_NAME, ACTIONS, HANDLER } = require("../../../../libs/Consts");
23
+
24
+ const templatePath = path.join(__dirname, "./template.ejs")
25
+
26
+ /**
27
+ * receive objectSchema
28
+ * create data for websocket connect function yaml template
29
+ *
30
+ * @param {Object} objectSchema
31
+ * @return {{ templatePath, templateData, setting } }
32
+ */
33
+
34
+ function data(_izContext, srcPath) {
35
+ let createSourceParam;
36
+ createSourceParam = [createWebSocketConnectYaml(_izContext, srcPath)]
37
+ return createSourceParam
38
+ }
39
+
40
+ function createWebSocketConnectYaml(_izContext, srcPath) {
41
+ let functionName = "WebSocketConnect"
42
+ return {
43
+ templatePath: templatePath,
44
+ templateData: {
45
+ functionName,
46
+ resourceLocation: SOURCE_PATH.resourceLocationPerAction
47
+ },
48
+ setting: {
49
+ savePath: path.join(srcPath, SOURCE_PATH.appYaml),
50
+ saveFileName: "FlowSchemaInvoke",
51
+ fileExtension: ".yml",
52
+ isAppend: true
53
+ }
54
+ }
55
+ }
56
+ module.exports = data
@@ -0,0 +1,10 @@
1
+ WebSocketConnect:
2
+ handler: src/generatedCode/ObjectTypePerActionEndpoint/source/WebSocketConnect.main
3
+ name: ${self:custom.iz_resourcePrefix}WebSocketConnect
4
+ events:
5
+ - websocket:
6
+ route: $connect
7
+ - websocket:
8
+ route: $disconnect
9
+ #<#<WebSocketConnectIamRole#>
10
+ #<#/<WebSocketConnectIamRole#>
@@ -0,0 +1,55 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const path = require('path');
20
+ const fs = require('fs');
21
+
22
+ const { SOURCE_PATH, SAVE_FILE_NAME, ACTIONS, HANDLER } = require("../../../../libs/Consts");
23
+
24
+ const templatePath = path.join(__dirname, "./template.ejs")
25
+
26
+ /**
27
+ * receive objectSchema
28
+ * create data for websocket connect function yaml template
29
+ *
30
+ * @param {Object} objectSchema
31
+ * @return {{ templatePath, templateData, setting } }
32
+ */
33
+
34
+ function data(_izContext, srcPath) {
35
+ let createSourceParam;
36
+ createSourceParam = [createWebSocketConnectYaml(_izContext, srcPath)]
37
+ return createSourceParam
38
+ }
39
+
40
+ function createWebSocketConnectYaml(_izContext, srcPath) {
41
+ let functionName = "WebSocketConnect"
42
+ return {
43
+ templatePath: templatePath,
44
+ templateData: {
45
+ functionName,
46
+ },
47
+ setting: {
48
+ savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
49
+ saveFileName: functionName,
50
+ fileExtension: ".js",
51
+ isAppend: true
52
+ }
53
+ }
54
+ }
55
+ module.exports = data
@@ -0,0 +1,63 @@
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
+ 'use strict';
19
+
20
+ const izara = require("@izara_project/izara-middleware");
21
+ const middleware = izara.middlewareHandler;
22
+ const AWS = require('aws-sdk');
23
+ const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
24
+
25
+ module.exports.main = middleware.wrap(async (event, context, callback) => {
26
+
27
+ event._izContext.logger.debug('Event:', event);
28
+
29
+ try {
30
+
31
+ if (event.requestContext) {
32
+ const route = event.requestContext.routeKey;
33
+ const connectionId = event.requestContext.connectionId;
34
+
35
+ switch (route) {
36
+ case '$connect':
37
+ console.log('Connect websocket')
38
+ break
39
+ case '$disconnect':
40
+ // await dynamodbSharedLib.deleteItem(
41
+ // event._izContext,
42
+ // dynamodbSharedLib.tableName("WebSocketTask"),
43
+ // {
44
+ // taskKey: "processSortRequest_sortResultIdG",
45
+ // connectionid: "connectionidFromClientG"
46
+ // }
47
+ // );
48
+ console.log('Websocket are Disconnection')
49
+ break
50
+ case '$default':
51
+ console.log('Received unknown route:', route)
52
+ break
53
+ }
54
+ }
55
+
56
+
57
+ return (izara.response.webSocketSuccess());
58
+
59
+ } catch (err) {
60
+ event._izContext.logger.error('Error, WebSocketConnect: ', err);
61
+ return (izara.response.failure(err));
62
+ }
63
+ });