qdadm 1.10.2 → 1.10.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/package.json +1 -1
- package/src/entity/EntityManager.ts +21 -2
package/package.json
CHANGED
|
@@ -1100,9 +1100,28 @@ export class EntityManager<T extends EntityRecord = EntityRecord> {
|
|
|
1100
1100
|
// 2. Fetch from API
|
|
1101
1101
|
let response: { items?: T[]; data?: T[] | { items?: T[]; data?: T[] }; total?: number; pagination?: { total?: number } }
|
|
1102
1102
|
if (endpoint && storage.request) {
|
|
1103
|
-
// Use request() with endpoint for multi-storage routing
|
|
1103
|
+
// Use request() with endpoint for multi-storage routing.
|
|
1104
|
+
// When using a dynamic endpoint, parent IDs are already encoded in the URL.
|
|
1105
|
+
// Strip parent-related filters to avoid duplication in query params.
|
|
1106
|
+
let requestParams = mergedParams
|
|
1107
|
+
if (context?.parentChain && mergedParams.filters) {
|
|
1108
|
+
const parentIds = new Set(
|
|
1109
|
+
context.parentChain.map((p: { id: string | number }) => String(p.id))
|
|
1110
|
+
)
|
|
1111
|
+
const cleaned = Object.fromEntries(
|
|
1112
|
+
Object.entries(mergedParams.filters as Record<string, unknown>).filter(
|
|
1113
|
+
([, value]) => !parentIds.has(String(value))
|
|
1114
|
+
)
|
|
1115
|
+
)
|
|
1116
|
+
requestParams = { ...mergedParams }
|
|
1117
|
+
if (Object.keys(cleaned).length > 0) {
|
|
1118
|
+
requestParams.filters = cleaned
|
|
1119
|
+
} else {
|
|
1120
|
+
delete requestParams.filters
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1104
1123
|
const apiResponse = (await storage.request('GET', endpoint, {
|
|
1105
|
-
params:
|
|
1124
|
+
params: requestParams,
|
|
1106
1125
|
context,
|
|
1107
1126
|
})) as { data?: unknown }
|
|
1108
1127
|
// Normalize response
|