bkper-js 2.12.3 → 2.12.4

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/model/Book.js CHANGED
@@ -909,7 +909,7 @@ export class Book extends Resource {
909
909
  getGroups() {
910
910
  return __awaiter(this, void 0, void 0, function* () {
911
911
  var _a, _b;
912
- if (this.allGroupsLoaded) {
912
+ if (this.idGroupMap && this.allGroupsLoaded) {
913
913
  return Array.from(((_a = this.idGroupMap) === null || _a === void 0 ? void 0 : _a.values()) || []);
914
914
  }
915
915
  let groups = yield GroupService.getGroups(this.getId(), this.getConfig());
@@ -956,7 +956,7 @@ export class Book extends Resource {
956
956
  getAccounts() {
957
957
  return __awaiter(this, void 0, void 0, function* () {
958
958
  var _a, _b;
959
- if (this.allAccountsLoaded) {
959
+ if (this.idAccountMap && this.allAccountsLoaded) {
960
960
  return Array.from(((_a = this.idAccountMap) === null || _a === void 0 ? void 0 : _a.values()) || []);
961
961
  }
962
962
  //Ensure groups are loaded
@@ -994,7 +994,7 @@ export class Book extends Resource {
994
994
  }
995
995
  /** @internal */
996
996
  ensureGroupsAccountMapsLoaded() {
997
- if (this.idGroupMap) {
997
+ if (this.idGroupMap && !this.allGroupsLoaded) {
998
998
  for (const group of this.idGroupMap.values()) {
999
999
  if (group.accounts == null) {
1000
1000
  group.accounts = new Map();
@@ -1009,11 +1009,13 @@ export class Book extends Resource {
1009
1009
  }
1010
1010
  /** @internal */
1011
1011
  clearGroupCache() {
1012
+ this.allGroupsLoaded = false;
1012
1013
  this.idGroupMap = undefined;
1013
1014
  this.nameGroupMap = undefined;
1014
1015
  }
1015
1016
  /** @internal */
1016
1017
  clearAccountCache() {
1018
+ this.allAccountsLoaded = false;
1017
1019
  this.idAccountMap = undefined;
1018
1020
  this.nameAccountMap = undefined;
1019
1021
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.12.3",
3
+ "version": "2.12.4",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",