bkper 2.0.1 → 2.1.1

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 CHANGED
@@ -21,7 +21,6 @@
21
21
  export declare class Account {
22
22
 
23
23
 
24
-
25
24
  /**
26
25
  * Gets the account internal id.
27
26
  */
@@ -158,7 +157,7 @@ export declare class Account {
158
157
  /**
159
158
  * Get the [[Groups]] of this account.
160
159
  */
161
- getGroups(): Promise<Set<Group>>;
160
+ getGroups(): Promise<Group[]>;
162
161
  /**
163
162
  * Sets the groups of the Account.
164
163
  *
@@ -681,6 +680,10 @@ export declare class Book {
681
680
  * Gets all [[Groups]] of this Book
682
681
  */
683
682
  getGroups(): Promise<Group[]>;
683
+ /**
684
+ * Get the [[Groups]] of a given account.
685
+ */
686
+ getGroupsByAccount(accountIdOrName: string): Promise<Group[]>;
684
687
  /**
685
688
  * Get Book transactions based on a query.
686
689
  *
@@ -30,9 +30,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.Account = void 0;
32
32
  const AccountService = __importStar(require("../service/account-service"));
33
+ const GroupService = __importStar(require("../service/group-service"));
33
34
  const Group_1 = require("./Group");
34
35
  const utils_1 = require("../utils");
35
36
  const Amount_1 = require("./Amount");
37
+ const Utils = __importStar(require("../utils"));
36
38
  /**
37
39
  *
38
40
  * This class defines an [Account](https://en.wikipedia.org/wiki/Account_(bookkeeping)) of a [[Book]].
@@ -251,16 +253,12 @@ class Account {
251
253
  */
252
254
  getGroups() {
253
255
  return __awaiter(this, void 0, void 0, function* () {
254
- if (!this.groups) {
255
- this.groups = new Set();
256
- if (this.wrapped.groups != null) {
257
- for (const groupId of this.wrapped.groups) {
258
- let group = yield this.book.getGroup(groupId);
259
- this.groups.add(group);
260
- }
261
- }
256
+ let groups = yield GroupService.getGroupsByAccountId(this.book.getId(), this.getId());
257
+ let groupsObj = Utils.wrapObjects(new Group_1.Group(), groups);
258
+ for (const group of groupsObj) {
259
+ group.book = this.book;
262
260
  }
263
- return this.groups;
261
+ return groupsObj;
264
262
  });
265
263
  }
266
264
  /**
@@ -293,13 +291,7 @@ class Account {
293
291
  groupObject = yield this.book.getGroup(group);
294
292
  }
295
293
  if (groupObject) {
296
- this.wrapped.groups.push(groupObject.getId());
297
- }
298
- if (!this.groups) {
299
- this.groups = new Set();
300
- }
301
- if (groupObject) {
302
- this.groups.add(groupObject);
294
+ this.wrapped.groups.push(groupObject.wrapped);
303
295
  }
304
296
  return this;
305
297
  });
package/lib/model/Book.js CHANGED
@@ -525,6 +525,19 @@ class Book {
525
525
  return groupsObj;
526
526
  });
527
527
  }
528
+ /**
529
+ * Get the [[Groups]] of a given account.
530
+ */
531
+ getGroupsByAccount(accountIdOrName) {
532
+ return __awaiter(this, void 0, void 0, function* () {
533
+ let groups = yield GroupService.getGroupsByAccountId(this.getId(), accountIdOrName);
534
+ let groupsObj = Utils.wrapObjects(new Group_1.Group(), groups);
535
+ for (const group of groupsObj) {
536
+ group.book = this;
537
+ }
538
+ return groupsObj;
539
+ });
540
+ }
528
541
  /**
529
542
  * Get Book transactions based on a query.
530
543
  *
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.HttpBooksApiV4Request = exports.HttpBooksApiV2Request = exports.HttpApiRequest = void 0;
15
+ exports.HttpBooksApiV5Request = exports.HttpBooksApiV2Request = exports.HttpApiRequest = void 0;
16
16
  const local_auth_service_1 = require("../auth/local-auth-service");
17
17
  const gaxios_1 = require("gaxios");
18
18
  const https_1 = __importDefault(require("https"));
@@ -83,6 +83,7 @@ class HttpApiRequest {
83
83
  body: this.payload,
84
84
  agent: httpsAgent,
85
85
  retryConfig: {
86
+ httpMethodsToRetry: ['GET', 'PUT', 'POST', 'PATCH', 'HEAD', 'OPTIONS', 'DELETE'],
86
87
  statusCodesToRetry: [[100, 199], [429, 429], [500, 599]],
87
88
  retry: process.env.NODE_ENV == utils_1.NODE_ENV_DEV ? 0 : 6,
88
89
  onRetryAttempt: (err) => { console.log(`${err.message} - Retrying... `); },
@@ -93,10 +94,10 @@ class HttpApiRequest {
93
94
  catch (e) {
94
95
  let error = e.response.data;
95
96
  if (error.error) {
96
- throw `[${error.error.message}] calling url ${url}`;
97
+ throw error.error.message;
97
98
  }
98
99
  else {
99
- throw `[${e.message}] calling url ${url}`;
100
+ throw e.message;
100
101
  }
101
102
  }
102
103
  });
@@ -121,10 +122,10 @@ class HttpBooksApiV2Request extends HttpApiRequest {
121
122
  }
122
123
  }
123
124
  exports.HttpBooksApiV2Request = HttpBooksApiV2Request;
124
- class HttpBooksApiV4Request extends HttpApiRequest {
125
+ class HttpBooksApiV5Request extends HttpApiRequest {
125
126
  constructor(service) {
126
- super(`v4/books/${service}`);
127
+ super(`v5/books/${service}`);
127
128
  }
128
129
  }
129
- exports.HttpBooksApiV4Request = HttpBooksApiV4Request;
130
+ exports.HttpBooksApiV5Request = HttpBooksApiV5Request;
130
131
  //# sourceMappingURL=HttpApiRequest.js.map
@@ -14,7 +14,7 @@ const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createAccount(bookId, account) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var payload = JSON.stringify(account);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/accounts`).setMethod('POST').setPayload(payload).fetch();
17
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts`).setMethod('POST').setPayload(payload).fetch();
18
18
  return response.data;
19
19
  });
20
20
  }
@@ -22,14 +22,14 @@ exports.createAccount = createAccount;
22
22
  function updateAccount(bookId, account) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  var payload = JSON.stringify(account);
25
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/accounts`).setMethod('PUT').setPayload(payload).fetch();
25
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts`).setMethod('PUT').setPayload(payload).fetch();
26
26
  return response.data;
27
27
  });
28
28
  }
29
29
  exports.updateAccount = updateAccount;
30
30
  function deleteAccount(bookId, account) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/accounts/${account.id}`).setMethod('DELETE').fetch();
32
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts/${account.id}`).setMethod('DELETE').fetch();
33
33
  return response.data;
34
34
  });
35
35
  }
@@ -40,7 +40,7 @@ function createAccounts(bookId, accounts) {
40
40
  items: accounts
41
41
  };
42
42
  var accountSaveBatchJSON = JSON.stringify(accountList);
43
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/accounts/batch`).setMethod('POST').setPayload(accountSaveBatchJSON).fetch();
43
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts/batch`).setMethod('POST').setPayload(accountSaveBatchJSON).fetch();
44
44
  var accountsPlain = yield response.data;
45
45
  if (accountsPlain.items == null) {
46
46
  return [];
@@ -52,7 +52,7 @@ exports.createAccounts = createAccounts;
52
52
  function getAccount(bookId, idOrName) {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  try {
55
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/accounts/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
55
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
56
56
  return response.data;
57
57
  }
58
58
  catch (error) {
@@ -14,7 +14,7 @@ const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createApp(app) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var payload = JSON.stringify(app);
17
- var response = yield new HttpApiRequest_1.HttpApiRequest(`v3/apps`).setMethod('POST').setPayload(payload).fetch();
17
+ var response = yield new HttpApiRequest_1.HttpApiRequest(`v5/apps`).setMethod('POST').setPayload(payload).fetch();
18
18
  return response.data;
19
19
  });
20
20
  }
@@ -22,7 +22,7 @@ exports.createApp = createApp;
22
22
  function updateApp(app) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  var payload = JSON.stringify(app);
25
- var response = yield new HttpApiRequest_1.HttpApiRequest(`v3/apps`).setMethod('PUT').setPayload(payload).fetch();
25
+ var response = yield new HttpApiRequest_1.HttpApiRequest(`v5/apps`).setMethod('PUT').setPayload(payload).fetch();
26
26
  return response.data;
27
27
  });
28
28
  }
@@ -30,7 +30,7 @@ exports.updateApp = updateApp;
30
30
  function patchApp(app) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
32
  var payload = JSON.stringify(app);
33
- var response = yield new HttpApiRequest_1.HttpApiRequest(`v3/apps`).setMethod('PATCH').setPayload(payload).fetch();
33
+ var response = yield new HttpApiRequest_1.HttpApiRequest(`v5/apps`).setMethod('PATCH').setPayload(payload).fetch();
34
34
  return response.data;
35
35
  });
36
36
  }
@@ -13,7 +13,7 @@ exports.getBalances = void 0;
13
13
  const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function getBalances(bookId, query) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/balances`).addParam('query', query).addParam('time', Date.now()).fetch();
16
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/balances`).addParam('query', query).addParam('time', Date.now()).fetch();
17
17
  return response.data;
18
18
  });
19
19
  }
@@ -16,7 +16,7 @@ function loadBook(bookId) {
16
16
  if (bookId == null) {
17
17
  throw new Error("Book id null!");
18
18
  }
19
- let response = yield new HttpApiRequest_1.HttpBooksApiV4Request(bookId).fetch();
19
+ let response = yield new HttpApiRequest_1.HttpBooksApiV5Request(bookId).fetch();
20
20
  return response.data;
21
21
  });
22
22
  }
@@ -24,14 +24,14 @@ exports.loadBook = loadBook;
24
24
  function updateBook(bookId, book) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  var payload = JSON.stringify(book);
27
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}`).setMethod('PUT').setPayload(payload).fetch();
27
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}`).setMethod('PUT').setPayload(payload).fetch();
28
28
  return response.data;
29
29
  });
30
30
  }
31
31
  exports.updateBook = updateBook;
32
32
  function audit(bookId) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
- new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/audit`).setMethod('PATCH').fetch();
34
+ new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/audit`).setMethod('PATCH').fetch();
35
35
  });
36
36
  }
37
37
  exports.audit = audit;
@@ -14,14 +14,14 @@ const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createFile(bookId, file) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var payload = JSON.stringify(file);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/files`).setMethod('POST').setPayload(payload).fetch();
17
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/files`).setMethod('POST').setPayload(payload).fetch();
18
18
  return response.data;
19
19
  });
20
20
  }
21
21
  exports.createFile = createFile;
22
22
  function getFile(bookId, id) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/files/${id}`).setMethod('GET').fetch();
24
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/files/${id}`).setMethod('GET').fetch();
25
25
  return response.data;
26
26
  });
27
27
  }
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getAccounts = exports.getGroup = exports.getGroups = exports.createGroups = exports.deleteGroup = exports.updateGroup = exports.createGroup = void 0;
12
+ exports.getAccounts = exports.getGroup = exports.getGroups = exports.getGroupsByAccountId = exports.createGroups = exports.deleteGroup = exports.updateGroup = exports.createGroup = void 0;
13
13
  const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createGroup(bookId, group) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var payload = JSON.stringify(group);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups`).setMethod('POST').setPayload(payload).fetch();
17
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('POST').setPayload(payload).fetch();
18
18
  return response.data;
19
19
  });
20
20
  }
@@ -22,14 +22,14 @@ exports.createGroup = createGroup;
22
22
  function updateGroup(bookId, group) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
24
  var payload = JSON.stringify(group);
25
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups`).setMethod('PUT').setPayload(payload).fetch();
25
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('PUT').setPayload(payload).fetch();
26
26
  return response.data;
27
27
  });
28
28
  }
29
29
  exports.updateGroup = updateGroup;
30
30
  function deleteGroup(bookId, group) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups/${group.id}`).setMethod('DELETE').fetch();
32
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/${group.id}`).setMethod('DELETE').fetch();
33
33
  return response.data;
34
34
  });
35
35
  }
@@ -40,7 +40,7 @@ function createGroups(bookId, groups) {
40
40
  items: groups
41
41
  };
42
42
  var groupsBatchJSON = JSON.stringify(groupList);
43
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups/batch`).setMethod('POST').setPayload(groupsBatchJSON).fetch();
43
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/batch`).setMethod('POST').setPayload(groupsBatchJSON).fetch();
44
44
  if (response == null) {
45
45
  return [];
46
46
  }
@@ -52,9 +52,20 @@ function createGroups(bookId, groups) {
52
52
  });
53
53
  }
54
54
  exports.createGroups = createGroups;
55
+ function getGroupsByAccountId(bookId, accountId) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts/${accountId}/groups`).setMethod('GET').fetch();
58
+ var groupsPlain = response.data;
59
+ if (groupsPlain.items == null) {
60
+ return [];
61
+ }
62
+ return groupsPlain.items;
63
+ });
64
+ }
65
+ exports.getGroupsByAccountId = getGroupsByAccountId;
55
66
  function getGroups(bookId) {
56
67
  return __awaiter(this, void 0, void 0, function* () {
57
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups`).setMethod('GET').fetch();
68
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('GET').fetch();
58
69
  var groupsPlain = response.data;
59
70
  if (groupsPlain.items == null) {
60
71
  return [];
@@ -66,7 +77,7 @@ exports.getGroups = getGroups;
66
77
  function getGroup(bookId, idOrName) {
67
78
  return __awaiter(this, void 0, void 0, function* () {
68
79
  try {
69
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
80
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
70
81
  return response.data;
71
82
  }
72
83
  catch (error) {
@@ -77,7 +88,7 @@ function getGroup(bookId, idOrName) {
77
88
  exports.getGroup = getGroup;
78
89
  function getAccounts(bookId, idOrName) {
79
90
  return __awaiter(this, void 0, void 0, function* () {
80
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/groups/${encodeURIComponent(idOrName)}/accounts`).setMethod('GET').fetch();
91
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups/${encodeURIComponent(idOrName)}/accounts`).setMethod('GET').fetch();
81
92
  var accountsPlain = response.data;
82
93
  if (accountsPlain.items == null) {
83
94
  return [];
@@ -14,7 +14,7 @@ const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createTransaction(bookId, transaction) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var payload = JSON.stringify(transaction);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions`).setMethod('POST').setPayload(payload).fetch();
17
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('POST').setPayload(payload).fetch();
18
18
  return response.data;
19
19
  });
20
20
  }
@@ -25,7 +25,7 @@ function createTransactionsBatch(bookId, transactions) {
25
25
  items: transactions
26
26
  };
27
27
  var payload = JSON.stringify(transactionList);
28
- let response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/batch`)
28
+ let response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/batch`)
29
29
  .setMethod('POST')
30
30
  .setPayload(payload)
31
31
  .fetch();
@@ -37,7 +37,7 @@ exports.createTransactionsBatch = createTransactionsBatch;
37
37
  function updateTransaction(bookId, transaction) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
39
  var payload = JSON.stringify(transaction);
40
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions`).setMethod('PUT').setPayload(payload).fetch();
40
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(payload).fetch();
41
41
  return response.data;
42
42
  });
43
43
  }
@@ -45,7 +45,7 @@ exports.updateTransaction = updateTransaction;
45
45
  function postTransaction(bookId, transaction) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
47
  var payload = JSON.stringify(transaction);
48
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(payload).fetch();
48
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(payload).fetch();
49
49
  return response.data;
50
50
  });
51
51
  }
@@ -53,7 +53,7 @@ exports.postTransaction = postTransaction;
53
53
  function checkTransaction(bookId, transaction) {
54
54
  return __awaiter(this, void 0, void 0, function* () {
55
55
  var payload = JSON.stringify(transaction);
56
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(payload).fetch();
56
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(payload).fetch();
57
57
  return response.data;
58
58
  });
59
59
  }
@@ -61,7 +61,7 @@ exports.checkTransaction = checkTransaction;
61
61
  function uncheckTransaction(bookId, transaction) {
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
63
  var payload = JSON.stringify(transaction);
64
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(payload).fetch();
64
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(payload).fetch();
65
65
  return response.data;
66
66
  });
67
67
  }
@@ -69,7 +69,7 @@ exports.uncheckTransaction = uncheckTransaction;
69
69
  function removeTransaction(bookId, transaction) {
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
71
  var payload = JSON.stringify(transaction);
72
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/remove`).setMethod('PATCH').setPayload(payload).fetch();
72
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/remove`).setMethod('PATCH').setPayload(payload).fetch();
73
73
  return response.data;
74
74
  });
75
75
  }
@@ -77,14 +77,14 @@ exports.removeTransaction = removeTransaction;
77
77
  function restoreTransaction(bookId, transaction) {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
79
  var payload = JSON.stringify(transaction);
80
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(payload).fetch();
80
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(payload).fetch();
81
81
  return response.data;
82
82
  });
83
83
  }
84
84
  exports.restoreTransaction = restoreTransaction;
85
85
  function getTransaction(bookId, id) {
86
86
  return __awaiter(this, void 0, void 0, function* () {
87
- var response = yield new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions/${id}`).setMethod('GET').fetch();
87
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/${id}`).setMethod('GET').fetch();
88
88
  return response.data;
89
89
  });
90
90
  }
@@ -94,7 +94,7 @@ function searchTransactions(bookId, query, limit, cursor) {
94
94
  if (query == null) {
95
95
  query = "";
96
96
  }
97
- var request = new HttpApiRequest_1.HttpBooksApiV4Request(`${bookId}/transactions`);
97
+ var request = new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`);
98
98
  request.addParam('query', query);
99
99
  request.addParam('limit', limit);
100
100
  if (cursor != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "description": "Node.js client for Bkper REST API",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "open": "^7.3.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@bkper/bkper-api-types": "^4.0.3",
49
+ "@bkper/bkper-api-types": "^5.0.0",
50
50
  "@microsoft/api-extractor": "^7.12.1",
51
51
  "@types/big.js": "^6.0.2",
52
52
  "@types/chai": "^4.2.14",