@dmptool/utils 1.0.22 → 1.0.24

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/dynamo.js +7 -5
  2. package/package.json +1 -1
package/dist/dynamo.js CHANGED
@@ -203,7 +203,7 @@ const getDMPs = async (dynamoConnectionParams, domainName, dmpId, version, inclu
203
203
  }
204
204
  else {
205
205
  // Just return the RDA Common Standard metadata record
206
- return items.map(item => ({ dmp: (0, util_dynamodb_1.unmarshall)(item) }));
206
+ return items.map(item => ({ dmp: item }));
207
207
  }
208
208
  }
209
209
  }
@@ -311,10 +311,12 @@ const createDMP = async (dynamoConnectionParams, domainName, dmpId, dmp, version
311
311
  throw new DMPToolDynamoError('Missing Dynamo config, DMP ID or DMP metadata record');
312
312
  }
313
313
  // If the version is LATEST, then first make sure there is not already one present!
314
- const exists = await (0, exports.DMPExists)(dynamoConnectionParams, dmpId);
315
- if (exists) {
316
- dynamoConnectionParams.logger.error({ dmpId }, 'Latest version already exists');
317
- throw new DMPToolDynamoError('Latest version already exists');
314
+ if (version === exports.DMP_LATEST_VERSION) {
315
+ const exists = await (0, exports.DMPExists)(dynamoConnectionParams, dmpId);
316
+ if (exists) {
317
+ dynamoConnectionParams.logger.error({ dmpId }, 'Latest version already exists');
318
+ throw new DMPToolDynamoError('Latest version already exists');
319
+ }
318
320
  }
319
321
  try {
320
322
  // If the metadata is nested in a top level 'dmp' property, then unwrap it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/utils",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
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",