UNPKG

2.68 kBTypeScriptView Raw
1import { Entity } from '../entity';
2import { EdmTypeShared } from '../edm-types';
3import { Filter } from '../filter';
4import { Field, FieldOptions } from './field';
5import { ConstructorOrField } from './constructor-or-field';
6/**
7 * Represents a property with an enum value.
8 * @typeparam EntityT - Type of the entity the field belongs to.
9 * @typeparam EnumT - Enum type that contains all valid enum entries for this field.
10 * @typeparam NullableT - Boolean type that represents whether the field is nullable.
11 * @typeparam SelectableT - Boolean type that represents whether the field is selectable.
12 */
13export declare class EnumField<EntityT extends Entity, EnumT extends string = string, NullableT extends boolean = false, SelectableT extends boolean = false> extends Field<EntityT, NullableT, SelectableT> {
14 readonly _fieldOf: ConstructorOrField<EntityT>;
15 readonly enumType?: Record<string, EnumT> | undefined;
16 /**
17 * @deprecated Since v1.48.0. This property is not used anymore.
18 */
19 readonly edmType: EdmTypeShared<any>;
20 /**
21 * Creates an instance of EnumField.
22 * @param fieldName - Actual name of the field used in the OData request.
23 * @param _fieldOf - The constructor of the entity or the complex type field this field belongs to.
24 * @param enumType - Enum type of the field according to the metadata description.
25 * @param fieldOptions - Optional settings for this field.
26 */
27 constructor(fieldName: string, _fieldOf: ConstructorOrField<EntityT>, enumType?: Record<string, EnumT> | undefined, fieldOptions?: FieldOptions<NullableT, SelectableT>);
28 /**
29 * Gets the path to the complex type property represented by this.
30 * @returns The path to the complex type property.
31 */
32 fieldPath(): string;
33 /**
34 * Creates an instance of Filter for this field and the given value using the operator 'eq', i.e. `==`.
35 * @param value - Value to be used in the filter
36 * @returns The resulting filter
37 */
38 equals(value: EnumType<EnumT>): Filter<EntityT, string>;
39 /**
40 * Creates an instance of Filter for this field and the given value using the operator 'ne', i.e. `!=`.
41 * @param value - Value to be used in the filter
42 * @returns The resulting filter
43 */
44 notEquals(value: EnumType<EnumT>): Filter<EntityT, string>;
45}
46/**
47 * Convenient type to reflect all the values of a string based enum as a union type.
48 * @typeparam T - String based enum type
49 * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types
50 */
51export declare type EnumType<T extends string> = `${T}`;
52//# sourceMappingURL=enum-field.d.ts.map
\No newline at end of file