@message-queue-toolkit/sns 17.1.1 → 17.3.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 +1 -1
- package/dist/lib/sns/AbstractSnsPublisher.d.ts +2 -2
- package/dist/lib/sns/AbstractSnsService.d.ts +7 -6
- package/dist/lib/sns/AbstractSnsService.js.map +1 -1
- package/dist/lib/sns/AbstractSnsSqsConsumer.d.ts +2 -2
- package/dist/lib/sns/AbstractSnsSqsConsumer.js +1 -1
- package/dist/lib/sns/AbstractSnsSqsConsumer.js.map +1 -1
- package/dist/lib/sns/SnsPublisherManager.d.ts +2 -2
- package/dist/lib/types/TopicTypes.d.ts +5 -0
- package/dist/lib/types/TopicTypes.js +12 -0
- package/dist/lib/types/TopicTypes.js.map +1 -0
- package/dist/lib/utils/snsAttributeUtils.d.ts +1 -1
- package/dist/lib/utils/snsAttributeUtils.js +29 -8
- package/dist/lib/utils/snsAttributeUtils.js.map +1 -1
- package/dist/lib/utils/snsInitter.d.ts +4 -4
- package/dist/lib/utils/snsInitter.js +47 -17
- package/dist/lib/utils/snsInitter.js.map +1 -1
- package/dist/lib/utils/snsSubscriber.d.ts +3 -2
- package/dist/lib/utils/snsSubscriber.js +21 -5
- package/dist/lib/utils/snsSubscriber.js.map +1 -1
- package/dist/lib/utils/snsUtils.d.ts +2 -1
- package/dist/lib/utils/snsUtils.js +24 -7
- package/dist/lib/utils/snsUtils.js.map +1 -1
- package/package.json +15 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { SNSTopicAWSConfig, SNSTopicConfig,
|
|
1
|
+
export type { SNSTopicAWSConfig, SNSTopicConfig, SNSTopicLocatorType, SNSCreationConfig, SNSDependencies, } from './lib/sns/AbstractSnsService';
|
|
2
2
|
export { SNS_MESSAGE_MAX_SIZE } from './lib/sns/AbstractSnsService';
|
|
3
3
|
export { AbstractSnsService } from './lib/sns/AbstractSnsService';
|
|
4
4
|
export { SnsConsumerErrorResolver } from './lib/errors/SnsConsumerErrorResolver';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Either } from '@lokalise/node-core';
|
|
2
2
|
import type { AsyncPublisher, BarrierResult, MessageInvalidFormatError, MessageValidationError, OffloadedPayloadPointerPayload, QueuePublisherOptions, ResolvedMessage } from '@message-queue-toolkit/core';
|
|
3
|
-
import type { SNSCreationConfig, SNSDependencies,
|
|
3
|
+
import type { SNSCreationConfig, SNSDependencies, SNSTopicLocatorType } from './AbstractSnsService';
|
|
4
4
|
import { AbstractSnsService } from './AbstractSnsService';
|
|
5
5
|
export type SNSMessageOptions = {
|
|
6
6
|
MessageGroupId?: string;
|
|
7
7
|
MessageDeduplicationId?: string;
|
|
8
8
|
};
|
|
9
|
-
export type SNSPublisherOptions<MessagePayloadType extends object> = QueuePublisherOptions<SNSCreationConfig,
|
|
9
|
+
export type SNSPublisherOptions<MessagePayloadType extends object> = QueuePublisherOptions<SNSCreationConfig, SNSTopicLocatorType, MessagePayloadType>;
|
|
10
10
|
export declare abstract class AbstractSnsPublisher<MessagePayloadType extends object> extends AbstractSnsService<MessagePayloadType, MessagePayloadType> implements AsyncPublisher<MessagePayloadType, SNSMessageOptions> {
|
|
11
11
|
private readonly messageSchemaContainer;
|
|
12
12
|
private initPromise?;
|
|
@@ -21,18 +21,19 @@ export type SNSTopicConfig = {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export type ExtraSNSCreationParams = {
|
|
24
|
-
queueUrlsWithSubscribePermissionsPrefix?: string;
|
|
24
|
+
queueUrlsWithSubscribePermissionsPrefix?: string | readonly string[];
|
|
25
25
|
allowedSourceOwner?: string;
|
|
26
26
|
};
|
|
27
27
|
export type SNSCreationConfig = {
|
|
28
|
-
topic
|
|
28
|
+
topic?: SNSTopicAWSConfig;
|
|
29
29
|
updateAttributesIfExists?: boolean;
|
|
30
30
|
} & ExtraSNSCreationParams;
|
|
31
|
-
export type
|
|
32
|
-
topicArn
|
|
31
|
+
export type SNSTopicLocatorType = {
|
|
32
|
+
topicArn?: string;
|
|
33
|
+
topicName?: string;
|
|
33
34
|
};
|
|
34
|
-
export type SNSOptions = QueueOptions<SNSCreationConfig,
|
|
35
|
-
export declare abstract class AbstractSnsService<MessagePayloadType extends object, MessageEnvelopeType extends object = SNS_MESSAGE_BODY_TYPE, SNSOptionsType extends SNSOptions = SNSOptions, DependenciesType extends SNSDependencies = SNSDependencies> extends AbstractQueueService<MessagePayloadType, MessageEnvelopeType, DependenciesType, SNSCreationConfig,
|
|
35
|
+
export type SNSOptions = QueueOptions<SNSCreationConfig, SNSTopicLocatorType>;
|
|
36
|
+
export declare abstract class AbstractSnsService<MessagePayloadType extends object, MessageEnvelopeType extends object = SNS_MESSAGE_BODY_TYPE, SNSOptionsType extends SNSOptions = SNSOptions, DependenciesType extends SNSDependencies = SNSDependencies> extends AbstractQueueService<MessagePayloadType, MessageEnvelopeType, DependenciesType, SNSCreationConfig, SNSTopicLocatorType, SNSOptionsType> {
|
|
36
37
|
protected readonly snsClient: SNSClient;
|
|
37
38
|
protected topicArn: string;
|
|
38
39
|
constructor(dependencies: DependenciesType, options: SNSOptionsType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSnsService.js","sourceRoot":"","sources":["../../../lib/sns/AbstractSnsService.ts"],"names":[],"mappings":";;;AAEA,sDAAkE;AAGlE,oDAAwD;AAExD,yDAAyD;AAC5C,QAAA,oBAAoB,GAAG,GAAG,GAAG,IAAI,CAAA,CAAC,QAAQ;
|
|
1
|
+
{"version":3,"file":"AbstractSnsService.js","sourceRoot":"","sources":["../../../lib/sns/AbstractSnsService.ts"],"names":[],"mappings":";;;AAEA,sDAAkE;AAGlE,oDAAwD;AAExD,yDAAyD;AAC5C,QAAA,oBAAoB,GAAG,GAAG,GAAG,IAAI,CAAA,CAAC,QAAQ;AAuCvD,MAAsB,kBAKpB,SAAQ,2BAOT;IACoB,SAAS,CAAW;IACvC,aAAa;IACH,QAAQ,CAAQ;IAE1B,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,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/C,MAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QAC3E,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAA,oBAAO,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;QACzF,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAA;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;IACvB,CAAC;IAEe,KAAK;QACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF;AArCD,gDAqCC"}
|
|
@@ -2,12 +2,12 @@ import type { SNSClient } from '@aws-sdk/client-sns';
|
|
|
2
2
|
import type { SQSConsumerDependencies, SQSConsumerOptions, SQSCreationConfig, SQSMessage, SQSQueueLocatorType } from '@message-queue-toolkit/sqs';
|
|
3
3
|
import { AbstractSqsConsumer } from '@message-queue-toolkit/sqs';
|
|
4
4
|
import type { SNSSubscriptionOptions } from '../utils/snsSubscriber';
|
|
5
|
-
import type { SNSCreationConfig, SNSOptions,
|
|
5
|
+
import type { SNSCreationConfig, SNSOptions, SNSTopicLocatorType } from './AbstractSnsService';
|
|
6
6
|
export type SNSSQSConsumerDependencies = SQSConsumerDependencies & {
|
|
7
7
|
snsClient: SNSClient;
|
|
8
8
|
};
|
|
9
9
|
export type SNSSQSCreationConfig = SQSCreationConfig & SNSCreationConfig;
|
|
10
|
-
export type SNSSQSQueueLocatorType = SQSQueueLocatorType &
|
|
10
|
+
export type SNSSQSQueueLocatorType = Partial<SQSQueueLocatorType> & SNSTopicLocatorType & {
|
|
11
11
|
subscriptionArn?: string;
|
|
12
12
|
};
|
|
13
13
|
export type SNSSQSConsumerOptions<MessagePayloadType extends object, ExecutionContext, PrehandlerOutput> = SQSConsumerOptions<MessagePayloadType, ExecutionContext, PrehandlerOutput, SNSSQSCreationConfig, SNSSQSQueueLocatorType> & SNSOptions & {
|
|
@@ -20,7 +20,7 @@ class AbstractSnsSqsConsumer extends sqs_1.AbstractSqsConsumer {
|
|
|
20
20
|
}
|
|
21
21
|
async init() {
|
|
22
22
|
if (this.deletionConfig && this.creationConfig && this.subscriptionConfig) {
|
|
23
|
-
await (0, snsInitter_1.deleteSnsSqs)(this.sqsClient, this.snsClient, this.deletionConfig, this.creationConfig.queue, this.creationConfig.topic, this.subscriptionConfig);
|
|
23
|
+
await (0, snsInitter_1.deleteSnsSqs)(this.sqsClient, this.snsClient, this.deletionConfig, this.creationConfig.queue, this.creationConfig.topic, this.subscriptionConfig, undefined, this.locatorConfig);
|
|
24
24
|
}
|
|
25
25
|
else if (this.deletionConfig && this.creationConfig) {
|
|
26
26
|
await (0, sqs_1.deleteSqs)(this.sqsClient, this.deletionConfig, this.creationConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSnsSqsConsumer.js","sourceRoot":"","sources":["../../../lib/sns/AbstractSnsSqsConsumer.ts"],"names":[],"mappings":";;;AAQA,oDAA2E;AAE3E,oDAA8D;AAC9D,gEAA0D;AA8B1D,MAAsB,sBAIpB,SAAQ,yBAOT;IACkB,kBAAkB,CAAyB;IAC3C,SAAS,CAAW;IAErC,aAAa;IACH,QAAQ,CAAQ;IAC1B,aAAa;IACH,eAAe,CAAQ;IAEjC,YACE,YAAwC,EACxC,OAAyF,EACzF,gBAAkC;QAElC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,CAAC,cAAc,CAAC,CAAA;IACnE,CAAC;CACF;AAlFD,wDAkFC"}
|
|
@@ -4,7 +4,7 @@ import type { PublisherMessageMetadataType } from '@message-queue-toolkit/core/l
|
|
|
4
4
|
import type { SnsAwareEventDefinition } from '@message-queue-toolkit/schemas';
|
|
5
5
|
import type z from 'zod';
|
|
6
6
|
import type { AbstractSnsPublisher, SNSMessageOptions, SNSPublisherOptions } from './AbstractSnsPublisher';
|
|
7
|
-
import type { SNSCreationConfig, SNSDependencies,
|
|
7
|
+
import type { SNSCreationConfig, SNSDependencies, SNSTopicLocatorType } from './AbstractSnsService';
|
|
8
8
|
import type { SnsPublisherFactory } from './CommonSnsPublisherFactory';
|
|
9
9
|
export type { SnsAwareEventDefinition };
|
|
10
10
|
export type SnsPublisherManagerDependencies<SupportedEvents extends SnsAwareEventDefinition[]> = {
|
|
@@ -19,7 +19,7 @@ export type SnsPublisherManagerOptions<T extends AbstractSnsPublisher<EventType>
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
export type SnsMessageSchemaType<T extends SnsAwareEventDefinition> = z.infer<T['publisherSchema']>;
|
|
22
|
-
export declare class SnsPublisherManager<T extends AbstractSnsPublisher<z.infer<SupportedEventDefinitions[number]['publisherSchema']>>, SupportedEventDefinitions extends SnsAwareEventDefinition[], MetadataType = PublisherMessageMetadataType> extends AbstractPublisherManager<SnsAwareEventDefinition, NonNullable<SupportedEventDefinitions[number]['snsTopic']>, AbstractSnsPublisher<z.infer<SupportedEventDefinitions[number]['publisherSchema']>>, SNSDependencies, SNSCreationConfig,
|
|
22
|
+
export declare class SnsPublisherManager<T extends AbstractSnsPublisher<z.infer<SupportedEventDefinitions[number]['publisherSchema']>>, SupportedEventDefinitions extends SnsAwareEventDefinition[], MetadataType = PublisherMessageMetadataType> extends AbstractPublisherManager<SnsAwareEventDefinition, NonNullable<SupportedEventDefinitions[number]['snsTopic']>, AbstractSnsPublisher<z.infer<SupportedEventDefinitions[number]['publisherSchema']>>, SNSDependencies, SNSCreationConfig, SNSTopicLocatorType, SnsMessageSchemaType<SnsAwareEventDefinition>, Omit<SNSPublisherOptions<z.infer<SupportedEventDefinitions[number]['publisherSchema']>>, 'messageSchemas' | 'creationConfig' | 'locatorConfig'>, SupportedEventDefinitions, MetadataType, SNSMessageOptions> {
|
|
23
23
|
constructor(dependencies: SnsPublisherManagerDependencies<SupportedEventDefinitions>, options: SnsPublisherManagerOptions<T, z.infer<SupportedEventDefinitions[number]['publisherSchema']>, MetadataType>);
|
|
24
24
|
publish(topic: NonNullable<SupportedEventDefinitions[number]['snsTopic']>, message: MessagePublishType<SupportedEventDefinitions[number]>, precedingEventMetadata?: Partial<MetadataType>, messageOptions?: SNSMessageOptions): Promise<MessageSchemaType<SupportedEventDefinitions[number]>>;
|
|
25
25
|
protected resolveCreationConfig(eventTarget: NonNullable<SupportedEventDefinitions[number]['snsTopic']>): SNSCreationConfig;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CreateTopicCommandInput } from '@aws-sdk/client-sns';
|
|
2
|
+
import type { SNSTopicLocatorType } from '../sns/AbstractSnsService';
|
|
3
|
+
export type TopicResolutionOptions = CreateTopicCommandInput | SNSTopicLocatorType;
|
|
4
|
+
export declare function isCreateTopicCommand(value: unknown): value is CreateTopicCommandInput;
|
|
5
|
+
export declare function isSNSTopicLocatorType(value: unknown): value is SNSTopicLocatorType;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCreateTopicCommand = isCreateTopicCommand;
|
|
4
|
+
exports.isSNSTopicLocatorType = isSNSTopicLocatorType;
|
|
5
|
+
function isCreateTopicCommand(value) {
|
|
6
|
+
return !!value && !!value.Name;
|
|
7
|
+
}
|
|
8
|
+
function isSNSTopicLocatorType(value) {
|
|
9
|
+
return (!!value &&
|
|
10
|
+
(!!value.topicArn || !!value.topicName));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=TopicTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopicTypes.js","sourceRoot":"","sources":["../../../lib/types/TopicTypes.ts"],"names":[],"mappings":";;AAKA,oDAEC;AAED,sDAKC;AATD,SAAgB,oBAAoB,CAAC,KAAc;IACjD,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,CAAE,KAAiC,CAAC,IAAI,CAAA;AAC7D,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAc;IAClD,OAAO,CACL,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,CAAE,KAA6B,CAAC,QAAQ,IAAI,CAAC,CAAE,KAA6B,CAAC,SAAS,CAAC,CAC1F,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ZodSchema } from 'zod';
|
|
2
2
|
export type TopicSubscriptionPolicyParams = {
|
|
3
3
|
topicArn: string;
|
|
4
|
-
allowedSqsQueueUrlPrefix?: string;
|
|
4
|
+
allowedSqsQueueUrlPrefix?: string | readonly string[];
|
|
5
5
|
allowedSourceOwner?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function generateTopicSubscriptionPolicy(params: TopicSubscriptionPolicyParams): string;
|
|
@@ -5,14 +5,35 @@ exports.generateFilterAttributes = generateFilterAttributes;
|
|
|
5
5
|
// See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html
|
|
6
6
|
const POLICY_VERSION = '2012-10-17';
|
|
7
7
|
function generateTopicSubscriptionPolicy(params) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
: ''
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const policyObject = {
|
|
9
|
+
Version: POLICY_VERSION,
|
|
10
|
+
Id: '__default_policy_ID',
|
|
11
|
+
Statement: [
|
|
12
|
+
{
|
|
13
|
+
Sid: 'AllowSQSSubscription',
|
|
14
|
+
Effect: 'Allow',
|
|
15
|
+
Principal: {
|
|
16
|
+
AWS: '*',
|
|
17
|
+
},
|
|
18
|
+
Action: ['sns:Subscribe'],
|
|
19
|
+
Resource: params.topicArn,
|
|
20
|
+
Condition: {},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
if (params.allowedSourceOwner) {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
policyObject.Statement[0].Condition.StringEquals = {
|
|
27
|
+
'AWS:SourceOwner': params.allowedSourceOwner,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (params.allowedSqsQueueUrlPrefix?.length && params.allowedSqsQueueUrlPrefix.length > 0) {
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
policyObject.Statement[0].Condition.StringLike = {
|
|
33
|
+
'sns:Endpoint': params.allowedSqsQueueUrlPrefix,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return JSON.stringify(policyObject);
|
|
16
37
|
}
|
|
17
38
|
function generateFilterAttributes(
|
|
18
39
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snsAttributeUtils.js","sourceRoot":"","sources":["../../../lib/utils/snsAttributeUtils.ts"],"names":[],"mappings":";;AAWA,
|
|
1
|
+
{"version":3,"file":"snsAttributeUtils.js","sourceRoot":"","sources":["../../../lib/utils/snsAttributeUtils.ts"],"names":[],"mappings":";;AAWA,0EAgCC;AAED,4DAiBC;AA5DD,gGAAgG;AAChG,MAAM,cAAc,GAAG,YAAY,CAAA;AAQnC,SAAgB,+BAA+B,CAAC,MAAqC;IACnF,MAAM,YAAY,GAAG;QACnB,OAAO,EAAE,cAAc;QACvB,EAAE,EAAE,qBAAqB;QACzB,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,sBAAsB;gBAC3B,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE;oBACT,GAAG,EAAE,GAAG;iBACT;gBACD,MAAM,EAAE,CAAC,eAAe,CAAC;gBACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,EAAE;aACd;SACF;KACF,CAAA;IAED,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC9B,aAAa;QACb,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,GAAG;YACjD,iBAAiB,EAAE,MAAM,CAAC,kBAAkB;SAC7C,CAAA;IACH,CAAC;IACD,IAAI,MAAM,CAAC,wBAAwB,EAAE,MAAM,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1F,aAAa;QACb,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,GAAG;YAC/C,cAAc,EAAE,MAAM,CAAC,wBAAwB;SAChD,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;AACrC,CAAC;AAED,SAAgB,wBAAwB;AACtC,4DAA4D;AAC5D,cAAgC,EAChC,gBAAwB;IAExB,MAAM,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACjD,aAAa;QACb,sEAAsE;QACtE,OAAO,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAe,CAAA;IACvD,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;YAC3B,IAAI,EAAE,YAAY;SACnB,CAAC;QACF,iBAAiB,EAAE,aAAa;KACjC,CAAA;AACH,CAAC"}
|
|
@@ -2,17 +2,17 @@ import type { CreateTopicCommandInput, SNSClient } from '@aws-sdk/client-sns';
|
|
|
2
2
|
import type { CreateQueueCommandInput, SQSClient } from '@aws-sdk/client-sqs';
|
|
3
3
|
import type { DeletionConfig, ExtraParams } from '@message-queue-toolkit/core';
|
|
4
4
|
import type { SQSCreationConfig } from '@message-queue-toolkit/sqs';
|
|
5
|
-
import type { SNSCreationConfig,
|
|
5
|
+
import type { SNSCreationConfig, SNSTopicLocatorType } from '../sns/AbstractSnsService';
|
|
6
6
|
import type { SNSSQSQueueLocatorType } from '../sns/AbstractSnsSqsConsumer';
|
|
7
7
|
import type { SNSSubscriptionOptions } from './snsSubscriber';
|
|
8
8
|
export declare function initSnsSqs(sqsClient: SQSClient, snsClient: SNSClient, locatorConfig?: SNSSQSQueueLocatorType, creationConfig?: SNSCreationConfig & SQSCreationConfig, subscriptionConfig?: SNSSubscriptionOptions, extraParams?: ExtraParams): Promise<{
|
|
9
9
|
subscriptionArn: string;
|
|
10
10
|
topicArn: string;
|
|
11
|
-
queueName: string;
|
|
12
11
|
queueUrl: string;
|
|
12
|
+
queueName: string;
|
|
13
13
|
}>;
|
|
14
|
-
export declare function deleteSnsSqs(sqsClient: SQSClient, snsClient: SNSClient, deletionConfig: DeletionConfig, queueConfiguration: CreateQueueCommandInput, topicConfiguration: CreateTopicCommandInput, subscriptionConfiguration: SNSSubscriptionOptions, extraParams?: ExtraParams): Promise<void>;
|
|
14
|
+
export declare function deleteSnsSqs(sqsClient: SQSClient, snsClient: SNSClient, deletionConfig: DeletionConfig, queueConfiguration: CreateQueueCommandInput, topicConfiguration: CreateTopicCommandInput | undefined, subscriptionConfiguration: SNSSubscriptionOptions, extraParams?: ExtraParams, topicLocator?: SNSTopicLocatorType): Promise<void>;
|
|
15
15
|
export declare function deleteSns(snsClient: SNSClient, deletionConfig: DeletionConfig, creationConfig: SNSCreationConfig): Promise<void>;
|
|
16
|
-
export declare function initSns(snsClient: SNSClient, locatorConfig?:
|
|
16
|
+
export declare function initSns(snsClient: SNSClient, locatorConfig?: SNSTopicLocatorType, creationConfig?: SNSCreationConfig): Promise<{
|
|
17
17
|
topicArn: string;
|
|
18
18
|
}>;
|
|
@@ -6,12 +6,14 @@ exports.deleteSns = deleteSns;
|
|
|
6
6
|
exports.initSns = initSns;
|
|
7
7
|
const core_1 = require("@message-queue-toolkit/core");
|
|
8
8
|
const sqs_1 = require("@message-queue-toolkit/sqs");
|
|
9
|
+
const TopicTypes_1 = require("../types/TopicTypes");
|
|
9
10
|
const snsSubscriber_1 = require("./snsSubscriber");
|
|
10
11
|
const snsUtils_1 = require("./snsUtils");
|
|
12
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
11
13
|
async function initSnsSqs(sqsClient, snsClient, locatorConfig, creationConfig, subscriptionConfig, extraParams) {
|
|
12
14
|
if (!locatorConfig?.subscriptionArn) {
|
|
13
|
-
if (!creationConfig?.topic) {
|
|
14
|
-
throw new Error('If locatorConfig.subscriptionArn is not specified, creationConfig.topic
|
|
15
|
+
if (!creationConfig?.topic && !locatorConfig?.topicArn && !locatorConfig?.topicName) {
|
|
16
|
+
throw new Error('If locatorConfig.subscriptionArn is not specified, creationConfig.topic is mandatory in order to attempt to create missing topic and subscribe to it OR locatorConfig.name or locatorConfig.topicArn parameter is mandatory, to create subscription for existing topic.');
|
|
15
17
|
}
|
|
16
18
|
if (!creationConfig?.queue) {
|
|
17
19
|
throw new Error('If locatorConfig.subscriptionArn is not specified, creationConfig.queue parameter is mandatory, as there will be an attempt to create the missing queue');
|
|
@@ -22,12 +24,17 @@ async function initSnsSqs(sqsClient, snsClient, locatorConfig, creationConfig, s
|
|
|
22
24
|
if (!subscriptionConfig) {
|
|
23
25
|
throw new Error('If locatorConfig.subscriptionArn is not specified, subscriptionConfig parameter is mandatory, as there will be an attempt to create the missing subscription');
|
|
24
26
|
}
|
|
25
|
-
const
|
|
27
|
+
const topicResolutionOptions = {
|
|
28
|
+
...locatorConfig,
|
|
29
|
+
...creationConfig.topic,
|
|
30
|
+
};
|
|
31
|
+
const { subscriptionArn, topicArn, queueUrl } = await (0, snsSubscriber_1.subscribeToTopic)(sqsClient, snsClient, creationConfig.queue, topicResolutionOptions, subscriptionConfig, {
|
|
26
32
|
updateAttributesIfExists: creationConfig.updateAttributesIfExists,
|
|
27
33
|
queueUrlsWithSubscribePermissionsPrefix: creationConfig.queueUrlsWithSubscribePermissionsPrefix,
|
|
28
34
|
allowedSourceOwner: creationConfig.allowedSourceOwner,
|
|
29
35
|
topicArnsWithPublishPermissionsPrefix: creationConfig.topicArnsWithPublishPermissionsPrefix,
|
|
30
36
|
logger: extraParams?.logger,
|
|
37
|
+
forceTagUpdate: creationConfig.forceTagUpdate,
|
|
31
38
|
});
|
|
32
39
|
if (!subscriptionArn) {
|
|
33
40
|
throw new Error('Failed to subscribe');
|
|
@@ -39,41 +46,63 @@ async function initSnsSqs(sqsClient, snsClient, locatorConfig, creationConfig, s
|
|
|
39
46
|
queueUrl,
|
|
40
47
|
};
|
|
41
48
|
}
|
|
49
|
+
if (!locatorConfig.queueUrl) {
|
|
50
|
+
throw new Error('If locatorConfig.subscriptionArn is provided, you have to also provide locatorConfig.queueUrl');
|
|
51
|
+
}
|
|
52
|
+
const checkPromises = [];
|
|
42
53
|
// Check for existing resources, using the locators
|
|
43
|
-
const
|
|
44
|
-
const topicPromise = (0, snsUtils_1.getTopicAttributes)(snsClient,
|
|
45
|
-
|
|
46
|
-
if (
|
|
54
|
+
const subscriptionTopicArn = locatorConfig.topicArn ?? (await (0, snsUtils_1.getTopicArnByName)(snsClient, locatorConfig.topicName));
|
|
55
|
+
const topicPromise = (0, snsUtils_1.getTopicAttributes)(snsClient, subscriptionTopicArn);
|
|
56
|
+
checkPromises.push(topicPromise);
|
|
57
|
+
if (locatorConfig.queueUrl) {
|
|
58
|
+
const queuePromise = (0, sqs_1.getQueueAttributes)(sqsClient, locatorConfig.queueUrl);
|
|
59
|
+
checkPromises.push(queuePromise);
|
|
60
|
+
}
|
|
61
|
+
const [topicCheckResult, queueCheckResult] = await Promise.all(checkPromises);
|
|
62
|
+
if (queueCheckResult?.error === 'not_found') {
|
|
47
63
|
throw new Error(`Queue with queueUrl ${locatorConfig.queueUrl} does not exist.`);
|
|
48
64
|
}
|
|
49
65
|
if (topicCheckResult.error === 'not_found') {
|
|
50
66
|
throw new Error(`Topic with topicArn ${locatorConfig.topicArn} does not exist.`);
|
|
51
67
|
}
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
let queueName;
|
|
69
|
+
if (locatorConfig.queueUrl) {
|
|
70
|
+
const splitUrl = locatorConfig.queueUrl.split('/');
|
|
71
|
+
queueName = splitUrl[splitUrl.length - 1];
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
queueName = creationConfig.queue.QueueName;
|
|
75
|
+
}
|
|
54
76
|
return {
|
|
55
77
|
subscriptionArn: locatorConfig.subscriptionArn,
|
|
56
|
-
topicArn:
|
|
78
|
+
topicArn: subscriptionTopicArn,
|
|
57
79
|
queueUrl: locatorConfig.queueUrl,
|
|
58
80
|
queueName,
|
|
59
81
|
};
|
|
60
82
|
}
|
|
61
|
-
async function deleteSnsSqs(sqsClient, snsClient, deletionConfig, queueConfiguration, topicConfiguration, subscriptionConfiguration, extraParams) {
|
|
83
|
+
async function deleteSnsSqs(sqsClient, snsClient, deletionConfig, queueConfiguration, topicConfiguration, subscriptionConfiguration, extraParams, topicLocator) {
|
|
62
84
|
if (!deletionConfig.deleteIfExists) {
|
|
63
85
|
return;
|
|
64
86
|
}
|
|
65
87
|
if ((0, core_1.isProduction)() && !deletionConfig.forceDeleteInProduction) {
|
|
66
88
|
throw new Error('You are running autodeletion in production. This can and probably will cause a loss of data. If you are absolutely sure you want to do this, please set deletionConfig.forceDeleteInProduction to true');
|
|
67
89
|
}
|
|
68
|
-
const { subscriptionArn } = await (0, snsSubscriber_1.subscribeToTopic)(sqsClient, snsClient, queueConfiguration, topicConfiguration, subscriptionConfiguration, extraParams);
|
|
90
|
+
const { subscriptionArn } = await (0, snsSubscriber_1.subscribeToTopic)(sqsClient, snsClient, queueConfiguration, topicConfiguration ?? topicLocator, subscriptionConfiguration, extraParams);
|
|
69
91
|
if (!subscriptionArn) {
|
|
70
92
|
throw new Error('subscriptionArn must be set for automatic deletion');
|
|
71
93
|
}
|
|
72
94
|
await (0, sqs_1.deleteQueue)(sqsClient,
|
|
73
95
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
74
96
|
queueConfiguration.QueueName, deletionConfig.waitForConfirmation !== false);
|
|
75
|
-
|
|
76
|
-
|
|
97
|
+
if (topicConfiguration) {
|
|
98
|
+
const topicName = (0, TopicTypes_1.isCreateTopicCommand)(topicConfiguration)
|
|
99
|
+
? topicConfiguration.Name
|
|
100
|
+
: 'undefined';
|
|
101
|
+
if (!topicName) {
|
|
102
|
+
throw new Error('Failed to resolve topic name');
|
|
103
|
+
}
|
|
104
|
+
await (0, snsUtils_1.deleteTopic)(snsClient, topicName);
|
|
105
|
+
}
|
|
77
106
|
await (0, snsUtils_1.deleteSubscription)(snsClient, subscriptionArn);
|
|
78
107
|
}
|
|
79
108
|
async function deleteSns(snsClient, deletionConfig, creationConfig) {
|
|
@@ -83,19 +112,20 @@ async function deleteSns(snsClient, deletionConfig, creationConfig) {
|
|
|
83
112
|
if ((0, core_1.isProduction)() && !deletionConfig.forceDeleteInProduction) {
|
|
84
113
|
throw new Error('You are running autodeletion in production. This can and probably will cause a loss of data. If you are absolutely sure you want to do this, please set deletionConfig.forceDeleteInProduction to true');
|
|
85
114
|
}
|
|
86
|
-
if (!creationConfig.topic
|
|
115
|
+
if (!creationConfig.topic?.Name) {
|
|
87
116
|
throw new Error('topic.Name must be set for automatic deletion');
|
|
88
117
|
}
|
|
89
118
|
await (0, snsUtils_1.deleteTopic)(snsClient, creationConfig.topic.Name);
|
|
90
119
|
}
|
|
91
120
|
async function initSns(snsClient, locatorConfig, creationConfig) {
|
|
92
121
|
if (locatorConfig) {
|
|
93
|
-
const
|
|
122
|
+
const topicArn = locatorConfig.topicArn ?? (await (0, snsUtils_1.getTopicArnByName)(snsClient, locatorConfig.topicName));
|
|
123
|
+
const checkResult = await (0, snsUtils_1.getTopicAttributes)(snsClient, topicArn);
|
|
94
124
|
if (checkResult.error === 'not_found') {
|
|
95
125
|
throw new Error(`Topic with topicArn ${locatorConfig.topicArn} does not exist.`);
|
|
96
126
|
}
|
|
97
127
|
return {
|
|
98
|
-
topicArn
|
|
128
|
+
topicArn,
|
|
99
129
|
};
|
|
100
130
|
}
|
|
101
131
|
// create new topic if it does not exist
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snsInitter.js","sourceRoot":"","sources":["../../../lib/utils/snsInitter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"snsInitter.js","sourceRoot":"","sources":["../../../lib/utils/snsInitter.ts"],"names":[],"mappings":";;AAuBA,gCA0GC;AAED,oCAkDC;AAED,8BAoBC;AAED,0BA+BC;AAzOD,sDAA0D;AAE1D,oDAA4E;AAM5E,oDAAuF;AAEvF,mDAAkD;AAClD,yCAMmB;AAEnB,6EAA6E;AACtE,KAAK,UAAU,UAAU,CAC9B,SAAoB,EACpB,SAAoB,EACpB,aAAsC,EACtC,cAAsD,EACtD,kBAA2C,EAC3C,WAAyB;IAEzB,IAAI,CAAC,aAAa,EAAE,eAAe,EAAE,CAAC;QACpC,IAAI,CAAC,cAAc,EAAE,KAAK,IAAI,CAAC,aAAa,EAAE,QAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,CAAC;YACpF,MAAM,IAAI,KAAK,CACb,yQAAyQ,CAC1Q,CAAA;QACH,CAAC;QACD,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,yJAAyJ,CAC1J,CAAA;QACH,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,mKAAmK,CACpK,CAAA;QACH,CAAC;QACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,8JAA8J,CAC/J,CAAA;QACH,CAAC;QAED,MAAM,sBAAsB,GAA2B;YACrD,GAAG,aAAa;YAChB,GAAG,cAAc,CAAC,KAAK;SACxB,CAAA;QAED,M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AAA;AACzD,CAAC;AAEM,KAAK,UAAU,OAAO,CAC3B,SAAoB,EACpB,aAAmC,EACnC,cAAkC;IAElC,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,QAAQ,GACZ,aAAa,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAA,4BAAiB,EAAC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAA;QACzF,MAAM,WAAW,GAAG,MAAM,IAAA,6BAAkB,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QACjE,IAAI,WAAW,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,uBAAuB,aAAa,CAAC,QAAQ,kBAAkB,CAAC,CAAA;QAClF,CAAC;QAED,OAAO;YACL,QAAQ;SACT,CAAA;IACH,CAAC;IAED,wCAAwC;IACxC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAA;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAW,EAAC,SAAS,EAAE,cAAc,CAAC,KAAM,EAAE;QACnE,uCAAuC,EAAE,cAAc,CAAC,uCAAuC;QAC/F,kBAAkB,EAAE,cAAc,CAAC,kBAAkB;KACtD,CAAC,CAAA;IACF,OAAO;QACL,QAAQ;KACT,CAAA;AACH,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SNSClient } from '@aws-sdk/client-sns';
|
|
2
2
|
import type { SubscribeCommandInput } from '@aws-sdk/client-sns/dist-types/commands/SubscribeCommand';
|
|
3
3
|
import type { CreateQueueCommandInput, SQSClient } from '@aws-sdk/client-sqs';
|
|
4
4
|
import type { ExtraParams } from '@message-queue-toolkit/core';
|
|
5
5
|
import type { ExtraSQSCreationParams } from '@message-queue-toolkit/sqs';
|
|
6
6
|
import type { ExtraSNSCreationParams } from '../sns/AbstractSnsService';
|
|
7
|
+
import { type TopicResolutionOptions } from '../types/TopicTypes';
|
|
7
8
|
export type SNSSubscriptionOptions = Omit<SubscribeCommandInput, 'TopicArn' | 'Endpoint' | 'Protocol' | 'ReturnSubscriptionArn'> & {
|
|
8
9
|
updateAttributesIfExists: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare function subscribeToTopic(sqsClient: SQSClient, snsClient: SNSClient, queueConfiguration: CreateQueueCommandInput, topicConfiguration:
|
|
11
|
+
export declare function subscribeToTopic(sqsClient: SQSClient, snsClient: SNSClient, queueConfiguration: CreateQueueCommandInput, topicConfiguration: TopicResolutionOptions, subscriptionConfiguration: SNSSubscriptionOptions, extraParams?: ExtraSNSCreationParams & ExtraSQSCreationParams & ExtraParams): Promise<{
|
|
11
12
|
subscriptionArn: string | undefined;
|
|
12
13
|
topicArn: string;
|
|
13
14
|
queueUrl: string;
|
|
@@ -3,15 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.subscribeToTopic = subscribeToTopic;
|
|
4
4
|
const client_sns_1 = require("@aws-sdk/client-sns");
|
|
5
5
|
const sqs_1 = require("@message-queue-toolkit/sqs");
|
|
6
|
+
const TopicTypes_1 = require("../types/TopicTypes");
|
|
6
7
|
const snsUtils_1 = require("./snsUtils");
|
|
8
|
+
async function resolveTopicArnToSubscribeTo(topicConfiguration, snsClient, extraParams) {
|
|
9
|
+
//If topicArn is present, let's use it and return early.
|
|
10
|
+
if ((0, TopicTypes_1.isSNSTopicLocatorType)(topicConfiguration) && topicConfiguration.topicArn) {
|
|
11
|
+
return topicConfiguration.topicArn;
|
|
12
|
+
}
|
|
13
|
+
//If input configuration is capable of creating a topic, let's create it and return its ARN.
|
|
14
|
+
if ((0, TopicTypes_1.isCreateTopicCommand)(topicConfiguration)) {
|
|
15
|
+
return await (0, snsUtils_1.assertTopic)(snsClient, topicConfiguration, {
|
|
16
|
+
queueUrlsWithSubscribePermissionsPrefix: extraParams?.queueUrlsWithSubscribePermissionsPrefix,
|
|
17
|
+
allowedSourceOwner: extraParams?.allowedSourceOwner,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//Last option: let's not create a topic but resolve a ARN based on the desired topic name.
|
|
21
|
+
return await (0, snsUtils_1.getTopicArnByName)(snsClient, topicConfiguration.topicName);
|
|
22
|
+
}
|
|
7
23
|
async function subscribeToTopic(sqsClient, snsClient, queueConfiguration, topicConfiguration, subscriptionConfiguration, extraParams) {
|
|
8
|
-
const topicArn = await (
|
|
9
|
-
queueUrlsWithSubscribePermissionsPrefix: extraParams?.queueUrlsWithSubscribePermissionsPrefix,
|
|
10
|
-
allowedSourceOwner: extraParams?.allowedSourceOwner,
|
|
11
|
-
});
|
|
24
|
+
const topicArn = await resolveTopicArnToSubscribeTo(topicConfiguration, snsClient, extraParams);
|
|
12
25
|
const { queueUrl, queueArn } = await (0, sqs_1.assertQueue)(sqsClient, queueConfiguration, {
|
|
13
26
|
topicArnsWithPublishPermissionsPrefix: extraParams?.topicArnsWithPublishPermissionsPrefix,
|
|
14
27
|
updateAttributesIfExists: extraParams?.updateAttributesIfExists,
|
|
28
|
+
forceTagUpdate: extraParams?.forceTagUpdate,
|
|
15
29
|
});
|
|
16
30
|
const subscribeCommand = new client_sns_1.SubscribeCommand({
|
|
17
31
|
TopicArn: topicArn,
|
|
@@ -32,7 +46,9 @@ async function subscribeToTopic(sqsClient, snsClient, queueConfiguration, topicC
|
|
|
32
46
|
catch (err) {
|
|
33
47
|
const logger = extraParams?.logger ?? console;
|
|
34
48
|
// @ts-ignore
|
|
35
|
-
logger.error(`Error while creating subscription for queue "${queueConfiguration.QueueName}", topic "${
|
|
49
|
+
logger.error(`Error while creating subscription for queue "${queueConfiguration.QueueName}", topic "${(0, TopicTypes_1.isCreateTopicCommand)(topicConfiguration)
|
|
50
|
+
? topicConfiguration.Name
|
|
51
|
+
: topicConfiguration.topicName}": ${err.message}`);
|
|
36
52
|
if (subscriptionConfiguration.updateAttributesIfExists &&
|
|
37
53
|
err.message.indexOf('Subscription already exists with different attributes') !== -1) {
|
|
38
54
|
const result = await tryToUpdateSubscription(snsClient, topicArn, queueArn, subscriptionConfiguration);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snsSubscriber.js","sourceRoot":"","sources":["../../../lib/utils/snsSubscriber.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"snsSubscriber.js","sourceRoot":"","sources":["../../../lib/utils/snsSubscriber.ts"],"names":[],"mappings":";;AA4CA,4CAmEC;AA9GD,oDAAwF;AAKxF,oDAAwD;AAIxD,oDAI4B;AAC5B,yCAA4F;AAO5F,KAAK,UAAU,4BAA4B,CACzC,kBAA0C,EAC1C,SAAoB,EACpB,WAAwF;IAExF,wDAAwD;IACxD,IAAI,IAAA,kCAAqB,EAAC,kBAAkB,CAAC,IAAI,kBAAkB,CAAC,QAAQ,EAAE,CAAC;QAC7E,OAAO,kBAAkB,CAAC,QAAQ,CAAA;IACpC,CAAC;IAED,4FAA4F;IAC5F,IAAI,IAAA,iCAAoB,EAAC,kBAAkB,CAAC,EAAE,CAAC;QAC7C,OAAO,MAAM,IAAA,sBAAW,EAAC,SAAS,EAAE,kBAAkB,EAAE;YACtD,uCAAuC,EAAE,WAAW,EAAE,uCAAuC;YAC7F,kBAAkB,EAAE,WAAW,EAAE,kBAAkB;SACpD,CAAC,CAAA;IACJ,CAAC;IAED,0FAA0F;IAC1F,OAAO,MAAM,IAAA,4BAAiB,EAAC,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAA;AACzE,CAAC;AAEM,KAAK,UAAU,gBAAgB,CACpC,SAAoB,EACpB,SAAoB,EACpB,kBAA2C,EAC3C,kBAA0C,EAC1C,yBAAiD,EACjD,WAA2E;IAE3E,MAAM,QAAQ,GAAG,MAAM,4BAA4B,CAAC,kBAAkB,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;IAE/F,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,iBAAW,EA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ACD,OAAO;gBACL,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,QAAQ;gBACR,QAAQ;gBACR,QAAQ;aACT,CAAA;QACH,CAAC;QAED,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,SAAoB,EACpB,QAAgB,EAChB,QAAgB,EAChB,yBAAiD;IAEjD,MAAM,YAAY,GAAG,MAAM,IAAA,0CAA+B,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACzF,IAAI,CAAC,YAAY,IAAI,CAAC,yBAAyB,CAAC,UAAU,EAAE,CAAC;QAC3D,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,iCAAiC,GAAG,MAAM,CAAC,OAAO,CACtD,yBAAyB,CAAC,UAAU,CACrC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACrB,OAAO,IAAI,6CAAgC,CAAC;YAC1C,eAAe,EAAE,YAAY,CAAC,eAAe;YAC7C,aAAa,EAAE,GAAG;YAClB,cAAc,EAAE,KAAK;SACtB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,KAAK,MAAM,OAAO,IAAI,iCAAiC,EAAE,CAAC;QACxD,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CreateTopicCommandInput, type SNSClient } from '@aws-sdk/client-sns';
|
|
2
2
|
import type { Either } from '@lokalise/node-core';
|
|
3
3
|
import type { ExtraSNSCreationParams } from '../sns/AbstractSnsService';
|
|
4
4
|
type AttributesResult = {
|
|
@@ -10,6 +10,7 @@ export declare function assertTopic(snsClient: SNSClient, topicOptions: CreateTo
|
|
|
10
10
|
export declare function deleteTopic(client: SNSClient, topicName: string): Promise<void>;
|
|
11
11
|
export declare function deleteSubscription(client: SNSClient, subscriptionArn: string): Promise<void>;
|
|
12
12
|
export declare function findSubscriptionByTopicAndQueue(snsClient: SNSClient, topicArn: string, queueArn: string): Promise<import("@aws-sdk/client-sns").Subscription | undefined>;
|
|
13
|
+
export declare function getTopicArnByName(snsClient: SNSClient, topicName?: string): Promise<string>;
|
|
13
14
|
/**
|
|
14
15
|
* Calculates the size of an outgoing SNS message.
|
|
15
16
|
*
|
|
@@ -7,11 +7,13 @@ exports.assertTopic = assertTopic;
|
|
|
7
7
|
exports.deleteTopic = deleteTopic;
|
|
8
8
|
exports.deleteSubscription = deleteSubscription;
|
|
9
9
|
exports.findSubscriptionByTopicAndQueue = findSubscriptionByTopicAndQueue;
|
|
10
|
+
exports.getTopicArnByName = getTopicArnByName;
|
|
10
11
|
const client_sns_1 = require("@aws-sdk/client-sns");
|
|
12
|
+
const client_sns_2 = require("@aws-sdk/client-sns");
|
|
11
13
|
const sqs_1 = require("@message-queue-toolkit/sqs");
|
|
12
14
|
const snsAttributeUtils_1 = require("./snsAttributeUtils");
|
|
13
15
|
async function getTopicAttributes(snsClient, topicArn) {
|
|
14
|
-
const command = new
|
|
16
|
+
const command = new client_sns_2.GetTopicAttributesCommand({
|
|
15
17
|
TopicArn: topicArn,
|
|
16
18
|
});
|
|
17
19
|
try {
|
|
@@ -34,7 +36,7 @@ async function getTopicAttributes(snsClient, topicArn) {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
async function getSubscriptionAttributes(snsClient, subscriptionArn) {
|
|
37
|
-
const command = new
|
|
39
|
+
const command = new client_sns_2.GetSubscriptionAttributesCommand({
|
|
38
40
|
SubscriptionArn: subscriptionArn,
|
|
39
41
|
});
|
|
40
42
|
try {
|
|
@@ -57,14 +59,14 @@ async function getSubscriptionAttributes(snsClient, subscriptionArn) {
|
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
async function assertTopic(snsClient, topicOptions, extraParams) {
|
|
60
|
-
const command = new
|
|
62
|
+
const command = new client_sns_2.CreateTopicCommand(topicOptions);
|
|
61
63
|
const response = await snsClient.send(command);
|
|
62
64
|
if (!response.TopicArn) {
|
|
63
65
|
throw new Error('No topic arn in response');
|
|
64
66
|
}
|
|
65
67
|
const topicArn = response.TopicArn;
|
|
66
68
|
if (extraParams?.queueUrlsWithSubscribePermissionsPrefix || extraParams?.allowedSourceOwner) {
|
|
67
|
-
const setTopicAttributesCommand = new
|
|
69
|
+
const setTopicAttributesCommand = new client_sns_2.SetTopicAttributesCommand({
|
|
68
70
|
TopicArn: topicArn,
|
|
69
71
|
AttributeName: 'Policy',
|
|
70
72
|
AttributeValue: (0, snsAttributeUtils_1.generateTopicSubscriptionPolicy)({
|
|
@@ -82,7 +84,7 @@ async function deleteTopic(client, topicName) {
|
|
|
82
84
|
const topicArn = await assertTopic(client, {
|
|
83
85
|
Name: topicName,
|
|
84
86
|
});
|
|
85
|
-
const command = new
|
|
87
|
+
const command = new client_sns_2.DeleteTopicCommand({
|
|
86
88
|
TopicArn: topicArn,
|
|
87
89
|
});
|
|
88
90
|
await client.send(command);
|
|
@@ -92,7 +94,7 @@ async function deleteTopic(client, topicName) {
|
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
async function deleteSubscription(client, subscriptionArn) {
|
|
95
|
-
const command = new
|
|
97
|
+
const command = new client_sns_2.UnsubscribeCommand({
|
|
96
98
|
SubscriptionArn: subscriptionArn,
|
|
97
99
|
});
|
|
98
100
|
try {
|
|
@@ -103,7 +105,7 @@ async function deleteSubscription(client, subscriptionArn) {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
async function findSubscriptionByTopicAndQueue(snsClient, topicArn, queueArn) {
|
|
106
|
-
const listSubscriptionsCommand = new
|
|
108
|
+
const listSubscriptionsCommand = new client_sns_2.ListSubscriptionsByTopicCommand({
|
|
107
109
|
TopicArn: topicArn,
|
|
108
110
|
});
|
|
109
111
|
const listSubscriptionResult = await snsClient.send(listSubscriptionsCommand);
|
|
@@ -111,6 +113,21 @@ async function findSubscriptionByTopicAndQueue(snsClient, topicArn, queueArn) {
|
|
|
111
113
|
return entry.Endpoint === queueArn;
|
|
112
114
|
});
|
|
113
115
|
}
|
|
116
|
+
async function getTopicArnByName(snsClient, topicName) {
|
|
117
|
+
if (!topicName) {
|
|
118
|
+
throw new Error('topicName is not provided');
|
|
119
|
+
}
|
|
120
|
+
// Use paginator to automatically handle NextToken
|
|
121
|
+
const paginator = (0, client_sns_1.paginateListTopics)({ client: snsClient }, {});
|
|
122
|
+
for await (const page of paginator) {
|
|
123
|
+
for (const topic of page.Topics || []) {
|
|
124
|
+
if (topic.TopicArn?.includes(topicName)) {
|
|
125
|
+
return topic.TopicArn;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
throw new Error(`Failed to resolve topic by name ${topicName}`);
|
|
130
|
+
}
|
|
114
131
|
/**
|
|
115
132
|
* Calculates the size of an outgoing SNS message.
|
|
116
133
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snsUtils.js","sourceRoot":"","sources":["../../../lib/utils/snsUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"snsUtils.js","sourceRoot":"","sources":["../../../lib/utils/snsUtils.ts"],"names":[],"mappings":";;;AAyBA,gDAyBC;AAED,8DAyBC;AAED,kCA2BC;AAED,kCAcC;AAED,gDASC;AAED,0EAaC;AAED,8CAeC;AArKD,oDAI4B;AAC5B,oDAQ4B;AAE5B,oDAA4G;AAI5G,2DAAqE;AAM9D,KAAK,UAAU,kBAAkB,CACtC,SAAoB,EACpB,QAAgB;IAEhB,MAAM,OAAO,GAAG,IAAI,sCAAyB,CAAC;QAC5C,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC9C,OAAO;YACL,MAAM,EAAE;gBACN,UAA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AAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;IAC7E,OAAO,sBAAsB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1D,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAA;IACpC,CAAC,CAAC,CAAA;AACJ,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,SAAoB,EAAE,SAAkB;IAC9E,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;IAC9C,CAAC;IAED,kDAAkD;IAClD,MAAM,SAAS,GAAG,IAAA,+BAAkB,EAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAA;IAC/D,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QACnC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YACtC,IAAI,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBACxC,OAAO,KAAK,CAAC,QAAQ,CAAA;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,SAAS,EAAE,CAAC,CAAA;AACjE,CAAC;AAED;;;;;;;;;;GAUG;AACI,MAAM,4BAA4B,GAAG,CAAC,OAAgB,EAAE,EAAE,CAC/D,IAAA,kCAA+B,EAAC,OAAO,CAAC,CAAA;AAD7B,QAAA,4BAA4B,gCACC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@message-queue-toolkit/sns",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "SNS adapter for message-queue-toolkit",
|
|
@@ -25,33 +25,33 @@
|
|
|
25
25
|
"prepublishOnly": "npm run build:release"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@lokalise/node-core": "^
|
|
29
|
-
"sqs-consumer": "^11.0
|
|
28
|
+
"@lokalise/node-core": "^13.0.1",
|
|
29
|
+
"sqs-consumer": "^11.1.0",
|
|
30
30
|
"zod": "^3.23.8"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@aws-sdk/client-sns": "^3.
|
|
34
|
-
"@aws-sdk/client-sqs": "^3.
|
|
33
|
+
"@aws-sdk/client-sns": "^3.632.0",
|
|
34
|
+
"@aws-sdk/client-sqs": "^3.632.0",
|
|
35
35
|
"@message-queue-toolkit/core": ">=15.0.0",
|
|
36
36
|
"@message-queue-toolkit/schemas": ">=2.0.0",
|
|
37
37
|
"@message-queue-toolkit/sqs": "^17.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@aws-sdk/client-s3": "^3.
|
|
41
|
-
"@aws-sdk/client-sns": "^3.
|
|
42
|
-
"@aws-sdk/client-sqs": "^3.
|
|
40
|
+
"@aws-sdk/client-s3": "^3.670.0",
|
|
41
|
+
"@aws-sdk/client-sns": "^3.670.0",
|
|
42
|
+
"@aws-sdk/client-sqs": "^3.670.0",
|
|
43
43
|
"@message-queue-toolkit/core": "*",
|
|
44
44
|
"@message-queue-toolkit/s3-payload-store": "*",
|
|
45
45
|
"@message-queue-toolkit/sqs": "*",
|
|
46
|
-
"@biomejs/biome": "1.
|
|
46
|
+
"@biomejs/biome": "1.9.3",
|
|
47
47
|
"@kibertoad/biome-config": "^1.2.1",
|
|
48
|
-
"@types/node": "^22.
|
|
49
|
-
"@vitest/coverage-v8": "^2.
|
|
50
|
-
"awilix": "^
|
|
48
|
+
"@types/node": "^22.7.5",
|
|
49
|
+
"@vitest/coverage-v8": "^2.1.2",
|
|
50
|
+
"awilix": "^12.0.1",
|
|
51
51
|
"awilix-manager": "^5.1.0",
|
|
52
|
-
"del-cli": "^
|
|
53
|
-
"typescript": "^5.
|
|
54
|
-
"vitest": "^2.
|
|
52
|
+
"del-cli": "^6.0.0",
|
|
53
|
+
"typescript": "^5.6.3",
|
|
54
|
+
"vitest": "^2.1.2"
|
|
55
55
|
},
|
|
56
56
|
"homepage": "https://github.com/kibertoad/message-queue-toolkit",
|
|
57
57
|
"repository": {
|