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

@servicetitan/acquisition-functions

Package Overview
Dependencies
Maintainers
7
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@servicetitan/acquisition-functions - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

3

dist/__tests__/mock.d.ts

@@ -452,1 +452,4 @@ export declare const MOCK: ({

})[];
export declare const filtersToIgnoreMOCK: {
name: string;
}[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MOCK = void 0;
exports.filtersToIgnoreMOCK = exports.MOCK = void 0;
exports.MOCK = [

@@ -458,1 +458,20 @@ {

];
exports.filtersToIgnoreMOCK = [
{ name: 'vacant land - exempt' },
{ name: 'residential - vacant land' },
{ name: 'industrial - vacant land' },
{ name: 'rural residence' },
{ name: 'multi-family - vacant land' },
{ name: 'waste land, marsh, swamp, submerged - vacant land' },
{ name: 'vacant land - unspecified improvement' },
{ name: 'planned unit development (pud)' },
{ name: 'row house' },
{ name: 'agricultural (unimproved) - vacant land' },
{ name: 'water area (lakes, river, shore) - vacant land' },
{ name: 'recreational - vacant land' },
{ name: 'vacant land - destroyed/uninhabitable improvement' },
{ name: 'institutional - vacant land' },
{ name: 'vacant land' },
{ name: 'government - vacant land' },
{ name: 'private preserve, open space - vacant land' },
];

2

dist/filter-fetcher/calc-filter-count.d.ts
import { Property } from '../types';
export declare const calculateFilterCount: (properties: Property[]) => {
export declare const calculateFilterCount: (properties: Property[], filtersToIgnore: string[]) => {
propertyusegroupCounts: {

@@ -4,0 +4,0 @@ name: string;

@@ -5,3 +5,3 @@ "use strict";

const utils_1 = require("../utils/utils");
const calculateFilterCount = (properties) => {
const calculateFilterCount = (properties, filtersToIgnore) => {
const filterCount = {

@@ -15,5 +15,6 @@ propertyusegroup: {},

};
const { isValidFilterName } = (0, utils_1.FilterNameValidator)(filtersToIgnore, utils_1.UNKNOWN);
properties.forEach(p => {
if (p.propertyusestandardized.toLowerCase() !== utils_1.UNKNOWN &&
p.propertyusegroup.toLowerCase() !== utils_1.UNKNOWN) {
if (isValidFilterName(p.propertyusestandardized.toLowerCase()) &&
isValidFilterName(p.propertyusegroup.toLowerCase())) {
const propertyUseKey = p.propertyusestandardized + utils_1.SEPARATOR_CHARACTER + p.propertyusegroup;

@@ -27,3 +28,3 @@ filterCount.propertyusestandardized[propertyUseKey] =

}
if (p.hvaccoolingdetail.toLowerCase() !== utils_1.UNKNOWN) {
if (isValidFilterName(p.hvaccoolingdetail.toLowerCase())) {
filterCount.hvaccoolingdetail[p.hvaccoolingdetail] =

@@ -33,3 +34,3 @@ filterCount.hvaccoolingdetail[p.hvaccoolingdetail] || 0;

}
if (p.hvacheatingdetail.toLowerCase() !== utils_1.UNKNOWN) {
if (isValidFilterName(p.hvacheatingdetail.toLowerCase())) {
filterCount.hvacheatingdetail[p.hvacheatingdetail] =

@@ -39,3 +40,3 @@ filterCount.hvacheatingdetail[p.hvacheatingdetail] || 0;

}
if (p.utilitieswatersource.toLowerCase() !== utils_1.UNKNOWN) {
if (isValidFilterName(p.utilitieswatersource.toLowerCase())) {
filterCount.utilitieswatersource[p.utilitieswatersource] =

@@ -45,3 +46,3 @@ filterCount.utilitieswatersource[p.utilitieswatersource] || 0;

}
if (p.flooringmaterialprimary.toLowerCase() !== utils_1.UNKNOWN) {
if (isValidFilterName(p.flooringmaterialprimary.toLowerCase())) {
filterCount.flooringmaterialprimary[p.flooringmaterialprimary] =

@@ -48,0 +49,0 @@ filterCount.flooringmaterialprimary[p.flooringmaterialprimary] || 0;

@@ -6,2 +6,4 @@ "use strict";

function getFilterFetcherProcessor(db) {
let invalidFilters;
let fetchInvalidFiltersInProgress = null;
const getFiltersCollection = async () => {

@@ -43,2 +45,26 @@ return db.collection('filters');

};
const getInvalidFilters = async () => {
if (invalidFilters !== undefined) {
return invalidFilters;
}
if (!fetchInvalidFiltersInProgress) {
fetchInvalidFiltersInProgress = db
.collection('badFilters')
.find({}, {
projection: {
_id: 0,
name: 1,
},
})
.toArray()
.then(results => {
invalidFilters = results.map(doc => doc.name);
})
.finally(() => {
fetchInvalidFiltersInProgress = null;
});
}
await fetchInvalidFiltersInProgress;
return invalidFilters;
};
return async function processZip(zip, errors) {

@@ -55,6 +81,9 @@ const meta = {

try {
const properties = await getProperties(zip);
const [properties, invalidFilters] = await Promise.all([
getProperties(zip),
getInvalidFilters(),
]);
meta.requests += 1;
meta.properties += properties.length;
const filters = (0, calc_filter_count_1.calculateFilterCount)(properties);
const filters = (0, calc_filter_count_1.calculateFilterCount)(properties, invalidFilters);
await deleteZipFilter(zip);

@@ -61,0 +90,0 @@ meta.requests += 1;

@@ -246,1 +246,4 @@ import { Property } from '../types';

}[];
export declare function FilterNameValidator(filtersToIgnore: string[], unknownCharacter: string): {
isValidFilterName(filterName: string, checkIgnoredFilters?: boolean): boolean;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertStringToDate = exports.convertToZipString = exports.convertObjectToArray = exports.extractUniqueFilterNames = exports.isEmptyField = exports.isNotFullProperty = exports.UNKNOWN = exports.SEPARATOR_CHARACTER = void 0;
exports.FilterNameValidator = exports.convertStringToDate = exports.convertToZipString = exports.convertObjectToArray = exports.extractUniqueFilterNames = exports.isEmptyField = exports.isNotFullProperty = exports.UNKNOWN = exports.SEPARATOR_CHARACTER = void 0;
exports.SEPARATOR_CHARACTER = '___';

@@ -81,1 +81,10 @@ exports.UNKNOWN = 'unknown';

exports.convertStringToDate = convertStringToDate;
function FilterNameValidator(filtersToIgnore, unknownCharacter) {
return {
isValidFilterName(filterName, checkIgnoredFilters = true) {
const isValidFilter = !checkIgnoredFilters || !filtersToIgnore.includes(filterName);
return filterName !== unknownCharacter && isValidFilter;
},
};
}
exports.FilterNameValidator = FilterNameValidator;
{
"name": "@servicetitan/acquisition-functions",
"version": "0.7.0",
"version": "0.8.0",
"description": "",

@@ -31,3 +31,3 @@ "main": "./dist/index.js",

},
"gitHead": "5f99e766305c1226ac570f8d2834ab7ce2c76c5d"
"gitHead": "04c06c606f59be9507544c0ac0a9e0a19538dbf0"
}
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