@dmptool/utils 1.0.33 → 1.0.34

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/sqs.d.ts CHANGED
@@ -13,7 +13,9 @@ export interface SendMessageResponse {
13
13
  * @param detailType The type of message
14
14
  * @param detail The payload of the message (will be accessible to the invoked resource)
15
15
  * @param region The region to publish the message in. Defaults to 'us-west-2'.
16
+ * @param useTLS Whether to use TLS when sending the message. Defaults to true.
17
+ * Should be false when running in a local development environment.
16
18
  * @returns A SendMessageResponse object containing the status code and message info.
17
19
  * @throws Error if there was an error sending the message
18
20
  */
19
- export declare const sendMessage: (logger: Logger, queueURL: string, source: string, detailType: string, details: Record<string, unknown>, region?: string) => Promise<SendMessageResponse>;
21
+ export declare const sendMessage: (logger: Logger, queueURL: string, source: string, detailType: string, details: Record<string, unknown>, region?: string, useTLS?: boolean) => Promise<SendMessageResponse>;
package/dist/sqs.js CHANGED
@@ -12,15 +12,23 @@ const general_1 = require("./general");
12
12
  * @param detailType The type of message
13
13
  * @param detail The payload of the message (will be accessible to the invoked resource)
14
14
  * @param region The region to publish the message in. Defaults to 'us-west-2'.
15
+ * @param useTLS Whether to use TLS when sending the message. Defaults to true.
16
+ * Should be false when running in a local development environment.
15
17
  * @returns A SendMessageResponse object containing the status code and message info.
16
18
  * @throws Error if there was an error sending the message
17
19
  */
18
- const sendMessage = async (logger, queueURL, source, detailType, details, region = 'us-west-2') => {
20
+ const sendMessage = async (logger, queueURL, source, detailType, details, region = 'us-west-2', useTLS = true // Should be false when running in a local dev environment
21
+ ) => {
19
22
  var _a, _b;
20
23
  let errMsg = '';
21
24
  if (logger && queueURL) {
22
25
  // Create a new SQS client instance
23
- const client = new client_sqs_1.SQSClient({ region });
26
+ const client = new client_sqs_1.SQSClient({
27
+ region,
28
+ // These should be false when running in a local dev environment
29
+ useQueueUrlAsEndpoint: useTLS || true,
30
+ tls: useTLS || true,
31
+ });
24
32
  logger.debug({ queueURL, source, detailType, details }, 'Sending message');
25
33
  try {
26
34
  // Send the message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmptool/utils",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
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",