taxtank-core 0.29.0 → 0.29.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.
@@ -1352,6 +1352,7 @@
1352
1352
  this.cacheSubject = new rxjs.ReplaySubject(1);
1353
1353
  /**
1354
1354
  * List of methods unavailable for current API
1355
+ * @TODO Alex: add and handle enabled methods too
1355
1356
  */
1356
1357
  this.disabledMethods = [];
1357
1358
  this.listenEvents();
@@ -1501,6 +1502,9 @@
1501
1502
  break;
1502
1503
  case 'delete':
1503
1504
  this.cache = this.cache.removeBy('id', items.map(function (item) { return item.id; }));
1505
+ break;
1506
+ case 'get':
1507
+ this.cache = this.createCollectionInstance(this.collectionClass, items);
1504
1508
  }
1505
1509
  this.cacheSubject.next(this.cache);
1506
1510
  };
@@ -8317,12 +8321,22 @@
8317
8321
  function PropertyShareCollection() {
8318
8322
  return _super !== null && _super.apply(this, arguments) || this;
8319
8323
  }
8324
+ /**
8325
+ * Get list of incoming property shares
8326
+ * (initiated not by current user)
8327
+ * @TODO Alex: rename
8328
+ */
8320
8329
  PropertyShareCollection.prototype.getIncoming = function () {
8321
8330
  return this.filter(function (propertyShare) {
8322
8331
  var _a;
8323
8332
  return ((_a = propertyShare.user) === null || _a === void 0 ? void 0 : _a.isLoggedIn()) && propertyShare.isPending() && propertyShare.property.user.id !== +localStorage.getItem('userId');
8324
8333
  });
8325
8334
  };
8335
+ /**
8336
+ * Get list of outcoming property shares
8337
+ * (initiated by current user)
8338
+ * @TODO Alex: rename
8339
+ */
8326
8340
  PropertyShareCollection.prototype.getOutcoming = function () {
8327
8341
  return this.filter(function (propertyShare) { var _a; return !((_a = propertyShare.user) === null || _a === void 0 ? void 0 : _a.isLoggedIn()); });
8328
8342
  };
@@ -9912,6 +9926,7 @@
9912
9926
  if (items === void 0) { items = []; }
9913
9927
  var _this = _super.call(this, items) || this;
9914
9928
  // Sort personal chart accounts by name (TT-1950)
9929
+ // @TODO Alex: implement general initial sorting solution in parent class
9915
9930
  _this.items.sort(function (a, b) {
9916
9931
  if (a.isPersonal() && b.isPersonal()) {
9917
9932
  return a.name > b.name ? 1 : -1;
@@ -10446,6 +10461,9 @@
10446
10461
  this.listenNotifications();
10447
10462
  this.listenBasiqLogin();
10448
10463
  };
10464
+ /**
10465
+ * POST endpoint is using for create and for update.
10466
+ */
10449
10467
  BankConnectionService.prototype.post = function (bankConnection) {
10450
10468
  var _this = this;
10451
10469
  return this.http.post(this.apiUrl, bankConnection)
@@ -10649,6 +10667,8 @@
10649
10667
  function BasiqTokenService() {
10650
10668
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
10651
10669
  _this.endpointUri = 'basiq/tokens';
10670
+ _this.modelClass = BasiqToken;
10671
+ _this.collectionClass = Collection;
10652
10672
  _this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
10653
10673
  return _this;
10654
10674
  }
@@ -10664,8 +10684,7 @@
10664
10684
  return new BasiqToken(response.access_token, new Date(now + response.expires_in * 1000));
10665
10685
  }))
10666
10686
  .subscribe(function (token) {
10667
- _this.cache = new Collection([token]);
10668
- _this.cacheSubject.next(_this.cache);
10687
+ _this.updateCache([token], 'get');
10669
10688
  });
10670
10689
  }
10671
10690
  return this.cacheSubject.asObservable();
@@ -15062,6 +15081,7 @@
15062
15081
  */
15063
15082
  LoanService.prototype.listenEvents = function () {
15064
15083
  var _this = this;
15084
+ // Update list of loans when added/changed loan bank account
15065
15085
  this.listenCSE(BankAccount, ['post', 'put'], function (bankAccounts) {
15066
15086
  if (bankAccounts.find(function (ba) { return !!ba.loan; })) {
15067
15087
  _this.resetCache();
@@ -15079,7 +15099,7 @@
15079
15099
  };
15080
15100
  /**
15081
15101
  * Add new loan payout
15082
- * @TODO Vik: fix api (remove loan id from URL)
15102
+ * @TODO Vik (TT-2670): fix api (remove loan id from URL)
15083
15103
  * @TODO Alex: move to separated service
15084
15104
  */
15085
15105
  LoanService.prototype.addPayoutLoan = function (loan, paidOutLoan) {
@@ -15093,7 +15113,7 @@
15093
15113
  };
15094
15114
  /**
15095
15115
  * Delete loan payout
15096
- * @TODO Vik: fix api (remove loan id from URL)
15116
+ * @TODO (TT-2670): Vik: fix api (remove loan id from URL)
15097
15117
  * @TODO Alex: move to separated service
15098
15118
  */
15099
15119
  LoanService.prototype.deletePayoutLoan = function (loan, payout) {
@@ -15108,7 +15128,7 @@
15108
15128
  /**
15109
15129
  * Update loan payout
15110
15130
  *
15111
- * @TODO Vik: fix api (remove loan id from URL)
15131
+ * @TODO Vik (TT-2670): fix api (remove loan id from URL)
15112
15132
  * @TODO Alex: move to separated service
15113
15133
  */
15114
15134
  LoanService.prototype.updatePayoutLoan = function (loan, paidOutLoan) {
@@ -17248,7 +17268,6 @@
17248
17268
  }
17249
17269
  // Rental income item is completed when user added at least one property
17250
17270
  if (incomeTypes.property) {
17251
- // @TODO Alex (TT-1777): remove pipe when all services refactored
17252
17271
  batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.getArray()));
17253
17272
  }
17254
17273
  // Sole business item is completed when user added at least one business