Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 46 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/datasync-filesystem-sdk",
"version": "1.3.1",
"version": "1.4.0",
"description": "JavaScript filesystem SDK to query data synced via @contentstack/datasync-content-store-filesystem",
"main": "dist/index.js",
"scripts": {
Expand Down
24 changes: 7 additions & 17 deletions src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1227,32 +1227,22 @@ export class Stack {
/**
* @private
* @method processOverlappingPaths
* @description Processes overlapping paths using a chained approach
* @description Processes overlapping paths by including all paths from each group
* @param {Object} pathAnalysis - Analysis result from analyzeReferencePaths
* @returns {this} - Returns stack instance
*/
private processOverlappingPaths(pathAnalysis: any): Stack {
// Start with independent paths (if any)
if (pathAnalysis.independentPaths.length > 0) {
this.q.includeSpecificReferences = pathAnalysis.independentPaths
this.q.includeSpecificReferences = [...pathAnalysis.independentPaths]
} else {
this.q.includeSpecificReferences = []
}

// Process each overlapping group by using the most specific path
// Process each overlapping group by including ALL paths from each group
pathAnalysis.overlappingGroups.forEach((group: string[]) => {
// Sort group by length (longest/most specific first)
const sortedGroup = group.sort((a, b) => b.length - a.length)

// Use the most specific path from each group
const mostSpecificPath = sortedGroup[0]

// If this is the first group and we have no independent paths,
// set the includeSpecificReferences
if (!this.q.includeSpecificReferences) {
this.q.includeSpecificReferences = [mostSpecificPath]
} else {
// Add the most specific path to existing references
this.q.includeSpecificReferences.push(mostSpecificPath)
}
// Add all paths from the group to includeSpecificReferences
this.q.includeSpecificReferences.push(...group)
})

return this
Expand Down
2 changes: 1 addition & 1 deletion typings/stack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export declare class Stack {
/**
* @private
* @method processOverlappingPaths
* @description Processes overlapping paths using a chained approach
* @description Processes overlapping paths by including all paths from each group
* @param {Object} pathAnalysis - Analysis result from analyzeReferencePaths
* @returns {this} - Returns stack instance
*/
Expand Down
Loading