notification-processor 6.0.1 → 6.0.3

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
@@ -1,3 +1,17 @@
1
+ ## [6.0.3](https://github.com/Parsimotion/notification-processor/compare/v6.0.2...v6.0.3) (2025-09-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * avoid retry on 401 ([f4e027f](https://github.com/Parsimotion/notification-processor/commit/f4e027f78be81d242d9b53860b2d67304636983f))
7
+
8
+ ## [6.0.2](https://github.com/Parsimotion/notification-processor/compare/v6.0.1...v6.0.2) (2025-09-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * enter en max retry ([2c08986](https://github.com/Parsimotion/notification-processor/commit/2c089862dff18a8b146b01a9e18f0eb13519dd1c))
14
+
1
15
  ## [6.0.1](https://github.com/Parsimotion/notification-processor/compare/v6.0.0...v6.0.1) (2025-09-09)
2
16
 
3
17
 
@@ -23,26 +23,26 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
23
23
  this._onIgnoredError_ = this._onIgnoredError_.bind(this);
24
24
  this.processor = processor;
25
25
  this.maxRetries = maxRetries;
26
- ({
27
- process: function process(notification, context, executionId) {
28
- var _this = this;
29
-
30
- return this.processor(notification, context, executionId).tap(function (it) {
31
- return _this._onSuccess_(notification, it);
32
- }).catch(function (err) {
33
- if (_this._isIgnoredError_(err)) {
34
- return _this._onIgnoredError_(notification, err);
35
- }
36
- if (_this._shouldRetry_(notification, err)) {
37
- throw _this._sanitizeError_(err);
38
- }
39
- return _this._onMaxRetryExceeded_(notification, err);
40
- });
41
- }
42
- });
43
26
  }
44
27
 
45
28
  _createClass(MaxRetriesProcessor, [{
29
+ key: "process",
30
+ value: function process(notification, context, executionId) {
31
+ var _this = this;
32
+
33
+ return this.processor(notification, context, executionId).tap(function (it) {
34
+ return _this._onSuccess_(notification, it);
35
+ }).catch(function (err) {
36
+ if (_this._isIgnoredError_(err)) {
37
+ return _this._onIgnoredError_(notification, err);
38
+ }
39
+ if (_this._shouldRetry_(notification, err)) {
40
+ throw _this._sanitizeError_(err);
41
+ }
42
+ return _this._onMaxRetryExceeded_(notification, err);
43
+ });
44
+ }
45
+ }, {
46
46
  key: "_shouldRetry_",
47
47
  value: function _shouldRetry_(_ref2, err) {
48
48
  var _ref2$meta$dequeueCou = _ref2.meta.dequeueCount,
@@ -35,6 +35,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
35
35
  this.getCompanyId = this.getCompanyId.bind(this);
36
36
  this._setInCache = this._setInCache.bind(this);
37
37
  this._translateUserId = this._translateUserId.bind(this);
38
+ this._fetchUser = this._fetchUser.bind(this);
38
39
  this.translatedCache = translatedCache;
39
40
  this.translate = this.translate.bind(this);
40
41
  }
@@ -75,17 +76,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
75
76
 
76
77
  console.log("Making request to translate", userId);
77
78
  return retry(function () {
78
- return request.get({
79
- url: MERCADOLIBRE_API_CORE_URL + "/users/me",
80
- json: true,
81
- qs: {
82
- authenticationType: "mercadolibre"
83
- },
84
- auth: {
85
- user: "" + userId,
86
- password: MERCADOLIBRE_API_MASTER_TOKEN
87
- }
88
- }).promise();
79
+ return _this._fetchUser(userId);
80
+ }, {
81
+ max_tries: 3,
82
+ throw_original: true,
83
+ predicate: function predicate(err) {
84
+ return err.statusCode !== 401;
85
+ }
89
86
  }).then(function (userInformation) {
90
87
  return {
91
88
  app: userInformation.app,
@@ -104,6 +101,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
104
101
  return _this._setInCache(userId, companyId);
105
102
  });
106
103
  }
104
+ }, {
105
+ key: "_fetchUser",
106
+ value: function _fetchUser(userId) {
107
+ return request.get({
108
+ url: MERCADOLIBRE_API_CORE_URL + "/users/me",
109
+ json: true,
110
+ qs: {
111
+ authenticationType: "mercadolibre"
112
+ },
113
+ auth: {
114
+ user: "" + userId,
115
+ password: MERCADOLIBRE_API_MASTER_TOKEN
116
+ }
117
+ }).promise();
118
+ }
107
119
  }]);
108
120
 
109
121
  return UserIdTranslator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notification-processor",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "description": "notification-processor",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,12 +31,13 @@
31
31
  },
32
32
  "husky": {
33
33
  "hooks": {
34
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
34
+ "commit-msg": "npx linterteca-commitlint --edit $1",
35
+ "pre-commit": "npx lint-staged",
36
+ "pre-push": "npx linterteca"
35
37
  }
36
38
  },
37
39
  "devDependencies": {
38
- "@commitlint/cli": "^11.0.0",
39
- "@commitlint/config-conventional": "^11.0.0",
40
+ "@producteca/linterteca": "^1.3.2",
40
41
  "babel-core": "^6.26.3",
41
42
  "babel-preset-env": "^1.7.0",
42
43
  "coffeescript": "^2.3.1",
@@ -63,5 +64,10 @@
63
64
  "bugs": {
64
65
  "url": "https://github.com/Parsimotion/notification-processor/issues"
65
66
  },
66
- "homepage": "https://github.com/Parsimotion/notification-processor#readme"
67
+ "homepage": "https://github.com/Parsimotion/notification-processor#readme",
68
+ "lint-staged": {
69
+ "*.{js,jsx}": [
70
+ "linterteca-lint"
71
+ ]
72
+ }
67
73
  }