Prometheus Entity Management API
    Preparing search index...

    Interface CreateEntityOptions<TRaw, TEntity>

    Options for createEntity. The source accessor is called reactively; changing either type or id inside it re-triggers the fetch.

    interface CreateEntityOptions<TRaw, TEntity extends object> {
        enabled?: () => boolean;
        fetch: (id: string) => Promise<TRaw>;
        id: () => string | null | undefined;
        idField?: string;
        normalize: (raw: TRaw) => TEntity;
        onError?: (error: Error) => void;
        onSuccess?: (entity: TEntity) => void;
        staleTime?: number;
        type: string;
    }

    Type Parameters

    • TRaw

      Shape returned by the transport fetch function.

    • TEntity extends object

      Normalized entity shape written to the graph.

    Index
    enabled?: () => boolean

    Set to false to skip fetching regardless of id presence (default true).

    fetch: (id: string) => Promise<TRaw>

    Transport fetch function. Receives the resolved id and returns raw data. Called by the underlying createResource; deduplicated by the core engine.

    id: () => string | null | undefined

    Reactive accessor returning the entity id — return null / undefined to disable.

    idField?: string

    Name of the id field inside the normalized entity (default "id"). Used when the server-returned id may differ from the request id.

    normalize: (raw: TRaw) => TEntity

    Maps raw API response to the canonical shape upserted into the graph.

    onError?: (error: Error) => void

    Called after all retries are exhausted.

    onSuccess?: (entity: TEntity) => void

    Called after a successful fetch and graph write.

    staleTime?: number

    Milliseconds before a cached entity is considered stale and a background refetch is triggered (inherits from configureEngine when omitted).

    type: string

    Entity kind (e.g. "Invoice"). Drives the graph partition.