@openneuro/server 4.4.3 → 4.4.7
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 +3 -3
- package/src/datalad/__tests__/dataset.spec.js +1 -1
- package/src/datalad/__tests__/snapshots.spec.js +1 -1
- package/src/graphql/resolvers/__tests__/dataset.spec.js +1 -1
- package/src/graphql/resolvers/dataset.js +14 -3
- package/src/graphql/resolvers/snapshots.js +7 -1
- package/src/graphql/schema.js +2 -0
- package/src/libs/email/index.ts +6 -5
- package/src/libs/email/templates/__tests__/__snapshots__/comment-created.spec.ts.snap +1 -1
- package/src/libs/email/templates/__tests__/__snapshots__/dataset-deleted.spec.ts.snap +1 -1
- package/src/libs/email/templates/__tests__/__snapshots__/owner-unsubscribed.spec.ts.snap +1 -1
- package/src/libs/email/templates/__tests__/__snapshots__/snapshot-created.spec.ts.snap +1 -1
- package/src/libs/email/templates/__tests__/__snapshots__/snapshot-reminder.spec.ts.snap +1 -1
- package/src/libs/email/templates/comment-created.ts +1 -1
- package/src/libs/email/templates/dataset-deleted.ts +1 -1
- package/src/libs/email/templates/dataset-import-failed.ts +2 -2
- package/src/libs/email/templates/dataset-imported.ts +2 -2
- package/src/libs/email/templates/owner-unsubscribed.ts +1 -1
- package/src/libs/email/templates/snapshot-created.ts +1 -1
- package/src/libs/email/templates/snapshot-reminder.ts +1 -1
- package/src/models/__tests__/ingestDataset.spec.ts +1 -1
- package/src/models/comment.ts +1 -0
- package/src/server.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/server",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.7",
|
|
4
4
|
"description": "Core service for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/server.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"jsonwebtoken": "^8.3.0",
|
|
48
48
|
"mime-types": "^2.1.19",
|
|
49
49
|
"moment": "^2.14.1",
|
|
50
|
-
"mongoose": "
|
|
50
|
+
"mongoose": "6.2.0",
|
|
51
51
|
"morgan": "^1.6.1",
|
|
52
52
|
"node-fetch": "^2.6.0",
|
|
53
53
|
"node-mailjet": "^3.3.5",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "4373b377ffa4f0bcd71a7abaf07235c262f6cdb2"
|
|
108
108
|
}
|
|
@@ -16,7 +16,7 @@ describe('dataset model operations', () => {
|
|
|
16
16
|
// Setup a default sequence value to return for each test
|
|
17
17
|
mockingoose.Counter.toReturn(
|
|
18
18
|
{ _id: 'dataset', sequence_value: 1 },
|
|
19
|
-
'
|
|
19
|
+
'findOne',
|
|
20
20
|
)
|
|
21
21
|
})
|
|
22
22
|
it('resolves to dataset id string', async done => {
|
|
@@ -28,7 +28,7 @@ describe('snapshot model operations', () => {
|
|
|
28
28
|
// Setup a default sequence value to return for each test
|
|
29
29
|
mockingoose.Counter.toReturn(
|
|
30
30
|
{ _id: 'dataset', sequence_value: 1 },
|
|
31
|
-
'
|
|
31
|
+
'findOne',
|
|
32
32
|
)
|
|
33
33
|
})
|
|
34
34
|
it('posts to the DataLad /datasets/{dsId}/snapshots/{snapshot} endpoint', async done => {
|
|
@@ -287,13 +287,24 @@ export const starred = (obj, _, { user }) =>
|
|
|
287
287
|
/**
|
|
288
288
|
* Is this dataset available on brainlife?
|
|
289
289
|
*/
|
|
290
|
-
export const onBrainlife = async
|
|
290
|
+
export const onBrainlife = async datasetOrSnapshot => {
|
|
291
291
|
try {
|
|
292
|
-
const
|
|
292
|
+
const find = {
|
|
293
|
+
removed: false,
|
|
294
|
+
}
|
|
295
|
+
if (datasetOrSnapshot.tag) {
|
|
296
|
+
find.path = { $regex: '^OpenNeuro/' + datasetOrSnapshot.id.split(':')[0] }
|
|
297
|
+
find.version = datasetOrSnapshot.tag
|
|
298
|
+
} else {
|
|
299
|
+
find.path = { $regex: '^OpenNeuro/' + datasetOrSnapshot.id }
|
|
300
|
+
}
|
|
301
|
+
const url = `https://brainlife.io/api/warehouse/datalad/datasets?find=${JSON.stringify(
|
|
302
|
+
find,
|
|
303
|
+
)}`
|
|
293
304
|
const res = await fetch(url)
|
|
294
305
|
const body = await res.json()
|
|
295
306
|
if (Array.isArray(body) && body.length) {
|
|
296
|
-
return
|
|
307
|
+
return true
|
|
297
308
|
} else {
|
|
298
309
|
return false
|
|
299
310
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as datalad from '../../datalad/snapshots.js'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
dataset,
|
|
4
|
+
analytics,
|
|
5
|
+
snapshotCreationComparison,
|
|
6
|
+
onBrainlife,
|
|
7
|
+
} from './dataset.js'
|
|
3
8
|
import { checkDatasetRead, checkDatasetWrite } from '../permissions.js'
|
|
4
9
|
import { readme } from './readme.js'
|
|
5
10
|
import { description } from './description.js'
|
|
@@ -32,6 +37,7 @@ export const snapshot = (obj, { datasetId, tag }, context) => {
|
|
|
32
37
|
.then(filterRemovedAnnexObjects(datasetId, context.userInfo)),
|
|
33
38
|
deprecated: () => deprecated({ datasetId, tag }),
|
|
34
39
|
related: () => related(datasetId),
|
|
40
|
+
onBrainlife,
|
|
35
41
|
}))
|
|
36
42
|
},
|
|
37
43
|
)
|
package/src/graphql/schema.js
CHANGED
|
@@ -459,6 +459,8 @@ export const typeDefs = `
|
|
|
459
459
|
deprecated: DeprecatedSnapshot
|
|
460
460
|
# Related DOI references
|
|
461
461
|
related: [RelatedObject]
|
|
462
|
+
# Is the snapshot available for analysis on Brainlife?
|
|
463
|
+
onBrainlife: Boolean @cacheControl(maxAge: 10080, scope: PUBLIC)
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
# RelatedObject nature of relationship
|
package/src/libs/email/index.ts
CHANGED
|
@@ -36,11 +36,12 @@ export const mailjetFormat = (email: Record<string, string>) => ({
|
|
|
36
36
|
* @param email Nodemailer style email record
|
|
37
37
|
*/
|
|
38
38
|
export const send = (email: Record<string, string>): Promise<Response> => {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (perform_api_call) {
|
|
40
|
+
return transport
|
|
41
|
+
.post('send', { version: 'v3.1', perform_api_call })
|
|
42
|
+
.request(mailjetFormat(email))
|
|
43
|
+
} else {
|
|
44
|
+
// Mailjet is not configured, instead log emails
|
|
41
45
|
console.dir(email)
|
|
42
46
|
}
|
|
43
|
-
return transport
|
|
44
|
-
.post('send', { version: 'v3.1', perform_api_call })
|
|
45
|
-
.request(mailjetFormat(email))
|
|
46
47
|
}
|
|
@@ -57,7 +57,7 @@ exports[`email template -> comment created renders with expected arguments 1`] =
|
|
|
57
57
|
</head>
|
|
58
58
|
<body>
|
|
59
59
|
<div class=\\"top-bar\\">
|
|
60
|
-
<img src=\\"https://openneuro.org/assets/
|
|
60
|
+
<img src=\\"https://openneuro.org/assets/email-header.1cb8bf76.png\\" />
|
|
61
61
|
</div>
|
|
62
62
|
<div class=\\"content\\">
|
|
63
63
|
<h2>Hi, J. Doe</h2>
|
|
@@ -39,7 +39,7 @@ exports[`email template -> comment created renders with expected arguments 1`] =
|
|
|
39
39
|
</head>
|
|
40
40
|
<body>
|
|
41
41
|
<div class=\\"top-bar\\">
|
|
42
|
-
<img src=\\"https://openneuro.org/assets/
|
|
42
|
+
<img src=\\"https://openneuro.org/assets/email-header.1cb8bf76.png\\" />
|
|
43
43
|
</div>
|
|
44
44
|
<div class=\\"content\\">
|
|
45
45
|
<h2>Hi, J. Doe</h2>
|
|
@@ -39,7 +39,7 @@ exports[`email template -> comment created renders with expected arguments 1`] =
|
|
|
39
39
|
</head>
|
|
40
40
|
<body>
|
|
41
41
|
<div class=\\"top-bar\\">
|
|
42
|
-
<img src=\\"https://openneuro.org/assets/
|
|
42
|
+
<img src=\\"https://openneuro.org/assets/email-header.1cb8bf76.png\\" />
|
|
43
43
|
</div>
|
|
44
44
|
<div class=\\"content\\">
|
|
45
45
|
<h2>Hi, J. Doe</h2>
|
|
@@ -57,7 +57,7 @@ exports[`email template -> comment created renders with expected arguments 1`] =
|
|
|
57
57
|
</head>
|
|
58
58
|
<body>
|
|
59
59
|
<div class=\\"top-bar\\">
|
|
60
|
-
<img src=\\"https://openneuro.org/assets/
|
|
60
|
+
<img src=\\"https://openneuro.org/assets/email-header.1cb8bf76.png\\" />
|
|
61
61
|
</div>
|
|
62
62
|
<div class=\\"content\\">
|
|
63
63
|
<h2>Hi, J. Doe</h2>
|
|
@@ -39,7 +39,7 @@ exports[`email template -> comment created renders with expected arguments 1`] =
|
|
|
39
39
|
</head>
|
|
40
40
|
<body>
|
|
41
41
|
<div class=\\"top-bar\\">
|
|
42
|
-
<img src=\\"https://openneuro.org/assets/
|
|
42
|
+
<img src=\\"https://openneuro.org/assets/email-header.1cb8bf76.png\\" />
|
|
43
43
|
</div>
|
|
44
44
|
<div class=\\"content\\">
|
|
45
45
|
<h2>Hi, J. Doe</h2>
|
|
@@ -66,13 +66,13 @@ export const datasetImportFailed = ({
|
|
|
66
66
|
</head>
|
|
67
67
|
<body>
|
|
68
68
|
<div class="top-bar">
|
|
69
|
-
<img src="${siteUrl}/assets/
|
|
69
|
+
<img src="${siteUrl}/assets/email-header.1cb8bf76.png" />
|
|
70
70
|
</div>
|
|
71
71
|
<div class="content">
|
|
72
72
|
<h2>Hi, ${name}</h2>
|
|
73
73
|
|
|
74
74
|
<p>
|
|
75
|
-
A dataset
|
|
75
|
+
A dataset import you requested failed. It was imported as <b>${datasetId}</b>.
|
|
76
76
|
</p>
|
|
77
77
|
|
|
78
78
|
<div>
|
|
@@ -62,13 +62,13 @@ export const datasetImportEmail = ({
|
|
|
62
62
|
</head>
|
|
63
63
|
<body>
|
|
64
64
|
<div class="top-bar">
|
|
65
|
-
<img src="${siteUrl}/assets/
|
|
65
|
+
<img src="${siteUrl}/assets/email-header.1cb8bf76.png" />
|
|
66
66
|
</div>
|
|
67
67
|
<div class="content">
|
|
68
68
|
<h2>Hi, ${name}</h2>
|
|
69
69
|
|
|
70
70
|
<p>
|
|
71
|
-
A dataset
|
|
71
|
+
A dataset import you requested has finished. It was imported as <b>${datasetId}</b>.
|
|
72
72
|
</p>
|
|
73
73
|
|
|
74
74
|
<div>
|
|
@@ -44,7 +44,7 @@ export const ownerUnsubscribed = ({
|
|
|
44
44
|
</head>
|
|
45
45
|
<body>
|
|
46
46
|
<div class="top-bar">
|
|
47
|
-
<img src="${siteUrl}/assets/
|
|
47
|
+
<img src="${siteUrl}/assets/email-header.1cb8bf76.png" />
|
|
48
48
|
</div>
|
|
49
49
|
<div class="content">
|
|
50
50
|
<h2>Hi, ${name}</h2>
|
|
@@ -46,7 +46,7 @@ export const snapshotReminder = ({
|
|
|
46
46
|
</head>
|
|
47
47
|
<body>
|
|
48
48
|
<div class="top-bar">
|
|
49
|
-
<img src="${siteUrl}/assets/
|
|
49
|
+
<img src="${siteUrl}/assets/email-header.1cb8bf76.png" />
|
|
50
50
|
</div>
|
|
51
51
|
<div class="content">
|
|
52
52
|
<h2>Hi, ${name}</h2>
|
package/src/models/comment.ts
CHANGED
package/src/server.js
CHANGED
|
@@ -23,12 +23,8 @@ const redisConnectionSetup = async () => {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
mongoose.connect(config.mongo.url, {
|
|
26
|
-
useNewUrlParser: true,
|
|
27
26
|
dbName: config.mongo.dbName,
|
|
28
27
|
connectTimeoutMS: config.mongo.connectTimeoutMS,
|
|
29
|
-
useFindAndModify: false,
|
|
30
|
-
useUnifiedTopology: true,
|
|
31
|
-
useCreateIndex: true,
|
|
32
28
|
})
|
|
33
29
|
|
|
34
30
|
redisConnectionSetup().then(() => {
|