ensembledata 0.1.0 → 0.1.4
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 +4 -4
- package/package.json +3 -2
- package/src/client.js +287 -105
- package/src/requester.js +7 -8
- package/src/version.js +1 -1
- package/types/client.d.ts +103 -100
- package/types/client.d.ts.map +1 -1
- package/types/requester.d.ts +5 -5
- package/types/requester.d.ts.map +1 -1
- package/types/version.d.ts +1 -1
package/src/requester.js
CHANGED
|
@@ -13,7 +13,7 @@ export class Requester {
|
|
|
13
13
|
* @type {number}
|
|
14
14
|
* @readonly
|
|
15
15
|
*/
|
|
16
|
-
#
|
|
16
|
+
#timeout;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @type {number}
|
|
@@ -24,29 +24,28 @@ export class Requester {
|
|
|
24
24
|
/**
|
|
25
25
|
* @param {{
|
|
26
26
|
* token: string;
|
|
27
|
-
*
|
|
27
|
+
* timeout: number;
|
|
28
28
|
* maxNetworkRetries: number;
|
|
29
29
|
* }} options
|
|
30
30
|
*/
|
|
31
|
-
constructor({ token,
|
|
31
|
+
constructor({ token, timeout, maxNetworkRetries }) {
|
|
32
32
|
this.#token = token;
|
|
33
|
-
this.#
|
|
33
|
+
this.#timeout = timeout;
|
|
34
34
|
this.#maxNetworkRetries = maxNetworkRetries;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @param {string} path
|
|
39
39
|
* @param {Record<string, any>} params
|
|
40
|
-
* @param {{
|
|
40
|
+
* @param {{ timeout?: number; returnTopLevelData?: boolean }} options
|
|
41
41
|
* @returns {Promise<EDResponse>}
|
|
42
42
|
*/
|
|
43
43
|
async get(path, params, options = {}) {
|
|
44
44
|
params = { ...params, token: this.#token };
|
|
45
45
|
const queryParams = new URLSearchParams(params).toString();
|
|
46
46
|
const timeoutMS =
|
|
47
|
-
(options.
|
|
48
|
-
|
|
49
|
-
: options.timeoutSecs) * 1_000;
|
|
47
|
+
(options.timeout === undefined ? this.#timeout : options.timeout) *
|
|
48
|
+
1_000;
|
|
50
49
|
const returnTopLevelData = options.returnTopLevelData || false;
|
|
51
50
|
|
|
52
51
|
for (let i = 0; i < this.#maxNetworkRetries; i++) {
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.4";
|