@sap-ux/axios-extension 1.23.1 → 1.24.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.
@@ -8,6 +8,7 @@ import { Ui5AbapRepositoryService } from './ui5-abap-repository-service';
8
8
  import { ODataServiceGenerator } from './adt-catalog/generators/odata-service-generator';
9
9
  import { UiServiceGenerator } from './adt-catalog/generators/ui-service-generator';
10
10
  import { type AdtService } from './adt-catalog/services';
11
+ import { UI5VersionService } from './ui5-version-service';
11
12
  /**
12
13
  * Extension of the service provider for ABAP services.
13
14
  */
@@ -108,6 +109,12 @@ export declare class AbapServiceProvider extends ServiceProvider {
108
109
  * @returns Subclass type of class AdtService
109
110
  */
110
111
  getAdtService<T extends AdtService>(adtServiceSubclass: typeof AdtService): Promise<T | null>;
112
+ /**
113
+ * Creates a singleton instance of the UI5 version service using lazy initialization.
114
+ *
115
+ * @returns The instance to the UI5 version service.
116
+ */
117
+ getUI5VersionService(): UI5VersionService;
111
118
  /**
112
119
  * Create a UI Service generator for the given referenced object.
113
120
  *
@@ -15,6 +15,7 @@ const odata_service_generator_1 = require("./adt-catalog/generators/odata-servic
15
15
  const ui_service_generator_1 = require("./adt-catalog/generators/ui-service-generator");
16
16
  const services_1 = require("./adt-catalog/services");
17
17
  const systeminfo_service_1 = require("./adt-catalog/services/systeminfo-service");
18
+ const ui5_version_service_1 = require("./ui5-version-service");
18
19
  /**
19
20
  * Extension of the service provider for ABAP services.
20
21
  */
@@ -215,6 +216,18 @@ class AbapServiceProvider extends service_provider_1.ServiceProvider {
215
216
  }
216
217
  return this.services[subclassName];
217
218
  }
219
+ /**
220
+ * Creates a singleton instance of the UI5 version service using lazy initialization.
221
+ *
222
+ * @returns The instance to the UI5 version service.
223
+ */
224
+ getUI5VersionService() {
225
+ const path = ui5_version_service_1.UI5VersionService.PATH;
226
+ if (!this.services[path]) {
227
+ this.services[path] = this.createService(path, ui5_version_service_1.UI5VersionService);
228
+ }
229
+ return this.services[path];
230
+ }
218
231
  /**
219
232
  * Create a UI Service generator for the given referenced object.
220
233
  *
@@ -0,0 +1,26 @@
1
+ import type { Logger } from '@sap-ux/logger';
2
+ import { Axios } from 'axios';
3
+ import type { Service } from 'base/service-provider';
4
+ /**
5
+ * The service implements a request for getting the UI5 framework version on ABAP system
6
+ * with the bootstrap api.
7
+ */
8
+ export declare class UI5VersionService extends Axios implements Service {
9
+ /**
10
+ * The base endpoint path used by this service for requests.
11
+ */
12
+ static readonly PATH: string;
13
+ /**
14
+ * Instance of the logger.
15
+ */
16
+ log: Logger;
17
+ /**
18
+ * The method returns a valid version of the UI5 framework on the ABAP system
19
+ * or throws an error if the version is not provided, malformed or there are
20
+ * connectivity issues or server errors.
21
+ *
22
+ * @returns The UI5 version on the ABAP system.
23
+ */
24
+ getUI5Version(): Promise<string>;
25
+ }
26
+ //# sourceMappingURL=ui5-version-service.d.ts.map
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI5VersionService = void 0;
4
+ const axios_1 = require("axios");
5
+ /**
6
+ * The service implements a request for getting the UI5 framework version on ABAP system
7
+ * with the bootstrap api.
8
+ */
9
+ class UI5VersionService extends axios_1.Axios {
10
+ /**
11
+ * The base endpoint path used by this service for requests.
12
+ */
13
+ static PATH = '/sap/public/bc/ui5_ui5';
14
+ /**
15
+ * Instance of the logger.
16
+ */
17
+ log;
18
+ /**
19
+ * The method returns a valid version of the UI5 framework on the ABAP system
20
+ * or throws an error if the version is not provided, malformed or there are
21
+ * connectivity issues or server errors.
22
+ *
23
+ * @returns The UI5 version on the ABAP system.
24
+ */
25
+ async getUI5Version() {
26
+ try {
27
+ const response = await this.get('/bootstrap_info.json', {
28
+ transformResponse: (data) => JSON.parse(data)
29
+ });
30
+ const { Version: version } = response.data;
31
+ if (!version) {
32
+ throw new Error('UI5 version not provided.');
33
+ }
34
+ return version;
35
+ }
36
+ catch (error) {
37
+ this.log.error('Could not get UI5 Version.');
38
+ this.log.debug(error);
39
+ throw error;
40
+ }
41
+ }
42
+ }
43
+ exports.UI5VersionService = UI5VersionService;
44
+ //# sourceMappingURL=ui5-version-service.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "nock": "13.4.0",
35
35
  "supertest": "7.1.4",
36
36
  "@types/proxy-from-env": "1.0.1",
37
- "@sap-ux/project-access": "1.32.6"
37
+ "@sap-ux/project-access": "1.32.7"
38
38
  },
39
39
  "files": [
40
40
  "dist",