Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/resources/apps.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
9 changes: 8 additions & 1 deletion src/resources/automations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,16 @@ export interface CreateAutomationOptions {
appEnvironmentName?: string;
}

export interface UpdateAutomationOptions extends Partial<CreateAutomationOptions> {
export interface UpdateAutomationOptions extends Omit<
Partial<CreateAutomationOptions>,
'buildStack'
> {
appId: string;
automationId: string;
/**
* The build stack to use. `null` uses the app's default build stack.
*/
buildStack?: BuildStack | null;
enabled?: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions test/resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down
Loading