dyna-record
    Preparing search index...

    Type Alias TypedFilterParams<T>

    The filter a query on T accepts: conditions on the attributes of T and of every entity in its partition, combined with AND, plus $or blocks.

    It is a union with one member per partition entity, keyed by a single type, plus members for a type array and for no type at all, so naming one entity's type limits the block to that entity's attributes. Alias for FilterParamsForEntities applied to PartitionEntities.

    Reusing a filter. A query narrows its results by the filter's literal type: the type it names, its keys and its $or blocks. A filter written at the call has that type, and so does one checked with satisfies TypedFilterParams<T>, which also gets every check a literal at the call gets. A filter whose type is this annotation (a function parameter, an object property) is accepted too, but the annotation widens it to the whole union, so the query cannot narrow by it and returns the whole partition.

    Beside an skCondition that names an entity, the query accepts only SKScopedFilterParams for that sort key condition: a value typed TypedFilterParams<T> is refused there, because it also offers other entities' keys and type values that cannot match the rows the sort key selects.

    Type Parameters

    • T extends default

      The entity being queried.

    const ordersIn2026 = {
    type: "Order",
    orderDate: { $gte: new Date("2026-01-01") }
    } satisfies TypedFilterParams<Customer>;

    const orders = await Customer.query("123", { filter: ordersIn2026 });
    // orders is Array<EntityAttributesInstance<Order>>
    async function customerRecords(filter: TypedFilterParams<Customer>) {
    // QueryResults<Customer>: the whole partition
    return await Customer.query("123", { filter });
    }