@openneuro/server 4.41.0 → 4.41.1
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/utils/datacite-utils.ts +51 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/server",
|
|
3
|
-
"version": "4.41.
|
|
3
|
+
"version": "4.41.1",
|
|
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.41.
|
|
24
|
+
"@openneuro/search": "^4.41.1",
|
|
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": "11f72adfa4edde68dc840b22522a5742af88d5ea"
|
|
93
93
|
}
|
|
@@ -220,30 +220,59 @@ export const updateContributorsUtil = async (
|
|
|
220
220
|
let dataciteData = await getDataciteYml(datasetId)
|
|
221
221
|
if (!dataciteData) dataciteData = await emptyDataciteYml({ datasetId })
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
223
|
+
//
|
|
224
|
+
// 1. Build contributors (full form, includes `order`)
|
|
225
|
+
//
|
|
226
|
+
const contributorsCopy: RawDataciteContributor[] = newContributors.map((
|
|
227
|
+
c,
|
|
228
|
+
index,
|
|
229
|
+
) => ({
|
|
230
|
+
name: c.name,
|
|
231
|
+
givenName: c.givenName || "",
|
|
232
|
+
familyName: c.familyName || "",
|
|
233
|
+
nameType: "Personal" as const,
|
|
234
|
+
nameIdentifiers: c.orcid
|
|
235
|
+
? [{
|
|
236
|
+
nameIdentifier: `https://orcid.org/${
|
|
237
|
+
c.orcid.replace(/^https?:\/\/orcid\.org\//, "")
|
|
238
|
+
}`,
|
|
239
|
+
nameIdentifierScheme: "ORCID",
|
|
240
|
+
schemeUri: "https://orcid.org",
|
|
241
|
+
}]
|
|
242
|
+
: [],
|
|
243
|
+
contributorType: c.contributorType || "Researcher",
|
|
244
|
+
order: index + 1,
|
|
245
|
+
}))
|
|
240
246
|
|
|
241
247
|
dataciteData.data.attributes.contributors = contributorsCopy
|
|
242
|
-
dataciteData.data.attributes.creators = contributorsCopy.map((
|
|
243
|
-
{ contributorType: _, ...rest },
|
|
244
|
-
) => rest)
|
|
245
248
|
|
|
246
|
-
|
|
249
|
+
//
|
|
250
|
+
// 2. Build creators (strictly filtered / no empty fields / no order)
|
|
251
|
+
//
|
|
252
|
+
type RawDataciteCreator = Omit<
|
|
253
|
+
RawDataciteContributor,
|
|
254
|
+
"contributorType" | "order"
|
|
255
|
+
>
|
|
256
|
+
|
|
257
|
+
const creators: RawDataciteCreator[] = contributorsCopy.map((c) => {
|
|
258
|
+
const creator: RawDataciteCreator = {
|
|
259
|
+
name: c.name,
|
|
260
|
+
nameType: "Personal",
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (c.givenName?.trim()) creator.givenName = c.givenName
|
|
264
|
+
if (c.familyName?.trim()) creator.familyName = c.familyName
|
|
265
|
+
if (c.nameIdentifiers?.length) creator.nameIdentifiers = c.nameIdentifiers
|
|
266
|
+
|
|
267
|
+
return creator
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
dataciteData.data.attributes.creators = creators
|
|
271
|
+
|
|
272
|
+
//
|
|
273
|
+
// 3. Save and commit once
|
|
274
|
+
//
|
|
275
|
+
const gitRef = await saveDataciteYmlToRepo(datasetId, userId, dataciteData)
|
|
247
276
|
|
|
248
277
|
return {
|
|
249
278
|
draft: {
|
|
@@ -252,5 +281,6 @@ export const updateContributorsUtil = async (
|
|
|
252
281
|
files: [],
|
|
253
282
|
modified: new Date().toISOString(),
|
|
254
283
|
},
|
|
284
|
+
gitRef: gitRef.id,
|
|
255
285
|
}
|
|
256
286
|
}
|