@izara_project/izara-market-library-service-schemas 1.0.86 → 1.0.88
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 +7 -7
- package/src/Libs/Libs.js +3 -1
- package/src/TemplateData/PropertyValueSchema/PropertyValueObjectSchema/data.js +59 -25
- package/src/TemplateData/PropertyValueSchema/PropertyValueRelationshipSchema/data.js +41 -17
- package/src/TemplateData/PropertyValueSchema/PropertyValueRelationshipSchema/tempRelationship.ejs +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-market-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.88",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@izara_project/izara-attribute-tree": "1.0.
|
|
25
|
-
"@izara_project/izara-core-generate-service-code": "^1.0.
|
|
24
|
+
"@izara_project/izara-attribute-tree": "^1.0.15",
|
|
25
|
+
"@izara_project/izara-core-generate-service-code": "^1.0.10",
|
|
26
26
|
"@izara_project/izara-core-library-asynchronous-flow": "^1.0.20",
|
|
27
27
|
"@izara_project/izara-core-library-calling-flow": "^1.0.4",
|
|
28
28
|
"@izara_project/izara-core-library-dynamodb": "^1.0.14",
|
|
29
29
|
"@izara_project/izara-core-library-external-request": "^1.0.23",
|
|
30
30
|
"@izara_project/izara-core-library-graph-service": "1.0.18",
|
|
31
31
|
"@izara_project/izara-core-library-lambda": "^1.0.6",
|
|
32
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
32
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.118",
|
|
33
33
|
"@izara_project/izara-core-library-sns": "^1.0.7",
|
|
34
|
-
"@izara_project/izara-property-nodes": "1.0.
|
|
34
|
+
"@izara_project/izara-property-nodes": "^1.0.16",
|
|
35
35
|
"@izara_project/izara-shared-core": "^1.0.9",
|
|
36
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
37
|
-
"lodash": "^4.17.
|
|
36
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.45",
|
|
37
|
+
"lodash": "^4.17.23"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/Libs/Libs.js
CHANGED
|
@@ -26,9 +26,11 @@ import graphSharedLibs from '@izara_project/izara-core-library-graph-service';
|
|
|
26
26
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
27
27
|
import {
|
|
28
28
|
getObjectSchema,
|
|
29
|
-
dataDetailsLib
|
|
29
|
+
dataDetailsLib,
|
|
30
|
+
identifiersObject
|
|
30
31
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
31
32
|
const { createDataDetailsLib } = dataDetailsLib;
|
|
33
|
+
const { dynamoDbIdentifiersByStorageResource } = identifiersObject;
|
|
32
34
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
33
35
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
34
36
|
import { validateObjType } from '@izara_project/izara-shared-service-schemas';
|
|
@@ -24,25 +24,26 @@ const __dirname = path.dirname(__filename);
|
|
|
24
24
|
|
|
25
25
|
import lodash from 'lodash';
|
|
26
26
|
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
27
|
+
import propertyNode from '@izara_project/izara-property-nodes';
|
|
28
|
+
import {
|
|
29
|
+
consts,
|
|
30
|
+
utils,
|
|
31
|
+
libs
|
|
32
|
+
} from '@izara_project/izara-core-generate-service-code';
|
|
29
33
|
|
|
30
|
-
const {
|
|
31
|
-
SOURCE_PATH,
|
|
32
|
-
FIELD_NAME_TYPE,
|
|
33
|
-
SAVE_FILE_NAME,
|
|
34
|
-
STORAGE_TYPES
|
|
35
|
-
} = consts;
|
|
34
|
+
const { SOURCE_PATH, FIELD_NAME_TYPE, SAVE_FILE_NAME, STORAGE_TYPES } = consts;
|
|
36
35
|
|
|
37
36
|
const { fieldNameSetting } = libs;
|
|
38
37
|
|
|
39
38
|
const { firstLetterUpperCase: upperCase } = utils;
|
|
40
39
|
|
|
41
|
-
const templatePath = path.join(
|
|
42
|
-
|
|
40
|
+
const templatePath = path.join(
|
|
41
|
+
__dirname,
|
|
42
|
+
'./templateObjectPropertyValueSchema.ejs'
|
|
43
|
+
);
|
|
43
44
|
|
|
44
45
|
async function data(_izContext, settings, srcPath) {
|
|
45
|
-
console.log('generateObjectSchema propertyNode')
|
|
46
|
+
console.log('generateObjectSchema propertyNode');
|
|
46
47
|
let propertyValueObjectSchemas = [];
|
|
47
48
|
let createSources = [];
|
|
48
49
|
|
|
@@ -66,7 +67,8 @@ async function data(_izContext, settings, srcPath) {
|
|
|
66
67
|
let propertyValueTag = settingPropertyNode.propertyNodeName;
|
|
67
68
|
// validate only addOnndataStructure is type propertyNode.
|
|
68
69
|
|
|
69
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
!objectSchema.hasOwnProperty('addOnDataStructure') ||
|
|
70
72
|
!Array.isArray(objectSchema.addOnDataStructure) ||
|
|
71
73
|
!objectSchema.addOnDataStructure.length
|
|
72
74
|
) {
|
|
@@ -78,7 +80,9 @@ async function data(_izContext, settings, srcPath) {
|
|
|
78
80
|
|
|
79
81
|
const storageResources = objectSchema.storageResources; // storageResource from main objectType
|
|
80
82
|
let cloneDeepStorageResources = lodash.cloneDeep(storageResources);
|
|
81
|
-
for (let [storageResourceTag, storageResourceSetting] of Object.entries(
|
|
83
|
+
for (let [storageResourceTag, storageResourceSetting] of Object.entries(
|
|
84
|
+
cloneDeepStorageResources
|
|
85
|
+
)) {
|
|
82
86
|
if (storageResourceSetting.storageType === STORAGE_TYPES.dynamoDB) {
|
|
83
87
|
delete cloneDeepStorageResources[storageResourceTag];
|
|
84
88
|
}
|
|
@@ -90,33 +94,40 @@ async function data(_izContext, settings, srcPath) {
|
|
|
90
94
|
{
|
|
91
95
|
// {subject}property
|
|
92
96
|
// objectType: propertyValueTag + PROPERTY_VALUE_TAG.property,
|
|
93
|
-
objectType:
|
|
97
|
+
objectType:
|
|
98
|
+
propertyNode.createPropertyLabelGraphNodeLabel(propertyValueTag),
|
|
94
99
|
fieldNames: {
|
|
95
100
|
// [propertyValueTag + PROPERTY_VALUE_TAG.property + 'Id']:
|
|
96
|
-
[propertyValueTag +
|
|
101
|
+
[propertyValueTag +
|
|
102
|
+
upperCase(propertyNode.consts.PROPERTY_LABEL_GRAPH_IDENTIFIER_ID)]:
|
|
97
103
|
fieldNameSetting(FIELD_NAME_TYPE.randomOnCreateFieldName)
|
|
98
104
|
},
|
|
99
105
|
identifiers: [
|
|
100
106
|
{
|
|
101
107
|
type: 'identifier',
|
|
102
|
-
fieldName:
|
|
108
|
+
fieldName:
|
|
109
|
+
propertyValueTag +
|
|
110
|
+
upperCase(propertyNode.consts.PROPERTY_LABEL_GRAPH_IDENTIFIER_ID)
|
|
103
111
|
}
|
|
104
112
|
]
|
|
105
113
|
},
|
|
106
114
|
{
|
|
107
115
|
// {subject}propertyLabel
|
|
108
116
|
// objectType: propertyValueTag + PROPERTY_VALUE_TAG.propertyLabel,
|
|
109
|
-
objectType:
|
|
117
|
+
objectType:
|
|
118
|
+
propertyNode.createPropertyValueGraphNodeLabel(propertyValueTag),
|
|
110
119
|
fieldNames: {
|
|
111
120
|
// [propertyValueTag + PROPERTY_VALUE_TAG.propertyLabel + 'Id']:
|
|
112
|
-
[propertyValueTag +
|
|
121
|
+
[propertyValueTag +
|
|
122
|
+
upperCase(propertyNode.consts.PROPERTY_VALUE_GRAPH_IDENTIFIERS_ID)]:
|
|
113
123
|
fieldNameSetting(FIELD_NAME_TYPE.randomOnCreateFieldName)
|
|
114
124
|
},
|
|
115
125
|
identifiers: [
|
|
116
126
|
{
|
|
117
127
|
type: 'identifier',
|
|
118
128
|
fieldName:
|
|
119
|
-
propertyValueTag +
|
|
129
|
+
propertyValueTag +
|
|
130
|
+
upperCase(propertyNode.consts.PROPERTY_VALUE_GRAPH_IDENTIFIERS_ID)
|
|
120
131
|
}
|
|
121
132
|
]
|
|
122
133
|
}
|
|
@@ -138,15 +149,38 @@ async function data(_izContext, settings, srcPath) {
|
|
|
138
149
|
createSources.push({
|
|
139
150
|
templatePath: templatePath,
|
|
140
151
|
templateData: {
|
|
141
|
-
fieldNames: JSON.stringify(
|
|
142
|
-
|
|
152
|
+
fieldNames: JSON.stringify(
|
|
153
|
+
propertyValueObjectSchema.fieldNames,
|
|
154
|
+
null,
|
|
155
|
+
2
|
|
156
|
+
),
|
|
157
|
+
identifiers: JSON.stringify(
|
|
158
|
+
propertyValueObjectSchema.identifiers,
|
|
159
|
+
null,
|
|
160
|
+
2
|
|
161
|
+
),
|
|
143
162
|
objectType: propertyValueObjectSchema.objectType,
|
|
144
|
-
storageResources: JSON.stringify(
|
|
145
|
-
|
|
163
|
+
storageResources: JSON.stringify(
|
|
164
|
+
propertyValueObjectSchema.storageResources,
|
|
165
|
+
null,
|
|
166
|
+
2
|
|
167
|
+
),
|
|
168
|
+
compositeKeyDeliminator:
|
|
169
|
+
propertyValueObjectSchema.compositeKeyDeliminator
|
|
146
170
|
},
|
|
147
171
|
setting: {
|
|
148
|
-
savePath: path.join(
|
|
149
|
-
|
|
172
|
+
savePath: path.join(
|
|
173
|
+
srcPath,
|
|
174
|
+
SOURCE_PATH.generatedPropertyValue,
|
|
175
|
+
propertyValueObjectSchema.objectType + '/'
|
|
176
|
+
),
|
|
177
|
+
hookPath: path.join(
|
|
178
|
+
srcPath,
|
|
179
|
+
'schemaHook',
|
|
180
|
+
'propertyValue',
|
|
181
|
+
propertyValueObjectSchema.objectType,
|
|
182
|
+
'/'
|
|
183
|
+
),
|
|
150
184
|
saveFileName: SAVE_FILE_NAME.objectSchema,
|
|
151
185
|
fileExtension: '.js',
|
|
152
186
|
isAppend: false
|
|
@@ -21,8 +21,8 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
21
21
|
const __dirname = path.dirname(__filename);
|
|
22
22
|
import lodash from 'lodash';
|
|
23
23
|
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
24
|
-
import
|
|
25
|
-
import { consts, utils } from '@izara_project/izara-core-generate-service-code'
|
|
24
|
+
import propertyNode from '@izara_project/izara-property-nodes';
|
|
25
|
+
import { consts, utils } from '@izara_project/izara-core-generate-service-code';
|
|
26
26
|
|
|
27
27
|
const {
|
|
28
28
|
SOURCE_PATH,
|
|
@@ -41,19 +41,25 @@ async function data(_izContext, settings, srcPath) {
|
|
|
41
41
|
// console.log("create Data function ::", { settings })
|
|
42
42
|
let createSourceRecords = [];
|
|
43
43
|
for (const settingPropertyValue of settings) {
|
|
44
|
-
let objectSchema = await getObjectSchema
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
let objectSchema = await getObjectSchema
|
|
45
|
+
.getLocalObjectSchemasWithHierarchy(
|
|
46
|
+
_izContext,
|
|
47
|
+
settingPropertyValue.objectType,
|
|
48
|
+
path.join(srcPath, './schemas')
|
|
49
|
+
)
|
|
50
|
+
.then(res => res.records[0]);
|
|
48
51
|
|
|
49
52
|
if (!objectSchema) {
|
|
50
53
|
throw Error(
|
|
51
|
-
`Invalid objType:${
|
|
54
|
+
`Invalid objType:${settingPropertyValue.objType}, cannot generate attribute tree schema cause objectSchema is not exists`
|
|
52
55
|
);
|
|
53
56
|
}
|
|
54
57
|
// console.log("objectSchema", objectSchema)
|
|
55
58
|
// validate addOnData type PropertyValues
|
|
56
|
-
if (
|
|
59
|
+
if (
|
|
60
|
+
objectSchema.addOnDataStructure &&
|
|
61
|
+
Object.keys(objectSchema.addOnDataStructure).length
|
|
62
|
+
) {
|
|
57
63
|
let addOn = objectSchema.addOnDataStructure.find(addOn => {
|
|
58
64
|
return (
|
|
59
65
|
addOn.type === ADD_ON_DATA_STRUCTURE_TYPE.propertyValue &&
|
|
@@ -67,7 +73,9 @@ async function data(_izContext, settings, srcPath) {
|
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
75
|
} else {
|
|
70
|
-
throw Error(
|
|
76
|
+
throw Error(
|
|
77
|
+
`objectType: ${settingPropertyValue.objectType} not have addOnDataStructure`
|
|
78
|
+
);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
let generateRelationships = createSourceParams(
|
|
@@ -100,7 +108,9 @@ function createSourceParams(_izContext, objectSchema, settings) {
|
|
|
100
108
|
let propertyValue = settings.propertyNodeName;
|
|
101
109
|
const storageResources = objectSchema.storageResources; // storageResource from main objectType
|
|
102
110
|
let cloneDeepStorageResources = lodash.cloneDeep(storageResources);
|
|
103
|
-
for (let [storageResourceTag, storageResourceSetting] of Object.entries(
|
|
111
|
+
for (let [storageResourceTag, storageResourceSetting] of Object.entries(
|
|
112
|
+
cloneDeepStorageResources
|
|
113
|
+
)) {
|
|
104
114
|
if (storageResourceSetting.storageType === STORAGE_TYPES.dynamoDB) {
|
|
105
115
|
delete cloneDeepStorageResources[storageResourceTag];
|
|
106
116
|
}
|
|
@@ -111,7 +121,9 @@ function createSourceParams(_izContext, objectSchema, settings) {
|
|
|
111
121
|
{
|
|
112
122
|
// has{objectType}propertyValue
|
|
113
123
|
// relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(propertyValue) + PROPERTY_VALUE_TAG.property,
|
|
114
|
-
relationshipTag:
|
|
124
|
+
relationshipTag: propertyNode.createHasPropertyGraphRelationshipType(
|
|
125
|
+
upperCase(propertyValue)
|
|
126
|
+
),
|
|
115
127
|
relationshipProperties: createBasicRelationshipsProperties(
|
|
116
128
|
{
|
|
117
129
|
serviceTag: serviceTag,
|
|
@@ -122,7 +134,9 @@ function createSourceParams(_izContext, objectSchema, settings) {
|
|
|
122
134
|
{
|
|
123
135
|
serviceTag: serviceTag,
|
|
124
136
|
// objectType: propertyValue + PROPERTY_VALUE_TAG.property,
|
|
125
|
-
objectType:
|
|
137
|
+
objectType: propertyNode.createPropertyValueGraphNodeLabel(
|
|
138
|
+
upperCase(propertyValue)
|
|
139
|
+
),
|
|
126
140
|
linkType: 'many',
|
|
127
141
|
requiredOnCreate: true
|
|
128
142
|
},
|
|
@@ -133,7 +147,9 @@ function createSourceParams(_izContext, objectSchema, settings) {
|
|
|
133
147
|
// disabled{objectType}propertyValue
|
|
134
148
|
{
|
|
135
149
|
// relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(propertyValue) + PROPERTY_VALUE_TAG.property,
|
|
136
|
-
relationshipTag:
|
|
150
|
+
relationshipTag: propertyNode.createDisabledPropertyGraphRelationshipType(
|
|
151
|
+
upperCase(propertyValue)
|
|
152
|
+
),
|
|
137
153
|
relationshipProperties: createBasicRelationshipsProperties(
|
|
138
154
|
{
|
|
139
155
|
serviceTag: serviceTag,
|
|
@@ -144,7 +160,9 @@ function createSourceParams(_izContext, objectSchema, settings) {
|
|
|
144
160
|
{
|
|
145
161
|
serviceTag: serviceTag,
|
|
146
162
|
// objectType: propertyValue + PROPERTY_VALUE_TAG.property,
|
|
147
|
-
objectType:
|
|
163
|
+
objectType: propertyNode.createPropertyValueGraphNodeLabel(
|
|
164
|
+
upperCase(propertyValue)
|
|
165
|
+
),
|
|
148
166
|
linkType: 'many',
|
|
149
167
|
requiredOnCreate: false
|
|
150
168
|
},
|
|
@@ -155,19 +173,25 @@ function createSourceParams(_izContext, objectSchema, settings) {
|
|
|
155
173
|
|
|
156
174
|
{
|
|
157
175
|
// is{objectType}PropertyLabel
|
|
158
|
-
relationshipTag:
|
|
176
|
+
relationshipTag: propertyNode.createIsPropertyLabelGraphRelationshipType(
|
|
177
|
+
upperCase(propertyValue)
|
|
178
|
+
),
|
|
159
179
|
relationshipProperties: createBasicRelationshipsProperties(
|
|
160
180
|
{
|
|
161
181
|
serviceTag: serviceTag,
|
|
162
182
|
// objectType: propertyValue + PROPERTY_VALUE_TAG.property,
|
|
163
|
-
objectType:
|
|
183
|
+
objectType: propertyNode.createPropertyValueGraphNodeLabel(
|
|
184
|
+
upperCase(propertyValue)
|
|
185
|
+
),
|
|
164
186
|
linkType: 'many',
|
|
165
187
|
requiredOnCreate: true
|
|
166
188
|
},
|
|
167
189
|
{
|
|
168
190
|
serviceTag: serviceTag,
|
|
169
191
|
// objectType: propertyValue + PROPERTY_VALUE_TAG.propertyLabel,
|
|
170
|
-
objectType:
|
|
192
|
+
objectType: propertyNode.createPropertyLabelGraphNodeLabel(
|
|
193
|
+
upperCase(propertyValue)
|
|
194
|
+
),
|
|
171
195
|
linkType: 'one',
|
|
172
196
|
requiredOnCreate: false
|
|
173
197
|
},
|