/** * Copyright Linkurious SAS 2012 - 2019 * * - Created on 2019-05-15. */ import { ICurrencyOptions, IDataSourceParams } from '../commonTypes'; import { ItemTypeAccessRightType, PropertyAccessRightType } from '../accessRight'; export interface IStartSchemaSamplingParams extends IDataSourceParams { reset?: boolean; waitForCompletion?: boolean; } export declare enum SamplingStatus { ONGOING = "ongoing", DONE = "done", ERROR = "error" } export interface GetSamplingStatusResponse { status: SamplingStatus; progress?: string; message?: string; lastSampled?: string; } export interface IUpdateSchemaSettingsParams extends IDataSourceParams { strictSchema: boolean; } export declare enum EntityType { NODE = "node", EDGE = "edge" } export declare enum DataVisibility { NONE = "none", AVAILABLE = "available", SEARCHABLE = "searchable" } export interface ICreateTypeParams extends IDataSourceParams { entityType: EntityType; itemType: string; visibility?: DataVisibility; } export interface IUpdateTypeParams extends ICreateTypeParams { } export declare enum PropertyTypeName { AUTO = "auto", BOOLEAN = "boolean", DATE = "date", DATETIME = "datetime", NUMBER = "number", STRING = "string" } export interface ISimpleType { name: PropertyTypeName.AUTO | PropertyTypeName.BOOLEAN; } export interface IEnumOptions { values: string[]; } export interface IStringType { name: PropertyTypeName.STRING; options?: IEnumOptions; } export declare enum DateFormat { NATIVE = "native", ISO = "iso",// yyyy-mm-dd DD_MM_YYYY = "dd/mm/yyyy", MM_DD_YYYY = "mm/dd/yyyy", TIMESTAMP = "timestamp", TIMESTAMP_MS = "timestamp-ms" } export interface IDateOptions { format: DateFormat; } export interface IDateType { name: PropertyTypeName.DATE; options: IDateOptions; } export declare enum DateTimeFormat { NATIVE = "native", ISO = "iso",// YYYY-MM-DDThh:mm:ss TIMESTAMP = "timestamp", TIMESTAMP_MS = "timestamp-ms" } export interface IDatetimeOptions { format: DateTimeFormat; timezone?: boolean; } export interface IDateTimeType { name: PropertyTypeName.DATETIME; options: IDatetimeOptions; } export interface INumberType { name: PropertyTypeName.NUMBER; options?: ICurrencyOptions; } export type PropertyType = ISimpleType | IStringType | IDateType | IDateTimeType | INumberType; export interface ICreatePropertyParams extends IDataSourceParams { entityType: EntityType; itemType: string; propertyKey: string; propertyType: PropertyType; required?: boolean; visibility?: DataVisibility; } export interface IUpdatePropertyParams extends IDataSourceParams { entityType: EntityType; itemType: string; propertyKey: string; propertyType?: PropertyType; required?: boolean; visibility?: DataVisibility; } export interface GraphSchemaProperty { propertyKey: string; required: boolean; visibility: DataVisibility; propertyType: PropertyType; indexed: boolean; indexedAs?: PropertyType; } /** * Define the schema of a graph item. * @property {string} itemType - The category or the type of the item. * @property {GraphSchemaProperty[]} properties - An array of properties associated with the graph item. * @property {DataVisibility} visibility - The visibility of the graph item. * @property {boolean} indexed - Indicates whether the type is indexed. * @property {EdgeTypeEnds[]} [edgeTypeEnds] - Optional, defined only for edge types. It defines the source and target categories that the edge connects. * @property {number} [count] - Optional, defined only for supported vendors. It indicates the number of items of this type. */ export interface GraphSchemaType { itemType: string; properties: GraphSchemaProperty[]; visibility: DataVisibility; indexed: boolean; edgeTypeEnds?: Array; count?: number; } /** * Define the source and target categories that an edge connects. */ export type EdgeTypeEnds = { source: string; target: string; }; export interface SearchSupport { /** * - `yes`: search is supported. * - `no`: search is not supported, and will never be, no matter what. * - `potentially`: search is currently unsupported, but could be after an external action. */ status: 'yes' | 'no' | 'potentially'; reason?: string; } export interface GraphSchema { results: GraphSchemaType[]; } export interface AdminGraphSchemaProperty extends Omit { searchSupport: SearchSupport; propertyTypeConsistent: boolean; } export interface AdminGraphSchemaType extends GraphSchemaType { properties: AdminGraphSchemaProperty[]; } export interface AdminGraphSchema { results: AdminGraphSchemaType[]; } export interface GraphSchemaPropertyWithAccess extends Omit { access: PropertyAccessRightType; } export interface GraphSchemaTypeWithAccess extends GraphSchemaType { access: ItemTypeAccessRightType; properties: Omit[] | GraphSchemaPropertyWithAccess[]; } export interface GraphSchemaWithAccess extends GraphSchema { any: { access: ItemTypeAccessRightType; }; results: GraphSchemaTypeWithAccess[]; } export interface IGetTypesParams extends IDataSourceParams { entityType: EntityType; }