/** * This module contains the TypeScript definitions of a Graph Query * and functions to build those filters based on path, * preview parameters, etc. * * This is used internally in the SDK */ export type GraphVariationInput = { include: 'NONE'; } | { include: 'ALL'; } | { include: 'SOME'; value: string[]; includeOriginal?: boolean; }; export type FilterShape = 'by-key' | 'by-path'; export type ScalarFilter = { filterShape: FilterShape; variables: Record; }; export type VariationMode = 'none' | 'all' | { count: number; includeOriginal?: boolean; }; export declare function pathScalarFilter(path: string, host?: string): ScalarFilter; export declare function previewScalarFilter(params: { key: string; ver: string; loc: string; }): ScalarFilter; /** * Converts a BCP-47 locale to the `Locales` enum's identifier syntax, in the * casing the enum uses: `en-BE` and `en-be` both become `en_BE`. * * A tag without subtags is left alone, so `ALL` and `NEUTRAL` survive. */ export declare function toLocaleEnumValues(locales?: string[]): string[] | undefined; /** * The filter identifying one content item by key. * * The locale goes to the `locale:` field argument, not to a `_metadata.locale` * predicate, which would exclude language fallbacks. */ export declare function referenceScalarFilter(reference: { key: string; locale?: string; version?: string; }): ScalarFilter; export declare function getVariationMode(variation?: GraphVariationInput): VariationMode; export declare function getVariationVariables(variation?: GraphVariationInput): Record; export declare function getFilterVarDecls(shape: FilterShape): string; /** * The `locale:` field argument, which resolves language fallback. Always * emitted: a null `$locale` means "any locale", so one query template covers * both the localized and the locale-agnostic lookup. */ export declare const LOCALE_CLAUSE = ", locale: $locale"; /** * The `where` argument identifying the content a query is about. * * @param publishedOnly - Narrow to content whose `_metadata.status` is `Published`. * @param extra - Further predicates to combine with the identity filter. */ export declare function getFilterWhereClause(shape: FilterShape, publishedOnly?: boolean, extra?: string[]): string; export declare function getVariationVarDecls(mode: VariationMode): string; export declare function getVariationClause(mode: VariationMode): string;