bkper-js 2.31.1 → 2.32.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/lib/index.d.ts CHANGED
@@ -1585,6 +1585,12 @@ export declare class Book extends ResourceProperty<bkper.Book> {
1585
1585
  * @returns The name of the owner of the Book
1586
1586
  */
1587
1587
  getOwnerName(): string | undefined;
1588
+ /**
1589
+ * Gets the logo URL of the Book owner's custom domain, if any.
1590
+ *
1591
+ * @returns The logo URL, or undefined if the owner has no custom domain logo
1592
+ */
1593
+ getLogoUrl(): string | undefined;
1588
1594
  /**
1589
1595
  * Gets the permission for the current user in this Book.
1590
1596
  *
package/lib/model/Book.js CHANGED
@@ -180,6 +180,14 @@ export class Book extends ResourceProperty {
180
180
  getOwnerName() {
181
181
  return this.payload.ownerName;
182
182
  }
183
+ /**
184
+ * Gets the logo URL of the Book owner's custom domain, if any.
185
+ *
186
+ * @returns The logo URL, or undefined if the owner has no custom domain logo
187
+ */
188
+ getLogoUrl() {
189
+ return this.payload.logoUrl;
190
+ }
183
191
  /**
184
192
  * Gets the permission for the current user in this Book.
185
193
  *
@@ -989,9 +997,27 @@ export class Book extends ResourceProperty {
989
997
  }
990
998
  }
991
999
  }
992
- /** @internal */
1000
+ /**
1001
+ * Ensures every group has a cached `.accounts` Map after accounts are loaded.
1002
+ *
1003
+ * `linkAccountsAndGroups()` populates `.accounts` on groups that have accounts
1004
+ * linked to them. Groups with zero accounts keep `.accounts = undefined`. This
1005
+ * method fills that gap by initializing an empty Map on those groups.
1006
+ *
1007
+ * Without this, `Group.getAccounts()` sees `undefined`, skips the cache check,
1008
+ * and falls through to a network request per group — causing hundreds of
1009
+ * redundant `/groups/{id}/accounts` calls on books with many groups.
1010
+ *
1011
+ * IMPORTANT: This method must NOT be guarded by `allGroupsLoaded` or any
1012
+ * similar flag. It runs inside `mapAccounts()`, which is always called after
1013
+ * `mapGroups()` sets `allGroupsLoaded = true`. A guard like
1014
+ * `if (!this.allGroupsLoaded)` would make this method dead code, silently
1015
+ * reintroducing the redundant network requests.
1016
+ *
1017
+ * @internal
1018
+ */
993
1019
  ensureGroupsAccountMapsLoaded() {
994
- if (this.idGroupMap && !this.allGroupsLoaded) {
1020
+ if (this.idGroupMap) {
995
1021
  for (const group of this.idGroupMap.values()) {
996
1022
  if (group.accounts == null) {
997
1023
  group.accounts = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.31.1",
3
+ "version": "2.32.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -39,7 +39,7 @@
39
39
  "postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
40
40
  },
41
41
  "dependencies": {
42
- "@bkper/bkper-api-types": "^5.38.0",
42
+ "@bkper/bkper-api-types": "^5.39.1",
43
43
  "big.js": "^6.0.3",
44
44
  "dayjs": "^1.10.3",
45
45
  "luxon": "^1.25.0",