UNPKG

@proofkit/fmodata

Version:

FileMaker OData API client

46 lines (45 loc) 1.95 kB
import { InternalLogger } from '../../logger.js'; import { FMTable } from '../../orm/table.js'; import { ExpandValidationConfig } from '../../validation.js'; import { ExpandConfig } from './shared-types.js'; /** * Builds OData expand query strings and validation configs. * Handles nested expands recursively and transforms relation names to FMTIDs * when using entity IDs. */ export declare class ExpandBuilder { private readonly useEntityIds; private readonly logger; constructor(useEntityIds: boolean, logger: InternalLogger); /** * Builds OData $expand query string from expand configurations. */ buildExpandString(configs: ExpandConfig[]): string; /** * Builds validation configs for expanded navigation properties. */ buildValidationConfigs(configs: ExpandConfig[]): ExpandValidationConfig[]; /** * Process an expand() call and return the expand config. * Used by both QueryBuilder and RecordBuilder to eliminate duplication. * * @param targetTable - The target table to expand to * @param sourceTable - The source table (for validation) * @param callback - Optional callback to configure the expand query * @param builderFactory - Function that creates a QueryBuilder for the target table * @returns ExpandConfig to add to the builder's expandConfigs array */ processExpand<TargetTable extends FMTable<any, any>, Builder = any>(targetTable: TargetTable, sourceTable: FMTable<any, any> | undefined, callback?: (builder: Builder) => Builder, builderFactory?: () => Builder): ExpandConfig; /** * Builds a single expand string with its options. */ private buildSingleExpand; /** * Resolves relation name, using FMTID if entity IDs are enabled. */ private resolveRelationName; /** * Builds expand parts (select, filter, orderBy, etc.) for a single expand. */ private buildExpandParts; }