diff --git a/lib/__tests__/buildAccount.test.ts b/lib/__tests__/buildAccount.test.ts index 54f446225..9a2f96921 100644 --- a/lib/__tests__/buildAccount.test.ts +++ b/lib/__tests__/buildAccount.test.ts @@ -177,7 +177,7 @@ describe('lib/buildAccount', () => { mockParentAccountConfig.env, 10 ); - expect(result).toEqual(mockDeveloperTestAccount); + expect(result).toEqual(mockDeveloperTestAccount.id); }); it('should throw error if account ID is not found', async () => { diff --git a/lib/buildAccount.ts b/lib/buildAccount.ts index 3118042ad..e46f91bce 100644 --- a/lib/buildAccount.ts +++ b/lib/buildAccount.ts @@ -24,7 +24,6 @@ import { debugError, logError } from './errorHandlers/index'; import { SANDBOX_API_TYPE_MAP, handleSandboxCreateError } from './sandboxes'; import { handleDeveloperTestAccountCreateError } from './developerTestAccounts'; import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts'; -import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts'; import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox'; import { SandboxAccountType } from '../types/Sandboxes'; @@ -91,7 +90,7 @@ export async function buildDeveloperTestAccount( parentAccountConfig: CLIAccount, env: Environment, portalLimit: number -): Promise { +): Promise { const i18nKey = 'lib.developerTestAccount.create.loading'; const id = getAccountIdentifier(parentAccountConfig); @@ -112,7 +111,8 @@ export async function buildDeveloperTestAccount( }), }); - let developerTestAccount: DeveloperTestAccount; + let developerTestAccountId: number; + let developerTestAccountPersonalAccessKey: string; try { const { data } = await createDeveloperTestAccount( @@ -120,12 +120,13 @@ export async function buildDeveloperTestAccount( testAccountName ); - developerTestAccount = data; + developerTestAccountId = data.id; + developerTestAccountPersonalAccessKey = data.personalAccessKey; SpinniesManager.succeed('buildDeveloperTestAccount', { text: i18n(`${i18nKey}.succeed`, { accountName: testAccountName, - accountId: developerTestAccount.id, + accountId: developerTestAccountId, }), }); } catch (e) { @@ -141,13 +142,18 @@ export async function buildDeveloperTestAccount( } try { - await saveAccountToConfig(developerTestAccount.id, testAccountName, env); + await saveAccountToConfig( + developerTestAccountId, + testAccountName, + env, + developerTestAccountPersonalAccessKey + ); } catch (err) { logError(err); throw err; } - return developerTestAccount; + return developerTestAccountId; } type SandboxAccount = SandboxResponse & { diff --git a/lib/localDev.ts b/lib/localDev.ts index dec2edad0..50a2de833 100644 --- a/lib/localDev.ts +++ b/lib/localDev.ts @@ -330,7 +330,7 @@ export async function createDeveloperTestAccountForLocalDev( maxTestPortals ); - return result.id; + return result; } catch (err) { logError(err); process.exit(EXIT_CODES.ERROR); diff --git a/package.json b/package.json index 2671a38d1..9a2658604 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "Apache-2.0", "repository": "https://github.com/HubSpot/hubspot-cli", "dependencies": { - "@hubspot/local-dev-lib": "3.5.2", + "@hubspot/local-dev-lib": "3.5.3", "@hubspot/project-parsing-lib": "0.1.7", "@hubspot/serverless-dev-runtime": "7.0.2", "@hubspot/theme-preview-dev-server": "0.0.10",