bkper 2.7.1 → 3.0.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.
Files changed (41) hide show
  1. package/README.md +8 -8
  2. package/bun.lockb +0 -0
  3. package/package.json +10 -33
  4. package/src/auth/keys.json +12 -0
  5. package/src/auth/local-auth-service.ts +73 -0
  6. package/src/cli.ts +57 -0
  7. package/tsconfig.json +25 -0
  8. package/lib/auth/keys.json +0 -12
  9. package/lib/auth/local-auth-service.js +0 -80
  10. package/lib/cli.js +0 -64
  11. package/lib/index.d.ts +0 -1775
  12. package/lib/index.js +0 -42
  13. package/lib/model/Account.js +0 -381
  14. package/lib/model/Amount.js +0 -295
  15. package/lib/model/App.js +0 -95
  16. package/lib/model/Bkper.js +0 -101
  17. package/lib/model/Book.js +0 -713
  18. package/lib/model/Collection.js +0 -43
  19. package/lib/model/Config.js +0 -3
  20. package/lib/model/Connection.js +0 -257
  21. package/lib/model/Enums.js +0 -138
  22. package/lib/model/File.js +0 -124
  23. package/lib/model/Group.js +0 -244
  24. package/lib/model/Integration.js +0 -112
  25. package/lib/model/Transaction.js +0 -715
  26. package/lib/model/TransactionIterator.js +0 -154
  27. package/lib/model/TransactionPage.js +0 -93
  28. package/lib/model/User.js +0 -93
  29. package/lib/service/HttpApiRequest.js +0 -170
  30. package/lib/service/account-service.js +0 -43
  31. package/lib/service/app-service.js +0 -35
  32. package/lib/service/balances-service.js +0 -21
  33. package/lib/service/book-service.js +0 -37
  34. package/lib/service/connection-service.js +0 -72
  35. package/lib/service/file-service.js +0 -28
  36. package/lib/service/group-service.js +0 -72
  37. package/lib/service/integration-service.js +0 -53
  38. package/lib/service/transaction-service.js +0 -115
  39. package/lib/service/user-service.js +0 -21
  40. package/lib/tsdoc-metadata.json +0 -11
  41. package/lib/utils.js +0 -341
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.listIntegrations = exports.deleteConnection = exports.updateConnection = exports.createConnection = exports.listConnections = exports.getConnection = void 0;
13
- const HttpApiRequest_1 = require("./HttpApiRequest");
14
- function getConnection(id) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user/connections/${id}`)
17
- .setMethod('GET')
18
- .fetch();
19
- return res.data;
20
- });
21
- }
22
- exports.getConnection = getConnection;
23
- function listConnections() {
24
- var _a;
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user/connections`)
27
- .setMethod('GET')
28
- .fetch();
29
- return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.items) || [];
30
- });
31
- }
32
- exports.listConnections = listConnections;
33
- function createConnection(connection) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user/connections`)
36
- .setPayload(connection)
37
- .setMethod('POST')
38
- .fetch();
39
- return res.data;
40
- });
41
- }
42
- exports.createConnection = createConnection;
43
- function updateConnection(connection) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user/connections`)
46
- .setPayload(connection)
47
- .setMethod('PUT')
48
- .fetch();
49
- return res.data;
50
- });
51
- }
52
- exports.updateConnection = updateConnection;
53
- function deleteConnection(id) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user/connections/${id}`)
56
- .setMethod('DELETE')
57
- .fetch();
58
- return res.data;
59
- });
60
- }
61
- exports.deleteConnection = deleteConnection;
62
- function listIntegrations(connectionId) {
63
- var _a;
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user/connections/${connectionId}/integrations`)
66
- .setMethod('GET')
67
- .fetch();
68
- return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.items) || [];
69
- });
70
- }
71
- exports.listIntegrations = listIntegrations;
72
- //# sourceMappingURL=connection-service.js.map
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getFile = exports.createFile = void 0;
13
- const HttpApiRequest_1 = require("./HttpApiRequest");
14
- function createFile(bookId, file) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/files`).setMethod('POST').setPayload(file).fetch();
17
- return response.data;
18
- });
19
- }
20
- exports.createFile = createFile;
21
- function getFile(bookId, id) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/files/${id}`).setMethod('GET').fetch();
24
- return response.data;
25
- });
26
- }
27
- exports.getFile = getFile;
28
- //# sourceMappingURL=file-service.js.map
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getAccounts = exports.getGroup = exports.getGroups = exports.getGroupsByAccountId = exports.deleteGroup = exports.updateGroup = exports.createGroup = void 0;
13
- const HttpApiRequest_1 = require("./HttpApiRequest");
14
- function createGroup(bookId, group) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('POST').setPayload(group).fetch();
17
- return response.data;
18
- });
19
- }
20
- exports.createGroup = createGroup;
21
- function updateGroup(bookId, group) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('PUT').setPayload(group).fetch();
24
- return response.data;
25
- });
26
- }
27
- exports.updateGroup = updateGroup;
28
- function deleteGroup(bookId, group) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/${group.id}`).setMethod('DELETE').fetch();
31
- return response.data;
32
- });
33
- }
34
- exports.deleteGroup = deleteGroup;
35
- function getGroupsByAccountId(bookId, accountId) {
36
- var _a;
37
- return __awaiter(this, void 0, void 0, function* () {
38
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts/${accountId}/groups`).setMethod('GET').fetch();
39
- return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
40
- });
41
- }
42
- exports.getGroupsByAccountId = getGroupsByAccountId;
43
- function getGroups(bookId) {
44
- return __awaiter(this, void 0, void 0, function* () {
45
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('GET').fetch();
46
- var groupsPlain = response.data;
47
- if (!(groupsPlain === null || groupsPlain === void 0 ? void 0 : groupsPlain.items)) {
48
- return [];
49
- }
50
- return groupsPlain.items;
51
- });
52
- }
53
- exports.getGroups = getGroups;
54
- function getGroup(bookId, idOrName) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
57
- return response.data;
58
- });
59
- }
60
- exports.getGroup = getGroup;
61
- function getAccounts(bookId, idOrName) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/${encodeURIComponent(idOrName)}/accounts`).setMethod('GET').fetch();
64
- var accountsPlain = response.data;
65
- if (!(accountsPlain === null || accountsPlain === void 0 ? void 0 : accountsPlain.items)) {
66
- return [];
67
- }
68
- return accountsPlain.items;
69
- });
70
- }
71
- exports.getAccounts = getAccounts;
72
- //# sourceMappingURL=group-service.js.map
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.deleteIntegration = exports.updateIntegration = exports.createIntegration = exports.listIntegrations = void 0;
13
- const HttpApiRequest_1 = require("./HttpApiRequest");
14
- function listIntegrations(bookId) {
15
- var _a;
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const res = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/integrations`)
18
- .setMethod('GET')
19
- .fetch();
20
- return ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.items) || [];
21
- });
22
- }
23
- exports.listIntegrations = listIntegrations;
24
- function createIntegration(bookId, integration) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const res = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/integrations`)
27
- .setPayload(integration)
28
- .setMethod('POST')
29
- .fetch();
30
- return res.data;
31
- });
32
- }
33
- exports.createIntegration = createIntegration;
34
- function updateIntegration(bookId, integration) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const res = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/integrations`)
37
- .setPayload(integration)
38
- .setMethod('PUT')
39
- .fetch();
40
- return res.data;
41
- });
42
- }
43
- exports.updateIntegration = updateIntegration;
44
- function deleteIntegration(bookId, id) {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- const res = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/integrations/${id}`)
47
- .setMethod('DELETE')
48
- .fetch();
49
- return res.data;
50
- });
51
- }
52
- exports.deleteIntegration = deleteIntegration;
53
- //# sourceMappingURL=integration-service.js.map
@@ -1,115 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
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 HttpApiRequest_1 = require("./HttpApiRequest");
14
- function createTransaction(bookId, transaction) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('POST').setPayload(transaction).fetch();
17
- return response.data;
18
- });
19
- }
20
- exports.createTransaction = createTransaction;
21
- function createTransactionsBatch(bookId, transactions) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- let transactionList = {
24
- items: transactions
25
- };
26
- var payload = JSON.stringify(transactionList);
27
- let response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/batch`)
28
- .setMethod('POST')
29
- .setPayload(payload)
30
- .fetch();
31
- transactionList = yield response.data;
32
- return transactionList != null && transactionList.items != null ? transactionList.items : [];
33
- });
34
- }
35
- exports.createTransactionsBatch = createTransactionsBatch;
36
- function trashTransactionsBatch(bookId, transactions) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- let transactionList = {
39
- items: transactions
40
- };
41
- var payload = JSON.stringify(transactionList);
42
- let response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/trash/batch`)
43
- .setMethod('PATCH')
44
- .setPayload(payload)
45
- .fetch();
46
- transactionList = yield response.data;
47
- });
48
- }
49
- exports.trashTransactionsBatch = trashTransactionsBatch;
50
- function updateTransaction(bookId, transaction) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(transaction).fetch();
53
- return response.data;
54
- });
55
- }
56
- exports.updateTransaction = updateTransaction;
57
- function postTransaction(bookId, transaction) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(transaction).fetch();
60
- return response.data;
61
- });
62
- }
63
- exports.postTransaction = postTransaction;
64
- function checkTransaction(bookId, transaction) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(transaction).fetch();
67
- return response.data;
68
- });
69
- }
70
- exports.checkTransaction = checkTransaction;
71
- function uncheckTransaction(bookId, transaction) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(transaction).fetch();
74
- return response.data;
75
- });
76
- }
77
- exports.uncheckTransaction = uncheckTransaction;
78
- function trashTransaction(bookId, transaction) {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/trash`).setMethod('PATCH').setPayload(transaction).fetch();
81
- return response.data;
82
- });
83
- }
84
- exports.trashTransaction = trashTransaction;
85
- function restoreTransaction(bookId, transaction) {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(transaction).fetch();
88
- return response.data;
89
- });
90
- }
91
- exports.restoreTransaction = restoreTransaction;
92
- function getTransaction(bookId, id) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/${id}`).setMethod('GET').fetch();
95
- return response.data;
96
- });
97
- }
98
- exports.getTransaction = getTransaction;
99
- function searchTransactions(bookId, query, limit, cursor) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- if (query == null) {
102
- query = "";
103
- }
104
- var request = new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`);
105
- request.addParam('query', query);
106
- request.addParam('limit', limit);
107
- if (cursor != null) {
108
- request.setHeader('cursor', cursor);
109
- }
110
- var response = yield request.fetch();
111
- return response.data;
112
- });
113
- }
114
- exports.searchTransactions = searchTransactions;
115
- //# sourceMappingURL=transaction-service.js.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getUser = void 0;
13
- const HttpApiRequest_1 = require("./HttpApiRequest");
14
- function getUser() {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const res = yield new HttpApiRequest_1.HttpApiV5Request(`user`).setMethod('GET').fetch();
17
- return res.data;
18
- });
19
- }
20
- exports.getUser = getUser;
21
- //# sourceMappingURL=user-service.js.map
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.13.0"
9
- }
10
- ]
11
- }