ag-common 0.0.311 → 0.0.314

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.
@@ -42,7 +42,7 @@ const putDynamo = (item, tableName) => __awaiter(void 0, void 0, void 0, functio
42
42
  return { data: item };
43
43
  });
44
44
  exports.putDynamo = putDynamo;
45
- let batchWriteRaw = (req, debugMsg) => __awaiter(void 0, void 0, void 0, function* () {
45
+ let batchWriteRaw = (req) => __awaiter(void 0, void 0, void 0, function* () {
46
46
  let count = 0;
47
47
  let max = 5;
48
48
  // eslint-disable-next-line no-constant-condition
@@ -58,20 +58,20 @@ let batchWriteRaw = (req, debugMsg) => __awaiter(void 0, void 0, void 0, functio
58
58
  catch (e) {
59
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
60
  let es = e.toString();
61
+ let msg = es;
62
+ (0, log_1.warn)('dynamo write error', msg);
61
63
  if (es.indexOf('429') !== -1 ||
62
64
  es.indexOf('ProvisionedThroughputExceeded') !== -1) {
63
65
  count += 1;
66
+ msg = `batch write throttled. retry ${count}/${max}`;
64
67
  }
65
- if (count >= max) {
68
+ else {
66
69
  throw e;
67
70
  }
68
- let msg = `batch write throttled. retry ${count}/${max}`;
69
- if (!debugMsg) {
70
- (0, log_1.info)(msg);
71
- }
72
- else {
73
- debugMsg(msg);
71
+ if (count >= max) {
72
+ throw e;
74
73
  }
74
+ (0, log_1.warn)(`dynamo retry ${count}/${max}`);
75
75
  yield (0, sleep_1.sleep)(2000);
76
76
  }
77
77
  });
@@ -90,7 +90,7 @@ const batchWrite = (tableName, itemsIn, breakOnError = false) => __awaiter(void
90
90
  PutRequest: { Item: item },
91
91
  })),
92
92
  };
93
- let res = yield batchWriteRaw(req, (m) => (0, log_1.info)(`${m} remaining=${rest.length}`));
93
+ let res = yield batchWriteRaw(req);
94
94
  const newError = (_b = (_a = res.$response) === null || _a === void 0 ? void 0 : _a.error) !== null && _b !== void 0 ? _b : null;
95
95
  if (newError) {
96
96
  error.push(newError);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.311",
3
+ "version": "0.0.314",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",
@@ -42,22 +42,12 @@
42
42
  "@storybook/react": "6.5.10",
43
43
  "@storybook/theming": "6.5.10",
44
44
  "@types/jsonwebtoken": "8.5.8",
45
- "@types/node": "18.7.1",
45
+ "@types/node": "18.7.5",
46
46
  "@types/react": "18.0.17",
47
47
  "@types/react-dom": "18.0.6",
48
48
  "@types/styled-components": "5.1.26",
49
- "@typescript-eslint/eslint-plugin": "5.33.0",
50
- "@typescript-eslint/parser": "5.33.0",
51
49
  "cross-env": "7.0.3",
52
- "eslint": "8.21.0",
53
- "eslint-config-airbnb-typescript": "17.0.0",
54
- "eslint-config-prettier": "8.5.0",
55
- "eslint-plugin-import": "2.26.0",
56
- "eslint-plugin-jsx-a11y": "6.6.1",
57
- "eslint-plugin-prettier": "4.2.1",
58
- "eslint-plugin-react": "7.30.1",
59
- "eslint-plugin-react-hooks": "4.6.0",
60
- "prettier": "2.7.1",
50
+ "eslint-config-e7npm": "0.0.5",
61
51
  "rimraf": "3.0.2",
62
52
  "styled-components": "5.3.5"
63
53
  },