Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lendi/integrations-transform

Package Overview
Dependencies
Maintainers
83
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lendi/integrations-transform - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

33

lib/schemas/public-asset-event.json

@@ -506,2 +506,32 @@ {

},
"PropertyExpenses": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["type"],
"properties": {
"type": {
"type": "string",
"enum": [
"BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
"PRIMARY_RESIDENCE_RUNNING_COSTS",
"INVESTMENT_PROPERTY_RUNNING_COSTS",
"SECONDARY_RESIDENCE_RUNNING_COSTS"
]
},
"amount": {
"type": "number",
"example": 100000
},
"frequency": {
"type": "string",
"enum": ["FORTNIGHTLY", "MONTHLY", "QUARTERLY", "WEEKLY", "YEARLY"]
},
"comments": {
"type": "string"
}
}
}
},
"asset": {

@@ -584,2 +614,5 @@ "type": "object",

"$ref": "#/definitions/year"
},
"propertyExpenses": {
"$ref": "#/definitions/PropertyExpenses"
}

@@ -586,0 +619,0 @@ },

10

lib/transform-events/transform-asset.d.ts

@@ -0,3 +1,4 @@

import { LivingExpense } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
import { PropertyType as LixiPropertyType, Residential } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
import { Asset, Payload, PropertyType } from '../types/events/public-asset';
import { Asset, Payload, PercentOwned, PropertyExpense, PropertyType } from '../types/events/public-asset';
import { PartialApplication } from '../types/partial-application';

@@ -29,1 +30,8 @@ export interface PropertyTypeMapping {

export declare function getAssetMapping(asset: Asset): Record<string, string>;
/**
* Creates living expense items from a propertyExpense object.
*
* @param percentOwned: owners of the property
* @param propertyExpenses: propertyExpenses items
*/
export declare function generatePropertyExpenses(percentOwned: PercentOwned, propertyExpenses: PropertyExpense[]): LivingExpense[];

@@ -14,6 +14,7 @@ "use strict";

exports.__esModule = true;
exports.getAssetMapping = exports.getPropertyType = exports.transformAsset = exports.residentialTypeList = exports.propertyTypeNameList = void 0;
exports.generatePropertyExpenses = exports.getAssetMapping = exports.getPropertyType = exports.transformAsset = exports.residentialTypeList = exports.propertyTypeNameList = void 0;
var lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
var application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths");
var lixi_internal_request_2 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
var uuid_1 = require("uuid");
var lodash_1 = require("lodash");

@@ -23,4 +24,6 @@ var logger_1 = require("../logger");

var public_asset_1 = require("../types/events/public-asset");
var public_expense_1 = require("../types/events/public-expense");
var get_financial_institution_1 = require("../utils/get-financial-institution");
var is_asset_type_1 = require("../utils/is-asset-type");
var round_decimal_1 = require("../utils/round-decimal");
var transform_asset_address_1 = require("./transform-asset-address");

@@ -90,2 +93,9 @@ var transform_percent_owned_1 = require("./transform-percent-owned");

break;
case 'propertyExpenses':
if (!asset.percentOwned) {
break;
}
var propertyExpenses = generatePropertyExpenses(asset.percentOwned, value);
(0, lodash_1.set)(partialApplication, assetMapping[key], propertyExpenses);
break;
case 'propertyStatus':

@@ -191,2 +201,3 @@ (0, lodash_1.set)(partialApplication, assetMapping[key], enum_mappings_1.propertyStatusMapping[value]);

primaryPurpose: "".concat(application_paths_1.paths.RealEstateAsset, ".@PrimaryPurpose"),
propertyExpenses: application_paths_1.paths.LivingExpenses,
propertyStatus: "".concat(application_paths_1.paths.RealEstateAsset, ".@Status"),

@@ -208,1 +219,36 @@ propertyType: "".concat(application_paths_1.paths.RealEstateAsset, ".Residential"),

exports.getAssetMapping = getAssetMapping;
/**
* Creates living expense items from a propertyExpense object.
*
* @param percentOwned: owners of the property
* @param propertyExpenses: propertyExpenses items
*/
function generatePropertyExpenses(percentOwned, propertyExpenses) {
var livingExpenses = [];
var filteredPropertyExpenses = propertyExpenses.filter(function (expense) { return expense.amount !== undefined; });
percentOwned.owners.forEach(function (owner) {
var expenses = filteredPropertyExpenses.map(function (expense) {
if (expense.frequency === public_expense_1.Frequency.Quarterly) {
expense.frequency = public_expense_1.Frequency.Yearly;
expense.amount *= 4;
}
return {
'@Amount': (0, round_decimal_1.roundDecimal)(expense.amount * owner.percent),
'@Category': enum_mappings_1.livingExpenseMapping[expense.type],
'@Frequency': enum_mappings_1.incomeExpenseFrequencyMapping[expense.frequency],
'@UniqueID': (0, uuid_1.v4)(),
PercentResponsible: {
Owner: [
{
'@Percent': 100,
'@x_Party': owner.applicantId
},
]
}
};
});
livingExpenses = livingExpenses.concat(expenses);
});
return livingExpenses;
}
exports.generatePropertyExpenses = generatePropertyExpenses;

@@ -9,3 +9,3 @@ /**

*/
type: Type;
type: PublicAssetType;
version: string;

@@ -42,2 +42,3 @@ }

primaryPurpose?: PrimaryPurpose;
propertyExpenses?: PropertyExpense[];
propertyStatus?: PropertyStatus;

@@ -402,2 +403,21 @@ propertyType?: PropertyType;

}
export interface PropertyExpense {
amount?: number;
comments?: string;
frequency?: Frequency;
type: PropertyExpenseType;
}
export declare enum Frequency {
Fortnightly = "FORTNIGHTLY",
Monthly = "MONTHLY",
Quarterly = "QUARTERLY",
Weekly = "WEEKLY",
Yearly = "YEARLY"
}
export declare enum PropertyExpenseType {
BodyCorporateFeesStrataFeesAndLandTax = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX",
InvestmentPropertyRunningCosts = "INVESTMENT_PROPERTY_RUNNING_COSTS",
PrimaryResidenceRunningCosts = "PRIMARY_RESIDENCE_RUNNING_COSTS",
SecondaryResidenceRunningCosts = "SECONDARY_RESIDENCE_RUNNING_COSTS"
}
export declare enum PropertyStatus {

@@ -468,5 +488,5 @@ Established = "ESTABLISHED",

*/
export declare enum Type {
export declare enum PublicAssetType {
AssetCreated = "AssetCreated",
AssetUpdated = "AssetUpdated"
}

27

lib/types/events/public-asset.js
"use strict";
exports.__esModule = true;
exports.Type = exports.ActionedByRole = exports.ZoneType = exports.AssetType = exports.PropertyType = exports.PropertyStatus = exports.PrimaryPurpose = exports.Proportions = exports.Countries = void 0;
exports.PublicAssetType = exports.ActionedByRole = exports.ZoneType = exports.AssetType = exports.PropertyType = exports.PropertyStatus = exports.PropertyExpenseType = exports.Frequency = exports.PrimaryPurpose = exports.Proportions = exports.Countries = void 0;
var Countries;

@@ -261,2 +261,17 @@ (function (Countries) {

})(PrimaryPurpose = exports.PrimaryPurpose || (exports.PrimaryPurpose = {}));
var Frequency;
(function (Frequency) {
Frequency["Fortnightly"] = "FORTNIGHTLY";
Frequency["Monthly"] = "MONTHLY";
Frequency["Quarterly"] = "QUARTERLY";
Frequency["Weekly"] = "WEEKLY";
Frequency["Yearly"] = "YEARLY";
})(Frequency = exports.Frequency || (exports.Frequency = {}));
var PropertyExpenseType;
(function (PropertyExpenseType) {
PropertyExpenseType["BodyCorporateFeesStrataFeesAndLandTax"] = "BODY_CORPORATE_FEES_STRATA_FEES_AND_LAND_TAX";
PropertyExpenseType["InvestmentPropertyRunningCosts"] = "INVESTMENT_PROPERTY_RUNNING_COSTS";
PropertyExpenseType["PrimaryResidenceRunningCosts"] = "PRIMARY_RESIDENCE_RUNNING_COSTS";
PropertyExpenseType["SecondaryResidenceRunningCosts"] = "SECONDARY_RESIDENCE_RUNNING_COSTS";
})(PropertyExpenseType = exports.PropertyExpenseType || (exports.PropertyExpenseType = {}));
var PropertyStatus;

@@ -319,6 +334,6 @@ (function (PropertyStatus) {

*/
var Type;
(function (Type) {
Type["AssetCreated"] = "AssetCreated";
Type["AssetUpdated"] = "AssetUpdated";
})(Type = exports.Type || (exports.Type = {}));
var PublicAssetType;
(function (PublicAssetType) {
PublicAssetType["AssetCreated"] = "AssetCreated";
PublicAssetType["AssetUpdated"] = "AssetUpdated";
})(PublicAssetType = exports.PublicAssetType || (exports.PublicAssetType = {}));
{
"name": "@lendi/integrations-transform",
"version": "1.3.4",
"version": "1.3.5",
"description": "Library for kafka event data transforming",

@@ -5,0 +5,0 @@ "author": "Integrations <integrations@lendi.com.au>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc