1 | import BigNumber from 'bignumber.js';
|
2 | import moment from 'moment';
|
3 | import { Entity, EntityIdentifiable, Constructable } from '../entity';
|
4 | import { Time } from '../time';
|
5 | /**
|
6 | * Union type to represent all possible types of a field.
|
7 | */
|
8 | export declare type FieldType = string | number | boolean | Time | moment.Moment | moment.Duration | BigNumber | null | undefined;
|
9 | /**
|
10 | * @deprecated Since v1.18.0. Use [[FieldType]] instead.
|
11 | * Represents types of nested fields.
|
12 | */
|
13 | export declare type DeepFieldType = FieldType | {
|
14 | [keys: string]: DeepFieldType;
|
15 | };
|
16 | /**
|
17 | * Optional settings for fields.
|
18 | */
|
19 | export interface FieldOptions<NullableT extends boolean = false, SelectableT extends boolean = false> {
|
20 | /**
|
21 | * Whether the value of the field can be `null`.
|
22 | */
|
23 | isNullable?: NullableT;
|
24 | /**
|
25 | * Whether the field can be reference in a `.select` statement.
|
26 | */
|
27 | isSelectable?: SelectableT;
|
28 | }
|
29 | /**
|
30 | * Get field options merged with default values.
|
31 | * The given options take precedence.
|
32 | * @param fieldOptions - Given options.
|
33 | * @returns Given options merged with default values.
|
34 | */
|
35 | export declare function getFieldOptions<NullableT extends boolean = false, SelectableT extends boolean = false>(fieldOptions?: FieldOptions<NullableT, SelectableT>): Required<FieldOptions<NullableT, SelectableT>>;
|
36 | /**
|
37 | * Abstract representation a property of an OData entity.
|
38 | *
|
39 | * `Field`s are used as static properties of entities or properties of [[ComplexTypeField]]s and are generated from the metadata, i.e. for each property of
|
40 | * an OData entity, there exists one static instance of `Field` (or rather one of its subclasses) in the corresponding generated class file.
|
41 | * Fields are used to represent the domain of values that can be used in select, filter and order by functions.
|
42 | *
|
43 | * See also: [[Selectable]], [[EdmTypeField]], [[ComplexTypeField]]
|
44 | * @typeparam EntityT - Type of the entity the field belongs to.
|
45 | * @typeparam NullableT - Boolean type that represents whether the field is nullable.
|
46 | * @typeparam SelectableT - Boolean type that represents whether the field is selectable.
|
47 | */
|
48 | export declare class Field<EntityT extends Entity, NullableT extends boolean = false, SelectableT extends boolean = false> implements EntityIdentifiable<EntityT> {
|
49 | readonly _fieldName: string;
|
50 | readonly _entityConstructor: Constructable<EntityT>;
|
51 | readonly _entity: EntityT;
|
52 | readonly _fieldOptions: Required<FieldOptions<NullableT, SelectableT>>;
|
53 | /**
|
54 | * Creates an instance of Field.
|
55 | * @param _fieldName - Actual name of the field used in the OData request
|
56 | * @param _entityConstructor - Constructor type of the entity the field belongs to
|
57 | * @param fieldOptions - Optional settings for this field.
|
58 | */
|
59 | constructor(_fieldName: string, _entityConstructor: Constructable<EntityT>, fieldOptions?: FieldOptions<NullableT, SelectableT>);
|
60 | /**
|
61 | * Path to the field to be used in filter and order by queries.
|
62 | * @returns Path to the field to be used in filter and order by queries.
|
63 | */
|
64 | fieldPath(): string;
|
65 | }
|
66 | //# sourceMappingURL=field.d.ts.map |
\ | No newline at end of file |