@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,138 @@
|
|
|
1
|
+
import { type Destinations } from '@sap-ux/btp-utils';
|
|
2
|
+
import { ClientChoiceValue, PackageInputChoices, TransportChoices, type SystemConfig, type AbapDeployConfigAnswersInternal, type AbapSystemChoice, type BackendTarget } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Validates the destination question and sets the destination in the prompt state.
|
|
5
|
+
*
|
|
6
|
+
* @param destination - chosen destination
|
|
7
|
+
* @param destinations - list of destinations
|
|
8
|
+
* @returns boolean
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateDestinationQuestion(destination: string, destinations?: Destinations): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Updates the destination prompt state.
|
|
13
|
+
*
|
|
14
|
+
* @param destination - destination
|
|
15
|
+
* @param destinations - list of destinations
|
|
16
|
+
*/
|
|
17
|
+
export declare function updateDestinationPromptState(destination: string, destinations?: Destinations): void;
|
|
18
|
+
/**
|
|
19
|
+
* Validates the target system.
|
|
20
|
+
*
|
|
21
|
+
* @param target - target system
|
|
22
|
+
* @param choices - abab system choices
|
|
23
|
+
* @returns boolean or error message string
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateTargetSystem(target?: string, choices?: AbapSystemChoice[]): boolean | string;
|
|
26
|
+
/**
|
|
27
|
+
* Validates the URL.
|
|
28
|
+
*
|
|
29
|
+
* @param input - url
|
|
30
|
+
* @returns boolean or error message string
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateUrl(input: string): boolean | string;
|
|
33
|
+
/**
|
|
34
|
+
* Validates the target system URL for CLI.
|
|
35
|
+
*
|
|
36
|
+
* @param targetSystem - target system
|
|
37
|
+
* @param choices - abap system choices
|
|
38
|
+
* @throws Error if target system is invalid
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateTargetSystemUrlCli(targetSystem?: string, choices?: AbapSystemChoice[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Validates the SCP question and sets the SCP in the prompt state.
|
|
43
|
+
*
|
|
44
|
+
* @param input - if confirm was selected
|
|
45
|
+
* @returns boolean
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateScpQuestion(input: boolean): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Validates and updates the client property in the state.
|
|
50
|
+
*
|
|
51
|
+
* @param clientChoice - client choice
|
|
52
|
+
* @param client - client from backend config
|
|
53
|
+
* @returns boolean
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateClientChoiceQuestion(clientChoice: ClientChoiceValue, client?: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Validates the client and sets the client in the prompt state.
|
|
58
|
+
*
|
|
59
|
+
* @param client - client
|
|
60
|
+
* @returns boolean or error message as a string
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateClient(client: string): boolean | string;
|
|
63
|
+
/**
|
|
64
|
+
* Validates the credentials.
|
|
65
|
+
*
|
|
66
|
+
* @param input - password entered
|
|
67
|
+
* @param previousAnswers - previous answers
|
|
68
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
69
|
+
* @returns boolean or error message as a string
|
|
70
|
+
*/
|
|
71
|
+
export declare function validateCredentials(input: string, previousAnswers: AbapDeployConfigAnswersInternal, backendTarget?: BackendTarget): Promise<boolean | string>;
|
|
72
|
+
/**
|
|
73
|
+
* Validates the ui5 app repository name.
|
|
74
|
+
*
|
|
75
|
+
* @param input - ui5 app repository name entered
|
|
76
|
+
* @returns boolean or error message as a string
|
|
77
|
+
*/
|
|
78
|
+
export declare function validateUi5AbapRepoName(input: string): boolean | string;
|
|
79
|
+
/**
|
|
80
|
+
* Validates the app description.
|
|
81
|
+
*
|
|
82
|
+
* @param input - app description entered
|
|
83
|
+
* @returns boolean or error message as a string
|
|
84
|
+
*/
|
|
85
|
+
export declare function validateAppDescription(input: string): boolean | string;
|
|
86
|
+
/**
|
|
87
|
+
* Makes an empty string package query to test connectivity if searching, otherwise returns true.
|
|
88
|
+
*
|
|
89
|
+
* @param input - package input choice
|
|
90
|
+
* @param systemConfig - system configuration
|
|
91
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
92
|
+
* @returns boolean or error message as a string
|
|
93
|
+
*/
|
|
94
|
+
export declare function validatePackageChoiceInput(input: PackageInputChoices, systemConfig: SystemConfig, backendTarget?: BackendTarget): Promise<boolean | string>;
|
|
95
|
+
/**
|
|
96
|
+
* This function is used to validate if user choice of providing package name is valid.
|
|
97
|
+
* The validation attempts to connect to backend ADT service to see if it is able to fetch package names.
|
|
98
|
+
*
|
|
99
|
+
* @param systemConfig - system configuration
|
|
100
|
+
* @param inputChoice - user choice of how to provide package name
|
|
101
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
102
|
+
*/
|
|
103
|
+
export declare function validatePackageChoiceInputForCli(systemConfig: SystemConfig, inputChoice?: PackageInputChoices, backendTarget?: BackendTarget): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Validates the package name.
|
|
106
|
+
*
|
|
107
|
+
* @param input - package name entered
|
|
108
|
+
* @param answers - previous answers
|
|
109
|
+
* @param backendTarget - backend target
|
|
110
|
+
* @returns boolean or error message as a string
|
|
111
|
+
*/
|
|
112
|
+
export declare function validatePackage(input: string, answers: AbapDeployConfigAnswersInternal, backendTarget?: BackendTarget): Promise<boolean | string>;
|
|
113
|
+
/**
|
|
114
|
+
* Validates the transport choice input.
|
|
115
|
+
*
|
|
116
|
+
* @param input - transport choice input
|
|
117
|
+
* @param previousAnswers - previous answers
|
|
118
|
+
* @param validateInputChanged - if the input has changed
|
|
119
|
+
* @param prevTransportInputChoice - previous transport input choice
|
|
120
|
+
* @param backendTarget - backend target
|
|
121
|
+
* @returns boolean or error message as a string
|
|
122
|
+
*/
|
|
123
|
+
export declare function validateTransportChoiceInput(input?: TransportChoices, previousAnswers?: AbapDeployConfigAnswersInternal, validateInputChanged?: boolean, prevTransportInputChoice?: TransportChoices, backendTarget?: BackendTarget): Promise<boolean | string>;
|
|
124
|
+
/**
|
|
125
|
+
* Validates the transport question.
|
|
126
|
+
*
|
|
127
|
+
* @param input - transport request
|
|
128
|
+
* @returns boolean or error message as a string
|
|
129
|
+
*/
|
|
130
|
+
export declare function validateTransportQuestion(input?: string): boolean | string;
|
|
131
|
+
/**
|
|
132
|
+
* Validates the confirm question and updates the state.
|
|
133
|
+
*
|
|
134
|
+
* @param overwrite - if overwrite was selected
|
|
135
|
+
* @returns boolean
|
|
136
|
+
*/
|
|
137
|
+
export declare function validateConfirmQuestion(overwrite: boolean): boolean;
|
|
138
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/prompts/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAkC,MAAM,mBAAmB,CAAC;AAgBtF,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EAEnB,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,+BAA+B,EACpC,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACrB,MAAM,UAAU,CAAC;AAElB;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAIrG;AA4BD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,GAAE,YAAiB,GAAG,IAAI,CAWvG;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAAG,OAAO,GAAG,MAAM,CAkBpG;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAoB3D;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAOpG;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAgBtG;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GA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GAAG,MAAM,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAGnE"}
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateConfirmQuestion = exports.validateTransportQuestion = exports.validateTransportChoiceInput = exports.validatePackage = exports.validatePackageChoiceInputForCli = exports.validatePackageChoiceInput = exports.validateAppDescription = exports.validateUi5AbapRepoName = exports.validateCredentials = exports.validateClient = exports.validateClientChoiceQuestion = exports.validateScpQuestion = exports.validateTargetSystemUrlCli = exports.validateUrl = exports.validateTargetSystem = exports.updateDestinationPromptState = exports.validateDestinationQuestion = void 0;
|
|
7
|
+
const prompt_state_1 = require("./prompt-state");
|
|
8
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
9
|
+
const validator_utils_1 = require("../validator-utils");
|
|
10
|
+
const service_provider_utils_1 = require("../service-provider-utils");
|
|
11
|
+
const i18n_1 = require("../i18n");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const error_handler_1 = require("../error-handler");
|
|
14
|
+
const store_1 = require("@sap-ux/store");
|
|
15
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
16
|
+
const logger_helper_1 = __importDefault(require("../logger-helper"));
|
|
17
|
+
const types_1 = require("../types");
|
|
18
|
+
/**
|
|
19
|
+
* Validates the destination question and sets the destination in the prompt state.
|
|
20
|
+
*
|
|
21
|
+
* @param destination - chosen destination
|
|
22
|
+
* @param destinations - list of destinations
|
|
23
|
+
* @returns boolean
|
|
24
|
+
*/
|
|
25
|
+
function validateDestinationQuestion(destination, destinations) {
|
|
26
|
+
prompt_state_1.PromptState.resetAbapDeployConfig();
|
|
27
|
+
updateDestinationPromptState(destination, destinations);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
exports.validateDestinationQuestion = validateDestinationQuestion;
|
|
31
|
+
/**
|
|
32
|
+
* Updates prompt state with the provided configuration.
|
|
33
|
+
*
|
|
34
|
+
* @param props - properties to update
|
|
35
|
+
* @param props.url - url
|
|
36
|
+
* @param props.client - client
|
|
37
|
+
* @param props.isS4HC - is S/4HANA Cloud
|
|
38
|
+
* @param props.scp - is SCP
|
|
39
|
+
*/
|
|
40
|
+
function updatePromptState({ url, client, isS4HC, scp }) {
|
|
41
|
+
prompt_state_1.PromptState.abapDeployConfig.url = url;
|
|
42
|
+
prompt_state_1.PromptState.abapDeployConfig.client = client;
|
|
43
|
+
prompt_state_1.PromptState.abapDeployConfig.isS4HC = isS4HC;
|
|
44
|
+
prompt_state_1.PromptState.abapDeployConfig.scp = scp;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Updates the destination prompt state.
|
|
48
|
+
*
|
|
49
|
+
* @param destination - destination
|
|
50
|
+
* @param destinations - list of destinations
|
|
51
|
+
*/
|
|
52
|
+
function updateDestinationPromptState(destination, destinations = {}) {
|
|
53
|
+
const dest = destinations[destination];
|
|
54
|
+
if (dest) {
|
|
55
|
+
prompt_state_1.PromptState.abapDeployConfig.destination = dest.Name;
|
|
56
|
+
updatePromptState({
|
|
57
|
+
url: dest?.Host,
|
|
58
|
+
client: dest['sap-client'],
|
|
59
|
+
isS4HC: (0, btp_utils_1.isS4HC)(dest),
|
|
60
|
+
scp: (0, btp_utils_1.isAbapEnvironmentOnBtp)(dest)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.updateDestinationPromptState = updateDestinationPromptState;
|
|
65
|
+
/**
|
|
66
|
+
* Validates the target system.
|
|
67
|
+
*
|
|
68
|
+
* @param target - target system
|
|
69
|
+
* @param choices - abab system choices
|
|
70
|
+
* @returns boolean or error message string
|
|
71
|
+
*/
|
|
72
|
+
function validateTargetSystem(target, choices) {
|
|
73
|
+
prompt_state_1.PromptState.resetAbapDeployConfig();
|
|
74
|
+
if (!target || target === "Url" /* TargetSystemType.Url */) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
const isValid = (0, validator_utils_1.isValidUrl)(target?.trim());
|
|
78
|
+
if (isValid === true && choices) {
|
|
79
|
+
const choice = choices.find((choice) => choice.value === target);
|
|
80
|
+
if (choice) {
|
|
81
|
+
updatePromptState({
|
|
82
|
+
url: choice.value,
|
|
83
|
+
client: choice.client ?? '',
|
|
84
|
+
scp: choice.scp,
|
|
85
|
+
isS4HC: choice.isS4HC
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return isValid;
|
|
90
|
+
}
|
|
91
|
+
exports.validateTargetSystem = validateTargetSystem;
|
|
92
|
+
/**
|
|
93
|
+
* Validates the URL.
|
|
94
|
+
*
|
|
95
|
+
* @param input - url
|
|
96
|
+
* @returns boolean or error message string
|
|
97
|
+
*/
|
|
98
|
+
function validateUrl(input) {
|
|
99
|
+
prompt_state_1.PromptState.resetAbapDeployConfig();
|
|
100
|
+
if ((0, validator_utils_1.isEmptyString)(input)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const result = (0, validator_utils_1.isValidUrl)(input?.trim());
|
|
104
|
+
if (result) {
|
|
105
|
+
const backendSystem = (0, utils_1.findBackendSystemByUrl)(input);
|
|
106
|
+
if (backendSystem) {
|
|
107
|
+
updatePromptState({
|
|
108
|
+
url: backendSystem.url,
|
|
109
|
+
client: backendSystem.client,
|
|
110
|
+
scp: !!backendSystem.serviceKeys,
|
|
111
|
+
isS4HC: backendSystem.authenticationType === store_1.AuthenticationType.ReentranceTicket
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return (0, i18n_1.t)('errors.invalidUrl', { url: input?.trim() });
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
exports.validateUrl = validateUrl;
|
|
121
|
+
/**
|
|
122
|
+
* Validates the target system URL for CLI.
|
|
123
|
+
*
|
|
124
|
+
* @param targetSystem - target system
|
|
125
|
+
* @param choices - abap system choices
|
|
126
|
+
* @throws Error if target system is invalid
|
|
127
|
+
*/
|
|
128
|
+
function validateTargetSystemUrlCli(targetSystem, choices) {
|
|
129
|
+
if (!prompt_state_1.PromptState.isYUI) {
|
|
130
|
+
const isTargetValid = validateTargetSystem(targetSystem, choices);
|
|
131
|
+
if (typeof isTargetValid === 'string') {
|
|
132
|
+
throw new Error(isTargetValid);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.validateTargetSystemUrlCli = validateTargetSystemUrlCli;
|
|
137
|
+
/**
|
|
138
|
+
* Validates the SCP question and sets the SCP in the prompt state.
|
|
139
|
+
*
|
|
140
|
+
* @param input - if confirm was selected
|
|
141
|
+
* @returns boolean
|
|
142
|
+
*/
|
|
143
|
+
function validateScpQuestion(input) {
|
|
144
|
+
prompt_state_1.PromptState.abapDeployConfig.scp = input;
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
exports.validateScpQuestion = validateScpQuestion;
|
|
148
|
+
/**
|
|
149
|
+
* Validates and updates the client property in the state.
|
|
150
|
+
*
|
|
151
|
+
* @param clientChoice - client choice
|
|
152
|
+
* @param client - client from backend config
|
|
153
|
+
* @returns boolean
|
|
154
|
+
*/
|
|
155
|
+
function validateClientChoiceQuestion(clientChoice, client) {
|
|
156
|
+
switch (clientChoice) {
|
|
157
|
+
case "base" /* ClientChoiceValue.Base */:
|
|
158
|
+
prompt_state_1.PromptState.abapDeployConfig.client =
|
|
159
|
+
prompt_state_1.PromptState.abapDeployConfig?.client ?? client; // Parsing of YAML documents can result in a double quoted property being parsed as a string
|
|
160
|
+
break;
|
|
161
|
+
case "blank" /* ClientChoiceValue.Blank */:
|
|
162
|
+
delete prompt_state_1.PromptState.abapDeployConfig.client;
|
|
163
|
+
break;
|
|
164
|
+
case "new" /* ClientChoiceValue.New */:
|
|
165
|
+
default:
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
exports.validateClientChoiceQuestion = validateClientChoiceQuestion;
|
|
171
|
+
/**
|
|
172
|
+
* Validates the client and sets the client in the prompt state.
|
|
173
|
+
*
|
|
174
|
+
* @param client - client
|
|
175
|
+
* @returns boolean or error message as a string
|
|
176
|
+
*/
|
|
177
|
+
function validateClient(client) {
|
|
178
|
+
if (!client) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
const tmpClient = String(client);
|
|
182
|
+
const result = (0, validator_utils_1.isValidClient)(tmpClient);
|
|
183
|
+
if (result) {
|
|
184
|
+
prompt_state_1.PromptState.abapDeployConfig.client = tmpClient;
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
delete prompt_state_1.PromptState.abapDeployConfig.client;
|
|
189
|
+
return (0, i18n_1.t)('errors.invalidClient', { client });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.validateClient = validateClient;
|
|
193
|
+
/**
|
|
194
|
+
* Validates the credentials.
|
|
195
|
+
*
|
|
196
|
+
* @param input - password entered
|
|
197
|
+
* @param previousAnswers - previous answers
|
|
198
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
199
|
+
* @returns boolean or error message as a string
|
|
200
|
+
*/
|
|
201
|
+
async function validateCredentials(input, previousAnswers, backendTarget) {
|
|
202
|
+
if (!input || !previousAnswers.username) {
|
|
203
|
+
return (0, i18n_1.t)('errors.requireCredentials');
|
|
204
|
+
}
|
|
205
|
+
let warning;
|
|
206
|
+
({
|
|
207
|
+
transportConfig: prompt_state_1.PromptState.transportAnswers.transportConfig,
|
|
208
|
+
transportConfigNeedsCreds: prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds,
|
|
209
|
+
warning
|
|
210
|
+
} = await (0, utils_1.initTransportConfig)({
|
|
211
|
+
backendTarget: backendTarget,
|
|
212
|
+
scp: prompt_state_1.PromptState.abapDeployConfig.scp,
|
|
213
|
+
url: prompt_state_1.PromptState.abapDeployConfig.url,
|
|
214
|
+
client: prompt_state_1.PromptState.abapDeployConfig.client,
|
|
215
|
+
credentials: {
|
|
216
|
+
username: previousAnswers.username,
|
|
217
|
+
password: input
|
|
218
|
+
},
|
|
219
|
+
errorHandler: (e) => {
|
|
220
|
+
(0, error_handler_1.handleTransportConfigError)(e);
|
|
221
|
+
}
|
|
222
|
+
}));
|
|
223
|
+
if (warning) {
|
|
224
|
+
const helpLink = (0, fiori_generator_shared_1.getHelpUrl)(3046 /* HELP_TREE.FIORI_TOOLS */, [57266]);
|
|
225
|
+
const warningMessage = (0, i18n_1.t)('warnings.transportConfigFailure', { helpLink });
|
|
226
|
+
logger_helper_1.default.logger.info(`\n${warningMessage}`);
|
|
227
|
+
logger_helper_1.default.logger.info(`\n${warning}`);
|
|
228
|
+
prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds = false;
|
|
229
|
+
return true; // Log a warning and proceed
|
|
230
|
+
}
|
|
231
|
+
if (prompt_state_1.PromptState.transportAnswers.transportConfigNeedsCreds) {
|
|
232
|
+
logger_helper_1.default.logger.warn((0, i18n_1.t)('errors.incorrectCredentials'));
|
|
233
|
+
return (0, i18n_1.t)('errors.incorrectCredentials');
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
logger_helper_1.default.logger.info((0, i18n_1.t)('info.correctCredentials'));
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
exports.validateCredentials = validateCredentials;
|
|
241
|
+
/**
|
|
242
|
+
* Validates the ui5 app repository name.
|
|
243
|
+
*
|
|
244
|
+
* @param input - ui5 app repository name entered
|
|
245
|
+
* @returns boolean or error message as a string
|
|
246
|
+
*/
|
|
247
|
+
function validateUi5AbapRepoName(input) {
|
|
248
|
+
if (prompt_state_1.PromptState.transportAnswers.transportConfigError) {
|
|
249
|
+
return (0, i18n_1.t)('errors.targetNotDeployable', {
|
|
250
|
+
systemError: prompt_state_1.PromptState.transportAnswers.transportConfigError
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
const result = (0, validator_utils_1.isAppNameValid)(input);
|
|
254
|
+
if (result?.valid) {
|
|
255
|
+
return result.valid;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
return result?.errorMessage ?? (0, i18n_1.t)('errors.validators.appNameInvalid');
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.validateUi5AbapRepoName = validateUi5AbapRepoName;
|
|
262
|
+
/**
|
|
263
|
+
* Validates the app description.
|
|
264
|
+
*
|
|
265
|
+
* @param input - app description entered
|
|
266
|
+
* @returns boolean or error message as a string
|
|
267
|
+
*/
|
|
268
|
+
function validateAppDescription(input) {
|
|
269
|
+
if (input?.length > 60) {
|
|
270
|
+
return (0, i18n_1.t)('errors.validators.descriptionLength');
|
|
271
|
+
}
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
exports.validateAppDescription = validateAppDescription;
|
|
275
|
+
/**
|
|
276
|
+
* Makes an empty string package query to test connectivity if searching, otherwise returns true.
|
|
277
|
+
*
|
|
278
|
+
* @param input - package input choice
|
|
279
|
+
* @param systemConfig - system configuration
|
|
280
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
281
|
+
* @returns boolean or error message as a string
|
|
282
|
+
*/
|
|
283
|
+
async function validatePackageChoiceInput(input, systemConfig, backendTarget) {
|
|
284
|
+
if (input === types_1.PackageInputChoices.ListExistingChoice) {
|
|
285
|
+
const retrievedPackageList = await (0, utils_1.queryPackages)('', systemConfig, backendTarget);
|
|
286
|
+
if (retrievedPackageList && retrievedPackageList.length > 0) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
return (0, i18n_1.t)('warnings.packageNotFound');
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
exports.validatePackageChoiceInput = validatePackageChoiceInput;
|
|
298
|
+
/**
|
|
299
|
+
* This function is used to validate if user choice of providing package name is valid.
|
|
300
|
+
* The validation attempts to connect to backend ADT service to see if it is able to fetch package names.
|
|
301
|
+
*
|
|
302
|
+
* @param systemConfig - system configuration
|
|
303
|
+
* @param inputChoice - user choice of how to provide package name
|
|
304
|
+
* @param backendTarget - backend target from abap deploy config prompt options
|
|
305
|
+
*/
|
|
306
|
+
async function validatePackageChoiceInputForCli(systemConfig, inputChoice, backendTarget) {
|
|
307
|
+
if (inputChoice) {
|
|
308
|
+
const result = await validatePackageChoiceInput(inputChoice, systemConfig, backendTarget);
|
|
309
|
+
if (result !== true) {
|
|
310
|
+
throw new Error(result);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.validatePackageChoiceInputForCli = validatePackageChoiceInputForCli;
|
|
315
|
+
/**
|
|
316
|
+
* Validates the package name.
|
|
317
|
+
*
|
|
318
|
+
* @param input - package name entered
|
|
319
|
+
* @param answers - previous answers
|
|
320
|
+
* @param backendTarget - backend target
|
|
321
|
+
* @returns boolean or error message as a string
|
|
322
|
+
*/
|
|
323
|
+
async function validatePackage(input, answers, backendTarget) {
|
|
324
|
+
if (!input?.trim()) {
|
|
325
|
+
return (0, i18n_1.t)('warnings.providePackage');
|
|
326
|
+
}
|
|
327
|
+
const systemConfig = {
|
|
328
|
+
url: prompt_state_1.PromptState.abapDeployConfig.url,
|
|
329
|
+
client: prompt_state_1.PromptState.abapDeployConfig.client,
|
|
330
|
+
destination: prompt_state_1.PromptState.abapDeployConfig.destination
|
|
331
|
+
};
|
|
332
|
+
// checks if package is a local package and will update prompt state accordingly
|
|
333
|
+
await (0, service_provider_utils_1.getTransportListFromService)(input, answers.ui5AbapRepo ?? '', systemConfig, backendTarget);
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
exports.validatePackage = validatePackage;
|
|
337
|
+
/**
|
|
338
|
+
* Handler for creating new transport choices.
|
|
339
|
+
*
|
|
340
|
+
* @param packageAnswer - package name
|
|
341
|
+
* @param systemConfig - system configuration
|
|
342
|
+
* @param input - transport choice input
|
|
343
|
+
* @param previousAnswers - previous answers
|
|
344
|
+
* @param validateInputChanged - if the input has changed
|
|
345
|
+
* @param prevTransportInputChoice - previous transport input choice
|
|
346
|
+
* @param backendTarget - backend target
|
|
347
|
+
* @returns - boolean or error message as a string
|
|
348
|
+
*/
|
|
349
|
+
async function handleCreateNewTransportChoice(packageAnswer, systemConfig, input, previousAnswers, validateInputChanged, prevTransportInputChoice, backendTarget) {
|
|
350
|
+
// Question is re-evaluated triggered by other user changes,
|
|
351
|
+
// no need to create a new transport number
|
|
352
|
+
if (validateInputChanged) {
|
|
353
|
+
if (input === prevTransportInputChoice) {
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
else if (!prevTransportInputChoice) {
|
|
357
|
+
// if prevTransportInputChoice is undefined (occurs after back navigation)
|
|
358
|
+
// take most recent entry in transport list
|
|
359
|
+
const list = await (0, validator_utils_1.getTransportList)(packageAnswer, previousAnswers?.ui5AbapRepo ?? '', systemConfig, backendTarget);
|
|
360
|
+
if (list?.[0]) {
|
|
361
|
+
prompt_state_1.PromptState.transportAnswers.newTransportNumber = list[0].transportReqNumber;
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const description = `For ABAP repository ${previousAnswers?.ui5AbapRepo?.toUpperCase()}, created by SAP Fiori Tools`;
|
|
367
|
+
prompt_state_1.PromptState.transportAnswers.newTransportNumber = await (0, validator_utils_1.createTransportNumber)({
|
|
368
|
+
packageName: (0, utils_1.getPackageAnswer)(previousAnswers),
|
|
369
|
+
ui5AppName: previousAnswers?.ui5AbapRepo ?? '',
|
|
370
|
+
description: description.length > 60 ? description.slice(0, 57) + '...' : description
|
|
371
|
+
}, systemConfig, backendTarget);
|
|
372
|
+
if (prompt_state_1.PromptState.transportAnswers.newTransportNumber) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
return (0, i18n_1.t)('errors.createTransportReqFailed');
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Handler for listing the transport choices.
|
|
381
|
+
*
|
|
382
|
+
* @param packageAnswer - package name
|
|
383
|
+
* @param systemConfig - system configuration
|
|
384
|
+
* @param previousAnswers - previous answers
|
|
385
|
+
* @param backendTarget - backend target
|
|
386
|
+
* @returns - boolean or error message as a string
|
|
387
|
+
*/
|
|
388
|
+
async function handleListExistingTransportChoice(packageAnswer, systemConfig, previousAnswers, backendTarget) {
|
|
389
|
+
if (!packageAnswer || !previousAnswers?.ui5AbapRepo) {
|
|
390
|
+
return (0, i18n_1.t)('errors.validators.transportListPreReqs');
|
|
391
|
+
}
|
|
392
|
+
prompt_state_1.PromptState.transportAnswers.transportList = await (0, validator_utils_1.getTransportList)(packageAnswer, previousAnswers.ui5AbapRepo, systemConfig, backendTarget);
|
|
393
|
+
if (prompt_state_1.PromptState.transportAnswers.transportList) {
|
|
394
|
+
if (prompt_state_1.PromptState.transportAnswers.transportList.length > 0) {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
return (0, i18n_1.t)('warnings.noTransportReqs');
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
return (0, i18n_1.t)('warnings.noExistingTransportReqList');
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Validates the transport choice input.
|
|
407
|
+
*
|
|
408
|
+
* @param input - transport choice input
|
|
409
|
+
* @param previousAnswers - previous answers
|
|
410
|
+
* @param validateInputChanged - if the input has changed
|
|
411
|
+
* @param prevTransportInputChoice - previous transport input choice
|
|
412
|
+
* @param backendTarget - backend target
|
|
413
|
+
* @returns boolean or error message as a string
|
|
414
|
+
*/
|
|
415
|
+
async function validateTransportChoiceInput(input, previousAnswers, validateInputChanged, prevTransportInputChoice, backendTarget) {
|
|
416
|
+
const packageAnswer = (0, utils_1.getPackageAnswer)(previousAnswers);
|
|
417
|
+
const systemConfig = {
|
|
418
|
+
url: prompt_state_1.PromptState.abapDeployConfig.url,
|
|
419
|
+
client: prompt_state_1.PromptState.abapDeployConfig.client,
|
|
420
|
+
destination: prompt_state_1.PromptState.abapDeployConfig.destination
|
|
421
|
+
};
|
|
422
|
+
switch (input) {
|
|
423
|
+
case types_1.TransportChoices.ListExistingChoice: {
|
|
424
|
+
return handleListExistingTransportChoice(packageAnswer, systemConfig, previousAnswers, backendTarget);
|
|
425
|
+
}
|
|
426
|
+
case types_1.TransportChoices.CreateNewChoice: {
|
|
427
|
+
return handleCreateNewTransportChoice(packageAnswer, systemConfig, input, previousAnswers, validateInputChanged, prevTransportInputChoice);
|
|
428
|
+
}
|
|
429
|
+
case types_1.TransportChoices.EnterManualChoice:
|
|
430
|
+
default:
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
exports.validateTransportChoiceInput = validateTransportChoiceInput;
|
|
435
|
+
/**
|
|
436
|
+
* Validates the transport question.
|
|
437
|
+
*
|
|
438
|
+
* @param input - transport request
|
|
439
|
+
* @returns boolean or error message as a string
|
|
440
|
+
*/
|
|
441
|
+
function validateTransportQuestion(input) {
|
|
442
|
+
if (prompt_state_1.PromptState.transportAnswers.transportRequired && !input?.trim()) {
|
|
443
|
+
return (0, i18n_1.t)('prompts.config.transport.provideTransportRequest');
|
|
444
|
+
}
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
exports.validateTransportQuestion = validateTransportQuestion;
|
|
448
|
+
/**
|
|
449
|
+
* Validates the confirm question and updates the state.
|
|
450
|
+
*
|
|
451
|
+
* @param overwrite - if overwrite was selected
|
|
452
|
+
* @returns boolean
|
|
453
|
+
*/
|
|
454
|
+
function validateConfirmQuestion(overwrite) {
|
|
455
|
+
prompt_state_1.PromptState.abapDeployConfig.abort = !overwrite;
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
exports.validateConfirmQuestion = validateConfirmQuestion;
|
|
459
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/prompts/validators.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA6C;AAC7C,iDAAsF;AACtF,wDAO4B;AAC5B,sEAAwE;AACxE,kCAA4B;AAC5B,oCAAwG;AACxG,oDAA8D;AAC9D,yCAAmD;AACnD,2EAAuE;AACvE,qEAA4C;AAC5C,oCASkB;AAElB;;;;;;GAMG;AACH,SAAgB,2BAA2B,CAAC,WAAmB,EAAE,YAA2B;IACxF,0BAAW,CAAC,qBAAqB,EAAE,CAAC;IACpC,4BAA4B,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AAChB,CAAC;AAJD,kEAIC;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,EACvB,GAAG,EACH,MAAM,EACN,MAAM,EACN,GAAG,EAMN;IACG,0BAAW,CAAC,gBAAgB,CAAC,GAAG,GAAG,GAAG,CAAC;IACvC,0BAAW,CAAC,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;IAC7C,0BAAW,CAAC,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;IAC7C,0BAAW,CAAC,gBAAgB,CAAC,GAAG,GAAG,GAAG,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,WAAmB,EAAE,eAA6B,EAAE;IAC7F,MAAM,IAAI,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACvC,IAAI,IAAI,EAAE,CAAC;QACP,0BAAW,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;QACrD,i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AACH,SAAgB,yBAAyB,CAAC,KAAc;IACpD,IAAI,0BAAW,CAAC,gBAAgB,CAAC,iBAAiB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;QACnE,OAAO,IAAA,QAAC,EAAC,kDAAkD,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AALD,8DAKC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,SAAkB;IACtD,0BAAW,CAAC,gBAAgB,CAAC,KAAK,GAAG,CAAC,SAAS,CAAC;IAChD,OAAO,IAAI,CAAC;AAChB,CAAC;AAHD,0DAGC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { BackendTarget, Credentials, SystemConfig } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Get or create an abap service provider.
|
|
5
|
+
*
|
|
6
|
+
* @param systemConfig - system configuration
|
|
7
|
+
* @param backendTarget - backend target from prompt options
|
|
8
|
+
* @param credentials - user credentials
|
|
9
|
+
* @returns abap service provider
|
|
10
|
+
*/
|
|
11
|
+
export declare function getOrCreateServiceProvider(systemConfig: SystemConfig, backendTarget?: BackendTarget, credentials?: Credentials): Promise<AbapServiceProvider>;
|
|
12
|
+
/**
|
|
13
|
+
* An abapServiceProvider is cached when it is created. However, we have scenarios such as to test
|
|
14
|
+
* query the backend and then show user credential prompts if getting 401 error response. In this case,
|
|
15
|
+
* we need to clear the cached service provider, and allow createNewServiceProvider to be called again
|
|
16
|
+
* after user provided user credentials.
|
|
17
|
+
*/
|
|
18
|
+
export declare function deleteCachedServiceProvider(): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=abap-service-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abap-service-provider.d.ts","sourceRoot":"","sources":["../../src/service-provider-utils/abap-service-provider.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMzE;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAC5C,YAAY,EAAE,YAAY,EAC1B,aAAa,CAAC,EAAE,aAAa,EAC7B,WAAW,CAAC,EAAE,WAAW,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAqB9B;AA+CD;;;;;GAKG;AACH,wBAAsB,2BAA2B,kBAEhD"}
|