bids-validator-deno 2.2.2__tar.gz → 2.2.4__tar.gz
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.
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/PKG-INFO +1 -1
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/deno.json +9 -9
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/pyproject.toml +1 -1
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/nifti.test.ts +4 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/nifti.ts +29 -23
- bids_validator_deno-2.2.4/src/files/repo.test.ts +28 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/repo.ts +32 -4
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/LICENSE +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/README.md +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/pdm_build.py +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/.git-meta.json +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/bids-validator.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/access.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/access.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/browser.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/browser.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/deno.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/deno.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/dwi.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/dwi.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/filetree.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/filetree.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/gzip.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/gzip.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/ignore.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/ignore.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/inheritance.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/inheritance.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/json.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/json.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/openers.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/openers.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/streams.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/streams.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/tiff.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/tiff.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/tsv.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/files/tsv.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/issues/datasetIssues.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/issues/datasetIssues.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/issues/list.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/issues/list.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/main.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/applyRules.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/applyRules.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/associations.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/associations.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/context.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/context.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/datatypes.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/datatypes.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/entities.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/entities.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/expressionLanguage.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/expressionLanguage.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/fixtures.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/tables.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/tables.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/walk.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/walk.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/setup/loadSchema.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/setup/loadSchema.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/setup/options.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/setup/options.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/setup/requestPermissions.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/summary/collectSubjectMetadata.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/summary/summary.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/summary/summary.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/README.md +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/bom-utf16.tsv +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/bom-utf8.json +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/generate-filenames.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/bids_examples.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/common.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/derivatives.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/empty_files.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/hed-integration.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/nifti_rules.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/valid_dataset.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/valid_filenames.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/valid_headers.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/nullReadBytes.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/regression.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/schema-expression-language.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/simple-dataset.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/utils.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/check.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/columns.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/columns.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/filetree.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/issues.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/schema.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/types/validation-result.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/errors.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/logger.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/logger.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/memoize.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/objectPathHandler.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/output.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/utils/queue.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/bids.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/bids.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/citation.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/citation.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameCase.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameCase.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameIdentify.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameIdentify.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameValidate.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameValidate.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/hed.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/internal/emptyFile.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/internal/unusedFile.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/json.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/validateFiles.test.ts +0 -0
- {bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/version.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bids/validator",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./src/bids-validator.ts",
|
|
6
6
|
"./main": "./src/main.ts",
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
},
|
|
29
29
|
"imports": {
|
|
30
30
|
"@ajv": "npm:ajv@^8.17.1",
|
|
31
|
-
"@bids/schema": "jsr:@bids/schema@~1.1.
|
|
31
|
+
"@bids/schema": "jsr:@bids/schema@~1.1.3",
|
|
32
32
|
"@cliffy/command": "jsr:@effigies/cliffy-command@1.0.0-dev.8",
|
|
33
33
|
"@cliffy/table": "jsr:@effigies/cliffy-table@1.0.0-dev.5",
|
|
34
34
|
"@hed/validator": "npm:hed-validator@~4.1.4",
|
|
35
35
|
"@ignore": "npm:ignore@^7.0.5",
|
|
36
|
-
"@libs/xml": "jsr:@libs/xml@^
|
|
36
|
+
"@libs/xml": "jsr:@libs/xml@^7.0.3",
|
|
37
37
|
"@mango/nifti": "npm:@bids/nifti-reader-js@^0.6.9",
|
|
38
|
-
"@std/assert": "jsr:@std/assert@^1.0.
|
|
38
|
+
"@std/assert": "jsr:@std/assert@^1.0.16",
|
|
39
39
|
"@std/fmt": "jsr:@std/fmt@^1.0.8",
|
|
40
|
-
"@std/fs": "jsr:@std/fs@^1.0.
|
|
40
|
+
"@std/fs": "jsr:@std/fs@^1.0.20",
|
|
41
41
|
"@std/io": "jsr:@std/io@^0.225.2",
|
|
42
42
|
"@std/log": "jsr:@std/log@^0.224.14",
|
|
43
|
-
"@std/path": "jsr:@std/path@^1.1.
|
|
44
|
-
"@std/streams": "jsr:@std/streams@^1.0.
|
|
45
|
-
"@std/yaml": "jsr:@std/yaml@^1.0.
|
|
46
|
-
"isomorphic-git": "npm:isomorphic-git@^1.
|
|
43
|
+
"@std/path": "jsr:@std/path@^1.1.3",
|
|
44
|
+
"@std/streams": "jsr:@std/streams@^1.0.14",
|
|
45
|
+
"@std/yaml": "jsr:@std/yaml@^1.0.10",
|
|
46
|
+
"isomorphic-git": "npm:isomorphic-git@^1.35.1",
|
|
47
47
|
"hash-wasm": "npm:hash-wasm@^4.12.0"
|
|
48
48
|
},
|
|
49
49
|
"tasks": {
|
|
@@ -96,6 +96,10 @@ Deno.test('Test extracting axis codes', async (t) => {
|
|
|
96
96
|
const affine = [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]
|
|
97
97
|
assertEquals(axisCodes(affine), ['A', 'S', 'R'])
|
|
98
98
|
})
|
|
99
|
+
await t.step('Fail gracefully on NaNs', async () => {
|
|
100
|
+
const affine = [[Number.NaN, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]
|
|
101
|
+
assertEquals(axisCodes(affine), null)
|
|
102
|
+
})
|
|
99
103
|
})
|
|
100
104
|
|
|
101
105
|
testAsyncFileAccess('Test file access errors for loadHeader', loadHeader)
|
|
@@ -34,9 +34,9 @@ async function extract(buffer: Uint8Array, nbytes: number): Promise<Uint8Array<A
|
|
|
34
34
|
|
|
35
35
|
export async function loadHeader(file: BIDSFile): Promise<NiftiHeader> {
|
|
36
36
|
const buf = await readBytes(file, 1024)
|
|
37
|
+
let header
|
|
37
38
|
try {
|
|
38
39
|
const data = isCompressed(buf.buffer) ? await extract(buf, 540) : buf.slice(0, 540)
|
|
39
|
-
let header
|
|
40
40
|
if (isNIFTI1(data.buffer)) {
|
|
41
41
|
header = new NIFTI1()
|
|
42
42
|
// Truncate to 348 bytes to avoid attempting to parse extensions
|
|
@@ -48,29 +48,30 @@ export async function loadHeader(file: BIDSFile): Promise<NiftiHeader> {
|
|
|
48
48
|
if (!header) {
|
|
49
49
|
throw { code: 'NIFTI_HEADER_UNREADABLE' }
|
|
50
50
|
}
|
|
51
|
-
const ndim = header.dims[0]
|
|
52
|
-
return {
|
|
53
|
-
dim: header.dims,
|
|
54
|
-
// Hack: round pixdim to 3 decimal places; schema should add rounding function
|
|
55
|
-
pixdim: header.pixDims.map((pixdim) => Math.round(pixdim * 1000) / 1000),
|
|
56
|
-
shape: header.dims.slice(1, ndim + 1),
|
|
57
|
-
voxel_sizes: header.pixDims.slice(1, ndim + 1),
|
|
58
|
-
dim_info: {
|
|
59
|
-
freq: header.dim_info & 0x03,
|
|
60
|
-
phase: (header.dim_info >> 2) & 0x03,
|
|
61
|
-
slice: (header.dim_info >> 4) & 0x03,
|
|
62
|
-
},
|
|
63
|
-
xyzt_units: {
|
|
64
|
-
xyz: ['unknown', 'meter', 'mm', 'um'][header.xyzt_units & 0x03],
|
|
65
|
-
t: ['unknown', 'sec', 'msec', 'usec'][(header.xyzt_units >> 3) & 0x03],
|
|
66
|
-
},
|
|
67
|
-
qform_code: header.qform_code,
|
|
68
|
-
sform_code: header.sform_code,
|
|
69
|
-
axis_codes: axisCodes(header.affine),
|
|
70
|
-
} as NiftiHeader
|
|
71
51
|
} catch (err) {
|
|
72
52
|
throw { code: 'NIFTI_HEADER_UNREADABLE' }
|
|
73
53
|
}
|
|
54
|
+
|
|
55
|
+
const ndim = header.dims[0]
|
|
56
|
+
return {
|
|
57
|
+
dim: header.dims,
|
|
58
|
+
// Hack: round pixdim to 3 decimal places; schema should add rounding function
|
|
59
|
+
pixdim: header.pixDims.map((pixdim) => Math.round(pixdim * 1000) / 1000),
|
|
60
|
+
shape: header.dims.slice(1, ndim + 1),
|
|
61
|
+
voxel_sizes: header.pixDims.slice(1, ndim + 1),
|
|
62
|
+
dim_info: {
|
|
63
|
+
freq: header.dim_info & 0x03,
|
|
64
|
+
phase: (header.dim_info >> 2) & 0x03,
|
|
65
|
+
slice: (header.dim_info >> 4) & 0x03,
|
|
66
|
+
},
|
|
67
|
+
xyzt_units: {
|
|
68
|
+
xyz: ['unknown', 'meter', 'mm', 'um'][header.xyzt_units & 0x03],
|
|
69
|
+
t: ['unknown', 'sec', 'msec', 'usec'][(header.xyzt_units >> 3) & 0x03],
|
|
70
|
+
},
|
|
71
|
+
qform_code: header.qform_code,
|
|
72
|
+
sform_code: header.sform_code,
|
|
73
|
+
axis_codes: axisCodes(header.affine),
|
|
74
|
+
} as NiftiHeader
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
/** Vector addition */
|
|
@@ -124,13 +125,18 @@ function argMax(arr: number[]): number {
|
|
|
124
125
|
*
|
|
125
126
|
* @returns character codes describing the orientation of an image affine.
|
|
126
127
|
*/
|
|
127
|
-
export function axisCodes(affine: number[][]): string[] {
|
|
128
|
+
export function axisCodes(affine: number[][]): string[] | null {
|
|
128
129
|
// This function is an extract of the Python function transforms3d.affines.decompose44
|
|
129
130
|
// (https://github.com/matthew-brett/transforms3d/blob/6a43a98/transforms3d/affines.py#L10-L153)
|
|
130
131
|
//
|
|
131
132
|
// As an optimization, this only orthogonalizes the basis,
|
|
132
133
|
// and does not normalize to unit vectors.
|
|
133
134
|
|
|
135
|
+
// Bad qforms result in NaNs in the rotation matrix
|
|
136
|
+
if (affine.some((row) => row.some((val) => !Number.isFinite(val)))) {
|
|
137
|
+
return null
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
// Operate on columns, which are the cosines that project input coordinates onto output axes
|
|
135
141
|
const [cosX, cosY, cosZ] = [0, 1, 2].map((j) => [0, 1, 2].map((i) => affine[i][j]))
|
|
136
142
|
|
|
@@ -148,7 +154,7 @@ export function axisCodes(affine: number[][]): string[] {
|
|
|
148
154
|
|
|
149
155
|
// Check that indices are 0, 1 and 2 in some order
|
|
150
156
|
if (maxIndices.toSorted().some((idx, i) => idx !== i)) {
|
|
151
|
-
throw {
|
|
157
|
+
throw { code: 'AMBIGUOUS_AFFINE' }
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
// Positive/negative codes for each world axis
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { assert, assertArrayIncludes, assertObjectMatch } from '@std/assert'
|
|
2
|
+
import { parseRmetLine } from './repo.ts'
|
|
3
|
+
|
|
4
|
+
Deno.test('parseRmetLine', async (t) => {
|
|
5
|
+
await t.step('parses valid rmet line', () => {
|
|
6
|
+
const line =
|
|
7
|
+
'1590213748.042921433s 57894849-d0c8-4c62-8418-3627be18a196:V +iVcEk18e3J2WQys4zr_ANaTPfpUufW4Y#ds002778/dataset_description.json'
|
|
8
|
+
const entry = parseRmetLine(line)
|
|
9
|
+
assertObjectMatch(entry!, {
|
|
10
|
+
timestamp: 1590213748.042921433,
|
|
11
|
+
uuid: '57894849-d0c8-4c62-8418-3627be18a196',
|
|
12
|
+
version: 'iVcEk18e3J2WQys4zr_ANaTPfpUufW4Y',
|
|
13
|
+
path: 'ds002778/dataset_description.json',
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
await t.step('parses base64-encoded rmet line', () => {
|
|
17
|
+
// Real example from OpenNeuro, has a unicode apostrophe in the filename
|
|
18
|
+
const line =
|
|
19
|
+
'1714730995.499196097s 51d08fb4-c58a-4fd7-a171-e5ff8226ca2f:V +!aG1NM2VqYWRxdFgxR18uc1VRNmJzd0FMLnhUcFJFeG8jZHMwMDQxOTQvZGVyaXZhdGl2ZXMvQnJhbmRzZXRhbDIwMjRUZW1wb3JhbEFkYXB0YXRpb25FQ29HL2RhdGFfc3ViamVjdHMvc3ViLXAxMS9lcG9jaHNfYi9lcG9jaHNfYl9jaGFubmVsMzItQW1iZXLigJlzIE1hY0Jvb2sgUHJvLnR4dA=='
|
|
20
|
+
const entry = parseRmetLine(line)
|
|
21
|
+
assertObjectMatch(entry!, {
|
|
22
|
+
timestamp: 1714730995.499196097,
|
|
23
|
+
uuid: '51d08fb4-c58a-4fd7-a171-e5ff8226ca2f',
|
|
24
|
+
version: 'hmM3ejadqtX1G_.sUQ6bswAL.xTpRExo',
|
|
25
|
+
path: 'ds004194/derivatives/Brandsetal2024TemporalAdaptationECoG/data_subjects/sub-p11/epochs_b/epochs_b_channel32-Amber’s MacBook Pro.txt'
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
})
|
|
@@ -9,7 +9,8 @@ const textDecoder = new TextDecoder('utf-8')
|
|
|
9
9
|
export const annexKeyRegex =
|
|
10
10
|
/^(?<hashname>[A-Z0-9]+)-s(?<size>\d+)--(?<digest>[0-9a-fA-F]+)(?<ext>\.[\w\-. ]*)?/
|
|
11
11
|
export const rmetLineRegex =
|
|
12
|
-
/^(?<timestamp>\d+(\.\d+)?)s (?<uuid>[0-9a-fA-F-]+):V \+(?<
|
|
12
|
+
/^(?<timestamp>\d+(\.\d+)?)s (?<uuid>[0-9a-fA-F-]+):V \+(?<version_str>.+)/
|
|
13
|
+
export const versionRegex = /^(?<version>[^#]+)#(?<path>.+)/
|
|
13
14
|
|
|
14
15
|
type Rmet = {
|
|
15
16
|
timestamp: number
|
|
@@ -39,6 +40,33 @@ export async function hashDirLower(annexKey: string): Promise<[string, string]>
|
|
|
39
40
|
return [digest.slice(0, 3), digest.slice(3, 6)]
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
export function parseRmetLine(line: string): Rmet | null {
|
|
44
|
+
const match = line.match(rmetLineRegex)
|
|
45
|
+
if (!match) {
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
48
|
+
const uuid = match!.groups!.uuid
|
|
49
|
+
const timestamp = parseFloat(match!.groups!.timestamp)
|
|
50
|
+
let versionStr = match!.groups!.version_str as string
|
|
51
|
+
// Base64 encoded version strings are prefixed with '!'
|
|
52
|
+
if (versionStr.startsWith('!')) {
|
|
53
|
+
versionStr = b64toUtf8(versionStr.slice(1))
|
|
54
|
+
}
|
|
55
|
+
const versionMatch = versionStr.match(versionRegex)
|
|
56
|
+
return {
|
|
57
|
+
timestamp,
|
|
58
|
+
uuid,
|
|
59
|
+
version: versionMatch!.groups!.version,
|
|
60
|
+
path: versionMatch!.groups!.path,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function b64toUtf8(str: string): string {
|
|
65
|
+
const decoded = atob(str)
|
|
66
|
+
const bytes = Uint8Array.from({ length: decoded.length }, (_, i) => decoded.charCodeAt(i))
|
|
67
|
+
return textDecoder.decode(bytes)
|
|
68
|
+
}
|
|
69
|
+
|
|
42
70
|
/**
|
|
43
71
|
* Read remote metadata entries for a given annex key
|
|
44
72
|
*
|
|
@@ -55,9 +83,9 @@ async function readRmet(key: string, options: any): Promise<Record<string, Rmet>
|
|
|
55
83
|
const rmet = await readAnnexPath(join(...hashDirs, `${key}.log.rmet`), options)
|
|
56
84
|
const ret: Record<string, Rmet> = {}
|
|
57
85
|
for (const line of rmet.split('\n')) {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
ret[
|
|
86
|
+
const entry = parseRmetLine(line)
|
|
87
|
+
if (entry) {
|
|
88
|
+
ret[entry.uuid] = entry
|
|
61
89
|
}
|
|
62
90
|
}
|
|
63
91
|
return ret
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/schema/expressionLanguage.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/summary/collectSubjectMetadata.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/bids_examples.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/hed-integration.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/valid_dataset.test.ts
RENAMED
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/valid_filenames.test.ts
RENAMED
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/local/valid_headers.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/tests/schema-expression-language.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameIdentify.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/filenameValidate.test.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/internal/emptyFile.ts
RENAMED
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/internal/unusedFile.ts
RENAMED
|
File without changes
|
|
File without changes
|
{bids_validator_deno-2.2.2 → bids_validator_deno-2.2.4}/src/validators/validateFiles.test.ts
RENAMED
|
File without changes
|
|
File without changes
|