import { DataContainer, Reference, AggregatedReference, DerivedReference, GroupedRefeference, ResolvedReference, ListItem, ModelDefinition, Property, PropertyAggregate, ValueMappingConfig, ModelMetadata, IndicesController, ChangeDetector, AutoGeneratePropertiesOption, ModelQualityConfig, AttributeQualityConfig, ValidatorErrorType, QueryReference } from '@dcupl/common'; import { ModelParser } from '../index.js'; export declare const EntryMetadataValues: { REF_VALUE: string; }; export type ValidatorReturnValue = { isValid: boolean; type: ValidatorErrorType; }; export declare class DcuplModel { private modelParser; properties: Map; references: Map; attributeQualityConfigs: Map; key: string; private log; initialDefinition: ModelDefinition; private data; supportsAutoCreation: boolean; autoGenerateKey: boolean; autoGenerateProperties: boolean; autoGeneratePropertiesOption: AutoGeneratePropertiesOption; keyProperty: string | readonly string[]; keyPropertySeparator?: string; valueMappings: ValueMappingConfig[]; meta?: ModelMetadata | undefined; qualityConfig: ModelQualityConfig; indicesController: IndicesController; cdRef: ChangeDetector; private groupedRefReverseIndex; private pendingItemKeys; constructor(modelParser: ModelParser); init(modelDefinition: ModelDefinition): void; /** * Drops what the previous definition set (attributes and their quality configs, the model's * quality config), so `init` + `applyPropertiesAndReferences` build the model from a replaced * definition as for a new model, while lists keep this instance (#408). */ resetDefinition(): void; applyPropertiesAndReferences(modelDefinition: ModelDefinition): void; private setAttributeQualityConfig; getModelDefinition(): ModelDefinition; generatePropertiesFromContainer(container: DataContainer): void; private getReferenceKeys; /** A definition error init re-detects on every run (#417); same gate as `setError`. */ private setDefinitionError; private sharedErrorDescriptions; private sharedErrorDescription; /** * Sets a validation error for this model. * Requires both global quality controller AND model-specific quality to be enabled. */ private setError; /** * Emit one `UnknownColumn` error per (model, attribute) for columns in the * source that are NOT declared on the model. The data for those columns is * silently dropped during ingest — this surfaces that data loss without * failing the load. See dcupl#183. */ private emitUnknownColumnErrors; /** * Coerces and validates one basic property of a raw row and stores it on * `dataEntry`. Returns whether a value was stored — `false` when the raw * value is missing or the coercion or a strict validator rejects it. */ private processBasicProperty; private handleValidators; private getWrongDataTypeError; /** * Detects a lossy numeric coercion: the raw value was successfully coerced to a * number, but information was silently dropped — either trailing/embedded * non-numeric content (e.g. "1.2 lbs" → 1.2) or fractional truncation for int * properties (e.g. "1.2" → 1). Representation-only differences that preserve the * value (leading zeros, trailing zeros, surrounding whitespace, "4.0" → 4) are * not considered lossy. */ private isLossyNumericCoercion; private getLossyCoercionError; private getValueAsArray; private processStringProperty; private processIntProperty; private processFloatProperty; private processJSONProperty; /** * A boolean is kept as is. A string follows {@link parseBooleanString}: 'true'/'false'/'1'/'0' * (case-insensitive) become booleans, any other string is a WrongDataType and the value stays * undefined (#364). Numbers are strict too: 1 and 0 become true and false, any other number is a * WrongDataType. Any other value, such as an object or an array, is a WrongDataType as well (#402). * With `forceStrictDataType` only real booleans pass. */ private processBooleanProperty; private processDateProperty; /** The NullValue error of a non-nullable reference with an explicit null, as for a property (#215). */ private getNullReferenceError; private processSingleValuedReference; private processMultiValuedReference; getViewKeys(): string[]; /** * Records one `NonUniqueKey` per row that a later row with the same key * replaced in the container's `set` payload. ModelParser dedupes the rows * before processing (the last row wins as a whole) and keeps the replaced * keys beside the container, so every full apply reports them again (#369). */ private emitNonUniqueKeyErrors; /** Whether `remoteModel` holds the item `key`, or is about to within this model's step-1 pass (#411). */ private hasRemoteEntry; /** * The keys of the given rows when this model has a basic reference to * itself, for `pendingItemKeys` (#411); `undefined` otherwise. */ getPendingItemKeys(rows: ListType[]): Set | undefined; addBasicPropertiesAndReferences(container: DataContainer): void; addQueryReferences(container: DataContainer): void; private isValidValueMapping; private mapRawValueUsingValueMapping; private handleAutoCreationAndReturnKey; private addContainer; addResolvedReferences(container: DataContainer): void; /** * Rebuilds resolved references for ALL items in this model * Used in partial updates when source references change * @param specificReferences - Optional set of specific reference keys to rebuild */ rebuildResolvedReferencesForAllItems(specificReferences?: Set): void; addDerivedReferencesGroupedReferencesDerivedPropertiesAndExpressionProperties(container: DataContainer): void; private handleDerivedProperties; reRunDerivedPropertiesBasedOnResolves(container: DataContainer): void; private handleSingleValuedDerivedProperties; private handleMultiValuedDerivedProperties; private handleDerivedReferences; private asStringArray; private buildReverseIndexForReference; private ensureReverseIndex; private handleGroupedReferences; resetData(): void; resetIndexMap(): void; /** * Drops model-level indices derived from the given attributes after a * partial update (#243): lazily built plain indices (facets/pivot * fallback), context-hashed indices (aggregate/sections/suggest) and * deep-query indices are built from data a partial update silently * invalidates — the next read rebuilds them from current data. A * reference's plain index stays: it is maintained eagerly during * processing, and the generic lazy rebuild cannot reproduce its shape. * * Which attribute an index belongs to comes from the indices controller's * record, not from the index name: cutting `the_customer.country_` * at `_` reads `the`, and `price` matched `price_net` (#358). */ resetIndicesForChangedAttributes(attributeKeys: Set): void; deleteDataEntries(data: DataContainer): void; getItemCount(): number; getAttributes(): (Reference | Property)[]; getAttribute(key: string): Reference | Property | undefined; getReferencesRelevantForDependencyGraph(): Reference[]; getBasicReferences(): Reference[]; getQueryReferences(): QueryReference[]; getResolvedReferences(): ResolvedReference[]; getGroupedReferences(): GroupedRefeference[]; getDerivedReferences(): DerivedReference[]; getAggregatedReferences(): AggregatedReference[]; getBasicProperties(): Property[]; getDerivedProperties(): Property[]; getDerivedPropertiesForBasicAndDerivedReferences(): Property[]; getDerivedPropertiesForResolvedReferences(): Property[]; getDerivedReferencesForResolvedReferences(): DerivedReference[]; getExpressionProperties(): Property[]; getAggregatedProperties(): PropertyAggregate[]; hasBasicReferences(): boolean; hasQueryReferences(): boolean; hasResolvedReferences(): boolean; hasGroupedReferences(): boolean; hasDerivedReferences(): boolean; hasBasicProperties(): boolean; hasDerivedProperties(): boolean; hasDerivedPropertiesForBasicReferences(): boolean; hasDerivedPropertiesBasedOnResolvedReferences(): boolean; hasDerivedReferencesBasedOnResolvedReferences(): boolean; hasExpressionProperties(): boolean; hasAggregatedProperties(): boolean; getData(options?: { itemKeys: string[]; }): Map; getDataAsArray(): ListType[]; getEntry(key: string): ListType | undefined; private setRefValue; /** * Processes only specific basic properties and references (Step 1) * @param container - Data container to process * @param attributesToProcess - Set of attribute keys to process */ addBasicPropertiesAndReferencesPartial(container: DataContainer, attributesToProcess: Set, pendingItemKeys?: Set | undefined): void; /** * Processes only specific query and resolved references (Step 2) * @param container - Data container to process * @param attributesToProcess - Set of attribute keys to process */ addQueryAndResolvedReferencesPartial(container: DataContainer, attributesToProcess: Set): void; /** * Creates an expanded context object for expression evaluation * Resolves references so expressions can access nested properties like productRef.baseCost */ private createExpressionContext; /** * Helper to recursively expand nested references (up to one level deep to avoid infinite recursion) */ private createNestedContext; /** * Processes only specific derived/grouped references and derived/expression properties (Step 3) * @param container - Data container to process * @param attributesToProcess - Set of attribute keys to process */ addDerivedAndExpressionAttributesPartial(container: DataContainer, attributesToProcess: Set): void; /** * Re-runs only specific derived properties based on resolved references (Step 4) * @param container - Data container to process * @param attributesToProcess - Set of attribute keys to process */ reRunDerivedPropertiesBasedOnResolvesPartial(container: DataContainer, attributesToProcess: Set): void; }