@izara_project/izara-market-library-service-schemas 1.0.33 → 1.0.35
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 +1 -1
- package/src/GenerateCodeLibs/src/Consts.js +2 -1
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +20 -6
- package/src/MainLibs/src/Consts.js +43 -10
- package/src/TemplateManager/src/attributeTree/relationshipSchema/data.js +1 -1
- package/src/reStructure/GenerateCode.js +1 -0
- package/src/reStructure/SchemaConfig.js +1 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +3 -0
- package/src/reStructure/TemplateData/attributeTreeSchema/generateTemplateData.js +28 -44
- package/src/reStructure/TemplateData/attributeTreeSchema/{mainAttributeTreeSchema → mainAttributeTree}/attributeLinkTemplate.ejs +3 -7
- package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTree/data.js +134 -0
- package/src/reStructure/TemplateData/attributeTreeSchema/relationshipSchema/data.js +172 -0
- package/src/reStructure/TemplateData/attributeTreeSchema/relationshipSchema/template.ejs +7 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/data.js +123 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/template.ejs +85 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +68 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +96 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/queue/data.js +77 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/queue/template.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +138 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/template.ejs +83 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +133 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs +12 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/statusFieldTemplate.ejs +27 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +34 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +76 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +13 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +142 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +18 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +89 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +120 -0
- package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/data.js +26 -59
- package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/data.js +8 -8
- package/src/reStructure/TemplateData/flowSchema/eventBridge/mainFunction/data.js +11 -9
- package/src/reStructure/TemplateData/flowSchema/eventBridge/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +3 -6
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +7 -9
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +8 -43
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +1 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +7 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +18 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +3 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +7 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +52 -13
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +3 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +18 -18
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +67 -6
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +20 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +9 -3
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +9 -3
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +10 -4
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +9 -3
- package/src/reStructure/TemplateData/propertyNodeSchema/generateTemplateData.js +66 -0
- package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/data.js +151 -0
- package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/templateObjectPropertyNodeSchema.ejs +16 -0
- package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/data.js +179 -0
- package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/templateRelationshipPropertyNodeSchema.ejs +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +5 -5
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +5 -5
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/libs/ValidateAddOnDataStructure.js +62 -0
- package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema/data.js +0 -188
- /package/src/reStructure/TemplateData/attributeTreeSchema/{mainAttributeTreeSchema → mainAttributeTree}/request.json +0 -0
|
@@ -1,188 +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
|
-
console.log("data main attribute tree schema");
|
|
21
|
-
|
|
22
|
-
const path = require('path');
|
|
23
|
-
const fs = require('fs');
|
|
24
|
-
|
|
25
|
-
const serviceSchemaCore = require("@izara_project/izara-core-library-service-schemas");
|
|
26
|
-
const getObjectSchema = serviceSchemaCore.getObjectSchema;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
|
|
30
|
-
const { SOURCE_PATH, ADD_ON_DATA_STRUCTURE_TYPE, ATTRIBUTE_TAG, fieldNameSetting, FIELD_NAME_TPYE, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts');
|
|
31
|
-
|
|
32
|
-
const templatePath = path.join(__dirname, "./attributeLinkTemplate.ejs");
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
async function data(_izContext, settings, srcPath) {
|
|
37
|
-
const objTypeString = objType => `{ serviceTag: ${objType.serviceTag}, objectType: ${objType.objectType} }`;
|
|
38
|
-
|
|
39
|
-
const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, settings.objType);
|
|
40
|
-
|
|
41
|
-
/*
|
|
42
|
-
validate settings with objectSchema
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
if (!objectSchema) {
|
|
46
|
-
throw Error(`Invalid objType:${objTypeString(settings.objType)}, cannot generate attribute tree schema cause objectSchema is not exists`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
|
|
50
|
-
throw Error(`objType: ${objTypeString(settings.objType)}. cannot generate attribute tree schema cause addOnDataStructure is not exists or empty`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!objectSchema.hasOwnProperty("addOnDataStructure")) {
|
|
54
|
-
throw Error("Invalid objectSchema does not have addOnDataStructure");
|
|
55
|
-
}
|
|
56
|
-
// {
|
|
57
|
-
// generateName: "mainAttributeTree",
|
|
58
|
-
// objType: {
|
|
59
|
-
// serviceTag: "GenerateCodeTemplate",
|
|
60
|
-
// objectType: "person"
|
|
61
|
-
// },
|
|
62
|
-
// attributeTag: "productAttribute"
|
|
63
|
-
// }
|
|
64
|
-
|
|
65
|
-
let addOnAttributeTree = objectSchema.addOnDataStructure.find(addOn => {
|
|
66
|
-
return addOn.type === ADD_ON_DATA_STRUCTURE_TYPE.attributeTree && addOn.attributeTreeTag === settings.attributeTag;
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!addOnAttributeTree) {
|
|
71
|
-
throw Error(`objType: ${objTypeString(settings.objType)}. cannot generate attribute tree schema cause not found addOnDataStructure with attributeTreeTag: ${settings.attributeTag}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// TODO: use addOnAttributeTree to generate attribute tree schema
|
|
75
|
-
// if addOnAttributeTree.havePropertyNode === true will generate property node schema
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// console.log("objectSchema", objectSchema)
|
|
79
|
-
// console.log("srcPath", objectSchema)
|
|
80
|
-
// const createSources = [];
|
|
81
|
-
// let attributeTreeObjSchemas = [];
|
|
82
|
-
// if (objectSchema.hasOwnProperty("addOnDataStructure")) {
|
|
83
|
-
|
|
84
|
-
// for (const versionedData of objectSchema.addOnDataStructure) {
|
|
85
|
-
// if (versionedData.type === ADD_ON_DATA_STRUCTURE_TYPE.attributeTree) {
|
|
86
|
-
// const attributeTreeSubject = objectSchema.objectType; // main objectType
|
|
87
|
-
// const storageResources = objectSchema.storageResources // storageResource from main objectType
|
|
88
|
-
// const storageResourceTags = Object.keys(storageResources) // storage ResourceTag from main objectType
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// attributeTreeObjSchemas.push(
|
|
92
|
-
// {
|
|
93
|
-
// objectType: attributeTreeSubject + ATTRIBUTE_TAG.attributeTagLabel,
|
|
94
|
-
// storageResources: storageResources,
|
|
95
|
-
// fieldNames: {
|
|
96
|
-
// labelId: fieldNameSetting(FIELD_NAME_TPYE.identifiers)
|
|
97
|
-
// },
|
|
98
|
-
// identifiers: [
|
|
99
|
-
// {
|
|
100
|
-
// type: "identifier",
|
|
101
|
-
// fieldName: "labelId"
|
|
102
|
-
// }
|
|
103
|
-
// ]
|
|
104
|
-
// },
|
|
105
|
-
// {
|
|
106
|
-
// objectType: attributeTreeSubject + ATTRIBUTE_TAG.attributeTagLink,
|
|
107
|
-
// storageResources: storageResources,
|
|
108
|
-
// fieldNames: {
|
|
109
|
-
// [attributeTreeSubject + ATTRIBUTE_TAG.attributeTagLink + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.identifiers),
|
|
110
|
-
// [attributeTreeSubject + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.requiredOnCreateFieldName),
|
|
111
|
-
// topLevelParentIdentifierProperties: fieldNameSetting(FIELD_NAME_TPYE.requiredOnCreateFieldName),
|
|
112
|
-
// parentNodeIdentifierLabel: fieldNameSetting(FIELD_NAME_TPYE.requiredOnCreateFieldName),
|
|
113
|
-
// parentNodeIdentifierProperties: fieldNameSetting(FIELD_NAME_TPYE.requiredOnCreateFieldName),
|
|
114
|
-
// },
|
|
115
|
-
// identifiers: [
|
|
116
|
-
// {
|
|
117
|
-
// type: "identifier",
|
|
118
|
-
// fieldName: `${attributeTreeSubject + ATTRIBUTE_TAG.attributeTagLink}Id`
|
|
119
|
-
// }
|
|
120
|
-
// ]
|
|
121
|
-
// },
|
|
122
|
-
// {
|
|
123
|
-
// objectType: attributeTreeSubject + ATTRIBUTE_TAG.attributeTagProperty,
|
|
124
|
-
// storageResources: storageResources,
|
|
125
|
-
// fieldNames: {
|
|
126
|
-
// propertyId: fieldNameSetting(FIELD_NAME_TPYE.identifiers),
|
|
127
|
-
// propertyLabelId: fieldNameSetting(FIELD_NAME_TPYE.optionalOnCreate)
|
|
128
|
-
// },
|
|
129
|
-
// identifiers: [
|
|
130
|
-
// {
|
|
131
|
-
// type: "identifier",
|
|
132
|
-
// fieldName: "propertyId"
|
|
133
|
-
// }
|
|
134
|
-
// ]
|
|
135
|
-
// },
|
|
136
|
-
// {
|
|
137
|
-
// objectType: attributeTreeSubject + ATTRIBUTE_TAG.attributeTagPropertyLabel,
|
|
138
|
-
// storageResources: storageResources,
|
|
139
|
-
// fieldNames: {
|
|
140
|
-
// propertyLabelId: fieldNameSetting(FIELD_NAME_TPYE.identifiers)
|
|
141
|
-
// },
|
|
142
|
-
// identifiers: [
|
|
143
|
-
// {
|
|
144
|
-
// type: "identifier",
|
|
145
|
-
// fieldName: "propertyLabelId"
|
|
146
|
-
// }
|
|
147
|
-
// ]
|
|
148
|
-
// }
|
|
149
|
-
// )
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// for (let attributeTreeObjSchema of attributeTreeObjSchemas) {
|
|
153
|
-
// for (let attributeTreeFieldName of Object.values(attributeTreeObjSchema.fieldNames)) {
|
|
154
|
-
// Object.assign(attributeTreeFieldName, { storageResourceTags: storageResourceTags }) // add storageResourceTags for each fieldName
|
|
155
|
-
// }
|
|
156
|
-
// }
|
|
157
|
-
// }
|
|
158
|
-
|
|
159
|
-
// }
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// // console.log("attributeTreeObjSchemas", attributeTreeObjSchemas)
|
|
164
|
-
// for (const attributeTreeObjSchema of attributeTreeObjSchemas) {
|
|
165
|
-
// createSources.push({
|
|
166
|
-
// templatePath: templatePath,
|
|
167
|
-
// templateData: {
|
|
168
|
-
// fieldNames: JSON.stringify(attributeTreeObjSchema.fieldNames, null, 2),
|
|
169
|
-
// identifiers: JSON.stringify(attributeTreeObjSchema.identifiers, null, 2),
|
|
170
|
-
// objectType: attributeTreeObjSchema.objectType,
|
|
171
|
-
// storageResources: JSON.stringify(attributeTreeObjSchema.storageResources, null, 2),
|
|
172
|
-
// compositeKeyDeliminator: attributeTreeObjSchema.compositeKeyDeliminator
|
|
173
|
-
// },
|
|
174
|
-
// setting: {
|
|
175
|
-
// savePath: path.join(srcPath, SOURCE_PATH.generatedAttributeTree, attributeTreeObjSchema.objectType + "/"),
|
|
176
|
-
// hookPath: path.join(srcPath, "schemaHook", attributeTreeObjSchema.objectType, "/"),
|
|
177
|
-
// saveFileName: SAVE_FILE_NAME.attributeTreeObjectSchema,
|
|
178
|
-
// fileExtension: ".js",
|
|
179
|
-
// isAppend: false
|
|
180
|
-
// }
|
|
181
|
-
// })
|
|
182
|
-
// }
|
|
183
|
-
// }
|
|
184
|
-
// console.log("createSources", createSources)
|
|
185
|
-
return createSources;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
module.exports = data
|
|
File without changes
|