azure-kusto-data 5.0.4 → 5.1.0
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/dist-esm/src/client.js +20 -10
- package/package.json +2 -2
- package/types/src/client.d.ts +9 -2
package/dist-esm/src/client.js
CHANGED
|
@@ -80,27 +80,30 @@ class KustoClient {
|
|
|
80
80
|
return this.executeQuery(db, query, properties);
|
|
81
81
|
}
|
|
82
82
|
async executeQuery(db, query, properties) {
|
|
83
|
-
return this._execute(this.endpoints[ExecutionType.Query], ExecutionType.Query, db, query
|
|
83
|
+
return this._execute(this.endpoints[ExecutionType.Query], ExecutionType.Query, db, { query }, properties);
|
|
84
84
|
}
|
|
85
85
|
async executeQueryV1(db, query, properties) {
|
|
86
|
-
return this._execute(this.endpoints[ExecutionType.QueryV1], ExecutionType.QueryV1, db, query
|
|
86
|
+
return this._execute(this.endpoints[ExecutionType.QueryV1], ExecutionType.QueryV1, db, { query }, properties);
|
|
87
87
|
}
|
|
88
88
|
async executeMgmt(db, query, properties) {
|
|
89
|
-
return this._execute(this.endpoints[ExecutionType.Mgmt], ExecutionType.Mgmt, db, query
|
|
89
|
+
return this._execute(this.endpoints[ExecutionType.Mgmt], ExecutionType.Mgmt, db, { query }, properties);
|
|
90
90
|
}
|
|
91
|
-
async executeStreamingIngest(db, table, stream, streamFormat, mappingName, clientRequestId) {
|
|
91
|
+
async executeStreamingIngest(db, table, stream, streamFormat, mappingName, blob, clientRequestId) {
|
|
92
92
|
let endpoint = `${this.endpoints[ExecutionType.Ingest]}/${this.getDb(db)}/${table}?streamFormat=${streamFormat}`;
|
|
93
93
|
if (mappingName != null) {
|
|
94
94
|
endpoint += `&mappingName=${mappingName}`;
|
|
95
95
|
}
|
|
96
|
+
if (blob) {
|
|
97
|
+
endpoint += `&sourceKind=uri`;
|
|
98
|
+
}
|
|
96
99
|
let properties = null;
|
|
97
100
|
if (clientRequestId) {
|
|
98
101
|
properties = new clientRequestProperties_1.default();
|
|
99
102
|
properties.clientRequestId = clientRequestId;
|
|
100
103
|
}
|
|
101
|
-
return this._execute(endpoint, ExecutionType.Ingest, db,
|
|
104
|
+
return this._execute(endpoint, ExecutionType.Ingest, db, blob ? { blob } : { stream }, properties);
|
|
102
105
|
}
|
|
103
|
-
async _execute(endpoint, executionType, db,
|
|
106
|
+
async _execute(endpoint, executionType, db, entity, properties) {
|
|
104
107
|
this.ensureOpen();
|
|
105
108
|
kustoTrustedEndpoints_1.kustoTrustedEndpoints.validateTrustedEndpoint(endpoint, (await cloudSettings_1.default.getCloudInfoForCluster(this.cluster)).LoginEndpoint);
|
|
106
109
|
db = this.getDb(db);
|
|
@@ -109,10 +112,10 @@ class KustoClient {
|
|
|
109
112
|
let clientRequestPrefix = "";
|
|
110
113
|
const timeout = this._getClientTimeout(executionType, properties);
|
|
111
114
|
let payloadContent = "";
|
|
112
|
-
if (query
|
|
115
|
+
if ("query" in entity) {
|
|
113
116
|
payload = {
|
|
114
117
|
db,
|
|
115
|
-
csl: query,
|
|
118
|
+
csl: entity.query,
|
|
116
119
|
};
|
|
117
120
|
if (properties != null) {
|
|
118
121
|
payload.properties = properties.toJSON();
|
|
@@ -121,8 +124,8 @@ class KustoClient {
|
|
|
121
124
|
headers["Content-Type"] = "application/json; charset=utf-8";
|
|
122
125
|
clientRequestPrefix = "KNC.execute;";
|
|
123
126
|
}
|
|
124
|
-
else if (stream
|
|
125
|
-
payloadContent = stream;
|
|
127
|
+
else if ("stream" in entity) {
|
|
128
|
+
payloadContent = entity.stream;
|
|
126
129
|
clientRequestPrefix = "KNC.executeStreamingIngest;";
|
|
127
130
|
if (core_util_1.isNode) {
|
|
128
131
|
headers["Content-Encoding"] = "gzip";
|
|
@@ -132,6 +135,13 @@ class KustoClient {
|
|
|
132
135
|
headers["Content-Type"] = "application/json";
|
|
133
136
|
}
|
|
134
137
|
}
|
|
138
|
+
else if ("blob" in entity) {
|
|
139
|
+
payloadContent = {
|
|
140
|
+
sourceUri: entity.blob,
|
|
141
|
+
};
|
|
142
|
+
clientRequestPrefix = "KNC.executeStreamingIngestFromBlob;";
|
|
143
|
+
headers["Content-Type"] = "application/json";
|
|
144
|
+
}
|
|
135
145
|
else {
|
|
136
146
|
throw new Error("Invalid parameters - expected query or streaming ingest");
|
|
137
147
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-kusto-data",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Azure Data Explorer Query SDK",
|
|
5
5
|
"module": "dist-esm/src/index.js",
|
|
6
6
|
"types": "./types/src/index.d.ts",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"overrides": {
|
|
69
69
|
"jsonwebtoken": "^9.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "120a8d91fde4b0e520225e09895a28b085b85a7e"
|
|
72
72
|
}
|
package/types/src/client.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ declare enum ExecutionType {
|
|
|
9
9
|
Ingest = "ingest",
|
|
10
10
|
QueryV1 = "queryv1"
|
|
11
11
|
}
|
|
12
|
+
export type RequestEntity = {
|
|
13
|
+
query: string;
|
|
14
|
+
} | {
|
|
15
|
+
stream: any;
|
|
16
|
+
} | {
|
|
17
|
+
blob: string;
|
|
18
|
+
};
|
|
12
19
|
export declare class KustoClient {
|
|
13
20
|
connectionString: ConnectionStringBuilder;
|
|
14
21
|
cluster: string;
|
|
@@ -25,8 +32,8 @@ export declare class KustoClient {
|
|
|
25
32
|
executeQuery(db: string | null, query: string, properties?: ClientRequestProperties): Promise<KustoResponseDataSet>;
|
|
26
33
|
executeQueryV1(db: string | null, query: string, properties?: ClientRequestProperties): Promise<KustoResponseDataSet>;
|
|
27
34
|
executeMgmt(db: string | null, query: string, properties?: ClientRequestProperties): Promise<KustoResponseDataSet>;
|
|
28
|
-
executeStreamingIngest(db: string | null, table: string, stream: any, streamFormat: any, mappingName: string | null, clientRequestId?: string): Promise<KustoResponseDataSet>;
|
|
29
|
-
_execute(endpoint: string, executionType: ExecutionType, db: string | null,
|
|
35
|
+
executeStreamingIngest(db: string | null, table: string, stream: any, streamFormat: any, mappingName: string | null, blob?: string, clientRequestId?: string): Promise<KustoResponseDataSet>;
|
|
36
|
+
_execute(endpoint: string, executionType: ExecutionType, db: string | null, entity: RequestEntity, properties?: ClientRequestProperties | null): Promise<KustoResponseDataSet>;
|
|
30
37
|
private getDb;
|
|
31
38
|
_doRequest(endpoint: string, executionType: ExecutionType, headers: {
|
|
32
39
|
[header: string]: string;
|