@quantcdn/quant-client 2.0.7 → 2.0.9
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/dist/src/client.js +13 -4
- package/dist/src/response.js +3 -2
- package/dist/src/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -23,7 +23,7 @@ class HttpClient {
|
|
|
23
23
|
do(options) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
return yield new Promise((resolve, reject) => {
|
|
26
|
-
request(options, (error,
|
|
26
|
+
request(options, (error, response, body) => {
|
|
27
27
|
if (error !== null) {
|
|
28
28
|
reject(error);
|
|
29
29
|
}
|
|
@@ -116,6 +116,13 @@ class QuantClient {
|
|
|
116
116
|
if ((filters === null || filters === void 0 ? void 0 : filters.sort_field) != null) {
|
|
117
117
|
qs.sort_field = filters.sort_field;
|
|
118
118
|
}
|
|
119
|
+
if ((filters === null || filters === void 0 ? void 0 : filters.quant_type) != null) {
|
|
120
|
+
qs.quant_type = filters.quant_type;
|
|
121
|
+
}
|
|
122
|
+
if ((filters === null || filters === void 0 ? void 0 : filters.page_size) != null) {
|
|
123
|
+
// Ensure page_size is between 1 and 100
|
|
124
|
+
qs.page_size = Math.min(Math.max(1, filters.page_size), 100);
|
|
125
|
+
}
|
|
119
126
|
return yield this._project.get('global-meta', qs);
|
|
120
127
|
}),
|
|
121
128
|
/**
|
|
@@ -183,12 +190,13 @@ class QuantClient {
|
|
|
183
190
|
* The response object.
|
|
184
191
|
*/
|
|
185
192
|
publish: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
|
|
193
|
+
const response = yield this._project.patch(`publish/${payload.revision}`, {}, {
|
|
187
194
|
'Quant-Url': payload.location
|
|
188
195
|
});
|
|
196
|
+
return response.first();
|
|
189
197
|
}),
|
|
190
198
|
/**
|
|
191
|
-
* Unpublish
|
|
199
|
+
* Unpublish the current published revision.
|
|
192
200
|
*
|
|
193
201
|
* @param payload PublishPayload
|
|
194
202
|
* The payload object.
|
|
@@ -197,9 +205,10 @@ class QuantClient {
|
|
|
197
205
|
* The response object.
|
|
198
206
|
*/
|
|
199
207
|
unpublish: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
|
|
208
|
+
const response = yield this._project.patch('unpublish', {}, {
|
|
201
209
|
'Quant-Url': payload.location
|
|
202
210
|
});
|
|
211
|
+
return response.first();
|
|
203
212
|
}),
|
|
204
213
|
/**
|
|
205
214
|
* Redirect a URL.
|
package/dist/src/response.js
CHANGED
|
@@ -25,13 +25,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.PaginatedResponse = void 0;
|
|
26
26
|
class PaginatedResponse {
|
|
27
27
|
constructor(client, options) {
|
|
28
|
-
|
|
28
|
+
var _a, _b;
|
|
29
29
|
this.page = 0;
|
|
30
30
|
this.total = 0;
|
|
31
31
|
this.hasNext = true;
|
|
32
32
|
this.client = client;
|
|
33
33
|
this.request = options;
|
|
34
|
-
|
|
34
|
+
// Use page_size from query parameters or default to 10
|
|
35
|
+
this.per_page = (_b = (_a = this.request.qs) === null || _a === void 0 ? void 0 : _a.page_size) !== null && _b !== void 0 ? _b : 10;
|
|
35
36
|
this.page = 1;
|
|
36
37
|
if (typeof this.request.qs !== 'object') {
|
|
37
38
|
this.request.qs = {};
|
package/dist/src/types.d.ts
CHANGED