/** * Literal value prefix used in navigation key parts. * When a key part starts with this prefix, it's a raw SQL literal (e.g. "5", "TRUE") * rather than a column name. */ export declare const LITERAL_PREFIX = "__LIT:"; /** * Format a join value as either a quoted column reference or a raw literal. * @param alias Table alias for column references * @param value Column name or "__LIT:value" for literals */ export declare function formatJoinValue(alias: string, value: string): string; /** * Check if a key part is a literal value (not a column reference). */ export declare function isLiteralKeyPart(value: string): boolean; /** * Build the literal-only filter predicates from a navigation's composite FK/match * arrays. Used by strategies that DO NOT carry a source-table reference inside * the collection subquery (e.g. CTE, temptable). In those strategies the * parent-child column equality is materialised via parent_id grouping / JOIN, * so we only need to emit the navigation's CONSTANT predicates (e.g. * `target.is_current = true`) as WHERE filters on the target rows. * * A pair `(fk[i], match[i])` is considered a literal predicate when: * - `match[i]` is a literal (`__LIT:value`) AND `fk[i]` is a column. * Emits: `""."" = `. * - both sides are literals. Emits: ` = ` (degenerate). * - `fk[i]` is a literal AND `match[i]` is a column. Skipped — the source * table isn't available inside the subquery; this shape isn't expressible * here and shouldn't be configured for a hasMany navigation. * * Column-on-both-sides pairs (i.e. real composite-column FKs) are NOT emitted * by this helper — they are handled upstream via the strategy's existing * `parent_id`-grouping / JOIN mechanism. * * @param targetAlias Alias of the target/child table inside the subquery. * @param foreignKeys Composite FK columns on the target side (may include `__LIT:`). * @param matches Match-key columns on the source side (may include `__LIT:`). */ export declare function buildLiteralOnlyPredicates(targetAlias: string, foreignKeys: string[] | undefined, matches: string[] | undefined): string[]; /** * Build the parent-child correlation predicate for a collection projection, * supporting composite keys and literal-value (constant) FK predicates. * * Iterates `foreignKeys` × `matches` in lock-step. Each pair becomes a single * ` = ` clause via `formatJoinValue`, then all pairs are AND-ed. * * Examples * -------- * Simple single column: `[fk] × [match]` * `""."" = "".""` * * SCD2 constant FK (the bug case): * foreignKeys: ['product_id', 'is_current'] * matches: ['id', '__LIT:true'] * * pair 0 → `""."product_id" = ""."id"` * pair 1 → `""."is_current" = true` * → final: `""."product_id" = ""."id" AND ""."is_current" = true` * * If `foreignKeys` is empty (legacy single-column form), the caller is expected * to fall back to the simple `fkAlias.fk = sourceAlias.match` form. This helper * itself returns an empty string in that case. * * @param fkAlias Alias to qualify foreign-key columns on the child/target side. * @param sourceAlias Alias to qualify match columns on the parent/source side. * @param foreignKeys Composite FK columns on the child/target side; may include `__LIT:` markers. * @param matches Composite match-key columns on the parent/source side; may include `__LIT:` markers. */ export declare function buildCollectionCorrelationWhere(fkAlias: string, sourceAlias: string, foreignKeys: string[], matches: string[]): string; //# sourceMappingURL=join-utils.d.ts.map