Skip to content
Snippets Groups Projects
FromBackend.ts 1.26 KiB
/*************** schema format from the backend *************** */

/** Schema type, consist of nodes and edges */
export type SchemaFromBackend = {
  edges: SchemaEdge[];
  nodes: SchemaNode[];
};

export type SchemaStatsFromBackend = {
  edgeStats: {
    type: string;
    count: number;
  }[];
  nodeStats: {
    key: string;
    labels: string[];
    count: number;
  }[];
};

export type SchemaAttributeTypes = 'string' | 'float' | 'int' | 'bool' | 'date' | 'time' | 'datetime' | 'duration';

export type DimensionType = 'categorical' | 'numerical' | 'temporal' | 'spatial';

/** Attribute type, consist of a name */
export type SchemaAttribute = {
  name: string;
  type: SchemaAttributeTypes;
  dimension?: DimensionType;
};

/** Node type, consist of a name and a list of attributes */
export type SchemaNode = {
  name: string;
  attributes: SchemaAttribute[];
  type?: string;
};

/** Edge type, consist of a name, start point, end point and a list of attributes */
export type SchemaEdge = {
  name: string;
  to: string;
  from: string;
  collection: string;
  attributes: SchemaAttribute[];
  label: string;
  type?: string;
};

export type GraphAttributeDimensions = {
  nodes: { [id: string]: { [id: string]: string } };
  edges: { [id: string]: { [id: string]: string } };
};