@adobe/data - v0.10.30
    Preparing search index...

    Interface ReadonlyStore<C, R, A, IX, PK, DFK>

    interface ReadonlyStore<
        C extends Components = never,
        R extends ResourceComponents = never,
        A extends ArchetypeComponents<StringKeyof<C>> = never,
        IX extends IndexDeclarations<C> = {},
        PK extends string = never,
        DFK extends string = never,
    > {
        archetypes: {
            readonly [K in string]: ArchetypeOrRouter<
                HasPartitionKey<A[K][number], PK>,
                { [Col in string]: (C & OptionalComponents)[Col] },
                ReadonlyArchetype<{ [Col in string]: (C & OptionalComponents)[Col] }>,
                Extract<A[K][number], DFK>,
            >
        };
        componentSchemas: { readonly [K in string]: Schema.Schema };
        indexes: { readonly [K in string | number | symbol]: Handle<C, IX[K]> };
        locate: (
            entity: number,
        ) => null | { archetype: ReadonlyArchetype; row: number };
        resources: { readonly [K in string]: R[K] };
        count<Include extends string>(
            include: ReadonlySet<string> | readonly Include[],
            options?: EntitySelectOptions<
                C & OptionalComponents,
                Pick<C & RequiredComponents & OptionalComponents, Include>,
            >,
        ): number;
        ensureArchetype<const CC extends string>(
            components: ReadonlySet<CC> | readonly CC[],
        ): HasPartitionKey<CC, PK> extends true
            ? Router<
                { [K in string]: (C & OptionalComponents)[K] },
                Extract<CC, DFK>,
            >
            : ReadonlyArchetype<{ [K in string]: (C & OptionalComponents)[K] }>;
        ensureArchetype<const CC extends string>(
            components: ReadonlySet<CC> | readonly CC[],
            partitionValues: { readonly [K in string]: (C & OptionalComponents)[K] },
        ): ReadonlyArchetype<{ [K in string]: (C & OptionalComponents)[K] }>;
        get<K extends string>(entity: number, component: K): undefined | C[K];
        queryArchetypes<Include extends string>(
            include: ReadonlySet<string> | readonly Include[],
            options?: ArchetypeQueryOptions<C, PK>,
        ): readonly ReadonlyArchetype<Pick<C & OptionalComponents, Include>>[];
        read<T>(
            entity: number,
            archetype: ReadonlyArchetype<T> | Archetype<T, never>,
        ): null | Readonly<T>;
        read<const K extends string | number | symbol>(
            entity: number,
            components: readonly K[],
        ): null | Readonly<Pick<EntityReadValues<C>, K>>;
        read(entity: number): null | EntityReadValues<C>;
        select<Include extends string>(
            include: ReadonlySet<string> | readonly Include[],
            options?: EntitySelectOptions<
                C & OptionalComponents,
                Pick<C & RequiredComponents & OptionalComponents, Include>,
            >,
        ): readonly number[];
        toData(options?: ToDataOptions): unknown;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    archetypes: {
        readonly [K in string]: ArchetypeOrRouter<
            HasPartitionKey<A[K][number], PK>,
            { [Col in string]: (C & OptionalComponents)[Col] },
            ReadonlyArchetype<{ [Col in string]: (C & OptionalComponents)[Col] }>,
            Extract<A[K][number], DFK>,
        >
    }
    componentSchemas: { readonly [K in string]: Schema.Schema }
    indexes: { readonly [K in string | number | symbol]: Handle<C, IX[K]> }
    locate: (entity: number) => null | { archetype: ReadonlyArchetype; row: number }
    resources: { readonly [K in string]: R[K] }

    Methods

    • Type Parameters

      • K extends string

      Parameters

      • entity: number
      • component: K

      Returns undefined | C[K]

    • Read exactly the components of archetype. A membership GATE: returns null unless the entity is a superset of archetype. The result is narrowed to the archetype's own row — reading a component outside archetype off the result is a compile error (use a wider archetype, the component-list overload, or read(entity)).

      Type Parameters

      • T

      Parameters

      Returns null | Readonly<T>

    • Read a chosen subset of an entity's components.

      A pure PROJECTION, not a membership gate: returns null only when the entity does not exist. A requested component the entity does not have comes back absent — the field stays optional in the result, exactly as from the full read(entity).

      Prefer this over read(entity) when only a few fields are needed: it names the exact components touched, so db.derive can scope its recompute to just those fields instead of the whole entity. id is not a readable component (you already hold it); the element type is inferred as a literal union.

      Type Parameters

      • const K extends string | number | symbol

      Parameters

      • entity: number
      • components: readonly K[]

      Returns null | Readonly<Pick<EntityReadValues<C>, K>>

    • Parameters

      • entity: number

      Returns null | EntityReadValues<C>

    • Serialize the store to a plain snapshot. When copy is true the snapshot is detached from the live store (column/entity buffers are copied) so it remains valid after subsequent mutations; otherwise it references live buffers and is only valid until the next mutation. See Database.toData() for the bug this copy flag addresses for transient-bearing strategies.

      options.scope selects which persistent quadrants to emit; omit for all.

      Parameters

      Returns unknown