rez_core 7.1.71 → 7.1.72
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/dist/module/entity/data/entity_json/service/entity_json.service.js +28 -2
- package/dist/module/entity/data/entity_json/service/entity_json.service.js.map +1 -1
- package/dist/module/entity/meta/meta/repository/entity-relation.repository.d.ts +2 -0
- package/dist/module/entity/meta/meta/repository/entity-relation.repository.js +20 -0
- package/dist/module/entity/meta/meta/repository/entity-relation.repository.js.map +1 -1
- package/dist/module/entity/meta/meta/service/entity-relation.service.d.ts +2 -0
- package/dist/module/entity/meta/meta/service/entity-relation.service.js +6 -0
- package/dist/module/entity/meta/meta/service/entity-relation.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/entity/data/entity_json/service/entity_json.service.ts +66 -4
- package/src/module/entity/meta/meta/repository/entity-relation.repository.ts +37 -0
- package/src/module/entity/meta/meta/service/entity-relation.service.ts +24 -0
- package/.claude/settings.local.json +0 -26
- package/.idea/250218_nodejs_core.iml +0 -9
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/server.log +0 -850
package/package.json
CHANGED
|
@@ -130,12 +130,74 @@ export class EntityJSONService {
|
|
|
130
130
|
return flatJson;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
async persistFlatJson(
|
|
134
|
-
|
|
133
|
+
async persistFlatJson(
|
|
134
|
+
entityType: string,
|
|
135
|
+
entityId: number,
|
|
136
|
+
loggedInUser: any
|
|
137
|
+
) {
|
|
138
|
+
// Check if flat_json is enabled for this entity or its parent
|
|
139
|
+
let shouldPersist = false;
|
|
140
|
+
let actualEntityType = entityType;
|
|
141
|
+
let actualEntityId = entityId;
|
|
142
|
+
|
|
143
|
+
// Case 1: Check if flat_json is enabled for the main entity
|
|
144
|
+
const entityMaster = await this.entityMasterService.getEntityMasterData(
|
|
145
|
+
entityType,
|
|
146
|
+
loggedInUser,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (entityMaster?.is_flat_json) {
|
|
150
|
+
shouldPersist = true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Case 2: If not enabled for main entity, check if it's a sub-entity with flat_json enabled parent
|
|
154
|
+
if (!shouldPersist) {
|
|
155
|
+
// Find all relations where this entity is the target (sub-entity)
|
|
156
|
+
const parentRelations = await this.entityRelationService.getParentRelationsByTargetEntity(
|
|
157
|
+
entityType,
|
|
158
|
+
loggedInUser.enterprise_id,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// Check each potential parent to see if it has flat_json enabled
|
|
162
|
+
for (const relation of parentRelations) {
|
|
163
|
+
const parentEntityMaster = await this.entityMasterService.getEntityMasterData(
|
|
164
|
+
relation.source_entity_type,
|
|
165
|
+
loggedInUser,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
if (parentEntityMaster?.is_flat_json) {
|
|
169
|
+
// Find the parent entity ID by looking up the relation data
|
|
170
|
+
const parentEntityId = await this.entityRelationService.getParentEntityIdFromRelationData(
|
|
171
|
+
entityType,
|
|
172
|
+
entityId,
|
|
173
|
+
relation.source_entity_type,
|
|
174
|
+
loggedInUser.enterprise_id,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
if (parentEntityId) {
|
|
178
|
+
shouldPersist = true;
|
|
179
|
+
// Use parent's type and id for persistence
|
|
180
|
+
actualEntityType = relation.source_entity_type;
|
|
181
|
+
actualEntityId = parentEntityId;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (!shouldPersist) {
|
|
189
|
+
console.log(
|
|
190
|
+
`Flat Json is not enabled for entity type '${entityType}' or its parent`,
|
|
191
|
+
);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const flatJson = await this.computeFlatJson(actualEntityType, actualEntityId, loggedInUser);
|
|
135
196
|
if (!flatJson) {
|
|
136
|
-
return
|
|
197
|
+
return;
|
|
137
198
|
}
|
|
138
|
-
|
|
199
|
+
|
|
200
|
+
let entityJson = new EntityJson(actualEntityType, actualEntityId, flatJson, loggedInUser.id, loggedInUser.id);
|
|
139
201
|
await this.entityJSONRepository.create(entityJson);
|
|
140
202
|
}
|
|
141
203
|
|
|
@@ -61,4 +61,41 @@ export class EntityRelationRepository {
|
|
|
61
61
|
|
|
62
62
|
return dropdownData.length ? dropdownData : [];
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Find all parent relations where the given entity is the target (sub-entity)
|
|
67
|
+
*/
|
|
68
|
+
async getParentRelationsByTargetEntity(
|
|
69
|
+
targetEntityType: string,
|
|
70
|
+
enterpriseId: number,
|
|
71
|
+
): Promise<EntityRelation[]> {
|
|
72
|
+
return this.entityRelationRepository.find({
|
|
73
|
+
where: {
|
|
74
|
+
target_entity_type: targetEntityType,
|
|
75
|
+
enterprise_id: enterpriseId,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Find the parent entity ID from relation data
|
|
82
|
+
*/
|
|
83
|
+
async getParentEntityIdFromRelationData(
|
|
84
|
+
targetEntityType: string,
|
|
85
|
+
targetEntityId: number,
|
|
86
|
+
sourceEntityType: string,
|
|
87
|
+
enterpriseId: number,
|
|
88
|
+
): Promise<number | null> {
|
|
89
|
+
const result = await this.entityRelationRepository.manager
|
|
90
|
+
.createQueryBuilder()
|
|
91
|
+
.select('erd.source_entity_id', 'source_entity_id')
|
|
92
|
+
.from('entity_relation_data', 'erd')
|
|
93
|
+
.where('erd.target_entity_type = :targetEntityType', { targetEntityType })
|
|
94
|
+
.andWhere('erd.target_entity_id = :targetEntityId', { targetEntityId })
|
|
95
|
+
.andWhere('erd.source_entity_type = :sourceEntityType', { sourceEntityType })
|
|
96
|
+
.andWhere('erd.enterprise_id = :enterpriseId', { enterpriseId })
|
|
97
|
+
.getRawOne();
|
|
98
|
+
|
|
99
|
+
return result?.source_entity_id || null;
|
|
100
|
+
}
|
|
64
101
|
}
|
|
@@ -185,4 +185,28 @@ export class EntityRelationService {
|
|
|
185
185
|
async getAllEntityDropDown(entity_type: string, loggedInUser): Promise<{ label: string; value: any }[]> {
|
|
186
186
|
return this.entityRelationRepository.getAllEntityDropdownData(entity_type, loggedInUser);
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
async getParentRelationsByTargetEntity(
|
|
190
|
+
targetEntityType: string,
|
|
191
|
+
enterpriseId: number,
|
|
192
|
+
): Promise<EntityRelation[]> {
|
|
193
|
+
return this.entityRelationRepository.getParentRelationsByTargetEntity(
|
|
194
|
+
targetEntityType,
|
|
195
|
+
enterpriseId,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async getParentEntityIdFromRelationData(
|
|
200
|
+
targetEntityType: string,
|
|
201
|
+
targetEntityId: number,
|
|
202
|
+
sourceEntityType: string,
|
|
203
|
+
enterpriseId: number,
|
|
204
|
+
): Promise<number | null> {
|
|
205
|
+
return this.entityRelationRepository.getParentEntityIdFromRelationData(
|
|
206
|
+
targetEntityType,
|
|
207
|
+
targetEntityId,
|
|
208
|
+
sourceEntityType,
|
|
209
|
+
enterpriseId,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
188
212
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(npm run build:*)",
|
|
5
|
-
"Bash(npm install)",
|
|
6
|
-
"Bash(npm run lint)",
|
|
7
|
-
"Bash(npm install:*)",
|
|
8
|
-
"Bash(curl:*)",
|
|
9
|
-
"Bash(npm run start:dev:*)",
|
|
10
|
-
"Bash(mkdir:*)",
|
|
11
|
-
"Bash(lsof:*)",
|
|
12
|
-
"Bash(kill:*)",
|
|
13
|
-
"Bash(npx eslint:*)",
|
|
14
|
-
"Read(/Users/admin/yash/**)",
|
|
15
|
-
"Bash(timeout 15 npm run start:dev)",
|
|
16
|
-
"Read(/Users/admin/yash/**)",
|
|
17
|
-
"Bash(find:*)",
|
|
18
|
-
"Bash(sed:*)",
|
|
19
|
-
"Bash(git checkout:*)",
|
|
20
|
-
"Read(//Users/admin/yash/**)",
|
|
21
|
-
"Bash(npx tsc:*)"
|
|
22
|
-
],
|
|
23
|
-
"deny": [],
|
|
24
|
-
"ask": []
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<HTMLCodeStyleSettings>
|
|
4
|
-
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
-
</HTMLCodeStyleSettings>
|
|
6
|
-
<JSCodeStyleSettings version="0">
|
|
7
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
10
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
11
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
12
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
13
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
-
</JSCodeStyleSettings>
|
|
15
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
16
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
17
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
18
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
19
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
20
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
21
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
22
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
23
|
-
</TypeScriptCodeStyleSettings>
|
|
24
|
-
<VueCodeStyleSettings>
|
|
25
|
-
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
26
|
-
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
27
|
-
</VueCodeStyleSettings>
|
|
28
|
-
<codeStyleSettings language="HTML">
|
|
29
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
30
|
-
<indentOptions>
|
|
31
|
-
<option name="INDENT_SIZE" value="2" />
|
|
32
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
33
|
-
<option name="TAB_SIZE" value="2" />
|
|
34
|
-
</indentOptions>
|
|
35
|
-
</codeStyleSettings>
|
|
36
|
-
<codeStyleSettings language="JavaScript">
|
|
37
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
38
|
-
<indentOptions>
|
|
39
|
-
<option name="INDENT_SIZE" value="2" />
|
|
40
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
41
|
-
<option name="TAB_SIZE" value="2" />
|
|
42
|
-
</indentOptions>
|
|
43
|
-
</codeStyleSettings>
|
|
44
|
-
<codeStyleSettings language="TypeScript">
|
|
45
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
46
|
-
<indentOptions>
|
|
47
|
-
<option name="INDENT_SIZE" value="2" />
|
|
48
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
49
|
-
<option name="TAB_SIZE" value="2" />
|
|
50
|
-
</indentOptions>
|
|
51
|
-
</codeStyleSettings>
|
|
52
|
-
<codeStyleSettings language="Vue">
|
|
53
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
54
|
-
<indentOptions>
|
|
55
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
56
|
-
</indentOptions>
|
|
57
|
-
</codeStyleSettings>
|
|
58
|
-
</code_scheme>
|
|
59
|
-
</component>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<component name="InspectionProjectProfileManager">
|
|
2
|
-
<profile version="1.0">
|
|
3
|
-
<option name="myName" value="Project Default" />
|
|
4
|
-
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
5
|
-
</profile>
|
|
6
|
-
</component>
|
package/.idea/misc.xml
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
|
4
|
-
<output url="file://$PROJECT_DIR$/out" />
|
|
5
|
-
</component>
|
|
6
|
-
</project>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/250218_nodejs_core.iml" filepath="$PROJECT_DIR$/.idea/250218_nodejs_core.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/prettier.xml
DELETED