@larsgw/formica 0.7.3 → 0.8.1

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/eslint.config.js +34 -0
  3. package/lib/bin/SHEETS.js +0 -0
  4. package/lib/bin/generate-linked-data.d.ts +2 -0
  5. package/lib/bin/generate-linked-data.js +784 -0
  6. package/lib/bin/process-resources-index.js +36 -3
  7. package/lib/bin/process-resources.js +40 -7
  8. package/lib/bin/util.js +40 -8
  9. package/lib/bin/validate-catalog.js +36 -3
  10. package/lib/bin/validate-linked-data.js +0 -0
  11. package/lib/bin/validate-resources-text.js +36 -3
  12. package/lib/catalog/entities.js +2 -2
  13. package/lib/catalog/entity.js +0 -2
  14. package/lib/catalog/index.js +3 -3
  15. package/lib/catalog/tables/author.js +1 -1
  16. package/lib/catalog/tables/place.js +1 -1
  17. package/lib/catalog/tables/publisher.js +1 -1
  18. package/lib/catalog/value.d.ts +1 -1
  19. package/lib/catalog/value.js +9 -8
  20. package/lib/csv.js +2 -3
  21. package/lib/index.js +37 -4
  22. package/lib/resources/diff-resource.js +5 -4
  23. package/lib/resources/parse-text.js +46 -13
  24. package/lib/taxon-names/index.js +2 -3
  25. package/package.json +13 -7
  26. package/src/bin/generate-linked-data.ts +755 -0
  27. package/src/bin/process-resources-index.ts +1 -1
  28. package/src/catalog/entity.ts +0 -2
  29. package/src/catalog/tables/author.ts +1 -1
  30. package/src/catalog/tables/place.ts +1 -1
  31. package/src/catalog/tables/publisher.ts +1 -1
  32. package/src/catalog/value.ts +2 -4
  33. package/src/module.d.ts +5 -0
  34. package/src/resources/diff-resource.ts +2 -1
  35. package/src/resources/parse-text.ts +2 -1
  36. package/tsconfig.json +2 -1
  37. package/.eslintrc.js +0 -16
  38. package/src/bin/clean-links.ts +0 -96
@@ -10,9 +10,43 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
13
46
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.parseFileHeader = exports.parseFile = void 0;
15
- var yaml = require("js-yaml");
47
+ exports.parseFile = parseFile;
48
+ exports.parseFileHeader = parseFileHeader;
49
+ var yaml = __importStar(require("js-yaml"));
16
50
  var resource_1 = require("./resource");
17
51
  var diff_resource_1 = require("./diff-resource");
18
52
  var RANKS = [
@@ -31,19 +65,19 @@ var RANKS = [
31
65
  'subtribe',
32
66
  'genus',
33
67
  'subgenus',
34
- 'section',
35
- 'subsection',
36
- 'series',
68
+ 'section', // not ICZN
69
+ 'subsection', // not ICZN
70
+ 'series', // not ICZN
37
71
  'group',
38
- 'subgroup',
39
- 'aggregate',
40
- 'complex',
72
+ 'subgroup', // ...
73
+ 'aggregate', // not ICZN
74
+ 'complex', // not ICZN
41
75
  'species',
42
76
  'subspecies',
43
77
  'variety',
44
78
  'form',
45
- 'aberration',
46
- 'race',
79
+ 'aberration', // not ICZN
80
+ 'race', // not ICZN
47
81
  'stirps' // not ICZN
48
82
  ];
49
83
  var MAIN_RANKS = [
@@ -111,7 +145,7 @@ var NAME_PATTERN = new RegExp('^' +
111
145
  // $2 optional author citation
112
146
  '(?: ' +
113
147
  // but not auct(t)., etc.
114
- '(?!auctt?\\.|(?:syn|comb|sp|spec|nom)\\. n(?:ov)?\\.|s(?:ens[.u]|\\.)|in part|partim)' +
148
+ '(?!auctt?\\.|(?:syn|comb|sp|spec|nom|gen|subgen)\\. n(?:ov)?\\.|s(?:ens[.u]|\\.)|in part|partim)' +
115
149
  '(' +
116
150
  // $2.1 anything in parentheses, followed by optional revising author(s)
117
151
  '\\(.+?\\)(?:\\s+' + SIMPLE_AUTHOR_PATTERN + ')?' +
@@ -275,6 +309,7 @@ function parseName(name, rank, parent) {
275
309
  item.scientificNameAuthorship = capitalizeAuthors(citation);
276
310
  item.taxonRemarks = notes;
277
311
  item.taxonRank = rank;
312
+ // @ts-expect-error TS1501: This regular expression flag is only available when targeting 'es6' or later.
278
313
  if (/[^\p{L}0-9\u{00D7}\- ]/u.test(taxon)) {
279
314
  throw new Error("Taxon name contains unexpected characters: \"".concat(taxon, "\""));
280
315
  }
@@ -613,8 +648,6 @@ function parseFile(file, id, old) {
613
648
  return parseResourceContent(diff, template, oldIds);
614
649
  });
615
650
  }
616
- exports.parseFile = parseFile;
617
651
  function parseFileHeader(file) {
618
652
  return splitResources(file).map(function (resource) { return parseResource(resource)[0]; });
619
653
  }
620
- exports.parseFileHeader = parseFileHeader;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.amendResource = exports.groupNameMatches = void 0;
3
+ exports.groupNameMatches = groupNameMatches;
4
+ exports.amendResource = amendResource;
4
5
  var MINIMUM_PREFIX_LENGTH = 3;
5
6
  var VALID_COMMON_PREFIXES = new Set([
6
7
  'Plantae|Tracheophyta',
@@ -58,7 +59,6 @@ function groupNameMatches(results) {
58
59
  }
59
60
  return groupedNameMatches;
60
61
  }
61
- exports.groupNameMatches = groupNameMatches;
62
62
  function amendResource(resource, source, matches) {
63
63
  for (var id in matches) {
64
64
  var match = matches[id];
@@ -76,4 +76,3 @@ function amendResource(resource, source, matches) {
76
76
  }
77
77
  }
78
78
  }
79
- exports.amendResource = amendResource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larsgw/formica",
3
- "version": "0.7.3",
3
+ "version": "0.8.1",
4
4
  "description": "SDK and tools for data from the Library of Identification Resources",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -33,15 +33,21 @@
33
33
  "dependencies": {
34
34
  "ietf-language-tag-regex": "^0.0.5",
35
35
  "js-yaml": "^4.1.0",
36
+ "jsonld": "^8.3.3",
37
+ "n3": "^1.25.2",
36
38
  "spdx-license-list": "^6.6.0"
37
39
  },
38
40
  "devDependencies": {
41
+ "@eslint/eslintrc": "^3.3.1",
42
+ "@eslint/js": "^9.26.0",
39
43
  "@types/js-yaml": "^4.0.5",
40
- "@types/node": "^18.14.1",
41
- "@typescript-eslint/eslint-plugin": "^5.54.0",
42
- "@typescript-eslint/parser": "^5.54.0",
43
- "conventional-changelog-cli": "^3.0.0",
44
- "eslint": "^8.35.0",
45
- "typescript": "^4.9.5"
44
+ "@types/jsonld": "^1.5.15",
45
+ "@types/n3": "^1.24.2",
46
+ "@types/node": "^22.15.14",
47
+ "@typescript-eslint/eslint-plugin": "^8.32.0",
48
+ "@typescript-eslint/parser": "^8.32.0",
49
+ "conventional-changelog-cli": "^5.0.0",
50
+ "eslint": "^9.26.0",
51
+ "typescript": "^5.8.3"
46
52
  }
47
53
  }