diff --git a/package.json b/package.json index 66b5578..5ba0371 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mondaycom/apps-cli", - "version": "1.3.4", + "version": "1.3.5", "description": "A cli tool to manage apps (and monday-code projects) in monday.com", "author": "monday.com Apps Team", "type": "module", diff --git a/src/commands/code/status.ts b/src/commands/code/status.ts index 4efaea1..ef7682c 100644 --- a/src/commands/code/status.ts +++ b/src/commands/code/status.ts @@ -5,18 +5,24 @@ import { AuthenticatedCommand } from 'commands-base/authenticated-command'; import { APP_VERSION_ID_TO_ENTER } from 'consts/messages'; import { DynamicChoicesService } from 'services/dynamic-choices-service'; import { getAppVersionDeploymentStatus } from 'services/push-service'; +import { getMondayCodeBuild } from 'src/services/app-builds-service'; import { HttpError } from 'types/errors'; import { AppVersionDeploymentStatus } from 'types/services/push-service'; import logger from 'utils/logger'; -const printDeploymentStatus = (appVersionId: number, deploymentStatus: AppVersionDeploymentStatus) => { +const printDeploymentStatus = ( + appVersionId: number, + deploymentStatus: Pick, +) => { const { deployment, status, error } = deploymentStatus; const url = deployment?.url || 'none'; + const liveUrl = deployment?.liveUrl; const errorMessage: string | undefined = error?.message; const tableData = { id: appVersionId, status, url, + ...(liveUrl && { liveUrl }), ...(errorMessage && { errorMessage }), }; @@ -47,6 +53,12 @@ export default class Status extends AuthenticatedCommand { try { this.preparePrintCommand(this, { appVersionId }); const deploymentStatus = await getAppVersionDeploymentStatus(appVersionId); + const mondayCodeRelease = await getMondayCodeBuild(appVersionId); + + if (deploymentStatus.deployment) { + deploymentStatus.deployment.liveUrl = mondayCodeRelease?.data?.liveUrl; + } + printDeploymentStatus(appVersionId, deploymentStatus); } catch (error: unknown) { if (error instanceof HttpError && error.code === StatusCodes.NOT_FOUND) { diff --git a/src/consts/app-release.ts b/src/consts/app-release.ts new file mode 100644 index 0000000..0241b88 --- /dev/null +++ b/src/consts/app-release.ts @@ -0,0 +1,5 @@ +export enum AppReleaseCategory { + View = 'view', + Integration = 'integration', + MondayCode = 'monday_code', +} diff --git a/src/services/app-builds-service.ts b/src/services/app-builds-service.ts index aa06edb..edaf5be 100644 --- a/src/services/app-builds-service.ts +++ b/src/services/app-builds-service.ts @@ -1,6 +1,7 @@ import { appReleasesUrl } from 'consts/urls'; import { execute } from 'services/api-service'; import { AppRelease, AppReleasesResponse, appReleasesSchema } from 'services/schemas/app-releases-schema'; +import { AppReleaseCategory } from 'src/consts/app-release'; import { HttpError } from 'types/errors'; import { AppVersionId } from 'types/general'; import { HttpMethodTypes } from 'types/services/api-service'; @@ -27,3 +28,8 @@ export const listAppBuilds = async (appVersionId: AppVersionId): Promise => { + const appReleases = await listAppBuilds(appVersionId); + return appReleases.find(release => release.category === AppReleaseCategory.MondayCode); +}; diff --git a/src/services/schemas/push-service-schemas.ts b/src/services/schemas/push-service-schemas.ts index 3cdac2f..31775f2 100644 --- a/src/services/schemas/push-service-schemas.ts +++ b/src/services/schemas/push-service-schemas.ts @@ -29,6 +29,7 @@ export const appVersionDeploymentStatusSchema = z .object({ url: z.string(), latestUrl: z.string(), + liveUrl: z.string().optional(), }) .optional(), error: z