@dmptool/utils 1.0.11 → 1.0.13

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.
Files changed (2) hide show
  1. package/dist/maDMP.js +4 -5
  2. package/package.json +1 -1
package/dist/maDMP.js CHANGED
@@ -116,7 +116,7 @@ const loadDefaultMemberRole = async (rdsConnectionParams) => {
116
116
  rdsConnectionParams.logger.debug({ sql }, 'Fetching default role');
117
117
  const resp = await (0, rds_1.queryTable)(rdsConnectionParams, sql, []);
118
118
  if (resp && Array.isArray(resp.results) && resp.results.length > 0) {
119
- return resp.results[0].id;
119
+ return resp.results[0].uri;
120
120
  }
121
121
  return undefined;
122
122
  };
@@ -228,7 +228,8 @@ async function loadContactFromPlanOwner(rdsConnectionParams, ownerId) {
228
228
  const loadMemberInfo = async (rdsConnectionParams, planId) => {
229
229
  const sql = `
230
230
  SELECT pc.id, a.uri, a.name, pctr.email, pctr.givenName, pctr.surName,
231
- pctr.orcid, pc.isPrimaryContact, GROUP_CONCAT(r.uri) as roles
231
+ pctr.orcid, pc.isPrimaryContact,
232
+ CONCAT('["', GROUP_CONCAT(r.uri SEPARATOR '","'), '"]') as roles
232
233
  FROM planMembers pc
233
234
  LEFT JOIN planMemberRoles pcr ON pc.id = pcr.planMemberId
234
235
  LEFT JOIN memberRoles r ON pcr.memberRoleId = r.id
@@ -488,9 +489,7 @@ const buildContributors = (applicationName, env, planId, projectId, members, def
488
489
  }
489
490
  return members.map((member) => {
490
491
  // Make sure that we always have roles as an array
491
- const roles = member.roles && member.roles.includes('[')
492
- ? JSON.parse(member.roles)
493
- : [defaultRole];
492
+ const roles = member.roles ? JSON.parse(member.roles) : [defaultRole];
494
493
  // Combine the member's given name and surname into a single name'
495
494
  const contrib = {
496
495
  name: [member.givenName, member.surName]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/utils",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Helper/Utility functions for use in the DMP Tool services. Particularly AWS tooling and maDMP serialization",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",