bkper 2.7.0 → 2.7.2
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/model/Bkper.js +4 -4
- package/lib/service/account-service.js +5 -5
- package/lib/service/app-service.js +4 -4
- package/lib/service/balances-service.js +2 -2
- package/lib/service/book-service.js +4 -4
- package/lib/service/connection-service.js +7 -7
- package/lib/service/file-service.js +3 -3
- package/lib/service/group-service.js +8 -8
- package/lib/service/{HttpApiRequest.js → http-api-request.js} +3 -4
- package/lib/service/integration-service.js +5 -5
- package/lib/service/transaction-service.js +12 -12
- package/lib/service/user-service.js +2 -2
- package/package.json +5 -5
package/lib/model/Bkper.js
CHANGED
|
@@ -33,7 +33,7 @@ const Book_1 = require("./Book");
|
|
|
33
33
|
const App_1 = require("./App");
|
|
34
34
|
const BookService = __importStar(require("../service/book-service"));
|
|
35
35
|
const UserService = __importStar(require("../service/user-service"));
|
|
36
|
-
const
|
|
36
|
+
const http_api_request_1 = require("../service/http-api-request");
|
|
37
37
|
const User_1 = require("./User");
|
|
38
38
|
/**
|
|
39
39
|
* This is the main Entry Point of the [bkper-node](https://www.npmjs.com/package/bkper) library.
|
|
@@ -71,7 +71,7 @@ class Bkper {
|
|
|
71
71
|
* @param config - The Config object
|
|
72
72
|
*/
|
|
73
73
|
static setConfig(config) {
|
|
74
|
-
|
|
74
|
+
http_api_request_1.HttpApiRequest.config = config;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Sets the API key to identify the agent.
|
|
@@ -83,7 +83,7 @@ class Bkper {
|
|
|
83
83
|
* @deprecated Use `setConfig()` instead
|
|
84
84
|
*/
|
|
85
85
|
static setApiKey(key) {
|
|
86
|
-
|
|
86
|
+
http_api_request_1.HttpApiRequest.config.apiKeyProvider = () => __awaiter(this, void 0, void 0, function* () { return key; });
|
|
87
87
|
return new App_1.App();
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -93,7 +93,7 @@ class Bkper {
|
|
|
93
93
|
*/
|
|
94
94
|
static setOAuthTokenProvider(oauthTokenProvider) {
|
|
95
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
|
|
96
|
+
http_api_request_1.HttpApiRequest.config.oauthTokenProvider = oauthTokenProvider;
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getAccount = exports.deleteAccount = exports.updateAccount = exports.createAccount = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function createAccount(bookId, account) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var response = yield new
|
|
16
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/accounts`).setMethod('POST').setPayload(account).fetch();
|
|
17
17
|
return response.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -21,21 +21,21 @@ exports.createAccount = createAccount;
|
|
|
21
21
|
function updateAccount(bookId, account) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
var payload = JSON.stringify(account);
|
|
24
|
-
var response = yield new
|
|
24
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/accounts`).setMethod('PUT').setPayload(payload).fetch();
|
|
25
25
|
return response.data;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
exports.updateAccount = updateAccount;
|
|
29
29
|
function deleteAccount(bookId, account) {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var response = yield new
|
|
31
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/accounts/${account.id}`).setMethod('DELETE').fetch();
|
|
32
32
|
return response.data;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
exports.deleteAccount = deleteAccount;
|
|
36
36
|
function getAccount(bookId, idOrName) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var response = yield new
|
|
38
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/accounts/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
|
|
39
39
|
return response.data;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -10,24 +10,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.patchApp = exports.updateApp = exports.createApp = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function createApp(app) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var response = yield new
|
|
16
|
+
var response = yield new http_api_request_1.HttpApiRequest(`v5/apps`).setMethod('POST').setPayload(app).fetch();
|
|
17
17
|
return response.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
exports.createApp = createApp;
|
|
21
21
|
function updateApp(app) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var response = yield new
|
|
23
|
+
var response = yield new http_api_request_1.HttpApiRequest(`v5/apps`).setMethod('PUT').setPayload(app).fetch();
|
|
24
24
|
return response.data;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
exports.updateApp = updateApp;
|
|
28
28
|
function patchApp(app) {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var response = yield new
|
|
30
|
+
var response = yield new http_api_request_1.HttpApiRequest(`v5/apps`).setMethod('PATCH').setPayload(app).fetch();
|
|
31
31
|
return response.data;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getBalances = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function getBalances(bookId, query) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var response = yield new
|
|
16
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/balances`).addParam('query', query).addParam('time', Date.now()).fetch();
|
|
17
17
|
return response.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -10,27 +10,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.audit = exports.updateBook = exports.loadBook = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function loadBook(bookId) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
if (bookId == null) {
|
|
17
17
|
throw new Error("Book id null!");
|
|
18
18
|
}
|
|
19
|
-
let response = yield new
|
|
19
|
+
let response = yield new http_api_request_1.HttpBooksApiV5Request(bookId).fetch();
|
|
20
20
|
return response.data;
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
exports.loadBook = loadBook;
|
|
24
24
|
function updateBook(bookId, book) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
var response = yield new
|
|
26
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}`).setMethod('PUT').setPayload(book).fetch();
|
|
27
27
|
return response.data;
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
exports.updateBook = updateBook;
|
|
31
31
|
function audit(bookId) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
new
|
|
33
|
+
new http_api_request_1.HttpBooksApiV5Request(`${bookId}/audit`).setMethod('PATCH').fetch();
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
exports.audit = audit;
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.listIntegrations = exports.deleteConnection = exports.updateConnection = exports.createConnection = exports.listConnections = exports.getConnection = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function getConnection(id) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const res = yield new
|
|
16
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user/connections/${id}`)
|
|
17
17
|
.setMethod('GET')
|
|
18
18
|
.fetch();
|
|
19
19
|
return res.data;
|
|
@@ -23,7 +23,7 @@ exports.getConnection = getConnection;
|
|
|
23
23
|
function listConnections() {
|
|
24
24
|
var _a;
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const res = yield new
|
|
26
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user/connections`)
|
|
27
27
|
.setMethod('GET')
|
|
28
28
|
.fetch();
|
|
29
29
|
return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
@@ -32,7 +32,7 @@ function listConnections() {
|
|
|
32
32
|
exports.listConnections = listConnections;
|
|
33
33
|
function createConnection(connection) {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const res = yield new
|
|
35
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user/connections`)
|
|
36
36
|
.setPayload(connection)
|
|
37
37
|
.setMethod('POST')
|
|
38
38
|
.fetch();
|
|
@@ -42,7 +42,7 @@ function createConnection(connection) {
|
|
|
42
42
|
exports.createConnection = createConnection;
|
|
43
43
|
function updateConnection(connection) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const res = yield new
|
|
45
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user/connections`)
|
|
46
46
|
.setPayload(connection)
|
|
47
47
|
.setMethod('PUT')
|
|
48
48
|
.fetch();
|
|
@@ -52,7 +52,7 @@ function updateConnection(connection) {
|
|
|
52
52
|
exports.updateConnection = updateConnection;
|
|
53
53
|
function deleteConnection(id) {
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const res = yield new
|
|
55
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user/connections/${id}`)
|
|
56
56
|
.setMethod('DELETE')
|
|
57
57
|
.fetch();
|
|
58
58
|
return res.data;
|
|
@@ -62,7 +62,7 @@ exports.deleteConnection = deleteConnection;
|
|
|
62
62
|
function listIntegrations(connectionId) {
|
|
63
63
|
var _a;
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const res = yield new
|
|
65
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user/connections/${connectionId}/integrations`)
|
|
66
66
|
.setMethod('GET')
|
|
67
67
|
.fetch();
|
|
68
68
|
return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
@@ -10,17 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getFile = exports.createFile = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function createFile(bookId, file) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var response = yield new
|
|
16
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/files`).setMethod('POST').setPayload(file).fetch();
|
|
17
17
|
return response.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
exports.createFile = createFile;
|
|
21
21
|
function getFile(bookId, id) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var response = yield new
|
|
23
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/files/${id}`).setMethod('GET').fetch();
|
|
24
24
|
return response.data;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -10,24 +10,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getAccounts = exports.getGroup = exports.getGroups = exports.getGroupsByAccountId = exports.deleteGroup = exports.updateGroup = exports.createGroup = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function createGroup(bookId, group) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var response = yield new
|
|
16
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('POST').setPayload(group).fetch();
|
|
17
17
|
return response.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
exports.createGroup = createGroup;
|
|
21
21
|
function updateGroup(bookId, group) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var response = yield new
|
|
23
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('PUT').setPayload(group).fetch();
|
|
24
24
|
return response.data;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
exports.updateGroup = updateGroup;
|
|
28
28
|
function deleteGroup(bookId, group) {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var response = yield new
|
|
30
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/groups/${group.id}`).setMethod('DELETE').fetch();
|
|
31
31
|
return response.data;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -35,14 +35,14 @@ exports.deleteGroup = deleteGroup;
|
|
|
35
35
|
function getGroupsByAccountId(bookId, accountId) {
|
|
36
36
|
var _a;
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var response = yield new
|
|
38
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/accounts/${accountId}/groups`).setMethod('GET').fetch();
|
|
39
39
|
return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
exports.getGroupsByAccountId = getGroupsByAccountId;
|
|
43
43
|
function getGroups(bookId) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var response = yield new
|
|
45
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('GET').fetch();
|
|
46
46
|
var groupsPlain = response.data;
|
|
47
47
|
if (!(groupsPlain === null || groupsPlain === void 0 ? void 0 : groupsPlain.items)) {
|
|
48
48
|
return [];
|
|
@@ -53,14 +53,14 @@ function getGroups(bookId) {
|
|
|
53
53
|
exports.getGroups = getGroups;
|
|
54
54
|
function getGroup(bookId, idOrName) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
var response = yield new
|
|
56
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/groups/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
|
|
57
57
|
return response.data;
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
exports.getGroup = getGroup;
|
|
61
61
|
function getAccounts(bookId, idOrName) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
var response = yield new
|
|
63
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/groups/${encodeURIComponent(idOrName)}/accounts`).setMethod('GET').fetch();
|
|
64
64
|
var accountsPlain = response.data;
|
|
65
65
|
if (!(accountsPlain === null || accountsPlain === void 0 ? void 0 : accountsPlain.items)) {
|
|
66
66
|
return [];
|
|
@@ -91,9 +91,8 @@ class HttpApiRequest {
|
|
|
91
91
|
retryConfig: {
|
|
92
92
|
httpMethodsToRetry: ['GET', 'PUT', 'POST', 'PATCH', 'HEAD', 'OPTIONS', 'DELETE'],
|
|
93
93
|
statusCodesToRetry: [[100, 199], [429, 429], [500, 599]],
|
|
94
|
-
retry: process.env.NODE_ENV == utils_1.NODE_ENV_DEV ? 0 :
|
|
95
|
-
onRetryAttempt: (err) => { console.log(`${err.message} - Retrying... `); }
|
|
96
|
-
retryDelay: 1000
|
|
94
|
+
retry: process.env.NODE_ENV == utils_1.NODE_ENV_DEV ? 0 : 3,
|
|
95
|
+
onRetryAttempt: (err) => { console.log(`${err.message} - Retrying... `); }
|
|
97
96
|
}
|
|
98
97
|
});
|
|
99
98
|
}
|
|
@@ -167,4 +166,4 @@ class HttpApiV5Request extends HttpApiRequest {
|
|
|
167
166
|
}
|
|
168
167
|
}
|
|
169
168
|
exports.HttpApiV5Request = HttpApiV5Request;
|
|
170
|
-
//# sourceMappingURL=
|
|
169
|
+
//# sourceMappingURL=http-api-request.js.map
|
|
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.deleteIntegration = exports.updateIntegration = exports.createIntegration = exports.listIntegrations = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function listIntegrations(bookId) {
|
|
15
15
|
var _a;
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const res = yield new
|
|
17
|
+
const res = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/integrations`)
|
|
18
18
|
.setMethod('GET')
|
|
19
19
|
.fetch();
|
|
20
20
|
return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
@@ -23,7 +23,7 @@ function listIntegrations(bookId) {
|
|
|
23
23
|
exports.listIntegrations = listIntegrations;
|
|
24
24
|
function createIntegration(bookId, integration) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const res = yield new
|
|
26
|
+
const res = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/integrations`)
|
|
27
27
|
.setPayload(integration)
|
|
28
28
|
.setMethod('POST')
|
|
29
29
|
.fetch();
|
|
@@ -33,7 +33,7 @@ function createIntegration(bookId, integration) {
|
|
|
33
33
|
exports.createIntegration = createIntegration;
|
|
34
34
|
function updateIntegration(bookId, integration) {
|
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const res = yield new
|
|
36
|
+
const res = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/integrations`)
|
|
37
37
|
.setPayload(integration)
|
|
38
38
|
.setMethod('PUT')
|
|
39
39
|
.fetch();
|
|
@@ -43,7 +43,7 @@ function updateIntegration(bookId, integration) {
|
|
|
43
43
|
exports.updateIntegration = updateIntegration;
|
|
44
44
|
function deleteIntegration(bookId, id) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const res = yield new
|
|
46
|
+
const res = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/integrations/${id}`)
|
|
47
47
|
.setMethod('DELETE')
|
|
48
48
|
.fetch();
|
|
49
49
|
return res.data;
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.searchTransactions = exports.getTransaction = exports.restoreTransaction = exports.trashTransaction = exports.uncheckTransaction = exports.checkTransaction = exports.postTransaction = exports.updateTransaction = exports.trashTransactionsBatch = exports.createTransactionsBatch = exports.createTransaction = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function createTransaction(bookId, transaction) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var response = yield new
|
|
16
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('POST').setPayload(transaction).fetch();
|
|
17
17
|
return response.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -24,7 +24,7 @@ function createTransactionsBatch(bookId, transactions) {
|
|
|
24
24
|
items: transactions
|
|
25
25
|
};
|
|
26
26
|
var payload = JSON.stringify(transactionList);
|
|
27
|
-
let response = yield new
|
|
27
|
+
let response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/batch`)
|
|
28
28
|
.setMethod('POST')
|
|
29
29
|
.setPayload(payload)
|
|
30
30
|
.fetch();
|
|
@@ -39,7 +39,7 @@ function trashTransactionsBatch(bookId, transactions) {
|
|
|
39
39
|
items: transactions
|
|
40
40
|
};
|
|
41
41
|
var payload = JSON.stringify(transactionList);
|
|
42
|
-
let response = yield new
|
|
42
|
+
let response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/trash/batch`)
|
|
43
43
|
.setMethod('PATCH')
|
|
44
44
|
.setPayload(payload)
|
|
45
45
|
.fetch();
|
|
@@ -49,49 +49,49 @@ function trashTransactionsBatch(bookId, transactions) {
|
|
|
49
49
|
exports.trashTransactionsBatch = trashTransactionsBatch;
|
|
50
50
|
function updateTransaction(bookId, transaction) {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
var response = yield new
|
|
52
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(transaction).fetch();
|
|
53
53
|
return response.data;
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
exports.updateTransaction = updateTransaction;
|
|
57
57
|
function postTransaction(bookId, transaction) {
|
|
58
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
var response = yield new
|
|
59
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(transaction).fetch();
|
|
60
60
|
return response.data;
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
exports.postTransaction = postTransaction;
|
|
64
64
|
function checkTransaction(bookId, transaction) {
|
|
65
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
var response = yield new
|
|
66
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(transaction).fetch();
|
|
67
67
|
return response.data;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
exports.checkTransaction = checkTransaction;
|
|
71
71
|
function uncheckTransaction(bookId, transaction) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
var response = yield new
|
|
73
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(transaction).fetch();
|
|
74
74
|
return response.data;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
exports.uncheckTransaction = uncheckTransaction;
|
|
78
78
|
function trashTransaction(bookId, transaction) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
var response = yield new
|
|
80
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/trash`).setMethod('PATCH').setPayload(transaction).fetch();
|
|
81
81
|
return response.data;
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
exports.trashTransaction = trashTransaction;
|
|
85
85
|
function restoreTransaction(bookId, transaction) {
|
|
86
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
var response = yield new
|
|
87
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(transaction).fetch();
|
|
88
88
|
return response.data;
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
exports.restoreTransaction = restoreTransaction;
|
|
92
92
|
function getTransaction(bookId, id) {
|
|
93
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
var response = yield new
|
|
94
|
+
var response = yield new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions/${id}`).setMethod('GET').fetch();
|
|
95
95
|
return response.data;
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -101,7 +101,7 @@ function searchTransactions(bookId, query, limit, cursor) {
|
|
|
101
101
|
if (query == null) {
|
|
102
102
|
query = "";
|
|
103
103
|
}
|
|
104
|
-
var request = new
|
|
104
|
+
var request = new http_api_request_1.HttpBooksApiV5Request(`${bookId}/transactions`);
|
|
105
105
|
request.addParam('query', query);
|
|
106
106
|
request.addParam('limit', limit);
|
|
107
107
|
if (cursor != null) {
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getUser = void 0;
|
|
13
|
-
const
|
|
13
|
+
const http_api_request_1 = require("./http-api-request");
|
|
14
14
|
function getUser() {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const res = yield new
|
|
16
|
+
const res = yield new http_api_request_1.HttpApiV5Request(`user`).setMethod('GET').fetch();
|
|
17
17
|
return res.data;
|
|
18
18
|
});
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Node.js client for Bkper REST API",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"test": "env TS_NODE_COMPILER_OPTIONS='{\"rootDir\": \".\" }' mocha -r ts-node/register 'test/**/*.ts'",
|
|
20
20
|
"clean": "gts clean",
|
|
21
21
|
"build": "run-s build:*",
|
|
22
|
-
"build:clean": "
|
|
23
|
-
"build:test": "
|
|
22
|
+
"build:clean": "bun clean",
|
|
23
|
+
"build:test": "bun run test",
|
|
24
24
|
"build:compile": "tsc",
|
|
25
25
|
"build:api": "api-extractor run --local",
|
|
26
26
|
"build:cleanup": "rimraf lib/**/*.map lib/*.map lib/**/*.d.ts lib/*.d.ts",
|
|
27
27
|
"build:dts": "cp dist/bkper-public.d.ts lib/index.d.ts",
|
|
28
28
|
"build:clean-dist": "rimraf dist",
|
|
29
29
|
"watch": "tsc -w",
|
|
30
|
-
"upgrade:api": "
|
|
30
|
+
"upgrade:api": "bun upgrade @bkper/bkper-api-types --latest",
|
|
31
31
|
"patch": "yarn version --patch",
|
|
32
32
|
"minor": "yarn version --minor",
|
|
33
33
|
"major": "yarn version --major",
|
|
34
|
-
"preversion": "
|
|
34
|
+
"preversion": "bun run build",
|
|
35
35
|
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|