@servicetitan/acquisition-functions 0.10.0 → 0.11.0

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.
@@ -22,29 +22,23 @@ describe('property-assessorlastsaledate-converter', () => {
22
22
  metadata = await assessorLastSaleDateProcessor.start('90001');
23
23
  });
24
24
  (0, globals_1.test)('should convert existing field to date', async () => {
25
- const result = await new Promise(resolve => {
26
- base.collection('properties')
27
- .find({
28
- assessorlastsaledate: {
29
- $exists: true,
30
- },
31
- })
32
- .toArray((err, res) => {
33
- resolve(res);
34
- });
35
- });
25
+ const result = await base
26
+ .collection('properties')
27
+ .find({
28
+ assessorlastsaledate: {
29
+ $exists: true,
30
+ },
31
+ })
32
+ .toArray();
36
33
  (0, globals_1.expect)(result[0].assessorlastsaledate).toBeInstanceOf(Date);
37
34
  });
38
35
  (0, globals_1.test)('should not touch nulls', async () => {
39
- const result = await new Promise(resolve => {
40
- base.collection('properties')
41
- .find({
42
- assessorlastsaledate: null,
43
- })
44
- .toArray((err, res) => {
45
- resolve(res);
46
- });
47
- });
36
+ const result = await base
37
+ .collection('properties')
38
+ .find({
39
+ assessorlastsaledate: null,
40
+ })
41
+ .toArray();
48
42
  (0, globals_1.expect)(result[0].assessorlastsaledate).toBe(null);
49
43
  });
50
44
  (0, globals_1.test)('should return metadata', async () => {
@@ -59,29 +53,23 @@ describe('property-assessorlastsaledate-converter', () => {
59
53
  await (0, index_1.propertiesAssessorLastSaleDateAggregate)(base);
60
54
  });
61
55
  (0, globals_1.test)('should convert existing field to date', async () => {
62
- const result = await new Promise(resolve => {
63
- base.collection('properties')
64
- .find({
65
- assessorlastsaledate: {
66
- $exists: true,
67
- },
68
- })
69
- .toArray((err, res) => {
70
- resolve(res);
71
- });
72
- });
56
+ const result = await base
57
+ .collection('properties')
58
+ .find({
59
+ assessorlastsaledate: {
60
+ $exists: true,
61
+ },
62
+ })
63
+ .toArray();
73
64
  (0, globals_1.expect)(result[0].assessorlastsaledate).toBeInstanceOf(Date);
74
65
  });
75
66
  (0, globals_1.test)('should not touch nulls', async () => {
76
- const result = await new Promise(resolve => {
77
- base.collection('properties')
78
- .find({
79
- assessorlastsaledate: null,
80
- })
81
- .toArray((err, res) => {
82
- resolve(res);
83
- });
84
- });
67
+ const result = await base
68
+ .collection('properties')
69
+ .find({
70
+ assessorlastsaledate: null,
71
+ })
72
+ .toArray();
85
73
  (0, globals_1.expect)(result[0].assessorlastsaledate).toBe(null);
86
74
  });
87
75
  });
@@ -44,31 +44,31 @@ describe('property-assessorlastsaledate-converter', () => {
44
44
  zipcode: '90001',
45
45
  propertyusegroup: [
46
46
  {
47
- name: 'COMMERCIAL',
47
+ name: 'Commercial',
48
48
  count: 2,
49
49
  },
50
50
  ],
51
51
  propertyusestandardized: [
52
52
  {
53
- name: 'APARTMENT HOUSE (5+ UNITS)',
54
- groupName: 'COMMERCIAL',
53
+ name: 'Apartment house (5+ units)',
54
+ groupName: 'Commercial',
55
55
  count: 1,
56
56
  },
57
57
  {
58
- name: 'AUTO REPAIR, GARAGE',
59
- groupName: 'COMMERCIAL',
58
+ name: 'Auto repair, garage',
59
+ groupName: 'Commercial',
60
60
  count: 1,
61
61
  },
62
62
  ],
63
63
  hvaccoolingdetail: [
64
64
  {
65
- name: 'YES',
65
+ name: 'Yes',
66
66
  count: 1,
67
67
  },
68
68
  ],
69
69
  hvacheatingdetail: [
70
70
  {
71
- name: 'NONE',
71
+ name: 'None',
72
72
  count: 2,
73
73
  },
74
74
  ],
@@ -83,8 +83,8 @@ describe('property-assessorlastsaledate-converter', () => {
83
83
  });
84
84
  (0, globals_1.expect)(result).not.toBe(null);
85
85
  (0, globals_1.expect)(result?.propertyusegroup.length).toBe(1);
86
- (0, globals_1.expect)(result?.propertyusegroup[0].name).toBe('COMMERCIAL');
87
- (0, globals_1.expect)(result?.propertyusestandardized.every(({ groupName }) => groupName === 'COMMERCIAL')).toBeTruthy();
86
+ (0, globals_1.expect)(result?.propertyusegroup[0].name).toBe('Commercial');
87
+ (0, globals_1.expect)(result?.propertyusestandardized.every(({ groupName }) => groupName === 'Commercial')).toBeTruthy();
88
88
  });
89
89
  afterAll(async () => {
90
90
  await (0, setup_1.closeConnection)();
@@ -26,18 +26,15 @@ describe('property-use-group-converter', () => {
26
26
  (0, globals_1.expect)(metadata.properties).toBe(2);
27
27
  (0, globals_1.expect)(metadata.requests).toBe(2);
28
28
  });
29
- (0, globals_1.test)('should convert existing field to captial-case', async () => {
30
- const result = await new Promise(resolve => {
31
- base.collection('properties')
32
- .find({
33
- propertyusegroup: {
34
- $exists: true,
35
- },
36
- })
37
- .toArray((err, res) => {
38
- resolve(res);
39
- });
40
- });
29
+ (0, globals_1.test)('should convert existing field to capital-case', async () => {
30
+ const result = await base
31
+ .collection('properties')
32
+ .find({
33
+ propertyusegroup: {
34
+ $exists: true,
35
+ },
36
+ })
37
+ .toArray();
41
38
  (0, globals_1.expect)(result[0].propertyusegroup).toBe('COMMERCIAL');
42
39
  (0, globals_1.expect)(result[1].propertyusegroup).toBe('COMMERCIAL');
43
40
  });
@@ -46,19 +43,16 @@ describe('property-use-group-converter', () => {
46
43
  (0, globals_1.beforeAll)(async () => {
47
44
  await (0, setup_1.setupProperties)(base);
48
45
  });
49
- (0, globals_1.test)('should convert existing field to captial-case', async () => {
46
+ (0, globals_1.test)('should convert existing field to capital-case', async () => {
50
47
  await (0, index_1.propertyUseGroupProcessorAggregate)(base);
51
- const result = await new Promise(resolve => {
52
- base.collection('properties')
53
- .find({
54
- propertyusegroup: {
55
- $exists: true,
56
- },
57
- })
58
- .toArray((err, res) => {
59
- resolve(res);
60
- });
61
- });
48
+ const result = await base
49
+ .collection('properties')
50
+ .find({
51
+ propertyusegroup: {
52
+ $exists: true,
53
+ },
54
+ })
55
+ .toArray();
62
56
  (0, globals_1.expect)(result[0].propertyusegroup).toBe('COMMERCIAL');
63
57
  (0, globals_1.expect)(result[1].propertyusegroup).toBe('COMMERCIAL');
64
58
  });
@@ -27,9 +27,7 @@ async function setupProperties(base) {
27
27
  exports.setupProperties = setupProperties;
28
28
  const url = `mongodb://${process.env.MONGO_HOSTNAME ?? 'localhost'}:27017`;
29
29
  const mongoClient = new mongodb_1.MongoClient(url, {
30
- useNewUrlParser: true,
31
- useUnifiedTopology: true,
32
- poolSize: 60,
30
+ maxPoolSize: 60,
33
31
  });
34
32
  let connectedMongoClient;
35
33
  const openConnection = async () => {
@@ -38,7 +38,7 @@ function getFilterFetcherProcessor(db) {
38
38
  utilitieswatersource: 1,
39
39
  utilitiessewageusage: 1,
40
40
  flooringmaterialprimary: 1,
41
- _id: 0, // eslint-disable-line
41
+ _id: 0,
42
42
  },
43
43
  })
44
44
  .toArray();
@@ -25,12 +25,11 @@ function getPropertyUseGroupProcessor(db) {
25
25
  const collection = await getPropertiesCollection(db);
26
26
  const propQuery = properties.map(({ _id, ...p }) => ({
27
27
  updateOne: {
28
- // eslint-disable-next-line @typescript-eslint/naming-convention
29
28
  filter: { _id },
30
29
  update: { $set: p },
31
30
  },
32
31
  }));
33
- return collection.bulkWrite(propQuery, { ordered: true, w: 1 });
32
+ return collection.bulkWrite(propQuery, { ordered: true, writeConcern: { w: 1 } });
34
33
  };
35
34
  const getProperties = (zip) => {
36
35
  return db
@@ -26,12 +26,11 @@ function getAssessorLastSaleDateProcessor(db) {
26
26
  const collection = await getPropertiesCollection(db);
27
27
  const propQuery = properties.map(({ _id, ...p }) => ({
28
28
  updateOne: {
29
- // eslint-disable-next-line @typescript-eslint/naming-convention
30
29
  filter: { _id },
31
30
  update: { $set: p },
32
31
  },
33
32
  }));
34
- return collection.bulkWrite(propQuery, { ordered: true, w: 1 });
33
+ return collection.bulkWrite(propQuery, { ordered: true, writeConcern: { w: 1 } });
35
34
  };
36
35
  return async function processZip(zip, errors) {
37
36
  const meta = {
@@ -228,7 +228,7 @@ export declare const convertStringToDate: (props: Property[], propName: keyof Pr
228
228
  buildingscount: number;
229
229
  modifiedon: string;
230
230
  location: string;
231
- _id: import("bson").ObjectID;
231
+ _id: import("bson").ObjectId;
232
232
  }[];
233
233
  export declare function FilterNameValidator(filtersToIgnore: string[], unknownCharacter: string): {
234
234
  isValidFilterName(filterName: string, checkIgnoredFilters?: boolean): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/acquisition-functions",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -15,10 +15,9 @@
15
15
  "devDependencies": {
16
16
  "@jest/globals": "29.1.2",
17
17
  "@types/jest": "^29.1.0",
18
- "@types/mongodb": "^3.6.20",
19
18
  "@types/node": "^18.6.3",
20
19
  "jest": "29.1.2",
21
- "mongodb": "3.6.3",
20
+ "mongodb": "~6.6.2",
22
21
  "ts-jest": "29.0.3",
23
22
  "ts-node": "^10.9.1"
24
23
  },
@@ -28,5 +27,5 @@
28
27
  "cli": {
29
28
  "webpack": false
30
29
  },
31
- "gitHead": "5e7083d61a148b1b76b265f7d85caf476c3e8b26"
30
+ "gitHead": "f9ea8fb7e8b10f8d969e7afa52ffb9bb76de07b7"
32
31
  }