@sap-ux/odata-service-inquirer 0.5.60 → 0.6.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/dist/i18n.js +15 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -9
- package/dist/prompts/connectionValidator.d.ts +63 -12
- package/dist/prompts/connectionValidator.js +208 -50
- package/dist/prompts/datasources/cap-project/questions.js +2 -1
- package/dist/prompts/datasources/sap-system/abap-on-btp/questions.d.ts +3 -2
- package/dist/prompts/datasources/sap-system/abap-on-btp/questions.js +10 -10
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.d.ts +9 -11
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.js +21 -55
- package/dist/prompts/datasources/sap-system/credentials/questions.d.ts +21 -0
- package/dist/prompts/datasources/sap-system/credentials/questions.js +123 -0
- package/dist/prompts/datasources/sap-system/new-system/questions.d.ts +4 -26
- package/dist/prompts/datasources/sap-system/new-system/questions.js +18 -168
- package/dist/prompts/datasources/sap-system/new-system/types.d.ts +0 -10
- package/dist/prompts/datasources/sap-system/service-selection/index.d.ts +3 -0
- package/dist/prompts/datasources/sap-system/service-selection/index.js +19 -0
- package/dist/prompts/datasources/sap-system/service-selection/questions.d.ts +15 -0
- package/dist/prompts/datasources/sap-system/service-selection/questions.js +146 -0
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.d.ts +71 -0
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.js +282 -0
- package/dist/prompts/datasources/sap-system/service-selection/types.d.ts +11 -0
- package/dist/prompts/datasources/sap-system/service-selection/types.js +3 -0
- package/dist/prompts/datasources/sap-system/system-selection/index.d.ts +2 -0
- package/dist/prompts/datasources/sap-system/system-selection/index.js +18 -0
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.d.ts +44 -0
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.js +190 -0
- package/dist/prompts/datasources/sap-system/system-selection/questions.d.ts +40 -0
- package/dist/prompts/datasources/sap-system/system-selection/questions.js +182 -0
- package/dist/prompts/datasources/sap-system/validators.d.ts +8 -0
- package/dist/prompts/datasources/sap-system/validators.js +17 -0
- package/dist/prompts/datasources/service-url/questions.js +4 -3
- package/dist/prompts/datasources/service-url/validators.js +8 -9
- package/dist/prompts/prompt-helpers.d.ts +2 -3
- package/dist/prompts/prompt-helpers.js +4 -13
- package/dist/prompts/prompts.js +5 -34
- package/dist/prompts/validators.d.ts +1 -1
- package/dist/prompts/validators.js +1 -1
- package/dist/translations/odata-service-inquirer.i18n.json +25 -37
- package/dist/types.d.ts +57 -45
- package/dist/types.js +7 -41
- package/dist/utils/index.d.ts +5 -18
- package/dist/utils/index.js +10 -55
- package/package.json +10 -9
- package/dist/error-handler/error-handler.d.ts +0 -184
- package/dist/error-handler/error-handler.js +0 -465
- package/dist/prompts/datasources/sap-system/abap-on-btp/cf-helper.d.ts +0 -9
- package/dist/prompts/datasources/sap-system/abap-on-btp/cf-helper.js +0 -54
- package/dist/prompts/datasources/sap-system/new-system/service-helper.d.ts +0 -43
- package/dist/prompts/datasources/sap-system/new-system/service-helper.js +0 -175
package/dist/prompts/prompts.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getQuestions = getQuestions;
|
|
7
|
-
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
8
4
|
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
9
5
|
const i18n_1 = require("../i18n");
|
|
10
6
|
const types_1 = require("../types");
|
|
11
7
|
const questions_1 = require("./datasources/cap-project/questions");
|
|
12
8
|
const metadata_file_1 = require("./datasources/metadata-file");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const logger_helper_1 = __importDefault(require("./logger-helper"));
|
|
9
|
+
const system_selection_1 = require("./datasources/sap-system/system-selection");
|
|
10
|
+
const questions_2 = require("./datasources/service-url/questions");
|
|
16
11
|
const prompt_helpers_1 = require("./prompt-helpers");
|
|
17
12
|
/**
|
|
18
13
|
* Get the prompts for the OData service inquirer.
|
|
@@ -42,29 +37,7 @@ function getDatasourceTypeQuestion(options) {
|
|
|
42
37
|
},
|
|
43
38
|
default: options?.default ?? -1,
|
|
44
39
|
message: (0, i18n_1.t)('prompts.datasourceType.message'),
|
|
45
|
-
choices
|
|
46
|
-
additionalMessages: (source) => {
|
|
47
|
-
if ([
|
|
48
|
-
types_1.DatasourceType.businessHub,
|
|
49
|
-
types_1.DatasourceType.none,
|
|
50
|
-
types_1.DatasourceType.projectSpecificDestination,
|
|
51
|
-
types_1.DatasourceType.sapSystem
|
|
52
|
-
].includes(source)) {
|
|
53
|
-
logger_helper_1.default.logger?.warn((0, i18n_1.t)('prompts.datasourceType.notYetImplementedWarningMessage', { datasourceType: source }));
|
|
54
|
-
return {
|
|
55
|
-
message: (0, i18n_1.t)('prompts.datasourceType.notYetImplementedWarningMessage', { datasourceType: source }),
|
|
56
|
-
severity: yeoman_ui_types_1.Severity.warning
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
if (source === types_1.DatasourceType.businessHub) {
|
|
60
|
-
return {
|
|
61
|
-
message: (0, i18n_1.t)('prompts.nonUIServiceTypeWarningMessage', {
|
|
62
|
-
serviceType: (0, i18n_1.t)('prompts.datasourceType.businessHubName')
|
|
63
|
-
}),
|
|
64
|
-
severity: yeoman_ui_types_1.Severity.warning
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
40
|
+
choices
|
|
68
41
|
};
|
|
69
42
|
}
|
|
70
43
|
/**
|
|
@@ -75,12 +48,10 @@ function getDatasourceTypeQuestion(options) {
|
|
|
75
48
|
*/
|
|
76
49
|
async function getDatasourceTypeConditionalQuestions(promptOptions) {
|
|
77
50
|
const conditionalQuestions = [];
|
|
51
|
+
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((await (0, system_selection_1.getSystemSelectionQuestions)(promptOptions)), (answers) => answers.datasourceType === types_1.DatasourceType.sapSystem));
|
|
78
52
|
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)([(0, metadata_file_1.getMetadataFileQuestion)(promptOptions?.metadataFilePath)], (answers) => answers.datasourceType === types_1.DatasourceType.metadataFile));
|
|
79
53
|
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0, questions_1.getLocalCapProjectPrompts)(promptOptions), (answers) => answers.datasourceType === types_1.DatasourceType.capProject));
|
|
80
|
-
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0,
|
|
81
|
-
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0, questions_2.getNewSystemQuestions)(promptOptions), (answers) => answers.datasourceType === types_1.DatasourceType.sapSystem &&
|
|
82
|
-
answers.system === questions_2.newSystemChoiceValue));
|
|
83
|
-
//...further data sources to be added here
|
|
54
|
+
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0, questions_2.getServiceUrlQuestions)(promptOptions), (answers) => answers.datasourceType === types_1.DatasourceType.odataServiceUrl));
|
|
84
55
|
return conditionalQuestions;
|
|
85
56
|
}
|
|
86
57
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -4,7 +4,7 @@ import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
|
4
4
|
*
|
|
5
5
|
* @param edmx the edmx to validate
|
|
6
6
|
* @param requiredVersion the required odata version to validate against
|
|
7
|
-
* @returns version
|
|
7
|
+
* @returns the version only if odata version of the specified edmx matches otherwises the validation error message
|
|
8
8
|
*/
|
|
9
9
|
export declare function validateODataVersion(edmx: string, requiredVersion?: OdataVersion): {
|
|
10
10
|
validationMsg?: string;
|
|
@@ -12,7 +12,7 @@ const utils_1 = require("../utils");
|
|
|
12
12
|
*
|
|
13
13
|
* @param edmx the edmx to validate
|
|
14
14
|
* @param requiredVersion the required odata version to validate against
|
|
15
|
-
* @returns version
|
|
15
|
+
* @returns the version only if odata version of the specified edmx matches otherwises the validation error message
|
|
16
16
|
*/
|
|
17
17
|
function validateODataVersion(edmx, requiredVersion) {
|
|
18
18
|
try {
|
|
@@ -81,13 +81,14 @@
|
|
|
81
81
|
"message": "Password"
|
|
82
82
|
},
|
|
83
83
|
"systemService": {
|
|
84
|
-
"message": "Service
|
|
84
|
+
"message": "Service",
|
|
85
85
|
"breadcrumb": "Service",
|
|
86
86
|
"noServicesWarning": "No services available for the selected system, see logs for further details."
|
|
87
87
|
},
|
|
88
88
|
"newSystemType": {
|
|
89
89
|
"choiceAbapOnPrem": "ABAP On Premise",
|
|
90
90
|
"choiceAbapOnBtp": "ABAP Environment on SAP Business Technology Platform",
|
|
91
|
+
"choiceCFAbapEnvServiceOnBtp": "Cloud Foundry ABAP environment on SAP Business Technology Platform",
|
|
91
92
|
"message": "System type",
|
|
92
93
|
"notYetImplementedWarningMessage": "The selected system type: {{ systemType }} is not yet implemented."
|
|
93
94
|
},
|
|
@@ -99,7 +100,9 @@
|
|
|
99
100
|
"emptySystemNameWarning": "System name cannot be empty."
|
|
100
101
|
},
|
|
101
102
|
"systemSelection": {
|
|
102
|
-
"newSystemChoiceLabel": "New system"
|
|
103
|
+
"newSystemChoiceLabel": "New system",
|
|
104
|
+
"message": "Select a system configuration",
|
|
105
|
+
"authenticationFailedUpdateCredentials": "Authentication failed. Please try updating the credentials."
|
|
103
106
|
},
|
|
104
107
|
"abapOnBTPType": {
|
|
105
108
|
"message": "ABAP environment definition source",
|
|
@@ -116,36 +119,27 @@
|
|
|
116
119
|
"cloudFoundryAbapSystem": {
|
|
117
120
|
"message": "ABAP environment",
|
|
118
121
|
"hint": "Enter the name of the Cloud Foundry service that contains the ABAP Environment instance"
|
|
122
|
+
},
|
|
123
|
+
"destinationServicePath": {
|
|
124
|
+
"message": "Service path",
|
|
125
|
+
"hint": "Enter the path to the OData service, relative to the selected destination URL",
|
|
126
|
+
"invalidServicePathWarning": "Please enter a valid service path"
|
|
119
127
|
}
|
|
120
128
|
},
|
|
121
129
|
"errors": {
|
|
122
|
-
"
|
|
130
|
+
"destination": {
|
|
131
|
+
"authError": "The selected system is returning an authentication error. System name: {{systemName}}, error: {{- error}}"
|
|
132
|
+
},
|
|
133
|
+
"cannotReadCapServiceMetadata": "An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails)",
|
|
123
134
|
"capModelAndServicesLoadError": "An error occurred loading the CAP model and services. {{- error}}",
|
|
124
135
|
"capServiceUrlPathNotDefined": "An error occurred reading CAP service metadata: {{serviceName}}. CAP service property `urlPath` is not defined but is required.",
|
|
125
|
-
"unknownError": "An error occurred
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"urlCertValidationError": "The system URL is using {{certErrorReason}} security certificate.",
|
|
129
|
-
"authenticationFailed": "Authentication incorrect {{error}}",
|
|
130
|
-
"authenticationTimeout": "Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",
|
|
131
|
-
"invalidUrl": "Not a valid URL",
|
|
136
|
+
"unknownError": "An error occurred{{- error, addMsgWithColonFormatter}}",
|
|
137
|
+
"authenticationFailed": "Authentication incorrect. {{error}}",
|
|
138
|
+
"invalidUrl": "Invalid URL{{-input, addMsgWithColonFormatter}}",
|
|
132
139
|
"connectionError": "A connection error occurred, please ensure the target host is available on the network: {{- error}}",
|
|
133
|
-
"timeout": "A connection timeout error occurred: {{- error}}",
|
|
134
|
-
"serviceUnavailable": "Selected service is returning an error.",
|
|
135
|
-
"catalogServiceNotActive": "Catalog service is not active",
|
|
136
|
-
"internalServerError": "The URL you have provided cannot be accessed and is returning: '{{- error}}'. Please ensure that the URL is accessible externally.",
|
|
137
140
|
"urlNotFound": "URL not found",
|
|
138
|
-
"odataServiceUrlNotFound": "The service URL you have provided is not a valid OData Service. Fiori applications require an OData service as the data source.",
|
|
139
|
-
"badGateway": "The server returned an error: bad gateway, please check the URL and try again.",
|
|
140
|
-
"destinationUnavailable": "The selected destination references an instance that is not available. Please check your destination configuration and try again.",
|
|
141
|
-
"destinationNotFound": "The destination is mis-configured, HTTP Error 404 returned, the requested resource could not be found.",
|
|
142
|
-
"destinationMisconfigured": "The destination is mis-configured, HTML5.DynamicDestination property is missing.",
|
|
143
141
|
"noServicesAvailable": "There are no V{{version}} OData services available from the selected system and the template you have chosen supports V{{version}} OData services only",
|
|
144
|
-
"redirectError": "A redirect response was received from the server",
|
|
145
142
|
"abapEnvsUnavailable": "ABAP environments unavailable",
|
|
146
|
-
"noSuchHostError": "No such host is known",
|
|
147
|
-
"odataServiceVersionMismatch": "The template you have chosen supports V{{requiredVersion}} OData services only. The provided version is V{{serviceVersion}}.",
|
|
148
|
-
"destinationAuthError": "The selected system is returning an authentication error. Please verify the destination configuration",
|
|
149
143
|
"systemOrServiceUrlNotFound": "Please verify the url: {{- url}}, target system configuration and network connectivity",
|
|
150
144
|
"urlRedirect": "The service URL is redirecting",
|
|
151
145
|
"certValidationRequired": "Certificate validation is required to continue.",
|
|
@@ -154,24 +148,18 @@
|
|
|
154
148
|
"serviceMetadataErrorUI": "$t(errors.serviceMetadataError, {\"servicePath\": \"{{- servicePath}}\" }). $t(texts.seeLogForDetails)",
|
|
155
149
|
"serviceMetadataErrorLog": "$t(errors.serviceMetadataError, {\"servicePath\": \"{{- servicePath}}\" }). {{error}}",
|
|
156
150
|
"serviceTypeRequestError": "Error retrieving service type: {{- error}}",
|
|
157
|
-
"noAbapEnvsInCFSpace": "No ABAP environments in CF space found.",
|
|
158
|
-
"abapEnvsCFDiscoveryFailed": "Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry (see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login).",
|
|
159
151
|
"abapServiceAuthenticationFailed": "ABAP environment authentication using UAA failed.",
|
|
160
|
-
"serviceCatalogRequest": "An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}. {{error}}"
|
|
152
|
+
"serviceCatalogRequest": "An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}. {{error}}",
|
|
153
|
+
"storedSystemConnectionError": "An error occurred while validating the stored system connection info. System name: {{-systemName}}, error: {{- error}}",
|
|
154
|
+
"noCatalogOrServiceAvailable": "No active system or OData service endpoint connection available to retrieve service(s).",
|
|
155
|
+
"allCatalogServiceRequestsFailed": "All catalog service requests failed for the selected system. OData version(s): V{{version}}."
|
|
161
156
|
},
|
|
162
157
|
"texts": {
|
|
163
|
-
"anExpiredCert": "an expired",
|
|
164
|
-
"aSelfSignedCert": "a self-signed",
|
|
165
|
-
"anUnknownOrInvalidCert": "an unknown or invalid",
|
|
166
|
-
"anUntrustedRootCert": "an untrusted root",
|
|
167
158
|
"suggestedSystemNameClient": ", client {{client}}",
|
|
168
159
|
"seeLogForDetails": "See log for more details.",
|
|
169
|
-
"forUserName": "(for user [{{username}}])"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
},
|
|
174
|
-
"telemetry": {
|
|
175
|
-
"unknownOsText": "Unknown"
|
|
160
|
+
"forUserName": "(for user [{{username}}])",
|
|
161
|
+
"systemTypeBTP": "BTP",
|
|
162
|
+
"systemTypeS4HC": "S4HC",
|
|
163
|
+
"httpStatus": "http status {{httpStatus}}"
|
|
176
164
|
}
|
|
177
165
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { IValidationLink } from '@sap-devx/yeoman-ui-types';
|
|
2
1
|
import type { Annotations, ServiceProvider } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { Destination } from '@sap-ux/btp-utils';
|
|
3
3
|
import type { CommonPromptOptions, YUIQuestion } from '@sap-ux/inquirer-common';
|
|
4
4
|
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
5
5
|
import type { CdsVersionInfo } from '@sap-ux/project-access';
|
|
6
|
-
import type { ListChoiceOptions } from 'inquirer';
|
|
7
6
|
import type { BackendSystem } from '@sap-ux/store';
|
|
7
|
+
import type { ListChoiceOptions } from 'inquirer';
|
|
8
8
|
/**
|
|
9
9
|
* This file contains types that are exported by the module and are needed for consumers using the APIs `prompt` and `getPrompts`.
|
|
10
10
|
*/
|
|
11
11
|
export declare enum DatasourceType {
|
|
12
12
|
sapSystem = "sapSystem",
|
|
13
|
-
businessHub = "businessHub",
|
|
14
13
|
capProject = "capProject",
|
|
15
14
|
odataServiceUrl = "odataServiceUrl",
|
|
16
15
|
none = "none",
|
|
17
16
|
metadataFile = "metadataFile",
|
|
18
|
-
projectSpecificDestination = "projectSpecificDestination"
|
|
17
|
+
projectSpecificDestination = "projectSpecificDestination",
|
|
18
|
+
businessHub = "businessHub"
|
|
19
19
|
}
|
|
20
20
|
export declare const SapSystemTypes: {
|
|
21
21
|
readonly abapOnPrem: "abapOnPrem";
|
|
@@ -74,8 +74,15 @@ export interface OdataServiceAnswers {
|
|
|
74
74
|
serviceProvider: ServiceProvider;
|
|
75
75
|
/**
|
|
76
76
|
* The persistable backend system representation of the connected service provider
|
|
77
|
+
* `newOrUpdated` is set to true if the system was newly created or updated during the connection validation process and should be considered for storage.
|
|
77
78
|
*/
|
|
78
|
-
backendSystem?: BackendSystem
|
|
79
|
+
backendSystem?: BackendSystem & {
|
|
80
|
+
newOrUpdated?: boolean;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The destination information for the connected system
|
|
84
|
+
*/
|
|
85
|
+
destination?: Destination;
|
|
79
86
|
};
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
@@ -113,7 +120,11 @@ export declare enum promptNames {
|
|
|
113
120
|
/**
|
|
114
121
|
* Newly created systems can be named for storage
|
|
115
122
|
*/
|
|
116
|
-
userSystemName = "userSystemName"
|
|
123
|
+
userSystemName = "userSystemName",
|
|
124
|
+
/**
|
|
125
|
+
* System selection
|
|
126
|
+
*/
|
|
127
|
+
systemSelection = "systemSelection"
|
|
117
128
|
}
|
|
118
129
|
export type CapRuntime = 'Node.js' | 'Java';
|
|
119
130
|
export interface CapService {
|
|
@@ -175,10 +186,6 @@ export type DatasourceTypePromptOptions = {
|
|
|
175
186
|
* Include the no datasource option in the datasource type prompt
|
|
176
187
|
*/
|
|
177
188
|
includeNone?: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Include the `projectSpecificDestination` option in the datasource type prompt
|
|
180
|
-
*/
|
|
181
|
-
includeProjectSpecificDest?: boolean;
|
|
182
189
|
/**
|
|
183
190
|
* Limit the offered datasource types to the specified types. Note that if `default` is also provided and not included in the choices, the default will be ignored.
|
|
184
191
|
* If `includeNone` is set to true, the `none` option will always be included.
|
|
@@ -186,6 +193,45 @@ export type DatasourceTypePromptOptions = {
|
|
|
186
193
|
*/
|
|
187
194
|
choices?: DatasourceType[];
|
|
188
195
|
};
|
|
196
|
+
export type DestinationFilters = {
|
|
197
|
+
/**
|
|
198
|
+
* 'WebIDEUsage' property is defined and includes the value 'odata_abap'. If this matches, the destination will be included regardless of other matches.
|
|
199
|
+
*/
|
|
200
|
+
odata_abap: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* 'WebIDEUsage' property is defined and includes the value 'odata_gen' and does not includes the value 'odata_abap'. If this matches, the destination will be included regardless of other matches.
|
|
203
|
+
*/
|
|
204
|
+
odata_generic: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* 'WebIDEAdditionalData' property is defined and includes the value 'full_url' and
|
|
207
|
+
* 'WebIDEUsage' property is defined and includes the value 'odata_gen' and does not includes the value 'odata_abap'. If this matches, the destination will be included regardless of other matches.
|
|
208
|
+
*/
|
|
209
|
+
full_service_url: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* 'WebIDEAdditionalData' property is defined and does not include the value 'full_url' and
|
|
212
|
+
* 'WebIDEUsage' property is defined and includes the value 'odata_gen' and does not includes the value 'odata_abap'. If this matches, the destination will be included regardless of other matches.
|
|
213
|
+
*/
|
|
214
|
+
partial_service_url: boolean;
|
|
215
|
+
};
|
|
216
|
+
export type SystemSelectionPromptOptions = {
|
|
217
|
+
/**
|
|
218
|
+
* Set the specific filter option(s) to true to include only the destinatons that have matching configuration attributes.
|
|
219
|
+
* If no filter is set, all destinations will be included. If multiple filters are set, the destination will be included if it matches any of the filters.
|
|
220
|
+
* i.e. if both `abap_cloud` and `abap_on_premise` are set to true, the destination will be included if it has either 'abap_cloud' or 'abap_on_premise' matching configuration.
|
|
221
|
+
*/
|
|
222
|
+
destinationFilters?: Partial<DestinationFilters>;
|
|
223
|
+
/**
|
|
224
|
+
* Determines if the system selection prompt should use auto complete prompt for system names.
|
|
225
|
+
* Note that the auto-complete module must be registered with the inquirer instance to use this feature.
|
|
226
|
+
*/
|
|
227
|
+
useAutoComplete?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Include the Cloud Foundry Abap environments service in the system selection prompt, note this option is only supported on Business Application Studio.
|
|
230
|
+
* Even if this option is set to true, the choice will only be included if the prompts are executed in the Business Application Studio.
|
|
231
|
+
* Note that there is no implementation for this option in this module and handling of the prompt optin and subsequent prompting must be implemented by the consumer.
|
|
232
|
+
*/
|
|
233
|
+
includeCloudFoundryAbapEnvChoice?: boolean;
|
|
234
|
+
};
|
|
189
235
|
export type MetadataPromptOptions = {
|
|
190
236
|
/**
|
|
191
237
|
* Used to validate the metadata file contains the required odata version edmx
|
|
@@ -220,43 +266,9 @@ export type OdataServiceUrlPasswordOptions = Pick<CommonPromptOptions, 'addition
|
|
|
220
266
|
/**
|
|
221
267
|
* Provide the correct type checking for prompt options
|
|
222
268
|
*/
|
|
223
|
-
type odataServiceInquirerPromptOptions = Record<promptNames.datasourceType, DatasourceTypePromptOptions> & Record<promptNames.metadataFilePath, MetadataPromptOptions> & Record<promptNames.capProject, CapProjectPromptOptions> & Record<promptNames.capService, CapServicePromptOptions> & Record<promptNames.serviceUrl, OdataServiceUrlPromptOptions> & Record<promptNames.serviceUrlPassword, OdataServiceUrlPasswordOptions> & Record<promptNames.serviceSelection, ServiceSelectionPromptOptions> & Record<promptNames.userSystemName, SystemNamePromptOptions>;
|
|
269
|
+
type odataServiceInquirerPromptOptions = Record<promptNames.datasourceType, DatasourceTypePromptOptions> & Record<promptNames.metadataFilePath, MetadataPromptOptions> & Record<promptNames.capProject, CapProjectPromptOptions> & Record<promptNames.capService, CapServicePromptOptions> & Record<promptNames.serviceUrl, OdataServiceUrlPromptOptions> & Record<promptNames.serviceUrlPassword, OdataServiceUrlPasswordOptions> & Record<promptNames.serviceSelection, ServiceSelectionPromptOptions> & Record<promptNames.userSystemName, SystemNamePromptOptions> & Record<promptNames.systemSelection, SystemSelectionPromptOptions>;
|
|
224
270
|
export type OdataServiceQuestion = YUIQuestion<OdataServiceAnswers>;
|
|
225
271
|
export type OdataServicePromptOptions = Partial<odataServiceInquirerPromptOptions>;
|
|
226
|
-
/**
|
|
227
|
-
* Implementation of IValidationLink interface.
|
|
228
|
-
* Provides a toString() for serialization on CLI since IValidationLink rendering is only supported by YeomanUI.
|
|
229
|
-
*/
|
|
230
|
-
export declare class ValidationLink implements IValidationLink {
|
|
231
|
-
message: IValidationLink['message'];
|
|
232
|
-
link: IValidationLink['link'];
|
|
233
|
-
/**
|
|
234
|
-
* Constructor for ValidationLink.
|
|
235
|
-
*
|
|
236
|
-
* @param validationLink The validation link object to be used for serialization
|
|
237
|
-
*/
|
|
238
|
-
constructor(validationLink: IValidationLink);
|
|
239
|
-
/**
|
|
240
|
-
* Serialize the validation link object to a string.
|
|
241
|
-
*
|
|
242
|
-
* @returns The validation link object as a string
|
|
243
|
-
*/
|
|
244
|
-
toString(): string;
|
|
245
|
-
}
|
|
246
|
-
export declare const hostEnvironment: {
|
|
247
|
-
vscode: {
|
|
248
|
-
name: string;
|
|
249
|
-
technical: string;
|
|
250
|
-
};
|
|
251
|
-
bas: {
|
|
252
|
-
name: string;
|
|
253
|
-
technical: string;
|
|
254
|
-
};
|
|
255
|
-
cli: {
|
|
256
|
-
name: string;
|
|
257
|
-
technical: string;
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
272
|
export declare const SAP_CLIENT_KEY = "sap-client";
|
|
261
273
|
export {};
|
|
262
274
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SAP_CLIENT_KEY = exports.
|
|
3
|
+
exports.SAP_CLIENT_KEY = exports.promptNames = exports.SapSystemTypes = exports.DatasourceType = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* This file contains types that are exported by the module and are needed for consumers using the APIs `prompt` and `getPrompts`.
|
|
6
6
|
*/
|
|
7
7
|
var DatasourceType;
|
|
8
8
|
(function (DatasourceType) {
|
|
9
9
|
DatasourceType["sapSystem"] = "sapSystem";
|
|
10
|
-
DatasourceType["businessHub"] = "businessHub";
|
|
11
10
|
DatasourceType["capProject"] = "capProject";
|
|
12
11
|
DatasourceType["odataServiceUrl"] = "odataServiceUrl";
|
|
13
12
|
DatasourceType["none"] = "none";
|
|
14
13
|
DatasourceType["metadataFile"] = "metadataFile";
|
|
14
|
+
// @deprecated
|
|
15
15
|
DatasourceType["projectSpecificDestination"] = "projectSpecificDestination";
|
|
16
|
+
// @deprecated
|
|
17
|
+
DatasourceType["businessHub"] = "businessHub";
|
|
16
18
|
})(DatasourceType || (exports.DatasourceType = DatasourceType = {}));
|
|
17
19
|
exports.SapSystemTypes = {
|
|
18
20
|
abapOnPrem: 'abapOnPrem',
|
|
@@ -55,46 +57,10 @@ var promptNames;
|
|
|
55
57
|
* Newly created systems can be named for storage
|
|
56
58
|
*/
|
|
57
59
|
promptNames["userSystemName"] = "userSystemName";
|
|
58
|
-
})(promptNames || (exports.promptNames = promptNames = {}));
|
|
59
|
-
/**
|
|
60
|
-
* Implementation of IValidationLink interface.
|
|
61
|
-
* Provides a toString() for serialization on CLI since IValidationLink rendering is only supported by YeomanUI.
|
|
62
|
-
*/
|
|
63
|
-
class ValidationLink {
|
|
64
|
-
// Having to redeclare properties from an interface should not be required see: https://github.com/Microsoft/TypeScript/issues/5326
|
|
65
|
-
message;
|
|
66
|
-
link;
|
|
67
60
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param validationLink The validation link object to be used for serialization
|
|
61
|
+
* System selection
|
|
71
62
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Serialize the validation link object to a string.
|
|
77
|
-
*
|
|
78
|
-
* @returns The validation link object as a string
|
|
79
|
-
*/
|
|
80
|
-
toString() {
|
|
81
|
-
return `${this.message} ${this.link.text}${this.link.url ? ' : ' + this.link.url : ''}`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.ValidationLink = ValidationLink;
|
|
85
|
-
exports.hostEnvironment = {
|
|
86
|
-
vscode: {
|
|
87
|
-
name: 'Visual Studio Code',
|
|
88
|
-
technical: 'VSCode'
|
|
89
|
-
},
|
|
90
|
-
bas: {
|
|
91
|
-
name: 'SAP Business Application Studio',
|
|
92
|
-
technical: 'SBAS'
|
|
93
|
-
},
|
|
94
|
-
cli: {
|
|
95
|
-
name: 'CLI',
|
|
96
|
-
technical: 'CLI'
|
|
97
|
-
}
|
|
98
|
-
};
|
|
63
|
+
promptNames["systemSelection"] = "systemSelection";
|
|
64
|
+
})(promptNames || (exports.promptNames = promptNames = {}));
|
|
99
65
|
exports.SAP_CLIENT_KEY = 'sap-client';
|
|
100
66
|
//# sourceMappingURL=types.js.map
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
import type { TelemetryProperties, ToolsSuiteTelemetryClient } from '@sap-ux/telemetry';
|
|
2
|
-
import { PromptState } from './prompt-state';
|
|
3
|
-
import { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
4
1
|
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
2
|
+
import { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
5
3
|
import type { ListChoiceOptions } from 'inquirer';
|
|
4
|
+
import { PromptState } from './prompt-state';
|
|
5
|
+
import { type HostEnvironmentId } from '@sap-ux/fiori-generator-shared';
|
|
6
6
|
/**
|
|
7
7
|
* Determine if the current prompting environment is cli or a hosted extension (app studio or vscode).
|
|
8
8
|
*
|
|
9
9
|
* @returns the platform name and technical name
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function getPromptHostEnvironment(): {
|
|
12
12
|
name: string;
|
|
13
|
-
technical:
|
|
13
|
+
technical: HostEnvironmentId;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Set the telemetry client.
|
|
17
|
-
*
|
|
18
|
-
* @param toolsSuiteTelemetryClient the telemetry client instance to use when sending telemetry events
|
|
19
|
-
*/
|
|
20
|
-
export declare function setTelemetryClient(toolsSuiteTelemetryClient: ToolsSuiteTelemetryClient | undefined): void;
|
|
21
|
-
/**
|
|
22
|
-
* Send telemetry event.
|
|
23
|
-
*
|
|
24
|
-
* @param eventName the name of the telemetry event
|
|
25
|
-
* @param telemetryData the telemetry values to report
|
|
26
|
-
*/
|
|
27
|
-
export declare function sendTelemetryEvent(eventName: string, telemetryData: TelemetryProperties): void;
|
|
28
15
|
/**
|
|
29
16
|
* Validate xml and parse the odata version from the metadata xml.
|
|
30
17
|
*
|
package/dist/utils/index.js
CHANGED
|
@@ -4,78 +4,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PromptState = void 0;
|
|
7
|
-
exports.
|
|
8
|
-
exports.setTelemetryClient = setTelemetryClient;
|
|
9
|
-
exports.sendTelemetryEvent = sendTelemetryEvent;
|
|
7
|
+
exports.getPromptHostEnvironment = getPromptHostEnvironment;
|
|
10
8
|
exports.parseOdataVersion = parseOdataVersion;
|
|
11
9
|
exports.originToRelative = originToRelative;
|
|
12
10
|
exports.convertODataVersionType = convertODataVersionType;
|
|
13
11
|
exports.getDefaultChoiceIndex = getDefaultChoiceIndex;
|
|
12
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
14
13
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
15
|
-
const telemetry_1 = require("@sap-ux/telemetry");
|
|
16
|
-
const os_name_1 = __importDefault(require("os-name"));
|
|
17
|
-
const types_1 = require("../types");
|
|
18
|
-
const prompt_state_1 = require("./prompt-state");
|
|
19
|
-
Object.defineProperty(exports, "PromptState", { enumerable: true, get: function () { return prompt_state_1.PromptState; } });
|
|
20
|
-
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
21
14
|
const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
|
|
22
|
-
const
|
|
15
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
23
16
|
const i18n_1 = require("../i18n");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
17
|
+
const logger_helper_1 = __importDefault(require("../prompts/logger-helper"));
|
|
18
|
+
const prompt_state_1 = require("./prompt-state");
|
|
19
|
+
Object.defineProperty(exports, "PromptState", { enumerable: true, get: function () { return prompt_state_1.PromptState; } });
|
|
20
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
26
21
|
/**
|
|
27
22
|
* Determine if the current prompting environment is cli or a hosted extension (app studio or vscode).
|
|
28
23
|
*
|
|
29
24
|
* @returns the platform name and technical name
|
|
30
25
|
*/
|
|
31
|
-
function
|
|
26
|
+
function getPromptHostEnvironment() {
|
|
32
27
|
if (!prompt_state_1.PromptState.isYUI) {
|
|
33
|
-
return
|
|
28
|
+
return fiori_generator_shared_1.hostEnvironment.cli;
|
|
34
29
|
}
|
|
35
30
|
else {
|
|
36
|
-
return (0, btp_utils_1.isAppStudio)() ?
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
let telemetryClient;
|
|
40
|
-
/**
|
|
41
|
-
* Set the telemetry client.
|
|
42
|
-
*
|
|
43
|
-
* @param toolsSuiteTelemetryClient the telemetry client instance to use when sending telemetry events
|
|
44
|
-
*/
|
|
45
|
-
function setTelemetryClient(toolsSuiteTelemetryClient) {
|
|
46
|
-
telemetryClient = toolsSuiteTelemetryClient;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Send telemetry event.
|
|
50
|
-
*
|
|
51
|
-
* @param eventName the name of the telemetry event
|
|
52
|
-
* @param telemetryData the telemetry values to report
|
|
53
|
-
*/
|
|
54
|
-
function sendTelemetryEvent(eventName, telemetryData) {
|
|
55
|
-
const telemetryEvent = createTelemetryEvent(eventName, telemetryData);
|
|
56
|
-
if (telemetryClient) {
|
|
57
|
-
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
58
|
-
telemetryClient.reportEvent(telemetryEvent, telemetry_1.SampleRate.NoSampling);
|
|
31
|
+
return (0, btp_utils_1.isAppStudio)() ? fiori_generator_shared_1.hostEnvironment.bas : fiori_generator_shared_1.hostEnvironment.vscode;
|
|
59
32
|
}
|
|
60
33
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Create telemetry event.
|
|
63
|
-
*
|
|
64
|
-
* @param eventName the name of the telemetry event
|
|
65
|
-
* @param telemetryData the telemetry values to add to he returned telemetry event
|
|
66
|
-
* @returns the telemetry event
|
|
67
|
-
*/
|
|
68
|
-
function createTelemetryEvent(eventName, telemetryData) {
|
|
69
|
-
const telemProps = Object.assign(telemetryData, {
|
|
70
|
-
Platform: getHostEnvironment().technical,
|
|
71
|
-
OperatingSystem: osVersionName
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
eventName,
|
|
75
|
-
properties: telemProps,
|
|
76
|
-
measurements: {}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
34
|
/**
|
|
80
35
|
* Validate xml and parse the odata version from the metadata xml.
|
|
81
36
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/odata-service-inquirer",
|
|
3
3
|
"description": "Prompts module that can prompt users for inputs required for odata service writing",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"i18next": "23.5.1",
|
|
27
27
|
"inquirer-autocomplete-prompt": "2.0.1",
|
|
28
28
|
"os-name": "4.0.1",
|
|
29
|
-
"@sap-ux/axios-extension": "1.17.
|
|
30
|
-
"@sap-ux/btp-utils": "0.
|
|
31
|
-
"@sap-ux/
|
|
32
|
-
"@sap-ux/
|
|
33
|
-
"@sap-ux/
|
|
29
|
+
"@sap-ux/axios-extension": "1.17.2",
|
|
30
|
+
"@sap-ux/btp-utils": "0.16.0",
|
|
31
|
+
"@sap-ux/fiori-generator-shared": "0.7.7",
|
|
32
|
+
"@sap-ux/guided-answers-helper": "0.1.0",
|
|
33
|
+
"@sap-ux/telemetry": "0.5.42",
|
|
34
|
+
"@sap-ux/inquirer-common": "0.5.0",
|
|
34
35
|
"@sap-ux/logger": "0.6.0",
|
|
35
36
|
"@sap-ux/project-access": "1.28.6",
|
|
36
37
|
"@sap-ux/project-input-validator": "0.3.3",
|
|
@@ -42,9 +43,9 @@
|
|
|
42
43
|
"@types/inquirer": "8.2.6",
|
|
43
44
|
"@types/lodash": "4.14.202",
|
|
44
45
|
"jest-extended": "3.2.4",
|
|
45
|
-
"
|
|
46
|
-
"@sap-ux/
|
|
47
|
-
"@sap-ux/
|
|
46
|
+
"@sap-ux/fiori-generator-shared": "0.7.7",
|
|
47
|
+
"@sap-ux/feature-toggle": "0.2.2",
|
|
48
|
+
"@sap-ux/odata-service-writer": "0.23.1"
|
|
48
49
|
},
|
|
49
50
|
"engines": {
|
|
50
51
|
"node": ">=18.x"
|