import type { ArgumentNode, DirectiveNode, EnumValueNode, IntValueNode, ObjectValueNode, StringValueNode, ValueNode } from 'graphql'; import type { OrderDirection } from '../implementation/order.js'; export interface IndexDefinitionConfig { readonly name?: string; readonly nameASTNode?: StringValueNode; /** * A list of dot-separated fields that make up this index */ readonly fields: ReadonlyArray; readonly fieldASTNodes?: ReadonlyArray; readonly unique?: boolean; /** * If set to true, the index will not contain any values where one of the fields is null. * * If unspecified, the value depends on unique: unique indices default to sparse, non-unique indices default to * non-sparse. */ readonly sparse?: boolean; readonly astNode?: DirectiveNode | ObjectValueNode; } export type VectorSimilarityMetric = 'COSINE' | 'L2' | 'INNER_PRODUCT'; export interface VectorIndexDefinitionConfig { readonly sparse?: boolean; readonly metric?: VectorSimilarityMetric; readonly metricASTNode?: EnumValueNode; readonly dimension?: number; readonly dimensionASTNode?: IntValueNode; readonly nLists?: number; readonly nListsASTNode?: IntValueNode; readonly defaultNProbe?: number; readonly defaultNProbeASTNode?: IntValueNode; readonly maxNProbe?: number; readonly maxNProbeASTNode?: IntValueNode; readonly trainingIterations?: number; readonly trainingIterationsASTNode?: IntValueNode; readonly factory?: string; readonly factoryASTNode?: StringValueNode; readonly storedValues?: ReadonlyArray; readonly storedValuesASTNodes?: ReadonlyArray; readonly astNode?: DirectiveNode | ObjectValueNode; } export interface FlexSearchPrimarySortClauseConfig { readonly field: string; readonly direction: OrderDirection; readonly fieldASTNode?: StringValueNode; readonly directionASTNode?: EnumValueNode; } export interface FlexSearchIndexConfig { readonly isIndexed: boolean; readonly isIndexedAstNode?: ArgumentNode; readonly primarySort: ReadonlyArray; readonly primarySortAstNode?: ArgumentNode; /** * Bundled non-functional, optional parameters for flexsearch performance optimizations */ readonly performanceParams?: FlexSearchPerformanceParams; } /** * Bundles non-functional, optional parameters for flexsearch performance optimizations */ export interface FlexSearchPerformanceParams { /** * The time in milliseconds after which data changes will be visible in flexSearch queries */ readonly commitIntervalMsec?: number; readonly commitIntervalMsecASTNode?: ValueNode; /** * The interval at which a consolidation policy is applied to the flexSearch view */ readonly consolidationIntervalMsec?: number; readonly consolidationIntervalMsecASTNode?: ValueNode; /** * Wait at least this many commits before removing unused files in the data directory */ readonly cleanupIntervalStep?: number; readonly cleanupIntervalStepASTNode?: ValueNode; }