@lendi/integrations-transform 1.3.7 → 1.3.8
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/schemas/public-asset-event.json +20 -0
- package/lib/transform-events/transform-asset.js +43 -2
- package/lib/types/enum-mappings/builder-type.d.ts +7 -0
- package/lib/types/enum-mappings/builder-type.js +10 -0
- package/lib/types/enum-mappings/construction-type.d.ts +7 -0
- package/lib/types/enum-mappings/construction-type.js +11 -0
- package/lib/types/events/public-asset.d.ts +14 -0
- package/lib/types/events/public-asset.js +12 -1
- package/package.json +2 -2
|
@@ -442,6 +442,10 @@
|
|
|
442
442
|
"constructionDetails": {
|
|
443
443
|
"type": "object",
|
|
444
444
|
"properties": {
|
|
445
|
+
"constructionType": {
|
|
446
|
+
"type": "string",
|
|
447
|
+
"enum": ["STRUCTURAL_RENOVATIONS", "BUILD_A_PROPERTY", "KNOCKDOWN_REBUILD"]
|
|
448
|
+
},
|
|
445
449
|
"buildPriceAmount": {
|
|
446
450
|
"type": "number"
|
|
447
451
|
},
|
|
@@ -451,6 +455,16 @@
|
|
|
451
455
|
},
|
|
452
456
|
"landEstimatedValue": {
|
|
453
457
|
"type": "number"
|
|
458
|
+
},
|
|
459
|
+
"otherConstructionCosts": {
|
|
460
|
+
"type": "number"
|
|
461
|
+
},
|
|
462
|
+
"builderType": {
|
|
463
|
+
"type": "string",
|
|
464
|
+
"enum": ["LICENSED_BUILDER", "OWNER_BUILDER"]
|
|
465
|
+
},
|
|
466
|
+
"isFixedPriceContract": {
|
|
467
|
+
"type": "boolean"
|
|
454
468
|
}
|
|
455
469
|
}
|
|
456
470
|
},
|
|
@@ -479,6 +493,9 @@
|
|
|
479
493
|
"description": "The unique number assigned to the Financial Institution account",
|
|
480
494
|
"example": "999994"
|
|
481
495
|
},
|
|
496
|
+
"isConstruction": {
|
|
497
|
+
"type": "boolean"
|
|
498
|
+
},
|
|
482
499
|
"dataType": {
|
|
483
500
|
"type": "string"
|
|
484
501
|
},
|
|
@@ -602,6 +619,9 @@
|
|
|
602
619
|
"constructionDetails": {
|
|
603
620
|
"$ref": "#/definitions/constructionDetails"
|
|
604
621
|
},
|
|
622
|
+
"isConstruction": {
|
|
623
|
+
"$ref": "#/definitions/isConstruction"
|
|
624
|
+
},
|
|
605
625
|
"make": {
|
|
606
626
|
"$ref": "#/definitions/make"
|
|
607
627
|
},
|
|
@@ -26,8 +26,22 @@ var is_asset_type_1 = require("../utils/is-asset-type");
|
|
|
26
26
|
var round_decimal_1 = require("../utils/round-decimal");
|
|
27
27
|
var transform_asset_address_1 = require("./transform-asset-address");
|
|
28
28
|
var transform_percent_owned_1 = require("./transform-percent-owned");
|
|
29
|
+
var builder_type_1 = require("../types/enum-mappings/builder-type");
|
|
30
|
+
var construction_type_1 = require("../types/enum-mappings/construction-type");
|
|
31
|
+
var __1 = require("..");
|
|
29
32
|
exports.propertyTypeNameList = Object.values(lixi_internal_request_2.Custom2PropertyTypeNameList);
|
|
30
33
|
exports.residentialTypeList = Object.values(lixi_internal_request_1.ResidentialTypeList);
|
|
34
|
+
// will add this path to protocol
|
|
35
|
+
var constructionDetailsPath = "".concat(application_paths_1.paths.RealEstateAsset, ".ConstructionDetails");
|
|
36
|
+
var constructionDetailsMapping = {
|
|
37
|
+
builderType: "".concat(constructionDetailsPath, ".@BuilderType"),
|
|
38
|
+
buildPriceAmount: "".concat(constructionDetailsPath, ".@BuildPriceAmount"),
|
|
39
|
+
constructionType: "".concat(constructionDetailsPath, ".@Type"),
|
|
40
|
+
estimatedValue: "".concat(constructionDetailsPath, ".@TotalAmount"),
|
|
41
|
+
isFixedPriceContract: "".concat(constructionDetailsPath, ".@FixedPriceContract"),
|
|
42
|
+
landEstimatedValue: "".concat(constructionDetailsPath, ".@LandValue"),
|
|
43
|
+
otherConstructionCosts: "".concat(constructionDetailsPath, ".@OutOfContractItemsCost")
|
|
44
|
+
};
|
|
31
45
|
/**
|
|
32
46
|
* Generates a partial internal request from a partial public asset event.
|
|
33
47
|
*
|
|
@@ -140,6 +154,31 @@ function transformAsset(_a) {
|
|
|
140
154
|
(0, lodash_1.set)(partialApplication, assetMapping[key], percentOwned);
|
|
141
155
|
}
|
|
142
156
|
break;
|
|
157
|
+
case 'constructionDetails':
|
|
158
|
+
for (var _d = 0, _e = Object.entries(value); _d < _e.length; _d++) {
|
|
159
|
+
var _f = _e[_d], key_1 = _f[0], constructionDetailsValue = _f[1];
|
|
160
|
+
switch (key_1) {
|
|
161
|
+
case 'builderType':
|
|
162
|
+
(0, lodash_1.set)(partialApplication, constructionDetailsMapping[key_1], builder_type_1.builderTypeMapping[constructionDetailsValue]);
|
|
163
|
+
break;
|
|
164
|
+
case 'constructionType':
|
|
165
|
+
(0, lodash_1.set)(partialApplication, constructionDetailsMapping[key_1], construction_type_1.constructionTypeMapping[constructionDetailsValue]);
|
|
166
|
+
break;
|
|
167
|
+
case 'isFixedPriceContract':
|
|
168
|
+
(0, lodash_1.set)(partialApplication, constructionDetailsMapping[key_1], (0, __1.booleanMapping)(constructionDetailsValue));
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
(0, lodash_1.set)(partialApplication, constructionDetailsMapping[key_1], constructionDetailsValue);
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
case 'estimatedValue':
|
|
177
|
+
if (asset.isConstruction) {
|
|
178
|
+
(0, lodash_1.set)(partialApplication, constructionDetailsMapping[key], value);
|
|
179
|
+
}
|
|
180
|
+
(0, lodash_1.set)(partialApplication, assetMapping[key], value);
|
|
181
|
+
break;
|
|
143
182
|
default:
|
|
144
183
|
(0, lodash_1.set)(partialApplication, assetMapping[key], value);
|
|
145
184
|
break;
|
|
@@ -203,7 +242,9 @@ function getAssetMapping(asset) {
|
|
|
203
242
|
propertyType: "".concat(application_paths_1.paths.RealEstateAsset, ".Residential"),
|
|
204
243
|
toBePurchased: "".concat(application_paths_1.paths.RealEstateAsset, ".@Transaction"),
|
|
205
244
|
toBeUsedAsSecurity: "".concat(application_paths_1.paths.RealEstateAsset, ".@ToBeUsedAsSecurity"),
|
|
206
|
-
zoneType: "".concat(application_paths_1.paths.RealEstateAsset, ".Zoning.@Type")
|
|
245
|
+
zoneType: "".concat(application_paths_1.paths.RealEstateAsset, ".Zoning.@Type"),
|
|
246
|
+
isConstruction: "".concat(application_paths_1.paths.RealEstateAsset, ".@Construction"),
|
|
247
|
+
constructionDetails: "".concat(application_paths_1.paths.RealEstateAsset, ".ConstructionDetails")
|
|
207
248
|
};
|
|
208
249
|
}
|
|
209
250
|
if ((0, is_asset_type_1.isMotorVehicle)(asset)) {
|
|
@@ -232,7 +273,7 @@ function generateLivingExpenses(percentOwned, assetId, propertyExpenses) {
|
|
|
232
273
|
'@Amount': (0, round_decimal_1.roundDecimal)(expense.amount * owner.percent),
|
|
233
274
|
'@Category': enum_mappings_1.livingExpenseMapping[expense.type],
|
|
234
275
|
'@Frequency': enum_mappings_1.incomeExpenseFrequencyMapping[expense.frequency],
|
|
235
|
-
'@UniqueID': "".concat((0, uuid_1.v4)(), "
|
|
276
|
+
'@UniqueID': "".concat((0, uuid_1.v4)(), "--").concat(assetId),
|
|
236
277
|
PercentResponsible: {
|
|
237
278
|
Owner: [
|
|
238
279
|
{
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BuilderTypeList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
+
import { BuilderType } from '../events/public-asset';
|
|
3
|
+
declare type BuilderTypeMapping = {
|
|
4
|
+
[key in BuilderType]: BuilderTypeList;
|
|
5
|
+
};
|
|
6
|
+
export declare const builderTypeMapping: BuilderTypeMapping;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.builderTypeMapping = void 0;
|
|
5
|
+
var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
6
|
+
var public_asset_1 = require("../events/public-asset");
|
|
7
|
+
exports.builderTypeMapping = (_a = {},
|
|
8
|
+
_a[public_asset_1.BuilderType.LicensedBuilder] = lixi_internal_request_1.BuilderTypeList.LicensedBuilder,
|
|
9
|
+
_a[public_asset_1.BuilderType.OwnerBuilder] = lixi_internal_request_1.BuilderTypeList.OwnerBuilder,
|
|
10
|
+
_a);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConstructionTypeList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
+
import { ConstructionType } from '../events/public-asset';
|
|
3
|
+
declare type ConstructionTypeMapping = {
|
|
4
|
+
[key in ConstructionType]: ConstructionTypeList;
|
|
5
|
+
};
|
|
6
|
+
export declare const constructionTypeMapping: ConstructionTypeMapping;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.constructionTypeMapping = void 0;
|
|
5
|
+
var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
6
|
+
var public_asset_1 = require("../events/public-asset");
|
|
7
|
+
exports.constructionTypeMapping = (_a = {},
|
|
8
|
+
_a[public_asset_1.ConstructionType.BuildAProperty] = lixi_internal_request_1.ConstructionTypeList.FullConstruction,
|
|
9
|
+
_a[public_asset_1.ConstructionType.KnockdownRebuild] = lixi_internal_request_1.ConstructionTypeList.FullConstruction,
|
|
10
|
+
_a[public_asset_1.ConstructionType.StructuralRenovations] = lixi_internal_request_1.ConstructionTypeList.Renovation,
|
|
11
|
+
_a);
|
|
@@ -33,6 +33,7 @@ export interface Asset {
|
|
|
33
33
|
financialInstitutionAccountNumber?: string;
|
|
34
34
|
financialInstitutionBsb?: string;
|
|
35
35
|
financialInstitutionShortName?: string;
|
|
36
|
+
isConstruction?: boolean;
|
|
36
37
|
knockDownToRebuild?: boolean;
|
|
37
38
|
make?: string;
|
|
38
39
|
model?: string;
|
|
@@ -346,7 +347,20 @@ export interface ConstructionDetails {
|
|
|
346
347
|
*/
|
|
347
348
|
buildIn6Months?: boolean;
|
|
348
349
|
buildPriceAmount?: number;
|
|
350
|
+
builderType?: BuilderType;
|
|
351
|
+
constructionType?: ConstructionType;
|
|
352
|
+
isFixedPriceContract?: boolean;
|
|
349
353
|
landEstimatedValue?: number;
|
|
354
|
+
otherConstructionCosts?: number;
|
|
355
|
+
}
|
|
356
|
+
export declare enum BuilderType {
|
|
357
|
+
LicensedBuilder = "LICENSED_BUILDER",
|
|
358
|
+
OwnerBuilder = "OWNER_BUILDER"
|
|
359
|
+
}
|
|
360
|
+
export declare enum ConstructionType {
|
|
361
|
+
BuildAProperty = "BUILD_A_PROPERTY",
|
|
362
|
+
KnockdownRebuild = "KNOCKDOWN_REBUILD",
|
|
363
|
+
StructuralRenovations = "STRUCTURAL_RENOVATIONS"
|
|
350
364
|
}
|
|
351
365
|
/**
|
|
352
366
|
* Details of the purchase/sale price as specified in the Contract of Sale
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.PublicAssetType = exports.ActionedByRole = exports.ZoneType = exports.AssetType = exports.PropertyType = exports.PropertyStatus = exports.PropertyExpenseType = exports.Frequency = exports.PrimaryPurpose = exports.Proportions = exports.Countries = void 0;
|
|
3
|
+
exports.PublicAssetType = exports.ActionedByRole = exports.ZoneType = exports.AssetType = exports.PropertyType = exports.PropertyStatus = exports.PropertyExpenseType = exports.Frequency = exports.PrimaryPurpose = exports.Proportions = exports.ConstructionType = exports.BuilderType = exports.Countries = void 0;
|
|
4
4
|
var Countries;
|
|
5
5
|
(function (Countries) {
|
|
6
6
|
Countries["Afghanistan"] = "Afghanistan";
|
|
@@ -243,6 +243,17 @@ var Countries;
|
|
|
243
243
|
Countries["Zambia"] = "Zambia";
|
|
244
244
|
Countries["Zimbabwe"] = "Zimbabwe";
|
|
245
245
|
})(Countries = exports.Countries || (exports.Countries = {}));
|
|
246
|
+
var BuilderType;
|
|
247
|
+
(function (BuilderType) {
|
|
248
|
+
BuilderType["LicensedBuilder"] = "LICENSED_BUILDER";
|
|
249
|
+
BuilderType["OwnerBuilder"] = "OWNER_BUILDER";
|
|
250
|
+
})(BuilderType = exports.BuilderType || (exports.BuilderType = {}));
|
|
251
|
+
var ConstructionType;
|
|
252
|
+
(function (ConstructionType) {
|
|
253
|
+
ConstructionType["BuildAProperty"] = "BUILD_A_PROPERTY";
|
|
254
|
+
ConstructionType["KnockdownRebuild"] = "KNOCKDOWN_REBUILD";
|
|
255
|
+
ConstructionType["StructuralRenovations"] = "STRUCTURAL_RENOVATIONS";
|
|
256
|
+
})(ConstructionType = exports.ConstructionType || (exports.ConstructionType = {}));
|
|
246
257
|
/**
|
|
247
258
|
* Indicate whether ownership proportions are equal, specified individually for each one or
|
|
248
259
|
* not specified.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
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,7 +21,7 @@
|
|
|
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.16.
|
|
24
|
+
"@lendi/integrations-credit-protocol": "1.16.2",
|
|
25
25
|
"@lendi/integrations-protocol": "2.5.4",
|
|
26
26
|
"clean-deep": "^3.4.0",
|
|
27
27
|
"date-fns": "2.19.0",
|