notification-processor 4.10.0 → 4.11.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.
|
@@ -6,7 +6,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
6
6
|
|
|
7
7
|
// Generated by CoffeeScript 2.7.0
|
|
8
8
|
(function () {
|
|
9
|
-
var DEFAULT_NOTIFICATIONS_API_ASYNC_URL, HOUR, NOTIFICATIONS_API_JOBS_CACHE_TTL, NOTIFICATIONS_API_STOPPED_JOB_CACHE_TTL, NodeCache, NotificationsApi, Promise, _, jobsCache, requestPromise, retry, stoppedJobsCache;
|
|
9
|
+
var DEFAULT_NOTIFICATIONS_API_ASYNC_URL, HOUR, NOTIFICATIONS_API_JOBS_CACHE_TTL, NOTIFICATIONS_API_MASTER_TOKEN, NOTIFICATIONS_API_STOPPED_JOB_CACHE_TTL, NodeCache, NotificationsApi, Promise, _, jobsCache, requestPromise, retry, stoppedJobsCache;
|
|
10
10
|
|
|
11
11
|
_ = require("lodash");
|
|
12
12
|
|
|
@@ -22,6 +22,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
22
22
|
|
|
23
23
|
NOTIFICATIONS_API_STOPPED_JOB_CACHE_TTL = parseInt(process.env.NOTIFICATIONS_API_STOPPED_JOB_CACHE_TTL) || 2;
|
|
24
24
|
|
|
25
|
+
NOTIFICATIONS_API_MASTER_TOKEN = process.env.NOTIFICATIONS_API_MASTER_TOKEN;
|
|
26
|
+
|
|
25
27
|
DEFAULT_NOTIFICATIONS_API_ASYNC_URL = process.env.DEFAULT_NOTIFICATIONS_API_ASYNC_URL || "https://apps.producteca.com/aws/notifications-api-async";
|
|
26
28
|
|
|
27
29
|
HOUR = 60 * 60;
|
|
@@ -46,6 +48,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
46
48
|
|
|
47
49
|
_classCallCheck(this, NotificationsApi);
|
|
48
50
|
|
|
51
|
+
var companyId;
|
|
49
52
|
this.success = this.success.bind(this);
|
|
50
53
|
this.fail = this.fail.bind(this);
|
|
51
54
|
this.jobIsStopped = this.jobIsStopped.bind(this);
|
|
@@ -59,6 +62,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
59
62
|
this.token = token;
|
|
60
63
|
this.jobId = jobId;
|
|
61
64
|
this.notificationApiAsyncUrl = notificationApiAsyncUrl;
|
|
65
|
+
if (_.startsWith(this.token, 'Basic') && !_.isEmpty(NOTIFICATIONS_API_MASTER_TOKEN)) {
|
|
66
|
+
companyId = _.first(Buffer.from(_.get(this.token.split(" "), "1"), 'base64').toString().split(":"));
|
|
67
|
+
this.token = "Basic " + new Buffer(companyId + ":" + NOTIFICATIONS_API_MASTER_TOKEN).toString("base64");
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
_createClass(NotificationsApi, [{
|