Skip to content

Commit

Permalink
Bump axios & uuid and move @types/mocha to devDependencies (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
amshalev authored Sep 12, 2021
1 parent 110f9fd commit cd3e613
Show file tree
Hide file tree
Showing 10 changed files with 947 additions and 2,200 deletions.
2 changes: 1 addition & 1 deletion azure-kusto-data/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const KustoClient = require("azure-kusto-data").Client;
const KustoConnectionStringBuilder = require("azure-kusto-data").KustoConnectionStringBuilder;
const ClientRequestProperties = require("azure-kusto-data").ClientRequestProperties;
const uuidv4 = require("uuid/v4");
const { v4: uuidv4 } = require('uuid');

const clusterConectionString = "https://<cluster>.<region>.kusto.windows.net";
const database = "<databaseName>";
Expand Down
11 changes: 6 additions & 5 deletions azure-kusto-data/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions azure-kusto-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-kusto-data",
"version": "2.2.2",
"version": "2.2.3",
"description": "Azure Data Explorer Query SDK",
"main": "index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -35,14 +35,14 @@
"dependencies": {
"@azure/identity": "^1.3.0",
"@azure/msal-node": "^1.1.0",
"@types/mocha": "^8.2.0",
"@types/node": "^14.14.13",
"@types/uuid": "^8.3.0",
"axios": "^0.21.1",
"axios": "^0.21.2",
"moment": "^2.25.3",
"uuid": "^3.4.0"
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/mocha": "^8.2.0",
"mocha": "^7.1.2",
"sinon": "^7.2.3",
"tslint": "^6.1.3",
Expand Down
4 changes: 2 additions & 2 deletions azure-kusto-data/source/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import moment from "moment";
import uuid from "uuid";
import { v4 as uuidv4 } from 'uuid';
import AadHelper from "./security";
import {KustoResponseDataSet, KustoResponseDataSetV1, KustoResponseDataSetV2} from "./response";
import ConnectionStringBuilder from "./connectionBuilder";
Expand Down Expand Up @@ -132,7 +132,7 @@ export class KustoClient {
headers["Content-Type"] = "multipart/form-data";
}

headers["x-ms-client-request-id"] = clientRequestId || clientRequestPrefix + `${uuid.v4()}`;
headers["x-ms-client-request-id"] = clientRequestId || clientRequestPrefix + `${uuidv4()}`;

headers.Authorization = await this.aadHelper._getAuthHeader();

Expand Down
5 changes: 2 additions & 3 deletions azure-kusto-data/test/clientTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import assert from "assert";

// tslint:disable-next-line:no-var-requires
import uuid from "uuid";
import { v4 as uuidv4 } from 'uuid';
import moment from "moment";

import {KustoClient} from "../source/client";
Expand Down Expand Up @@ -166,7 +165,7 @@ describe("KustoClient", function () {
it("set clientRequestId for request", async function () {
const url = "https://cluster.kusto.windows.net";
const client = new KustoClient(url);
const clientRequestId = `MyApp.MyActivity;${uuid.v4()}`;
const clientRequestId = `MyApp.MyActivity;${uuidv4()}`;
const application = "app1";
const user = "user1";

Expand Down
18 changes: 9 additions & 9 deletions azure-kusto-data/test/connectionBuilderTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import assert from "assert";
import uuid from "uuid";
import { v4 as uuidv4 } from 'uuid';
import {KustoConnectionStringBuilder} from "../source/connectionBuilder";

describe("KustoConnectionStringBuilder", function () {
Expand Down Expand Up @@ -55,25 +55,25 @@ describe("KustoConnectionStringBuilder", function () {

it("from string with app auth", function () {

const uuidv4 = uuid.v4();
const uuid = uuidv4();
const key = "key of application";

const kcsbs = [
new KustoConnectionStringBuilder(`localhost;Application client Id=${uuidv4};application Key=${key}`),
new KustoConnectionStringBuilder(`Data Source=localhost ; Application Client Id=${uuidv4}; Appkey =${key}`),
new KustoConnectionStringBuilder(` Addr = localhost ; AppClientId = ${uuidv4} ; AppKey =${key}`),
new KustoConnectionStringBuilder(`Network Address = localhost; AppClientId = ${uuidv4} ; AppKey =${key}`),
KustoConnectionStringBuilder.withAadApplicationKeyAuthentication("localhost", uuidv4, key)
new KustoConnectionStringBuilder(`localhost;Application client Id=${uuid};application Key=${key}`),
new KustoConnectionStringBuilder(`Data Source=localhost ; Application Client Id=${uuid}; Appkey =${key}`),
new KustoConnectionStringBuilder(` Addr = localhost ; AppClientId = ${uuid} ; AppKey =${key}`),
new KustoConnectionStringBuilder(`Network Address = localhost; AppClientId = ${uuid} ; AppKey =${key}`),
KustoConnectionStringBuilder.withAadApplicationKeyAuthentication("localhost", uuid, key)
];

const kcsb1 = new KustoConnectionStringBuilder("server=localhost");
kcsb1.applicationClientId = uuidv4;
kcsb1.applicationClientId = uuid;
kcsb1.applicationKey = key;
kcsbs.push(kcsb1);

for (const kcsb of kcsbs) {
assert.equal(kcsb.dataSource, "localhost");
assert.equal(kcsb.applicationClientId, uuidv4);
assert.equal(kcsb.applicationClientId, uuid);
assert.equal(kcsb.applicationKey, key);
assert.equal(kcsb.authorityId, "common");
const emptyFields = ["aadUserId", "password"];
Expand Down
Loading

0 comments on commit cd3e613

Please sign in to comment.