From 331074b4f5d31e037de901990eedc5fb97723f94 Mon Sep 17 00:00:00 2001 From: Ilya Shevchenko Date: Fri, 3 Mar 2023 20:10:46 +0400 Subject: [PATCH] fix: import type from `@yandex-cloud/nodejs-sdk` --- examples/package.json | 3 ++- src/credentials.ts | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/package.json b/examples/package.json index 7814d56f..a8f5496f 100644 --- a/examples/package.json +++ b/examples/package.json @@ -19,6 +19,7 @@ "url-shortener": "node build/url-shortener/index.js" }, "dependencies": { + "@yandex-cloud/nodejs-sdk": "^2.4.1", "pino": "^8.11.0", "winston": "^3.8.2", "yargs": "^16.1.0", @@ -33,4 +34,4 @@ "express": "^4.17.1", "typescript": "^4.6.4" } -} \ No newline at end of file +} diff --git a/src/credentials.ts b/src/credentials.ts index df91ba14..0bd58d09 100644 --- a/src/credentials.ts +++ b/src/credentials.ts @@ -7,6 +7,7 @@ import {ISslCredentials, makeDefaultSslCredentials} from './ssl-credentials'; import IamTokenService = yandex.cloud.iam.v1.IamTokenService; import AuthServiceResult = Ydb.Auth.LoginResult; import ICreateIamTokenResponse = yandex.cloud.iam.v1.ICreateIamTokenResponse; +import type {MetadataTokenService} from '@yandex-cloud/nodejs-sdk/dist/token-service/metadata-token-service'; function makeCredentialsMetadata(token: string): grpc.Metadata { const metadata = new grpc.Metadata(); @@ -239,7 +240,7 @@ export class IamAuthService implements IAuthService { export class MetadataAuthService implements IAuthService { private tokenService?: ITokenService; - private MetadataTokenServiceClass?: typeof import('@yandex-cloud/nodejs-sdk/dist/token-service/metadata-token-service').MetadataTokenService; + private MetadataTokenServiceClass?: typeof MetadataTokenService; /** Do not use this, use MetadataAuthService.create */ constructor(tokenService?: ITokenService) { @@ -251,11 +252,9 @@ export class MetadataAuthService implements IAuthService { */ private async createMetadata(): Promise { if (!this.tokenService) { - console.log('importing `@yandex-cloud/nodejs-sdk`'); const {MetadataTokenService} = await import( '@yandex-cloud/nodejs-sdk/dist/token-service/metadata-token-service' ); - console.log('\timported ...'); this.MetadataTokenServiceClass = MetadataTokenService; this.tokenService = new MetadataTokenService(); }