@larsgw/formica 0.9.1 → 0.9.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.9.2](https://github.com/identification-resources/formica/compare/v0.9.1...v0.9.2) (2026-06-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **catalog:** check for ID uniqueness ([eed45ad](https://github.com/identification-resources/formica/commit/eed45ad6155a03474606d84daefddac4c1c63956))
7
+
1
8
  ## [0.9.1](https://github.com/identification-resources/formica/compare/v0.9.0...v0.9.1) (2026-04-21)
2
9
 
3
10
 
@@ -101,6 +101,20 @@ function validateFile(arg) {
101
101
  const sheet = path.basename(filePath, '.csv');
102
102
  const entities = index_1.catalog.loadData(file, sheet);
103
103
  const errors = entities.validate();
104
+ const ids = new Set();
105
+ for (const entity of entities) {
106
+ const id = entity.get('id');
107
+ if (ids.has(id)) {
108
+ errors.push({
109
+ entity: id,
110
+ field: 'id',
111
+ error: `ID "${id}" repeated`
112
+ });
113
+ }
114
+ else {
115
+ ids.add(id);
116
+ }
117
+ }
104
118
  if (sheet === 'taxa') {
105
119
  const validator = new TaxaValidator(entities);
106
120
  errors.push(...validator.validate());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larsgw/formica",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
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",
@@ -73,6 +73,21 @@ async function validateFile (arg: string): Promise<WorkError[]> {
73
73
  const entities = catalog.loadData(file, sheet)
74
74
  const errors = entities.validate()
75
75
 
76
+ const ids = new Set()
77
+ for (const entity of entities) {
78
+ const id = entity.get('id') as string
79
+
80
+ if (ids.has(id)) {
81
+ errors.push({
82
+ entity: id,
83
+ field: 'id',
84
+ error: `ID "${id}" repeated`
85
+ })
86
+ } else {
87
+ ids.add(id)
88
+ }
89
+ }
90
+
76
91
  if (sheet === 'taxa') {
77
92
  const validator = new TaxaValidator(entities)
78
93
  errors.push(...validator.validate())