azure-kusto-data
Advanced tools
Comparing version 2.1.3 to 2.1.4
{ | ||
"name": "azure-kusto-data", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Azure Data Explorer Query SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,5 +6,6 @@ import AadHelper from "./security"; | ||
declare enum ExecutionType { | ||
Mgmt = 0, | ||
Query = 1, | ||
Ingest = 2 | ||
Mgmt = "mgmt", | ||
Query = "query", | ||
Ingest = "ingest", | ||
QueryV1 = "queryv1" | ||
} | ||
@@ -15,5 +16,3 @@ export declare class KustoClient { | ||
endpoints: { | ||
mgmt: string; | ||
query: string; | ||
ingest: string; | ||
[key in ExecutionType]: string; | ||
}; | ||
@@ -27,2 +26,3 @@ aadHelper: AadHelper; | ||
executeQuery(db: string, query: string, properties?: ClientRequestProperties): Promise<KustoResponseDataSet>; | ||
executeQueryV1(db: string, query: string, properties?: ClientRequestProperties): Promise<KustoResponseDataSet>; | ||
executeMgmt(db: string, query: string, properties?: ClientRequestProperties): Promise<KustoResponseDataSet>; | ||
@@ -29,0 +29,0 @@ executeStreamingIngest(db: string, table: string, stream: any, streamFormat: any, mappingName: string | null): Promise<KustoResponseDataSet>; |
@@ -31,5 +31,6 @@ "use strict"; | ||
(function (ExecutionType) { | ||
ExecutionType[ExecutionType["Mgmt"] = 0] = "Mgmt"; | ||
ExecutionType[ExecutionType["Query"] = 1] = "Query"; | ||
ExecutionType[ExecutionType["Ingest"] = 2] = "Ingest"; | ||
ExecutionType["Mgmt"] = "mgmt"; | ||
ExecutionType["Query"] = "query"; | ||
ExecutionType["Ingest"] = "ingest"; | ||
ExecutionType["QueryV1"] = "queryv1"; | ||
})(ExecutionType || (ExecutionType = {})); | ||
@@ -41,5 +42,6 @@ class KustoClient { | ||
this.endpoints = { | ||
mgmt: `${this.cluster}/v1/rest/mgmt`, | ||
query: `${this.cluster}/v2/rest/query`, | ||
ingest: `${this.cluster}/v1/rest/ingest`, | ||
[ExecutionType.Mgmt]: `${this.cluster}/v1/rest/mgmt`, | ||
[ExecutionType.Query]: `${this.cluster}/v2/rest/query`, | ||
[ExecutionType.Ingest]: `${this.cluster}/v1/rest/ingest`, | ||
[ExecutionType.QueryV1]: `${this.cluster}/v1/rest/query`, | ||
}; | ||
@@ -64,8 +66,13 @@ this.aadHelper = new security_1.default(this.connectionString); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._execute(this.endpoints.query, ExecutionType.Query, db, query, null, properties); | ||
return this._execute(this.endpoints[ExecutionType.Query], ExecutionType.Query, db, query, null, properties); | ||
}); | ||
} | ||
executeQueryV1(db, query, properties) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._execute(this.endpoints[ExecutionType.QueryV1], ExecutionType.QueryV1, db, query, null, properties); | ||
}); | ||
} | ||
executeMgmt(db, query, properties) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._execute(this.endpoints.mgmt, ExecutionType.Mgmt, db, query, null, properties); | ||
return this._execute(this.endpoints[ExecutionType.Mgmt], ExecutionType.Mgmt, db, query, null, properties); | ||
}); | ||
@@ -75,3 +82,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let endpoint = `${this.endpoints.ingest}/${db}/${table}?streamFormat=${streamFormat}`; | ||
let endpoint = `${this.endpoints[ExecutionType.Ingest]}/${db}/${table}?streamFormat=${streamFormat}`; | ||
if (mappingName != null) { | ||
@@ -169,3 +176,3 @@ endpoint += `&mappingName=${mappingName}`; | ||
} | ||
return executionType == ExecutionType.Query ? QUERY_TIMEOUT_IN_MILLISECS : COMMAND_TIMEOUT_IN_MILLISECS; | ||
return (executionType == ExecutionType.Query || executionType == ExecutionType.QueryV1) ? QUERY_TIMEOUT_IN_MILLISECS : COMMAND_TIMEOUT_IN_MILLISECS; | ||
} | ||
@@ -172,0 +179,0 @@ } |
@@ -19,5 +19,6 @@ // Copyright (c) Microsoft Corporation. | ||
enum ExecutionType { | ||
Mgmt = 0, | ||
Query = 1, | ||
Ingest = 2 | ||
Mgmt = "mgmt", | ||
Query = "query", | ||
Ingest = "ingest", | ||
QueryV1 = "queryv1", | ||
} | ||
@@ -28,3 +29,3 @@ | ||
cluster: string; | ||
endpoints: { mgmt: string; query: string; ingest: string; }; | ||
endpoints: { [key in ExecutionType] : string; }; | ||
aadHelper: AadHelper; | ||
@@ -37,5 +38,6 @@ headers: { [name: string]: string }; | ||
this.endpoints = { | ||
mgmt: `${this.cluster}/v1/rest/mgmt`, | ||
query: `${this.cluster}/v2/rest/query`, | ||
ingest: `${this.cluster}/v1/rest/ingest`, | ||
[ExecutionType.Mgmt]: `${this.cluster}/v1/rest/mgmt`, | ||
[ExecutionType.Query]: `${this.cluster}/v2/rest/query`, | ||
[ExecutionType.Ingest]: `${this.cluster}/v1/rest/ingest`, | ||
[ExecutionType.QueryV1]: `${this.cluster}/v1/rest/query`, | ||
}; | ||
@@ -60,11 +62,15 @@ this.aadHelper = new AadHelper(this.connectionString); | ||
async executeQuery(db: string, query: string, properties?: ClientRequestProperties) { | ||
return this._execute(this.endpoints.query, ExecutionType.Query, db, query, null, properties); | ||
return this._execute(this.endpoints[ExecutionType.Query], ExecutionType.Query, db, query, null, properties); | ||
} | ||
async executeQueryV1(db: string, query: string, properties?: ClientRequestProperties) { | ||
return this._execute(this.endpoints[ExecutionType.QueryV1], ExecutionType.QueryV1, db, query, null, properties); | ||
} | ||
async executeMgmt(db: string, query: string, properties?: ClientRequestProperties) { | ||
return this._execute(this.endpoints.mgmt, ExecutionType.Mgmt, db, query, null, properties); | ||
return this._execute(this.endpoints[ExecutionType.Mgmt], ExecutionType.Mgmt, db, query, null, properties); | ||
} | ||
async executeStreamingIngest(db: string, table: string, stream: any, streamFormat: any, mappingName: string | null): Promise<KustoResponseDataSet> { | ||
let endpoint = `${this.endpoints.ingest}/${db}/${table}?streamFormat=${streamFormat}`; | ||
let endpoint = `${this.endpoints[ExecutionType.Ingest]}/${db}/${table}?streamFormat=${streamFormat}`; | ||
if (mappingName != null) { | ||
@@ -181,3 +187,3 @@ endpoint += `&mappingName=${mappingName}`; | ||
return executionType == ExecutionType.Query ? QUERY_TIMEOUT_IN_MILLISECS : COMMAND_TIMEOUT_IN_MILLISECS; | ||
return (executionType == ExecutionType.Query || executionType == ExecutionType.QueryV1) ? QUERY_TIMEOUT_IN_MILLISECS : COMMAND_TIMEOUT_IN_MILLISECS; | ||
} | ||
@@ -184,0 +190,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
234610
2182