startgg-helper 2.1.1 → 2.2.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.
- package/package.json +14 -1
- package/src/query.js +1 -1
- package/src/queryLimiter.js +3 -5
package/package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "startgg-helper",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "A set of functions and classes useful to communicate with the start.gg API, using any client (YOU NEED TO PROVIDE A CLIENT YOURSELF, SEE README)",
|
|
5
5
|
"main": "main.js",
|
|
6
|
+
"module": "main.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"default": "./main.js"
|
|
10
|
+
},
|
|
11
|
+
"./util": {
|
|
12
|
+
"default": "./src/jsUtil.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"main.js",
|
|
17
|
+
"/src"
|
|
18
|
+
],
|
|
6
19
|
"scripts": {
|
|
7
20
|
"test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js --silent"
|
|
8
21
|
},
|
package/src/query.js
CHANGED
|
@@ -134,7 +134,7 @@ export class Query {
|
|
|
134
134
|
let localResult = connection.nodes;
|
|
135
135
|
if (connection.pageInfo && connection.pageInfo.totalPages){
|
|
136
136
|
let totalPages = connection.pageInfo.totalPages;
|
|
137
|
-
if (currentPage >= totalPages) {
|
|
137
|
+
if (!totalPages || currentPage >= totalPages) {
|
|
138
138
|
result = result.concat(localResult);
|
|
139
139
|
break;
|
|
140
140
|
}
|
package/src/queryLimiter.js
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
//voir la diff avec la version de sgghelper ?
|
|
4
4
|
|
|
5
|
-
import { GraphQLClient } from "graphql-request";
|
|
6
|
-
|
|
7
5
|
export class TimedQuerySemaphore {
|
|
8
6
|
/**
|
|
9
|
-
* @typedef {{client:
|
|
7
|
+
* @typedef {{client: any, schema: string,
|
|
10
8
|
* params: {[varName: string]: value},
|
|
11
9
|
* resolve: (value: any) => void,
|
|
12
10
|
* reject: (reason?: any) => void}
|
|
@@ -43,7 +41,7 @@ export class TimedQuerySemaphore {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
|
-
* @param {
|
|
44
|
+
* @param {any} client
|
|
47
45
|
* @param {string} schema
|
|
48
46
|
* @param {{[varName: string]: value}} params
|
|
49
47
|
* @returns
|
|
@@ -70,7 +68,7 @@ export class TimedQuerySemaphore {
|
|
|
70
68
|
|
|
71
69
|
/**
|
|
72
70
|
* Executes the given query with the given GraphQL Client
|
|
73
|
-
* @param {
|
|
71
|
+
* @param {any} client
|
|
74
72
|
* @param {string} schema
|
|
75
73
|
* @param {{[varName: string]: value}} params
|
|
76
74
|
* @returns
|