@kusto/monaco-kusto 5.3.9 → 5.3.11

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.
@@ -25,7 +25,7 @@ declare module monaco.languages.kusto {
25
25
  formatter?: FormatterOptions;
26
26
  enableQueryWarnings?: boolean;
27
27
  enableQuerySuggestions?: boolean;
28
- disabledDiagnoticCodes?: string[];
28
+ disabledDiagnosticCodes?: string[];
29
29
  }
30
30
 
31
31
  export interface SyntaxErrorAsMarkDownOptions {
@@ -38,7 +38,7 @@ declare module monaco.languages.kusto {
38
38
  indentationSize?: number;
39
39
  pipeOperatorStyle?: FormatterPlacementStyle;
40
40
  }
41
-
41
+
42
42
  export type FormatterPlacementStyle = 'None' | 'NewLine' | 'Smart';
43
43
 
44
44
  export interface LanguageServiceDefaults {
@@ -73,7 +73,8 @@ declare module monaco.languages.kusto {
73
73
  schema: any,
74
74
  clusterConnectionString: string,
75
75
  databaseInContextName: string,
76
- globalParameters: ScalarParameter[]
76
+ globalScalarParameters: ScalarParameter[],
77
+ globalTabularParameters: TabularParameter[]
77
78
  ): Promise<void>;
78
79
  normalizeSchema(
79
80
  schema: any,
@@ -98,7 +99,7 @@ declare module monaco.languages.kusto {
98
99
 
99
100
  /**
100
101
  * Get all the ambient parameters defined in global scope.
101
- * Ambient parameters are parameters that are not defined in the syntax such as in a query paramter declaration.
102
+ * Ambient parameters are parameters that are not defined in the syntax such as in a query parameter declaration.
102
103
  * These are parameters that are injected from outside, usually by a UX application that would like to offer
103
104
  * the user intellisense for a symbol, without forcing them to write a query declaration statement.
104
105
  * Usually the same application injects the query declaration statement and the parameter values when
@@ -120,14 +121,22 @@ declare module monaco.languages.kusto {
120
121
  doDocumentFormat(uri: string): Promise<ls.TextEdit[]>;
121
122
  doRangeFormat(uri: string, range: ls.Range): Promise<ls.TextEdit[]>;
122
123
  doCurrentCommandFormat(uri: string, caretPosition: ls.Position): Promise<ls.TextEdit[]>;
123
- doValidation(uri: string, intervals: { start: number; end: number }[], includeWarnings?: boolean, includeSuggestions?: boolean): Promise<ls.Diagnostic[]>;
124
- setParameters(parameters: ScalarParameter[]): void;
124
+ doValidation(
125
+ uri: string,
126
+ intervals: { start: number; end: number }[],
127
+ includeWarnings?: boolean,
128
+ includeSuggestions?: boolean
129
+ ): Promise<ls.Diagnostic[]>;
130
+ setParameters(
131
+ scalarParameters: readonly ScalarParameter[],
132
+ tabularParameters: readonly TabularParameter[]
133
+ ): void;
125
134
  /**
126
- * Get all the database references from the current command.
135
+ * Get all the database references from the current command.
127
136
  * If database's schema is already cached in previous calls to setSchema or addDatabaseToSchema it will not be returned.
128
137
  * This method should be used to get all the cross-databases in a command, then schema for the database should be fetched and added with addDatabaseToSchema.
129
138
  * @example
130
- * If the current command includes: cluster('help').database('Samples')
139
+ * If the current command includes: cluster('help').database('Samples')
131
140
  * getDatabaseReferences will return [{ clusterName: 'help', databaseName 'Samples' }]
132
141
  */
133
142
  getDatabaseReferences(uri: string, cursorOffset: number): Promise<DatabaseReference[]>;
@@ -149,7 +158,7 @@ declare module monaco.languages.kusto {
149
158
  * @param clusterName the name of the cluster as returned from getDatabaseReferences/getClusterReferences.
150
159
  * @example
151
160
  * - User enters cluster('help').database('Samples')
152
- * - hosting app calls getDatabaseReferences which returns [{ clusterName: 'help', databaseName: 'Samples' }].
161
+ * - hosting app calls getDatabaseReferences which returns [{ clusterName: 'help', databaseName: 'Samples' }].
153
162
  * - hosting app fetches the database Schema from https://help.kusto.windows.net
154
163
  * - hosting app calls 'addDatabaseToSchema' with the database's schema.
155
164
  * - now, when user types cluster('help').database('Samples') then the auto complete list will show all the tables.
@@ -160,12 +169,12 @@ declare module monaco.languages.kusto {
160
169
  * @param clusterName the name of the cluster as returned in getClusterReferences.
161
170
  * @example
162
171
  * - User enters cluster('help')
163
- * - hosting app calls getClusterReferences which returns [{ clusterName: 'help' }].
172
+ * - hosting app calls getClusterReferences which returns [{ clusterName: 'help' }].
164
173
  * - hosting app fetches the list of databases from https://help.kusto.windows.net
165
174
  * - hosting app calls addClusterToSchema with the list of databases.
166
175
  * - now, when user type `cluster('help').database(` then the auto complete list will show all the databases.
167
176
  */
168
- addClusterToSchema(uri: string, clusterName: string, databasesNames: string[]): Promise<void>;
177
+ addClusterToSchema(uri: string, clusterName: string, databasesNames: readonly string[]): Promise<void>;
169
178
  }
170
179
 
171
180
  /**
@@ -193,6 +202,12 @@ declare module monaco.languages.kusto {
193
202
  cslDefaultValue?: string;
194
203
  }
195
204
 
205
+ export interface TabularParameter {
206
+ name: string;
207
+ columns: Column[];
208
+ docstring?: string;
209
+ }
210
+
196
211
  // 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
197
212
  // it will have a name, and a list of scalar types which are the column types.
198
213
  export type InputParameter = ScalarParameter & { columns?: ScalarParameter[] };
@@ -283,11 +298,11 @@ declare module monaco.languages.kusto {
283
298
 
284
299
  export interface DatabaseReference {
285
300
  databaseName: string;
286
- clusterName: string;
287
- };
301
+ clusterName: string;
302
+ }
288
303
 
289
304
  export interface ClusterReference {
290
- clusterName: string;
305
+ clusterName: string;
291
306
  }
292
307
 
293
308
  export type RenderOptionKeys = keyof RenderOptions;
package/scripts/bundle.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const requirejs = require('requirejs');
2
2
  const path = require('path');
3
3
  const fs = require('fs');
4
- const Terser = require("terser");
4
+ const Terser = require('terser');
5
5
  const helpers = require('monaco-plugin-helpers');
6
6
 
7
7
  const REPO_ROOT = path.resolve(__dirname, '..');
@@ -11,55 +11,62 @@ const semver = require('../package.json').version;
11
11
  const headerVersion = semver + '(' + sha1 + ')';
12
12
 
13
13
  const BUNDLED_FILE_HEADER = [
14
- '/*!-----------------------------------------------------------------------------',
15
- ' * Copyright (c) Microsoft Corporation. All rights reserved.',
16
- ' * monaco-kusto version: ' + headerVersion,
17
- ' * Released under the MIT license',
18
- ' * https://https://github.com/Azure/monaco-kusto/blob/master/README.md',
19
- ' *-----------------------------------------------------------------------------*/',
20
- ''
14
+ '/*!-----------------------------------------------------------------------------',
15
+ ' * Copyright (c) Microsoft Corporation. All rights reserved.',
16
+ ' * monaco-kusto version: ' + headerVersion,
17
+ ' * Released under the MIT license',
18
+ ' * https://https://github.com/Azure/monaco-kusto/blob/master/README.md',
19
+ ' *-----------------------------------------------------------------------------*/',
20
+ '',
21
21
  ].join('\n');
22
22
 
23
- bundleOne('monaco.contribution', ['vs/language/kusto/kustoMode']),
24
- bundleOne('kustoMode'),
25
- bundleOne('kustoWorker')
23
+ bundleOne('monaco.contribution', ['vs/language/kusto/kustoMode']), bundleOne('kustoMode'), bundleOne('kustoWorker');
26
24
 
27
25
  function bundleOne(moduleId, exclude) {
28
- requirejs.optimize({
29
- baseUrl: './',
30
- name: 'vs/language/kusto/' + moduleId,
31
- out: 'release/dev/' + moduleId + '.js',
32
- exclude: exclude,
33
- paths: {
34
- 'vs/language/kusto': REPO_ROOT + '/out/amd'
35
- },
36
- optimize: 'none',
37
- packages: [{
38
- name: 'vscode-languageserver-types',
39
- location: path.join(REPO_ROOT, '/node_modules/vscode-languageserver-types/lib/umd'),
40
- main: 'main'
41
- }, {
42
- name: 'xregexp',
43
- location: path.join(REPO_ROOT, '/node_modules/xregexp'),
44
- main: 'xregexp-all.js'
45
- }, {
46
- name: 'lodash',
47
- location: path.join(REPO_ROOT, '/node_modules/lodash'),
48
- main: 'lodash.min.js'
49
- }],
50
- }, function (buildResponse) {
51
- const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
52
- const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
53
- const fileContents = fs.readFileSync(devFilePath).toString();
54
- console.log();
55
- console.log(`Minifying ${devFilePath}...`);
56
- const result = Terser.minify(fileContents, {
57
- output: {
58
- comments: 'some'
59
- }
60
- });
61
- console.log(`Done.`);
62
- try { fs.mkdirSync(path.join(REPO_ROOT, 'release/min')) } catch (err) { }
63
- fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
64
- })
26
+ requirejs.optimize(
27
+ {
28
+ baseUrl: './',
29
+ name: 'vs/language/kusto/' + moduleId,
30
+ out: 'release/dev/' + moduleId + '.js',
31
+ exclude: exclude,
32
+ paths: {
33
+ 'vs/language/kusto': REPO_ROOT + '/out/amd',
34
+ },
35
+ optimize: 'none',
36
+ packages: [
37
+ {
38
+ name: 'vscode-languageserver-types',
39
+ location: path.join(REPO_ROOT, '/node_modules/vscode-languageserver-types/lib/umd'),
40
+ main: 'main',
41
+ },
42
+ {
43
+ name: 'xregexp',
44
+ location: path.join(REPO_ROOT, '/node_modules/xregexp'),
45
+ main: 'xregexp-all.js',
46
+ },
47
+ {
48
+ name: 'lodash',
49
+ location: path.join(REPO_ROOT, '/node_modules/lodash'),
50
+ main: 'lodash.min.js',
51
+ },
52
+ ],
53
+ },
54
+ function (buildResponse) {
55
+ const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
56
+ const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
57
+ const fileContents = fs.readFileSync(devFilePath).toString();
58
+ console.log();
59
+ console.log(`Minifying ${devFilePath}...`);
60
+ const result = Terser.minify(fileContents, {
61
+ output: {
62
+ comments: 'some',
63
+ },
64
+ });
65
+ console.log(`Done.`);
66
+ try {
67
+ fs.mkdirSync(path.join(REPO_ROOT, 'release/min'));
68
+ } catch (err) {}
69
+ fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
70
+ }
71
+ );
65
72
  }
@@ -4,23 +4,16 @@ const helpers = require('monaco-plugin-helpers');
4
4
  const REPO_ROOT = path.join(__dirname, '../');
5
5
 
6
6
  helpers.packageESM({
7
- repoRoot: REPO_ROOT,
8
- esmSource: 'out/esm',
9
- esmDestination: 'release/esm',
10
- entryPoints: [
11
- 'monaco.contribution.js',
12
- 'kustoMode.js',
13
- 'kusto.worker.js',
14
- ],
15
- resolveAlias: {
16
- },
17
- resolveSkip: [
18
- 'monaco-editor-core'
19
- ],
20
- destinationFolderSimplification: {
21
- 'node_modules': '_deps',
22
- 'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
23
- '/node_modules/xregexp': 'xregexp',
24
- '/node_modules/lodash': 'lodash'
25
- }
26
- });
7
+ repoRoot: REPO_ROOT,
8
+ esmSource: 'out/esm',
9
+ esmDestination: 'release/esm',
10
+ entryPoints: ['monaco.contribution.js', 'kustoMode.js', 'kusto.worker.js'],
11
+ resolveAlias: {},
12
+ resolveSkip: ['monaco-editor-core'],
13
+ destinationFolderSimplification: {
14
+ node_modules: '_deps',
15
+ 'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
16
+ '/node_modules/xregexp': 'xregexp',
17
+ '/node_modules/lodash': 'lodash',
18
+ },
19
+ });
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "outDir": "./out/esm",
7
+ "target": "es5",
8
+ "lib": ["es2020", "dom", "WebWorker.ImportScripts"],
9
+ "alwaysStrict": true,
10
+ "declaration": true,
11
+ "skipLibCheck": true,
12
+ "types": [
13
+ "monaco-editor-core/monaco",
14
+ "@kusto/language-service/Kusto.JavaScript.Client",
15
+ "@kusto/language-service-next/Kusto.Language.Bridge"
16
+ ]
17
+ }
18
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "include": ["./src/**/*"],
4
+ "compilerOptions": {
5
+ "rootDir": "./src",
6
+ "module": "amd",
7
+ "moduleResolution": "node",
8
+ "outDir": "./out/amd",
9
+ "target": "es5",
10
+ "lib": ["es2020", "dom", "WebWorker.ImportScripts"],
11
+ "alwaysStrict": true,
12
+ "declaration": true,
13
+ "skipLibCheck": true,
14
+ "types": [
15
+ "monaco-editor-core/monaco",
16
+ "@kusto/language-service/Kusto.JavaScript.Client",
17
+ "@kusto/language-service-next/Kusto.Language.Bridge"
18
+ ]
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "sourceMap": true,
6
+ "sourceRoot": "./src"
7
+ }
8
+ }