Type Alias RelationshipPaths<MapT, DocumentT, Depth, Prefix>
RelationshipPaths: GreaterThan<Depth, 0> extends true ? DocumentT["data"] extends (
infer Data)
[] | infer Data ? Data extends { relationships?: infer Relation } ? Relation extends Record<string, Relationship> ? { [K in keyof Relation]: K extends string ? Relation[K]["data"] extends | { type?: infer RelationT } | { type?: ...
}[] ? RelationT extends keyof MapT ? | `${(...)
}${(...)
}` | RelationshipPaths<(...)
, (...)
, (...)
, (...)
> : never : never : never }[keyof Relation] : never : never : never : never Type Parameters
- MapT extends Record<string, z.ZodTypeAny>
- DocumentT extends JsonApiDocument
- Depth extends number = 5
- Prefix extends string = ""
Recursively traverse the JSON:API document to build a list of all possible relationship paths up to the specified depth, which prevents stack overflow for circular relationships. Use the result in
include
queries