@larsgw/formica 0.7.2 → 0.8.0
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/CHANGELOG.md +23 -0
- package/eslint.config.js +34 -0
- package/lib/bin/SHEETS.js +0 -0
- package/lib/bin/generate-linked-data.d.ts +2 -0
- package/lib/bin/generate-linked-data.js +740 -0
- package/lib/bin/process-resources-index.js +36 -3
- package/lib/bin/process-resources.js +40 -7
- package/lib/bin/util.js +40 -8
- package/lib/bin/validate-catalog.js +36 -3
- package/lib/bin/validate-resources-text.js +36 -3
- package/lib/catalog/entities.js +2 -2
- package/lib/catalog/entity.js +0 -2
- package/lib/catalog/index.js +3 -3
- package/lib/catalog/tables/author.js +5 -3
- package/lib/catalog/tables/index.js +4 -4
- package/lib/catalog/tables/place.js +3 -1
- package/lib/catalog/tables/publisher.js +5 -3
- package/lib/catalog/tables/taxon.js +3 -1
- package/lib/catalog/tables/work.js +5 -5
- package/lib/catalog/value.d.ts +6 -2
- package/lib/catalog/value.js +14 -9
- package/lib/csv.js +2 -3
- package/lib/index.js +37 -4
- package/lib/resources/diff-resource.js +5 -4
- package/lib/resources/parse-text.js +45 -12
- package/lib/taxon-names/index.js +2 -3
- package/package.json +13 -7
- package/src/bin/generate-linked-data.ts +709 -0
- package/src/bin/process-resources-index.ts +1 -1
- package/src/catalog/entity.ts +0 -2
- package/src/catalog/tables/author.ts +5 -3
- package/src/catalog/tables/index.ts +4 -4
- package/src/catalog/tables/place.ts +3 -1
- package/src/catalog/tables/publisher.ts +5 -3
- package/src/catalog/tables/taxon.ts +3 -1
- package/src/catalog/tables/work.ts +5 -5
- package/src/catalog/value.ts +7 -5
- package/src/module.d.ts +5 -0
- package/src/resources/diff-resource.ts +2 -1
- package/src/resources/parse-text.ts +1 -0
- package/tsconfig.json +2 -1
- package/.eslintrc.js +0 -16
- package/src/bin/clean-links.ts +0 -96
|
@@ -9,14 +9,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
9
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.ResourceDiffType = void 0;
|
|
13
|
+
exports.createDiff = createDiff;
|
|
13
14
|
var ResourceDiffType;
|
|
14
15
|
(function (ResourceDiffType) {
|
|
15
16
|
ResourceDiffType["Added"] = "+";
|
|
16
17
|
ResourceDiffType["Deleted"] = "-";
|
|
17
18
|
ResourceDiffType["Modified"] = "~";
|
|
18
19
|
ResourceDiffType["Unchanged"] = "=";
|
|
19
|
-
})(ResourceDiffType
|
|
20
|
+
})(ResourceDiffType || (exports.ResourceDiffType = ResourceDiffType = {}));
|
|
20
21
|
function LCS(X, Y) {
|
|
21
22
|
var m = X.length;
|
|
22
23
|
var n = Y.length;
|
|
@@ -42,7 +43,8 @@ function LCS(X, Y) {
|
|
|
42
43
|
text: X[i - 1],
|
|
43
44
|
type: ResourceDiffType.Unchanged
|
|
44
45
|
});
|
|
45
|
-
i
|
|
46
|
+
i--;
|
|
47
|
+
j--;
|
|
46
48
|
}
|
|
47
49
|
else if (i !== 0 && (j === 0 || C[i - 1][j] > C[i][j - 1])) {
|
|
48
50
|
diff.unshift({
|
|
@@ -154,4 +156,3 @@ function createDiff(a, b, tokenize) {
|
|
|
154
156
|
}
|
|
155
157
|
return lines;
|
|
156
158
|
}
|
|
157
|
-
exports.createDiff = createDiff;
|
|
@@ -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.
|
|
15
|
-
|
|
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 = [
|
|
@@ -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;
|
package/lib/taxon-names/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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.
|
|
3
|
+
"version": "0.8.0",
|
|
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/
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"eslint": "^8.
|
|
45
|
-
"
|
|
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
|
}
|