@hestia-earth/pipeline-utils 0.15.5 → 0.16.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/ec2.d.ts +1 -1
- package/dist/ec2.js +3 -6
- package/dist/ec2.js.map +1 -1
- package/dist/find-nodes.js +5 -6
- package/dist/find-nodes.js.map +1 -1
- package/dist/lambda.d.ts +1 -1
- package/dist/lambda.js +5 -7
- package/dist/lambda.js.map +1 -1
- package/dist/progress.d.ts +2 -2
- package/dist/progress.js +3 -4
- package/dist/progress.js.map +1 -1
- package/dist/s3.d.ts +16 -15
- package/dist/s3.js +94 -68
- package/dist/s3.js.map +1 -1
- package/dist/sns.d.ts +1 -1
- package/dist/sns.js +4 -7
- package/dist/sns.js.map +1 -1
- package/dist/sqs.d.ts +2 -2
- package/dist/sqs.js +3 -6
- package/dist/sqs.js.map +1 -1
- package/dist/write-json-stream.d.ts +1 -1
- package/dist/write-json-stream.js +1 -1
- package/dist/write-json-stream.js.map +1 -1
- package/jest.setup.js +15 -0
- package/package.json +16 -14
- package/src/ec2.ts +5 -6
- package/src/find-nodes.ts +1 -2
- package/src/lambda.ts +7 -7
- package/src/progress.ts +1 -2
- package/src/s3.ts +147 -104
- package/src/sns.ts +5 -6
- package/src/sqs.ts +6 -7
- package/src/write-json-stream.ts +2 -2
package/src/sns.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { from, of, throwError } from 'rxjs';
|
|
3
|
-
import { take, map, catchError } from 'rxjs/operators';
|
|
1
|
+
import { SNSClient, PublishCommand } from '@aws-sdk/client-sns';
|
|
2
|
+
import { from, of, throwError, take, map, catchError } from 'rxjs';
|
|
4
3
|
|
|
5
4
|
import { error, info } from './log';
|
|
6
5
|
import { IFunctionParam, isS3Mode } from './s3';
|
|
@@ -18,8 +17,8 @@ export const publishSnsMessage = (
|
|
|
18
17
|
) =>
|
|
19
18
|
isS3Mode
|
|
20
19
|
? from(
|
|
21
|
-
new
|
|
22
|
-
|
|
20
|
+
new SNSClient({}).send(
|
|
21
|
+
new PublishCommand({
|
|
23
22
|
TopicArn: topicArn,
|
|
24
23
|
Message: JSON.stringify(params),
|
|
25
24
|
MessageAttributes: {
|
|
@@ -38,7 +37,7 @@ export const publishSnsMessage = (
|
|
|
38
37
|
)
|
|
39
38
|
}
|
|
40
39
|
})
|
|
41
|
-
|
|
40
|
+
)
|
|
42
41
|
).pipe(
|
|
43
42
|
take(1),
|
|
44
43
|
map(res => {
|
package/src/sqs.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { from, of } from 'rxjs';
|
|
3
|
-
import { take, map } from 'rxjs/operators';
|
|
1
|
+
import { SQSClient, SendMessageCommand, SendMessageCommandInput } from '@aws-sdk/client-sqs';
|
|
2
|
+
import { from, of, take, map } from 'rxjs';
|
|
4
3
|
|
|
5
4
|
import { info } from './log';
|
|
6
5
|
import { IFunctionParam, isS3Mode, region } from './s3';
|
|
@@ -14,12 +13,12 @@ export const sendSqsMessage = (
|
|
|
14
13
|
params: IFunctionParam | Record<string, any>,
|
|
15
14
|
queueUrl = process.env.SQS_URL,
|
|
16
15
|
extras: attributes = {},
|
|
17
|
-
requestParams: Partial<Omit<
|
|
16
|
+
requestParams: Partial<Omit<SendMessageCommandInput, 'QueueUrl' | 'MessageBody' | 'MessageAttributes'>> = {}
|
|
18
17
|
) =>
|
|
19
18
|
isS3Mode
|
|
20
19
|
? from(
|
|
21
|
-
new
|
|
22
|
-
|
|
20
|
+
new SQSClient({ region }).send(
|
|
21
|
+
new SendMessageCommand({
|
|
23
22
|
QueueUrl: queueUrl,
|
|
24
23
|
MessageBody: JSON.stringify(params),
|
|
25
24
|
MessageAttributes: {
|
|
@@ -39,7 +38,7 @@ export const sendSqsMessage = (
|
|
|
39
38
|
},
|
|
40
39
|
...requestParams
|
|
41
40
|
})
|
|
42
|
-
|
|
41
|
+
)
|
|
43
42
|
).pipe(
|
|
44
43
|
take(1),
|
|
45
44
|
map(res => {
|
package/src/write-json-stream.ts
CHANGED
|
@@ -39,9 +39,9 @@ const stringify = (writeStream: WriteStream, data: any) =>
|
|
|
39
39
|
: writeStream.write(JSON.stringify(data), encoding);
|
|
40
40
|
|
|
41
41
|
export const streamJSONToFile = (filepath: string, data: Record<string, any>) =>
|
|
42
|
-
new Promise((resolve, reject) => {
|
|
42
|
+
new Promise<void>((resolve, reject) => {
|
|
43
43
|
const writeStream = createWriteStream(filepath);
|
|
44
|
-
writeStream.on('finish', resolve);
|
|
44
|
+
writeStream.on('finish', () => resolve());
|
|
45
45
|
writeStream.on('error', reject);
|
|
46
46
|
stringify(writeStream, data);
|
|
47
47
|
writeStream.end();
|