import type { CreateResult, FilterType, FindOptions, PartialResult, WithOptionalId } from '@furystack/core'; import type { Injector } from '@furystack/inject'; import { EventHub, type ListenerErrorPayload } from '@furystack/utils'; import type { DataSetSettings } from './data-set-setting.js'; /** * Authorization-enforcing wrapper around a {@link PhysicalStore}. The * recommended write gateway for application code — `furystack/no-direct-store-token` * enforces this. Each mutation runs the relevant `authorize*` and * `modify*` callbacks from {@link DataSetSettings}, persists, then emits * `onEntityAdded` / `onEntityUpdated` / `onEntityRemoved` (consumed by * entity sync, audit logs). * * Mutating methods take an `injector` parameter to surface caller identity * to the authorizers. For server-side / background work without an HTTP * request, wrap the injector with `useSystemIdentityContext` from * `@furystack/core`. * * @example * ```ts * await usingAsync( * useSystemIdentityContext({ injector, username: 'background-job' }), * async (systemInjector) => { * const dataSet = getDataSetFor(systemInjector, UserDataSet) * await dataSet.add(systemInjector, { username: 'alice', roles: [] }) * }, * ) * ``` */ export declare class DataSet> extends EventHub<{ onEntityAdded: { injector: Injector; entity: T; }; onEntityUpdated: { injector: Injector; id: T[TPrimaryKey]; change: Partial; }; onEntityRemoved: { injector: Injector; key: T[TPrimaryKey]; }; onListenerError: ListenerErrorPayload; }> implements Disposable { readonly settings: DataSetSettings; primaryKey: TPrimaryKey; add(injector: Injector, ...entities: TWritableData[]): Promise>; update(injector: Injector, id: T[TPrimaryKey], change: Partial): Promise; count(injector: Injector, filter?: FilterType): Promise; find>(injector: Injector, filter: FindOptions): Promise>>; get>(injector: Injector, key: T[TPrimaryKey], select?: TSelect): Promise | undefined>; /** * Removes by primary key. Pre-load `authorizeRemove` and per-entity * `authorizeRemoveEntity` are all-or-nothing — any rejection aborts the * whole batch before any persist call. When `authorizeRemoveEntity` is * configured, missing keys are silently forwarded to the physical store * (no entity to authorize). */ remove(injector: Injector, ...keys: Array): Promise; constructor(settings: DataSetSettings); } //# sourceMappingURL=data-set.d.ts.map