@lv-x-software-house/x_view 1.2.6-dev.2 → 1.2.6-dev.3

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 CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -29,17 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
30
  // src/index.js
30
31
  var index_exports = {};
31
32
  __export(index_exports, {
32
- XViewScene: () => XViewScene,
33
- delete_uploaded_file_logic: () => delete_uploaded_file_logic,
34
- get_ancestry_board_logic: () => get_ancestry_board_logic,
35
- get_ancestry_file_logic: () => get_ancestry_file_logic,
36
- get_scene_view_data_logic: () => get_scene_view_data_logic,
37
- get_single_parent_file_logic: () => get_single_parent_file_logic,
38
- get_view_members_logic: () => get_view_members_logic,
39
- import_parent_file_modal_get_logic: () => import_parent_file_modal_get_logic,
40
- save_ancestry_board_logic: () => save_ancestry_board_logic,
41
- save_view_data_logic: () => save_view_data_logic,
42
- x_view_add_new_parent_file_to_scene_at_firebase: () => x_view_add_new_parent_file_to_scene_at_firebase
33
+ XViewScene: () => XViewScene
43
34
  });
44
35
  module.exports = __toCommonJS(index_exports);
45
36
 
@@ -13018,6 +13009,18 @@ var CustomMention = import_extension_mention.default.extend({
13018
13009
  "data-mention-type": attributes.type
13019
13010
  };
13020
13011
  }
13012
+ },
13013
+ label: {
13014
+ default: null,
13015
+ parseHTML: (element) => element.getAttribute("data-label"),
13016
+ renderHTML: (attributes) => {
13017
+ if (!attributes.label) {
13018
+ return {};
13019
+ }
13020
+ return {
13021
+ "data-label": attributes.label
13022
+ };
13023
+ }
13021
13024
  }
13022
13025
  };
13023
13026
  }
@@ -13026,7 +13029,6 @@ var MentionEditor = ({
13026
13029
  initialValue = "",
13027
13030
  onChange,
13028
13031
  onPlay,
13029
- // Mantido para futura expansão se quisermos badges clicáveis reais no editor
13030
13032
  availableItems = [],
13031
13033
  canEdit = true,
13032
13034
  placeholder = "Escreva algo... use @ para mencionar"
@@ -13082,7 +13084,8 @@ var MentionEditor = ({
13082
13084
  showOnCreate: true,
13083
13085
  interactive: true,
13084
13086
  trigger: "manual",
13085
- placement: "bottom-start"
13087
+ placement: "bottom-start",
13088
+ theme: "x-view-dark"
13086
13089
  });
13087
13090
  },
13088
13091
  onUpdate(props) {
@@ -13146,29 +13149,79 @@ var MentionEditor = ({
13146
13149
  ), /* @__PURE__ */ import_react28.default.createElement("style", null, `
13147
13150
  .tiptap p {
13148
13151
  margin: 0;
13149
- min-height: 1.2em;
13152
+ min-height: 1.25rem;
13153
+ line-height: 1.5;
13150
13154
  }
13151
13155
  .tiptap .mention {
13152
13156
  display: inline-flex;
13153
13157
  align-items: center;
13154
- background-color: rgba(99, 102, 241, 0.15);
13155
- border: 1px solid rgba(99, 102, 241, 0.3);
13156
- border-radius: 4px;
13157
- padding: 0 4px;
13158
+ background: rgba(99, 102, 241, 0.12);
13159
+ border: 1px solid rgba(99, 102, 241, 0.25);
13160
+ border-radius: 6px;
13161
+ padding: 1px 6px;
13158
13162
  color: #a5b4fc;
13159
- font-weight: 500;
13163
+ font-weight: 600;
13160
13164
  cursor: pointer;
13161
- margin: 0 2px;
13162
- transition: all 0.2s;
13165
+ margin: 0 1px;
13166
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
13167
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
13168
+ font-size: 0.85rem;
13169
+ text-decoration: none;
13170
+ vertical-align: baseline;
13163
13171
  }
13164
13172
  .tiptap .mention:hover {
13165
- background-color: rgba(99, 102, 241, 0.25);
13173
+ background: rgba(99, 102, 241, 0.22);
13166
13174
  border-color: rgba(99, 102, 241, 0.5);
13167
- color: white;
13175
+ color: #fff;
13176
+ transform: translateY(-1px);
13177
+ box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
13168
13178
  }
13179
+ .tiptap .mention::before {
13180
+ content: "";
13181
+ display: inline-block;
13182
+ width: 12px;
13183
+ height: 12px;
13184
+ margin-right: 4px;
13185
+ background-size: contain;
13186
+ background-repeat: no-repeat;
13187
+ opacity: 0.8;
13188
+ filter: brightness(1.2);
13189
+ }
13190
+
13191
+ /* Type specific styles */
13192
+ .tiptap .mention[data-mention-type="ancestry"] {
13193
+ background: rgba(139, 92, 246, 0.15);
13194
+ border-color: rgba(139, 92, 246, 0.3);
13195
+ color: #c4b5fd;
13196
+ }
13197
+ .tiptap .mention[data-mention-type="quest"] {
13198
+ background: rgba(16, 185, 129, 0.15);
13199
+ border-color: rgba(16, 185, 129, 0.3);
13200
+ color: #6ee7b7;
13201
+ }
13202
+ .tiptap .mention[data-mention-type="node"] {
13203
+ background: rgba(59, 130, 246, 0.15);
13204
+ border-color: rgba(59, 130, 246, 0.3);
13205
+ color: #93c5fd;
13206
+ }
13207
+ .tiptap .mention[data-mention-type="version"] {
13208
+ background: rgba(245, 158, 11, 0.15);
13209
+ border-color: rgba(245, 158, 11, 0.3);
13210
+ color: #fcd34d;
13211
+ }
13212
+
13169
13213
  .tiptap:focus {
13170
13214
  outline: none;
13171
13215
  }
13216
+
13217
+ .ProseMirror-placeholder:first-child::before {
13218
+ content: attr(data-placeholder);
13219
+ float: left;
13220
+ color: #475569;
13221
+ pointer-events: none;
13222
+ height: 0;
13223
+ font-style: italic;
13224
+ }
13172
13225
  `));
13173
13226
  };
13174
13227
  var MentionEditor_default = MentionEditor;
@@ -18679,451 +18732,7 @@ function XViewScene({
18679
18732
  )
18680
18733
  );
18681
18734
  }
18682
-
18683
- // src/x_view_server_logic.js
18684
- async function save_view_data_logic(db_services, filename, data) {
18685
- try {
18686
- const saveResult = await db_services.save_file(filename, data);
18687
- return saveResult;
18688
- } catch (error) {
18689
- console.error("catch (error) em save_view_data_logic:", error);
18690
- return { success: false, error: error.message };
18691
- }
18692
- }
18693
- async function get_scene_view_data_logic(db_services, scene_config, owner_id, type, session, focusNodeId = null, focusAncestryId = null) {
18694
- var _a, _b;
18695
- try {
18696
- if (!session || !session.user) {
18697
- return { success: false, error: "Usu\xE1rio n\xE3o autenticado." };
18698
- }
18699
- const membershipCheck = await db_services.check_membership(owner_id, type, scene_config, session.user.id);
18700
- const isFullMember = membershipCheck.success && membershipCheck.isValidMember;
18701
- if (!isFullMember && !focusNodeId && !focusAncestryId) {
18702
- return { success: false, error: "Acesso Negado: Voc\xEA n\xE3o possui permiss\xE3o para acessar este cen\xE1rio." };
18703
- }
18704
- const sceneResponse = await db_services.get_file(`x_view_scenes/${owner_id}/${scene_config}`);
18705
- if (!sceneResponse || !sceneResponse.success) {
18706
- console.error("Falha ao buscar dados da cena:", sceneResponse == null ? void 0 : sceneResponse.error);
18707
- return { success: false, error: `N\xE3o foi poss\xEDvel carregar o arquivo da cena: ${scene_config}` };
18708
- }
18709
- const sceneData = sceneResponse.data;
18710
- const parentDbObjects = sceneData.parent_dbs || [];
18711
- if (type && type.toLowerCase().includes("database")) {
18712
- const selfExists = parentDbObjects.some((db) => String(db.db_id) === String(scene_config));
18713
- if (!selfExists) {
18714
- parentDbObjects.push({ db_id: scene_config, owner_id });
18715
- }
18716
- }
18717
- const parentResponsesPromises = parentDbObjects.map(
18718
- (db_info) => db_services.get_file(`x_view_dbs/${db_info.owner_id}/${db_info.db_id}`)
18719
- );
18720
- const parentResponsesResults = await Promise.allSettled(parentResponsesPromises);
18721
- const parentData = {};
18722
- for (let i = 0; i < parentResponsesResults.length; i++) {
18723
- const result = parentResponsesResults[i];
18724
- const db_info = parentDbObjects[i];
18725
- if (result.status === "fulfilled" && ((_a = result.value) == null ? void 0 : _a.success)) {
18726
- parentData[db_info.db_id] = result.value.data;
18727
- } else {
18728
- console.warn(
18729
- `Arquivo pai n\xE3o carregado: ${db_info.db_id}. Pode ter sido deletado.`,
18730
- result.status === "rejected" ? result.reason : (_b = result.value) == null ? void 0 : _b.error
18731
- );
18732
- }
18733
- }
18734
- if (type && type.toLowerCase() === "view") {
18735
- parentData[scene_config] = {
18736
- dataset_name: "Quests Internas (View)",
18737
- nodes: sceneData.quest_nodes || [],
18738
- links: sceneData.quest_links || []
18739
- };
18740
- }
18741
- const allNodes = Object.values(parentData).flatMap((db) => db.nodes || []);
18742
- const allLinks = Object.values(parentData).flatMap((db) => db.links || []);
18743
- const parentNodeMap = new Map(allNodes.map((node) => [String(node.id), node]));
18744
- const parentLinkMap = new Map(allLinks.map((link) => [`${link.source}-${link.target}`, link]));
18745
- const validatedNodes = (sceneData.nodes || []).map((sceneNode) => {
18746
- var _a2, _b2;
18747
- const nodeTypes = Array.isArray(sceneNode.type) ? sceneNode.type : [sceneNode.type];
18748
- if (nodeTypes.includes("quest")) {
18749
- const dbQuestNode = (_b2 = (_a2 = parentData[scene_config]) == null ? void 0 : _a2.nodes) == null ? void 0 : _b2.find((qn) => String(qn.id) === String(sceneNode.id));
18750
- if (dbQuestNode) {
18751
- return { ...sceneNode, ...dbQuestNode };
18752
- }
18753
- return sceneNode;
18754
- }
18755
- const dbNode = parentNodeMap.get(String(sceneNode.id));
18756
- if (dbNode) {
18757
- return { ...sceneNode, ...dbNode };
18758
- }
18759
- return null;
18760
- }).filter(Boolean);
18761
- const validNodeIdsInScene = new Set(validatedNodes.map((node) => String(node.id)));
18762
- const validatedLinks = (sceneData.links || []).filter((sceneLink) => {
18763
- const linkExistsInParent = parentLinkMap.has(`${sceneLink.source}-${sceneLink.target}`);
18764
- const nodesAreValidForScene = validNodeIdsInScene.has(String(sceneLink.source)) && validNodeIdsInScene.has(String(sceneLink.target));
18765
- return linkExistsInParent && nodesAreValidForScene;
18766
- }).map((sceneLink) => parentLinkMap.get(`${sceneLink.source}-${sceneLink.target}`));
18767
- const validatedSceneData = {
18768
- ...sceneData,
18769
- nodes: validatedNodes,
18770
- links: validatedLinks
18771
- };
18772
- const ancestryFilePaths = [];
18773
- ancestryFilePaths.push({
18774
- path: `x_view_ancestry/${owner_id}/${scene_config}`,
18775
- source_id: scene_config,
18776
- owner_id,
18777
- isSceneFile: true
18778
- });
18779
- parentDbObjects.forEach((db_info) => {
18780
- ancestryFilePaths.push({
18781
- path: `x_view_ancestry/${db_info.owner_id}/${db_info.db_id}`,
18782
- source_id: db_info.db_id,
18783
- owner_id: db_info.owner_id,
18784
- isSceneFile: false
18785
- });
18786
- });
18787
- const ancestryPromises = ancestryFilePaths.map((file) => db_services.get_file(file.path));
18788
- const ancestryResults = await Promise.allSettled(ancestryPromises);
18789
- const ancestriesFromSceneFile = [];
18790
- const ancestriesFromDbFiles = [];
18791
- ancestryResults.forEach((result, index) => {
18792
- var _a2;
18793
- const fileInfo = ancestryFilePaths[index];
18794
- if (result.status === "fulfilled" && ((_a2 = result.value) == null ? void 0 : _a2.success) && Array.isArray(result.value.data)) {
18795
- const ancestriesFromFile = result.value.data.map((ancestry) => {
18796
- const existingSource = ancestry._source_file_id;
18797
- const existingOwner = ancestry._source_owner_id;
18798
- const isImportedItem = existingSource && existingSource !== fileInfo.source_id;
18799
- return {
18800
- ...ancestry,
18801
- _source_file_id: isImportedItem ? existingSource : fileInfo.source_id,
18802
- _source_owner_id: isImportedItem ? existingOwner : fileInfo.owner_id
18803
- };
18804
- });
18805
- if (fileInfo.isSceneFile) {
18806
- ancestriesFromSceneFile.push(...ancestriesFromFile);
18807
- } else {
18808
- ancestriesFromDbFiles.push(...ancestriesFromFile);
18809
- }
18810
- }
18811
- });
18812
- const ancestryMap = /* @__PURE__ */ new Map();
18813
- ancestriesFromDbFiles.forEach((anc) => ancestryMap.set(anc.ancestry_id, anc));
18814
- ancestriesFromSceneFile.forEach((anc) => ancestryMap.set(anc.ancestry_id, anc));
18815
- let ancestryData = Array.from(ancestryMap.values());
18816
- const externalSourcesToRefresh = /* @__PURE__ */ new Map();
18817
- ancestryData.forEach((anc) => {
18818
- const targetSourceId = anc._source_file_id || anc._imported_from_view_id;
18819
- const targetOwnerId = anc._source_owner_id || anc._imported_from_view_owner_id;
18820
- if (targetSourceId && targetSourceId !== scene_config && targetOwnerId) {
18821
- const isAlreadyLoadedAsParent = parentDbObjects.some((db) => String(db.db_id) === String(targetSourceId));
18822
- if (!isAlreadyLoadedAsParent) {
18823
- const key = `${targetOwnerId}/${targetSourceId}`;
18824
- externalSourcesToRefresh.set(key, {
18825
- owner_id: targetOwnerId,
18826
- source_id: targetSourceId,
18827
- key
18828
- });
18829
- }
18830
- }
18831
- });
18832
- const successfullyFetchedSources = /* @__PURE__ */ new Set();
18833
- const failedSources = /* @__PURE__ */ new Set();
18834
- if (externalSourcesToRefresh.size > 0) {
18835
- const refreshPromises = Array.from(externalSourcesToRefresh.values()).map(
18836
- (src) => db_services.get_file(`x_view_ancestry/${src.owner_id}/${src.source_id}`).then((res) => ({ ...res, _meta_key: src.key }))
18837
- );
18838
- const refreshResults = await Promise.allSettled(refreshPromises);
18839
- const freshAncestryMap = /* @__PURE__ */ new Map();
18840
- refreshResults.forEach((result) => {
18841
- var _a2, _b2;
18842
- if (result.status === "fulfilled" && ((_a2 = result.value) == null ? void 0 : _a2.success) && Array.isArray(result.value.data)) {
18843
- successfullyFetchedSources.add(result.value._meta_key);
18844
- result.value.data.forEach((freshAnc) => {
18845
- if (!freshAnc.is_private) {
18846
- freshAncestryMap.set(String(freshAnc.ancestry_id), freshAnc);
18847
- }
18848
- });
18849
- } else if (result.status === "fulfilled" && !((_b2 = result.value) == null ? void 0 : _b2.success)) {
18850
- failedSources.add(result.value._meta_key);
18851
- }
18852
- });
18853
- ancestryData = ancestryData.filter((localAnc) => {
18854
- const targetSourceId = localAnc._source_file_id || localAnc._imported_from_view_id;
18855
- const targetOwnerId = localAnc._source_owner_id || localAnc._imported_from_view_owner_id;
18856
- if (!targetSourceId || targetSourceId === scene_config) return true;
18857
- const key = `${targetOwnerId}/${targetSourceId}`;
18858
- if (failedSources.has(key)) {
18859
- return false;
18860
- }
18861
- if (externalSourcesToRefresh.has(key) && successfullyFetchedSources.has(key)) {
18862
- const stillExists = freshAncestryMap.has(String(localAnc.ancestry_id));
18863
- return stillExists;
18864
- }
18865
- return true;
18866
- }).map((localAnc) => {
18867
- const freshVersion = freshAncestryMap.get(String(localAnc.ancestry_id));
18868
- if (freshVersion) {
18869
- return {
18870
- ...freshVersion,
18871
- _imported_from_view_id: localAnc._imported_from_view_id,
18872
- _imported_from_view_owner_id: localAnc._imported_from_view_owner_id,
18873
- _origin_db_ids: localAnc._origin_db_ids,
18874
- _source_file_id: localAnc._source_file_id,
18875
- _source_owner_id: localAnc._source_owner_id
18876
- };
18877
- }
18878
- return localAnc;
18879
- });
18880
- }
18881
- const ancestryFilePath = `x_view_ancestry/${owner_id}/${scene_config}`;
18882
- const parentNodeIds = new Set(allNodes.map((node) => String(node.id)));
18883
- const pruneTree = (node) => {
18884
- if (!node) return null;
18885
- if (node.is_section) {
18886
- const validChildren2 = (node.children || []).map((child) => pruneTree(child)).filter(Boolean);
18887
- return { ...node, children: validChildren2 };
18888
- }
18889
- if (!parentNodeIds.has(String(node.node_id))) {
18890
- return null;
18891
- }
18892
- const validChildren = (node.children || []).map((child) => pruneTree(child)).filter(Boolean);
18893
- let validBranches = [];
18894
- if (node.parallel_branches) {
18895
- validBranches = node.parallel_branches.map((branch) => ({
18896
- ...branch,
18897
- tree: pruneTree(branch.tree)
18898
- })).filter((b) => b.tree !== null);
18899
- }
18900
- return {
18901
- ...node,
18902
- children: validChildren,
18903
- parallel_branches: validBranches
18904
- };
18905
- };
18906
- const originalAncestryDataString = JSON.stringify(Array.from(ancestryMap.values()));
18907
- const cleanedAncestryData = ancestryData.map((ancestry) => {
18908
- if (!parentNodeIds.has(String(ancestry.ancestral_node))) return null;
18909
- const cleanedTree = pruneTree(ancestry.tree);
18910
- if (!cleanedTree) return null;
18911
- let cleanedAbstraction = null;
18912
- if (ancestry.abstraction_tree) {
18913
- cleanedAbstraction = pruneTree(ancestry.abstraction_tree);
18914
- }
18915
- return {
18916
- ...ancestry,
18917
- tree: cleanedTree,
18918
- abstraction_tree: cleanedAbstraction
18919
- };
18920
- }).filter(Boolean);
18921
- if (JSON.stringify(cleanedAncestryData) !== originalAncestryDataString) {
18922
- ancestryData = cleanedAncestryData;
18923
- try {
18924
- await db_services.save_file(ancestryFilePath, ancestryData);
18925
- } catch (saveError) {
18926
- console.error("Falha ao salvar o arquivo de ancestralidade da cena atualizado:", saveError);
18927
- }
18928
- }
18929
- if (!isFullMember) {
18930
- const requiredNodeIds = /* @__PURE__ */ new Set();
18931
- const requiredAncestryIds = /* @__PURE__ */ new Set();
18932
- if (focusNodeId) requiredNodeIds.add(String(focusNodeId));
18933
- if (focusAncestryId) requiredAncestryIds.add(String(focusAncestryId));
18934
- const allNodesFromDb = Object.values(parentData).flatMap((db) => db.nodes || []);
18935
- const extractDependenciesFromText = (text) => {
18936
- if (!text) return;
18937
- const mentionRegex = /\[\[MENTION:node:([a-zA-Z0-9\-_]+)\]\]/g;
18938
- const refRegex = /\[\[REF:(node|ancestry):([a-zA-Z0-9\-_]+):([a-zA-Z0-9\-_]+)\]\]/g;
18939
- let match;
18940
- while ((match = mentionRegex.exec(text)) !== null) {
18941
- requiredNodeIds.add(match[1]);
18942
- }
18943
- while ((match = refRegex.exec(text)) !== null) {
18944
- if (match[1] === "node") requiredNodeIds.add(match[2]);
18945
- if (match[1] === "ancestry") requiredAncestryIds.add(match[2]);
18946
- }
18947
- };
18948
- const extractTreeDependencies = (treeItem) => {
18949
- var _a2;
18950
- if (!treeItem) return;
18951
- if (treeItem.node_id) requiredNodeIds.add(String(treeItem.node_id));
18952
- if ((_a2 = treeItem.node) == null ? void 0 : _a2.id) requiredNodeIds.add(String(treeItem.node.id));
18953
- if (treeItem.children) {
18954
- treeItem.children.forEach(extractTreeDependencies);
18955
- }
18956
- if (treeItem.parallel_branches) {
18957
- treeItem.parallel_branches.forEach((branch) => {
18958
- if (branch.linked_ancestry_id) {
18959
- requiredAncestryIds.add(String(branch.linked_ancestry_id));
18960
- }
18961
- if (branch.description) extractDependenciesFromText(branch.description);
18962
- if (branch.description_sections) {
18963
- branch.description_sections.forEach((s) => extractDependenciesFromText(s.content));
18964
- }
18965
- extractTreeDependencies(branch.tree);
18966
- });
18967
- }
18968
- };
18969
- let previousSize;
18970
- do {
18971
- previousSize = requiredNodeIds.size + requiredAncestryIds.size;
18972
- requiredAncestryIds.forEach((ancId) => {
18973
- const anc = ancestryData.find((a) => String(a.ancestry_id) === ancId);
18974
- if (anc && !anc.is_private) {
18975
- if (anc.description) extractDependenciesFromText(anc.description);
18976
- if (anc.description_sections) {
18977
- anc.description_sections.forEach((s) => extractDependenciesFromText(s.content));
18978
- }
18979
- extractTreeDependencies(anc.tree);
18980
- extractTreeDependencies(anc.abstraction_tree);
18981
- }
18982
- });
18983
- requiredNodeIds.forEach((nodeId) => {
18984
- const node = allNodesFromDb.find((n) => String(n.id) === nodeId);
18985
- if (node) {
18986
- if (node.description) extractDependenciesFromText(node.description);
18987
- if (node.description_sections) {
18988
- node.description_sections.forEach((s) => extractDependenciesFromText(s.content));
18989
- }
18990
- }
18991
- });
18992
- } while (requiredNodeIds.size + requiredAncestryIds.size > previousSize);
18993
- const restrictedSceneData = { ...validatedSceneData, nodes: [], links: [] };
18994
- const restrictedParentData = {};
18995
- const restrictedAncestryData = ancestryData.filter((a) => requiredAncestryIds.has(String(a.ancestry_id)) && !a.is_private);
18996
- for (const [dbId, dbContent] of Object.entries(parentData)) {
18997
- const filteredNodes = (dbContent.nodes || []).filter((n) => requiredNodeIds.has(String(n.id)));
18998
- if (filteredNodes.length > 0) {
18999
- restrictedParentData[dbId] = { ...dbContent, nodes: filteredNodes, links: [] };
19000
- }
19001
- }
19002
- if (focusNodeId) {
19003
- const mainNode = allNodesFromDb.find((n) => String(n.id) === String(focusNodeId));
19004
- if (mainNode) {
19005
- restrictedSceneData.nodes = [mainNode];
19006
- }
19007
- }
19008
- return {
19009
- success: true,
19010
- data: {
19011
- scene: restrictedSceneData,
19012
- parent: restrictedParentData,
19013
- ancestry: restrictedAncestryData
19014
- }
19015
- };
19016
- }
19017
- return {
19018
- success: true,
19019
- data: { scene: validatedSceneData, parent: parentData, ancestry: ancestryData }
19020
- };
19021
- } catch (error) {
19022
- console.error("Erro em get_scene_view_data_logic:", error);
19023
- return { success: false, error: error.message };
19024
- }
19025
- }
19026
- async function import_parent_file_modal_get_logic(db_services, session) {
19027
- try {
19028
- const call_firestore_get_x_view_data = await db_services.get_firestore_data(session);
19029
- const x_view_databases = call_firestore_get_x_view_data.data.sub_collections.x_view_databases || [];
19030
- const x_views = call_firestore_get_x_view_data.data.sub_collections.x_views || [];
19031
- return {
19032
- success: true,
19033
- data: {
19034
- databases: x_view_databases,
19035
- views: x_views
19036
- }
19037
- };
19038
- } catch (error) {
19039
- console.error("catch (error) em import_parent_file_modal_get_logic:", error);
19040
- return { success: false, error: error.message };
19041
- }
19042
- }
19043
- async function get_single_parent_file_logic(db_services, file_id, session) {
19044
- try {
19045
- const call_GCP_cloud_storage_get_file = await db_services.get_file(`x_view_dbs/${session.user.id}/${file_id}`);
19046
- return call_GCP_cloud_storage_get_file;
19047
- } catch (error) {
19048
- console.error("catch (error) em get_single_parent_file_logic:", error);
19049
- return { success: false, error: error.message };
19050
- }
19051
- }
19052
- async function x_view_add_new_parent_file_to_scene_at_firebase(file_id, session, new_parent, db_services) {
19053
- try {
19054
- const update_data = {
19055
- scene_id: file_id,
19056
- new_parent,
19057
- session
19058
- };
19059
- const call_firestore_add_new_parent_file_to_scene_at_firebase = await db_services.add_new_parent_file_to_scene_at_firebase(update_data);
19060
- return call_firestore_add_new_parent_file_to_scene_at_firebase;
19061
- } catch (error) {
19062
- console.error("catch (error) em get_single_parent_file_logic:", error);
19063
- return { success: false, error: error.message };
19064
- }
19065
- }
19066
- async function get_ancestry_file_logic(db_services, file_id, owner_id) {
19067
- try {
19068
- const path = `x_view_ancestry/${owner_id}/${file_id}`;
19069
- const call_GCP_cloud_storage_get_file = await db_services.get_file(path);
19070
- return call_GCP_cloud_storage_get_file;
19071
- } catch (error) {
19072
- console.error("catch (error) em get_ancestry_file_logic:", error);
19073
- return { success: false, error: error.message };
19074
- }
19075
- }
19076
- async function save_ancestry_board_logic(db_services, scene_id, type, groups, session, owner_id) {
19077
- try {
19078
- const targetOwnerId = owner_id || session.user.id;
19079
- return await db_services.save_ancestry_board(session, scene_id, type, groups, targetOwnerId);
19080
- } catch (error) {
19081
- console.error("Erro em save_ancestry_board_logic:", error);
19082
- return { success: false, error: error.message };
19083
- }
19084
- }
19085
- async function get_ancestry_board_logic(db_services, scene_id, type, session, owner_id) {
19086
- try {
19087
- const targetOwnerId = owner_id || session.user.id;
19088
- return await db_services.get_ancestry_board(session, scene_id, type, targetOwnerId);
19089
- } catch (error) {
19090
- console.error("Erro em get_ancestry_board_logic:", error);
19091
- return { success: false, error: error.message };
19092
- }
19093
- }
19094
- async function delete_uploaded_file_logic(db_services, fileUrl) {
19095
- try {
19096
- if (db_services.delete_public_file) {
19097
- return await db_services.delete_public_file(fileUrl);
19098
- }
19099
- return { success: false, error: "Servi\xE7o de dele\xE7\xE3o n\xE3o configurado." };
19100
- } catch (error) {
19101
- console.error("Erro em delete_uploaded_file_logic:", error);
19102
- return { success: false, error: error.message };
19103
- }
19104
- }
19105
- async function get_view_members_logic(db_services, ownerId, type, itemId) {
19106
- try {
19107
- if (!db_services.get_view_members) {
19108
- return { success: false, error: "Servi\xE7o de busca de membros n\xE3o configurado." };
19109
- }
19110
- return await db_services.get_view_members(ownerId, type, itemId);
19111
- } catch (error) {
19112
- console.error("Erro em get_view_members_logic:", error);
19113
- return { success: false, error: error.message };
19114
- }
19115
- }
19116
18735
  // Annotate the CommonJS export names for ESM import in node:
19117
18736
  0 && (module.exports = {
19118
- XViewScene,
19119
- delete_uploaded_file_logic,
19120
- get_ancestry_board_logic,
19121
- get_ancestry_file_logic,
19122
- get_scene_view_data_logic,
19123
- get_single_parent_file_logic,
19124
- get_view_members_logic,
19125
- import_parent_file_modal_get_logic,
19126
- save_ancestry_board_logic,
19127
- save_view_data_logic,
19128
- x_view_add_new_parent_file_to_scene_at_firebase
18737
+ XViewScene
19129
18738
  });