Files
pterodactyl-panel/resources/scripts/api/relationships.ts
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

14 lines
490 B
TypeScript

// Fractal returns a NullResource for any include the viewer lacks permission for.
interface NullResourceLike {
object: 'null_resource';
}
export function relationshipData<T>(relationship: { data: T[] } | NullResourceLike | undefined): T[] {
return relationship && 'data' in relationship ? relationship.data : [];
}
export function relationshipAttributes<A>(relationship: { attributes: A | null } | undefined): A | undefined {
return relationship?.attributes ?? undefined;
}