@lendi/integrations-transform 1.2.0 → 1.2.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.
Files changed (42) hide show
  1. package/lib/index.d.ts +3 -1
  2. package/lib/index.js +3 -1
  3. package/lib/schemas/public-asset-event.json +86 -93
  4. package/lib/transform-events/generate-liability.js +2 -2
  5. package/lib/transform-events/transform-applicant.js +5 -8
  6. package/lib/transform-events/transform-application.js +3 -4
  7. package/lib/transform-events/transform-asset-address.d.ts +19 -0
  8. package/lib/transform-events/transform-asset-address.js +83 -0
  9. package/lib/transform-events/transform-asset.d.ts +28 -0
  10. package/lib/transform-events/transform-asset.js +203 -0
  11. package/lib/transform-events/transform-expenses.js +3 -4
  12. package/lib/transform-events/{generate-income.d.ts → transform-income.d.ts} +9 -5
  13. package/lib/transform-events/{generate-income.js → transform-income.js} +39 -15
  14. package/lib/transform-events/{generate-lixi-percentowned.d.ts → transform-percent-owned.d.ts} +1 -1
  15. package/lib/transform-events/{generate-lixi-percentowned.js → transform-percent-owned.js} +5 -4
  16. package/lib/types/enum-mappings/asset-type.d.ts +3 -0
  17. package/lib/types/enum-mappings/asset-type.js +18 -0
  18. package/lib/types/enum-mappings/funding-position.d.ts +1 -1
  19. package/lib/types/enum-mappings/funding-position.js +2 -2
  20. package/lib/types/enum-mappings/income-type.d.ts +2 -2
  21. package/lib/types/enum-mappings/income-type.js +2 -2
  22. package/lib/types/enum-mappings/index.d.ts +26 -0
  23. package/lib/types/enum-mappings/index.js +38 -0
  24. package/lib/types/enum-mappings/public-property-type.d.ts +2 -2
  25. package/lib/types/enum-mappings/public-property-type.js +2 -2
  26. package/lib/types/enum-mappings/to-be-purchased.d.ts +5 -0
  27. package/lib/types/enum-mappings/to-be-purchased.js +8 -0
  28. package/lib/types/enum-mappings/to-be-used-as-security.d.ts +5 -0
  29. package/lib/types/enum-mappings/to-be-used-as-security.js +8 -0
  30. package/lib/types/events/public-asset.d.ts +16 -17
  31. package/lib/types/events/public-asset.js +3 -0
  32. package/lib/update-application/merge-application.d.ts +8 -0
  33. package/lib/update-application/merge-application.js +132 -0
  34. package/lib/utils/address-tools.d.ts +14 -1
  35. package/lib/utils/address-tools.js +35 -3
  36. package/lib/utils/generate-address.d.ts +3 -4
  37. package/lib/utils/generate-address.js +8 -9
  38. package/lib/utils/is-asset-type.d.ts +25 -0
  39. package/lib/utils/is-asset-type.js +46 -0
  40. package/package.json +3 -3
  41. package/lib/transform-events/generate-asset.d.ts +0 -17
  42. package/lib/transform-events/generate-asset.js +0 -178
@@ -0,0 +1,5 @@
1
+ import { YesNoList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
2
+ export interface ToBeUsedAsSecurityMapping {
3
+ [key: string]: YesNoList;
4
+ }
5
+ export declare const toBeUsedAsSecurityMapping: ToBeUsedAsSecurityMapping;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.toBeUsedAsSecurityMapping = void 0;
4
+ var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
5
+ exports.toBeUsedAsSecurityMapping = {
6
+ "true": lixi_internal_request_1.YesNoList.Yes,
7
+ "false": lixi_internal_request_1.YesNoList.No
8
+ };
@@ -1,18 +1,18 @@
1
1
  /**
2
- * Create, update or delete
2
+ * Create or update
3
3
  */
4
4
  export interface PublicAsset {
5
- payload: AssetDefinition;
6
- type: Type;
5
+ payload: Payload;
7
6
  /**
8
7
  * schema version
9
8
  */
9
+ type: Type;
10
10
  version: string;
11
11
  }
12
12
  /**
13
- * create/update Asset payload
13
+ * create Asset payload
14
14
  */
15
- export interface AssetDefinition {
15
+ export interface Payload {
16
16
  applicationId: string;
17
17
  asset: Asset;
18
18
  /**
@@ -26,9 +26,12 @@ export interface Asset {
26
26
  constructionDetails?: ConstructionDetails;
27
27
  contractDetails?: ContractDetails;
28
28
  contractPriceAmount?: number;
29
+ dataType?: string;
29
30
  description?: string;
30
31
  estimatedValue?: number;
31
32
  financialInstitution?: string;
33
+ financialInstitutionAccountNumber?: string;
34
+ financialInstitutionBsb?: string;
32
35
  financialInstitutionShortName?: string;
33
36
  knockDownToRebuild?: boolean;
34
37
  make?: string;
@@ -37,6 +40,7 @@ export interface Asset {
37
40
  primaryPurpose?: PrimaryPurpose;
38
41
  propertyStatus?: PropertyStatus;
39
42
  propertyType?: PropertyType;
43
+ relationId?: string;
40
44
  toBePurchased?: boolean;
41
45
  toBeSold?: boolean;
42
46
  toBeUsedAsSecurity?: boolean;
@@ -46,7 +50,7 @@ export interface Asset {
46
50
  }
47
51
  export interface Address {
48
52
  /**
49
- * The city / suburb name
53
+ * The suburb name
50
54
  */
51
55
  city?: string;
52
56
  country?: Countries;
@@ -55,12 +59,12 @@ export interface Address {
55
59
  */
56
60
  formatted?: string;
57
61
  /**
58
- * N digit postcode (for AU addresses, usually 4)
62
+ * A 4 digit postcode
59
63
  */
60
64
  postcode?: string;
61
65
  standard?: AddressStandard;
62
66
  /**
63
- * The state name
67
+ * One our great nation's states
64
68
  */
65
69
  state?: string;
66
70
  }
@@ -310,10 +314,6 @@ export interface AddressStandard {
310
314
  * The building name
311
315
  */
312
316
  buildingName?: string;
313
- /**
314
- * Postal address, usually a PO Box or Locked Bag
315
- */
316
- deliveryAddress?: string;
317
317
  /**
318
318
  * The level of the unit/apartment
319
319
  */
@@ -330,10 +330,6 @@ export interface AddressStandard {
330
330
  * The street number
331
331
  */
332
332
  streetNumber?: string;
333
- /**
334
- * The street suffix
335
- */
336
- streetSuffix?: string;
337
333
  /**
338
334
  * The type of the street i.e. road
339
335
  */
@@ -370,7 +366,7 @@ export interface ContractDetails {
370
366
  estimatedSettlementDate?: string;
371
367
  }
372
368
  export interface PercentOwned {
373
- owners?: ApplicantOwnership[];
369
+ owners: ApplicantOwnership[];
374
370
  /**
375
371
  * Indicate whether ownership proportions are equal, specified individually for each one or
376
372
  * not specified.
@@ -463,6 +459,9 @@ export declare enum ActionedByRole {
463
459
  Customer = "customer",
464
460
  Team = "team"
465
461
  }
462
+ /**
463
+ * schema version
464
+ */
466
465
  export declare enum Type {
467
466
  AssetCreated = "AssetCreated",
468
467
  AssetUpdated = "AssetUpdated"
@@ -312,6 +312,9 @@ var ActionedByRole;
312
312
  ActionedByRole["Customer"] = "customer";
313
313
  ActionedByRole["Team"] = "team";
314
314
  })(ActionedByRole = exports.ActionedByRole || (exports.ActionedByRole = {}));
315
+ /**
316
+ * schema version
317
+ */
315
318
  var Type;
316
319
  (function (Type) {
317
320
  Type["AssetCreated"] = "AssetCreated";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Deep merges the application and custom handles specific arrays
3
+ *
4
+ * @param newApplication new application coming from events.
5
+ * @param existingApplication a saved dynamo application.
6
+ * @return merged application.
7
+ */
8
+ export declare function deepMergeApplication(existingApplication: object | undefined, newApplication: object): any;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.deepMergeApplication = void 0;
4
+ var merge = require("deepmerge");
5
+ var cleanDeep = require('clean-deep');
6
+ /**
7
+ * Deep merges the application and custom handles specific arrays
8
+ *
9
+ * @param newApplication new application coming from events.
10
+ * @param existingApplication a saved dynamo application.
11
+ * @return merged application.
12
+ */
13
+ function deepMergeApplication(existingApplication, newApplication) {
14
+ // Array fields with @UniqueIDs
15
+ var listsWithUniqueIds = [
16
+ 'Attachment',
17
+ 'Address',
18
+ 'CompanyApplicant',
19
+ 'Dependant',
20
+ 'Liability',
21
+ 'LivingExpense',
22
+ 'LoanDetails',
23
+ 'NonRealEstateAsset',
24
+ 'OtherCommitment',
25
+ 'OtherIncome',
26
+ 'PersonApplicant',
27
+ 'RealEstateAsset',
28
+ 'RelatedCompany',
29
+ 'RelatedPerson',
30
+ ];
31
+ // Array fields with @x_Party
32
+ var listsWithXParty = ['Report'];
33
+ // Array fields with @x_Owner
34
+ var listsWithXOwner = ['RentalIncome'];
35
+ // Array fields with @x_Applicant
36
+ var listsWithXApplicant = ['Applicant'];
37
+ // Array fields with @x_ResidentialAddress
38
+ var listsWithXResidentialAddress = ['PriorAddress'];
39
+ // Curried function which takes a uniqueKey and returns a function which will either replace
40
+ // or merge the item in the array based on the uniqueKey
41
+ if (!existingApplication) {
42
+ return newApplication;
43
+ }
44
+ var mergeItems = function (uniqueKey) {
45
+ return function (existingItem, newItem) {
46
+ // if not array continue with merge
47
+ if (!Array.isArray(newItem)) {
48
+ return merge(existingItem, newItem, options);
49
+ }
50
+ return findArrayItemAndMerge(existingItem, newItem, uniqueKey, options);
51
+ };
52
+ };
53
+ var options = {
54
+ customMerge: function (key) {
55
+ if (listsWithUniqueIds.find(function (item) { return item === key; })) {
56
+ return mergeItems('@UniqueID');
57
+ }
58
+ if (listsWithXParty.find(function (item) { return item === key; })) {
59
+ return mergeItems('@x_Party');
60
+ }
61
+ if (listsWithXOwner.find(function (item) { return item === key; })) {
62
+ return mergeItems('@x_Owner');
63
+ }
64
+ if (listsWithXResidentialAddress.find(function (item) { return item === key; })) {
65
+ return mergeItems('@x_ResidentialAddress');
66
+ }
67
+ if (listsWithXApplicant.find(function (item) { return item === key; })) {
68
+ return mergeItems('@x_Applicant');
69
+ }
70
+ return mergeItems(key);
71
+ }
72
+ };
73
+ var mergedApplication = merge(existingApplication, newApplication, options);
74
+ // Default configurations of cleanDeep for reference.
75
+ var params = {
76
+ cleanValues: [],
77
+ emptyArrays: true,
78
+ emptyObjects: true,
79
+ emptyStrings: true,
80
+ NaNValues: true,
81
+ nullValues: true,
82
+ undefinedValues: true
83
+ };
84
+ return cleanDeep(mergedApplication, params);
85
+ }
86
+ exports.deepMergeApplication = deepMergeApplication;
87
+ var arrayItemToReplaceKeys = ['Owner', 'Attendee', 'Shareholder', 'Fee', 'ContributionFunds', 'RentalIncome'];
88
+ function findArrayItemAndMerge(existingItem, newItem, uniqueKey, options) {
89
+ // For some Key, overwritten the old value with the new data so no merge is happening.
90
+ if (arrayItemToReplaceKeys.includes(uniqueKey))
91
+ return newItem;
92
+ if (uniqueKey === 'Income' && existingItem && existingItem.some(function (item) { return item['@StartDate']; })) {
93
+ // Income array in CompanyApplicant
94
+ return newItem;
95
+ }
96
+ // Copying existing array
97
+ var mergedArray = existingItem.slice();
98
+ // Searching whether item in the new array exists in existing array
99
+ newItem.forEach(function (item) {
100
+ var indexOfItem = mergedArray.findIndex(function (existingItem) {
101
+ // TODO [CORE-2160] how to identify employment without go a level down.
102
+ // Employment needs to go one level deeper to check if the @UniqueID already exist.
103
+ if (uniqueKey === 'Employment') {
104
+ var currentEmploymentKeys = Object.keys(item);
105
+ var existingEmploymentKeys = Object.keys(existingItem);
106
+ if (currentEmploymentKeys.length && existingEmploymentKeys.length) {
107
+ // Get the unique id from the field with proper value for current employment. The types with undefined value
108
+ // are present in order to remove the related types from existing application. These undefined types will be
109
+ // removed from payload immediately after deep merging.
110
+ // @pliu 19/11/19
111
+ var currentEmployment = currentEmploymentKeys.find(function (key) { return item[key]; });
112
+ // Each employment can only have one of three types.
113
+ // @pliu 19/11/19
114
+ var existingEmployment = existingEmploymentKeys[0];
115
+ if (currentEmployment && existingEmployment) {
116
+ return existingItem[existingEmployment]['@UniqueID'] === item[currentEmployment]['@UniqueID'];
117
+ }
118
+ }
119
+ return -1;
120
+ }
121
+ return existingItem[uniqueKey] === item[uniqueKey];
122
+ });
123
+ // Checks if item should be added or merged
124
+ if (indexOfItem === -1) {
125
+ mergedArray.push(item);
126
+ }
127
+ else {
128
+ mergedArray[indexOfItem] = merge(mergedArray[indexOfItem], item, options);
129
+ }
130
+ });
131
+ return mergedArray;
132
+ }
@@ -2,7 +2,7 @@
2
2
  * A set of tools for manipulating addresses in LIXI applications.
3
3
  */
4
4
  import { AddressType, CurrentAddress, PreviousAddress } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
5
- import { CommonAddressProperties, PreviousAddress as InternalPreviousAddress } from '../types/events/public-applicant';
5
+ import { Address, CommonAddressProperties, Countries, PreviousAddress as InternalPreviousAddress } from '../types/events/public-applicant';
6
6
  /**
7
7
  * Type definition for functions used to transform types while mapping from event values to LIXI values.
8
8
  */
@@ -25,6 +25,7 @@ export interface MappedTransform {
25
25
  */
26
26
  export declare type PathMappedTransform = Record<string, MappedTransform>;
27
27
  export declare const lixiContactAddressMapping: PathMappedTransform;
28
+ export declare const australianStates: string[];
28
29
  /**
29
30
  * The transform map used for the LIXI address
30
31
  */
@@ -66,4 +67,16 @@ export declare function isMissingCountry(addressEvent: EventAddressType): boolea
66
67
  * @param address
67
68
  */
68
69
  export declare function setCountry(address: EventAddressType): EventAddressType;
70
+ /**
71
+ * @description Extract a country from a formatted address.
72
+ * @param {string} formatted - A formatted Address.
73
+ * @returns {Countries} The country extracted from the Address.
74
+ */
75
+ export declare function extractCountryFromFormatted(formatted?: string): Countries;
76
+ /**
77
+ * @description If the address has an overseas country or state, it returns true, defaults to false if no country and state found.
78
+ * @param {Address} address - Asset Address
79
+ * @returns {boolean} - Returns true if overseas address.
80
+ */
81
+ export declare function isOverseasAddress({ country, formatted, state }?: Address): boolean;
69
82
  export {};
@@ -3,7 +3,8 @@
3
3
  * A set of tools for manipulating addresses in LIXI applications.
4
4
  */
5
5
  exports.__esModule = true;
6
- exports.setCountry = exports.isMissingCountry = exports.rebuildPreviousAddress = exports.rebuildAddress = exports.mapTransform = exports.lixiAddressMapping = exports.lixiContactAddressMapping = void 0;
6
+ exports.isOverseasAddress = exports.extractCountryFromFormatted = exports.setCountry = exports.isMissingCountry = exports.rebuildPreviousAddress = exports.rebuildAddress = exports.mapTransform = exports.lixiAddressMapping = exports.australianStates = exports.lixiContactAddressMapping = void 0;
7
+ var lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
7
8
  var lodash_1 = require("lodash");
8
9
  var country_code_1 = require("../types/enum-mappings/country-code");
9
10
  var housing_status_1 = require("../types/enum-mappings/housing-status");
@@ -24,6 +25,7 @@ exports.lixiContactAddressMapping = {
24
25
  path: '@EndDate'
25
26
  }
26
27
  };
28
+ exports.australianStates = Object.values(lixi_internal_request_1.AuStateList);
27
29
  /**
28
30
  * The transform map used for the LIXI address
29
31
  */
@@ -136,11 +138,41 @@ exports.isMissingCountry = isMissingCountry;
136
138
  * @param address
137
139
  */
138
140
  function setCountry(address) {
139
- var _a;
140
141
  var formatted = (0, lodash_1.get)(address, 'residentialAddress.formatted');
141
142
  if (formatted && !address.residentialAddress.country) {
142
- address.residentialAddress.country = (_a = formatted.split(',').pop()) === null || _a === void 0 ? void 0 : _a.trim();
143
+ address.residentialAddress.country = extractCountryFromFormatted(formatted);
143
144
  }
144
145
  return address;
145
146
  }
146
147
  exports.setCountry = setCountry;
148
+ /**
149
+ * @description Extract a country from a formatted address.
150
+ * @param {string} formatted - A formatted Address.
151
+ * @returns {Countries} The country extracted from the Address.
152
+ */
153
+ function extractCountryFromFormatted(formatted) {
154
+ var _a;
155
+ if (formatted === void 0) { formatted = ''; }
156
+ return (_a = formatted === null || formatted === void 0 ? void 0 : formatted.split(',').pop()) === null || _a === void 0 ? void 0 : _a.trim();
157
+ }
158
+ exports.extractCountryFromFormatted = extractCountryFromFormatted;
159
+ /**
160
+ * @description If the address has an overseas country or state, it returns true, defaults to false if no country and state found.
161
+ * @param {Address} address - Asset Address
162
+ * @returns {boolean} - Returns true if overseas address.
163
+ */
164
+ function isOverseasAddress(_a) {
165
+ var _b = _a === void 0 ? {} : _a, country = _b.country, formatted = _b.formatted, state = _b.state;
166
+ if (country) {
167
+ return country !== public_applicant_1.Countries.Australia;
168
+ }
169
+ if (formatted) {
170
+ var lastPast = extractCountryFromFormatted(formatted);
171
+ return lastPast !== public_applicant_1.Countries.Australia;
172
+ }
173
+ if (state) {
174
+ return !exports.australianStates.includes(state);
175
+ }
176
+ return false;
177
+ }
178
+ exports.isOverseasAddress = isOverseasAddress;
@@ -4,10 +4,9 @@ export declare const StreetNumberMaxLength = 16;
4
4
  export declare const StreetTypeArray: StreetTypeList[];
5
5
  /**
6
6
  * Generates an address for an asset.
7
-
8
- * @param address: An address object.
9
- * @param id: Id of asset object.
10
- * @return A transformed address object.
7
+ * @param {Address} address - An address object.
8
+ * @param {string} id - Id of asset object.
9
+ * @return {Partial<AddressType>} A transformed address object.
11
10
  */
12
11
  export declare function generateAddress(address: Address, id: string): Partial<AddressType>;
13
12
  /**
@@ -6,7 +6,9 @@ var lodash_1 = require("lodash");
6
6
  var country_code_1 = require("..//types/enum-mappings/country-code");
7
7
  var postcode_1 = require("../types/enum-mappings/postcode");
8
8
  var public_asset_1 = require("../types/events/public-asset");
9
+ var address_tools_1 = require("./address-tools");
9
10
  exports.StreetNumberMaxLength = 16;
11
+ exports.StreetTypeArray = Object.values(lixi_internal_request_1.StreetTypeList);
10
12
  var addressMapping = {
11
13
  country: '@Country',
12
14
  city: '@Suburb',
@@ -21,21 +23,18 @@ var standardMapping = {
21
23
  level: '@Level',
22
24
  unit: '@Unit'
23
25
  };
24
- exports.StreetTypeArray = Object.values(lixi_internal_request_1.StreetTypeList);
25
26
  /**
26
27
  * Generates an address for an asset.
27
-
28
- * @param address: An address object.
29
- * @param id: Id of asset object.
30
- * @return A transformed address object.
28
+ * @param {Address} address - An address object.
29
+ * @param {string} id - Id of asset object.
30
+ * @return {Partial<AddressType>} A transformed address object.
31
31
  */
32
32
  function generateAddress(address, id) {
33
- var _a;
34
33
  var transformedAddress = {
35
34
  '@Country': lixi_internal_request_1.CountryCodeList.Au,
36
35
  '@UniqueID': id
37
36
  };
38
- var country = (((_a = address.formatted) === null || _a === void 0 ? void 0 : _a.split(',').pop()) || '').trim();
37
+ var country = (0, address_tools_1.extractCountryFromFormatted)(address.formatted);
39
38
  if (!address.country && country.length > 0) {
40
39
  address.country = country;
41
40
  }
@@ -50,8 +49,8 @@ function generateAddress(address, id) {
50
49
  transformedAddress['@AustralianPostCode'] = postcode_1.postcodeMapping[address.state];
51
50
  }
52
51
  }
53
- for (var _i = 0, _b = Object.entries(address); _i < _b.length; _i++) {
54
- var _c = _b[_i], key = _c[0], value = _c[1];
52
+ for (var _i = 0, _a = Object.entries(address); _i < _a.length; _i++) {
53
+ var _b = _a[_i], key = _b[0], value = _b[1];
55
54
  if (addressMapping[key]) {
56
55
  switch (key) {
57
56
  case 'standard':
@@ -0,0 +1,25 @@
1
+ import { Asset } from '../types/events/public-asset';
2
+ /**
3
+ * @description Checks if the asset is of financial type.
4
+ * @param {Asset} asset asset payload.
5
+ * @returns {boolean} returns true if asset is a financial asset.
6
+ */
7
+ export declare function isFinancialAsset(asset: Asset): boolean;
8
+ /**
9
+ * @description Is Asset a Real Estate Asset.
10
+ * @param {Asset} asset An Asset.
11
+ * @returns {boolean} returns true if Asset is a Real Estate Asset.
12
+ */
13
+ export declare function isRealEstateAsset(asset: Asset): boolean;
14
+ /**
15
+ * @description Is Asset a Motor Vehicle.
16
+ * @param {Asset} asset An Asset.
17
+ * @returns {boolean} returns true if an Asset is a vehicle.
18
+ */
19
+ export declare function isMotorVehicle(asset: Asset): boolean;
20
+ /**
21
+ * @description Is Asset of LIXI type `OtherAsset`.
22
+ * @param {Asset} asset An Asset.
23
+ * @returns {boolean} returns true if asset is `OtherAsset`.
24
+ */
25
+ export declare function isOtherAsset(asset: Asset): boolean;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.isOtherAsset = exports.isMotorVehicle = exports.isRealEstateAsset = exports.isFinancialAsset = void 0;
4
+ var public_asset_1 = require("../types/events/public-asset");
5
+ /**
6
+ * @description Checks if the asset is of financial type.
7
+ * @param {Asset} asset asset payload.
8
+ * @returns {boolean} returns true if asset is a financial asset.
9
+ */
10
+ function isFinancialAsset(asset) {
11
+ return [
12
+ public_asset_1.AssetType.Shares,
13
+ public_asset_1.AssetType.Superannuation,
14
+ public_asset_1.AssetType.TermDeposit,
15
+ public_asset_1.AssetType.SavingCheckAccount,
16
+ public_asset_1.AssetType.ManagedFunds,
17
+ ].includes(asset.type);
18
+ }
19
+ exports.isFinancialAsset = isFinancialAsset;
20
+ /**
21
+ * @description Is Asset a Real Estate Asset.
22
+ * @param {Asset} asset An Asset.
23
+ * @returns {boolean} returns true if Asset is a Real Estate Asset.
24
+ */
25
+ function isRealEstateAsset(asset) {
26
+ return asset.type === public_asset_1.AssetType.Property;
27
+ }
28
+ exports.isRealEstateAsset = isRealEstateAsset;
29
+ /**
30
+ * @description Is Asset a Motor Vehicle.
31
+ * @param {Asset} asset An Asset.
32
+ * @returns {boolean} returns true if an Asset is a vehicle.
33
+ */
34
+ function isMotorVehicle(asset) {
35
+ return asset.type === public_asset_1.AssetType.Vehicle;
36
+ }
37
+ exports.isMotorVehicle = isMotorVehicle;
38
+ /**
39
+ * @description Is Asset of LIXI type `OtherAsset`.
40
+ * @param {Asset} asset An Asset.
41
+ * @returns {boolean} returns true if asset is `OtherAsset`.
42
+ */
43
+ function isOtherAsset(asset) {
44
+ return [public_asset_1.AssetType.HomeContents, public_asset_1.AssetType.Gifts, public_asset_1.AssetType.OtherAsset].includes(asset.type);
45
+ }
46
+ exports.isOtherAsset = isOtherAsset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.2.0",
3
+ "version": "1.2.4",
4
4
  "description": "Library for kafka event data transforming",
5
5
  "author": "Integrations <integrations@lendi.com.au>",
6
6
  "homepage": "https://bitbucket.org/lendi-dev/integrations-shared-packages#readme",
@@ -21,8 +21,8 @@
21
21
  "url": "git+ssh://git@bitbucket.org/lendi-dev/integrations-shared-packages.git"
22
22
  },
23
23
  "dependencies": {
24
- "@lendi/integrations-credit-protocol": "1.14.4",
25
- "@lendi/integrations-protocol": "2.3.0",
24
+ "@lendi/integrations-credit-protocol": "1.15.2",
25
+ "@lendi/integrations-protocol": "2.5.4",
26
26
  "clean-deep": "^3.4.0",
27
27
  "date-fns": "2.19.0",
28
28
  "dd-trace": "^0.28.1",
@@ -1,17 +0,0 @@
1
- import { Asset, AssetDefinition as Payload } from '../types/events/public-asset';
2
- export declare const residentialTypeList: string[];
3
- export declare const propertyTypeNameList: string[];
4
- /**
5
- * Generates a partial internal request from a partial public asset event.
6
- *
7
- * @param asset: A partial public asset.
8
- * @param applicationId: Id of application.
9
- * @param id: Id of asset entity.
10
- * @return A partial InternalRequest.
11
- */
12
- export declare function generateAsset({ asset, applicationId, id }: Payload): {};
13
- /**
14
- * Checks if the asset is of financial type.
15
- * @param asset asset payload
16
- */
17
- export declare function isFinancialAsset(asset: Asset): boolean;