@sap-ux/odata-service-inquirer 1.1.1 → 1.2.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.
@@ -81,7 +81,15 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
81
81
  }
82
82
  return serviceChoices;
83
83
  },
84
- additionalMessages: (selectedService) => (0, service_helper_1.getSelectedServiceMessage)(serviceChoices, selectedService, connectValidator, requiredOdataVersion),
84
+ additionalMessages: (selectedService) => {
85
+ // Additional messages is executed after validation, so we can assume the PromptState has been updated
86
+ let hasBackendAnnotations = false;
87
+ if (selectedService && utils_1.PromptState.odataService.servicePath === selectedService.servicePath) {
88
+ hasBackendAnnotations =
89
+ !!utils_1.PromptState.odataService.annotations && utils_1.PromptState.odataService.annotations.length > 0;
90
+ }
91
+ return (0, service_helper_1.getSelectedServiceMessage)(serviceChoices, selectedService, connectValidator, requiredOdataVersion, hasBackendAnnotations);
92
+ },
85
93
  default: () => (0, utils_1.getDefaultChoiceIndex)(serviceChoices),
86
94
  // Warning: only executes in YUI and cli when automcomplete is used
87
95
  validate: async (service) => {
@@ -65,7 +65,8 @@ export declare function getSelectedServiceLabel(username: string | undefined): s
65
65
  * @param selectedService the selected service
66
66
  * @param connectValidator the connection validator
67
67
  * @param requiredOdataVersion the required OData version for the service
68
+ * @param hasAnnotations used to determine whether to show a warning message that annotations could not be retrieved
68
69
  * @returns the service selection prompt additional message
69
70
  */
70
- export declare function getSelectedServiceMessage(serviceChoices: ListChoiceOptions<ServiceAnswer>[], selectedService: ServiceAnswer, connectValidator: ConnectionValidator, requiredOdataVersion?: OdataVersion): Promise<IMessageSeverity | undefined>;
71
+ export declare function getSelectedServiceMessage(serviceChoices: ListChoiceOptions<ServiceAnswer>[], selectedService: ServiceAnswer, connectValidator: ConnectionValidator, requiredOdataVersion?: OdataVersion, hasAnnotations?: boolean): Promise<IMessageSeverity | undefined>;
71
72
  //# sourceMappingURL=service-helper.d.ts.map
@@ -247,9 +247,10 @@ function getSelectedServiceLabel(username) {
247
247
  * @param selectedService the selected service
248
248
  * @param connectValidator the connection validator
249
249
  * @param requiredOdataVersion the required OData version for the service
250
+ * @param hasAnnotations used to determine whether to show a warning message that annotations could not be retrieved
250
251
  * @returns the service selection prompt additional message
251
252
  */
252
- async function getSelectedServiceMessage(serviceChoices, selectedService, connectValidator, requiredOdataVersion) {
253
+ async function getSelectedServiceMessage(serviceChoices, selectedService, connectValidator, requiredOdataVersion, hasAnnotations = true) {
253
254
  if (serviceChoices?.length === 0) {
254
255
  if (requiredOdataVersion) {
255
256
  return {
@@ -269,6 +270,13 @@ async function getSelectedServiceMessage(serviceChoices, selectedService, connec
269
270
  if (selectedService) {
270
271
  let serviceType = selectedService.serviceType;
271
272
  if (selectedService.serviceODataVersion === axios_extension_1.ODataVersion.v2) {
273
+ // Warn if odata service is version is '2' and no annotations are present
274
+ if (!hasAnnotations) {
275
+ return {
276
+ message: (0, i18n_1.t)('prompts.warnings.noAnnotations'),
277
+ severity: yeoman_ui_types_1.Severity.warning
278
+ };
279
+ }
272
280
  serviceType = await getServiceType(selectedService.servicePath, selectedService.serviceType, connectValidator.catalogs[axios_extension_1.ODataVersion.v2]);
273
281
  }
274
282
  if (serviceType && serviceType !== axios_extension_1.ServiceType.UI) {
@@ -63,7 +63,8 @@
63
63
  "warnings": {
64
64
  "nonUIServiceTypeWarningMessage": "Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",
65
65
  "noServicesAvailable": "No services available for the selected system, see logs for further details.",
66
- "noServicesAvailableForOdataVersion": "There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only"
66
+ "noServicesAvailableForOdataVersion": "There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",
67
+ "noAnnotations": "No backend annotations associated with this service were retrieved and may result in an invalid application being created"
67
68
  },
68
69
  "systemUrl": {
69
70
  "message": "System URL",
@@ -131,7 +132,7 @@
131
132
  "defaultEntityNameNotFoundWarning": "The supplied entity cannot be found in the service. Please choose from the list above.",
132
133
  "noDraftEnabledEntitiesError": "The CAP service you have chosen does not have any entities that are draft enabled. In order to generate a V4 Fiori application using this floor plan for a CAP project, the entity selected must be draft enabled.",
133
134
  "noEntitiesError": "$t(errors.noRelevantEntities)",
134
- "noEntitiesAlpV4Error": "The OData V4 service you have provided is not suitable for use in an Analytical List Page application. The service must contain aggregate based entity sets for this template."
135
+ "noEntitiesAlpV4Error": "The OData V4 service you have provided is not suitable for use in an Analytical List Page application. The service must contain aggregate based entities for this template."
135
136
  },
136
137
  "navigationEntitySelection": {
137
138
  "message": "Navigation entity",
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": "1.1.1",
4
+ "version": "1.2.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,14 +30,14 @@
30
30
  "os-name": "4.0.1",
31
31
  "@sap-ux/axios-extension": "1.18.1",
32
32
  "@sap-ux/btp-utils": "0.17.2",
33
- "@sap-ux/guided-answers-helper": "0.2.0",
34
33
  "@sap-ux/fiori-generator-shared": "0.7.19",
35
- "@sap-ux/telemetry": "0.5.51",
34
+ "@sap-ux/guided-answers-helper": "0.2.0",
36
35
  "@sap-ux/inquirer-common": "0.6.4",
37
36
  "@sap-ux/logger": "0.6.0",
37
+ "@sap-ux/telemetry": "0.5.51",
38
38
  "@sap-ux/project-access": "1.29.0",
39
- "@sap-ux/store": "1.0.0",
40
- "@sap-ux/project-input-validator": "0.3.4"
39
+ "@sap-ux/project-input-validator": "0.3.4",
40
+ "@sap-ux/store": "1.0.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@sap-ux/vocabularies-types": "0.11.7",
@@ -49,8 +49,8 @@
49
49
  "@sap-ux/fiori-generator-shared": "0.7.19",
50
50
  "@sap-ux/fiori-elements-writer": "2.0.0",
51
51
  "@sap-ux/fiori-freestyle-writer": "2.0.0",
52
- "@sap-ux/odata-service-writer": "0.25.3",
53
- "@sap-ux/feature-toggle": "0.2.3"
52
+ "@sap-ux/feature-toggle": "0.2.3",
53
+ "@sap-ux/odata-service-writer": "0.25.3"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=18.x"