From 508da8c79bf9f0583f6db2b569152ed9f85dd65a Mon Sep 17 00:00:00 2001 From: Dark-Kernel Date: Mon, 29 Jul 2024 20:17:56 +0530 Subject: [PATCH] created RunData interface for privateKey access --- apps/cli/src/commands/run.command.ts | 10 +++++----- apps/cli/src/types/command/run.types.d.ts | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/cli/src/commands/run.command.ts b/apps/cli/src/commands/run.command.ts index 63bc5bc9..5baa1c69 100644 --- a/apps/cli/src/commands/run.command.ts +++ b/apps/cli/src/commands/run.command.ts @@ -15,7 +15,8 @@ import { import { Logger } from '@/util/logger' import type { ClientRegisteredResponse, - Configuration + Configuration, + RunData } from '@/types/command/run.types' import { decrypt } from '@/util/decrypt' @@ -54,7 +55,7 @@ export default class RunCommand extends BaseCommand { } private async fetchConfigurations(): Promise< - ProjectRootConfig & { privateKey: string } + ProjectRootConfig & RunData > { const { environment, project, workspace, quitOnDecryptionFailure } = await fetchProjectRootConfig() const privateKeyConfig = await fetchPrivateKeyConfig() @@ -81,14 +82,13 @@ export default class RunCommand extends BaseCommand { return 'ws' } - private async connectToSocket(data: ProjectRootConfig) { + private async connectToSocket(data: ProjectRootConfig & RunData) { Logger.info('Connecting to socket...') const host = this.baseUrl.substring(this.baseUrl.lastIndexOf('/') + 1) const websocketUrl = `${this.getWebsocketType(this.baseUrl)}://${host}/change-notifier` - const privateKey = (data as any).privateKey; + const privateKey = data.privateKey const quitOnDecryptionFailure = data.quitOnDecryptionFailure - const ioClient = io(websocketUrl, { autoConnect: false, extraHeaders: { diff --git a/apps/cli/src/types/command/run.types.d.ts b/apps/cli/src/types/command/run.types.d.ts index 79da8314..fa902480 100644 --- a/apps/cli/src/types/command/run.types.d.ts +++ b/apps/cli/src/types/command/run.types.d.ts @@ -1,3 +1,5 @@ +import { ProjectRootConfig } from "../index.types" + export interface Configuration { name: string value: string @@ -9,3 +11,7 @@ export interface ClientRegisteredResponse { projectId: string environmentId: string } + +export interface RunData extends ProjectRootConfig{ + privateKey: string +}