@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.
@@ -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, repsonse, body) => {
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
- return yield this._project.patch(`publish/${payload.revision}`, {}, {
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 a revision.
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
- return yield this._project.patch(`unpublish/${payload.revision}`, {}, {
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.
@@ -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
- this.per_page = 10;
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
- this.per_page = 10;
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 = {};
@@ -62,4 +62,6 @@ export interface WafLog {
62
62
  export interface MetaFilters {
63
63
  sort_field: string;
64
64
  sort_direction: string;
65
+ quant_type?: 'edge_function' | 'redirect' | 'content' | 'file';
66
+ page_size?: number;
65
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantcdn/quant-client",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Client library for API connectivity",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",