@mountainpass/addressr 1.0.260 → 1.0.263
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/client/elasticsearch.js +1 -1
- package/lib/service/address-service.js +21 -18
- package/lib/version.js +1 -1
- package/package.json +7 -4
|
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
16
|
|
|
17
17
|
const waitPort = require('wait-port');
|
|
18
18
|
|
|
19
|
-
const elasticsearch = require('@
|
|
19
|
+
const elasticsearch = require('@opensearch-project/opensearch');
|
|
20
20
|
|
|
21
21
|
const logger = (0, _debug2.default)('api');
|
|
22
22
|
const error = (0, _debug2.default)('error');
|
|
@@ -68,6 +68,10 @@ var _crypto = require("crypto");
|
|
|
68
68
|
|
|
69
69
|
var _crypto2 = _interopRequireDefault(_crypto);
|
|
70
70
|
|
|
71
|
+
var _globPromise = require("glob-promise");
|
|
72
|
+
|
|
73
|
+
var _globPromise2 = _interopRequireDefault(_globPromise);
|
|
74
|
+
|
|
71
75
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
72
76
|
|
|
73
77
|
/* eslint-disable eslint-comments/disable-enable-pair */
|
|
@@ -606,7 +610,7 @@ function mapToMla(s) {
|
|
|
606
610
|
|
|
607
611
|
if (s.lotNumber && s.number === undefined) {
|
|
608
612
|
number = `LOT ${s.lotNumber.prefix || ''}${s.lotNumber.number || ''}${s.lotNumber.suffix || ''}`;
|
|
609
|
-
} else {
|
|
613
|
+
} else if (s.number) {
|
|
610
614
|
number = `${s.number.prefix || ''}${s.number.number || ''}${s.number.suffix || ''}`;
|
|
611
615
|
|
|
612
616
|
if (s.number.last) {
|
|
@@ -1086,7 +1090,8 @@ const {
|
|
|
1086
1090
|
} = require('fs').promises;
|
|
1087
1091
|
|
|
1088
1092
|
async function getFiles(currentDir, baseDir) {
|
|
1089
|
-
const dir = resolve(baseDir, currentDir);
|
|
1093
|
+
const dir = _path2.default.resolve(baseDir, currentDir);
|
|
1094
|
+
|
|
1090
1095
|
logger(`reading ${dir} (${currentDir} in ${baseDir})`);
|
|
1091
1096
|
const dirents = await readdir(dir, {
|
|
1092
1097
|
withFileTypes: true
|
|
@@ -1456,23 +1461,21 @@ async function loadGnaf({
|
|
|
1456
1461
|
throw new Error(`Data dir '${unzipped}' is empty`);
|
|
1457
1462
|
}
|
|
1458
1463
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
});
|
|
1466
|
-
} else if (contents.includes('Counts.csv')) {
|
|
1467
|
-
// feb20 doesn't have an intermediate directory
|
|
1468
|
-
const mainDirectory = unzipped;
|
|
1469
|
-
logger('2. Main Data dir', mainDirectory);
|
|
1470
|
-
await loadGnafData(mainDirectory, {
|
|
1471
|
-
refresh
|
|
1472
|
-
});
|
|
1473
|
-
} else {
|
|
1474
|
-
throw new Error(`Data dir '${unzipped}' has unexpected contents: ${contents}`);
|
|
1464
|
+
const gnafDir = await (0, _globPromise2.default)('**/G-NAF/', {
|
|
1465
|
+
cwd: unzipped
|
|
1466
|
+
});
|
|
1467
|
+
console.log(gnafDir);
|
|
1468
|
+
|
|
1469
|
+
if (gnafDir.length === 0) {
|
|
1470
|
+
throw new Error(`Cannot find 'G-NAF' directory in Data dir '${unzipped}'`);
|
|
1475
1471
|
}
|
|
1472
|
+
|
|
1473
|
+
const mainDirectory = _path2.default.dirname(`${unzipped}/${gnafDir[0].slice(0, -1)}`);
|
|
1474
|
+
|
|
1475
|
+
logger('Main Data dir', mainDirectory);
|
|
1476
|
+
await loadGnafData(mainDirectory, {
|
|
1477
|
+
refresh
|
|
1478
|
+
});
|
|
1476
1479
|
}
|
|
1477
1480
|
/**
|
|
1478
1481
|
* Get Addresses
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountainpass/addressr",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.263",
|
|
4
4
|
"description": "Australian Address Validation, Search and Autocomplete",
|
|
5
5
|
"author": "Mountain Pass <addressr@mountain-pass.com.au>",
|
|
6
6
|
"contributors": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"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 ",
|
|
41
41
|
"start:server:OT": "ES_INDEX_NAME=ot DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport babel-node server.js",
|
|
42
42
|
"start:server": "DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport babel-node server.js",
|
|
43
|
-
"start:server:prod": ". .env && PORT=$npm_package_config_localport DEBUG=error
|
|
43
|
+
"start:server:prod": ". .env && PORT=$npm_package_config_localport DEBUG=error babel-node server.js",
|
|
44
44
|
"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",
|
|
45
45
|
"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",
|
|
46
46
|
"start:server:preinstalled": "ES_INDEX_NAME=test DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport addressr-server",
|
|
@@ -101,7 +101,8 @@
|
|
|
101
101
|
"docker:push": "docker push \"mountainpass/addressr:${npm_package_version}\"",
|
|
102
102
|
"postdocker:push": "docker push \"mountainpass/addressr:latest\"",
|
|
103
103
|
"check-licenses": "license-checker --production --onlyAllow 'MIT;Apache-2.0;ISC;Custom: http://github.com/substack/node-bufferlist;Unlicense;BSD-2-Clause;BSD-3-Clause;WTFPL;0BSD;MIT*' --summary",
|
|
104
|
-
"pre-commit": "lint-staged && npm run check-licenses"
|
|
104
|
+
"pre-commit": "lint-staged && npm run check-licenses",
|
|
105
|
+
"test:performance": "k6 run --out csv=target/stress.csv test/k6/script.js"
|
|
105
106
|
},
|
|
106
107
|
"bin": {
|
|
107
108
|
"addressr-loader": "lib/bin/addressr-loader.js",
|
|
@@ -131,12 +132,14 @@
|
|
|
131
132
|
"license": "Apache-2.0",
|
|
132
133
|
"private": false,
|
|
133
134
|
"dependencies": {
|
|
134
|
-
"@elastic/elasticsearch": "^7.13.0",
|
|
135
135
|
"@mountainpass/waycharter": "^1.0.68",
|
|
136
|
+
"@opensearch-project/opensearch": "^2.0.0",
|
|
136
137
|
"debug": "^4.1.1",
|
|
137
138
|
"directory-exists": "^2.0.1",
|
|
138
139
|
"dotenv": "^10.0.0",
|
|
139
140
|
"express": "^4.17.1",
|
|
141
|
+
"glob": "^7.1.7",
|
|
142
|
+
"glob-promise": "^4.2.0",
|
|
140
143
|
"got": "^9.6.0",
|
|
141
144
|
"http-link-header": "1.0.2",
|
|
142
145
|
"js-yaml": "^3.3.0",
|