@sap-ux/odata-service-inquirer 2.23.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n.js +14 -24
- package/dist/index.d.ts +11 -6
- package/dist/index.js +40 -44
- package/dist/prompts/connectionValidator.d.ts +2 -2
- package/dist/prompts/connectionValidator.js +109 -116
- package/dist/prompts/datasources/cap-project/cap-helpers.d.ts +2 -2
- package/dist/prompts/datasources/cap-project/cap-helpers.js +44 -53
- package/dist/prompts/datasources/cap-project/questions.d.ts +2 -2
- package/dist/prompts/datasources/cap-project/questions.js +46 -49
- package/dist/prompts/datasources/cap-project/types.d.ts +1 -1
- package/dist/prompts/datasources/cap-project/types.js +2 -5
- package/dist/prompts/datasources/cap-project/validators.js +5 -8
- package/dist/prompts/datasources/metadata-file/index.d.ts +1 -1
- package/dist/prompts/datasources/metadata-file/index.js +12 -15
- package/dist/prompts/datasources/metadata-file/validators.js +9 -13
- package/dist/prompts/datasources/sap-system/abap-on-btp/questions.d.ts +3 -3
- package/dist/prompts/datasources/sap-system/abap-on-btp/questions.js +55 -62
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.d.ts +3 -3
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.js +26 -30
- package/dist/prompts/datasources/sap-system/cf-abap/questions.d.ts +2 -2
- package/dist/prompts/datasources/sap-system/cf-abap/questions.js +7 -10
- package/dist/prompts/datasources/sap-system/credentials/questions.d.ts +1 -1
- package/dist/prompts/datasources/sap-system/credentials/questions.js +27 -31
- package/dist/prompts/datasources/sap-system/external-services/value-help-download.d.ts +1 -1
- package/dist/prompts/datasources/sap-system/external-services/value-help-download.js +25 -31
- package/dist/prompts/datasources/sap-system/new-system/questions.d.ts +2 -2
- package/dist/prompts/datasources/sap-system/new-system/questions.js +12 -15
- package/dist/prompts/datasources/sap-system/new-system/types.d.ts +1 -1
- package/dist/prompts/datasources/sap-system/new-system/types.js +2 -5
- package/dist/prompts/datasources/sap-system/prompt-helpers.js +6 -9
- package/dist/prompts/datasources/sap-system/service-selection/index.d.ts +2 -2
- package/dist/prompts/datasources/sap-system/service-selection/index.js +2 -18
- package/dist/prompts/datasources/sap-system/service-selection/questions.d.ts +3 -3
- package/dist/prompts/datasources/sap-system/service-selection/questions.js +39 -45
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.d.ts +3 -3
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.js +78 -90
- package/dist/prompts/datasources/sap-system/service-selection/types.js +1 -2
- package/dist/prompts/datasources/sap-system/shared-prompts/shared-prompts.d.ts +5 -5
- package/dist/prompts/datasources/sap-system/shared-prompts/shared-prompts.js +36 -40
- package/dist/prompts/datasources/sap-system/system-selection/index.d.ts +1 -1
- package/dist/prompts/datasources/sap-system/system-selection/index.js +1 -17
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.d.ts +3 -3
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.js +48 -58
- package/dist/prompts/datasources/sap-system/system-selection/questions.d.ts +4 -4
- package/dist/prompts/datasources/sap-system/system-selection/questions.js +55 -62
- package/dist/prompts/datasources/sap-system/validators.js +13 -18
- package/dist/prompts/datasources/service-helpers/service-helpers.js +9 -15
- package/dist/prompts/datasources/service-url/questions.d.ts +1 -1
- package/dist/prompts/datasources/service-url/questions.js +43 -49
- package/dist/prompts/datasources/service-url/types.js +2 -5
- package/dist/prompts/datasources/service-url/validators.js +35 -41
- package/dist/prompts/edmx/alp-questions.d.ts +1 -1
- package/dist/prompts/edmx/alp-questions.js +28 -31
- package/dist/prompts/edmx/entity-helper.js +26 -35
- package/dist/prompts/edmx/questions.d.ts +1 -1
- package/dist/prompts/edmx/questions.js +78 -84
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +1 -17
- package/dist/prompts/logger-helper.js +4 -40
- package/dist/prompts/prompt-helpers.d.ts +1 -1
- package/dist/prompts/prompt-helpers.js +12 -16
- package/dist/prompts/prompts.d.ts +1 -1
- package/dist/prompts/prompts.js +16 -19
- package/dist/prompts/types.js +1 -2
- package/dist/prompts/validators.js +7 -13
- package/dist/types.d.ts +2 -2
- package/dist/types.js +8 -11
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +38 -53
- package/dist/utils/prompt-state.d.ts +1 -1
- package/dist/utils/prompt-state.js +1 -5
- package/dist/utils/store.js +7 -14
- package/package.json +22 -20
package/dist/i18n.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.i18n = exports.defaultProjectNumber = void 0;
|
|
7
|
-
exports.initI18nOdataServiceInquirer = initI18nOdataServiceInquirer;
|
|
8
|
-
exports.t = t;
|
|
9
|
-
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
10
|
-
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
11
|
-
const i18next_1 = __importDefault(require("i18next"));
|
|
12
|
-
const odata_service_inquirer_i18n_json_1 = __importDefault(require("./translations/odata-service-inquirer.i18n.json"));
|
|
1
|
+
import { addi18nResourceBundle as addInquirerCommonTexts } from '@sap-ux/inquirer-common';
|
|
2
|
+
import { addi18nResourceBundle as addProjectInputValidatorTexts } from '@sap-ux/project-input-validator';
|
|
3
|
+
import i18next from 'i18next';
|
|
4
|
+
import translations from './translations/odata-service-inquirer.i18n.json' with { type: 'json' };
|
|
13
5
|
const odataServiceInquirerNamespace = 'odata-service-inquirer';
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
export const defaultProjectNumber = 1;
|
|
7
|
+
export const i18n = i18next.createInstance();
|
|
16
8
|
/**
|
|
17
9
|
* Initialize i18next with the translations for this module.
|
|
18
10
|
*/
|
|
19
|
-
async function initI18nOdataServiceInquirer() {
|
|
20
|
-
await
|
|
11
|
+
export async function initI18nOdataServiceInquirer() {
|
|
12
|
+
await i18n.init({
|
|
21
13
|
lng: 'en',
|
|
22
14
|
fallbackLng: 'en',
|
|
23
15
|
missingInterpolationHandler: () => '',
|
|
@@ -36,10 +28,10 @@ async function initI18nOdataServiceInquirer() {
|
|
|
36
28
|
},
|
|
37
29
|
showSupportNotice: false
|
|
38
30
|
});
|
|
39
|
-
|
|
31
|
+
i18n.addResourceBundle('en', odataServiceInquirerNamespace, translations);
|
|
40
32
|
// add other bundles that are used in consumed modules
|
|
41
|
-
(
|
|
42
|
-
(
|
|
33
|
+
addInquirerCommonTexts();
|
|
34
|
+
addProjectInputValidatorTexts();
|
|
43
35
|
}
|
|
44
36
|
/**
|
|
45
37
|
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
@@ -48,13 +40,11 @@ async function initI18nOdataServiceInquirer() {
|
|
|
48
40
|
* @param options additional options
|
|
49
41
|
* @returns {string} localized string stored for the given key
|
|
50
42
|
*/
|
|
51
|
-
function t(key, options) {
|
|
43
|
+
export function t(key, options) {
|
|
52
44
|
if (!options?.ns) {
|
|
53
45
|
options = Object.assign(options ?? {}, { ns: odataServiceInquirerNamespace });
|
|
54
46
|
}
|
|
55
|
-
return
|
|
47
|
+
return i18n.t(key, options);
|
|
56
48
|
}
|
|
57
|
-
initI18nOdataServiceInquirer().catch(() =>
|
|
58
|
-
// Needed for lint
|
|
59
|
-
});
|
|
49
|
+
void initI18nOdataServiceInquirer().catch(() => undefined);
|
|
60
50
|
//# sourceMappingURL=i18n.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { type Logger } from '@sap-ux/logger';
|
|
|
3
3
|
import { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
4
4
|
import { type ToolsSuiteTelemetryClient } from '@sap-ux/telemetry';
|
|
5
5
|
import type { Question } from 'inquirer';
|
|
6
|
-
import type { ServiceAnswer } from './prompts/datasources/sap-system/service-selection';
|
|
7
|
-
import { type SystemSelectionAnswers } from './prompts/datasources/sap-system/system-selection';
|
|
8
|
-
import
|
|
6
|
+
import type { ServiceAnswer } from './prompts/datasources/sap-system/service-selection/index.js';
|
|
7
|
+
import { type SystemSelectionAnswers } from './prompts/datasources/sap-system/system-selection/index.js';
|
|
8
|
+
import { CfAbapEnvServiceChoice, NewSystemChoice } from './prompts/datasources/sap-system/system-selection/prompt-helpers.js';
|
|
9
9
|
import type { Annotations } from '@sap-ux/axios-extension';
|
|
10
|
-
import type { CapRuntime, CapService } from '@sap-ux/cap-config-writer';
|
|
11
10
|
import type { TemplateType } from '@sap-ux/fiori-elements-writer';
|
|
12
|
-
import {
|
|
11
|
+
import type { EntityRelatedAnswers, EntityPromptOptions, OdataServiceAnswers, OdataServicePromptOptions, OdataServiceQuestion, ConnectedSystem } from './types.js';
|
|
12
|
+
import { DatasourceType } from './types.js';
|
|
13
13
|
/**
|
|
14
14
|
* Get the inquirer prompts for odata service.
|
|
15
15
|
*
|
|
@@ -64,5 +64,10 @@ declare function getEntityRelatedPrompts(metadata: string, templateType: Templat
|
|
|
64
64
|
* @returns the prompt answers
|
|
65
65
|
*/
|
|
66
66
|
declare function prompt(adapter: InquirerAdapter, promptOptions?: OdataServicePromptOptions, logger?: Logger, enableGuidedAnswers?: boolean, telemetryClient?: ToolsSuiteTelemetryClient, isYUI?: boolean, connectedSystem?: ConnectedSystem): Promise<OdataServiceAnswers>;
|
|
67
|
-
export { CfAbapEnvServiceChoice, DatasourceType,
|
|
67
|
+
export { CfAbapEnvServiceChoice, DatasourceType, ERROR_TYPE, ErrorHandler, getEntityRelatedPrompts, getPrompts, getSystemSelectionQuestions, NewSystemChoice, OdataVersion, prompt };
|
|
68
|
+
export { promptNames } from './types.js';
|
|
69
|
+
export type { SystemSelectionAnswerType } from './prompts/datasources/sap-system/system-selection/prompt-helpers.js';
|
|
70
|
+
export type { CapRuntime, CapService } from '@sap-ux/cap-config-writer';
|
|
71
|
+
export type { InquirerAdapter } from '@sap-ux/inquirer-common';
|
|
72
|
+
export type { EntityRelatedAnswers, OdataServiceAnswers, OdataServicePromptOptions, SapSystemType, ConnectedSystem } from './types.js';
|
|
68
73
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "ERROR_TYPE", { enumerable: true, get: function () { return inquirer_common_1.ERROR_TYPE; } });
|
|
13
|
-
Object.defineProperty(exports, "ErrorHandler", { enumerable: true, get: function () { return inquirer_common_1.ErrorHandler; } });
|
|
14
|
-
const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
|
|
15
|
-
Object.defineProperty(exports, "OdataVersion", { enumerable: true, get: function () { return odata_service_writer_1.OdataVersion; } });
|
|
16
|
-
const inquirer_autocomplete_prompt_1 = __importDefault(require("inquirer-autocomplete-prompt"));
|
|
17
|
-
const i18n_1 = require("./i18n");
|
|
18
|
-
const prompts_1 = require("./prompts");
|
|
19
|
-
const system_selection_1 = require("./prompts/datasources/sap-system/system-selection");
|
|
20
|
-
const questions_1 = require("./prompts/edmx/questions");
|
|
21
|
-
const logger_helper_1 = __importDefault(require("./prompts/logger-helper"));
|
|
22
|
-
const types_1 = require("./types");
|
|
23
|
-
Object.defineProperty(exports, "DatasourceType", { enumerable: true, get: function () { return types_1.DatasourceType; } });
|
|
24
|
-
Object.defineProperty(exports, "promptNames", { enumerable: true, get: function () { return types_1.promptNames; } });
|
|
25
|
-
const utils_1 = require("./utils");
|
|
1
|
+
import { ERROR_TYPE, ErrorHandler, setTelemetryClient } from '@sap-ux/inquirer-common';
|
|
2
|
+
import { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
3
|
+
import autocomplete from 'inquirer-autocomplete-prompt';
|
|
4
|
+
import { initI18nOdataServiceInquirer } from './i18n.js';
|
|
5
|
+
import { getQuestions } from './prompts/index.js';
|
|
6
|
+
import { getSystemSelectionQuestions as getSystemSelectionQuestionsBase } from './prompts/datasources/sap-system/system-selection/index.js';
|
|
7
|
+
import { CfAbapEnvServiceChoice, NewSystemChoice } from './prompts/datasources/sap-system/system-selection/prompt-helpers.js';
|
|
8
|
+
import { getEntitySelectionQuestions } from './prompts/edmx/questions.js';
|
|
9
|
+
import LoggerHelper from './prompts/logger-helper.js';
|
|
10
|
+
import { DatasourceType } from './types.js';
|
|
11
|
+
import { getPromptHostEnvironment, PromptState } from './utils/index.js';
|
|
26
12
|
/**
|
|
27
13
|
* Get the inquirer prompts for odata service.
|
|
28
14
|
*
|
|
@@ -36,21 +22,21 @@ const utils_1 = require("./utils");
|
|
|
36
22
|
*/
|
|
37
23
|
async function getPrompts(promptOptions, logger, enableGuidedAnswers = false, telemetryClient, isYUI = false, connectedSystem) {
|
|
38
24
|
// prompt texts must be loaded before the prompts are created, wait for the i18n bundle to be initialized
|
|
39
|
-
await
|
|
25
|
+
await initI18nOdataServiceInquirer();
|
|
40
26
|
if (logger) {
|
|
41
|
-
|
|
27
|
+
LoggerHelper.logger = logger;
|
|
42
28
|
}
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
ErrorHandler.logger = LoggerHelper.logger;
|
|
30
|
+
ErrorHandler.guidedAnswersEnabled = enableGuidedAnswers;
|
|
45
31
|
// Sets the platform for error handler telem reporting, based on the `isYUI` option
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
ErrorHandler.platform = getPromptHostEnvironment().technical;
|
|
33
|
+
ErrorHandler.guidedAnswersTrigger = '@sap-ux/odata-service-inquirer';
|
|
34
|
+
PromptState.isYUI = isYUI;
|
|
35
|
+
setTelemetryClient(telemetryClient);
|
|
50
36
|
return {
|
|
51
|
-
prompts: await
|
|
37
|
+
prompts: await getQuestions(promptOptions, connectedSystem),
|
|
52
38
|
// Return reference to derived answers object that will be populated with user responses (after prompting is complete)
|
|
53
|
-
answers:
|
|
39
|
+
answers: PromptState.odataService
|
|
54
40
|
};
|
|
55
41
|
}
|
|
56
42
|
/**
|
|
@@ -63,14 +49,14 @@ async function getPrompts(promptOptions, logger, enableGuidedAnswers = false, te
|
|
|
63
49
|
*/
|
|
64
50
|
async function getSystemSelectionQuestions(promptOptions, isYUI, logger) {
|
|
65
51
|
if (isYUI !== undefined) {
|
|
66
|
-
|
|
52
|
+
PromptState.isYUI = isYUI;
|
|
67
53
|
}
|
|
68
54
|
if (logger) {
|
|
69
|
-
|
|
55
|
+
LoggerHelper.logger = logger;
|
|
70
56
|
}
|
|
71
57
|
return {
|
|
72
|
-
prompts: await (
|
|
73
|
-
answers:
|
|
58
|
+
prompts: await getSystemSelectionQuestionsBase(promptOptions),
|
|
59
|
+
answers: PromptState.odataService
|
|
74
60
|
};
|
|
75
61
|
}
|
|
76
62
|
/**
|
|
@@ -88,10 +74,10 @@ async function getSystemSelectionQuestions(promptOptions, isYUI, logger) {
|
|
|
88
74
|
*/
|
|
89
75
|
function getEntityRelatedPrompts(metadata, templateType, isCapService = false, promptOptions, annotations, logger, isYUI = false) {
|
|
90
76
|
if (logger) {
|
|
91
|
-
|
|
77
|
+
LoggerHelper.logger = logger;
|
|
92
78
|
}
|
|
93
|
-
|
|
94
|
-
return
|
|
79
|
+
PromptState.isYUI = isYUI;
|
|
80
|
+
return getEntitySelectionQuestions(metadata, templateType, isCapService, promptOptions, annotations);
|
|
95
81
|
}
|
|
96
82
|
/**
|
|
97
83
|
* Prompt for odata service writer inputs.
|
|
@@ -109,12 +95,22 @@ async function prompt(adapter, promptOptions, logger, enableGuidedAnswers, telem
|
|
|
109
95
|
if (adapter?.promptModule &&
|
|
110
96
|
(promptOptions?.serviceSelection?.useAutoComplete ?? promptOptions?.capProject?.useAutoComplete)) {
|
|
111
97
|
const pm = adapter.promptModule;
|
|
112
|
-
pm.registerPrompt('autocomplete',
|
|
98
|
+
pm.registerPrompt('autocomplete', autocomplete);
|
|
113
99
|
}
|
|
114
100
|
const odataServicePrompts = (await getPrompts(promptOptions, logger, enableGuidedAnswers, telemetryClient, isYUI, connectedSystem)).prompts;
|
|
115
101
|
const answers = await adapter.prompt(odataServicePrompts);
|
|
116
102
|
// Add dervied service answers to the answers object
|
|
117
|
-
Object.assign(answers,
|
|
103
|
+
Object.assign(answers, PromptState.odataService);
|
|
118
104
|
return answers;
|
|
119
105
|
}
|
|
106
|
+
export { CfAbapEnvServiceChoice,
|
|
107
|
+
// @deprecated - temp export to support to support open source migration
|
|
108
|
+
DatasourceType,
|
|
109
|
+
// @deprecated - temp export to support to support open source migration
|
|
110
|
+
ERROR_TYPE,
|
|
111
|
+
// @deprecated - temp export to support to support open source migration
|
|
112
|
+
ErrorHandler, getEntityRelatedPrompts, getPrompts, getSystemSelectionQuestions, NewSystemChoice,
|
|
113
|
+
// @deprecated - temp export to support to support open source migration
|
|
114
|
+
OdataVersion, prompt };
|
|
115
|
+
export { promptNames } from './types.js';
|
|
120
116
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,8 +2,8 @@ import type { AxiosRequestConfig, CatalogService, ODataService, ProviderConfigur
|
|
|
2
2
|
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
3
3
|
import { type Destination } from '@sap-ux/btp-utils';
|
|
4
4
|
import { ERROR_TYPE } from '@sap-ux/inquirer-common';
|
|
5
|
-
import type { ConnectedSystem } from '../types';
|
|
6
|
-
import type { ValidationResult } from './types';
|
|
5
|
+
import type { ConnectedSystem } from '../types.js';
|
|
6
|
+
import type { ValidationResult } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Structure to store validity information about url to be validated.
|
|
9
9
|
*/
|