@openneuro/server 4.31.2 → 4.32.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.31.2",
3
+ "version": "4.32.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.31.2",
24
+ "@openneuro/search": "^4.32.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": "d2665a438f56c1b2400f33073a43f2e996c286d1"
88
+ "gitHead": "3dd549a9ec43bbbf00a295a35b30f43cb7c29ffd"
89
89
  }
@@ -181,8 +181,10 @@ const parseQuery = async (query, datasetType, datasetStatus, userId) => {
181
181
  })
182
182
  } else if (datasetStatus === "Invalid") {
183
183
  addClause(query, "filter", {
184
- term: {
185
- ["draft.issues.severity"]: "error",
184
+ range: {
185
+ "latestSnapshot.validation.errors": {
186
+ gt: 0,
187
+ },
186
188
  },
187
189
  })
188
190
  }
@@ -1,6 +1,6 @@
1
1
  import Summary from "../../models/summary"
2
2
  import { summary } from "./summary"
3
- import { issues } from "./issues.js"
3
+ import { issues, issuesDraftStatus } from "./issues.js"
4
4
  import { description } from "./description.js"
5
5
  import { readme } from "./readme.js"
6
6
  import { getDraftRevision } from "../../datalad/draft.js"
@@ -37,6 +37,7 @@ const draft = {
37
37
  size: draftSize,
38
38
  summary,
39
39
  issues,
40
+ issuesStatus: issuesDraftStatus,
40
41
  validation,
41
42
  modified: (obj) => obj.modified,
42
43
  description,
@@ -46,3 +46,42 @@ export const snapshotIssues = async (snapshot) => {
46
46
  .exec()
47
47
  .then((data) => (data ? data.issues : null))
48
48
  }
49
+
50
+ /**
51
+ * Resolver implementation for legacy validator status summary
52
+ */
53
+ export async function issuesStatus(datasetId, version) {
54
+ const data = await Issue.findOne({
55
+ id: version,
56
+ datasetId,
57
+ }).exec()
58
+ if (data) {
59
+ const warnings = data.issues.filter((issue) =>
60
+ issue.severity === "warning"
61
+ ).length
62
+ const errors = data.issues.filter((issue) =>
63
+ issue.severity === "error"
64
+ ).length
65
+ return {
66
+ errors,
67
+ warnings,
68
+ }
69
+ } else {
70
+ return null
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Draft specific issues status resolver
76
+ */
77
+ export function issuesDraftStatus(dataset) {
78
+ return issuesStatus(dataset.id, dataset.revision)
79
+ }
80
+
81
+ /**
82
+ * Draft specific issues status resolver
83
+ */
84
+ export function issuesSnapshotStatus(snapshot) {
85
+ const datasetId = snapshot.id.split(":")[0]
86
+ return issuesStatus(datasetId, snapshot.hexsha)
87
+ }
@@ -5,7 +5,7 @@ import { checkDatasetRead, checkDatasetWrite } from "../permissions"
5
5
  import { readme } from "./readme.js"
6
6
  import { description } from "./description.js"
7
7
  import { summary } from "./summary"
8
- import { snapshotIssues } from "./issues.js"
8
+ import { issuesSnapshotStatus, snapshotIssues } from "./issues.js"
9
9
  import { getFiles } from "../../datalad/files"
10
10
  import Summary from "../../models/summary"
11
11
  import DatasetModel from "../../models/dataset"
@@ -259,6 +259,7 @@ export const deleteSnapshot = (obj, { datasetId, tag }, { user, userInfo }) => {
259
259
  const Snapshot = {
260
260
  analytics: (snapshot) => analytics(snapshot),
261
261
  issues: (snapshot) => snapshotIssues(snapshot),
262
+ issuesStatus: (snapshot) => issuesSnapshotStatus(snapshot),
262
263
  validation: (snapshot) => snapshotValidation(snapshot),
263
264
  }
264
265
 
@@ -497,6 +497,8 @@ export const typeDefs = `
497
497
  summary: Summary
498
498
  # Validator issues (legacy validator)
499
499
  issues: [ValidationIssue]
500
+ # Validator issues status (legacy validator)
501
+ issuesStatus: ValidationIssueStatus
500
502
  # Validator issues (schema validator)
501
503
  validation: DatasetValidation
502
504
  # Committed files in the working tree
@@ -526,6 +528,8 @@ export const typeDefs = `
526
528
  summary: Summary
527
529
  # Validator issues (legacy validator)
528
530
  issues: [ValidationIssue]
531
+ # Validator issues status (legacy validator)
532
+ issuesStatus: ValidationIssueStatus
529
533
  # Validator issues (schema validator)
530
534
  validation: DatasetValidation
531
535
  # Snapshot files
@@ -710,6 +714,12 @@ export const typeDefs = `
710
714
  helpUrl: String
711
715
  }
712
716
 
717
+ # Legacy validator count of errors and warnings
718
+ type ValidationIssueStatus {
719
+ errors: Int
720
+ warnings: Int
721
+ }
722
+
713
723
  input ValidatorIssueInput {
714
724
  code: String!
715
725
  subCode: String
@@ -5,12 +5,19 @@ import Dataset from "../models/dataset"
5
5
  // Static URLs - manual for now, could be generated from routes
6
6
  export const sitemapStaticUrls = () => [
7
7
  { url: "/", priority: 0.9, changefreq: "weekly" },
8
- { url: "/public/datasets", priority: 1.0, changefreq: "daily" },
8
+ { url: "/search", priority: 0.8, changefreq: "daily" },
9
+ { url: "/search/modality/mri", priority: 0.7, changefreq: "daily" },
10
+ { url: "/search/modality/pet", priority: 0.7, changefreq: "daily" },
11
+ { url: "/search/modality/meg", priority: 0.7, changefreq: "daily" },
12
+ { url: "/search/modality/eeg", priority: 0.7, changefreq: "daily" },
13
+ { url: "/search/modality/ieeg", priority: 0.7, changefreq: "daily" },
14
+ { url: "/search/modality/nirs", priority: 0.7, changefreq: "daily" },
15
+ { url: "/search/nih", priority: 0.7, changefreq: "daily" },
9
16
  { url: "/faq", priority: 0.6, changefreq: "monthly" },
10
17
  { url: "/pet", priority: 0.5, changefreq: "monthly" },
11
18
  { url: "/terms", priority: 0.5, changefreq: "monthly" },
12
19
  { url: "/cite", priority: 0.4, changefreq: "monthly" },
13
- { url: "/public/jobs", priority: 0.5, changefreq: "monthly" },
20
+ { url: "/image-attribution", priority: 0.4, changefreq: "monthly" },
14
21
  { url: "/crn/graphql", priority: 0.3 },
15
22
  ]
16
23
 
@@ -1,22 +1,16 @@
1
- /**
1
+ /**
2
2
  * Migration of accounts from previous providers (Google) to ORCID as primary authentication
3
- *
3
+ *
4
4
  * Runs on successful oauth linking these accounts
5
- *
6
- * Either Google -> ORCID (creates / updates ORCID account with the Google account and merges any data)
5
+ *
6
+ * Either Google -> ORCID (creates / updates ORCID account with the Google account and merges any data)
7
7
  * or ORCID + Google (merges Google account data into existing account)
8
8
  */
9
9
 
10
- /**
11
- *
12
- */
10
+ /** */
13
11
  function migrationOrcidToGoogle() {
14
-
15
12
  }
16
13
 
17
- /**
18
- *
19
- */
14
+ /** */
20
15
  function migrationGoogleToOrcid() {
21
-
22
- }
16
+ }
@@ -2,10 +2,14 @@ import mongoose from "mongoose"
2
2
  import type { Document } from "mongoose"
3
3
  const { Schema, model } = mongoose
4
4
 
5
+ export interface LegacyValidatorIssue {
6
+ severity: "error" | "warning"
7
+ }
8
+
5
9
  export interface IssueDocument extends Document {
6
10
  id: string
7
11
  datasetId: string
8
- issues: object
12
+ issues: LegacyValidatorIssue[]
9
13
  validatorMetadata: {
10
14
  validator: string
11
15
  version: string
@@ -15,7 +19,7 @@ export interface IssueDocument extends Document {
15
19
  const issueSchema = new Schema({
16
20
  id: { type: String, required: true },
17
21
  datasetId: { type: String, required: true },
18
- issues: Object,
22
+ issues: [Object],
19
23
  validatorMetadata: {
20
24
  validator: String,
21
25
  version: String,