@lv-x-software-house/x_view 1.2.8-dev.3 → 1.2.8-dev.4

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
@@ -15459,7 +15459,9 @@ function XViewScene({
15459
15459
  save_quest_action,
15460
15460
  delete_quest_action,
15461
15461
  save_quest_link_action,
15462
- delete_quest_link_action
15462
+ delete_quest_link_action,
15463
+ get_view_quests_and_links_action,
15464
+ migrate_legacy_quests_action
15463
15465
  }) {
15464
15466
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
15465
15467
  const { data: session, status } = (0, import_react34.useSession)();
@@ -16323,11 +16325,32 @@ function XViewScene({
16323
16325
  focusAncestryId
16324
16326
  );
16325
16327
  const boardPromise = get_boards_action && session ? get_boards_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
16326
- const [sceneResponse, boardResponse] = await Promise.all([
16328
+ const questPromise = get_view_quests_and_links_action && session ? get_view_quests_and_links_action(ownerId2, sceneConfigId) : Promise.resolve({ success: false, quests: [], links: [] });
16329
+ const [sceneResponse, boardResponse, questResponse] = await Promise.all([
16327
16330
  scenePromise,
16328
- boardPromise
16331
+ boardPromise,
16332
+ questPromise
16329
16333
  ]);
16330
16334
  if ((sceneResponse == null ? void 0 : sceneResponse.success) && ((_a2 = sceneResponse.data) == null ? void 0 : _a2.scene) && ((_b2 = sceneResponse.data) == null ? void 0 : _b2.parent)) {
16335
+ const sceneData = sceneResponse.data.scene;
16336
+ let firestoreQuests = (questResponse == null ? void 0 : questResponse.success) ? questResponse.quests : [];
16337
+ let firestoreLinks = (questResponse == null ? void 0 : questResponse.success) ? questResponse.links : [];
16338
+ if (!sceneData.quests_migrated && firestoreQuests.length === 0) {
16339
+ const legacyQuests = sceneData.quest_nodes || [];
16340
+ const legacyLinks = sceneData.quest_links || [];
16341
+ if ((legacyQuests.length > 0 || legacyLinks.length > 0) && migrate_legacy_quests_action) {
16342
+ console.log(
16343
+ "X-View: Iniciando Lazy Migration de Quests para Firestore..."
16344
+ );
16345
+ await migrate_legacy_quests_action(ownerId2, sceneConfigId, {
16346
+ nodes: legacyQuests,
16347
+ links: legacyLinks
16348
+ });
16349
+ firestoreQuests = legacyQuests;
16350
+ firestoreLinks = legacyLinks;
16351
+ sceneData.quests_migrated = true;
16352
+ }
16353
+ }
16331
16354
  if (focusNodeId) {
16332
16355
  let targetNode = sceneResponse.data.scene.nodes.find(
16333
16356
  (n) => String(n.id) === String(focusNodeId)
@@ -16349,10 +16372,29 @@ function XViewScene({
16349
16372
  sceneResponse.data.scene.links = [];
16350
16373
  }
16351
16374
  sceneDataRef.current = {
16352
- ...sceneResponse.data.scene,
16353
- milestones: sceneResponse.data.scene.milestones || []
16375
+ ...sceneData,
16376
+ quests_migrated: sceneData.quests_migrated || false,
16377
+ milestones: sceneData.milestones || []
16354
16378
  };
16355
- parentDataRef.current = sceneResponse.data.parent;
16379
+ const currentParentData = sceneResponse.data.parent;
16380
+ if (currentParentData && currentParentData[sceneConfigId]) {
16381
+ const existingNodes = currentParentData[sceneConfigId].nodes || [];
16382
+ const firestoreQuestIds = new Set(firestoreQuests.map((q) => String(q.id)));
16383
+ const filteredExisting = existingNodes.filter(
16384
+ (n) => !firestoreQuestIds.has(String(n.id))
16385
+ );
16386
+ currentParentData[sceneConfigId].nodes = [
16387
+ ...filteredExisting,
16388
+ ...firestoreQuests
16389
+ ];
16390
+ if (firestoreLinks && firestoreLinks.length > 0) {
16391
+ currentParentData[sceneConfigId].links = [
16392
+ ...currentParentData[sceneConfigId].links || [],
16393
+ ...firestoreLinks
16394
+ ];
16395
+ }
16396
+ }
16397
+ parentDataRef.current = currentParentData;
16356
16398
  ancestryDataRef.current = sceneResponse.data.ancestry;
16357
16399
  console.log(
16358
16400
  "Console de sceneResponse.data.scene:",
@@ -17970,7 +18012,9 @@ function XViewScene({
17970
18012
  save_quest: save_quest_action,
17971
18013
  delete_quest: delete_quest_action,
17972
18014
  save_quest_link: save_quest_link_action,
17973
- delete_quest_link: delete_quest_link_action
18015
+ delete_quest_link: delete_quest_link_action,
18016
+ get_view_quests_and_links: get_view_quests_and_links_action,
18017
+ migrate_legacy_quests: migrate_legacy_quests_action
17974
18018
  }
17975
18019
  };
17976
18020
  },
@@ -17993,7 +18037,9 @@ function XViewScene({
17993
18037
  save_quest_action,
17994
18038
  delete_quest_action,
17995
18039
  save_quest_link_action,
17996
- delete_quest_link_action
18040
+ delete_quest_link_action,
18041
+ get_view_quests_and_links_action,
18042
+ migrate_legacy_quests_action
17997
18043
  ]
17998
18044
  );
17999
18045
  const handleStartVersioning = (nodeData) => {
package/dist/index.mjs CHANGED
@@ -15522,7 +15522,9 @@ function XViewScene({
15522
15522
  save_quest_action,
15523
15523
  delete_quest_action,
15524
15524
  save_quest_link_action,
15525
- delete_quest_link_action
15525
+ delete_quest_link_action,
15526
+ get_view_quests_and_links_action,
15527
+ migrate_legacy_quests_action
15526
15528
  }) {
15527
15529
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
15528
15530
  const { data: session, status } = useSession();
@@ -16386,11 +16388,32 @@ function XViewScene({
16386
16388
  focusAncestryId
16387
16389
  );
16388
16390
  const boardPromise = get_boards_action && session ? get_boards_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
16389
- const [sceneResponse, boardResponse] = await Promise.all([
16391
+ const questPromise = get_view_quests_and_links_action && session ? get_view_quests_and_links_action(ownerId2, sceneConfigId) : Promise.resolve({ success: false, quests: [], links: [] });
16392
+ const [sceneResponse, boardResponse, questResponse] = await Promise.all([
16390
16393
  scenePromise,
16391
- boardPromise
16394
+ boardPromise,
16395
+ questPromise
16392
16396
  ]);
16393
16397
  if ((sceneResponse == null ? void 0 : sceneResponse.success) && ((_a2 = sceneResponse.data) == null ? void 0 : _a2.scene) && ((_b2 = sceneResponse.data) == null ? void 0 : _b2.parent)) {
16398
+ const sceneData = sceneResponse.data.scene;
16399
+ let firestoreQuests = (questResponse == null ? void 0 : questResponse.success) ? questResponse.quests : [];
16400
+ let firestoreLinks = (questResponse == null ? void 0 : questResponse.success) ? questResponse.links : [];
16401
+ if (!sceneData.quests_migrated && firestoreQuests.length === 0) {
16402
+ const legacyQuests = sceneData.quest_nodes || [];
16403
+ const legacyLinks = sceneData.quest_links || [];
16404
+ if ((legacyQuests.length > 0 || legacyLinks.length > 0) && migrate_legacy_quests_action) {
16405
+ console.log(
16406
+ "X-View: Iniciando Lazy Migration de Quests para Firestore..."
16407
+ );
16408
+ await migrate_legacy_quests_action(ownerId2, sceneConfigId, {
16409
+ nodes: legacyQuests,
16410
+ links: legacyLinks
16411
+ });
16412
+ firestoreQuests = legacyQuests;
16413
+ firestoreLinks = legacyLinks;
16414
+ sceneData.quests_migrated = true;
16415
+ }
16416
+ }
16394
16417
  if (focusNodeId) {
16395
16418
  let targetNode = sceneResponse.data.scene.nodes.find(
16396
16419
  (n) => String(n.id) === String(focusNodeId)
@@ -16412,10 +16435,29 @@ function XViewScene({
16412
16435
  sceneResponse.data.scene.links = [];
16413
16436
  }
16414
16437
  sceneDataRef.current = {
16415
- ...sceneResponse.data.scene,
16416
- milestones: sceneResponse.data.scene.milestones || []
16438
+ ...sceneData,
16439
+ quests_migrated: sceneData.quests_migrated || false,
16440
+ milestones: sceneData.milestones || []
16417
16441
  };
16418
- parentDataRef.current = sceneResponse.data.parent;
16442
+ const currentParentData = sceneResponse.data.parent;
16443
+ if (currentParentData && currentParentData[sceneConfigId]) {
16444
+ const existingNodes = currentParentData[sceneConfigId].nodes || [];
16445
+ const firestoreQuestIds = new Set(firestoreQuests.map((q) => String(q.id)));
16446
+ const filteredExisting = existingNodes.filter(
16447
+ (n) => !firestoreQuestIds.has(String(n.id))
16448
+ );
16449
+ currentParentData[sceneConfigId].nodes = [
16450
+ ...filteredExisting,
16451
+ ...firestoreQuests
16452
+ ];
16453
+ if (firestoreLinks && firestoreLinks.length > 0) {
16454
+ currentParentData[sceneConfigId].links = [
16455
+ ...currentParentData[sceneConfigId].links || [],
16456
+ ...firestoreLinks
16457
+ ];
16458
+ }
16459
+ }
16460
+ parentDataRef.current = currentParentData;
16419
16461
  ancestryDataRef.current = sceneResponse.data.ancestry;
16420
16462
  console.log(
16421
16463
  "Console de sceneResponse.data.scene:",
@@ -18033,7 +18075,9 @@ function XViewScene({
18033
18075
  save_quest: save_quest_action,
18034
18076
  delete_quest: delete_quest_action,
18035
18077
  save_quest_link: save_quest_link_action,
18036
- delete_quest_link: delete_quest_link_action
18078
+ delete_quest_link: delete_quest_link_action,
18079
+ get_view_quests_and_links: get_view_quests_and_links_action,
18080
+ migrate_legacy_quests: migrate_legacy_quests_action
18037
18081
  }
18038
18082
  };
18039
18083
  },
@@ -18056,7 +18100,9 @@ function XViewScene({
18056
18100
  save_quest_action,
18057
18101
  delete_quest_action,
18058
18102
  save_quest_link_action,
18059
- delete_quest_link_action
18103
+ delete_quest_link_action,
18104
+ get_view_quests_and_links_action,
18105
+ migrate_legacy_quests_action
18060
18106
  ]
18061
18107
  );
18062
18108
  const handleStartVersioning = (nodeData) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.8-dev.3",
3
+ "version": "1.2.8-dev.4",
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",