@message-queue-toolkit/sqs 1.1.0 → 2.0.0
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/index.d.ts +4 -4
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/sqs/AbstractSqsConsumer.d.ts +11 -4
- package/dist/lib/sqs/AbstractSqsConsumer.js +1 -1
- package/dist/lib/sqs/AbstractSqsConsumer.js.map +1 -1
- package/dist/lib/sqs/AbstractSqsService.d.ts +8 -3
- package/dist/lib/sqs/AbstractSqsService.js +19 -4
- package/dist/lib/sqs/AbstractSqsService.js.map +1 -1
- package/dist/lib/utils/SqsUtils.d.ts +7 -0
- package/dist/lib/utils/SqsUtils.js +25 -1
- package/dist/lib/utils/SqsUtils.js.map +1 -1
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type { SQSQueueAWSConfig, SQSQueueConfig, SQSConsumerDependencies, } from './lib/sqs/AbstractSqsService';
|
|
2
|
-
export { AbstractSqsConsumer } from './lib/sqs/AbstractSqsConsumer';
|
|
3
|
-
export type {
|
|
1
|
+
export type { SQSQueueAWSConfig, SQSQueueConfig, SQSConsumerDependencies, SQSQueueLocatorType, } from './lib/sqs/AbstractSqsService';
|
|
2
|
+
export { AbstractSqsConsumer, SQSCreationConfig } from './lib/sqs/AbstractSqsConsumer';
|
|
3
|
+
export type { NewSQSConsumerOptions, ExistingSQSConsumerOptions, } from './lib/sqs/AbstractSqsConsumer';
|
|
4
4
|
export { SqsConsumerErrorResolver } from './lib/errors/SqsConsumerErrorResolver';
|
|
5
5
|
export { AbstractSqsPublisher } from './lib/sqs/AbstractSqsPublisher';
|
|
6
6
|
export type { SQSMessageOptions } from './lib/sqs/AbstractSqsPublisher';
|
|
7
|
-
export { assertQueue, deleteQueue, purgeQueue } from './lib/utils/SqsUtils';
|
|
7
|
+
export { assertQueue, deleteQueue, purgeQueue, getQueueAttributes } from './lib/utils/SqsUtils';
|
|
8
8
|
export { deserializeSQSMessage } from './lib/sqs/sqsMessageDeserializer';
|
|
9
9
|
export type { CommonMessage, SQSMessage } from './lib/types/MessageTypes';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeSQSMessage = exports.purgeQueue = exports.deleteQueue = exports.assertQueue = exports.AbstractSqsPublisher = exports.SqsConsumerErrorResolver = exports.AbstractSqsConsumer = void 0;
|
|
3
|
+
exports.deserializeSQSMessage = exports.getQueueAttributes = exports.purgeQueue = exports.deleteQueue = exports.assertQueue = exports.AbstractSqsPublisher = exports.SqsConsumerErrorResolver = exports.AbstractSqsConsumer = void 0;
|
|
4
4
|
var AbstractSqsConsumer_1 = require("./lib/sqs/AbstractSqsConsumer");
|
|
5
5
|
Object.defineProperty(exports, "AbstractSqsConsumer", { enumerable: true, get: function () { return AbstractSqsConsumer_1.AbstractSqsConsumer; } });
|
|
6
6
|
var SqsConsumerErrorResolver_1 = require("./lib/errors/SqsConsumerErrorResolver");
|
|
@@ -11,6 +11,7 @@ var SqsUtils_1 = require("./lib/utils/SqsUtils");
|
|
|
11
11
|
Object.defineProperty(exports, "assertQueue", { enumerable: true, get: function () { return SqsUtils_1.assertQueue; } });
|
|
12
12
|
Object.defineProperty(exports, "deleteQueue", { enumerable: true, get: function () { return SqsUtils_1.deleteQueue; } });
|
|
13
13
|
Object.defineProperty(exports, "purgeQueue", { enumerable: true, get: function () { return SqsUtils_1.purgeQueue; } });
|
|
14
|
+
Object.defineProperty(exports, "getQueueAttributes", { enumerable: true, get: function () { return SqsUtils_1.getQueueAttributes; } });
|
|
14
15
|
var sqsMessageDeserializer_1 = require("./lib/sqs/sqsMessageDeserializer");
|
|
15
16
|
Object.defineProperty(exports, "deserializeSQSMessage", { enumerable: true, get: function () { return sqsMessageDeserializer_1.deserializeSQSMessage; } });
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAOA,qEAAsF;AAA7E,0HAAA,mBAAmB,OAAA;AAK5B,kFAAgF;AAAvE,oIAAA,wBAAwB,OAAA;AAEjC,uEAAqE;AAA5D,4HAAA,oBAAoB,OAAA;AAG7B,iDAA+F;AAAtF,uGAAA,WAAW,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AACjE,2EAAwE;AAA/D,+HAAA,qBAAqB,OAAA"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { Either, ErrorResolver } from '@lokalise/node-core';
|
|
2
|
-
import type { QueueConsumer as QueueConsumer,
|
|
2
|
+
import type { QueueConsumer as QueueConsumer, NewQueueOptions, ExistingQueueOptions, Deserializer } from '@message-queue-toolkit/core';
|
|
3
3
|
import { Consumer } from 'sqs-consumer';
|
|
4
4
|
import type { ConsumerOptions } from 'sqs-consumer/src/types';
|
|
5
5
|
import type { SQSMessage } from '../types/MessageTypes';
|
|
6
|
-
import type { SQSConsumerDependencies, SQSQueueAWSConfig } from './AbstractSqsService';
|
|
6
|
+
import type { SQSConsumerDependencies, SQSQueueAWSConfig, SQSQueueLocatorType } from './AbstractSqsService';
|
|
7
7
|
import { AbstractSqsService } from './AbstractSqsService';
|
|
8
|
-
export type
|
|
8
|
+
export type SQSCreationConfig = {
|
|
9
|
+
queue: SQSQueueAWSConfig;
|
|
10
|
+
};
|
|
11
|
+
export type NewSQSConsumerOptions<MessagePayloadType extends object, CreationConfigType extends SQSCreationConfig> = NewQueueOptions<MessagePayloadType, CreationConfigType> & {
|
|
12
|
+
consumerOverrides?: Partial<ConsumerOptions>;
|
|
13
|
+
deserializer?: Deserializer<MessagePayloadType, SQSMessage>;
|
|
14
|
+
};
|
|
15
|
+
export type ExistingSQSConsumerOptions<MessagePayloadType extends object, QueueLocatorType extends SQSQueueLocatorType = SQSQueueLocatorType> = ExistingQueueOptions<MessagePayloadType, QueueLocatorType> & {
|
|
9
16
|
consumerOverrides?: Partial<ConsumerOptions>;
|
|
10
17
|
deserializer?: Deserializer<MessagePayloadType, SQSMessage>;
|
|
11
18
|
};
|
|
12
|
-
export declare abstract class AbstractSqsConsumer<MessagePayloadType extends object, ConsumerOptionsType extends
|
|
19
|
+
export declare abstract class AbstractSqsConsumer<MessagePayloadType extends object, QueueLocatorType extends SQSQueueLocatorType = SQSQueueLocatorType, CreationConfigType extends SQSCreationConfig = SQSCreationConfig, ConsumerOptionsType extends NewSQSConsumerOptions<MessagePayloadType, CreationConfigType> | ExistingSQSConsumerOptions<MessagePayloadType, QueueLocatorType> = NewSQSConsumerOptions<MessagePayloadType, CreationConfigType> | ExistingSQSConsumerOptions<MessagePayloadType, QueueLocatorType>> extends AbstractSqsService<MessagePayloadType, QueueLocatorType, CreationConfigType, ConsumerOptionsType, SQSConsumerDependencies> implements QueueConsumer {
|
|
13
20
|
private readonly transactionObservabilityManager?;
|
|
14
21
|
protected readonly errorResolver: ErrorResolver;
|
|
15
22
|
protected consumer: Consumer;
|
|
@@ -39,7 +39,7 @@ class AbstractSqsConsumer extends AbstractSqsService_1.AbstractSqsService {
|
|
|
39
39
|
result: deserializationResult.result,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
async failProcessing(
|
|
42
|
+
async failProcessing(_message) {
|
|
43
43
|
// Not implemented yet - needs dead letter queue
|
|
44
44
|
}
|
|
45
45
|
async start() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSqsConsumer.js","sourceRoot":"","sources":["../../../lib/sqs/AbstractSqsConsumer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Ab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AAiB,CAAC,CAAA;gBAC/D,CAAC,CAAC,CAAA;gBAEJ,IAAI,MAAM,CAAC,MAAM,EAAE;oBACjB,OAAO,OAAO,CAAA;iBACf;qBAAM;oBACL,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;iBAC9B;YACH,CAAC;YACD,GAAG,EAAE,IAAI,CAAC,SAAS;YACnB,GAAG,IAAI,CAAC,uBAAuB;SAChC,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAChC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;IAEe,KAAK,CAAC,KAAK,CAAC,KAAe;QACzC,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;QACnB,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;YAClB,KAAK,EAAE,KAAK,IAAI,KAAK;SACtB,CAAC,CAAA;IACJ,CAAC;CACF;AAlID,kDAkIC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { SQSClient } from '@aws-sdk/client-sqs';
|
|
2
2
|
import type { CreateQueueRequest } from '@aws-sdk/client-sqs/dist-types/models/models_0';
|
|
3
|
-
import type { QueueConsumerDependencies, QueueDependencies,
|
|
3
|
+
import type { QueueConsumerDependencies, QueueDependencies, NewQueueOptions, ExistingQueueOptions } from '@message-queue-toolkit/core';
|
|
4
4
|
import { AbstractQueueService } from '@message-queue-toolkit/core';
|
|
5
|
+
import type { SQSCreationConfig } from './AbstractSqsConsumer';
|
|
5
6
|
export type SQSDependencies = QueueDependencies & {
|
|
6
7
|
sqsClient: SQSClient;
|
|
7
8
|
};
|
|
8
9
|
export type SQSConsumerDependencies = SQSDependencies & QueueConsumerDependencies;
|
|
9
|
-
export type SQSQueueAWSConfig =
|
|
10
|
+
export type SQSQueueAWSConfig = CreateQueueRequest;
|
|
10
11
|
export type SQSQueueConfig = {
|
|
11
12
|
tags?: Record<string, string>;
|
|
12
13
|
Attributes?: {
|
|
@@ -20,9 +21,13 @@ export type SQSQueueConfig = {
|
|
|
20
21
|
RedriveAllowPolicy?: string;
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
|
-
export
|
|
24
|
+
export type SQSQueueLocatorType = {
|
|
25
|
+
queueUrl: string;
|
|
26
|
+
};
|
|
27
|
+
export declare class AbstractSqsService<MessagePayloadType extends object, QueueLocatorType extends SQSQueueLocatorType = SQSQueueLocatorType, CreationConfigType extends SQSCreationConfig = SQSCreationConfig, SQSOptionsType extends NewQueueOptions<MessagePayloadType, CreationConfigType> | ExistingQueueOptions<MessagePayloadType, QueueLocatorType> = NewQueueOptions<MessagePayloadType, CreationConfigType> | ExistingQueueOptions<MessagePayloadType, QueueLocatorType>, DependenciesType extends SQSDependencies = SQSDependencies> extends AbstractQueueService<MessagePayloadType, DependenciesType, CreationConfigType, QueueLocatorType, SQSOptionsType> {
|
|
24
28
|
protected readonly sqsClient: SQSClient;
|
|
25
29
|
queueUrl: string;
|
|
30
|
+
queueName: string;
|
|
26
31
|
constructor(dependencies: DependenciesType, options: SQSOptionsType);
|
|
27
32
|
init(): Promise<void>;
|
|
28
33
|
close(): Promise<void>;
|
|
@@ -7,15 +7,30 @@ class AbstractSqsService extends core_1.AbstractQueueService {
|
|
|
7
7
|
sqsClient;
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
queueUrl;
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
queueName;
|
|
10
12
|
constructor(dependencies, options) {
|
|
11
13
|
super(dependencies, options);
|
|
12
14
|
this.sqsClient = dependencies.sqsClient;
|
|
13
15
|
}
|
|
14
16
|
async init() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// reuse existing queue only
|
|
18
|
+
if (this.locatorConfig) {
|
|
19
|
+
const checkResult = await (0, SqsUtils_1.getQueueAttributes)(this.sqsClient, this.locatorConfig);
|
|
20
|
+
if (checkResult.error === 'not_found') {
|
|
21
|
+
throw new Error(`Queue with queueUrl ${this.locatorConfig.queueUrl} does not exist.`);
|
|
22
|
+
}
|
|
23
|
+
this.queueUrl = this.locatorConfig.queueUrl;
|
|
24
|
+
const splitUrl = this.queueUrl.split('/');
|
|
25
|
+
this.queueName = splitUrl[splitUrl.length - 1];
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// create new queue if does not exist
|
|
29
|
+
if (!this.creationConfig?.queue.QueueName) {
|
|
30
|
+
throw new Error('queueConfig.QueueName is mandatory when locator is not provided');
|
|
31
|
+
}
|
|
32
|
+
this.queueUrl = await (0, SqsUtils_1.assertQueue)(this.sqsClient, this.creationConfig.queue);
|
|
33
|
+
this.queueName = this.creationConfig.queue.QueueName;
|
|
19
34
|
}
|
|
20
35
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
21
36
|
async close() { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSqsService.js","sourceRoot":"","sources":["../../../lib/sqs/AbstractSqsService.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AbstractSqsService.js","sourceRoot":"","sources":["../../../lib/sqs/AbstractSqsService.ts"],"names":[],"mappings":";;;AAQA,sDAAkE;AAElE,gDAAmE;AA8BnE,MAAa,kBAUX,SAAQ,2BAMT;IACoB,SAAS,CAAW;IACvC,aAAa;IACN,QAAQ,CAAQ;IACvB,aAAa;IACN,SAAS,CAAQ;IAExB,YAAY,YAA8B,EAAE,OAAuB;QACjE,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAE5B,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAA;IACzC,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,4BAA4B;QAC5B,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAkB,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;YAChF,IAAI,WAAW,CAAC,KAAK,KAAK,WAAW,EAAE;gBACrC,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,aAAa,CAAC,QAAQ,kBAAkB,CAAC,CAAA;aACtF;YAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAA;YAE3C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACzC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;YAC9C,OAAM;SACP;QAED,qCAAqC;QACrC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAA;SACnF;QAED,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAA,sBAAW,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;QAC5E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAA;IACtD,CAAC;IAED,4DAA4D;IAC5C,KAAK,CAAC,KAAK,KAAmB,CAAC;CAChD;AAvDD,gDAuDC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { CreateQueueCommandInput, SQSClient } from '@aws-sdk/client-sqs';
|
|
2
|
+
import type { Either } from '@lokalise/node-core';
|
|
3
|
+
import type { SQSQueueLocatorType } from '../sqs/AbstractSqsService';
|
|
4
|
+
type QueueAttributesResult = {
|
|
5
|
+
attributes?: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
export declare function getQueueAttributes(sqsClient: SQSClient, queueLocator: SQSQueueLocatorType): Promise<Either<'not_found', QueueAttributesResult>>;
|
|
2
8
|
export declare function assertQueue(sqsClient: SQSClient, queueConfig: CreateQueueCommandInput): Promise<string>;
|
|
3
9
|
export declare function purgeQueue(client: SQSClient, queueName: string): Promise<void>;
|
|
4
10
|
export declare function deleteQueue(client: SQSClient, queueName: string): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteQueue = exports.purgeQueue = exports.assertQueue = void 0;
|
|
3
|
+
exports.deleteQueue = exports.purgeQueue = exports.assertQueue = exports.getQueueAttributes = void 0;
|
|
4
4
|
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
5
|
+
async function getQueueAttributes(sqsClient, queueLocator) {
|
|
6
|
+
const command = new client_sqs_1.GetQueueAttributesCommand({
|
|
7
|
+
QueueUrl: queueLocator.queueUrl,
|
|
8
|
+
});
|
|
9
|
+
try {
|
|
10
|
+
const response = await sqsClient.send(command);
|
|
11
|
+
return {
|
|
12
|
+
result: {
|
|
13
|
+
attributes: response.Attributes,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
if (err.Code === 'AWS.SimpleQueueService.NonExistentQueue') {
|
|
20
|
+
return {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
error: 'not_found',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.getQueueAttributes = getQueueAttributes;
|
|
5
29
|
async function assertQueue(sqsClient, queueConfig) {
|
|
6
30
|
const command = new client_sqs_1.CreateQueueCommand(queueConfig);
|
|
7
31
|
await sqsClient.send(command);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqsUtils.js","sourceRoot":"","sources":["../../../lib/utils/SqsUtils.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":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,MAAM,eAAe,GAAG,IAAI,+BAAkB,CAAC;YAC7C,SAAS,EAAE,SAAS;SACrB,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAEnD,MAAM,YAAY,GAAG,IAAI,8BAAiB,CAAC;YACzC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;SAC5B,CAAC,CAAA;QACF,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;KAChC;IAAC,OAAO,GAAG,EAAE;QACZ,aAAa;QACb,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;KAC/C;AACH,CAAC;AAfD,gCAeC;AAEM,KAAK,UAAU,WAAW,CAAC,MAAiB,EAAE,SAAiB;IACpE,IAAI;QACF,MAAM,eAAe,GAAG,IAAI,+BAAkB,CAAC;YAC7C,SAAS,EAAE,SAAS;SACrB,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAEnD,MAAM,OAAO,GAAG,IAAI,+BAAkB,CAAC;YACrC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;SAC5B,CAAC,CAAA;QAEF,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;KAC3B;IAAC,OAAO,GAAG,EAAE;QACZ,aAAa;QACb,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;KAChD;AACH,CAAC;AAhBD,kCAgBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@message-queue-toolkit/sqs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "SQS adapter for message-queue-toolkit",
|
|
@@ -26,31 +26,31 @@
|
|
|
26
26
|
"prepublishOnly": "npm run build:release"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
31
|
-
"sqs-consumer": "^7.2.0",
|
|
29
|
+
"@lokalise/node-core": "^5.12.0",
|
|
30
|
+
"sqs-consumer": "^7.2.2",
|
|
32
31
|
"zod": "^3.21.4"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
|
-
"@
|
|
34
|
+
"@aws-sdk/client-sqs": "^3.369.0",
|
|
35
|
+
"@message-queue-toolkit/core": "^1.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@message-queue-toolkit/core": "*",
|
|
39
|
-
"@types/node": "^20.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
41
|
-
"@typescript-eslint/parser": "^5.
|
|
42
|
-
"@vitest/coverage-v8": "^0.
|
|
39
|
+
"@types/node": "^20.4.1",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
42
|
+
"@vitest/coverage-v8": "^0.33.0",
|
|
43
43
|
"awilix": "^8.0.1",
|
|
44
44
|
"awilix-manager": "^2.0.0",
|
|
45
45
|
"del-cli": "^5.0.0",
|
|
46
|
-
"eslint": "^8.
|
|
46
|
+
"eslint": "^8.44.0",
|
|
47
47
|
"eslint-config-prettier": "^8.8.0",
|
|
48
48
|
"eslint-plugin-import": "^2.27.5",
|
|
49
|
-
"eslint-plugin-prettier": "^
|
|
49
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
50
50
|
"eslint-plugin-vitest": "^0.2.6",
|
|
51
|
-
"prettier": "^
|
|
52
|
-
"typescript": "^5.1.
|
|
53
|
-
"vitest": "^0.
|
|
51
|
+
"prettier": "^3.0.0",
|
|
52
|
+
"typescript": "^5.1.6",
|
|
53
|
+
"vitest": "^0.33.0"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/kibertoad/message-queue-toolkit",
|
|
56
56
|
"repository": {
|