Skip to content

Commit

Permalink
feature: [beta] added interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayElkana committed May 30, 2024
1 parent f4d3a52 commit 50e7ff3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mondaycom/apps-cli",
"version": "2.6.2-beta.4",
"version": "2.6.2-beta.5",
"description": "A cli tool to manage apps (and monday-code projects) in monday.com",
"author": "monday.com Apps Team",
"type": "module",
Expand Down
2 changes: 2 additions & 0 deletions src/commands/code/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export default class Status extends AuthenticatedCommand {
logger.debug({ res: error }, DEBUG_TAG);
if (error instanceof HttpError && error.code === StatusCodes.NOT_FOUND) {
logger.error(`No deployment found for provided app version id - "${appVersionId || VAR_UNKNOWN}"`);
} else if (error instanceof HttpError && error.code === 400) {
logger.error(error.message);
} else {
logger.error(
`An unknown error happened while fetching deployment status for app version id - "${
Expand Down
24 changes: 11 additions & 13 deletions src/utils/region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,28 @@ export async function chooseRegionIfNeeded(
region?: Region,
options?: { appId?: number; appVersionId?: number },
): Promise<Region | undefined> {
if (region) {
if (region || !isPermitted(Permissions.MCODE_MULTI_REGION)) {
return region;
}

const { appId, appVersionId } = options || {};

let isMultiRegionApp = false;
if (appId && isANumber(appId)) {
const isAppSupportMultiRegion = await checkIfAppSupportMultiRegion(appId);
if (isAppSupportMultiRegion) {
isMultiRegionApp = true;
}
}

if (!isMultiRegionApp && appVersionId && isANumber(appVersionId)) {
let _appId = appId;
if (appVersionId && isANumber(appVersionId)) {
const appVersion = await getAppVersionById(appVersionId);
if (!appVersion) throw new Error(`AppVersion with id ${appVersionId} not found.`);
_appId = appVersion.appId;
if (appVersion?.mondayCodeConfig?.isMultiRegion) {
isMultiRegionApp = true;
} else {
const isAppSupportMultiRegion = await checkIfAppSupportMultiRegion(appVersion.appId);
if (isAppSupportMultiRegion) {
isMultiRegionApp = true;
}
}
}

if (!isMultiRegionApp && _appId && isANumber(_appId)) {
const isAppSupportMultiRegion = await checkIfAppSupportMultiRegion(_appId);
if (isAppSupportMultiRegion) {
isMultiRegionApp = true;
}
}

Expand Down

0 comments on commit 50e7ff3

Please sign in to comment.