ebay-api 9.4.4 → 9.5.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.
- package/README.md +25 -2
- package/dist/api/traditional/XMLRequest.d.ts +7 -1
- package/dist/api/traditional/XMLRequest.js +9 -9
- package/dist/api/traditional/index.js +14 -1
- package/dist/ebay-api.min.mjs +1 -1
- package/dist/types/apiTypes.d.ts +2 -0
- package/lib/api/traditional/XMLRequest.d.ts +7 -1
- package/lib/api/traditional/XMLRequest.js +9 -9
- package/lib/api/traditional/index.js +14 -1
- package/lib/ebay-api.min.js +1 -1
- package/lib/types/apiTypes.d.ts +2 -0
- package/package.json +1 -1
package/dist/types/apiTypes.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { X2jOptions } from 'fast-xml-parser';
|
|
2
3
|
import { Locale, MarketplaceId, SiteId } from '../enums/index.js';
|
|
3
4
|
export type Scope = string[];
|
|
4
5
|
export type Keyset = {
|
|
@@ -31,6 +32,7 @@ export type eBayConfig = Keyset & {
|
|
|
31
32
|
export type ApiConfig = {
|
|
32
33
|
autoRefreshToken?: boolean;
|
|
33
34
|
axiosConfig?: AxiosRequestConfig;
|
|
35
|
+
parseOptions?: X2jOptions;
|
|
34
36
|
};
|
|
35
37
|
export type Headers = Record<string, string | number | undefined>;
|
|
36
38
|
export type ApiRequestConfig = {
|
|
@@ -22,6 +22,13 @@ export declare const defaultXML2JSONParseOptions: {
|
|
|
22
22
|
leadingZeros: boolean;
|
|
23
23
|
};
|
|
24
24
|
removeNSPrefix: boolean;
|
|
25
|
+
processEntities: {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
maxEntitySize: number;
|
|
28
|
+
maxTotalExpansions: number;
|
|
29
|
+
maxExpandedLength: number;
|
|
30
|
+
maxEntityCount: number;
|
|
31
|
+
};
|
|
25
32
|
isArray: (name: string, jpath: string) => boolean;
|
|
26
33
|
};
|
|
27
34
|
export type BodyHeaders = {
|
|
@@ -55,7 +62,6 @@ export default class XMLRequest {
|
|
|
55
62
|
constructor(callName: string, fields: Fields | null, config: XMLReqConfig, req: IEBayApiRequest);
|
|
56
63
|
private getResponseWrapper;
|
|
57
64
|
private getCredentials;
|
|
58
|
-
private getParseOptions;
|
|
59
65
|
private getHeaders;
|
|
60
66
|
toJSON(xml: string): any;
|
|
61
67
|
toXML(fields: Fields): string;
|
|
@@ -28,6 +28,13 @@ exports.defaultXML2JSONParseOptions = {
|
|
|
28
28
|
leadingZeros: false
|
|
29
29
|
},
|
|
30
30
|
removeNSPrefix: true,
|
|
31
|
+
processEntities: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
maxEntitySize: 10000,
|
|
34
|
+
maxTotalExpansions: 10000,
|
|
35
|
+
maxExpandedLength: 100000,
|
|
36
|
+
maxEntityCount: 100
|
|
37
|
+
},
|
|
31
38
|
isArray: (name, jpath) => {
|
|
32
39
|
return /Array$/.test(jpath.slice(0, -name.length - 1));
|
|
33
40
|
}
|
|
@@ -65,12 +72,6 @@ class XMLRequest {
|
|
|
65
72
|
}
|
|
66
73
|
} : {};
|
|
67
74
|
}
|
|
68
|
-
getParseOptions() {
|
|
69
|
-
return {
|
|
70
|
-
...exports.defaultXML2JSONParseOptions,
|
|
71
|
-
...this.config.parseOptions
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
75
|
getHeaders() {
|
|
75
76
|
return {
|
|
76
77
|
...exports.defaultHeaders,
|
|
@@ -78,9 +79,8 @@ class XMLRequest {
|
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
81
|
toJSON(xml) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return new fast_xml_parser_1.XMLParser(parseOptions).parse(xml);
|
|
82
|
+
log('parseOption', this.config.parseOptions);
|
|
83
|
+
return new fast_xml_parser_1.XMLParser(this.config.parseOptions).parse(xml);
|
|
84
84
|
}
|
|
85
85
|
toXML(fields) {
|
|
86
86
|
const HEADING = '<?xml version="1.0" encoding="utf-8"?>';
|
|
@@ -49,7 +49,20 @@ class Traditional extends index_js_2.default {
|
|
|
49
49
|
constructor() {
|
|
50
50
|
super(...arguments);
|
|
51
51
|
this.createXMLRequest = (callName, api) => async (fields, opts) => {
|
|
52
|
-
const apiConfig = {
|
|
52
|
+
const apiConfig = {
|
|
53
|
+
...XMLRequest_js_1.defaultApiConfig,
|
|
54
|
+
...opts,
|
|
55
|
+
parseOptions: {
|
|
56
|
+
...XMLRequest_js_1.defaultApiConfig.parseOptions,
|
|
57
|
+
...this.config.parseOptions,
|
|
58
|
+
...opts?.parseOptions,
|
|
59
|
+
processEntities: {
|
|
60
|
+
...XMLRequest_js_1.defaultApiConfig.parseOptions.processEntities,
|
|
61
|
+
...this.config.parseOptions?.processEntities,
|
|
62
|
+
...opts?.parseOptions?.processEntities
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
53
66
|
try {
|
|
54
67
|
return await this.request(apiConfig, api, callName, fields);
|
|
55
68
|
}
|