Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: update project types #221

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 1 addition & 5 deletions api/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import {
UploadProjectResponse,
ProjectSettings,
FetchPlatformVersionResponse,
WarnLogsResponse,
} from '../types/Project';
import { Build, FetchProjectBuildsResponse } from '../types/Build';
import {
ComponentStructureResponse,
ProjectComponentsMetadata,
} from '../types/ComponentStructure';
import { Deploy, ProjectDeployResponse } from '../types/Deploy';
import { ProjectLog } from '../types/ProjectLog';
import {
MigrateAppResponse,
CloneAppResponse,
Expand Down Expand Up @@ -272,10 +272,6 @@ export function cancelStagedBuild(
});
}

type WarnLogsResponse = {
logs: Array<ProjectLog>;
};

export function fetchBuildWarnLogs(
accountId: number,
projectName: string,
Expand Down
6 changes: 4 additions & 2 deletions types/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ 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;
buildType: ValueOf<typeof SUBBUILD_TYPES>;
errorMessage: string;
finishedAt: string;
rootPath: string;
standardError?: OptionalError;
standardError: ProjectStandardError | null;
startedAt: string;
status: ValueOf<typeof BUILD_STATUS>;
id: string;
visible: boolean;
};

export type Build = {
Expand All @@ -35,6 +36,7 @@ export type Build = {
status: ValueOf<typeof BUILD_STATUS>;
subbuildStatuses: Array<SubbuildStatus>;
uploadMessage: string;
autoDeployId: number;
};

export type FetchProjectBuildsResponse = {
Expand Down
5 changes: 3 additions & 2 deletions types/Deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof DEPLOY_STATUS>;

Expand All @@ -14,10 +14,11 @@ export type SubdeployStatus = {
| ValueOf<typeof SUBCOMPONENT_TYPES>;
errorMessage: string;
finishedAt: string;
standardError?: OptionalError;
standardError: ProjectStandardError | null;
startedAt: string;
status: DeployStatus;
id: string;
visible: boolean;
};

export type Deploy = {
Expand Down
2 changes: 0 additions & 2 deletions types/Error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export interface HubSpotHttpErrorContext extends FileSystemErrorContext {
projectName?: string;
}

export type OptionalError = BaseError | null | undefined;

export type ErrorContext = {
accountId?: number;
};
5 changes: 3 additions & 2 deletions types/Migration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ValueOf } from './Utils';
import { OptionalError } from './Error';
import { ProjectStandardError } from './Project';

export const MIGRATION_STATUS = {
BUILDING: 'BUILDING',
FAILURE: 'FAILURE',
Expand All @@ -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<typeof MIGRATION_STATUS>;
};
22 changes: 22 additions & 0 deletions types/Project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Build } from './Build';
import { GithubSourceData } from './Github';
import { ProjectLog } from './ProjectLog';

export type Project = {
createdAt: number;
Expand Down Expand Up @@ -45,3 +46,24 @@ export type FetchPlatformVersionResponse = {
defaultPlatformVersion: string;
activePlatformVersions: Array<string>;
};

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<ProjectLog>;
};
Loading