bkper-js 1.43.1 → 1.45.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 +14 -0
- package/lib/model/Book.js +26 -0
- package/lib/service/transaction-service.js +14 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -966,6 +966,13 @@ export declare class Book {
|
|
|
966
966
|
* @returns The created Transactions
|
|
967
967
|
*/
|
|
968
968
|
batchCreateTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
969
|
+
/**
|
|
970
|
+
* Batch post [[Transactions]] on the Book.
|
|
971
|
+
*
|
|
972
|
+
* @param transactions The transactions to be posted
|
|
973
|
+
*
|
|
974
|
+
*/
|
|
975
|
+
batchPostTransactions(transactions: Transaction[]): Promise<void>;
|
|
969
976
|
/**
|
|
970
977
|
* Batch update [[Transactions]] on the Book.
|
|
971
978
|
*
|
|
@@ -1000,6 +1007,13 @@ export declare class Book {
|
|
|
1000
1007
|
*
|
|
1001
1008
|
*/
|
|
1002
1009
|
batchTrashTransactions(transactions: Transaction[], trashChecked?: boolean): Promise<void>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Batch untrash [[Transactions]] on the Book.
|
|
1012
|
+
*
|
|
1013
|
+
* @param transactions The transactions to be untrashed
|
|
1014
|
+
*
|
|
1015
|
+
*/
|
|
1016
|
+
batchUntrashTransactions(transactions: Transaction[]): Promise<void>;
|
|
1003
1017
|
/**
|
|
1004
1018
|
* Replay [[Events]] on the Book, in batch.
|
|
1005
1019
|
*/
|
package/lib/model/Book.js
CHANGED
|
@@ -421,6 +421,19 @@ export class Book {
|
|
|
421
421
|
return transactions;
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Batch post [[Transactions]] on the Book.
|
|
426
|
+
*
|
|
427
|
+
* @param transactions The transactions to be posted
|
|
428
|
+
*
|
|
429
|
+
*/
|
|
430
|
+
batchPostTransactions(transactions) {
|
|
431
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
+
let transactionPayloads = [];
|
|
433
|
+
transactions.forEach(tx => transactionPayloads.push(tx.json()));
|
|
434
|
+
yield TransactionService.postTransactionsBatch(this.getId(), transactionPayloads);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
424
437
|
/**
|
|
425
438
|
* Batch update [[Transactions]] on the Book.
|
|
426
439
|
*
|
|
@@ -481,6 +494,19 @@ export class Book {
|
|
|
481
494
|
yield TransactionService.trashTransactionsBatch(this.getId(), transactionPayloads, trashChecked);
|
|
482
495
|
});
|
|
483
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* Batch untrash [[Transactions]] on the Book.
|
|
499
|
+
*
|
|
500
|
+
* @param transactions The transactions to be untrashed
|
|
501
|
+
*
|
|
502
|
+
*/
|
|
503
|
+
batchUntrashTransactions(transactions) {
|
|
504
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
+
let transactionPayloads = [];
|
|
506
|
+
transactions.forEach(tx => transactionPayloads.push(tx.json()));
|
|
507
|
+
yield TransactionService.untrashTransactionsBatch(this.getId(), transactionPayloads);
|
|
508
|
+
});
|
|
509
|
+
}
|
|
484
510
|
/**
|
|
485
511
|
* Replay [[Events]] on the Book, in batch.
|
|
486
512
|
*/
|
|
@@ -14,6 +14,12 @@ export function createTransaction(bookId, transaction) {
|
|
|
14
14
|
return response.data;
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
export function postTransactionsBatch(bookId, transactions) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const payload = { items: transactions };
|
|
20
|
+
yield new HttpBooksApiV5Request(`${bookId}/transactions/post/batch`).setMethod('PATCH').setPayload(payload).fetch();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
17
23
|
export function createTransactionsBatch(bookId, transactions) {
|
|
18
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
25
|
let transactionList = { items: transactions };
|
|
@@ -52,6 +58,14 @@ export function trashTransactionsBatch(bookId, transactions, trashChecked) {
|
|
|
52
58
|
transactionList = yield response.data;
|
|
53
59
|
});
|
|
54
60
|
}
|
|
61
|
+
export function untrashTransactionsBatch(bookId, transactions) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
let transactionList = { items: transactions };
|
|
64
|
+
const payload = transactionList;
|
|
65
|
+
const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/untrash/batch`).setMethod('PATCH').setPayload(payload).fetch();
|
|
66
|
+
transactionList = yield response.data;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
55
69
|
export function updateTransaction(bookId, transaction) {
|
|
56
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
71
|
var response = yield new HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(transaction).fetch();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"description": "Javascript client for Bkper REST API",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@bkper/bkper-api-types": "^5.
|
|
37
|
+
"@bkper/bkper-api-types": "^5.21.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@google-cloud/local-auth": "^3.0.1",
|