@hestia-earth/pipeline-utils 0.9.5 → 0.9.6

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 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.9.6](https://gitlab.com/hestia-earth/hestia-pipeline-utils/compare/v0.9.5...v0.9.6) (2023-05-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **sns:** fix disable on s3 mode ([708623e](https://gitlab.com/hestia-earth/hestia-pipeline-utils/commit/708623e3e67cd7846b04ea33e00560badb5420ad))
11
+
5
12
  ### [0.9.5](https://gitlab.com/hestia-earth/hestia-pipeline-utils/compare/v0.9.4...v0.9.5) (2023-05-18)
6
13
 
7
14
 
package/dist/lambda.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import * as AWS from 'aws-sdk';
2
1
  import { IFunctionParam } from './s3';
3
- export declare const invoke: (functionName: string, params: IFunctionParam) => import("rxjs").Observable<import("aws-sdk/lib/request").PromiseResult<AWS.Lambda.InvocationResponse, AWS.AWSError>>;
2
+ export declare const invoke: (functionName: string, params: IFunctionParam) => import("rxjs").Observable<any>;
package/dist/lambda.js CHANGED
@@ -5,14 +5,17 @@ const AWS = require("aws-sdk");
5
5
  const rxjs_1 = require("rxjs");
6
6
  const operators_1 = require("rxjs/operators");
7
7
  const log_1 = require("./log");
8
- const invoke = (functionName, params) => (0, rxjs_1.from)(new AWS.Lambda().invoke({
9
- FunctionName: functionName,
10
- InvocationType: 'Event',
11
- LogType: 'None',
12
- Payload: JSON.stringify(params)
13
- }).promise()).pipe((0, operators_1.take)(1), (0, operators_1.map)(res => {
14
- (0, log_1.debug)(`invoke ${functionName}`, res);
15
- return res;
16
- }));
8
+ const s3_1 = require("./s3");
9
+ const invoke = (functionName, params) => s3_1.isS3Mode
10
+ ? (0, rxjs_1.from)(new AWS.Lambda().invoke({
11
+ FunctionName: functionName,
12
+ InvocationType: 'Event',
13
+ LogType: 'None',
14
+ Payload: JSON.stringify(params)
15
+ }).promise()).pipe((0, operators_1.take)(1), (0, operators_1.map)(res => {
16
+ (0, log_1.debug)(`invoke ${functionName}`, res);
17
+ return res;
18
+ }))
19
+ : (0, rxjs_1.of)(null);
17
20
  exports.invoke = invoke;
18
21
  //# sourceMappingURL=lambda.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lambda.js","sourceRoot":"","sources":["../src/lambda.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAA4B;AAC5B,8CAA2C;AAE3C,+BAA8B;AAGvB,MAAM,MAAM,GAAG,CAAC,YAAoB,EAAE,MAAsB,EAAE,EAAE,CACrE,IAAA,WAAI,EACF,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY;IAC1B,cAAc,EAAE,OAAO;IACvB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;CAChC,CAAC,CAAC,OAAO,EAAE,CACb,CAAC,IAAI,CACJ,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,GAAG,CAAC,EAAE;IACR,IAAA,WAAK,EAAC,UAAU,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,CACH,CAAC;AAdS,QAAA,MAAM,UAcf"}
1
+ {"version":3,"file":"lambda.js","sourceRoot":"","sources":["../src/lambda.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAgC;AAChC,8CAA2C;AAE3C,+BAA8B;AAC9B,6BAAgD;AAEzC,MAAM,MAAM,GAAG,CAAC,YAAoB,EAAE,MAAsB,EAAE,EAAE,CAAC,aAAQ;IAC9E,CAAC,CAAC,IAAA,WAAI,EACJ,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC;QACtB,YAAY,EAAE,YAAY;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;KAChC,CAAC,CAAC,OAAO,EAAE,CACb,CAAC,IAAI,CACJ,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,GAAG,CAAC,EAAE;QACR,IAAA,WAAK,EAAC,UAAU,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CACH;IACD,CAAC,CAAC,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;AAfA,QAAA,MAAM,UAeN"}
package/dist/sns.js CHANGED
@@ -7,8 +7,7 @@ const operators_1 = require("rxjs/operators");
7
7
  const log_1 = require("./log");
8
8
  const s3_1 = require("./s3");
9
9
  const publish = (functionName, params, topicArn = process.env.SNS_TOPIC) => s3_1.isS3Mode
10
- ? (0, rxjs_1.of)(null)
11
- : (0, rxjs_1.from)(new AWS.SNS().publish({
10
+ ? (0, rxjs_1.from)(new AWS.SNS().publish({
12
11
  TopicArn: topicArn,
13
12
  Message: JSON.stringify(params),
14
13
  MessageAttributes: {
@@ -20,6 +19,7 @@ const publish = (functionName, params, topicArn = process.env.SNS_TOPIC) => s3_1
20
19
  }).promise()).pipe((0, operators_1.take)(1), (0, operators_1.map)(res => {
21
20
  (0, log_1.debug)(`publish ${functionName}`, res);
22
21
  return res;
23
- }));
22
+ }))
23
+ : (0, rxjs_1.of)(null);
24
24
  exports.publish = publish;
25
25
  //# sourceMappingURL=sns.js.map
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;AAEzC,MAAM,OAAO,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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,WAAW,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;QACtC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CACH;IACD,CAAC,CAAC,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;AAnBA,QAAA,OAAO,WAmBP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/pipeline-utils",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Utilities for running pipelines",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
package/src/lambda.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as AWS from 'aws-sdk';
2
- import { from } from 'rxjs';
2
+ import { from, of } from 'rxjs';
3
3
  import { take, map } from 'rxjs/operators';
4
4
 
5
5
  import { debug } from './log';
6
- import { IFunctionParam } from './s3';
6
+ import { IFunctionParam, isS3Mode } from './s3';
7
7
 
8
- export const invoke = (functionName: string, params: IFunctionParam) =>
9
- from(
8
+ export const invoke = (functionName: string, params: IFunctionParam) => isS3Mode
9
+ ? from(
10
10
  new AWS.Lambda().invoke({
11
11
  FunctionName: functionName,
12
12
  InvocationType: 'Event',
@@ -19,4 +19,5 @@ export const invoke = (functionName: string, params: IFunctionParam) =>
19
19
  debug(`invoke ${functionName}`, res);
20
20
  return res;
21
21
  })
22
- );
22
+ )
23
+ : of(null);
package/src/sns.ts CHANGED
@@ -6,8 +6,7 @@ import { debug } from './log';
6
6
  import { IFunctionParam, isS3Mode } from './s3';
7
7
 
8
8
  export const publish = (functionName: string, params: IFunctionParam, topicArn = process.env.SNS_TOPIC) => isS3Mode
9
- ? of(null)
10
- : from(
9
+ ? from(
11
10
  new AWS.SNS().publish({
12
11
  TopicArn: topicArn,
13
12
  Message: JSON.stringify(params),
@@ -24,4 +23,5 @@ export const publish = (functionName: string, params: IFunctionParam, topicArn =
24
23
  debug(`publish ${functionName}`, res);
25
24
  return res;
26
25
  })
27
- );
26
+ )
27
+ : of(null);