bkper 2.5.9 → 2.6.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.
@@ -0,0 +1,72 @@
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
@@ -13,8 +13,7 @@ exports.getFile = exports.createFile = void 0;
13
13
  const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createFile(bookId, file) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
- var payload = JSON.stringify(file);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/files`).setMethod('POST').setPayload(payload).fetch();
16
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/files`).setMethod('POST').setPayload(file).fetch();
18
17
  return response.data;
19
18
  });
20
19
  }
@@ -13,16 +13,14 @@ exports.getAccounts = exports.getGroup = exports.getGroups = exports.getGroupsBy
13
13
  const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createGroup(bookId, group) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
- var payload = JSON.stringify(group);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('POST').setPayload(payload).fetch();
16
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('POST').setPayload(group).fetch();
18
17
  return response.data;
19
18
  });
20
19
  }
21
20
  exports.createGroup = createGroup;
22
21
  function updateGroup(bookId, group) {
23
22
  return __awaiter(this, void 0, void 0, function* () {
24
- var payload = JSON.stringify(group);
25
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('PUT').setPayload(payload).fetch();
23
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/groups`).setMethod('PUT').setPayload(group).fetch();
26
24
  return response.data;
27
25
  });
28
26
  }
@@ -35,13 +33,10 @@ function deleteGroup(bookId, group) {
35
33
  }
36
34
  exports.deleteGroup = deleteGroup;
37
35
  function getGroupsByAccountId(bookId, accountId) {
36
+ var _a;
38
37
  return __awaiter(this, void 0, void 0, function* () {
39
38
  var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/accounts/${accountId}/groups`).setMethod('GET').fetch();
40
- var groupsPlain = response.data;
41
- if (!(groupsPlain === null || groupsPlain === void 0 ? void 0 : groupsPlain.items)) {
42
- return [];
43
- }
44
- return groupsPlain.items;
39
+ return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
45
40
  });
46
41
  }
47
42
  exports.getGroupsByAccountId = getGroupsByAccountId;
@@ -0,0 +1,53 @@
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
@@ -9,12 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.searchTransactions = exports.getTransaction = exports.restoreTransaction = exports.removeTransaction = exports.uncheckTransaction = exports.checkTransaction = exports.postTransaction = exports.updateTransaction = exports.createTransactionsBatch = exports.createTransaction = void 0;
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
13
  const HttpApiRequest_1 = require("./HttpApiRequest");
14
14
  function createTransaction(bookId, transaction) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
- var payload = JSON.stringify(transaction);
17
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('POST').setPayload(payload).fetch();
16
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('POST').setPayload(transaction).fetch();
18
17
  return response.data;
19
18
  });
20
19
  }
@@ -34,50 +33,58 @@ function createTransactionsBatch(bookId, transactions) {
34
33
  });
35
34
  }
36
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;
37
50
  function updateTransaction(bookId, transaction) {
38
51
  return __awaiter(this, void 0, void 0, function* () {
39
- var payload = JSON.stringify(transaction);
40
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(payload).fetch();
52
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(transaction).fetch();
41
53
  return response.data;
42
54
  });
43
55
  }
44
56
  exports.updateTransaction = updateTransaction;
45
57
  function postTransaction(bookId, transaction) {
46
58
  return __awaiter(this, void 0, void 0, function* () {
47
- var payload = JSON.stringify(transaction);
48
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(payload).fetch();
59
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(transaction).fetch();
49
60
  return response.data;
50
61
  });
51
62
  }
52
63
  exports.postTransaction = postTransaction;
53
64
  function checkTransaction(bookId, transaction) {
54
65
  return __awaiter(this, void 0, void 0, function* () {
55
- var payload = JSON.stringify(transaction);
56
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(payload).fetch();
66
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(transaction).fetch();
57
67
  return response.data;
58
68
  });
59
69
  }
60
70
  exports.checkTransaction = checkTransaction;
61
71
  function uncheckTransaction(bookId, transaction) {
62
72
  return __awaiter(this, void 0, void 0, function* () {
63
- var payload = JSON.stringify(transaction);
64
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(payload).fetch();
73
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(transaction).fetch();
65
74
  return response.data;
66
75
  });
67
76
  }
68
77
  exports.uncheckTransaction = uncheckTransaction;
69
- function removeTransaction(bookId, transaction) {
78
+ function trashTransaction(bookId, transaction) {
70
79
  return __awaiter(this, void 0, void 0, function* () {
71
- var payload = JSON.stringify(transaction);
72
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/remove`).setMethod('PATCH').setPayload(payload).fetch();
80
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/trash`).setMethod('PATCH').setPayload(transaction).fetch();
73
81
  return response.data;
74
82
  });
75
83
  }
76
- exports.removeTransaction = removeTransaction;
84
+ exports.trashTransaction = trashTransaction;
77
85
  function restoreTransaction(bookId, transaction) {
78
86
  return __awaiter(this, void 0, void 0, function* () {
79
- var payload = JSON.stringify(transaction);
80
- var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(payload).fetch();
87
+ var response = yield new HttpApiRequest_1.HttpBooksApiV5Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(transaction).fetch();
81
88
  return response.data;
82
89
  });
83
90
  }
@@ -0,0 +1,21 @@
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "2.5.9",
3
+ "version": "2.6.0",
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": "^5.1.4",
49
+ "@bkper/bkper-api-types": "^5.4.0",
50
50
  "@microsoft/api-extractor": "^7.12.1",
51
51
  "@types/big.js": "^6.0.2",
52
52
  "@types/chai": "^4.2.14",