nodejs-nomer 1.0.8 → 1.0.9

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/dist/index.js CHANGED
@@ -41,25 +41,25 @@ var Nomer = /*#__PURE__*/function () {
41
41
  }, {
42
42
  key: "clean",
43
43
  value: function clean() {
44
- var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("clean", this.getPropertiesPath()));
44
+ var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("clean", false, this.getPropertiesPath()));
45
45
  return res;
46
46
  }
47
47
  }, {
48
48
  key: "inputSchema",
49
49
  value: function inputSchema() {
50
- var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("input-schema", this.getPropertiesPath()));
50
+ var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("input-schema", false, this.getPropertiesPath()));
51
51
  return res;
52
52
  }
53
53
  }, {
54
54
  key: "outputSchema",
55
55
  value: function outputSchema() {
56
- var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("output-schema", this.getPropertiesPath()));
56
+ var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("output-schema", false, this.getPropertiesPath()));
57
57
  return res;
58
58
  }
59
59
  }, {
60
60
  key: "properties",
61
61
  value: function properties() {
62
- var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("properties", this.getPropertiesPath()));
62
+ var res = (0, _utils.runNomer)((0, _utils.getNomerSimpleCmd)("properties", false, this.getPropertiesPath()));
63
63
  return res;
64
64
  }
65
65
  }, {
package/dist/result.js CHANGED
@@ -13,7 +13,6 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
13
13
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
15
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
- var TSV_COLUMNS = ['inputId', 'inputName', 'match', 'externalId', 'name', 'authorship', 'rank', 'commonNames', 'path', 'pathIds', 'pathNames', 'pathAuthorship', 'externalUrl'];
17
16
  var Result = /*#__PURE__*/function () {
18
17
  function Result() {
19
18
  _classCallCheck(this, Result);
package/dist/utils.js CHANGED
@@ -50,7 +50,9 @@ var getNomerSimpleCmd = function getNomerSimpleCmd() {
50
50
  };
51
51
  var runNomer = function runNomer(nomerCmd) {
52
52
  try {
53
- var result = execSync(nomerCmd).toString();
53
+ var result = execSync(nomerCmd, {
54
+ maxBuffer: 4096 * 4096
55
+ }).toString();
54
56
  if (result) {
55
57
  return result.trimEnd();
56
58
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nodejs-nomer",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "NodeJS wrapper for nomer",
5
- "directories": {
6
- "bin": "./bin"
5
+ "bin": {
6
+ "nomer": "./bin/nomer"
7
7
  },
8
8
  "main": "index.js",
9
9
  "scripts": {
@@ -32,4 +32,4 @@
32
32
  "dependencies": {
33
33
  "properties-file": "^3.5.1"
34
34
  }
35
- }
35
+ }
package/src/index.js CHANGED
@@ -23,22 +23,22 @@ class Nomer {
23
23
  }
24
24
 
25
25
  clean() {
26
- const res = runNomer(getNomerSimpleCmd("clean", this.getPropertiesPath()))
26
+ const res = runNomer(getNomerSimpleCmd("clean", false, this.getPropertiesPath()))
27
27
  return res;
28
28
  }
29
29
 
30
30
  inputSchema() {
31
- const res = runNomer(getNomerSimpleCmd("input-schema", this.getPropertiesPath()))
31
+ const res = runNomer(getNomerSimpleCmd("input-schema", false, this.getPropertiesPath()))
32
32
  return res;
33
33
  }
34
34
 
35
35
  outputSchema() {
36
- const res = runNomer(getNomerSimpleCmd("output-schema", this.getPropertiesPath()))
36
+ const res = runNomer(getNomerSimpleCmd("output-schema", false, this.getPropertiesPath()))
37
37
  return res;
38
38
  }
39
39
 
40
40
  properties() {
41
- const res = runNomer(getNomerSimpleCmd("properties", this.getPropertiesPath()))
41
+ const res = runNomer(getNomerSimpleCmd("properties", false, this.getPropertiesPath()))
42
42
  return res;
43
43
  }
44
44
 
package/src/result.js CHANGED
@@ -1,19 +1,3 @@
1
- const TSV_COLUMNS = [
2
- 'inputId',
3
- 'inputName',
4
- 'match',
5
- 'externalId',
6
- 'name',
7
- 'authorship',
8
- 'rank',
9
- 'commonNames',
10
- 'path',
11
- 'pathIds',
12
- 'pathNames',
13
- 'pathAuthorship',
14
- 'externalUrl'
15
- ];
16
-
17
1
  class Result {
18
2
 
19
3
  static json(result) {
package/src/utils.js CHANGED
@@ -4,7 +4,7 @@ const getNomerValidateCmd = (filepath = "", cmd = "validate-term", properties =
4
4
  if (filepath === "") {
5
5
  throw new Exception("Filepath cannot be empty string");
6
6
  }
7
- let nomerCmd = `curl -L ${filepath} | ./bin/nomer ${cmd}`;
7
+ let nomerCmd = `curl -L ${filepath} | nomer ${cmd}`;
8
8
  if (properties) {
9
9
  nomerCmd = `${nomerCmd} -p ${properties}`;
10
10
  }
@@ -13,7 +13,7 @@ const getNomerValidateCmd = (filepath = "", cmd = "validate-term", properties =
13
13
  }
14
14
 
15
15
  const getNomerMatchCmd = (query = "", cmd = "append", matcher = "globi-taxon-cache", properties = null, outputFormat = null, echoOpt = "-e") => {
16
- let nomerCmd = `echo ${echoOpt} '${query}' | ./bin/nomer ${cmd} ${matcher}`;
16
+ let nomerCmd = `echo ${echoOpt} '${query}' | nomer ${cmd} ${matcher}`;
17
17
  if (properties) {
18
18
  nomerCmd = `${nomerCmd} -p ${properties}`;
19
19
  }
@@ -25,7 +25,7 @@ const getNomerMatchCmd = (query = "", cmd = "append", matcher = "globi-taxon-cac
25
25
  }
26
26
 
27
27
  const getNomerSimpleCmd = (cmd = "version", verbose = false, properties = null, outputFormat = null) => {
28
- let nomerCmd = `./bin/nomer ${cmd}`;
28
+ let nomerCmd = `nomer ${cmd}`;
29
29
  if (properties) {
30
30
  nomerCmd = `${nomerCmd} -p ${properties}`;
31
31
  }
@@ -41,7 +41,9 @@ const getNomerSimpleCmd = (cmd = "version", verbose = false, properties = null,
41
41
 
42
42
  const runNomer = (nomerCmd) => {
43
43
  try {
44
- const result = execSync(nomerCmd).toString();
44
+ const result = execSync(nomerCmd, {
45
+ maxBuffer: 4096 * 4096
46
+ }).toString();
45
47
  if (result) {
46
48
  return result.trimEnd();
47
49
  }
package/test/script.js CHANGED
@@ -1,7 +1,23 @@
1
1
  const Nomer = require("nodejs-nomer")
2
2
 
3
3
  const nomer = new Nomer();
4
+
5
+ console.time("version")
4
6
  console.log(nomer.version());
7
+ console.timeEnd("version")
8
+
9
+
10
+
11
+ // console.time("append")
12
+ // const results = []
13
+ // for (let index = 0; index < 100; index++) {
14
+ // results.push(nomer.append("\tBauhinia rufa\t", "gbif"))
15
+ // }
16
+ // console.timeEnd("append")
5
17
 
6
- console.log(nomer.matcher());
7
- console.log(nomer.append("\tHomo sapiens", "gbif-web"));
18
+ // console.time("toObject")
19
+ // for (let index = 0; index < results.length; index++) {
20
+ // const element = results[index];
21
+ // nomer.toObject(element)
22
+ // }
23
+ // console.timeEnd("toObject")
package/package.json.bkp DELETED
@@ -1,39 +0,0 @@
1
- {
2
- "name": "nodejs-nomer",
3
- "version": "1.0.7",
4
- "description": "NodeJS wrapper for nomer",
5
- "config": {
6
- "nomerVersion": "0.5.7"
7
- },
8
- "directories": {
9
- "bin": "./bin"
10
- },
11
- "main": "index.js",
12
- "scripts": {
13
- "test": "npm run test",
14
- "build": "babel src -d dist",
15
- //"preinstall": "./install_nomer.sh ${npm_package_config_nomerVersion}"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/zedomel/nodejs-nomer.git"
20
- },
21
- "keywords": [
22
- "nomer",
23
- "nodejs"
24
- ],
25
- "author": "Jose A Salim",
26
- "license": "GPL-3.0",
27
- "bugs": {
28
- "url": "https://github.com/zedomel/nodejs-nomer/issues"
29
- },
30
- "homepage": "https://github.com/zedomel/nodejs-nomer#readme",
31
- "devDependencies": {
32
- "@babel/cli": "^7.23.9",
33
- "@babel/core": "^7.24.0",
34
- "@babel/preset-env": "^7.24.0"
35
- },
36
- "dependencies": {
37
- "properties-file": "^3.5.1"
38
- }
39
- }