@sap-ux/odata-service-inquirer 3.0.25 → 3.2.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/prompts/datasources/sap-system/system-selection/prompt-helpers.d.ts +3 -2
- package/dist/prompts/datasources/sap-system/system-selection/prompt-helpers.js +3 -2
- package/dist/prompts/datasources/sap-system/system-selection/questions.js +1 -1
- package/dist/prompts/edmx/questions.js +55 -30
- package/dist/translations/odata-service-inquirer.i18n.json +7 -3
- package/dist/types.d.ts +10 -3
- package/dist/types.js +1 -0
- package/dist/utils/store.d.ts +4 -3
- package/dist/utils/store.js +4 -5
- package/package.json +8 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Destination } from '@sap-ux/btp-utils';
|
|
2
2
|
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
3
|
-
import { type BackendSystemKey, type BackendSystem } from '@sap-ux/store';
|
|
3
|
+
import { type BackendSystemKey, type BackendSystem, type BackendSystemFilter } from '@sap-ux/store';
|
|
4
4
|
import type { ListChoiceOptions } from 'inquirer';
|
|
5
5
|
import type { ConnectedSystem, DestinationFilters } from '../../../../types.js';
|
|
6
6
|
import type { ConnectionValidator } from '../../../connectionValidator.js';
|
|
@@ -42,9 +42,10 @@ export declare function connectWithDestination(destination: Destination, connect
|
|
|
42
42
|
* @param destinationFilters the filters to apply to the destination choices
|
|
43
43
|
* @param includeCloudFoundryAbapEnvChoice whether to include the Cloud Foundry ABAP environment choice in the list
|
|
44
44
|
* @param hideNewSystem - if true it will prevent adding the 'New System' option to the list
|
|
45
|
+
* @param backendSystemFilter - optional store filter to apply when retrieving backend systems
|
|
45
46
|
* @returns a list of choices for the system selection prompt
|
|
46
47
|
*/
|
|
47
|
-
export declare function createSystemChoices(destinationFilters?: Partial<DestinationFilters>, includeCloudFoundryAbapEnvChoice?: boolean, hideNewSystem?: boolean): Promise<ListChoiceOptions<SystemSelectionAnswerType>[]>;
|
|
48
|
+
export declare function createSystemChoices(destinationFilters?: Partial<DestinationFilters>, includeCloudFoundryAbapEnvChoice?: boolean, hideNewSystem?: boolean, backendSystemFilter?: BackendSystemFilter): Promise<ListChoiceOptions<SystemSelectionAnswerType>[]>;
|
|
48
49
|
/**
|
|
49
50
|
* Find the default selection index based on the default choice value.
|
|
50
51
|
*
|
|
@@ -143,9 +143,10 @@ function matchesFilters(destination, filters) {
|
|
|
143
143
|
* @param destinationFilters the filters to apply to the destination choices
|
|
144
144
|
* @param includeCloudFoundryAbapEnvChoice whether to include the Cloud Foundry ABAP environment choice in the list
|
|
145
145
|
* @param hideNewSystem - if true it will prevent adding the 'New System' option to the list
|
|
146
|
+
* @param backendSystemFilter - optional store filter to apply when retrieving backend systems
|
|
146
147
|
* @returns a list of choices for the system selection prompt
|
|
147
148
|
*/
|
|
148
|
-
export async function createSystemChoices(destinationFilters, includeCloudFoundryAbapEnvChoice = false, hideNewSystem = false) {
|
|
149
|
+
export async function createSystemChoices(destinationFilters, includeCloudFoundryAbapEnvChoice = false, hideNewSystem = false, backendSystemFilter) {
|
|
149
150
|
let systemChoices = [];
|
|
150
151
|
let newSystemChoice;
|
|
151
152
|
// If this is BAS, return destinations, otherwise return stored backend systems
|
|
@@ -183,7 +184,7 @@ export async function createSystemChoices(destinationFilters, includeCloudFoundr
|
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
else {
|
|
186
|
-
const backendSystems = await getAllBackendSystems(false);
|
|
187
|
+
const backendSystems = await getAllBackendSystems(false, backendSystemFilter);
|
|
187
188
|
// Cache the backend systems
|
|
188
189
|
PromptState.backendSystemsCache = backendSystems;
|
|
189
190
|
systemChoices = backendSystems.map((system) => {
|
|
@@ -95,7 +95,7 @@ export async function getSystemSelectionQuestions(promptOptions, connectedSystem
|
|
|
95
95
|
export async function getSystemConnectionQuestions(connectionValidator, promptOptions, cachedConnectedSystem) {
|
|
96
96
|
const requiredOdataVersion = promptOptions?.serviceSelection?.requiredOdataVersion;
|
|
97
97
|
const destinationFilters = promptOptions?.systemSelection?.destinationFilters;
|
|
98
|
-
const systemChoices = await createSystemChoices(destinationFilters, promptOptions?.systemSelection?.includeCloudFoundryAbapEnvChoice, promptOptions?.systemSelection?.hideNewSystem);
|
|
98
|
+
const systemChoices = await createSystemChoices(destinationFilters, promptOptions?.systemSelection?.includeCloudFoundryAbapEnvChoice, promptOptions?.systemSelection?.hideNewSystem, promptOptions?.systemSelection?.backendSystemFilter);
|
|
99
99
|
let defaultChoiceIndex = findDefaultSystemSelectionIndex(systemChoices, promptOptions?.systemSelection?.defaultChoice);
|
|
100
100
|
// Alternative connection path, will override default authentication path (catalog endpoints)
|
|
101
101
|
let connectPath = promptOptions?.systemSelection?.connectPath;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Severity } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { PageTemplateType, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT } from '@sap-ux/fe-fpm-writer';
|
|
2
3
|
import { searchChoices, getRecursiveHierarchyQualifierForEntitySet, findEntitySetByName } from '@sap-ux/inquirer-common';
|
|
3
4
|
import { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
4
5
|
import { t } from '../../i18n.js';
|
|
@@ -150,43 +151,67 @@ export function getEntitySelectionQuestions(metadata, templateType, isCapService
|
|
|
150
151
|
return entityQuestions;
|
|
151
152
|
}
|
|
152
153
|
/**
|
|
153
|
-
* Get the questions for page building block.
|
|
154
|
+
* Get the questions for the page building block prompts.
|
|
154
155
|
*
|
|
155
156
|
* @returns the page building block questions
|
|
156
157
|
*/
|
|
157
158
|
function getPageBuildingBlockQuestions() {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
return [
|
|
160
|
+
{
|
|
161
|
+
type: 'confirm',
|
|
162
|
+
name: EntityPromptNames.addPageBuildingBlock,
|
|
163
|
+
message: t('prompts.pageBuildingBlock.message'),
|
|
164
|
+
default: false,
|
|
165
|
+
guiOptions: {
|
|
166
|
+
breadcrumb: true,
|
|
167
|
+
hint: t('prompts.pageBuildingBlock.tooltip', {
|
|
168
|
+
minUi5VersionForPageBuildingBlock: MIN_UI5_VERSION_PAGE_BUILDING_BLOCK
|
|
169
|
+
})
|
|
170
|
+
}
|
|
167
171
|
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
{
|
|
173
|
+
when: (answers) => answers.addPageBuildingBlock === true,
|
|
174
|
+
type: 'confirm',
|
|
175
|
+
name: EntityPromptNames.pageBuildingBlockLayout,
|
|
176
|
+
message: t('prompts.pageBuildingBlock.layoutMessage'),
|
|
177
|
+
default: true,
|
|
178
|
+
labelTrue: t('prompts.pageBuildingBlock.choiceBasic'),
|
|
179
|
+
labelFalse: t('prompts.pageBuildingBlock.choiceFull'),
|
|
180
|
+
filter: (val) => (val ? PageTemplateType.Basic : PageTemplateType.Full),
|
|
181
|
+
guiOptions: {
|
|
182
|
+
breadcrumb: t('prompts.pageBuildingBlock.layoutMessage')
|
|
183
|
+
},
|
|
184
|
+
additionalMessages: (input) => {
|
|
185
|
+
if (input === true) {
|
|
186
|
+
return {
|
|
187
|
+
message: t('prompts.pageBuildingBlock.basicLayoutWarning', {
|
|
188
|
+
minUi5VersionForPageBuildingBlock: MIN_UI5_VERSION_PAGE_BUILDING_BLOCK
|
|
189
|
+
}),
|
|
190
|
+
severity: Severity.warning
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (input === false) {
|
|
194
|
+
return {
|
|
195
|
+
message: t('prompts.pageBuildingBlock.fullLayoutWarning', {
|
|
196
|
+
minUi5VersionForFullLayout: MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT
|
|
197
|
+
}),
|
|
198
|
+
severity: Severity.warning
|
|
199
|
+
};
|
|
200
|
+
}
|
|
174
201
|
}
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
// If the user wants to add a Page Building Block, ask for the title
|
|
178
|
-
pageBuildingBlockQuestions.push({
|
|
179
|
-
when: (answers) => answers.addPageBuildingBlock === true,
|
|
180
|
-
type: 'input',
|
|
181
|
-
name: EntityPromptNames.pageBuildingBlockTitle,
|
|
182
|
-
message: t('prompts.pageBuildingBlock.titleMessage'),
|
|
183
|
-
guiOptions: {
|
|
184
|
-
breadcrumb: true,
|
|
185
|
-
mandatory: true
|
|
186
202
|
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
203
|
+
{
|
|
204
|
+
when: (answers) => answers.addPageBuildingBlock === true,
|
|
205
|
+
type: 'input',
|
|
206
|
+
name: EntityPromptNames.pageBuildingBlockTitle,
|
|
207
|
+
message: t('prompts.pageBuildingBlock.titleMessage'),
|
|
208
|
+
guiOptions: {
|
|
209
|
+
breadcrumb: true,
|
|
210
|
+
mandatory: true
|
|
211
|
+
},
|
|
212
|
+
validate: (input) => !!input
|
|
213
|
+
}
|
|
214
|
+
];
|
|
190
215
|
}
|
|
191
216
|
/**
|
|
192
217
|
* Get the questions that may be used to prompt for table layout options.
|
|
@@ -153,9 +153,13 @@
|
|
|
153
153
|
},
|
|
154
154
|
"pageBuildingBlock": {
|
|
155
155
|
"message": "Add a Page Building Block to the Application?",
|
|
156
|
-
"tooltip": "The Page building block is supported from SAPUI5 version
|
|
157
|
-
"
|
|
158
|
-
"
|
|
156
|
+
"tooltip": "The Page building block is supported from SAPUI5 version {{ minUi5VersionForPageBuildingBlock }}. By choosing this option, you are restricting the minimum SAPUI5 version to {{ minUi5VersionForPageBuildingBlock }} and above.",
|
|
157
|
+
"titleMessage": "Page Title",
|
|
158
|
+
"layoutMessage": "Page Building Block Layout",
|
|
159
|
+
"choiceFull": "Full Layout",
|
|
160
|
+
"choiceBasic": "Basic Layout",
|
|
161
|
+
"basicLayoutWarning": "The Page building block is supported with SAPUI5 version {{ minUi5VersionForPageBuildingBlock }} and above.",
|
|
162
|
+
"fullLayoutWarning": "Full Layout is supported with SAPUI5 version {{ minUi5VersionForFullLayout }} and above."
|
|
159
163
|
},
|
|
160
164
|
"tableType": {
|
|
161
165
|
"message": "Table Type",
|
package/dist/types.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ import type { CapService } from '@sap-ux/cap-config-writer';
|
|
|
4
4
|
import type { TableSelectionMode, TableType } from '@sap-ux/fiori-elements-writer';
|
|
5
5
|
import type { CommonPromptOptions, YUIQuestion } from '@sap-ux/inquirer-common';
|
|
6
6
|
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
7
|
-
import type { BackendSystem } from '@sap-ux/store';
|
|
7
|
+
import type { BackendSystem, BackendSystemFilter } from '@sap-ux/store';
|
|
8
8
|
import type { ListChoiceOptions } from 'inquirer';
|
|
9
9
|
import type { serviceUrlInternalPromptNames } from './prompts/datasources/service-url/types.js';
|
|
10
10
|
import type { EntityAnswer, NavigationEntityAnswer } from './prompts/edmx/entity-helper.js';
|
|
11
|
+
import type { PageTemplateType } from '@sap-ux/fe-fpm-writer';
|
|
11
12
|
/**
|
|
12
13
|
* This file contains types that are exported by the module and are needed for consumers using the APIs `prompt` and `getPrompts`.
|
|
13
14
|
*/
|
|
@@ -159,6 +160,7 @@ export declare const EntityPromptNames: {
|
|
|
159
160
|
readonly navigationEntity: "navigationEntity";
|
|
160
161
|
readonly filterEntitySet: "filterEntitySet";
|
|
161
162
|
readonly addPageBuildingBlock: "addPageBuildingBlock";
|
|
163
|
+
readonly pageBuildingBlockLayout: "pageBuildingBlockLayout";
|
|
162
164
|
readonly pageBuildingBlockTitle: "pageBuildingBlockTitle";
|
|
163
165
|
readonly tableType: "tableType";
|
|
164
166
|
readonly hierarchyQualifier: "hierarchyQualifier";
|
|
@@ -180,9 +182,9 @@ export interface EntitySelectionAnswers {
|
|
|
180
182
|
* Answers related to the Page Building Block prompt.
|
|
181
183
|
*/
|
|
182
184
|
export interface PageBuildingBlockAnswers {
|
|
183
|
-
/** Indicates if a Page Building Block should be addedn*/
|
|
184
185
|
[EntityPromptNames.addPageBuildingBlock]?: boolean;
|
|
185
|
-
/** The
|
|
186
|
+
/** The layout type for the page building block. This is only applicable if addPageBuildingBlock is true. */
|
|
187
|
+
[EntityPromptNames.pageBuildingBlockLayout]?: PageTemplateType;
|
|
186
188
|
[EntityPromptNames.pageBuildingBlockTitle]?: string;
|
|
187
189
|
}
|
|
188
190
|
export interface TableConfigAnswers {
|
|
@@ -307,6 +309,11 @@ export type SystemSelectionPromptOptions = {
|
|
|
307
309
|
* If true, the 'New System' option is not added to the system selection list. Default is false - the 'New System' option will be available.
|
|
308
310
|
*/
|
|
309
311
|
hideNewSystem?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Include systems specified by the backendSystemFilter see {@link BackendSystemFilter}.
|
|
314
|
+
* Defaults to { connectionType: ['abap_catalog', 'odata_service'] } if not provided.
|
|
315
|
+
*/
|
|
316
|
+
backendSystemFilter?: BackendSystemFilter;
|
|
310
317
|
};
|
|
311
318
|
export type MetadataPromptOptions = {
|
|
312
319
|
/**
|
package/dist/types.js
CHANGED
|
@@ -76,6 +76,7 @@ export const EntityPromptNames = {
|
|
|
76
76
|
navigationEntity: 'navigationEntity',
|
|
77
77
|
filterEntitySet: 'filterEntitySet',
|
|
78
78
|
addPageBuildingBlock: 'addPageBuildingBlock',
|
|
79
|
+
pageBuildingBlockLayout: 'pageBuildingBlockLayout',
|
|
79
80
|
pageBuildingBlockTitle: 'pageBuildingBlockTitle',
|
|
80
81
|
tableType: 'tableType',
|
|
81
82
|
hierarchyQualifier: 'hierarchyQualifier',
|
package/dist/utils/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BackendSystem, type BackendSystemKey, type Service } from '@sap-ux/store';
|
|
1
|
+
import { type BackendSystem, type BackendSystemKey, type BackendSystemFilter, type Service } from '@sap-ux/store';
|
|
2
2
|
/**
|
|
3
3
|
* Get the backend system service instance.
|
|
4
4
|
*
|
|
@@ -9,7 +9,8 @@ export declare function getBackendSystemService(): Promise<Service<BackendSystem
|
|
|
9
9
|
* Fetch all backend systems.
|
|
10
10
|
*
|
|
11
11
|
* @param includeSensitiveData - whether to include sensitive data
|
|
12
|
-
* @
|
|
12
|
+
* @param backendSystemFilter - store filter for backend systems. Defaults to { connectionType: ['abap_catalog', 'odata_service'] } if not provided.
|
|
13
|
+
* @returns backend systems
|
|
13
14
|
*/
|
|
14
|
-
export declare function getAllBackendSystems(includeSensitiveData?: boolean): Promise<BackendSystem[] | []>;
|
|
15
|
+
export declare function getAllBackendSystems(includeSensitiveData?: boolean, backendSystemFilter?: BackendSystemFilter): Promise<BackendSystem[] | []>;
|
|
15
16
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/utils/store.js
CHANGED
|
@@ -16,17 +16,16 @@ export async function getBackendSystemService() {
|
|
|
16
16
|
* Fetch all backend systems.
|
|
17
17
|
*
|
|
18
18
|
* @param includeSensitiveData - whether to include sensitive data
|
|
19
|
-
* @
|
|
19
|
+
* @param backendSystemFilter - store filter for backend systems. Defaults to { connectionType: ['abap_catalog', 'odata_service'] } if not provided.
|
|
20
|
+
* @returns backend systems
|
|
20
21
|
*/
|
|
21
|
-
export async function getAllBackendSystems(includeSensitiveData = false) {
|
|
22
|
+
export async function getAllBackendSystems(includeSensitiveData = false, backendSystemFilter) {
|
|
22
23
|
let backendSystems = [];
|
|
23
24
|
try {
|
|
24
25
|
const backendService = await getBackendSystemService();
|
|
25
26
|
backendSystems = await backendService.getAll({
|
|
26
27
|
includeSensitiveData,
|
|
27
|
-
backendSystemFilter: {
|
|
28
|
-
connectionType: ['abap_catalog', 'odata_service']
|
|
29
|
-
}
|
|
28
|
+
backendSystemFilter: backendSystemFilter ?? { connectionType: ['abap_catalog', 'odata_service'] }
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/odata-service-inquirer",
|
|
3
3
|
"description": "Prompts module that can prompt users for inputs required for odata service writing",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"@sap-devx/yeoman-ui-types": "1.25.0",
|
|
34
34
|
"@sap-ux/axios-extension": "2.0.7",
|
|
35
35
|
"@sap-ux/btp-utils": "2.0.5",
|
|
36
|
-
"@sap-ux/fiori-generator-shared": "1.
|
|
36
|
+
"@sap-ux/fiori-generator-shared": "1.2.0",
|
|
37
37
|
"@sap-ux/guided-answers-helper": "1.0.1",
|
|
38
38
|
"@sap-ux/telemetry": "1.0.18",
|
|
39
|
-
"@sap-ux/inquirer-common": "1.0.
|
|
39
|
+
"@sap-ux/inquirer-common": "1.0.23",
|
|
40
40
|
"@sap-ux/logger": "1.0.3",
|
|
41
41
|
"@sap-ux/nodejs-utils": "1.0.7",
|
|
42
42
|
"@sap-ux/project-access": "2.1.6",
|
|
@@ -49,12 +49,13 @@
|
|
|
49
49
|
"@types/inquirer-autocomplete-prompt": "2.0.2",
|
|
50
50
|
"@types/inquirer": "8.2.6",
|
|
51
51
|
"jest-extended": "7.0.0",
|
|
52
|
-
"@sap-ux/
|
|
53
|
-
"@sap-ux/fiori-
|
|
54
|
-
"@sap-ux/fiori-
|
|
52
|
+
"@sap-ux/fe-fpm-writer": "1.3.0",
|
|
53
|
+
"@sap-ux/fiori-generator-shared": "1.2.0",
|
|
54
|
+
"@sap-ux/fiori-elements-writer": "3.1.0",
|
|
55
|
+
"@sap-ux/fiori-freestyle-writer": "3.0.53",
|
|
55
56
|
"@sap-ux/feature-toggle": "1.0.5",
|
|
56
57
|
"@sap-ux/odata-service-writer": "1.0.12",
|
|
57
|
-
"@sap-ux/cap-config-writer": "1.0.
|
|
58
|
+
"@sap-ux/cap-config-writer": "1.0.22"
|
|
58
59
|
},
|
|
59
60
|
"engines": {
|
|
60
61
|
"node": ">=22.x"
|