bkper-js 1.47.1 → 1.47.3
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 +891 -355
- package/lib/model/Account.js +86 -42
- package/lib/model/Agent.js +6 -0
- package/lib/model/Amount.js +72 -13
- package/lib/model/App.js +77 -26
- package/lib/model/BalancesReport.js +11 -5
- package/lib/model/Bkper.js +5 -4
- package/lib/model/Book.js +176 -91
- package/lib/model/BotResponse.js +13 -3
- package/lib/model/Collection.js +16 -2
- package/lib/model/Connection.js +8 -6
- package/lib/model/Conversation.js +9 -2
- package/lib/model/Event.js +18 -0
- package/lib/model/EventList.js +10 -5
- package/lib/model/File.js +31 -12
- package/lib/model/Group.js +75 -33
- package/lib/model/Integration.js +4 -2
- package/lib/model/Message.js +18 -5
- package/lib/model/Query.js +18 -4
- package/lib/model/Template.js +2 -0
- package/lib/model/Transaction.js +165 -81
- package/lib/model/TransactionList.js +14 -7
- package/lib/model/User.js +7 -1
- package/lib/service/book-service.js +19 -2
- package/lib/utils.js +0 -1
- package/package.json +2 -2
|
@@ -10,6 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Transaction } from "./Transaction.js";
|
|
11
11
|
/**
|
|
12
12
|
* A list associated with a transaction query.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
13
15
|
*/
|
|
14
16
|
export class TransactionList {
|
|
15
17
|
constructor(book, payload) {
|
|
@@ -17,13 +19,17 @@ export class TransactionList {
|
|
|
17
19
|
this.payload = payload || {};
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Gets the cursor associated with the query for pagination.
|
|
23
|
+
*
|
|
24
|
+
* @returns The cursor associated with the query for pagination
|
|
21
25
|
*/
|
|
22
26
|
getCursor() {
|
|
23
27
|
return this.payload.cursor;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* Retrieves the account associated with the query, when filtering by account.
|
|
31
|
+
*
|
|
32
|
+
* @returns The account associated with the query, or undefined if not set
|
|
27
33
|
*/
|
|
28
34
|
getAccount() {
|
|
29
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -34,26 +40,27 @@ export class TransactionList {
|
|
|
34
40
|
});
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
|
-
*
|
|
43
|
+
* Gets the first Transaction in the list.
|
|
44
|
+
*
|
|
45
|
+
* @returns The first Transaction in the list
|
|
38
46
|
*/
|
|
39
47
|
getFirst() {
|
|
40
48
|
const transactions = this.getItems();
|
|
41
49
|
return transactions.length > 0 ? transactions[0] : undefined;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
52
|
+
* Gets the total number of transactions in the list.
|
|
44
53
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @returns The total number of transactions.
|
|
54
|
+
* @returns The total number of transactions
|
|
48
55
|
*/
|
|
49
56
|
size() {
|
|
50
57
|
var _a;
|
|
51
58
|
return ((_a = this.payload.items) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
52
59
|
}
|
|
53
60
|
/**
|
|
54
|
-
*
|
|
61
|
+
* Gets the transactions in the list.
|
|
55
62
|
*
|
|
56
|
-
* @returns An array of Transaction objects
|
|
63
|
+
* @returns An array of Transaction objects
|
|
57
64
|
*/
|
|
58
65
|
getItems() {
|
|
59
66
|
var _a;
|
package/lib/model/User.js
CHANGED
|
@@ -10,7 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { Connection } from "./Connection.js";
|
|
11
11
|
import * as ConnectionService from '../service/connection-service.js';
|
|
12
12
|
/**
|
|
13
|
-
* This class defines a User.
|
|
13
|
+
* This class defines a User on the Bkper platform.
|
|
14
|
+
*
|
|
15
|
+
* Users can own and collaborate on [[Books]], manage [[Collections]], and connect to external services through [[Connections]].
|
|
16
|
+
*
|
|
17
|
+
* Each User has a unique identity, subscription plan details, and access permissions across the platform.
|
|
14
18
|
*
|
|
15
19
|
* @public
|
|
16
20
|
*/
|
|
@@ -20,6 +24,8 @@ export class User {
|
|
|
20
24
|
this.payload = payload || {};
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
27
|
+
* Gets an immutable copy of the JSON payload for this User.
|
|
28
|
+
*
|
|
23
29
|
* @returns An immutable copy of the json payload
|
|
24
30
|
*/
|
|
25
31
|
json() {
|
|
@@ -8,9 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { HttpBooksApiV5Request } from "./http-api-request.js";
|
|
11
|
-
export function loadBooks() {
|
|
11
|
+
export function loadBooks(query) {
|
|
12
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
let
|
|
13
|
+
let request = new HttpBooksApiV5Request('');
|
|
14
|
+
if (query) {
|
|
15
|
+
request.addParam('query', query);
|
|
16
|
+
}
|
|
17
|
+
let response = yield request.fetch();
|
|
14
18
|
if (response.data == null) {
|
|
15
19
|
return [];
|
|
16
20
|
}
|
|
@@ -56,4 +60,17 @@ export function getApps(bookId) {
|
|
|
56
60
|
return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
57
61
|
});
|
|
58
62
|
}
|
|
63
|
+
export function copyBook(bookId, name, copyTransactions, fromDate) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const request = new HttpBooksApiV5Request(`${bookId}/copy`).setMethod('POST').addParam('name', name);
|
|
66
|
+
if (copyTransactions) {
|
|
67
|
+
request.addParam('copyTransactions', copyTransactions);
|
|
68
|
+
if (fromDate) {
|
|
69
|
+
request.addParam('fromDate', fromDate);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const response = yield request.fetch();
|
|
73
|
+
return response.data;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
59
76
|
//# sourceMappingURL=book-service.js.map
|
package/lib/utils.js
CHANGED
|
@@ -126,7 +126,6 @@ export function parseDate(date, pattern, timeZone) {
|
|
|
126
126
|
}
|
|
127
127
|
let dateObject = DateTime.fromFormat(date, pattern, { zone: timeZone }).toJSDate();
|
|
128
128
|
if (dateObject instanceof Date && !isNaN(dateObject.getTime())) {
|
|
129
|
-
console.log(dateObject);
|
|
130
129
|
return dateObject;
|
|
131
130
|
}
|
|
132
131
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper-js",
|
|
3
|
-
"version": "1.47.
|
|
3
|
+
"version": "1.47.3",
|
|
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.23.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@google-cloud/local-auth": "^3.0.1",
|