From 0d54858e7c618bef63853ee89e20b3ad581e1479 Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Tue, 15 Oct 2024 15:30:33 -0500 Subject: [PATCH 1/6] fix typing on schem validation error object, remove isBidsy.ts --- bids-validator/deno.json | 2 +- bids-validator/src/utils/errors.ts | 3 ++- bids-validator/src/validators/isBidsy.ts | 14 -------------- 3 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 bids-validator/src/validators/isBidsy.ts diff --git a/bids-validator/deno.json b/bids-validator/deno.json index c1f9d14c4..10fbc36c3 100644 --- a/bids-validator/deno.json +++ b/bids-validator/deno.json @@ -1,6 +1,6 @@ { "name": "@bids/validator", - "version": "1.14.13", + "version": "1.14.14", "exports": { ".": "./src/bids-validator.ts", "./main": "./src/main.ts", diff --git a/bids-validator/src/utils/errors.ts b/bids-validator/src/utils/errors.ts index 66445113b..e5a99e934 100644 --- a/bids-validator/src/utils/errors.ts +++ b/bids-validator/src/utils/errors.ts @@ -1,5 +1,6 @@ export class SchemaStructureError extends Error { - constructor(schemaPath) { + schemaPath: string + constructor(schemaPath: string) { super(`Validator attempted to access ${schemaPath}, but it wasn't there.`) this.name = 'SchemaStructureError' this.schemaPath = schemaPath diff --git a/bids-validator/src/validators/isBidsy.ts b/bids-validator/src/validators/isBidsy.ts deleted file mode 100644 index 73e02ff0c..000000000 --- a/bids-validator/src/validators/isBidsy.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Not sure if we want this yet. Would be to create issues for non standard - * derivatives to have the lowest common denomenator of bids like file names. - */ -// @ts-nocheck -import type { BIDSContext } from '../schema/context.ts' -import type { ContextCheckFunction } from '../../types/check.ts' -import type { BIDSFile } from '../types/filetree.ts' -import type { Schema } from '../types/schema.ts' - -export const isBidsyFilename: ContextCheckFunction = (schema, context) => { - // every '.', '-', '_' followed by an alnum - // only contains '.', '-', '_' and alnum -} From ba32614b7379b66b435c0bbedcf8d5953a80b8af Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Tue, 15 Oct 2024 16:19:33 -0500 Subject: [PATCH 2/6] rollback deno esbuild plugin --- bids-validator/build.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bids-validator/build.ts b/bids-validator/build.ts index ead89ab0a..863ecd85b 100755 --- a/bids-validator/build.ts +++ b/bids-validator/build.ts @@ -1,4 +1,4 @@ -#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run +#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run --reload /** * Build the schema based validator for distribution (web and npm), targets browser compatible ESM * @@ -6,7 +6,7 @@ */ import * as esbuild from 'https://deno.land/x/esbuild@v0.24.0/mod.js' import { parse } from 'https://deno.land/std@0.223.0/flags/mod.ts' -import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@0.11.0" +import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@0.10.3" import * as path from "https://deno.land/std@0.223.0/path/mod.ts" import { getVersion } from './src/version.ts' From 35306a2f3d7f92f5992eb679f56b5af135a62c01 Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Tue, 15 Oct 2024 17:15:58 -0500 Subject: [PATCH 3/6] v1.14.15-dev.0 --- bids-validator-web/package.json | 2 +- bids-validator/package.json | 2 +- lerna.json | 2 +- package-lock.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bids-validator-web/package.json b/bids-validator-web/package.json index 3c6116b73..9abd49780 100644 --- a/bids-validator-web/package.json +++ b/bids-validator-web/package.json @@ -1,6 +1,6 @@ { "name": "bids-validator-web", - "version": "1.14.14", + "version": "1.14.15-dev.0", "description": "web client for bids-validator", "main": "index.js", "license": "MIT", diff --git a/bids-validator/package.json b/bids-validator/package.json index b9cff64d6..3b3307012 100644 --- a/bids-validator/package.json +++ b/bids-validator/package.json @@ -1,6 +1,6 @@ { "name": "bids-validator", - "version": "1.14.14", + "version": "1.14.15-dev.0", "description": "", "main": "./dist/commonjs/index.js", "exports": { diff --git a/lerna.json b/lerna.json index 42e04a6fc..4ae55d509 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "packages": ["bids-validator", "bids-validator-web"], - "version": "1.14.14" + "version": "1.14.15-dev.0" } diff --git a/package-lock.json b/package-lock.json index f6b480016..11c68edd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ } }, "bids-validator": { - "version": "1.14.14", + "version": "1.14.15-dev.0", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.637.0", @@ -80,7 +80,7 @@ } }, "bids-validator-web": { - "version": "1.14.14", + "version": "1.14.15-dev.0", "license": "MIT", "dependencies": { "@babel/runtime": "^7.22.10", From 4671868d4ba51d8ed3208bf6ba21a1282a333d2e Mon Sep 17 00:00:00 2001 From: Mathieu Guay-Paquet Date: Tue, 15 Oct 2024 14:20:19 -0400 Subject: [PATCH 4/6] fix: avoid Maximum call stack size exceeded Using spread syntax `...SomeIterable` with a long list inside a function call can result in a "Maximum call stack size exceeded" error. But this is not a problem inside array literals. --- bids-validator/validators/session.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bids-validator/validators/session.js b/bids-validator/validators/session.js index e7d8ead00..a17f23717 100644 --- a/bids-validator/validators/session.js +++ b/bids-validator/validators/session.js @@ -11,15 +11,12 @@ import isNode from '../utils/isNode' * files from the set. */ const session = function missingSessionFiles(fileList) { - const issues = [] const { subjects, sessions } = getDataOrganization(fileList) - - issues.push(...missingSessionWarnings(subjects, sessions)) - const subject_files = getSubjectFiles(subjects) - issues.push(...missingFileWarnings(subjects, subject_files)) - - return issues + return [ + ...missingSessionWarnings(subjects, sessions), + ...missingFileWarnings(subjects, subject_files), + ] } /** From 5e55ceeb029ddb170f66f80c2c136475d8700d4b Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Thu, 17 Oct 2024 09:31:27 -0500 Subject: [PATCH 5/6] add continous regex for anatomical datatype to file_level_rules.json --- .../bids_validator/rules/file_level_rules.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bids-validator/bids_validator/rules/file_level_rules.json b/bids-validator/bids_validator/rules/file_level_rules.json index 360027e4a..291c4c6c2 100644 --- a/bids-validator/bids_validator/rules/file_level_rules.json +++ b/bids-validator/bids_validator/rules/file_level_rules.json @@ -141,6 +141,17 @@ "@@@_anat_ext_@@@": ["nii\\.gz", "nii", "json"] } }, + "anat_cont": { + "regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?anat[\\/\\\\]\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_ce-[a-zA-Z0-9]+)?(?:_rec-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_echo-[0-9]+)?(?:_part-(imag|mag|phase|real))?(?:_recording-[a-zA-Z0-9]+)?(?:_chunk-[0-9]+)?(?:@@@_cont_ext_@@@)$", + "tokens": { + "@@@_cont_ext_@@@": [ + "_physio\\.tsv\\.gz", + "_stim\\.tsv\\.gz", + "_physio\\.json", + "_stim\\.json" + ] + } + }, "behavioral": { "regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?beh[\\/\\\\]\\1(_\\2)?_task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?((?:@@@_behavioral_ext_@@@)|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$", From b1d50c81529dbe13824428baccfaa9ad390721be Mon Sep 17 00:00:00 2001 From: Ross Blair Date: Thu, 17 Oct 2024 09:43:10 -0500 Subject: [PATCH 6/6] load new regex in utils/type.js --- bids-validator/utils/type.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bids-validator/utils/type.js b/bids-validator/utils/type.js index 98de0b88c..9a2315496 100644 --- a/bids-validator/utils/type.js +++ b/bids-validator/utils/type.js @@ -29,6 +29,7 @@ const anatMultiInv = buildRegExp(file_level_rules.anat_multiinv) const anatMP2RAGE = buildRegExp(file_level_rules.anat_mp2rage) const anatVFAMT = buildRegExp(file_level_rules.anat_vfa_mt) const anatMTR = buildRegExp(file_level_rules.anat_mtr) +const anatCont = buildRegExp(file_level_rules.anat_cont) const behavioralData = buildRegExp(file_level_rules.behavioral) const dwiData = buildRegExp(file_level_rules.dwi) const eegData = buildRegExp(file_level_rules.eeg) @@ -242,7 +243,8 @@ export default { conditionalMatch(anatMultiInv, path) || conditionalMatch(anatMP2RAGE, path) || conditionalMatch(anatVFAMT, path) || - conditionalMatch(anatMTR, path) + conditionalMatch(anatMTR, path) || + conditionalMatch(anatCont, path) ) },