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

    Interface ReconcilingDatabase<C, R, A, TD>

    interface ReconcilingDatabase<
        C extends Components,
        R extends ResourceComponents,
        A extends ArchetypeComponents<StringKeyof<C>>,
        TD extends TransactionDeclarations<C, R, A>,
    > {
        apply: (
            envelope: TransactionEnvelope<Extract<keyof TD, string>>,
        ) => undefined | TransactionResult<C>;
        archetypes: {
            readonly [K in string]: ReadonlyArchetype<
                { [Col in string]: (C & OptionalComponents)[Col] },
            >
        };
        cancel: (id: number, userId?: string | number) => void;
        componentSchemas: { readonly [K in string]: Schema.Schema };
        execute: (
            handler: (ctx: Store<C, R, A>) => number | void,
            options?: { transient?: boolean; userId?: string | number },
        ) => TransactionResult<C>;
        extend: <
            P extends Database.Plugin<any, any, any, any, any, any, any, any, any>,
        >(
            plugin: P,
        ) => ReconcilingDatabase<
            C & (
                P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                    ? FromSchemas<XC>
                    : never
            ),
            R & (
                P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                    ? FromSchemas<XR>
                    : never
            ),
            A & (
                P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                    ? XA
                    : never
            ),
            TD & (
                P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                    ? XTD
                    : never
            ),
        >;
        fromData: (data: unknown, scope?: PersistenceScope) => void;
        indexes: {};
        locate: (
            entity: number,
        ) => null | { archetype: ReadonlyArchetype; row: number };
        observe: {
            components: { readonly [K in string]: Observe<void> };
            resources: { readonly [K in string]: Observe<R[K]> };
            transactions: Observe<TransactionResult<C>>;
            archetype(id: number): Observe<void>;
            count<Include extends string, T extends string>(
                include: ReadonlySet<string> | readonly Include[],
                options?: any,
            ): Observe<number>;
            entity<T>(
                id: number,
                minArchetype?: ReadonlyArchetype<T> | Archetype<T, never>,
            ): Observe<null | Readonly<T> & EntityReadValues<C>>;
            entity(id: number): Observe<null | EntityReadValues<C>>;
            select<Include extends string, T extends string>(
                include: ReadonlySet<string> | readonly Include[],
                options?: any,
            ): Observe<readonly number[]>;
        };
        pruneToSchema: (keep: ReadonlySet<string>) => void;
        reset: () => void;
        resources: { readonly [K in string]: R[K] };
        toData: (options?: ToDataOptions) => unknown;
        count<Include extends string>(
            include: ReadonlySet<string> | readonly Include[],
            options?: EntitySelectOptions<
                C & OptionalComponents,
                Pick<C & RequiredComponents & OptionalComponents, Include>,
            >,
        ): number;
        derive<T>(compute: (db: any) => T): Observe<T>;
        derive<I extends Record<string, Observe<unknown>>, T>(
            inputs: I,
            compute: (
                db: any,
                inputs: {
                    readonly [K in string | number | symbol]: I[K] extends Observe<U>
                        ? U
                        : never
                },
            ) => T,
        ): Observe<T>;
        ensureArchetype<const CC extends string>(
            components: ReadonlySet<CC> | readonly CC[],
        ): ReadonlyArchetype<{ [K in string]: (C & OptionalComponents)[K] }>;
        ensureArchetype<const CC extends string>(
            components: ReadonlySet<CC> | readonly CC[],
            partitionValues: { readonly [K in never]: (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, never>,
        ): 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[];
    }

    Type Parameters

    Hierarchy

    Index

    Properties

    apply: (
        envelope: TransactionEnvelope<Extract<keyof TD, string>>,
    ) => undefined | TransactionResult<C>
    archetypes: {
        readonly [K in string]: ReadonlyArchetype<
            { [Col in string]: (C & OptionalComponents)[Col] },
        >
    }
    cancel: (id: number, userId?: string | number) => void
    componentSchemas: { readonly [K in string]: Schema.Schema }
    execute: (
        handler: (ctx: Store<C, R, A>) => number | void,
        options?: { transient?: boolean; userId?: string | number },
    ) => TransactionResult<C>
    extend: <P extends Database.Plugin<any, any, any, any, any, any, any, any, any>>(
        plugin: P,
    ) => ReconcilingDatabase<
        C & (
            P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                ? FromSchemas<XC>
                : never
        ),
        R & (
            P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                ? FromSchemas<XR>
                : never
        ),
        A & (
            P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                ? XA
                : never
        ),
        TD & (
            P extends Database.Plugin<XC, XR, XA, XTD, any, any, any, any, any>
                ? XTD
                : never
        ),
    >
    fromData: (data: unknown, scope?: PersistenceScope) => void
    indexes: {}
    locate: (entity: number) => null | { archetype: ReadonlyArchetype; row: number }
    observe: {
        components: { readonly [K in string]: Observe<void> };
        resources: { readonly [K in string]: Observe<R[K]> };
        transactions: Observe<TransactionResult<C>>;
        archetype(id: number): Observe<void>;
        count<Include extends string, T extends string>(
            include: ReadonlySet<string> | readonly Include[],
            options?: any,
        ): Observe<number>;
        entity<T>(
            id: number,
            minArchetype?: ReadonlyArchetype<T> | Archetype<T, never>,
        ): Observe<null | Readonly<T> & EntityReadValues<C>>;
        entity(id: number): Observe<null | EntityReadValues<C>>;
        select<Include extends string, T extends string>(
            include: ReadonlySet<string> | readonly Include[],
            options?: any,
        ): Observe<readonly number[]>;
    }
    pruneToSchema: (keep: ReadonlySet<string>) => void
    reset: () => void
    resources: { readonly [K in string]: R[K] }
    toData: (options?: ToDataOptions) => unknown

    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.

    Methods

    • Type Parameters

      • T

      Parameters

      • compute: (db: any) => T

      Returns Observe<T>

    • Type Parameters

      • I extends Record<string, Observe<unknown>>
      • T

      Parameters

      • inputs: I
      • compute: (
            db: any,
            inputs: {
                readonly [K in string | number | symbol]: I[K] extends Observe<U>
                    ? U
                    : never
            },
        ) => T

      Returns Observe<T>

    • 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>