@lv-x-software-house/x_view 1.2.3-dev.7 → 1.2.3-dev.8
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/index.js +79 -42
- package/dist/index.mjs +79 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13066,7 +13066,7 @@ async function save_view_data_logic(db_services, filename, data) {
|
|
|
13066
13066
|
}
|
|
13067
13067
|
}
|
|
13068
13068
|
async function get_scene_view_data_logic(db_services, scene_config, owner_id, type, session, focusNodeId = null, focusAncestryId = null) {
|
|
13069
|
-
var _a, _b
|
|
13069
|
+
var _a, _b;
|
|
13070
13070
|
try {
|
|
13071
13071
|
if (!session || !session.user) {
|
|
13072
13072
|
return { success: false, error: "Usu\xE1rio n\xE3o autenticado." };
|
|
@@ -13274,54 +13274,91 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
13274
13274
|
}
|
|
13275
13275
|
}
|
|
13276
13276
|
if (!isFullMember) {
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
if (
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
if (!
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
}
|
|
13277
|
+
const requiredNodeIds = /* @__PURE__ */ new Set();
|
|
13278
|
+
const requiredAncestryIds = /* @__PURE__ */ new Set();
|
|
13279
|
+
if (focusNodeId) requiredNodeIds.add(String(focusNodeId));
|
|
13280
|
+
if (focusAncestryId) requiredAncestryIds.add(String(focusAncestryId));
|
|
13281
|
+
const allNodesFromDb = Object.values(parentData).flatMap((db) => db.nodes || []);
|
|
13282
|
+
const extractDependenciesFromText = (text) => {
|
|
13283
|
+
if (!text) return;
|
|
13284
|
+
const mentionRegex = /\[\[MENTION:node:([a-zA-Z0-9\-_]+)\]\]/g;
|
|
13285
|
+
const refRegex = /\[\[REF:(node|ancestry):([a-zA-Z0-9\-_]+):([a-zA-Z0-9\-_]+)\]\]/g;
|
|
13286
|
+
let match;
|
|
13287
|
+
while ((match = mentionRegex.exec(text)) !== null) {
|
|
13288
|
+
requiredNodeIds.add(match[1]);
|
|
13290
13289
|
}
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13290
|
+
while ((match = refRegex.exec(text)) !== null) {
|
|
13291
|
+
if (match[1] === "node") requiredNodeIds.add(match[2]);
|
|
13292
|
+
if (match[1] === "ancestry") requiredAncestryIds.add(match[2]);
|
|
13293
|
+
}
|
|
13294
|
+
};
|
|
13295
|
+
const extractTreeDependencies = (treeItem) => {
|
|
13296
|
+
var _a2;
|
|
13297
|
+
if (!treeItem) return;
|
|
13298
|
+
if (treeItem.node_id) requiredNodeIds.add(String(treeItem.node_id));
|
|
13299
|
+
if ((_a2 = treeItem.node) == null ? void 0 : _a2.id) requiredNodeIds.add(String(treeItem.node.id));
|
|
13300
|
+
if (treeItem.children) {
|
|
13301
|
+
treeItem.children.forEach(extractTreeDependencies);
|
|
13302
|
+
}
|
|
13303
|
+
if (treeItem.parallel_branches) {
|
|
13304
|
+
treeItem.parallel_branches.forEach((branch) => {
|
|
13305
|
+
if (branch.linked_ancestry_id) {
|
|
13306
|
+
requiredAncestryIds.add(String(branch.linked_ancestry_id));
|
|
13307
|
+
}
|
|
13308
|
+
if (branch.description) extractDependenciesFromText(branch.description);
|
|
13309
|
+
if (branch.description_sections) {
|
|
13310
|
+
branch.description_sections.forEach((s) => extractDependenciesFromText(s.content));
|
|
13311
|
+
}
|
|
13312
|
+
extractTreeDependencies(branch.tree);
|
|
13313
|
+
});
|
|
13314
|
+
}
|
|
13315
|
+
};
|
|
13316
|
+
let previousSize;
|
|
13317
|
+
do {
|
|
13318
|
+
previousSize = requiredNodeIds.size + requiredAncestryIds.size;
|
|
13319
|
+
requiredAncestryIds.forEach((ancId) => {
|
|
13320
|
+
const anc = ancestryData.find((a) => String(a.ancestry_id) === ancId);
|
|
13321
|
+
if (anc && !anc.is_private) {
|
|
13322
|
+
if (anc.description) extractDependenciesFromText(anc.description);
|
|
13323
|
+
if (anc.description_sections) {
|
|
13324
|
+
anc.description_sections.forEach((s) => extractDependenciesFromText(s.content));
|
|
13325
|
+
}
|
|
13326
|
+
extractTreeDependencies(anc.tree);
|
|
13327
|
+
extractTreeDependencies(anc.abstraction_tree);
|
|
13310
13328
|
}
|
|
13311
|
-
};
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13329
|
+
});
|
|
13330
|
+
requiredNodeIds.forEach((nodeId) => {
|
|
13331
|
+
const node = allNodesFromDb.find((n) => String(n.id) === nodeId);
|
|
13332
|
+
if (node) {
|
|
13333
|
+
if (node.description) extractDependenciesFromText(node.description);
|
|
13334
|
+
if (node.description_sections) {
|
|
13335
|
+
node.description_sections.forEach((s) => extractDependenciesFromText(s.content));
|
|
13336
|
+
}
|
|
13319
13337
|
}
|
|
13338
|
+
});
|
|
13339
|
+
} while (requiredNodeIds.size + requiredAncestryIds.size > previousSize);
|
|
13340
|
+
const restrictedSceneData = { ...validatedSceneData, nodes: [], links: [] };
|
|
13341
|
+
const restrictedParentData = {};
|
|
13342
|
+
const restrictedAncestryData = ancestryData.filter((a) => requiredAncestryIds.has(String(a.ancestry_id)) && !a.is_private);
|
|
13343
|
+
for (const [dbId, dbContent] of Object.entries(parentData)) {
|
|
13344
|
+
const filteredNodes = (dbContent.nodes || []).filter((n) => requiredNodeIds.has(String(n.id)));
|
|
13345
|
+
if (filteredNodes.length > 0) {
|
|
13346
|
+
restrictedParentData[dbId] = { ...dbContent, nodes: filteredNodes, links: [] };
|
|
13347
|
+
}
|
|
13348
|
+
}
|
|
13349
|
+
if (focusNodeId) {
|
|
13350
|
+
const mainNode = allNodesFromDb.find((n) => String(n.id) === String(focusNodeId));
|
|
13351
|
+
if (mainNode) {
|
|
13352
|
+
restrictedSceneData.nodes = [mainNode];
|
|
13320
13353
|
}
|
|
13321
13354
|
}
|
|
13322
13355
|
return {
|
|
13323
13356
|
success: true,
|
|
13324
|
-
data: {
|
|
13357
|
+
data: {
|
|
13358
|
+
scene: restrictedSceneData,
|
|
13359
|
+
parent: restrictedParentData,
|
|
13360
|
+
ancestry: restrictedAncestryData
|
|
13361
|
+
}
|
|
13325
13362
|
};
|
|
13326
13363
|
}
|
|
13327
13364
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -13066,7 +13066,7 @@ async function save_view_data_logic(db_services, filename, data) {
|
|
|
13066
13066
|
}
|
|
13067
13067
|
}
|
|
13068
13068
|
async function get_scene_view_data_logic(db_services, scene_config, owner_id, type, session, focusNodeId = null, focusAncestryId = null) {
|
|
13069
|
-
var _a, _b
|
|
13069
|
+
var _a, _b;
|
|
13070
13070
|
try {
|
|
13071
13071
|
if (!session || !session.user) {
|
|
13072
13072
|
return { success: false, error: "Usu\xE1rio n\xE3o autenticado." };
|
|
@@ -13274,54 +13274,91 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
13274
13274
|
}
|
|
13275
13275
|
}
|
|
13276
13276
|
if (!isFullMember) {
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
if (
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
if (!
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
}
|
|
13277
|
+
const requiredNodeIds = /* @__PURE__ */ new Set();
|
|
13278
|
+
const requiredAncestryIds = /* @__PURE__ */ new Set();
|
|
13279
|
+
if (focusNodeId) requiredNodeIds.add(String(focusNodeId));
|
|
13280
|
+
if (focusAncestryId) requiredAncestryIds.add(String(focusAncestryId));
|
|
13281
|
+
const allNodesFromDb = Object.values(parentData).flatMap((db) => db.nodes || []);
|
|
13282
|
+
const extractDependenciesFromText = (text) => {
|
|
13283
|
+
if (!text) return;
|
|
13284
|
+
const mentionRegex = /\[\[MENTION:node:([a-zA-Z0-9\-_]+)\]\]/g;
|
|
13285
|
+
const refRegex = /\[\[REF:(node|ancestry):([a-zA-Z0-9\-_]+):([a-zA-Z0-9\-_]+)\]\]/g;
|
|
13286
|
+
let match;
|
|
13287
|
+
while ((match = mentionRegex.exec(text)) !== null) {
|
|
13288
|
+
requiredNodeIds.add(match[1]);
|
|
13290
13289
|
}
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13290
|
+
while ((match = refRegex.exec(text)) !== null) {
|
|
13291
|
+
if (match[1] === "node") requiredNodeIds.add(match[2]);
|
|
13292
|
+
if (match[1] === "ancestry") requiredAncestryIds.add(match[2]);
|
|
13293
|
+
}
|
|
13294
|
+
};
|
|
13295
|
+
const extractTreeDependencies = (treeItem) => {
|
|
13296
|
+
var _a2;
|
|
13297
|
+
if (!treeItem) return;
|
|
13298
|
+
if (treeItem.node_id) requiredNodeIds.add(String(treeItem.node_id));
|
|
13299
|
+
if ((_a2 = treeItem.node) == null ? void 0 : _a2.id) requiredNodeIds.add(String(treeItem.node.id));
|
|
13300
|
+
if (treeItem.children) {
|
|
13301
|
+
treeItem.children.forEach(extractTreeDependencies);
|
|
13302
|
+
}
|
|
13303
|
+
if (treeItem.parallel_branches) {
|
|
13304
|
+
treeItem.parallel_branches.forEach((branch) => {
|
|
13305
|
+
if (branch.linked_ancestry_id) {
|
|
13306
|
+
requiredAncestryIds.add(String(branch.linked_ancestry_id));
|
|
13307
|
+
}
|
|
13308
|
+
if (branch.description) extractDependenciesFromText(branch.description);
|
|
13309
|
+
if (branch.description_sections) {
|
|
13310
|
+
branch.description_sections.forEach((s) => extractDependenciesFromText(s.content));
|
|
13311
|
+
}
|
|
13312
|
+
extractTreeDependencies(branch.tree);
|
|
13313
|
+
});
|
|
13314
|
+
}
|
|
13315
|
+
};
|
|
13316
|
+
let previousSize;
|
|
13317
|
+
do {
|
|
13318
|
+
previousSize = requiredNodeIds.size + requiredAncestryIds.size;
|
|
13319
|
+
requiredAncestryIds.forEach((ancId) => {
|
|
13320
|
+
const anc = ancestryData.find((a) => String(a.ancestry_id) === ancId);
|
|
13321
|
+
if (anc && !anc.is_private) {
|
|
13322
|
+
if (anc.description) extractDependenciesFromText(anc.description);
|
|
13323
|
+
if (anc.description_sections) {
|
|
13324
|
+
anc.description_sections.forEach((s) => extractDependenciesFromText(s.content));
|
|
13325
|
+
}
|
|
13326
|
+
extractTreeDependencies(anc.tree);
|
|
13327
|
+
extractTreeDependencies(anc.abstraction_tree);
|
|
13310
13328
|
}
|
|
13311
|
-
};
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13329
|
+
});
|
|
13330
|
+
requiredNodeIds.forEach((nodeId) => {
|
|
13331
|
+
const node = allNodesFromDb.find((n) => String(n.id) === nodeId);
|
|
13332
|
+
if (node) {
|
|
13333
|
+
if (node.description) extractDependenciesFromText(node.description);
|
|
13334
|
+
if (node.description_sections) {
|
|
13335
|
+
node.description_sections.forEach((s) => extractDependenciesFromText(s.content));
|
|
13336
|
+
}
|
|
13319
13337
|
}
|
|
13338
|
+
});
|
|
13339
|
+
} while (requiredNodeIds.size + requiredAncestryIds.size > previousSize);
|
|
13340
|
+
const restrictedSceneData = { ...validatedSceneData, nodes: [], links: [] };
|
|
13341
|
+
const restrictedParentData = {};
|
|
13342
|
+
const restrictedAncestryData = ancestryData.filter((a) => requiredAncestryIds.has(String(a.ancestry_id)) && !a.is_private);
|
|
13343
|
+
for (const [dbId, dbContent] of Object.entries(parentData)) {
|
|
13344
|
+
const filteredNodes = (dbContent.nodes || []).filter((n) => requiredNodeIds.has(String(n.id)));
|
|
13345
|
+
if (filteredNodes.length > 0) {
|
|
13346
|
+
restrictedParentData[dbId] = { ...dbContent, nodes: filteredNodes, links: [] };
|
|
13347
|
+
}
|
|
13348
|
+
}
|
|
13349
|
+
if (focusNodeId) {
|
|
13350
|
+
const mainNode = allNodesFromDb.find((n) => String(n.id) === String(focusNodeId));
|
|
13351
|
+
if (mainNode) {
|
|
13352
|
+
restrictedSceneData.nodes = [mainNode];
|
|
13320
13353
|
}
|
|
13321
13354
|
}
|
|
13322
13355
|
return {
|
|
13323
13356
|
success: true,
|
|
13324
|
-
data: {
|
|
13357
|
+
data: {
|
|
13358
|
+
scene: restrictedSceneData,
|
|
13359
|
+
parent: restrictedParentData,
|
|
13360
|
+
ancestry: restrictedAncestryData
|
|
13361
|
+
}
|
|
13325
13362
|
};
|
|
13326
13363
|
}
|
|
13327
13364
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv-x-software-house/x_view",
|
|
3
|
-
"version": "1.2.3-dev.
|
|
3
|
+
"version": "1.2.3-dev.8",
|
|
4
4
|
"description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
|
|
5
5
|
"author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
|
|
6
6
|
"license": "UNLICENSED",
|