d5-api-initializer 1.1.1 → 1.1.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-api-initializer",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "license": "MIT",
5
5
  "dependencies": {},
6
6
  "main": "publish/cjs/d5-api-initializer",
@@ -367,6 +367,7 @@ var UserMessages_default = new UserMessages();
367
367
  var ApiObjectCollectionIterator = class {
368
368
  constructor({ invoker }) {
369
369
  __publicField(this, "_invoker");
370
+ __publicField(this, "_rowsPerPage", 100);
370
371
  this._invoker = invoker;
371
372
  }
372
373
  get objectName() {
@@ -394,14 +395,17 @@ var ApiObjectCollectionIterator = class {
394
395
  this._invoker.addColumns(columns);
395
396
  return this;
396
397
  }
398
+ setRowsPerPage(amount) {
399
+ this._rowsPerPage = amount;
400
+ this._invoker.setRowsPerPage(amount);
401
+ return this;
402
+ }
397
403
  /* ------------------------------Other------------------------------ */
398
404
  *invoke() {
399
405
  let data = null, pageCount = 1;
400
406
  let lastPage = false;
401
- const rowsPerPage = 100;
402
407
  while (!lastPage) {
403
408
  this._invoker.page = pageCount;
404
- this._invoker.rowsPerPage = rowsPerPage;
405
409
  data = new ApiResponse(this._invoker.invoke(), this.objectName).getResponse();
406
410
  pageCount++;
407
411
  if (Array.isArray(data)) {
@@ -409,7 +413,7 @@ var ApiObjectCollectionIterator = class {
409
413
  yield data[i];
410
414
  }
411
415
  }
412
- lastPage = data.length < rowsPerPage;
416
+ lastPage = data.length < this._rowsPerPage;
413
417
  }
414
418
  }
415
419
  };
@@ -157,6 +157,7 @@ interface IInvoker$1<T> {
157
157
  setSorts(sorts: string[]): T;
158
158
  addColumns(columns: string[]): T;
159
159
  addSorts(sorts: string[]): T;
160
+ setRowsPerPage(amount: number): T;
160
161
  objectName: string;
161
162
  }
162
163
  declare class ApiInvoker implements IInvoker$1<ApiInvoker> {
@@ -302,6 +303,7 @@ declare class ApiRequest {
302
303
 
303
304
  declare class ApiObjectCollectionIterator implements IInvoker$1<ApiObjectCollectionIterator> {
304
305
  private _invoker;
306
+ private _rowsPerPage;
305
307
  constructor({ invoker }: {
306
308
  invoker: ApiInvoker;
307
309
  });
@@ -311,6 +313,7 @@ declare class ApiObjectCollectionIterator implements IInvoker$1<ApiObjectCollect
311
313
  setSorts(sorts: string[]): ApiObjectCollectionIterator;
312
314
  addSorts(sorts: string[]): ApiObjectCollectionIterator;
313
315
  addColumns(columns: string[]): ApiObjectCollectionIterator;
316
+ setRowsPerPage(amount: number): ApiObjectCollectionIterator;
314
317
  invoke(): Generator<ApiResponse>;
315
318
  }
316
319
 
@@ -331,6 +331,7 @@ var UserMessages_default = new UserMessages();
331
331
  var ApiObjectCollectionIterator = class {
332
332
  constructor({ invoker }) {
333
333
  __publicField(this, "_invoker");
334
+ __publicField(this, "_rowsPerPage", 100);
334
335
  this._invoker = invoker;
335
336
  }
336
337
  get objectName() {
@@ -358,14 +359,17 @@ var ApiObjectCollectionIterator = class {
358
359
  this._invoker.addColumns(columns);
359
360
  return this;
360
361
  }
362
+ setRowsPerPage(amount) {
363
+ this._rowsPerPage = amount;
364
+ this._invoker.setRowsPerPage(amount);
365
+ return this;
366
+ }
361
367
  /* ------------------------------Other------------------------------ */
362
368
  *invoke() {
363
369
  let data = null, pageCount = 1;
364
370
  let lastPage = false;
365
- const rowsPerPage = 100;
366
371
  while (!lastPage) {
367
372
  this._invoker.page = pageCount;
368
- this._invoker.rowsPerPage = rowsPerPage;
369
373
  data = new ApiResponse(this._invoker.invoke(), this.objectName).getResponse();
370
374
  pageCount++;
371
375
  if (Array.isArray(data)) {
@@ -373,7 +377,7 @@ var ApiObjectCollectionIterator = class {
373
377
  yield data[i];
374
378
  }
375
379
  }
376
- lastPage = data.length < rowsPerPage;
380
+ lastPage = data.length < this._rowsPerPage;
377
381
  }
378
382
  }
379
383
  };
@@ -331,6 +331,7 @@ var UserMessages_default = new UserMessages();
331
331
  var ApiObjectCollectionIterator = class {
332
332
  constructor({ invoker }) {
333
333
  __publicField(this, "_invoker");
334
+ __publicField(this, "_rowsPerPage", 100);
334
335
  this._invoker = invoker;
335
336
  }
336
337
  get objectName() {
@@ -358,14 +359,17 @@ var ApiObjectCollectionIterator = class {
358
359
  this._invoker.addColumns(columns);
359
360
  return this;
360
361
  }
362
+ setRowsPerPage(amount) {
363
+ this._rowsPerPage = amount;
364
+ this._invoker.setRowsPerPage(amount);
365
+ return this;
366
+ }
361
367
  /* ------------------------------Other------------------------------ */
362
368
  *invoke() {
363
369
  let data = null, pageCount = 1;
364
370
  let lastPage = false;
365
- const rowsPerPage = 100;
366
371
  while (!lastPage) {
367
372
  this._invoker.page = pageCount;
368
- this._invoker.rowsPerPage = rowsPerPage;
369
373
  data = new ApiResponse(this._invoker.invoke(), this.objectName).getResponse();
370
374
  pageCount++;
371
375
  if (Array.isArray(data)) {
@@ -373,7 +377,7 @@ var ApiObjectCollectionIterator = class {
373
377
  yield data[i];
374
378
  }
375
379
  }
376
- lastPage = data.length < rowsPerPage;
380
+ lastPage = data.length < this._rowsPerPage;
377
381
  }
378
382
  }
379
383
  };