@sap-ux/axios-extension 1.25.6 → 1.25.8

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,5 +1,5 @@
1
1
  export { AppInfo, BspConfig, DeployConfig, Ui5AbapRepositoryService, UndeployConfig } from './ui5-abap-repository-service';
2
- export { LayeredRepositoryService, AdaptationConfig, MergedAppDescriptor, SystemInfo, AdaptationProjectType, Inbound, InboundContent } from './lrep-service';
2
+ export { LayeredRepositoryService, AdaptationConfig, MergedAppDescriptor, SystemInfo, AdaptationProjectType, Inbound, InboundContent, AdaptationsResponse, AdaptationDescriptor, KeyUserDataResponse, KeyUserChangeContent, FlexVersion } from './lrep-service';
3
3
  export { AbapServiceProvider } from './abap-service-provider';
4
4
  export { AppIndex, AppIndexService, Ui5AppInfo, Ui5AppInfoContent, App } from './app-index-service';
5
5
  export * from './message';
@@ -97,6 +97,37 @@ export interface SystemInfo {
97
97
  */
98
98
  inbounds?: Inbound[];
99
99
  }
100
+ export interface AdaptationDescriptor {
101
+ id: string;
102
+ type?: string;
103
+ title?: string;
104
+ contexts?: Record<string, string[]>;
105
+ createdBy?: string;
106
+ createdAt?: string;
107
+ changedBy?: string;
108
+ changedAt?: string;
109
+ }
110
+ export interface AdaptationsResponse {
111
+ adaptations: AdaptationDescriptor[];
112
+ }
113
+ export interface KeyUserChangeContent {
114
+ content: Record<string, unknown>;
115
+ texts?: Record<string, unknown>;
116
+ }
117
+ export interface KeyUserDataResponse {
118
+ contents: KeyUserChangeContent[];
119
+ }
120
+ export interface FlexVersion {
121
+ versionId: string;
122
+ isPublished: boolean;
123
+ title: string;
124
+ activatedAt: string;
125
+ activatedBy: string;
126
+ appdescrChangesHash: string;
127
+ }
128
+ export interface FlexVersionsResponse {
129
+ versions: FlexVersion[];
130
+ }
100
131
  interface Language {
101
132
  sap: string;
102
133
  description: string;
@@ -177,6 +208,31 @@ export declare class LayeredRepositoryService extends Axios implements Service {
177
208
  * @returns the Axios response object for further processing
178
209
  */
179
210
  undeploy(config: AdaptationConfig): Promise<AxiosResponse>;
211
+ /**
212
+ * Lists context-based adaptations for the given application.
213
+ *
214
+ * @param {string} appId - Technical application id.
215
+ * @param {string} [version] - Optional version id. If not provided, uses the hardcoded default version.
216
+ * @returns {Promise<AdaptationsResponse>} Adaptations sorted by priority.
217
+ */
218
+ listAdaptations(appId: string, version?: string): Promise<AdaptationsResponse>;
219
+ /**
220
+ * Retrieves key user changes for the given component and adaptation id.
221
+ *
222
+ * @param {string} componentId - Technical component id.
223
+ * @param {string} adaptationId - Adaptation identifier (DEFAULT for default).
224
+ * @returns {Promise<KeyUserDataResponse>} Key user change payload.
225
+ */
226
+ getKeyUserData(componentId: string, adaptationId: string): Promise<KeyUserDataResponse>;
227
+ /**
228
+ * Retrieves versions for the given component.
229
+ *
230
+ * @param {string} componentId - Technical component id.
231
+ * @param {number} [limit] - Optional limit for the number of versions to retrieve (default: 2).
232
+ * @param {string} [language] - Optional language code (default: EN).
233
+ * @returns {Promise<FlexVersionsResponse>} Flex versions response containing an array of versions.
234
+ */
235
+ getFlexVersions(componentId: string, limit?: number, language?: string): Promise<FlexVersionsResponse>;
180
236
  /**
181
237
  * Get system info.
182
238
  *
@@ -44,6 +44,26 @@ function isBuffer(input) {
44
44
  * @returns The decoded parameters as a string.
45
45
  */
46
46
  const decodeUrlParams = (params) => decodeURIComponent(params.toString());
47
+ /**
48
+ * Transform the response data to a JSON object.
49
+ *
50
+ * @param data the response data
51
+ * @returns the transformed data
52
+ */
53
+ function transformResponse(data) {
54
+ if (typeof data === 'string') {
55
+ try {
56
+ return JSON.parse(data);
57
+ }
58
+ catch {
59
+ /**
60
+ * If parsing fails, return the original data to preserve error information for non-JSON error responses.
61
+ */
62
+ return data;
63
+ }
64
+ }
65
+ return data;
66
+ }
47
67
  /**
48
68
  * Path suffix for all DTA actions.
49
69
  */
@@ -197,6 +217,81 @@ class LayeredRepositoryService extends axios_1.Axios {
197
217
  throw error;
198
218
  }
199
219
  }
220
+ /**
221
+ * Lists context-based adaptations for the given application.
222
+ *
223
+ * @param {string} appId - Technical application id.
224
+ * @param {string} [version] - Optional version id. If not provided, uses the hardcoded default version.
225
+ * @returns {Promise<AdaptationsResponse>} Adaptations sorted by priority.
226
+ */
227
+ async listAdaptations(appId, version) {
228
+ try {
229
+ const response = await this.get(`/flex/apps/${encodeURIComponent(appId)}/adaptations/?version=${encodeURIComponent(version)}`, {
230
+ transformResponse
231
+ });
232
+ this.tryLogResponse(response, `Successfully fetched adaptations for app ${appId}`);
233
+ return response.data;
234
+ }
235
+ catch (error) {
236
+ if ((0, odata_request_error_1.isAxiosError)(error)) {
237
+ this.tryLogResponse(error.response);
238
+ }
239
+ throw error;
240
+ }
241
+ }
242
+ /**
243
+ * Retrieves key user changes for the given component and adaptation id.
244
+ *
245
+ * @param {string} componentId - Technical component id.
246
+ * @param {string} adaptationId - Adaptation identifier (DEFAULT for default).
247
+ * @returns {Promise<KeyUserDataResponse>} Key user change payload.
248
+ */
249
+ async getKeyUserData(componentId, adaptationId) {
250
+ const params = new node_url_1.URLSearchParams(this.defaults?.params);
251
+ params.append('adaptationId', encodeURIComponent(adaptationId));
252
+ try {
253
+ const response = await this.get(`/flex/keyuserdata/${componentId}`, {
254
+ params,
255
+ paramsSerializer: decodeUrlParams,
256
+ transformResponse
257
+ });
258
+ this.tryLogResponse(response, `Successfully fetched key user data for component ${componentId} and ${adaptationId} adaptation.`);
259
+ return response.data;
260
+ }
261
+ catch (error) {
262
+ if ((0, odata_request_error_1.isAxiosError)(error)) {
263
+ this.tryLogResponse(error.response);
264
+ }
265
+ throw error;
266
+ }
267
+ }
268
+ /**
269
+ * Retrieves versions for the given component.
270
+ *
271
+ * @param {string} componentId - Technical component id.
272
+ * @param {number} [limit] - Optional limit for the number of versions to retrieve (default: 2).
273
+ * @param {string} [language] - Optional language code (default: EN).
274
+ * @returns {Promise<FlexVersionsResponse>} Flex versions response containing an array of versions.
275
+ */
276
+ async getFlexVersions(componentId, limit = 2, language = 'EN') {
277
+ try {
278
+ const params = new node_url_1.URLSearchParams(this.defaults?.params);
279
+ params.append('sap-language', language);
280
+ params.append('limit', limit.toString());
281
+ const response = await this.get(`/flex/versions/${encodeURIComponent(componentId)}`, {
282
+ params,
283
+ transformResponse
284
+ });
285
+ this.tryLogResponse(response, `Successfully fetched flex versions for component ${componentId}`);
286
+ return response.data;
287
+ }
288
+ catch (error) {
289
+ if ((0, odata_request_error_1.isAxiosError)(error)) {
290
+ this.tryLogResponse(error.response);
291
+ }
292
+ throw error;
293
+ }
294
+ }
200
295
  /**
201
296
  * Get system info.
202
297
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "1.25.6",
3
+ "version": "1.25.8",
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",
@@ -16,8 +16,8 @@
16
16
  "dependencies": {
17
17
  "axios": "1.12.2",
18
18
  "detect-content-type": "1.2.0",
19
- "fast-xml-parser": "4.4.1",
20
- "lodash": "4.17.21",
19
+ "fast-xml-parser": "4.5.3",
20
+ "lodash": "4.17.23",
21
21
  "open": "7.0.3",
22
22
  "qs": "6.14.1",
23
23
  "xpath": "0.0.33",
@@ -26,7 +26,7 @@
26
26
  "http-proxy-agent": "7.0.2",
27
27
  "proxy-from-env": "1.1.0",
28
28
  "@sap-ux/btp-utils": "1.1.6",
29
- "@sap-ux/logger": "0.8.0",
29
+ "@sap-ux/logger": "0.8.1",
30
30
  "@sap-ux/feature-toggle": "0.3.5"
31
31
  },
32
32
  "devDependencies": {
@@ -35,7 +35,7 @@
35
35
  "nock": "13.4.0",
36
36
  "supertest": "7.1.4",
37
37
  "@types/proxy-from-env": "1.0.1",
38
- "@sap-ux/project-access": "1.33.1"
38
+ "@sap-ux/project-access": "1.34.4"
39
39
  },
40
40
  "files": [
41
41
  "dist",