Skip to content

Commit

Permalink
fix(btp-utils): refactor code to reuse abapenvtype
Browse files Browse the repository at this point in the history
  • Loading branch information
longieirl committed Dec 12, 2024
1 parent f611d28 commit fd8d149
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
24 changes: 13 additions & 11 deletions packages/btp-utils/src/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,41 +246,43 @@ export function isAbapODataDestination(destination: Destination): boolean {
/**
* Cloud Foundry instance types
*/
export enum ServiceType {
export const AbapEnvType = {
/**
* ABAP instance type
*/
ABAP = 'abap',
ABAP: 'abap',
/**
* ABAP trial instance type
*/
ABAP_TRIAL = 'abap-trial',
ABAP_TRIAL: 'abap-trial',
/**
* ABAP CANARY trial instance type
*/
ABAP_CANARY = 'abap-canary',
ABAP_CANARY: 'abap-canary',
/**
* ABAP OEM instance type
*/
ABAP_OEM = 'abap-oem',
ABAP_OEM: 'abap-oem',
/**
* ABAP OEM CANARY instance type
*/
ABAP_OEM_CANARY = 'abap-oem-canary',
ABAP_OEM_CANARY: 'abap-oem-canary',
/**
* ABAP HAAS instance type
*/
ABAP_HAAS = 'abap-haas',
ABAP_HAAS: 'abap-haas',
/**
* Destination service instance type
*/
DESTINATION = 'destination',
DESTINATION: 'destination',
/**
* ABAP Staging service instance type
*/
ABAP_STAGING = 'abap-staging',
ABAP_STAGING: 'abap-staging',
/**
* ABAP Internal Staging service instance type
*/
ABAP_INTERNAL_STAGING = 'abap-internal-staging'
}
ABAP_INTERNAL_STAGING: 'abap-internal-staging'
} as const;

export type AbapEnvType = (typeof AbapEnvType)[keyof typeof AbapEnvType];
13 changes: 1 addition & 12 deletions packages/inquirer-common/src/prompts/cf-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@ import { apiGetServicesInstancesFilteredByType as getServicesInstances } from '@
import type { ListChoiceOptions } from 'inquirer';
import { ERROR_TYPE, type ErrorHandler } from '../error-handler/error-handler';
import { t } from '../i18n';

const AbapEnvType = {
ABAP: 'abap',
ABAP_TRIAL: 'abap-trial',
ABAP_CANARY: 'abap-canary',
ABAP_OEM: 'abap-oem',
ABAP_OEM_CANARY: 'abap-oem-canary',
ABAP_HAAS: 'abap-haas',
ABAP_STAGING: 'abap-staging',
ABAP_INTERNAL_STAGING: 'abap-internal-staging',
DESTINATION: 'destination'
} as const;
import { AbapEnvType } from '@sap-ux/btp-utils';

/**
* Get the name sorted list of ABAP instance choices from an active CF login. If not logged in, an error message is logged.
Expand Down

0 comments on commit fd8d149

Please sign in to comment.