@kusto/monaco-kusto 8.3.0 → 9.0.1
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/package.json +1 -1
- package/release/dev/kustoMode.js +2 -2
- package/release/dev/kustoWorker.js +101 -77
- package/release/dev/{main-e6ef956d.js → main-3ce9fab8.js} +2 -2
- package/release/dev/monaco.contribution.js +2 -2
- package/release/dev/{schema-7d65ed04.js → schema-780b30a5.js} +2 -2
- package/release/esm/kusto.worker.js +47 -33
- package/release/esm/languageService/kustoLanguageService.d.ts +2 -2
- package/release/esm/languageService/kustoLanguageService.js +56 -37
- package/release/esm/languageService/schema.d.ts +7 -0
- package/release/esm/{schema-ee621489.js → schema-cb0f4140.js} +1 -1
- package/release/min/kustoMode.js +2 -2
- package/release/min/kustoWorker.js +4 -4
- package/release/min/{main-04a9f035.js → main-3692c2f3.js} +2 -2
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/{schema-095fdf5a.js → schema-0b9a0786.js} +2 -2
package/package.json
CHANGED
package/release/dev/kustoMode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 9.0.1(f5a32d15a425500f1b758b3086d32627195845f9)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
7
7
|
|
|
8
|
-
define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-
|
|
8
|
+
define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-3ce9fab8'], (function (exports, monaco, main) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 9.0.1(f5a32d15a425500f1b758b3086d32627195845f9)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
7
7
|
|
|
8
|
-
define('vs/language/kusto/kustoWorker', ['exports', './main-
|
|
8
|
+
define('vs/language/kusto/kustoWorker', ['exports', './main-3ce9fab8', './schema-780b30a5'], (function (exports, main, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _slicedToArray$2(arr, i) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$2(); }
|
|
11
11
|
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -3463,7 +3463,10 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
3463
3463
|
);
|
|
3464
3464
|
}
|
|
3465
3465
|
|
|
3466
|
+
var _excluded = ["name", "columns", "entityType", "docstring"];
|
|
3466
3467
|
var _symbolKindToName;
|
|
3468
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3469
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
3467
3470
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest(); }
|
|
3468
3471
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3469
3472
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -4347,12 +4350,15 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
4347
4350
|
* @param schema schema json as received from .show schema as json
|
|
4348
4351
|
* @param clusterConnectionString cluster connection string
|
|
4349
4352
|
* @param databaseInContextName name of database in context
|
|
4353
|
+
* @param globalScalarParameters
|
|
4354
|
+
* @param globalTabularParameters
|
|
4355
|
+
* @param databaseInContextAlternateName alternate name of database in context
|
|
4350
4356
|
*/
|
|
4351
4357
|
}, {
|
|
4352
4358
|
key: "setSchemaFromShowSchema",
|
|
4353
|
-
value: function setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters) {
|
|
4359
|
+
value: function setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters, databaseInContextAlternateName) {
|
|
4354
4360
|
var _this8 = this;
|
|
4355
|
-
return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName).then(function (normalized) {
|
|
4361
|
+
return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName).then(function (normalized) {
|
|
4356
4362
|
return _this8.setSchema(_objectSpread(_objectSpread({}, normalized), {}, {
|
|
4357
4363
|
globalScalarParameters: globalScalarParameters,
|
|
4358
4364
|
globalTabularParameters: globalTabularParameters
|
|
@@ -4365,47 +4371,60 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
4365
4371
|
* @param schema result of show schema
|
|
4366
4372
|
* @param clusterConnectionString cluster connection string`
|
|
4367
4373
|
* @param databaseInContextName database in context name
|
|
4374
|
+
* @param databaseInContextAlternateName database in context alternate name
|
|
4368
4375
|
*/
|
|
4369
4376
|
}, {
|
|
4370
4377
|
key: "normalizeSchema",
|
|
4371
|
-
value: function normalizeSchema(schema, clusterConnectionString, databaseInContextName) {
|
|
4378
|
+
value: function normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
|
|
4372
4379
|
var databases = Object.keys(schema.Databases).map(function (key) {
|
|
4373
4380
|
return schema.Databases[key];
|
|
4374
4381
|
}).map(function (_ref4) {
|
|
4375
|
-
var
|
|
4382
|
+
var _ref7;
|
|
4376
4383
|
var Name = _ref4.Name,
|
|
4377
4384
|
Tables = _ref4.Tables,
|
|
4378
4385
|
ExternalTables = _ref4.ExternalTables,
|
|
4379
4386
|
MaterializedViews = _ref4.MaterializedViews,
|
|
4380
4387
|
Functions = _ref4.Functions,
|
|
4388
|
+
_ref4$EntityGroups = _ref4.EntityGroups,
|
|
4389
|
+
EntityGroups = _ref4$EntityGroups === void 0 ? {} : _ref4$EntityGroups,
|
|
4381
4390
|
MinorVersion = _ref4.MinorVersion,
|
|
4382
4391
|
MajorVersion = _ref4.MajorVersion;
|
|
4383
4392
|
return {
|
|
4384
4393
|
name: Name,
|
|
4394
|
+
alternateName: databaseInContextAlternateName,
|
|
4385
4395
|
minorVersion: MinorVersion,
|
|
4386
4396
|
majorVersion: MajorVersion,
|
|
4387
|
-
|
|
4388
|
-
var
|
|
4389
|
-
|
|
4397
|
+
entityGroups: Object.entries(EntityGroups).map(function (_ref5) {
|
|
4398
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
4399
|
+
name = _ref6[0],
|
|
4400
|
+
members = _ref6[1];
|
|
4401
|
+
return {
|
|
4402
|
+
name: name,
|
|
4403
|
+
members: members
|
|
4404
|
+
};
|
|
4405
|
+
}),
|
|
4406
|
+
tables: (_ref7 = []).concat.apply(_ref7, _toConsumableArray([[Tables, 'Table'], [MaterializedViews, 'MaterializedView'], [ExternalTables, 'ExternalTable']].filter(function (_ref8) {
|
|
4407
|
+
var _ref9 = _slicedToArray(_ref8, 1),
|
|
4408
|
+
tableContainer = _ref9[0];
|
|
4390
4409
|
return tableContainer;
|
|
4391
|
-
}).map(function (
|
|
4392
|
-
var
|
|
4393
|
-
tableContainer =
|
|
4394
|
-
tableEntity =
|
|
4395
|
-
return Object.values(tableContainer).map(function (
|
|
4396
|
-
var Name =
|
|
4397
|
-
OrderedColumns =
|
|
4398
|
-
DocString =
|
|
4410
|
+
}).map(function (_ref10) {
|
|
4411
|
+
var _ref11 = _slicedToArray(_ref10, 2),
|
|
4412
|
+
tableContainer = _ref11[0],
|
|
4413
|
+
tableEntity = _ref11[1];
|
|
4414
|
+
return Object.values(tableContainer).map(function (_ref12) {
|
|
4415
|
+
var Name = _ref12.Name,
|
|
4416
|
+
OrderedColumns = _ref12.OrderedColumns,
|
|
4417
|
+
DocString = _ref12.DocString;
|
|
4399
4418
|
return {
|
|
4400
4419
|
name: Name,
|
|
4401
4420
|
docstring: DocString,
|
|
4402
4421
|
entityType: tableEntity,
|
|
4403
|
-
columns: OrderedColumns.map(function (
|
|
4404
|
-
var Name =
|
|
4405
|
-
|
|
4406
|
-
var DocString =
|
|
4407
|
-
CslType =
|
|
4408
|
-
Examples =
|
|
4422
|
+
columns: OrderedColumns.map(function (_ref13) {
|
|
4423
|
+
var Name = _ref13.Name;
|
|
4424
|
+
_ref13.Type;
|
|
4425
|
+
var DocString = _ref13.DocString,
|
|
4426
|
+
CslType = _ref13.CslType,
|
|
4427
|
+
Examples = _ref13.Examples;
|
|
4409
4428
|
return {
|
|
4410
4429
|
name: Name,
|
|
4411
4430
|
type: CslType,
|
|
@@ -4418,11 +4437,11 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
4418
4437
|
}))),
|
|
4419
4438
|
functions: Object.keys(Functions).map(function (key) {
|
|
4420
4439
|
return Functions[key];
|
|
4421
|
-
}).map(function (
|
|
4422
|
-
var Name =
|
|
4423
|
-
Body =
|
|
4424
|
-
DocString =
|
|
4425
|
-
InputParameters =
|
|
4440
|
+
}).map(function (_ref14) {
|
|
4441
|
+
var Name = _ref14.Name,
|
|
4442
|
+
Body = _ref14.Body,
|
|
4443
|
+
DocString = _ref14.DocString,
|
|
4444
|
+
InputParameters = _ref14.InputParameters;
|
|
4426
4445
|
return {
|
|
4427
4446
|
name: Name,
|
|
4428
4447
|
body: Body,
|
|
@@ -4531,10 +4550,10 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
4531
4550
|
value: function getCommandsInDocumentV1(document) {
|
|
4532
4551
|
this.parseDocumentV1(document, k.ParseMode.CommandTokensOnly);
|
|
4533
4552
|
var commands = this.toArray(this._parser.Results);
|
|
4534
|
-
return Promise.resolve(commands.map(function (
|
|
4535
|
-
var AbsoluteStart =
|
|
4536
|
-
AbsoluteEnd =
|
|
4537
|
-
Text =
|
|
4553
|
+
return Promise.resolve(commands.map(function (_ref15) {
|
|
4554
|
+
var AbsoluteStart = _ref15.AbsoluteStart,
|
|
4555
|
+
AbsoluteEnd = _ref15.AbsoluteEnd,
|
|
4556
|
+
Text = _ref15.Text;
|
|
4538
4557
|
return {
|
|
4539
4558
|
absoluteStart: AbsoluteStart,
|
|
4540
4559
|
absoluteEnd: AbsoluteEnd,
|
|
@@ -4610,10 +4629,10 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
4610
4629
|
var commands = this.toArray(script.Blocks).filter(function (command) {
|
|
4611
4630
|
return command.Text.trim() != '';
|
|
4612
4631
|
});
|
|
4613
|
-
return Promise.resolve(commands.map(function (
|
|
4614
|
-
var Start =
|
|
4615
|
-
End =
|
|
4616
|
-
Text =
|
|
4632
|
+
return Promise.resolve(commands.map(function (_ref16) {
|
|
4633
|
+
var Start = _ref16.Start,
|
|
4634
|
+
End = _ref16.End,
|
|
4635
|
+
Text = _ref16.Text;
|
|
4617
4636
|
return {
|
|
4618
4637
|
absoluteStart: Start,
|
|
4619
4638
|
absoluteEnd: End,
|
|
@@ -5225,10 +5244,10 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
5225
5244
|
}
|
|
5226
5245
|
|
|
5227
5246
|
// This is a cluster manger
|
|
5228
|
-
var
|
|
5229
|
-
accounts =
|
|
5230
|
-
services =
|
|
5231
|
-
connectionString =
|
|
5247
|
+
var _ref17 = schema,
|
|
5248
|
+
accounts = _ref17.accounts,
|
|
5249
|
+
services = _ref17.services,
|
|
5250
|
+
connectionString = _ref17.connectionString;
|
|
5232
5251
|
new k.KustoIntelliSenseAccountEntity();
|
|
5233
5252
|
new k.KustoIntelliSenseServiceEntity();
|
|
5234
5253
|
this._rulesProvider = new k.ClusterManagerIntelliSenseRulesProvider.$ctor1(new Bridge.ArrayEnumerable(accounts), new Bridge.ArrayEnumerable(services), connectionString);
|
|
@@ -5285,6 +5304,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
5285
5304
|
var database = {
|
|
5286
5305
|
majorVersion: 0,
|
|
5287
5306
|
minorVersion: 0,
|
|
5307
|
+
entityGroups: [],
|
|
5288
5308
|
name: 'Kuskus',
|
|
5289
5309
|
tables: [{
|
|
5290
5310
|
name: 'KustoLogs',
|
|
@@ -5489,43 +5509,10 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
5489
5509
|
}, {
|
|
5490
5510
|
key: "convertToDatabaseSymbol",
|
|
5491
5511
|
value: function convertToDatabaseSymbol(db) {
|
|
5492
|
-
var
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
// TODO: handle outputColumns (right now it doesn't seem to be implemented for any function).
|
|
5498
|
-
return new sym.FunctionSymbol.$ctor14(fn.name, fn.body, KustoLanguageService.toBridgeList(parameters), fn.docstring);
|
|
5499
|
-
};
|
|
5500
|
-
var createTableSymbol = function createTableSymbol(tbl) {
|
|
5501
|
-
var _mvQuery;
|
|
5502
|
-
var columnSymbols = tbl.columns.map(function (col) {
|
|
5503
|
-
return KustoLanguageService.createColumnSymbol(col);
|
|
5504
|
-
});
|
|
5505
|
-
var symbol = new sym.TableSymbol.$ctor4(tbl.name, columnSymbols);
|
|
5506
|
-
symbol.Description = tbl.docstring;
|
|
5507
|
-
switch (tbl.entityType) {
|
|
5508
|
-
case 'MaterializedViewTable':
|
|
5509
|
-
var mvQuery = (_mvQuery = tbl.mvQuery) !== null && _mvQuery !== void 0 ? _mvQuery : null;
|
|
5510
|
-
symbol = new sym.MaterializedViewSymbol.$ctor2(tbl.name, symbol.Columns, mvQuery, tbl.docstring);
|
|
5511
|
-
symbol = symbol.WithIsMaterializedView(true);
|
|
5512
|
-
break;
|
|
5513
|
-
case 'ExternalTable':
|
|
5514
|
-
symbol = symbol.WithIsExternal(true);
|
|
5515
|
-
break;
|
|
5516
|
-
}
|
|
5517
|
-
return symbol;
|
|
5518
|
-
};
|
|
5519
|
-
var createDatabaseSymbol = function createDatabaseSymbol(db) {
|
|
5520
|
-
var tableSymbols = db.tables ? db.tables.map(function (tbl) {
|
|
5521
|
-
return createTableSymbol(tbl);
|
|
5522
|
-
}) : [];
|
|
5523
|
-
var functionSymbols = db.functions ? db.functions.map(function (fun) {
|
|
5524
|
-
return createFunctionSymbol(fun);
|
|
5525
|
-
}) : [];
|
|
5526
|
-
return new sym.DatabaseSymbol.ctor(db.name, tableSymbols.concat(functionSymbols));
|
|
5527
|
-
};
|
|
5528
|
-
var databaseSymbol = createDatabaseSymbol(db);
|
|
5512
|
+
var tableSymbols = (db.tables || []).map(this.createTableSymbol);
|
|
5513
|
+
var functionSymbols = (db.functions || []).map(this.createFunctionSymbol);
|
|
5514
|
+
var entityGroupsSymbols = (db.entityGroups || []).map(this.createEntityGroupSymbol);
|
|
5515
|
+
var databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols));
|
|
5529
5516
|
return databaseSymbol;
|
|
5530
5517
|
}
|
|
5531
5518
|
}, {
|
|
@@ -5546,6 +5533,43 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-e6ef956d', './schema
|
|
|
5546
5533
|
// copied from bridge.js from the implementation of Enumerable.prototype.toList
|
|
5547
5534
|
return new (System.Collections.Generic.List$1(System.Object).$ctor1)(array);
|
|
5548
5535
|
}
|
|
5536
|
+
}, {
|
|
5537
|
+
key: "createFunctionSymbol",
|
|
5538
|
+
value: function createFunctionSymbol(fn) {
|
|
5539
|
+
var parameters = fn.inputParameters.map(function (param) {
|
|
5540
|
+
return KustoLanguageService.createParameter(param);
|
|
5541
|
+
});
|
|
5542
|
+
|
|
5543
|
+
// TODO: handle outputColumns (right now it doesn't seem to be implemented for any function).
|
|
5544
|
+
return new sym.FunctionSymbol.$ctor14(fn.name, fn.body, KustoLanguageService.toBridgeList(parameters), fn.docstring);
|
|
5545
|
+
}
|
|
5546
|
+
}, {
|
|
5547
|
+
key: "createTableSymbol",
|
|
5548
|
+
value: function createTableSymbol(_ref18) {
|
|
5549
|
+
var _mvQuery;
|
|
5550
|
+
var name = _ref18.name,
|
|
5551
|
+
columns = _ref18.columns,
|
|
5552
|
+
entityType = _ref18.entityType,
|
|
5553
|
+
docstring = _ref18.docstring,
|
|
5554
|
+
tbl = _objectWithoutProperties(_ref18, _excluded);
|
|
5555
|
+
var columnSymbols = new Bridge.ArrayEnumerable(columns.map(function (col) {
|
|
5556
|
+
return KustoLanguageService.createColumnSymbol(col);
|
|
5557
|
+
}));
|
|
5558
|
+
switch (entityType) {
|
|
5559
|
+
case 'MaterializedViewTable':
|
|
5560
|
+
var mvQuery = (_mvQuery = tbl.mvQuery) !== null && _mvQuery !== void 0 ? _mvQuery : null;
|
|
5561
|
+
return new sym.MaterializedViewSymbol.$ctor2(name, columnSymbols, mvQuery, docstring);
|
|
5562
|
+
case 'ExternalTable':
|
|
5563
|
+
return new sym.ExternalTableSymbol.$ctor3(name, columnSymbols, docstring);
|
|
5564
|
+
default:
|
|
5565
|
+
return new sym.TableSymbol.$ctor6(name, columnSymbols, docstring);
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5568
|
+
}, {
|
|
5569
|
+
key: "createEntityGroupSymbol",
|
|
5570
|
+
value: function createEntityGroupSymbol(entityGroup) {
|
|
5571
|
+
return new sym.EntityGroupSymbol.$ctor3(entityGroup.name, entityGroup.members.join(), null);
|
|
5572
|
+
}
|
|
5549
5573
|
}]);
|
|
5550
5574
|
return KustoLanguageService;
|
|
5551
5575
|
}();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 9.0.1(f5a32d15a425500f1b758b3086d32627195845f9)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
7
7
|
|
|
8
|
-
define('vs/language/kusto/main-
|
|
8
|
+
define('vs/language/kusto/main-3ce9fab8', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
/* --------------------------------------------------------------------------------------------
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 9.0.1(f5a32d15a425500f1b758b3086d32627195845f9)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
7
7
|
|
|
8
|
-
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-
|
|
8
|
+
define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-780b30a5'], (function (require, exports, monaco, schema) { 'use strict';
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
11
|
var n = Object.create(null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 9.0.1(f5a32d15a425500f1b758b3086d32627195845f9)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
7
7
|
|
|
8
|
-
define('vs/language/kusto/schema-
|
|
8
|
+
define('vs/language/kusto/schema-780b30a5', ['exports'], (function (exports) { 'use strict';
|
|
9
9
|
|
|
10
10
|
// Definition of schema object in the context of language services. This model is exposed to consumers of this library.
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* monaco-kusto version:
|
|
3
|
+
* monaco-kusto version: 9.0.1(f5a32d15a425500f1b758b3086d32627195845f9)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://https://github.com/Azure/monaco-kusto/blob/master/README.md
|
|
6
6
|
*-----------------------------------------------------------------------------*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as worker from 'monaco-editor/esm/vs/editor/editor.worker';
|
|
9
9
|
import * as ls from 'vscode-languageserver-types';
|
|
10
10
|
import XRegExp from 'xregexp';
|
|
11
|
-
import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-
|
|
11
|
+
import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-cb0f4140.js';
|
|
12
12
|
import '@kusto/language-service/bridge.min';
|
|
13
13
|
import '@kusto/language-service/Kusto.JavaScript.Client.min';
|
|
14
14
|
import '@kusto/language-service/newtonsoft.json.min';
|
|
@@ -813,9 +813,12 @@ class KustoLanguageService {
|
|
|
813
813
|
* @param schema schema json as received from .show schema as json
|
|
814
814
|
* @param clusterConnectionString cluster connection string
|
|
815
815
|
* @param databaseInContextName name of database in context
|
|
816
|
+
* @param globalScalarParameters
|
|
817
|
+
* @param globalTabularParameters
|
|
818
|
+
* @param databaseInContextAlternateName alternate name of database in context
|
|
816
819
|
*/
|
|
817
|
-
setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters) {
|
|
818
|
-
return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName).then(normalized => this.setSchema({
|
|
820
|
+
setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters, databaseInContextAlternateName) {
|
|
821
|
+
return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName).then(normalized => this.setSchema({
|
|
819
822
|
...normalized,
|
|
820
823
|
globalScalarParameters,
|
|
821
824
|
globalTabularParameters
|
|
@@ -827,20 +830,27 @@ class KustoLanguageService {
|
|
|
827
830
|
* @param schema result of show schema
|
|
828
831
|
* @param clusterConnectionString cluster connection string`
|
|
829
832
|
* @param databaseInContextName database in context name
|
|
833
|
+
* @param databaseInContextAlternateName database in context alternate name
|
|
830
834
|
*/
|
|
831
|
-
normalizeSchema(schema, clusterConnectionString, databaseInContextName) {
|
|
835
|
+
normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
|
|
832
836
|
const databases = Object.keys(schema.Databases).map(key => schema.Databases[key]).map(({
|
|
833
837
|
Name,
|
|
834
838
|
Tables,
|
|
835
839
|
ExternalTables,
|
|
836
840
|
MaterializedViews,
|
|
837
841
|
Functions,
|
|
842
|
+
EntityGroups = {},
|
|
838
843
|
MinorVersion,
|
|
839
844
|
MajorVersion
|
|
840
845
|
}) => ({
|
|
841
846
|
name: Name,
|
|
847
|
+
alternateName: databaseInContextAlternateName,
|
|
842
848
|
minorVersion: MinorVersion,
|
|
843
849
|
majorVersion: MajorVersion,
|
|
850
|
+
entityGroups: Object.entries(EntityGroups).map(([name, members]) => ({
|
|
851
|
+
name,
|
|
852
|
+
members
|
|
853
|
+
})),
|
|
844
854
|
tables: [].concat(...[[Tables, 'Table'], [MaterializedViews, 'MaterializedView'], [ExternalTables, 'ExternalTable']].filter(([tableContainer]) => tableContainer).map(([tableContainer, tableEntity]) => Object.values(tableContainer).map(({
|
|
845
855
|
Name,
|
|
846
856
|
OrderedColumns,
|
|
@@ -1332,6 +1342,7 @@ class KustoLanguageService {
|
|
|
1332
1342
|
const database = {
|
|
1333
1343
|
majorVersion: 0,
|
|
1334
1344
|
minorVersion: 0,
|
|
1345
|
+
entityGroups: [],
|
|
1335
1346
|
name: 'Kuskus',
|
|
1336
1347
|
tables: [{
|
|
1337
1348
|
name: 'KustoLogs',
|
|
@@ -1510,34 +1521,10 @@ class KustoLanguageService {
|
|
|
1510
1521
|
return new sym.Parameter.$ctor2(param.name, argumentType);
|
|
1511
1522
|
}
|
|
1512
1523
|
static convertToDatabaseSymbol(db) {
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
return new sym.FunctionSymbol.$ctor14(fn.name, fn.body, KustoLanguageService.toBridgeList(parameters), fn.docstring);
|
|
1518
|
-
};
|
|
1519
|
-
const createTableSymbol = tbl => {
|
|
1520
|
-
const columnSymbols = tbl.columns.map(col => KustoLanguageService.createColumnSymbol(col));
|
|
1521
|
-
let symbol = new sym.TableSymbol.$ctor4(tbl.name, columnSymbols);
|
|
1522
|
-
symbol.Description = tbl.docstring;
|
|
1523
|
-
switch (tbl.entityType) {
|
|
1524
|
-
case 'MaterializedViewTable':
|
|
1525
|
-
const mvQuery = tbl.mvQuery ?? null;
|
|
1526
|
-
symbol = new sym.MaterializedViewSymbol.$ctor2(tbl.name, symbol.Columns, mvQuery, tbl.docstring);
|
|
1527
|
-
symbol = symbol.WithIsMaterializedView(true);
|
|
1528
|
-
break;
|
|
1529
|
-
case 'ExternalTable':
|
|
1530
|
-
symbol = symbol.WithIsExternal(true);
|
|
1531
|
-
break;
|
|
1532
|
-
}
|
|
1533
|
-
return symbol;
|
|
1534
|
-
};
|
|
1535
|
-
const createDatabaseSymbol = db => {
|
|
1536
|
-
const tableSymbols = db.tables ? db.tables.map(tbl => createTableSymbol(tbl)) : [];
|
|
1537
|
-
const functionSymbols = db.functions ? db.functions.map(fun => createFunctionSymbol(fun)) : [];
|
|
1538
|
-
return new sym.DatabaseSymbol.ctor(db.name, tableSymbols.concat(functionSymbols));
|
|
1539
|
-
};
|
|
1540
|
-
const databaseSymbol = createDatabaseSymbol(db);
|
|
1524
|
+
const tableSymbols = (db.tables || []).map(this.createTableSymbol);
|
|
1525
|
+
const functionSymbols = (db.functions || []).map(this.createFunctionSymbol);
|
|
1526
|
+
const entityGroupsSymbols = (db.entityGroups || []).map(this.createEntityGroupSymbol);
|
|
1527
|
+
const databaseSymbol = new sym.DatabaseSymbol.$ctor2(db.name, db.alternateName || null, tableSymbols.concat(functionSymbols).concat(entityGroupsSymbols));
|
|
1541
1528
|
return databaseSymbol;
|
|
1542
1529
|
}
|
|
1543
1530
|
convertToKustoJsSchemaV2(schema) {
|
|
@@ -1898,6 +1885,33 @@ class KustoLanguageService {
|
|
|
1898
1885
|
const parsedAndAnalyzed = Kusto.Language.KustoCode.ParseAndAnalyze(text, this._kustoJsSchemaV2);
|
|
1899
1886
|
return parsedAndAnalyzed;
|
|
1900
1887
|
}
|
|
1888
|
+
static createFunctionSymbol(fn) {
|
|
1889
|
+
const parameters = fn.inputParameters.map(param => KustoLanguageService.createParameter(param));
|
|
1890
|
+
|
|
1891
|
+
// TODO: handle outputColumns (right now it doesn't seem to be implemented for any function).
|
|
1892
|
+
return new sym.FunctionSymbol.$ctor14(fn.name, fn.body, KustoLanguageService.toBridgeList(parameters), fn.docstring);
|
|
1893
|
+
}
|
|
1894
|
+
static createTableSymbol({
|
|
1895
|
+
name,
|
|
1896
|
+
columns,
|
|
1897
|
+
entityType,
|
|
1898
|
+
docstring,
|
|
1899
|
+
...tbl
|
|
1900
|
+
}) {
|
|
1901
|
+
const columnSymbols = new Bridge.ArrayEnumerable(columns.map(col => KustoLanguageService.createColumnSymbol(col)));
|
|
1902
|
+
switch (entityType) {
|
|
1903
|
+
case 'MaterializedViewTable':
|
|
1904
|
+
const mvQuery = tbl.mvQuery ?? null;
|
|
1905
|
+
return new sym.MaterializedViewSymbol.$ctor2(name, columnSymbols, mvQuery, docstring);
|
|
1906
|
+
case 'ExternalTable':
|
|
1907
|
+
return new sym.ExternalTableSymbol.$ctor3(name, columnSymbols, docstring);
|
|
1908
|
+
default:
|
|
1909
|
+
return new sym.TableSymbol.$ctor6(name, columnSymbols, docstring);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
static createEntityGroupSymbol(entityGroup) {
|
|
1913
|
+
return new sym.EntityGroupSymbol.$ctor3(entityGroup.name, entityGroup.members.join(), null);
|
|
1914
|
+
}
|
|
1901
1915
|
}
|
|
1902
1916
|
let languageService = new KustoLanguageService(KustoLanguageService.dummySchema, {
|
|
1903
1917
|
includeControlCommands: true,
|
|
@@ -80,8 +80,8 @@ export interface LanguageService {
|
|
|
80
80
|
doHover(document: TextDocument, position: ls.Position): Promise<ls.Hover | undefined>;
|
|
81
81
|
setParameters(scalarParameters: readonly s.ScalarParameter[], tabularParameters: readonly s.TabularParameter[]): Promise<void>;
|
|
82
82
|
setSchema(schema: s.Schema): Promise<void>;
|
|
83
|
-
setSchemaFromShowSchema(schema: s.showSchema.Result, clusterConnectionString: string, databaseInContextName: string, globalScalarParameters?: s.ScalarParameter[], globalTabularParameters?: s.TabularParameter[]): Promise<void>;
|
|
84
|
-
normalizeSchema(schema: s.showSchema.Result, clusterConnectionString: string, databaseInContextName: string): Promise<s.EngineSchema>;
|
|
83
|
+
setSchemaFromShowSchema(schema: s.showSchema.Result, clusterConnectionString: string, databaseInContextName: string, globalScalarParameters?: s.ScalarParameter[], globalTabularParameters?: s.TabularParameter[], databaseInContextAlternateName?: string): Promise<void>;
|
|
84
|
+
normalizeSchema(schema: s.showSchema.Result, clusterConnectionString: string, databaseInContextName: string, databaseInContextAlternateName?: string): Promise<s.EngineSchema>;
|
|
85
85
|
getSchema(): Promise<s.Schema>;
|
|
86
86
|
getCommandInContext(document: TextDocument, cursorOffset: number): Promise<string>;
|
|
87
87
|
getCommandAndLocationInContext(document: TextDocument, cursorOffset: number): Promise<{
|