UNPKG

odatafy-mongoose

Version:

Use mongoose to excel the capabilities of datafy-mongodb

187 lines (186 loc) 4.78 kB
export declare const ODATAVERSION = "4.0"; export declare const ODATASCHEMA = "http://docs.oasis-open.org/odata/odata-json-csdl/v4.0/edm.json#"; export type ServiceMetadata = { $schema: typeof ODATASCHEMA; "odata-version": typeof ODATAVERSION; definitions: { [key: string]: ModelMetadata; }; actions: {}; functions: {}; terms: {}; entityContainer: EntityContainerMetadata | {}; schemas: {}; references: {}; }; export type ODataModelFieldObject = { type: PrimitiveDataTypes.OBJECT; properties: { [key: string]: ODataModelField; }; }; export type ODataModelField = (ODataModelFieldObject | { type: PrimitiveDataTypes.ARRAY; items: ODataModelField; } | { $ref: string; } | { anyOf: ODataModelField[]; } | { allOf: ODataModelField[]; } | ODataType) & { relationships?: { partner?: string; onDelete?: 'Cascade' | 'None' | 'SetDefault' | 'SetNull'; referentialConstraints?: { [key: string]: { referencedProperty: string; }; }; }; }; export type ObjectModelMetadata = { type: PrimitiveDataTypes.OBJECT; keys: string[]; properties: { [key: string]: ODataModelField; }; }; export type ModelMetadata = (ObjectModelMetadata | { anyOf: ODataModelField[]; } | { allOf: ODataModelField[]; }) & { default?: ODataModelField; }; export type PropertyMetadata = { Type: string; Name: string; }; export type ActionMetadata = {}; export type AnnotationMetadata = {}; export type EntityContainerMetadata = { name: string; entitySets: { [key: string]: { entityType: { $ref: string; }; navigationPropertyBindings?: { [key: string]: { target: string; }; }; }; }; singletons: {}; functionImports: {}; }; /** * Reference Types */ /** * OData Datatypes **/ export declare enum PrimitiveDataTypes { STRING = "string", BOOLEAN = "boolean", INTEGER = "integer", NUMBER = "number", OBJECT = "object", ARRAY = "array", NULL = "null" } export declare enum DataFormats { BASE64URL = "base64url", UINT8 = "uint8", DATE = "date", DATETIME = "date-time", DECIMAL = "decimal", DOUBLE = "double", DURATION = "duration", UUID = "uuid", INT16 = "int16", INT32 = "int32", INT64 = "int64", INT8 = "int8", SINGLE = "single", TIME = "time" } export type ODataType = (ODataString | ODataBinary | ODataBoolean | ODataByte | ODataDateTimeOffset | ODataDecimal | ODataDouble | ODataDuration | ODataGuid | ODataInt16 | ODataInt32 | ODataInt64 | ODataSByte | ODataSingle | ODataTimeOfDay | ODataNull) & { default?: PrimitiveDataTypes; enum?: PrimitiveDataTypes[]; nullable?: boolean; }; export type ODataBinary = { type: PrimitiveDataTypes.STRING; format: DataFormats.BASE64URL; maxlength?: number; byteLength?: number; }; export type ODataBoolean = { type: PrimitiveDataTypes.BOOLEAN; }; export type ODataNull = { type: PrimitiveDataTypes.NULL; }; export type ODataByte = { type: PrimitiveDataTypes.INTEGER; format: DataFormats.UINT8; }; export type ODataDateTimeOffset = { type: PrimitiveDataTypes.STRING; format: DataFormats.DATETIME; precision?: number; }; export type ODataDecimal = { type: [PrimitiveDataTypes.STRING, PrimitiveDataTypes.NUMBER]; format: DataFormats.DECIMAL; minimum?: number; maximum?: number; multipleOf?: number; precision?: number; scale?: number; }; export type ODataDouble = { type: [PrimitiveDataTypes.NUMBER, PrimitiveDataTypes.STRING]; format: DataFormats.DOUBLE; }; export type ODataDuration = { type: PrimitiveDataTypes.STRING; format: DataFormats.DURATION; }; export type ODataGuid = { type: PrimitiveDataTypes.STRING; format: DataFormats.UUID; }; export type ODataInt16 = { type: PrimitiveDataTypes.INTEGER; format: DataFormats.INT16; }; export type ODataInt32 = { type: PrimitiveDataTypes.INTEGER; format: DataFormats.INT32; }; export type ODataInt64 = { type: [PrimitiveDataTypes.INTEGER, PrimitiveDataTypes.INTEGER]; format: DataFormats.INT64; }; export type ODataSByte = { type: PrimitiveDataTypes.INTEGER; format: DataFormats.INT8; }; export type ODataSingle = { type: [PrimitiveDataTypes.NUMBER, PrimitiveDataTypes.STRING]; format: DataFormats.SINGLE; }; export type ODataString = { type: PrimitiveDataTypes.STRING; maxlength?: number; pattern?: string; }; export type ODataTimeOfDay = { type: PrimitiveDataTypes.STRING; format: DataFormats.TIME; precision?: number; };