core-utils
    Preparing search index...

    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 Relationships
                    ? {
                        [K in keyof Relation]: K extends string
                            ? NonNullable<Relation[K]> extends Relationship
                                ? NonNullable<(...)>["data"] extends { type?: ... } | (...)[]
                                    ? RelationT extends keyof (...) ? (...) | (...) : never
                                    : never
                                : never
                            : never
                    }[keyof Relation]
                    : never
                : never
            : never
        : never

    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

    Type Parameters

    • MapT extends Record<string, z.ZodTypeAny>

      A map of ApiType to Zod schemas.

    • DocumentT extends JsonApiDocument

      The JSON:API document.

    • Depth extends number = 5

      The maximum depth for recursive relationship traversal.

    • Prefix extends string = ""

      The prefix for nested relationship paths.