@openneuro/server 4.38.0-alpha.1 → 4.38.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/server",
3
- "version": "4.38.0-alpha.1",
3
+ "version": "4.38.0-alpha.2",
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": "^4.5.0",
24
- "@openneuro/search": "^4.38.0-alpha.1",
24
+ "@openneuro/search": "^4.38.0-alpha.2",
25
25
  "@sentry/node": "^8.25.0",
26
26
  "@sentry/profiling-node": "^8.25.0",
27
27
  "base64url": "^3.0.0",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "c7a1350704df419d17999699e056030b9aa0bd66"
91
+ "gitHead": "a2a301d754891d76a04c1ae91fde268419f0b5ca"
92
92
  }
@@ -8,6 +8,7 @@ import { checkDatasetWrite } from "../permissions.js"
8
8
  import { getFiles } from "../../datalad/files"
9
9
  import { filterRemovedAnnexObjects } from "../utils/file.js"
10
10
  import { validation } from "./validation"
11
+ import FileCheck from "../../models/fileCheck"
11
12
 
12
13
  // A draft must have a dataset parent
13
14
  export const draftFiles = async (dataset, args, { userInfo }) => {
@@ -31,6 +32,20 @@ export const revalidate = async (obj, { datasetId }, { user, userInfo }) => {
31
32
  await checkDatasetWrite(datasetId, user, userInfo)
32
33
  }
33
34
 
35
+ /**
36
+ * Resolve any issues with files recorded for the current commit
37
+ */
38
+ export const fileCheck = async (dataset) => {
39
+ const hexsha = await getDraftRevision(dataset.id)
40
+ // For drafts, obtain the local check results
41
+ const checks = await FileCheck.findOne({
42
+ datasetId: dataset.id,
43
+ hexsha,
44
+ remote: "local",
45
+ }).exec()
46
+ return checks
47
+ }
48
+
34
49
  const draft = {
35
50
  id: (obj) => obj.id,
36
51
  files: draftFiles,
@@ -43,6 +58,7 @@ const draft = {
43
58
  description,
44
59
  readme,
45
60
  head: (obj) => obj.revision,
61
+ fileCheck,
46
62
  }
47
63
 
48
64
  export default draft
@@ -546,6 +546,8 @@ export const typeDefs = `
546
546
  head: String
547
547
  # Total size in bytes of this draft
548
548
  size: BigInt
549
+ # File issues
550
+ fileCheck: FileCheck
549
551
  }
550
552
 
551
553
  # Tagged snapshot of a draft
@@ -933,6 +935,10 @@ export const typeDefs = `
933
935
  key: String
934
936
  note: String
935
937
  success: Boolean
938
+ dead: [String]
939
+ missing: [String]
940
+ untrusted: [String]
941
+ input: [String]
936
942
  }
937
943
 
938
944
  `
@@ -9,7 +9,7 @@ export interface FileCheckDocument extends Document {
9
9
  remote: string
10
10
  annexFsck: {
11
11
  command: string
12
- "error-messages": string[]
12
+ errorMessages: string[]
13
13
  file: string
14
14
  key: string
15
15
  note: string
@@ -24,7 +24,7 @@ const fileCheckSchema = new Schema({
24
24
  remote: { type: String, default: "local", required: true },
25
25
  annexFsck: [{
26
26
  command: String,
27
- "error-messages": [String],
27
+ errorMessages: [String],
28
28
  file: String,
29
29
  key: String,
30
30
  note: String,