@mountainpass/addressr 1.0.260 → 1.0.261
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/service/address-service.js +20 -17
- package/lib/version.js +1 -1
- package/package.json +4 -2
|
@@ -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 */
|
|
@@ -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.261",
|
|
4
4
|
"description": "Australian Address Validation, Search and Autocomplete",
|
|
5
5
|
"author": "Mountain Pass <addressr@mountain-pass.com.au>",
|
|
6
6
|
"contributors": [
|
|
@@ -131,12 +131,14 @@
|
|
|
131
131
|
"license": "Apache-2.0",
|
|
132
132
|
"private": false,
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"@elastic/elasticsearch": "^7.
|
|
134
|
+
"@elastic/elasticsearch": "^7.15.0",
|
|
135
135
|
"@mountainpass/waycharter": "^1.0.68",
|
|
136
136
|
"debug": "^4.1.1",
|
|
137
137
|
"directory-exists": "^2.0.1",
|
|
138
138
|
"dotenv": "^10.0.0",
|
|
139
139
|
"express": "^4.17.1",
|
|
140
|
+
"glob": "^7.1.7",
|
|
141
|
+
"glob-promise": "^4.2.0",
|
|
140
142
|
"got": "^9.6.0",
|
|
141
143
|
"http-link-header": "1.0.2",
|
|
142
144
|
"js-yaml": "^3.3.0",
|