import { PropertyAccessor } from '@cratis/fundamentals'; import type { EventContext } from '../../events/EventContext.js'; import { CausedByProperty } from '../causedBy.js'; /** * Where the key of a dictionary entry comes from when a projection maps into a dictionary-typed read model property. * Pass a plain accessor on the event for the common case; use the factory methods for keys from the event content, * the event context or the identity that caused the event. */ export declare class DictionaryKey { readonly expression: string; private constructor(); /** * The key is read from a property of the event content. Nested paths are supported; the kernel requires the * property to exist on the event (case-sensitively) and an event without a value for it leaves the dictionary as it is. * @param eventPropertyAccessor - Accessor for the event property holding the key. * @returns The dictionary key. */ static fromEventContent(eventPropertyAccessor: PropertyAccessor): DictionaryKey; /** * The key is read from the event context, for instance `eventSourceId` or `causedBy.subject`. * @param contextProperty - The event context property name, or an accessor on the {@link EventContext}. * @returns The dictionary key. */ static fromEventContext(contextProperty: string | PropertyAccessor): DictionaryKey; /** * The key is a member of the identity that caused the event. * @param property - The identity member: `subject`, `name` or `userName`. * @returns The dictionary key. */ static causedBy(property: CausedByProperty): DictionaryKey; } /** A dictionary key: an accessor on the event (the key is read from the event content) or a {@link DictionaryKey}. */ export type DictionaryKeySource = PropertyAccessor | DictionaryKey; /** * Resolves a dictionary key source to its {@link DictionaryKey}. * @param key - The key source. * @returns The dictionary key. */ export declare function toDictionaryKey(key: DictionaryKeySource): DictionaryKey; /** * Builds the target property path of a dictionary entry: `.`, for example * `slots.$eventContent.category`. * @param dictionaryProperty - The dictionary-typed read model property. * @param key - Where the key of the entry comes from. * @returns The dynamic property path the kernel resolves per event. */ export declare function dictionaryEntryPath(dictionaryProperty: string, key: DictionaryKeySource): string; //# sourceMappingURL=DictionaryKey.d.ts.map