@sap-ux/inquirer-common 0.13.6 → 1.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/dist/error-handler/error-handler.d.ts +2 -2
- package/dist/error-handler/error-handler.js +76 -80
- package/dist/i18n.js +10 -19
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -27
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.js +1 -17
- package/dist/metadata/metadataHelpers.js +21 -32
- package/dist/prompts/cf-helper.d.ts +1 -1
- package/dist/prompts/cf-helper.js +16 -19
- package/dist/prompts/credentials.d.ts +1 -1
- package/dist/prompts/credentials.js +7 -10
- package/dist/prompts/helpers.d.ts +1 -1
- package/dist/prompts/helpers.js +8 -18
- package/dist/prompts/separator.js +4 -11
- package/dist/prompts/utility.d.ts +2 -2
- package/dist/prompts/utility.js +17 -56
- package/dist/telemetry/telemetry.d.ts +1 -1
- package/dist/telemetry/telemetry.js +14 -23
- package/dist/types.js +1 -5
- package/package.json +15 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Destination } from '@sap-ux/btp-utils';
|
|
2
|
-
import { type HostEnvironmentId } from '@sap-ux/fiori-generator-shared
|
|
2
|
+
import { type HostEnvironmentId } from '@sap-ux/fiori-generator-shared';
|
|
3
3
|
import { type Logger } from '@sap-ux/logger';
|
|
4
|
-
import { ValidationLink } from '../types';
|
|
4
|
+
import { ValidationLink } from '../types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Constants specific to error handling
|
|
7
7
|
*/
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const i18n_1 = require("../i18n");
|
|
9
|
-
const telemetry_1 = require("../telemetry/telemetry");
|
|
10
|
-
const types_1 = require("../types");
|
|
1
|
+
import { Authentication, isAppStudio, isHTML5DynamicConfigured, isOnPremiseDestination } from '@sap-ux/btp-utils';
|
|
2
|
+
import { getHostEnvironment } from '@sap-ux/fiori-generator-shared';
|
|
3
|
+
import { getHelpUrl, GUIDED_ANSWERS_ICON, GUIDED_ANSWERS_LAUNCH_CMD_ID, HELP_NODES, HELP_TREE } from '@sap-ux/guided-answers-helper';
|
|
4
|
+
import { ToolsLogger } from '@sap-ux/logger';
|
|
5
|
+
import { t } from '../i18n.js';
|
|
6
|
+
import { getTelemPropertyDestinationType, sendTelemetryEvent } from '../telemetry/telemetry.js';
|
|
7
|
+
import { ValidationLink } from '../types.js';
|
|
11
8
|
// Telemetry event names specific to odata service error handling
|
|
12
9
|
const telemEventGALinkCreated = 'GA_LINK_CREATED';
|
|
13
10
|
const telemBasError = 'SERVICE_INQUIRER_BAS_ERROR';
|
|
14
11
|
/**
|
|
15
12
|
* Constants specific to error handling
|
|
16
13
|
*/
|
|
17
|
-
var ERROR_TYPE;
|
|
14
|
+
export var ERROR_TYPE;
|
|
18
15
|
(function (ERROR_TYPE) {
|
|
19
16
|
ERROR_TYPE["AUTH"] = "AUTH";
|
|
20
17
|
ERROR_TYPE["AUTH_TIMEOUT"] = "AUTH_TIMEOUT";
|
|
@@ -48,10 +45,10 @@ var ERROR_TYPE;
|
|
|
48
45
|
ERROR_TYPE["BAD_REQUEST"] = "BAD_REQUEST";
|
|
49
46
|
ERROR_TYPE["DESTINATION_CONNECTION_ERROR"] = "DESTINATION_CONNECTION_ERROR";
|
|
50
47
|
ERROR_TYPE["SERVER_HTTP_ERROR"] = "SERVER_HTTP_ERROR";
|
|
51
|
-
})(ERROR_TYPE || (
|
|
48
|
+
})(ERROR_TYPE || (ERROR_TYPE = {}));
|
|
52
49
|
// Used to match regex expressions to error messages, etc. providing a way to return a consistent
|
|
53
50
|
// single error and error msg for multiple errors
|
|
54
|
-
|
|
51
|
+
export const ERROR_MAP = {
|
|
55
52
|
[ERROR_TYPE.AUTH]: [
|
|
56
53
|
/401/,
|
|
57
54
|
/403/,
|
|
@@ -104,7 +101,7 @@ exports.ERROR_MAP = {
|
|
|
104
101
|
* Maps errors to end-user messages using some basic root cause analysis based on regex matching.
|
|
105
102
|
* This class will also log errors and provide help links for validation errors in some limited use cases.
|
|
106
103
|
*/
|
|
107
|
-
class ErrorHandler {
|
|
104
|
+
export class ErrorHandler {
|
|
108
105
|
/** The last error message generated */
|
|
109
106
|
currentErrorMsg;
|
|
110
107
|
/** The last error message type generated if determined */
|
|
@@ -164,59 +161,59 @@ class ErrorHandler {
|
|
|
164
161
|
* @param subTextKey an i18next key used to provide additional context to the error message
|
|
165
162
|
* @returns the localized error message
|
|
166
163
|
*/
|
|
167
|
-
static serverErrorMessage = (error, subTextKey) =>
|
|
164
|
+
static serverErrorMessage = (error, subTextKey) => t('errors.serverReturnedAnError', {
|
|
168
165
|
errorDesc: subTextKey
|
|
169
|
-
?
|
|
166
|
+
? t(subTextKey, { errorMsg: ErrorHandler.getMessageFromError(error) })
|
|
170
167
|
: ErrorHandler.getMessageFromError(error)
|
|
171
168
|
});
|
|
172
169
|
// Get the localized parameterized error message for the specified error type
|
|
173
170
|
static _errorTypeToMsg = {
|
|
174
|
-
[ERROR_TYPE.CERT]: (error) =>
|
|
175
|
-
[ERROR_TYPE.CERT_EXPIRED]: () =>
|
|
176
|
-
[ERROR_TYPE.CERT_SELF_SIGNED]: () =>
|
|
177
|
-
certErrorReason:
|
|
171
|
+
[ERROR_TYPE.CERT]: (error) => t('errors.certificateError', { errorMsg: ErrorHandler.getMessageFromError(error) }),
|
|
172
|
+
[ERROR_TYPE.CERT_EXPIRED]: () => t('errors.urlCertValidationError', { certErrorReason: t('texts.anExpiredCert') }),
|
|
173
|
+
[ERROR_TYPE.CERT_SELF_SIGNED]: () => t('errors.urlCertValidationError', {
|
|
174
|
+
certErrorReason: t('texts.aSelfSignedCert')
|
|
178
175
|
}),
|
|
179
|
-
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: () =>
|
|
180
|
-
certErrorReason:
|
|
176
|
+
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: () => t('errors.urlCertValidationError', {
|
|
177
|
+
certErrorReason: t('texts.anUnknownOrInvalidCert')
|
|
181
178
|
}),
|
|
182
|
-
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: () =>
|
|
183
|
-
certErrorReason:
|
|
179
|
+
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: () => t('errors.urlCertValidationError', {
|
|
180
|
+
certErrorReason: t('texts.anUntrustedRootCert')
|
|
184
181
|
}),
|
|
185
|
-
[ERROR_TYPE.INVALID_SSL_CERTIFICATE]: () =>
|
|
186
|
-
certErrorReason:
|
|
182
|
+
[ERROR_TYPE.INVALID_SSL_CERTIFICATE]: () => t('errors.urlCertValidationError', {
|
|
183
|
+
certErrorReason: t('texts.anUnknownOrInvalidCert')
|
|
187
184
|
}),
|
|
188
|
-
[ERROR_TYPE.AUTH]: (error) =>
|
|
185
|
+
[ERROR_TYPE.AUTH]: (error) => t('errors.authenticationFailed', {
|
|
189
186
|
error: ErrorHandler.getMessageFromError(error)
|
|
190
187
|
}),
|
|
191
|
-
[ERROR_TYPE.AUTH_TIMEOUT]: () =>
|
|
192
|
-
[ERROR_TYPE.TIMEOUT]: (error) =>
|
|
193
|
-
[ERROR_TYPE.INVALID_URL]: () =>
|
|
194
|
-
[ERROR_TYPE.CONNECTION]: (error) =>
|
|
188
|
+
[ERROR_TYPE.AUTH_TIMEOUT]: () => t('errors.authenticationTimeout'),
|
|
189
|
+
[ERROR_TYPE.TIMEOUT]: (error) => t('errors.timeout', { errorMsg: ErrorHandler.getMessageFromError(error) }),
|
|
190
|
+
[ERROR_TYPE.INVALID_URL]: () => t('errors.invalidUrl'),
|
|
191
|
+
[ERROR_TYPE.CONNECTION]: (error) => t('errors.connectionError', {
|
|
195
192
|
error: ErrorHandler.getMessageFromError(error)
|
|
196
193
|
}),
|
|
197
|
-
[ERROR_TYPE.UNKNOWN]: (error) =>
|
|
194
|
+
[ERROR_TYPE.UNKNOWN]: (error) => t('errors.unknownError', {
|
|
198
195
|
error: ErrorHandler.getMessageFromError(error)
|
|
199
196
|
}),
|
|
200
|
-
[ERROR_TYPE.SERVICES_UNAVAILABLE]: () =>
|
|
197
|
+
[ERROR_TYPE.SERVICES_UNAVAILABLE]: () => t('errors.servicesUnavailable'),
|
|
201
198
|
[ERROR_TYPE.SERVICE_UNAVAILABLE]: (error) => ErrorHandler.serverErrorMessage(error),
|
|
202
|
-
[ERROR_TYPE.CATALOG_SERVICE_NOT_ACTIVE]: () =>
|
|
199
|
+
[ERROR_TYPE.CATALOG_SERVICE_NOT_ACTIVE]: () => t('errors.catalogServiceNotActive'),
|
|
203
200
|
[ERROR_TYPE.INTERNAL_SERVER_ERROR]: (error) => ErrorHandler.serverErrorMessage(error, 'errors.internalServerError'),
|
|
204
|
-
[ERROR_TYPE.NOT_FOUND]: () =>
|
|
205
|
-
[ERROR_TYPE.ODATA_URL_NOT_FOUND]: () =>
|
|
201
|
+
[ERROR_TYPE.NOT_FOUND]: () => t('errors.urlNotFound'),
|
|
202
|
+
[ERROR_TYPE.ODATA_URL_NOT_FOUND]: () => t('errors.odataServiceUrlNotFound'),
|
|
206
203
|
[ERROR_TYPE.BAD_GATEWAY]: (error) => ErrorHandler.serverErrorMessage(error, 'errors.badGateway'),
|
|
207
|
-
[ERROR_TYPE.DESTINATION_UNAVAILABLE]: () =>
|
|
208
|
-
[ERROR_TYPE.DESTINATION_NOT_FOUND]: () =>
|
|
209
|
-
[ERROR_TYPE.DESTINATION_MISCONFIGURED]: (error) =>
|
|
204
|
+
[ERROR_TYPE.DESTINATION_UNAVAILABLE]: () => t('errors.destination.unavailable'),
|
|
205
|
+
[ERROR_TYPE.DESTINATION_NOT_FOUND]: () => t('errors.destination.notFound'),
|
|
206
|
+
[ERROR_TYPE.DESTINATION_MISCONFIGURED]: (error) => t('errors.destination.misconfigured', {
|
|
210
207
|
destinationProperty: typeof error === 'string' ? error : ''
|
|
211
208
|
}),
|
|
212
|
-
[ERROR_TYPE.NO_V2_SERVICES]: () =>
|
|
213
|
-
[ERROR_TYPE.NO_V4_SERVICES]: () =>
|
|
214
|
-
[ERROR_TYPE.DESTINATION_SERVICE_UNAVAILABLE]: () =>
|
|
215
|
-
[ERROR_TYPE.REDIRECT]: () =>
|
|
216
|
-
[ERROR_TYPE.NO_SUCH_HOST]: () =>
|
|
217
|
-
[ERROR_TYPE.NO_ABAP_ENVS]: () =>
|
|
209
|
+
[ERROR_TYPE.NO_V2_SERVICES]: () => t('errors.noServicesAvailable', { version: '2' }),
|
|
210
|
+
[ERROR_TYPE.NO_V4_SERVICES]: () => t('errors.noServicesAvailable', { version: '4' }),
|
|
211
|
+
[ERROR_TYPE.DESTINATION_SERVICE_UNAVAILABLE]: () => t('errors.destination.unavailable'),
|
|
212
|
+
[ERROR_TYPE.REDIRECT]: () => t('errors.redirectError'),
|
|
213
|
+
[ERROR_TYPE.NO_SUCH_HOST]: () => t('errors.noSuchHostError'),
|
|
214
|
+
[ERROR_TYPE.NO_ABAP_ENVS]: () => t('errors.abapEnvsUnavailable'),
|
|
218
215
|
[ERROR_TYPE.BAD_REQUEST]: (error) => ErrorHandler.serverErrorMessage(error, 'errors.badRequest'),
|
|
219
|
-
[ERROR_TYPE.DESTINATION_CONNECTION_ERROR]: () =>
|
|
216
|
+
[ERROR_TYPE.DESTINATION_CONNECTION_ERROR]: () => t('errors.systemConnectionValidationFailed'),
|
|
220
217
|
[ERROR_TYPE.SERVER_HTTP_ERROR]: (error) => ErrorHandler.serverErrorMessage(error),
|
|
221
218
|
[ERROR_TYPE.GATEWAY_TIMEOUT]: (error) => ErrorHandler.serverErrorMessage(error)
|
|
222
219
|
};
|
|
@@ -236,22 +233,22 @@ class ErrorHandler {
|
|
|
236
233
|
* @returns The Guided Answers node for the specified error type
|
|
237
234
|
*/
|
|
238
235
|
static getHelpNode = (errorType) => {
|
|
239
|
-
const isBAS =
|
|
236
|
+
const isBAS = isAppStudio();
|
|
240
237
|
const errorToHelp = {
|
|
241
|
-
[ERROR_TYPE.SERVICES_UNAVAILABLE]: isBAS ?
|
|
242
|
-
[ERROR_TYPE.CERT]:
|
|
243
|
-
[ERROR_TYPE.CERT_EXPIRED]:
|
|
244
|
-
[ERROR_TYPE.CERT_SELF_SIGNED]:
|
|
245
|
-
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]:
|
|
246
|
-
[ERROR_TYPE.INVALID_SSL_CERTIFICATE]:
|
|
247
|
-
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]:
|
|
248
|
-
[ERROR_TYPE.DESTINATION_MISCONFIGURED]:
|
|
249
|
-
[ERROR_TYPE.DESTINATION_UNAVAILABLE]:
|
|
250
|
-
[ERROR_TYPE.DESTINATION_NOT_FOUND]:
|
|
251
|
-
[ERROR_TYPE.BAD_GATEWAY]:
|
|
252
|
-
[ERROR_TYPE.DESTINATION_SERVICE_UNAVAILABLE]:
|
|
253
|
-
[ERROR_TYPE.NO_V4_SERVICES]:
|
|
254
|
-
[ERROR_TYPE.GATEWAY_TIMEOUT]: isBAS ?
|
|
238
|
+
[ERROR_TYPE.SERVICES_UNAVAILABLE]: isBAS ? HELP_NODES.BAS_CATALOG_SERVICES_REQUEST_FAILED : undefined,
|
|
239
|
+
[ERROR_TYPE.CERT]: HELP_NODES.CERTIFICATE_ERROR,
|
|
240
|
+
[ERROR_TYPE.CERT_EXPIRED]: HELP_NODES.CERTIFICATE_ERROR,
|
|
241
|
+
[ERROR_TYPE.CERT_SELF_SIGNED]: HELP_NODES.CERTIFICATE_ERROR,
|
|
242
|
+
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: HELP_NODES.CERTIFICATE_ERROR,
|
|
243
|
+
[ERROR_TYPE.INVALID_SSL_CERTIFICATE]: HELP_NODES.CERTIFICATE_ERROR,
|
|
244
|
+
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: HELP_NODES.CERTIFICATE_ERROR,
|
|
245
|
+
[ERROR_TYPE.DESTINATION_MISCONFIGURED]: HELP_NODES.DESTINATION_MISCONFIGURED,
|
|
246
|
+
[ERROR_TYPE.DESTINATION_UNAVAILABLE]: HELP_NODES.DESTINATION_UNAVAILABLE,
|
|
247
|
+
[ERROR_TYPE.DESTINATION_NOT_FOUND]: HELP_NODES.DESTINATION_NOT_FOUND,
|
|
248
|
+
[ERROR_TYPE.BAD_GATEWAY]: HELP_NODES.BAD_GATEWAY,
|
|
249
|
+
[ERROR_TYPE.DESTINATION_SERVICE_UNAVAILABLE]: HELP_NODES.DESTINATION_SERVICE_UNAVAILBLE,
|
|
250
|
+
[ERROR_TYPE.NO_V4_SERVICES]: HELP_NODES.NO_V4_SERVICES,
|
|
251
|
+
[ERROR_TYPE.GATEWAY_TIMEOUT]: isBAS ? HELP_NODES.DESTINATION_GATEWAY_TIMEOUT : undefined,
|
|
255
252
|
[ERROR_TYPE.AUTH]: undefined,
|
|
256
253
|
[ERROR_TYPE.AUTH_TIMEOUT]: undefined,
|
|
257
254
|
[ERROR_TYPE.REDIRECT]: undefined,
|
|
@@ -268,7 +265,7 @@ class ErrorHandler {
|
|
|
268
265
|
[ERROR_TYPE.NO_V2_SERVICES]: undefined,
|
|
269
266
|
[ERROR_TYPE.TIMEOUT]: undefined,
|
|
270
267
|
[ERROR_TYPE.BAD_REQUEST]: undefined,
|
|
271
|
-
[ERROR_TYPE.DESTINATION_CONNECTION_ERROR]:
|
|
268
|
+
[ERROR_TYPE.DESTINATION_CONNECTION_ERROR]: HELP_NODES.DESTINATION_CONNECTION_ERRORS,
|
|
272
269
|
[ERROR_TYPE.SERVER_HTTP_ERROR]: undefined
|
|
273
270
|
};
|
|
274
271
|
return errorToHelp[errorType];
|
|
@@ -295,7 +292,7 @@ class ErrorHandler {
|
|
|
295
292
|
* @param logPrefix optional, a prefix to be used for the logger to distinguish the source of the log messages, if a logger is not provided
|
|
296
293
|
*/
|
|
297
294
|
constructor(logger, enableGuidedAnswers = false, logPrefix) {
|
|
298
|
-
ErrorHandler._logger = logger ?? new
|
|
295
|
+
ErrorHandler._logger = logger ?? new ToolsLogger({ logPrefix: logPrefix ?? '@sap-ux/inquirer-common' });
|
|
299
296
|
ErrorHandler.guidedAnswersEnabled = enableGuidedAnswers;
|
|
300
297
|
}
|
|
301
298
|
/**
|
|
@@ -355,7 +352,7 @@ class ErrorHandler {
|
|
|
355
352
|
errorValueToFind = ErrorHandler.findErrorValueForMapping(error);
|
|
356
353
|
}
|
|
357
354
|
return Object.keys(ERROR_TYPE).find((errorCodeType) => {
|
|
358
|
-
return
|
|
355
|
+
return ERROR_MAP[errorCodeType].find((exp) => exp.test(errorValueToFind.toString()));
|
|
359
356
|
});
|
|
360
357
|
}
|
|
361
358
|
/**
|
|
@@ -495,12 +492,12 @@ class ErrorHandler {
|
|
|
495
492
|
let destErrorType;
|
|
496
493
|
let destErrorMsg;
|
|
497
494
|
// Add more specific error types for destinations here
|
|
498
|
-
if (!
|
|
495
|
+
if (!isHTML5DynamicConfigured(destination)) {
|
|
499
496
|
destErrorType = ERROR_TYPE.DESTINATION_MISCONFIGURED;
|
|
500
497
|
destErrorMsg = this.getErrorMsgFromType(destErrorType, 'HTML5.DynamicDestination');
|
|
501
498
|
}
|
|
502
499
|
else if (errorType === ERROR_TYPE.SERVICE_UNAVAILABLE) {
|
|
503
|
-
if (
|
|
500
|
+
if (isOnPremiseDestination(destination)) {
|
|
504
501
|
destErrorType = ERROR_TYPE.DESTINATION_SERVICE_UNAVAILABLE; // Remap to specific gateway to allow GA link to be associated
|
|
505
502
|
}
|
|
506
503
|
else {
|
|
@@ -514,15 +511,15 @@ class ErrorHandler {
|
|
|
514
511
|
else if (ERROR_TYPE.INTERNAL_SERVER_ERROR === errorType || ERROR_TYPE.SERVER_HTTP_ERROR === errorType) {
|
|
515
512
|
destErrorType = ERROR_TYPE.DESTINATION_CONNECTION_ERROR;
|
|
516
513
|
}
|
|
517
|
-
else if (errorType === ERROR_TYPE.AUTH && destination.Authentication !==
|
|
514
|
+
else if (errorType === ERROR_TYPE.AUTH && destination.Authentication !== Authentication.NO_AUTHENTICATION) {
|
|
518
515
|
// Auth errors for destinations are usually misconfiguration, unless the `Authentication` property is set to `NoAuthentication`
|
|
519
|
-
destErrorMsg = this.getErrorMsgFromType(ERROR_TYPE.AUTH,
|
|
516
|
+
destErrorMsg = this.getErrorMsgFromType(ERROR_TYPE.AUTH, t('texts.checkDestinationAuthConfig'));
|
|
520
517
|
}
|
|
521
518
|
// Always raise a telemetry event for destination related errors
|
|
522
|
-
|
|
519
|
+
sendTelemetryEvent(telemBasError, {
|
|
523
520
|
basErrorType: destErrorType ?? errorType,
|
|
524
|
-
destODataType:
|
|
525
|
-
Platform: this._platform ??
|
|
521
|
+
destODataType: getTelemPropertyDestinationType(destination),
|
|
522
|
+
Platform: this._platform ?? getHostEnvironment().technical
|
|
526
523
|
});
|
|
527
524
|
return {
|
|
528
525
|
errorType: destErrorType ?? errorType,
|
|
@@ -609,30 +606,29 @@ class ErrorHandler {
|
|
|
609
606
|
const valLink = {
|
|
610
607
|
message: errorMsg,
|
|
611
608
|
link: {
|
|
612
|
-
text:
|
|
613
|
-
icon:
|
|
614
|
-
url:
|
|
609
|
+
text: t('guidedAnswers.validationErrorHelpText'),
|
|
610
|
+
icon: GUIDED_ANSWERS_ICON,
|
|
611
|
+
url: getHelpUrl(HELP_TREE.FIORI_TOOLS, [helpNode])
|
|
615
612
|
}
|
|
616
613
|
};
|
|
617
614
|
if (this.guidedAnswersEnabled) {
|
|
618
615
|
valLink.link.command = {
|
|
619
|
-
id:
|
|
616
|
+
id: GUIDED_ANSWERS_LAUNCH_CMD_ID,
|
|
620
617
|
params: {
|
|
621
|
-
treeId:
|
|
618
|
+
treeId: HELP_TREE.FIORI_TOOLS,
|
|
622
619
|
nodeIdPath: [helpNode],
|
|
623
620
|
trigger: this.guidedAnswersTrigger
|
|
624
621
|
}
|
|
625
622
|
};
|
|
626
623
|
}
|
|
627
624
|
// Report the GA link created event
|
|
628
|
-
|
|
625
|
+
sendTelemetryEvent(telemEventGALinkCreated, {
|
|
629
626
|
errorType,
|
|
630
627
|
isGuidedAnswersEnabled: this.guidedAnswersEnabled,
|
|
631
628
|
nodeIdPath: `${helpNode}`,
|
|
632
|
-
Platform: this.platform ??
|
|
629
|
+
Platform: this.platform ?? getHostEnvironment().technical
|
|
633
630
|
});
|
|
634
|
-
return new
|
|
631
|
+
return new ValidationLink(valLink);
|
|
635
632
|
}
|
|
636
633
|
}
|
|
637
|
-
exports.ErrorHandler = ErrorHandler;
|
|
638
634
|
//# sourceMappingURL=error-handler.js.map
|
package/dist/i18n.js
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.i18n = void 0;
|
|
7
|
-
exports.addi18nResourceBundle = addi18nResourceBundle;
|
|
8
|
-
exports.initI18nInquirerCommon = initI18nInquirerCommon;
|
|
9
|
-
exports.t = t;
|
|
10
|
-
const i18next_1 = __importDefault(require("i18next"));
|
|
11
|
-
const inquirer_common_i18n_json_1 = __importDefault(require("./translations/inquirer-common.i18n.json"));
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import translations from './translations/inquirer-common.i18n.json' with { type: 'json' };
|
|
12
3
|
const inquirerCommonI18nNamespace = 'inquirer-common';
|
|
13
|
-
|
|
4
|
+
export const i18n = i18next.createInstance();
|
|
14
5
|
/**
|
|
15
6
|
* Adds the `inquirer-common` resource bundle to i18next.
|
|
16
7
|
* May be required to load i18n translations after initialising in the consumer module.
|
|
17
8
|
*/
|
|
18
|
-
function addi18nResourceBundle() {
|
|
19
|
-
|
|
9
|
+
export function addi18nResourceBundle() {
|
|
10
|
+
i18n.addResourceBundle('en', inquirerCommonI18nNamespace, translations);
|
|
20
11
|
}
|
|
21
12
|
/**
|
|
22
13
|
* Initialize i18next with the translations for this module.
|
|
23
14
|
*/
|
|
24
|
-
async function initI18nInquirerCommon() {
|
|
25
|
-
await
|
|
15
|
+
export async function initI18nInquirerCommon() {
|
|
16
|
+
await i18n.init({
|
|
26
17
|
lng: 'en',
|
|
27
18
|
fallbackLng: 'en',
|
|
28
19
|
missingInterpolationHandler: () => '',
|
|
@@ -46,13 +37,13 @@ async function initI18nInquirerCommon() {
|
|
|
46
37
|
* @param options additional options
|
|
47
38
|
* @returns {string} localized string stored for the given key
|
|
48
39
|
*/
|
|
49
|
-
function t(key, options) {
|
|
40
|
+
export function t(key, options) {
|
|
50
41
|
if (!options?.ns) {
|
|
51
42
|
options = Object.assign(options ?? {}, { ns: inquirerCommonI18nNamespace });
|
|
52
43
|
}
|
|
53
|
-
return
|
|
44
|
+
return i18n.t(key, options);
|
|
54
45
|
}
|
|
55
46
|
initI18nInquirerCommon().catch(() => {
|
|
56
|
-
//
|
|
47
|
+
// In case of an error during initialization, we catch it to prevent the application from crashing.
|
|
57
48
|
});
|
|
58
49
|
//# sourceMappingURL=i18n.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './prompts/utility';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './prompts/utility.js';
|
|
2
|
+
export * from './types.js';
|
|
3
3
|
export type { OutputTabLinkResult, ShowOutputTabLink } from '@sap-devx/yeoman-ui-types';
|
|
4
|
-
export * from './prompts/helpers';
|
|
5
|
-
export * from './error-handler/error-handler';
|
|
6
|
-
export * from './prompts/cf-helper';
|
|
7
|
-
export * from './telemetry/telemetry';
|
|
8
|
-
export * from './prompts/credentials';
|
|
9
|
-
export * from './metadata';
|
|
10
|
-
export { addi18nResourceBundle } from './i18n';
|
|
4
|
+
export * from './prompts/helpers.js';
|
|
5
|
+
export * from './error-handler/error-handler.js';
|
|
6
|
+
export * from './prompts/cf-helper.js';
|
|
7
|
+
export * from './telemetry/telemetry.js';
|
|
8
|
+
export * from './prompts/credentials.js';
|
|
9
|
+
export * from './metadata/index.js';
|
|
10
|
+
export { addi18nResourceBundle } from './i18n.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.addi18nResourceBundle = void 0;
|
|
18
|
-
__exportStar(require("./prompts/utility"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
20
|
-
__exportStar(require("./prompts/helpers"), exports);
|
|
21
|
-
__exportStar(require("./error-handler/error-handler"), exports);
|
|
22
|
-
__exportStar(require("./prompts/cf-helper"), exports);
|
|
23
|
-
__exportStar(require("./telemetry/telemetry"), exports);
|
|
24
|
-
__exportStar(require("./prompts/credentials"), exports);
|
|
25
|
-
__exportStar(require("./metadata"), exports);
|
|
26
|
-
var i18n_1 = require("./i18n");
|
|
27
|
-
Object.defineProperty(exports, "addi18nResourceBundle", { enumerable: true, get: function () { return i18n_1.addi18nResourceBundle; } });
|
|
1
|
+
export * from './prompts/utility.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './prompts/helpers.js';
|
|
4
|
+
export * from './error-handler/error-handler.js';
|
|
5
|
+
export * from './prompts/cf-helper.js';
|
|
6
|
+
export * from './telemetry/telemetry.js';
|
|
7
|
+
export * from './prompts/credentials.js';
|
|
8
|
+
export * from './metadata/index.js';
|
|
9
|
+
export { addi18nResourceBundle } from './i18n.js';
|
|
28
10
|
//# sourceMappingURL=index.js.map
|
package/dist/metadata/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './metadataHelpers';
|
|
1
|
+
export * from './metadataHelpers.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/metadata/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./metadataHelpers"), exports);
|
|
1
|
+
export * from './metadataHelpers.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.filterAggregateTransformations = filterAggregateTransformations;
|
|
6
|
-
exports.hasAggregateTransformationsForEntity = hasAggregateTransformationsForEntity;
|
|
7
|
-
exports.getRecursiveHierarchyQualifierForEntitySet = getRecursiveHierarchyQualifierForEntitySet;
|
|
8
|
-
exports.hasRecursiveHierarchyForEntity = hasRecursiveHierarchyForEntity;
|
|
9
|
-
exports.getRecursiveHierarchyQualifier = getRecursiveHierarchyQualifier;
|
|
10
|
-
exports.shouldUseAnalyticalTable = shouldUseAnalyticalTable;
|
|
11
|
-
exports.convertEdmxToConvertedMetadata = convertEdmxToConvertedMetadata;
|
|
12
|
-
const annotation_converter_1 = require("@sap-ux/annotation-converter");
|
|
13
|
-
const edmx_parser_1 = require("@sap-ux/edmx-parser");
|
|
14
|
-
const i18n_1 = require("../i18n");
|
|
15
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
1
|
+
import { convert } from '@sap-ux/annotation-converter';
|
|
2
|
+
import { parse } from '@sap-ux/edmx-parser';
|
|
3
|
+
import { t } from '../i18n.js';
|
|
4
|
+
import { findRecursiveHierarchyKey, getTableCapabilitiesByEntitySet } from '@sap-ux/project-access';
|
|
16
5
|
/**
|
|
17
6
|
* Required transformations for analytical table support.
|
|
18
7
|
* NOTE: This constant is primarily used by odata-service-inquirer but is exported
|
|
19
8
|
* here to maintain backward compatibility with external packages that import it.
|
|
20
9
|
*/
|
|
21
|
-
|
|
10
|
+
export const transformationsRequiredForAnalyticalTable = [
|
|
22
11
|
'filter',
|
|
23
12
|
'identity',
|
|
24
13
|
'orderby',
|
|
@@ -35,7 +24,7 @@ exports.transformationsRequiredForAnalyticalTable = [
|
|
|
35
24
|
* @param entitySetName The name of the entity set to find.
|
|
36
25
|
* @returns The entity set if found, undefined otherwise.
|
|
37
26
|
*/
|
|
38
|
-
function findEntitySetByName(metadata, entitySetName) {
|
|
27
|
+
export function findEntitySetByName(metadata, entitySetName) {
|
|
39
28
|
return metadata.entitySets.find((entitySet) => entitySet.name === entitySetName);
|
|
40
29
|
}
|
|
41
30
|
/**
|
|
@@ -45,8 +34,8 @@ function findEntitySetByName(metadata, entitySetName) {
|
|
|
45
34
|
* @param entitySets the entity sets to filter
|
|
46
35
|
* @returns the filtered entity sets
|
|
47
36
|
*/
|
|
48
|
-
function filterAggregateTransformations(entitySets) {
|
|
49
|
-
return entitySets.filter((entitySet) =>
|
|
37
|
+
export function filterAggregateTransformations(entitySets) {
|
|
38
|
+
return entitySets.filter((entitySet) => getTableCapabilitiesByEntitySet(entitySet).hasAggregateTransformations);
|
|
50
39
|
}
|
|
51
40
|
/**
|
|
52
41
|
* Checks if the given entity set name has aggregate transformations in the metadata.
|
|
@@ -58,12 +47,12 @@ function filterAggregateTransformations(entitySets) {
|
|
|
58
47
|
* @param requiredTransformations Optional array of specific transformations to check for. If not provided, checks for any transformations.
|
|
59
48
|
* @returns true if the entity set has the required transformations, false otherwise.
|
|
60
49
|
*/
|
|
61
|
-
function hasAggregateTransformationsForEntity(metadata, entitySetName, requiredTransformations) {
|
|
50
|
+
export function hasAggregateTransformationsForEntity(metadata, entitySetName, requiredTransformations) {
|
|
62
51
|
const entitySet = findEntitySetByName(metadata, entitySetName);
|
|
63
52
|
if (!entitySet) {
|
|
64
53
|
return false;
|
|
65
54
|
}
|
|
66
|
-
return
|
|
55
|
+
return getTableCapabilitiesByEntitySet(entitySet, requiredTransformations).hasAggregateTransformationsForEntitySet;
|
|
67
56
|
}
|
|
68
57
|
/**
|
|
69
58
|
* Gets the qualifier from a Hierarchy.RecursiveHierarchy annotation for the given entity set.
|
|
@@ -71,8 +60,8 @@ function hasAggregateTransformationsForEntity(metadata, entitySetName, requiredT
|
|
|
71
60
|
* @param entitySet The entity set to check for recursive hierarchy annotation.
|
|
72
61
|
* @returns The qualifier string if found, undefined otherwise.
|
|
73
62
|
*/
|
|
74
|
-
function getRecursiveHierarchyQualifierForEntitySet(entitySet) {
|
|
75
|
-
return
|
|
63
|
+
export function getRecursiveHierarchyQualifierForEntitySet(entitySet) {
|
|
64
|
+
return findRecursiveHierarchyKey(entitySet)?.split('#')[1];
|
|
76
65
|
}
|
|
77
66
|
/**
|
|
78
67
|
* Checks if the given entity set name has a Hierarchy.RecursiveHierarchy annotation in the metadata.
|
|
@@ -81,12 +70,12 @@ function getRecursiveHierarchyQualifierForEntitySet(entitySet) {
|
|
|
81
70
|
* @param entitySetName The entity set name to check for recursive hierarchy annotation.
|
|
82
71
|
* @returns true if the entity set has Hierarchy.RecursiveHierarchy annotation, false otherwise.
|
|
83
72
|
*/
|
|
84
|
-
function hasRecursiveHierarchyForEntity(metadata, entitySetName) {
|
|
73
|
+
export function hasRecursiveHierarchyForEntity(metadata, entitySetName) {
|
|
85
74
|
const entitySet = findEntitySetByName(metadata, entitySetName);
|
|
86
75
|
if (!entitySet) {
|
|
87
76
|
return false;
|
|
88
77
|
}
|
|
89
|
-
return
|
|
78
|
+
return getTableCapabilitiesByEntitySet(entitySet).hasRecursiveHierarchyForEntitySet;
|
|
90
79
|
}
|
|
91
80
|
/**
|
|
92
81
|
* Gets the qualifier from a Hierarchy.RecursiveHierarchy annotation for the given entity set.
|
|
@@ -95,7 +84,7 @@ function hasRecursiveHierarchyForEntity(metadata, entitySetName) {
|
|
|
95
84
|
* @param entitySetName The entity set name to check for recursive hierarchy annotation.
|
|
96
85
|
* @returns The qualifier string if found, undefined otherwise.
|
|
97
86
|
*/
|
|
98
|
-
function getRecursiveHierarchyQualifier(metadata, entitySetName) {
|
|
87
|
+
export function getRecursiveHierarchyQualifier(metadata, entitySetName) {
|
|
99
88
|
const entitySet = findEntitySetByName(metadata, entitySetName);
|
|
100
89
|
if (!entitySet) {
|
|
101
90
|
return undefined;
|
|
@@ -111,8 +100,8 @@ function getRecursiveHierarchyQualifier(metadata, entitySetName) {
|
|
|
111
100
|
* @param requireCompleteTransformations Whether to require all analytical transformations or accept any analytical annotations.
|
|
112
101
|
* @returns True if AnalyticalTable should be used, false otherwise.
|
|
113
102
|
*/
|
|
114
|
-
function shouldUseAnalyticalTable(entitySet, requireCompleteTransformations) {
|
|
115
|
-
const { hasAggregateTransformations, hasAggregateTransformationsForEntitySet } =
|
|
103
|
+
export function shouldUseAnalyticalTable(entitySet, requireCompleteTransformations) {
|
|
104
|
+
const { hasAggregateTransformations, hasAggregateTransformationsForEntitySet } = getTableCapabilitiesByEntitySet(entitySet, transformationsRequiredForAnalyticalTable);
|
|
116
105
|
// No analytical data means no need for AnalyticalTable
|
|
117
106
|
if (!hasAggregateTransformations) {
|
|
118
107
|
return false;
|
|
@@ -131,18 +120,18 @@ function shouldUseAnalyticalTable(entitySet, requireCompleteTransformations) {
|
|
|
131
120
|
* @returns The converted metadata object.
|
|
132
121
|
* @throws If the EDMX cannot be parsed or the OData version is unparseable.
|
|
133
122
|
*/
|
|
134
|
-
function convertEdmxToConvertedMetadata(edmx) {
|
|
123
|
+
export function convertEdmxToConvertedMetadata(edmx) {
|
|
135
124
|
try {
|
|
136
|
-
const convertedMetadata =
|
|
125
|
+
const convertedMetadata = convert(parse(edmx));
|
|
137
126
|
const parsedOdataVersion = Number.parseInt(convertedMetadata?.version, 10);
|
|
138
127
|
if (Number.isNaN(parsedOdataVersion)) {
|
|
139
|
-
throw new TypeError(
|
|
128
|
+
throw new TypeError(t('errors.unparseableOdataVersion'));
|
|
140
129
|
}
|
|
141
130
|
return convertedMetadata;
|
|
142
131
|
}
|
|
143
132
|
catch (error) {
|
|
144
133
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
145
|
-
throw new Error(
|
|
134
|
+
throw new Error(t('errors.unparseableMetadata', { error: errorMessage }));
|
|
146
135
|
}
|
|
147
136
|
}
|
|
148
137
|
//# sourceMappingURL=metadataHelpers.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ServiceInstanceInfo } from '@sap/cf-tools';
|
|
2
2
|
import type { ListChoiceOptions } from 'inquirer';
|
|
3
|
-
import { type ErrorHandler } from '../error-handler/error-handler';
|
|
3
|
+
import { type ErrorHandler } from '../error-handler/error-handler.js';
|
|
4
4
|
/**
|
|
5
5
|
* Get the name sorted list of ABAP instance choices from an active CF login. If not logged in, an error message is logged.
|
|
6
6
|
*
|
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const error_handler_1 = require("../error-handler/error-handler");
|
|
6
|
-
const i18n_1 = require("../i18n");
|
|
7
|
-
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
1
|
+
import { apiGetServicesInstancesFilteredByType as getServicesInstances } from '@sap/cf-tools';
|
|
2
|
+
import { ERROR_TYPE } from '../error-handler/error-handler.js';
|
|
3
|
+
import { t } from '../i18n.js';
|
|
4
|
+
import { AbapEnvType } from '@sap-ux/btp-utils';
|
|
8
5
|
/**
|
|
9
6
|
* Get the name sorted list of ABAP instance choices from an active CF login. If not logged in, an error message is logged.
|
|
10
7
|
*
|
|
11
8
|
* @param errorHandler The error handler instance used to log and retain messages for use in prompts
|
|
12
9
|
* @returns The list of ABAP instance choices
|
|
13
10
|
*/
|
|
14
|
-
async function getCFAbapInstanceChoices(errorHandler) {
|
|
11
|
+
export async function getCFAbapInstanceChoices(errorHandler) {
|
|
15
12
|
const choices = [];
|
|
16
13
|
try {
|
|
17
14
|
const filteredInstances = [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
AbapEnvType.ABAP,
|
|
16
|
+
AbapEnvType.ABAP_TRIAL,
|
|
17
|
+
AbapEnvType.ABAP_CANARY,
|
|
18
|
+
AbapEnvType.ABAP_OEM,
|
|
19
|
+
AbapEnvType.ABAP_OEM_CANARY,
|
|
20
|
+
AbapEnvType.ABAP_HAAS,
|
|
21
|
+
AbapEnvType.ABAP_STAGING,
|
|
22
|
+
AbapEnvType.ABAP_INTERNAL_STAGING
|
|
26
23
|
];
|
|
27
24
|
// Load additional ABAP service types to extend the filtered instance list
|
|
28
25
|
const envFilteredInstances = process.env.ABAPEnvServiceTypes
|
|
29
26
|
? process.env.ABAPEnvServiceTypes.split(',').map((item) => item.trim())
|
|
30
27
|
: [];
|
|
31
|
-
const serviceInstanceInfo = await (
|
|
28
|
+
const serviceInstanceInfo = await getServicesInstances([
|
|
32
29
|
...filteredInstances,
|
|
33
30
|
...envFilteredInstances
|
|
34
31
|
]);
|
|
@@ -39,12 +36,12 @@ async function getCFAbapInstanceChoices(errorHandler) {
|
|
|
39
36
|
}
|
|
40
37
|
else {
|
|
41
38
|
// No envs found
|
|
42
|
-
errorHandler.logErrorMsgs(
|
|
39
|
+
errorHandler.logErrorMsgs(ERROR_TYPE.NO_ABAP_ENVS, t('errors.noAbapEnvsInCFSpace'));
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
catch (error) {
|
|
46
43
|
// Cannot connect to CF
|
|
47
|
-
errorHandler.logErrorMsgs(
|
|
44
|
+
errorHandler.logErrorMsgs(ERROR_TYPE.NO_ABAP_ENVS, t('errors.abapEnvsCFDiscoveryFailed'));
|
|
48
45
|
}
|
|
49
46
|
return choices.sort((a, b) => (a.name ? a.name.localeCompare(b.name ?? '') : 0));
|
|
50
47
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCredentialsPrompts = getCredentialsPrompts;
|
|
4
|
-
const i18n_1 = require("../i18n");
|
|
1
|
+
import { t } from '../i18n.js';
|
|
5
2
|
/**
|
|
6
3
|
* Prompts the user for credentials.
|
|
7
4
|
*
|
|
8
5
|
* @param {Function} additionalValidation - Optional callback function called in the validation phase of password prompt. Callback function should return a boolean or a message.
|
|
9
6
|
* @returns {Array} An array of prompts.
|
|
10
7
|
*/
|
|
11
|
-
async function getCredentialsPrompts(additionalValidation) {
|
|
8
|
+
export async function getCredentialsPrompts(additionalValidation) {
|
|
12
9
|
return [
|
|
13
10
|
{
|
|
14
11
|
type: 'input',
|
|
15
12
|
name: 'username',
|
|
16
|
-
message:
|
|
13
|
+
message: t('prompts.username.message'),
|
|
17
14
|
guiOptions: {
|
|
18
15
|
mandatory: true
|
|
19
16
|
},
|
|
20
17
|
store: false,
|
|
21
18
|
validate: (value) => {
|
|
22
|
-
return value ? true :
|
|
19
|
+
return value ? true : t('errors.cannotBeEmpty', { field: t('prompts.username.message') });
|
|
23
20
|
}
|
|
24
21
|
},
|
|
25
22
|
{
|
|
26
23
|
type: 'password',
|
|
27
24
|
guiType: 'login',
|
|
28
25
|
name: 'password',
|
|
29
|
-
message:
|
|
26
|
+
message: t('prompts.password.message'),
|
|
30
27
|
mask: '*',
|
|
31
28
|
guiOptions: {
|
|
32
29
|
mandatory: true
|
|
@@ -34,10 +31,10 @@ async function getCredentialsPrompts(additionalValidation) {
|
|
|
34
31
|
store: false,
|
|
35
32
|
validate: async (value, answers) => {
|
|
36
33
|
if (!value) {
|
|
37
|
-
return
|
|
34
|
+
return t('errors.cannotBeEmpty', { field: t('prompts.password.message') });
|
|
38
35
|
}
|
|
39
36
|
if (!answers.username) {
|
|
40
|
-
return
|
|
37
|
+
return t('errors.cannotBeEmpty', { field: t('prompts.username.message') });
|
|
41
38
|
}
|
|
42
39
|
if (additionalValidation) {
|
|
43
40
|
return await additionalValidation({ username: answers.username, password: value });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Answers, Question, Validator } from 'inquirer';
|
|
2
|
-
import type { CommonPromptOptions, PromptDefaultValue, PromptSeverityMessage, YUIQuestion } from '../types';
|
|
2
|
+
import type { CommonPromptOptions, PromptDefaultValue, PromptSeverityMessage, YUIQuestion } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Extends an additionalMessages function.
|
|
5
5
|
*
|
package/dist/prompts/helpers.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
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.extendAdditionalMessages = extendAdditionalMessages;
|
|
7
|
-
exports.extendValidate = extendValidate;
|
|
8
|
-
exports.applyExtensionFunction = applyExtensionFunction;
|
|
9
|
-
exports.withCondition = withCondition;
|
|
10
|
-
exports.extendWithOptions = extendWithOptions;
|
|
11
|
-
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
1
|
+
import cloneDeep from 'lodash/cloneDeep.js';
|
|
12
2
|
/**
|
|
13
3
|
* Extends an additionalMessages function.
|
|
14
4
|
*
|
|
@@ -17,12 +7,12 @@ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
|
17
7
|
* @param promptState - the runtime state of the prompts, this can be used to provide additional answers not defined by the prompt answers object
|
|
18
8
|
* @returns the extended additional messages function
|
|
19
9
|
*/
|
|
20
|
-
function extendAdditionalMessages(question, addMsgFunc, promptState) {
|
|
10
|
+
export function extendAdditionalMessages(question, addMsgFunc, promptState) {
|
|
21
11
|
const addMsgs = question.additionalMessages;
|
|
22
12
|
return (value, previousAnswers) => {
|
|
23
13
|
// Allow non-prompt answer (derived answers) values to be passed to the additional messages function
|
|
24
14
|
// We clone as answers should never be mutatable in prompt functions
|
|
25
|
-
const combinedAnswers = { ...(
|
|
15
|
+
const combinedAnswers = { ...cloneDeep(previousAnswers), ...cloneDeep(promptState) };
|
|
26
16
|
const extMsg = addMsgFunc(value, combinedAnswers);
|
|
27
17
|
if (extMsg) {
|
|
28
18
|
return extMsg; // Extended prompt message is returned first
|
|
@@ -39,11 +29,11 @@ function extendAdditionalMessages(question, addMsgFunc, promptState) {
|
|
|
39
29
|
* @param promptState - the runtime state of the prompts, this can be used to provide additional answers not defined by the prompt answers object
|
|
40
30
|
* @returns the extended validate function
|
|
41
31
|
*/
|
|
42
|
-
function extendValidate(question, validateFunc, promptState) {
|
|
32
|
+
export function extendValidate(question, validateFunc, promptState) {
|
|
43
33
|
const validate = question.validate;
|
|
44
34
|
return (value, previousAnswers) => {
|
|
45
35
|
// Allow non-prompt answer (derived answers) values to be passed to the validate function
|
|
46
|
-
const combinedAnswers = { ...(
|
|
36
|
+
const combinedAnswers = { ...cloneDeep(previousAnswers), ...cloneDeep(promptState) };
|
|
47
37
|
const extVal = validateFunc?.(value, combinedAnswers);
|
|
48
38
|
if (extVal !== true) {
|
|
49
39
|
return extVal;
|
|
@@ -60,7 +50,7 @@ function extendValidate(question, validateFunc, promptState) {
|
|
|
60
50
|
* @param promptState - the runtime state of the prompts, this can be used to provide additional answers not defined by the prompt answers object
|
|
61
51
|
* @returns the extended question
|
|
62
52
|
*/
|
|
63
|
-
function applyExtensionFunction(question, promptOption, funcName, promptState) {
|
|
53
|
+
export function applyExtensionFunction(question, promptOption, funcName, promptState) {
|
|
64
54
|
let extendedFunc;
|
|
65
55
|
if (funcName === 'validate' && promptOption.validate) {
|
|
66
56
|
extendedFunc = extendValidate(question, promptOption.validate, promptState);
|
|
@@ -78,7 +68,7 @@ function applyExtensionFunction(question, promptOption, funcName, promptState) {
|
|
|
78
68
|
* @param condition function which returns true or false
|
|
79
69
|
* @returns the passed questions reference
|
|
80
70
|
*/
|
|
81
|
-
function withCondition(questions, condition) {
|
|
71
|
+
export function withCondition(questions, condition) {
|
|
82
72
|
questions.forEach((question) => {
|
|
83
73
|
if (question.when !== undefined) {
|
|
84
74
|
if (typeof question.when === 'function') {
|
|
@@ -113,7 +103,7 @@ function withCondition(questions, condition) {
|
|
|
113
103
|
* @param promptState - the runtime state of the prompts, this can be used to provide additional answers not defined by the prompt answers object
|
|
114
104
|
* @returns - the extended questions
|
|
115
105
|
*/
|
|
116
|
-
function extendWithOptions(questions, promptOptions, promptState) {
|
|
106
|
+
export function extendWithOptions(questions, promptOptions, promptState) {
|
|
117
107
|
questions.forEach((question) => {
|
|
118
108
|
const promptOptKey = question.name;
|
|
119
109
|
const promptOpt = promptOptions[question.name];
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Separator = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import figures from 'figures';
|
|
9
3
|
/**
|
|
10
4
|
* Separator object. This is a copy of `inquirer@8.2.6` Separator class. Since this is the only implementation needed
|
|
11
5
|
* from `inquirer` we have implemented our own to avoid a heavy dependency.
|
|
@@ -15,7 +9,7 @@ const figures_1 = __importDefault(require("figures"));
|
|
|
15
9
|
* @class
|
|
16
10
|
* @param {string} line Separation line content (facultative)
|
|
17
11
|
*/
|
|
18
|
-
class Separator {
|
|
12
|
+
export class Separator {
|
|
19
13
|
type;
|
|
20
14
|
line;
|
|
21
15
|
/**
|
|
@@ -25,7 +19,7 @@ class Separator {
|
|
|
25
19
|
*/
|
|
26
20
|
constructor(line) {
|
|
27
21
|
this.type = 'separator';
|
|
28
|
-
this.line =
|
|
22
|
+
this.line = chalk.dim(line || new Array(15).join(figures.line));
|
|
29
23
|
}
|
|
30
24
|
/**
|
|
31
25
|
* Stringify separator.
|
|
@@ -46,5 +40,4 @@ class Separator {
|
|
|
46
40
|
return obj.type !== 'separator';
|
|
47
41
|
}
|
|
48
42
|
}
|
|
49
|
-
exports.Separator = Separator;
|
|
50
43
|
//# sourceMappingURL=separator.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UI5Version } from '@sap-ux/ui5-info';
|
|
2
2
|
import type { ListChoiceOptions } from 'inquirer';
|
|
3
|
-
import type { UI5VersionChoice } from '../types';
|
|
4
|
-
import { Separator } from './separator';
|
|
3
|
+
import type { UI5VersionChoice } from '../types.js';
|
|
4
|
+
import { Separator } from './separator.js';
|
|
5
5
|
/**
|
|
6
6
|
* Get the UI5 themes as prompt choices applicable for the specified UI5 version.
|
|
7
7
|
*
|
package/dist/prompts/utility.js
CHANGED
|
@@ -1,55 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.getUI5ThemesChoices = getUI5ThemesChoices;
|
|
37
|
-
exports.searchChoices = searchChoices;
|
|
38
|
-
exports.ui5VersionsGrouped = ui5VersionsGrouped;
|
|
39
|
-
exports.getDefaultUI5VersionChoice = getDefaultUI5VersionChoice;
|
|
40
|
-
const ui5_info_1 = require("@sap-ux/ui5-info");
|
|
41
|
-
const fuzzy = __importStar(require("fuzzy"));
|
|
42
|
-
const semver_1 = require("semver");
|
|
43
|
-
const i18n_1 = require("../i18n");
|
|
44
|
-
const separator_1 = require("./separator");
|
|
1
|
+
import { getUi5Themes } from '@sap-ux/ui5-info';
|
|
2
|
+
import fuzzy from 'fuzzy';
|
|
3
|
+
import { coerce, eq, lte } from 'semver';
|
|
4
|
+
import { t } from '../i18n.js';
|
|
5
|
+
import { Separator } from './separator.js';
|
|
45
6
|
/**
|
|
46
7
|
* Get the UI5 themes as prompt choices applicable for the specified UI5 version.
|
|
47
8
|
*
|
|
48
9
|
* @param ui5Version - UI5 semantic version
|
|
49
10
|
* @returns UI5 themes as list choice options
|
|
50
11
|
*/
|
|
51
|
-
async function getUI5ThemesChoices(ui5Version) {
|
|
52
|
-
const themes = await
|
|
12
|
+
export async function getUI5ThemesChoices(ui5Version) {
|
|
13
|
+
const themes = await getUi5Themes(ui5Version);
|
|
53
14
|
return themes.map((theme) => ({
|
|
54
15
|
name: theme.label,
|
|
55
16
|
value: theme.id
|
|
@@ -62,7 +23,7 @@ async function getUI5ThemesChoices(ui5Version) {
|
|
|
62
23
|
* @param searchList - the list in which to search by fuzzy matching the choice name
|
|
63
24
|
* @returns Inquirer choices filtered by the search value
|
|
64
25
|
*/
|
|
65
|
-
function searchChoices(searchVal, searchList) {
|
|
26
|
+
export function searchChoices(searchVal, searchList) {
|
|
66
27
|
return searchVal && searchList
|
|
67
28
|
? fuzzy
|
|
68
29
|
.filter(searchVal, searchList, {
|
|
@@ -82,7 +43,7 @@ function searchChoices(searchVal, searchList) {
|
|
|
82
43
|
* @param useDefaultChoiceLabel - optional, if true the specified `defaultChoice` label will replace the `maintained` label. e.g. when `source system version` has been appended
|
|
83
44
|
* @returns Array of ui5 version choices and separators if applicable, grouped by maintenance state
|
|
84
45
|
*/
|
|
85
|
-
function ui5VersionsGrouped(versions, includeSeparators = false, defaultChoice, useDefaultChoiceLabel = false) {
|
|
46
|
+
export function ui5VersionsGrouped(versions, includeSeparators = false, defaultChoice, useDefaultChoiceLabel = false) {
|
|
86
47
|
if (!versions || (Array.isArray(versions) && versions.length === 0)) {
|
|
87
48
|
return [];
|
|
88
49
|
}
|
|
@@ -90,7 +51,7 @@ function ui5VersionsGrouped(versions, includeSeparators = false, defaultChoice,
|
|
|
90
51
|
.filter((v) => v.maintained === true)
|
|
91
52
|
.map((mainV) => ({
|
|
92
53
|
name: !includeSeparators
|
|
93
|
-
? `${mainV.version} - (${
|
|
54
|
+
? `${mainV.version} - (${t('ui5VersionLabels.maintained')} ${t('ui5VersionLabels.version', {
|
|
94
55
|
count: 1
|
|
95
56
|
})})`
|
|
96
57
|
: mainV.version,
|
|
@@ -100,13 +61,13 @@ function ui5VersionsGrouped(versions, includeSeparators = false, defaultChoice,
|
|
|
100
61
|
.filter((v) => v.maintained === false)
|
|
101
62
|
.map((mainV) => ({
|
|
102
63
|
name: !includeSeparators
|
|
103
|
-
? `${mainV.version} - (${
|
|
64
|
+
? `${mainV.version} - (${t('ui5VersionLabels.outOfMaintenance')} ${t('ui5VersionLabels.version', { count: 1 })})`
|
|
104
65
|
: mainV.version,
|
|
105
66
|
value: mainV.version
|
|
106
67
|
}));
|
|
107
68
|
if (includeSeparators) {
|
|
108
|
-
maintChoices.unshift(new
|
|
109
|
-
notMaintChoices.unshift(new
|
|
69
|
+
maintChoices.unshift(new Separator(`${t('ui5VersionLabels.maintained')} ${t('ui5VersionLabels.version', { count: 0 })}`));
|
|
70
|
+
notMaintChoices.unshift(new Separator(`${t('ui5VersionLabels.outOfMaintenance')} ${t('ui5VersionLabels.version', { count: 0 })}`));
|
|
110
71
|
}
|
|
111
72
|
const versionChoices = [...maintChoices, ...notMaintChoices];
|
|
112
73
|
if (defaultChoice) {
|
|
@@ -133,7 +94,7 @@ function ui5VersionsGrouped(versions, includeSeparators = false, defaultChoice,
|
|
|
133
94
|
function findDefaultUI5Version(ui5Versions, useClosestVersion, defaultChoiceVersion) {
|
|
134
95
|
let version;
|
|
135
96
|
if (useClosestVersion) {
|
|
136
|
-
version = ui5Versions.find((ui5Ver) =>
|
|
97
|
+
version = ui5Versions.find((ui5Ver) => lte(ui5Ver.version, defaultChoiceVersion));
|
|
137
98
|
}
|
|
138
99
|
else {
|
|
139
100
|
version = {
|
|
@@ -151,19 +112,19 @@ function findDefaultUI5Version(ui5Versions, useClosestVersion, defaultChoiceVers
|
|
|
151
112
|
* @param defaultChoice - optional default choice to be used
|
|
152
113
|
* @returns The default UI5 version choice or the latest provided version
|
|
153
114
|
*/
|
|
154
|
-
function getDefaultUI5VersionChoice(ui5Versions, defaultChoice) {
|
|
115
|
+
export function getDefaultUI5VersionChoice(ui5Versions, defaultChoice) {
|
|
155
116
|
let useClosestVersion = false;
|
|
156
117
|
if (defaultChoice) {
|
|
157
118
|
if (defaultChoice.value.toLowerCase().endsWith('snapshot')) {
|
|
158
119
|
useClosestVersion = true;
|
|
159
120
|
}
|
|
160
|
-
const defaultChoiceVersion =
|
|
121
|
+
const defaultChoiceVersion = coerce(defaultChoice.value);
|
|
161
122
|
if (defaultChoiceVersion !== null) {
|
|
162
123
|
const version = findDefaultUI5Version(ui5Versions, useClosestVersion, defaultChoiceVersion);
|
|
163
124
|
if (version) {
|
|
164
125
|
// if the versions are an exact match use the name (UI label) from the default choice as this may use a custom name
|
|
165
126
|
return {
|
|
166
|
-
name:
|
|
127
|
+
name: eq(version.version, defaultChoice.value) ? defaultChoice.name : version.version,
|
|
167
128
|
value: version.version
|
|
168
129
|
};
|
|
169
130
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Destination } from '@sap-ux/btp-utils';
|
|
2
2
|
import type { TelemetryProperties, ToolsSuiteTelemetryClient } from '@sap-ux/telemetry';
|
|
3
|
-
import type { TelemPropertyDestinationType } from '../types';
|
|
3
|
+
import type { TelemPropertyDestinationType } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Set the telemetry client for use with sending telemetry events.
|
|
6
6
|
*
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setTelemetryClient = setTelemetryClient;
|
|
7
|
-
exports.getTelemetryClient = getTelemetryClient;
|
|
8
|
-
exports.sendTelemetryEvent = sendTelemetryEvent;
|
|
9
|
-
exports.getTelemPropertyDestinationType = getTelemPropertyDestinationType;
|
|
10
|
-
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
11
|
-
const telemetry_1 = require("@sap-ux/telemetry");
|
|
12
|
-
const os_name_1 = __importDefault(require("os-name"));
|
|
13
|
-
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
1
|
+
import { isAbapODataDestination, isFullUrlDestination, isPartialUrlDestination } from '@sap-ux/btp-utils';
|
|
2
|
+
import { SampleRate } from '@sap-ux/telemetry';
|
|
3
|
+
import osName from 'os-name';
|
|
4
|
+
import { getHostEnvironment } from '@sap-ux/fiori-generator-shared';
|
|
14
5
|
let telemetryClient;
|
|
15
6
|
// cached os name to avoid multiple calls to os-name
|
|
16
7
|
let osVersionName;
|
|
@@ -19,7 +10,7 @@ let osVersionName;
|
|
|
19
10
|
*
|
|
20
11
|
* @param toolsSuiteTelemetryClient the telemetry client instance to use when sending telemetry events
|
|
21
12
|
*/
|
|
22
|
-
function setTelemetryClient(toolsSuiteTelemetryClient) {
|
|
13
|
+
export function setTelemetryClient(toolsSuiteTelemetryClient) {
|
|
23
14
|
telemetryClient = toolsSuiteTelemetryClient;
|
|
24
15
|
}
|
|
25
16
|
/**
|
|
@@ -27,7 +18,7 @@ function setTelemetryClient(toolsSuiteTelemetryClient) {
|
|
|
27
18
|
*
|
|
28
19
|
* @returns the telemetry client instance if previously set.
|
|
29
20
|
*/
|
|
30
|
-
function getTelemetryClient() {
|
|
21
|
+
export function getTelemetryClient() {
|
|
31
22
|
return telemetryClient;
|
|
32
23
|
}
|
|
33
24
|
/**
|
|
@@ -36,12 +27,12 @@ function getTelemetryClient() {
|
|
|
36
27
|
* @param eventName the name of the telemetry event
|
|
37
28
|
* @param telemetryData the telemetry values to report
|
|
38
29
|
*/
|
|
39
|
-
function sendTelemetryEvent(eventName, telemetryData) {
|
|
30
|
+
export function sendTelemetryEvent(eventName, telemetryData) {
|
|
40
31
|
const telemetryEvent = createTelemetryEvent(eventName, telemetryData);
|
|
41
32
|
if (telemetryClient) {
|
|
42
33
|
// Do not wait for the telemetry event to be sent, it cannot be recovered if it fails, do not block the process
|
|
43
34
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
|
44
|
-
telemetryClient.reportEvent(telemetryEvent,
|
|
35
|
+
telemetryClient.reportEvent(telemetryEvent, SampleRate.NoSampling);
|
|
45
36
|
}
|
|
46
37
|
}
|
|
47
38
|
/**
|
|
@@ -52,10 +43,10 @@ function sendTelemetryEvent(eventName, telemetryData) {
|
|
|
52
43
|
* @returns the telemetry event
|
|
53
44
|
*/
|
|
54
45
|
function createTelemetryEvent(eventName, telemetryData) {
|
|
55
|
-
osVersionName = osVersionName ?? (
|
|
46
|
+
osVersionName = osVersionName ?? osName(); // cache the os name
|
|
56
47
|
const telemProps = Object.assign(telemetryData, {
|
|
57
48
|
OperatingSystem: osVersionName,
|
|
58
|
-
Platform: telemetryData.Platform ||
|
|
49
|
+
Platform: telemetryData.Platform || getHostEnvironment().technical
|
|
59
50
|
});
|
|
60
51
|
return {
|
|
61
52
|
eventName,
|
|
@@ -69,14 +60,14 @@ function createTelemetryEvent(eventName, telemetryData) {
|
|
|
69
60
|
* @param destination the destination used to set the telemetry destination type
|
|
70
61
|
* @returns the telemetry property destination type
|
|
71
62
|
*/
|
|
72
|
-
function getTelemPropertyDestinationType(destination) {
|
|
73
|
-
if (
|
|
63
|
+
export function getTelemPropertyDestinationType(destination) {
|
|
64
|
+
if (isAbapODataDestination(destination)) {
|
|
74
65
|
return 'AbapODataCatalogDest';
|
|
75
66
|
}
|
|
76
|
-
else if (
|
|
67
|
+
else if (isFullUrlDestination(destination)) {
|
|
77
68
|
return 'GenericODataFullUrlDest';
|
|
78
69
|
}
|
|
79
|
-
else if (
|
|
70
|
+
else if (isPartialUrlDestination(destination)) {
|
|
80
71
|
return 'GenericODataPartialUrlDest';
|
|
81
72
|
}
|
|
82
73
|
else {
|
package/dist/types.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidationLink = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Implementation of IValidationLink interface.
|
|
6
3
|
* Provides a toString() for serialization on CLI since IValidationLink rendering is only supported by YeomanUI.
|
|
7
4
|
*/
|
|
8
|
-
class ValidationLink {
|
|
5
|
+
export class ValidationLink {
|
|
9
6
|
// Having to redeclare properties from an interface should not be required see: https://github.com/Microsoft/TypeScript/issues/5326
|
|
10
7
|
message;
|
|
11
8
|
link;
|
|
@@ -26,5 +23,4 @@ class ValidationLink {
|
|
|
26
23
|
return `${this.message} ${this.link.text}${this.link.url ? ' : ' + this.link.url : ''}`;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
exports.ValidationLink = ValidationLink;
|
|
30
26
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/inquirer-common",
|
|
3
3
|
"description": "Commonly used shared functionality and types to support inquirer modules.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Ainquirer-common"
|
|
12
12
|
},
|
|
13
|
+
"type": "module",
|
|
13
14
|
"license": "Apache-2.0",
|
|
14
15
|
"main": "dist/index.js",
|
|
15
16
|
"files": [
|
|
@@ -23,24 +24,25 @@
|
|
|
23
24
|
"@sap-ux/annotation-converter": "0.10.21",
|
|
24
25
|
"@sap-ux/edmx-parser": "0.10.0",
|
|
25
26
|
"axios": "1.16.0",
|
|
26
|
-
"chalk": "
|
|
27
|
+
"chalk": "5.3.0",
|
|
27
28
|
"figures": "3.2.0",
|
|
28
29
|
"fuzzy": "0.1.3",
|
|
29
30
|
"i18next": "25.10.10",
|
|
30
31
|
"lodash": "4.18.1",
|
|
31
32
|
"os-name": "4.0.1",
|
|
32
33
|
"semver": "7.7.4",
|
|
33
|
-
"@sap-ux/btp-utils": "
|
|
34
|
-
"@sap-ux/feature-toggle": "0.
|
|
35
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
36
|
-
"@sap-ux/guided-answers-helper": "0.
|
|
37
|
-
"@sap-ux/telemetry": "0.
|
|
38
|
-
"@sap-ux/logger": "0.
|
|
39
|
-
"@sap-ux/project-access": "
|
|
40
|
-
"@sap-ux/odata-service-writer": "0.
|
|
41
|
-
"@sap-ux/ui5-info": "0.
|
|
34
|
+
"@sap-ux/btp-utils": "2.0.0",
|
|
35
|
+
"@sap-ux/feature-toggle": "1.0.0",
|
|
36
|
+
"@sap-ux/fiori-generator-shared": "1.0.1",
|
|
37
|
+
"@sap-ux/guided-answers-helper": "1.0.0",
|
|
38
|
+
"@sap-ux/telemetry": "1.0.1",
|
|
39
|
+
"@sap-ux/logger": "1.0.0",
|
|
40
|
+
"@sap-ux/project-access": "2.0.1",
|
|
41
|
+
"@sap-ux/odata-service-writer": "1.0.1",
|
|
42
|
+
"@sap-ux/ui5-info": "1.0.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
45
|
+
"@jest/globals": "30.3.0",
|
|
44
46
|
"@sap-ux/vocabularies-types": "0.15.0",
|
|
45
47
|
"@sap-devx/yeoman-ui-types": "1.25.0",
|
|
46
48
|
"@types/inquirer": "8.2.6",
|
|
@@ -57,8 +59,8 @@
|
|
|
57
59
|
"watch": "tsc --watch",
|
|
58
60
|
"lint": "eslint",
|
|
59
61
|
"lint:fix": "eslint --fix",
|
|
60
|
-
"test": "jest --ci --forceExit --detectOpenHandles --colors",
|
|
61
|
-
"test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
62
|
+
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
|
|
63
|
+
"test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
62
64
|
"link": "pnpm link --global",
|
|
63
65
|
"unlink": "pnpm unlink --global"
|
|
64
66
|
}
|