@sap-ux/odata-service-inquirer 3.0.25 → 3.1.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.
@@ -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;
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@ 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';
@@ -307,6 +307,11 @@ export type SystemSelectionPromptOptions = {
307
307
  * 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
308
  */
309
309
  hideNewSystem?: boolean;
310
+ /**
311
+ * Include systems specified by the backendSystemFilter see {@link BackendSystemFilter}.
312
+ * Defaults to { connectionType: ['abap_catalog', 'odata_service'] } if not provided.
313
+ */
314
+ backendSystemFilter?: BackendSystemFilter;
310
315
  };
311
316
  export type MetadataPromptOptions = {
312
317
  /**
@@ -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
- * @returns backened systems
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
@@ -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
- * @returns backened systems
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.25",
4
+ "version": "3.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,15 +33,15 @@
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.1.0",
37
- "@sap-ux/guided-answers-helper": "1.0.1",
36
+ "@sap-ux/fiori-generator-shared": "1.2.0",
38
37
  "@sap-ux/telemetry": "1.0.18",
39
- "@sap-ux/inquirer-common": "1.0.22",
38
+ "@sap-ux/guided-answers-helper": "1.0.1",
40
39
  "@sap-ux/logger": "1.0.3",
41
- "@sap-ux/nodejs-utils": "1.0.7",
40
+ "@sap-ux/inquirer-common": "1.0.23",
42
41
  "@sap-ux/project-access": "2.1.6",
42
+ "@sap-ux/store": "2.0.4",
43
43
  "@sap-ux/project-input-validator": "1.0.10",
44
- "@sap-ux/store": "2.0.4"
44
+ "@sap-ux/nodejs-utils": "1.0.7"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jest/globals": "30.4.1",
@@ -49,12 +49,12 @@
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/fiori-generator-shared": "1.1.0",
53
- "@sap-ux/fiori-elements-writer": "3.0.57",
54
- "@sap-ux/fiori-freestyle-writer": "3.0.51",
52
+ "@sap-ux/fiori-elements-writer": "3.0.60",
53
+ "@sap-ux/fiori-freestyle-writer": "3.0.53",
54
+ "@sap-ux/fiori-generator-shared": "1.2.0",
55
55
  "@sap-ux/feature-toggle": "1.0.5",
56
56
  "@sap-ux/odata-service-writer": "1.0.12",
57
- "@sap-ux/cap-config-writer": "1.0.21"
57
+ "@sap-ux/cap-config-writer": "1.0.22"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=22.x"