From 1d14a97b651f7aca8fc7122cac3b44d284a13f79 Mon Sep 17 00:00:00 2001 From: alexloiko <13203602+alexloiko@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:11:04 +0200 Subject: [PATCH] ALL-9923 Fixed version in report for Docker (#113) * ALL-9923 Fixed version in report for Docker * ALL-9923 Fixed version in response header --------- Co-authored-by: Oleksandr Loiko --- package.json | 2 +- src/management.ts | 4 +++- src/signatures.ts | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1beaba0..c47effd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumio/tatum-kms", - "version": "7.0.7", + "version": "7.0.8", "description": "Tatum KMS - Key Management System for Tatum-powered apps.", "main": "dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/management.ts b/src/management.ts index c52c26c..46c665a 100644 --- a/src/management.ts +++ b/src/management.ts @@ -30,6 +30,8 @@ import { import { utils } from './utils' import semver from 'semver' +import { version } from '../package.json' + const ensurePathExists = (path: string) => { const dir = dirname(path) if (!existsSync(dir)) { @@ -545,7 +547,7 @@ export const getQuestion = (q: string, e?: string) => { } const getKmsVersion = (): string => { - return process.env.npm_package_version ?? 'N/A' + return version || 'N/A' } const getPathToWallet = (path?: string) => { diff --git a/src/signatures.ts b/src/signatures.ts index 883bf49..4015512 100644 --- a/src/signatures.ts +++ b/src/signatures.ts @@ -58,6 +58,7 @@ import { ExternalUrlMethod, Wallet } from './interfaces' import { getManagedWallets, getWallet, getWalletForSignature } from './management' import semver from 'semver' import { Config, ConfigOption } from './config' +import { version } from '../package.json' const TATUM_URL: string = process.env.TATUM_API_URL || 'https://api.tatum.io' @@ -516,7 +517,7 @@ const processVersionUpdateHeader = (versionUpdateHeader: string) => { versionUpdateState.level = parts[1]?.toUpperCase()?.trim() versionUpdateState.logFunction = versionUpdateState.level === 'ERROR' ? console.error : console.log versionUpdateState.message = parts[2]?.trim() - versionUpdateState.currentVersion = process.env.npm_package_version ?? '' + versionUpdateState.currentVersion = version ?? '' if ( !versionUpdateState.running && @@ -562,7 +563,7 @@ const getPendingTransactions = async ( { headers: { 'x-api-key': Config.getValue(ConfigOption.TATUM_API_KEY), - 'x-ttm-kms-client-version': process.env.npm_package_version ?? '', + 'x-ttm-kms-client-version': version ?? '', }, }, )