Skip to content

Commit e6f20c3

Browse files
authored
Merge pull request #221 from HubSpot/update-project-types
Chore: update project types
2 parents a078c41 + b3c75af commit e6f20c3

File tree

6 files changed

+34
-11
lines changed

6 files changed

+34
-11
lines changed

api/projects.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import {
77
UploadProjectResponse,
88
ProjectSettings,
99
FetchPlatformVersionResponse,
10+
WarnLogsResponse,
1011
} from '../types/Project';
1112
import { Build, FetchProjectBuildsResponse } from '../types/Build';
1213
import {
1314
ComponentStructureResponse,
1415
ProjectComponentsMetadata,
1516
} from '../types/ComponentStructure';
1617
import { Deploy, ProjectDeployResponse } from '../types/Deploy';
17-
import { ProjectLog } from '../types/ProjectLog';
1818
import {
1919
MigrateAppResponse,
2020
CloneAppResponse,
@@ -272,10 +272,6 @@ export function cancelStagedBuild(
272272
});
273273
}
274274

275-
type WarnLogsResponse = {
276-
logs: Array<ProjectLog>;
277-
};
278-
279275
export function fetchBuildWarnLogs(
280276
accountId: number,
281277
projectName: string,

types/Build.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ import {
66
} from '../enums/build';
77
import { ActivitySource } from './Activity';
88
import { DeployStatusTaskLocator } from './Deploy';
9-
import { OptionalError } from './Error';
9+
import { ProjectStandardError } from './Project';
1010

1111
export type SubbuildStatus = {
1212
buildName: string;
1313
buildType: ValueOf<typeof SUBBUILD_TYPES>;
1414
errorMessage: string;
1515
finishedAt: string;
1616
rootPath: string;
17-
standardError?: OptionalError;
17+
standardError: ProjectStandardError | null;
1818
startedAt: string;
1919
status: ValueOf<typeof BUILD_STATUS>;
2020
id: string;
21+
visible: boolean;
2122
};
2223

2324
export type Build = {
@@ -35,6 +36,7 @@ export type Build = {
3536
status: ValueOf<typeof BUILD_STATUS>;
3637
subbuildStatuses: Array<SubbuildStatus>;
3738
uploadMessage: string;
39+
autoDeployId: number;
3840
};
3941

4042
export type FetchProjectBuildsResponse = {

types/Deploy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ValueOf } from './Utils';
22
import { ACTIVITY_SOURCE } from '../enums/project';
33
import { DEPLOY_ACTION, DEPLOY_STATUS } from '../enums/deploy';
44
import { COMPONENT_TYPES, SUBCOMPONENT_TYPES } from '../enums/build';
5-
import { OptionalError } from './Error';
5+
import { ProjectStandardError } from './Project';
66

77
export type DeployStatus = ValueOf<typeof DEPLOY_STATUS>;
88

@@ -14,10 +14,11 @@ export type SubdeployStatus = {
1414
| ValueOf<typeof SUBCOMPONENT_TYPES>;
1515
errorMessage: string;
1616
finishedAt: string;
17-
standardError?: OptionalError;
17+
standardError: ProjectStandardError | null;
1818
startedAt: string;
1919
status: DeployStatus;
2020
id: string;
21+
visible: boolean;
2122
};
2223

2324
export type Deploy = {

types/Error.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface HubSpotHttpErrorContext extends FileSystemErrorContext {
3636
projectName?: string;
3737
}
3838

39+
// TODO: Remove in next major release
3940
export type OptionalError = BaseError | null | undefined;
4041

4142
export type ErrorContext = {

types/Migration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ValueOf } from './Utils';
2-
import { OptionalError } from './Error';
2+
import { ProjectStandardError } from './Project';
3+
34
export const MIGRATION_STATUS = {
45
BUILDING: 'BUILDING',
56
FAILURE: 'FAILURE',
@@ -21,6 +22,6 @@ export type CloneAppResponse = {
2122
export type PollAppResponse = {
2223
id: number;
2324
project?: { id: number; name: string; buildId: number; deployId: number };
24-
error?: OptionalError;
25+
error: ProjectStandardError | null;
2526
status: ValueOf<typeof MIGRATION_STATUS>;
2627
};

types/Project.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Build } from './Build';
22
import { GithubSourceData } from './Github';
3+
import { ProjectLog } from './ProjectLog';
34

45
export type Project = {
56
createdAt: number;
@@ -45,3 +46,24 @@ export type FetchPlatformVersionResponse = {
4546
defaultPlatformVersion: string;
4647
activePlatformVersions: Array<string>;
4748
};
49+
50+
export type ProjectStandardError = {
51+
status: string;
52+
id?: string;
53+
category: string;
54+
subCategory?: string;
55+
message?: string;
56+
errors?: Array<{
57+
message: string;
58+
in?: string;
59+
code?: string;
60+
subcateogy?: string;
61+
context: object;
62+
}>;
63+
context: object;
64+
links: { [key: string]: string };
65+
};
66+
67+
export type WarnLogsResponse = {
68+
logs: Array<ProjectLog>;
69+
};

0 commit comments

Comments
 (0)