import type { CollectionConfig, VirtualRowProps } from '@tanstack/react-db'; import type { StandardSchemaV1 } from '@standard-schema/spec'; import type { Effect } from 'effect'; import type { DecodedEntity, EntityMetaSchema, DecodedSingleEntity } from '../../../core/index.js'; import type { AnyESchema, AnyEntityESchema, ESchemaIdField } from '../../../eschema/index.js'; /** * TanStack DB row form of an entity: value fields hoisted to the top level with * meta nested under `_meta`, plus the runtime virtual props ($synced, $origin). * * Virtual props are added at runtime by @tanstack/db on every read, but the * `useLiveQuery(() => collection)` overload types `data` as the bare item type and * drops them. The props are optional so they surface on reads without being * required on writes. The collection schema validates this latest decoded shape. */ export type CollectionItem = T & { _meta?: typeof EntityMetaSchema.Type; } & Partial>; export type CollectionItemSchema = StandardSchemaV1, CollectionItem>; export declare const makeCollectionItemSchema: (schema: S) => CollectionItemSchema; /** * An old→new cursor fetch source. A worker or repair capability declares one * only when it consumes that direction. */ export type ForwardFetch = (ctx: { cursor: DecodedEntity | null; }) => Effect.Effect[], E, R>; /** * Pass-through TanStack collection options, with the fields the engine owns * (id, getKey, schema, sync wiring, mutation handlers, utils) removed. */ export type StdCollectionOptions = Omit, string>, 'id' | 'getKey' | 'schema' | 'syncMode' | 'sync' | 'rowUpdateMode' | 'onInsert' | 'onUpdate' | 'onDelete' | 'utils'>; /** * Payload for a keyed update: the complete value before the mutation plus the * partial updates (the id field itself excluded from the updatable fields). */ export type UpdatePayload = { current: TItem; updates: Partial>>; }; export type DeletePayload = { current: TItem; }; export type UpdateChanges = UpdatePayload['updates']; export declare const stripMeta: (item: CollectionItem) => TItem; export declare const stripMetaPartial: (item: Partial>) => Partial; export declare const toEntity: (entity: DecodedSingleEntity) => DecodedEntity; //# sourceMappingURL=collection-item.d.ts.map