@kusto/monaco-kusto 10.0.6 → 10.0.8

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.
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 10.0.6(2d98fbb291999138c08e16b68891b9e1c28dd4bf)
3
+ * monaco-kusto version: 10.0.8(134ff03184264a9900737e4b5cf93f69540e1c8e)
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-f70a1720'], (function (exports, monaco, main) { 'use strict';
8
+ define('vs/language/kusto/kustoMode', ['exports', 'vs/editor/editor.main', './main-5c133770'], (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: 10.0.6(2d98fbb291999138c08e16b68891b9e1c28dd4bf)
3
+ * monaco-kusto version: 10.0.8(134ff03184264a9900737e4b5cf93f69540e1c8e)
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-f70a1720', './schema-43c4cc5e'], (function (exports, main, schema) { 'use strict';
8
+ define('vs/language/kusto/kustoWorker', ['exports', './main-5c133770', './schema-5549fea4'], (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."); }
@@ -4311,7 +4311,6 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4311
4311
  }, {
4312
4312
  key: "setSchema",
4313
4313
  value: function setSchema(schema) {
4314
- var _this7 = this;
4315
4314
  this._schema = schema;
4316
4315
  // We support intellisenseV2 only if the clusterType is "Engine", even if the setting is enabled
4317
4316
  if (this._languageSettings.useIntellisenseV2 && schema && schema.clusterType === 'Engine') {
@@ -4322,12 +4321,11 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4322
4321
  }
4323
4322
 
4324
4323
  // since V2 doesn't support control commands, we're initializing V1 intellisense for both cases and we'll going to use V1 intellisense for control commands.
4325
- return new Promise(function (resolve, reject) {
4326
- var kustoJsSchema = schema ? KustoLanguageService.convertToKustoJsSchema(schema) : undefined;
4327
- _this7._kustoJsSchema = kustoJsSchema;
4328
- _this7.createRulesProvider(kustoJsSchema, schema.clusterType);
4329
- resolve(undefined);
4330
- });
4324
+
4325
+ var kustoJsSchema = schema ? KustoLanguageService.convertToKustoJsSchema(schema) : undefined;
4326
+ this._kustoJsSchema = kustoJsSchema;
4327
+ this.createRulesProvider(kustoJsSchema, schema.clusterType);
4328
+ return Promise.resolve();
4331
4329
  }
4332
4330
  }, {
4333
4331
  key: "setParameters",
@@ -4346,6 +4344,12 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4346
4344
  });
4347
4345
  this._kustoJsSchemaV2 = this._kustoJsSchemaV2.WithParameters(KustoLanguageService.toBridgeList([].concat(_toConsumableArray(scalarSymbols), _toConsumableArray(tabularSymbols))));
4348
4346
  this._script = (_this$_script = this._script) === null || _this$_script === void 0 ? void 0 : _this$_script.WithGlobals(this._kustoJsSchemaV2);
4347
+
4348
+ // Set parameters is only working with the below code. It didn't used to need this, why does it now?!?
4349
+ // Copy+pasted from setSchema
4350
+ var kustoJsSchema = KustoLanguageService.convertToKustoJsSchema(this._schema);
4351
+ this._kustoJsSchema = kustoJsSchema;
4352
+ this.createRulesProvider(kustoJsSchema, this._schema.clusterType);
4349
4353
  return Promise.resolve(undefined);
4350
4354
  }
4351
4355
 
@@ -4361,13 +4365,11 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4361
4365
  }, {
4362
4366
  key: "setSchemaFromShowSchema",
4363
4367
  value: function setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters, databaseInContextAlternateName) {
4364
- var _this8 = this;
4365
- return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName).then(function (normalized) {
4366
- return _this8.setSchema(_objectSpread(_objectSpread({}, normalized), {}, {
4367
- globalScalarParameters: globalScalarParameters,
4368
- globalTabularParameters: globalTabularParameters
4369
- }));
4370
- });
4368
+ var normalized = this._normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName);
4369
+ return this.setSchema(_objectSpread(_objectSpread({}, normalized), {}, {
4370
+ globalScalarParameters: globalScalarParameters,
4371
+ globalTabularParameters: globalTabularParameters
4372
+ }));
4371
4373
  }
4372
4374
 
4373
4375
  /**
@@ -4378,8 +4380,8 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4378
4380
  * @param databaseInContextAlternateName database in context alternate name
4379
4381
  */
4380
4382
  }, {
4381
- key: "normalizeSchema",
4382
- value: function normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
4383
+ key: "_normalizeSchema",
4384
+ value: function _normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
4383
4385
  var databases = Object.keys(schema.Databases).map(function (key) {
4384
4386
  return schema.Databases[key];
4385
4387
  }).map(function (_ref7) {
@@ -4469,7 +4471,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4469
4471
  })
4470
4472
  };
4471
4473
  });
4472
- var result = {
4474
+ return {
4473
4475
  clusterType: 'Engine',
4474
4476
  cluster: {
4475
4477
  connectionString: clusterConnectionString,
@@ -4479,7 +4481,19 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4479
4481
  return db.name === databaseInContextName;
4480
4482
  })[0]
4481
4483
  };
4482
- return Promise.resolve(result);
4484
+ }
4485
+
4486
+ /**
4487
+ * Converts the result of .show schema as json to a normalized schema used by kusto language service.
4488
+ * @param schema result of show schema
4489
+ * @param clusterConnectionString cluster connection string`
4490
+ * @param databaseInContextName database in context name
4491
+ * @param databaseInContextAlternateName database in context alternate name
4492
+ */
4493
+ }, {
4494
+ key: "normalizeSchema",
4495
+ value: function normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
4496
+ return Promise.resolve(this._normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName));
4483
4497
  }
4484
4498
  }, {
4485
4499
  key: "getSchema",
@@ -4585,7 +4599,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4585
4599
  }, {
4586
4600
  key: "getFormattedCommandsInDocumentV2",
4587
4601
  value: function getFormattedCommandsInDocumentV2(document, rangeStart, rangeEnd) {
4588
- var _this9 = this;
4602
+ var _this7 = this;
4589
4603
  var script = this.parseDocumentV2(document);
4590
4604
  var commands = this.toArray(script.Blocks).filter(function (command) {
4591
4605
  if (!command.Text || command.Text.trim() == '') return false;
@@ -4611,9 +4625,9 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4611
4625
  };
4612
4626
  }
4613
4627
  var formattedCommands = commands.map(function (command) {
4614
- var _formatterOptions$ind, _this9$toPlacementSty;
4615
- var formatterOptions = _this9._languageSettings.formatter;
4616
- var formatter = Kusto.Language.Editor.FormattingOptions.Default.WithIndentationSize((_formatterOptions$ind = formatterOptions === null || formatterOptions === void 0 ? void 0 : formatterOptions.indentationSize) !== null && _formatterOptions$ind !== void 0 ? _formatterOptions$ind : 4).WithInsertMissingTokens(false).WithPipeOperatorStyle((_this9$toPlacementSty = _this9.toPlacementStyle(formatterOptions === null || formatterOptions === void 0 ? void 0 : formatterOptions.pipeOperatorStyle)) !== null && _this9$toPlacementSty !== void 0 ? _this9$toPlacementSty : k2.PlacementStyle.Smart).WithSemicolonStyle(Kusto.Language.Editor.PlacementStyle.None).WithBrackettingStyle(k2.BrackettingStyle.Diagonal);
4628
+ var _formatterOptions$ind, _this7$toPlacementSty;
4629
+ var formatterOptions = _this7._languageSettings.formatter;
4630
+ var formatter = Kusto.Language.Editor.FormattingOptions.Default.WithIndentationSize((_formatterOptions$ind = formatterOptions === null || formatterOptions === void 0 ? void 0 : formatterOptions.indentationSize) !== null && _formatterOptions$ind !== void 0 ? _formatterOptions$ind : 4).WithInsertMissingTokens(false).WithPipeOperatorStyle((_this7$toPlacementSty = _this7.toPlacementStyle(formatterOptions === null || formatterOptions === void 0 ? void 0 : formatterOptions.pipeOperatorStyle)) !== null && _this7$toPlacementSty !== void 0 ? _this7$toPlacementSty : k2.PlacementStyle.Smart).WithSemicolonStyle(Kusto.Language.Editor.PlacementStyle.None).WithBrackettingStyle(k2.BrackettingStyle.Diagonal);
4617
4631
  if (rangeStart == null || rangeEnd == null || rangeStart === command.Start && rangeEnd === command.End) {
4618
4632
  var result = command.Service.GetFormattedText(formatter);
4619
4633
  return result.Text;
@@ -4744,7 +4758,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4744
4758
  }, {
4745
4759
  key: "getRenderInfo",
4746
4760
  value: function getRenderInfo(document, cursorOffset) {
4747
- var _this10 = this;
4761
+ var _this8 = this;
4748
4762
  var parsedAndAnalyzed = this.parseAndAnalyze(document, cursorOffset);
4749
4763
  if (!parsedAndAnalyzed) {
4750
4764
  return Promise.resolve(undefined);
@@ -4784,7 +4798,7 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
4784
4798
  break;
4785
4799
  case 'ycolumns':
4786
4800
  case 'anomalycolumns':
4787
- var nameNodes = _this10.toArray(property.Element$1.Expression.Names);
4801
+ var nameNodes = _this8.toArray(property.Element$1.Expression.Names);
4788
4802
  var values = nameNodes.map(function (nameNode) {
4789
4803
  return nameNode.Element$1.SimpleName;
4790
4804
  });
@@ -5064,14 +5078,14 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
5064
5078
  }, {
5065
5079
  key: "getClassificationsFromParseResult",
5066
5080
  value: function getClassificationsFromParseResult() {
5067
- var _this11 = this;
5081
+ var _this9 = this;
5068
5082
  var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
5069
5083
  var classifications = this.toArray(this._parser.Results).map(function (command) {
5070
- return _this11.toArray(command.Tokens);
5084
+ return _this9.toArray(command.Tokens);
5071
5085
  }).reduce(function (prev, curr) {
5072
5086
  return prev.concat(curr);
5073
5087
  }, []).map(function (cslCommandToken) {
5074
- var range = new k2.ClassifiedRange(_this11.tokenKindToClassificationKind(cslCommandToken.TokenKind), cslCommandToken.AbsoluteStart + offset, cslCommandToken.Length);
5088
+ var range = new k2.ClassifiedRange(_this9.tokenKindToClassificationKind(cslCommandToken.TokenKind), cslCommandToken.AbsoluteStart + offset, cslCommandToken.Length);
5075
5089
  return range;
5076
5090
  });
5077
5091
  return classifications;
@@ -5452,10 +5466,10 @@ define('vs/language/kusto/kustoWorker', ['exports', './main-f70a1720', './schema
5452
5466
  }, {
5453
5467
  key: "inputParameterToSignature",
5454
5468
  value: function inputParameterToSignature(params) {
5455
- var _this12 = this;
5469
+ var _this10 = this;
5456
5470
  var signatureWithoutParens = params.map(function (param) {
5457
5471
  if (param.columns) {
5458
- var tableSignature = _this12.scalarParametersToSignature(param.columns);
5472
+ var tableSignature = _this10.scalarParametersToSignature(param.columns);
5459
5473
  return "".concat(param.name, ": ").concat(tableSignature);
5460
5474
  } else {
5461
5475
  return "".concat(param.name, ": ").concat(param.cslType);
@@ -1,11 +1,11 @@
1
1
  /*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * monaco-kusto version: 10.0.6(2d98fbb291999138c08e16b68891b9e1c28dd4bf)
3
+ * monaco-kusto version: 10.0.8(134ff03184264a9900737e4b5cf93f69540e1c8e)
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-f70a1720', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/main-5c133770', ['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: 10.0.6(2d98fbb291999138c08e16b68891b9e1c28dd4bf)
3
+ * monaco-kusto version: 10.0.8(134ff03184264a9900737e4b5cf93f69540e1c8e)
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-43c4cc5e'], (function (require, exports, monaco, schema) { 'use strict';
8
+ define('vs/language/kusto/monaco.contribution', ['require', 'exports', 'vs/editor/editor.main', './schema-5549fea4'], (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: 10.0.6(2d98fbb291999138c08e16b68891b9e1c28dd4bf)
3
+ * monaco-kusto version: 10.0.8(134ff03184264a9900737e4b5cf93f69540e1c8e)
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-43c4cc5e', ['exports'], (function (exports) { 'use strict';
8
+ define('vs/language/kusto/schema-5549fea4', ['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: 10.0.6(2d98fbb291999138c08e16b68891b9e1c28dd4bf)
3
+ * monaco-kusto version: 10.0.8(134ff03184264a9900737e4b5cf93f69540e1c8e)
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-fbf2f106.js';
11
+ import { d as getEntityDataTypeFromCslType, a as getCallName, b as getExpression, g as getCslTypeNameFromClrType } from './schema-0961786c.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';
@@ -795,12 +795,11 @@ class KustoLanguageService {
795
795
  }
796
796
 
797
797
  // since V2 doesn't support control commands, we're initializing V1 intellisense for both cases and we'll going to use V1 intellisense for control commands.
798
- return new Promise((resolve, reject) => {
799
- const kustoJsSchema = schema ? KustoLanguageService.convertToKustoJsSchema(schema) : undefined;
800
- this._kustoJsSchema = kustoJsSchema;
801
- this.createRulesProvider(kustoJsSchema, schema.clusterType);
802
- resolve(undefined);
803
- });
798
+
799
+ const kustoJsSchema = schema ? KustoLanguageService.convertToKustoJsSchema(schema) : undefined;
800
+ this._kustoJsSchema = kustoJsSchema;
801
+ this.createRulesProvider(kustoJsSchema, schema.clusterType);
802
+ return Promise.resolve();
804
803
  }
805
804
  setParameters(scalarParameters, tabularParameters) {
806
805
  if (!this._languageSettings.useIntellisenseV2 || this._schema.clusterType !== 'Engine') {
@@ -812,6 +811,12 @@ class KustoLanguageService {
812
811
  const tabularSymbols = tabularParameters.map(param => KustoLanguageService.createTabularParameterSymbol(param));
813
812
  this._kustoJsSchemaV2 = this._kustoJsSchemaV2.WithParameters(KustoLanguageService.toBridgeList([...scalarSymbols, ...tabularSymbols]));
814
813
  this._script = this._script?.WithGlobals(this._kustoJsSchemaV2);
814
+
815
+ // Set parameters is only working with the below code. It didn't used to need this, why does it now?!?
816
+ // Copy+pasted from setSchema
817
+ const kustoJsSchema = KustoLanguageService.convertToKustoJsSchema(this._schema);
818
+ this._kustoJsSchema = kustoJsSchema;
819
+ this.createRulesProvider(kustoJsSchema, this._schema.clusterType);
815
820
  return Promise.resolve(undefined);
816
821
  }
817
822
 
@@ -825,11 +830,12 @@ class KustoLanguageService {
825
830
  * @param databaseInContextAlternateName alternate name of database in context
826
831
  */
827
832
  setSchemaFromShowSchema(schema, clusterConnectionString, databaseInContextName, globalScalarParameters, globalTabularParameters, databaseInContextAlternateName) {
828
- return this.normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName).then(normalized => this.setSchema({
833
+ const normalized = this._normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName);
834
+ return this.setSchema({
829
835
  ...normalized,
830
836
  globalScalarParameters,
831
837
  globalTabularParameters
832
- }));
838
+ });
833
839
  }
834
840
 
835
841
  /**
@@ -839,7 +845,7 @@ class KustoLanguageService {
839
845
  * @param databaseInContextName database in context name
840
846
  * @param databaseInContextAlternateName database in context alternate name
841
847
  */
842
- normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
848
+ _normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
843
849
  const databases = Object.keys(schema.Databases).map(key => schema.Databases[key]).map(({
844
850
  Name,
845
851
  Tables,
@@ -901,7 +907,7 @@ class KustoLanguageService {
901
907
  }))
902
908
  }))
903
909
  }));
904
- const result = {
910
+ return {
905
911
  clusterType: 'Engine',
906
912
  cluster: {
907
913
  connectionString: clusterConnectionString,
@@ -909,7 +915,17 @@ class KustoLanguageService {
909
915
  },
910
916
  database: databases.filter(db => db.name === databaseInContextName)[0]
911
917
  };
912
- return Promise.resolve(result);
918
+ }
919
+
920
+ /**
921
+ * Converts the result of .show schema as json to a normalized schema used by kusto language service.
922
+ * @param schema result of show schema
923
+ * @param clusterConnectionString cluster connection string`
924
+ * @param databaseInContextName database in context name
925
+ * @param databaseInContextAlternateName database in context alternate name
926
+ */
927
+ normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName) {
928
+ return Promise.resolve(this._normalizeSchema(schema, clusterConnectionString, databaseInContextName, databaseInContextAlternateName));
913
929
  }
914
930
  getSchema() {
915
931
  return Promise.resolve(this._schema);