@hestia-earth/pipeline-utils 0.10.1 → 0.10.2
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/CHANGELOG.md +7 -0
- package/dist/sns.d.ts +5 -1
- package/dist/sns.js +9 -2
- package/dist/sns.js.map +1 -1
- package/dist/sqs.d.ts +5 -1
- package/dist/sqs.js +9 -2
- package/dist/sqs.js.map +1 -1
- package/package.json +1 -1
- package/src/sns.ts +15 -2
- package/src/sqs.ts +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.10.2](https://gitlab.com/hestia-earth/hestia-pipeline-utils/compare/v0.10.1...v0.10.2) (2023-06-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add extra attributes to SNS and SQS ([e981692](https://gitlab.com/hestia-earth/hestia-pipeline-utils/commit/e98169230a9c41ac8a2ad85104275f3c8913dc0c))
|
|
11
|
+
|
|
5
12
|
### [0.10.1](https://gitlab.com/hestia-earth/hestia-pipeline-utils/compare/v0.10.0...v0.10.1) (2023-06-08)
|
|
6
13
|
|
|
7
14
|
|
package/dist/sns.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { IFunctionParam } from './s3';
|
|
2
|
-
|
|
2
|
+
declare type attributes = {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const publish: (functionName: string, params: IFunctionParam, topicArn?: string, extras?: attributes) => import("rxjs").Observable<any>;
|
|
6
|
+
export {};
|
package/dist/sns.js
CHANGED
|
@@ -6,7 +6,7 @@ const rxjs_1 = require("rxjs");
|
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
7
7
|
const log_1 = require("./log");
|
|
8
8
|
const s3_1 = require("./s3");
|
|
9
|
-
const publish = (functionName, params, topicArn = process.env.SNS_TOPIC) => s3_1.isS3Mode
|
|
9
|
+
const publish = (functionName, params, topicArn = process.env.SNS_TOPIC, extras = {}) => s3_1.isS3Mode
|
|
10
10
|
? (0, rxjs_1.from)(new AWS.SNS().publish({
|
|
11
11
|
TopicArn: topicArn,
|
|
12
12
|
Message: JSON.stringify(params),
|
|
@@ -14,7 +14,14 @@ const publish = (functionName, params, topicArn = process.env.SNS_TOPIC) => s3_1
|
|
|
14
14
|
functionName: {
|
|
15
15
|
DataType: 'String',
|
|
16
16
|
StringValue: functionName
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
...(Object.fromEntries(Object.entries(extras || {}).map(([key, value]) => [
|
|
19
|
+
key,
|
|
20
|
+
{
|
|
21
|
+
DataType: 'String',
|
|
22
|
+
StringValue: value
|
|
23
|
+
}
|
|
24
|
+
])))
|
|
18
25
|
}
|
|
19
26
|
}).promise()).pipe((0, operators_1.take)(1), (0, operators_1.map)(res => {
|
|
20
27
|
(0, log_1.debug)(`SNS publish ${functionName}`, res);
|
package/dist/sns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sns.js","sourceRoot":"","sources":["../src/sns.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAgC;AAChC,8CAA2C;AAE3C,+BAA8B;AAC9B,6BAAgD;
|
|
1
|
+
{"version":3,"file":"sns.js","sourceRoot":"","sources":["../src/sns.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAgC;AAChC,8CAA2C;AAE3C,+BAA8B;AAC9B,6BAAgD;AAMzC,MAAM,OAAO,GAAG,CACrB,YAAoB,EAAE,MAAsB,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,SAAqB,EAAE,EACvG,EAAE,CAAC,aAAQ;IACX,CAAC,CAAC,IAAA,WAAI,EACJ,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;QACpB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/B,iBAAiB,EAAE;YACjB,YAAY,EAAE;gBACZ,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,YAAY;aAC1B;YACD,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;gBACxE,GAAG;gBACH;oBACE,QAAQ,EAAE,QAAQ;oBAClB,WAAW,EAAE,KAAK;iBACnB;aACF,CAAC,CAAC,CAAC;SACL;KACF,CAAC,CAAC,OAAO,EAAE,CACb,CAAC,IAAI,CACJ,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,GAAG,CAAC,EAAE;QACR,IAAA,WAAK,EAAC,eAAe,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CACH;IACD,CAAC,CAAC,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;AA5BA,QAAA,OAAO,WA4BP"}
|
package/dist/sqs.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { IFunctionParam } from './s3';
|
|
2
|
-
|
|
2
|
+
declare type attributes = {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const sendMessage: (functionName: string, params: IFunctionParam, queueUrl?: string, extras?: attributes) => import("rxjs").Observable<any>;
|
|
6
|
+
export {};
|
package/dist/sqs.js
CHANGED
|
@@ -6,7 +6,7 @@ const rxjs_1 = require("rxjs");
|
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
7
7
|
const log_1 = require("./log");
|
|
8
8
|
const s3_1 = require("./s3");
|
|
9
|
-
const sendMessage = (functionName, params, queueUrl = process.env.SQS_URL) => s3_1.isS3Mode
|
|
9
|
+
const sendMessage = (functionName, params, queueUrl = process.env.SQS_URL, extras = {}) => s3_1.isS3Mode
|
|
10
10
|
? (0, rxjs_1.from)(new AWS.SQS({ region: s3_1.region }).sendMessage({
|
|
11
11
|
QueueUrl: queueUrl,
|
|
12
12
|
MessageBody: JSON.stringify(params),
|
|
@@ -14,7 +14,14 @@ const sendMessage = (functionName, params, queueUrl = process.env.SQS_URL) => s3
|
|
|
14
14
|
functionName: {
|
|
15
15
|
DataType: 'String',
|
|
16
16
|
StringValue: functionName
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
...(Object.fromEntries(Object.entries(extras || {}).map(([key, value]) => [
|
|
19
|
+
key,
|
|
20
|
+
{
|
|
21
|
+
DataType: 'String',
|
|
22
|
+
StringValue: value
|
|
23
|
+
}
|
|
24
|
+
])))
|
|
18
25
|
}
|
|
19
26
|
}).promise()).pipe((0, operators_1.take)(1), (0, operators_1.map)(res => {
|
|
20
27
|
(0, log_1.debug)(`SQS send message ${functionName}`, res);
|
package/dist/sqs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../src/sqs.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAgC;AAChC,8CAA2C;AAE3C,+BAA8B;AAC9B,6BAAwD;
|
|
1
|
+
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../src/sqs.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAgC;AAChC,8CAA2C;AAE3C,+BAA8B;AAC9B,6BAAwD;AAMjD,MAAM,WAAW,GAAG,CACzB,YAAoB,EAAE,MAAsB,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,SAAqB,EAAE,EACrG,EAAE,CAAC,aAAQ;IACX,CAAC,CAAC,IAAA,WAAI,EACJ,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAN,WAAM,EAAE,CAAC,CAAC,WAAW,CAAC;QAClC,QAAQ,EAAE,QAAQ;QAClB,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QACnC,iBAAiB,EAAE;YACjB,YAAY,EAAE;gBACZ,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,YAAY;aAC1B;YACD,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;gBACxE,GAAG;gBACH;oBACE,QAAQ,EAAE,QAAQ;oBAClB,WAAW,EAAE,KAAK;iBACnB;aACF,CAAC,CAAC,CAAC;SACL;KACF,CAAC,CAAC,OAAO,EAAE,CACb,CAAC,IAAI,CACJ,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,GAAG,CAAC,EAAE;QACR,IAAA,WAAK,EAAC,oBAAoB,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/C,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CACH;IACD,CAAC,CAAC,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;AA5BA,QAAA,WAAW,eA4BX"}
|
package/package.json
CHANGED
package/src/sns.ts
CHANGED
|
@@ -5,7 +5,13 @@ import { take, map } from 'rxjs/operators';
|
|
|
5
5
|
import { debug } from './log';
|
|
6
6
|
import { IFunctionParam, isS3Mode } from './s3';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
type attributes = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const publish = (
|
|
13
|
+
functionName: string, params: IFunctionParam, topicArn = process.env.SNS_TOPIC, extras: attributes = {}
|
|
14
|
+
) => isS3Mode
|
|
9
15
|
? from(
|
|
10
16
|
new AWS.SNS().publish({
|
|
11
17
|
TopicArn: topicArn,
|
|
@@ -14,7 +20,14 @@ export const publish = (functionName: string, params: IFunctionParam, topicArn =
|
|
|
14
20
|
functionName: {
|
|
15
21
|
DataType: 'String',
|
|
16
22
|
StringValue: functionName
|
|
17
|
-
}
|
|
23
|
+
},
|
|
24
|
+
...(Object.fromEntries(Object.entries(extras || {}).map(([key, value]) => [
|
|
25
|
+
key,
|
|
26
|
+
{
|
|
27
|
+
DataType: 'String',
|
|
28
|
+
StringValue: value
|
|
29
|
+
}
|
|
30
|
+
])))
|
|
18
31
|
}
|
|
19
32
|
}).promise()
|
|
20
33
|
).pipe(
|
package/src/sqs.ts
CHANGED
|
@@ -5,7 +5,13 @@ import { take, map } from 'rxjs/operators';
|
|
|
5
5
|
import { debug } from './log';
|
|
6
6
|
import { IFunctionParam, isS3Mode, region } from './s3';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
type attributes = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const sendMessage = (
|
|
13
|
+
functionName: string, params: IFunctionParam, queueUrl = process.env.SQS_URL, extras: attributes = {}
|
|
14
|
+
) => isS3Mode
|
|
9
15
|
? from(
|
|
10
16
|
new AWS.SQS({ region }).sendMessage({
|
|
11
17
|
QueueUrl: queueUrl,
|
|
@@ -14,7 +20,14 @@ export const sendMessage = (functionName: string, params: IFunctionParam, queueU
|
|
|
14
20
|
functionName: {
|
|
15
21
|
DataType: 'String',
|
|
16
22
|
StringValue: functionName
|
|
17
|
-
}
|
|
23
|
+
},
|
|
24
|
+
...(Object.fromEntries(Object.entries(extras || {}).map(([key, value]) => [
|
|
25
|
+
key,
|
|
26
|
+
{
|
|
27
|
+
DataType: 'String',
|
|
28
|
+
StringValue: value
|
|
29
|
+
}
|
|
30
|
+
])))
|
|
18
31
|
}
|
|
19
32
|
}).promise()
|
|
20
33
|
).pipe(
|