@openneuro/server 4.27.0-alpha.4 → 4.28.0-alpha.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.28.0-alpha.0",
|
|
4
4
|
"description": "Core service for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/server.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@elastic/elasticsearch": "8.13.1",
|
|
22
22
|
"@graphql-tools/schema": "^10.0.0",
|
|
23
23
|
"@keyv/redis": "^2.7.0",
|
|
24
|
-
"@openneuro/search": "^4.
|
|
24
|
+
"@openneuro/search": "^4.28.0-alpha.0",
|
|
25
25
|
"@sentry/node": "^8.25.0",
|
|
26
26
|
"@sentry/profiling-node": "^8.25.0",
|
|
27
27
|
"base64url": "^3.0.0",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "6b1f049c2deaafce8f99be6f931c3ec4b6d517c4"
|
|
89
89
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import Dataset from "../../models/dataset"
|
|
1
2
|
import { description } from "./description.js"
|
|
2
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Return "schema" or "legacy" depending on the validator preferred for a dataset
|
|
6
|
+
*/
|
|
3
7
|
export async function datasetType(dsOrSnapshot): Promise<"schema" | "legacy"> {
|
|
4
|
-
const
|
|
5
|
-
|
|
8
|
+
const ds = new Dataset({ id: dsOrSnapshot.datasetId })
|
|
9
|
+
if (ds.schemaValidator) {
|
|
10
|
+
return "schema"
|
|
11
|
+
} else {
|
|
12
|
+
const dsDescription = await description(dsOrSnapshot)
|
|
13
|
+
return dsDescription.DatasetType === "derivative" ? "schema" : "legacy"
|
|
14
|
+
}
|
|
6
15
|
}
|
package/src/models/dataset.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface DatasetDocument extends Document {
|
|
|
27
27
|
downloads: number
|
|
28
28
|
views: number
|
|
29
29
|
related: [DatasetRelationDocument]
|
|
30
|
+
schemaValidator: boolean
|
|
30
31
|
_conditions: any
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -42,6 +43,7 @@ const datasetSchema = new Schema<DatasetDocument>(
|
|
|
42
43
|
downloads: Number,
|
|
43
44
|
views: Number,
|
|
44
45
|
related: [RelationSchema],
|
|
46
|
+
schemaValidator: { type: Boolean, default: false },
|
|
45
47
|
},
|
|
46
48
|
{ toJSON: { virtuals: true }, toObject: { virtuals: true } },
|
|
47
49
|
)
|