@cumulus/aws-client 21.3.1 → 21.3.2-testlerna.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/S3.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  * @module S3
3
3
  */
4
4
  /// <reference types="node" />
5
- /// <reference types="node" />
6
5
  import pRetry from 'p-retry';
7
6
  import { Readable, TransformOptions } from 'stream';
8
7
  import { CopyObjectCommandInput, DeleteObjectRequest, DeleteBucketCommandOutput, GetObjectCommandInput, GetObjectOutput, HeadObjectOutput, ListObjectsV2Request, ObjectCannedACL, PutObjectCommandInput, PutObjectRequest, S3, Tagging, ListObjectsCommandOutput, DeleteObjectCommandOutput, PutObjectCommandOutput, CopyObjectCommandOutput, CompleteMultipartUploadCommandOutput, GetObjectTaggingCommandOutput } from '@aws-sdk/client-s3';
package/S3.js CHANGED
@@ -38,7 +38,6 @@ const p_retry_1 = __importDefault(require("p-retry"));
38
38
  const p_wait_for_1 = __importDefault(require("p-wait-for"));
39
39
  const p_timeout_1 = __importDefault(require("p-timeout"));
40
40
  const pump_1 = __importDefault(require("pump"));
41
- const querystring_1 = __importDefault(require("querystring"));
42
41
  const stream_1 = require("stream");
43
42
  const util_1 = require("util");
44
43
  const lib_storage_1 = require("@aws-sdk/lib-storage");
@@ -346,7 +345,7 @@ const getObjectTags = async (bucket, key) => {
346
345
  };
347
346
  const getObjectTaggingString = async (bucket, key) => {
348
347
  const tags = await getObjectTags(bucket, key);
349
- return querystring_1.default.stringify(tags);
348
+ return new URLSearchParams(tags).toString();
350
349
  };
351
350
  /**
352
351
  * Puts object Tagging in S3
package/SNS.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @module SNS
3
3
  */
4
+ import { DeleteTopicCommandOutput, SubscribeCommandOutput } from '@aws-sdk/client-sns';
4
5
  /**
5
6
  * Publish a message to an SNS topic. Does not catch
6
7
  * errors, to allow more specific handling by the caller.
@@ -21,4 +22,19 @@ export declare const publishSnsMessageWithRetry: (snsTopicArn: string, message:
21
22
  export declare const createSnsTopic: (snsTopicName: string) => Promise<{
22
23
  TopicArn: string | undefined;
23
24
  }>;
25
+ /**
26
+ * Delete an SNS topic with a given ARN.
27
+ *
28
+ * @param snsTopicArn - ARN of the SNS topic
29
+ * @returns - Promise that resolves when the topic is deleted
30
+ */
31
+ export declare const deleteSnsTopic: (snsTopicArn: string) => Promise<DeleteTopicCommandOutput>;
32
+ /**
33
+ * Subscribe an SQS queue to an SNS topic.
34
+ *
35
+ * @param snsTopicArn - ARN of the SNS topic
36
+ * @param sqsQueueArn - ARN of the SQS queue
37
+ * @returns - Promise that resolves with the subscription ARN
38
+ */
39
+ export declare const subscribeSqsToSnsTopic: (snsTopicArn: string, sqsQueueArn: string) => Promise<SubscribeCommandOutput>;
24
40
  //# sourceMappingURL=SNS.d.ts.map
package/SNS.js CHANGED
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createSnsTopic = exports.publishSnsMessageWithRetry = void 0;
9
+ exports.subscribeSqsToSnsTopic = exports.deleteSnsTopic = exports.createSnsTopic = exports.publishSnsMessageWithRetry = void 0;
10
10
  const p_retry_1 = __importDefault(require("p-retry"));
11
11
  const logger_1 = __importDefault(require("@cumulus/logger"));
12
12
  const errors_1 = require("@cumulus/errors");
@@ -54,4 +54,31 @@ const createSnsTopic = async (snsTopicName) => {
54
54
  return { TopicArn: createTopicResponse.TopicArn };
55
55
  };
56
56
  exports.createSnsTopic = createSnsTopic;
57
+ /**
58
+ * Delete an SNS topic with a given ARN.
59
+ *
60
+ * @param snsTopicArn - ARN of the SNS topic
61
+ * @returns - Promise that resolves when the topic is deleted
62
+ */
63
+ const deleteSnsTopic = async (snsTopicArn) => {
64
+ const deleteTopicCommand = new client_sns_1.DeleteTopicCommand({ TopicArn: snsTopicArn });
65
+ return await (0, services_1.sns)().send(deleteTopicCommand);
66
+ };
67
+ exports.deleteSnsTopic = deleteSnsTopic;
68
+ /**
69
+ * Subscribe an SQS queue to an SNS topic.
70
+ *
71
+ * @param snsTopicArn - ARN of the SNS topic
72
+ * @param sqsQueueArn - ARN of the SQS queue
73
+ * @returns - Promise that resolves with the subscription ARN
74
+ */
75
+ const subscribeSqsToSnsTopic = async (snsTopicArn, sqsQueueArn) => {
76
+ const subscribeCommand = new client_sns_1.SubscribeCommand({
77
+ TopicArn: snsTopicArn,
78
+ Protocol: 'sqs',
79
+ Endpoint: sqsQueueArn,
80
+ });
81
+ return await (0, services_1.sns)().send(subscribeCommand);
82
+ };
83
+ exports.subscribeSqsToSnsTopic = subscribeSqsToSnsTopic;
57
84
  //# sourceMappingURL=SNS.js.map
package/SQS.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare const getQueueUrlByName: (queueName: string) => Promise<string |
15
15
  /**
16
16
  * Create an SQS Queue. Properly handles localstack queue URLs
17
17
  */
18
- export declare function createQueue(QueueName: string): Promise<string | undefined>;
18
+ export declare function createQueue(QueueName: string, Attributes?: Record<string, string>): Promise<string | undefined>;
19
19
  export declare const deleteQueue: (queueUrl: string) => Promise<import("@aws-sdk/client-sqs").DeleteQueueCommandOutput>;
20
20
  export declare const getQueueAttributes: (queueName: string) => Promise<{
21
21
  name: string;
package/SQS.js CHANGED
@@ -32,8 +32,11 @@ exports.getQueueUrlByName = getQueueUrlByName;
32
32
  /**
33
33
  * Create an SQS Queue. Properly handles localstack queue URLs
34
34
  */
35
- async function createQueue(QueueName) {
36
- const command = new client_sqs_1.CreateQueueCommand({ QueueName });
35
+ async function createQueue(QueueName, Attributes) {
36
+ const command = new client_sqs_1.CreateQueueCommand({
37
+ QueueName,
38
+ ...(Attributes && { Attributes }),
39
+ });
37
40
  const createQueueResponse = await (0, services_1.sqs)().send(command)
38
41
  .catch((error) => {
39
42
  log.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/aws-client",
3
- "version": "21.3.1",
3
+ "version": "21.3.2-testlerna.0",
4
4
  "description": "Utilities for working with AWS",
5
5
  "keywords": [
6
6
  "GIBS",
@@ -30,7 +30,7 @@
30
30
  "test": "../../node_modules/.bin/ava",
31
31
  "test:ci": "../../scripts/run_package_ci_unit.sh",
32
32
  "test:coverage": "../../node_modules/.bin/nyc npm test",
33
- "prepare": "npm run tsc",
33
+ "build": "npm run tsc",
34
34
  "tsc": "../../node_modules/.bin/tsc",
35
35
  "tsc:listEmittedFiles": "../../node_modules/.bin/tsc --listEmittedFiles",
36
36
  "watch-test": "../../node_modules/.bin/tsc-watch --onsuccess 'npm test'",
@@ -47,32 +47,32 @@
47
47
  "author": "Cumulus Authors",
48
48
  "license": "Apache-2.0",
49
49
  "dependencies": {
50
- "@aws-sdk/client-api-gateway": "^3.621.0",
51
- "@aws-sdk/client-cloudformation": "^3.621.0",
52
- "@aws-sdk/client-cloudwatch-events": "^3.621.0",
53
- "@aws-sdk/client-dynamodb": "^3.621.0",
54
- "@aws-sdk/client-dynamodb-streams": "^3.621.0",
55
- "@aws-sdk/client-ec2": "^3.621.0",
56
- "@aws-sdk/client-ecs": "^3.621.0",
57
- "@aws-sdk/client-elasticsearch-service": "^3.621.0",
58
- "@aws-sdk/client-kinesis": "^3.621.0",
59
- "@aws-sdk/client-kms": "^3.621.0",
60
- "@aws-sdk/client-lambda": "^3.621.0",
61
- "@aws-sdk/client-s3": "^3.621.0",
62
- "@aws-sdk/client-secrets-manager": "^3.621.0",
63
- "@aws-sdk/client-sfn": "^3.621.0",
64
- "@aws-sdk/client-sns": "^3.621.0",
65
- "@aws-sdk/client-sqs": "^3.621.0",
66
- "@aws-sdk/client-sts": "^3.621.0",
67
- "@aws-sdk/lib-dynamodb": "^3.621.0",
68
- "@aws-sdk/lib-storage": "^3.621.0",
69
- "@aws-sdk/s3-request-presigner": "^3.621.0",
70
- "@aws-sdk/signature-v4-crt": "^3.621.0",
50
+ "@aws-sdk/client-api-gateway": "^3.993.0",
51
+ "@aws-sdk/client-cloudformation": "^3.993.0",
52
+ "@aws-sdk/client-cloudwatch-events": "^3.993.0",
53
+ "@aws-sdk/client-dynamodb": "^3.993.0",
54
+ "@aws-sdk/client-dynamodb-streams": "^3.993.0",
55
+ "@aws-sdk/client-ec2": "^3.993.0",
56
+ "@aws-sdk/client-ecs": "^3.993.0",
57
+ "@aws-sdk/client-elasticsearch-service": "^3.993.0",
58
+ "@aws-sdk/client-kinesis": "^3.993.0",
59
+ "@aws-sdk/client-kms": "^3.993.0",
60
+ "@aws-sdk/client-lambda": "^3.993.0",
61
+ "@aws-sdk/client-s3": "^3.993.0",
62
+ "@aws-sdk/client-secrets-manager": "^3.993.0",
63
+ "@aws-sdk/client-sfn": "^3.993.0",
64
+ "@aws-sdk/client-sns": "^3.993.0",
65
+ "@aws-sdk/client-sqs": "^3.993.0",
66
+ "@aws-sdk/client-sts": "^3.993.0",
67
+ "@aws-sdk/lib-dynamodb": "^3.993.0",
68
+ "@aws-sdk/lib-storage": "^3.993.0",
69
+ "@aws-sdk/s3-request-presigner": "^3.993.0",
70
+ "@aws-sdk/signature-v4-crt": "^3.993.0",
71
71
  "@aws-sdk/types": "^3.609.0",
72
- "@cumulus/checksum": "21.3.1",
73
- "@cumulus/errors": "21.3.1",
74
- "@cumulus/logger": "21.3.1",
75
- "@cumulus/types": "21.3.1",
72
+ "@cumulus/checksum": "21.3.2-testlerna.0",
73
+ "@cumulus/errors": "21.3.2-testlerna.0",
74
+ "@cumulus/logger": "21.3.2-testlerna.0",
75
+ "@cumulus/types": "21.3.2-testlerna.0",
76
76
  "lodash": "~4.17.21",
77
77
  "mem": "^8.0.2",
78
78
  "p-map": "^1.2.0",
@@ -83,8 +83,8 @@
83
83
  "uuid": "^8.2.0"
84
84
  },
85
85
  "devDependencies": {
86
- "@cumulus/test-data": "21.3.1",
86
+ "@cumulus/test-data": "21.3.2-testlerna.0",
87
87
  "@types/uuid": "^8.0.0"
88
88
  },
89
- "gitHead": "ba5c9b04fa1181fecbb97149fb4c01a92000ebb4"
89
+ "gitHead": "ef6577b6caec96a20df8ccff293a9436db32a482"
90
90
  }