import type { ASTNode, DirectiveNode, FieldDefinitionNode } from 'graphql'; import type { CalcMutationsOperator, FieldConfig, FlexSearchLanguage } from '../config/field.js'; import { AggregationOperator, RelationDeleteAction } from '../config/field.js'; import { QuickFix } from '../validation/quick-fix.js'; import type { ModelComponent, ValidationContext } from '../validation/validation-context.js'; import { CollectPath } from './collect-path.js'; import type { FieldLocalization } from './i18n.js'; import type { Model } from './model.js'; import { EffectiveModuleSpecification } from './modules/effective-module-specification.js'; import { FieldModuleSpecification } from './modules/field-module-specification.js'; import type { PermissionProfile } from './permission-profile.js'; import type { RelationSide } from './relation.js'; import { Relation } from './relation.js'; import { RolesSpecifier } from './roles-specifier.js'; import type { ObjectType, Type } from './type.js'; import { VectorIndex } from './vector-index.js'; export interface SystemFieldConfig extends FieldConfig { readonly isSystemField?: boolean; readonly isNonNull?: boolean; readonly allowedDirectiveNames?: ReadonlyArray; } export declare class Field implements ModelComponent { private readonly input; readonly declaringType: ObjectType; readonly model: Model; readonly name: string; description: string | undefined; readonly deprecationReason: string | undefined; readonly astNode: FieldDefinitionNode | undefined; readonly isList: boolean; readonly isReference: boolean; readonly isRelation: boolean; readonly isCollectField: boolean; readonly collectPath: CollectPath | undefined; readonly aggregationOperator: AggregationOperator | undefined; readonly defaultValue?: any; readonly calcMutationOperators: ReadonlySet; readonly isParentField: boolean; readonly isRootField: boolean; readonly roles: RolesSpecifier | undefined; readonly isHidden: boolean; private _type; /** * Specifies if this field can be used within restrictions of a permission profile * * The field does not need to be used within restrictions if this is true. */ readonly isAccessField: boolean; /** * Indicates if this is an inherent field of the declaring type that will be maintained by the system and thus can * only be queried */ readonly isSystemField: boolean; readonly moduleSpecification: FieldModuleSpecification | undefined; readonly referenceAstNode: ASTNode | undefined; readonly relationAstNode: ASTNode | undefined; readonly inverseOfAstNode: ASTNode | undefined; readonly relationDeleteActionAstNode: ASTNode | undefined; readonly collectAstNode: DirectiveNode | undefined; readonly collectPathAstNode: ASTNode | undefined; readonly aggregationOperatorAstNode: ASTNode | undefined; readonly defaultValueAstNode: DirectiveNode | undefined; readonly calcMutationsAstNode: DirectiveNode | undefined; readonly rootDirectiveAstNode: DirectiveNode | undefined; readonly parentDirectiveAstNode: DirectiveNode | undefined; readonly isFlexSearchIndexedAstNode: DirectiveNode | undefined; readonly isFlexSearchFullTextIndexedAstNode: DirectiveNode | undefined; readonly vectorIndex: VectorIndex | undefined; constructor(input: SystemFieldConfig, declaringType: ObjectType); /** * Indicates if this field can never be set manually (independent of permissions) */ get isReadOnly(): boolean; get isDeprecated(): boolean; /** * Specifies whether this field (or items within the list if this is a list) is never null */ get isNonNull(): boolean; get type(): Type; get hasValidType(): boolean; get hasDefaultValue(): boolean; /** * The default value, parsed like an equivalent GraphQL input value would be * * For example, DateTime values are normalized, decimals are rounded, and OffsetDateTime values * are ZonedDateTime instances. If the default value is invalid, this is the raw default value. */ get parsedDefaultValue(): unknown; get label(): Record; get hint(): Record; get permissionProfile(): PermissionProfile | undefined; get isKeyField(): boolean; get inverseOf(): Field | undefined; get inverseField(): Field | undefined; get relation(): Relation | undefined; get relationSide(): RelationSide | undefined; getRelationSideOrThrow(): RelationSide; getRelationOrThrow(): Relation; get relationDeleteAction(): RelationDeleteAction; /** * The field that holds the key if this is a reference * * If this is a reference without an explicit key field, returns this (reference) field */ get referenceKeyField(): Field | undefined; getReferenceKeyFieldOrThrow(): Field; /** * A reference field within the same type that uses this field as its key field */ get referenceField(): Field | undefined; getLocalization(resolutionOrder: ReadonlyArray): FieldLocalization; get effectiveModuleSpecification(): EffectiveModuleSpecification; validate(context: ValidationContext): void; private validateName; private validateType; private validateRootEntityType; private validateRelation; private validateReference; private validateCollect; private validateReferenceKeyField; private validateEntityExtensionType; private validateChildEntityType; private validatePermissions; private validateDefaultValue; private validateCalcMutations; private validateParentField; private validateRootField; private validateFlexSearch; private hasRecursiveIncludeInSearch; private validateAccessField; /** * Quick fixes to replace the declared type of this field (e.g. "[String]") */ private getChangeTypeQuickFixes; private getRemoveIncludeInSearchQuickFixes; private getAddRelationDirectiveQuickFixes; private getUseRestrictQuickFixes; /** * Quick fixes to replace the aggregation operator with its variant that checks for boolean "true" */ private getUseBooleanAggregationOperatorQuickFixes; private getUseAggregationOperatorQuickFixes; private getRemoveAggregateArgumentQuickFixes; private getAddDistinctAggregationQuickFixes; private getRemoveLastCollectPathSegmentQuickFixes; /** * Simple checks that the @modules directive is correct */ private validateModulesDirective; /** * Checks the combination of @key and modules */ private validateModulesOfKeyField; /** * Checks that this field is only included in modules that also include all prerequisites (type, collect path...) */ private validateModuleConsistency; get isFlexSearchIndexed(): boolean; get isFlexSearchIndexCaseSensitive(): boolean; get flexSearchAnalyzer(): string | undefined; /** * Indicates whether the flexSearch index is based on a string (and e.g. FLEX_STRING_GREATER_THAN should be used) * or if it's a string/boolean/number */ get isFlexSearchStringBased(): boolean; get flexSearchFulltextAnalyzer(): string | undefined; getFlexSearchFulltextAnalyzerOrThrow(): string; get isFlexSearchFulltextIndexed(): boolean; get isIncludedInSearch(): boolean; get isFulltextIncludedInSearch(): boolean; get flexSearchLanguage(): FlexSearchLanguage | undefined; private validateVectorIndex; } export interface ChangeFieldTypeQuickFixOptions { readonly description?: string; readonly isPreferred?: boolean; } /** * Quick fixes to replace the declared type of a field (e.g. "[String]") */ export declare function getChangeFieldTypeQuickFixes(fieldNode: FieldDefinitionNode | undefined, newTypeText: string, { description, isPreferred, }?: ChangeFieldTypeQuickFixOptions): ReadonlyArray;