@izara_project/izara-market-library-service-schemas 1.0.52 → 1.0.54

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 (58) hide show
  1. package/package.json +5 -5
  2. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +1 -1
  3. package/src/reStructure/TemplateConfig.js +4 -1
  4. package/src/reStructure/TemplateData/Auth/generateAuthYml/data.js +58 -0
  5. package/src/reStructure/TemplateData/Auth/generateAuthYml/template.ejs +17 -0
  6. package/src/reStructure/TemplateData/Auth/generateTemplateData.js +51 -0
  7. package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +2 -1
  8. package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +2 -1
  9. package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +2 -0
  10. package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +2 -0
  11. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +52 -41
  12. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +3 -1
  13. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +4 -4
  14. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +4 -1
  15. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +2 -2
  16. package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +12 -14
  17. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +22 -6
  18. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +2 -2
  19. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/functionYaml/data.js +13 -10
  20. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/data.js +1 -46
  21. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +4 -1
  22. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +8 -12
  23. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/EndpointComponent/mainFunction → flowSchemaMainFunction}/data.js +5 -5
  24. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/EndpointComponent/mainFunction → flowSchemaMainFunction}/template.ejs +7 -12
  25. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +12 -8
  26. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +6 -2
  27. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +1 -1
  28. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +1 -1
  29. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
  30. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +1 -1
  31. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +1 -1
  32. package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +1 -1
  33. package/src/reStructure/TemplateData/flowSchema/flowStep/handler/template.ejs +7 -1
  34. package/src/reStructure/TemplateData/flowSchema/flowStep/mainFunction/data.js +2 -2
  35. package/src/reStructure/TemplateData/flowSchema/flowStep/mainFunction/template.ejs +2 -7
  36. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +37 -24
  37. package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/functionYaml/data.js +79 -0
  38. package/src/reStructure/TemplateData/flowSchema/lambdaSync/{functionYaml/templateApi.ejs → Api/functionYaml/template.ejs} +11 -5
  39. package/src/reStructure/TemplateData/flowSchema/lambdaSync/{handler → Api/handler}/data.js +7 -33
  40. package/src/reStructure/TemplateData/flowSchema/lambdaSync/{handler/templateApi.ejs → Api/handler/template.ejs} +28 -24
  41. package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/functionYaml/data.js +78 -0
  42. package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/handler/data.js +58 -0
  43. package/src/reStructure/TemplateData/flowSchema/lambdaSync/{handler/templateInv.ejs → Inv/handler/template.ejs} +11 -5
  44. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +15 -7
  45. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +1 -1
  46. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +9 -1
  47. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +5 -1
  48. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +9 -10
  49. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/mainFunction/data.js +0 -75
  50. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/mainFunction/template.ejs +0 -98
  51. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/sqsTemplate.ejs +0 -52
  52. package/src/reStructure/TemplateData/flowSchema/lambdaSync/functionYaml/data.js +0 -128
  53. package/src/reStructure/TemplateData/flowSchema/lambdaSync/mainFunction/data.js +0 -74
  54. package/src/reStructure/TemplateData/flowSchema/lambdaSync/mainFunction/template.ejs +0 -96
  55. /package/src/reStructure/TemplateData/flowSchema/lambdaSync/{functionYaml/templateInv.ejs → Inv/functionYaml/template.ejs} +0 -0
  56. /package/src/reStructure/TemplateData/flowSchema/{templateBystatusType → templateByStatusType}/statusFieldTemplate.ejs +0 -0
  57. /package/src/reStructure/TemplateData/flowSchema/{templateBystatusType → templateByStatusType}/storedCacheTemplate.ejs +0 -0
  58. /package/src/reStructure/TemplateData/flowSchema/{templateBystatusType → templateByStatusType}/triggerCacheTemplate.ejs +0 -0
@@ -1,128 +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
- const path = require('path');
20
-
21
- const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
- const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
23
- const {
24
- SOURCE_PATH,
25
- defaultIamRolePerAction,
26
- createIamRole,
27
- RESOURCE_CLASSES,
28
- SNS_RESOURCE,
29
- resourceNames,
30
- DYNAMO_RESOURCE,
31
- SAVE_FILE_NAME,
32
- FUNCTION_NAME,
33
- shortNameHandler,
34
- externalResourceYaml,
35
- SOURCE_GENERATE_IAM_ROLE,
36
- SQS_RESOURCE,
37
- LAMBDA_RESOURCE
38
- } = require('../../../../../MainLibs/src/Consts');
39
- const { NoRetryError } = require('@izara_project/izara-core-library-core');
40
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
41
-
42
- const templatePathInv = path.join(__dirname, "templateInv.ejs");
43
- const templatePathApi = path.join(__dirname, "templateApi.ejs");
44
- /**
45
- * receive objectSchema
46
- * create data for WebScoket handler template
47
- *
48
- * @param {Object} objectSchema
49
- * @return {{templatePath, templateData,setting}}
50
- */
51
-
52
- async function data(_izContext, flowSchema, srcPath) {
53
- let returnCreateSource = [];
54
- returnCreateSource.push(await createSourceParamsInvoke(_izContext, flowSchema, srcPath))
55
- if (flowSchema.externalEndpoint) {
56
- returnCreateSource.push(await createSourceParamsApi(_izContext, flowSchema, srcPath))
57
- }
58
- return returnCreateSource
59
- }
60
-
61
- async function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
62
- let functionName = upperCase(flowSchema.flowTag)
63
- let handlerType = upperCase(HANDLER.hdrInv)
64
- let additionalResourcePermission = defaultIamRolePerAction();
65
- let tableName = null;
66
- if (flowSchema.statusType === "storedCache") {
67
- let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
68
- for (const storageResource of Object.values(objectSchema.storageResources)) {
69
- if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
70
- tableName = storageResource.tableName
71
- }
72
- }
73
- }
74
-
75
- return {
76
- templatePath: templatePathInv,
77
- templateData: {
78
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
79
- functionName,
80
- handlerType,
81
- additionalResourcePermission,
82
- functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
83
- roleName: upperCase(flowSchema.flowTag)
84
- },
85
- setting: {
86
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
87
- saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
88
- fileExtension: ".yml",
89
- isAppend: true
90
- }
91
- }
92
- }
93
-
94
- async function createSourceParamsApi(_izContext, flowSchema, srcPath) {
95
- let functionName = upperCase(flowSchema.flowTag)
96
- let handlerType = upperCase(HANDLER.hdrApi)
97
- let additionalResourcePermission = defaultIamRolePerAction();
98
- let tableName = null;
99
- if (flowSchema.statusType === "storedCache") {
100
- let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
101
- for (const storageResource of Object.values(objectSchema.storageResources)) {
102
- if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
103
- tableName = storageResource.tableName
104
- }
105
- }
106
- }
107
-
108
- return {
109
- templatePath: templatePathApi,
110
- templateData: {
111
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
112
- functionName,
113
- handlerType,
114
- additionalResourcePermission,
115
- functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
116
- roleName: upperCase(flowSchema.flowTag),
117
- event: "post"
118
- },
119
- setting: {
120
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
121
- saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
122
- fileExtension: ".yml",
123
- isAppend: true
124
- }
125
- }
126
- }
127
-
128
- module.exports = data;
@@ -1,74 +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
- const path = require('path');
20
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema
21
- const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts');
22
- const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
23
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils")
24
- const templatePath = path.join(__dirname, "./template.ejs");
25
- const statusFieldTemplate = path.join(__dirname, "../../templateBystatusType/statusFieldTemplate.ejs")
26
- const storedCacheTemplate = path.join(__dirname, "../../templateBystatusType/storedCacheTemplate.ejs")
27
- const triggerCacheTemplate = path.join(__dirname, "../../templateBystatusType/triggerCacheTemplate.ejs");
28
- /**
29
- * receive objectSchema
30
- * create data for WebScoket handler template
31
- *
32
- * @param {Object} objectSchema
33
- * @return {{templatePath, templateData,setting}}
34
- */
35
-
36
-
37
- async function data(_izContext, flowSchema, srcPath) {
38
- return [await createParamsForCreateSource(_izContext, flowSchema, srcPath)]
39
- }
40
-
41
- async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
42
- let functionName = upperCase(flowSchema.flowTag);
43
- let statusType = flowSchema.statusType;
44
- let triggerType = flowSchema.triggerType;
45
- let tableName = null;
46
- if (flowSchema.statusType === "storedCache") {
47
- let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
48
- for (const storageResource of Object.values(objectSchema.storageResources)) {
49
- if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
50
- tableName = storageResource.tableName
51
- }
52
- }
53
- }
54
- return {
55
- templatePath: templatePath,
56
- templateData: {
57
- flowTag: flowSchema.flowTag,
58
- functionName,
59
- statusFieldTemplate,
60
- storedCacheTemplate,
61
- triggerCacheTemplate,
62
- statusType,
63
- tableName,
64
- triggerType
65
- },
66
- setting: {
67
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
68
- saveFileName: `${functionName}_Main`,
69
- fileExtension: ".js",
70
- isAppend: false
71
- }
72
- }
73
- }
74
- module.exports = data
@@ -1,96 +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
16
- <http: //www.gnu.org/licenses />.
17
- */
18
-
19
- 'use strict';
20
-
21
- const hash = require('@izara_project/izara-shared-core').objectHash;
22
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
23
-
24
- const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
25
- const snsSharedLib = require('@izara_project/izara-core-library-sns');
26
- const sqsSharedLib = require('@izara_project/izara-core-library-sqs');
27
- const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
28
- const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
29
- const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
30
- const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
31
-
32
- const externalRequest = require('@izara_project/izara-core-library-external-request');
33
- const sns = externalRequest.sns
34
- const sqs = externalRequest.sqs
35
- const lambda = externalRequest.lambda
36
- const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
37
- const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
38
- const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
39
- const { v4: uuidv4 } = require('uuid')
40
- const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
41
- const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
42
- const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
43
- const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs.js')
44
- //(<optionalRequire>)
45
- //(</optionalRequire>)
46
- /**
47
- *
48
- *
49
- * description of function.
50
- * @param {Object} _izContext
51
- * @param {CorrelationIds} _izContext.correlationIds - property of _izContext
52
- * @param {Logger} _izContext.logger - property of _izContext
53
- * @param {Object} requestParams - request params
54
- * @param {Object} requestParams.identifiers - identifiers for get data
55
- * @param {Object} requestParams.additionalRequest - additionalRequest
56
- *
57
- *
58
- * @returns {object} description of return value
59
- */
60
-
61
- module.exports.<%- functionName %>Main = async (
62
- _izContext,
63
- requestParams,
64
- callingFlowConfig = {},
65
- //(<additionalParams>)
66
- //(</additionalParams>)
67
- ) => {
68
-
69
- try {
70
- _izContext.logger.debug("<%- functionName %>Main _izContext", _izContext)
71
- _izContext.logger.debug("<%- functionName %>Main requestParams", requestParams)
72
- _izContext.logger.debug("<%- functionName %>Main callingFlowConfig", callingFlowConfig)
73
-
74
- //(<beforeCheckStatus>)
75
- //(</beforeCheckStatus>)
76
-
77
- <% if (statusType === "statusField") { %>
78
- <%- include(statusFieldTemplate) %>
79
- <% } else if (statusType === "storedCache") { %>
80
- <%- include(storedCacheTemplate, {tableName:tableName}) %>
81
-
82
- <% } else if (statusType === "triggerCache") { %>
83
- <%- include(triggerCacheTemplate, {
84
- tableName: tableName,
85
- triggerType: triggerType
86
- }) %>
87
- <% } %>
88
-
89
- //(<endpointHook>)
90
- //(</endpointHook>)
91
-
92
- } catch (err) {
93
- _izContext.logger.error('error WebSocketInvoke: ', err)
94
- throw (err)
95
- }
96
- }