import { BreezeEnum } from '../core/enum.js'; import { Validator } from '../validation/validate.js'; /** DataType is an 'Enum' containing all of the supported data types. */ export declare class DataType extends BreezeEnum { /** The default value of this DataType. __Read Only__ */ defaultValue?: any; /** Whether this is a 'numeric' DataType. __Read Only__ */ isNumeric?: boolean; /** Whether this is an 'integer' DataType. __Read Only__ */ isInteger?: boolean; /** The constructor function to create a {@link Validator} to be used in validating instances of this DataType. */ validatorCtor?(context?: any): Validator; /** Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast. @returns value appropriate for this DataType */ normalize?(value: any): any; /** Optional function to convert a raw (server) value from string to this DataType. @returns value appropriate for this DataType */ parseRawValue?(value: any): any; /** Optional function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast. @returns value appropriate for this DataType */ parse?(source: any, sourceTypeName: string): any; /** Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values. @returns value appropriate for this DataType */ getNext?(): any; /** Optional function to get the next value when the datatype is used as a concurrency property. @param previousValue @returns the next concurrency value, which may be a function of the previousValue. */ getConcurrencyValue?(previousValue?: any): any; /** The function Breeze converts `DateTime` and `DateTimeOffset` values from the server with, when it materializes query and save results. Defaults to {@link DataType.parseDateAsUTC}. Replace it at startup, before the first query, to change how a date-time string with no offset is read - for example with {@link DataType.parseDateAsLocal}. It does not affect saves, which always send UTC. */ static parseDateFromServer: (value: any) => any; /** A string (.NET `String`; also `Char`). Default `""`. */ static String: DataType; /** A 64-bit integer (.NET `Int64`; also `UInt32` and `UInt64`), held as a JavaScript `number`, so values beyond ±2^53 lose precision. Default `0`. */ static Int64: DataType; /** A 32-bit integer (.NET `Int32`; also `UInt16`), held as a `number`. Default `0`. */ static Int32: DataType; /** A 16-bit integer (.NET `Int16`; also `SByte`), held as a `number`. Default `0`. */ static Int16: DataType; /** An unsigned 8-bit integer, 0 to 255 (.NET `Byte`), held as a `number`. Default `0`. */ static Byte: DataType; /** A decimal number (.NET `Decimal`), held as a JavaScript `number` - a double - so digits beyond its precision are lost. Default `0`. */ static Decimal: DataType; /** A 64-bit floating-point number (.NET `Double`). Also the type Breeze infers for an unmapped property that holds a number. Default `0`. */ static Double: DataType; /** A 32-bit floating-point number (.NET `Single`), held as a `number`. Default `0`. */ static Single: DataType; /** A calendar date with no time (.NET `DateOnly`), held as a `Date` at local midnight. Read from the first ten characters (`YYYY-MM-DD`) of the server's value, sent back as `YYYY-MM-DD` from the local date, and compared by date alone. Default 1 January 1900. */ static DateOnly: DataType; /** A date and time (.NET `DateTime`), held as a `Date`. Read from the server with {@link DataType.parseDateFromServer} and sent as ISO 8601 in UTC. Also the type Breeze infers for an unmapped property that holds a `Date`. Default 1 January 1900, local midnight. */ static DateTime: DataType; /** A date and time with an offset (.NET `DateTimeOffset`), held as a `Date`, which has no offset: it is read with {@link DataType.parseDateFromServer} and sent back in UTC, so the original offset is lost. Default 1 January 1900, local midnight. */ static DateTimeOffset: DataType; /** A duration (.NET `TimeSpan`), held as the ISO 8601 duration string the server sends, such as `PT4H30M`. Compared as a number of seconds in local queries. Default `PT0S`. */ static Time: DataType; /** A time of day (.NET `TimeOnly`), held as the string the server sends: "14:30:00" or "01:23:45.678". */ static TimeOnly: DataType; /** A `true` or `false` value (.NET `Boolean`). Default `false`. */ static Boolean: DataType; /** A GUID (.NET `Guid`), held as a lower-case string. Default `"00000000-0000-0000-0000-000000000000"`. */ static Guid: DataType; /** Binary data (.NET `byte[]`), such as a SQL `rowversion`, held as the base64 string the server sends. Default `null`. */ static Binary: DataType; /** An unknown type: a server type name the client does not recognize (the original is kept in the property's `rawTypeName`), or an unmapped property whose type cannot be inferred. Values are not converted or validated. Default `undefined`. */ static Undefined: DataType; /** Returns the function Breeze uses to turn values of a data type into something `===`, `<` and `>` compare correctly, in local queries and when ordering: the data type's `normalize` if it has one, a conversion to seconds for {@link DataType.Time}, and otherwise the value itself. Applications do not normally need it. @param dataType - The data type of the values to compare. */ static getComparableFn(dataType?: DataType): (value: any) => any; /** Returns the DataType with the specified name, or undefined if there is none. Also accepts the names the .NET servers use for some types, such as 'TimeSpan' for {@link DataType.Time}. */ static fromName(name: string): DataType | undefined; /** Returns the DataType for a specified input. */ static fromValue(val: any): DataType; /** Converts a {@link DataType.Time} value from the server. By default it returns the value unchanged: a `Time` is held as the ISO 8601 duration string the server sends, such as `PT4H30M`. Replace it at startup, before the first query, to hold durations some other way - as a number of seconds, say, with {@link core.durationToSeconds}. */ static parseTimeFromServer(source: any): any; /** Converts a date-time string from the server to a `Date`. This is the default {@link DataType.parseDateFromServer}. - A string with `Z` or an offset (`2024-03-15T10:30:00Z`, `...10:30:00+02:00`) is read as given. - A string with no offset that ends in fractional seconds, of any length (`2024-03-15T10:30:00.5`, `...00.000`, `...00.1234567`), is read as UTC: Breeze appends `Z`. - Any other string with no offset, such as `2024-03-15T10:30:00`, goes to `Date.parse` unchanged, which reads it as **local** time. @param source - The value from the server. */ static parseDateAsUTC(source: any): any; /** Parse as UTC then shift to local time */ static parseDateAsLocal(source: string): any; /** if val is a Date, return a date-only string e.g. '2023-12-31' */ static toDateOnlyString(val: any): any; /** Returns a raw value converted to the specified DataType */ static parseRawValue(val: any, dataType?: DataType): any; }