@larksuiteoapi/node-sdk 1.56.1 → 1.57.0-beta.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 CHANGED
@@ -83983,16 +83983,17 @@ class Client extends Client$1 {
83983
83983
  const helpDeskCredential = string2Base64(`${this.helpDeskId}:${this.helpDeskToken}`);
83984
83984
  targetOptions.headers['X-Lark-Helpdesk-Authorization'] = `Bearer ${helpDeskCredential}`;
83985
83985
  }
83986
+ const payloadData = Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.data) || {})), targetOptions.data);
83986
83987
  return {
83987
83988
  params: Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.params) || {})), targetOptions.params),
83988
83989
  headers: Object.assign(Object.assign({ 'User-Agent': 'oapi-node-sdk/1.0.0' }, ((payload === null || payload === void 0 ? void 0 : payload.headers) || {})), targetOptions.headers),
83989
- data: Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.data) || {})), targetOptions.data),
83990
+ // @ts-ignore
83991
+ data: Object.keys(payloadData).length === 0 ? undefined : payloadData,
83990
83992
  path: Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.path) || {})), targetOptions.path),
83991
83993
  };
83992
83994
  });
83993
83995
  }
83994
83996
  request(payload, options) {
83995
- var _a;
83996
83997
  return __awaiter(this, void 0, void 0, function* () {
83997
83998
  const { data, params, headers, url } = payload, rest = __rest(payload, ["data", "params", "headers", "url"]);
83998
83999
  const formatPayload = yield this.formatPayload({
@@ -84000,8 +84001,6 @@ class Client extends Client$1 {
84000
84001
  params,
84001
84002
  headers,
84002
84003
  }, options);
84003
- // fix: #153
84004
- const targetData = (((_a = payload.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'get' && Object.keys(formatPayload.data).length === 0) ? undefined : formatPayload.data;
84005
84004
  this.logger.trace(`send request [${payload.method}]: ${payload.url}`);
84006
84005
  const res = yield this.httpInstance
84007
84006
  .request(Object.assign(Object.assign({}, rest), {
@@ -84009,7 +84008,7 @@ class Client extends Client$1 {
84009
84008
  ? url
84010
84009
  : `${this.domain}/${formatUrl(url)}`,
84011
84010
  headers: formatPayload.headers,
84012
- data: targetData,
84011
+ data: formatPayload.data,
84013
84012
  params: formatPayload.params,
84014
84013
  }))
84015
84014
  .catch((e) => {
package/lib/index.js CHANGED
@@ -83998,16 +83998,17 @@ class Client extends Client$1 {
83998
83998
  const helpDeskCredential = string2Base64(`${this.helpDeskId}:${this.helpDeskToken}`);
83999
83999
  targetOptions.headers['X-Lark-Helpdesk-Authorization'] = `Bearer ${helpDeskCredential}`;
84000
84000
  }
84001
+ const payloadData = Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.data) || {})), targetOptions.data);
84001
84002
  return {
84002
84003
  params: Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.params) || {})), targetOptions.params),
84003
84004
  headers: Object.assign(Object.assign({ 'User-Agent': 'oapi-node-sdk/1.0.0' }, ((payload === null || payload === void 0 ? void 0 : payload.headers) || {})), targetOptions.headers),
84004
- data: Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.data) || {})), targetOptions.data),
84005
+ // @ts-ignore
84006
+ data: Object.keys(payloadData).length === 0 ? undefined : payloadData,
84005
84007
  path: Object.assign(Object.assign({}, ((payload === null || payload === void 0 ? void 0 : payload.path) || {})), targetOptions.path),
84006
84008
  };
84007
84009
  });
84008
84010
  }
84009
84011
  request(payload, options) {
84010
- var _a;
84011
84012
  return __awaiter(this, void 0, void 0, function* () {
84012
84013
  const { data, params, headers, url } = payload, rest = __rest(payload, ["data", "params", "headers", "url"]);
84013
84014
  const formatPayload = yield this.formatPayload({
@@ -84015,8 +84016,6 @@ class Client extends Client$1 {
84015
84016
  params,
84016
84017
  headers,
84017
84018
  }, options);
84018
- // fix: #153
84019
- const targetData = (((_a = payload.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'get' && Object.keys(formatPayload.data).length === 0) ? undefined : formatPayload.data;
84020
84019
  this.logger.trace(`send request [${payload.method}]: ${payload.url}`);
84021
84020
  const res = yield this.httpInstance
84022
84021
  .request(Object.assign(Object.assign({}, rest), {
@@ -84024,7 +84023,7 @@ class Client extends Client$1 {
84024
84023
  ? url
84025
84024
  : `${this.domain}/${formatUrl(url)}`,
84026
84025
  headers: formatPayload.headers,
84027
- data: targetData,
84026
+ data: formatPayload.data,
84028
84027
  params: formatPayload.params,
84029
84028
  }))
84030
84029
  .catch((e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larksuiteoapi/node-sdk",
3
- "version": "1.56.1",
3
+ "version": "1.57.0-beta.1",
4
4
  "description": "larksuite open sdk for nodejs",
5
5
  "keywords": [
6
6
  "feishu",
@@ -29,7 +29,7 @@
29
29
  "homepage": "https://github.com/larksuite/node-sdk",
30
30
  "url": "https://github.com/larksuite/node-sdk/issues",
31
31
  "dependencies": {
32
- "axios": "0.27.2",
32
+ "axios": "~1.13.3",
33
33
  "lodash.identity": "^3.0.0",
34
34
  "lodash.merge": "^4.6.2",
35
35
  "lodash.pickby": "^4.6.0",
package/types/index.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
11
  */
12
12
 
13
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
13
+ import { AxiosInstance, CustomParamsSerializer, ParamsSerializerOptions, AxiosRequestConfig } from 'axios';
14
14
  import { Readable } from 'stream';
15
15
  import fs from 'fs';
16
16
 
@@ -74,7 +74,7 @@ interface HttpInstance {
74
74
  put<T = any, R = T, D = any>(url: string, data?: D, opts?: HttpRequestOptions<D>): Promise<R>;
75
75
  patch<T = any, R = T, D = any>(url: string, data?: D, opts?: HttpRequestOptions<D>): Promise<R>;
76
76
  }
77
- type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
77
+ type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' | 'formdata';
78
78
  interface HttpRequestOptions<D> {
79
79
  url?: string;
80
80
  method?: string;
@@ -82,7 +82,7 @@ interface HttpRequestOptions<D> {
82
82
  params?: Record<string, any>;
83
83
  data?: D;
84
84
  responseType?: ResponseType;
85
- paramsSerializer?: (params: Record<string, any>) => string;
85
+ paramsSerializer?: CustomParamsSerializer | ParamsSerializerOptions;
86
86
  timeout?: number;
87
87
  $return_headers?: boolean;
88
88
  }