@larsgw/formica 0.7.1 → 0.7.2
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 +9 -0
- package/lib/catalog/index.js +1 -0
- package/lib/catalog/tables/index.js +2 -0
- package/lib/catalog/tables/taxon.d.ts +4 -0
- package/lib/catalog/tables/taxon.js +35 -0
- package/lib/catalog/value.d.ts +1 -0
- package/lib/catalog/value.js +1 -0
- package/package.json +1 -1
- package/src/catalog/index.ts +1 -0
- package/src/catalog/tables/index.ts +2 -0
- package/src/catalog/tables/taxon.ts +15 -0
- package/src/catalog/value.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.7.2](https://github.com/identification-resources/formica/compare/v0.7.1...v0.7.2) (2025-04-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **catalog:** add validation for taxa.csv ([59cfcf2](https://github.com/identification-resources/formica/commit/59cfcf28ebbef42e28e648e800c178a7d528f37a))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [0.7.1](https://github.com/identification-resources/formica/compare/v0.7.0...v0.7.1) (2025-03-25)
|
|
2
11
|
|
|
3
12
|
|
package/lib/catalog/index.js
CHANGED
|
@@ -12,6 +12,7 @@ function getTypeInfo(type) {
|
|
|
12
12
|
case 'authors': return index_1.TYPE_INFO.authors;
|
|
13
13
|
case 'places': return index_1.TYPE_INFO.places;
|
|
14
14
|
case 'publishers': return index_1.TYPE_INFO.publishers;
|
|
15
|
+
case 'taxa': return index_1.TYPE_INFO.taxa;
|
|
15
16
|
case 'catalog': return index_1.TYPE_INFO.catalog;
|
|
16
17
|
default: throw new TypeError("Unknown type \"".concat(type, "\""));
|
|
17
18
|
}
|
|
@@ -4,10 +4,12 @@ exports.TYPE_INFO = void 0;
|
|
|
4
4
|
var author_1 = require("./author");
|
|
5
5
|
var publisher_1 = require("./publisher");
|
|
6
6
|
var place_1 = require("./place");
|
|
7
|
+
var taxon_1 = require("./taxon");
|
|
7
8
|
var work_1 = require("./work");
|
|
8
9
|
exports.TYPE_INFO = {
|
|
9
10
|
authors: [author_1.Author, 'name'],
|
|
10
11
|
publishers: [publisher_1.Publisher, 'name'],
|
|
11
12
|
places: [place_1.Place, 'name'],
|
|
13
|
+
taxa: [taxon_1.Taxon, 'name'],
|
|
12
14
|
catalog: [work_1.Work, 'id']
|
|
13
15
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Taxon = void 0;
|
|
19
|
+
var value_1 = require("../value");
|
|
20
|
+
var entity_1 = require("../entity");
|
|
21
|
+
var Taxon = /** @class */ (function (_super) {
|
|
22
|
+
__extends(Taxon, _super);
|
|
23
|
+
function Taxon(values) {
|
|
24
|
+
return _super.call(this, values, {
|
|
25
|
+
name: { required: true, multiple: false },
|
|
26
|
+
qid: { required: false, multiple: false, format: value_1.FORMATS.QID },
|
|
27
|
+
rank: { required: false, multiple: false },
|
|
28
|
+
gbif: { required: false, multiple: false, format: value_1.FORMATS.INTEGER },
|
|
29
|
+
children_gbif: { required: false, multiple: true, format: value_1.FORMATS.INTEGER },
|
|
30
|
+
ancestors_gbif: { required: false, multiple: true, format: value_1.FORMATS.INTEGER }
|
|
31
|
+
}) || this;
|
|
32
|
+
}
|
|
33
|
+
return Taxon;
|
|
34
|
+
}(entity_1.Entity));
|
|
35
|
+
exports.Taxon = Taxon;
|
package/lib/catalog/value.d.ts
CHANGED
package/lib/catalog/value.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.FORMATS = {
|
|
|
17
17
|
DOI: /^10\./,
|
|
18
18
|
QID: /^Q[1-9][0-9]*$/,
|
|
19
19
|
URL: /^(ftp|http|https):\/\/((?:[a-z0-9][a-z0-9-_]*?[a-z0-9]?\.)+(?:xn--)?[a-z0-9]+)(:\d*)?((?:\/(?:%\d\d|[!$&'()*+,\-.0-9";=@A-Z_a-z~])*)*)(\?(?:%\d\d|[!$&'()*+,\-./0-9:;=?@A-Z_a-z~])*)?(#(?:%\d\d|[!$&'()*+,\-./0-9:;=?@A-Z_a-z~])*)?/i,
|
|
20
|
+
INTEGER: /^(0|[1-9]\d*)$/,
|
|
20
21
|
LICENSE: function (value) { return /^<(public domain|.+\?)>$/.test(value) || !!spdxLicenseList[value]; },
|
|
21
22
|
LANGUAGE: function (value) { return ietfTagList.test(value); }
|
|
22
23
|
};
|
package/package.json
CHANGED
package/src/catalog/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ function getTypeInfo (type: string): [typeof Entity, string] {
|
|
|
8
8
|
case 'authors': return TYPE_INFO.authors
|
|
9
9
|
case 'places': return TYPE_INFO.places
|
|
10
10
|
case 'publishers': return TYPE_INFO.publishers
|
|
11
|
+
case 'taxa': return TYPE_INFO.taxa
|
|
11
12
|
case 'catalog': return TYPE_INFO.catalog
|
|
12
13
|
default: throw new TypeError(`Unknown type "${type}"`)
|
|
13
14
|
}
|
|
@@ -2,11 +2,13 @@ import { Entity } from '../entity'
|
|
|
2
2
|
import { Author } from './author'
|
|
3
3
|
import { Publisher } from './publisher'
|
|
4
4
|
import { Place } from './place'
|
|
5
|
+
import { Taxon } from './taxon'
|
|
5
6
|
import { Work } from './work'
|
|
6
7
|
|
|
7
8
|
export const TYPE_INFO: Record<string, [typeof Entity, string]> = {
|
|
8
9
|
authors: [Author, 'name'],
|
|
9
10
|
publishers: [Publisher, 'name'],
|
|
10
11
|
places: [Place, 'name'],
|
|
12
|
+
taxa: [Taxon, 'name'],
|
|
11
13
|
catalog: [Work, 'id']
|
|
12
14
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FORMATS } from '../value'
|
|
2
|
+
import { Entity } from '../entity'
|
|
3
|
+
|
|
4
|
+
export class Taxon extends Entity {
|
|
5
|
+
constructor (values: Record<string, string>) {
|
|
6
|
+
super(values, {
|
|
7
|
+
name: { required: true, multiple: false },
|
|
8
|
+
qid: { required: false, multiple: false, format: FORMATS.QID },
|
|
9
|
+
rank: { required: false, multiple: false },
|
|
10
|
+
gbif: { required: false, multiple: false, format: FORMATS.INTEGER },
|
|
11
|
+
children_gbif: { required: false, multiple: true, format: FORMATS.INTEGER },
|
|
12
|
+
ancestors_gbif: { required: false, multiple: true, format: FORMATS.INTEGER }
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/catalog/value.ts
CHANGED
|
@@ -17,6 +17,7 @@ export const FORMATS = {
|
|
|
17
17
|
DOI: /^10\./,
|
|
18
18
|
QID: /^Q[1-9][0-9]*$/,
|
|
19
19
|
URL: /^(ftp|http|https):\/\/((?:[a-z0-9][a-z0-9-_]*?[a-z0-9]?\.)+(?:xn--)?[a-z0-9]+)(:\d*)?((?:\/(?:%\d\d|[!$&'()*+,\-.0-9";=@A-Z_a-z~])*)*)(\?(?:%\d\d|[!$&'()*+,\-./0-9:;=?@A-Z_a-z~])*)?(#(?:%\d\d|[!$&'()*+,\-./0-9:;=?@A-Z_a-z~])*)?/i,
|
|
20
|
+
INTEGER: /^(0|[1-9]\d*)$/,
|
|
20
21
|
|
|
21
22
|
LICENSE (value: SingleValue) { return /^<(public domain|.+\?)>$/.test(value) || !!spdxLicenseList[value] },
|
|
22
23
|
LANGUAGE (value: SingleValue) { return ietfTagList.test(value) }
|