@kusto/monaco-kusto
Version:
CSL, KQL plugin for the Monaco Editor
157 lines (156 loc) • 5.41 kB
TypeScript
export interface Column {
readonly name: string;
readonly type: string;
readonly docstring?: string;
readonly examples?: readonly string[];
}
export interface Table {
readonly name: string;
readonly entityType?: TableEntityType;
readonly columns: readonly Column[];
readonly docstring?: string;
}
export interface MaterializedViewTable extends Table {
readonly entityType: 'MaterializedViewTable';
readonly mvQuery?: string;
}
export interface ScalarParameter {
readonly name: string;
readonly type?: string;
readonly cslType?: string;
readonly docstring?: string;
readonly cslDefaultValue?: string;
readonly examples?: readonly string[];
}
export interface TabularParameter {
readonly name: string;
readonly columns: readonly Column[];
readonly docstring?: string;
}
/**
* An input parameter either be a scalar in which case it has a name, type and
* cslType, or it can be columnar, in which case it will have a name, and a list
* of scalar types which are the column types.
*/
export interface InputParameter extends ScalarParameter {
readonly columns?: ScalarParameter[];
}
export interface Function {
readonly name: string;
readonly body: string;
readonly inputParameters: readonly InputParameter[];
readonly docstring?: string;
}
export interface EntityGroup {
readonly name: string;
readonly members: readonly string[];
}
export interface Database {
readonly name: string;
readonly alternateName?: string;
readonly tables: readonly Table[];
readonly functions: readonly Function[];
readonly entityGroups: readonly EntityGroup[];
readonly majorVersion: number;
readonly minorVersion: number;
}
export type ClusterType = 'Engine' | 'DataManagement' | 'ClusterManager';
export interface EngineSchema {
readonly clusterType: 'Engine';
readonly cluster: {
readonly connectionString: string;
readonly databases: readonly Database[];
};
readonly database: Database | undefined;
readonly globalScalarParameters?: readonly ScalarParameter[];
readonly globalTabularParameters?: readonly TabularParameter[];
}
export type TableEntityType = 'Table' | 'ExternalTable' | 'MaterializedViewTable';
export interface ClusterMangerSchema {
readonly clusterType: 'ClusterManager';
readonly accounts: readonly string[];
readonly services: readonly string[];
readonly connectionString: string;
}
export interface DataManagementSchema {
readonly clusterType: 'DataManagement';
}
/**
* Schema types:
* Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
* Cluster Manager – Internal only. A schema for clusters that manages other clusters.
* Data Management – Internal only. A schema for ingestion point operations.
*/
export type Schema = EngineSchema | ClusterMangerSchema | DataManagementSchema;
export declare const getCslTypeNameFromClrType: (clrType: string) => string;
export declare const getEntityDataTypeFromCslType: (cslType: string) => string;
export declare const getCallName: (fn: Function) => string;
export declare const getExpression: (fn: Function) => string;
export declare const getInputParametersAsCslString: (inputParameters: readonly InputParameter[]) => any;
/**
* This is the schema of the output of kusto command
* .show schema as json
*/
export declare namespace showSchema {
interface Column {
readonly Name: string;
readonly Type: string;
readonly CslType: string;
readonly DocString?: string;
readonly Examples?: readonly string[];
}
interface Table {
readonly Name: string;
readonly EntityType: TableEntityType;
readonly OrderedColumns: readonly Column[];
readonly DocString?: string;
}
interface Tables {
readonly [tableName: string]: Table;
}
interface ScalarParameter {
readonly Name: string;
readonly Type?: string;
readonly CslType?: string;
readonly DocString?: string;
readonly CslDefaultValue?: string;
}
interface TabularParameter {
readonly Name: string;
readonly Columns: readonly Column[];
readonly DocString?: string;
}
interface InputParameter extends ScalarParameter {
readonly Columns?: readonly ScalarParameter[];
}
interface Function {
readonly Name: string;
readonly InputParameters: readonly InputParameter[];
readonly Body: string;
readonly Folder: string;
readonly DocString: string;
readonly FunctionKind: string;
readonly OutputColumns: readonly any[];
}
interface Functions {
readonly [functionName: string]: Function;
}
interface Database {
readonly Name: string;
readonly Tables: Tables;
readonly ExternalTables: Tables;
readonly MaterializedViews: Table;
readonly EntityGroups: Readonly<Record<string, readonly string[]>>;
readonly MajorVersion: number;
readonly MinorVersion: number;
readonly Functions: Functions;
readonly DatabaseAccessMode: string;
}
interface Databases {
readonly [dbName: string]: Database;
}
interface Result {
readonly Plugins: readonly unknown[];
readonly Databases: Databases;
}
}