@larksuiteoapi/node-sdk 1.40.0 → 1.40.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.
- package/es/index.js +13 -1
- package/lib/index.js +17 -6
- package/package.json +1 -2
package/es/index.js
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import get from 'lodash.get';
|
|
14
14
|
import axios, { AxiosError } from 'axios';
|
|
15
15
|
import crypto from 'crypto';
|
|
16
|
-
import pick from 'lodash.pick';
|
|
17
16
|
import { stringify } from 'qs';
|
|
18
17
|
import identity from 'lodash.identity';
|
|
19
18
|
import pickBy from 'lodash.pickby';
|
|
@@ -219,6 +218,19 @@ const assert = (predication, callback) => __awaiter(void 0, void 0, void 0, func
|
|
|
219
218
|
|
|
220
219
|
const formatUrl = (url) => (url ? url.replace(/^\//, '') : '');
|
|
221
220
|
|
|
221
|
+
const pick = (obj, keys = []) => {
|
|
222
|
+
const result = {};
|
|
223
|
+
if (!obj) {
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
keys.forEach(key => {
|
|
227
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
228
|
+
result[key] = obj[key];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return result;
|
|
232
|
+
};
|
|
233
|
+
|
|
222
234
|
const formatErrors = (e) => {
|
|
223
235
|
if (e instanceof AxiosError) {
|
|
224
236
|
const { message, response, request, config } = pick(e, [
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
17
17
|
var get = require('lodash.get');
|
|
18
18
|
var axios = require('axios');
|
|
19
19
|
var crypto = require('crypto');
|
|
20
|
-
var pick = require('lodash.pick');
|
|
21
20
|
var qs = require('qs');
|
|
22
21
|
var identity = require('lodash.identity');
|
|
23
22
|
var pickBy = require('lodash.pickby');
|
|
@@ -31,7 +30,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
31
30
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
32
31
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
33
32
|
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
34
|
-
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
35
33
|
var identity__default = /*#__PURE__*/_interopDefaultLegacy(identity);
|
|
36
34
|
var pickBy__default = /*#__PURE__*/_interopDefaultLegacy(pickBy);
|
|
37
35
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
@@ -236,9 +234,22 @@ const assert = (predication, callback) => __awaiter(void 0, void 0, void 0, func
|
|
|
236
234
|
|
|
237
235
|
const formatUrl = (url) => (url ? url.replace(/^\//, '') : '');
|
|
238
236
|
|
|
237
|
+
const pick = (obj, keys = []) => {
|
|
238
|
+
const result = {};
|
|
239
|
+
if (!obj) {
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
keys.forEach(key => {
|
|
243
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
244
|
+
result[key] = obj[key];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return result;
|
|
248
|
+
};
|
|
249
|
+
|
|
239
250
|
const formatErrors = (e) => {
|
|
240
251
|
if (e instanceof axios.AxiosError) {
|
|
241
|
-
const { message, response, request, config } =
|
|
252
|
+
const { message, response, request, config } = pick(e, [
|
|
242
253
|
'message',
|
|
243
254
|
'response',
|
|
244
255
|
'request',
|
|
@@ -246,9 +257,9 @@ const formatErrors = (e) => {
|
|
|
246
257
|
]);
|
|
247
258
|
const filteredErrorInfo = {
|
|
248
259
|
message,
|
|
249
|
-
config:
|
|
250
|
-
request:
|
|
251
|
-
response:
|
|
260
|
+
config: pick(config, ['data', 'url', 'params', 'method']),
|
|
261
|
+
request: pick(request, ['protocol', 'host', 'path', 'method']),
|
|
262
|
+
response: pick(response, ['data', 'status', 'statusText']),
|
|
252
263
|
};
|
|
253
264
|
const errors = [filteredErrorInfo];
|
|
254
265
|
const specificError = get__default["default"](e, 'response.data');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larksuiteoapi/node-sdk",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.1",
|
|
4
4
|
"description": "larksuite open sdk for nodejs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"feishu",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"lodash.get": "^4.4.2",
|
|
34
34
|
"lodash.identity": "^3.0.0",
|
|
35
35
|
"lodash.merge": "^4.6.2",
|
|
36
|
-
"lodash.pick": "^4.4.0",
|
|
37
36
|
"lodash.pickby": "^4.6.0",
|
|
38
37
|
"protobufjs": "^7.2.6",
|
|
39
38
|
"qs": "^6.13.0",
|