zudello-integration-sdk 1.0.57 → 1.0.59
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
CHANGED
|
@@ -54,13 +54,16 @@ class UniversalModule {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Universal List By URL.
|
|
57
|
-
* @param {
|
|
57
|
+
* @param {string} url URL of the request.
|
|
58
|
+
* @param {string} after Cursor for pagination.
|
|
58
59
|
* @param {number} limit Limit of listed data.
|
|
59
60
|
* @param {string} query Query of listed data.
|
|
61
|
+
* @param {object} variables Additional variables for the query.
|
|
60
62
|
* @returns {object} Universal List Response.
|
|
61
63
|
*/
|
|
62
|
-
async list({ after = "", limit = 100, query = "", variables = {} }) {
|
|
64
|
+
async list({ url, after = "", limit = 100, query = "", variables = {} }) {
|
|
63
65
|
return await this.request({
|
|
66
|
+
url,
|
|
64
67
|
method: "POST",
|
|
65
68
|
body: {
|
|
66
69
|
query,
|
|
@@ -75,35 +78,41 @@ class UniversalModule {
|
|
|
75
78
|
|
|
76
79
|
/**
|
|
77
80
|
* Universal Auto Pagination Listing.
|
|
78
|
-
* @param {
|
|
81
|
+
* @param {string} url URL of the request.
|
|
82
|
+
* @param {string} after Cursor for pagination.
|
|
79
83
|
* @param {number} limit Limit of listed data.
|
|
80
84
|
* @param {string} query Query of listed data.
|
|
81
|
-
* @
|
|
85
|
+
* @param {object} variables Additional variables for the query.
|
|
86
|
+
* @param {string} pageInfoPath Path to pageInfo in the response (e.g., "data.users.pageInfo").
|
|
87
|
+
* @returns {AsyncGenerator} Auto Pagination responses.
|
|
82
88
|
*/
|
|
83
89
|
async *autoPaginationList({
|
|
90
|
+
url,
|
|
84
91
|
after = "",
|
|
85
92
|
limit = 100,
|
|
86
93
|
query = "",
|
|
87
94
|
variables = {},
|
|
88
95
|
pageInfoPath = "",
|
|
89
96
|
}) {
|
|
90
|
-
let response = await this.list({ after, limit, query, variables });
|
|
91
|
-
|
|
97
|
+
let response = await this.list({ url, after, limit, query, variables });
|
|
92
98
|
yield response;
|
|
93
99
|
|
|
94
|
-
pageInfo = _.get(response, pageInfoPath);
|
|
95
|
-
if (pageInfo.hasNextPage) {
|
|
100
|
+
let pageInfo = _.get(response, pageInfoPath);
|
|
101
|
+
if (pageInfo && pageInfo.hasNextPage) {
|
|
96
102
|
while (pageInfo.hasNextPage) {
|
|
97
103
|
after = pageInfo.endCursor;
|
|
98
104
|
|
|
99
|
-
response = await this.list({ after, limit, query, variables });
|
|
100
|
-
|
|
105
|
+
response = await this.list({ url, after, limit, query, variables });
|
|
101
106
|
yield response;
|
|
102
107
|
|
|
103
108
|
pageInfo = _.get(response, pageInfoPath);
|
|
109
|
+
|
|
110
|
+
if (!pageInfo) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
104
113
|
}
|
|
105
114
|
}
|
|
106
115
|
}
|
|
107
116
|
}
|
|
108
117
|
|
|
109
|
-
module.exports = UniversalModule;
|
|
118
|
+
module.exports = UniversalModule;
|