abler-api 0.1.36 → 0.1.37

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.
@@ -689,7 +689,7 @@ class apiUtil$2 {
689
689
  static createApiCallRec(tokenData, req) {
690
690
  if (!req.apiCallRec) {
691
691
  if (req.apiCallRecId) {
692
- return dbQueryOne(dbSql.loadApiUsage, {
692
+ return dbUtil.dbQueryOne(dbSql.loadApiUsage, {
693
693
  replacements: {
694
694
  id: req.apiCallRecId
695
695
  }
@@ -698,10 +698,10 @@ class apiUtil$2 {
698
698
  return req.apiCallRec;
699
699
  });
700
700
  } else {
701
- let params = extractParams(req); // let contentLength = parseInt(req.headers["content-length"]) || 0;
701
+ let params = this.extractParams(req); // let contentLength = parseInt(req.headers["content-length"]) || 0;
702
702
 
703
703
  let rec = {
704
- id: newGuid(),
704
+ id: ppUtil$4.newGuid(),
705
705
  companyId: tokenData.apiKey || '',
706
706
  orderId: params.orderId || '',
707
707
  signerId: params.signerId || '',
@@ -736,6 +736,24 @@ class apiUtil$2 {
736
736
  }
737
737
 
738
738
  return req.apiCallRec;
739
+
740
+ function _getBodyLogStr(req) {
741
+ let contentLength = parseInt(req.headers["content-length"]) || 0;
742
+ if (contentLength < 500) return req.rawBody || '';
743
+ let tempBody = {};
744
+
745
+ for (let key in req.body) {
746
+ let value = req.body[key];
747
+
748
+ if (typeof value == 'string' && value.length > 500) {
749
+ value = value.substring(0, 31) + '...(' + value.length + ')';
750
+ }
751
+
752
+ tempBody[key] = value;
753
+ }
754
+
755
+ return JSON.stringify(tempBody);
756
+ }
739
757
  }
740
758
  /**
741
759
  * 查询机构信息
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
- "module": "./dist/es/pp-util.js",
6
+ "-module": "./dist/es/pp-util.js",
7
7
  "scripts": {
8
8
  "build": "npx rollup -c rollup.config.js",
9
9
  "test": "echo \"Error: no test specified\" && exit 1"