@sap-ux/axios-extension 0.14.1 → 1.0.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.
Files changed (33) hide show
  1. package/dist/abap/adt-catalog/index.js +5 -1
  2. package/dist/abap/adt-catalog/services/ato-service.d.ts +1 -1
  3. package/dist/abap/adt-catalog/services/ato-service.js +2 -2
  4. package/dist/abap/adt-catalog/services/index.d.ts +1 -0
  5. package/dist/abap/adt-catalog/services/index.js +3 -1
  6. package/dist/abap/adt-catalog/services/list-package-service.d.ts +55 -0
  7. package/dist/abap/adt-catalog/services/list-package-service.js +109 -0
  8. package/dist/abap/adt-catalog/services/transportcheck-service.d.ts +1 -1
  9. package/dist/abap/adt-catalog/services/transportcheck-service.js +7 -3
  10. package/dist/abap/adt-catalog/services/transportrequest-service.d.ts +1 -1
  11. package/dist/abap/adt-catalog/services/transportrequest-service.js +2 -2
  12. package/dist/abap/app-index-service.d.ts +1 -1
  13. package/dist/abap/catalog/index.js +5 -1
  14. package/dist/abap/index.js +5 -1
  15. package/dist/abap/lrep-service.d.ts +2 -2
  16. package/dist/abap/lrep-service.js +2 -2
  17. package/dist/abap/types/adt-internal-types.d.ts +11 -0
  18. package/dist/abap/types/adt-internal-types.js +3 -0
  19. package/dist/abap/types/adt-types.d.ts +6 -6
  20. package/dist/abap/types/index.js +5 -1
  21. package/dist/abap/ui5-abap-repository-service.d.ts +1 -0
  22. package/dist/abap/ui5-abap-repository-service.js +4 -4
  23. package/dist/auth/connection.js +1 -1
  24. package/dist/auth/index.js +6 -2
  25. package/dist/auth/reentrance-ticket/index.js +1 -1
  26. package/dist/auth/reentrance-ticket/redirect.js +3 -3
  27. package/dist/auth/uaa.d.ts +1 -1
  28. package/dist/auth/uaa.js +2 -2
  29. package/dist/base/service-provider.d.ts +1 -1
  30. package/dist/factory.d.ts +2 -2
  31. package/dist/factory.js +9 -9
  32. package/dist/index.js +5 -1
  33. package/package.json +3 -3
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -7,7 +7,7 @@ export declare class AtoService extends AdtService {
7
7
  /**
8
8
  * @see AdtService.getAdtCatagory()
9
9
  */
10
- private static AdtCategory;
10
+ private static adtCategory;
11
11
  /**
12
12
  * @see AdtService.getAdtCatagory()
13
13
  * @returns AdtCategory
@@ -24,7 +24,7 @@ class AtoService extends adt_service_1.AdtService {
24
24
  * @returns AdtCategory
25
25
  */
26
26
  static getAdtCatagory() {
27
- return AtoService.AdtCategory;
27
+ return AtoService.adtCategory;
28
28
  }
29
29
  /**
30
30
  * Send ADT request to fetch ATO settings.
@@ -68,7 +68,7 @@ exports.AtoService = AtoService;
68
68
  /**
69
69
  * @see AdtService.getAdtCatagory()
70
70
  */
71
- AtoService.AdtCategory = {
71
+ AtoService.adtCategory = {
72
72
  scheme: 'http://www.sap.com/adt/categories/ato',
73
73
  term: 'settings'
74
74
  };
@@ -2,4 +2,5 @@ export { AdtService } from './adt-service';
2
2
  export { AtoService } from './ato-service';
3
3
  export { TransportChecksService } from './transportcheck-service';
4
4
  export { TransportRequestService, NewUi5ObjectRequestParams } from './transportrequest-service';
5
+ export { ListPackageService } from './list-package-service';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransportRequestService = exports.TransportChecksService = exports.AtoService = exports.AdtService = void 0;
3
+ exports.ListPackageService = exports.TransportRequestService = exports.TransportChecksService = exports.AtoService = exports.AdtService = void 0;
4
4
  var adt_service_1 = require("./adt-service");
5
5
  Object.defineProperty(exports, "AdtService", { enumerable: true, get: function () { return adt_service_1.AdtService; } });
6
6
  var ato_service_1 = require("./ato-service");
@@ -9,4 +9,6 @@ var transportcheck_service_1 = require("./transportcheck-service");
9
9
  Object.defineProperty(exports, "TransportChecksService", { enumerable: true, get: function () { return transportcheck_service_1.TransportChecksService; } });
10
10
  var transportrequest_service_1 = require("./transportrequest-service");
11
11
  Object.defineProperty(exports, "TransportRequestService", { enumerable: true, get: function () { return transportrequest_service_1.TransportRequestService; } });
12
+ var list_package_service_1 = require("./list-package-service");
13
+ Object.defineProperty(exports, "ListPackageService", { enumerable: true, get: function () { return list_package_service_1.ListPackageService; } });
12
14
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,55 @@
1
+ import { AdtService } from './adt-service';
2
+ import type { AdtCategory } from '../../types';
3
+ /**
4
+ * Structure of input parameter for `listPackages` method.
5
+ *
6
+ * @see {@link ListPackageService#listPackages}
7
+ */
8
+ export interface ListPackageParams {
9
+ maxResults?: number;
10
+ phrase?: string;
11
+ }
12
+ /**
13
+ * ListPackageService implements ADT requests for fetching a list of available package names
14
+ * from ABAP backend system.
15
+ *
16
+ * @class
17
+ */
18
+ export declare class ListPackageService extends AdtService {
19
+ /**
20
+ * @see AdtService.getAdtCatagory()
21
+ */
22
+ private static adtCategory;
23
+ /**
24
+ * Get ADT scheme ID.
25
+ *
26
+ * @returns AdtCategory
27
+ */
28
+ static getAdtCatagory(): AdtCategory;
29
+ /**
30
+ * The suggested usage of this API from ADT team is to validate the input package
31
+ * name exists rather than searching through the list to find a package name.
32
+ * Several reasons: 1) there is a large number of package names; 2) ABAP developer
33
+ * works with the same package name most of the time. They are likely to remember
34
+ * the package name, typing the prefix (namespace) of the package, the backend
35
+ * returns few package names that match the prefix, and finally developer selects
36
+ * a package name to minimize risk of typo introduced by manual input.
37
+ *
38
+ * @param params
39
+ * maxResults Maxmium number of records to be returned by the ADT service.
40
+ * Based on explanation above, it is suggested to use a relatively small number like 50.
41
+ * phrase Search phrase. The input is case sensitive.
42
+ * @returns A list of package names that has prefix matching input parameter `phrase`.
43
+ * The list is returned in the same order as returned by the ADT API.
44
+ * No guarantee on alphabetic ordering of package names.
45
+ */
46
+ listPackages(params: ListPackageParams): Promise<string[]>;
47
+ /**
48
+ * Parse the XML document of package info entries from ADT service.
49
+ *
50
+ * @param xml xml document containing package info entries.
51
+ * @returns A list of package names.
52
+ */
53
+ private parsePackageListResponse;
54
+ }
55
+ //# sourceMappingURL=list-package-service.d.ts.map
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ListPackageService = void 0;
16
+ const adt_service_1 = require("./adt-service");
17
+ const fast_xml_parser_1 = __importDefault(require("fast-xml-parser"));
18
+ /**
19
+ * ListPackageService implements ADT requests for fetching a list of available package names
20
+ * from ABAP backend system.
21
+ *
22
+ * @class
23
+ */
24
+ class ListPackageService extends adt_service_1.AdtService {
25
+ /**
26
+ * Get ADT scheme ID.
27
+ *
28
+ * @returns AdtCategory
29
+ */
30
+ static getAdtCatagory() {
31
+ return ListPackageService.adtCategory;
32
+ }
33
+ /**
34
+ * The suggested usage of this API from ADT team is to validate the input package
35
+ * name exists rather than searching through the list to find a package name.
36
+ * Several reasons: 1) there is a large number of package names; 2) ABAP developer
37
+ * works with the same package name most of the time. They are likely to remember
38
+ * the package name, typing the prefix (namespace) of the package, the backend
39
+ * returns few package names that match the prefix, and finally developer selects
40
+ * a package name to minimize risk of typo introduced by manual input.
41
+ *
42
+ * @param params
43
+ * maxResults Maxmium number of records to be returned by the ADT service.
44
+ * Based on explanation above, it is suggested to use a relatively small number like 50.
45
+ * phrase Search phrase. The input is case sensitive.
46
+ * @returns A list of package names that has prefix matching input parameter `phrase`.
47
+ * The list is returned in the same order as returned by the ADT API.
48
+ * No guarantee on alphabetic ordering of package names.
49
+ */
50
+ listPackages(params) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const { maxResults = 50, phrase = '' } = params;
53
+ const config = {
54
+ headers: {
55
+ Accept: 'application/xml'
56
+ },
57
+ params: {
58
+ operation: 'quickSearch',
59
+ query: `${phrase}*`,
60
+ useSearchProvider: 'X',
61
+ maxResults,
62
+ objectType: 'DEVC/K'
63
+ }
64
+ };
65
+ const response = yield this.get('', config);
66
+ return this.parsePackageListResponse(response.data);
67
+ });
68
+ }
69
+ /**
70
+ * Parse the XML document of package info entries from ADT service.
71
+ *
72
+ * @param xml xml document containing package info entries.
73
+ * @returns A list of package names.
74
+ */
75
+ parsePackageListResponse(xml) {
76
+ var _a;
77
+ if (fast_xml_parser_1.default.validate(xml) !== true) {
78
+ this.log.warn(`Invalid XML: ${xml}`);
79
+ return [];
80
+ }
81
+ const options = {
82
+ attributeNamePrefix: '',
83
+ ignoreAttributes: false,
84
+ ignoreNameSpace: true,
85
+ parseAttributeValue: true
86
+ };
87
+ const obj = fast_xml_parser_1.default.getTraversalObj(xml, options);
88
+ const parsed = fast_xml_parser_1.default.convertToJson(obj, options);
89
+ let packageArray = [];
90
+ if ((_a = parsed === null || parsed === void 0 ? void 0 : parsed.objectReferences) === null || _a === void 0 ? void 0 : _a.objectReference) {
91
+ if (Array.isArray(parsed.objectReferences.objectReference)) {
92
+ packageArray = parsed.objectReferences.objectReference;
93
+ }
94
+ else {
95
+ packageArray = [parsed.objectReferences.objectReference];
96
+ }
97
+ }
98
+ return packageArray.map((item) => item.name);
99
+ }
100
+ }
101
+ exports.ListPackageService = ListPackageService;
102
+ /**
103
+ * @see AdtService.getAdtCatagory()
104
+ */
105
+ ListPackageService.adtCategory = {
106
+ scheme: 'http://www.sap.com/adt/categories/respository',
107
+ term: 'search'
108
+ };
109
+ //# sourceMappingURL=list-package-service.js.map
@@ -8,7 +8,7 @@ export declare class TransportChecksService extends AdtService {
8
8
  /**
9
9
  * @see AdtService.getAdtCatagory()
10
10
  */
11
- private static AdtCategory;
11
+ private static adtCategory;
12
12
  /**
13
13
  * @see AdtService.getAdtCatagory()
14
14
  * @returns AdtCategory
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -47,7 +51,7 @@ class TransportChecksService extends adt_service_1.AdtService {
47
51
  * @returns AdtCategory
48
52
  */
49
53
  static getAdtCatagory() {
50
- return TransportChecksService.AdtCategory;
54
+ return TransportChecksService.adtCategory;
51
55
  }
52
56
  /**
53
57
  * TransportChecksService API function to fetch a list of available transport requests.
@@ -200,7 +204,7 @@ exports.TransportChecksService = TransportChecksService;
200
204
  /**
201
205
  * @see AdtService.getAdtCatagory()
202
206
  */
203
- TransportChecksService.AdtCategory = {
207
+ TransportChecksService.adtCategory = {
204
208
  scheme: 'http://www.sap.com/adt/categories/cts',
205
209
  term: 'transportchecks'
206
210
  };
@@ -26,7 +26,7 @@ export declare class TransportRequestService extends AdtService {
26
26
  /**
27
27
  * @see AdtService.getAdtCatagory()
28
28
  */
29
- private static AdtCategory;
29
+ private static adtCategory;
30
30
  /**
31
31
  * @see AdtService.getAdtCatagory()
32
32
  * @returns AdtCategory
@@ -21,7 +21,7 @@ class TransportRequestService extends adt_service_1.AdtService {
21
21
  * @returns AdtCategory
22
22
  */
23
23
  static getAdtCatagory() {
24
- return TransportRequestService.AdtCategory;
24
+ return TransportRequestService.adtCategory;
25
25
  }
26
26
  /**
27
27
  * TransportRequestService API function to create a new transport number.
@@ -75,7 +75,7 @@ exports.TransportRequestService = TransportRequestService;
75
75
  /**
76
76
  * @see AdtService.getAdtCatagory()
77
77
  */
78
- TransportRequestService.AdtCategory = {
78
+ TransportRequestService.adtCategory = {
79
79
  scheme: 'http://www.sap.com/adt/categories/cts',
80
80
  term: 'transports'
81
81
  };
@@ -5,7 +5,7 @@ export interface App {
5
5
  'sap.app/id': string;
6
6
  url: string;
7
7
  }
8
- export declare type AppIndex = Partial<App>[];
8
+ export type AppIndex = Partial<App>[];
9
9
  /**
10
10
  * A class respresenting the app index service allowing to search applications deployed on an ABAP system.
11
11
  */
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -5,7 +5,7 @@ import type { Logger } from '@sap-ux/logger';
5
5
  /**
6
6
  * Object structure representing a namespace: containing an id (variant id) and a reference (base application id).
7
7
  */
8
- export declare type NamespaceObject = {
8
+ export type NamespaceObject = {
9
9
  /**
10
10
  * variant id
11
11
  */
@@ -18,7 +18,7 @@ export declare type NamespaceObject = {
18
18
  /**
19
19
  * Type representing a namespace. It is either a string or an object.
20
20
  */
21
- export declare type Namespace = NamespaceObject | string;
21
+ export type Namespace = NamespaceObject | string;
22
22
  /**
23
23
  * Required configuration to deploy an adaptation project.
24
24
  */
@@ -52,7 +52,7 @@ class LayeredRepositoryService extends axios_1.Axios {
52
52
  return response;
53
53
  }
54
54
  catch (error) {
55
- if (odata_request_error_1.isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
55
+ if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
56
56
  return error.response;
57
57
  }
58
58
  else {
@@ -71,7 +71,7 @@ class LayeredRepositoryService extends axios_1.Axios {
71
71
  deploy(archivePath, config) {
72
72
  var _a;
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
- const archive = fs_1.readFileSync(archivePath);
74
+ const archive = (0, fs_1.readFileSync)(archivePath);
75
75
  const checkResponse = yield this.isExistingVariant(config.namespace);
76
76
  const params = {
77
77
  name: getNamespaceAsString(config.namespace),
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This type is used internally for the list of PacakgeInfo
3
+ * returned from ADT rest api. It should not be exposed for
4
+ * public use via axios-extension.
5
+ */
6
+ export interface PackageInfo {
7
+ uri: string;
8
+ type: string;
9
+ name: string;
10
+ }
11
+ //# sourceMappingURL=adt-internal-types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=adt-internal-types.js.map
@@ -9,9 +9,9 @@ export interface AdtSchemaData {
9
9
  workspace: AdtWorkspace[];
10
10
  };
11
11
  }
12
- export declare type AdtCategoryTerm = string;
13
- export declare type AdtWorkspaceTitle = string;
14
- export declare type AdtCategoryId = string;
12
+ export type AdtCategoryTerm = string;
13
+ export type AdtWorkspaceTitle = string;
14
+ export type AdtCategoryId = string;
15
15
  /**
16
16
  * AdtWorkspace groups ADT services based on their
17
17
  * functionalities.
@@ -42,7 +42,7 @@ export interface AdtCollection {
42
42
  templateLinks: any;
43
43
  [key: string]: any;
44
44
  }
45
- export declare type AdtAcceptContentType = string[] | string;
45
+ export type AdtAcceptContentType = string[] | string;
46
46
  /**
47
47
  * Uniquely identifies a ADT service. Provide an AdtCategory
48
48
  * as key to look for the service schema of the corresponding ADT service.
@@ -68,7 +68,7 @@ export declare enum TenantType {
68
68
  /**
69
69
  * Possible values for operations type property: (C)loud and on-(P)remise.
70
70
  */
71
- export declare type OperationsType = 'C' | 'P';
71
+ export type OperationsType = 'C' | 'P';
72
72
  export interface AtoSettings {
73
73
  developmentPackage?: string;
74
74
  developmentPrefix?: string;
@@ -77,6 +77,6 @@ export interface AtoSettings {
77
77
  tenantType?: TenantType;
78
78
  isTransportRequestRequired?: boolean;
79
79
  }
80
- export declare type AdtTransportStatus = 'S' | 'E';
80
+ export type AdtTransportStatus = 'S' | 'E';
81
81
  export declare const LocalPackageText: string[];
82
82
  //# sourceMappingURL=adt-types.d.ts.map
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type { AxiosResponse, AxiosRequestConfig } from 'axios';
3
4
  import { ODataService } from '../base/odata-service';
4
5
  /**
@@ -91,7 +91,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
91
91
  const response = yield this.updateRepoRequest(!!info, bsp.name, payload, config);
92
92
  // An app can be successfully deployed after a timeout exception, no value in showing exception headers
93
93
  if ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a['sap-message']) {
94
- message_1.prettyPrintMessage({ msg: response.headers['sap-message'], log: this.log, host: frontendUrl });
94
+ (0, message_1.prettyPrintMessage)({ msg: response.headers['sap-message'], log: this.log, host: frontendUrl });
95
95
  }
96
96
  // log url of created/updated app
97
97
  const path = '/sap/bc/ui5_ui5' + (!bsp.name.startsWith('/') ? '/sap/' : '') + bsp.name.toLowerCase();
@@ -125,7 +125,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
125
125
  if (info) {
126
126
  const response = yield this.deleteRepoRequest(bsp.name, config);
127
127
  if ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a['sap-message']) {
128
- message_1.prettyPrintMessage({ msg: response.headers['sap-message'], log: this.log, host });
128
+ (0, message_1.prettyPrintMessage)({ msg: response.headers['sap-message'], log: this.log, host });
129
129
  }
130
130
  return response;
131
131
  }
@@ -307,9 +307,9 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
307
307
  logError({ error, host }) {
308
308
  var _a;
309
309
  this.log.error(error.message);
310
- if (odata_request_error_1.isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
310
+ if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
311
311
  if (error.response.data['error']) {
312
- message_1.prettyPrintError({ error: error.response.data['error'], host, log: this.log });
312
+ (0, message_1.prettyPrintError)({ error: error.response.data['error'], host, log: this.log });
313
313
  }
314
314
  else {
315
315
  this.log.error(error.response.data);
@@ -124,7 +124,7 @@ function getContentType(contentTypeHeader, responseData) {
124
124
  }
125
125
  else if (typeof responseData === 'string') {
126
126
  // Try to infer it from the data
127
- return (_b = (_a = detect_content_type_1.default(Buffer.from(responseData))) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
127
+ return (_b = (_a = (0, detect_content_type_1.default)(Buffer.from(responseData))) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
128
128
  }
129
129
  else {
130
130
  return '';
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -87,7 +91,7 @@ exports.attachReentranceTicketAuthInterceptor = attachReentranceTicketAuthInterc
87
91
  function getReentranceTicketAuthInterceptor({ provider, ejectCallback }) {
88
92
  return (request) => __awaiter(this, void 0, void 0, function* () {
89
93
  var _a;
90
- const { reentranceTicket, apiUrl } = yield reentrance_ticket_1.getReentranceTicket({
94
+ const { reentranceTicket, apiUrl } = yield (0, reentrance_ticket_1.getReentranceTicket)({
91
95
  backendUrl: provider.defaults.baseURL,
92
96
  logger: provider.log
93
97
  });
@@ -32,7 +32,7 @@ function getReentranceTicket({ backendUrl, logger, timeout = connection_1.defaul
32
32
  return new Promise((resolve, reject) => {
33
33
  const backend = new abap_system_1.ABAPSystem(backendUrl);
34
34
  // Start local server to listen to redirect call, with timeout
35
- const { server, redirectUrl } = redirect_1.setupRedirectHandling({ resolve, reject, timeout, backend, logger });
35
+ const { server, redirectUrl } = (0, redirect_1.setupRedirectHandling)({ resolve, reject, timeout, backend, logger });
36
36
  server.listen();
37
37
  const redirectPort = server.address().port;
38
38
  // Open browser to handle SAML flow and return the reentrance ticket
@@ -24,7 +24,7 @@ function setupRedirectHandling({ resolve, reject, timeout, backend, logger }) {
24
24
  let server;
25
25
  const handleTimeout = () => {
26
26
  server === null || server === void 0 ? void 0 : server.close();
27
- reject(new error_1.TimeoutError(`Timeout. Did not get a response within ${message_1.prettyPrintTimeInMs(timeout)}`));
27
+ reject(new error_1.TimeoutError(`Timeout. Did not get a response within ${(0, message_1.prettyPrintTimeInMs)(timeout)}`));
28
28
  };
29
29
  const timer = setTimeout(handleTimeout, timeout);
30
30
  server = http_1.default.createServer((req, res) => {
@@ -38,7 +38,7 @@ function setupRedirectHandling({ resolve, reject, timeout, backend, logger }) {
38
38
  if (reentranceTicket) {
39
39
  logger.debug('Got reentrance ticket: ' + reentranceTicket);
40
40
  res.writeHead(200, { 'Content-Type': 'text/html' });
41
- res.end(Buffer.from(static_1.redirectSuccessHtml(backend.logoffUrl())));
41
+ res.end(Buffer.from((0, static_1.redirectSuccessHtml)(backend.logoffUrl())));
42
42
  server.close();
43
43
  resolve({ reentranceTicket, apiUrl: backend.apiHostname() });
44
44
  }
@@ -46,7 +46,7 @@ function setupRedirectHandling({ resolve, reject, timeout, backend, logger }) {
46
46
  logger.error('Error getting reentrance ticket');
47
47
  logger.debug(req);
48
48
  res.writeHead(500, { 'Content-Type': 'text/html' });
49
- res.end(Buffer.from(static_1.redirectErrorHtml()));
49
+ res.end(Buffer.from((0, static_1.redirectErrorHtml)()));
50
50
  server.close();
51
51
  reject(new error_1.ConnectionError('Error getting reentrance ticket'));
52
52
  }
@@ -2,7 +2,7 @@ import type { AxiosRequestConfig } from 'axios';
2
2
  import type { Logger } from '@sap-ux/logger';
3
3
  import type { ServiceInfo } from '@sap-ux/btp-utils';
4
4
  import { Redirect } from './redirect';
5
- export declare type RefreshTokenChanged = (refreshToken?: string) => void | Promise<void>;
5
+ export type RefreshTokenChanged = (refreshToken?: string) => void | Promise<void>;
6
6
  /**
7
7
  * A class representing interactions with an SAP BTP UAA service
8
8
  */
package/dist/auth/uaa.js CHANGED
@@ -182,14 +182,14 @@ class Uaa {
182
182
  let server;
183
183
  const handleTimeout = () => {
184
184
  server === null || server === void 0 ? void 0 : server.close();
185
- reject(new error_1.UAATimeoutError(`Timeout. Did not get a response within ${message_1.prettyPrintTimeInMs(timeout)}`));
185
+ reject(new error_1.UAATimeoutError(`Timeout. Did not get a response within ${(0, message_1.prettyPrintTimeInMs)(timeout)}`));
186
186
  };
187
187
  const timer = setTimeout(handleTimeout, timeout);
188
188
  server = http_1.default.createServer((req, res) => {
189
189
  const reqUrl = new URL(req.url, `http://${req.headers.host}`);
190
190
  if (reqUrl.pathname === redirect_1.Redirect.path) {
191
191
  res.writeHead(200, { 'Content-Type': 'text/html' });
192
- res.end(Buffer.from(static_1.redirectSuccessHtml(this.logoutUrl, this.systemId)));
192
+ res.end(Buffer.from((0, static_1.redirectSuccessHtml)(this.logoutUrl, this.systemId)));
193
193
  this.log.info('Got authCode');
194
194
  resolve({ authCode: reqUrl.searchParams.get('code') + '', redirect });
195
195
  if (timer) {
@@ -3,7 +3,7 @@ import { Axios } from 'axios';
3
3
  import type { Logger } from '@sap-ux/logger';
4
4
  import { ODataService } from './odata-service';
5
5
  import { Cookies } from '../auth';
6
- export declare type Service = Axios & {
6
+ export type Service = Axios & {
7
7
  log: Logger;
8
8
  };
9
9
  export interface ProviderConfiguration {
package/dist/factory.d.ts CHANGED
@@ -43,7 +43,7 @@ export interface AbapEmbeddedSteampunkOptions extends ReentranceTicketOptions {
43
43
  environment: AbapCloudEnvironment.EmbeddedSteampunk;
44
44
  }
45
45
  /** Discriminated union of supported environments - {@link AbapCloudStandaloneOptions} and {@link AbapEmbeddedSteampunkOptions} */
46
- declare type AbapCloudOptions = AbapCloudStandaloneOptions | AbapEmbeddedSteampunkOptions;
46
+ type AbapCloudOptions = AbapCloudStandaloneOptions | AbapEmbeddedSteampunkOptions;
47
47
  /**
48
48
  * Create an instance of an ABAP service provider for a Cloud ABAP system.
49
49
  *
@@ -54,7 +54,7 @@ export declare function createForAbapOnCloud(options: AbapCloudOptions & Partial
54
54
  /**
55
55
  * To create a destination provider only the destination name is absolutely required.
56
56
  */
57
- export declare type MinimalDestinationConfig = Pick<Destination, 'Name'> & Partial<Destination>;
57
+ export type MinimalDestinationConfig = Pick<Destination, 'Name'> & Partial<Destination>;
58
58
  /**
59
59
  * Create an instance of a service provider for the given destination.
60
60
  *
package/dist/factory.js CHANGED
@@ -40,7 +40,7 @@ const util_1 = require("util");
40
40
  */
41
41
  function createInstance(ProviderType, config) {
42
42
  var _a, _b;
43
- const providerConfig = cloneDeep_1.default(config);
43
+ const providerConfig = (0, cloneDeep_1.default)(config);
44
44
  providerConfig.httpsAgent = new https_1.Agent({
45
45
  rejectUnauthorized: !providerConfig.ignoreCertErrors
46
46
  });
@@ -63,9 +63,9 @@ function createInstance(ProviderType, config) {
63
63
  head: {},
64
64
  patch: {}
65
65
  };
66
- auth_1.attachConnectionHandler(instance);
66
+ (0, auth_1.attachConnectionHandler)(instance);
67
67
  if ((_b = providerConfig.auth) === null || _b === void 0 ? void 0 : _b.password) {
68
- auth_1.attachBasicAuthInterceptor(instance);
68
+ (0, auth_1.attachBasicAuthInterceptor)(instance);
69
69
  }
70
70
  if (config.cookies) {
71
71
  config.cookies.split(';').forEach((singleCookieStr) => {
@@ -120,7 +120,7 @@ function createForAbapOnCloud(options) {
120
120
  const { service, refreshToken, refreshTokenChangedCb, cookies } = options, config = __rest(options, ["service", "refreshToken", "refreshTokenChangedCb", "cookies"]);
121
121
  provider = createInstance(abap_1.AbapServiceProvider, Object.assign({ baseURL: service.url, cookies }, config));
122
122
  if (!cookies) {
123
- auth_1.attachUaaAuthInterceptor(provider, service, refreshToken, refreshTokenChangedCb);
123
+ (0, auth_1.attachUaaAuthInterceptor)(provider, service, refreshToken, refreshTokenChangedCb);
124
124
  }
125
125
  break;
126
126
  }
@@ -128,13 +128,13 @@ function createForAbapOnCloud(options) {
128
128
  const { url, cookies } = options, config = __rest(options, ["url", "cookies"]);
129
129
  provider = createInstance(abap_1.AbapServiceProvider, Object.assign({ baseURL: url }, config));
130
130
  if (!cookies) {
131
- auth_1.attachReentranceTicketAuthInterceptor({ provider });
131
+ (0, auth_1.attachReentranceTicketAuthInterceptor)({ provider });
132
132
  }
133
133
  break;
134
134
  }
135
135
  default:
136
136
  const opts = options;
137
- throw new Error(`Unknown environment type supplied: ${util_1.inspect(opts)}`);
137
+ throw new Error(`Unknown environment type supplied: ${(0, util_1.inspect)(opts)}`);
138
138
  }
139
139
  return provider;
140
140
  }
@@ -150,12 +150,12 @@ exports.createForAbapOnCloud = createForAbapOnCloud;
150
150
  function createForDestination(options, destination, destinationServiceInstance) {
151
151
  var _a;
152
152
  const { cookies } = options, config = __rest(options, ["cookies"]);
153
- const providerConfig = Object.assign(Object.assign({}, config), { baseURL: btp_utils_1.getDestinationUrlForAppStudio(destination.Name, destination.Host ? new URL(destination.Host).pathname : undefined), cookies: cookies });
153
+ const providerConfig = Object.assign(Object.assign({}, config), { baseURL: (0, btp_utils_1.getDestinationUrlForAppStudio)(destination.Name, destination.Host ? new URL(destination.Host).pathname : undefined), cookies: cookies });
154
154
  // SAML in AppStudio is not yet supported
155
155
  providerConfig.params = (_a = providerConfig.params) !== null && _a !== void 0 ? _a : {};
156
156
  providerConfig.params.saml2 = 'disabled';
157
157
  let provider;
158
- if (btp_utils_1.isAbapSystem(destination)) {
158
+ if ((0, btp_utils_1.isAbapSystem)(destination)) {
159
159
  provider = createInstance(abap_1.AbapServiceProvider, providerConfig);
160
160
  }
161
161
  else {
@@ -164,7 +164,7 @@ function createForDestination(options, destination, destinationServiceInstance)
164
164
  // resolve destination service user on first request if required
165
165
  if (destinationServiceInstance) {
166
166
  const oneTimeReqInterceptorId = provider.interceptors.request.use((request) => __awaiter(this, void 0, void 0, function* () {
167
- const credentials = yield btp_utils_1.getCredentialsForDestinationService(destinationServiceInstance);
167
+ const credentials = yield (0, btp_utils_1.getCredentialsForDestinationService)(destinationServiceInstance);
168
168
  provider.defaults.headers.common[btp_utils_1.BAS_DEST_INSTANCE_CRED_HEADER] = credentials;
169
169
  provider.interceptors.request.eject(oneTimeReqInterceptorId);
170
170
  return request;
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "0.14.1",
3
+ "version": "1.0.1",
4
4
  "description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "private": false,
15
15
  "main": "dist/index.js",
16
16
  "dependencies": {
17
- "@sap-ux/btp-utils": "0.11.4",
18
- "@sap-ux/logger": "0.3.4",
17
+ "@sap-ux/btp-utils": "0.11.5",
18
+ "@sap-ux/logger": "0.3.5",
19
19
  "axios": "0.24.0",
20
20
  "detect-content-type": "1.2.0",
21
21
  "fast-xml-parser": "3.12.20",