@larsgw/formica 0.9.1 → 0.10.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.
Files changed (50) hide show
  1. package/lib/bin/process-resources-index.js +0 -0
  2. package/lib/bin/process-resources.d.ts +6 -1
  3. package/lib/bin/process-resources.js +116 -25
  4. package/lib/bin/validate-catalog.js +14 -0
  5. package/lib/bin/validate-resources-text.js +3 -1
  6. package/lib/resources/parse-text.js +6 -3
  7. package/lib/taxon-names/index.js +1 -1
  8. package/package.json +15 -13
  9. package/.gitattributes +0 -1
  10. package/.github/workflows/ci.yml +0 -27
  11. package/CHANGELOG.md +0 -383
  12. package/eslint.config.js +0 -34
  13. package/lib/bin/SHEETS.js +0 -0
  14. package/lib/bin/clean-links.d.ts +0 -2
  15. package/lib/bin/clean-links.js +0 -170
  16. package/lib/bin/download-place-shapes.js +0 -188
  17. package/lib/bin/index-place-shapes.js +0 -115
  18. package/lib/bin/process-resources-problems.js +0 -177
  19. package/lib/bin/validate-linked-data.js +0 -0
  20. package/lib/resources/content/clavis.js +0 -10
  21. package/lib/resources/content/index.js +0 -0
  22. package/lib/resources/content/sdd.js +0 -151
  23. package/lib/resources/sdd.js +0 -78
  24. package/src/bin/generate-linked-data.ts +0 -762
  25. package/src/bin/process-resources-index.ts +0 -100
  26. package/src/bin/process-resources.ts +0 -510
  27. package/src/bin/util.ts +0 -74
  28. package/src/bin/validate-catalog.ts +0 -107
  29. package/src/bin/validate-resources-text.ts +0 -25
  30. package/src/catalog/entities.ts +0 -62
  31. package/src/catalog/entity.ts +0 -116
  32. package/src/catalog/index.ts +0 -33
  33. package/src/catalog/tables/author.ts +0 -15
  34. package/src/catalog/tables/index.ts +0 -14
  35. package/src/catalog/tables/place.ts +0 -14
  36. package/src/catalog/tables/publisher.ts +0 -15
  37. package/src/catalog/tables/taxon.ts +0 -17
  38. package/src/catalog/tables/work.ts +0 -65
  39. package/src/catalog/value.ts +0 -51
  40. package/src/csv.ts +0 -33
  41. package/src/index.ts +0 -4
  42. package/src/module.d.ts +0 -148
  43. package/src/resources/diff-resource.ts +0 -226
  44. package/src/resources/index.ts +0 -4
  45. package/src/resources/parse-name.ts +0 -392
  46. package/src/resources/parse-text.ts +0 -408
  47. package/src/resources/resource.ts +0 -10
  48. package/src/taxon-names/index.ts +0 -79
  49. package/test/resources.js +0 -374
  50. package/tsconfig.json +0 -15
package/CHANGELOG.md DELETED
@@ -1,383 +0,0 @@
1
- ## [0.9.1](https://github.com/identification-resources/formica/compare/v0.9.0...v0.9.1) (2026-04-21)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **resources:** fix RDF mapping of taxonomic status ([c65383e](https://github.com/identification-resources/formica/commit/c65383e4d64c674c6c3b9f69e8cae925fcdf6896))
7
-
8
-
9
- ### Features
10
-
11
- * **catalog:** add more validation for taxa ([2bbc017](https://github.com/identification-resources/formica/commit/2bbc0177f8d4a6909339cfee812c33873770f725))
12
-
13
- # [0.9.0](https://github.com/identification-resources/formica/compare/v0.8.8...v0.9.0) (2026-02-04)
14
-
15
-
16
- ### Bug Fixes
17
-
18
- * **resources:** improve taxonomic status ([0ea8fd2](https://github.com/identification-resources/formica/commit/0ea8fd220571f5f6ff05f517069aba10148c6888))
19
-
20
-
21
- ### Features
22
-
23
- * **resources:** include cluster data in DwC files ([60a28ac](https://github.com/identification-resources/formica/commit/60a28ace18b0760696735ca416a2e8d014d1c928))
24
- * **resources:** include uncertainty of synonymy in DwC if specified ([03b6734](https://github.com/identification-resources/formica/commit/03b6734851dc9c331ec88fab21e90ad3f0303c3c))
25
-
26
- ## [0.8.8](https://github.com/identification-resources/formica/compare/v0.8.7...v0.8.8) (2025-12-25)
27
-
28
-
29
- ### Features
30
-
31
- * **resources:** add 'subclass' rank ([4b10405](https://github.com/identification-resources/formica/commit/4b10405b32840c1675caf7ef24bf2bbfd821a236))
32
-
33
- ## [0.8.7](https://github.com/identification-resources/formica/compare/v0.8.6...v0.8.7) (2025-11-01)
34
-
35
-
36
- ### Bug Fixes
37
-
38
- * **resources:** fix handling of corrections ([49c05b4](https://github.com/identification-resources/formica/commit/49c05b499262e64514b832313360d1e6a4cc6378))
39
-
40
- ## [0.8.6](https://github.com/identification-resources/formica/compare/v0.8.5...v0.8.6) (2025-10-28)
41
-
42
-
43
- ### Bug Fixes
44
-
45
- * **resources:** fix diffs if last line changes ([a86c3e9](https://github.com/identification-resources/formica/commit/a86c3e97ae31cf9d509fff4a7525d56c05f79752))
46
- * **resources:** fix recognition of subgenus synonyms ([4c52599](https://github.com/identification-resources/formica/commit/4c525991dafac83176b96b2e04c5c952d777ac08))
47
-
48
-
49
- ### Features
50
-
51
- * **resources:** ignore errors in later-corrected names ([4c1f69e](https://github.com/identification-resources/formica/commit/4c1f69e81450664f122cdf00e68cb918248790e6)), closes [#5](https://github.com/identification-resources/formica/issues/5)
52
-
53
- ## [0.8.5](https://github.com/identification-resources/formica/compare/v0.8.4...v0.8.5) (2025-10-28)
54
-
55
-
56
- ### Bug Fixes
57
-
58
- * **catalog:** add mapping for typo 'male' in linked data ([a83d34e](https://github.com/identification-resources/formica/commit/a83d34e7aa57a78e410e2ea55adbf75e522d9028))
59
- * **catalog:** fix dcmitype: for algorithms, checklists ([68e353d](https://github.com/identification-resources/formica/commit/68e353d71d632e092e3e79254e6b4f575c004f1c))
60
- * **catalog:** fix typos in linked data generation ([9ad951f](https://github.com/identification-resources/formica/commit/9ad951f5c19978509c6aba7fd81470270707da99))
61
- * **resources:** add scientific name for complexes, aggregates ([843afc3](https://github.com/identification-resources/formica/commit/843afc39df1952dda4bb6339ee47f2619432bb74))
62
- * **resources:** omit generic error stack trace ([c831bc2](https://github.com/identification-resources/formica/commit/c831bc2a952ef17a9e57b012fe0568e2acc0c6ae))
63
-
64
-
65
- ### Features
66
-
67
- * **resources:** handle subgenus synonyms of genera ([4e61336](https://github.com/identification-resources/formica/commit/4e61336e36054ffd6df57ebad5479e7ceebcb235)), closes [#16](https://github.com/identification-resources/formica/issues/16)
68
- * **resources:** rework parsing of resources ([cff7730](https://github.com/identification-resources/formica/commit/cff773000c5b9e3f990c619cdd45a76a18ee39a9)), closes [#15](https://github.com/identification-resources/formica/issues/15) [#7](https://github.com/identification-resources/formica/issues/7)
69
-
70
- ## [0.8.4](https://github.com/identification-resources/formica/compare/v0.8.3...v0.8.4) (2025-09-19)
71
-
72
-
73
- ### Bug Fixes
74
-
75
- * **catalog:** clearer error message when validating ([b1c34f0](https://github.com/identification-resources/formica/commit/b1c34f00ed9a262251d2d24b3e6c46fd17730405))
76
- * **resources:** optimize diffing algorithm ([0c86c49](https://github.com/identification-resources/formica/commit/0c86c49474754dced74c8423f3e6b7ed2fd2a78f)), closes [#6](https://github.com/identification-resources/formica/issues/6)
77
-
78
-
79
- ### Features
80
-
81
- * **catalog:** map additional scope value ([80c6d26](https://github.com/identification-resources/formica/commit/80c6d269a7d5b03600991fb353280e81afcefb0e))
82
-
83
- ## [0.8.3](https://github.com/identification-resources/formica/compare/v0.8.2...v0.8.3) (2025-07-15)
84
-
85
-
86
- ### Features
87
-
88
- * **catalog:** add catalog field key_characteristics ([6529cfa](https://github.com/identification-resources/formica/commit/6529cfab81f759f926b81bdd9d5a36e84b526284))
89
-
90
- ## [0.8.2](https://github.com/identification-resources/formica/compare/v0.8.1...v0.8.2) (2025-06-26)
91
-
92
-
93
- ### Bug Fixes
94
-
95
- * **resources:** add support for documented flag ([6cb89e4](https://github.com/identification-resources/formica/commit/6cb89e428bde8665b7e8f03b5c7f47a44e15f58e))
96
- * **resources:** allow hyphens in biname pattern ([6a58a77](https://github.com/identification-resources/formica/commit/6a58a77757b8b6ae8c2d7d01440775776d183d05))
97
-
98
- ## [0.8.1](https://github.com/identification-resources/formica/compare/v0.8.0...v0.8.1) (2025-05-30)
99
-
100
-
101
- ### Bug Fixes
102
-
103
- * **catalog:** fix aspects of linked data ([1b2964f](https://github.com/identification-resources/formica/commit/1b2964f46b8409c6a67f0475faf067a80734288c))
104
- * **catalog:** set display_name to required, as documented ([3f36909](https://github.com/identification-resources/formica/commit/3f36909bbe6261cbee022139050875de37174611))
105
-
106
-
107
- ### Features
108
-
109
- * **resources:** add support for "(sub)gen. nov" pattern ([d2598eb](https://github.com/identification-resources/formica/commit/d2598ebfd2f80d9c2bcc00ce145b9fc229316e5b))
110
-
111
- # [0.8.0](https://github.com/identification-resources/formica/compare/v0.7.3...v0.8.0) (2025-05-07)
112
-
113
-
114
- ### Bug Fixes
115
-
116
- * **catalog:** remove unused obsolete 'clean-links' script ([af1ecc2](https://github.com/identification-resources/formica/commit/af1ecc2fdd0a80bb8fa7108f3d52978239d7ef01))
117
-
118
-
119
- ### Features
120
-
121
- * **catalog:** implement generation of linked data ([334616e](https://github.com/identification-resources/formica/commit/334616e2e12c0d91e49f84f06bdd00ab7a238b8e))
122
-
123
- ## [0.7.3](https://github.com/identification-resources/formica/compare/v0.7.2...v0.7.3) (2025-04-17)
124
-
125
-
126
- ### Features
127
-
128
- * **catalog:** update validation for identifiers ([156a703](https://github.com/identification-resources/formica/commit/156a7036ab09c411d091bc9d0f628831a30ba3f5))
129
-
130
- ## [0.7.2](https://github.com/identification-resources/formica/compare/v0.7.1...v0.7.2) (2025-04-02)
131
-
132
-
133
- ### Features
134
-
135
- * **catalog:** add validation for taxa.csv ([59cfcf2](https://github.com/identification-resources/formica/commit/59cfcf28ebbef42e28e648e800c178a7d528f37a))
136
-
137
- ## [0.7.1](https://github.com/identification-resources/formica/compare/v0.7.0...v0.7.1) (2025-03-25)
138
-
139
-
140
- ### Features
141
-
142
- * **resources:** add 'subphylum' rank ([8b5243b](https://github.com/identification-resources/formica/commit/8b5243bfd79b6486c613ca1178f1e1c9ec3f43a4))
143
-
144
- # [0.7.0](https://github.com/identification-resources/formica/compare/v0.6.8...v0.7.0) (2025-03-14)
145
-
146
-
147
- ### Bug Fixes
148
-
149
- * **resources:** improve diff regarding indet lines ([2615437](https://github.com/identification-resources/formica/commit/26154374f50d680c5f3e187cd6a1a5eadbac6b5d))
150
-
151
-
152
- ### Features
153
-
154
- * **resources:** change syntax of "indet" line ([d53363e](https://github.com/identification-resources/formica/commit/d53363e65bfa77a2eb247999316621f9ca0bff59))
155
-
156
-
157
- ### BREAKING CHANGES
158
-
159
- * **resources:** "indet" lines now have to be prefixed with "[indet]"
160
-
161
- ## [0.6.8](https://github.com/identification-resources/formica/compare/v0.6.7...v0.6.8) (2025-03-13)
162
-
163
-
164
- ### Features
165
-
166
- * **resources:** add support for intergeneric hybrids without parents ([3cb0c0c](https://github.com/identification-resources/formica/commit/3cb0c0cd60fc5a4ba88add623fbadc3b90d8530c))
167
- * **resources:** create index of CoL identifiers ([3792903](https://github.com/identification-resources/formica/commit/37929035374bc0c67ed2403e775e06a904bdbd4d))
168
- * **resources:** support intergeneric hybrids ([0a6696c](https://github.com/identification-resources/formica/commit/0a6696c5fd0603a0366c80c2298b6544636ed0c6))
169
-
170
- ## [0.6.7](https://github.com/identification-resources/formica/compare/v0.6.6...v0.6.7) (2025-02-26)
171
-
172
-
173
- ### Bug Fixes
174
-
175
- * **resources:** keep uncorrected name in verbatimIdentification ([dc4d5d1](https://github.com/identification-resources/formica/commit/dc4d5d17e7a412a94538f6162dfd839d808cbc30))
176
- * **resources:** update heuristics for recognizing author citations ([bca6a7f](https://github.com/identification-resources/formica/commit/bca6a7f5a6c2dc3dc421d885f6270f5464fc5ea5))
177
- * **resources:** use corrected generic name in output ([b472384](https://github.com/identification-resources/formica/commit/b4723842e87515f076230c603246082bc3bbec9d))
178
-
179
-
180
- ### Features
181
-
182
- * **resources:** add support for completeness flags ([55b5427](https://github.com/identification-resources/formica/commit/55b5427125b4f1072191cadbc461ba31d37e6f2e))
183
-
184
- ## [0.6.6](https://github.com/identification-resources/formica/compare/v0.6.5...v0.6.6) (2025-02-16)
185
-
186
-
187
- ### Features
188
-
189
- * **resources:** allow other resources in version_of ([85947b0](https://github.com/identification-resources/formica/commit/85947b0dcfbdb4bfd6537c628b34087a6e6326f7))
190
-
191
- ## [0.6.5](https://github.com/identification-resources/formica/compare/v0.6.4...v0.6.5) (2024-12-20)
192
-
193
-
194
- ### Bug Fixes
195
-
196
- * **resources:** ignore empty lines in diff mode ([3fb027e](https://github.com/identification-resources/formica/commit/3fb027e8968196910fff2e574e700ac0abee996c))
197
- * **resources:** improve (ICBN) author parsing ([d3e3faf](https://github.com/identification-resources/formica/commit/d3e3faf411d1a7dccd528a5ee78bd0823a5883b4)), closes [#13](https://github.com/identification-resources/formica/issues/13) [#14](https://github.com/identification-resources/formica/issues/14)
198
- * **resources:** support "et al." in author name ([82993bf](https://github.com/identification-resources/formica/commit/82993bffac5e7f3ed00d00c28c836f347b264a43))
199
-
200
- ## [0.6.4](https://github.com/identification-resources/formica/compare/v0.6.3...v0.6.4) (2024-12-16)
201
-
202
-
203
- ### Bug Fixes
204
-
205
- * **resources:** fix matching of some ICBN names ([3c18458](https://github.com/identification-resources/formica/commit/3c184586b64e2a31f1eb7298bcd7c80c1d119069))
206
-
207
- ## [0.6.3](https://github.com/identification-resources/formica/compare/v0.6.2...v0.6.3) (2024-04-12)
208
-
209
-
210
- ### Bug Fixes
211
-
212
- * **resources:** allow 'phylum' rank ([ff9be66](https://github.com/identification-resources/formica/commit/ff9be66abab79a86263764b54d6a2709833b14d4))
213
-
214
- ## [0.6.2](https://github.com/identification-resources/formica/compare/v0.6.1...v0.6.2) (2024-04-08)
215
-
216
-
217
- ### Bug Fixes
218
-
219
- * **catalog:** include all fields in tabular export ([c4e47bb](https://github.com/identification-resources/formica/commit/c4e47bbdf31c8f589e35c897c8207eb4dd979461))
220
-
221
-
222
- ### Features
223
-
224
- * **catalog:** add script to de-duplicate links ([b719348](https://github.com/identification-resources/formica/commit/b719348635e1b35ee80758c0cdd9938625d79ebf))
225
-
226
- ## [0.6.1](https://github.com/identification-resources/formica/compare/v0.6.0...v0.6.1) (2024-03-20)
227
-
228
-
229
- ### Bug Fixes
230
-
231
- * **resources:** allow two-part hybrid names ([8e3b836](https://github.com/identification-resources/formica/commit/8e3b8368985d1db35b62d306d833121150e91865))
232
-
233
- # [0.6.0](https://github.com/identification-resources/formica/compare/v0.5.2...v0.6.0) (2024-01-05)
234
-
235
-
236
- ### Features
237
-
238
- * **catalog:** add entry type, key type values ([ed6e4fb](https://github.com/identification-resources/formica/commit/ed6e4fb545e09cddb5d466f602bffb8a8483f043))
239
-
240
- ## [0.5.2](https://github.com/identification-resources/formica/compare/v0.5.1...v0.5.2) (2023-11-27)
241
-
242
-
243
- ### Bug Fixes
244
-
245
- * **resources:** fix GBIF index generation ([c88e2d2](https://github.com/identification-resources/formica/commit/c88e2d2b306b930ca0b00b978e3eb89b8adfb656))
246
-
247
- ## [0.5.1](https://github.com/identification-resources/formica/compare/v0.5.0...v0.5.1) (2023-11-03)
248
-
249
-
250
- ### Bug Fixes
251
-
252
- * **resources:** fix file listing in processor ([009b980](https://github.com/identification-resources/formica/commit/009b98091b0f597e91213ace82252facbe3b5fed))
253
-
254
- # [0.5.0](https://github.com/identification-resources/formica/compare/v0.4.3...v0.5.0) (2023-10-24)
255
-
256
-
257
- ### Bug Fixes
258
-
259
- * **catalog:** make validation more robust ([522db8a](https://github.com/identification-resources/formica/commit/522db8ad428c2d4645569a7f541fd203f5d628e8))
260
- * **csv:** fix csv formatting ([064e5e5](https://github.com/identification-resources/formica/commit/064e5e57b2a642d22850501ab2a0b95879779b85))
261
- * **resources:** do not count abbreviations as species ([ac0cc5a](https://github.com/identification-resources/formica/commit/ac0cc5a7cfd1f68df9b8d1d1c543a2f593839daa))
262
- * **resources:** fix typos in output column names ([0d02823](https://github.com/identification-resources/formica/commit/0d0282378b21e92fbe028a53a9d121f42e791cc5))
263
-
264
-
265
- ### Features
266
-
267
- * **resources:** encode names with spaces with underscores ([9c7efd4](https://github.com/identification-resources/formica/commit/9c7efd4daf80660be98f2fec8ef9faa5d5b42d67))
268
- * **resources:** include verbatimIdentification column ([4a2e920](https://github.com/identification-resources/formica/commit/4a2e9201467347e900f5690d2301a3b231ded822))
269
- * **resources:** move "scope" metadata to "catalog" ([286c5b2](https://github.com/identification-resources/formica/commit/286c5b223ce41336f3ebd63c1797403aad21aef6))
270
- * **resources:** update processor configuration ([64daa26](https://github.com/identification-resources/formica/commit/64daa26d70c96df24298c7b78f2b93ef0f5b2a48))
271
-
272
-
273
- ### BREAKING CHANGES
274
-
275
- * **resources:** - "intragenericEpithet" is now "infragenericEpithet"
276
- - "intraspecificEpithet" is now "infraspecificEpithet"
277
- * **resources:** Adds additional column, between "higherClassification" and "colTaxonID".
278
- * **resources:** - Instead of "-u, --update" use "-s modified"
279
- - Instead of "--update-mapping" use "-s all"
280
- * **resources:** Index will no longer contain "scope" array. "scope" field in YAML header
281
- does no longer pass validation. Use the "taxon_scope" and "scope" fields
282
- in "catalog" instead.
283
-
284
- ## [0.4.3](https://github.com/identification-resources/formica/compare/v0.4.2...v0.4.3) (2023-09-30)
285
-
286
-
287
- ### Bug Fixes
288
-
289
- * **resource:** fix regression in taxon parsing ([098477b](https://github.com/identification-resources/formica/commit/098477b5914324a3c15ec885617d4cf30996f30d))
290
-
291
- ## [0.4.2](https://github.com/identification-resources/formica/compare/v0.4.1...v0.4.2) (2023-09-30)
292
-
293
-
294
- ### Bug Fixes
295
-
296
- * **resources:** allow simpler intraspecific synonyms ([978186c](https://github.com/identification-resources/formica/commit/978186cbaf469f3085c24c2e8bc8ffb1f83f2799)), closes [#9](https://github.com/identification-resources/formica/issues/9)
297
- * **resources:** correct synonym rank determintation ([766ea2a](https://github.com/identification-resources/formica/commit/766ea2af14ff3aa64a7a2e19ed096836d38182cf))
298
- * **resources:** do not parse "indet." lines as taxa ([f4debf6](https://github.com/identification-resources/formica/commit/f4debf695b0cdb375bfb60ab5ce942fa2f7dee85)), closes [#8](https://github.com/identification-resources/formica/issues/8)
299
-
300
- ## [0.4.1](https://github.com/identification-resources/formica/compare/v0.4.0...v0.4.1) (2023-09-07)
301
-
302
-
303
- ### Bug Fixes
304
-
305
- * **catalog:** fix typo in duplicate_of schema ([fbb6333](https://github.com/identification-resources/formica/commit/fbb6333d10dd6f5846856ea8de81d941ce539d21))
306
-
307
- # [0.4.0](https://github.com/identification-resources/formica/compare/v0.3.1...v0.4.0) (2023-09-07)
308
-
309
-
310
- ### Bug Fixes
311
-
312
- * **catalog:** validation checks for unknown fields ([5fe5cf0](https://github.com/identification-resources/formica/commit/5fe5cf0b8cf4db7c4af50a897821077e410a1e09))
313
- * **catalog:** verify if required fields are missing ([c327ae4](https://github.com/identification-resources/formica/commit/c327ae458a80567aac34dd03f3970dcf9d575479))
314
-
315
-
316
- ### Features
317
-
318
- * **catalog:** add duplicate_of field ([e4a8bbe](https://github.com/identification-resources/formica/commit/e4a8bbecef9c6a40d0f2cc5d4e8bb67685a453ff))
319
-
320
- ## [0.3.1](https://github.com/identification-resources/formica/compare/v0.3.0...v0.3.1) (2023-09-04)
321
-
322
-
323
- ### Bug Fixes
324
-
325
- * **resources:** allow correction of synonyms of lowest taxa ([c737d5b](https://github.com/identification-resources/formica/commit/c737d5b09d5e5b24f4cc2c8cff88c9ada8d0ab7b))
326
- * **resources:** fix regression in c737d5b ([d4e52e9](https://github.com/identification-resources/formica/commit/d4e52e95ed1a35dabbd80b9f9aace1a824fdae98))
327
- * **resources:** handle corrections to synonyms ([21ed9b7](https://github.com/identification-resources/formica/commit/21ed9b79f77e1e6d0639d96ed9822d5212a85a2e)), closes [#4](https://github.com/identification-resources/formica/issues/4)
328
-
329
- # [0.3.0](https://github.com/identification-resources/formica/compare/v0.2.1...v0.3.0) (2023-08-20)
330
-
331
-
332
- ### Features
333
-
334
- * **resources:** add accepted ids to dwc and index ([1b5aba8](https://github.com/identification-resources/formica/commit/1b5aba8ff07bba32fc1bbf49927fef7a880eb35e))
335
- * **resources:** allow updates of just mappings ([0ea62c1](https://github.com/identification-resources/formica/commit/0ea62c143a49129709960de123c0037973356487))
336
- * **resources:** improve prefix selection heuristics ([7c2e0c9](https://github.com/identification-resources/formica/commit/7c2e0c99d9de7490314f971e8b4e9e5e190a81c2))
337
- * **resources:** improve taxon name matching ([78ff480](https://github.com/identification-resources/formica/commit/78ff480485ca42bd1d1f2893f230e61db6cb6be8)), closes [#2](https://github.com/identification-resources/formica/issues/2)
338
- * **resources:** test for rank mismatch ([0e69b7f](https://github.com/identification-resources/formica/commit/0e69b7f0a6654fa5255e797be7516cd06edb4df3)), closes [#2](https://github.com/identification-resources/formica/issues/2)
339
-
340
- ## [0.2.1](https://github.com/identification-resources/formica/compare/v0.2.0...v0.2.1) (2023-08-10)
341
-
342
-
343
- ### Bug Fixes
344
-
345
- * **resources:** do not validate old versions ([1a8dd2e](https://github.com/identification-resources/formica/commit/1a8dd2e0e373489e287d1fd89dbb7443245c5214))
346
- * **resources:** fix check for missing leaf taxa ([035f1ad](https://github.com/identification-resources/formica/commit/035f1ad20efa80b388ec3828d4ace4518c7b344e))
347
-
348
- # [0.2.0](https://github.com/identification-resources/formica/compare/v0.1.1...v0.2.0) (2023-08-09)
349
-
350
-
351
- ### Features
352
-
353
- * **catalog:** add taxon_scope column ([6a06c37](https://github.com/identification-resources/formica/commit/6a06c37ec0640a8ffbc258ad6a4d81d84d35fee9))
354
- * **resources:** check for missing leaf taxa ([387c47d](https://github.com/identification-resources/formica/commit/387c47d10bb7f1fb09a68c10dfa869bb924b7633))
355
-
356
- ## [0.1.1](https://github.com/identification-resources/formica/compare/v0.1.0...v0.1.1) (2023-05-10)
357
-
358
-
359
- ### Bug Fixes
360
-
361
- * **processor:** add Node hashbang ([51dee57](https://github.com/identification-resources/formica/commit/51dee57b8547afba449b2b846bd7d65e7927368f))
362
-
363
- # [0.1.0](https://github.com/identification-resources/formica/compare/fed91fd6f350c47bd067d221a4d0e2278a199dae...v0.1.0) (2023-03-01)
364
-
365
-
366
- ### Bug Fixes
367
-
368
- * **resources:** fix typo in taxon name pattern ([8f1b6cf](https://github.com/identification-resources/formica/commit/8f1b6cfa3858edb83c0aee589b84ad760ab815af))
369
- * **resources:** improve name parsing heuristics ([a40642e](https://github.com/identification-resources/formica/commit/a40642e9bdaeaae363584712e45f218809a5754b))
370
-
371
-
372
- ### Features
373
-
374
- * **catalog:** add SDK for catalog data ([fed91fd](https://github.com/identification-resources/formica/commit/fed91fd6f350c47bd067d221a4d0e2278a199dae))
375
- * **csv:** allow custom delims in output ([b523614](https://github.com/identification-resources/formica/commit/b523614171b0ff96347cb876a08106df413c4032))
376
- * **processor:** processor for DwC creation ([0e6f21d](https://github.com/identification-resources/formica/commit/0e6f21dfe00a2892348a4ab04fcaf3d6c8324a91))
377
- * **processor:** processor for DwC indexing ([279773b](https://github.com/identification-resources/formica/commit/279773b085676cf7cb3eb4d81496ad219ac85bce))
378
- * **resources:** add SDK for resource text files ([0acd36d](https://github.com/identification-resources/formica/commit/0acd36dde04cc1240cb8be97d48812b201b2685a))
379
- * **resources:** add support for cluster markings ([112315c](https://github.com/identification-resources/formica/commit/112315c7ebd7151c4e2cc77ab20e0cec3f579db6))
380
- * **resources:** add support for diffs as input ([9751627](https://github.com/identification-resources/formica/commit/9751627a916f47552661596048f1f0d44d89b102))
381
- * **resources:** add support for hybrids ([e49e96a](https://github.com/identification-resources/formica/commit/e49e96af9c3958bab2a3b0508b1fc8a018b80716))
382
- * **validate:** add catalog validation script ([4cdf785](https://github.com/identification-resources/formica/commit/4cdf785afb2c77320cd9b5b76483e3464c0f1cff))
383
- * **validate:** add script to validate resources ([246fb5d](https://github.com/identification-resources/formica/commit/246fb5dd8da03e736884850874cc51a11be9985c))
package/eslint.config.js DELETED
@@ -1,34 +0,0 @@
1
- const { defineConfig } = require('eslint/config')
2
-
3
- const tsParser = require('@typescript-eslint/parser')
4
- const typescriptEslint = require('@typescript-eslint/eslint-plugin')
5
- const js = require('@eslint/js')
6
-
7
- const { FlatCompat } = require('@eslint/eslintrc')
8
-
9
- const compat = new FlatCompat({
10
- baseDirectory: __dirname,
11
- recommendedConfig: js.configs.recommended,
12
- allConfig: js.configs.all
13
- })
14
-
15
- module.exports = defineConfig([{
16
- extends: compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'),
17
- languageOptions: {
18
- parser: tsParser,
19
- },
20
- plugins: {
21
- '@typescript-eslint': typescriptEslint,
22
- },
23
- rules: {
24
- indent: ['error', 4, {
25
- SwitchCase: 1,
26
- }],
27
- 'no-unused-vars': 'off',
28
- '@typescript-eslint/no-unused-vars': ['warn', {
29
- argsIgnorePattern: '^_',
30
- varsIgnorePattern: '^_',
31
- caughtErrorsIgnorePattern: '^_',
32
- }],
33
- },
34
- }])
package/lib/bin/SHEETS.js DELETED
File without changes
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __generator = (this && this.__generator) || function (thisArg, body) {
13
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
- function verb(n) { return function (v) { return step([n, v]); }; }
16
- function step(op) {
17
- if (f) throw new TypeError("Generator is already executing.");
18
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
- if (y = 0, t) op = [op[0] & 2, t.value];
21
- switch (op[0]) {
22
- case 0: case 1: t = op; break;
23
- case 4: _.label++; return { value: op[1], done: false };
24
- case 5: _.label++; y = op[1]; op = [0]; continue;
25
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
- default:
27
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
- if (t[2]) _.ops.pop();
32
- _.trys.pop(); continue;
33
- }
34
- op = body.call(thisArg, _);
35
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
- }
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- var fs_1 = require("fs");
41
- var path = require("path");
42
- var util = require("util");
43
- var index_1 = require("../index");
44
- var LINKS = {
45
- author: { sheet: 'authors', cleanField: 'main_full_name' },
46
- publisher: { sheet: 'publishers', cleanField: 'full_name' },
47
- };
48
- function replaceLink(value, data, cleanField) {
49
- var _a;
50
- var entity = data.get(value);
51
- return (_a = entity.get(cleanField)) !== null && _a !== void 0 ? _a : value;
52
- }
53
- function save(sheet, path) {
54
- return fs_1.promises.writeFile(path, index_1.csv.formatCsv(sheet.toTable()));
55
- }
56
- function main() {
57
- return __awaiter(this, void 0, void 0, function () {
58
- var args, files, _i, _a, arg, filePath, file, sheet, _loop_1, _b, _c, _d, _e, field;
59
- return __generator(this, function (_f) {
60
- switch (_f.label) {
61
- case 0:
62
- args = util.parseArgs({ allowPositionals: true });
63
- files = {};
64
- _i = 0, _a = args.positionals;
65
- _f.label = 1;
66
- case 1:
67
- if (!(_i < _a.length)) return [3 /*break*/, 4];
68
- arg = _a[_i];
69
- filePath = path.resolve(arg);
70
- return [4 /*yield*/, fs_1.promises.readFile(filePath, 'utf8')];
71
- case 2:
72
- file = _f.sent();
73
- sheet = path.basename(filePath, '.csv');
74
- files[sheet] = {
75
- path: filePath,
76
- sheet: index_1.catalog.loadData(file, sheet),
77
- };
78
- _f.label = 3;
79
- case 3:
80
- _i++;
81
- return [3 /*break*/, 1];
82
- case 4:
83
- if (!files.catalog) {
84
- throw new Error('Catalog file must be provided');
85
- }
86
- _loop_1 = function (field) {
87
- var _g, sheet, cleanField, indexField, used, _h, _j, work, value, entities, _k, _l, entity, oldKey, newKey;
88
- return __generator(this, function (_m) {
89
- switch (_m.label) {
90
- case 0:
91
- _g = LINKS[field], sheet = _g.sheet, cleanField = _g.cleanField;
92
- indexField = index_1.catalog.getTypeInfo(sheet)[1];
93
- used = new Set();
94
- if (!files[sheet]) {
95
- return [2 /*return*/, "continue"];
96
- }
97
- // Update works
98
- for (_h = 0, _j = files.catalog.sheet.entities; _h < _j.length; _h++) {
99
- work = _j[_h];
100
- value = work.get(field);
101
- if (value === undefined) {
102
- continue;
103
- }
104
- else if (Array.isArray(value)) {
105
- work.fields[field] = value.map(function (value) {
106
- value = replaceLink(value, files[sheet].sheet, cleanField);
107
- used.add(value);
108
- return value;
109
- });
110
- }
111
- else {
112
- work.fields[field] = replaceLink(value, files[sheet].sheet, cleanField);
113
- used.add(work.fields[field]);
114
- }
115
- }
116
- entities = [];
117
- for (_k = 0, _l = files[sheet].sheet.entities; _k < _l.length; _k++) {
118
- entity = _l[_k];
119
- oldKey = entity.get(indexField);
120
- if (entity.has(cleanField)) {
121
- entity.fields[indexField] = entity.get(cleanField);
122
- delete entity.fields[cleanField];
123
- }
124
- newKey = entity.get(indexField);
125
- if (used.has(newKey) && (newKey === oldKey || !files[sheet].sheet.index[newKey])) {
126
- entities.push(entity);
127
- }
128
- }
129
- // Save new file
130
- return [4 /*yield*/, save(new index_1.catalog.Entities(entities, indexField), files[sheet].path)];
131
- case 1:
132
- // Save new file
133
- _m.sent();
134
- return [2 /*return*/];
135
- }
136
- });
137
- };
138
- _b = LINKS;
139
- _c = [];
140
- for (_d in _b)
141
- _c.push(_d);
142
- _e = 0;
143
- _f.label = 5;
144
- case 5:
145
- if (!(_e < _c.length)) return [3 /*break*/, 8];
146
- _d = _c[_e];
147
- if (!(_d in _b)) return [3 /*break*/, 7];
148
- field = _d;
149
- return [5 /*yield**/, _loop_1(field)];
150
- case 6:
151
- _f.sent();
152
- _f.label = 7;
153
- case 7:
154
- _e++;
155
- return [3 /*break*/, 5];
156
- case 8:
157
- // Save catalog
158
- return [4 /*yield*/, save(files.catalog.sheet, files.catalog.path)];
159
- case 9:
160
- // Save catalog
161
- _f.sent();
162
- return [2 /*return*/];
163
- }
164
- });
165
- });
166
- }
167
- main().catch(function (error) {
168
- console.error(error);
169
- process.exit(1);
170
- });