bkper-js 1.42.0 → 1.43.0

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/lib/index.d.ts CHANGED
@@ -966,6 +966,15 @@ export declare class Book {
966
966
  * @returns The created Transactions
967
967
  */
968
968
  batchCreateTransactions(transactions: Transaction[]): Promise<Transaction[]>;
969
+ /**
970
+ * Batch update [[Transactions]] on the Book.
971
+ *
972
+ * @param transactions The transactions to be updated
973
+ *
974
+ * @param updateChecked True to also update checked transactions
975
+ *
976
+ */
977
+ batchUpdateTransactions(transactions: Transaction[], updateChecked?: boolean): Promise<void>;
969
978
  /**
970
979
  * Batch check [[Transactions]] on the Book.
971
980
  *
@@ -985,8 +994,10 @@ export declare class Book {
985
994
  *
986
995
  * @param transactions The transactions to be trashed
987
996
  *
997
+ * @param trashChecked True to also trash checked transactions
998
+ *
988
999
  */
989
- batchTrashTransactions(transactions: Transaction[]): Promise<void>;
1000
+ batchTrashTransactions(transactions: Transaction[], trashChecked?: boolean): Promise<void>;
990
1001
  /**
991
1002
  * Replay [[Events]] on the Book, in batch.
992
1003
  */
package/lib/model/Book.js CHANGED
@@ -421,6 +421,21 @@ export class Book {
421
421
  return transactions;
422
422
  });
423
423
  }
424
+ /**
425
+ * Batch update [[Transactions]] on the Book.
426
+ *
427
+ * @param transactions The transactions to be updated
428
+ *
429
+ * @param updateChecked True to also update checked transactions
430
+ *
431
+ */
432
+ batchUpdateTransactions(transactions, updateChecked) {
433
+ return __awaiter(this, void 0, void 0, function* () {
434
+ let transactionsPayload = [];
435
+ transactions.forEach(tx => transactionsPayload.push(tx.json()));
436
+ yield TransactionService.updateTransactionsBatch(this.getId(), transactionsPayload, updateChecked);
437
+ });
438
+ }
424
439
  /**
425
440
  * Batch check [[Transactions]] on the Book.
426
441
  *
@@ -452,12 +467,14 @@ export class Book {
452
467
  *
453
468
  * @param transactions The transactions to be trashed
454
469
  *
470
+ * @param trashChecked True to also trash checked transactions
471
+ *
455
472
  */
456
- batchTrashTransactions(transactions) {
473
+ batchTrashTransactions(transactions, trashChecked) {
457
474
  return __awaiter(this, void 0, void 0, function* () {
458
475
  let transactionPayloads = [];
459
476
  transactions.forEach(tx => transactionPayloads.push(tx.json()));
460
- yield TransactionService.trashTransactionsBatch(this.getId(), transactionPayloads);
477
+ yield TransactionService.trashTransactionsBatch(this.getId(), transactionPayloads, trashChecked);
461
478
  });
462
479
  }
463
480
  /**
@@ -28,6 +28,12 @@ export function createTransactionsBatch(bookId, transactions) {
28
28
  return transactionList != null && transactionList.items != null ? transactionList.items : [];
29
29
  });
30
30
  }
31
+ export function updateTransactionsBatch(bookId, transactions, updateChecked) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const payload = { items: transactions };
34
+ yield new HttpBooksApiV5Request(`${bookId}/transactions/batch`).setMethod('PUT').setPayload(payload).addParam('updateChecked', updateChecked).fetch();
35
+ });
36
+ }
31
37
  export function checkTransactionsBatch(bookId, transactions) {
32
38
  return __awaiter(this, void 0, void 0, function* () {
33
39
  const payload = { items: transactions };
@@ -40,16 +46,11 @@ export function uncheckTransactionsBatch(bookId, transactions) {
40
46
  yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck/batch`).setMethod('PATCH').setPayload(payload).fetch();
41
47
  });
42
48
  }
43
- export function trashTransactionsBatch(bookId, transactions) {
49
+ export function trashTransactionsBatch(bookId, transactions, trashChecked) {
44
50
  return __awaiter(this, void 0, void 0, function* () {
45
- let transactionList = {
46
- items: transactions
47
- };
48
- var payload = transactionList;
49
- let response = yield new HttpBooksApiV5Request(`${bookId}/transactions/trash/batch`)
50
- .setMethod('PATCH')
51
- .setPayload(payload)
52
- .fetch();
51
+ let transactionList = { items: transactions };
52
+ const payload = transactionList;
53
+ const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/trash/batch`).setMethod('PATCH').setPayload(payload).addParam('trashChecked', trashChecked).fetch();
53
54
  transactionList = yield response.data;
54
55
  });
55
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "1.42.0",
3
+ "version": "1.43.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",