notification-processor 4.18.2 → 4.19.1

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.
@@ -115,13 +115,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
115
115
  eventTimestamp = _ref3.eventTimestamp,
116
116
  parentEventId = _ref3.parentEventId,
117
117
  app = _ref3.app,
118
- job = _ref3.job;
118
+ job = _ref3.job,
119
+ partialMessage = _ref3.partialMessage;
119
120
 
120
- var now, theRequest;
121
+ var errorDescription, now, theRequest;
121
122
  if (!eventId) {
122
123
  return Promise.resolve({});
123
124
  }
124
125
  theRequest = _.get(err, "detail.request") || _.get(err, "cause.detail.request");
126
+ errorDescription = err && _(["cause.message", "message", "cause.type", "type"]).map(function (property) {
127
+ return _.get(err, property);
128
+ }).reject(_.isEmpty).get(0, "unknown");
125
129
  now = new Date();
126
130
  return {
127
131
  id: id,
@@ -146,15 +150,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
146
150
  app: _this3.app,
147
151
  error: _.omit(err, ["detail.request", "cause.detail.request"]),
148
152
  request: _.omit(theRequest, _.castArray(_this3.propertiesToOmit).concat("auth")),
149
- type: err && _.get(err, "type", "unknown"),
150
- tags: _.get(err, "tags", [])
153
+ type: errorDescription,
154
+ tags: _.get(err, "tags", []),
155
+ message: partialMessage || notification.message
151
156
  }),
152
157
  status: executionStatus,
153
158
  resource: resource,
154
159
  integration: _this3.app + "|" + (job || _this3.job),
155
160
  // Generic app fields
156
161
  event_timestamp: eventTimestamp || now.getTime(),
157
- output_message: _.get(err, "type"),
162
+ output_message: errorDescription,
158
163
  user_settings_version: null, //TODO
159
164
  env_version: null, //TODO
160
165
  code_version: null //TODO
@@ -111,7 +111,7 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = [
111
111
  name = _ref3$job.name,
112
112
  creationDate = _ref3$job.creationDate;
113
113
 
114
- var eventId, jobCreationDate, messageInsertionTime, ref, ref1, ref2;
114
+ var eventId, headersWithoutAuth, jobCreationDate, messageInsertionTime, ref, ref1, ref2;
115
115
  eventId = notification.message.JobId || _headerValue(notification.message.HeadersForRequest, "x-producteca-event-id", null) || _headerValue(notification.message.HeadersForRequest, "X-producteca-event-id", null) || (notification != null ? (ref = notification.meta) != null ? ref.messageId : void 0 : void 0) || uuid();
116
116
  if (creationDate) {
117
117
  jobCreationDate = new Date(creationDate).getTime();
@@ -119,6 +119,11 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = [
119
119
  if (notification != null ? (ref1 = notification.meta) != null ? ref1.insertionTime : void 0 : void 0) {
120
120
  messageInsertionTime = new Date(notification != null ? (ref2 = notification.meta) != null ? ref2.insertionTime : void 0 : void 0).getTime();
121
121
  }
122
+ headersWithoutAuth = _.reject(notification.message.HeadersForRequest, function (_ref4) {
123
+ var Key = _ref4.Key;
124
+
125
+ return (Key != null ? Key.toLowerCase() : void 0) === 'authorization';
126
+ });
122
127
  return Promise.props({
123
128
  eventType: 'http',
124
129
  resource: _this.resource(notification),
@@ -129,7 +134,10 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = [
129
134
  externalReference: null,
130
135
  eventId: eventId,
131
136
  eventTimestamp: jobCreationDate || messageInsertionTime,
132
- parentEventId: null
137
+ parentEventId: null,
138
+ partialMessage: _.assign({}, notification.message, {
139
+ HeadersForRequest: headersWithoutAuth
140
+ })
133
141
  });
134
142
  });
135
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notification-processor",
3
- "version": "4.18.2",
3
+ "version": "4.19.1",
4
4
  "description": "notification-processor",
5
5
  "main": "index.js",
6
6
  "scripts": {