azure-kusto-data 3.3.1 → 3.4.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/README.md +3 -1
- package/example.js +1 -0
- package/index.d.ts +2 -1
- package/index.js +26 -1
- package/package.json +24 -19
- package/source/client.js +9 -4
- package/source/clientRequestProperties.js +2 -2
- package/source/connectionBuilder.d.ts +5 -0
- package/source/connectionBuilder.js +14 -3
- package/source/errors.d.ts +4 -0
- package/source/errors.js +9 -1
- package/source/models.js +0 -2
- package/source/response.js +0 -2
- package/source/security.js +3 -3
- package/source/tokenProvider.d.ts +44 -33
- package/source/tokenProvider.js +75 -68
- package/tsconfig.tsbuildinfo +1 -1
- 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/README.md
CHANGED
|
@@ -13,6 +13,7 @@ const KustoConnectionStringBuilder = require("azure-kusto-data").KustoConnection
|
|
|
13
13
|
const kcsb = KustoConnectionStringBuilder.withAadApplicationKeyAuthentication(`https://${clusterName}.kusto.windows.net`, "appid", "appkey", "authorityId");
|
|
14
14
|
const client = new KustoClient(kcsb);
|
|
15
15
|
|
|
16
|
+
// `execute()` infers the type of command from the query, although you can also specify the type explicitly using the methods `excuteQuery()`,`executeQueryV1()` or `executeMgmt()`
|
|
16
17
|
const results = await client.execute("db", "TableName | limit 1");
|
|
17
18
|
console.log(JSON.stringify(results));
|
|
18
19
|
console.log(results.primaryResults[0].toString());
|
|
@@ -47,7 +48,8 @@ const kcsb = KustoConnectionStringBuilder.withAadApplicationCertificateAuthentic
|
|
|
47
48
|
Option 3: Authenticating using [AAD Managed Identities](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview).
|
|
48
49
|
|
|
49
50
|
```javascript
|
|
50
|
-
const kcsb = KustoConnectionStringBuilder.
|
|
51
|
+
const kcsb = KustoConnectionStringBuilder.withSystemManagedIdentity(`https://${clusterName}.kusto.windows.net`);
|
|
52
|
+
const kcsb = KustoConnectionStringBuilder.withUserManagedIdentity(`https://${clusterName}.kusto.windows.net`, clientId);
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
### Username/Password
|
package/example.js
CHANGED
|
@@ -37,6 +37,7 @@ async function start() {
|
|
|
37
37
|
clientRequestProps.clientRequestId = `MyApp.MyActivity;${uuidv4()}`;
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
|
+
// `execute()` infers the type of command from the query, although you can also specify the type explicitly using the methods `excuteQuery()`,`executeQueryV1()` or `executeMgmt()`
|
|
40
41
|
const results = await kustoClient.execute(database, `['${table}'] | limit 1`, clientRequestProps);
|
|
41
42
|
console.log(JSON.stringify(results));
|
|
42
43
|
console.log(results.primaryResults[0].toString());
|
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.
|
|
3
|
+
"version": "3.4.1",
|
|
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,33 +23,32 @@
|
|
|
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",
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@azure/identity": "^2.0
|
|
40
|
-
"@azure/msal-node": "^1.
|
|
41
|
-
"@types/node": "^
|
|
42
|
-
"@types/uuid": "^8.3.
|
|
43
|
-
"axios": "^0.
|
|
44
|
-
"follow-redirects": "^1.
|
|
45
|
-
"moment": "^2.
|
|
43
|
+
"@azure/identity": "^2.1.0",
|
|
44
|
+
"@azure/msal-node": "^1.12.1",
|
|
45
|
+
"@types/node": "^18.6.4",
|
|
46
|
+
"@types/uuid": "^8.3.4",
|
|
47
|
+
"axios": "^0.27.2",
|
|
48
|
+
"follow-redirects": "^1.15.1",
|
|
49
|
+
"moment": "^2.29.4",
|
|
50
|
+
"ts-node": "^10.9.1",
|
|
46
51
|
"uuid": "^8.3.2"
|
|
47
52
|
},
|
|
48
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "9677e7be6186f9a5bf2ce12245662640fb10c6db"
|
|
49
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`,
|
|
@@ -157,7 +162,6 @@ class KustoClient {
|
|
|
157
162
|
return db;
|
|
158
163
|
}
|
|
159
164
|
_doRequest(endpoint, executionType, headers, payload, timeout, properties) {
|
|
160
|
-
var _a;
|
|
161
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
166
|
const axiosConfig = {
|
|
163
167
|
headers,
|
|
@@ -169,8 +173,9 @@ class KustoClient {
|
|
|
169
173
|
}
|
|
170
174
|
catch (error) {
|
|
171
175
|
if (axios_1.default.isAxiosError(error) && error.response) {
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
if (error.response.status === 429) {
|
|
177
|
+
throw new errors_1.ThrottlingError("POST request failed with status 429 (Too Many Requests)", error);
|
|
178
|
+
}
|
|
174
179
|
}
|
|
175
180
|
throw error;
|
|
176
181
|
}
|
|
@@ -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
|
}
|
|
@@ -31,7 +31,12 @@ export declare class KustoConnectionStringBuilder {
|
|
|
31
31
|
static withAadApplicationKeyAuthentication(connectionString: string, aadAppId: string, appKey: string, authorityId?: string): KustoConnectionStringBuilder;
|
|
32
32
|
static withAadApplicationCertificateAuthentication(connectionString: string, aadAppId: string, applicationCertificatePrivateKey: string, applicationCertificateThumbprint: string, authorityId?: string, applicationCertificateX5c?: string): KustoConnectionStringBuilder;
|
|
33
33
|
static withAadDeviceAuthentication(connectionString: string, authorityId?: string, deviceCodeCallback?: (response: DeviceCodeResponse) => void): KustoConnectionStringBuilder;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated - use `withSystemManagedIdentity` or `withUserManagedIdentity` instead
|
|
36
|
+
*/
|
|
34
37
|
static withAadManagedIdentities(connectionString: string, msiClientId?: string, authorityId?: string, timeoutMs?: number): KustoConnectionStringBuilder;
|
|
38
|
+
static withSystemManagedIdentity(connectionString: string, authorityId?: string, timeoutMs?: number): KustoConnectionStringBuilder;
|
|
39
|
+
static withUserManagedIdentity(connectionString: string, msiClientId: string, authorityId?: string, timeoutMs?: number): KustoConnectionStringBuilder;
|
|
35
40
|
static withAzLoginIdentity(connectionString: string, authorityId?: string, timeoutMs?: number): KustoConnectionStringBuilder;
|
|
36
41
|
static withAccessToken(connectionString: string, accessToken: string): KustoConnectionStringBuilder;
|
|
37
42
|
static withTokenProvider(connectionString: string, tokenProvider: () => Promise<string>): KustoConnectionStringBuilder;
|
|
@@ -69,7 +69,7 @@ const getPropName = (key) => {
|
|
|
69
69
|
class KustoConnectionStringBuilder {
|
|
70
70
|
constructor(connectionString) {
|
|
71
71
|
var _a;
|
|
72
|
-
this.authorityId = "
|
|
72
|
+
this.authorityId = "organizations";
|
|
73
73
|
if (connectionString.trim().length === 0)
|
|
74
74
|
throw new Error("Missing connection string");
|
|
75
75
|
if (connectionString.endsWith("/") || connectionString.endsWith("\\")) {
|
|
@@ -157,14 +157,19 @@ class KustoConnectionStringBuilder {
|
|
|
157
157
|
}
|
|
158
158
|
return kcsb;
|
|
159
159
|
}
|
|
160
|
-
static withAadDeviceAuthentication(connectionString, authorityId
|
|
160
|
+
static withAadDeviceAuthentication(connectionString, authorityId, deviceCodeCallback = KustoConnectionStringBuilder.defaultDeviceCallback) {
|
|
161
161
|
const kcsb = new KustoConnectionStringBuilder(connectionString);
|
|
162
162
|
kcsb.aadFederatedSecurity = true;
|
|
163
|
-
|
|
163
|
+
if (authorityId) {
|
|
164
|
+
kcsb.authorityId = authorityId;
|
|
165
|
+
}
|
|
164
166
|
kcsb.deviceCodeCallback = deviceCodeCallback;
|
|
165
167
|
kcsb.useDeviceCodeAuth = true;
|
|
166
168
|
return kcsb;
|
|
167
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated - use `withSystemManagedIdentity` or `withUserManagedIdentity` instead
|
|
172
|
+
*/
|
|
168
173
|
static withAadManagedIdentities(connectionString, msiClientId, authorityId, timeoutMs) {
|
|
169
174
|
const kcsb = new KustoConnectionStringBuilder(connectionString);
|
|
170
175
|
kcsb.aadFederatedSecurity = true;
|
|
@@ -176,6 +181,12 @@ class KustoConnectionStringBuilder {
|
|
|
176
181
|
kcsb.useManagedIdentityAuth = true;
|
|
177
182
|
return kcsb;
|
|
178
183
|
}
|
|
184
|
+
static withSystemManagedIdentity(connectionString, authorityId, timeoutMs) {
|
|
185
|
+
return this.withAadManagedIdentities(connectionString, undefined, authorityId, timeoutMs);
|
|
186
|
+
}
|
|
187
|
+
static withUserManagedIdentity(connectionString, msiClientId, authorityId, timeoutMs) {
|
|
188
|
+
return this.withAadManagedIdentities(connectionString, msiClientId, authorityId, timeoutMs);
|
|
189
|
+
}
|
|
179
190
|
static withAzLoginIdentity(connectionString, authorityId, timeoutMs) {
|
|
180
191
|
const kcsb = new KustoConnectionStringBuilder(connectionString);
|
|
181
192
|
kcsb.aadFederatedSecurity = true;
|
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) {
|
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
|
@@ -51,16 +51,16 @@ class AadHelper {
|
|
|
51
51
|
this.tokenProvider = new TokenProvider.ApplicationCertificateTokenProvider(kcsb.dataSource, kcsb.applicationClientId, kcsb.applicationCertificateThumbprint, kcsb.applicationCertificatePrivateKey, kcsb.applicationCertificateX5c, kcsb.authorityId);
|
|
52
52
|
}
|
|
53
53
|
else if (kcsb.useManagedIdentityAuth) {
|
|
54
|
-
this.tokenProvider = new TokenProvider.MsiTokenProvider(kcsb.dataSource, kcsb.
|
|
54
|
+
this.tokenProvider = new TokenProvider.MsiTokenProvider(kcsb.dataSource, kcsb.msiClientId, kcsb.authorityId, kcsb.timeoutMs);
|
|
55
55
|
}
|
|
56
56
|
else if (kcsb.useAzLoginAuth) {
|
|
57
|
-
this.tokenProvider = new TokenProvider.AzCliTokenProvider(kcsb.dataSource, kcsb.authorityId,
|
|
57
|
+
this.tokenProvider = new TokenProvider.AzCliTokenProvider(kcsb.dataSource, kcsb.authorityId, kcsb.timeoutMs);
|
|
58
58
|
}
|
|
59
59
|
else if (kcsb.accessToken) {
|
|
60
60
|
this.tokenProvider = new TokenProvider.BasicTokenProvider(kcsb.dataSource, kcsb.accessToken);
|
|
61
61
|
}
|
|
62
62
|
else if (kcsb.useUserPromptAuth) {
|
|
63
|
-
this.tokenProvider = new TokenProvider.UserPromptProvider(kcsb.dataSource, kcsb.authorityId, kcsb.
|
|
63
|
+
this.tokenProvider = new TokenProvider.UserPromptProvider(kcsb.dataSource, kcsb.authorityId, kcsb.timeoutMs, kcsb.loginHint);
|
|
64
64
|
}
|
|
65
65
|
else if (kcsb.tokenProvider) {
|
|
66
66
|
this.tokenProvider = new TokenProvider.CallbackTokenProvider(kcsb.dataSource, kcsb.tokenProvider);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfidentialClientApplication, PublicClientApplication } from "@azure/msal-node";
|
|
1
|
+
import { ConfidentialClientApplication, Configuration, PublicClientApplication } from "@azure/msal-node";
|
|
2
2
|
import { DeviceCodeResponse } from "@azure/msal-common";
|
|
3
3
|
import { CloudInfo } from "./cloudSettings";
|
|
4
4
|
import { TokenCredential } from "@azure/core-auth";
|
|
@@ -38,32 +38,38 @@ export declare class CallbackTokenProvider extends TokenProviderBase {
|
|
|
38
38
|
acquireToken(): Promise<TokenResponse>;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Token providers that require cloud settings to be configured - msal and azure identity
|
|
42
42
|
*/
|
|
43
|
-
declare abstract class
|
|
44
|
-
cloudInfo: CloudInfo;
|
|
45
|
-
|
|
46
|
-
initialized: boolean;
|
|
47
|
-
authorityUri: string;
|
|
43
|
+
declare abstract class CloudSettingsTokenProvider extends TokenProviderBase {
|
|
44
|
+
protected cloudInfo: CloudInfo;
|
|
45
|
+
protected initialized: boolean;
|
|
48
46
|
abstract initClient(): void;
|
|
49
|
-
abstract
|
|
50
|
-
|
|
47
|
+
abstract acquireTokenWithCloudSettings(): Promise<TokenType | null>;
|
|
48
|
+
additionalCloudSettingsInit(): void;
|
|
49
|
+
protected constructor(kustoUri: string);
|
|
51
50
|
acquireToken(): Promise<TokenResponse>;
|
|
52
51
|
context(): Record<string, any>;
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Acquire a token from MSAL
|
|
55
|
+
*/
|
|
56
|
+
declare abstract class MsalTokenProvider extends CloudSettingsTokenProvider {
|
|
57
|
+
private clientId;
|
|
58
|
+
protected cloudInfo: CloudInfo;
|
|
59
|
+
protected authorityId: string;
|
|
60
|
+
protected authorityUri: string;
|
|
61
|
+
protected constructor(kustoUri: string, authorityId: string, clientId: string | undefined);
|
|
62
|
+
commonOptions(): Configuration;
|
|
63
|
+
additionalCloudSettingsInit(): void;
|
|
64
|
+
context(): Record<string, any>;
|
|
65
|
+
}
|
|
66
|
+
export declare abstract class AzureIdentityProvider extends CloudSettingsTokenProvider {
|
|
67
|
+
protected authorityId?: string | undefined;
|
|
56
68
|
private timeoutMs?;
|
|
57
69
|
private credential;
|
|
58
|
-
|
|
59
|
-
constructor(kustoUri: string, authorityId: string, clientId?: string | undefined, timeoutMs?: number | undefined);
|
|
70
|
+
constructor(kustoUri: string, authorityId?: string | undefined, timeoutMs?: number | undefined);
|
|
60
71
|
initClient(): void;
|
|
61
|
-
|
|
62
|
-
authorityHost: string;
|
|
63
|
-
clientId: string | undefined;
|
|
64
|
-
tenantId: string;
|
|
65
|
-
};
|
|
66
|
-
acquireMsalToken(): Promise<TokenType | null>;
|
|
72
|
+
acquireTokenWithCloudSettings(): Promise<TokenType | null>;
|
|
67
73
|
context(): Record<string, any>;
|
|
68
74
|
abstract getCredential(): TokenCredential;
|
|
69
75
|
}
|
|
@@ -72,7 +78,10 @@ export declare abstract class AzureIdentityProvider extends MsalTokenProvider {
|
|
|
72
78
|
* The args parameter is a dictionary conforming with the ManagedIdentityCredential initializer API arguments
|
|
73
79
|
*/
|
|
74
80
|
export declare class MsiTokenProvider extends AzureIdentityProvider {
|
|
81
|
+
protected clientId?: string | undefined;
|
|
82
|
+
constructor(kustoUri: string, clientId?: string | undefined, authorityId?: string, timeoutMs?: number);
|
|
75
83
|
getCredential(): TokenCredential;
|
|
84
|
+
context(): Record<string, any>;
|
|
76
85
|
}
|
|
77
86
|
/**
|
|
78
87
|
* AzCli Token Provider obtains a refresh token from the AzCli cache and uses it to authenticate with MSAL
|
|
@@ -85,9 +94,11 @@ export declare class AzCliTokenProvider extends AzureIdentityProvider {
|
|
|
85
94
|
*/
|
|
86
95
|
export declare class UserPromptProvider extends AzureIdentityProvider {
|
|
87
96
|
private loginHint?;
|
|
88
|
-
readonly
|
|
89
|
-
|
|
97
|
+
readonly MinPort = 20000;
|
|
98
|
+
readonly MaxPort = 65536;
|
|
99
|
+
constructor(kustoUri: string, authorityId: string, timeoutMs?: number, loginHint?: string | undefined);
|
|
90
100
|
getCredential(): TokenCredential;
|
|
101
|
+
private getRandomPortInRange;
|
|
91
102
|
context(): Record<string, any>;
|
|
92
103
|
}
|
|
93
104
|
/**
|
|
@@ -100,7 +111,7 @@ export declare class UserPassTokenProvider extends MsalTokenProvider {
|
|
|
100
111
|
msalClient: PublicClientApplication;
|
|
101
112
|
constructor(kustoUri: string, userName: string, password: string, authorityId: string);
|
|
102
113
|
initClient(): void;
|
|
103
|
-
|
|
114
|
+
acquireTokenWithCloudSettings(): Promise<TokenType | null>;
|
|
104
115
|
context(): Record<string, any>;
|
|
105
116
|
}
|
|
106
117
|
/**
|
|
@@ -112,18 +123,18 @@ export declare class DeviceLoginTokenProvider extends MsalTokenProvider {
|
|
|
112
123
|
msalClient: PublicClientApplication;
|
|
113
124
|
constructor(kustoUri: string, deviceCodeCallback: (response: DeviceCodeResponse) => void, authorityId: string);
|
|
114
125
|
initClient(): void;
|
|
115
|
-
|
|
126
|
+
acquireTokenWithCloudSettings(): Promise<TokenType | null>;
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
|
-
* Acquire a token from MSAL with application
|
|
129
|
+
* Acquire a token from MSAL with application id and Key
|
|
119
130
|
*/
|
|
120
131
|
export declare class ApplicationKeyTokenProvider extends MsalTokenProvider {
|
|
121
|
-
appClientId
|
|
122
|
-
appKey
|
|
132
|
+
private appClientId;
|
|
133
|
+
private appKey;
|
|
123
134
|
msalClient: ConfidentialClientApplication;
|
|
124
135
|
constructor(kustoUri: string, appClientId: string, appKey: string, authorityId: string);
|
|
125
136
|
initClient(): void;
|
|
126
|
-
|
|
137
|
+
acquireTokenWithCloudSettings(): Promise<TokenType | null>;
|
|
127
138
|
context(): Record<string, any>;
|
|
128
139
|
}
|
|
129
140
|
/**
|
|
@@ -131,14 +142,14 @@ export declare class ApplicationKeyTokenProvider extends MsalTokenProvider {
|
|
|
131
142
|
* Passing the public certificate is optional and will result in Subject Name & Issuer Authentication
|
|
132
143
|
*/
|
|
133
144
|
export declare class ApplicationCertificateTokenProvider extends MsalTokenProvider {
|
|
134
|
-
appClientId
|
|
135
|
-
certThumbprint
|
|
136
|
-
certPrivateKey
|
|
137
|
-
certX5c
|
|
145
|
+
private appClientId;
|
|
146
|
+
private certThumbprint;
|
|
147
|
+
private certPrivateKey;
|
|
148
|
+
private certX5c?;
|
|
138
149
|
msalClient: ConfidentialClientApplication;
|
|
139
|
-
constructor(kustoUri: string, appClientId: string, certThumbprint: string, certPrivateKey: string, certX5c?: string, authorityId?: string);
|
|
150
|
+
constructor(kustoUri: string, appClientId: string, certThumbprint: string, certPrivateKey: string, certX5c?: string | undefined, authorityId?: string);
|
|
140
151
|
initClient(): void;
|
|
141
|
-
|
|
152
|
+
acquireTokenWithCloudSettings(): Promise<TokenType | null>;
|
|
142
153
|
context(): Record<string, any>;
|
|
143
154
|
}
|
|
144
155
|
export {};
|