@byted-apaas/server-sdk-node 1.1.27 → 1.1.28-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/server-sdk-node",
3
- "version": "1.1.27",
3
+ "version": "1.1.28-beta.2",
4
4
  "description": "aPaaS Server SDK",
5
5
  "author": "zhouwexin <zhouwexin@bytedance.com>",
6
6
  "homepage": "",
@@ -13,7 +13,7 @@
13
13
  "clean": "tsc --build --clean && rm -rf **/*.js.map"
14
14
  },
15
15
  "dependencies": {
16
- "@byted-apaas/server-common-node": "^2.0.24",
16
+ "@byted-apaas/server-common-node": "^2.0.28-beta.3",
17
17
  "@jorgeferrero/stream-to-buffer": "^2.0.6",
18
18
  "dayjs": "^1.9.6",
19
19
  "form-data": "^3.0.0",
@@ -1,4 +1,13 @@
1
1
  import { AppCtx } from '../application/application';
2
+ import { HttpConfig } from '@byted-apaas/server-common-node/http/config';
3
+ import { HttpOptions } from '@byted-apaas/server-common-node/http/request';
4
+ /**
5
+ * 获取带有 server-sdk 信息的 HttpOptions
6
+ * @param ctx 上下文
7
+ * @param httpConfig HTTP 配置
8
+ * @returns HttpOptions
9
+ */
10
+ export declare function getOptionsWithSDKInfo(ctx: any, httpConfig: HttpConfig): HttpOptions;
2
11
  export declare function getDebugExtraInfo(): Record<string, string>;
3
12
  export declare function getTriggerCtx(): any;
4
13
  export declare function transMapToFlowVariable(params: Record<string, any>): {
package/request/common.js CHANGED
@@ -1,15 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNamespaceForOpenAndFaaSSDK = exports.getTenantInfo = exports.transFlowVariableToMap = exports.transMapToFlowVariable = exports.getTriggerCtx = exports.getDebugExtraInfo = void 0;
3
+ exports.getNamespaceForOpenAndFaaSSDK = exports.getTenantInfo = exports.transFlowVariableToMap = exports.transMapToFlowVariable = exports.getTriggerCtx = exports.getDebugExtraInfo = exports.getOptionsWithSDKInfo = void 0;
4
4
  const constants_1 = require("@byted-apaas/server-common-node/constants/constants");
5
5
  const common = require("@byted-apaas/server-common-node");
6
6
  const interface_1 = require("./interface");
7
7
  const credential_1 = require("@byted-apaas/server-common-node/credential/credential");
8
8
  const exceptions_1 = require("@byted-apaas/server-common-node/utils/exceptions");
9
9
  const common_1 = require("../application/impl/common");
10
+ const request_1 = require("@byted-apaas/server-common-node/http/request");
11
+ const version_1 = require("../version/version");
10
12
  const utils = common.utils;
11
13
  const checkUtils = common.checkUtils;
12
14
  const exceptions = common.exceptions;
15
+ // server-sdk 的 SDK 信息
16
+ const serverSdkInfo = {
17
+ name: version_1.SDKName,
18
+ version: version_1.SDKVersion,
19
+ };
20
+ /**
21
+ * 获取带有 server-sdk 信息的 HttpOptions
22
+ * @param ctx 上下文
23
+ * @param httpConfig HTTP 配置
24
+ * @returns HttpOptions
25
+ */
26
+ function getOptionsWithSDKInfo(ctx, httpConfig) {
27
+ return (0, request_1.getOptions)(ctx, httpConfig).setSDKInfo(serverSdkInfo);
28
+ }
29
+ exports.getOptionsWithSDKInfo = getOptionsWithSDKInfo;
13
30
  // eslint-disable-next-line @typescript-eslint/no-require-imports
14
31
  const nodeCls = require('node-cls');
15
32
  function checkLoopCtx(reqCtx) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FaaSInfraRequest = void 0;
4
4
  const common = require("@byted-apaas/server-common-node");
5
+ const common_1 = require("./common");
5
6
  const headers = common.constants.headers;
6
7
  const commonHttp = common.http;
7
8
  const faasinfra = common.http.faasinfra;
@@ -20,7 +21,7 @@ class FaaSInfraRequest {
20
21
  }
21
22
  async createDistributeTaskV1(dataset, handlerFunc, progressCallbackFunc, completedCallbackFunc, options) {
22
23
  // 1.获取 options
23
- let config = commonHttp.getOptions(null, faasinfraHttpPath.createDistributedTask);
24
+ let config = (0, common_1.getOptionsWithSDKInfo)(null, faasinfraHttpPath.createDistributedTask);
24
25
  // 2.构造url
25
26
  let urlPath = config._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
26
27
  // 3.请求
@@ -51,7 +52,7 @@ class FaaSInfraRequest {
51
52
  }
52
53
  async createDistributeTaskV2(dataset, handlerFunc, progressCallbackFunc, completedCallbackFunc, options) {
53
54
  // 1.获取 options
54
- let config = commonHttp.getOptions(null, faasinfraHttpPath.createDistributedTaskV2);
55
+ let config = (0, common_1.getOptionsWithSDKInfo)(null, faasinfraHttpPath.createDistributedTaskV2);
55
56
  // 2.构造url
56
57
  let urlPath = config._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
57
58
  // 3.请求
@@ -83,7 +84,7 @@ class FaaSInfraRequest {
83
84
  }
84
85
  async invokeMicroserviceSync(apiName, path, method, body) {
85
86
  let reqPath = faasinfraHttpPath.invokeMicroserviceSync;
86
- let options = commonHttp.getOptions(null, reqPath);
87
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, reqPath);
87
88
  let urlPath = options._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
88
89
  options.json = {
89
90
  'microserviceId': apiName,
@@ -99,7 +100,7 @@ class FaaSInfraRequest {
99
100
  }
100
101
  async invokeMicroserviceAsync(apiName, path, method, body) {
101
102
  let reqPath = faasinfraHttpPath.invokeMicroserviceAsync;
102
- let options = commonHttp.getOptions(null, reqPath);
103
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, reqPath);
103
104
  let urlPath = options._reqPath.replace(replaceKeys.namespace, utils.getNamespaceFromCtx());
104
105
  options.json = {
105
106
  'microserviceId': apiName,
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.GetFaaSInfraInstance = exports.GetInstance = exports.GetHttpInstance = void 0;
6
6
  const openapi_1 = require("./openapi");
7
7
  const faasinfra_1 = require("./faasinfra");
8
- const version_1 = require("../version/version");
9
- const server_common_node_1 = require("@byted-apaas/server-common-node");
10
8
  const requestInstanceMap = {
11
9
  'httpRequest': null,
12
10
  'rpcRequest': null,
@@ -14,8 +12,6 @@ const requestInstanceMap = {
14
12
  function GetHttpInstance() {
15
13
  if (!requestInstanceMap.httpRequest) {
16
14
  requestInstanceMap.httpRequest = new openapi_1.RequestHttp();
17
- // 设置 SDK 版本信息到请求上下文,用于埋点上报
18
- server_common_node_1.utils.setSDKInfo(version_1.SDKName, version_1.SDKVersion);
19
15
  }
20
16
  return requestInstanceMap.httpRequest;
21
17
  }
@@ -26,7 +26,7 @@ const fieldType = common.fieldType;
26
26
  const utils = common.utils;
27
27
  const checkUtils = common.checkUtils;
28
28
  async function updateWorkflowVariables(ctx, instanceId, variables, variableTypes) {
29
- let options = commonHttp.getOptions(null, openapiHttpPath.workflowUpdateVariablesV2);
29
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.workflowUpdateVariablesV2);
30
30
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
31
31
  // 2.请求
32
32
  options.json = {
@@ -44,7 +44,7 @@ async function createRecordBySync(objectApiName, record, authType) {
44
44
  throw new exceptions.InvalidParamError('objectApiName is empty');
45
45
  }
46
46
  // 2.获取 options
47
- let options = commonHttp.getOptions(null, openapiHttpPath.createRecordBySyncV2);
47
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createRecordBySyncV2);
48
48
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
49
49
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
50
50
  // 3.请求
@@ -76,7 +76,7 @@ async function createRecordBySyncV3(objectApiName, record, authType) {
76
76
  throw new exceptions.InvalidParamError('objectApiName is empty');
77
77
  }
78
78
  // 2.获取 options
79
- let options = commonHttp.getOptions(null, openapiHttpPath.createRecordBySyncV3);
79
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createRecordBySyncV3);
80
80
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
81
81
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
82
82
  // 3.请求
@@ -108,7 +108,7 @@ async function updateRecordBySync(objectApiName, recordID, record, authType) {
108
108
  throw new exceptions.InvalidParamError('objectApiName is empty');
109
109
  }
110
110
  // 2.获取 options
111
- let options = commonHttp.getOptions(null, openapiHttpPath.updateRecordBySyncV2);
111
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.updateRecordBySyncV2);
112
112
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
113
113
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
114
114
  // 3.请求
@@ -134,7 +134,7 @@ async function updateRecordBySyncV3(objectApiName, recordID, record, authType) {
134
134
  throw new exceptions.InvalidParamError('objectApiName is empty');
135
135
  }
136
136
  // 2.获取 options
137
- let options = commonHttp.getOptions(null, openapiHttpPath.updateRecordBySyncV3);
137
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.updateRecordBySyncV3);
138
138
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
139
139
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
140
140
  urlPath = urlPath.replace(replaceKeys.recordID, recordID);
@@ -160,7 +160,7 @@ async function deleteRecordBySync(objectApiName, recordID, authType) {
160
160
  throw new exceptions.InvalidParamError('objectApiName is empty');
161
161
  }
162
162
  // 2.获取 options
163
- let options = commonHttp.getOptions(null, openapiHttpPath.deleteRecordBySyncV2);
163
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.deleteRecordBySyncV2);
164
164
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
165
165
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
166
166
  // 3.请求
@@ -185,7 +185,7 @@ async function deleteRecordBySyncV3(objectApiName, recordID, authType) {
185
185
  throw new exceptions.InvalidParamError('objectApiName is empty');
186
186
  }
187
187
  // 2.获取 options
188
- let options = commonHttp.getOptions(null, openapiHttpPath.deleteRecordBySyncV3);
188
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.deleteRecordBySyncV3);
189
189
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
190
190
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
191
191
  urlPath = urlPath.replace(replaceKeys.recordID, recordID);
@@ -202,7 +202,7 @@ async function deleteRecordBySyncV3(objectApiName, recordID, authType) {
202
202
  }
203
203
  async function createRecordsByAsync(objectApiName, records, authType) {
204
204
  // 1.获取 options
205
- let options = commonHttp.getOptions(null, openapiHttpPath.createRecordsByAsyncV2);
205
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createRecordsByAsyncV2);
206
206
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
207
207
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
208
208
  // 2.请求
@@ -223,7 +223,7 @@ async function createRecordsByAsync(objectApiName, records, authType) {
223
223
  }
224
224
  async function updateRecordsByAsync(objectApiName, recordMap, authType) {
225
225
  // 1.获取 options
226
- let options = commonHttp.getOptions(null, openapiHttpPath.updateRecordsByAsyncV2);
226
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.updateRecordsByAsyncV2);
227
227
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
228
228
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
229
229
  // 2.请求
@@ -244,7 +244,7 @@ async function updateRecordsByAsync(objectApiName, recordMap, authType) {
244
244
  }
245
245
  async function deleteRecordsByAsync(objectApiName, recordIDs, authType) {
246
246
  // 1.获取 options
247
- let options = commonHttp.getOptions(null, openapiHttpPath.deleteRecordsByAsyncV2);
247
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.deleteRecordsByAsyncV2);
248
248
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
249
249
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
250
250
  // 2.请求
@@ -265,7 +265,7 @@ async function deleteRecordsByAsync(objectApiName, recordIDs, authType) {
265
265
  }
266
266
  async function createRecordsBySync(objectApiName, records, authType) {
267
267
  // 1.获取 options
268
- let options = commonHttp.getOptions(null, openapiHttpPath.mCreateRecordsBySyncV2);
268
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.mCreateRecordsBySyncV2);
269
269
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
270
270
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
271
271
  // 2.请求
@@ -287,7 +287,7 @@ async function createRecordsBySync(objectApiName, records, authType) {
287
287
  }
288
288
  async function createRecordsBySyncV3(objectApiName, records, authType) {
289
289
  // 1.获取 options
290
- const options = commonHttp.getOptions(null, openapiHttpPath.createRecordsBySyncV3);
290
+ const options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createRecordsBySyncV3);
291
291
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
292
292
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
293
293
  // 2.请求
@@ -308,7 +308,7 @@ async function createRecordsBySyncV3(objectApiName, records, authType) {
308
308
  }
309
309
  async function updateRecordsBySync(objectApiName, recordMap, authType) {
310
310
  // 1.获取 options
311
- let options = commonHttp.getOptions(null, openapiHttpPath.mUpdateRecordsBySyncV2);
311
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.mUpdateRecordsBySyncV2);
312
312
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
313
313
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
314
314
  // 2.请求
@@ -338,7 +338,7 @@ async function updateRecordsBySync(objectApiName, recordMap, authType) {
338
338
  }
339
339
  async function updateRecordsBySyncV3(objectApiName, records, authType) {
340
340
  // 1.获取 options
341
- let options = commonHttp.getOptions(null, openapiHttpPath.updateRecordsBySyncV3);
341
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.updateRecordsBySyncV3);
342
342
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
343
343
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
344
344
  // 2.请求
@@ -367,7 +367,7 @@ async function updateRecordsBySyncV3(objectApiName, records, authType) {
367
367
  }
368
368
  async function deleteRecordsBySync(objectApiName, recordIDs, authType) {
369
369
  // 1.获取 options
370
- let options = commonHttp.getOptions(null, openapiHttpPath.mDeleteRecordsBySyncV2);
370
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.mDeleteRecordsBySyncV2);
371
371
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
372
372
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
373
373
  // 2.请求
@@ -397,7 +397,7 @@ async function deleteRecordsBySync(objectApiName, recordIDs, authType) {
397
397
  }
398
398
  async function deleteRecordsBySyncV3(objectApiName, recordIDs, authType) {
399
399
  // 1.获取 options
400
- const options = commonHttp.getOptions(null, openapiHttpPath.deleteRecordsBySyncV3);
400
+ const options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.deleteRecordsBySyncV3);
401
401
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
402
402
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
403
403
  // 2.请求
@@ -455,7 +455,7 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearc
455
455
  throw new exceptions.InternalError('objectApiName is empty');
456
456
  }
457
457
  // 2.获取 options
458
- let options = commonHttp.getOptions(null, needCount ? openapiHttpPath.mGetCountByCriterionV2 : openapiHttpPath.mGetRecordByCriterionV2);
458
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, needCount ? openapiHttpPath.mGetCountByCriterionV2 : openapiHttpPath.mGetRecordByCriterionV2);
459
459
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
460
460
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
461
461
  if (needCount) {
@@ -495,7 +495,7 @@ async function getRecordsV3OrCountByCriterion(objectApiName, criterion, quickQue
495
495
  throw new exceptions.InternalError('objectApiName is empty');
496
496
  }
497
497
  // 2.获取 options
498
- let options = commonHttp.getOptions(null, openapiHttpPath.mGetRecordsV3OrCounByCriterion);
498
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.mGetRecordsV3OrCounByCriterion);
499
499
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
500
500
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
501
501
  if (needCount) {
@@ -549,7 +549,7 @@ async function uploadFile(datas, expire = 0, fileName) {
549
549
  formData.append('ignoreUserId', 'true');
550
550
  let formHeaders = formData.getHeaders();
551
551
  // 1.获取config
552
- let options = commonHttp.getOptions(null, openapiHttpPath.uploadAttachment);
552
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.uploadAttachment);
553
553
  let urlPath = options._reqPath;
554
554
  options.responseType = 'buffer';
555
555
  for (let key of Object.keys(formHeaders)) {
@@ -561,7 +561,7 @@ async function uploadFile(datas, expire = 0, fileName) {
561
561
  }
562
562
  async function downloadFileByID(id, filePath) {
563
563
  // 1.获取 options
564
- let options = commonHttp.getOptions(null, openapiHttpPath.downloadFile);
564
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.downloadFile);
565
565
  let urlPath = options._reqPath.replace(replaceKeys.fileID, id);
566
566
  options.responseType = 'buffer';
567
567
  // 2.请求
@@ -578,7 +578,7 @@ async function downloadFileByID(id, filePath) {
578
578
  }
579
579
  async function downloadFileByToken(fileToken, filePath) {
580
580
  // 1.获取 options
581
- let options = commonHttp.getOptions(null, openapiHttpPath.downloadAttachment);
581
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.downloadAttachment);
582
582
  let urlPath = options._reqPath + `?token=${fileToken}`;
583
583
  options.responseType = 'buffer';
584
584
  // 2.请求
@@ -595,7 +595,7 @@ async function downloadFileByToken(fileToken, filePath) {
595
595
  }
596
596
  async function mGetFileToken(ids) {
597
597
  // 1.获取 options
598
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getBatchAttachmentToken);
598
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.getBatchAttachmentToken);
599
599
  let urlPath = options._reqPath;
600
600
  // 2.请求
601
601
  options.json = {
@@ -656,7 +656,7 @@ async function createMessage(msg) {
656
656
  }
657
657
  }
658
658
  // 2.获取 options
659
- let options = commonHttp.getOptions(null, openapiHttpPath.createMessage);
659
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createMessage);
660
660
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
661
661
  // 3.请求
662
662
  options.json = {
@@ -717,7 +717,7 @@ async function updateMessage(msgId, msg) {
717
717
  }
718
718
  }
719
719
  // 2.获取 options
720
- let options = commonHttp.getOptions(null, openapiHttpPath.updateMessage);
720
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.updateMessage);
721
721
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
722
722
  // 3.请求
723
723
  options.json = {
@@ -736,7 +736,7 @@ async function getFields(objectApiName) {
736
736
  throw new exceptions.InvalidParamError('objectApiName is empty');
737
737
  }
738
738
  // 2.获取config
739
- let options = commonHttp.getOptions(null, openapiHttpPath.getFieldsV5);
739
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getFieldsV5);
740
740
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
741
741
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
742
742
  let obj = await openapi.doRequest(null, urlPath, options);
@@ -754,7 +754,7 @@ async function getField(objectApiName, fieldApiName) {
754
754
  throw new exceptions.InternalError('fieldApiName is empty');
755
755
  }
756
756
  // 2.获取 options
757
- let options = commonHttp.getOptions(null, openapiHttpPath.getFieldV5);
757
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getFieldV5);
758
758
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
759
759
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
760
760
  urlPath = urlPath.replace(replaceKeys.fieldApiName, fieldApiName);
@@ -767,7 +767,7 @@ async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
767
767
  throw new exceptions.InvalidParamError(`The type of workflowInstanceId should be number, but ${typeof (workflowInstanceId)}.`);
768
768
  }
769
769
  // 2.获取 options
770
- let options = commonHttp.getOptions(null, openapiHttpPath.terminateWorkflowInstance);
770
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.terminateWorkflowInstance);
771
771
  let urlPath = options._reqPath;
772
772
  // 3.请求
773
773
  options.json = {
@@ -779,7 +779,7 @@ async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
779
779
  }
780
780
  async function modifyRecordsWithTransaction(placeholders, operations, authType, version) {
781
781
  // 1.获取 options
782
- let options = commonHttp.getOptions(null, openapiHttpPath.modifyRecordsWithTransaction);
782
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.modifyRecordsWithTransaction);
783
783
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
784
784
  // 2.请求
785
785
  options.json = {
@@ -811,7 +811,7 @@ async function modifyRecordsWithTransaction(placeholders, operations, authType,
811
811
  }
812
812
  async function getGlobalConfigByKey(key) {
813
813
  // 1.获取 options
814
- let options = commonHttp.getOptions(null, openapiHttpPath.getAllGlobalConfigs);
814
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getAllGlobalConfigs);
815
815
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
816
816
  // 2.请求
817
817
  let pageSize = 100, offset = 0;
@@ -838,7 +838,7 @@ async function getGlobalConfigByKey(key) {
838
838
  }
839
839
  async function oql(oql, args, namedArgs, authType) {
840
840
  // 1.获取 options
841
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.oql);
841
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.oql);
842
842
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
843
843
  // 2.请求
844
844
  options.json = {
@@ -874,7 +874,7 @@ async function oql(oql, args, namedArgs, authType) {
874
874
  }
875
875
  async function openSDKCreateRecordBySync(objectApiName, record) {
876
876
  // 1.获取 options
877
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKCreateRecord);
877
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKCreateRecord);
878
878
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
879
879
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
880
880
  // 2.请求
@@ -883,7 +883,7 @@ async function openSDKCreateRecordBySync(objectApiName, record) {
883
883
  }
884
884
  async function openSDKUpdateRecordBySync(objectApiName, recordID, record) {
885
885
  // 1.获取 options
886
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKUpdateRecord);
886
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKUpdateRecord);
887
887
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
888
888
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
889
889
  urlPath = urlPath.replace(replaceKeys.recordID, recordID.toString());
@@ -894,7 +894,7 @@ async function openSDKUpdateRecordBySync(objectApiName, recordID, record) {
894
894
  ;
895
895
  async function openSDKDeleteRecordBySync(objectApiName, recordID) {
896
896
  // 1.获取 options
897
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKDeleteRecord);
897
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKDeleteRecord);
898
898
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
899
899
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
900
900
  urlPath = urlPath.replace(replaceKeys.recordID, recordID.toString());
@@ -904,7 +904,7 @@ async function openSDKDeleteRecordBySync(objectApiName, recordID) {
904
904
  ;
905
905
  async function openSDKCreateRecordsBySync(objectApiName, records) {
906
906
  // 1.获取 options
907
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKBatchCreateRecord);
907
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKBatchCreateRecord);
908
908
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
909
909
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
910
910
  // 2.请求
@@ -914,7 +914,7 @@ async function openSDKCreateRecordsBySync(objectApiName, records) {
914
914
  ;
915
915
  async function openSDKUpdateRecordsBySync(objectApiName, records) {
916
916
  // 1.获取 options
917
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKBatchUpdateRecord);
917
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKBatchUpdateRecord);
918
918
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
919
919
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
920
920
  // 2.请求
@@ -924,7 +924,7 @@ async function openSDKUpdateRecordsBySync(objectApiName, records) {
924
924
  ;
925
925
  async function openSDKDeleteRecordsBySync(objectApiName, recordIDs) {
926
926
  // 1.获取 options
927
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKBatchDeleteRecord);
927
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKBatchDeleteRecord);
928
928
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
929
929
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
930
930
  // 2.请求
@@ -934,7 +934,7 @@ async function openSDKDeleteRecordsBySync(objectApiName, recordIDs) {
934
934
  ;
935
935
  async function openSDKGetRecords(objectApiName, param) {
936
936
  // 1.获取 options
937
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKGetRecords);
937
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKGetRecords);
938
938
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
939
939
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
940
940
  if (param.limit <= 0 || param.limit > 10000) {
@@ -952,7 +952,7 @@ async function openSDKGetRecords(objectApiName, param) {
952
952
  }
953
953
  async function openSDKUploadFile(fileName, data) {
954
954
  // 1.获取 options
955
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKUploadFile);
955
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKUploadFile);
956
956
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
957
957
  let formData = new FormData();
958
958
  formData.append('file', data);
@@ -968,7 +968,7 @@ async function openSDKUploadFile(fileName, data) {
968
968
  }
969
969
  async function openSDKUploadAvatar(fileName, data) {
970
970
  // 1.获取 options
971
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKUploadAvatar);
971
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKUploadAvatar);
972
972
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
973
973
  let formData = new FormData();
974
974
  formData.append('file', data);
@@ -984,7 +984,7 @@ async function openSDKUploadAvatar(fileName, data) {
984
984
  }
985
985
  async function openSDKDownloadAvatar(imageID) {
986
986
  // 1.获取 options
987
- let options = commonHttp.getOptions(null, openapiHttpPath.openSDKDownloadAvatar);
987
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.openSDKDownloadAvatar);
988
988
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
989
989
  urlPath = urlPath.replace(replaceKeys.fileID, imageID);
990
990
  options.responseType = 'buffer';
@@ -1189,7 +1189,7 @@ class RequestHttp {
1189
1189
  }
1190
1190
  ;
1191
1191
  async getApprovalInstanceList(params) {
1192
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getApprovalInstanceList);
1192
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.getApprovalInstanceList);
1193
1193
  let urlPath = options._reqPath;
1194
1194
  // 设置参数
1195
1195
  const searchParams = {};
@@ -1217,7 +1217,7 @@ class RequestHttp {
1217
1217
  };
1218
1218
  }
1219
1219
  async getApprovalInstance(params) {
1220
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getApprovalInstance);
1220
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.getApprovalInstance);
1221
1221
  let urlPath = options._reqPath.replace(replaceKeys.id, String(params.approvalInstanceId));
1222
1222
  // 设置参数
1223
1223
  const searchParams = new URLSearchParams();
@@ -1276,7 +1276,7 @@ class RequestHttp {
1276
1276
  }
1277
1277
  exports.RequestHttp = RequestHttp;
1278
1278
  async function invokeFuncWithAuth(idOrName, params) {
1279
- let options = commonHttp.getOptions(null, openapiHttpPath.invokeFuncWithAuthInnerAPI);
1279
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.invokeFuncWithAuthInnerAPI);
1280
1280
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1281
1281
  urlPath = urlPath.replace(replaceKeys.apiName, idOrName.APIName);
1282
1282
  options.headers.User = utils.getUserIDFromCtx();
@@ -1304,7 +1304,7 @@ async function invokeFuncWithAuth(idOrName, params) {
1304
1304
  return result.data;
1305
1305
  }
1306
1306
  async function invokeFuncSync(idOrName, params) {
1307
- let options = commonHttp.getOptions(null, openapiHttpPath.invokeFuncSyncInnerAPI);
1307
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.invokeFuncSyncInnerAPI);
1308
1308
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1309
1309
  options.headers.User = utils.getUserIDFromCtx();
1310
1310
  options.json = {
@@ -1332,7 +1332,7 @@ async function invokeFuncSync(idOrName, params) {
1332
1332
  }
1333
1333
  async function createAsyncTaskV1(idOrName, params) {
1334
1334
  // attention: 异步任务接口存在先后区别,接口版本号不一致需 check,v1->v2
1335
- let options = commonHttp.getOptions(null, openapiHttpPath.createAsyncTaskInnerAPIV2);
1335
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createAsyncTaskInnerAPIV2);
1336
1336
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1337
1337
  options.headers.User = utils.getUserIDFromCtx();
1338
1338
  options.json = {
@@ -1356,7 +1356,7 @@ async function createAsyncTaskV1(idOrName, params) {
1356
1356
  }
1357
1357
  async function createAsyncTaskV2(APIName, params) {
1358
1358
  // attention: 异步任务接口存在先后区别,接口版本号不一致需 check,v2->v1
1359
- let options = commonHttp.getOptions(null, openapiHttpPath.createAsyncTaskInnerAPIV1);
1359
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.createAsyncTaskInnerAPIV1);
1360
1360
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1361
1361
  let triggerCtx = {}, taskID = utils.getTriggerTaskID();
1362
1362
  if (taskID) {
@@ -1406,7 +1406,7 @@ async function getExecutionUserTaskInfo(executionId) {
1406
1406
  if (!executionId) {
1407
1407
  throw new exceptions.InvalidParamError('executionId is empty');
1408
1408
  }
1409
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getExecutionUserTaskInfo);
1409
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.getExecutionUserTaskInfo);
1410
1410
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.id, `${executionId}`);
1411
1411
  urlPath += `?operator=${utils.getUserIDFromCtx()}`;
1412
1412
  options.headers.User = utils.getUserIDFromCtx();
@@ -1421,7 +1421,7 @@ async function executeFlow(apiName, option, async) {
1421
1421
  if (!apiName) {
1422
1422
  throw new exceptions.InvalidParamError(`flow apiName is empty`);
1423
1423
  }
1424
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.executeFlow);
1424
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.executeFlow);
1425
1425
  const urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, apiName);
1426
1426
  options.headers.User = utils.getUserIDFromCtx();
1427
1427
  options.json = {
@@ -1446,7 +1446,7 @@ async function revokeExecution(executionId, revokeOptions) {
1446
1446
  if (!executionId) {
1447
1447
  throw new exceptions.InvalidParamError(`executionId is empty`);
1448
1448
  }
1449
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.revokeExecution);
1449
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.revokeExecution);
1450
1450
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.id, `${executionId}`);
1451
1451
  options.headers.User = utils.getUserIDFromCtx();
1452
1452
  let reason = undefined;
@@ -1467,7 +1467,7 @@ async function getExecutionInfo(executionId) {
1467
1467
  if (!executionId) {
1468
1468
  throw new exceptions.InvalidParamError(`executionId is empty`);
1469
1469
  }
1470
- let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getExecutionInfo);
1470
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, constants_2.openapiHttpPath.getExecutionInfo);
1471
1471
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.id, `${executionId}`);
1472
1472
  urlPath += `?operator=${utils.getUserIDFromCtx()}`;
1473
1473
  options.headers.User = utils.getUserIDFromCtx();
@@ -1488,7 +1488,7 @@ async function getIntegrationAppAccessToken(apiName) {
1488
1488
  if (!apiName) {
1489
1489
  throw new exceptions.InvalidParamError('apiName is empty');
1490
1490
  }
1491
- let options = commonHttp.getOptions(null, openapiHttpPath.getIntegrationAppAccessTokenAPI);
1491
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getIntegrationAppAccessTokenAPI);
1492
1492
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, `${apiName}`);
1493
1493
  let res = await openapi.doRequest(null, urlPath, options);
1494
1494
  return {
@@ -1502,7 +1502,7 @@ async function getIntegrationTenantAccessToken(apiName) {
1502
1502
  if (!apiName) {
1503
1503
  throw new exceptions.InvalidParamError('apiName is empty');
1504
1504
  }
1505
- let options = commonHttp.getOptions(null, openapiHttpPath.getIntegrationTenantAccessTokenAPI);
1505
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getIntegrationTenantAccessTokenAPI);
1506
1506
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, `${apiName}`);
1507
1507
  let res = await openapi.doRequest(null, urlPath, options);
1508
1508
  return {
@@ -1512,7 +1512,7 @@ async function getIntegrationTenantAccessToken(apiName) {
1512
1512
  };
1513
1513
  }
1514
1514
  async function getDefaultIntegrationAppAccessToken() {
1515
- let options = commonHttp.getOptions(null, openapiHttpPath.getDefaultIntegrationAppAccessTokenAPI);
1515
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getDefaultIntegrationAppAccessTokenAPI);
1516
1516
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1517
1517
  let res = await openapi.doRequest(null, urlPath, options);
1518
1518
  return {
@@ -1522,7 +1522,7 @@ async function getDefaultIntegrationAppAccessToken() {
1522
1522
  };
1523
1523
  }
1524
1524
  async function getDefaultIntegrationTenantAccessToken() {
1525
- let options = commonHttp.getOptions(null, openapiHttpPath.getDefaultIntegrationTenantAccessTokenAPI);
1525
+ let options = (0, common_1.getOptionsWithSDKInfo)(null, openapiHttpPath.getDefaultIntegrationTenantAccessTokenAPI);
1526
1526
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1527
1527
  let res = await openapi.doRequest(null, urlPath, options);
1528
1528
  return {