bkper-js 2.34.1 → 2.35.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/README.md +1 -1
- package/dist/bkper.min.js +2 -2
- package/dist/bkper.min.js.map +3 -3
- package/lib/index.d.ts +7 -3
- package/lib/model/Book.js +17 -3
- package/lib/model/Enums.js +2 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1818,12 +1818,14 @@ export declare class Book extends ResourceProperty<bkper.Book> {
|
|
|
1818
1818
|
* The merged transaction is created synchronously. Cleanup of the two
|
|
1819
1819
|
* originals is scheduled asynchronously by the backend.
|
|
1820
1820
|
*
|
|
1821
|
-
* @param transaction1 - The first transaction to merge
|
|
1822
|
-
*
|
|
1821
|
+
* @param transaction1 - The first transaction to merge. Accepts a wrapped
|
|
1822
|
+
* [[Transaction]], a plain `bkper.Transaction` payload, or a transaction id.
|
|
1823
|
+
* @param transaction2 - The second transaction to merge. Accepts a wrapped
|
|
1824
|
+
* [[Transaction]], a plain `bkper.Transaction` payload, or a transaction id.
|
|
1823
1825
|
*
|
|
1824
1826
|
* @returns The merged Transaction
|
|
1825
1827
|
*/
|
|
1826
|
-
mergeTransactions(transaction1: Transaction, transaction2: Transaction): Promise<Transaction>;
|
|
1828
|
+
mergeTransactions(transaction1: Transaction | bkper.Transaction | string, transaction2: Transaction | bkper.Transaction | string): Promise<Transaction>;
|
|
1827
1829
|
/**
|
|
1828
1830
|
* Replay [[Events]] on the Book, in batch.
|
|
1829
1831
|
*
|
|
@@ -2745,6 +2747,8 @@ export declare enum EventType {
|
|
|
2745
2747
|
INTEGRATION_CREATED = "INTEGRATION_CREATED",
|
|
2746
2748
|
INTEGRATION_UPDATED = "INTEGRATION_UPDATED",
|
|
2747
2749
|
INTEGRATION_DELETED = "INTEGRATION_DELETED",
|
|
2750
|
+
BOOK_AUDITED = "BOOK_AUDITED",
|
|
2751
|
+
BOOK_CREATED = "BOOK_CREATED",
|
|
2748
2752
|
BOOK_UPDATED = "BOOK_UPDATED",
|
|
2749
2753
|
BOOK_DELETED = "BOOK_DELETED"
|
|
2750
2754
|
}
|
package/lib/model/Book.js
CHANGED
|
@@ -548,15 +548,29 @@ export class Book extends ResourceProperty {
|
|
|
548
548
|
* The merged transaction is created synchronously. Cleanup of the two
|
|
549
549
|
* originals is scheduled asynchronously by the backend.
|
|
550
550
|
*
|
|
551
|
-
* @param transaction1 - The first transaction to merge
|
|
552
|
-
*
|
|
551
|
+
* @param transaction1 - The first transaction to merge. Accepts a wrapped
|
|
552
|
+
* [[Transaction]], a plain `bkper.Transaction` payload, or a transaction id.
|
|
553
|
+
* @param transaction2 - The second transaction to merge. Accepts a wrapped
|
|
554
|
+
* [[Transaction]], a plain `bkper.Transaction` payload, or a transaction id.
|
|
553
555
|
*
|
|
554
556
|
* @returns The merged Transaction
|
|
555
557
|
*/
|
|
556
558
|
mergeTransactions(transaction1, transaction2) {
|
|
557
559
|
return __awaiter(this, void 0, void 0, function* () {
|
|
560
|
+
const transactionId1 = typeof transaction1 === 'string' ? transaction1 :
|
|
561
|
+
transaction1 instanceof Transaction ? transaction1.getId() :
|
|
562
|
+
transaction1.id;
|
|
563
|
+
if (transactionId1 == null || transactionId1.trim() === '') {
|
|
564
|
+
throw new Error('The first transaction must provide an id for merge.');
|
|
565
|
+
}
|
|
566
|
+
const transactionId2 = typeof transaction2 === 'string' ? transaction2 :
|
|
567
|
+
transaction2 instanceof Transaction ? transaction2.getId() :
|
|
568
|
+
transaction2.id;
|
|
569
|
+
if (transactionId2 == null || transactionId2.trim() === '') {
|
|
570
|
+
throw new Error('The second transaction must provide an id for merge.');
|
|
571
|
+
}
|
|
558
572
|
const payload = {
|
|
559
|
-
items: [
|
|
573
|
+
items: [{ id: transactionId1 }, { id: transactionId2 }],
|
|
560
574
|
};
|
|
561
575
|
let operation = yield TransactionService.mergeTransactions(this.getId(), payload, this.getConfig());
|
|
562
576
|
return new Transaction(this, operation.transaction || {});
|
package/lib/model/Enums.js
CHANGED
|
@@ -263,6 +263,8 @@ export var EventType;
|
|
|
263
263
|
EventType["INTEGRATION_CREATED"] = "INTEGRATION_CREATED";
|
|
264
264
|
EventType["INTEGRATION_UPDATED"] = "INTEGRATION_UPDATED";
|
|
265
265
|
EventType["INTEGRATION_DELETED"] = "INTEGRATION_DELETED";
|
|
266
|
+
EventType["BOOK_AUDITED"] = "BOOK_AUDITED";
|
|
267
|
+
EventType["BOOK_CREATED"] = "BOOK_CREATED";
|
|
266
268
|
EventType["BOOK_UPDATED"] = "BOOK_UPDATED";
|
|
267
269
|
EventType["BOOK_DELETED"] = "BOOK_DELETED";
|
|
268
270
|
})(EventType || (EventType = {}));
|