aiiinotate 0.10.0 → 0.10.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/README.md +1 -1
- package/cli/utils/io.js +8 -1
- package/docs/cli.md +7 -4
- package/import_manifests.txt +1734 -0
- package/package.json +1 -1
- package/src/data/annotations/annotations2.js +0 -1
- package/src/data/manifests/manifests2.js +6 -2
- package/src/utils/utils.js +54 -21
- package/import_manifest_file.txt +0 -1
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ npm run cli -- import <arguments>
|
|
|
180
180
|
|
|
181
181
|
## Test coverage
|
|
182
182
|
|
|
183
|
-
aiiinotate is well tested:
|
|
183
|
+
aiiinotate is well tested: **~90% test coverage** on all files !
|
|
184
184
|
|
|
185
185
|
```
|
|
186
186
|
ℹ ----------------------------------------------------------------------------------------
|
package/cli/utils/io.js
CHANGED
|
@@ -64,9 +64,16 @@ function fileArrayValidate (fileArr) {
|
|
|
64
64
|
* @returns {Promise<string[]>}
|
|
65
65
|
*/
|
|
66
66
|
async function parseImportInputFile(file) {
|
|
67
|
+
// ensure input file exists
|
|
68
|
+
const [ fileAbs, ok ] = fileOk(file);
|
|
69
|
+
if (!ok) {
|
|
70
|
+
console.error(`could not read import file: ${file}. exiting...`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
// read `file` split it by lines, remove empty lines
|
|
68
75
|
const fileArr =
|
|
69
|
-
fileRead(
|
|
76
|
+
fileRead(fileAbs)
|
|
70
77
|
.split("\n")
|
|
71
78
|
.filter(l => !l.match(/^\s*$/g));
|
|
72
79
|
return [ ...new Set(fileArrayValidate(fileArr)) ];
|
package/docs/cli.md
CHANGED
|
@@ -64,17 +64,20 @@ aiiinotate migrate revert-all
|
|
|
64
64
|
|
|
65
65
|
## `import`: import data
|
|
66
66
|
|
|
67
|
+
The CLI can be used to import IIIF annotations or to index IIIF manifests in aiiinotate.
|
|
68
|
+
|
|
67
69
|
```bash
|
|
68
70
|
# in prod
|
|
69
|
-
aiiinotate import -i 2 -f <path/to/import/file.txt>
|
|
71
|
+
aiiinotate import <manifests|annotations> -i 2 -f <path/to/import/file.txt>
|
|
70
72
|
```
|
|
71
73
|
|
|
72
74
|
Where:
|
|
75
|
+
- `<manifests|annotations>` is the kind of data to import: manifests or annotations
|
|
73
76
|
- `-i` `--iiif-version` (`2|3`) is the IIIF Presentation API version of the data to import:
|
|
74
|
-
- if `-i 3`, we import IIIF presentation 3.x
|
|
75
|
-
- if `-i 2`, we import IIIF presentation 2.x
|
|
77
|
+
- if `-i 3`, we import IIIF presentation 3.x data
|
|
78
|
+
- if `-i 2`, we import IIIF presentation 2.x data
|
|
76
79
|
- `-f --file` is a relative or absolute path the the import file. This import file:
|
|
77
|
-
- contains a list of paths to annotation lists
|
|
80
|
+
- contains a list of paths to annotation lists, annotation pages or manifests
|
|
78
81
|
- with 1 path per line
|
|
79
82
|
- paths can be relative or absolute
|
|
80
83
|
|