import { Item } from "../item"; import { ComKey, LocKeyArray, PriKey } from "../key"; import { ItemQuery } from "../query/ItemQuery"; import { AffectedKeys, OperationParams } from "./Operations"; /** * Specialized Operations Interfaces * * This file contains operation interfaces for specific usage patterns. * These are primarily used in UI layers (like React providers) to group * operations by their usage pattern rather than data structure. * * For core architectural patterns (Primary vs. Contained), see: * - primary.ts - Operations for top-level items * - contained.ts - Operations for hierarchical items */ /** * Collection-focused operations interface. * Optimized for working with groups of items. * Used by React providers for array/list contexts. */ export interface CollectionOperations, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> { all(query?: ItemQuery, locations?: LocKeyArray | []): Promise; one(query?: ItemQuery, locations?: LocKeyArray | []): Promise; find(finder: string, params?: OperationParams, locations?: LocKeyArray | []): Promise; findOne(finder: string, params?: OperationParams, locations?: LocKeyArray | []): Promise; create(item: Partial>, locations?: LocKeyArray | []): Promise; allAction(action: string, params?: OperationParams, locations?: LocKeyArray | []): Promise<[V[], AffectedKeys]>; allFacet(facet: string, params?: OperationParams, locations?: LocKeyArray | []): Promise; } /** * Instance-focused operations interface. * Optimized for working with a single specific item. * Used by React providers for single-item contexts. */ export interface InstanceOperations, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> { get(key: PriKey | ComKey): Promise; update(key: PriKey | ComKey, item: Partial>): Promise; remove(key: PriKey | ComKey): Promise; action(key: PriKey | ComKey, action: string, params?: OperationParams): Promise<[V, AffectedKeys]>; facet(key: PriKey | ComKey, facet: string, params?: OperationParams): Promise; }