import { Entity, EntitySchema, EntitySelection, PackedEntitySelection, WhereEntity } from "@entity-space/elements"; import { Class } from "@entity-space/utils"; import { Subject } from "rxjs"; export interface QueryOptions { schema: EntitySchema; selection: EntitySelection; } export interface QueryReactivityOptions { additionalBlueprints?: Class[]; } export interface QueryCacheOptions { key?: unknown; refresh?: boolean; refreshDelay?: number; refreshInterval?: number; reactive?: boolean | QueryReactivityOptions; maxAge?: string | number; } export interface QueryArguments { schema: EntitySchema; select?: PackedEntitySelection; where?: WhereEntity; parameters?: QueryArgumentsParameters; sort?: QueryArgumentsSort[]; page?: QueryArgumentsPage; cache?: boolean | QueryCacheOptions; isLoading$?: Subject; } export interface QueryArgumentsParameters { blueprint: Class; value: Entity; } export interface QueryArgumentsSort { key: string | PackedEntitySelection; ascending: boolean; } export interface QueryArgumentsPage { from: number; to: number; } export interface HydrateArguments { blueprint: Class; entities: Entity[]; select: PackedEntitySelection; cache?: boolean | QueryCacheOptions; } export interface EntityMutationCacheOptions { key?: unknown; } export interface EntityMutationOptions { cache: false | EntityMutationCacheOptions; }