diff --git a/src/resources/apps.ts b/src/resources/apps.ts index b695501..c4ef381 100644 --- a/src/resources/apps.ts +++ b/src/resources/apps.ts @@ -1,5 +1,5 @@ import type { HttpClient } from '../http-client'; -import type { AppType, PaginationOptions } from '../types'; +import type { AppType, BuildStack, PaginationOptions } from '../types'; import { AutomationsResource } from './automations'; import { BaseResource } from './base'; import { BuildSourcesResource } from './build-sources'; @@ -30,6 +30,11 @@ export interface App { * The id of the default environment. */ appEnvironmentId: string | null; + /** + * The default build stack for builds that do not specify one. `null` uses + * the Capawesome Cloud default. + */ + buildStack: BuildStack | null; createdAt: string; updatedAt: string; } @@ -65,6 +70,11 @@ export interface UpdateAppOptions { type?: AppType; appChannelId?: string | null; appEnvironmentId?: string | null; + /** + * The default build stack for builds that do not specify one. `null` uses + * the Capawesome Cloud default. + */ + buildStack?: BuildStack | null; appChannelDiscoveryEnabled?: boolean; nextAppBuildNumber?: number; } diff --git a/src/resources/automations.ts b/src/resources/automations.ts index 4c4ab01..8cac5b3 100644 --- a/src/resources/automations.ts +++ b/src/resources/automations.ts @@ -74,9 +74,16 @@ export interface CreateAutomationOptions { appEnvironmentName?: string; } -export interface UpdateAutomationOptions extends Partial { +export interface UpdateAutomationOptions extends Omit< + Partial, + 'buildStack' +> { appId: string; automationId: string; + /** + * The build stack to use. `null` uses the app's default build stack. + */ + buildStack?: BuildStack | null; enabled?: boolean; } diff --git a/src/types.ts b/src/types.ts index bd5ad13..d010dfd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,7 +21,7 @@ export type GitProvider = 'azure_devops' | 'bitbucket' | 'gitea' | 'git_http' | /** * The macOS stack used to run a native build. */ -export type BuildStack = 'macos-sequoia' | 'macos-tahoe'; +export type BuildStack = 'macos-sequoia' | 'macos-tahoe' | 'macos-golden-gate'; /** * The type of a native build. diff --git a/test/resources.test.ts b/test/resources.test.ts index 033b565..9fb798c 100644 --- a/test/resources.test.ts +++ b/test/resources.test.ts @@ -188,6 +188,18 @@ describe('resources', () => { expect(url.searchParams.get('name')).toBe('My App'); }); + it('clears the default build stack of an app', async () => { + const { getLastRequest } = mockFetchJson({ id: 'app-1', buildStack: null }); + const client = new CapawesomeCloud({ token: 't' }); + + await client.apps.update({ appId: 'app-1', buildStack: null }); + + const { url, init } = getLastRequest(); + expect(init.method).toBe('PATCH'); + expect(url).toBe('https://api.cloud.capawesome.io/v1/apps/app-1'); + expect(JSON.parse(init.body as string)).toEqual({ buildStack: null }); + }); + it('filters teams by name', async () => { const { getLastRequest } = mockFetchJson([]); const client = new CapawesomeCloud({ token: 't' });