@kusto/monaco-kusto 7.0.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/package.json +3 -6
- package/release/dev/Kusto.Language.Bridge.min.js +1 -1
- package/release/dev/kusto.javascript.client.min.js +1 -1
- package/release/dev/kustoMode.js +55 -25
- package/release/dev/kustoWorker.js +34 -105
- package/release/dev/{main-5ef10bd7.js → main-a9bd6fdf.js} +2 -2
- package/release/dev/monaco.contribution.js +36 -9
- package/release/dev/schema-9cf94ce1.js +109 -0
- package/release/esm/kusto.worker.js +11 -69
- package/release/esm/kustoMode.d.ts +10 -4
- package/release/esm/kustoMode.js +14 -9
- package/release/esm/kustoWorker.d.ts +22 -8
- package/release/esm/languageFeatures.d.ts +11 -14
- package/release/esm/languageService/kustoLanguageService.d.ts +2 -8
- package/release/esm/languageService/schema.d.ts +7 -2
- package/release/esm/languageService/settings.d.ts +2 -2
- package/release/esm/monaco.contribution.d.ts +11 -3
- package/release/esm/monaco.contribution.js +27 -9
- package/release/esm/schema-53127847.js +85 -0
- package/release/esm/types.d.ts +8 -120
- package/release/esm/workerManager.d.ts +2 -2
- package/release/min/Kusto.Language.Bridge.min.js +1 -1
- package/release/min/kusto.javascript.client.min.js +1 -1
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-c8dacaab.js → main-e51f94c9.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/schema-9334f5c9.js +7 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*!-----------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* monaco-kusto version: 7.2.0(ff25adc61b13954e5ec288fcdc16c92483943ef5)
|
|
4
|
+
* Released under the MIT license
|
|
5
|
+
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
|
+
*-----------------------------------------------------------------------------*/
|
|
7
|
+
|
|
8
|
+
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An input parameter either be a scalar in which case it has a name, type and
|
|
12
|
+
* cslType, or it can be columnar, in which case it will have a name, and a list
|
|
13
|
+
* of scalar types which are the column types.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Schema types:
|
|
18
|
+
* Engine – The main schema type. Contains clusters, databases, tables, table columns and functions.
|
|
19
|
+
* Cluster Manager – Internal only. A schema for clusters that manages other clusters.
|
|
20
|
+
* Data Management – Internal only. A schema for ingestion point operations.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const dotnetTypeToKustoType = {
|
|
24
|
+
'System.SByte': 'bool',
|
|
25
|
+
'System.Byte': 'uint8',
|
|
26
|
+
'System.Int16': 'int16',
|
|
27
|
+
'System.UInt16': 'uint16',
|
|
28
|
+
'System.Int32': 'int',
|
|
29
|
+
'System.UInt32': 'uint',
|
|
30
|
+
'System.Int64': 'long',
|
|
31
|
+
'System.UInt64': 'ulong',
|
|
32
|
+
'System.String': 'string',
|
|
33
|
+
'System.Single': 'float',
|
|
34
|
+
'System.Double': 'real',
|
|
35
|
+
'System.DateTime': 'datetime',
|
|
36
|
+
'System.TimeSpan': 'timespan',
|
|
37
|
+
'System.Guid': 'guid',
|
|
38
|
+
'System.Boolean': 'bool',
|
|
39
|
+
'Newtonsoft.Json.Linq.JArray': 'dynamic',
|
|
40
|
+
'Newtonsoft.Json.Linq.JObject': 'dynamic',
|
|
41
|
+
'Newtonsoft.Json.Linq.JToken': 'dynamic',
|
|
42
|
+
'System.Object': 'dynamic',
|
|
43
|
+
'System.Data.SqlTypes.SqlDecimal': 'decimal'
|
|
44
|
+
};
|
|
45
|
+
const getCslTypeNameFromClrType = clrType => dotnetTypeToKustoType[clrType] || clrType;
|
|
46
|
+
const kustoTypeToEntityDataType = {
|
|
47
|
+
object: 'Object',
|
|
48
|
+
bool: 'Boolean',
|
|
49
|
+
uint8: 'Byte',
|
|
50
|
+
int16: 'Int16',
|
|
51
|
+
uint16: 'UInt16',
|
|
52
|
+
int: 'Int32',
|
|
53
|
+
uint: 'UInt32',
|
|
54
|
+
long: 'Int64',
|
|
55
|
+
ulong: 'UInt64',
|
|
56
|
+
float: 'Single',
|
|
57
|
+
real: 'Double',
|
|
58
|
+
decimal: 'Decimal',
|
|
59
|
+
datetime: 'DateTime',
|
|
60
|
+
string: 'String',
|
|
61
|
+
dynamic: 'Dynamic',
|
|
62
|
+
timespan: 'TimeSpan'
|
|
63
|
+
};
|
|
64
|
+
const getEntityDataTypeFromCslType = cslType => kustoTypeToEntityDataType[cslType] || cslType;
|
|
65
|
+
const getCallName = fn => `${fn.name}(${fn.inputParameters.map(p => `{${p.name}}`).join(',')})`;
|
|
66
|
+
const getExpression = fn => `let ${fn.name} = ${getInputParametersAsCslString(fn.inputParameters)} ${fn.body}`;
|
|
67
|
+
const getInputParametersAsCslString = inputParameters => `(${inputParameters.map(inputParameter => getInputParameterAsCslString(inputParameter)).join(',')})`;
|
|
68
|
+
const getInputParameterAsCslString = inputParameter => {
|
|
69
|
+
// If this is a tabular parameter
|
|
70
|
+
if (inputParameter.columns && inputParameter.columns.length > 0) {
|
|
71
|
+
const attributesAsString = inputParameter.columns.map(col => `${col.name}:${col.cslType || getCslTypeNameFromClrType(col.type)}`).join(',');
|
|
72
|
+
return `${inputParameter.name}:${attributesAsString === '' ? '*' : attributesAsString}`;
|
|
73
|
+
} else {
|
|
74
|
+
return `${inputParameter.name}:${inputParameter.cslType || getCslTypeNameFromClrType(inputParameter.type)}`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* This is the schema of the output of kusto command
|
|
80
|
+
* .show schema as json
|
|
81
|
+
*/
|
|
82
|
+
let showSchema;
|
|
83
|
+
(function (_showSchema) {})(showSchema || (showSchema = {}));
|
|
84
|
+
|
|
85
|
+
export { getCallName as a, getExpression as b, getInputParametersAsCslString as c, getEntityDataTypeFromCslType as d, getCslTypeNameFromClrType as g, showSchema as s };
|
package/release/esm/types.d.ts
CHANGED
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
2
|
import type * as ls from 'vscode-languageserver-types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
syntaxErrorAsMarkDown?: SyntaxErrorAsMarkDownOptions;
|
|
7
|
-
openSuggestionDialogAfterPreviousSuggestionAccepted?: boolean;
|
|
8
|
-
useIntellisenseV2?: boolean;
|
|
9
|
-
useSemanticColorization?: boolean;
|
|
10
|
-
useTokenColorization?: boolean;
|
|
11
|
-
disabledCompletionItems?: string[];
|
|
12
|
-
onDidProvideCompletionItems?: OnDidProvideCompletionItems;
|
|
13
|
-
enableHover?: boolean;
|
|
14
|
-
formatter?: FormatterOptions;
|
|
15
|
-
enableQueryWarnings?: boolean;
|
|
16
|
-
enableQuerySuggestions?: boolean;
|
|
17
|
-
disabledDiagnosticCodes?: string[];
|
|
18
|
-
quickFixCodeActions?: QuickFixCodeActionOptions[];
|
|
19
|
-
enableQuickFixes?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface SyntaxErrorAsMarkDownOptions {
|
|
22
|
-
header?: string;
|
|
23
|
-
icon?: string;
|
|
24
|
-
enableSyntaxErrorAsMarkDown?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export type QuickFixCodeActionOptions = 'Extract Expression' | 'Extract Function' | 'Change to' | 'FixAll';
|
|
27
|
-
export interface FormatterOptions {
|
|
28
|
-
indentationSize?: number;
|
|
29
|
-
pipeOperatorStyle?: FormatterPlacementStyle;
|
|
30
|
-
}
|
|
31
|
-
export type FormatterPlacementStyle = 'None' | 'NewLine' | 'Smart';
|
|
3
|
+
import type { Schema, ScalarParameter, TabularParameter, EngineSchema, Database, showSchema } from './languageService/schema';
|
|
4
|
+
import type { RenderInfo } from './languageService/renderInfo';
|
|
5
|
+
import type { LanguageSettings } from './languageService/settings';
|
|
32
6
|
export interface LanguageServiceDefaults {
|
|
33
7
|
readonly onDidChange: monaco.IEvent<LanguageServiceDefaults>;
|
|
34
8
|
readonly languageSettings: LanguageSettings;
|
|
@@ -47,8 +21,8 @@ export interface LanguageServiceDefaults {
|
|
|
47
21
|
}
|
|
48
22
|
export interface KustoWorker {
|
|
49
23
|
setSchema(schema: Schema): Promise<void>;
|
|
50
|
-
setSchemaFromShowSchema(schema: any, clusterConnectionString: string, databaseInContextName: string, globalScalarParameters
|
|
51
|
-
normalizeSchema(schema:
|
|
24
|
+
setSchemaFromShowSchema(schema: any, clusterConnectionString: string, databaseInContextName: string, globalScalarParameters?: ScalarParameter[], globalTabularParameters?: TabularParameter[]): Promise<void>;
|
|
25
|
+
normalizeSchema(schema: showSchema.Result, clusterConnectionString: string, databaseInContextName: string): Promise<EngineSchema>;
|
|
52
26
|
getCommandInContext(uri: string, cursorOffset: number): Promise<string | null>;
|
|
53
27
|
getCommandAndLocationInContext(uri: string, offset: number): Promise<{
|
|
54
28
|
text: string;
|
|
@@ -88,7 +62,7 @@ export interface KustoWorker {
|
|
|
88
62
|
}[]>;
|
|
89
63
|
/**
|
|
90
64
|
* Get the global parameters that are actually being referenced in query.
|
|
91
|
-
* This is different from getQueryParams that will return the parameters
|
|
65
|
+
* This is different from getQueryParams that will return the parameters using a query declaration
|
|
92
66
|
* statement.
|
|
93
67
|
* It is also different from getGlobalParams that will return all global parameters whether used or not.
|
|
94
68
|
*/
|
|
@@ -96,7 +70,7 @@ export interface KustoWorker {
|
|
|
96
70
|
name: string;
|
|
97
71
|
type: string;
|
|
98
72
|
}[]>;
|
|
99
|
-
getReferencedSymbols(
|
|
73
|
+
getReferencedSymbols(uri: string, cursorOffset?: number): Promise<{
|
|
100
74
|
name: string;
|
|
101
75
|
kind: string;
|
|
102
76
|
display: string;
|
|
@@ -112,7 +86,7 @@ export interface KustoWorker {
|
|
|
112
86
|
start: number;
|
|
113
87
|
end: number;
|
|
114
88
|
}[], includeWarnings?: boolean, includeSuggestions?: boolean): Promise<ls.Diagnostic[]>;
|
|
115
|
-
setParameters(scalarParameters: readonly ScalarParameter[], tabularParameters: readonly TabularParameter[]): void
|
|
89
|
+
setParameters(scalarParameters: readonly ScalarParameter[], tabularParameters: readonly TabularParameter[]): Promise<void>;
|
|
116
90
|
/**
|
|
117
91
|
* Get all the database references from the current command.
|
|
118
92
|
* If database's schema is already cached in previous calls to setSchema or addDatabaseToSchema it will not be returned.
|
|
@@ -165,91 +139,6 @@ export interface KustoWorker {
|
|
|
165
139
|
export interface WorkerAccessor {
|
|
166
140
|
(first: monaco.Uri, ...more: monaco.Uri[]): Promise<KustoWorker>;
|
|
167
141
|
}
|
|
168
|
-
export interface Column {
|
|
169
|
-
name: string;
|
|
170
|
-
type: string;
|
|
171
|
-
docstring?: string;
|
|
172
|
-
}
|
|
173
|
-
export interface Table {
|
|
174
|
-
name: string;
|
|
175
|
-
columns: Column[];
|
|
176
|
-
docstring?: string;
|
|
177
|
-
}
|
|
178
|
-
export interface ScalarParameter {
|
|
179
|
-
name: string;
|
|
180
|
-
type?: string;
|
|
181
|
-
cslType?: string;
|
|
182
|
-
cslDefaultValue?: string;
|
|
183
|
-
}
|
|
184
|
-
export interface TabularParameter {
|
|
185
|
-
name: string;
|
|
186
|
-
columns: Column[];
|
|
187
|
-
docstring?: string;
|
|
188
|
-
}
|
|
189
|
-
export type InputParameter = ScalarParameter & {
|
|
190
|
-
columns?: ScalarParameter[];
|
|
191
|
-
};
|
|
192
|
-
export interface Function {
|
|
193
|
-
name: string;
|
|
194
|
-
body: string;
|
|
195
|
-
docstring?: string;
|
|
196
|
-
inputParameters: InputParameter[];
|
|
197
|
-
}
|
|
198
|
-
export interface Database {
|
|
199
|
-
name: string;
|
|
200
|
-
tables: Table[];
|
|
201
|
-
functions: Function[];
|
|
202
|
-
majorVersion: number;
|
|
203
|
-
minorVersion: number;
|
|
204
|
-
}
|
|
205
|
-
export interface EngineSchema {
|
|
206
|
-
clusterType: 'Engine';
|
|
207
|
-
cluster: {
|
|
208
|
-
connectionString: string;
|
|
209
|
-
databases: Database[];
|
|
210
|
-
};
|
|
211
|
-
database: Database | undefined;
|
|
212
|
-
}
|
|
213
|
-
export interface ClusterMangerSchema {
|
|
214
|
-
clusterType: 'ClusterManager';
|
|
215
|
-
accounts: string[];
|
|
216
|
-
services: string[];
|
|
217
|
-
connectionString: string;
|
|
218
|
-
}
|
|
219
|
-
export interface DataManagementSchema {
|
|
220
|
-
clusterType: 'DataManagement';
|
|
221
|
-
}
|
|
222
|
-
export type Schema = EngineSchema | ClusterMangerSchema | DataManagementSchema;
|
|
223
|
-
export declare type VisualizationType = 'anomalychart' | 'areachart' | 'barchart' | 'columnchart' | 'ladderchart' | 'linechart' | 'piechart' | 'pivotchart' | 'scatterchart' | 'stackedareachart' | 'timechart' | 'table' | 'timeline' | 'timepivot' | 'card';
|
|
224
|
-
export declare type Scale = 'linear' | 'log';
|
|
225
|
-
export declare type LegendVisibility = 'visible' | 'hidden';
|
|
226
|
-
export declare type YSplit = 'none' | 'axes' | 'panels';
|
|
227
|
-
export declare type Kind = 'default' | 'unstacked' | 'stacked' | 'stacked100' | 'map';
|
|
228
|
-
export interface RenderOptions {
|
|
229
|
-
visualization?: null | VisualizationType;
|
|
230
|
-
title?: null | string;
|
|
231
|
-
xcolumn?: null | string;
|
|
232
|
-
series?: null | string[];
|
|
233
|
-
ycolumns?: null | string[];
|
|
234
|
-
xtitle?: null | string;
|
|
235
|
-
ytitle?: null | string;
|
|
236
|
-
xaxis?: null | Scale;
|
|
237
|
-
yaxis?: null | Scale;
|
|
238
|
-
legend?: null | LegendVisibility;
|
|
239
|
-
ySplit?: null | YSplit;
|
|
240
|
-
accumulate?: null | boolean;
|
|
241
|
-
kind?: null | Kind;
|
|
242
|
-
anomalycolumns?: null | string[];
|
|
243
|
-
ymin?: null | number;
|
|
244
|
-
ymax?: null | number;
|
|
245
|
-
}
|
|
246
|
-
export interface RenderInfo {
|
|
247
|
-
options: RenderOptions;
|
|
248
|
-
location: {
|
|
249
|
-
startOffset: number;
|
|
250
|
-
endOffset: number;
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
142
|
export interface DatabaseReference {
|
|
254
143
|
databaseName: string;
|
|
255
144
|
clusterName: string;
|
|
@@ -257,5 +146,4 @@ export interface DatabaseReference {
|
|
|
257
146
|
export interface ClusterReference {
|
|
258
147
|
clusterName: string;
|
|
259
148
|
}
|
|
260
|
-
export type RenderOptionKeys = keyof RenderOptions;
|
|
261
149
|
export type OnDidProvideCompletionItems = (list: ls.CompletionList) => Promise<ls.CompletionList>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
2
2
|
import type { LanguageServiceDefaults } from './monaco.contribution';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IKustoWorkerImpl } from './kustoWorker';
|
|
4
4
|
export declare class WorkerManager {
|
|
5
5
|
private _monacoInstance;
|
|
6
6
|
private _storedState;
|
|
@@ -16,5 +16,5 @@ export declare class WorkerManager {
|
|
|
16
16
|
dispose(): void;
|
|
17
17
|
private _checkIfIdle;
|
|
18
18
|
private _getClient;
|
|
19
|
-
getLanguageServiceWorker(...resources: monaco.Uri[]): Promise<
|
|
19
|
+
getLanguageServiceWorker(...resources: monaco.Uri[]): Promise<IKustoWorkerImpl>;
|
|
20
20
|
}
|