@pisell/core 1.0.55 → 1.0.56

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.
@@ -634,6 +634,7 @@ var IndexDBManager = /*#__PURE__*/function () {
634
634
  // })
635
635
  }
636
636
  return _context10.abrupt("return", this.withTimeout(_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
637
+ var issExists;
637
638
  return _regeneratorRuntime().wrap(function _callee7$(_context9) {
638
639
  while (1) switch (_context9.prev = _context9.next) {
639
640
  case 0:
@@ -657,25 +658,13 @@ var IndexDBManager = /*#__PURE__*/function () {
657
658
  _context9.next = 6;
658
659
  return _this8.db.table(storeName).add(data);
659
660
  case 6:
660
- if (log) {
661
- // this.app.logger.addLog({
662
- // type: 'info',
663
- // title: uuid,
664
- // metadata: { msg: '添加数据成功' }
665
- // });
666
- console.log('✅ 添加事务完成');
667
- // this.app.logger.addLog({
668
- // type: 'info',
669
- // title: uuid,
670
- // metadata: { msg: '事务完成' }
671
- // });
672
- }
673
661
  return _context9.abrupt("return", data);
674
- case 10:
675
- _context9.prev = 10;
662
+ case 9:
663
+ _context9.prev = 9;
676
664
  _context9.t0 = _context9["catch"](3);
665
+ issExists = ((_context9.t0 === null || _context9.t0 === void 0 ? void 0 : _context9.t0.message) || '').includes('exists'); // 如果错误信息中包含 'exists',则表示数据已存在,不报日志
677
666
  _this8.app.logger.addLog({
678
- type: 'error',
667
+ type: issExists ? 'info' : 'error',
679
668
  title: uuid,
680
669
  metadata: {
681
670
  msg: '添加数据失败',
@@ -688,7 +677,7 @@ var IndexDBManager = /*#__PURE__*/function () {
688
677
  case "end":
689
678
  return _context9.stop();
690
679
  }
691
- }, _callee7, null, [[3, 10]]);
680
+ }, _callee7, null, [[3, 9]]);
692
681
  }))(), "add(".concat(storeName, ")")));
693
682
  case 11:
694
683
  case "end":
@@ -367,13 +367,11 @@ var IndexDBManager = class _IndexDBManager {
367
367
  }
368
368
  try {
369
369
  await this.db.table(storeName).add(data);
370
- if (log) {
371
- console.log("✅ 添加事务完成");
372
- }
373
370
  return data;
374
371
  } catch (error) {
372
+ const issExists = ((error == null ? void 0 : error.message) || "").includes("exists");
375
373
  this.app.logger.addLog({
376
- type: "error",
374
+ type: issExists ? "info" : "error",
377
375
  title: uuid,
378
376
  metadata: {
379
377
  msg: "添加数据失败",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/core",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "sideEffects": false,
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",