@sap-ux/axios-extension 1.2.6 → 1.2.7

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,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.AdtCatalogService = void 0;
16
13
  const axios_1 = require("axios");
17
14
  const adt_schema_store_1 = require("./adt-schema-store");
18
- const fast_xml_parser_1 = __importDefault(require("fast-xml-parser"));
15
+ const fast_xml_parser_1 = require("fast-xml-parser");
19
16
  /**
20
17
  * Adt Catalog Service implementation fetches the
21
18
  * Adt service specification for a given ADT service.
@@ -93,17 +90,18 @@ class AdtCatalogService extends axios_1.Axios {
93
90
  * @returns Discovery schema data object
94
91
  */
95
92
  parseAdtSchemaData(xml) {
96
- if (fast_xml_parser_1.default.validate(xml) !== true) {
93
+ if (fast_xml_parser_1.XMLValidator.validate(xml) !== true) {
97
94
  return null;
98
95
  }
99
96
  const options = {
100
97
  attributeNamePrefix: '',
101
98
  ignoreAttributes: false,
102
99
  ignoreNameSpace: true,
103
- parseAttributeValue: true
100
+ parseAttributeValue: true,
101
+ removeNSPrefix: true
104
102
  };
105
- const obj = fast_xml_parser_1.default.getTraversalObj(xml, options);
106
- const parsed = fast_xml_parser_1.default.convertToJson(obj, options);
103
+ const parser = new fast_xml_parser_1.XMLParser(options);
104
+ const parsed = parser.parse(xml, true);
107
105
  if (parsed.service) {
108
106
  return parsed;
109
107
  }
@@ -31,20 +31,21 @@ class AdtSchemaStore {
31
31
  this.adtSchema = {};
32
32
  const workspaces = schemaData.service.workspace;
33
33
  for (const workspace of workspaces) {
34
- if (!workspace.collection) {
34
+ const collections = workspace.collection;
35
+ if (!collections) {
35
36
  continue;
36
37
  }
37
- if (Array.isArray(workspace.collection)) {
38
- workspace.collection.forEach((collection) => {
38
+ if (Array.isArray(collections)) {
39
+ collections.forEach((collection) => {
39
40
  collection.workspaceTitle = workspace.title;
40
41
  const id = this.serializeAdtCategory(collection.category);
41
42
  this.adtSchema[id] = collection;
42
43
  });
43
44
  }
44
45
  else {
45
- const collection = workspace.collection;
46
+ const collection = collections;
46
47
  const id = this.serializeAdtCategory(collection.category);
47
- this.adtSchema[id] = workspace.collection;
48
+ this.adtSchema[id] = collections;
48
49
  }
49
50
  }
50
51
  }
@@ -8,13 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.AtoService = void 0;
16
13
  const adt_service_1 = require("./adt-service");
17
- const fast_xml_parser_1 = __importDefault(require("fast-xml-parser"));
14
+ const fast_xml_parser_1 = require("fast-xml-parser");
18
15
  /**
19
16
  * AtoService implements ADT requests for fetching ATO settings.
20
17
  */
@@ -49,7 +46,7 @@ class AtoService extends adt_service_1.AdtService {
49
46
  * @returns parsed ATO settings
50
47
  */
51
48
  parseAtoResponse(xml) {
52
- if (fast_xml_parser_1.default.validate(xml) !== true) {
49
+ if (fast_xml_parser_1.XMLValidator.validate(xml) !== true) {
53
50
  this.log.warn(`Invalid XML: ${xml}`);
54
51
  return {};
55
52
  }
@@ -57,10 +54,11 @@ class AtoService extends adt_service_1.AdtService {
57
54
  attributeNamePrefix: '',
58
55
  ignoreAttributes: false,
59
56
  ignoreNameSpace: true,
60
- parseAttributeValue: true
57
+ parseAttributeValue: true,
58
+ removeNSPrefix: true
61
59
  };
62
- const obj = fast_xml_parser_1.default.getTraversalObj(xml, options);
63
- const parsed = fast_xml_parser_1.default.convertToJson(obj, options);
60
+ const parser = new fast_xml_parser_1.XMLParser(options);
61
+ const parsed = parser.parse(xml, true);
64
62
  return parsed.settings ? parsed.settings : {};
65
63
  }
66
64
  }
@@ -8,13 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.FileStoreService = void 0;
16
13
  const adt_service_1 = require("./adt-service");
17
- const fast_xml_parser_1 = __importDefault(require("fast-xml-parser"));
14
+ const fast_xml_parser_1 = require("fast-xml-parser");
18
15
  /**
19
16
  * FileStoreService implements ADT requests to obtain the content
20
17
  * of deployed archive.
@@ -78,17 +75,18 @@ class FileStoreService extends adt_service_1.AdtService {
78
75
  return responseData;
79
76
  }
80
77
  // A list of file/folder items in the response data as xml string.
81
- if (fast_xml_parser_1.default.validate(responseData) !== true) {
78
+ if (fast_xml_parser_1.XMLValidator.validate(responseData) !== true) {
82
79
  throw new Error('Invalid XML content');
83
80
  }
84
81
  const options = {
85
82
  attributeNamePrefix: '',
86
83
  ignoreAttributes: false,
87
84
  ignoreNameSpace: true,
88
- parseAttributeValue: true
85
+ parseAttributeValue: true,
86
+ removeNSPrefix: true
89
87
  };
90
- const obj = fast_xml_parser_1.default.getTraversalObj(responseData, options);
91
- const parsed = fast_xml_parser_1.default.convertToJson(obj, options);
88
+ const parser = new fast_xml_parser_1.XMLParser(options);
89
+ const parsed = parser.parse(responseData, true);
92
90
  let fileNodeArray = [];
93
91
  if (parsed === null || parsed === void 0 ? void 0 : parsed.feed) {
94
92
  if (Array.isArray(parsed.feed.entry)) {
@@ -8,13 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.ListPackageService = void 0;
16
13
  const adt_service_1 = require("./adt-service");
17
- const fast_xml_parser_1 = __importDefault(require("fast-xml-parser"));
14
+ const fast_xml_parser_1 = require("fast-xml-parser");
18
15
  /**
19
16
  * ListPackageService implements ADT requests for fetching a list of available package names
20
17
  * from ABAP backend system.
@@ -74,7 +71,7 @@ class ListPackageService extends adt_service_1.AdtService {
74
71
  */
75
72
  parsePackageListResponse(xml) {
76
73
  var _a;
77
- if (fast_xml_parser_1.default.validate(xml) !== true) {
74
+ if (fast_xml_parser_1.XMLValidator.validate(xml) !== true) {
78
75
  this.log.warn(`Invalid XML: ${xml}`);
79
76
  return [];
80
77
  }
@@ -82,10 +79,11 @@ class ListPackageService extends adt_service_1.AdtService {
82
79
  attributeNamePrefix: '',
83
80
  ignoreAttributes: false,
84
81
  ignoreNameSpace: true,
85
- parseAttributeValue: true
82
+ parseAttributeValue: true,
83
+ removeNSPrefix: true
86
84
  };
87
- const obj = fast_xml_parser_1.default.getTraversalObj(xml, options);
88
- const parsed = fast_xml_parser_1.default.convertToJson(obj, options);
85
+ const parser = new fast_xml_parser_1.XMLParser(options);
86
+ const parsed = parser.parse(xml, true);
89
87
  let packageArray = [];
90
88
  if ((_a = parsed === null || parsed === void 0 ? void 0 : parsed.objectReferences) === null || _a === void 0 ? void 0 : _a.objectReference) {
91
89
  if (Array.isArray(parsed.objectReferences.objectReference)) {
@@ -31,14 +31,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
32
  });
33
33
  };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
34
  Object.defineProperty(exports, "__esModule", { value: true });
38
35
  exports.TransportChecksService = void 0;
39
36
  const adt_service_1 = require("./adt-service");
40
37
  const types_1 = require("../../types");
41
- const fast_xml_parser_1 = __importDefault(require("fast-xml-parser"));
38
+ const fast_xml_parser_1 = require("fast-xml-parser");
42
39
  const xpath = __importStar(require("xpath"));
43
40
  const xmldom_1 = require("@xmldom/xmldom");
44
41
  /**
@@ -97,7 +94,7 @@ class TransportChecksService extends adt_service_1.AdtService {
97
94
  */
98
95
  getTransportRequestList(xml) {
99
96
  var _a;
100
- if (fast_xml_parser_1.default.validate(xml) !== true) {
97
+ if (fast_xml_parser_1.XMLValidator.validate(xml) !== true) {
101
98
  this.log.warn(`Invalid XML: ${xml}`);
102
99
  return [];
103
100
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "1.2.6",
4
- "description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.",
3
+ "version": "1.2.7",
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",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "axios": "0.24.0",
18
18
  "detect-content-type": "1.2.0",
19
- "fast-xml-parser": "3.12.20",
19
+ "fast-xml-parser": "4.2.4",
20
20
  "lodash": "4.17.21",
21
21
  "open": "7.0.3",
22
22
  "qs": "6.7.3",
@@ -48,7 +48,7 @@
48
48
  "lint": "eslint . --ext .ts",
49
49
  "lint:fix": "eslint . --ext .ts --fix",
50
50
  "test": "jest --ci --forceExit --detectOpenHandles --colors",
51
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
51
+ "test-u": "jest --forceExit --detectOpenHandles --colors -u",
52
52
  "link": "pnpm link --global",
53
53
  "unlink": "pnpm unlink --global"
54
54
  }