@openneuro/server 4.2.3 → 4.3.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/Dockerfile
CHANGED
|
@@ -11,7 +11,8 @@ WORKDIR /srv
|
|
|
11
11
|
COPY --from=build /srv/packages/openneuro-server/package.json /srv/package.json
|
|
12
12
|
COPY --from=build /srv/.yarnrc.yml /srv/.yarnrc.yml
|
|
13
13
|
COPY --from=build /srv/.yarn /srv/.yarn
|
|
14
|
-
COPY --from=build /srv/.pnp.
|
|
14
|
+
COPY --from=build /srv/.pnp.cjs /srv/.pnp.cjs
|
|
15
|
+
COPY --from=build /srv/.pnp.loader.mjs /srv/.pnp.loader.mjs
|
|
15
16
|
COPY --from=build /srv/packages/openneuro-server/dist /srv/packages/openneuro-server/dist
|
|
16
17
|
|
|
17
18
|
HEALTHCHECK --interval=10s --retries=10 CMD curl -f 'http://localhost:8111' || exit 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-alpha.0",
|
|
4
4
|
"description": "Core service for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/server.js",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"subscriptions-transport-ws": "0.9.18",
|
|
67
67
|
"superagent": "^3.8.2",
|
|
68
68
|
"ts-node": "9.1.1",
|
|
69
|
-
"typescript": "4.
|
|
69
|
+
"typescript": "4.5.4",
|
|
70
70
|
"underscore": "^1.8.3",
|
|
71
71
|
"uuid": "^3.0.1",
|
|
72
72
|
"xmldoc": "^1.1.0"
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "966931efa8d06bbf0b9540038ab3decab086d745"
|
|
108
108
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
createSnapshot,
|
|
16
16
|
deleteSnapshot,
|
|
17
17
|
deprecateSnapshot,
|
|
18
|
+
undoDeprecateSnapshot,
|
|
18
19
|
} from './snapshots.js'
|
|
19
20
|
import { removeUser, setAdmin, setBlocked } from './user.js'
|
|
20
21
|
import { updateSummary } from './summary.js'
|
|
@@ -44,6 +45,7 @@ const Mutation = {
|
|
|
44
45
|
flagAnnexObject,
|
|
45
46
|
createSnapshot,
|
|
46
47
|
deprecateSnapshot,
|
|
48
|
+
undoDeprecateSnapshot,
|
|
47
49
|
deleteSnapshot,
|
|
48
50
|
updateSummary,
|
|
49
51
|
updateValidation,
|
|
@@ -9,10 +9,6 @@ import { getFiles, filterFiles } from '../../datalad/files.js'
|
|
|
9
9
|
import DatasetModel from '../../models/dataset'
|
|
10
10
|
import { filterRemovedAnnexObjects } from '../utils/file.js'
|
|
11
11
|
import DeprecatedSnapshot from '../../models/deprecatedSnapshot'
|
|
12
|
-
import { checkDatasetAdmin } from '../permissions.js'
|
|
13
|
-
import SnapshotModel from '../../models/snapshot'
|
|
14
|
-
import User from '../../models/user'
|
|
15
|
-
import * as Sentry from '@sentry/node'
|
|
16
12
|
import { redis } from '../../libs/redis'
|
|
17
13
|
import CacheItem, { CacheType } from '../../cache/item'
|
|
18
14
|
import { normalizeDOI } from '../../libs/doi/normalize'
|
|
@@ -34,15 +30,16 @@ export const snapshot = (obj, { datasetId, tag }, context) => {
|
|
|
34
30
|
getFiles(datasetId, snapshot.hexsha)
|
|
35
31
|
.then(filterFiles(prefix))
|
|
36
32
|
.then(filterRemovedAnnexObjects(datasetId, context.userInfo)),
|
|
37
|
-
deprecated: () => deprecated(
|
|
33
|
+
deprecated: () => deprecated({ datasetId, tag }),
|
|
38
34
|
related: () => related(datasetId),
|
|
39
35
|
}))
|
|
40
36
|
},
|
|
41
37
|
)
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
export const deprecated =
|
|
45
|
-
|
|
40
|
+
export const deprecated = ({ datasetId, tag }) => {
|
|
41
|
+
const id = `${datasetId}:${tag}`
|
|
42
|
+
return DeprecatedSnapshot.findOne({ id }).lean().exec()
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
/**
|
|
@@ -89,22 +86,41 @@ export const deprecateSnapshot = async (
|
|
|
89
86
|
{ datasetId, tag, reason },
|
|
90
87
|
{ user, userInfo },
|
|
91
88
|
) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
const id = `${datasetId}:${tag}`
|
|
90
|
+
await checkDatasetWrite(datasetId, user, userInfo)
|
|
91
|
+
const timestamp = new Date()
|
|
92
|
+
await DeprecatedSnapshot.updateOne(
|
|
93
|
+
{ id },
|
|
94
|
+
{
|
|
95
|
+
id,
|
|
96
|
+
user,
|
|
97
|
+
reason,
|
|
98
|
+
timestamp,
|
|
99
|
+
},
|
|
100
|
+
{ upsert: true },
|
|
101
|
+
)
|
|
102
|
+
return {
|
|
103
|
+
id,
|
|
104
|
+
deprecated: {
|
|
105
|
+
id,
|
|
106
|
+
user,
|
|
107
|
+
reason,
|
|
108
|
+
timestamp,
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const undoDeprecateSnapshot = async (
|
|
114
|
+
obj,
|
|
115
|
+
{ datasetId, tag },
|
|
116
|
+
{ user, userInfo },
|
|
117
|
+
) => {
|
|
118
|
+
const id = `${datasetId}:${tag}`
|
|
119
|
+
await checkDatasetWrite(datasetId, user, userInfo)
|
|
120
|
+
await DeprecatedSnapshot.findOneAndDelete({ id })
|
|
121
|
+
return {
|
|
122
|
+
id,
|
|
123
|
+
deprecated: null,
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
126
|
|
package/src/graphql/schema.js
CHANGED
|
@@ -176,7 +176,9 @@ export const typeDefs = `
|
|
|
176
176
|
# Reset draft commit
|
|
177
177
|
resetDraft(datasetId: ID!, ref: String!): Boolean
|
|
178
178
|
# Flag snapshot as deprecated
|
|
179
|
-
deprecateSnapshot(datasetId: ID!, tag: String!, reason: String!):
|
|
179
|
+
deprecateSnapshot(datasetId: ID!, tag: String!, reason: String!): Snapshot
|
|
180
|
+
# Unflag snapshot as deprecated
|
|
181
|
+
undoDeprecateSnapshot(datasetId: ID!, tag: String!): Snapshot
|
|
180
182
|
# Create anonymous read only reviewer
|
|
181
183
|
createReviewer(datasetId: ID!): DatasetReviewer
|
|
182
184
|
# Remove reviewer
|
|
@@ -485,9 +487,9 @@ export const typeDefs = `
|
|
|
485
487
|
# hexsha of deprecated snapshots
|
|
486
488
|
id: ID!
|
|
487
489
|
# ID of user who flagged snapshot as deprecated
|
|
488
|
-
user:
|
|
490
|
+
user: String
|
|
489
491
|
# Reason for deprecating snaphot
|
|
490
|
-
|
|
492
|
+
reason: String
|
|
491
493
|
# Timestamp of snapshot deprecation
|
|
492
494
|
timestamp: Date
|
|
493
495
|
}
|
|
@@ -4,7 +4,7 @@ const { Schema, model } = mongoose
|
|
|
4
4
|
export interface DeprecatedSnapshotDocument extends Document {
|
|
5
5
|
id: string // snapshot hexsha
|
|
6
6
|
user: string
|
|
7
|
-
|
|
7
|
+
reason: string
|
|
8
8
|
timestamp: Date
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -13,9 +13,8 @@ const deprecatedSnapshotSchema = new Schema({
|
|
|
13
13
|
user: {
|
|
14
14
|
type: String,
|
|
15
15
|
required: true,
|
|
16
|
-
ref: 'User',
|
|
17
16
|
},
|
|
18
|
-
|
|
17
|
+
reason: {
|
|
19
18
|
type: String,
|
|
20
19
|
required: true,
|
|
21
20
|
},
|
package/src/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Needs to run before the other imports in Node */
|
|
2
|
-
import
|
|
3
|
-
start({
|
|
4
|
-
serviceName: '
|
|
2
|
+
import apm from 'elastic-apm-node'
|
|
3
|
+
apm.start({
|
|
4
|
+
serviceName: 'openneuro-server',
|
|
5
5
|
})
|
|
6
6
|
|
|
7
7
|
import * as Sentry from '@sentry/node'
|