From 96b1c8864fb044353d8e110b549ffd1a5bb9755b Mon Sep 17 00:00:00 2001 From: Mehdi Salemi Date: Thu, 3 Oct 2024 15:18:18 -0400 Subject: [PATCH] fix: check for cached app, and set when it does not exist --- packages/app/src/cli/services/generate-schema.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/app/src/cli/services/generate-schema.ts b/packages/app/src/cli/services/generate-schema.ts index 686b09772c3..4df99a0fa35 100644 --- a/packages/app/src/cli/services/generate-schema.ts +++ b/packages/app/src/cli/services/generate-schema.ts @@ -1,4 +1,5 @@ import {fetchOrCreateOrganizationApp} from './context.js' +import {setCachedAppInfo} from './local-storage.js' import {DeveloperPlatformClient, selectDeveloperPlatformClient} from '../utilities/developer-platform-client.js' import {AppInterface} from '../models/app/app.js' import {getAppIdentifiers} from '../models/app/identifiers.js' @@ -37,7 +38,15 @@ export async function ensureConnectedAppFunctionContext( ) } - apiKey = (await fetchOrCreateOrganizationApp(app.creationDefaultOptions())).apiKey + const createdApp = await fetchOrCreateOrganizationApp(app.creationDefaultOptions()) + apiKey = createdApp.apiKey + + await setCachedAppInfo({ + appId: apiKey, + title: createdApp.title, + directory: app.directory, + orgId: createdApp.organizationId, + }) } return {apiKey, developerPlatformClient} }