@sap-ux/abap-deploy-config-inquirer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +93 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -0
- package/dist/error-handler.d.ts +13 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/error-handler.js +33 -0
- package/dist/error-handler.js.map +1 -0
- package/dist/i18n.d.ts +14 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +34 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-helper.d.ts +20 -0
- package/dist/logger-helper.d.ts.map +1 -0
- package/dist/logger-helper.js +27 -0
- package/dist/logger-helper.js.map +1 -0
- package/dist/prompts/conditions.d.ts +117 -0
- package/dist/prompts/conditions.d.ts.map +1 -0
- package/dist/prompts/conditions.js +299 -0
- package/dist/prompts/conditions.js.map +1 -0
- package/dist/prompts/defaults.d.ts +45 -0
- package/dist/prompts/defaults.d.ts.map +1 -0
- package/dist/prompts/defaults.js +91 -0
- package/dist/prompts/defaults.js.map +1 -0
- package/dist/prompts/helpers.d.ts +54 -0
- package/dist/prompts/helpers.d.ts.map +1 -0
- package/dist/prompts/helpers.js +234 -0
- package/dist/prompts/helpers.js.map +1 -0
- package/dist/prompts/index.d.ts +9 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +30 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/prompt-state.d.ts +38 -0
- package/dist/prompts/prompt-state.d.ts.map +1 -0
- package/dist/prompts/prompt-state.js +59 -0
- package/dist/prompts/prompt-state.js.map +1 -0
- package/dist/prompts/questions/abap-target.d.ts +10 -0
- package/dist/prompts/questions/abap-target.d.ts.map +1 -0
- package/dist/prompts/questions/abap-target.js +219 -0
- package/dist/prompts/questions/abap-target.js.map +1 -0
- package/dist/prompts/questions/auth.d.ts +10 -0
- package/dist/prompts/questions/auth.d.ts.map +1 -0
- package/dist/prompts/questions/auth.js +55 -0
- package/dist/prompts/questions/auth.js.map +1 -0
- package/dist/prompts/questions/config/app.d.ts +10 -0
- package/dist/prompts/questions/config/app.d.ts.map +1 -0
- package/dist/prompts/questions/config/app.js +68 -0
- package/dist/prompts/questions/config/app.js.map +1 -0
- package/dist/prompts/questions/config/index.d.ts +4 -0
- package/dist/prompts/questions/config/index.d.ts.map +1 -0
- package/dist/prompts/questions/config/index.js +20 -0
- package/dist/prompts/questions/config/index.js.map +1 -0
- package/dist/prompts/questions/config/package.d.ts +10 -0
- package/dist/prompts/questions/config/package.d.ts.map +1 -0
- package/dist/prompts/questions/config/package.js +91 -0
- package/dist/prompts/questions/config/package.js.map +1 -0
- package/dist/prompts/questions/config/transport.d.ts +10 -0
- package/dist/prompts/questions/config/transport.d.ts.map +1 -0
- package/dist/prompts/questions/config/transport.js +91 -0
- package/dist/prompts/questions/config/transport.js.map +1 -0
- package/dist/prompts/questions/confirm.d.ts +10 -0
- package/dist/prompts/questions/confirm.d.ts.map +1 -0
- package/dist/prompts/questions/confirm.js +55 -0
- package/dist/prompts/questions/confirm.js.map +1 -0
- package/dist/prompts/questions/index.d.ts +5 -0
- package/dist/prompts/questions/index.d.ts.map +1 -0
- package/dist/prompts/questions/index.js +21 -0
- package/dist/prompts/questions/index.js.map +1 -0
- package/dist/prompts/validators.d.ts +138 -0
- package/dist/prompts/validators.d.ts.map +1 -0
- package/dist/prompts/validators.js +459 -0
- package/dist/prompts/validators.js.map +1 -0
- package/dist/service-provider-utils/abap-service-provider.d.ts +19 -0
- package/dist/service-provider-utils/abap-service-provider.d.ts.map +1 -0
- package/dist/service-provider-utils/abap-service-provider.js +89 -0
- package/dist/service-provider-utils/abap-service-provider.js.map +1 -0
- package/dist/service-provider-utils/create-transport.d.ts +12 -0
- package/dist/service-provider-utils/create-transport.d.ts.map +1 -0
- package/dist/service-provider-utils/create-transport.js +35 -0
- package/dist/service-provider-utils/create-transport.js.map +1 -0
- package/dist/service-provider-utils/index.d.ts +6 -0
- package/dist/service-provider-utils/index.d.ts.map +1 -0
- package/dist/service-provider-utils/index.js +22 -0
- package/dist/service-provider-utils/index.js.map +1 -0
- package/dist/service-provider-utils/list-packages.d.ts +11 -0
- package/dist/service-provider-utils/list-packages.d.ts.map +1 -0
- package/dist/service-provider-utils/list-packages.js +37 -0
- package/dist/service-provider-utils/list-packages.js.map +1 -0
- package/dist/service-provider-utils/transport-config.d.ts +18 -0
- package/dist/service-provider-utils/transport-config.d.ts.map +1 -0
- package/dist/service-provider-utils/transport-config.js +211 -0
- package/dist/service-provider-utils/transport-config.js.map +1 -0
- package/dist/service-provider-utils/transport-list.d.ts +16 -0
- package/dist/service-provider-utils/transport-list.d.ts.map +1 -0
- package/dist/service-provider-utils/transport-list.js +56 -0
- package/dist/service-provider-utils/transport-list.js.map +1 -0
- package/dist/translations/abap-deploy-config-inquirer.i18n.json +146 -0
- package/dist/types.d.ts +165 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +46 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +90 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +233 -0
- package/dist/utils.js.map +1 -0
- package/dist/validator-utils.d.ts +75 -0
- package/dist/validator-utils.d.ts.map +1 -0
- package/dist/validator-utils.js +172 -0
- package/dist/validator-utils.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type AbapDeployConfigAnswersInternal, type AbapDeployConfigPromptOptions, type BackendTarget } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if URL question should be shown.
|
|
4
|
+
*
|
|
5
|
+
* @param targetSystem - chosen target system
|
|
6
|
+
* @returns true if target system type is URL
|
|
7
|
+
*/
|
|
8
|
+
export declare function showUrlQuestion(targetSystem?: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Determines if the SCP question should be shown.
|
|
11
|
+
*
|
|
12
|
+
* @param previousAnswers - previous answers
|
|
13
|
+
* @returns boolean
|
|
14
|
+
*/
|
|
15
|
+
export declare function showScpQuestion(previousAnswers: AbapDeployConfigAnswersInternal): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Determines if the client choice question should be shown.
|
|
18
|
+
*
|
|
19
|
+
* @param client - client
|
|
20
|
+
* @param isS4HanaCloudSystem - is S/4 HANA Cloud system
|
|
21
|
+
* @returns boolean
|
|
22
|
+
*/
|
|
23
|
+
export declare function showClientChoiceQuestion(client?: string, isS4HanaCloudSystem?: boolean): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Determines if the client question should be shown.
|
|
26
|
+
* Note: In some instances, when a yaml conf is parsed, double quoted properties i.e. client: "100" are saved as a number instead of a string.
|
|
27
|
+
*
|
|
28
|
+
* @param clientChoice - client choice from previous answers
|
|
29
|
+
* @param client - client
|
|
30
|
+
* @param isS4HanaCloudSystem - is S/4 HANA Cloud system
|
|
31
|
+
* @returns boolean
|
|
32
|
+
*/
|
|
33
|
+
export declare function showClientQuestion(clientChoice?: string, client?: string, isS4HanaCloudSystem?: boolean): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Determines if the username question should be shown.
|
|
36
|
+
*
|
|
37
|
+
* @param backendTarget - backend target from prompt options
|
|
38
|
+
* @returns boolean
|
|
39
|
+
*/
|
|
40
|
+
export declare function showUsernameQuestion(backendTarget?: BackendTarget): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Determines if the password question should be shown.
|
|
43
|
+
*
|
|
44
|
+
* @returns boolean
|
|
45
|
+
*/
|
|
46
|
+
export declare function showPasswordQuestion(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Determines if the UI5 app deploy config question should be shown (UI5 Abap Repo name & Description).
|
|
49
|
+
*
|
|
50
|
+
* @param hideUi5AbapRepoPrompt - option to hide the prompt if using a btp system
|
|
51
|
+
* @returns boolean
|
|
52
|
+
*/
|
|
53
|
+
export declare function showUi5AppDeployConfigQuestion(hideUi5AbapRepoPrompt?: boolean): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Determines if the choice of package input options should include both manual input and search (autocomplete) input options.
|
|
56
|
+
*
|
|
57
|
+
* @returns boolean
|
|
58
|
+
*/
|
|
59
|
+
export declare function showPackageInputChoiceQuestion(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Determines if the manual package input prompt should be shown.
|
|
62
|
+
*
|
|
63
|
+
* @param isCli - is in CLI
|
|
64
|
+
* @param packageInputChoice - package input choice from previous answers
|
|
65
|
+
* @returns boolean
|
|
66
|
+
*/
|
|
67
|
+
export declare function defaultOrShowManualPackageQuestion(isCli: boolean, packageInputChoice?: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Determines if the search (autcomplete) package input prompt can be shown based on backend availability.
|
|
70
|
+
*
|
|
71
|
+
* @param isCli - is in CLI
|
|
72
|
+
* @param packageInputChoice - package input choice from previous answers
|
|
73
|
+
* @returns boolean
|
|
74
|
+
*/
|
|
75
|
+
export declare function defaultOrShowSearchPackageQuestion(isCli: boolean, packageInputChoice?: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Determines if the transport input choice question should be shown.
|
|
78
|
+
*
|
|
79
|
+
* @returns boolean
|
|
80
|
+
*/
|
|
81
|
+
export declare function showTransportInputChoice(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Determines if the transport list question should be shown.
|
|
84
|
+
*
|
|
85
|
+
* @param transportInputChoice - transportInputChoice from previous answers
|
|
86
|
+
* @returns boolean
|
|
87
|
+
*/
|
|
88
|
+
export declare function defaultOrShowTransportListQuestion(transportInputChoice?: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Determines if the transport created prompt should be shown.
|
|
91
|
+
*
|
|
92
|
+
* @param transportInputChoice - transportInputChoice from previous answers
|
|
93
|
+
* @returns boolean
|
|
94
|
+
*/
|
|
95
|
+
export declare function defaultOrShowTransportCreatedQuestion(transportInputChoice?: string): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Determines if the manual transport prompt should be shown.
|
|
98
|
+
*
|
|
99
|
+
* @param transportInputChoice - transportInputChoice from previous answers
|
|
100
|
+
* @returns boolean
|
|
101
|
+
*/
|
|
102
|
+
export declare function defaultOrShowManualTransportQuestion(transportInputChoice?: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Determines if the index prompt should be shown.
|
|
105
|
+
*
|
|
106
|
+
* @param options - abap deploy config prompt options
|
|
107
|
+
* @returns boolean
|
|
108
|
+
*/
|
|
109
|
+
export declare function showIndexQuestion(options: AbapDeployConfigPromptOptions): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Determines if the overwrite prompt should be shown.
|
|
112
|
+
*
|
|
113
|
+
* @param options - abap deploy config prompt options
|
|
114
|
+
* @returns boolean
|
|
115
|
+
*/
|
|
116
|
+
export declare function showOverwriteQuestion(options: AbapDeployConfigPromptOptions): boolean;
|
|
117
|
+
//# sourceMappingURL=conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/prompts/conditions.ts"],"names":[],"mappings":"AASA,OAAO,EAKH,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,KAAK,aAAa,EAErB,MAAM,UAAU,CAAC;AAElB;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,eAAe,EAAE,+BAA+B,GAAG,OAAO,CAiBzF;AAiBD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,OAAO,GAAG,OAAO,CAMhG;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,YA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+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.showOverwriteQuestion = exports.showIndexQuestion = exports.defaultOrShowManualTransportQuestion = exports.defaultOrShowTransportCreatedQuestion = exports.defaultOrShowTransportListQuestion = exports.showTransportInputChoice = exports.defaultOrShowSearchPackageQuestion = exports.defaultOrShowManualPackageQuestion = exports.showPackageInputChoiceQuestion = exports.showUi5AppDeployConfigQuestion = exports.showPasswordQuestion = exports.showUsernameQuestion = exports.showClientQuestion = exports.showClientChoiceQuestion = exports.showScpQuestion = exports.showUrlQuestion = void 0;
|
|
7
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
8
|
+
const prompt_state_1 = require("./prompt-state");
|
|
9
|
+
const validator_utils_1 = require("../validator-utils");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const error_handler_1 = require("../error-handler");
|
|
12
|
+
const i18n_1 = require("../i18n");
|
|
13
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
14
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
15
|
+
const logger_helper_1 = __importDefault(require("../logger-helper"));
|
|
16
|
+
const types_1 = require("../types");
|
|
17
|
+
/**
|
|
18
|
+
* Determines if URL question should be shown.
|
|
19
|
+
*
|
|
20
|
+
* @param targetSystem - chosen target system
|
|
21
|
+
* @returns true if target system type is URL
|
|
22
|
+
*/
|
|
23
|
+
function showUrlQuestion(targetSystem) {
|
|
24
|
+
return targetSystem === "Url" /* TargetSystemType.Url */;
|
|
25
|
+
}
|
|
26
|
+
exports.showUrlQuestion = showUrlQuestion;
|
|
27
|
+
/**
|
|
28
|
+
* Determines if the SCP question should be shown.
|
|
29
|
+
*
|
|
30
|
+
* @param previousAnswers - previous answers
|
|
31
|
+
* @returns boolean
|
|
32
|
+
*/
|
|
33
|
+
function showScpQuestion(previousAnswers) {
|
|
34
|
+
if ((!(0, btp_utils_1.isAppStudio)() && !previousAnswers.targetSystem) ||
|
|
35
|
+
(showUrlQuestion(previousAnswers.targetSystem) && previousAnswers.url?.length === 0)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let isSystemUnknown = false;
|
|
39
|
+
if (previousAnswers.url && previousAnswers.url.length > 0) {
|
|
40
|
+
const backendSystem = (0, utils_1.findBackendSystemByUrl)(previousAnswers.targetSystem ?? previousAnswers.url);
|
|
41
|
+
if (!backendSystem) {
|
|
42
|
+
isSystemUnknown = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return isSystemUnknown;
|
|
46
|
+
}
|
|
47
|
+
exports.showScpQuestion = showScpQuestion;
|
|
48
|
+
/**
|
|
49
|
+
* Client condition to determine if the client question should be shown.
|
|
50
|
+
*
|
|
51
|
+
* @param isS4HanaCloudSystem - is S/4 HANA Cloud system
|
|
52
|
+
* @returns boolean
|
|
53
|
+
*/
|
|
54
|
+
function showClientCondition(isS4HanaCloudSystem) {
|
|
55
|
+
return Boolean(!(0, btp_utils_1.isAppStudio)() &&
|
|
56
|
+
(0, validator_utils_1.clientDoesNotExistOrInvalid)(prompt_state_1.PromptState.abapDeployConfig.client) &&
|
|
57
|
+
!prompt_state_1.PromptState.abapDeployConfig.scp &&
|
|
58
|
+
!isS4HanaCloudSystem);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Determines if the client choice question should be shown.
|
|
62
|
+
*
|
|
63
|
+
* @param client - client
|
|
64
|
+
* @param isS4HanaCloudSystem - is S/4 HANA Cloud system
|
|
65
|
+
* @returns boolean
|
|
66
|
+
*/
|
|
67
|
+
function showClientChoiceQuestion(client, isS4HanaCloudSystem) {
|
|
68
|
+
if (prompt_state_1.PromptState.isYUI || !client) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return showClientCondition(isS4HanaCloudSystem);
|
|
72
|
+
}
|
|
73
|
+
exports.showClientChoiceQuestion = showClientChoiceQuestion;
|
|
74
|
+
/**
|
|
75
|
+
* Determines if the client question should be shown.
|
|
76
|
+
* Note: In some instances, when a yaml conf is parsed, double quoted properties i.e. client: "100" are saved as a number instead of a string.
|
|
77
|
+
*
|
|
78
|
+
* @param clientChoice - client choice from previous answers
|
|
79
|
+
* @param client - client
|
|
80
|
+
* @param isS4HanaCloudSystem - is S/4 HANA Cloud system
|
|
81
|
+
* @returns boolean
|
|
82
|
+
*/
|
|
83
|
+
function showClientQuestion(clientChoice, client, isS4HanaCloudSystem) {
|
|
84
|
+
const clientCondition = showClientCondition(isS4HanaCloudSystem);
|
|
85
|
+
if (clientCondition && client) {
|
|
86
|
+
prompt_state_1.PromptState.abapDeployConfig.client = String(client);
|
|
87
|
+
}
|
|
88
|
+
const showOnCli = clientChoice === "new" /* ClientChoiceValue.New */ || !client;
|
|
89
|
+
return !prompt_state_1.PromptState.isYUI ? showOnCli && clientCondition : clientCondition;
|
|
90
|
+
}
|
|
91
|
+
exports.showClientQuestion = showClientQuestion;
|
|
92
|
+
/**
|
|
93
|
+
* Determines if the username question should be shown.
|
|
94
|
+
*
|
|
95
|
+
* @param backendTarget - backend target from prompt options
|
|
96
|
+
* @returns boolean
|
|
97
|
+
*/
|
|
98
|
+
async function showUsernameQuestion(backendTarget) {
|
|
99
|
+
let warning;
|
|
100
|
+
({
|
|
101
|
+
transportConfig: prompt_state_1.PromptState.transportAnswers.transportConfig,
|
|
102
|
+
transportConfigNeedsCreds: prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds,
|
|
103
|
+
warning
|
|
104
|
+
} = await (0, utils_1.initTransportConfig)({
|
|
105
|
+
backendTarget: backendTarget,
|
|
106
|
+
scp: prompt_state_1.PromptState.abapDeployConfig.scp,
|
|
107
|
+
url: prompt_state_1.PromptState.abapDeployConfig.url,
|
|
108
|
+
client: prompt_state_1.PromptState.abapDeployConfig.client,
|
|
109
|
+
destination: prompt_state_1.PromptState.abapDeployConfig.destination,
|
|
110
|
+
errorHandler: (e) => {
|
|
111
|
+
(0, error_handler_1.handleTransportConfigError)(e);
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
if (warning) {
|
|
115
|
+
const helpLink = (0, fiori_generator_shared_1.getHelpUrl)(3046 /* HELP_TREE.FIORI_TOOLS */, [57266]);
|
|
116
|
+
const warningMessage = (0, i18n_1.t)('warnings.transportConfigFailure', { helpLink });
|
|
117
|
+
logger_helper_1.default.logger.info(`\n${warningMessage}`);
|
|
118
|
+
logger_helper_1.default.logger.info(`\n${warning}`);
|
|
119
|
+
prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds = false;
|
|
120
|
+
return false; // Log a warning and proceed
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// Need to give the CLI some context why the username is shown.
|
|
124
|
+
if (prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds) {
|
|
125
|
+
logger_helper_1.default.logger.info((0, i18n_1.t)('errors.atoUnauthorisedSystem'));
|
|
126
|
+
}
|
|
127
|
+
return prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds ?? false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.showUsernameQuestion = showUsernameQuestion;
|
|
131
|
+
/**
|
|
132
|
+
* Determines if the password question should be shown.
|
|
133
|
+
*
|
|
134
|
+
* @returns boolean
|
|
135
|
+
*/
|
|
136
|
+
function showPasswordQuestion() {
|
|
137
|
+
return Boolean(prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds);
|
|
138
|
+
}
|
|
139
|
+
exports.showPasswordQuestion = showPasswordQuestion;
|
|
140
|
+
/**
|
|
141
|
+
* Determines if the UI5 app deploy config question should be shown (UI5 Abap Repo name & Description).
|
|
142
|
+
*
|
|
143
|
+
* @param hideUi5AbapRepoPrompt - option to hide the prompt if using a btp system
|
|
144
|
+
* @returns boolean
|
|
145
|
+
*/
|
|
146
|
+
function showUi5AppDeployConfigQuestion(hideUi5AbapRepoPrompt) {
|
|
147
|
+
if (hideUi5AbapRepoPrompt) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return !prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds;
|
|
151
|
+
}
|
|
152
|
+
exports.showUi5AppDeployConfigQuestion = showUi5AppDeployConfigQuestion;
|
|
153
|
+
/**
|
|
154
|
+
* Determines if the package question should be shown.
|
|
155
|
+
*
|
|
156
|
+
* @returns boolean
|
|
157
|
+
*/
|
|
158
|
+
function defaultOrShowPackageQuestion() {
|
|
159
|
+
if (prompt_state_1.PromptState.transportAnswers?.transportConfig?.getPackage()) {
|
|
160
|
+
prompt_state_1.PromptState.abapDeployConfig.package = prompt_state_1.PromptState.transportAnswers.transportConfig.getPackage();
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return (!prompt_state_1.PromptState.transportAnswers?.transportConfigError &&
|
|
165
|
+
!prompt_state_1.PromptState.transportAnswers?.transportConfigNeedsCreds);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Determines if the choice of package input options should include both manual input and search (autocomplete) input options.
|
|
170
|
+
*
|
|
171
|
+
* @returns boolean
|
|
172
|
+
*/
|
|
173
|
+
function showPackageInputChoiceQuestion() {
|
|
174
|
+
// Only show the input choice (manual/search) when the autocomplete prompt is supported; CLI or YUI specific version
|
|
175
|
+
return Boolean((!prompt_state_1.PromptState.isYUI || (0, feature_toggle_1.isFeatureEnabled)('enableAutocompleteUIPrompt')) && defaultOrShowPackageQuestion());
|
|
176
|
+
}
|
|
177
|
+
exports.showPackageInputChoiceQuestion = showPackageInputChoiceQuestion;
|
|
178
|
+
/**
|
|
179
|
+
* Determines if the manual package input prompt should be shown.
|
|
180
|
+
*
|
|
181
|
+
* @param isCli - is in CLI
|
|
182
|
+
* @param packageInputChoice - package input choice from previous answers
|
|
183
|
+
* @returns boolean
|
|
184
|
+
*/
|
|
185
|
+
function defaultOrShowManualPackageQuestion(isCli, packageInputChoice) {
|
|
186
|
+
// Until the version of YUI installed supports auto-complete we must continue to show a manual input for packages
|
|
187
|
+
return (((!isCli && !(0, feature_toggle_1.isFeatureEnabled)('enableAutocompleteUIPrompt')) ||
|
|
188
|
+
packageInputChoice === types_1.PackageInputChoices.EnterManualChoice) &&
|
|
189
|
+
defaultOrShowPackageQuestion());
|
|
190
|
+
}
|
|
191
|
+
exports.defaultOrShowManualPackageQuestion = defaultOrShowManualPackageQuestion;
|
|
192
|
+
/**
|
|
193
|
+
* Determines if the search (autcomplete) package input prompt can be shown based on backend availability.
|
|
194
|
+
*
|
|
195
|
+
* @param isCli - is in CLI
|
|
196
|
+
* @param packageInputChoice - package input choice from previous answers
|
|
197
|
+
* @returns boolean
|
|
198
|
+
*/
|
|
199
|
+
function defaultOrShowSearchPackageQuestion(isCli, packageInputChoice) {
|
|
200
|
+
// Only show the autocomplete prompt when the autocomplete prompt is supported; CLI or YUI specific version
|
|
201
|
+
return ((isCli || (0, feature_toggle_1.isFeatureEnabled)('enableAutocompleteUIPrompt')) &&
|
|
202
|
+
packageInputChoice === types_1.PackageInputChoices.ListExistingChoice &&
|
|
203
|
+
defaultOrShowPackageQuestion());
|
|
204
|
+
}
|
|
205
|
+
exports.defaultOrShowSearchPackageQuestion = defaultOrShowSearchPackageQuestion;
|
|
206
|
+
/**
|
|
207
|
+
* Determines if the transport question should be shown.
|
|
208
|
+
*
|
|
209
|
+
* @returns boolean
|
|
210
|
+
*/
|
|
211
|
+
function defaultOrShowTransportQuestion() {
|
|
212
|
+
if (prompt_state_1.PromptState.transportAnswers.transportConfig?.getDefaultTransport() !== undefined) {
|
|
213
|
+
prompt_state_1.PromptState.abapDeployConfig.transport = prompt_state_1.PromptState.transportAnswers.transportConfig.getDefaultTransport();
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return (!prompt_state_1.PromptState.transportAnswers.transportConfigError &&
|
|
218
|
+
!prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Determines if the transport input choice question should be shown.
|
|
223
|
+
*
|
|
224
|
+
* @returns boolean
|
|
225
|
+
*/
|
|
226
|
+
function showTransportInputChoice() {
|
|
227
|
+
return defaultOrShowTransportQuestion();
|
|
228
|
+
}
|
|
229
|
+
exports.showTransportInputChoice = showTransportInputChoice;
|
|
230
|
+
/**
|
|
231
|
+
* Checks if the transport list is empty.
|
|
232
|
+
*
|
|
233
|
+
* @param transportList - list of transports
|
|
234
|
+
* @returns boolean - true if the transport list is empty
|
|
235
|
+
*/
|
|
236
|
+
function isTransportListEmpty(transportList) {
|
|
237
|
+
return !transportList || transportList.length === 0;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Determines if the transport list question should be shown.
|
|
241
|
+
*
|
|
242
|
+
* @param transportInputChoice - transportInputChoice from previous answers
|
|
243
|
+
* @returns boolean
|
|
244
|
+
*/
|
|
245
|
+
function defaultOrShowTransportListQuestion(transportInputChoice) {
|
|
246
|
+
const showQuestion = defaultOrShowTransportQuestion();
|
|
247
|
+
if (!showQuestion) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
return (transportInputChoice === types_1.TransportChoices.ListExistingChoice &&
|
|
251
|
+
!isTransportListEmpty(prompt_state_1.PromptState.transportAnswers.transportList));
|
|
252
|
+
}
|
|
253
|
+
exports.defaultOrShowTransportListQuestion = defaultOrShowTransportListQuestion;
|
|
254
|
+
/**
|
|
255
|
+
* Determines if the transport created prompt should be shown.
|
|
256
|
+
*
|
|
257
|
+
* @param transportInputChoice - transportInputChoice from previous answers
|
|
258
|
+
* @returns boolean
|
|
259
|
+
*/
|
|
260
|
+
function defaultOrShowTransportCreatedQuestion(transportInputChoice) {
|
|
261
|
+
const showQuestion = defaultOrShowTransportQuestion();
|
|
262
|
+
if (!showQuestion) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
return (transportInputChoice === types_1.TransportChoices.CreateNewChoice && !!prompt_state_1.PromptState.transportAnswers.newTransportNumber);
|
|
266
|
+
}
|
|
267
|
+
exports.defaultOrShowTransportCreatedQuestion = defaultOrShowTransportCreatedQuestion;
|
|
268
|
+
/**
|
|
269
|
+
* Determines if the manual transport prompt should be shown.
|
|
270
|
+
*
|
|
271
|
+
* @param transportInputChoice - transportInputChoice from previous answers
|
|
272
|
+
* @returns boolean
|
|
273
|
+
*/
|
|
274
|
+
function defaultOrShowManualTransportQuestion(transportInputChoice) {
|
|
275
|
+
return defaultOrShowTransportQuestion() && transportInputChoice === types_1.TransportChoices.EnterManualChoice;
|
|
276
|
+
}
|
|
277
|
+
exports.defaultOrShowManualTransportQuestion = defaultOrShowManualTransportQuestion;
|
|
278
|
+
/**
|
|
279
|
+
* Determines if the index prompt should be shown.
|
|
280
|
+
*
|
|
281
|
+
* @param options - abap deploy config prompt options
|
|
282
|
+
* @returns boolean
|
|
283
|
+
*/
|
|
284
|
+
function showIndexQuestion(options) {
|
|
285
|
+
const condition = Boolean(options.indexGenerationAllowed && !prompt_state_1.PromptState.abapDeployConfig.index);
|
|
286
|
+
return condition && !prompt_state_1.PromptState.transportAnswers.transportConfigError && options.backendTarget?.type !== 'library';
|
|
287
|
+
}
|
|
288
|
+
exports.showIndexQuestion = showIndexQuestion;
|
|
289
|
+
/**
|
|
290
|
+
* Determines if the overwrite prompt should be shown.
|
|
291
|
+
*
|
|
292
|
+
* @param options - abap deploy config prompt options
|
|
293
|
+
* @returns boolean
|
|
294
|
+
*/
|
|
295
|
+
function showOverwriteQuestion(options) {
|
|
296
|
+
return Boolean(options.showOverwriteQuestion && !!options.existingDeployTaskConfig && !prompt_state_1.PromptState.abapDeployConfig.overwrite);
|
|
297
|
+
}
|
|
298
|
+
exports.showOverwriteQuestion = showOverwriteQuestion;
|
|
299
|
+
//# sourceMappingURL=conditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/promp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AACH,SAAgB,iBAAiB,CAAC,OAAsC;IACpE,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,IAAI,CAAC,0BAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACjG,OAAO,SAAS,IAAI,CAAC,0BAAW,CAAC,gBAAgB,CAAC,oBAAoB,IAAI,OAAO,CAAC,aAAa,EAAE,IAAI,KAAK,SAAS,CAAC;AACxH,CAAC;AAHD,8CAGC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,OAAsC;IACxE,OAAO,OAAO,CACV,OAAO,CAAC,qBAAqB,IAAI,CAAC,CAAC,OAAO,CAAC,wBAAwB,IAAI,CAAC,0BAAW,CAAC,gBAAgB,CAAC,SAAS,CACjH,CAAC;AACN,CAAC;AAJD,sDAIC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PackageInputChoices, TransportChoices, type AbapSystemChoice } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Determines the default target system from the abap system choices.
|
|
4
|
+
*
|
|
5
|
+
* @param targetSystems - list of target systems
|
|
6
|
+
* @returns default target system
|
|
7
|
+
*/
|
|
8
|
+
export declare function defaultTargetSystem(targetSystems?: AbapSystemChoice[]): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Determines the default url based on the target system or the prompt state.
|
|
11
|
+
*
|
|
12
|
+
* @param targetSystem - chosen target system
|
|
13
|
+
* @returns default url
|
|
14
|
+
*/
|
|
15
|
+
export declare function defaultUrl(targetSystem?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Determines the default package choice based on the previous package input choice.
|
|
18
|
+
*
|
|
19
|
+
* @param previousPackageInputChoice - previous package choice
|
|
20
|
+
* @returns default package choice
|
|
21
|
+
*/
|
|
22
|
+
export declare function defaultPackageChoice(previousPackageInputChoice?: PackageInputChoices): string;
|
|
23
|
+
/**
|
|
24
|
+
* Determines the default package based on the previous answers or the existing deploy task config.
|
|
25
|
+
*
|
|
26
|
+
* @param existingPkg - existing package from manual input prompt or backend config
|
|
27
|
+
* @returns default package
|
|
28
|
+
*/
|
|
29
|
+
export declare function defaultPackage(existingPkg?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Determines the default user choice of how to provide transport number.
|
|
32
|
+
*
|
|
33
|
+
* @param previousTransportInputChoice - previous user choice
|
|
34
|
+
* @param createTrDuringDeploy - existing ui5-deploy.yaml config that indicates to create TR during deployment.
|
|
35
|
+
* @returns default choice of transport input choice
|
|
36
|
+
*/
|
|
37
|
+
export declare function defaultTransportRequestChoice(previousTransportInputChoice?: TransportChoices, createTrDuringDeploy?: boolean): string;
|
|
38
|
+
/**
|
|
39
|
+
* Determines the transport request list choice based on the number of transports i.e if there is only it will be the default.
|
|
40
|
+
*
|
|
41
|
+
* @param numTransportListChoice - number of transport requests
|
|
42
|
+
* @returns default client choice
|
|
43
|
+
*/
|
|
44
|
+
export declare function defaultTransportListChoice(numTransportListChoice?: number): 0 | undefined;
|
|
45
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/prompts/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAoB,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE1G;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,gBAAgB,EAAE,GAAG,MAAM,GAAG,SAAS,CAO1F;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,0BAA0B,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAE7F;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAW3D;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CACzC,4BAA4B,CAAC,EAAE,gBAAgB,EAC/C,oBAAoB,UAAQ,GAC7B,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,sBAAsB,CAAC,EAAE,MAAM,iBAEzE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultTransportListChoice = exports.defaultTransportRequestChoice = exports.defaultPackage = exports.defaultPackageChoice = exports.defaultUrl = exports.defaultTargetSystem = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const prompt_state_1 = require("./prompt-state");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
/**
|
|
8
|
+
* Determines the default target system from the abap system choices.
|
|
9
|
+
*
|
|
10
|
+
* @param targetSystems - list of target systems
|
|
11
|
+
* @returns default target system
|
|
12
|
+
*/
|
|
13
|
+
function defaultTargetSystem(targetSystems) {
|
|
14
|
+
let defaultTargetSystem;
|
|
15
|
+
const targetSystem = targetSystems?.find((choice) => choice.isDefault === true);
|
|
16
|
+
if (targetSystem) {
|
|
17
|
+
defaultTargetSystem = targetSystem.value;
|
|
18
|
+
}
|
|
19
|
+
return defaultTargetSystem;
|
|
20
|
+
}
|
|
21
|
+
exports.defaultTargetSystem = defaultTargetSystem;
|
|
22
|
+
/**
|
|
23
|
+
* Determines the default url based on the target system or the prompt state.
|
|
24
|
+
*
|
|
25
|
+
* @param targetSystem - chosen target system
|
|
26
|
+
* @returns default url
|
|
27
|
+
*/
|
|
28
|
+
function defaultUrl(targetSystem) {
|
|
29
|
+
return targetSystem === "Url" /* TargetSystemType.Url */ ? '' : prompt_state_1.PromptState.abapDeployConfig.url ?? '';
|
|
30
|
+
}
|
|
31
|
+
exports.defaultUrl = defaultUrl;
|
|
32
|
+
/**
|
|
33
|
+
* Determines the default package choice based on the previous package input choice.
|
|
34
|
+
*
|
|
35
|
+
* @param previousPackageInputChoice - previous package choice
|
|
36
|
+
* @returns default package choice
|
|
37
|
+
*/
|
|
38
|
+
function defaultPackageChoice(previousPackageInputChoice) {
|
|
39
|
+
return previousPackageInputChoice ?? types_1.PackageInputChoices.EnterManualChoice;
|
|
40
|
+
}
|
|
41
|
+
exports.defaultPackageChoice = defaultPackageChoice;
|
|
42
|
+
/**
|
|
43
|
+
* Determines the default package based on the previous answers or the existing deploy task config.
|
|
44
|
+
*
|
|
45
|
+
* @param existingPkg - existing package from manual input prompt or backend config
|
|
46
|
+
* @returns default package
|
|
47
|
+
*/
|
|
48
|
+
function defaultPackage(existingPkg) {
|
|
49
|
+
if (prompt_state_1.PromptState.abapDeployConfig.scp) {
|
|
50
|
+
return existingPkg || '';
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
let defaultPkg = '';
|
|
54
|
+
// if atoSettings are enabled and operationsType is P (on-premise) we default to $tmp
|
|
55
|
+
if (prompt_state_1.PromptState.transportAnswers.transportConfig?.getOperationsType() === 'P') {
|
|
56
|
+
defaultPkg = constants_1.DEFAULT_PACKAGE_ABAP;
|
|
57
|
+
}
|
|
58
|
+
return existingPkg || defaultPkg;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.defaultPackage = defaultPackage;
|
|
62
|
+
/**
|
|
63
|
+
* Determines the default user choice of how to provide transport number.
|
|
64
|
+
*
|
|
65
|
+
* @param previousTransportInputChoice - previous user choice
|
|
66
|
+
* @param createTrDuringDeploy - existing ui5-deploy.yaml config that indicates to create TR during deployment.
|
|
67
|
+
* @returns default choice of transport input choice
|
|
68
|
+
*/
|
|
69
|
+
function defaultTransportRequestChoice(previousTransportInputChoice, createTrDuringDeploy = false) {
|
|
70
|
+
if (previousTransportInputChoice) {
|
|
71
|
+
return previousTransportInputChoice;
|
|
72
|
+
}
|
|
73
|
+
else if (createTrDuringDeploy) {
|
|
74
|
+
return types_1.TransportChoices.CreateDuringDeployChoice;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return types_1.TransportChoices.EnterManualChoice;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.defaultTransportRequestChoice = defaultTransportRequestChoice;
|
|
81
|
+
/**
|
|
82
|
+
* Determines the transport request list choice based on the number of transports i.e if there is only it will be the default.
|
|
83
|
+
*
|
|
84
|
+
* @param numTransportListChoice - number of transport requests
|
|
85
|
+
* @returns default client choice
|
|
86
|
+
*/
|
|
87
|
+
function defaultTransportListChoice(numTransportListChoice) {
|
|
88
|
+
return numTransportListChoice && numTransportListChoice > 1 ? undefined : 0;
|
|
89
|
+
}
|
|
90
|
+
exports.defaultTransportListChoice = defaultTransportListChoice;
|
|
91
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/prompts/defaults.ts"],"names":[],"mappings":";;;AAAA,4CAAoD;AACpD,iDAA6C;AAC7C,oCAA0G;AAE1G;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,aAAkC;IAClE,IAAI,mBAAmB,CAAC;IACxB,MAAM,YAAY,GAAG,aAAa,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;IAChF,IAAI,YAAY,EAAE,CAAC;QACf,mBAAmB,GAAG,YAAY,CAAC,KAAK,CAAC;IAC7C,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC/B,CAAC;AAPD,kDAOC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,YAAqB;IAC5C,OAAO,YAAY,qCAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,EAAE,CAAC;AAC/F,CAAC;AAFD,gCAEC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,0BAAgD;IACjF,OAAO,0BAA0B,IAAI,2BAAmB,CAAC,iBAAiB,CAAC;AAC/E,CAAC;AAFD,oDAEC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,WAAoB;IAC/C,IAAI,0BAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;QACnC,OAAO,WAAW,IAAI,EAAE,CAAC;IAC7B,CAAC;SAAM,CAAC;QACJ,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,qFAAqF;QACrF,IAAI,0BAAW,CAAC,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,EAAE,KAAK,GAAG,EAAE,CAAC;YAC5E,UAAU,GAAG,gCAAoB,CAAC;QACtC,CAAC;QACD,OAAO,WAAW,IAAI,UAAU,CAAC;IACrC,CAAC;AACL,CAAC;AAXD,wCAWC;AAED;;;;;;GAMG;AACH,SAAgB,6BAA6B,CACzC,4BAA+C,EAC/C,oBAAoB,GAAG,KAAK;IAE5B,IAAI,4BAA4B,EAAE,CAAC;QAC/B,OAAO,4BAA4B,CAAC;IACxC,CAAC;SAAM,IAAI,oBAAoB,EAAE,CAAC;QAC9B,OAAO,wBAAgB,CAAC,wBAAwB,CAAC;IACrD,CAAC;SAAM,CAAC;QACJ,OAAO,wBAAgB,CAAC,iBAAiB,CAAC;IAC9C,CAAC;AACL,CAAC;AAXD,sEAWC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,sBAA+B;IACtE,OAAO,sBAAsB,IAAI,sBAAsB,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAFD,gEAEC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Destinations } from '@sap-ux/btp-utils';
|
|
2
|
+
import { type AbapSystemChoice, type AbapDeployConfigAnswersInternal, type BackendTarget } from '../types';
|
|
3
|
+
import { type BackendSystem } from '@sap-ux/store';
|
|
4
|
+
import type { ChoiceOptions, ListChoiceOptions } from 'inquirer';
|
|
5
|
+
/**
|
|
6
|
+
* Returns a list of the aba system choices comprising of either destinations or backend systems.
|
|
7
|
+
*
|
|
8
|
+
* @param destinations - destinations retrieved from BTP
|
|
9
|
+
* @param backendTarget - backend target used previously (may not be saved in store)
|
|
10
|
+
* @param backendSystems - backend systems retrieved from store
|
|
11
|
+
* @returns choices for ABAP systems
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAbapSystemChoices(destinations?: Destinations, backendTarget?: BackendTarget, backendSystems?: BackendSystem[]): Promise<AbapSystemChoice[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a list of the client choice prompt options.
|
|
16
|
+
*
|
|
17
|
+
* @param client - client from backend target
|
|
18
|
+
* @returns list of client choice options
|
|
19
|
+
*/
|
|
20
|
+
export declare function getClientChoicePromptChoices(client?: string): ChoiceOptions[];
|
|
21
|
+
/**
|
|
22
|
+
* Returns a list of package input choices.
|
|
23
|
+
*
|
|
24
|
+
* @returns list of package input choices
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPackageInputChoices(): ListChoiceOptions[];
|
|
27
|
+
/**
|
|
28
|
+
* Returns a list of transport choices.
|
|
29
|
+
*
|
|
30
|
+
* @returns list of transport choices
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTransportChoices(): ListChoiceOptions[];
|
|
33
|
+
/**
|
|
34
|
+
* Ensures the URL in the state is update accordingly.
|
|
35
|
+
*
|
|
36
|
+
* @param previousAnswers - previous answers
|
|
37
|
+
* @param destinations - destinations retrieved from BTP
|
|
38
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
39
|
+
*/
|
|
40
|
+
export declare function updatePromptStateUrl(previousAnswers: AbapDeployConfigAnswersInternal, destinations?: Destinations, backendTarget?: BackendTarget): void;
|
|
41
|
+
/**
|
|
42
|
+
* Queries the packages based on the input provided.
|
|
43
|
+
*
|
|
44
|
+
* @param isCli - is running in CLI
|
|
45
|
+
* @param input - package input
|
|
46
|
+
* @param previousAnswers - previous answers
|
|
47
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
48
|
+
* @returns results of query and message based on number of results
|
|
49
|
+
*/
|
|
50
|
+
export declare function getPackageChoices(isCli: boolean, input: string, previousAnswers: AbapDeployConfigAnswersInternal, backendTarget?: BackendTarget): Promise<{
|
|
51
|
+
packages: string[];
|
|
52
|
+
morePackageResultsMsg: string;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/prompts/helpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0C,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAKH,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,EACpC,KAAK,aAAa,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAoHjE;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACtC,YAAY,CAAC,EAAE,YAAY,EAC3B,aAAa,CAAC,EAAE,aAAa,EAC7B,cAAc,CAAC,EAAE,aAAa,EAAE,GACjC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAY7B;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,EAAE,CAS7E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,iBAAiB,EAAE,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,iBAAiB,EAAE,CAgBzD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,eAAe,EAAE,+BAA+B,EAChD,YAAY,CAAC,EAAE,YAAY,EAC3B,aAAa,CAAC,EAAE,aAAa,GAC9B,IAAI,CAYN;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACnC,KAAK,EAAE,OAAO,E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