UNPKG

@ultipa-graph/ultipa-driver

Version:

NodeJS SDK for ultipa-server 5.1

147 lines (146 loc) 4.19 kB
/// <reference types="node" /> import { RequestConfig, DBType, Schema } from "./types"; import { Response } from "./types"; /** * Specify request parameter types */ export declare namespace RequestParamType { /** Return type */ type RETURN_TYPE = string[] | string | string[][]; /** Depth */ type DEPTH_TYPE = number | (number | string)[]; /** Update type */ type UPDATE = "sync" | "async" | "static"; } export declare enum ResponseTableName { JOB_RESULT = "result", SCHEMA = "_schema", GRAPH = "_graph", HDC_GRAPH_LIST = "_hdcGraphList", NODE_SCHEMA = "_nodeSchema", EDGE_SCHEMA = "_edgeSchema", GRAPH_COUNT = "_graphCount", ALGO_LIST = "_algoList", POLICY = "_policy", NODE_INDEX = "_nodeIndex", EDGE_INDEX = "_edgeIndex", NODE_FULLTEXT = "_nodeFulltext", EDGE_FULLTEXT = "_edgeFulltext" } /** * Namespace for request type */ export declare namespace RequestType { interface CityHash64 { name?: string; by?: string; } interface CommonStreamRequire extends RequestConfig { /** Handle results in stream mode */ stream: QueryResponseListener; } interface ExportListener extends RequestConfig { stream: { /** Start callback */ onStart?: () => void; /** Close callback */ onClose?: () => void; /** Get data */ onData: (data: any) => void | Promise<void>; /** End callback */ onEnd: () => void; /** Error callback */ onError?: (err: Error) => void; /** Pause callback */ onPause?: () => void; /** Readable callback */ onReadable?: () => void; /** Resume callback */ onResume?: () => void; /** Package size limit */ package_limit?: number; }; } /** Export */ interface Export { /** Export type */ dbType: DBType; /** Schema name */ schema: string; /** Entry limit */ limit: number; /** Property list */ properties: string[]; } /** Install algorithm */ interface _InstallAlgo { datas: { /** File bytes */ chunk: Buffer; /** File name */ fileName: string; /** File MD5 value */ md5: string; }[]; hdc?: string; isHdc?: boolean; } interface InstallAlgo { /** By file path */ paths?: { /** Algorithm .so file directory */ algoFilePath: string; /** Algorithm .yml description file directory */ infoFilePath: string; }; /** By detailed data */ datas?: _InstallAlgo; hdc?: string; } /** Install algorithm */ interface InstallAlgoAio extends InstallAlgo { isHdc?: boolean; } interface QueryResponseListener { /** Start callback */ onStart?: () => void; /** Close callback */ onClose?: () => void; /** Get data */ onData: (data: Response) => void | Promise<void>; /** End callback */ onEnd: () => void; /** Error callback */ onError?: (err: Error) => void; /** Pause callback */ onPause?: () => void; /** Readable callback */ onReadable?: () => void; /** Resume callback */ onResume?: () => void; /** Package size limit */ package_limit?: number; } } export interface TruncateParams { graphName: string; schemaName?: string; dbType?: DBType; } /** * Namespace for response type */ export declare namespace ResponseType { interface GraphCount { type: string; schema: string; from_schema: string; to_schema: string; count: number; } interface ShowSchema { nodeSchema: Schema[]; edgeSchema: Schema[]; graphCount: GraphCount[]; } }