Prometheus Entity Management API
    Preparing search index...
    • Scope React graph hooks to an application-owned store.

      The default remains the package singleton. Next.js and other SSR hosts use this provider to keep concurrent request renders isolated while hydrating one browser-owned graph for the mounted application tree.

      Parameters

      Returns FunctionComponentElement<
          ProviderProps<
              | Omit<
                  Omit<StoreApi<GraphState>, "subscribe"> & {
                      subscribe: {
                          (
                              listener: (
                                  selectedState: GraphState,
                                  previousSelectedState: GraphState,
                              ) => void,
                          ): () => void;
                          <U>(
                              selector: (state: GraphState) => U,
                              listener: (selectedState: U, previousSelectedState: U) => void,
                              options?: {
                                  equalityFn?: (...) | (...);
                                  fireImmediately?: (...) | (...) | (...);
                              },
                          ): () => void;
                      };
                  },
                  "setState",
              > & {
                  setState(
                      nextStateOrUpdater:
                          | GraphState
                          | Partial<GraphState>
                          | (
                              (
                                  state: {
                                      appendListResult: (
                                          key: string,
                                          ids: string[],
                                          meta: Partial<Omit<(...), (...)>>,
                                      ) => void;
                                      clearEntitySyncMetadata: (type: string, id: string) => void;
                                      clearPatch: (type: string, id: string) => void;
                                      entities: { [x: string]: { [x: string]: { [x: ...]: ... } } };
                                      entityStates: {
                                          [x: string]: {
                                              error: (...) | (...);
                                              isFetching: boolean;
                                              lastFetched: (...) | (...);
                                              stale: boolean;
                                          };
                                      };
                                      ingestFetchedList: (
                                          type: string,
                                          entries: { data: ...; id: ... }[],
                                          options?: IngestFetchedListOptions,
                                      ) => void;
                                      insertIdInList: (
                                          key: string,
                                          id: string,
                                          position: number | "end" | "start",
                                      ) => void;
                                      invalidateEntity: (type: string, id?: string) => void;
                                      invalidateLists: (matcher: string | ((key: ...) => ...)) => void;
                                      invalidateType: (type: string) => void;
                                      lists: {
                                          [x: string]: {
                                              currentPage: (...) | (...);
                                              error: (...) | (...);
                                              hasNextPage: boolean;
                                              hasPrevPage: boolean;
                                              ids: (...)[];
                                              isFetching: boolean;
                                              isFetchingMore: boolean;
                                              lastError: (...) | (...) | (...);
                                              lastFetched: (...) | (...);
                                              nextCursor: (...) | (...);
                                              pageSize: (...) | (...);
                                              prevCursor: (...) | (...);
                                              stale: boolean;
                                              total: (...) | (...);
                                          };
                                      };
                                      patchEntity: (
                                          type: string,
                                          id: string,
                                          patch: Record<string, unknown>,
                                      ) => void;
                                      patches: { [x: string]: { [x: string]: { [x: ...]: ... } } };
                                      prependListResult: (
                                          key: string,
                                          ids: string[],
                                          meta?: Partial<(...)>,
                                      ) => void;
                                      readEntity: <T = Record<string, unknown>>(
                                          type: string,
                                          id: string,
                                      ) => T | null;
                                      readEntitySnapshot: <T = Record<string, unknown>>(
                                          type: string,
                                          id: string,
                                      ) => EntitySnapshot<(...)> | null;
                                      removeEntity: (type: string, id: string) => void;
                                      removeIdFromAllLists: (type: string, id: string) => void;
                                      replaceEntity: (
                                          type: string,
                                          id: string,
                                          data: Record<string, unknown>,
                                      ) => void;
                                      setEntityError: (
                                          type: string,
                                          id: string,
                                          error: string | null,
                                      ) => void;
                                      setEntityFetched: (type: string, id: string) => void;
                                      setEntityFetching: (
                                          type: string,
                                          id: string,
                                          fetching: boolean,
                                      ) => void;
                                      setEntityStale: (type: string, id: string, stale: boolean) => void;
                                      setEntitySyncMetadata: (
                                          type: string,
                                          id: string,
                                          metadata: Partial<EntitySyncMetadata>,
                                      ) => void;
                                      setListError: (
                                          key: string,
                                          error: string | null,
                                          typed?: EntityError | null,
                                      ) => void;
                                      setListFetching: (key: string, fetching: boolean) => void;
                                      setListFetchingMore: (key: string, fetchingMore: boolean) => void;
                                      setListResult: (
                                          key: string,
                                          ids: string[],
                                          meta: Partial<Omit<(...), (...)>>,
                                      ) => void;
                                      setListStale: (key: string, stale: boolean) => void;
                                      syncMetadata: {
                                          [x: string]: {
                                              origin: SyncOrigin;
                                              synced: boolean;
                                              updatedAt: (...) | (...);
                                          };
                                      };
                                      unpatchEntity: (type: string, id: string, keys: string[]) => void;
                                      upsertEntities: (
                                          type: string,
                                          entries: { data: ...; id: ... }[],
                                      ) => void;
                                      upsertEntity: (
                                          type: string,
                                          id: string,
                                          data: Record<string, unknown>,
                                      ) => void;
                                  },
                              ) => void
                          ),
                      shouldReplace?: false,
                  ): void;
                  setState(
                      nextStateOrUpdater:
                          | GraphState
                          | (
                              (
                                  state: {
                                      appendListResult: (
                                          key: string,
                                          ids: string[],
                                          meta: Partial<Omit<(...), (...)>>,
                                      ) => void;
                                      clearEntitySyncMetadata: (type: string, id: string) => void;
                                      clearPatch: (type: string, id: string) => void;
                                      entities: { [x: string]: { [x: string]: { [x: ...]: ... } } };
                                      entityStates: {
                                          [x: string]: {
                                              error: (...) | (...);
                                              isFetching: boolean;
                                              lastFetched: (...) | (...);
                                              stale: boolean;
                                          };
                                      };
                                      ingestFetchedList: (
                                          type: string,
                                          entries: { data: ...; id: ... }[],
                                          options?: IngestFetchedListOptions,
                                      ) => void;
                                      insertIdInList: (
                                          key: string,
                                          id: string,
                                          position: number | "end" | "start",
                                      ) => void;
                                      invalidateEntity: (type: string, id?: string) => void;
                                      invalidateLists: (matcher: string | ((key: ...) => ...)) => void;
                                      invalidateType: (type: string) => void;
                                      lists: {
                                          [x: string]: {
                                              currentPage: (...) | (...);
                                              error: (...) | (...);
                                              hasNextPage: boolean;
                                              hasPrevPage: boolean;
                                              ids: (...)[];
                                              isFetching: boolean;
                                              isFetchingMore: boolean;
                                              lastError: (...) | (...) | (...);
                                              lastFetched: (...) | (...);
                                              nextCursor: (...) | (...);
                                              pageSize: (...) | (...);
                                              prevCursor: (...) | (...);
                                              stale: boolean;
                                              total: (...) | (...);
                                          };
                                      };
                                      patchEntity: (
                                          type: string,
                                          id: string,
                                          patch: Record<string, unknown>,
                                      ) => void;
                                      patches: { [x: string]: { [x: string]: { [x: ...]: ... } } };
                                      prependListResult: (
                                          key: string,
                                          ids: string[],
                                          meta?: Partial<(...)>,
                                      ) => void;
                                      readEntity: <T = Record<string, unknown>>(
                                          type: string,
                                          id: string,
                                      ) => T | null;
                                      readEntitySnapshot: <T = Record<string, unknown>>(
                                          type: string,
                                          id: string,
                                      ) => EntitySnapshot<(...)> | null;
                                      removeEntity: (type: string, id: string) => void;
                                      removeIdFromAllLists: (type: string, id: string) => void;
                                      replaceEntity: (
                                          type: string,
                                          id: string,
                                          data: Record<string, unknown>,
                                      ) => void;
                                      setEntityError: (
                                          type: string,
                                          id: string,
                                          error: string | null,
                                      ) => void;
                                      setEntityFetched: (type: string, id: string) => void;
                                      setEntityFetching: (
                                          type: string,
                                          id: string,
                                          fetching: boolean,
                                      ) => void;
                                      setEntityStale: (type: string, id: string, stale: boolean) => void;
                                      setEntitySyncMetadata: (
                                          type: string,
                                          id: string,
                                          metadata: Partial<EntitySyncMetadata>,
                                      ) => void;
                                      setListError: (
                                          key: string,
                                          error: string | null,
                                          typed?: EntityError | null,
                                      ) => void;
                                      setListFetching: (key: string, fetching: boolean) => void;
                                      setListFetchingMore: (key: string, fetchingMore: boolean) => void;
                                      setListResult: (
                                          key: string,
                                          ids: string[],
                                          meta: Partial<Omit<(...), (...)>>,
                                      ) => void;
                                      setListStale: (key: string, stale: boolean) => void;
                                      syncMetadata: {
                                          [x: string]: {
                                              origin: SyncOrigin;
                                              synced: boolean;
                                              updatedAt: (...) | (...);
                                          };
                                      };
                                      unpatchEntity: (type: string, id: string, keys: string[]) => void;
                                      upsertEntities: (
                                          type: string,
                                          entries: { data: ...; id: ... }[],
                                      ) => void;
                                      upsertEntity: (
                                          type: string,
                                          id: string,
                                          data: Record<string, unknown>,
                                      ) => void;
                                  },
                              ) => void
                          ),
                      shouldReplace: true,
                  ): void;
              }
              | null,
          >,
      >