taxtank-core 0.33.16 → 0.33.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/esm2022/src/lib/collections/sole/index.mjs +2 -2
  2. package/esm2022/src/lib/collections/sole/sole-business-loss.collection.mjs +41 -0
  3. package/esm2022/src/lib/db/Models/sole/sole-details.mjs +3 -3
  4. package/esm2022/src/lib/forms/holding/holding-reinvest.form.mjs +2 -2
  5. package/esm2022/src/lib/forms/property/property-add.form.mjs +7 -3
  6. package/esm2022/src/lib/forms/report/my-tax/my-tax-partnerships-and-trusts.form.mjs +1 -1
  7. package/esm2022/src/lib/models/event/app-event-type.enum.mjs +15 -17
  8. package/esm2022/src/lib/models/report/my-tax/my-tax-business-income-or-losses/my-tax-business-losses/my-tax-business-losses.mjs +1 -1
  9. package/esm2022/src/lib/models/report/my-tax/my-tax-losses/my-tax-losses.mjs +1 -1
  10. package/esm2022/src/lib/models/transaction/allocation-rule-transaction.mjs +1 -1
  11. package/esm2022/src/lib/services/http/bank/basiq/basiq.service.mjs +2 -1
  12. package/esm2022/src/lib/services/http/property/property-category-movement/property-category-movement.service.mjs +1 -1
  13. package/esm2022/src/lib/services/http/sole/sole-business-loss/sole-business-loss.service.mjs +8 -3
  14. package/esm2022/src/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.mjs +3 -3
  15. package/esm2022/src/lib/services/http/sole/sole-details/sole-details.service.mjs +16 -47
  16. package/esm2022/src/lib/validators/date/max-date.validator.mjs +17 -0
  17. package/esm2022/src/lib/validators/date/min-date.validator.mjs +17 -0
  18. package/esm2022/src/lib/validators/index.mjs +3 -2
  19. package/fesm2022/taxtank-core.mjs +57 -71
  20. package/fesm2022/taxtank-core.mjs.map +1 -1
  21. package/package.json +1 -1
  22. package/src/lib/collections/sole/index.d.ts +1 -1
  23. package/src/lib/collections/sole/{sole-business-losses.collection.d.ts → sole-business-loss.collection.d.ts} +1 -1
  24. package/src/lib/db/Models/sole/sole-details.d.ts +2 -2
  25. package/src/lib/forms/report/my-tax/my-tax-partnerships-and-trusts.form.d.ts +1 -1
  26. package/src/lib/models/event/app-event-type.enum.d.ts +14 -16
  27. package/src/lib/models/report/my-tax/my-tax-business-income-or-losses/my-tax-business-losses/my-tax-business-losses.d.ts +2 -2
  28. package/src/lib/models/report/my-tax/my-tax-losses/my-tax-losses.d.ts +2 -2
  29. package/src/lib/services/http/bank/basiq/basiq.service.d.ts +1 -0
  30. package/src/lib/services/http/sole/sole-business-loss/sole-business-loss.service.d.ts +8 -3
  31. package/src/lib/services/http/sole/sole-details/sole-details.service.d.ts +12 -13
  32. package/src/lib/validators/date/max-date.validator.d.ts +5 -0
  33. package/src/lib/validators/index.d.ts +2 -1
  34. package/esm2022/src/lib/collections/sole/sole-business-losses.collection.mjs +0 -41
  35. package/esm2022/src/lib/validators/min-date/messages.enum.mjs +0 -5
  36. package/esm2022/src/lib/validators/min-date/min-date.validator.mjs +0 -18
  37. package/src/lib/validators/min-date/messages.enum.d.ts +0 -3
  38. /package/src/lib/validators/{min-date → date}/min-date.validator.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.33.16",
3
+ "version": "0.33.18",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^17.0.0",
@@ -1,3 +1,3 @@
1
- export * from './sole-business-losses.collection';
1
+ export * from './sole-business-loss.collection';
2
2
  export * from './sole-invoice-item.collection';
3
3
  export * from './sole-invoice.collection';
@@ -1,7 +1,7 @@
1
1
  import { Collection } from '../collection';
2
2
  import { SoleBusinessLoss } from '../../models';
3
3
  import { TransactionCollection } from '../transaction';
4
- export declare class SoleBusinessLossesCollection extends Collection<SoleBusinessLoss> {
4
+ export declare class SoleBusinessLossCollection extends Collection<SoleBusinessLoss> {
5
5
  /**
6
6
  * Business loss applied in current year, includes previous year losses and current year losses for businesses matching offset rule
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import { User } from '../user/user';
2
- import { AbstractModel } from '../abstract-model';
3
2
  import { AnnualFrequencyEnum } from '../../Enums';
4
- export declare class SoleDetails extends AbstractModel {
3
+ import { ObservableModel } from '../observable-model';
4
+ export declare class SoleDetails extends ObservableModel {
5
5
  abn?: string;
6
6
  isGST?: boolean;
7
7
  createdAt?: Date;
@@ -1,5 +1,5 @@
1
1
  import { AbstractForm } from '../../abstract.form';
2
- import { MyTaxPartnershipsAndTrusts } from '../../../models/report/my-tax';
2
+ import { MyTaxPartnershipsAndTrusts } from '../../../models/report';
3
3
  export declare class MyTaxPartnershipsAndTrustsForm extends AbstractForm<MyTaxPartnershipsAndTrusts> {
4
4
  constructor(partnershipsAndTrusts: MyTaxPartnershipsAndTrusts);
5
5
  }
@@ -42,20 +42,18 @@ export declare enum AppEventTypeEnum {
42
42
  PROPERTY_SUBSCRIPTION_DELETED = 37,
43
43
  PROPERTY_VALUATION_DOCUMENT_CREATED = 38,
44
44
  SOLE_DEPRECIATION_METHOD_UPDATED = 39,
45
- SOLE_DETAILS_CREATED = 40,
46
- SOLE_DETAILS_UPDATED = 41,
47
- SOLE_INVOICE_PUBLISHED = 42,
48
- TAX_REVIEW_UPDATED = 43,
49
- TRANSACTION_ALLOCATION_CREATED = 44,
50
- TRANSACTION_ALLOCATION_DELETED = 45,
51
- TRANSACTION_CREATED = 46,
52
- TRANSACTION_DELETED = 47,
53
- TRANSACTION_UPDATED = 48,
54
- TRANSACTIONS_CREATED = 49,
55
- VEHICLE_CLAIM_DETAILS_UPDATED = 50,
56
- VEHICLE_CLAIM_DETAILS_CREATED = 51,
57
- VEHICLE_LOGBOOK_CREATED = 52,
58
- VEHICLE_LOGBOOK_UPDATED = 53,
59
- VEHICLE_LOGBOOK_DELETED = 54,
60
- VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 55
45
+ SOLE_INVOICE_PUBLISHED = 40,
46
+ TAX_REVIEW_UPDATED = 41,
47
+ TRANSACTION_ALLOCATION_CREATED = 42,
48
+ TRANSACTION_ALLOCATION_DELETED = 43,
49
+ TRANSACTION_CREATED = 44,
50
+ TRANSACTION_DELETED = 45,
51
+ TRANSACTION_UPDATED = 46,
52
+ TRANSACTIONS_CREATED = 47,
53
+ VEHICLE_CLAIM_DETAILS_UPDATED = 48,
54
+ VEHICLE_CLAIM_DETAILS_CREATED = 49,
55
+ VEHICLE_LOGBOOK_CREATED = 50,
56
+ VEHICLE_LOGBOOK_UPDATED = 51,
57
+ VEHICLE_LOGBOOK_DELETED = 52,
58
+ VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 53
61
59
  }
@@ -1,6 +1,6 @@
1
1
  import { DepreciationCollection, TransactionCollection } from '../../../../../collections';
2
2
  import { SoleBusinessLoss } from '../../../../sole';
3
- import { SoleBusinessLossesCollection } from '../../../../../collections';
3
+ import { SoleBusinessLossCollection } from '../../../../../collections';
4
4
  import { TaxSummary } from '../../../../tax-summary/tax-summary';
5
5
  /**
6
6
  * Sole business information related to expense transactions (losses)
@@ -27,5 +27,5 @@ export declare class MyTaxBusinessLosses {
27
27
  netNonPrimaryIncomeOrLossesAmount: number;
28
28
  currentYearNetNonPrimaryIncomeOrLossesAmount: number;
29
29
  deferredLossesAmount: number;
30
- constructor(transactions: TransactionCollection, depreciations: DepreciationCollection, businessLosses: SoleBusinessLossesCollection, currentLoss: SoleBusinessLoss, taxSummary: TaxSummary);
30
+ constructor(transactions: TransactionCollection, depreciations: DepreciationCollection, businessLosses: SoleBusinessLossCollection, currentLoss: SoleBusinessLoss, taxSummary: TaxSummary);
31
31
  }
@@ -1,4 +1,4 @@
1
- import { SoleBusinessLossesCollection, TransactionCollection } from '../../../../collections';
1
+ import { SoleBusinessLossCollection, TransactionCollection } from '../../../../collections';
2
2
  /**
3
3
  * Sole business losses report
4
4
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Losses" section)
@@ -12,5 +12,5 @@ export declare class MyTaxLosses {
12
12
  * Losses applied to the current year (until profit gets to $0)
13
13
  */
14
14
  businessLossApplied: number;
15
- constructor(businessLosses: SoleBusinessLossesCollection, transactions: TransactionCollection);
15
+ constructor(businessLosses: SoleBusinessLossCollection, transactions: TransactionCollection);
16
16
  }
@@ -77,6 +77,7 @@ export declare class BasiqService extends RestService<BankAccountBase, BankAccou
77
77
  */
78
78
  retrieveJob(jobId: string): Observable<BasiqJobResponse>;
79
79
  /**
80
+ * @TODO not used, remove?
80
81
  * Recoursive method, watch basiq job retrieve accounts status
81
82
  * @param jobId id of basiq job to check
82
83
  * @returns observable boolean. True - accounts retrieved, false - accounts not retrieved (time is out)
@@ -1,12 +1,17 @@
1
- import { RestService } from '../../rest/rest-old.service';
2
1
  import { SoleBusinessLoss as SoleBusinessLossBase } from '../../../../db/Models/sole/sole-business-loss';
3
2
  import { SoleBusinessLoss } from '../../../../models';
4
3
  import { IEventListener } from '../../../../interfaces';
4
+ import { SoleBusinessLossCollection } from '../../../../collections';
5
+ import { RestMethod, RestService } from '../../rest';
6
+ import { UserRolesEnum } from 'taxtank-core/common';
5
7
  import * as i0 from "@angular/core";
6
- export declare class SoleBusinessLossService extends RestService<SoleBusinessLossBase, SoleBusinessLoss> implements IEventListener {
8
+ export declare class SoleBusinessLossService extends RestService<SoleBusinessLossBase, SoleBusinessLoss, SoleBusinessLossCollection> implements IEventListener {
7
9
  protected environment: any;
8
10
  modelClass: typeof SoleBusinessLoss;
9
- url: string;
11
+ collectionClass: typeof SoleBusinessLossCollection;
12
+ endpointUri: string;
13
+ disabledMethods: RestMethod[];
14
+ roles: UserRolesEnum[];
10
15
  constructor(environment: any);
11
16
  listenEvents(): void;
12
17
  /**
@@ -1,21 +1,20 @@
1
1
  import { SoleDetails } from '../../../../models';
2
- import { Observable, ReplaySubject } from 'rxjs';
3
- import { HttpClient } from '@angular/common/http';
4
- import { EventDispatcherService } from '../../../event';
2
+ import { SoleDetails as SoleDetailsBase } from '../../../../db/Models/sole/sole-details';
3
+ import { RestMethod, RestService } from '../../rest';
4
+ import { Collection } from '../../../../collections';
5
+ import { UserRolesEnum } from 'taxtank-core/common';
6
+ import { Observable } from 'rxjs';
5
7
  import * as i0 from "@angular/core";
6
8
  /**
7
9
  * @TODO TT-1777 Alex: extend from rest service when it refactored
8
10
  */
9
- export declare class SoleDetailsService {
10
- private http;
11
- protected environment: any;
12
- private eventDispatcherService;
13
- cache: SoleDetails;
14
- cacheSubject: ReplaySubject<SoleDetails>;
15
- constructor(http: HttpClient, environment: any, eventDispatcherService: EventDispatcherService);
16
- get(): Observable<SoleDetails>;
17
- add(soleDetails: SoleDetails): Observable<SoleDetails>;
18
- update(soleDetails: SoleDetails): Observable<SoleDetails>;
11
+ export declare class SoleDetailsService extends RestService<SoleDetailsBase, SoleDetails, Collection<SoleDetails>> {
12
+ modelClass: typeof SoleDetails;
13
+ collectionClass: typeof Collection;
14
+ endpointUri: string;
15
+ disabledMethods: RestMethod[];
16
+ roles: UserRolesEnum[];
17
+ get(): Observable<Collection<SoleDetails>>;
19
18
  static ɵfac: i0.ɵɵFactoryDeclaration<SoleDetailsService, never>;
20
19
  static ɵprov: i0.ɵɵInjectableDeclaration<SoleDetailsService>;
21
20
  }
@@ -0,0 +1,5 @@
1
+ import { ValidatorFn } from '@angular/forms';
2
+ /**
3
+ * Validation function, that checks If date form value is more than provided date
4
+ */
5
+ export declare function maxDateValidator(date: Date, message?: string): ValidatorFn;
@@ -3,7 +3,8 @@ export * from './autocomplete.validator';
3
3
  export * from './conditional.validator';
4
4
  export * from './password.validator';
5
5
  export * from './password-match.validator';
6
- export * from './min-date/min-date.validator';
6
+ export * from './date/min-date.validator';
7
+ export * from './date/max-date.validator';
7
8
  export * from './fields-sum.validator';
8
9
  export * from './current-fin-year.validator';
9
10
  export * from './file.validator';
@@ -1,41 +0,0 @@
1
- import { Collection } from '../collection';
2
- import { Dictionary } from '../../models';
3
- export class SoleBusinessLossesCollection extends Collection {
4
- /**
5
- * Business loss applied in current year, includes previous year losses and current year losses for businesses matching offset rule
6
- */
7
- calculateBusinessLossApplied(transactions) {
8
- // claim amounts for businesses that can be applied to be reduced by prior year business losses
9
- const claimAmountsByBusinessId = this.getClaimAmountsByBusinessId(transactions);
10
- return Object.keys(claimAmountsByBusinessId.items).reduce((sum, businessId) => {
11
- const loss = this.findBy('business.id', +businessId);
12
- const lossOpenBalance = loss?.openBalance || 0;
13
- // business loss can be applied to business profit or other income types profit in case in offset rule met
14
- return sum + (loss?.offsetRule ? lossOpenBalance : Math.min(lossOpenBalance, claimAmountsByBusinessId.get(businessId)));
15
- }, 0);
16
- }
17
- /**
18
- * Get business claim amounts that can be applied to be reduced by prior year business losses:
19
- * businesses with income or businesses with a loss, but which met the non-commercial loss rules
20
- * https://www.ato.gov.au/Business/Non-commercial-losses/
21
- */
22
- getClaimAmountsByBusinessId(transactions) {
23
- const claimAmountsByBusinessId = new Dictionary([]);
24
- const transactionsByBusinessId = transactions.groupBy('business.id');
25
- transactionsByBusinessId.keys.forEach((businessId) => {
26
- // business loss may not exist if, when creating a business, user didn't add losses for previous years
27
- const lossOffsetRule = this.findBy('business.id', +businessId)?.offsetRule;
28
- const businessClaimAmount = transactionsByBusinessId
29
- .get(businessId)
30
- .getBusinessClaimAmount(+businessId);
31
- // @TODO vik it has nothing to do with getClaimAmountsByBusinessId
32
- // no way to apply loss for business without profit if offset rules not met
33
- if (businessClaimAmount < 0 && !lossOffsetRule) {
34
- return;
35
- }
36
- claimAmountsByBusinessId.add(businessId, businessClaimAmount);
37
- });
38
- return claimAmountsByBusinessId;
39
- }
40
- }
41
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic29sZS1idXNpbmVzcy1sb3NzZXMuY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3R0LWNvcmUvc3JjL2xpYi9jb2xsZWN0aW9ucy9zb2xlL3NvbGUtYnVzaW5lc3MtbG9zc2VzLmNvbGxlY3Rpb24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1cbn1cbiJdfQ==
@@ -1,5 +0,0 @@
1
- export var MessagesEnum;
2
- (function (MessagesEnum) {
3
- MessagesEnum["INVALID_DATE"] = "The date should not be before $1";
4
- })(MessagesEnum || (MessagesEnum = {}));
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZXMuZW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3R0LWNvcmUvc3JjL2xpYi92YWxpZGF0b3JzL21pbi1kYXRlL21lc3NhZ2VzLmVudW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFOLElBQVksWUFFWDtBQUZELFdBQVksWUFBWTtJQUN0QixpRUFBaUQsQ0FBQTtBQUNuRCxDQUFDLEVBRlcsWUFBWSxLQUFaLFlBQVksUUFFdkIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZW51bSBNZXNzYWdlc0VudW0ge1xuICBJTlZBTElEX0RBVEUgPSBgVGhlIGRhdGUgc2hvdWxkIG5vdCBiZSBiZWZvcmUgJDFgXG59XG4iXX0=
@@ -1,18 +0,0 @@
1
- import { MessagesEnum } from './messages.enum';
2
- import { DatePipe } from '@angular/common';
3
- /**
4
- * Validation function, that checks If date form value is more than provided date
5
- */
6
- export function minDateValidator(date, message = MessagesEnum.INVALID_DATE.replace('$1', new DatePipe('en-US').transform(date))) {
7
- return (control) => {
8
- if (!control.value) {
9
- return null;
10
- }
11
- // form control value can be as a Moment object - we wrap it in "new Date()" to work with it like with JS Date
12
- if (new Date(control.value) >= new Date(date)) {
13
- return null;
14
- }
15
- return { minDate: message };
16
- };
17
- }
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWluLWRhdGUudmFsaWRhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4v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GUgfSBmcm9tICdAYW5ndWxhci9jb21tb24nO1xuXG4vKipcbiAqIFZhbGlkYXRpb24gZnVuY3Rpb24sIHRoYXQgY2hlY2tzIElmIGRhdGUgZm9ybSB2YWx1ZSBpcyBtb3JlIHRoYW4gcHJvdmlkZWQgZGF0ZVxuICovXG5leHBvcnQgZnVuY3Rpb24gbWluRGF0ZVZhbGlkYXRvcihcbiAgZGF0ZTogRGF0ZSxcbiAgbWVzc2FnZTogc3RyaW5nID0gTWVzc2FnZXNFbnVtLklOVkFMSURfREFURS5yZXBsYWNlKCckMScsIG5ldyBEYXRlUGlwZSgnZW4tVVMnKS50cmFuc2Zvcm0oZGF0ZSkpXG4pOiBWYWxpZGF0b3JGbiB7XG4gIHJldHVybiAoY29udHJvbDogQWJzdHJhY3RDb250cm9sKTogVmFsaWRhdGlvbkVycm9ycyA9PiB7XG4gICAgaWYgKCFjb250cm9sLnZhbHVlKSB7XG4gICAgICByZXR1cm4gbnVsbDtcbiAgICB9XG5cbiAgICAvLyBmb3JtIGNvbnRyb2wgdmFsdWUgY2FuIGJlIGFzIGEgTW9tZW50IG9iamVjdCAtIHdlIHdyYXAgaXQgaW4gXCJuZXcgRGF0ZSgpXCIgdG8gd29yayB3aXRoIGl0IGxpa2Ugd2l0aCBKUyBEYXRlXG4gICAgaWYgKG5ldyBEYXRlKGNvbnRyb2wudmFsdWUpID49IG5ldyBEYXRlKGRhdGUpKSB7XG4gICAgICByZXR1cm4gbnVsbDtcbiAgICB9XG5cbiAgICByZXR1cm4ge21pbkRhdGU6IG1lc3NhZ2V9O1xuICB9O1xufVxuIl19
@@ -1,3 +0,0 @@
1
- export declare enum MessagesEnum {
2
- INVALID_DATE = "The date should not be before $1"
3
- }