Skip to content

Commit

Permalink
Merge branch 'main' of github.com:HubSpot/hubspot-local-dev-lib into …
Browse files Browse the repository at this point in the history
…jy/update-upload-to-handle-ir
  • Loading branch information
joe-yeager committed Dec 18, 2024
2 parents 051fda5 + 7957ded commit 0b67594
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 12 deletions.
6 changes: 1 addition & 5 deletions api/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
UploadProjectResponse,
ProjectSettings,
FetchPlatformVersionResponse,
WarnLogsResponse,
UploadIRResponse,
} from '../types/Project';
import { Build, FetchProjectBuildsResponse } from '../types/Build';
Expand All @@ -15,7 +16,6 @@ import {
ProjectComponentsMetadata,
} from '../types/ComponentStructure';
import { Deploy, ProjectDeployResponse } from '../types/Deploy';
import { ProjectLog } from '../types/ProjectLog';
import {
MigrateAppResponse,
CloneAppResponse,
Expand Down Expand Up @@ -299,10 +299,6 @@ export function cancelStagedBuild(
});
}

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

export function fetchBuildWarnLogs(
accountId: number,
projectName: string,
Expand Down
6 changes: 6 additions & 0 deletions config/config_DEPRECATED.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ export function validateConfig(): boolean {
logger.error('config.portals[] is not defined');
return false;
}

if (accounts.length === 0) {
logger.error('There are no accounts defined in the configuration file');
return false;
}

const accountIdsHash: { [id: number]: CLIAccount_DEPRECATED } = {};
const accountNamesHash: { [name: string]: CLIAccount_DEPRECATED } = {};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hubspot/local-dev-lib",
"version": "3.0.1",
"version": "3.0.2",
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
"main": "lib/index.js",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions types/Accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface CLIAccount_NEW {
authType?: AuthType;
auth?: {
tokenInfo?: TokenInfo;
clientId?: string;
clientSecret?: string;
};
sandboxAccountType?: string | null;
parentAccountId?: number | null;
Expand All @@ -30,6 +32,8 @@ export interface CLIAccount_DEPRECATED {
authType?: AuthType;
auth?: {
tokenInfo?: TokenInfo;
clientId?: string;
clientSecret?: string;
};
sandboxAccountType?: string | null;
parentAccountId?: number | null;
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
1 change: 1 addition & 0 deletions types/Error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
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 @@ -50,3 +51,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>;
};

0 comments on commit 0b67594

Please sign in to comment.