import type { AnyCustomObjectDefinition, FieldNames, FieldValue, LookupReference } from "./types.mjs"; declare const STANDARD_RQL_FIELD_NAMES: readonly ["id", "name", "created_at", "updated_at", "system_updated_at", "external_id", "owner_role", "created_by", "last_modified_by"]; type StandardRqlFieldValueByName = { id: string; name: string; created_at: string | null; updated_at: string | null; system_updated_at: string | null; external_id: string | null; owner_role: LookupReference<'Employee'> | null; created_by: LookupReference<'Employee'> | null; last_modified_by: LookupReference<'Employee'> | null; }; /** * Standard field-name strings exposed by the typed RQL helper. * * @typeParam TDefinition - Object definition whose standard fields should be exposed. */ export type StandardRqlFieldName = (typeof STANDARD_RQL_FIELD_NAMES)[number]; /** * Field-name strings accepted by the typed RQL helper. * * @typeParam TDefinition - Object definition whose field-name union should be exposed. */ export type RqlFieldName = StandardRqlFieldName | FieldNames; /** * Field token used by the RQL helper to preserve type information across string compilation. * * @typeParam TValue - Runtime value type stored in the field. * @typeParam TApiName - Wire-level field api name used when rendering RQL. */ export interface RqlFieldToken { readonly kind: 'rql-field-token'; readonly apiName: TApiName; readonly logicalName: string; readonly __valueType__?: TValue; } /** * Opaque RQL fragment that can be interpolated into {@link CustomObjectRqlHelpers.rql}. */ export interface RqlFragment { readonly kind: 'rql-fragment'; readonly text: string; } /** * Scope object whose properties autocomplete to the standard and custom fields available on one object definition. * * @typeParam TDefinition - Object definition whose field tokens should be exposed. */ export type RqlFieldScope = { readonly [K in StandardRqlFieldName]: RqlFieldToken; } & { readonly [K in FieldNames]: RqlFieldToken, TDefinition['fields'][K] extends { apiName: infer TApiName extends string; } ? TApiName : string>; }; /** * Input that the RQL helper knows how to encode as a literal value. */ export type RqlValue = string | number | boolean | null | LookupReference | readonly RqlValue[]; /** * Runtime surface returned by {@link createRqlHelpers}. * * @typeParam TDefinition - Object definition whose field tokens should be exposed. */ export interface CustomObjectRqlHelpers { /** Object-scoped field tokens used for IntelliSense-friendly property access. */ readonly fields: RqlFieldScope; /** Converts a field-name string into a typed field token. */ field>(fieldName: TFieldName): RqlFieldScope[TFieldName]; /** Renders a tagged template into a backend-ready RQL string. */ rql(strings: TemplateStringsArray, ...values: readonly RqlInterpolation[]): string; /** Renders a fragment built by helper functions into a string. */ render(fragment: RqlFragment): string; /** Wraps a raw RQL snippet as a fragment. Use sparingly. */ raw(text: string): RqlFragment; /** Builds an equality comparison fragment. */ eq(field: RqlFieldToken, value: RqlComparableValue | null): RqlFragment; /** Builds an inequality comparison fragment. */ ne(field: RqlFieldToken, value: RqlComparableValue | null): RqlFragment; /** Builds a less-than comparison fragment. */ lt(field: RqlFieldToken, value: TValue): RqlFragment; /** Builds a less-than-or-equal comparison fragment. */ lte(field: RqlFieldToken, value: TValue): RqlFragment; /** Builds a greater-than comparison fragment. */ gt(field: RqlFieldToken, value: TValue): RqlFragment; /** Builds a greater-than-or-equal comparison fragment. */ gte(field: RqlFieldToken, value: TValue): RqlFragment; /** Builds an `IN` comparison fragment. */ in(field: RqlFieldToken, values: readonly RqlComparableValue[]): RqlFragment; /** Builds a `NOT_IN` comparison fragment. */ notIn(field: RqlFieldToken, values: readonly RqlComparableValue[]): RqlFragment; /** Builds an `IS NULL`-style equality fragment. */ isNull(field: RqlFieldToken): RqlFragment; /** Builds an `IS NOT NULL`-style inequality fragment. */ isNotNull(field: RqlFieldToken): RqlFragment; /** Builds a parenthesized `AND` fragment. */ and(...fragments: readonly RqlFragment[]): RqlFragment; /** Builds a parenthesized `OR` fragment. */ or(...fragments: readonly RqlFragment[]): RqlFragment; /** Builds a parenthesized `NOT` fragment. */ not(fragment: RqlFragment): RqlFragment; } /** Allowed comparison inputs for one field token. */ export type RqlComparableValue = TValue extends LookupReference ? TValue | string : TValue; /** Interpolation values accepted by the tagged-template compiler. */ export type RqlInterpolation = RqlFieldToken | RqlFragment | RqlValue; /** * Creates a typed RQL helper surface for one custom-object definition. * * The helper keeps authoring close to raw RQL by combining a tagged-template * compiler with IntelliSense-friendly field tokens. Callers write normal RQL in * string segments and interpolate typed field references or JavaScript literal * values where they want compiler assistance. * * @param definition - Typed object definition whose field tokens should be exposed. * @returns Typed RQL helper surface bound to the supplied object definition. * @typeParam TDefinition - Object definition whose field tokens should be exposed. */ export declare function createRqlHelpers(definition: TDefinition): CustomObjectRqlHelpers; export {}; //# sourceMappingURL=rql.d.mts.map