@absolutejs/absolute 0.19.0-beta.605 → 0.19.0-beta.606

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.
@@ -4801,11 +4801,13 @@ var buildRAGChunkGraph = (chunks) => {
4801
4801
  const existing = sections.get(sectionId);
4802
4802
  if (!existing) {
4803
4803
  sections.set(sectionId, {
4804
+ childSectionIds: [],
4804
4805
  chunkCount: structure.sequence?.sectionChunkCount ?? 1,
4805
4806
  chunkIds: [chunk.chunkId],
4806
4807
  depth: structure.section?.depth,
4807
4808
  id: sectionId,
4808
4809
  kind: structure.section?.kind,
4810
+ leadChunkId: chunk.chunkId,
4809
4811
  path: structure.section?.path,
4810
4812
  title: structure.section?.title
4811
4813
  });
@@ -4828,6 +4830,48 @@ var buildRAGChunkGraph = (chunks) => {
4828
4830
  }
4829
4831
  return left.localeCompare(right);
4830
4832
  });
4833
+ section.leadChunkId = section.chunkIds[0];
4834
+ }
4835
+ const sectionPathIndex = new Map;
4836
+ for (const section of sections.values()) {
4837
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
4838
+ if (path && path.length > 0) {
4839
+ sectionPathIndex.set(path.join("\x00"), section);
4840
+ }
4841
+ }
4842
+ for (const section of sections.values()) {
4843
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
4844
+ if (!path || path.length < 2) {
4845
+ continue;
4846
+ }
4847
+ const parent = sectionPathIndex.get(path.slice(0, -1).join("\x00"));
4848
+ if (!parent || parent.id === section.id) {
4849
+ continue;
4850
+ }
4851
+ section.parentSectionId = parent.id;
4852
+ if (!parent.childSectionIds.includes(section.id)) {
4853
+ parent.childSectionIds.push(section.id);
4854
+ }
4855
+ if (parent.leadChunkId && section.leadChunkId) {
4856
+ const parentKey = `section_parent:${section.leadChunkId}:${parent.leadChunkId}`;
4857
+ if (!edgeKeys.has(parentKey)) {
4858
+ edgeKeys.add(parentKey);
4859
+ edges.push({
4860
+ fromChunkId: section.leadChunkId,
4861
+ relation: "section_parent",
4862
+ toChunkId: parent.leadChunkId
4863
+ });
4864
+ }
4865
+ const childKey = `section_child:${parent.leadChunkId}:${section.leadChunkId}`;
4866
+ if (!edgeKeys.has(childKey)) {
4867
+ edgeKeys.add(childKey);
4868
+ edges.push({
4869
+ fromChunkId: parent.leadChunkId,
4870
+ relation: "section_child",
4871
+ toChunkId: section.leadChunkId
4872
+ });
4873
+ }
4874
+ }
4831
4875
  }
4832
4876
  nodes.sort((left, right) => {
4833
4877
  const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
@@ -4861,6 +4905,8 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
4861
4905
  if (graph.nodes.length === 0) {
4862
4906
  return {
4863
4907
  activeChunkId,
4908
+ childSections: [],
4909
+ siblingSections: [],
4864
4910
  sectionNodes: []
4865
4911
  };
4866
4912
  }
@@ -4869,13 +4915,19 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
4869
4915
  const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
4870
4916
  const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
4871
4917
  const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
4918
+ const parentSection = section?.parentSectionId ? graph.sections.find((entry) => entry.id === section.parentSectionId) : undefined;
4919
+ const childSections = section ? section.childSectionIds.map((sectionId) => graph.sections.find((entry) => entry.id === sectionId)).filter((entry) => Boolean(entry)) : [];
4920
+ const siblingSections = section?.parentSectionId ? graph.sections.filter((entry) => entry.parentSectionId === section.parentSectionId && entry.id !== section.id) : [];
4872
4921
  const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
4873
4922
  return {
4874
4923
  activeChunkId: resolvedActiveChunkId,
4875
4924
  activeNode,
4925
+ childSections,
4876
4926
  nextNode,
4927
+ parentSection,
4877
4928
  previousNode,
4878
4929
  section,
4930
+ siblingSections,
4879
4931
  sectionNodes
4880
4932
  };
4881
4933
  };
@@ -6848,5 +6900,5 @@ export {
6848
6900
  buildRAGEvaluationLeaderboard
6849
6901
  };
6850
6902
 
6851
- //# debugId=C86DB4BD7A51410264756E2164756E21
6903
+ //# debugId=3CD5187B947B133564756E2164756E21
6852
6904
  //# sourceMappingURL=index.js.map