@mountainpass/addressr 1.0.268 → 1.0.269

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.
@@ -364,7 +364,7 @@ async function unzipFile(file) {
364
364
  // }
365
365
 
366
366
 
367
- function levelTypeCodeToName(code, context) {
367
+ function levelTypeCodeToName(code, context, address) {
368
368
  const found = context['Authority_Code_LEVEL_TYPE_AUT_psv'].find(entry => entry.CODE === code);
369
369
 
370
370
  if (found) {
@@ -372,10 +372,13 @@ function levelTypeCodeToName(code, context) {
372
372
  }
373
373
 
374
374
  error(`Unknown Level Type Code: '${code}'`);
375
+ error({
376
+ address
377
+ });
375
378
  return;
376
379
  }
377
380
 
378
- function flatTypeCodeToName(code, context) {
381
+ function flatTypeCodeToName(code, context, address) {
379
382
  const found = context['Authority_Code_FLAT_TYPE_AUT_psv'].find(entry => entry.CODE === code);
380
383
 
381
384
  if (found) {
@@ -383,6 +386,9 @@ function flatTypeCodeToName(code, context) {
383
386
  }
384
387
 
385
388
  error(`Unknown Flat Type Code: '${code}'`);
389
+ error({
390
+ address
391
+ });
386
392
  return;
387
393
  }
388
394
 
@@ -720,7 +726,7 @@ function mapAddressDetails(d, context, i, count) {
720
726
  level: { ...(d.LEVEL_TYPE_CODE !== '' && {
721
727
  type: {
722
728
  code: d.LEVEL_TYPE_CODE,
723
- name: levelTypeCodeToName(d.LEVEL_TYPE_CODE, context)
729
+ name: levelTypeCodeToName(d.LEVEL_TYPE_CODE, context, d)
724
730
  }
725
731
  }),
726
732
  ...(d.LEVEL_NUMBER_PREFIX !== '' && {
@@ -738,7 +744,7 @@ function mapAddressDetails(d, context, i, count) {
738
744
  flat: { ...(d.FLAT_TYPE_CODE !== '' && {
739
745
  type: {
740
746
  code: d.FLAT_TYPE_CODE,
741
- name: flatTypeCodeToName(d.FLAT_TYPE_CODE, context)
747
+ name: flatTypeCodeToName(d.FLAT_TYPE_CODE, context, d)
742
748
  }
743
749
  }),
744
750
  ...(d.FLAT_NUMBER_PREFIX !== '' && {
@@ -821,45 +827,48 @@ async function loadAddressDetails(file, expectedCount, context, {
821
827
 
822
828
  if (chunk.errors.length > 0) {
823
829
  error(`Errors reading '${file}': ${chunk.errors}`);
824
- } else {
825
- const indexingBody = [];
826
- chunk.data.forEach(row => {
827
- const item = mapAddressDetails(row, context, actualCount, expectedCount);
828
- items.push(item);
829
- actualCount += 1;
830
- indexingBody.push({
831
- index: {
832
- _index: ES_INDEX_NAME,
833
- _id: `/addresses/${item.pid}`
834
- }
835
- });
836
- const {
837
- sla,
838
- ssla,
839
- ...structured
840
- } = item;
841
- indexingBody.push({
842
- sla,
843
- ssla,
844
- structured,
845
- confidence: structured.structured.confidence
846
- });
830
+ error({
831
+ errors: chunk.errors
847
832
  });
833
+ }
848
834
 
849
- if (indexingBody.length > 0) {
850
- sendIndexRequest(indexingBody, undefined, {
851
- refresh
852
- }).then(() => {
853
- parser.resume();
854
- return;
855
- }).catch(error_ => {
856
- error('error sending index request', error_);
857
- throw error_;
858
- });
859
- } else {
860
- // nothing to process. Have reached end of file.
835
+ const indexingBody = [];
836
+ chunk.data.forEach(row => {
837
+ const item = mapAddressDetails(row, context, actualCount, expectedCount);
838
+ items.push(item);
839
+ actualCount += 1;
840
+ indexingBody.push({
841
+ index: {
842
+ _index: ES_INDEX_NAME,
843
+ _id: `/addresses/${item.pid}`
844
+ }
845
+ });
846
+ const {
847
+ sla,
848
+ ssla,
849
+ ...structured
850
+ } = item;
851
+ indexingBody.push({
852
+ sla,
853
+ ssla,
854
+ structured,
855
+ confidence: structured.structured.confidence
856
+ });
857
+ });
858
+
859
+ if (indexingBody.length > 0) {
860
+ sendIndexRequest(indexingBody, undefined, {
861
+ refresh
862
+ }).then(() => {
861
863
  parser.resume();
862
- }
864
+ return;
865
+ }).catch(error_ => {
866
+ error('error sending index request', error_);
867
+ throw error_;
868
+ });
869
+ } else {
870
+ // nothing to process. Have reached end of file.
871
+ parser.resume();
863
872
  }
864
873
  },
865
874
  // step: function(row) {
@@ -1232,10 +1241,13 @@ async function loadFileCounts(countsFile) {
1232
1241
  step: function (row) {
1233
1242
  if (row.errors.length > 0) {
1234
1243
  error(`Errors reading '${countsFile}': ${row.errors}`);
1235
- } else {
1236
- const psvFile = row.data.File.replace(/\\/g, '/').replace(/\.zip$/, '.psv');
1237
- filesCounts[psvFile] = row.data.Count;
1244
+ error({
1245
+ errors: row.errors
1246
+ });
1238
1247
  }
1248
+
1249
+ const psvFile = row.data.File.replace(/\\/g, '/').replace(/\.zip$/, '.psv');
1250
+ filesCounts[psvFile] = row.data.Count;
1239
1251
  },
1240
1252
  complete: function () {
1241
1253
  console.log('GNAF data loaded');
@@ -1333,6 +1345,9 @@ async function loadSiteGeo(files, directory, state, loadContext, filesCounts) {
1333
1345
 
1334
1346
  if (chunk.errors.length > 0) {
1335
1347
  error(`Errors reading '${directory}/${geoFile}': ${chunk.errors}`);
1348
+ error({
1349
+ errors: chunk.errors
1350
+ });
1336
1351
  } else {
1337
1352
  chunk.data.forEach(row => {
1338
1353
  if (expectedCount) {
@@ -1385,6 +1400,9 @@ async function loadDefaultGeo(files, directory, state, loadContext, filesCounts)
1385
1400
 
1386
1401
  if (chunk.errors.length > 0) {
1387
1402
  error(`Errors reading '${directory}/${geoFile}': ${chunk.errors}`);
1403
+ error({
1404
+ errors: chunk.errors
1405
+ });
1388
1406
  } else {
1389
1407
  chunk.data.forEach(row => {
1390
1408
  if (expectedCount) {
package/lib/version.js CHANGED
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  // generated by genversion
7
- const version = exports.version = '1.0.268';
7
+ const version = exports.version = '1.0.269';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mountainpass/addressr",
3
- "version": "1.0.268",
3
+ "version": "1.0.269",
4
4
  "description": "Australian Address Validation, Search and Autocomplete",
5
5
  "author": "Mountain Pass <addressr@mountain-pass.com.au>",
6
6
  "contributors": [
@@ -10,12 +10,13 @@
10
10
  "node": ">=14.21.2"
11
11
  },
12
12
  "config": {
13
- "localport": "6060"
13
+ "localport": "6060",
14
+ "SEARCH_IMAGE": "opensearchproject/opensearch:1.2.4"
14
15
  },
15
16
  "scripts": {
16
- "docs:build": "log4brains build",
17
- "docs:preview": "log4brains preview",
18
- "deploy": "deploy/deploy.sh",
17
+ "pull:open-search": "docker pull ${npm_package_config_SEARCH_IMAGE}",
18
+ "start:open-search": "docker run -p 9200:9200 -p 9300:9300 -e \"ES_JAVA_OPTS=-Xms1g -Xmx1g\" -e \"discovery.type=single-node\" -e \"plugins.security.disabled=true\" \"${npm_package_config_SEARCH_IMAGE}\"",
19
+ "hmm": "echo mountainpass-addressr-${npm_package_version}.tgz",
19
20
  "requirements-check": "scripts/check-version.js",
20
21
  "postinstall": "npm run requirements-check",
21
22
  "prestart:loader:babel:OT": "npm run build && cp -r target lib/.",
@@ -42,7 +43,7 @@
42
43
  "start:loader:geo:WA:prod": ". .env && COVERED_STATES=WA PORT=$npm_package_config_localport NODE_OPTIONS=--max_old_space_size=8196 babel-node loader.js ",
43
44
  "start:server:OT": "ES_INDEX_NAME=ot DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport babel-node server.js",
44
45
  "start:server": "DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport babel-node server.js",
45
- "start:server:prod": ". .env && PORT=$npm_package_config_localport DEBUG=error,api,express:*,swagger-tools*,test,es babel-node src/server2.js",
46
+ "start:server:prod": ". .env && PORT=$npm_package_config_localport DEBUG=error babel-node server.js",
46
47
  "start:server2:prod": ". .env && ADDRESSR_ACCESS_CONTROL_ALLOW_ORIGIN=null ADDRESSR_ACCESS_CONTROL_EXPOSE_HEADERS=* PORT=$npm_package_config_localport DEBUG=error,api,express:*,swagger-tools*,test,es babel-node src/server2.js",
47
48
  "start:server:OT:prod": ". .env && ES_INDEX_NAME=ot PORT=$npm_package_config_localport DEBUG=error,api,express:*,swagger-tools*,test,es babel-node server.js",
48
49
  "start:server:preinstalled": "ES_INDEX_NAME=test DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport addressr-server",
@@ -152,7 +153,6 @@
152
153
  "papaparse": "^5.0.0",
153
154
  "progress": "^2.0.3",
154
155
  "semver": "^7.3.2",
155
- "shelljs": "^0.8.5",
156
156
  "swagger-tools": "^0.10.4",
157
157
  "unzip-stream": "^0.3.0",
158
158
  "uri-template-lite": "^20.5.0",
@@ -169,17 +169,14 @@
169
169
  "@babel/preset-react": "^7.0.0",
170
170
  "@babel/register": "^7.7.0",
171
171
  "@babel/runtime": "^7.5.0",
172
- "@dagger.io/dagger": "^0.3.1",
173
172
  "@istanbuljs/nyc-config-babel": "^3.0.0",
174
173
  "@mountainpass/waychaser": "^4.0.0",
175
174
  "@windyroad/cucumber-js-throwables": "^1.0.4",
176
- "@windyroad/quick-containers-js": "^2.0.0",
177
175
  "babel-eslint": "^10.0.2",
178
176
  "babel-plugin-istanbul": "^6.0.0",
179
177
  "babel-preset-env": "^1.7.0",
180
178
  "chai": "^4.2.0",
181
179
  "cucumber": "^5.1.0",
182
- "dockerode": "^3.3.4",
183
180
  "eslint": "^7.9.0",
184
181
  "eslint-config-prettier": "^8.0.0",
185
182
  "eslint-plugin-chai-friendly": "^0.7.1",
@@ -198,15 +195,13 @@
198
195
  "istanbul-middleware": "^0.2.2",
199
196
  "license-checker": "^25.0.1",
200
197
  "lint-staged": "^11.0.0",
201
- "log4brains": "^1.0.1",
202
198
  "ngrok": "^4.0.1",
203
199
  "nodemon": "^2.0.4",
204
200
  "npm-check": "^5.9.0",
205
201
  "npm-run-all": "^4.1.5",
206
202
  "nyc": "^15.1.0",
207
203
  "prettier": "^2.1.0",
208
- "prettier-config-standard": "^4.0.0",
209
- "zip-a-folder": "^1.1.3"
204
+ "prettier-config-standard": "^4.0.0"
210
205
  },
211
206
  "repository": {
212
207
  "type": "git",