@dmptool/utils 1.0.37 → 1.0.39
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/README.md +5 -2
- package/dist/dynamo.js +13 -1
- package/dist/general.js +1 -1
- package/dist/maDMP.js +1 -5
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -797,13 +797,16 @@ The code will use that value to construct the appropriate prefix for the key. Fo
|
|
|
797
797
|
```typescript
|
|
798
798
|
import {EnvironmentEnum, initializeLogger, getSSMParameter, LogLevelEnum } from '@dmptool/utils';
|
|
799
799
|
|
|
800
|
-
process.env.AWS_REGION = 'us-west-2';
|
|
801
|
-
|
|
802
800
|
// Initialize a logger
|
|
803
801
|
const logger: Logger = initializeLogger('exampleSSM', LogLevelEnum.DEBUG);
|
|
804
802
|
|
|
805
803
|
const paramName = 'RdsDatabase';
|
|
806
804
|
|
|
805
|
+
const configParams = {
|
|
806
|
+
logger,
|
|
807
|
+
region: process.env.AWS_REGION,
|
|
808
|
+
}
|
|
809
|
+
|
|
807
810
|
const response = await getSSMParameter(logger, paramName, EnvironmentEnum.DEV);
|
|
808
811
|
|
|
809
812
|
if (response) {
|
package/dist/dynamo.js
CHANGED
|
@@ -10,8 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.deleteDMP = exports.tombstoneDMP = exports.updateDMP = exports.createDMP = exports.getDMPs = exports.getDMPVersions = exports.getAllUniqueDMPIds = exports.DMPExists = exports.DMP_TOMBSTONE_VERSION = exports.DMP_LATEST_VERSION = void 0;
|
|
18
|
+
const http_1 = __importDefault(require("http"));
|
|
19
|
+
const node_http_handler_1 = require("@aws-sdk/node-http-handler");
|
|
15
20
|
const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
|
|
16
21
|
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
17
22
|
const general_1 = require("./general");
|
|
@@ -50,7 +55,14 @@ const getDynamoDBClient = (dynamoConfigParams) => {
|
|
|
50
55
|
// If an endpoint was specified, we are running in a local environment
|
|
51
56
|
return endpoint === undefined
|
|
52
57
|
? new client_dynamodb_1.DynamoDBClient({ region, maxAttempts })
|
|
53
|
-
: new client_dynamodb_1.DynamoDBClient({
|
|
58
|
+
: new client_dynamodb_1.DynamoDBClient({
|
|
59
|
+
region,
|
|
60
|
+
maxAttempts,
|
|
61
|
+
endpoint,
|
|
62
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler({
|
|
63
|
+
httpAgent: new http_1.default.Agent({ keepAlive: true }),
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
54
66
|
};
|
|
55
67
|
/**
|
|
56
68
|
* Lightweight query just to check if the DMP exists.
|
package/dist/general.js
CHANGED
package/dist/maDMP.js
CHANGED
|
@@ -236,7 +236,7 @@ const loadMemberInfo = async (rdsConnectionParams, planId) => {
|
|
|
236
236
|
LEFT JOIN projectMembers pctr ON pc.projectMemberId = pctr.id
|
|
237
237
|
LEFT JOIN affiliations a ON pctr.affiliationId = a.uri
|
|
238
238
|
WHERE pc.planId = ?
|
|
239
|
-
GROUP BY a.uri, a.name, pctr.email, pctr.givenName, pctr.surName,
|
|
239
|
+
GROUP BY pc.id, a.uri, a.name, pctr.email, pctr.givenName, pctr.surName,
|
|
240
240
|
pctr.orcid, pc.isPrimaryContact;
|
|
241
241
|
`;
|
|
242
242
|
rdsConnectionParams.logger.debug({ planId, sql }, 'Fetching plan member information');
|
|
@@ -383,7 +383,6 @@ const loadNarrativeTemplateInfo = async (rdsConnectionParams, planId) => {
|
|
|
383
383
|
section: [],
|
|
384
384
|
};
|
|
385
385
|
results.forEach((row) => {
|
|
386
|
-
var _a;
|
|
387
386
|
if (row.sectionId !== null && row.sectionId !== undefined) {
|
|
388
387
|
// Sections may have several rows in the results, so we need to check if we
|
|
389
388
|
// already have the section defined.
|
|
@@ -401,8 +400,6 @@ const loadNarrativeTemplateInfo = async (rdsConnectionParams, planId) => {
|
|
|
401
400
|
narrative.section.push(curSection);
|
|
402
401
|
}
|
|
403
402
|
if (row.questionId !== null && row.questionId !== undefined) {
|
|
404
|
-
const questionType = ((_a = row.questionJSON) === null || _a === void 0 ? void 0 : _a.type) || 'textArea';
|
|
405
|
-
const defaultAnswer = types_1.AnswerDefaultMap[questionType] || types_1.DefaultTextAreaAnswer;
|
|
406
403
|
// Every row in the results represents a single question/answer pair
|
|
407
404
|
curSection.question.push({
|
|
408
405
|
id: row.questionId,
|
|
@@ -886,7 +883,6 @@ const validateDMPToolExtensions = (logger, dmpId, dmp) => {
|
|
|
886
883
|
const msg = `Invalid DMP Tool extensions: ${validationErrors.join('; ')}`;
|
|
887
884
|
logger.warn({ dmpId }, msg);
|
|
888
885
|
logger.warn({ dmp }, 'Full DMP Tool extensions');
|
|
889
|
-
console.log(validationErrors);
|
|
890
886
|
throw new DMPValidationError(msg);
|
|
891
887
|
}
|
|
892
888
|
return dmp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dmptool/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
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",
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"trivy-high": "./scripts/trivy-high.sh",
|
|
32
32
|
"trivy-med": "./scripts/trivy-med.sh"
|
|
33
33
|
},
|
|
34
|
+
"overrides": {
|
|
35
|
+
"fast-xml-parser": "5.3.4"
|
|
36
|
+
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@dmptool/types": "2.3.2",
|
|
36
39
|
"@elastic/ecs-pino-format": "^1.5.0",
|
|
@@ -43,10 +46,11 @@
|
|
|
43
46
|
"peerDependencies": {
|
|
44
47
|
"@aws-sdk/client-cloudformation": "^3.980.0",
|
|
45
48
|
"@aws-sdk/client-dynamodb": "^3.980.0",
|
|
46
|
-
"@aws-sdk/client-sqs": "^3.980.0",
|
|
47
49
|
"@aws-sdk/client-s3": "^3.980.0",
|
|
48
50
|
"@aws-sdk/client-sns": "^3.980.0",
|
|
51
|
+
"@aws-sdk/client-sqs": "^3.980.0",
|
|
49
52
|
"@aws-sdk/client-ssm": "^3.980.0",
|
|
53
|
+
"@aws-sdk/node-http-handler": "^3.370.0",
|
|
50
54
|
"@aws-sdk/s3-request-presigner": "^3.980.0",
|
|
51
55
|
"@aws-sdk/util-dynamodb": "^3.980.0"
|
|
52
56
|
},
|