@openneuro/server 4.43.0 → 4.44.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.44.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": "^4.5.0",
|
|
24
|
-
"@openneuro/search": "^4.
|
|
24
|
+
"@openneuro/search": "^4.44.0-alpha.0",
|
|
25
25
|
"@sentry/node": "^8.25.0",
|
|
26
26
|
"@sentry/profiling-node": "^8.25.0",
|
|
27
27
|
"base64url": "^3.0.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "ca0842ef4139407364515814218ed254fd13afb3"
|
|
93
93
|
}
|
|
@@ -18,7 +18,7 @@ export const issues = async (dataset, _, { userInfo }) => {
|
|
|
18
18
|
.exec()
|
|
19
19
|
.then((data) => {
|
|
20
20
|
if (!data && userInfo) {
|
|
21
|
-
// If no results were found,
|
|
21
|
+
// If no results were found, request to run validation
|
|
22
22
|
revalidate(
|
|
23
23
|
null,
|
|
24
24
|
{ datasetId: dataset.id, ref: dataset.revision },
|
|
@@ -2,7 +2,7 @@ import config from "../../config"
|
|
|
2
2
|
import { generateDataladCookie } from "../../libs/authentication/jwt"
|
|
3
3
|
import { getDatasetWorker } from "../../libs/datalad-service"
|
|
4
4
|
import Validation from "../../models/validation"
|
|
5
|
-
import { redis
|
|
5
|
+
import { redis } from "../../libs/redis"
|
|
6
6
|
import CacheItem from "../../cache/item"
|
|
7
7
|
import { CacheType } from "../../cache/types"
|
|
8
8
|
|
|
@@ -134,8 +134,6 @@ export const validationUrl = (datasetId, ref) => {
|
|
|
134
134
|
*/
|
|
135
135
|
export const revalidate = async (obj, { datasetId, ref }, { userInfo }) => {
|
|
136
136
|
try {
|
|
137
|
-
// Lock for five minutes to avoid stacking up multiple validation requests
|
|
138
|
-
await redlock.lock(`openneuro:revalidate-lock:${datasetId}:${ref}`, 300000)
|
|
139
137
|
const response = await fetch(validationUrl(datasetId, ref), {
|
|
140
138
|
method: "POST",
|
|
141
139
|
body: JSON.stringify({}),
|
package/src/handlers/datalad.ts
CHANGED
|
@@ -2,7 +2,7 @@ import request from "superagent"
|
|
|
2
2
|
import { Readable } from "node:stream"
|
|
3
3
|
import mime from "mime-types"
|
|
4
4
|
import { getFiles } from "../datalad/files"
|
|
5
|
-
import { getDatasetWorker } from "../libs/datalad-service"
|
|
5
|
+
import { getDatasetEndpoint, getDatasetWorker } from "../libs/datalad-service"
|
|
6
6
|
import { getDraftRevision } from "../datalad/draft"
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -103,3 +103,16 @@ export const getObject = (req, res) => {
|
|
|
103
103
|
})
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Redirect to the appropriate git endpoint for a dataset
|
|
109
|
+
*/
|
|
110
|
+
export function gitRepo(req, res) {
|
|
111
|
+
const { datasetId } = req.params
|
|
112
|
+
const worker = getDatasetEndpoint(datasetId)
|
|
113
|
+
const newUrl = req.originalUrl.replace(
|
|
114
|
+
`${req.baseUrl}/git/`,
|
|
115
|
+
`/git/${worker}/`,
|
|
116
|
+
)
|
|
117
|
+
return res.redirect(301, newUrl)
|
|
118
|
+
}
|
package/src/routes.ts
CHANGED
|
@@ -187,6 +187,11 @@ const routes = [
|
|
|
187
187
|
url: "/sitemap",
|
|
188
188
|
handler: sitemapHandler,
|
|
189
189
|
},
|
|
190
|
+
// git redirect routes
|
|
191
|
+
{ method: "get", url: "/git/:datasetId", handler: datalad.gitRepo },
|
|
192
|
+
{ method: "post", url: "/git/:datasetId", handler: datalad.gitRepo },
|
|
193
|
+
{ method: "get", url: "/git/:datasetId/*", handler: datalad.gitRepo },
|
|
194
|
+
{ method: "post", url: "/git/:datasetId/*", handler: datalad.gitRepo },
|
|
190
195
|
]
|
|
191
196
|
|
|
192
197
|
// initialize routes -------------------------------
|