bkper-js 2.29.4 → 2.30.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.
package/README.md CHANGED
@@ -15,20 +15,20 @@ It provides a set of classes and functions to interact with the Bkper API, inclu
15
15
 
16
16
  ### Add the package:
17
17
 
18
- ```
18
+ ```bash tab="npm"
19
19
  npm i -S bkper-js
20
20
  ```
21
21
 
22
- or
23
-
24
- ```
25
- yarn add bkper-js
22
+ ```bash tab="bun"
23
+ bun add bkper-js
26
24
  ```
27
25
 
28
- or
29
-
26
+ ```bash tab="pnpm"
27
+ pnpm add bkper-js
30
28
  ```
31
- bun add bkper-js
29
+
30
+ ```bash tab="yarn"
31
+ yarn add bkper-js
32
32
  ```
33
33
 
34
34
  ## Usage
package/lib/index.d.ts CHANGED
@@ -1830,6 +1830,14 @@ export declare class Book extends ResourceProperty<bkper.Book> {
1830
1830
  * @returns The created Accounts
1831
1831
  */
1832
1832
  batchCreateAccounts(accounts: Account[]): Promise<Account[]>;
1833
+ /**
1834
+ * Delete [[Accounts]] on the Book, in batch.
1835
+ *
1836
+ * @param accounts - The accounts to be deleted
1837
+ *
1838
+ * @returns The deleted Accounts
1839
+ */
1840
+ batchDeleteAccounts(accounts: Account[]): Promise<Account[]>;
1833
1841
  /**
1834
1842
  * Create [[Groups]] on the Book, in batch.
1835
1843
  *
@@ -1839,7 +1847,7 @@ export declare class Book extends ResourceProperty<bkper.Book> {
1839
1847
  */
1840
1848
  batchCreateGroups(groups: Group[]): Promise<Group[]>;
1841
1849
  /**
1842
- * Trigger [Balances Audit](https://help.bkper.com/en/articles/4412038-balances-audit) async process.
1850
+ * Trigger Balances Audit async process.
1843
1851
  */
1844
1852
  audit(): void;
1845
1853
  /**
@@ -3234,8 +3242,6 @@ export declare enum Periodicity {
3234
3242
  /**
3235
3243
  * Enum representing permissions of user in the Book
3236
3244
  *
3237
- * Learn more at [share article](https://help.bkper.com/en/articles/2569153-share-your-book-with-your-peers).
3238
- *
3239
3245
  * @public
3240
3246
  */
3241
3247
  export declare enum Permission {
package/lib/model/Book.js CHANGED
@@ -574,6 +574,32 @@ export class Book extends ResourceProperty {
574
574
  return [];
575
575
  });
576
576
  }
577
+ /**
578
+ * Delete [[Accounts]] on the Book, in batch.
579
+ *
580
+ * @param accounts - The accounts to be deleted
581
+ *
582
+ * @returns The deleted Accounts
583
+ */
584
+ batchDeleteAccounts(accounts) {
585
+ return __awaiter(this, void 0, void 0, function* () {
586
+ if (accounts.length > 0) {
587
+ const accountList = {
588
+ items: accounts.map(a => a.json()),
589
+ };
590
+ const payloads = yield AccountService.deleteAccounts(this.getId(), accountList, this.getConfig());
591
+ const deletedAccounts = [];
592
+ for (const payload of payloads) {
593
+ const account = new Account(this, payload);
594
+ deletedAccounts.push(account);
595
+ this.setAccount(payload, true);
596
+ }
597
+ this.clearCache();
598
+ return deletedAccounts;
599
+ }
600
+ return [];
601
+ });
602
+ }
577
603
  /**
578
604
  * Create [[Groups]] on the Book, in batch.
579
605
  *
@@ -599,7 +625,7 @@ export class Book extends ResourceProperty {
599
625
  });
600
626
  }
601
627
  /**
602
- * Trigger [Balances Audit](https://help.bkper.com/en/articles/4412038-balances-audit) async process.
628
+ * Trigger Balances Audit async process.
603
629
  */
604
630
  audit() {
605
631
  BookService.audit(this.getId(), this.getConfig());
@@ -37,8 +37,6 @@ export var DecimalSeparator;
37
37
  /**
38
38
  * Enum representing permissions of user in the Book
39
39
  *
40
- * Learn more at [share article](https://help.bkper.com/en/articles/2569153-share-your-book-with-your-peers).
41
- *
42
40
  * @public
43
41
  */
44
42
  export var Permission;
@@ -34,6 +34,13 @@ export function deleteAccount(bookId, account, config) {
34
34
  return response.data;
35
35
  });
36
36
  }
37
+ export function deleteAccounts(bookId, payload, config) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ var _a;
40
+ const response = yield new HttpBooksApiV5Request(`${bookId}/accounts/delete/batch`, config).setMethod('POST').setPayload(payload).fetch();
41
+ return ((_a = response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
42
+ });
43
+ }
37
44
  export function getAccount(bookId, idOrName, config) {
38
45
  return __awaiter(this, void 0, void 0, function* () {
39
46
  let response = yield new HttpBooksApiV5Request(`${bookId}/accounts/${encodeURIComponent(idOrName)}`, config).setMethod('GET').fetch();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.29.4",
3
+ "version": "2.30.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -35,7 +35,7 @@
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": {
38
- "@bkper/bkper-api-types": "^5.36.0",
38
+ "@bkper/bkper-api-types": "^5.37.0",
39
39
  "big.js": "^6.0.3",
40
40
  "dayjs": "^1.10.3",
41
41
  "luxon": "^1.25.0",