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

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 (107) hide show
  1. package/package.json +1 -1
  2. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +35 -5
  3. package/src/MainLibs/src/Consts.js +5 -2
  4. package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
  5. package/src/MainLibs/src/Utils.js +12 -0
  6. package/src/reStructure/GenerateCode.js +2 -2
  7. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +36 -11
  8. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +24 -1
  9. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
  10. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +22 -0
  11. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
  12. package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -2
  13. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -0
  14. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +5 -1
  15. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
  16. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -3
  17. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +1 -1
  18. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +1 -1
  19. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
  20. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
  21. package/src/reStructure/TemplateData/flowSchema/externalTopic/functionYaml/data.js +127 -0
  22. package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
  23. package/src/reStructure/TemplateData/flowSchema/externalTopic/{sqs/handler → handler}/template.ejs +16 -61
  24. package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/data.js +74 -0
  25. package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/template.ejs +131 -0
  26. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +61 -34
  27. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -1
  28. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +3 -7
  29. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +2 -5
  30. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +13 -4
  31. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +15 -23
  32. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
  33. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
  34. package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/functionYaml/data.js +43 -38
  35. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/template.ejs +20 -0
  36. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/data.js +80 -0
  37. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/template.ejs +85 -0
  38. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
  39. package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +11 -13
  40. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +46 -37
  41. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +14 -19
  42. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +5 -21
  43. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/functionYaml/template.ejs +20 -0
  44. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/data.js +2 -2
  45. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
  46. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +24 -10
  47. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +23 -25
  48. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
  49. package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
  50. package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
  51. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +38 -0
  52. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +39 -0
  53. package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -0
  54. package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -0
  55. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +2 -7
  56. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +22 -3
  57. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +14 -9
  58. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +26 -6
  59. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +11 -7
  60. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +17 -7
  61. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +23 -4
  62. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +14 -9
  63. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +26 -6
  64. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +10 -7
  65. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
  66. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +23 -4
  67. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +14 -9
  68. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +26 -7
  69. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +10 -7
  70. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +12 -7
  71. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +22 -3
  72. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +14 -6
  73. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +20 -3
  74. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +9 -3
  75. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +12 -6
  76. package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
  77. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -184
  78. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
  79. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -210
  80. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -77
  81. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +0 -8
  82. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +0 -17
  83. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +0 -64
  84. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +0 -61
  85. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +0 -74
  86. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +0 -110
  87. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +0 -18
  88. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +0 -57
  89. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +0 -85
  90. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
  91. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
  92. /package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/template.ejs +0 -0
  93. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +0 -0
  94. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/template.ejs +0 -0
  95. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/data.js +0 -0
  96. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/mainFunction/data.js +0 -0
  97. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.js +0 -0
  98. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/data.js +0 -0
  99. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/template.ejs +0 -0
  100. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/data.js +0 -0
  101. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
  102. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +0 -0
  103. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/template.ejs +0 -0
  104. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/data.js +0 -0
  105. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/template.ejs +0 -0
  106. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
  107. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -0
@@ -1,57 +0,0 @@
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
-
20
- const path = require('path');
21
- const { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
-
23
- const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/src/Consts");
24
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
25
- const templatePath = path.join(__dirname, "template.ejs")
26
-
27
- /**
28
- * receive objectSchema
29
- * create data for WebSocket handler template
30
- *
31
- * @param {Object} objectSchema
32
- * @return {{templatePath, templateData,setting}}
33
- */
34
- function data(_izContext, flowSchema, srcPath) {
35
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
36
- }
37
-
38
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
39
- let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicIn"
40
- let handlerType = "HdrWbs"
41
- const flowTag = flowSchema.flowTag
42
- return {
43
- templatePath: templatePath,
44
- templateData: {
45
- functionName: functionName,
46
- fileName: upperCase(functionName),
47
- flowTag,
48
- },
49
- setting: {
50
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
51
- saveFileName: `${upperCase(functionName)}_${handlerType}`,
52
- fileExtension: ".js",
53
- isAppend: false
54
- }
55
- }
56
- }
57
- module.exports = data
@@ -1,85 +0,0 @@
1
- /*
2
- * Copyright (C) 2021 Sven Mason <http://izara.io>
3
- *
4
- * This program is free software: you can redistribute it and/or modify it under the terms
5
- * of the GNU Affero General Public License as published by the Free Software Foundation,
6
- * either version 3 of the License, or (at your option) any later version.
7
- *
8
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
- * See the GNU Affero General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU Affero General Public License along with this program.
13
- * If not, see <http://www.gnu.org/licenses/>.
14
- */
15
-
16
- 'use strict';
17
-
18
- const { middlewareHandler, consts } = require("@izara_project/izara-middleware");
19
- // const AWS = require('aws-sdk');
20
- // const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
21
-
22
- const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
23
- const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
24
- const hash = require('@izara_project/izara-shared-core').objectHash;
25
- // const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
26
-
27
- const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
28
- const { <%- functionName %>Main } = require("./<%- fileName %>_Main");
29
-
30
- module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
31
- event._izContext.logger.debug('Event:', event);
32
-
33
- try {
34
- if (event.requestContext) {
35
- const route = event.requestContext.routeKey;
36
- const connectionId = event.requestContext.connectionId;
37
- let correlationId = event._izContext.correlationIds.get(consts.X_CORRELATION_ID);
38
-
39
- switch (route) {
40
- case '<%- flowTag %>':
41
- console.log("event in route <%- flowTag %>", event);
42
-
43
- let eventParams = JSON.parse(event.body);
44
-
45
- await dynamodbSharedLib.putItem(
46
- event._izContext,
47
- await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
48
- {
49
- taskKey: correlationId,
50
- connectionId: connectionId,
51
- originTimestamp: Date.now()
52
- }
53
- );
54
-
55
- let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
56
-
57
- await <%- functionName %>Main(
58
- event._izContext,
59
- eventParams,
60
- callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
61
- // (<additionalParams>)
62
- // (</additionalParams>)
63
- );
64
-
65
- break;
66
- }
67
- } else {
68
- const connId = event.connId;
69
- // await postMessage({ message: event.message }, connId);
70
- await postToConnection({ message: event.message }, connId);
71
- }
72
- } catch (err) {
73
- const connId = event.requestContext?.connectionId;
74
- event._izContext.logger.error('Error, WebSocket: ', err);
75
- // await sendErrorMessage({ message: err.message }, connId);
76
- await postToConnection({ message: err.message }, connId);
77
- }
78
- });
79
-
80
- <%_
81
- const join = require('path').join;
82
- function upperCase(text) {
83
- return text.charAt(0).toUpperCase() + text.slice(1);
84
- }
85
- _%>
@@ -1,67 +0,0 @@
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
-
20
- const path = require('path');
21
-
22
- const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/src/Consts");
23
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
24
- const templatePath = path.join(__dirname, "template.ejs");
25
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
26
- const statusFieldTemplate = path.join(__dirname, "../../../createRecordByStatusType/statusFieldTemplate.ejs")
27
- const storedCacheTemplate = path.join(__dirname, "../../../createRecordByStatusType/storedCacheTemplate.ejs")
28
-
29
- /**
30
- * receive objectSchema
31
- * create data for WebSocket Main template
32
- *
33
- * @param {Object} objectSchema
34
- * @return {{templatePath, templateData,setting}}
35
- */
36
-
37
-
38
- function data(_izContext, flowSchema, srcPath) {
39
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
40
- }
41
-
42
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
43
- let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicIn"
44
- const splitKey = Object.keys(flowSchema.flowSteps)[0].split('_')
45
- // stockLocation_Test_flowStep_TopicName_In
46
- // let objectSchema = await getObjectSchema.getObjectSchemaCombineFieldNamesWithCache(_izContext, flowSchema.objType)
47
- // let fieldNames = Object.keys(objectSchema.fieldNames)
48
- return {
49
- templatePath: templatePath,
50
- templateData: {
51
- serviceTag: splitKey[0],
52
- topicName: splitKey[2] + '_' + splitKey[3],
53
- externalTopicMain: functionName + 'Main',
54
- storedCacheTemplate,
55
- statusFieldTemplate,
56
- statusType: flowSchema.statusType,
57
- flowTag: flowSchema.flowTag,
58
- },
59
- setting: {
60
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
61
- saveFileName: `${functionName}_Main`,
62
- fileExtension: ".js",
63
- isAppend: false
64
- }
65
- }
66
- }
67
- module.exports = data