azure-kusto-data 3.2.0 → 3.3.2
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/LICENSE +21 -0
- package/index.d.ts +2 -1
- package/index.js +26 -1
- package/package.json +17 -28
- package/source/client.js +10 -2
- package/source/clientRequestProperties.js +2 -2
- package/source/errors.d.ts +4 -0
- package/source/errors.js +9 -1
- package/source/models.js +1 -3
- package/source/response.js +0 -2
- package/source/security.js +5 -1
- package/source/tokenProvider.js +0 -1
- package/tsconfig.tsbuildinfo +1 -4038
- package/.eslintignore +0 -5
- package/.eslintrc.js +0 -247
- package/.prettierignore +0 -7
- package/.prettierrc.json +0 -5
- package/index.js.map +0 -1
- package/source/client.js.map +0 -1
- package/source/clientRequestProperties.js.map +0 -1
- package/source/cloudSettings.js.map +0 -1
- package/source/connectionBuilder.js.map +0 -1
- package/source/errors.js.map +0 -1
- package/source/models.js.map +0 -1
- package/source/response.js.map +0 -1
- package/source/security.js.map +0 -1
- package/source/tokenProvider.js.map +0 -1
- package/source/typeUtilts.js.map +0 -1
- package/tsconfig.json +0 -17
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import KustoClient from "./source/client";
|
|
2
2
|
import ClientRequestProperties from "./source/clientRequestProperties";
|
|
3
3
|
import KustoConnectionStringBuilder from "./source/connectionBuilder";
|
|
4
|
-
|
|
4
|
+
import * as KustoDataErrors from "./source/errors";
|
|
5
|
+
export { KustoClient as Client, ClientRequestProperties, KustoConnectionStringBuilder, KustoDataErrors };
|
package/index.js
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
4
27
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
29
|
};
|
|
7
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.KustoConnectionStringBuilder = exports.ClientRequestProperties = exports.Client = void 0;
|
|
31
|
+
exports.KustoDataErrors = exports.KustoConnectionStringBuilder = exports.ClientRequestProperties = exports.Client = void 0;
|
|
9
32
|
const client_1 = __importDefault(require("./source/client"));
|
|
10
33
|
exports.Client = client_1.default;
|
|
11
34
|
const clientRequestProperties_1 = __importDefault(require("./source/clientRequestProperties"));
|
|
12
35
|
exports.ClientRequestProperties = clientRequestProperties_1.default;
|
|
13
36
|
const connectionBuilder_1 = __importDefault(require("./source/connectionBuilder"));
|
|
14
37
|
exports.KustoConnectionStringBuilder = connectionBuilder_1.default;
|
|
38
|
+
const KustoDataErrors = __importStar(require("./source/errors"));
|
|
39
|
+
exports.KustoDataErrors = KustoDataErrors;
|
|
15
40
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-kusto-data",
|
|
3
|
-
"version": "3.2
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Azure Data Explorer Query SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
7
10
|
"engines": {
|
|
8
11
|
"node": ">= 14.0.0"
|
|
9
12
|
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
10
16
|
"tags": [
|
|
11
17
|
"azure",
|
|
12
18
|
"kusto",
|
|
@@ -17,21 +23,19 @@
|
|
|
17
23
|
"azure",
|
|
18
24
|
"kusto"
|
|
19
25
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc -b",
|
|
22
|
-
"prepublish": "npm run build ",
|
|
23
|
-
"example": "npm run build && node example.js",
|
|
24
|
-
"lint": "npx eslint -c .eslintrc.js --ext .ts .",
|
|
25
|
-
"test": "npm run build && mocha --parallel",
|
|
26
|
-
"testPipeline": "npm run build && nyc --reporter lcovonly mocha --reporter mocha-junit-reporter",
|
|
27
|
-
"format": "npx prettier --write .",
|
|
28
|
-
"checkFormat": "npx prettier --check --end-of-line lf ."
|
|
29
|
-
},
|
|
30
26
|
"repository": {
|
|
31
27
|
"type": "git",
|
|
32
28
|
"url": "https://github.com/Azure/azure-kusto-node.git",
|
|
33
29
|
"directory": "azure-kusto-data"
|
|
34
30
|
},
|
|
31
|
+
"files": [
|
|
32
|
+
"source/**/*.js",
|
|
33
|
+
"source/**/*.d.ts",
|
|
34
|
+
"index.js",
|
|
35
|
+
"index.d.ts",
|
|
36
|
+
"tsconfig.tsbuildinfo",
|
|
37
|
+
"example.js"
|
|
38
|
+
],
|
|
35
39
|
"author": "",
|
|
36
40
|
"license": "ISC",
|
|
37
41
|
"homepage": "https://github.com/Azure/azure-kusto-node/blob/master/azure-kusto-data/README.md",
|
|
@@ -43,23 +47,8 @@
|
|
|
43
47
|
"axios": "^0.24.0",
|
|
44
48
|
"follow-redirects": "^1.14.8",
|
|
45
49
|
"moment": "^2.25.3",
|
|
50
|
+
"ts-node": "^10.7.0",
|
|
46
51
|
"uuid": "^8.3.2"
|
|
47
52
|
},
|
|
48
|
-
"
|
|
49
|
-
"@types/mocha": "^8.2.0",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^5.12.0",
|
|
51
|
-
"@typescript-eslint/parser": "^5.12.0",
|
|
52
|
-
"eslint": "^8.9.0",
|
|
53
|
-
"eslint-config-prettier": "^8.3.0",
|
|
54
|
-
"eslint-plugin-header": "^3.1.1",
|
|
55
|
-
"eslint-plugin-jsdoc": "^37.9.1",
|
|
56
|
-
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
57
|
-
"mocha": "^9.2.0",
|
|
58
|
-
"mocha-junit-reporter": "^2.0.2",
|
|
59
|
-
"nyc": "^15.1.0",
|
|
60
|
-
"prettier": "2.5.1",
|
|
61
|
-
"sinon": "^7.2.3",
|
|
62
|
-
"ts-node": "^9.1.1",
|
|
63
|
-
"typescript": "^4.1.3"
|
|
64
|
-
}
|
|
53
|
+
"gitHead": "98353bc492ff277e385181c1034d878c8bfb3119"
|
|
65
54
|
}
|
package/source/client.js
CHANGED
|
@@ -21,6 +21,7 @@ const security_1 = __importDefault(require("./security"));
|
|
|
21
21
|
const response_1 = require("./response");
|
|
22
22
|
const connectionBuilder_1 = __importDefault(require("./connectionBuilder"));
|
|
23
23
|
const clientRequestProperties_1 = __importDefault(require("./clientRequestProperties"));
|
|
24
|
+
const errors_1 = require("./errors");
|
|
24
25
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
25
26
|
const axios_1 = __importDefault(require("axios"));
|
|
26
27
|
const http_1 = __importDefault(require("http"));
|
|
@@ -39,7 +40,11 @@ var ExecutionType;
|
|
|
39
40
|
class KustoClient {
|
|
40
41
|
constructor(kcsb) {
|
|
41
42
|
this.connectionString = typeof kcsb === "string" ? new connectionBuilder_1.default(kcsb) : kcsb;
|
|
42
|
-
|
|
43
|
+
if (!this.connectionString.dataSource) {
|
|
44
|
+
throw new Error("Cluster url is required");
|
|
45
|
+
}
|
|
46
|
+
const url = new URL(this.connectionString.dataSource);
|
|
47
|
+
this.cluster = `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : ""}`;
|
|
43
48
|
this.defaultDatabase = this.connectionString.initialCatalog;
|
|
44
49
|
this.endpoints = {
|
|
45
50
|
[ExecutionType.Mgmt]: `${this.cluster}/v1/rest/mgmt`,
|
|
@@ -139,7 +144,7 @@ class KustoClient {
|
|
|
139
144
|
headers["x-ms-user"] = properties.user;
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
|
-
headers["x-ms-client-request-id"] = clientRequestId || clientRequestPrefix + `${uuid_1.v4()}`;
|
|
147
|
+
headers["x-ms-client-request-id"] = clientRequestId || clientRequestPrefix + `${(0, uuid_1.v4)()}`;
|
|
143
148
|
const authHeader = yield this.aadHelper.getAuthHeader();
|
|
144
149
|
if (authHeader != null) {
|
|
145
150
|
headers.Authorization = authHeader;
|
|
@@ -169,6 +174,9 @@ class KustoClient {
|
|
|
169
174
|
}
|
|
170
175
|
catch (error) {
|
|
171
176
|
if (axios_1.default.isAxiosError(error) && error.response) {
|
|
177
|
+
if (error.response.status === 429) {
|
|
178
|
+
throw new errors_1.ThrottlingError("POST request failed with status 429 (Too Many Requests)", error);
|
|
179
|
+
}
|
|
172
180
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
173
181
|
throw ((_a = error.response.data) === null || _a === void 0 ? void 0 : _a.error) || error.response.data;
|
|
174
182
|
}
|
|
@@ -55,13 +55,13 @@ class ClientRequestProperties {
|
|
|
55
55
|
toJSON() {
|
|
56
56
|
const json = {};
|
|
57
57
|
if (Object.keys(this._options).length !== 0) {
|
|
58
|
-
json.Options = this._options;
|
|
58
|
+
json.Options = Object.assign({}, this._options);
|
|
59
59
|
if (json.Options.servertimeout) {
|
|
60
60
|
json.Options.servertimeout = this._msToTimespan(json.Options.servertimeout);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
if (Object.keys(this._parameters).length !== 0) {
|
|
64
|
-
json.Parameters = this._parameters;
|
|
64
|
+
json.Parameters = Object.assign({}, this._parameters);
|
|
65
65
|
}
|
|
66
66
|
return Object.keys(json).length !== 0 ? json : null;
|
|
67
67
|
}
|
package/source/errors.d.ts
CHANGED
|
@@ -4,3 +4,7 @@ export declare class KustoAuthenticationError extends Error {
|
|
|
4
4
|
context: Record<string, any>;
|
|
5
5
|
constructor(message: string, inner: Error | undefined, tokenProviderName: string, context: Record<string, any>);
|
|
6
6
|
}
|
|
7
|
+
export declare class ThrottlingError extends Error {
|
|
8
|
+
inner: Error | undefined;
|
|
9
|
+
constructor(message: string, inner: Error | undefined);
|
|
10
|
+
}
|
package/source/errors.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.KustoAuthenticationError = void 0;
|
|
5
|
+
exports.ThrottlingError = exports.KustoAuthenticationError = void 0;
|
|
6
6
|
class KustoAuthenticationError extends Error {
|
|
7
7
|
constructor(message, inner, tokenProviderName, context) {
|
|
8
8
|
super(message);
|
|
@@ -13,4 +13,12 @@ class KustoAuthenticationError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.KustoAuthenticationError = KustoAuthenticationError;
|
|
16
|
+
class ThrottlingError extends Error {
|
|
17
|
+
constructor(message, inner) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.inner = inner;
|
|
20
|
+
this.name = "ThrottlingError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ThrottlingError = ThrottlingError;
|
|
16
24
|
//# sourceMappingURL=errors.js.map
|
package/source/models.js
CHANGED
|
@@ -6,8 +6,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.KustoResultTable = exports.KustoResultColumn = exports.KustoResultRow = exports.WellKnownDataSet = void 0;
|
|
9
|
-
// We want all the Kusto table models in this file
|
|
10
|
-
/* eslint-disable max-classes-per-file */
|
|
11
9
|
const moment_1 = __importDefault(require("moment"));
|
|
12
10
|
var WellKnownDataSet;
|
|
13
11
|
(function (WellKnownDataSet) {
|
|
@@ -16,7 +14,7 @@ var WellKnownDataSet;
|
|
|
16
14
|
WellKnownDataSet["TableOfContents"] = "TableOfContents";
|
|
17
15
|
WellKnownDataSet["QueryProperties"] = "QueryProperties";
|
|
18
16
|
})(WellKnownDataSet = exports.WellKnownDataSet || (exports.WellKnownDataSet = {}));
|
|
19
|
-
const defaultDatetimeParser = (t) => moment_1.default(t);
|
|
17
|
+
const defaultDatetimeParser = (t) => (0, moment_1.default)(t);
|
|
20
18
|
const defaultTimespanParser = (t) => moment_1.default.duration(t);
|
|
21
19
|
class KustoResultRow {
|
|
22
20
|
constructor(columns, row, dateTimeParser = defaultDatetimeParser, timeSpanParser = defaultTimespanParser) {
|
package/source/response.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.KustoResponseDataSetV2 = exports.KustoResponseDataSetV1 = exports.KustoResponseDataSet = void 0;
|
|
6
|
-
// We want all the Response models to be in this file
|
|
7
|
-
/* eslint-disable max-classes-per-file */
|
|
8
6
|
const models_1 = require("./models");
|
|
9
7
|
var ErrorLevels;
|
|
10
8
|
(function (ErrorLevels) {
|
package/source/security.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/source/tokenProvider.js
CHANGED
|
@@ -12,7 +12,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.ApplicationCertificateTokenProvider = exports.ApplicationKeyTokenProvider = exports.DeviceLoginTokenProvider = exports.UserPassTokenProvider = exports.UserPromptProvider = exports.AzCliTokenProvider = exports.MsiTokenProvider = exports.AzureIdentityProvider = exports.CallbackTokenProvider = exports.BasicTokenProvider = exports.TokenProviderBase = void 0;
|
|
15
|
-
/* eslint-disable max-classes-per-file -- We want all the Token Providers in this file */
|
|
16
15
|
const msal_node_1 = require("@azure/msal-node");
|
|
17
16
|
const identity_1 = require("@azure/identity");
|
|
18
17
|
const cloudSettings_1 = require("./cloudSettings");
|