Socket
Socket
Sign inDemoInstall

sqs-consumer

Package Overview
Dependencies
Maintainers
2
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqs-consumer - npm Package Compare versions

Comparing version 10.2.1 to 10.3.0

.github/workflows/annotate-test-reports.yml

11

CHANGELOG.md

@@ -1,9 +0,7 @@

## [10.2.1](https://github.com/bbc/sqs-consumer/compare/v10.2.0...v10.2.1) (2024-04-30)
## [10.3.0](https://github.com/bbc/sqs-consumer/compare/v10.2.1...v10.3.0) (2024-05-08)
### Bug Fixes
### Features
* build exclusive type files ([65008eb](https://github.com/bbc/sqs-consumer/commit/65008ebaab8aecbe806b8e7ab9be809de58518a9))
* default extension for cjs ([bd9855b](https://github.com/bbc/sqs-consumer/commit/bd9855babedee1ea6506d8fc2901228e1cd31468))
* types extension for cjs ([8bc6239](https://github.com/bbc/sqs-consumer/commit/8bc62396badf30bcf508309110a782aa6f4b9d8c))
* add the ability to extend errors from aws ([#496](https://github.com/bbc/sqs-consumer/issues/496)) ([f4b071b](https://github.com/bbc/sqs-consumer/commit/f4b071b05e6cee304fcf866fa813e791338359d2))

@@ -13,2 +11,3 @@

* updating repro links ([48f452e](https://github.com/bbc/sqs-consumer/commit/48f452ee935a563b3d0c1043b552947da84886ea))
* enhance ci reports ([#497](https://github.com/bbc/sqs-consumer/issues/497)) ([eded17a](https://github.com/bbc/sqs-consumer/commit/eded17adc06fe8414b7ea0732dd5cac2cd00f7e2))
* updating test-reporter ([645901d](https://github.com/bbc/sqs-consumer/commit/645901de5c60aa44dc45bc2ac5e5981581004b39))

@@ -32,2 +32,3 @@ /// <reference types="node" />

abortController: AbortController;
private extendedAWSErrors;
constructor(options: ConsumerOptions);

@@ -34,0 +35,0 @@ /**

@@ -39,2 +39,3 @@ "use strict";

this.alwaysAcknowledge = options.alwaysAcknowledge ?? false;
this.extendedAWSErrors = options.extendedAWSErrors ?? false;
this.sqs =

@@ -218,3 +219,3 @@ options.sqs ||

catch (err) {
throw (0, errors_js_1.toSQSError)(err, `SQS receive message failed: ${err.message}`);
throw (0, errors_js_1.toSQSError)(err, `SQS receive message failed: ${err.message}`, this.extendedAWSErrors);
}

@@ -331,3 +332,3 @@ }

catch (err) {
this.emit("error", (0, errors_js_1.toSQSError)(err, `Error changing visibility timeout: ${err.message}`), message);
this.emit("error", (0, errors_js_1.toSQSError)(err, `Error changing visibility timeout: ${err.message}`, this.extendedAWSErrors), message);
}

@@ -353,3 +354,3 @@ }

catch (err) {
this.emit("error", (0, errors_js_1.toSQSError)(err, `Error changing visibility timeout: ${err.message}`), messages);
this.emit("error", (0, errors_js_1.toSQSError)(err, `Error changing visibility timeout: ${err.message}`, this.extendedAWSErrors), messages);
}

@@ -433,3 +434,3 @@ }

catch (err) {
throw (0, errors_js_1.toSQSError)(err, `SQS delete message failed: ${err.message}`);
throw (0, errors_js_1.toSQSError)(err, `SQS delete message failed: ${err.message}`, this.extendedAWSErrors);
}

@@ -462,3 +463,3 @@ }

catch (err) {
throw (0, errors_js_1.toSQSError)(err, `SQS delete message failed: ${err.message}`);
throw (0, errors_js_1.toSQSError)(err, `SQS delete message failed: ${err.message}`, this.extendedAWSErrors);
}

@@ -465,0 +466,0 @@ }

@@ -8,3 +8,5 @@ import { AWSError } from "./types.js";

retryable: boolean;
fault: "client" | "server";
fault: AWSError["$fault"];
response?: AWSError["$response"];
metadata?: AWSError["$metadata"];
constructor(message: string);

@@ -32,3 +34,3 @@ }

*/
declare function toSQSError(err: AWSError, message: string): SQSError;
declare function toSQSError(err: AWSError, message: string, extendedAWSErrors: boolean): SQSError;
/**

@@ -35,0 +37,0 @@ * Formats an Error to the StandardError type.

@@ -56,3 +56,3 @@ "use strict";

*/
function toSQSError(err, message) {
function toSQSError(err, message, extendedAWSErrors) {
const sqsError = new SQSError(message);

@@ -65,2 +65,6 @@ sqsError.code = err.name;

sqsError.time = new Date();
if (extendedAWSErrors) {
sqsError.response = err.$response;
sqsError.metadata = err.$metadata;
}
return sqsError;

@@ -67,0 +71,0 @@ }

@@ -142,2 +142,7 @@ import { SQSClient, Message, QueueAttributeName } from "@aws-sdk/client-sqs";

postReceiveMessageCallback?(): Promise<void>;
/**
* Set this to `true` if you want to receive additional information about the error
* that occurred from AWS, such as the response and metadata.
*/
extendedAWSErrors?: boolean;
}

@@ -226,3 +231,3 @@ /**

*/
name: string;
readonly name: string;
/**

@@ -239,4 +244,22 @@ * Human-readable error response message

*/
readonly $fault?: "client" | "server";
readonly $fault: "client" | "server";
/**
* Represents an HTTP message as received in reply to a request
*/
readonly $response?: {
/**
* The status code of the HTTP response.
*/
statusCode?: number;
/**
* The headers of the HTTP message.
*/
headers: Record<string, string>;
/**
* The body of the HTTP message.
* Can be: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream
*/
body?: any;
};
/**
* The service that encountered the exception.

@@ -254,7 +277,7 @@ */

};
$metadata?: {
readonly $metadata: {
/**
* The status code of the last HTTP response received for this operation.
*/
httpStatusCode?: number;
readonly httpStatusCode?: number;
/**

@@ -264,15 +287,15 @@ * A unique identifier for the last request sent for this operation. Often

*/
requestId?: string;
readonly requestId?: string;
/**
* A secondary identifier for the last request sent. Used for debugging.
*/
extendedRequestId?: string;
readonly extendedRequestId?: string;
/**
* A tertiary identifier for the last request sent. Used for debugging.
*/
cfId?: string;
readonly cfId?: string;
/**
* The number of times this operation was attempted.
*/
attempts?: number;
readonly attempts?: number;
/**

@@ -282,4 +305,4 @@ * The total amount of time (in milliseconds) that was spent waiting between

*/
totalRetryDelay?: number;
readonly totalRetryDelay?: number;
};
};

@@ -32,2 +32,3 @@ /// <reference types="node" resolution-mode="require"/>

abortController: AbortController;
private extendedAWSErrors;
constructor(options: ConsumerOptions);

@@ -34,0 +35,0 @@ /**

@@ -36,2 +36,3 @@ import { SQSClient, ChangeMessageVisibilityCommand, ChangeMessageVisibilityBatchCommand, DeleteMessageCommand, DeleteMessageBatchCommand, ReceiveMessageCommand, } from "@aws-sdk/client-sqs";

this.alwaysAcknowledge = options.alwaysAcknowledge ?? false;
this.extendedAWSErrors = options.extendedAWSErrors ?? false;
this.sqs =

@@ -215,3 +216,3 @@ options.sqs ||

catch (err) {
throw toSQSError(err, `SQS receive message failed: ${err.message}`);
throw toSQSError(err, `SQS receive message failed: ${err.message}`, this.extendedAWSErrors);
}

@@ -328,3 +329,3 @@ }

catch (err) {
this.emit("error", toSQSError(err, `Error changing visibility timeout: ${err.message}`), message);
this.emit("error", toSQSError(err, `Error changing visibility timeout: ${err.message}`, this.extendedAWSErrors), message);
}

@@ -350,3 +351,3 @@ }

catch (err) {
this.emit("error", toSQSError(err, `Error changing visibility timeout: ${err.message}`), messages);
this.emit("error", toSQSError(err, `Error changing visibility timeout: ${err.message}`, this.extendedAWSErrors), messages);
}

@@ -430,3 +431,3 @@ }

catch (err) {
throw toSQSError(err, `SQS delete message failed: ${err.message}`);
throw toSQSError(err, `SQS delete message failed: ${err.message}`, this.extendedAWSErrors);
}

@@ -459,5 +460,5 @@ }

catch (err) {
throw toSQSError(err, `SQS delete message failed: ${err.message}`);
throw toSQSError(err, `SQS delete message failed: ${err.message}`, this.extendedAWSErrors);
}
}
}

@@ -8,3 +8,5 @@ import { AWSError } from "./types.js";

retryable: boolean;
fault: "client" | "server";
fault: AWSError["$fault"];
response?: AWSError["$response"];
metadata?: AWSError["$metadata"];
constructor(message: string);

@@ -32,3 +34,3 @@ }

*/
declare function toSQSError(err: AWSError, message: string): SQSError;
declare function toSQSError(err: AWSError, message: string, extendedAWSErrors: boolean): SQSError;
/**

@@ -35,0 +37,0 @@ * Formats an Error to the StandardError type.

@@ -50,3 +50,3 @@ class SQSError extends Error {

*/
function toSQSError(err, message) {
function toSQSError(err, message, extendedAWSErrors) {
const sqsError = new SQSError(message);

@@ -59,2 +59,6 @@ sqsError.code = err.name;

sqsError.time = new Date();
if (extendedAWSErrors) {
sqsError.response = err.$response;
sqsError.metadata = err.$metadata;
}
return sqsError;

@@ -61,0 +65,0 @@ }

@@ -142,2 +142,7 @@ import { SQSClient, Message, QueueAttributeName } from "@aws-sdk/client-sqs";

postReceiveMessageCallback?(): Promise<void>;
/**
* Set this to `true` if you want to receive additional information about the error
* that occurred from AWS, such as the response and metadata.
*/
extendedAWSErrors?: boolean;
}

@@ -226,3 +231,3 @@ /**

*/
name: string;
readonly name: string;
/**

@@ -239,4 +244,22 @@ * Human-readable error response message

*/
readonly $fault?: "client" | "server";
readonly $fault: "client" | "server";
/**
* Represents an HTTP message as received in reply to a request
*/
readonly $response?: {
/**
* The status code of the HTTP response.
*/
statusCode?: number;
/**
* The headers of the HTTP message.
*/
headers: Record<string, string>;
/**
* The body of the HTTP message.
* Can be: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream
*/
body?: any;
};
/**
* The service that encountered the exception.

@@ -254,7 +277,7 @@ */

};
$metadata?: {
readonly $metadata: {
/**
* The status code of the last HTTP response received for this operation.
*/
httpStatusCode?: number;
readonly httpStatusCode?: number;
/**

@@ -264,15 +287,15 @@ * A unique identifier for the last request sent for this operation. Often

*/
requestId?: string;
readonly requestId?: string;
/**
* A secondary identifier for the last request sent. Used for debugging.
*/
extendedRequestId?: string;
readonly extendedRequestId?: string;
/**
* A tertiary identifier for the last request sent. Used for debugging.
*/
cfId?: string;
readonly cfId?: string;
/**
* The number of times this operation was attempted.
*/
attempts?: number;
readonly attempts?: number;
/**

@@ -282,4 +305,4 @@ * The total amount of time (in milliseconds) that was spent waiting between

*/
totalRetryDelay?: number;
readonly totalRetryDelay?: number;
};
};
{
"name": "sqs-consumer",
"version": "10.2.1",
"version": "10.3.0",
"description": "Build SQS-based Node applications without the boilerplate",

@@ -30,3 +30,3 @@ "type": "module",

"prepublishOnly": "npm run build",
"test:unit": "mocha --recursive --full-trace --exit",
"test:unit": "mocha --recursive --full-trace --exit --reporter json > test/reports/test-results.json",
"pretest:integration:init": "npm run build",

@@ -33,0 +33,0 @@ "test:integration:init": "sh ./test/scripts/initIntTests.sh",

@@ -61,2 +61,3 @@ import {

public abortController: AbortController;
private extendedAWSErrors: boolean;

@@ -86,2 +87,3 @@ constructor(options: ConsumerOptions) {

this.alwaysAcknowledge = options.alwaysAcknowledge ?? false;
this.extendedAWSErrors = options.extendedAWSErrors ?? false;
this.sqs =

@@ -302,3 +304,7 @@ options.sqs ||

} catch (err) {
throw toSQSError(err, `SQS receive message failed: ${err.message}`);
throw toSQSError(
err,
`SQS receive message failed: ${err.message}`,
this.extendedAWSErrors,
);
}

@@ -445,3 +451,7 @@ }

"error",
toSQSError(err, `Error changing visibility timeout: ${err.message}`),
toSQSError(
err,
`Error changing visibility timeout: ${err.message}`,
this.extendedAWSErrors,
),
message,

@@ -477,3 +487,7 @@ );

"error",
toSQSError(err, `Error changing visibility timeout: ${err.message}`),
toSQSError(
err,
`Error changing visibility timeout: ${err.message}`,
this.extendedAWSErrors,
),
messages,

@@ -575,3 +589,7 @@ );

} catch (err) {
throw toSQSError(err, `SQS delete message failed: ${err.message}`);
throw toSQSError(
err,
`SQS delete message failed: ${err.message}`,
this.extendedAWSErrors,
);
}

@@ -610,5 +628,9 @@ }

} catch (err) {
throw toSQSError(err, `SQS delete message failed: ${err.message}`);
throw toSQSError(
err,
`SQS delete message failed: ${err.message}`,
this.extendedAWSErrors,
);
}
}
}

@@ -9,3 +9,5 @@ import { AWSError } from "./types.js";

retryable: boolean;
fault: "client" | "server";
fault: AWSError["$fault"];
response?: AWSError["$response"];
metadata?: AWSError["$metadata"];

@@ -71,3 +73,7 @@ constructor(message: string) {

*/
function toSQSError(err: AWSError, message: string): SQSError {
function toSQSError(
err: AWSError,
message: string,
extendedAWSErrors: boolean,
): SQSError {
const sqsError = new SQSError(message);

@@ -81,2 +87,7 @@ sqsError.code = err.name;

if (extendedAWSErrors) {
sqsError.response = err.$response;
sqsError.metadata = err.$metadata;
}
return sqsError;

@@ -83,0 +94,0 @@ }

@@ -143,2 +143,7 @@ import { SQSClient, Message, QueueAttributeName } from "@aws-sdk/client-sqs";

postReceiveMessageCallback?(): Promise<void>;
/**
* Set this to `true` if you want to receive additional information about the error
* that occurred from AWS, such as the response and metadata.
*/
extendedAWSErrors?: boolean;
}

@@ -235,3 +240,3 @@

*/
name: string;
readonly name: string;

@@ -251,5 +256,24 @@ /**

*/
readonly $fault?: "client" | "server";
readonly $fault: "client" | "server";
/**
* Represents an HTTP message as received in reply to a request
*/
readonly $response?: {
/**
* The status code of the HTTP response.
*/
statusCode?: number;
/**
* The headers of the HTTP message.
*/
headers: Record<string, string>;
/**
* The body of the HTTP message.
* Can be: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream
*/
body?: any;
};
/**
* The service that encountered the exception.

@@ -269,7 +293,7 @@ */

$metadata?: {
readonly $metadata: {
/**
* The status code of the last HTTP response received for this operation.
*/
httpStatusCode?: number;
readonly httpStatusCode?: number;

@@ -280,3 +304,3 @@ /**

*/
requestId?: string;
readonly requestId?: string;

@@ -286,3 +310,3 @@ /**

*/
extendedRequestId?: string;
readonly extendedRequestId?: string;

@@ -292,3 +316,3 @@ /**

*/
cfId?: string;
readonly cfId?: string;

@@ -298,3 +322,3 @@ /**

*/
attempts?: number;
readonly attempts?: number;

@@ -305,4 +329,4 @@ /**

*/
totalRetryDelay?: number;
readonly totalRetryDelay?: number;
};
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc