Skip to content

Commit

Permalink
Maorba/cheese/public multi region major version (#98)
Browse files Browse the repository at this point in the history
* new major version that opens the multi-region functionality for everyone (in the CLI only)
  • Loading branch information
maorb-dev authored Jul 28, 2024
1 parent 85ebb87 commit 2c71187
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 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": "3.6.1",
"version": "4.0.0",
"description": "A cli tool to manage apps (and monday-code projects) in monday.com",
"author": "monday.com Apps Team",
"type": "module",
Expand Down
4 changes: 0 additions & 4 deletions src/services/env-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ export const initCurrentWorkingDirectory = (): string => {
export const getCurrentWorkingDirectory = (): string => {
return process.env.CURRENT_WORKING_DIRECTORY!;
};

export const getIsSupportMultiRegion = (): boolean => {
return Boolean(process.env.MCDOE_SUPPRT_MULTIREGION);
};
5 changes: 1 addition & 4 deletions src/utils/permissions.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { getIsSupportMultiRegion } from 'services/env-service';
import { Permissions } from 'types/utils/permissions';

export const isPermitted = (permission: Permissions): boolean => {
if (!permission) {
return false;
}

if (permission === Permissions.MCODE_MULTI_REGION) {
return getIsSupportMultiRegion();
}
// add granular permission check here

return false;
};
16 changes: 5 additions & 11 deletions src/utils/region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { getAppVersionById } from 'services/app-versions-service';
import { checkIfAppSupportMultiRegion } from 'services/apps-service';
import { PromptService } from 'services/prompt-service';
import { Region } from 'types/general/region';
import { Permissions } from 'types/utils/permissions';
import { isPermitted } from 'utils/permissions';
import { isANumber } from 'utils/validations';

export const addRegionToQuery = (query: object | undefined, region?: Region) => {
Expand All @@ -29,14 +27,10 @@ export const regionFlag = {
};

export function addRegionToFlags<T>(flags: T): T {
if (isPermitted(Permissions.MCODE_MULTI_REGION)) {
return {
...flags,
...regionFlag,
};
}

return flags;
return {
...flags,
...regionFlag,
};
}

const regionsPrompt = async () =>
Expand All @@ -46,7 +40,7 @@ export async function chooseRegionIfNeeded(
region?: Region,
options?: { appId?: number; appVersionId?: number },
): Promise<Region | undefined> {
if (region || !isPermitted(Permissions.MCODE_MULTI_REGION)) {
if (region) {
return region;
}

Expand Down

0 comments on commit 2c71187

Please sign in to comment.