@izara_project/izara-market-library-service-schemas 1.0.34 → 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.
Files changed (74) hide show
  1. package/package.json +1 -1
  2. package/src/GenerateCodeLibs/src/Consts.js +2 -1
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +5 -5
  4. package/src/MainLibs/src/Consts.js +43 -10
  5. package/src/TemplateManager/src/attributeTree/relationshipSchema/data.js +1 -1
  6. package/src/reStructure/GenerateCode.js +1 -0
  7. package/src/reStructure/SchemaConfig.js +1 -0
  8. package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +2 -2
  9. package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +2 -2
  10. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +3 -0
  11. package/src/reStructure/TemplateData/attributeTreeSchema/generateTemplateData.js +28 -44
  12. package/src/reStructure/TemplateData/attributeTreeSchema/{mainAttributeTreeSchema → mainAttributeTree}/attributeLinkTemplate.ejs +3 -7
  13. package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTree/data.js +134 -0
  14. package/src/reStructure/TemplateData/attributeTreeSchema/relationshipSchema/data.js +172 -0
  15. package/src/reStructure/TemplateData/attributeTreeSchema/relationshipSchema/template.ejs +7 -0
  16. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/data.js +123 -0
  17. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +20 -0
  18. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/data.js +57 -0
  19. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/template.ejs +85 -0
  20. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +68 -0
  21. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +96 -0
  22. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/queue/data.js +77 -0
  23. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/queue/template.ejs +49 -0
  24. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +4 -4
  25. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +138 -0
  26. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/template.ejs +20 -0
  27. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/data.js +55 -0
  28. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/template.ejs +83 -0
  29. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/data.js +55 -0
  30. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +133 -0
  31. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/data.js +64 -0
  32. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs +12 -0
  33. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/statusFieldTemplate.ejs +19 -6
  34. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +19 -2
  35. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +76 -0
  36. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +13 -0
  37. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +142 -0
  38. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +18 -0
  39. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/data.js +64 -0
  40. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +89 -0
  41. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/data.js +55 -0
  42. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +120 -0
  43. package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/data.js +26 -59
  44. package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/template.ejs +3 -3
  45. package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/data.js +8 -8
  46. package/src/reStructure/TemplateData/flowSchema/eventBridge/mainFunction/data.js +11 -9
  47. package/src/reStructure/TemplateData/flowSchema/eventBridge/mainFunction/template.ejs +3 -3
  48. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +3 -6
  49. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +7 -9
  50. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +2 -2
  51. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +2 -2
  52. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +1 -1
  53. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +8 -43
  54. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +1 -1
  55. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +2 -2
  56. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +1 -0
  57. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +7 -1
  58. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +18 -7
  59. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +3 -1
  60. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +7 -1
  61. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +52 -13
  62. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +2 -0
  63. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +1 -6
  64. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +1 -29
  65. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +67 -6
  66. package/src/reStructure/TemplateData/generateRole/createSharedResource.js +20 -0
  67. package/src/reStructure/TemplateData/propertyNodeSchema/generateTemplateData.js +66 -0
  68. package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/data.js +151 -0
  69. package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/templateObjectPropertyNodeSchema.ejs +16 -0
  70. package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/data.js +179 -0
  71. package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/templateRelationshipPropertyNodeSchema.ejs +7 -0
  72. package/src/reStructure/libs/ValidateAddOnDataStructure.js +62 -0
  73. package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema/data.js +0 -188
  74. /package/src/reStructure/TemplateData/attributeTreeSchema/{mainAttributeTreeSchema → mainAttributeTree}/request.json +0 -0
@@ -0,0 +1,179 @@
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("=== relationship property node schema ===");
21
+
22
+ const path = require('path');
23
+ const fs = require('fs');
24
+ const {
25
+ SOURCE_PATH,
26
+ PREFIX_RELATIONSHIP,
27
+ PROPERTYNODE_TAG,
28
+ SAVE_FILE_NAME
29
+ } = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
30
+
31
+ const templatePath = path.join(__dirname, "./templateRelationshipPropertyNodeSchema.ejs");
32
+
33
+ const yaml = require("yaml")
34
+ const objectschemaLocalByPath = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
35
+ const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
36
+ const Consts = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
37
+ const { firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
38
+ const { createBasicRelationshipsProperties } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
39
+
40
+ async function data(_izContext, settings, srcPath) {
41
+
42
+ let objectSchemaPath = path.join(srcPath, "schemas")
43
+ let allObjectSchemas = await objectschemaLocalByPath.getAllLocalObjectSchemas(
44
+ _izContext,
45
+ objectSchemaPath
46
+ );
47
+
48
+ let createSourceRecords = [];
49
+
50
+ if (allObjectSchemas.records.length == 0) {
51
+ throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
52
+ };
53
+ nextObjectSchema:
54
+ for (const objectSchema of allObjectSchemas.records) {
55
+
56
+ // validate only addOnndataStructure is type propertyNode.
57
+ if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
58
+ console.log("Not have data in addOnDataStructure ,continute nextObjectSchema")
59
+ continue
60
+ };
61
+
62
+ for (let eachAddOnDataStructure of objectSchema.addOnDataStructure) {
63
+
64
+ if (eachAddOnDataStructure.type !== Consts.ADD_ON_DATA_STRUCTURE_TYPE.propertyNode) {
65
+ console.log("continute,AddOnDataStructure not type propertyNode")
66
+ continue
67
+ };
68
+
69
+ let generateRelationships = createSourceParams(
70
+ _izContext,
71
+ objectSchema,
72
+ srcPath
73
+ );
74
+ console.log("generateRelationship", generateRelationships);
75
+
76
+ createSourceRecords.push(...generateRelationships);
77
+
78
+ };//End loop addOn
79
+ }; //End loop objectSchema
80
+ console.log("createSourceRecords: ", createSourceRecords);
81
+
82
+ if (createSourceRecords.length) {
83
+ return {
84
+ templatePath: templatePath,
85
+ templateData: {
86
+ datas: createSourceRecords
87
+ },
88
+ setting: {
89
+ savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyNode),
90
+ hookPath: path.join(srcPath, "schemaHook", "propertyNode", "/"),
91
+ saveFileName: SAVE_FILE_NAME.objectRelationship,
92
+ fileExtension: ".js",
93
+ isAppend: false,
94
+ // encloseTemplate: "\n ]",
95
+ }
96
+ }
97
+ };
98
+ };
99
+
100
+
101
+ function createSourceParams(
102
+ _izContext,
103
+ objectSchema,
104
+ srcPath
105
+ ) {
106
+ const attributeRelationships = [];
107
+ const objectType = objectSchema.objectType; // main objectType
108
+ const storageResources = objectSchema.storageResources // storageResource from main objectType
109
+ const configPath = path.join(srcPath, '../../config/serverless.config.yml');
110
+ const serverlessConfig = fs.readFileSync(configPath, 'utf8');
111
+ const config = yaml.parse(serverlessConfig);
112
+ const serviceTag = config.main_config.iz_serviceTag;
113
+
114
+
115
+ attributeRelationships.push(
116
+ { // has{objectType}property
117
+ relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(objectType) + PROPERTYNODE_TAG.property,
118
+ relationshipProperties: createBasicRelationshipsProperties(
119
+ {
120
+ serviceTag: serviceTag,
121
+ objectType: objectType,
122
+ linkType: "many",
123
+ requiredOnCreate: false
124
+ },
125
+ {
126
+ serviceTag: serviceTag,
127
+ objectType: upperCase(objectType) + PROPERTYNODE_TAG.property,
128
+ linkType: "many",
129
+ requiredOnCreate: false
130
+ },
131
+ storageResources,
132
+ "from"
133
+ )
134
+ },
135
+ // disabled{objectType}property
136
+ {
137
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + PROPERTYNODE_TAG.property,
138
+ relationshipProperties: createBasicRelationshipsProperties(
139
+ {
140
+ serviceTag: serviceTag,
141
+ objectType: objectType,
142
+ linkType: "many",
143
+ requiredOnCreate: false
144
+ },
145
+ {
146
+ serviceTag: serviceTag,
147
+ objectType: upperCase(objectType) + PROPERTYNODE_TAG.property,
148
+ linkType: "many",
149
+ requiredOnCreate: false
150
+ },
151
+ storageResources,
152
+ "from"
153
+ )
154
+ },
155
+
156
+ { // is{objectType}PropertyLabel
157
+ relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + PROPERTYNODE_TAG.propertyLabel,
158
+ relationshipProperties: createBasicRelationshipsProperties(
159
+ {
160
+ serviceTag: serviceTag,
161
+ objectType: upperCase(objectType) + PROPERTYNODE_TAG.property,
162
+ linkType: "many",
163
+ requiredOnCreate: true
164
+ },
165
+ {
166
+ serviceTag: serviceTag,
167
+ objectType: upperCase(objectType) + PROPERTYNODE_TAG.propertyLabel,
168
+ linkType: "many",
169
+ requiredOnCreate: false
170
+ },
171
+ storageResources,
172
+ "from"
173
+ )
174
+ }
175
+ )
176
+ return attributeRelationships
177
+ }
178
+
179
+ module.exports = data
@@ -0,0 +1,7 @@
1
+ module.exports = [
2
+ <% datas.forEach(data => { %>
3
+ {
4
+ <%- data.relationshipTag %>: <%- JSON.stringify(data.relationshipProperties,null,2) %>
5
+ },
6
+ <% }) %>
7
+ ]
@@ -0,0 +1,62 @@
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 Consts = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts')
20
+ const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
21
+ const { ADD_ON_DATA_STRUCTURE_TYPE } = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
22
+
23
+ async function validateAddOnDataStructure(
24
+ _izContext,
25
+ settings
26
+ ) {
27
+
28
+ let errorFounds = [];
29
+ let returnObjectValue = {}
30
+
31
+ const objTypeString = objType => `{ serviceTag: ${objType.serviceTag}, objectType: ${objType.objectType} }`;
32
+
33
+ const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, settings.objType);
34
+
35
+ if (!objectSchema) {
36
+ errorFounds.push(`Invalid objType:${objTypeString(settings.objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
37
+ };
38
+
39
+ if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
40
+ errorFounds.push(`objType: ${objTypeString(settings.objType)}.cause addOnDataStructure is not exists or empty`)
41
+ };
42
+
43
+
44
+ if (settings.hasOwnProperty("attributeTag")) {
45
+ let addOnAttributeTree = objectSchema.addOnDataStructure.find(addOn => {
46
+ return addOn.type === ADD_ON_DATA_STRUCTURE_TYPE.attributeTree && addOn.attributeTreeTag === settings.attributeTag;
47
+ });
48
+ Object.assign(returnObjectValue, {
49
+ addOnAttributeTree: addOnAttributeTree,
50
+ });
51
+ if (!addOnAttributeTree) {
52
+ errorFounds.push(`objType: ${objTypeString(settings.objType)}. cannot generate attribute tree schema cause not found addOnDataStructure with attributeTreeTag: ${settings.attributeTag}`)
53
+ }
54
+ };
55
+
56
+ Object.assign(returnObjectValue, {
57
+ objectSchema: objectSchema
58
+ });
59
+
60
+ return [returnObjectValue, errorFounds];
61
+ }
62
+ module.exports = validateAddOnDataStructure
@@ -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