taxtank-core 0.28.97 → 0.28.99

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.
Files changed (132) hide show
  1. package/bundles/taxtank-core.umd.js +2303 -2040
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/index.js +3 -1
  4. package/esm2015/lib/collections/sole/sole-business-losses.collection.js +2 -2
  5. package/esm2015/lib/db/Models/abstract-model.js +2 -1
  6. package/esm2015/lib/db/Models/observable-model.js +10 -0
  7. package/esm2015/lib/db/Models/property/property.js +3 -3
  8. package/esm2015/lib/db/Models/sole/bas-report.js +3 -2
  9. package/esm2015/lib/functions/array/index.js +2 -1
  10. package/esm2015/lib/functions/array/to-array.js +7 -0
  11. package/esm2015/lib/models/event/app-event.js +12 -1
  12. package/esm2015/lib/models/property/property.js +3 -1
  13. package/esm2015/lib/models/report/sole/sole-business/sole-business-loss-report.js +4 -2
  14. package/esm2015/lib/services/account-setup/account-setup.service.js +3 -2
  15. package/esm2015/lib/services/event/event-dispatcher.service.js +12 -1
  16. package/esm2015/lib/services/http/bank/bank-account/bank-account.service.js +2 -2
  17. package/esm2015/lib/services/http/bank/bank-connection/bank-connection.service.js +2 -2
  18. package/esm2015/lib/services/http/bank/bank-transaction/bank-transaction.service.js +2 -2
  19. package/esm2015/lib/services/http/bank/bank.service.js +2 -2
  20. package/esm2015/lib/services/http/bank/basiq/basiq.service.js +2 -2
  21. package/esm2015/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.js +2 -2
  22. package/esm2015/lib/services/http/chat/chat.service.js +2 -2
  23. package/esm2015/lib/services/http/chat/message/message.service.js +2 -2
  24. package/esm2015/lib/services/http/depreciation/depreciation.service.js +2 -2
  25. package/esm2015/lib/services/http/document/document-folder/document-folder.service.js +2 -2
  26. package/esm2015/lib/services/http/document/document.service.js +2 -2
  27. package/esm2015/lib/services/http/firm/client-invite/client-invite.service.js +2 -2
  28. package/esm2015/lib/services/http/firm/client-movement/client-movement.service.js +2 -2
  29. package/esm2015/lib/services/http/firm/employee/employee.service.js +2 -2
  30. package/esm2015/lib/services/http/firm/employee-invite/employee-invite.service.js +2 -2
  31. package/esm2015/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.js +2 -2
  32. package/esm2015/lib/services/http/income-source/income-source.service.js +2 -2
  33. package/esm2015/lib/services/http/income-source/salary-forecast/salary-forecast.service.js +2 -2
  34. package/esm2015/lib/services/http/income-source/sole-forecast/sole-forecast.service.js +2 -2
  35. package/esm2015/lib/services/http/loan/loan.service.js +2 -2
  36. package/esm2015/lib/services/http/property/property-category/property-category.service.js +2 -2
  37. package/esm2015/lib/services/http/property/property-category-movement/property-category-movement.service.js +2 -2
  38. package/esm2015/lib/services/http/property/property-document/property-document.service.js +2 -2
  39. package/esm2015/lib/services/http/property/property-sale/property-sale.service.js +2 -2
  40. package/esm2015/lib/services/http/property/property-sale/tax-exemption/tax-exemption.service.js +2 -2
  41. package/esm2015/lib/services/http/property/property-share/property-share.service.js +2 -2
  42. package/esm2015/lib/services/http/property/property.service.js +29 -46
  43. package/esm2015/lib/services/http/rest/http-method.type.js +2 -0
  44. package/esm2015/lib/services/http/rest/index.js +3 -1
  45. package/esm2015/lib/services/http/rest/rest-method.type.js +2 -0
  46. package/esm2015/lib/services/http/rest/rest-old.service.js +225 -0
  47. package/esm2015/lib/services/http/rest/rest.service.js +144 -147
  48. package/esm2015/lib/services/http/service-notification/service-notification.service.js +2 -2
  49. package/esm2015/lib/services/http/sole/bas-report/bas-report.service.js +2 -2
  50. package/esm2015/lib/services/http/sole/sole-business/sole-business.service.js +2 -2
  51. package/esm2015/lib/services/http/sole/sole-business-activity/sole-business-activity.service.js +2 -2
  52. package/esm2015/lib/services/http/sole/sole-business-loss/sole-business-loss-rules/sole-business-loss-offset-rule.service.js +2 -2
  53. package/esm2015/lib/services/http/sole/sole-business-loss/sole-business-loss.service.js +2 -2
  54. package/esm2015/lib/services/http/sole/sole-contact/sole-contact.service.js +2 -2
  55. package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +2 -2
  56. package/esm2015/lib/services/http/sole/sole-invoice-template/sole-invoice-template.service.js +2 -2
  57. package/esm2015/lib/services/http/subscription/service-price.service.js +2 -2
  58. package/esm2015/lib/services/http/tax-review/tax-review-history/tax-review-history.service.js +2 -2
  59. package/esm2015/lib/services/http/tax-review/tax-review.service.js +2 -2
  60. package/esm2015/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.js +2 -2
  61. package/esm2015/lib/services/http/transaction/transaction.service.js +2 -2
  62. package/esm2015/lib/services/http/user/user-event-setting/user-event-setting.service.js +2 -2
  63. package/esm2015/lib/services/http/user/user-event-type/user-event-type.service.js +2 -2
  64. package/esm2015/lib/services/http/user/users-invite/users-invite.service.js +2 -2
  65. package/esm2015/lib/services/http/vehicle/vehicle-claim.service.js +2 -2
  66. package/esm2015/lib/services/http/vehicle/vehicle-logbook.service.js +2 -2
  67. package/esm2015/lib/services/http/vehicle/vehicle.service.js +2 -2
  68. package/esm2015/lib/services/report/property/property-transaction-report.service.js +2 -3
  69. package/fesm2015/taxtank-core.js +1964 -1728
  70. package/fesm2015/taxtank-core.js.map +1 -1
  71. package/lib/collections/index.d.ts +2 -0
  72. package/lib/db/Models/observable-model.d.ts +8 -0
  73. package/lib/db/Models/property/property.d.ts +2 -2
  74. package/lib/db/Models/sole/bas-report.d.ts +2 -1
  75. package/lib/functions/array/index.d.ts +1 -0
  76. package/lib/functions/array/to-array.d.ts +4 -0
  77. package/lib/models/event/app-event.d.ts +9 -0
  78. package/lib/models/property/property.d.ts +2 -0
  79. package/lib/services/event/event-dispatcher.service.d.ts +9 -1
  80. package/lib/services/http/bank/bank-account/bank-account.service.d.ts +1 -1
  81. package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +1 -1
  82. package/lib/services/http/bank/bank-transaction/bank-transaction.service.d.ts +1 -1
  83. package/lib/services/http/bank/bank.service.d.ts +1 -1
  84. package/lib/services/http/bank/basiq/basiq.service.d.ts +1 -1
  85. package/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.d.ts +1 -1
  86. package/lib/services/http/chat/chat.service.d.ts +1 -1
  87. package/lib/services/http/chat/message/message.service.d.ts +1 -1
  88. package/lib/services/http/depreciation/depreciation.service.d.ts +1 -1
  89. package/lib/services/http/document/document-folder/document-folder.service.d.ts +1 -1
  90. package/lib/services/http/document/document.service.d.ts +1 -1
  91. package/lib/services/http/firm/client-invite/client-invite.service.d.ts +1 -1
  92. package/lib/services/http/firm/client-movement/client-movement.service.d.ts +1 -1
  93. package/lib/services/http/firm/employee/employee.service.d.ts +1 -1
  94. package/lib/services/http/firm/employee-invite/employee-invite.service.d.ts +1 -1
  95. package/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.d.ts +1 -1
  96. package/lib/services/http/income-source/income-source.service.d.ts +1 -1
  97. package/lib/services/http/income-source/salary-forecast/salary-forecast.service.d.ts +1 -1
  98. package/lib/services/http/income-source/sole-forecast/sole-forecast.service.d.ts +1 -1
  99. package/lib/services/http/loan/loan.service.d.ts +1 -1
  100. package/lib/services/http/property/property-category/property-category.service.d.ts +1 -1
  101. package/lib/services/http/property/property-category-movement/property-category-movement.service.d.ts +1 -1
  102. package/lib/services/http/property/property-document/property-document.service.d.ts +1 -1
  103. package/lib/services/http/property/property-sale/property-sale.service.d.ts +1 -1
  104. package/lib/services/http/property/property-sale/tax-exemption/tax-exemption.service.d.ts +1 -1
  105. package/lib/services/http/property/property-share/property-share.service.d.ts +1 -1
  106. package/lib/services/http/property/property.service.d.ts +8 -11
  107. package/lib/services/http/rest/http-method.type.d.ts +1 -0
  108. package/lib/services/http/rest/index.d.ts +2 -0
  109. package/lib/services/http/rest/rest-method.type.d.ts +1 -0
  110. package/lib/services/http/rest/rest-old.service.d.ts +110 -0
  111. package/lib/services/http/rest/rest.service.d.ts +71 -62
  112. package/lib/services/http/service-notification/service-notification.service.d.ts +1 -1
  113. package/lib/services/http/sole/bas-report/bas-report.service.d.ts +1 -1
  114. package/lib/services/http/sole/sole-business/sole-business.service.d.ts +1 -1
  115. package/lib/services/http/sole/sole-business-activity/sole-business-activity.service.d.ts +1 -1
  116. package/lib/services/http/sole/sole-business-loss/sole-business-loss-rules/sole-business-loss-offset-rule.service.d.ts +1 -1
  117. package/lib/services/http/sole/sole-business-loss/sole-business-loss.service.d.ts +1 -1
  118. package/lib/services/http/sole/sole-contact/sole-contact.service.d.ts +1 -1
  119. package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +1 -1
  120. package/lib/services/http/sole/sole-invoice-template/sole-invoice-template.service.d.ts +1 -1
  121. package/lib/services/http/subscription/service-price.service.d.ts +1 -1
  122. package/lib/services/http/tax-review/tax-review-history/tax-review-history.service.d.ts +1 -1
  123. package/lib/services/http/tax-review/tax-review.service.d.ts +1 -1
  124. package/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.d.ts +1 -1
  125. package/lib/services/http/transaction/transaction.service.d.ts +1 -1
  126. package/lib/services/http/user/user-event-setting/user-event-setting.service.d.ts +1 -1
  127. package/lib/services/http/user/user-event-type/user-event-type.service.d.ts +1 -1
  128. package/lib/services/http/user/users-invite/users-invite.service.d.ts +1 -1
  129. package/lib/services/http/vehicle/vehicle-claim.service.d.ts +1 -1
  130. package/lib/services/http/vehicle/vehicle-logbook.service.d.ts +1 -1
  131. package/lib/services/http/vehicle/vehicle.service.d.ts +1 -1
  132. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ export * from './collection';
2
+ export * from './property';
1
3
  export * from './vehicle';
2
4
  export * from './sole';
3
5
  export * from './property';
@@ -0,0 +1,8 @@
1
+ import { RestMethod } from "../../services/http/rest";
2
+ import { AbstractModel } from "./abstract-model";
3
+ /**
4
+ * Model, which children should be listened via event dispatcher service ising automatic events
5
+ */
6
+ export declare class ObservableModel extends AbstractModel {
7
+ static getEventName(method: RestMethod): string;
8
+ }
@@ -10,8 +10,8 @@ import { BankAccountProperty } from '../bank/bank-account-property';
10
10
  import { PropertyDocument } from '../document/property-document';
11
11
  import { Depreciation } from '../depreciation/depreciation';
12
12
  import { PropertySubscription } from './property-subscription';
13
- import { AbstractModel } from '../abstract-model';
14
- export declare class Property extends AbstractModel {
13
+ import { ObservableModel } from '../observable-model';
14
+ export declare class Property extends ObservableModel {
15
15
  id?: number;
16
16
  photo?: string;
17
17
  purchasePrice?: number;
@@ -1,5 +1,6 @@
1
+ import { AbstractModel } from '../abstract-model';
1
2
  import { User } from '../user/user';
2
- export declare class BasReport {
3
+ export declare class BasReport extends AbstractModel {
3
4
  dateFrom?: Date;
4
5
  dateTo?: Date;
5
6
  income?: number;
@@ -1,3 +1,4 @@
1
1
  export * from './replace';
2
2
  export * from './sort';
3
3
  export * from './sort-deep';
4
+ export * from './to-array';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Convert single object or array into array
3
+ */
4
+ export declare function toArray<T>(data: T | T[]): T[];
@@ -1,3 +1,4 @@
1
+ import { ObservableModel } from '../../db/Models/observable-model';
1
2
  import { AppEventTypeEnum } from './app-event-type.enum';
2
3
  /**
3
4
  * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
@@ -7,3 +8,11 @@ export declare class AppEvent<T> {
7
8
  payload: T;
8
9
  constructor(type: AppEventTypeEnum, payload: T);
9
10
  }
11
+ /**
12
+ * @TODO Alex (TT-1777): temp name, replace AppEvent or rename this class when all services refactored
13
+ */
14
+ export declare class AppEvent2 {
15
+ name: string;
16
+ items: ObservableModel[];
17
+ constructor(name: string, items: ObservableModel[]);
18
+ }
@@ -14,6 +14,7 @@ import { PropertySale } from './property-sale/property-sale';
14
14
  import { unitOfTime } from 'moment';
15
15
  import { TransactionCollection } from '../../collections/transaction/transaction.collection';
16
16
  import { DepreciationCollection } from '../../collections/depreciation.collection';
17
+ import { PropertyCollection } from '../../collections';
17
18
  /**
18
19
  * propertySale docs - https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4209508353/Property+Sold+button
19
20
  */
@@ -23,6 +24,7 @@ export declare class Property extends PropertyBase implements Photoable, Documen
23
24
  * Any assets acquired before this day are CGT exempt (because the tax didn't exist before this date).
24
25
  */
25
26
  static preCGTAssetDate: Date;
27
+ static collectionClass: typeof PropertyCollection;
26
28
  contractDate: Date;
27
29
  settlementDate: Date;
28
30
  address: Address;
@@ -1,17 +1,25 @@
1
- import { AppEvent } from '../../models/event/app-event';
1
+ import { AppEvent, AppEvent2 } from '../../models/event/app-event';
2
2
  import { AppEventTypeEnum } from '../../models/event/app-event-type.enum';
3
3
  import { Observable } from 'rxjs';
4
+ import { ObservableModel } from '../../db/Models/observable-model';
4
5
  import * as i0 from "@angular/core";
6
+ /**
7
+ * @TODO Alex (TT-1777): replace old logic with the new when all services ready
8
+ * @TODO Alex (TT-1777): rename old logic and keep it for custom events
9
+ */
5
10
  export declare class EventDispatcherService {
6
11
  private eventSubject;
12
+ private eventSubject2;
7
13
  /**
8
14
  * subscription to specific event type
9
15
  */
10
16
  on(eventType: AppEventTypeEnum | AppEventTypeEnum[]): Observable<any>;
17
+ on2(eventName: string): Observable<ObservableModel[]>;
11
18
  /**
12
19
  * deliver new event
13
20
  */
14
21
  dispatch<T>(event: AppEvent<T>): void;
22
+ dispatch2(event: AppEvent2): void;
15
23
  static ɵfac: i0.ɵɵFactoryDeclaration<EventDispatcherService, never>;
16
24
  static ɵprov: i0.ɵɵInjectableDeclaration<EventDispatcherService>;
17
25
  }
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { BankAccount as BankAccountBase } from '../../../../db/Models/bank/bank-account';
3
- import { RestService } from '../../rest/rest.service';
3
+ import { RestService } from '../../rest/rest-old.service';
4
4
  import { BankAccount } from '../../../../models/bank/bank-account';
5
5
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
6
6
  import { BankConnection } from '../../../../models/bank/bank-connection';
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { BankConnection as BankConnectionBase } from '../../../../db/Models/bank/bank-connection';
3
3
  import { BankConnection } from '../../../../models/bank/bank-connection';
4
- import { RestService } from '../../rest/rest.service';
4
+ import { RestService } from '../../rest/rest-old.service';
5
5
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
6
6
  import { UserEventTypeTypeEnum } from '../../../../db/Enums/user-event-type-type.enum';
7
7
  import * as i0 from "@angular/core";
@@ -1,6 +1,6 @@
1
1
  import { BankTransaction as BankTransactionBase } from '../../../../db/Models/bank/bank-transaction';
2
2
  import { Observable } from 'rxjs';
3
- import { RestService } from '../../rest/rest.service';
3
+ import { RestService } from '../../rest/rest-old.service';
4
4
  import { BankTransaction } from '../../../../models/bank/bank-transaction';
5
5
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
6
6
  import * as i0 from "@angular/core";
@@ -1,6 +1,6 @@
1
1
  import { Bank as BankBase } from '../../../db/Models/bank/bank';
2
2
  import { Bank } from '../../../models/bank/bank';
3
- import { RestService } from '../rest/rest.service';
3
+ import { RestService } from '../rest/rest-old.service';
4
4
  import { Observable } from 'rxjs';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { BankAccount as BankAccountBase } from '../../../../db/Models/bank/bank-account';
3
- import { RestService } from '../../rest/rest.service';
3
+ import { RestService } from '../../rest/rest-old.service';
4
4
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
5
5
  import { HttpClient } from '@angular/common/http';
6
6
  import { EventDispatcherService } from '../../../event/event-dispatcher.service';
@@ -1,4 +1,4 @@
1
- import { RestService } from '../../rest/rest.service';
1
+ import { RestService } from '../../rest/rest-old.service';
2
2
  import { ChartAccountsDepreciation as ChartAccountsDepreciationBase } from '../../../../db/Models/chart-accounts/chart-accounts-depreciation';
3
3
  import { Observable } from 'rxjs';
4
4
  import { ChartAccountsDepreciation } from '../../../../models/chart-accounts/chart-accounts-depreciation';
@@ -1,7 +1,7 @@
1
1
  import { Chat as ChatBase } from '../../../db/Models/firm/chat';
2
2
  import { HttpClient } from '@angular/common/http';
3
3
  import { SseService } from '../../event/sse.service';
4
- import { RestService } from '../rest/rest.service';
4
+ import { RestService } from '../rest/rest-old.service';
5
5
  import { Chat } from '../../../models/chat/chat';
6
6
  import { EventDispatcherService } from '../../event/event-dispatcher.service';
7
7
  import { ToastService } from '../../toast/toast.service';
@@ -1,7 +1,7 @@
1
1
  import { Message as MessageBase } from '../../../../db/Models/firm/message';
2
2
  import { HttpClient } from '@angular/common/http';
3
3
  import { Message } from '../../../../models/chat/message';
4
- import { RestService } from '../../rest/rest.service';
4
+ import { RestService } from '../../rest/rest-old.service';
5
5
  import { EventDispatcherService } from '../../../event/event-dispatcher.service';
6
6
  import { SseService } from '../../../event/sse.service';
7
7
  import { ToastService } from '../../../toast/toast.service';
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { Depreciation as DepreciationBase } from '../../../db/Models/depreciation/depreciation';
3
- import { RestService } from '../rest/rest.service';
3
+ import { RestService } from '../rest/rest-old.service';
4
4
  import { Depreciation } from '../../../models/depreciation/depreciation';
5
5
  import { HttpClient } from '@angular/common/http';
6
6
  import { EventDispatcherService } from '../../event/event-dispatcher.service';
@@ -1,7 +1,7 @@
1
1
  import { DocumentFolder as DocumentFolderBase } from '../../../../db/Models/document/document-folder';
2
2
  import { Document } from '../../../../models/document/document';
3
3
  import { Observable } from 'rxjs';
4
- import { RestService } from '../../rest/rest.service';
4
+ import { RestService } from '../../rest/rest-old.service';
5
5
  import { DocumentFolder } from '../../../../models/document/document-folder';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
@@ -1,6 +1,6 @@
1
1
  import { Document as DocumentBase } from '../../../db/Models/document/document';
2
2
  import { Document } from '../../../models';
3
- import { RestService } from '../rest/rest.service';
3
+ import { RestService } from '../rest/rest-old.service';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class DocumentService extends RestService<DocumentBase, Document> {
6
6
  url: string;
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ClientInvite as ClientInviteBase } from '../../../../db/Models/firm/client-invite';
3
- import { RestService } from '../../rest/rest.service';
3
+ import { RestService } from '../../rest/rest-old.service';
4
4
  import { ClientInvite } from '../../../../models/client/client-invite';
5
5
  import { IEventListener } from "../../../../interfaces/event-listener.interface";
6
6
  import * as i0 from "@angular/core";
@@ -2,7 +2,7 @@ import { ClientMovement as ClientMovementBase } from '../../../../db/Models/firm
2
2
  import { Observable } from 'rxjs';
3
3
  import { ClientMovementCollection } from '../../../../collections/client-movement.collection';
4
4
  import { FirmTypeEnum } from '../../../../db/Enums/firm-type.enum';
5
- import { RestService } from '../../rest/rest.service';
5
+ import { RestService } from '../../rest/rest-old.service';
6
6
  import { ClientMovement } from '../../../../models/client/client-movement';
7
7
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
8
8
  import * as i0 from "@angular/core";
@@ -1,4 +1,4 @@
1
- import { RestService } from '../../rest/rest.service';
1
+ import { RestService } from '../../rest/rest-old.service';
2
2
  import { User as UserBase } from '../../../../db/Models/user/user';
3
3
  import { Observable } from 'rxjs';
4
4
  import { User } from '../../../../models/user/user';
@@ -1,7 +1,7 @@
1
1
  import { EmployeeInvite as EmployeeInviteBase } from '../../../../db/Models/firm/employee-invite';
2
2
  import { Observable } from 'rxjs';
3
3
  import { EmployeeInvite } from '../../../../models/employee/employee-invite';
4
- import { RestService } from '../../rest/rest.service';
4
+ import { RestService } from '../../rest/rest-old.service';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class EmployeeInviteService extends RestService<EmployeeInviteBase, EmployeeInvite> {
7
7
  url: string;
@@ -1,5 +1,5 @@
1
1
  import { IncomeSourceForecast as IncomeSourceForecastBase } from '../../../../db/Models/incomeSource/income-source-forecast';
2
- import { RestService } from '../../rest/rest.service';
2
+ import { RestService } from '../../rest/rest-old.service';
3
3
  import { IncomeSourceForecast } from '../../../../models/income-source/income-source-forecast';
4
4
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
5
5
  import * as i0 from "@angular/core";
@@ -1,6 +1,6 @@
1
1
  import { Observable, ReplaySubject } from 'rxjs';
2
2
  import { IncomeSource as IncomeSourceBase } from '../../../db/Models/incomeSource/income-source';
3
- import { RestService } from '../rest/rest.service';
3
+ import { RestService } from '../rest/rest-old.service';
4
4
  import { IncomeSourceType } from '../../../models/income-source/income-source-type';
5
5
  import { SalaryForecast } from '../../../models/income-source/salary-forecast';
6
6
  import { IncomeSourceTypeEnum } from '../../../db/Enums/income-source-type.enum';
@@ -1,5 +1,5 @@
1
1
  import { SalaryForecast as SalaryForecastBase } from '../../../../db/Models/incomeSource/salary-forecast';
2
- import { RestService } from '../../rest/rest.service';
2
+ import { RestService } from '../../rest/rest-old.service';
3
3
  import { SalaryForecast } from '../../../../models/income-source/salary-forecast';
4
4
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
5
5
  import * as i0 from "@angular/core";
@@ -1,5 +1,5 @@
1
1
  import { SoleForecast as SoleForecastBase } from '../../../../db/Models/sole/sole-forecast';
2
- import { RestService } from '../../rest/rest.service';
2
+ import { RestService } from '../../rest/rest-old.service';
3
3
  import { SoleForecast } from '../../../../models/income-source/sole-forecast';
4
4
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
5
5
  import * as i0 from "@angular/core";
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { Loan as LoanBase } from '../../../db/Models/loan/loan';
3
- import { RestService } from '../rest/rest.service';
3
+ import { RestService } from '../rest/rest-old.service';
4
4
  import { Loan } from '../../../models/loan/loan';
5
5
  import { LoanPayout } from '../../../models/loan/loan-payout';
6
6
  import { IEventListener } from '../../../interfaces/event-listener.interface';
@@ -1,5 +1,5 @@
1
1
  import { PropertyCategory as PropertyCategoryBase } from '../../../../db/Models/property/property-category';
2
- import { RestService } from '../../rest/rest.service';
2
+ import { RestService } from '../../rest/rest-old.service';
3
3
  import { PropertyCategory } from '../../../../models/property/property-category';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { PropertyCategoryMovement } from '../../../../models/property/property-category-movement';
2
2
  import { PropertyCategoryMovement as PropertyCategoryMovementBase } from '../../../../db/Models/property/property-category-movement';
3
- import { RestService } from '../../rest/rest.service';
3
+ import { RestService } from '../../rest/rest-old.service';
4
4
  import { Observable } from 'rxjs';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class PropertyCategoryMovementService extends RestService<PropertyCategoryMovementBase, PropertyCategoryMovement> {
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { PropertyDocument as PropertyDocumentBase } from '../../../../db/Models/document/property-document';
3
3
  import { PropertyDocument } from '../../../../models/property/property-document';
4
- import { RestService } from '../../rest/rest.service';
4
+ import { RestService } from '../../rest/rest-old.service';
5
5
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
@@ -1,6 +1,6 @@
1
1
  import { PropertySale as PropertySaleBase } from '../../../../db/Models/property/property-sale/property-sale';
2
2
  import { PropertySale } from '../../../../models/property/property-sale/property-sale';
3
- import { RestService } from '../../rest/rest.service';
3
+ import { RestService } from '../../rest/rest-old.service';
4
4
  import { Observable } from 'rxjs';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class PropertySaleService extends RestService<PropertySaleBase, PropertySale> {
@@ -1,4 +1,4 @@
1
- import { RestService } from '../../../rest/rest.service';
1
+ import { RestService } from '../../../rest/rest-old.service';
2
2
  import { TaxExemption as BaseTaxExemption } from '../../../../../db/Models/property/property-sale/tax-exemption';
3
3
  import { TaxExemption } from '../../../../../models/property/property-sale/tax-exemption';
4
4
  import * as i0 from "@angular/core";
@@ -1,7 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { PropertyShare as PropertyShareBase } from '../../../../db/Models/property/property-share';
3
3
  import { PropertyShare } from '../../../../models/property/property-share';
4
- import { RestService } from '../../rest/rest.service';
4
+ import { RestService } from '../../rest/rest-old.service';
5
5
  import { IEventListener } from '../../../../interfaces/event-listener.interface';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class PropertyShareService extends RestService<PropertyShareBase, PropertyShare> implements IEventListener {
@@ -1,16 +1,20 @@
1
1
  import { Property as PropertyBase } from '../../../db/Models/property/property';
2
2
  import { Observable } from 'rxjs';
3
- import { RestService } from '../rest/rest.service';
4
3
  import { Property } from '../../../models/property/property';
5
4
  import { IEventListener } from '../../../interfaces/event-listener.interface';
5
+ import { RestService } from '../rest/rest.service';
6
+ import { PropertyCollection } from '../../../collections';
6
7
  import * as i0 from "@angular/core";
7
8
  /**
8
9
  * @Todo Alex remove functionality related to PropertyShare
10
+ * @TODO Alex (TT-1777): replace all event listeners with the new this.listen()
9
11
  * Service for work with Property
10
12
  */
11
- export declare class PropertyService extends RestService<PropertyBase, Property> implements IEventListener {
13
+ export declare class PropertyService extends RestService<PropertyBase, Property, PropertyCollection> implements IEventListener {
12
14
  modelClass: typeof Property;
13
- url: string;
15
+ collectionClass: typeof PropertyCollection;
16
+ entityUrl: string;
17
+ post(property: Property): Observable<Property>;
14
18
  listenEvents(): void;
15
19
  /**
16
20
  * Update cache when share invitation accepted
@@ -25,9 +29,7 @@ export declare class PropertyService extends RestService<PropertyBase, Property>
25
29
  */
26
30
  private listenSalesAdded;
27
31
  private listenSalesDeleted;
28
- update(property: Property): Observable<Property>;
29
- updateDepreciationCalculation(property: Property): Observable<Property>;
30
- getByCategoryId(id: number): Observable<Property[]>;
32
+ updateDepreciationCalculation(property: Property): Observable<void>;
31
33
  /**
32
34
  * Activate deactivated property
33
35
  */
@@ -42,11 +44,6 @@ export declare class PropertyService extends RestService<PropertyBase, Property>
42
44
  * @param photoFormData FormData with property photo image
43
45
  */
44
46
  updatePhoto(property: Property, photoFormData: FormData): Observable<void>;
45
- getByShareId(id: number): Observable<Property[]>;
46
- /**
47
- * Get list of active user's properties
48
- */
49
- getActive(): Observable<Property[]>;
50
47
  static ɵfac: i0.ɵɵFactoryDeclaration<PropertyService, never>;
51
48
  static ɵprov: i0.ɵɵInjectableDeclaration<PropertyService>;
52
49
  }
@@ -0,0 +1 @@
1
+ export declare type HttpMethod = 'get' | 'post' | 'put' | 'delete';
@@ -1 +1,3 @@
1
1
  export * from './rest.service';
2
+ export * from './rest-method.type';
3
+ export * from './http-method.type';
@@ -0,0 +1 @@
1
+ export declare type RestMethod = 'get' | 'post' | 'postBatch' | 'put' | 'putBatch' | 'delete' | 'deleteBatch';
@@ -0,0 +1,110 @@
1
+ import { Observable, ReplaySubject } from 'rxjs';
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { EventDispatcherService } from '../../event/event-dispatcher.service';
4
+ import { ToastService } from '../../toast/toast.service';
5
+ import { IEventListener } from '../../../interfaces/event-listener.interface';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Abstract base service that implements common services functionality
9
+ * and describe abstract methods/properties that have to be implemented in child services
10
+ * Model - entity service is working with
11
+ * BaseModel - base entity model that extends by Model
12
+ * @TODO TT-1777 Alex: remove when all services refactored
13
+ */
14
+ export declare abstract class RestService<BaseModel, Model extends BaseModel> implements IEventListener {
15
+ protected http: HttpClient;
16
+ protected eventDispatcherService: EventDispatcherService;
17
+ protected environment: any;
18
+ protected toastService: ToastService;
19
+ abstract url: string;
20
+ abstract modelClass: any;
21
+ protected cache: Model[];
22
+ protected cacheSubject: ReplaySubject<Model[]>;
23
+ protected isHydra: boolean;
24
+ messageCreated: string;
25
+ messageCreatedBatch: string;
26
+ messageUpdated: string;
27
+ messageUpdatedBatch: string;
28
+ messageDeleted: string;
29
+ messageDeletedBatch: string;
30
+ constructor(http: HttpClient, eventDispatcherService: EventDispatcherService, environment: any, toastService: ToastService);
31
+ /**
32
+ * get cached list of all instances
33
+ */
34
+ get(): Observable<Model[]>;
35
+ /**
36
+ * get instance by id from cache
37
+ * @param id ID of required item
38
+ */
39
+ findById(id: number): Observable<Model>;
40
+ find(id: number): Model;
41
+ /**
42
+ * add new instance and update cache
43
+ */
44
+ private create;
45
+ /**
46
+ * @TODO Alex TT-1777 rename to post
47
+ */
48
+ add(model: Model, shouldUpdateCache?: boolean): Observable<Model>;
49
+ /**
50
+ * @TODO Alex TT-1777 rename to upload
51
+ */
52
+ postForm(file: File, params?: {
53
+ [key: string]: string;
54
+ }): Observable<Model>;
55
+ /**
56
+ * Add several new items
57
+ * @param models Array of new items for saving
58
+ * @param queryParams query parameters for request
59
+ * @TODO Alex TT-1777 rename to postBatch
60
+ */
61
+ addBatch(models: Model[], queryParams?: object): Observable<Model[]>;
62
+ /**
63
+ * Update item
64
+ * @param model Existing instance for updating
65
+ * @param queryParams query parameters for request
66
+ * @TODO Alex TT-1777 rename to put
67
+ */
68
+ update(model: Model, queryParams?: object): Observable<Model>;
69
+ /**
70
+ * Update several items
71
+ * @param models Array of items for updating
72
+ * @param queryParams query parameters for request
73
+ * TODO Alex TT-1777 rename to putBatch
74
+ */
75
+ updateBatch(models: Model[], queryParams?: object): Observable<Model[]>;
76
+ /**
77
+ * delete instance of class
78
+ * @param model Class instance for deleting
79
+ */
80
+ delete(model: Model): Observable<void>;
81
+ /**
82
+ * delete multiple instances of class
83
+ * @param models Class instances array for deleting
84
+ */
85
+ deleteBatch(models: Model[]): Observable<void>;
86
+ /**
87
+ * clear service cache
88
+ */
89
+ resetCache(): void;
90
+ /**
91
+ * get list of base class instances directly from backend
92
+ */
93
+ protected fetch(): Observable<Model[]>;
94
+ /**
95
+ * Update cache subject with current cache array value
96
+ */
97
+ protected updateCache(): void;
98
+ /**
99
+ * Create new instance of class
100
+ * @param model The class for which you want to create an instance
101
+ * @param baseModel base model instance that we will use as constructor options
102
+ */
103
+ protected createModelInstance(model: new (bm: BaseModel) => Model, baseModel: BaseModel): Model;
104
+ /**
105
+ * Method that call all listeners. Empty by default. Should be redefined by child services if required
106
+ */
107
+ listenEvents(): void;
108
+ static ɵfac: i0.ɵɵFactoryDeclaration<RestService<any, any>, never>;
109
+ static ɵprov: i0.ɵɵInjectableDeclaration<RestService<any, any>>;
110
+ }