@dmptool/utils 1.0.22 → 1.0.23

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 +6 -4
  2. package/package.json +1 -1
package/dist/dynamo.js CHANGED
@@ -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.23",
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",