chatbot-nc 2.1.44 → 2.1.45
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/cjs/aws/services/AWSSQS.d.ts +2 -1
- package/dist/cjs/aws/services/AWSSQS.js +16 -5
- package/dist/cjs/aws/services/AWSSQS.js.map +1 -1
- package/dist/esm/aws/services/AWSSQS.d.ts +2 -1
- package/dist/esm/aws/services/AWSSQS.js +17 -6
- package/dist/esm/aws/services/AWSSQS.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MessageAttributeValue } from "@aws-sdk/client-sqs";
|
|
1
2
|
export declare const SQS: {
|
|
2
|
-
publish: (
|
|
3
|
+
publish: (queue: string, message: string, delay?: number, messageAttributes?: Record<string, MessageAttributeValue>) => Promise<void>;
|
|
3
4
|
};
|
|
@@ -5,14 +5,25 @@ const client_sqs_1 = require("@aws-sdk/client-sqs"); // ES Modules import
|
|
|
5
5
|
const environment = (process.env.NODE_ENVIRONMENT || 'Test');
|
|
6
6
|
const awsRegion = (process.env.AWS_DEFAULT_REGION || 'us-east-1');
|
|
7
7
|
const client = new client_sqs_1.SQSClient({ region: awsRegion });
|
|
8
|
-
const publish = async (
|
|
8
|
+
const publish = async (queue, message, delay, messageAttributes) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
let queueParam = {
|
|
11
|
+
QueueName: queue
|
|
12
|
+
};
|
|
13
|
+
var command = await new client_sqs_1.CreateQueueCommand(queueParam);
|
|
14
|
+
const parameter = await client.send(command);
|
|
15
|
+
const sqsParameters = {
|
|
16
|
+
QueueUrl: parameter.QueueUrl,
|
|
17
|
+
MessageBody: message,
|
|
18
|
+
DelaySeconds: delay !== null && delay !== void 0 ? delay : 0,
|
|
19
|
+
MessageAttributes: messageAttributes
|
|
20
|
+
};
|
|
21
|
+
console.info("Queue URL is " + parameter.QueueUrl);
|
|
22
|
+
let sendMessageCommand = new client_sqs_1.SendMessageCommand(sqsParameters);
|
|
23
|
+
const data = await client.send(sendMessageCommand);
|
|
13
24
|
}
|
|
14
25
|
catch (error) {
|
|
15
|
-
console.error(`error occured while
|
|
26
|
+
console.error(`error occured while senind sqs message to SNS `);
|
|
16
27
|
console.error(error, error.stack);
|
|
17
28
|
}
|
|
18
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWSSQS.js","sourceRoot":"","sources":["../../../../aws/services/AWSSQS.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"AWSSQS.js","sourceRoot":"","sources":["../../../../aws/services/AWSSQS.ts"],"names":[],"mappings":";;;AAAA,oDAAiK,CAAC,oBAAoB;AAEtL,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,MAAM,CAAC,CAAC;AAC7D,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW,CAAC,CAAC;AAElE,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAEpD,MAAM,OAAO,GAAG,KAAK,EAAE,KAAa,EAAE,OAAe,EAAE,KAAc,EAAE,iBAAyD,EAAE,EAAE;IAChI,IAAI,CAAC;QAED,IAAI,UAAU,GAA4B;YACtC,SAAS,EAAE,KAAK;SACnB,CAAC;QACF,IAAI,OAAO,GAAG,MAAM,IAAI,+BAAkB,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE5C,MAAM,aAAa,GAA4B;YAC3C,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,WAAW,EAAE,OAAO;YACpB,YAAY,EAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC;YACvB,iBAAiB,EAAE,iBAAiB;SACvC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEnD,IAAI,kBAAkB,GAAG,IAAI,+BAAkB,CAAC,aAAa,CAAC,CAAC;QAC/D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAEvD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;QAC/D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;AACL,CAAC,CAAA;AAIY,QAAA,GAAG,GAAG;IACf,OAAO;CACV,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MessageAttributeValue } from "@aws-sdk/client-sqs";
|
|
1
2
|
export declare const SQS: {
|
|
2
|
-
publish: (
|
|
3
|
+
publish: (queue: string, message: string, delay?: number, messageAttributes?: Record<string, MessageAttributeValue>) => Promise<void>;
|
|
3
4
|
};
|
|
@@ -7,18 +7,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { SQSClient } from "@aws-sdk/client-sqs"; // ES Modules import
|
|
10
|
+
import { CreateQueueCommand, SendMessageCommand, SQSClient } from "@aws-sdk/client-sqs"; // ES Modules import
|
|
11
11
|
const environment = (process.env.NODE_ENVIRONMENT || 'Test');
|
|
12
12
|
const awsRegion = (process.env.AWS_DEFAULT_REGION || 'us-east-1');
|
|
13
13
|
const client = new SQSClient({ region: awsRegion });
|
|
14
|
-
const publish = (
|
|
14
|
+
const publish = (queue, message, delay, messageAttributes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let queueParam = {
|
|
17
|
+
QueueName: queue
|
|
18
|
+
};
|
|
19
|
+
var command = yield new CreateQueueCommand(queueParam);
|
|
20
|
+
const parameter = yield client.send(command);
|
|
21
|
+
const sqsParameters = {
|
|
22
|
+
QueueUrl: parameter.QueueUrl,
|
|
23
|
+
MessageBody: message,
|
|
24
|
+
DelaySeconds: delay !== null && delay !== void 0 ? delay : 0,
|
|
25
|
+
MessageAttributes: messageAttributes
|
|
26
|
+
};
|
|
27
|
+
console.info("Queue URL is " + parameter.QueueUrl);
|
|
28
|
+
let sendMessageCommand = new SendMessageCommand(sqsParameters);
|
|
29
|
+
const data = yield client.send(sendMessageCommand);
|
|
19
30
|
}
|
|
20
31
|
catch (error) {
|
|
21
|
-
console.error(`error occured while
|
|
32
|
+
console.error(`error occured while senind sqs message to SNS `);
|
|
22
33
|
console.error(error, error.stack);
|
|
23
34
|
}
|
|
24
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWSSQS.js","sourceRoot":"","sources":["../../../../aws/services/AWSSQS.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"AWSSQS.js","sourceRoot":"","sources":["../../../../aws/services/AWSSQS.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAkD,kBAAkB,EAA2B,SAAS,EAAE,MAAM,qBAAqB,CAAC,CAAC,oBAAoB;AAEtL,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,MAAM,CAAC,CAAC;AAC7D,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW,CAAC,CAAC;AAElE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAEpD,MAAM,OAAO,GAAG,CAAO,KAAa,EA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