@mountainpass/addressr 1.1.7 → 1.1.8

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.
@@ -118,16 +118,7 @@ async function initIndex(esClient, clear, synonyms) {
118
118
  }
119
119
  }
120
120
  };
121
- if (!exists.body) {
122
- logger(`creating index: ${ES_INDEX_NAME}`);
123
- const indexCreateResult = await esClient.indices.create({
124
- index: ES_INDEX_NAME,
125
- body: indexBody
126
- });
127
- logger({
128
- indexCreateResult
129
- });
130
- } else {
121
+ if (exists.body) {
131
122
  // update the index
132
123
  const indexCloseResult = await esClient.indices.close({
133
124
  index: ES_INDEX_NAME
@@ -162,6 +153,15 @@ async function initIndex(esClient, clear, synonyms) {
162
153
  logger({
163
154
  refreshResult
164
155
  });
156
+ } else {
157
+ logger(`creating index: ${ES_INDEX_NAME}`);
158
+ const indexCreateResult = await esClient.indices.create({
159
+ index: ES_INDEX_NAME,
160
+ body: indexBody
161
+ });
162
+ logger({
163
+ indexCreateResult
164
+ });
165
165
  }
166
166
  const indexGetResult = await esClient.indices.get({
167
167
  index: ES_INDEX_NAME,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const fs = require('fs');
3
+ const fs = require('node:fs');
4
4
  const packageJson = require('../package.json');
5
5
  const shell = require('shelljs');
6
6
  const {
@@ -972,7 +972,7 @@ function buildSynonyms(context) {
972
972
  }
973
973
  const {
974
974
  readdir
975
- } = require('fs').promises;
975
+ } = require('node:fs').promises;
976
976
  async function getFiles(currentDir, baseDir) {
977
977
  const dir = _nodePath2.default.resolve(baseDir, currentDir);
978
978
  logger(`reading ${dir} (${currentDir} in ${baseDir})`);
@@ -992,7 +992,7 @@ function countFileLines(filePath) {
992
992
  let last;
993
993
  readStream.on('data', function (chunk) {
994
994
  lines += chunk.split('\n').length - 1;
995
- last = chunk[chunk.length - 1];
995
+ last = chunk.at(-1);
996
996
  });
997
997
  readStream.on('end', function () {
998
998
  if (last !== '\n') {
@@ -1105,7 +1105,7 @@ async function loadFileCounts(countsFile) {
1105
1105
  errors: row.errors
1106
1106
  });
1107
1107
  }
1108
- const psvFile = row.data.File.replace(/\\/g, '/').replace(/\.zip$/, '.psv');
1108
+ const psvFile = row.data.File.replaceAll('\\', '/').replace(/\.zip$/, '.psv');
1109
1109
  filesCounts[psvFile] = row.data.Count;
1110
1110
  },
1111
1111
  complete: function () {
@@ -1283,12 +1283,12 @@ async function loadAuthFiles(files, directory, loadContext, filesCounts) {
1283
1283
  complete: function (results) {
1284
1284
  loadContext[contextKey] = results.data;
1285
1285
  if (filesCounts) {
1286
- if (results.data.length != filesCounts[authFile]) {
1287
- error(`Error loading '${directory}/${authFile}'. Expected '${filesCounts[authFile]}' rows, got '${results.data.length}'`);
1288
- reject(`Error loading '${directory}/${authFile}'. Expected '${filesCounts[authFile]}' rows, got '${results.data.length}'`);
1289
- } else {
1286
+ if (results.data.length == filesCounts[authFile]) {
1290
1287
  logger(`loaded '${results.data.length}' rows from '${directory}/${authFile}' into key '${contextKey}'`);
1291
1288
  resolve();
1289
+ } else {
1290
+ error(`Error loading '${directory}/${authFile}'. Expected '${filesCounts[authFile]}' rows, got '${results.data.length}'`);
1291
+ reject(`Error loading '${directory}/${authFile}'. Expected '${filesCounts[authFile]}' rows, got '${results.data.length}'`);
1292
1292
  }
1293
1293
  }
1294
1294
  },
package/lib/swagger.js CHANGED
@@ -35,7 +35,7 @@ var options = {
35
35
 
36
36
  // The Swagger document (require it, build it programmatically, fetch it from a URL, ...)
37
37
  var spec = (0, _nodeFs.readFileSync)(_nodePath2.default.join(__dirname, 'api/swagger.yaml'), 'utf8');
38
- var swaggerDoc = exports.swaggerDoc = (0, _jsYaml.safeLoad)(spec);
38
+ var swaggerDoc = exports.swaggerDoc = (0, _jsYaml.load)(spec);
39
39
  global.swaggerDoc = swaggerDoc;
40
40
  function swaggerInit() {
41
41
  // Initialize the Swagger middleware
@@ -5,10 +5,10 @@ var _progress2 = _interopRequireDefault(_progress);
5
5
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
6
6
  const {
7
7
  parse
8
- } = require('url');
9
- const http = require('https');
10
- const fs = require('fs');
11
- const pathUtil = require('path');
8
+ } = require('node:url');
9
+ const http = require('node:https');
10
+ const fs = require('node:fs');
11
+ const pathUtil = require('node:path');
12
12
  module.exports = function (url, path, size) {
13
13
  const uri = parse(url);
14
14
  if (!path) {
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.1.7';
7
+ const version = exports.version = '1.1.8';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mountainpass/addressr",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Australian Address Validation, Search and Autocomplete",
5
5
  "author": {
6
6
  "name": "Mountain Pass",
@@ -167,7 +167,7 @@
167
167
  "glob-promise": "^4.2.0",
168
168
  "got": "^9.6.0",
169
169
  "http-link-header": "1.0.2",
170
- "js-yaml": "^3.3.0",
170
+ "js-yaml": "^4.1.1",
171
171
  "json-ptr": "2.1.0",
172
172
  "keyv": "^4.0.1",
173
173
  "keyv-file": "^0.2.0",
@@ -184,6 +184,7 @@
184
184
  "devDependencies": {
185
185
  "@babel/cli": "^7.6.2",
186
186
  "@babel/core": "^7.6.2",
187
+ "@babel/eslint-parser": "^7.28.6",
187
188
  "@babel/node": "^7.6.2",
188
189
  "@babel/plugin-proposal-class-properties": "^7.5.5",
189
190
  "@babel/plugin-transform-runtime": "^7.6.2",
@@ -195,24 +196,22 @@
195
196
  "@istanbuljs/nyc-config-babel": "^3.0.0",
196
197
  "@mountainpass/waychaser": "^4.0.0",
197
198
  "@windyroad/cucumber-js-throwables": "^1.0.4",
198
- "babel-eslint": "^10.0.2",
199
199
  "babel-plugin-istanbul": "^6.0.0",
200
200
  "babel-preset-env": "^1.7.0",
201
201
  "bats": "^1.13.0",
202
202
  "chai": "^4.2.0",
203
203
  "cucumber": "^5.1.0",
204
204
  "dry-aged-deps": "^2.6.0",
205
- "eslint": "^7.9.0",
205
+ "eslint": "^8.57.1",
206
206
  "eslint-config-prettier": "^9.1.2",
207
- "eslint-plugin-chai-friendly": "^0.7.1",
207
+ "eslint-plugin-chai-friendly": "^0.7.4",
208
208
  "eslint-plugin-eslint-comments": "^3.2.0",
209
- "eslint-plugin-import": "^2.22.0",
210
- "eslint-plugin-node": "^11.1.0",
211
- "eslint-plugin-prettier": "^4.2.5",
212
- "eslint-plugin-promise": "^5.1.0",
213
- "eslint-plugin-react": "^7.7.0",
214
- "eslint-plugin-security": "^1.4.0",
215
- "eslint-plugin-unicorn": "^34.0.1",
209
+ "eslint-plugin-import": "^2.32.0",
210
+ "eslint-plugin-n": "^17.24.0",
211
+ "eslint-plugin-prettier": "^5.5.5",
212
+ "eslint-plugin-promise": "^6.6.0",
213
+ "eslint-plugin-security": "^1.7.1",
214
+ "eslint-plugin-unicorn": "^49.0.0",
216
215
  "genversion": "^3.0.0",
217
216
  "husky": "^9.1.7",
218
217
  "imagemin-lint-staged": "^0.5.1",
@@ -220,7 +219,7 @@
220
219
  "istanbul-middleware": "^0.2.2",
221
220
  "license-checker": "^25.0.1",
222
221
  "lint-staged": "^15.5.2",
223
- "nodemon": "^2.0.4",
222
+ "nodemon": "^3.1.14",
224
223
  "npm-check": "^5.9.0",
225
224
  "npm-run-all": "^4.1.5",
226
225
  "nyc": "^15.1.0",