diff --git a/api/projects.ts b/api/projects.ts index ce7be00..dd90d71 100644 --- a/api/projects.ts +++ b/api/projects.ts @@ -7,6 +7,7 @@ import { UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, + WarnLogsResponse, } from '../types/Project'; import { Build, FetchProjectBuildsResponse } from '../types/Build'; import { @@ -14,7 +15,6 @@ import { ProjectComponentsMetadata, } from '../types/ComponentStructure'; import { Deploy, ProjectDeployResponse } from '../types/Deploy'; -import { ProjectLog } from '../types/ProjectLog'; import { MigrateAppResponse, CloneAppResponse, @@ -272,10 +272,6 @@ export function cancelStagedBuild( }); } -type WarnLogsResponse = { - logs: Array; -}; - export function fetchBuildWarnLogs( accountId: number, projectName: string, diff --git a/types/Build.ts b/types/Build.ts index 590318e..1d150b9 100644 --- a/types/Build.ts +++ b/types/Build.ts @@ -6,7 +6,7 @@ import { } from '../enums/build'; import { ActivitySource } from './Activity'; import { DeployStatusTaskLocator } from './Deploy'; -import { OptionalError } from './Error'; +import { ProjectStandardError } from './Project'; export type SubbuildStatus = { buildName: string; @@ -14,10 +14,11 @@ export type SubbuildStatus = { errorMessage: string; finishedAt: string; rootPath: string; - standardError?: OptionalError; + standardError: ProjectStandardError | null; startedAt: string; status: ValueOf; id: string; + visible: boolean; }; export type Build = { @@ -35,6 +36,7 @@ export type Build = { status: ValueOf; subbuildStatuses: Array; uploadMessage: string; + autoDeployId: number; }; export type FetchProjectBuildsResponse = { diff --git a/types/Deploy.ts b/types/Deploy.ts index 83e93de..8b16261 100644 --- a/types/Deploy.ts +++ b/types/Deploy.ts @@ -2,7 +2,7 @@ import { ValueOf } from './Utils'; import { ACTIVITY_SOURCE } from '../enums/project'; import { DEPLOY_ACTION, DEPLOY_STATUS } from '../enums/deploy'; import { COMPONENT_TYPES, SUBCOMPONENT_TYPES } from '../enums/build'; -import { OptionalError } from './Error'; +import { ProjectStandardError } from './Project'; export type DeployStatus = ValueOf; @@ -14,10 +14,11 @@ export type SubdeployStatus = { | ValueOf; errorMessage: string; finishedAt: string; - standardError?: OptionalError; + standardError: ProjectStandardError | null; startedAt: string; status: DeployStatus; id: string; + visible: boolean; }; export type Deploy = { diff --git a/types/Error.ts b/types/Error.ts index 39f8753..4b2593b 100644 --- a/types/Error.ts +++ b/types/Error.ts @@ -36,6 +36,7 @@ export interface HubSpotHttpErrorContext extends FileSystemErrorContext { projectName?: string; } +// TODO: Remove in next major release export type OptionalError = BaseError | null | undefined; export type ErrorContext = { diff --git a/types/Migration.ts b/types/Migration.ts index 6e33cff..284eedd 100644 --- a/types/Migration.ts +++ b/types/Migration.ts @@ -1,5 +1,6 @@ import { ValueOf } from './Utils'; -import { OptionalError } from './Error'; +import { ProjectStandardError } from './Project'; + export const MIGRATION_STATUS = { BUILDING: 'BUILDING', FAILURE: 'FAILURE', @@ -21,6 +22,6 @@ export type CloneAppResponse = { export type PollAppResponse = { id: number; project?: { id: number; name: string; buildId: number; deployId: number }; - error?: OptionalError; + error: ProjectStandardError | null; status: ValueOf; }; diff --git a/types/Project.ts b/types/Project.ts index e37c037..7835fd6 100644 --- a/types/Project.ts +++ b/types/Project.ts @@ -1,5 +1,6 @@ import { Build } from './Build'; import { GithubSourceData } from './Github'; +import { ProjectLog } from './ProjectLog'; export type Project = { createdAt: number; @@ -45,3 +46,24 @@ export type FetchPlatformVersionResponse = { defaultPlatformVersion: string; activePlatformVersions: Array; }; + +export type ProjectStandardError = { + status: string; + id?: string; + category: string; + subCategory?: string; + message?: string; + errors?: Array<{ + message: string; + in?: string; + code?: string; + subcateogy?: string; + context: object; + }>; + context: object; + links: { [key: string]: string }; +}; + +export type WarnLogsResponse = { + logs: Array; +};