@sap-ux/odata-service-inquirer 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +87 -0
- package/dist/error-handler/error-handler.d.ts +176 -0
- package/dist/error-handler/error-handler.js +450 -0
- package/dist/error-handler/help/help-topics.d.ts +37 -0
- package/dist/error-handler/help/help-topics.js +40 -0
- package/dist/error-handler/help/images/guidedAnswersIcon_svg_base64.d.ts +2 -0
- package/dist/error-handler/help/images/guidedAnswersIcon_svg_base64.js +5 -0
- package/dist/error-handler/help/images/index.d.ts +2 -0
- package/dist/error-handler/help/images/index.js +18 -0
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.js +50 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +73 -0
- package/dist/prompts/datasources/cap-project/cap-helpers.d.ts +26 -0
- package/dist/prompts/datasources/cap-project/cap-helpers.js +215 -0
- package/dist/prompts/datasources/cap-project/questions.d.ts +14 -0
- package/dist/prompts/datasources/cap-project/questions.js +172 -0
- package/dist/prompts/datasources/cap-project/types.d.ts +27 -0
- package/dist/prompts/datasources/cap-project/types.js +12 -0
- package/dist/prompts/datasources/cap-project/validators.d.ts +8 -0
- package/dist/prompts/datasources/cap-project/validators.js +35 -0
- package/dist/prompts/datasources/metadata-file/index.d.ts +10 -0
- package/dist/prompts/datasources/metadata-file/index.js +47 -0
- package/dist/prompts/datasources/metadata-file/validators.d.ts +13 -0
- package/dist/prompts/datasources/metadata-file/validators.js +45 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.js +18 -0
- package/dist/prompts/logger-helper.d.ts +20 -0
- package/dist/prompts/logger-helper.js +27 -0
- package/dist/prompts/prompt-helpers.d.ts +14 -0
- package/dist/prompts/prompt-helpers.js +44 -0
- package/dist/prompts/prompts.d.ts +9 -0
- package/dist/prompts/prompts.js +98 -0
- package/dist/prompts/validators.d.ts +13 -0
- package/dist/prompts/validators.js +45 -0
- package/dist/translations/odata-service-inquirer.i18n.json +88 -0
- package/dist/types.d.ts +176 -0
- package/dist/types.js +76 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.js +70 -0
- package/dist/utils/prompt-state.d.ts +13 -0
- package/dist/utils/prompt-state.js +18 -0
- package/package.json +55 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorHandler = exports.ERROR_MAP = exports.ERROR_TYPE = void 0;
|
|
4
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
|
+
const logger_1 = require("@sap-ux/logger");
|
|
6
|
+
const i18n_1 = require("../i18n");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const help_topics_1 = require("./help/help-topics");
|
|
10
|
+
const images_1 = require("./help/images");
|
|
11
|
+
const teleEventGALinkCreated = 'GA_LINK_CREATED';
|
|
12
|
+
/**
|
|
13
|
+
* Constants specific to error handling
|
|
14
|
+
*/
|
|
15
|
+
var ERROR_TYPE;
|
|
16
|
+
(function (ERROR_TYPE) {
|
|
17
|
+
ERROR_TYPE["AUTH"] = "AUTH";
|
|
18
|
+
ERROR_TYPE["AUTH_TIMEOUT"] = "AUTH_TIMEOUT";
|
|
19
|
+
ERROR_TYPE["REDIRECT"] = "REDIRECT";
|
|
20
|
+
ERROR_TYPE["CERT"] = "CERT";
|
|
21
|
+
ERROR_TYPE["CERT_SELF_SIGNED"] = "CERT_SELF_SIGNED";
|
|
22
|
+
ERROR_TYPE["CERT_UKNOWN_OR_INVALID"] = "CERT_UKNOWN_OR_INVALID";
|
|
23
|
+
ERROR_TYPE["CERT_EXPIRED"] = "CERT_EXPIRED";
|
|
24
|
+
ERROR_TYPE["CERT_SELF_SIGNED_CERT_IN_CHAIN"] = "CERT_SELF_SIGNED_CERT_IN_CHAIN";
|
|
25
|
+
ERROR_TYPE["UNKNOWN"] = "UNKNOWN";
|
|
26
|
+
ERROR_TYPE["INVALID_URL"] = "INVALID_URL";
|
|
27
|
+
ERROR_TYPE["CONNECTION"] = "CONNECTION";
|
|
28
|
+
ERROR_TYPE["SERVICES_UNAVAILABLE"] = "SERVICES_UNAVAILABLE";
|
|
29
|
+
ERROR_TYPE["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
|
|
30
|
+
ERROR_TYPE["NO_ABAP_ENVS"] = "NO_ABAP_ENVS";
|
|
31
|
+
ERROR_TYPE["CATALOG_SERVICE_NOT_ACTIVE"] = "CATALOG_SERVICE_NOT_ACTIVE";
|
|
32
|
+
ERROR_TYPE["NO_SUCH_HOST"] = "NO_SUCH_HOST";
|
|
33
|
+
ERROR_TYPE["NOT_FOUND"] = "NOT_FOUND";
|
|
34
|
+
ERROR_TYPE["ODATA_URL_NOT_FOUND"] = "ODATA_URL_NOT_FOUND";
|
|
35
|
+
ERROR_TYPE["BAD_GATEWAY"] = "BAD_GATEWAY";
|
|
36
|
+
ERROR_TYPE["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
|
|
37
|
+
ERROR_TYPE["DESTINATION_BAD_GATEWAY_503"] = "DESTINATION_BAD_GATEWAY_503";
|
|
38
|
+
ERROR_TYPE["DESTINATION_UNAVAILABLE"] = "DESTINATION_UNAVAILABLE";
|
|
39
|
+
ERROR_TYPE["DESTINATION_NOT_FOUND"] = "DESTINATION_NOT_FOUND";
|
|
40
|
+
ERROR_TYPE["DESTINATION_MISCONFIGURED"] = "DESTINATION_MISCONFIGURED";
|
|
41
|
+
ERROR_TYPE["NO_V2_SERVICES"] = "NO_V2_SERVICES";
|
|
42
|
+
ERROR_TYPE["NO_V4_SERVICES"] = "NO_V4_SERVICES";
|
|
43
|
+
})(ERROR_TYPE || (exports.ERROR_TYPE = ERROR_TYPE = {}));
|
|
44
|
+
// Used to match regex expressions to error messages, etc. providing a way to return a consistent
|
|
45
|
+
// single error and error msg for multiple errors
|
|
46
|
+
exports.ERROR_MAP = {
|
|
47
|
+
[ERROR_TYPE.AUTH]: [
|
|
48
|
+
/401/,
|
|
49
|
+
/403/,
|
|
50
|
+
/Incorrect credentials were provided to login/, // API Hub error msg
|
|
51
|
+
/Unable to retrieve SAP Business Accelerator Hub key/ // API Hub error msg
|
|
52
|
+
],
|
|
53
|
+
[ERROR_TYPE.AUTH_TIMEOUT]: [/UAATimeoutError/],
|
|
54
|
+
[ERROR_TYPE.CERT]: [], // General cert error, unspecified root cause
|
|
55
|
+
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: [
|
|
56
|
+
/UNABLE_TO_GET_ISSUER_CERT/,
|
|
57
|
+
/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,
|
|
58
|
+
/unable to get local issuer certificate/
|
|
59
|
+
],
|
|
60
|
+
[ERROR_TYPE.CERT_EXPIRED]: [/CERT_HAS_EXPIRED/],
|
|
61
|
+
[ERROR_TYPE.CERT_SELF_SIGNED]: [/DEPTH_ZERO_SELF_SIGNED_CERT/],
|
|
62
|
+
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: [/SELF_SIGNED_CERT_IN_CHAIN/],
|
|
63
|
+
[ERROR_TYPE.UNKNOWN]: [],
|
|
64
|
+
[ERROR_TYPE.CONNECTION]: [/ENOTFOUND/, /ECONNRESET/, /ECONNREFUSED/],
|
|
65
|
+
[ERROR_TYPE.SERVICES_UNAVAILABLE]: [],
|
|
66
|
+
[ERROR_TYPE.SERVICE_UNAVAILABLE]: [/503/],
|
|
67
|
+
[ERROR_TYPE.INVALID_URL]: [/Invalid URL/, /ERR_INVALID_URL/],
|
|
68
|
+
[ERROR_TYPE.REDIRECT]: [/3[\d][\d]/],
|
|
69
|
+
[ERROR_TYPE.NO_ABAP_ENVS]: [],
|
|
70
|
+
[ERROR_TYPE.CATALOG_SERVICE_NOT_ACTIVE]: [
|
|
71
|
+
/\/IWBEP\/CM_V4_COS\/014/,
|
|
72
|
+
/\/IWFND\/CM_V4_COS\/021/,
|
|
73
|
+
/Service group '\/IWFND\/CONFIG' not published/
|
|
74
|
+
],
|
|
75
|
+
[ERROR_TYPE.NO_SUCH_HOST]: [/no such host/],
|
|
76
|
+
[ERROR_TYPE.NOT_FOUND]: [/404/],
|
|
77
|
+
[ERROR_TYPE.ODATA_URL_NOT_FOUND]: [],
|
|
78
|
+
[ERROR_TYPE.INTERNAL_SERVER_ERROR]: [/500/],
|
|
79
|
+
[ERROR_TYPE.BAD_GATEWAY]: [/502/],
|
|
80
|
+
[ERROR_TYPE.DESTINATION_BAD_GATEWAY_503]: [],
|
|
81
|
+
[ERROR_TYPE.DESTINATION_UNAVAILABLE]: [],
|
|
82
|
+
[ERROR_TYPE.DESTINATION_NOT_FOUND]: [],
|
|
83
|
+
[ERROR_TYPE.DESTINATION_MISCONFIGURED]: [],
|
|
84
|
+
[ERROR_TYPE.NO_V2_SERVICES]: [],
|
|
85
|
+
[ERROR_TYPE.NO_V4_SERVICES]: []
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Maps errors to end-user messages using some basic root cause analysis based on regex matching.
|
|
89
|
+
* This class will also log errors and provide help links for validation errors in some limited use cases.
|
|
90
|
+
*/
|
|
91
|
+
class ErrorHandler {
|
|
92
|
+
/**
|
|
93
|
+
* Create an instance of the ErrorHandler.
|
|
94
|
+
*
|
|
95
|
+
* @param logger the logger instance to use
|
|
96
|
+
* @param enableGuidedAnswers if true, the end user validation errors will include guided answers to provide help
|
|
97
|
+
*/
|
|
98
|
+
constructor(logger, enableGuidedAnswers = false) {
|
|
99
|
+
ErrorHandler._logger = logger !== null && logger !== void 0 ? logger : new logger_1.ToolsLogger({ logPrefix: '@sap-ux/odata-service-inquirer' });
|
|
100
|
+
ErrorHandler.guidedAnswersEnabled = enableGuidedAnswers;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get Guided Answers (context help) enabled value.
|
|
104
|
+
*
|
|
105
|
+
* @returns true if Guided Answers is enabled
|
|
106
|
+
*/
|
|
107
|
+
static get guidedAnswersEnabled() {
|
|
108
|
+
return ErrorHandler._guidedAnswersEnabled;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Toggle Guided Answers (context help) for validation errors.
|
|
112
|
+
*/
|
|
113
|
+
static set guidedAnswersEnabled(value) {
|
|
114
|
+
ErrorHandler._guidedAnswersEnabled = value;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Set the logger to be used for error messages.
|
|
118
|
+
*
|
|
119
|
+
* @param logger the logger instance to use
|
|
120
|
+
*/
|
|
121
|
+
static set logger(logger) {
|
|
122
|
+
ErrorHandler._logger = logger;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the logger used for error messages.
|
|
126
|
+
*
|
|
127
|
+
* @returns the logger instance
|
|
128
|
+
*/
|
|
129
|
+
static get logger() {
|
|
130
|
+
return ErrorHandler._logger;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Tests if the error is a general certificate error.
|
|
134
|
+
*
|
|
135
|
+
* @param status the error type
|
|
136
|
+
* @returns true if the error is a general certificate error
|
|
137
|
+
*/
|
|
138
|
+
static isCertError(status) {
|
|
139
|
+
return [
|
|
140
|
+
ERROR_TYPE.CERT,
|
|
141
|
+
ERROR_TYPE.CERT_EXPIRED,
|
|
142
|
+
ERROR_TYPE.CERT_SELF_SIGNED,
|
|
143
|
+
ERROR_TYPE.CERT_UKNOWN_OR_INVALID,
|
|
144
|
+
ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN
|
|
145
|
+
].includes(ErrorHandler.getErrorType(status));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the error type for the specified error, mapping status code, error code, error name, error message to a few general error types.
|
|
149
|
+
*
|
|
150
|
+
* @param error the error, string or status code to get the type for
|
|
151
|
+
* @returns the error type
|
|
152
|
+
*/
|
|
153
|
+
static getErrorType(error) {
|
|
154
|
+
return Object.keys(ERROR_TYPE).find((errorCodeType) => {
|
|
155
|
+
return exports.ERROR_MAP[errorCodeType].find((exp) => exp.test(error.toString()));
|
|
156
|
+
}, {});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Maps errors to a few generic types, log a detailed error.
|
|
160
|
+
*
|
|
161
|
+
* @param error If the error is a string this will be logged as is. Otherwise it will be mapped to a general error internally, possibly retained and logged.
|
|
162
|
+
* @param userMsg If provided this will be set as the userErrorMsg instead of an error to msg map
|
|
163
|
+
* this allows a message more relevant to the context of where the error was generated to be used.
|
|
164
|
+
* @param retainError Defaults to true to retain the error state.
|
|
165
|
+
* @returns A user-friendly message for display in-line
|
|
166
|
+
*/
|
|
167
|
+
logErrorMsgs(error, userMsg, retainError = true) {
|
|
168
|
+
var _a;
|
|
169
|
+
let resolvedError = {
|
|
170
|
+
errorMsg: '',
|
|
171
|
+
errorType: ERROR_TYPE.UNKNOWN
|
|
172
|
+
};
|
|
173
|
+
// Overloaded to allow ERROR_TYPE for convenience
|
|
174
|
+
if (Object.values(ERROR_TYPE).includes(error)) {
|
|
175
|
+
const errorType = error;
|
|
176
|
+
resolvedError.errorMsg = (_a = ErrorHandler.getErrorMsgFromType(errorType)) !== null && _a !== void 0 ? _a : errorType.toString();
|
|
177
|
+
resolvedError.errorType = errorType;
|
|
178
|
+
}
|
|
179
|
+
else if (typeof error === 'string') {
|
|
180
|
+
resolvedError.errorMsg = error;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
resolvedError = ErrorHandler.mapErrorToMsg(error);
|
|
184
|
+
}
|
|
185
|
+
ErrorHandler._logger.error(userMsg ? `${userMsg} ${resolvedError.errorMsg}` : resolvedError.errorMsg);
|
|
186
|
+
if (retainError) {
|
|
187
|
+
this.currentErrorMsg = userMsg !== null && userMsg !== void 0 ? userMsg : resolvedError.errorMsg;
|
|
188
|
+
this.currentErrorType = resolvedError.errorType;
|
|
189
|
+
}
|
|
190
|
+
return resolvedError.errorMsg;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Maps an error to a user-friendly message. The specified error may by a string (e.g. error message), number (e.g. status code), Error, or Axios error.
|
|
194
|
+
*
|
|
195
|
+
* @param error The error to map
|
|
196
|
+
* @returns The mapped error message and error type
|
|
197
|
+
*/
|
|
198
|
+
static mapErrorToMsg(error) {
|
|
199
|
+
var _a, _b, _c, _d, _e, _f;
|
|
200
|
+
let errorType;
|
|
201
|
+
if (Object.values(ERROR_TYPE).includes(error)) {
|
|
202
|
+
errorType = error;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
// Map error type using more to less specific information if available
|
|
206
|
+
errorType =
|
|
207
|
+
(_f = ErrorHandler.getErrorType(((_c = (_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) ||
|
|
208
|
+
((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) ||
|
|
209
|
+
((_e = error.response) === null || _e === void 0 ? void 0 : _e.data) ||
|
|
210
|
+
error.code ||
|
|
211
|
+
(['TypeError', 'Error'].includes(error.name) ? error.message : error.name) || // For generic error types use the message otherwise the name is more relevant
|
|
212
|
+
error.message ||
|
|
213
|
+
error)) !== null && _f !== void 0 ? _f : ERROR_TYPE.UNKNOWN;
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
errorMsg: ErrorHandler._errorMsg(error)[errorType],
|
|
217
|
+
errorType
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Used by validate functions to report in-line user friendly errors.
|
|
222
|
+
* Checks if there is an existing error.
|
|
223
|
+
*
|
|
224
|
+
* @param error optional, if provided get the end user message that it maps to, otherwise get the previous error message
|
|
225
|
+
* @param reset optional, resets the previous error state if true
|
|
226
|
+
* @param fallback optional, return the message of the specified ERROR_TYPE if no previous end user message and no error specified
|
|
227
|
+
* @returns The error message
|
|
228
|
+
*/
|
|
229
|
+
getErrorMsg(error, reset, fallback) {
|
|
230
|
+
var _a;
|
|
231
|
+
let errorMsg;
|
|
232
|
+
if (error) {
|
|
233
|
+
errorMsg = ErrorHandler.mapErrorToMsg(error).errorMsg;
|
|
234
|
+
}
|
|
235
|
+
// Get previous error message
|
|
236
|
+
if (!errorMsg) {
|
|
237
|
+
errorMsg = (_a = this.currentErrorMsg) !== null && _a !== void 0 ? _a : (fallback ? ErrorHandler.getErrorMsgFromType(fallback) : undefined);
|
|
238
|
+
}
|
|
239
|
+
if (reset) {
|
|
240
|
+
this.currentErrorMsg = null;
|
|
241
|
+
this.currentErrorType = null;
|
|
242
|
+
}
|
|
243
|
+
return errorMsg;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Used by validate functions to report in-line user friendly errors messages with help links.
|
|
247
|
+
* If the error type is unknown, this will find a mapped error type and return the help (ValidationLink) if it exists.
|
|
248
|
+
* If an error is not provided the current error state will be used. This does not log the message to the console.
|
|
249
|
+
*
|
|
250
|
+
* @param error optional, if provided get the help link message that it maps to, otherwise get the previously logged error message help link
|
|
251
|
+
* @param reset optional, resets the previous error state if true
|
|
252
|
+
* @returns An instance of @see {ValidationLink}
|
|
253
|
+
*/
|
|
254
|
+
getValidationErrorHelp(error, reset = false) {
|
|
255
|
+
var _a;
|
|
256
|
+
let errorHelp;
|
|
257
|
+
let errorMsg;
|
|
258
|
+
if (error) {
|
|
259
|
+
const resolvedError = ErrorHandler.mapErrorToMsg(error);
|
|
260
|
+
if (resolvedError.errorType !== ERROR_TYPE.UNKNOWN) {
|
|
261
|
+
errorHelp = ErrorHandler.getHelpForError(resolvedError.errorType, resolvedError.errorMsg);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else if (!error) {
|
|
265
|
+
errorMsg = (_a = this.currentErrorMsg) !== null && _a !== void 0 ? _a : '';
|
|
266
|
+
if (this.currentErrorType) {
|
|
267
|
+
errorHelp = ErrorHandler.getHelpForError(this.currentErrorType, errorMsg);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (reset) {
|
|
271
|
+
this.currentErrorMsg = null;
|
|
272
|
+
this.currentErrorType = null;
|
|
273
|
+
}
|
|
274
|
+
return errorHelp !== null && errorHelp !== void 0 ? errorHelp : errorMsg;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get the error message for the specified error type.
|
|
278
|
+
*
|
|
279
|
+
* @param errorType The error type for which the message may be returned
|
|
280
|
+
* @param error optional, if provided may be used to get generate a more specific error message, or be included in the message
|
|
281
|
+
* @returns The error message for the specified error type
|
|
282
|
+
*/
|
|
283
|
+
static getErrorMsgFromType(errorType, error) {
|
|
284
|
+
if (ERROR_TYPE[errorType]) {
|
|
285
|
+
return ErrorHandler._errorMsg(error)[ERROR_TYPE[errorType]];
|
|
286
|
+
}
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Checks if there is an existing error.
|
|
291
|
+
*
|
|
292
|
+
* @param reset - resets the current error state
|
|
293
|
+
* @returns true if there is an existing error
|
|
294
|
+
*/
|
|
295
|
+
hasError(reset = false) {
|
|
296
|
+
const hasError = !!this.currentErrorMsg;
|
|
297
|
+
if (reset) {
|
|
298
|
+
this.currentErrorMsg = null;
|
|
299
|
+
this.currentErrorType = null;
|
|
300
|
+
}
|
|
301
|
+
return hasError;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Sets the current error state.
|
|
305
|
+
*
|
|
306
|
+
* @param errorType - the error type
|
|
307
|
+
* @param error - the original error, if any
|
|
308
|
+
*/
|
|
309
|
+
setCurrentError(errorType, error) {
|
|
310
|
+
this.currentErrorMsg = ErrorHandler._errorMsg(error)[ERROR_TYPE[errorType]];
|
|
311
|
+
this.currentErrorType = errorType;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Gets the current error type state.
|
|
315
|
+
*
|
|
316
|
+
* @param reset - resets the current error state
|
|
317
|
+
* @returns The current error type
|
|
318
|
+
*/
|
|
319
|
+
getCurrentErrorType(reset = false) {
|
|
320
|
+
const currentErrorType = this.currentErrorType;
|
|
321
|
+
if (reset) {
|
|
322
|
+
this.currentErrorMsg = null;
|
|
323
|
+
this.currentErrorType = null;
|
|
324
|
+
}
|
|
325
|
+
return currentErrorType;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Maps an error type to a validation link if help (Guided Answers topic) is available for the specified error.
|
|
329
|
+
* Otherwise the specified error message is returned. To retrieve the previous error state @see getValidationErrorHelp.
|
|
330
|
+
* Use this (getHelpForError) if the error type is known.
|
|
331
|
+
*
|
|
332
|
+
* @param errorType - the error type to be mapped to help link
|
|
333
|
+
* @param errorMsg - the message to appear with the help link
|
|
334
|
+
* @returns A validation help link or help link message
|
|
335
|
+
*/
|
|
336
|
+
static getHelpForError(errorType, errorMsg) {
|
|
337
|
+
const helpNode = ErrorHandler.getHelpNode(errorType);
|
|
338
|
+
const mappedErrorMsg = errorMsg !== null && errorMsg !== void 0 ? errorMsg : ErrorHandler.getErrorMsgFromType(errorType);
|
|
339
|
+
if (helpNode) {
|
|
340
|
+
const valLink = {
|
|
341
|
+
message: mappedErrorMsg !== null && mappedErrorMsg !== void 0 ? mappedErrorMsg : '',
|
|
342
|
+
link: {
|
|
343
|
+
text: (0, i18n_1.t)('guidedAnswers.validationErrorHelpText'),
|
|
344
|
+
icon: images_1.GUIDED_ANSWERS_ICON,
|
|
345
|
+
url: (0, help_topics_1.getHelpUrl)(3046 /* HELP_TREE.FIORI_TOOLS */, [helpNode])
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
if (this.guidedAnswersEnabled) {
|
|
349
|
+
valLink.link.command = {
|
|
350
|
+
id: help_topics_1.GUIDED_ANSWERS_LAUNCH_CMD_ID,
|
|
351
|
+
params: {
|
|
352
|
+
treeId: 3046 /* HELP_TREE.FIORI_TOOLS */,
|
|
353
|
+
nodeIdPath: [helpNode],
|
|
354
|
+
trigger: '@sap-ux/odata-service-inquirer'
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
// Report the GA link created event
|
|
359
|
+
(0, utils_1.sendTelemetryEvent)(teleEventGALinkCreated, {
|
|
360
|
+
errorType,
|
|
361
|
+
isGuidedAnswersEnabled: this.guidedAnswersEnabled,
|
|
362
|
+
nodeIdPath: `${helpNode}`
|
|
363
|
+
});
|
|
364
|
+
return new types_1.ValidationLink(valLink);
|
|
365
|
+
}
|
|
366
|
+
return mappedErrorMsg;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
exports.ErrorHandler = ErrorHandler;
|
|
370
|
+
// Get the required localized parameterized error message
|
|
371
|
+
// Note that these are general fallback end-user error messages.
|
|
372
|
+
// More specific error messages can be used at the point of error generation.
|
|
373
|
+
ErrorHandler._errorMsg = (error) => ({
|
|
374
|
+
[ERROR_TYPE.CERT]: (0, i18n_1.t)('errors.certificateError', { error }),
|
|
375
|
+
[ERROR_TYPE.CERT_EXPIRED]: (0, i18n_1.t)('errors.urlCertValidationError', { certErrorReason: (0, i18n_1.t)('texts.anExpiredCert') }),
|
|
376
|
+
[ERROR_TYPE.CERT_SELF_SIGNED]: (0, i18n_1.t)('errors.urlCertValidationError', {
|
|
377
|
+
certErrorReason: (0, i18n_1.t)('texts.aSelfSignedCert')
|
|
378
|
+
}),
|
|
379
|
+
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: (0, i18n_1.t)('errors.urlCertValidationError', {
|
|
380
|
+
certErrorReason: (0, i18n_1.t)('texts.anUnknownOrInvalidCert')
|
|
381
|
+
}),
|
|
382
|
+
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: (0, i18n_1.t)('errors.urlCertValidationError', {
|
|
383
|
+
certErrorReason: (0, i18n_1.t)('texts.anUntrustedRootCert')
|
|
384
|
+
}),
|
|
385
|
+
[ERROR_TYPE.AUTH]: (0, i18n_1.t)('errors.authenticationFailed', { error }),
|
|
386
|
+
[ERROR_TYPE.AUTH_TIMEOUT]: (0, i18n_1.t)('errors.authenticationTimeout'),
|
|
387
|
+
[ERROR_TYPE.INVALID_URL]: (0, i18n_1.t)('errors.invalidUrl'),
|
|
388
|
+
[ERROR_TYPE.CONNECTION]: (0, i18n_1.t)('errors.connectionError', {
|
|
389
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
390
|
+
}),
|
|
391
|
+
[ERROR_TYPE.UNKNOWN]: (0, i18n_1.t)('errors.unknownError', {
|
|
392
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error)
|
|
393
|
+
}),
|
|
394
|
+
[ERROR_TYPE.SERVICES_UNAVAILABLE]: (0, i18n_1.t)('errors.servicesUnavailable'),
|
|
395
|
+
[ERROR_TYPE.SERVICE_UNAVAILABLE]: (0, i18n_1.t)('errors.serviceUnavailable'),
|
|
396
|
+
[ERROR_TYPE.CATALOG_SERVICE_NOT_ACTIVE]: (0, i18n_1.t)('errors.catalogServiceNotActive'),
|
|
397
|
+
[ERROR_TYPE.INTERNAL_SERVER_ERROR]: (0, i18n_1.t)('errors.internalServerError', { error: error === null || error === void 0 ? void 0 : error.message }),
|
|
398
|
+
[ERROR_TYPE.NOT_FOUND]: (0, i18n_1.t)('errors.urlNotFound'),
|
|
399
|
+
[ERROR_TYPE.ODATA_URL_NOT_FOUND]: (0, i18n_1.t)('errors.odataServiceUrlNotFound'),
|
|
400
|
+
[ERROR_TYPE.BAD_GATEWAY]: (0, i18n_1.t)('errors.destinationUnavailable'),
|
|
401
|
+
[ERROR_TYPE.DESTINATION_UNAVAILABLE]: (0, i18n_1.t)('errors.destinationUnavailable'),
|
|
402
|
+
[ERROR_TYPE.DESTINATION_NOT_FOUND]: (0, i18n_1.t)('errors.destinationNotFound'),
|
|
403
|
+
[ERROR_TYPE.DESTINATION_MISCONFIGURED]: (0, i18n_1.t)('errors.destinationMisconfigured'),
|
|
404
|
+
[ERROR_TYPE.NO_V2_SERVICES]: (0, i18n_1.t)('errors.noServicesAvailable', { version: '2' }),
|
|
405
|
+
[ERROR_TYPE.NO_V4_SERVICES]: (0, i18n_1.t)('errors.noServicesAvailabl', { version: '4' }),
|
|
406
|
+
[ERROR_TYPE.DESTINATION_BAD_GATEWAY_503]: (0, i18n_1.t)('errors.destinationUnavailable'),
|
|
407
|
+
[ERROR_TYPE.REDIRECT]: (0, i18n_1.t)('errors.redirectError'),
|
|
408
|
+
[ERROR_TYPE.NO_SUCH_HOST]: (0, i18n_1.t)('errors.noSuchHostError'),
|
|
409
|
+
[ERROR_TYPE.NO_ABAP_ENVS]: (0, i18n_1.t)('error.abapEnvsUnavailable')
|
|
410
|
+
});
|
|
411
|
+
/**
|
|
412
|
+
* Get the Guided Answers (help) node for the specified error type.
|
|
413
|
+
*
|
|
414
|
+
* @param errorType The error type for which a help node (help content id) may be returned
|
|
415
|
+
* @returns The Guided Answers node for the specified error type
|
|
416
|
+
*/
|
|
417
|
+
ErrorHandler.getHelpNode = (errorType) => {
|
|
418
|
+
const errorToHelp = {
|
|
419
|
+
[ERROR_TYPE.SERVICES_UNAVAILABLE]: (0, btp_utils_1.isAppStudio)()
|
|
420
|
+
? help_topics_1.HELP_NODES.BAS_CATALOG_SERVICES_REQUEST_FAILED
|
|
421
|
+
: undefined,
|
|
422
|
+
[ERROR_TYPE.CERT]: help_topics_1.HELP_NODES.CERTIFICATE_ERROR,
|
|
423
|
+
[ERROR_TYPE.CERT_SELF_SIGNED]: help_topics_1.HELP_NODES.CERTIFICATE_ERROR,
|
|
424
|
+
[ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: help_topics_1.HELP_NODES.CERTIFICATE_ERROR,
|
|
425
|
+
[ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: help_topics_1.HELP_NODES.CERTIFICATE_ERROR,
|
|
426
|
+
[ERROR_TYPE.DESTINATION_MISCONFIGURED]: help_topics_1.HELP_NODES.DESTINATION_MISCONFIGURED,
|
|
427
|
+
[ERROR_TYPE.DESTINATION_UNAVAILABLE]: help_topics_1.HELP_NODES.DESTINATION_UNAVAILABLE,
|
|
428
|
+
[ERROR_TYPE.DESTINATION_NOT_FOUND]: help_topics_1.HELP_NODES.DESTINATION_NOT_FOUND,
|
|
429
|
+
[ERROR_TYPE.BAD_GATEWAY]: help_topics_1.HELP_NODES.BAD_GATEWAY,
|
|
430
|
+
[ERROR_TYPE.DESTINATION_BAD_GATEWAY_503]: help_topics_1.HELP_NODES.DESTINATION_BAD_GATEWAY_503,
|
|
431
|
+
[ERROR_TYPE.NO_V4_SERVICES]: help_topics_1.HELP_NODES.NO_V4_SERVICES,
|
|
432
|
+
[ERROR_TYPE.AUTH]: undefined,
|
|
433
|
+
[ERROR_TYPE.AUTH_TIMEOUT]: undefined,
|
|
434
|
+
[ERROR_TYPE.REDIRECT]: undefined,
|
|
435
|
+
[ERROR_TYPE.CERT_EXPIRED]: undefined,
|
|
436
|
+
[ERROR_TYPE.UNKNOWN]: undefined,
|
|
437
|
+
[ERROR_TYPE.INVALID_URL]: undefined,
|
|
438
|
+
[ERROR_TYPE.CONNECTION]: undefined,
|
|
439
|
+
[ERROR_TYPE.SERVICE_UNAVAILABLE]: undefined,
|
|
440
|
+
[ERROR_TYPE.NO_ABAP_ENVS]: undefined,
|
|
441
|
+
[ERROR_TYPE.CATALOG_SERVICE_NOT_ACTIVE]: undefined,
|
|
442
|
+
[ERROR_TYPE.NO_SUCH_HOST]: undefined,
|
|
443
|
+
[ERROR_TYPE.NOT_FOUND]: undefined,
|
|
444
|
+
[ERROR_TYPE.ODATA_URL_NOT_FOUND]: undefined,
|
|
445
|
+
[ERROR_TYPE.INTERNAL_SERVER_ERROR]: undefined,
|
|
446
|
+
[ERROR_TYPE.NO_V2_SERVICES]: undefined
|
|
447
|
+
};
|
|
448
|
+
return errorToHelp[errorType];
|
|
449
|
+
};
|
|
450
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping of human readable help topic to implementation specific ids
|
|
3
|
+
* Help items are nodes under a root tree item. A node may have n additonal nodes.
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare const enum HELP_TREE {
|
|
7
|
+
FIORI_TOOLS = 3046
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Individual help topics which are mapped to node ids
|
|
11
|
+
*/
|
|
12
|
+
export declare const HELP_NODES: {
|
|
13
|
+
FIORI_TOOLS: number;
|
|
14
|
+
DEV_PLATFORM: number;
|
|
15
|
+
FIORI_APP_GENERATOR: number;
|
|
16
|
+
BAS_CATALOG_SERVICES_REQUEST_FAILED: number;
|
|
17
|
+
APPLICATION_PREVIEW: number;
|
|
18
|
+
CERTIFICATE_ERROR: number;
|
|
19
|
+
DESTINATION_MISCONFIGURED: number;
|
|
20
|
+
DESTINATION_UNAVAILABLE: number;
|
|
21
|
+
DESTINATION_NOT_FOUND: number;
|
|
22
|
+
BAD_GATEWAY: number;
|
|
23
|
+
DESTINATION_BAD_GATEWAY_503: number;
|
|
24
|
+
NO_V4_SERVICES: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const GUIDED_ANSWERS_EXTENSION_ID = "saposs.sap-guided-answers-extension";
|
|
27
|
+
export declare const GUIDED_ANSWERS_LAUNCH_CMD_ID = "sap.ux.guidedAnswer.openGuidedAnswer";
|
|
28
|
+
/**
|
|
29
|
+
* Creates a help url for the specified tree and node ids. If node ids are not specified the root tree path
|
|
30
|
+
* will be returned, which may not be a valid help page.
|
|
31
|
+
*
|
|
32
|
+
* @param treeId The tree id of the help content system (Guided Answers context)
|
|
33
|
+
* @param nodeIds The node ids of the help content page (Guided Answers specific page)
|
|
34
|
+
* @returns The help url
|
|
35
|
+
*/
|
|
36
|
+
export declare function getHelpUrl(treeId: number, nodeIds: number[]): string;
|
|
37
|
+
//# sourceMappingURL=help-topics.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHelpUrl = exports.GUIDED_ANSWERS_LAUNCH_CMD_ID = exports.GUIDED_ANSWERS_EXTENSION_ID = exports.HELP_NODES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Individual help topics which are mapped to node ids
|
|
6
|
+
*/
|
|
7
|
+
exports.HELP_NODES = {
|
|
8
|
+
FIORI_TOOLS: 45995, // The root of all Fiori Tools help
|
|
9
|
+
DEV_PLATFORM: 45996, // Environment specific selection, vscode or BAS
|
|
10
|
+
FIORI_APP_GENERATOR: 48363, // Fiori application generator
|
|
11
|
+
BAS_CATALOG_SERVICES_REQUEST_FAILED: 48366, // BAS specific catalog service request failure
|
|
12
|
+
APPLICATION_PREVIEW: 52881, // App preview failure
|
|
13
|
+
CERTIFICATE_ERROR: 53643,
|
|
14
|
+
DESTINATION_MISCONFIGURED: 54336, // Missing additional property
|
|
15
|
+
DESTINATION_UNAVAILABLE: 51208, // Launchpad service is not subscribed to
|
|
16
|
+
DESTINATION_NOT_FOUND: 51208, // Destination URL is returning an empty response
|
|
17
|
+
BAD_GATEWAY: 48366, // Bad gateway 502
|
|
18
|
+
DESTINATION_BAD_GATEWAY_503: 52526, // Destination Service Unavailable 503
|
|
19
|
+
NO_V4_SERVICES: 57573 // No V4 OData services available
|
|
20
|
+
};
|
|
21
|
+
exports.GUIDED_ANSWERS_EXTENSION_ID = 'saposs.sap-guided-answers-extension';
|
|
22
|
+
exports.GUIDED_ANSWERS_LAUNCH_CMD_ID = 'sap.ux.guidedAnswer.openGuidedAnswer';
|
|
23
|
+
const GUIDED_ANSWERS_SUPPORT_BASE_URL = 'https://ga.support.sap.com/dtp/viewer/index.html';
|
|
24
|
+
/**
|
|
25
|
+
* Creates a help url for the specified tree and node ids. If node ids are not specified the root tree path
|
|
26
|
+
* will be returned, which may not be a valid help page.
|
|
27
|
+
*
|
|
28
|
+
* @param treeId The tree id of the help content system (Guided Answers context)
|
|
29
|
+
* @param nodeIds The node ids of the help content page (Guided Answers specific page)
|
|
30
|
+
* @returns The help url
|
|
31
|
+
*/
|
|
32
|
+
function getHelpUrl(treeId, nodeIds) {
|
|
33
|
+
let actions = '';
|
|
34
|
+
if (nodeIds.length > 0) {
|
|
35
|
+
actions = `/actions/${nodeIds.join(':')}`;
|
|
36
|
+
}
|
|
37
|
+
return `${GUIDED_ANSWERS_SUPPORT_BASE_URL}#/tree/${treeId}${actions}`;
|
|
38
|
+
}
|
|
39
|
+
exports.getHelpUrl = getHelpUrl;
|
|
40
|
+
//# sourceMappingURL=help-topics.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GUIDED_ANSWERS_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjQzVDNUM1Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iI0M1QzVDNSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";
|
|
2
|
+
//# sourceMappingURL=guidedAnswersIcon_svg_base64.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUIDED_ANSWERS_ICON = void 0;
|
|
4
|
+
exports.GUIDED_ANSWERS_ICON = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjQzVDNUM1Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iI0M1QzVDNSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==';
|
|
5
|
+
//# sourceMappingURL=guidedAnswersIcon_svg_base64.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
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("./guidedAnswersIcon_svg_base64"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TOptions } from 'i18next';
|
|
2
|
+
export declare const defaultProjectNumber = 1;
|
|
3
|
+
/**
|
|
4
|
+
* Initialize i18next with the translations for this module.
|
|
5
|
+
*/
|
|
6
|
+
export declare function initI18nOdataServiceInquirer(): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
9
|
+
*
|
|
10
|
+
* @param key i18n key
|
|
11
|
+
* @param options additional options
|
|
12
|
+
* @returns {string} localized string stored for the given key
|
|
13
|
+
*/
|
|
14
|
+
export declare function t(key: string, options?: TOptions): string;
|
|
15
|
+
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.t = exports.initI18nOdataServiceInquirer = exports.defaultProjectNumber = void 0;
|
|
16
|
+
const i18next_1 = __importDefault(require("i18next"));
|
|
17
|
+
const odata_service_inquirer_i18n_json_1 = __importDefault(require("./translations/odata-service-inquirer.i18n.json"));
|
|
18
|
+
const odataServiceInquirerNamespace = 'odata-service-inquirer';
|
|
19
|
+
exports.defaultProjectNumber = 1;
|
|
20
|
+
/**
|
|
21
|
+
* Initialize i18next with the translations for this module.
|
|
22
|
+
*/
|
|
23
|
+
function initI18nOdataServiceInquirer() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield i18next_1.default.init({
|
|
26
|
+
lng: 'en',
|
|
27
|
+
fallbackLng: 'en',
|
|
28
|
+
missingInterpolationHandler: () => ''
|
|
29
|
+
}, () => i18next_1.default.addResourceBundle('en', odataServiceInquirerNamespace, odata_service_inquirer_i18n_json_1.default));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.initI18nOdataServiceInquirer = initI18nOdataServiceInquirer;
|
|
33
|
+
/**
|
|
34
|
+
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
35
|
+
*
|
|
36
|
+
* @param key i18n key
|
|
37
|
+
* @param options additional options
|
|
38
|
+
* @returns {string} localized string stored for the given key
|
|
39
|
+
*/
|
|
40
|
+
function t(key, options) {
|
|
41
|
+
if (!(options === null || options === void 0 ? void 0 : options.ns)) {
|
|
42
|
+
options = Object.assign(options !== null && options !== void 0 ? options : {}, { ns: odataServiceInquirerNamespace });
|
|
43
|
+
}
|
|
44
|
+
return i18next_1.default.t(key, options);
|
|
45
|
+
}
|
|
46
|
+
exports.t = t;
|
|
47
|
+
initI18nOdataServiceInquirer().catch(() => {
|
|
48
|
+
// Needed for lint
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=i18n.js.map
|