bkper-js 1.40.0 → 1.42.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 +39 -2
- package/lib/model/Book.js +35 -2
- package/lib/model/Query.js +22 -0
- package/lib/service/transaction-service.js +12 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -959,11 +959,32 @@ export declare class Book {
|
|
|
959
959
|
*/
|
|
960
960
|
round(value: Amount | number): Amount;
|
|
961
961
|
/**
|
|
962
|
-
*
|
|
962
|
+
* Batch create [[Transactions]] on the Book.
|
|
963
|
+
*
|
|
964
|
+
* @param transactions The transactions to be created
|
|
965
|
+
*
|
|
966
|
+
* @returns The created Transactions
|
|
963
967
|
*/
|
|
964
968
|
batchCreateTransactions(transactions: Transaction[]): Promise<Transaction[]>;
|
|
965
969
|
/**
|
|
966
|
-
*
|
|
970
|
+
* Batch check [[Transactions]] on the Book.
|
|
971
|
+
*
|
|
972
|
+
* @param transactions The transactions to be checked
|
|
973
|
+
*
|
|
974
|
+
*/
|
|
975
|
+
batchCheckTransactions(transactions: Transaction[]): Promise<void>;
|
|
976
|
+
/**
|
|
977
|
+
* Batch uncheck [[Transactions]] on the Book.
|
|
978
|
+
*
|
|
979
|
+
* @param transactions The transactions to be unchecked
|
|
980
|
+
*
|
|
981
|
+
*/
|
|
982
|
+
batchUncheckTransactions(transactions: Transaction[]): Promise<void>;
|
|
983
|
+
/**
|
|
984
|
+
* Batch trash [[Transactions]] on the Book.
|
|
985
|
+
*
|
|
986
|
+
* @param transactions The transactions to be trashed
|
|
987
|
+
*
|
|
967
988
|
*/
|
|
968
989
|
batchTrashTransactions(transactions: Transaction[]): Promise<void>;
|
|
969
990
|
/**
|
|
@@ -2279,10 +2300,26 @@ export declare class Query {
|
|
|
2279
2300
|
* @return The title of this saved Query
|
|
2280
2301
|
*/
|
|
2281
2302
|
getTitle(): string | undefined;
|
|
2303
|
+
/**
|
|
2304
|
+
* Sets the title of this saved Query.
|
|
2305
|
+
*
|
|
2306
|
+
* @param title The title of this saved Query
|
|
2307
|
+
*
|
|
2308
|
+
* @returns This Query, for chaining
|
|
2309
|
+
*/
|
|
2310
|
+
setTitle(title: string): Query;
|
|
2282
2311
|
/**
|
|
2283
2312
|
* @return This Query string to be executed
|
|
2284
2313
|
*/
|
|
2285
2314
|
getQuery(): string | undefined;
|
|
2315
|
+
/**
|
|
2316
|
+
* Sets the query string associated with this saved Query.
|
|
2317
|
+
*
|
|
2318
|
+
* @param query The query string to be executed
|
|
2319
|
+
*
|
|
2320
|
+
* @returns This Query, for chaining
|
|
2321
|
+
*/
|
|
2322
|
+
setQuery(query: string): Query;
|
|
2286
2323
|
/**
|
|
2287
2324
|
* Perform create new Query.
|
|
2288
2325
|
*/
|
package/lib/model/Book.js
CHANGED
|
@@ -406,7 +406,11 @@ export class Book {
|
|
|
406
406
|
return Utils.round(value, this.getFractionDigits());
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
409
|
-
*
|
|
409
|
+
* Batch create [[Transactions]] on the Book.
|
|
410
|
+
*
|
|
411
|
+
* @param transactions The transactions to be created
|
|
412
|
+
*
|
|
413
|
+
* @returns The created Transactions
|
|
410
414
|
*/
|
|
411
415
|
batchCreateTransactions(transactions) {
|
|
412
416
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -418,7 +422,36 @@ export class Book {
|
|
|
418
422
|
});
|
|
419
423
|
}
|
|
420
424
|
/**
|
|
421
|
-
*
|
|
425
|
+
* Batch check [[Transactions]] on the Book.
|
|
426
|
+
*
|
|
427
|
+
* @param transactions The transactions to be checked
|
|
428
|
+
*
|
|
429
|
+
*/
|
|
430
|
+
batchCheckTransactions(transactions) {
|
|
431
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
+
let transactionPayloads = [];
|
|
433
|
+
transactions.forEach(tx => transactionPayloads.push(tx.json()));
|
|
434
|
+
yield TransactionService.checkTransactionsBatch(this.getId(), transactionPayloads);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Batch uncheck [[Transactions]] on the Book.
|
|
439
|
+
*
|
|
440
|
+
* @param transactions The transactions to be unchecked
|
|
441
|
+
*
|
|
442
|
+
*/
|
|
443
|
+
batchUncheckTransactions(transactions) {
|
|
444
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
445
|
+
let transactionPayloads = [];
|
|
446
|
+
transactions.forEach(tx => transactionPayloads.push(tx.json()));
|
|
447
|
+
yield TransactionService.uncheckTransactionsBatch(this.getId(), transactionPayloads);
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Batch trash [[Transactions]] on the Book.
|
|
452
|
+
*
|
|
453
|
+
* @param transactions The transactions to be trashed
|
|
454
|
+
*
|
|
422
455
|
*/
|
|
423
456
|
batchTrashTransactions(transactions) {
|
|
424
457
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/model/Query.js
CHANGED
|
@@ -38,12 +38,34 @@ export class Query {
|
|
|
38
38
|
getTitle() {
|
|
39
39
|
return this.payload.title;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Sets the title of this saved Query.
|
|
43
|
+
*
|
|
44
|
+
* @param title The title of this saved Query
|
|
45
|
+
*
|
|
46
|
+
* @returns This Query, for chaining
|
|
47
|
+
*/
|
|
48
|
+
setTitle(title) {
|
|
49
|
+
this.payload.title = title;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
41
52
|
/**
|
|
42
53
|
* @return This Query string to be executed
|
|
43
54
|
*/
|
|
44
55
|
getQuery() {
|
|
45
56
|
return this.payload.query;
|
|
46
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Sets the query string associated with this saved Query.
|
|
60
|
+
*
|
|
61
|
+
* @param query The query string to be executed
|
|
62
|
+
*
|
|
63
|
+
* @returns This Query, for chaining
|
|
64
|
+
*/
|
|
65
|
+
setQuery(query) {
|
|
66
|
+
this.payload.query = query;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
47
69
|
/**
|
|
48
70
|
* Perform create new Query.
|
|
49
71
|
*/
|
|
@@ -28,6 +28,18 @@ export function createTransactionsBatch(bookId, transactions) {
|
|
|
28
28
|
return transactionList != null && transactionList.items != null ? transactionList.items : [];
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
export function checkTransactionsBatch(bookId, transactions) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const payload = { items: transactions };
|
|
34
|
+
yield new HttpBooksApiV5Request(`${bookId}/transactions/check/batch`).setMethod('PATCH').setPayload(payload).fetch();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function uncheckTransactionsBatch(bookId, transactions) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const payload = { items: transactions };
|
|
40
|
+
yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck/batch`).setMethod('PATCH').setPayload(payload).fetch();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
31
43
|
export function trashTransactionsBatch(bookId, transactions) {
|
|
32
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
45
|
let transactionList = {
|