@dmptool/utils 1.0.10 → 1.0.11

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 +6 -6
  2. package/package.json +1 -1
package/dist/maDMP.js CHANGED
@@ -312,19 +312,19 @@ const loadDatasetInfo = async (rdsConnectionParams, applicationName, projectId,
312
312
  * Builds the RDA Common Standard Related Identifier entries for the DMP
313
313
  *
314
314
  * @param rdsConnectionParams the connection parameters for the MySQL database
315
- * @param projectId the Project ID to fetch the Related Works information for
315
+ * @param planId the Plan ID to fetch the Related Works information for
316
316
  * @returns the RDA Common Standard Related Identifier entries for the DMP
317
317
  */
318
- const loadRelatedWorksInfo = async (rdsConnectionParams, projectId) => {
318
+ const loadRelatedWorksInfo = async (rdsConnectionParams, planId) => {
319
319
  const sql = `
320
320
  SELECT w.doi AS identifier, LOWER(wv.workType) AS workType
321
321
  FROM relatedWorks rw
322
322
  JOIN workVersions wv ON rw.workVersionId = wv.id
323
323
  JOIN works w ON wv.workId = w.id
324
- WHERE rw.projectId = ?;
324
+ WHERE rw.planId = ?;
325
325
  `;
326
- rdsConnectionParams.logger.debug({ projectId, sql }, 'Fetching related works information');
327
- const resp = await (0, rds_1.queryTable)(rdsConnectionParams, sql, [projectId.toString()]);
326
+ rdsConnectionParams.logger.debug({ planId, sql }, 'Fetching related works information');
327
+ const resp = await (0, rds_1.queryTable)(rdsConnectionParams, sql, [planId.toString()]);
328
328
  if (resp && Array.isArray(resp.results) && resp.results.length > 0) {
329
329
  const works = resp.results.filter((row) => !(0, general_1.isNullOrUndefined)(row));
330
330
  // Determine the identifier types
@@ -974,7 +974,7 @@ async function planToDMPCommonStandard(rdsConnectionParams, applicationName, dom
974
974
  // We only allow one funding per plan at this time
975
975
  const fundings = await loadFundingInfo(rdsConnectionParams, plan.id);
976
976
  const funding = fundings.length > 0 ? fundings[0] : undefined;
977
- const works = await loadRelatedWorksInfo(rdsConnectionParams, plan.projectId);
977
+ const works = await loadRelatedWorksInfo(rdsConnectionParams, plan.id);
978
978
  const defaultRole = await loadDefaultMemberRole(rdsConnectionParams);
979
979
  // If the plan is registered, use the DOI as the identifier, otherwise convert to a URL
980
980
  const dmpId = plan.registered
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/utils",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
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",