From e54e690caa9bfa8b42111f02b33b05ee790a1e9e Mon Sep 17 00:00:00 2001 From: Tanmaya Panda Date: Mon, 15 Jan 2024 17:11:15 +0530 Subject: [PATCH] addressed review comments --- src/ServerClient/ADXClient.ts | 6 +++--- webpack.common.js | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ServerClient/ADXClient.ts b/src/ServerClient/ADXClient.ts index df3f6f1..4aa5da7 100644 --- a/src/ServerClient/ADXClient.ts +++ b/src/ServerClient/ADXClient.ts @@ -1,5 +1,4 @@ import { ADXResponse, RawADXResponse } from "./ADXResponse"; -const packageJson = require('../../package.json'); type ADXTokenProvider = () => Promise; @@ -72,8 +71,9 @@ export class ADXClient { Authorization: `Bearer ${token}`, "x-ms-client-request-id": `KTrender;${self.crypto.randomUUID()}`, "x-ms-app": "KustoTrender", - "x-ms-client-version": packageJson.version, - "x-ms-user" : "KustoTrender" + "x-ms-client-version": process.env.PACKAGE_VERSION, + "x-ms-user" : "KustoTrender", + "User-Agent" : navigator.userAgent }, body: JSON.stringify(body), }); diff --git a/webpack.common.js b/webpack.common.js index aa5e400..e8f799e 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,5 +1,7 @@ const path = require('path'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const packageJson = require('./package.json'); +const webpack = require('webpack'); module.exports = { entry: './src/KustoTrender.ts', @@ -48,4 +50,9 @@ module.exports = { publicPath: '/dist/', libraryTarget: 'umd' }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.PACKAGE_VERSION': JSON.stringify(packageJson.version) + }) + ] }; \ No newline at end of file