@izara_project/izara-market-library-service-schemas 1.0.22 → 1.0.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-market-library-service-schemas",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Schemas for Izara Market project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,18 +14,18 @@
14
14
  "license": "AGPL-3.0-or-later",
15
15
  "homepage": "https://bitbucket.org/izara-market-libraries/izara-market-library-service-schemas/src/master/README.md",
16
16
  "devDependencies": {
17
- "jest": "^23.6.0"
17
+ "jest": "^29.7.0"
18
18
  },
19
19
  "jest": {
20
20
  "testEnvironment": "node"
21
21
  },
22
22
  "dependencies": {
23
- "@izara_project/izara-core-library-core": "^1.0.14",
23
+ "@izara_project/izara-core-library-core": "^1.0.16",
24
24
  "@izara_project/izara-core-library-external-request": "^1.0.17",
25
- "@izara_project/izara-core-library-service-schemas": "^1.0.41",
26
- "@izara_project/izara-shared": "^1.0.116",
25
+ "@izara_project/izara-core-library-service-schemas": "^1.0.43",
26
+ "@izara_project/izara-shared": "^1.0.125",
27
27
  "ejs": "^3.1.10",
28
- "js-beautify": "^1.15.1",
28
+ "js-beautify": "^1.15.4",
29
29
  "lodash": "^4.17.21",
30
30
  "object-hash": "^3.0.0",
31
31
  "yaml": "^2.7.0"
@@ -936,22 +936,31 @@ function createFieldForUpdateDynamoDb(_izContext, objectSchema, dynamoDataDetail
936
936
 
937
937
  /**
938
938
  *
939
- * @param {Object} fromObjType
940
- * @param {String} fromObjType.objectType
941
- * @param {String} fromObjType.serviceTag
942
- * @param {Object} toObjType
943
- * @param {String} toObjType.objectType
944
- * @param {String} toObjType.serviceTag
939
+ * @param {Object} from
940
+ * @param {String} from.objectType
941
+ * @param {String} from.serviceTag
942
+ * @param {String} from.linkType
943
+ * @param {String} from.requiredOnCreate
944
+ * @param {Object} to
945
+ * @param {String} to.objectType
946
+ * @param {String} to.serviceTag
947
+ * @param {String} to.linkType
948
+ * @param {String} to.requiredOnCreate
945
949
  * @param {Object} storageResources
950
+ * @param {Boolean} topLevelParent
946
951
  */
947
- function createLinksObjectRelationshipAttributeTree(fromObjType, toObjType, storageResources, direction) {
948
- validateObjType(fromObjType);
949
- validateObjType(toObjType);
950
-
951
- if (direction === from) {
952
-
952
+ function createBasicRelationshipsProperties(from, to, storageResources, baseDirection, topLevelParent = false) {
953
+ validateObjType({ objectType: from.objectType, serviceTag: from.serviceTag });
954
+ validateObjType({ objectType: to.objectType, serviceTag: to.serviceTag });
955
+
956
+ let otherDirection;
957
+ if (baseDirection === "to") {
958
+ otherDirection = "from"
959
+ } else if (baseDirection === "from") {
960
+ otherDirection = "to"
953
961
  }
954
- return {
962
+
963
+ let relationshipProperties = {
955
964
  fieldNames: {
956
965
  originTimeStamp: {
957
966
  type: 'number',
@@ -966,21 +975,55 @@ function createLinksObjectRelationshipAttributeTree(fromObjType, toObjType, stor
966
975
  storageResources: storageResources,
967
976
  links: [
968
977
  {
969
- storageResourceTag: Object.keys(storageResources),
978
+ storageResourceTags: Object.keys(storageResources),
970
979
  from: {
971
- objType: fromObjType,
972
- linkType: "one",
973
- direction: direction
980
+ objType: {
981
+ objectType: from.objectType,
982
+ serviceTag: from.serviceTag
983
+ },
984
+ linkType: from.linkType,
985
+ direction: baseDirection,
986
+ requiredOnCreate: from.requiredOnCreate
974
987
  },
975
988
  to: {
976
- objType: toObjType,
977
- linkType: "many"
989
+ objType: {
990
+ objectType: to.objectType,
991
+ serviceTag: to.serviceTag
992
+ },
993
+ linkType: to.linkType,
994
+ direction: otherDirection,
995
+ requiredOnCreate: to.requiredOnCreate
978
996
  }
979
997
  }
980
- ]
981
-
998
+ ],
999
+ }
982
1000
 
1001
+ if (topLevelParent === true) {
1002
+ relationshipProperties.links.push(
1003
+ {
1004
+ storageResourceTags: Object.keys(storageResources),
1005
+ from: {
1006
+ objType: {
1007
+ serviceTag: to.serviceTag,
1008
+ objectType: to.objectType
1009
+ },
1010
+ linkType: "one",
1011
+ direction: "from",
1012
+ requiredOnCreate: false
1013
+ },
1014
+ to: {
1015
+ objType: {
1016
+ serviceTag: to.serviceTag,
1017
+ objectType: to.objectType
1018
+ },
1019
+ linkType: "many",
1020
+ direction: "to",
1021
+ requiredOnCreate: false
1022
+ }
1023
+ }
1024
+ )
983
1025
  }
1026
+ return relationshipProperties
984
1027
  }
985
1028
 
986
1029
  module.exports = {
@@ -1001,7 +1044,7 @@ module.exports = {
1001
1044
  createDeleteDataDetail,
1002
1045
 
1003
1046
  createFieldForUpdateDynamoDb,
1004
- createLinksObjectRelationshipAttributeTree
1047
+ createBasicRelationshipsProperties
1005
1048
  }
1006
1049
 
1007
1050
 
@@ -86,10 +86,20 @@ function generateDataFromTemplate(template, data,) {
86
86
  * @param {string} setting.initialData // initialData can use when isAppend = true
87
87
  * @returns
88
88
  */
89
- async function createSource(template, data, { savePath, hookPath, saveFileName, fileExtension, initialData, isAppend = false }) {
89
+ async function createSource(template, data, { savePath, hookPath, saveFileName, fileExtension, initialData, isAppend = false, checkCreateSourcePass = false }) {
90
90
 
91
91
  try {
92
92
 
93
+ if (checkCreateSourcePass) {
94
+ try {
95
+ generateDataFromTemplate(template, data);
96
+ return [true, {}];
97
+ } catch (errors) {
98
+ return [false, errors];
99
+ }
100
+ }
101
+
102
+
93
103
  let dataToSave = generateDataFromTemplate(template, data);
94
104
 
95
105
  let anyDoubleTagClass
@@ -43,10 +43,11 @@ const NoRetryError = require("@izara_project/izara-core-library-core/src/NoRetry
43
43
 
44
44
  async function data(_izContext, srcPath) {
45
45
 
46
+ let schemaPath = path.join(srcPath, "schemas")
46
47
  let datas = [];
47
48
 
48
49
  // 1. get objectTypes for check objType param
49
- let getObjectTypes = await getObjectSchemas.getAllLocalObjectSchemas(_izContext, srcPath);
50
+ let getObjectTypes = await getObjectSchemas.getAllLocalObjectSchemas(_izContext, schemaPath);
50
51
  // console.log(("getObjectTypes: ", getObjectTypes.fieldLookup)
51
52
 
52
53
  for (const objectType of Object.keys(getObjectTypes.fieldLookup)) {
@@ -56,7 +57,7 @@ async function data(_izContext, srcPath) {
56
57
  let objectSchemaRecord = await getObjectSchemas.getLocalObjectSchemasWithHierarchy(
57
58
  _izContext,
58
59
  objectType,
59
- srcPath
60
+ schemaPath
60
61
  );
61
62
  // console.log("objectSchemaRecord: ", objectSchemaRecord)
62
63
 
@@ -648,6 +648,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
648
648
  // }
649
649
  // start create source
650
650
  for (let { templatePath, templateData, setting } of createSourceParams) {
651
+ // console.log("templateData in generateCode", templateData)
651
652
  // console.log("setting.saveFileName in GenerateCode", setting.saveFileName);
652
653
  // console.log("templatePath in GenerateCode", templatePath);
653
654
 
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
  const join = require('path').join;
20
20
  const { readFileSync } = require('fs');
21
- const { SOURCE_PATH } = require('./libs/Consts')
21
+ const { SOURCE_PATH, ADD_ON_DATA_STRUCTURE_TYPE } = require('./libs/Consts')
22
22
  const { createSource } = require("../../SourceManager/src/CreateSource");
23
23
  const { deleteFileInDir } = require('../../SourceManager/src/Utils')
24
24
  const {
@@ -26,6 +26,7 @@ const {
26
26
  } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
27
27
 
28
28
  const createAttributeTreeObjSchemas = require('./attributeTree/objectSchema/data');
29
+ const createAttributeTreeObjRelationship = require('./attributeTree/relationshipSchema/data');
29
30
 
30
31
  /**
31
32
  *
@@ -55,19 +56,33 @@ async function generateSchemaWithTemplate(_izContext, objSchemaPath) {
55
56
  const allObjectSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
56
57
 
57
58
  for (const objectSchema of allObjectSchemas.records) {
59
+
58
60
  const attributeTreeObjSchema = createAttributeTreeObjSchemas(_izContext, objectSchema, saveFilePath);
61
+
59
62
  const attributeTreeGenerator = [...attributeTreeObjSchema]
63
+ if (objectSchema.hasOwnProperty("addOnDataStructure")) {
64
+ for (const versionedData of objectSchema.addOnDataStructure) {
65
+ if (versionedData.type === ADD_ON_DATA_STRUCTURE_TYPE.attributeTree) {
66
+ const attributeTreeObjRelationship = createAttributeTreeObjRelationship(_izContext, objectSchema, saveFilePath);
67
+ createSourceParams = createSourceParams.concat(attributeTreeObjRelationship)
68
+ }
69
+ }
70
+ }
71
+
60
72
  createSourceParams.push(...attributeTreeGenerator)
61
- };
73
+
74
+ }
75
+
76
+
77
+ console.log("createSourceParams in generateSchema", createSourceParams)
62
78
 
63
79
  for (let folderPathToEmpty of Object.keys(GENERATECODE_SOURCE_PATH)) {
64
80
  await deleteFileInDir(GENERATECODE_SOURCE_PATH[folderPathToEmpty]);
65
81
  }
66
82
 
67
-
83
+ // console.log("createSourceParams", createSourceParams)
68
84
  for (let { templatePath, templateData, setting } of createSourceParams) {
69
- // console.log("setting.saveFileName in GenerateSchema", setting.saveFileName);
70
- // console.log("templatePath in GenerateSchema", templatePath);
85
+ // console.log("templateData in generateSchema", templateData);
71
86
  // console.log("setting.savePath in GenerateSchema", setting.savePath)
72
87
  await createSource(
73
88
  readFileSync(templatePath, 'utf8'),
@@ -27,7 +27,7 @@ function data(_izContext, objectSchema, srcPath) {
27
27
  const createSources = [];
28
28
  let attributeTreeObjSchemas = [];
29
29
  if (objectSchema.hasOwnProperty("addOnDataStructure")) {
30
- for (const versionedData of objectSchema.addOnDataStructure)
30
+ for (const versionedData of objectSchema.addOnDataStructure) {
31
31
  if (versionedData.type === ADD_ON_DATA_STRUCTURE_TYPE.attributeTree) {
32
32
  const objectType = objectSchema.objectType; // main objectType
33
33
  const storageResources = objectSchema.storageResources // storageResource from main objectType
@@ -98,25 +98,28 @@ function data(_izContext, objectSchema, srcPath) {
98
98
  }
99
99
  }
100
100
  }
101
- }
102
- // console.log("attributeTreeObjSchemas", attributeTreeObjSchemas)
103
- for (const attributeTreeObjSchema of attributeTreeObjSchemas) {
104
- createSources.push({
105
- templatePath: templatePath,
106
- templateData: {
107
- fieldNames: JSON.stringify(attributeTreeObjSchema.fieldNames),
108
- identifiers: JSON.stringify(attributeTreeObjSchema.identifiers),
109
- objectType: attributeTreeObjSchema.objectType,
110
- storageResources: JSON.stringify(attributeTreeObjSchema.storageResources),
111
- compositeKeyDeliminator: attributeTreeObjSchema.compositeKeyDeliminator
112
- },
113
- setting: {
114
- savePath: path.join(srcPath, SOURCE_PATH.generatedAttributeTree, attributeTreeObjSchema.objectType + "/"),
115
- saveFileName: SAVE_FILE_NAME.attributeTreeObjectSchema,
116
- fileExtension: ".js",
117
- isAppend: false
118
- }
119
- })
101
+
102
+ }
103
+ // console.log("attributeTreeObjSchemas", attributeTreeObjSchemas)
104
+ for (const attributeTreeObjSchema of attributeTreeObjSchemas) {
105
+ createSources.push({
106
+ templatePath: templatePath,
107
+ templateData: {
108
+ fieldNames: JSON.stringify(attributeTreeObjSchema.fieldNames),
109
+ identifiers: JSON.stringify(attributeTreeObjSchema.identifiers),
110
+ objectType: attributeTreeObjSchema.objectType,
111
+ storageResources: JSON.stringify(attributeTreeObjSchema.storageResources),
112
+ compositeKeyDeliminator: attributeTreeObjSchema.compositeKeyDeliminator
113
+ },
114
+ setting: {
115
+ savePath: path.join(srcPath, SOURCE_PATH.generatedAttributeTree, attributeTreeObjSchema.objectType + "/"),
116
+ hookPath: path.join(srcPath, "schemaHook", attributeTreeObjSchema.objectType, "/"),
117
+ saveFileName: SAVE_FILE_NAME.attributeTreeObjectSchema,
118
+ fileExtension: ".js",
119
+ isAppend: false
120
+ }
121
+ })
122
+ }
120
123
  }
121
124
  console.log("createSources", createSources)
122
125
  return createSources;
@@ -5,12 +5,13 @@ module.exports = [
5
5
  {
6
6
  objectType: "<%- objectType %>",
7
7
  overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
8
- create: [], // default: ['hdrApi', 'hdrSqs']
9
- update: [], // default: ['hdrApi', 'hdrSqs']
10
- get: [], // default: ['hdrApi', 'hdrInv']
11
- delete: [], // default: ['hdrApi', 'hdrSqs']
8
+ //(<overWriteHandlers<%- objectType %>>)
9
+ //(</overWriteHandlers<%- objectType %>>)
12
10
  },
13
- overwriteGeneratedMainFunction: ["create","update","get","delete"],
11
+ overwriteGeneratedMainFunction: [
12
+ //(<overwriteGeneratedMainFunction<%- objectType %>>)
13
+ //(</overwriteGeneratedMainFunction<%- objectType %>>)
14
+ ],
14
15
  canDelete: true,
15
16
  storageResources: <%- storageResources %>,
16
17
  fieldNames: <%- fieldNames %>,
@@ -21,72 +21,186 @@ const fs = require('fs');
21
21
  const yaml = require("yaml")
22
22
  const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
23
23
  const { SOURCE_PATH, ADD_ON_DATA_STRUCTURE_TYPE, SAVE_FILE_NAME, PREFIX_RELATIONSHIP, ATTRIBUTE_TAG } = require('../../libs/Consts');
24
- const { createLinksObjectRelationshipAttributeTree } = require("../../../../GenerateCodeLibs/src/GenerateCodeLibs")
24
+ const { createBasicRelationshipsProperties } = require("../../../../GenerateCodeLibs/src/GenerateCodeLibs")
25
25
  const templatePath = path.join(__dirname, "./template.ejs");
26
26
 
27
27
  function data(_izContext, objectSchema, srcPath) {
28
- const createSources = [];
29
- let attributeTreeObjRelationshipSchemas = [];
30
28
  if (objectSchema.hasOwnProperty("addOnDataStructure")) {
31
- for (const versionedData of objectSchema.addOnDataStructure)
29
+ for (const versionedData of objectSchema.addOnDataStructure) {
32
30
  if (versionedData.type === ADD_ON_DATA_STRUCTURE_TYPE.attributeTree) {
33
- const objectType = objectSchema.objectType; // main objectType
34
- const storageResources = objectSchema.storageResources // storageResource from main objectType
35
- const storageResourceTags = Object.keys(storageResources)
36
- const configPath = path.join(__dirname, '../../../config/serverless.config.yml');
37
- const serverlessConfig = fs.readFileSync(configPath, 'utf8');
38
- const config = yaml.parse(serverlessConfig);
39
-
40
- attributeTreeObjRelationshipSchemas.push(
41
- {
42
- relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType),
43
- links: [
44
- createLinksObjectRelationshipAttributeTree(
45
- {
46
- serviceTag: config.main_config.iz_serviceTag,
47
- objectType: objectType
48
- },
49
- {
50
- serviceTag: config.main_config.iz_serviceTag,
51
- objectType: objectType + ATTRIBUTE_TAG.attributeTagLink
52
- }
53
- )
54
- ]
31
+ let generateRelationships = createSourceParams(_izContext, objectSchema, srcPath)
32
+ console.log("generateRelationship", generateRelationships)
33
+ return {
34
+ templatePath: templatePath,
35
+ templateData: { datas: generateRelationships },
36
+ setting: {
37
+ savePath: path.join(srcPath, SOURCE_PATH.generatedAttributeTree),
38
+ saveFileName: SAVE_FILE_NAME.attributeTreeObjectRelationship,
39
+ fileExtension: ".js",
40
+ isAppend: false
55
41
  }
56
- )
57
-
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
58
47
 
59
48
 
60
- for (const attributeTreeObjRelationshipSchema of attributeTreeObjRelationshipSchemas) {
61
- Object.assign(attributeTreeObjRelationshipSchema, { storageResources: storageResources })
62
- attributeTreeObjRelationshipSchema.links.push({ storageResourceTags })
63
- }
49
+ function createSourceParams(_izContext, objectSchema, srcPath) {
50
+ const attributeRelationships = [];
51
+ const objectType = objectSchema.objectType; // main objectType
52
+ const storageResources = objectSchema.storageResources // storageResource from main objectType
53
+ const configPath = path.join(srcPath, '../../config/serverless.config.yml');
54
+ const serverlessConfig = fs.readFileSync(configPath, 'utf8');
55
+ const config = yaml.parse(serverlessConfig);
56
+ const serviceTag = config.main_config.iz_serviceTag;
64
57
 
58
+ const fieldNamesBasicRelationship = {
65
59
 
66
- // console.log("attributeTreeObjSchemas", attributeTreeObjSchemas)
67
- for (const attributeTreeObjRelationshipSchema of attributeTreeObjRelationshipSchemas) {
68
- createSources.push({
69
- templatePath: templatePath,
70
- templateData: {
71
- baseObjectType: attributeTreeObjRelationshipSchema.baseObjectType,
72
- toObjectType: attributeTreeObjRelationshipSchema.toObjectType,
73
- storageResources: JSON.stringify(attributeTreeObjRelationshipSchema.storageResources),
74
- sotrageResourceTag: storageResourceTags,
75
- relationshipTag: attributeTreeObjRelationshipSchema.relationshipTag,
76
- serviceTag: attributeTreeObjRelationshipSchema.links[0]
77
- },
78
- setting: {
79
- savePath: path.join(srcPath, SOURCE_PATH.generatedAttributeTree),
80
- saveFileName: SAVE_FILE_NAME.attributeTreeObjectRelationship,
81
- fileExtension: ".js",
82
- isAppend: false
83
- }
84
- })
85
- }
86
- }
87
60
  }
88
- console.log("createSources", createSources)
89
- return createSources;
61
+ attributeRelationships.push(
62
+ {
63
+ relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType), // isProductAttribute
64
+ relationshipProperties: createBasicRelationshipsProperties(
65
+ {
66
+ serviceTag: serviceTag,
67
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagLink,
68
+ linkType: "many",
69
+ requiredOnCreate: false
70
+ },
71
+ {
72
+ serviceTag: serviceTag,
73
+ objectType: objectType,
74
+ linkType: "one",
75
+ requiredOnCreate: false
76
+ },
77
+ storageResources,
78
+ "from"
79
+ )
80
+ },
81
+ {
82
+ relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + ATTRIBUTE_TAG.attributeTagLabel, // isProductAttributeLabel
83
+ relationshipProperties: createBasicRelationshipsProperties(
84
+ {
85
+ serviceTag: serviceTag,
86
+ objectType: objectType,
87
+ linkType: "many",
88
+ requiredOnCreate: true
89
+ },
90
+ {
91
+ serviceTag: serviceTag,
92
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagLabel,
93
+ linkType: "one",
94
+ requiredOnCreate: false
95
+ },
96
+ storageResources,
97
+ "from"
98
+ )
99
+ },
100
+ {
101
+ relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + ATTRIBUTE_TAG.attributeTagPropertyLabel, // isProductAttributePropertyLabel
102
+ relationshipProperties: createBasicRelationshipsProperties(
103
+ {
104
+ serviceTag: serviceTag,
105
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagProperty,
106
+ linkType: "one",
107
+ requiredOnCreate: true
108
+ },
109
+ {
110
+ serviceTag: serviceTag,
111
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagPropertyLabel,
112
+ linkType: "one",
113
+ requiredOnCreate: false
114
+ },
115
+ storageResources,
116
+ "from"
117
+ )
118
+ },
119
+ {
120
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + ATTRIBUTE_TAG.attributeTagLink, // disabledProductAttributeLink
121
+ relationshipProperties: createBasicRelationshipsProperties(
122
+ {
123
+ serviceTag: "ProductManager",
124
+ objectType: "product",
125
+ linkType: "one",
126
+ requiredOnCreate: false
127
+ },
128
+ {
129
+ serviceTag: serviceTag,
130
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagLink,
131
+ linkType: "many",
132
+ requiredOnCreate: false
133
+ },
134
+ storageResources,
135
+ "from",
136
+ true
137
+ )
138
+ },
139
+ {
140
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + ATTRIBUTE_TAG.attributeTagProperty, // disabledProductAttributeProperty
141
+ relationshipProperties: createBasicRelationshipsProperties(
142
+ {
143
+ serviceTag: serviceTag,
144
+ objectType: objectType,
145
+ linkType: "one",
146
+ requiredOnCreate: false
147
+ },
148
+ {
149
+ serviceTag: serviceTag,
150
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagProperty,
151
+ linkType: "many",
152
+ requiredOnCreate: true
153
+ },
154
+ storageResources,
155
+ "from",
156
+ )
157
+ },
158
+ {
159
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + ATTRIBUTE_TAG.attributeTagProperty, // hasProductAttributeLink
160
+ relationshipProperties: createBasicRelationshipsProperties(
161
+ {
162
+ serviceTag: "ProductManager",
163
+ objectType: "product",
164
+ linkType: "one",
165
+ requiredOnCreate: false
166
+ },
167
+ {
168
+ serviceTag: serviceTag,
169
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagLink,
170
+ linkType: "many",
171
+ requiredOnCreate: false
172
+ },
173
+ storageResources,
174
+ "from",
175
+ true
176
+ )
177
+ },
178
+ {
179
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + ATTRIBUTE_TAG.attributeTagProperty, // hasProductAttributeProperty
180
+ relationshipProperties: createBasicRelationshipsProperties(
181
+ {
182
+ serviceTag: serviceTag,
183
+ objectType: objectType,
184
+ linkType: "one",
185
+ requiredOnCreate: false
186
+ },
187
+ {
188
+ serviceTag: serviceTag,
189
+ objectType: objectType + ATTRIBUTE_TAG.attributeTagProperty,
190
+ linkType: "many",
191
+ requiredOnCreate: true
192
+ },
193
+ storageResources,
194
+ "from",
195
+ true
196
+ )
197
+ }
198
+ )
199
+
200
+ // console.log("attributeRelationships:::", JSON.stringify(attributeRelationships))
201
+ return attributeRelationships
90
202
  }
91
203
 
204
+
205
+
92
206
  module.exports = data
@@ -1,40 +1,7 @@
1
1
  module.exports = [
2
- {
3
- "<%- relationshipTag %>": { // relationshipTag - name of relationship type stored in graph
4
- fieldNames: {
5
- "originTimestamp": {
6
- "type": "number",
7
- "requiredOnCreate": true,
8
- "canUpdate": true,
9
- "validation": {
10
-
11
- },
12
- "optionalOnCreate": false
13
- }
14
- }
15
- storageResources: <%- storageResources %>,
16
- links: [
17
- {
18
- storageResourceTags: <%- storageResourceTags %>,
19
- from: {
20
- objType: {
21
- serviceTag: "GCTpBas",
22
- objectType: "<%- baseObjectType %>"
23
- },
24
-
25
- linkType: "one", // one | many
26
- },
27
- to: {
28
- objType: {
29
- serviceTag: "GCTpBas",
30
- objectType: "<%- toObjectType %>"
31
- },
32
- requiredOnCreate: true,
33
- linkType: "many", // one | many
34
- handler: true // if set true, serviceTag of objTyp will handle link logic eg. translateIds
35
- },
36
- }
37
- ],
38
- }
39
- },
2
+ <% datas.forEach(data => { %>
3
+ {
4
+ <%- data.relationshipTag %>: <%- JSON.stringify(data.relationshipProperties) %>
5
+ },
6
+ <% }) %>
40
7
  ]
@@ -59,7 +59,7 @@ const createExternalSnsSubscriptions = async (_izContext, allObjSchemas, allRelS
59
59
  }
60
60
  }
61
61
  }
62
- // console.log("snsServiceConfigArray::", snsServiceConfigArray)
62
+ console.log("snsServiceConfigArray::", snsServiceConfigArray)
63
63
 
64
64
  return {
65
65
  templatePath: templatePath,
@@ -5,7 +5,11 @@ module.exports = {
5
5
 
6
6
  mainResource: "xxxx"
7
7
  },
8
- Plugin:{
9
-
8
+ Plugin: {
9
+
10
10
  }
11
- }
11
+ }
12
+
13
+ let name = require('./TemplateData/perAction/generatePerAction')
14
+
15
+ name()
@@ -1,5 +1,12 @@
1
1
 
2
+ async function testName() {
2
3
 
3
- module.exports.generateCode = (objSchemaPath) => {
4
+ }
4
5
 
5
- }
6
+
7
+
8
+
9
+
10
+
11
+
12
+ module.exports = testName;