@sap-ux/ui-service-inquirer 0.3.8 → 1.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 CHANGED
@@ -1,25 +1,17 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.i18n = void 0;
7
- exports.initI18n = initI18n;
8
- exports.t = t;
9
- const i18next_1 = __importDefault(require("i18next"));
10
- const ui_service_inquirer_i18n_json_1 = __importDefault(require("./translations/ui-service-inquirer.i18n.json"));
1
+ import i18next from 'i18next';
2
+ import translations from './translations/ui-service-inquirer.i18n.json' with { type: 'json' };
11
3
  const uiServiceI18nNamespace = 'ui-service-inquirer';
12
- exports.i18n = i18next_1.default.createInstance();
4
+ export const i18n = i18next.createInstance();
13
5
  /**
14
6
  * Initialize i18next with the translations for this module.
15
7
  */
16
- async function initI18n() {
17
- await exports.i18n.init({
8
+ export async function initI18n() {
9
+ await i18n.init({
18
10
  lng: 'en',
19
11
  fallbackLng: 'en',
20
12
  showSupportNotice: false
21
13
  });
22
- exports.i18n.addResourceBundle('en', uiServiceI18nNamespace, ui_service_inquirer_i18n_json_1.default);
14
+ i18n.addResourceBundle('en', uiServiceI18nNamespace, translations);
23
15
  }
24
16
  /**
25
17
  * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
@@ -28,13 +20,11 @@ async function initI18n() {
28
20
  * @param options additional options
29
21
  * @returns {string} localized string stored for the given key
30
22
  */
31
- function t(key, options) {
23
+ export function t(key, options) {
32
24
  if (!options?.ns) {
33
25
  options = Object.assign(options ?? {}, { ns: uiServiceI18nNamespace });
34
26
  }
35
- return exports.i18n.t(key, options);
27
+ return i18n.t(key, options);
36
28
  }
37
- initI18n().catch(() => {
38
- // Needed for lint
39
- });
29
+ void initI18n().catch(() => undefined);
40
30
  //# sourceMappingURL=i18n.js.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './types';
2
- export { getSystemSelectionPrompts, getConfigPrompts } from './prompts';
1
+ export * from './types.js';
2
+ export { getSystemSelectionPrompts, getConfigPrompts } from './prompts/index.js';
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,22 +1,3 @@
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
- exports.getConfigPrompts = exports.getSystemSelectionPrompts = void 0;
18
- __exportStar(require("./types"), exports);
19
- var prompts_1 = require("./prompts");
20
- Object.defineProperty(exports, "getSystemSelectionPrompts", { enumerable: true, get: function () { return prompts_1.getSystemSelectionPrompts; } });
21
- Object.defineProperty(exports, "getConfigPrompts", { enumerable: true, get: function () { return prompts_1.getConfigPrompts; } });
1
+ export * from './types.js';
2
+ export { getSystemSelectionPrompts, getConfigPrompts } from './prompts/index.js';
22
3
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const logger_1 = require("@sap-ux/logger");
1
+ import { ToolsLogger } from '@sap-ux/logger';
4
2
  /**
5
3
  * Static logger prevents passing of logger references through all functions, as this is a cross-cutting concern.
6
4
  */
7
- class LoggerHelper {
8
- static _logger = new logger_1.ToolsLogger({ logPrefix: '@sap-ux/ui-service-inquirer' });
5
+ export default class LoggerHelper {
6
+ static _logger = new ToolsLogger({ logPrefix: '@sap-ux/ui-service-inquirer' });
9
7
  /**
10
8
  * Get the logger.
11
9
  *
@@ -23,5 +21,4 @@ class LoggerHelper {
23
21
  LoggerHelper._logger = value;
24
22
  }
25
23
  }
26
- exports.default = LoggerHelper;
27
24
  //# sourceMappingURL=logger-helper.js.map
@@ -1,2 +1,2 @@
1
- export * from './questions';
1
+ export * from './questions.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,2 @@
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("./questions"), exports);
1
+ export * from './questions.js';
18
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { type Logger } from '@sap-ux/logger';
2
- import { type ServiceConfigOptions, type ServiceConfigQuestion } from '../../types';
2
+ import { type ServiceConfigOptions, type ServiceConfigQuestion } from '../../types.js';
3
3
  /**
4
4
  * Get the configuration questions.
5
5
  *
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfigQuestions = getConfigQuestions;
4
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
5
- const abap_deploy_config_inquirer_1 = require("@sap-ux/abap-deploy-config-inquirer");
6
- const i18n_1 = require("../../i18n");
7
- const prompt_helper_1 = require("../prompt-helper");
8
- const prompt_state_1 = require("../prompt-state");
1
+ import { Severity } from '@sap-devx/yeoman-ui-types';
2
+ import { getPackagePrompts, getTransportRequestPrompts } from '@sap-ux/abap-deploy-config-inquirer';
3
+ import { t } from '../../i18n.js';
4
+ import { createAbapTarget, defaultOrShowAppGenLaunchQuestion, defaultOrShowDraftQuestion, getServiceNameChoices, getValidationErrorLink } from '../prompt-helper.js';
5
+ import { PromptState } from '../prompt-state.js';
9
6
  /**
10
7
  * Get the configuration questions.
11
8
  *
@@ -13,16 +10,16 @@ const prompt_state_1 = require("../prompt-state");
13
10
  * @param options - configuration options for prompts
14
11
  * @returns the configuration questions
15
12
  */
16
- function getConfigQuestions(logger, options) {
17
- prompt_state_1.PromptState.resetServiceConfig();
18
- const abapTarget = (0, prompt_helper_1.createAbapTarget)(prompt_state_1.PromptState.systemSelection.connectedSystem?.destination, prompt_state_1.PromptState.systemSelection.connectedSystem?.backendSystem);
13
+ export function getConfigQuestions(logger, options) {
14
+ PromptState.resetServiceConfig();
15
+ const abapTarget = createAbapTarget(PromptState.systemSelection.connectedSystem?.destination, PromptState.systemSelection.connectedSystem?.backendSystem);
19
16
  const transportOptions = {
20
17
  backendTarget: {
21
18
  abapTarget: abapTarget,
22
- serviceProvider: prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider
19
+ serviceProvider: PromptState.systemSelection.connectedSystem?.serviceProvider
23
20
  },
24
21
  transportCreated: {
25
- description: (0, i18n_1.t)('prompts.options.transportDescription')
22
+ description: t('prompts.options.transportDescription')
26
23
  },
27
24
  transportInputChoice: {
28
25
  showCreateDuringDeploy: false
@@ -31,21 +28,21 @@ function getConfigQuestions(logger, options) {
31
28
  default: ''
32
29
  }
33
30
  };
34
- const packagePrompts = (0, abap_deploy_config_inquirer_1.getPackagePrompts)({
31
+ const packagePrompts = getPackagePrompts({
35
32
  packageAutocomplete: {
36
33
  useAutocomplete: true
37
34
  },
38
35
  backendTarget: {
39
36
  abapTarget: abapTarget,
40
- serviceProvider: prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider
37
+ serviceProvider: PromptState.systemSelection.connectedSystem?.serviceProvider
41
38
  }
42
39
  }, true, true);
43
- const transportPrompts = (0, abap_deploy_config_inquirer_1.getTransportRequestPrompts)(transportOptions, true, true);
40
+ const transportPrompts = getTransportRequestPrompts(transportOptions, true, true);
44
41
  const configPrompts = [getServiceNameQuestion(logger, transportOptions, options)];
45
- if ((0, prompt_helper_1.defaultOrShowDraftQuestion)(options?.useDraftEnabled)) {
42
+ if (defaultOrShowDraftQuestion(options?.useDraftEnabled)) {
46
43
  configPrompts.push(getDraftEnabledQuestion(logger));
47
44
  }
48
- if ((0, prompt_helper_1.defaultOrShowAppGenLaunchQuestion)(options?.useLaunchGen)) {
45
+ if (defaultOrShowAppGenLaunchQuestion(options?.useLaunchGen)) {
49
46
  configPrompts.push(getAppGenLaunchQuestion());
50
47
  }
51
48
  return [...packagePrompts, ...transportPrompts, ...configPrompts];
@@ -65,44 +62,44 @@ function getServiceNameQuestion(logger, transportOptions, options) {
65
62
  try {
66
63
  const packageValue = answers.packageManual || answers.packageAutocomplete;
67
64
  if (packageValue) {
68
- prompt_state_1.PromptState.serviceConfig.content =
69
- (await prompt_state_1.PromptState.systemSelection.objectGenerator?.getContent(packageValue)) ?? '';
70
- const content = JSON.parse(prompt_state_1.PromptState.serviceConfig?.content);
71
- if ((0, prompt_helper_1.defaultOrShowDraftQuestion)(options?.useDraftEnabled) &&
65
+ PromptState.serviceConfig.content =
66
+ (await PromptState.systemSelection.objectGenerator?.getContent(packageValue)) ?? '';
67
+ const content = JSON.parse(PromptState.serviceConfig?.content);
68
+ if (defaultOrShowDraftQuestion(options?.useDraftEnabled) &&
72
69
  content.businessObject?.projectionBehavior?.withDraft) {
73
- prompt_state_1.PromptState.serviceConfig.showDraftEnabled = true;
70
+ PromptState.serviceConfig.showDraftEnabled = true;
74
71
  }
75
72
  transportOptions.ui5AbapRepo.default = `${(content.general?.namespace ?? 'Z').toLowerCase()}testapp`;
76
- prompt_state_1.PromptState.serviceConfig.content = JSON.stringify(content);
77
- prompt_state_1.PromptState.serviceConfig.serviceName =
73
+ PromptState.serviceConfig.content = JSON.stringify(content);
74
+ PromptState.serviceConfig.serviceName =
78
75
  content.businessService.serviceBinding.serviceBindingName;
79
76
  }
80
77
  }
81
78
  catch (e) {
82
- logger?.error(`${(0, i18n_1.t)('error.fetchingContentForServiceBinding')}: ${e.message}`);
79
+ logger?.error(`${t('error.fetchingContentForServiceBinding')}: ${e.message}`);
83
80
  }
84
81
  }
85
- return !!prompt_state_1.PromptState.serviceConfig.serviceName || !!prompt_state_1.PromptState.serviceConfig.content;
82
+ return !!PromptState.serviceConfig.serviceName || !!PromptState.serviceConfig.content;
86
83
  },
87
84
  type: 'expand',
88
85
  name: 'serviceName',
89
86
  guiOptions: {
90
- breadcrumb: (0, i18n_1.t)('prompts.serviceNameBreadcrumb')
87
+ breadcrumb: t('prompts.serviceNameBreadcrumb')
91
88
  },
92
- message: (0, i18n_1.t)('prompts.serviceName'),
93
- choices: () => (0, prompt_helper_1.getServiceNameChoices)(prompt_state_1.PromptState.serviceConfig.serviceName),
89
+ message: t('prompts.serviceName'),
90
+ choices: () => getServiceNameChoices(PromptState.serviceConfig.serviceName),
94
91
  default: () => 0,
95
92
  validate: async () => {
96
93
  try {
97
- const validation = await prompt_state_1.PromptState.systemSelection.objectGenerator?.validateContent(prompt_state_1.PromptState.serviceConfig.content);
94
+ const validation = await PromptState.systemSelection.objectGenerator?.validateContent(PromptState.serviceConfig.content);
98
95
  if (validation?.severity === 'ERROR') {
99
- return await (0, prompt_helper_1.getValidationErrorLink)();
96
+ return await getValidationErrorLink();
100
97
  }
101
98
  return true;
102
99
  }
103
100
  catch (e) {
104
- logger.error(`${(0, i18n_1.t)('error.validatingContent')}: ${e.message}`);
105
- return await (0, prompt_helper_1.getValidationErrorLink)();
101
+ logger.error(`${t('error.validatingContent')}: ${e.message}`);
102
+ return await getValidationErrorLink();
106
103
  }
107
104
  }
108
105
  };
@@ -116,24 +113,24 @@ function getServiceNameQuestion(logger, transportOptions, options) {
116
113
  function getDraftEnabledQuestion(logger) {
117
114
  let draftEnabled = true;
118
115
  return {
119
- when: () => prompt_state_1.PromptState.serviceConfig.showDraftEnabled,
116
+ when: () => PromptState.serviceConfig.showDraftEnabled,
120
117
  name: 'draftEnabled',
121
118
  type: 'confirm',
122
- message: (0, i18n_1.t)('prompts.draftEnabled'),
119
+ message: t('prompts.draftEnabled'),
123
120
  guiOptions: {
124
121
  breadcrumb: true,
125
122
  mandatory: true
126
123
  },
127
124
  default: true,
128
125
  validate: async (input) => {
129
- if (input !== draftEnabled && prompt_state_1.PromptState.serviceConfig.content) {
130
- const content = JSON.parse(prompt_state_1.PromptState.serviceConfig.content);
126
+ if (input !== draftEnabled && PromptState.serviceConfig.content) {
127
+ const content = JSON.parse(PromptState.serviceConfig.content);
131
128
  content.businessObject.projectionBehavior.withDraft = input;
132
- prompt_state_1.PromptState.serviceConfig.content = JSON.stringify(content);
129
+ PromptState.serviceConfig.content = JSON.stringify(content);
133
130
  try {
134
- const validation = await prompt_state_1.PromptState.systemSelection.objectGenerator?.validateContent(prompt_state_1.PromptState.serviceConfig.content);
131
+ const validation = await PromptState.systemSelection.objectGenerator?.validateContent(PromptState.serviceConfig.content);
135
132
  if (validation?.severity === 'ERROR') {
136
- return (0, i18n_1.t)('error.validatingContent');
133
+ return t('error.validatingContent');
137
134
  }
138
135
  draftEnabled = input;
139
136
  }
@@ -155,16 +152,16 @@ function getAppGenLaunchQuestion() {
155
152
  return {
156
153
  name: 'launchAppGen',
157
154
  type: 'confirm',
158
- message: (0, i18n_1.t)('prompts.launchAppGen'),
155
+ message: t('prompts.launchAppGen'),
159
156
  guiOptions: {
160
- breadcrumb: (0, i18n_1.t)('prompts.launchAppGenBreadcrumb')
157
+ breadcrumb: t('prompts.launchAppGenBreadcrumb')
161
158
  },
162
159
  additionalMessages: (val) => {
163
160
  let additionalMessage;
164
161
  if (val) {
165
162
  additionalMessage = {
166
- message: (0, i18n_1.t)('info.appGenLaunch'),
167
- severity: yeoman_ui_types_1.Severity.information
163
+ message: t('info.appGenLaunch'),
164
+ severity: Severity.information
168
165
  };
169
166
  }
170
167
  return additionalMessage;
@@ -1,3 +1,3 @@
1
- export * from './prompts';
2
- export * from './prompt-helper';
1
+ export * from './prompts.js';
2
+ export * from './prompt-helper.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,3 @@
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("./prompts"), exports);
18
- __exportStar(require("./prompt-helper"), exports);
1
+ export * from './prompts.js';
2
+ export * from './prompt-helper.js';
19
3
  //# sourceMappingURL=index.js.map
@@ -1,26 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBusinessObjects = getBusinessObjects;
4
- exports.getAbapCDSViews = getAbapCDSViews;
5
- exports.createAbapTarget = createAbapTarget;
6
- exports.getServiceNameChoices = getServiceNameChoices;
7
- exports.getValidationErrorLink = getValidationErrorLink;
8
- exports.defaultOrShowDraftQuestion = defaultOrShowDraftQuestion;
9
- exports.defaultOrShowAppGenLaunchQuestion = defaultOrShowAppGenLaunchQuestion;
10
- const axios_extension_1 = require("@sap-ux/axios-extension");
11
- const btp_utils_1 = require("@sap-ux/btp-utils");
12
- const guided_answers_helper_1 = require("@sap-ux/guided-answers-helper");
13
- const inquirer_common_1 = require("@sap-ux/inquirer-common");
14
- const telemetry_1 = require("@sap-ux/telemetry");
15
- const i18n_1 = require("../i18n");
1
+ import { AbapCDSViewService, BusinessObjectsService } from '@sap-ux/axios-extension';
2
+ import { isAppStudio } from '@sap-ux/btp-utils';
3
+ import { HELP_NODES } from '@sap-ux/guided-answers-helper';
4
+ import { ERROR_TYPE, ErrorHandler, setTelemetryClient } from '@sap-ux/inquirer-common';
5
+ import { ClientFactory } from '@sap-ux/telemetry';
6
+ import { t } from '../i18n.js';
16
7
  /**
17
8
  * Get the business objects.
18
9
  *
19
10
  * @param provider - the provider to get the business objects
20
11
  * @returns the business objects
21
12
  */
22
- async function getBusinessObjects(provider) {
23
- const businessObjectsService = await provider.getAdtService(axios_extension_1.BusinessObjectsService);
13
+ export async function getBusinessObjects(provider) {
14
+ const businessObjectsService = await provider.getAdtService(BusinessObjectsService);
24
15
  const businessObjects = await businessObjectsService?.getBusinessObjects();
25
16
  return (businessObjects?.map((bo) => {
26
17
  return { name: `${bo.name} (${bo.description})`, value: bo };
@@ -32,8 +23,8 @@ async function getBusinessObjects(provider) {
32
23
  * @param provider - the provider to get the ABAP CDS views
33
24
  * @returns the ABAP CDS views
34
25
  */
35
- async function getAbapCDSViews(provider) {
36
- const abapCDSViewsService = await provider.getAdtService(axios_extension_1.AbapCDSViewService);
26
+ export async function getAbapCDSViews(provider) {
27
+ const abapCDSViewsService = await provider.getAdtService(AbapCDSViewService);
37
28
  const abapCDSViews = await abapCDSViewsService?.getAbapCDSViews();
38
29
  return (abapCDSViews?.map((abapCDSView) => {
39
30
  return { name: `${abapCDSView.name} (${abapCDSView.description})`, value: abapCDSView };
@@ -46,8 +37,8 @@ async function getAbapCDSViews(provider) {
46
37
  * @param backendSystem - the backend system
47
38
  * @returns the ABAP target
48
39
  */
49
- function createAbapTarget(destination, backendSystem) {
50
- if ((0, btp_utils_1.isAppStudio)()) {
40
+ export function createAbapTarget(destination, backendSystem) {
41
+ if (isAppStudio()) {
51
42
  return { destination: destination?.Name };
52
43
  }
53
44
  else {
@@ -60,7 +51,7 @@ function createAbapTarget(destination, backendSystem) {
60
51
  * @param serviceName - the service name
61
52
  * @returns the service name choices
62
53
  */
63
- function getServiceNameChoices(serviceName) {
54
+ export function getServiceNameChoices(serviceName) {
64
55
  return [
65
56
  {
66
57
  name: serviceName,
@@ -73,9 +64,9 @@ function getServiceNameChoices(serviceName) {
73
64
  *
74
65
  * @returns the validation error link
75
66
  */
76
- async function getValidationErrorLink() {
77
- (0, inquirer_common_1.setTelemetryClient)(telemetry_1.ClientFactory.getTelemetryClient());
78
- return inquirer_common_1.ErrorHandler.getHelpLink(guided_answers_helper_1.HELP_NODES.UI_SERVICE_GENERATOR, inquirer_common_1.ERROR_TYPE.INTERNAL_SERVER_ERROR, (0, i18n_1.t)('error.validatingContent'));
67
+ export async function getValidationErrorLink() {
68
+ setTelemetryClient(ClientFactory.getTelemetryClient());
69
+ return ErrorHandler.getHelpLink(HELP_NODES.UI_SERVICE_GENERATOR, ERROR_TYPE.INTERNAL_SERVER_ERROR, t('error.validatingContent'));
79
70
  }
80
71
  /**
81
72
  * Determines if the draft enabled prompt is shown.
@@ -83,7 +74,7 @@ async function getValidationErrorLink() {
83
74
  * @param useDraftEnabled - user provided value for draft enabled
84
75
  * @returns boolean
85
76
  */
86
- function defaultOrShowDraftQuestion(useDraftEnabled) {
77
+ export function defaultOrShowDraftQuestion(useDraftEnabled) {
87
78
  return useDraftEnabled ?? true;
88
79
  }
89
80
  /**
@@ -92,7 +83,7 @@ function defaultOrShowDraftQuestion(useDraftEnabled) {
92
83
  * @param useLaunchGen - user provided value for app gen launch
93
84
  * @returns boolean
94
85
  */
95
- function defaultOrShowAppGenLaunchQuestion(useLaunchGen) {
86
+ export function defaultOrShowAppGenLaunchQuestion(useLaunchGen) {
96
87
  return useLaunchGen ?? true;
97
88
  }
98
89
  //# sourceMappingURL=prompt-helper.js.map
@@ -1,4 +1,4 @@
1
- import type { ServiceConfig, SystemSelectionAnswers } from '../types';
1
+ import type { ServiceConfig, SystemSelectionAnswers } from '../types.js';
2
2
  /**
3
3
  * Much of the values returned by the ui service inquirer prompting are derived from prompt answers and are not direct answer values.
4
4
  * Since inquirer does not provide a way to return values that are not direct answers from prompts, this class will maintain the derived values
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PromptState = void 0;
4
1
  /**
5
2
  * Much of the values returned by the ui service inquirer prompting are derived from prompt answers and are not direct answer values.
6
3
  * Since inquirer does not provide a way to return values that are not direct answers from prompts, this class will maintain the derived values
7
4
  * across prompts statically for the lifespan of the prompting session.
8
5
  *
9
6
  */
10
- class PromptState {
7
+ export class PromptState {
11
8
  static _systemSelection = {};
12
9
  static _serviceConfig;
13
10
  /**
@@ -61,5 +58,4 @@ class PromptState {
61
58
  };
62
59
  }
63
60
  }
64
- exports.PromptState = PromptState;
65
61
  //# sourceMappingURL=prompt-state.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
2
  import type { Question } from 'inquirer';
3
- import type { ServiceConfig, ServiceConfigOptions, ServiceConfigQuestion, SystemSelectionAnswers, UiServiceAnswers } from '../types';
3
+ import type { ServiceConfig, ServiceConfigOptions, ServiceConfigQuestion, SystemSelectionAnswers, UiServiceAnswers } from '../types.js';
4
4
  /**
5
5
  * Get the system selection prompts.
6
6
  *
@@ -1,14 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSystemSelectionPrompts = getSystemSelectionPrompts;
7
- exports.getConfigPrompts = getConfigPrompts;
8
- const logger_helper_1 = __importDefault(require("../logger-helper"));
9
- const questions_1 = require("./configuration/questions");
10
- const prompt_state_1 = require("./prompt-state");
11
- const questions_2 = require("./system-selection/questions");
1
+ import LoggerHelper from '../logger-helper.js';
2
+ import { getConfigQuestions } from './configuration/questions.js';
3
+ import { PromptState } from './prompt-state.js';
4
+ import { getSystemQuestions } from './system-selection/questions.js';
12
5
  /**
13
6
  * Get the system selection prompts.
14
7
  *
@@ -17,13 +10,13 @@ const questions_2 = require("./system-selection/questions");
17
10
  * @param logger - optional logger instance to use for logging
18
11
  * @returns the system selection prompts
19
12
  */
20
- async function getSystemSelectionPrompts(answers, systemName, logger) {
13
+ export async function getSystemSelectionPrompts(answers, systemName, logger) {
21
14
  if (logger) {
22
- logger_helper_1.default.logger = logger;
15
+ LoggerHelper.logger = logger;
23
16
  }
24
17
  return {
25
- prompts: await (0, questions_2.getSystemQuestions)(logger_helper_1.default.logger, answers, systemName),
26
- answers: prompt_state_1.PromptState.systemSelection
18
+ prompts: await getSystemQuestions(LoggerHelper.logger, answers, systemName),
19
+ answers: PromptState.systemSelection
27
20
  };
28
21
  }
29
22
  /**
@@ -34,16 +27,16 @@ async function getSystemSelectionPrompts(answers, systemName, logger) {
34
27
  * @param logger - optional logger instance to use for logging
35
28
  * @returns the configuration prompts
36
29
  */
37
- function getConfigPrompts(systemSelectionAnswers, options, logger) {
30
+ export function getConfigPrompts(systemSelectionAnswers, options, logger) {
38
31
  if (logger) {
39
- logger_helper_1.default.logger = logger;
32
+ LoggerHelper.logger = logger;
40
33
  }
41
- if (!prompt_state_1.PromptState.systemSelection.connectedSystem) {
42
- Object.assign(prompt_state_1.PromptState.systemSelection, systemSelectionAnswers);
34
+ if (!PromptState.systemSelection.connectedSystem) {
35
+ Object.assign(PromptState.systemSelection, systemSelectionAnswers);
43
36
  }
44
37
  return {
45
- prompts: (0, questions_1.getConfigQuestions)(logger_helper_1.default.logger, options),
46
- answers: prompt_state_1.PromptState.serviceConfig
38
+ prompts: getConfigQuestions(LoggerHelper.logger, options),
39
+ answers: PromptState.serviceConfig
47
40
  };
48
41
  }
49
42
  //# sourceMappingURL=prompts.js.map
@@ -1,2 +1,2 @@
1
- export * from './questions';
1
+ export * from './questions.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,2 @@
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("./questions"), exports);
1
+ export * from './questions.js';
18
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
2
  import type { Question } from 'yeoman-generator';
3
- import { type UiServiceAnswers } from '../../types';
3
+ import { type UiServiceAnswers } from '../../types.js';
4
4
  /**
5
5
  * Get the system questions.
6
6
  *
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSystemQuestions = getSystemQuestions;
4
- const odata_service_inquirer_1 = require("@sap-ux/odata-service-inquirer");
5
- const i18n_1 = require("../../i18n");
6
- const types_1 = require("../../types");
7
- const prompt_helper_1 = require("../prompt-helper");
8
- const prompt_state_1 = require("../prompt-state");
1
+ import { getSystemSelectionQuestions, promptNames } from '@sap-ux/odata-service-inquirer';
2
+ import { t } from '../../i18n.js';
3
+ import { ObjectType } from '../../types.js';
4
+ import { getAbapCDSViews, getBusinessObjects } from '../prompt-helper.js';
5
+ import { PromptState } from '../prompt-state.js';
9
6
  /**
10
7
  * Get the system questions.
11
8
  *
@@ -14,9 +11,9 @@ const prompt_state_1 = require("../prompt-state");
14
11
  * @param systemName - the name of the system
15
12
  * @returns the system questions
16
13
  */
17
- async function getSystemQuestions(logger, previousAnswers, systemName) {
18
- prompt_state_1.PromptState.reset();
19
- const systemQuestions = await (0, odata_service_inquirer_1.getSystemSelectionQuestions)({
14
+ export async function getSystemQuestions(logger, previousAnswers, systemName) {
15
+ PromptState.reset();
16
+ const systemQuestions = await getSystemSelectionQuestions({
20
17
  serviceSelection: { hide: true },
21
18
  systemSelection: {
22
19
  defaultChoice: systemName,
@@ -29,8 +26,8 @@ async function getSystemQuestions(logger, previousAnswers, systemName) {
29
26
  const objectQuestions = [
30
27
  {
31
28
  when: (answers) => {
32
- if (answers[odata_service_inquirer_1.promptNames.systemSelection] && systemQuestions.answers.connectedSystem?.serviceProvider) {
33
- prompt_state_1.PromptState.systemSelection.connectedSystem = systemQuestions.answers.connectedSystem;
29
+ if (answers[promptNames.systemSelection] && systemQuestions.answers.connectedSystem?.serviceProvider) {
30
+ PromptState.systemSelection.connectedSystem = systemQuestions.answers.connectedSystem;
34
31
  return true;
35
32
  }
36
33
  return false;
@@ -41,14 +38,14 @@ async function getSystemQuestions(logger, previousAnswers, systemName) {
41
38
  breadcrumb: true
42
39
  },
43
40
  default: previousAnswers?.objectType ?? '',
44
- message: (0, i18n_1.t)('prompts.objectTypeLabel'),
41
+ message: t('prompts.objectTypeLabel'),
45
42
  choices: () => [
46
- { name: (0, i18n_1.t)('prompts.businessObjectInterfaceLabel'), value: types_1.ObjectType.BUSINESS_OBJECT },
47
- { name: (0, i18n_1.t)('prompts.abapCdsServiceLabel'), value: types_1.ObjectType.CDS_VIEW }
43
+ { name: t('prompts.businessObjectInterfaceLabel'), value: ObjectType.BUSINESS_OBJECT },
44
+ { name: t('prompts.abapCdsServiceLabel'), value: ObjectType.CDS_VIEW }
48
45
  ]
49
46
  },
50
47
  {
51
- when: (previousAnswers) => previousAnswers.objectType === types_1.ObjectType.BUSINESS_OBJECT,
48
+ when: (previousAnswers) => previousAnswers.objectType === ObjectType.BUSINESS_OBJECT,
52
49
  type: 'list',
53
50
  name: 'businessObjectInterface',
54
51
  guiOptions: {
@@ -56,31 +53,31 @@ async function getSystemQuestions(logger, previousAnswers, systemName) {
56
53
  applyDefaultWhenDirty: true
57
54
  },
58
55
  default: previousAnswers?.businessObjectInterface ?? '',
59
- message: (0, i18n_1.t)('prompts.businessObjectInterfaceLabel'),
56
+ message: t('prompts.businessObjectInterfaceLabel'),
60
57
  choices: async () => {
61
58
  try {
62
- return await (0, prompt_helper_1.getBusinessObjects)(prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider);
59
+ return await getBusinessObjects(PromptState.systemSelection.connectedSystem?.serviceProvider);
63
60
  }
64
61
  catch (error) {
65
- logger.error((0, i18n_1.t)('error.fetchingBusinessObjects' + error.message));
62
+ logger.error(t('error.fetchingBusinessObjects' + error.message));
66
63
  return [];
67
64
  }
68
65
  },
69
66
  validate: async (val) => {
70
67
  if (val) {
71
68
  try {
72
- prompt_state_1.PromptState.systemSelection.objectGenerator = await (prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider).getUiServiceGenerator(val);
69
+ PromptState.systemSelection.objectGenerator = await (PromptState.systemSelection.connectedSystem?.serviceProvider).getUiServiceGenerator(val);
73
70
  }
74
71
  catch (error) {
75
- logger.error((0, i18n_1.t)('error.fetchingGenerator', { error: error.message }));
72
+ logger.error(t('error.fetchingGenerator', { error: error.message }));
76
73
  }
77
- return prompt_state_1.PromptState.systemSelection.objectGenerator ? true : (0, i18n_1.t)('error.noGeneratorFoundBo');
74
+ return PromptState.systemSelection.objectGenerator ? true : t('error.noGeneratorFoundBo');
78
75
  }
79
76
  return false;
80
77
  }
81
78
  },
82
79
  {
83
- when: (previousAnswers) => previousAnswers.objectType === types_1.ObjectType.CDS_VIEW,
80
+ when: (previousAnswers) => previousAnswers.objectType === ObjectType.CDS_VIEW,
84
81
  type: 'list',
85
82
  name: 'abapCDSView',
86
83
  guiOptions: {
@@ -88,25 +85,25 @@ async function getSystemQuestions(logger, previousAnswers, systemName) {
88
85
  applyDefaultWhenDirty: true
89
86
  },
90
87
  default: previousAnswers?.abapCDSView ?? '',
91
- message: (0, i18n_1.t)('prompts.abapCdsServiceLabel'),
88
+ message: t('prompts.abapCdsServiceLabel'),
92
89
  choices: async () => {
93
90
  try {
94
- return await (0, prompt_helper_1.getAbapCDSViews)(prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider);
91
+ return await getAbapCDSViews(PromptState.systemSelection.connectedSystem?.serviceProvider);
95
92
  }
96
93
  catch (error) {
97
- logger.error((0, i18n_1.t)('error.fetchingCdsViews', { error: error.message }));
94
+ logger.error(t('error.fetchingCdsViews', { error: error.message }));
98
95
  return [];
99
96
  }
100
97
  },
101
98
  validate: async (val) => {
102
99
  if (val) {
103
100
  try {
104
- prompt_state_1.PromptState.systemSelection.objectGenerator = await (prompt_state_1.PromptState.systemSelection.connectedSystem?.serviceProvider).getUiServiceGenerator(val);
101
+ PromptState.systemSelection.objectGenerator = await (PromptState.systemSelection.connectedSystem?.serviceProvider).getUiServiceGenerator(val);
105
102
  }
106
103
  catch (error) {
107
- logger.error((0, i18n_1.t)('error.fetchingGenerator', { error: error.message }));
104
+ logger.error(t('error.fetchingGenerator', { error: error.message }));
108
105
  }
109
- return prompt_state_1.PromptState.systemSelection.objectGenerator ? true : (0, i18n_1.t)('error.noGeneratorFoundCdsService');
106
+ return PromptState.systemSelection.objectGenerator ? true : t('error.noGeneratorFoundCdsService');
110
107
  }
111
108
  return false;
112
109
  }
package/dist/types.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectType = void 0;
4
- var ObjectType;
1
+ export var ObjectType;
5
2
  (function (ObjectType) {
6
3
  ObjectType["BUSINESS_OBJECT"] = "BusinessObject";
7
4
  ObjectType["CDS_VIEW"] = "CDSView";
8
- })(ObjectType || (exports.ObjectType = ObjectType = {}));
5
+ })(ObjectType || (ObjectType = {}));
9
6
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/ui-service-inquirer",
3
3
  "description": "Generator for creating UI Service",
4
- "version": "0.3.8",
4
+ "version": "1.0.0",
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"
12
12
  },
13
+ "type": "module",
13
14
  "license": "Apache-2.0",
14
15
  "main": "dist/index.js",
15
16
  "files": [
@@ -23,16 +24,17 @@
23
24
  "@sap-devx/yeoman-ui-types": "1.25.0",
24
25
  "i18next": "25.10.10",
25
26
  "yeoman-generator": "5.10.0",
26
- "@sap-ux/abap-deploy-config-inquirer": "1.9.7",
27
- "@sap-ux/axios-extension": "1.26.1",
28
- "@sap-ux/btp-utils": "1.2.1",
29
- "@sap-ux/guided-answers-helper": "0.5.1",
30
- "@sap-ux/inquirer-common": "0.13.6",
31
- "@sap-ux/logger": "0.9.0",
32
- "@sap-ux/odata-service-inquirer": "2.23.4",
33
- "@sap-ux/telemetry": "0.7.5"
27
+ "@sap-ux/abap-deploy-config-inquirer": "2.0.0",
28
+ "@sap-ux/axios-extension": "2.0.0",
29
+ "@sap-ux/btp-utils": "2.0.0",
30
+ "@sap-ux/guided-answers-helper": "1.0.0",
31
+ "@sap-ux/inquirer-common": "1.0.0",
32
+ "@sap-ux/logger": "1.0.0",
33
+ "@sap-ux/odata-service-inquirer": "3.0.0",
34
+ "@sap-ux/telemetry": "1.0.0"
34
35
  },
35
36
  "devDependencies": {
37
+ "@jest/globals": "30.3.0",
36
38
  "@types/inquirer-autocomplete-prompt": "2.0.2",
37
39
  "@types/inquirer": "8.2.6",
38
40
  "@types/yeoman-environment": "2.10.11",
@@ -43,9 +45,9 @@
43
45
  "nock": "14.0.11",
44
46
  "rimraf": "6.1.3",
45
47
  "yeoman-test": "6.3.0",
46
- "@sap-ux/jest-file-matchers": "0.3.0",
47
- "@sap-ux/store": "1.6.1",
48
- "@sap-ux/system-access": "0.8.2"
48
+ "@sap-ux/jest-file-matchers": "1.0.0",
49
+ "@sap-ux/store": "2.0.0",
50
+ "@sap-ux/system-access": "1.0.0"
49
51
  },
50
52
  "engines": {
51
53
  "node": ">=22.x"
@@ -56,8 +58,8 @@
56
58
  "watch": "tsc --watch",
57
59
  "lint": "eslint",
58
60
  "lint:fix": "eslint --fix",
59
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
60
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
61
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
62
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
61
63
  "link": "pnpm link --global",
62
64
  "unlink": "pnpm unlink --global"
63
65
  }