@dmptool/utils 1.0.36 → 1.0.38

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/dist/dynamo.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface DynamoConnectionParams {
6
6
  logger: Logger;
7
7
  region: string;
8
8
  tableName: string;
9
+ endpoint?: string;
9
10
  maxAttempts: number;
10
11
  }
11
12
  export interface DMPVersionType {
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");
@@ -46,8 +51,18 @@ class DMPToolDynamoError extends Error {
46
51
  }
47
52
  // Initialize AWS SDK clients (outside the handler function)
48
53
  const getDynamoDBClient = (dynamoConfigParams) => {
49
- const { region, maxAttempts } = dynamoConfigParams;
50
- return new client_dynamodb_1.DynamoDBClient({ region, maxAttempts });
54
+ const { region, maxAttempts, endpoint } = dynamoConfigParams;
55
+ // If an endpoint was specified, we are running in a local environment
56
+ return endpoint === undefined
57
+ ? new client_dynamodb_1.DynamoDBClient({ region, maxAttempts })
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
+ });
51
66
  };
52
67
  /**
53
68
  * Lightweight query just to check if the DMP exists.
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');
package/dist/ssm.d.ts CHANGED
@@ -16,4 +16,4 @@ export interface SsmConnectionParams {
16
16
  * @returns The value of the variable, or undefined if the variable could not be found.
17
17
  * @throws
18
18
  */
19
- export declare const getSSMParameter: (connectionParams: SsmConnectionParams, key: string, env?: EnvironmentEnum, endpoint?: string) => Promise<string | undefined>;
19
+ export declare const getSSMParameter: (connectionParams: SsmConnectionParams, key: string, env?: EnvironmentEnum) => Promise<string | undefined>;
package/dist/ssm.js CHANGED
@@ -13,7 +13,7 @@ const client_ssm_1 = require("@aws-sdk/client-ssm");
13
13
  * @returns The value of the variable, or undefined if the variable could not be found.
14
14
  * @throws
15
15
  */
16
- const getSSMParameter = async (connectionParams, key, env = general_1.EnvironmentEnum.DEV, endpoint) => {
16
+ const getSSMParameter = async (connectionParams, key, env = general_1.EnvironmentEnum.DEV) => {
17
17
  var _a;
18
18
  if (connectionParams.logger && key && key.trim() !== '') {
19
19
  // Create an SSM client (use the endpoint if we are not using TLS - local dev)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/utils",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
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",
@@ -43,10 +43,11 @@
43
43
  "peerDependencies": {
44
44
  "@aws-sdk/client-cloudformation": "^3.980.0",
45
45
  "@aws-sdk/client-dynamodb": "^3.980.0",
46
- "@aws-sdk/client-sqs": "^3.980.0",
47
46
  "@aws-sdk/client-s3": "^3.980.0",
48
47
  "@aws-sdk/client-sns": "^3.980.0",
48
+ "@aws-sdk/client-sqs": "^3.980.0",
49
49
  "@aws-sdk/client-ssm": "^3.980.0",
50
+ "@aws-sdk/node-http-handler": "^3.370.0",
50
51
  "@aws-sdk/s3-request-presigner": "^3.980.0",
51
52
  "@aws-sdk/util-dynamodb": "^3.980.0"
52
53
  },