@byted-apaas/server-sdk-node 1.0.17 → 1.1.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.
Files changed (163) hide show
  1. package/README.md +7 -0
  2. package/application/application.d.ts +9 -7
  3. package/application/application.js +1 -0
  4. package/application/application.js.map +1 -0
  5. package/application/function/function.d.ts +1 -1
  6. package/application/function/function.js +1 -1
  7. package/application/function/function.js.map +1 -0
  8. package/application/impl/common.d.ts +1 -1
  9. package/application/impl/common.js +14 -12
  10. package/application/impl/common.js.map +1 -0
  11. package/application/impl/impl.d.ts +8 -6
  12. package/application/impl/impl.js +7 -4
  13. package/application/impl/impl.js.map +1 -0
  14. package/constants/constants.js +5 -4
  15. package/constants/constants.js.map +1 -0
  16. package/context/context.d.ts +8 -38
  17. package/context/context.js +3 -2
  18. package/context/context.js.map +1 -0
  19. package/context/db/db.d.ts +11 -19
  20. package/context/db/db.js +1 -0
  21. package/context/db/db.js.map +1 -0
  22. package/context/db/impl/IObject.d.ts +37 -37
  23. package/context/db/impl/IObject.js +1 -0
  24. package/context/db/impl/IObject.js.map +1 -0
  25. package/context/db/impl/db.d.ts +9 -9
  26. package/context/db/impl/db.js +7 -6
  27. package/context/db/impl/db.js.map +1 -0
  28. package/context/db/impl/object.js +48 -47
  29. package/context/db/impl/object.js.map +1 -0
  30. package/context/db/impl/oql/ioql.js +1 -0
  31. package/context/db/impl/oql/ioql.js.map +1 -0
  32. package/context/db/impl/oql/oql.d.ts +1 -1
  33. package/context/db/impl/oql/oql.js +1 -0
  34. package/context/db/impl/oql/oql.js.map +1 -0
  35. package/context/db/impl/order.js +2 -1
  36. package/context/db/impl/order.js.map +1 -0
  37. package/context/db/impl/propertiesStore.js +2 -1
  38. package/context/db/impl/propertiesStore.js.map +1 -0
  39. package/context/db/impl/queryBuilder.js +1 -0
  40. package/context/db/impl/queryBuilder.js.map +1 -0
  41. package/context/db/impl/transaction/index.d.ts +1 -1
  42. package/context/db/impl/transaction/index.js +47 -45
  43. package/context/db/impl/transaction/index.js.map +1 -0
  44. package/context/db/impl/transaction/operation.js +1 -0
  45. package/context/db/impl/transaction/operation.js.map +1 -0
  46. package/context/db/impl/transaction.d.ts +0 -5
  47. package/context/db/impl/transaction.js +1 -0
  48. package/context/db/impl/transaction.js.map +1 -0
  49. package/context/globalConfig/globalConfig.js +1 -0
  50. package/context/globalConfig/globalConfig.js.map +1 -0
  51. package/context/integration/IIntegration.d.ts +30 -0
  52. package/context/integration/IIntegration.js +5 -0
  53. package/context/integration/IIntegration.js.map +1 -0
  54. package/context/integration/impl/integration.d.ts +16 -0
  55. package/context/integration/impl/integration.js +63 -0
  56. package/context/integration/impl/integration.js.map +1 -0
  57. package/context/metadata/components/common.js +4 -3
  58. package/context/metadata/components/common.js.map +1 -0
  59. package/context/metadata/components/components.d.ts +4 -4
  60. package/context/metadata/components/components.js +1 -0
  61. package/context/metadata/components/components.js.map +1 -0
  62. package/context/metadata/components/desktop/list.d.ts +3 -3
  63. package/context/metadata/components/desktop/list.js +24 -23
  64. package/context/metadata/components/desktop/list.js.map +1 -0
  65. package/context/metadata/components/desktop/recordDetail.d.ts +2 -2
  66. package/context/metadata/components/desktop/recordDetail.js +1 -0
  67. package/context/metadata/components/desktop/recordDetail.js.map +1 -0
  68. package/context/metadata/components/mobile/list.d.ts +4 -4
  69. package/context/metadata/components/mobile/list.js +2 -1
  70. package/context/metadata/components/mobile/list.js.map +1 -0
  71. package/context/metadata/metadata.d.ts +5 -6
  72. package/context/metadata/metadata.js +6 -6
  73. package/context/metadata/metadata.js.map +1 -0
  74. package/context/metadata/objects/fields.d.ts +6 -6
  75. package/context/metadata/objects/fields.js +58 -57
  76. package/context/metadata/objects/fields.js.map +1 -0
  77. package/context/metadata/objects/fields.util.d.ts +3 -3
  78. package/context/metadata/objects/fields.util.js +22 -21
  79. package/context/metadata/objects/fields.util.js.map +1 -0
  80. package/context/metadata/objects/objects.d.ts +1 -1
  81. package/context/metadata/objects/objects.js +2 -1
  82. package/context/metadata/objects/objects.js.map +1 -0
  83. package/context/metadata/types/common.js +1 -0
  84. package/context/metadata/types/common.js.map +1 -0
  85. package/context/metadata/types/components.d.ts +5 -5
  86. package/context/metadata/types/components.js +1 -0
  87. package/context/metadata/types/components.js.map +1 -0
  88. package/context/metadata/types/objects.d.ts +88 -88
  89. package/context/metadata/types/objects.js +1 -0
  90. package/context/metadata/types/objects.js.map +1 -0
  91. package/context/msg/msg.d.ts +2 -2
  92. package/context/msg/msg.js +1 -0
  93. package/context/msg/msg.js.map +1 -0
  94. package/context/resources/IResources.d.ts +2 -2
  95. package/context/resources/IResources.js +1 -0
  96. package/context/resources/IResources.js.map +1 -0
  97. package/context/resources/impl/resources.d.ts +4 -4
  98. package/context/resources/impl/resources.js +4 -3
  99. package/context/resources/impl/resources.js.map +1 -0
  100. package/context/tasks/tasks.d.ts +3 -3
  101. package/context/tasks/tasks.js +6 -5
  102. package/context/tasks/tasks.js.map +1 -0
  103. package/data/index.d.ts +2 -2
  104. package/data/index.js +1 -0
  105. package/data/index.js.map +1 -0
  106. package/global/application/flow/flow.d.ts +85 -0
  107. package/global/application/flow/flow.js +3 -0
  108. package/global/application/flow/flow.js.map +1 -0
  109. package/global/global.d.ts +88 -0
  110. package/global/global.js +4 -0
  111. package/global/global.js.map +1 -0
  112. package/hooks/api.d.ts +12 -7
  113. package/hooks/api.js +29 -23
  114. package/hooks/api.js.map +1 -0
  115. package/hooks/hooks.js +42 -0
  116. package/hooks/hooks.js.map +1 -0
  117. package/kunlun/kunlun.d.ts +5 -5
  118. package/kunlun/kunlun.js +1 -0
  119. package/kunlun/kunlun.js.map +1 -0
  120. package/kunlun/operator/IOperator.d.ts +16 -16
  121. package/kunlun/operator/IOperator.js +1 -0
  122. package/kunlun/operator/IOperator.js.map +1 -0
  123. package/kunlun/operator/impl/expression.d.ts +2 -2
  124. package/kunlun/operator/impl/expression.js +6 -5
  125. package/kunlun/operator/impl/expression.js.map +1 -0
  126. package/kunlun/operator/impl/logic.js +49 -31
  127. package/kunlun/operator/impl/logic.js.map +1 -0
  128. package/kunlun/operator/impl/logicV2.d.ts +2 -2
  129. package/kunlun/operator/impl/logicV2.js +13 -13
  130. package/kunlun/operator/impl/logicV2.js.map +1 -0
  131. package/kunlun/operator/impl/operator.d.ts +17 -17
  132. package/kunlun/operator/impl/operator.js +39 -38
  133. package/kunlun/operator/impl/operator.js.map +1 -0
  134. package/kunlun/operator/impl/operatorV2.d.ts +17 -17
  135. package/kunlun/operator/impl/operatorV2.js +39 -38
  136. package/kunlun/operator/impl/operatorV2.js.map +1 -0
  137. package/lib/core.d.ts +3 -3
  138. package/lib/core.js +1 -0
  139. package/lib/core.js.map +1 -0
  140. package/log/app.access.log +0 -0
  141. package/log/app.call.log +0 -0
  142. package/log/app.log +0 -0
  143. package/package.json +2 -2
  144. package/request/common.d.ts +1 -1
  145. package/request/common.js +5 -3
  146. package/request/common.js.map +1 -0
  147. package/request/constants.d.ts +1 -1
  148. package/request/constants.js +7 -6
  149. package/request/constants.js.map +1 -0
  150. package/request/faasinfra.d.ts +1 -1
  151. package/request/faasinfra.js +42 -251
  152. package/request/faasinfra.js.map +1 -0
  153. package/request/innerapi.d.ts +12 -8
  154. package/request/innerapi.js +173 -57
  155. package/request/innerapi.js.map +1 -0
  156. package/request/interface.d.ts +68 -54
  157. package/request/interface.js +9 -9
  158. package/request/interface.js.map +1 -0
  159. package/request/openapi.d.ts +12 -8
  160. package/request/openapi.js +215 -149
  161. package/request/openapi.js.map +1 -0
  162. package/types/types.js +1 -0
  163. package/types/types.js.map +1 -0
@@ -10,7 +10,8 @@ const constants_2 = require("./constants");
10
10
  const constants_3 = require("@byted-apaas/server-common-node/constants/constants");
11
11
  const common_1 = require("./common");
12
12
  const utils_1 = require("@byted-apaas/server-common-node/utils/utils");
13
- const nodeCls = require("node-cls");
13
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
14
+ const nodeCls = require('node-cls'); //nolint:byted_s_ts_no_require_imports
14
15
  const fs = require('fs');
15
16
  const path = require('path');
16
17
  const commonHttp = common.http;
@@ -26,10 +27,10 @@ async function updateWorkflowVariables(ctx, instanceId, variables, variableTypes
26
27
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
27
28
  // 2.请求
28
29
  options.json = {
29
- "operator": -1,
30
- "workflowInstanceID": instanceId,
31
- "variables": JSON.parse(variables),
32
- "variableTypes": JSON.parse(variableTypes),
30
+ 'operator': -1,
31
+ 'workflowInstanceID': instanceId,
32
+ 'variables': JSON.parse(variables),
33
+ 'variableTypes': JSON.parse(variableTypes),
33
34
  };
34
35
  await openapi.doRequest(null, urlPath, options);
35
36
  }
@@ -37,7 +38,7 @@ exports.updateWorkflowVariables = updateWorkflowVariables;
37
38
  async function createRecordBySync(objectApiName, record, authType) {
38
39
  // 1.check
39
40
  if (!objectApiName) {
40
- throw new exceptions.InvalidParamError("objectApiName is empty");
41
+ throw new exceptions.InvalidParamError('objectApiName is empty');
41
42
  }
42
43
  // 2.获取 options
43
44
  let options = commonHttp.getOptions(null, openapiHttpPath.createRecordBySyncV2);
@@ -45,17 +46,17 @@ async function createRecordBySync(objectApiName, record, authType) {
45
46
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
46
47
  // 3.请求
47
48
  options.json = {
48
- "operator": utils.getUserIDFromCtx(),
49
- "data": record,
49
+ 'operator': utils.getUserIDFromCtx(),
50
+ 'data': record,
50
51
  };
51
52
  authType = (0, utils_1.formatAuthType)(authType);
52
- options.headers["User"] = utils.getUserIDFromCtx() + "";
53
+ options.headers.User = String(utils.getUserIDFromCtx());
53
54
  if (authType) {
54
55
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
55
56
  }
56
57
  let task_id = utils.getTriggerTaskID();
57
58
  if (task_id) {
58
- options.json["task_id"] = task_id;
59
+ options.json.task_id = task_id;
59
60
  }
60
61
  let data = await openapi.doRequest(null, urlPath, options);
61
62
  if (data && data.record_id) {
@@ -69,7 +70,7 @@ async function createRecordBySync(objectApiName, record, authType) {
69
70
  async function updateRecordBySync(objectApiName, recordID, record, authType) {
70
71
  // 1.check
71
72
  if (!objectApiName) {
72
- throw new exceptions.InvalidParamError("objectApiName is empty");
73
+ throw new exceptions.InvalidParamError('objectApiName is empty');
73
74
  }
74
75
  // 2.获取 options
75
76
  let options = commonHttp.getOptions(null, openapiHttpPath.updateRecordBySyncV2);
@@ -77,25 +78,25 @@ async function updateRecordBySync(objectApiName, recordID, record, authType) {
77
78
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
78
79
  // 3.请求
79
80
  options.json = {
80
- "operator": utils.getUserIDFromCtx(),
81
- "record_id": recordID,
82
- "data": record,
81
+ 'operator': utils.getUserIDFromCtx(),
82
+ 'record_id': recordID,
83
+ 'data': record,
83
84
  };
84
85
  authType = (0, utils_1.formatAuthType)(authType);
85
- options.headers["User"] = utils.getUserIDFromCtx() + "";
86
+ options.headers.User = String(utils.getUserIDFromCtx());
86
87
  if (authType) {
87
88
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
88
89
  }
89
90
  let task_id = utils.getTriggerTaskID();
90
91
  if (task_id) {
91
- options.json["task_id"] = task_id;
92
+ options.json.task_id = task_id;
92
93
  }
93
94
  return openapi.doRequest(null, urlPath, options);
94
95
  }
95
96
  async function deleteRecordBySync(objectApiName, recordID, authType) {
96
97
  // 1.check
97
98
  if (!objectApiName) {
98
- throw new exceptions.InvalidParamError("objectApiName is empty");
99
+ throw new exceptions.InvalidParamError('objectApiName is empty');
99
100
  }
100
101
  // 2.获取 options
101
102
  let options = commonHttp.getOptions(null, openapiHttpPath.deleteRecordBySyncV2);
@@ -103,17 +104,17 @@ async function deleteRecordBySync(objectApiName, recordID, authType) {
103
104
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
104
105
  // 3.请求
105
106
  options.json = {
106
- "operator": utils.getUserIDFromCtx(),
107
- "record_id": recordID,
107
+ 'operator': utils.getUserIDFromCtx(),
108
+ 'record_id': recordID,
108
109
  };
109
110
  authType = (0, utils_1.formatAuthType)(authType);
110
- options.headers["User"] = utils.getUserIDFromCtx() + "";
111
+ options.headers.User = String(utils.getUserIDFromCtx());
111
112
  if (authType) {
112
113
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
113
114
  }
114
115
  let task_id = utils.getTriggerTaskID();
115
116
  if (task_id) {
116
- options.json["task_id"] = task_id;
117
+ options.json.task_id = task_id;
117
118
  }
118
119
  return openapi.doRequest(null, urlPath, options);
119
120
  }
@@ -124,17 +125,17 @@ async function createRecordsByAsync(objectApiName, records, authType) {
124
125
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
125
126
  // 2.请求
126
127
  options.json = {
127
- "operator": utils.getUserIDFromCtx(),
128
- "data": records,
128
+ 'operator': utils.getUserIDFromCtx(),
129
+ 'data': records,
129
130
  };
130
131
  authType = (0, utils_1.formatAuthType)(authType);
131
- options.headers["User"] = utils.getUserIDFromCtx() + "";
132
+ options.headers.User = String(utils.getUserIDFromCtx());
132
133
  if (authType) {
133
134
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
134
135
  }
135
136
  let task_id = utils.getTriggerTaskID();
136
137
  if (task_id) {
137
- options.json["automation_task_id"] = task_id;
138
+ options.json.automation_task_id = task_id;
138
139
  }
139
140
  return openapi.doRequest(null, urlPath, options);
140
141
  }
@@ -145,17 +146,17 @@ async function updateRecordsByAsync(objectApiName, recordMap, authType) {
145
146
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
146
147
  // 2.请求
147
148
  options.json = {
148
- "operator": utils.getUserIDFromCtx(),
149
- "data": recordMap,
149
+ 'operator': utils.getUserIDFromCtx(),
150
+ 'data': recordMap,
150
151
  };
151
152
  authType = (0, utils_1.formatAuthType)(authType);
152
- options.headers["User"] = utils.getUserIDFromCtx() + "";
153
+ options.headers.User = String(utils.getUserIDFromCtx());
153
154
  if (authType) {
154
155
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
155
156
  }
156
157
  let task_id = utils.getTriggerTaskID();
157
158
  if (task_id) {
158
- options.json["automation_task_id"] = task_id;
159
+ options.json.automation_task_id = task_id;
159
160
  }
160
161
  return openapi.doRequest(null, urlPath, options);
161
162
  }
@@ -166,17 +167,17 @@ async function deleteRecordsByAsync(objectApiName, recordIDs, authType) {
166
167
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
167
168
  // 2.请求
168
169
  options.json = {
169
- "operator": utils.getUserIDFromCtx(),
170
- "record_id_list": recordIDs,
170
+ 'operator': utils.getUserIDFromCtx(),
171
+ 'record_id_list': recordIDs,
171
172
  };
172
173
  authType = (0, utils_1.formatAuthType)(authType);
173
- options.headers["User"] = utils.getUserIDFromCtx() + "";
174
+ options.headers.User = String(utils.getUserIDFromCtx());
174
175
  if (authType) {
175
176
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
176
177
  }
177
178
  let task_id = utils.getTriggerTaskID();
178
179
  if (task_id) {
179
- options.json["automation_task_id"] = task_id;
180
+ options.json.automation_task_id = task_id;
180
181
  }
181
182
  return openapi.doRequest(null, urlPath, options);
182
183
  }
@@ -187,18 +188,18 @@ async function createRecordsBySync(objectApiName, records, authType) {
187
188
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
188
189
  // 2.请求
189
190
  options.json = {
190
- "operator": utils.getUserIDFromCtx(),
191
- "set_system_mod": 2,
192
- "data": records,
191
+ 'operator': utils.getUserIDFromCtx(),
192
+ 'set_system_mod': 2,
193
+ 'data': records,
193
194
  };
194
195
  authType = (0, utils_1.formatAuthType)(authType);
195
- options.headers["User"] = utils.getUserIDFromCtx() + "";
196
+ options.headers.User = String(utils.getUserIDFromCtx());
196
197
  if (authType) {
197
198
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
198
199
  }
199
200
  let task_id = utils.getTriggerTaskID();
200
201
  if (task_id) {
201
- options.json["automation_task_id"] = task_id;
202
+ options.json.automation_task_id = task_id;
202
203
  }
203
204
  return openapi.doRequest(null, urlPath, options);
204
205
  }
@@ -209,18 +210,18 @@ async function updateRecordsBySync(objectApiName, recordMap, authType) {
209
210
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
210
211
  // 2.请求
211
212
  options.json = {
212
- "operator": utils.getUserIDFromCtx(),
213
- "set_system_mod": 2,
214
- "data": recordMap,
213
+ 'operator': utils.getUserIDFromCtx(),
214
+ 'set_system_mod': 2,
215
+ 'data': recordMap,
215
216
  };
216
217
  authType = (0, utils_1.formatAuthType)(authType);
217
- options.headers["User"] = utils.getUserIDFromCtx() + "";
218
+ options.headers.User = String(utils.getUserIDFromCtx());
218
219
  if (authType) {
219
220
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
220
221
  }
221
222
  let task_id = utils.getTriggerTaskID();
222
223
  if (task_id) {
223
- options.json["automation_task_id"] = task_id;
224
+ options.json.automation_task_id = task_id;
224
225
  }
225
226
  return openapi.doRequest(null, urlPath, options);
226
227
  }
@@ -231,32 +232,32 @@ async function deleteRecordsBySync(objectApiName, recordIDs, authType) {
231
232
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
232
233
  // 2.请求
233
234
  options.json = {
234
- "operator": utils.getUserIDFromCtx(),
235
- "set_system_mod": 2,
236
- "record_id_list": recordIDs,
235
+ 'operator': utils.getUserIDFromCtx(),
236
+ 'set_system_mod': 2,
237
+ 'record_id_list': recordIDs,
237
238
  };
238
239
  authType = (0, utils_1.formatAuthType)(authType);
239
- options.headers["User"] = utils.getUserIDFromCtx() + "";
240
+ options.headers.User = String(utils.getUserIDFromCtx());
240
241
  if (authType) {
241
242
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
242
243
  }
243
244
  let task_id = utils.getTriggerTaskID();
244
245
  if (task_id) {
245
- options.json["automation_task_id"] = task_id;
246
+ options.json.automation_task_id = task_id;
246
247
  }
247
248
  return openapi.doRequest(null, urlPath, options);
248
249
  }
249
250
  function handleResponse(data, needCount) {
250
251
  // 返回数据的特殊处理
251
252
  if (needCount) {
252
- if (checkUtils.isObject(data) && data["total"]) {
253
- return data["total"];
253
+ if (checkUtils.isObject(data) && data.total) {
254
+ return data.total;
254
255
  }
255
256
  return 0;
256
257
  }
257
258
  else {
258
- if (checkUtils.isObject(data) && data["data_list"]) {
259
- return data["data_list"];
259
+ if (checkUtils.isObject(data) && data.data_list) {
260
+ return data.data_list;
260
261
  }
261
262
  return [];
262
263
  }
@@ -264,7 +265,7 @@ function handleResponse(data, needCount) {
264
265
  async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearch, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
265
266
  // 1.check
266
267
  if (!objectApiName) {
267
- throw new exceptions.InternalError("objectApiName is empty");
268
+ throw new exceptions.InternalError('objectApiName is empty');
268
269
  }
269
270
  // 2.获取 options
270
271
  let options = commonHttp.getOptions(null, needCount ? openapiHttpPath.mGetCountByCriterionV2 : openapiHttpPath.mGetRecordByCriterionV2);
@@ -272,18 +273,18 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearc
272
273
  urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
273
274
  // 3.请求
274
275
  options.json = {
275
- "criterion": JSON.parse(criterion),
276
- "order": order,
277
- "ignore_back_lookup_field": ignoreBackLookupField,
278
- "field_api_names": fieldApiNames,
279
- "offset": offset,
280
- "limit": limit,
281
- "need_filter_user_permission": false,
282
- "need_total_count": needCount,
283
- "fuzzySearch": fuzzySearch,
276
+ 'criterion': JSON.parse(criterion),
277
+ order,
278
+ 'ignore_back_lookup_field': ignoreBackLookupField,
279
+ 'field_api_names': fieldApiNames,
280
+ offset,
281
+ limit,
282
+ 'need_filter_user_permission': false,
283
+ 'need_total_count': needCount,
284
+ fuzzySearch,
284
285
  };
285
286
  authType = (0, utils_1.formatAuthType)(authType);
286
- options.headers["User"] = utils.getUserIDFromCtx() + "";
287
+ options.headers.User = String(utils.getUserIDFromCtx());
287
288
  if (authType) {
288
289
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
289
290
  }
@@ -293,7 +294,6 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearc
293
294
  /**
294
295
  * 上传文件
295
296
  *
296
- * @param ctx
297
297
  * @param datas:filePath;Stream
298
298
  * @param expire(seconds)
299
299
  * @returns {Promise<*|string>}
@@ -319,7 +319,7 @@ async function downloadFileByID(id, filePath) {
319
319
  // 1.获取 options
320
320
  let options = commonHttp.getOptions(null, openapiHttpPath.downloadFile);
321
321
  let urlPath = options._reqPath.replace(replaceKeys.fileID, id);
322
- options.responseType = "buffer";
322
+ options.responseType = 'buffer';
323
323
  // 2.请求
324
324
  let data = await openapi.doRequest(null, urlPath, options);
325
325
  // 3.写入文件
@@ -328,7 +328,7 @@ async function downloadFileByID(id, filePath) {
328
328
  checkUtils.checkFile(filePath);
329
329
  utils.mkdirs(path.dirname(filePath));
330
330
  fs.writeFileSync(filePath, data);
331
- return;
331
+ return undefined;
332
332
  }
333
333
  return data;
334
334
  }
@@ -336,7 +336,7 @@ async function downloadFileByToken(fileToken, filePath) {
336
336
  // 1.获取 options
337
337
  let options = commonHttp.getOptions(null, openapiHttpPath.downloadAttachment);
338
338
  let urlPath = options._reqPath + `?token=${fileToken}`;
339
- options.responseType = "buffer";
339
+ options.responseType = 'buffer';
340
340
  // 2.请求
341
341
  let data = await openapi.doRequest(null, urlPath, options);
342
342
  // 3.写入文件
@@ -345,7 +345,7 @@ async function downloadFileByToken(fileToken, filePath) {
345
345
  checkUtils.checkFile(filePath);
346
346
  utils.mkdirs(path.dirname(filePath));
347
347
  fs.writeFileSync(filePath, data);
348
- return;
348
+ return undefined;
349
349
  }
350
350
  return data;
351
351
  }
@@ -372,24 +372,24 @@ async function createMessage(msg) {
372
372
  throw new exceptions.InvalidParamError(`Invalid format of parameter icon, icon should be string.`);
373
373
  }
374
374
  let params = {};
375
- let modelKeySearchData = { "icon_type": msg.icon };
376
- let receiverIds = msg["target_users"] || [];
375
+ const modelKeySearchData = { 'icon_type': msg.icon };
376
+ const receiverIds = msg.target_users || [];
377
377
  if (!(receiverIds instanceof Array)) {
378
378
  throw new exceptions.InvalidParamError(`Invalid format of parameter target_users, target_users should be array.`);
379
379
  }
380
380
  if (receiverIds.length === 0) {
381
381
  throw new exceptions.InvalidParamError(`parameter target_users is required!`);
382
382
  }
383
- let percent = msg["percent"];
383
+ const percent = msg.percent;
384
384
  if (percent !== undefined && percent !== null) {
385
- if (typeof (percent) != 'number') {
386
- throw new exceptions.InvalidParamError(`Invalid format of parameter percent, percent should be number.`);
385
+ if (typeof (percent) !== 'number') {
386
+ throw new exceptions.InvalidParamError('Invalid format of parameter percent, percent should be number.');
387
387
  }
388
388
  if (percent < 0 || percent > 100) {
389
- throw new exceptions.InvalidParamError(`Invalid value of parameter percent, the value should be in range [0, 100].`);
389
+ throw new exceptions.InvalidParamError('Invalid value of parameter percent, the value should be in range [0, 100].');
390
390
  }
391
391
  else {
392
- modelKeySearchData["percent"] = JSON.stringify(percent);
392
+ modelKeySearchData.percent = JSON.stringify(percent);
393
393
  }
394
394
  }
395
395
  // kunlun类型
@@ -400,7 +400,7 @@ async function createMessage(msg) {
400
400
  // if (msg[key] instanceof fieldType.Multilingual) {
401
401
  if (fieldType.isKFieldTypeMultilingual((msg[key]))) {
402
402
  let value = JSON.stringify(msg[key].toJSON());
403
- params[key] = JSON.stringify({ "value": value });
403
+ params[key] = JSON.stringify({ value });
404
404
  }
405
405
  else {
406
406
  params[key] = JSON.stringify(msg[key].toJSON());
@@ -416,11 +416,11 @@ async function createMessage(msg) {
416
416
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
417
417
  // 3.请求
418
418
  options.json = {
419
- "NotifyModelKey": constants_1.notifyModel.key,
420
- "ReceiverIDs": receiverIds,
421
- "ParamsRawData": params,
422
- "Percent": percent,
423
- "ModelKeySearchData": modelKeySearchData
419
+ 'NotifyModelKey': constants_1.notifyModel.key,
420
+ 'ReceiverIDs': receiverIds,
421
+ 'ParamsRawData': params,
422
+ 'Percent': percent,
423
+ 'ModelKeySearchData': modelKeySearchData,
424
424
  };
425
425
  let res = await openapi.doRequest(null, urlPath, options);
426
426
  return Number(res.taskID);
@@ -440,17 +440,17 @@ async function updateMessage(msgId, msg) {
440
440
  throw new exceptions.InvalidParamError(`Invalid format of parameter icon, icon should be string.`);
441
441
  }
442
442
  let params = {};
443
- let modelKeySearchData = { "icon_type": msg.icon };
444
- let percent = msg["percent"];
443
+ const modelKeySearchData = { 'icon_type': msg.icon };
444
+ const percent = msg.percent;
445
445
  if (percent !== undefined && percent !== null) {
446
- if (typeof (percent) != 'number') {
447
- throw new exceptions.InvalidParamError(`Invalid format of parameter percent, percent should be number.`);
446
+ if (typeof (percent) !== 'number') {
447
+ throw new exceptions.InvalidParamError('Invalid format of parameter percent, percent should be number.');
448
448
  }
449
449
  if (percent < 0 || percent > 100) {
450
- throw new exceptions.InvalidParamError(`Invalid value of parameter percent in message ${msgId}, the value should be in range [0, 100].`);
450
+ throw new exceptions.InvalidParamError('Invalid value of parameter percent in message ${msgId}, the value should be in range [0, 100].');
451
451
  }
452
452
  else {
453
- modelKeySearchData["percent"] = JSON.stringify(percent);
453
+ modelKeySearchData.percent = JSON.stringify(percent);
454
454
  }
455
455
  }
456
456
  // kunlun类型
@@ -461,7 +461,7 @@ async function updateMessage(msgId, msg) {
461
461
  // if (msg[key] instanceof fieldType.Multilingual) {
462
462
  if (fieldType.isKFieldTypeMultilingual(msg[key])) {
463
463
  let value = JSON.stringify(msg[key].toJSON());
464
- params[key] = JSON.stringify({ "value": value });
464
+ params[key] = JSON.stringify({ value });
465
465
  }
466
466
  else {
467
467
  params[key] = JSON.stringify(msg[key].toJSON());
@@ -477,19 +477,19 @@ async function updateMessage(msgId, msg) {
477
477
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
478
478
  // 3.请求
479
479
  options.json = {
480
- "TaskID": msgId,
481
- "Percent": percent,
482
- "NotifyModelKey": constants_1.notifyModel.key,
483
- "ParamsRawData": params,
484
- "IsBackground": true,
485
- "ModelKeySearchData": modelKeySearchData
480
+ 'TaskID': msgId,
481
+ 'Percent': percent,
482
+ 'NotifyModelKey': constants_1.notifyModel.key,
483
+ 'ParamsRawData': params,
484
+ 'IsBackground': true,
485
+ 'ModelKeySearchData': modelKeySearchData,
486
486
  };
487
487
  return await openapi.doRequest(null, urlPath, options);
488
488
  }
489
489
  async function getFields(objectApiName) {
490
490
  // 1.check
491
491
  if (!objectApiName) {
492
- throw new exceptions.InvalidParamError("objectApiName is empty");
492
+ throw new exceptions.InvalidParamError('objectApiName is empty');
493
493
  }
494
494
  // 2.获取config
495
495
  let options = commonHttp.getOptions(null, openapiHttpPath.getFieldsV5);
@@ -504,10 +504,10 @@ async function getFields(objectApiName) {
504
504
  async function getField(objectApiName, fieldApiName) {
505
505
  // 1.check
506
506
  if (!objectApiName) {
507
- throw new exceptions.InternalError("objectApiName is empty");
507
+ throw new exceptions.InternalError('objectApiName is empty');
508
508
  }
509
509
  if (!fieldApiName) {
510
- throw new exceptions.InternalError("fieldApiName is empty");
510
+ throw new exceptions.InternalError('fieldApiName is empty');
511
511
  }
512
512
  // 2.获取 options
513
513
  let options = commonHttp.getOptions(null, openapiHttpPath.getFieldV5);
@@ -519,7 +519,7 @@ async function getField(objectApiName, fieldApiName) {
519
519
  }
520
520
  async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
521
521
  // 1.check
522
- if (typeof (workflowInstanceId) !== "number") {
522
+ if (typeof (workflowInstanceId) !== 'number') {
523
523
  throw new exceptions.InvalidParamError(`The type of workflowInstanceId should be number, but ${typeof (workflowInstanceId)}.`);
524
524
  }
525
525
  // 2.获取 options
@@ -527,9 +527,9 @@ async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
527
527
  let urlPath = options._reqPath;
528
528
  // 3.请求
529
529
  options.json = {
530
- "workflowInstanceID": workflowInstanceId,
531
- "operator": operator,
532
- "reason": reason,
530
+ 'workflowInstanceID': workflowInstanceId,
531
+ operator,
532
+ reason,
533
533
  };
534
534
  await openapi.doRequest(null, urlPath, options);
535
535
  }
@@ -539,19 +539,19 @@ async function modifyRecordsWithTransaction(placeholders, operations, authType)
539
539
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
540
540
  // 2.请求
541
541
  options.json = {
542
- "placeholders": placeholders,
543
- "operations": operations,
544
- "operatorId": utils.getUserIDFromCtx(),
545
- "setSystemField": 1,
542
+ placeholders,
543
+ operations,
544
+ 'operatorId': utils.getUserIDFromCtx(),
545
+ 'setSystemField': 1,
546
546
  };
547
547
  authType = (0, utils_1.formatAuthType)(authType);
548
- options.headers["User"] = utils.getUserIDFromCtx() + "";
548
+ options.headers.User = String(utils.getUserIDFromCtx());
549
549
  if (authType) {
550
550
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
551
551
  }
552
552
  let taskId = utils.getTriggerTaskID();
553
553
  if (taskId) {
554
- options.json["taskId"] = taskId;
554
+ options.json.taskId = taskId;
555
555
  }
556
556
  let result = await openapi.doRequest(null, urlPath, options);
557
557
  let retPlaceholders = new Map();
@@ -570,11 +570,11 @@ async function getGlobalConfigByKey(key) {
570
570
  let pageSize = 100, offset = 0;
571
571
  for (let i = 0;; i++) {
572
572
  options.json = {
573
- "biz_type": "GlobalVariables",
574
- "used_by": "UsedBySystem",
575
- "filter": {
576
- "offset": offset * i,
577
- "limit": pageSize
573
+ 'biz_type': 'GlobalVariables',
574
+ 'used_by': 'UsedBySystem',
575
+ 'filter': {
576
+ 'offset': offset * i,
577
+ 'limit': pageSize,
578
578
  },
579
579
  };
580
580
  let data = await openapi.doRequest(null, urlPath, options);
@@ -595,13 +595,13 @@ async function oql(oql, args, namedArgs, authType) {
595
595
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
596
596
  // 2.请求
597
597
  options.json = {
598
- "query": oql,
599
- "args": args,
600
- "namedArgs": namedArgs,
601
- "compat": true,
598
+ 'query': oql,
599
+ args,
600
+ namedArgs,
601
+ 'compat': true,
602
602
  };
603
603
  authType = (0, utils_1.formatAuthType)(authType);
604
- options.headers["User"] = utils.getUserIDFromCtx() + "";
604
+ options.headers.User = String(utils.getUserIDFromCtx());
605
605
  if (authType) {
606
606
  options.headers[constants_3.AuthTypeHttpHeader] = authType;
607
607
  }
@@ -620,7 +620,6 @@ async function openSDKCreateRecordBySync(objectApiName, record) {
620
620
  options.json = record;
621
621
  return await openapi.doRequest(null, urlPath, options);
622
622
  }
623
- ;
624
623
  async function openSDKUpdateRecordBySync(objectApiName, recordID, record) {
625
624
  // 1.获取 options
626
625
  let options = commonHttp.getOptions(null, openapiHttpPath.openSDKUpdateRecord);
@@ -727,7 +726,7 @@ async function openSDKDownloadAvatar(imageID) {
727
726
  let options = commonHttp.getOptions(null, openapiHttpPath.openSDKDownloadAvatar);
728
727
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
729
728
  urlPath = urlPath.replace(replaceKeys.fileID, imageID);
730
- options.responseType = "buffer";
729
+ options.responseType = 'buffer';
731
730
  // 2.请求
732
731
  let data = await openapi.doRequest(null, urlPath, options);
733
732
  // 3.写入文件
@@ -759,6 +758,10 @@ class RequestHttp {
759
758
  this.modifyRecordsWithTransaction = modifyRecordsWithTransaction;
760
759
  this.getGlobalConfigByKey = getGlobalConfigByKey;
761
760
  this.oql = oql;
761
+ this.getIntegrationAppAccessToken = getIntegrationAppAccessToken;
762
+ this.getIntegrationTenantAccessToken = getIntegrationTenantAccessToken;
763
+ this.getDefaultIntegrationAppAccessToken = getDefaultIntegrationAppAccessToken;
764
+ this.getDefaultIntegrationTenantAccessToken = getDefaultIntegrationTenantAccessToken;
762
765
  // TODO: open sdk api test
763
766
  this.openSDKCreateRecordBySync = openSDKCreateRecordBySync;
764
767
  this.openSDKUpdateRecordBySync = openSDKUpdateRecordBySync;
@@ -796,9 +799,11 @@ class RequestHttp {
796
799
  uploadFile(data, expire) {
797
800
  return null;
798
801
  }
802
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
799
803
  downloadFileByID(fileID, filePath) {
800
804
  return null;
801
805
  }
806
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
802
807
  downloadFileByToken(fileToken, filePath) {
803
808
  return null;
804
809
  }
@@ -852,6 +857,18 @@ class RequestHttp {
852
857
  mGetFileToken(ids) {
853
858
  return null;
854
859
  }
860
+ async getIntegrationAppAccessToken(apiName) {
861
+ return null;
862
+ }
863
+ async getIntegrationTenantAccessToken(apiName) {
864
+ return null;
865
+ }
866
+ async getDefaultIntegrationAppAccessToken() {
867
+ return null;
868
+ }
869
+ async getDefaultIntegrationTenantAccessToken() {
870
+ return null;
871
+ }
855
872
  // open sdk empty implement
856
873
  openSDKCreateRecordBySync(objectApiName, record) {
857
874
  }
@@ -891,10 +908,10 @@ async function invokeFuncWithAuth(idOrName, params) {
891
908
  let options = commonHttp.getOptions(null, openapiHttpPath.invokeFuncWithAuthInnerAPI);
892
909
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
893
910
  urlPath = urlPath.replace(replaceKeys.apiName, idOrName.APIName);
894
- options.headers["User"] = utils.getUserIDFromCtx();
911
+ options.headers.User = utils.getUserIDFromCtx();
895
912
  options.json = {
896
- "params": params,
897
- "context": getTriggerCtx(),
913
+ params,
914
+ 'context': getTriggerCtx(),
898
915
  };
899
916
  if (!idOrName.isInvokeByAPIName) {
900
917
  options.json.apiID = idOrName.APIId;
@@ -910,31 +927,31 @@ async function invokeFuncWithAuth(idOrName, params) {
910
927
  catch (e) {
911
928
  throw new exceptions.InternalError(`JSON parse failed for ${res.result}`);
912
929
  }
913
- if (!result || result.code !== "0") {
914
- throw new exceptions.InvalidParamError(`result is invalid for code: ${result ? result.code : ""} msg: ${result ? result.msg : ""}`);
930
+ if (!result || result.code !== '0') {
931
+ throw new exceptions.InvalidParamError(`result is invalid for code: ${result ? result.code : ''} msg: ${result ? result.msg : ''}`);
915
932
  }
916
933
  return result.data;
917
934
  }
918
935
  async function invokeFuncSync(idOrName, params) {
919
936
  let options = commonHttp.getOptions(null, openapiHttpPath.invokeFuncSyncInnerAPI);
920
937
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
921
- options.headers["User"] = utils.getUserIDFromCtx();
938
+ options.headers.User = utils.getUserIDFromCtx();
922
939
  options.json = {
923
- "params": JSON.stringify(params),
924
- "context": JSON.stringify(getTriggerCtx()),
925
- "triggerType": utils.getTriggerType(),
940
+ 'params': JSON.stringify(params),
941
+ 'context': JSON.stringify(getTriggerCtx()),
942
+ 'triggerType': utils.getTriggerType(),
926
943
  };
927
944
  // 相等时,表示是新版本函数的场景
928
945
  if (idOrName.isInvokeByAPIName) {
929
946
  options.json.apiAlias = idOrName.APIName;
930
- options.json.function_name = "";
947
+ options.json.function_name = '';
931
948
  }
932
949
  else {
933
950
  options.json.function_name = idOrName.APIId;
934
- options.json.apiAlias = "";
951
+ options.json.apiAlias = '';
935
952
  }
936
953
  let res = await openapi.doRequest(null, urlPath, options);
937
- if (res && res.code === "0") {
954
+ if (res && res.code === '0') {
938
955
  return res.data;
939
956
  }
940
957
  throw new exceptions.InternalError(`invokeFuncSync result.code(${res.code}) is invalid`);
@@ -943,16 +960,16 @@ async function createAsyncTaskV1(idOrName, params) {
943
960
  // attention: 异步任务接口存在先后区别,接口版本号不一致需 check,v1->v2
944
961
  let options = commonHttp.getOptions(null, openapiHttpPath.createAsyncTaskInnerAPIV2);
945
962
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
946
- options.headers["User"] = utils.getUserIDFromCtx();
963
+ options.headers.User = utils.getUserIDFromCtx();
947
964
  options.json = {
948
- "params": JSON.stringify(params),
949
- "context": JSON.stringify(getTriggerCtx()),
950
- "triggerType": utils.getTriggerType(),
965
+ 'params': JSON.stringify(params),
966
+ 'context': JSON.stringify(getTriggerCtx()),
967
+ 'triggerType': utils.getTriggerType(),
951
968
  };
952
969
  // 相等时,表示是新版本函数的场景
953
970
  if (idOrName.isInvokeByAPIName) {
954
971
  options.json.apiAlias = idOrName.APIName;
955
- options.json.function_name = ""; // required
972
+ options.json.function_name = ''; // required
956
973
  }
957
974
  else {
958
975
  options.json.function_name = idOrName.APIId;
@@ -979,13 +996,13 @@ async function createAsyncTaskV2(APIName, params) {
979
996
  if (checkLoopCtx(reqCtx)) {
980
997
  triggerCtx[constants_3.headers.loopMasks] = reqCtx.loopMasks;
981
998
  }
982
- options.headers["User"] = utils.getUserIDFromCtx();
999
+ options.headers.User = utils.getUserIDFromCtx();
983
1000
  options.json = {
984
- "apiAlias": APIName,
985
- "params": JSON.stringify(params),
986
- "context": JSON.stringify(getTriggerCtx()),
987
- "triggerType": utils.getTriggerType(),
988
- "extra": (0, common_1.getDebugExtraInfo)()
1001
+ 'apiAlias': APIName,
1002
+ 'params': JSON.stringify(params),
1003
+ 'context': JSON.stringify(getTriggerCtx()),
1004
+ 'triggerType': utils.getTriggerType(),
1005
+ 'extra': (0, common_1.getDebugExtraInfo)(),
989
1006
  };
990
1007
  let res = await openapi.doRequest(null, urlPath, options);
991
1008
  if (res && res.task_id) {
@@ -1013,14 +1030,14 @@ function getTriggerCtx() {
1013
1030
  }
1014
1031
  async function getExecutionUserTaskInfo(executionId) {
1015
1032
  if (!executionId) {
1016
- throw new exceptions.InvalidParamError(`executionId is empty`);
1033
+ throw new exceptions.InvalidParamError('executionId is empty');
1017
1034
  }
1018
1035
  let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getExecutionUserTaskInfo);
1019
1036
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.id, `${executionId}`);
1020
1037
  urlPath += `?operator=${utils.getUserIDFromCtx()}`;
1021
1038
  let res = await openapi.doRequest(null, urlPath, options);
1022
1039
  if (!res) {
1023
- throw new exceptions.InternalError(`getExecutionUserTaskInfo result is empty`);
1040
+ throw new exceptions.InternalError('getExecutionUserTaskInfo result is empty');
1024
1041
  }
1025
1042
  return res.taskList;
1026
1043
  }
@@ -1032,9 +1049,9 @@ async function executeFlow(APIName, option) {
1032
1049
  let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.executeFlow);
1033
1050
  let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, APIName);
1034
1051
  options.json = {
1035
- "operator": utils.getUserIDFromCtx(),
1036
- "variables": (0, common_1.transMapToFlowVariable)(option.params),
1037
- "loopMasks": utils.getLoopMasks(),
1052
+ 'operator': utils.getUserIDFromCtx(),
1053
+ 'variables': (0, common_1.transMapToFlowVariable)(option.params),
1054
+ 'loopMasks': utils.getLoopMasks(),
1038
1055
  };
1039
1056
  let res = await openapi.doRequest(null, urlPath, options);
1040
1057
  return {
@@ -1060,8 +1077,8 @@ async function revokeExecution(executionId, revokeOptions) {
1060
1077
  };
1061
1078
  }
1062
1079
  options.json = {
1063
- "operator": utils.getUserIDFromCtx(),
1064
- "reason": reason,
1080
+ 'operator': utils.getUserIDFromCtx(),
1081
+ reason,
1065
1082
  };
1066
1083
  return await openapi.doRequest(null, urlPath, options);
1067
1084
  }
@@ -1085,3 +1102,52 @@ async function getExecutionInfo(executionId) {
1085
1102
  };
1086
1103
  }
1087
1104
  exports.getExecutionInfo = getExecutionInfo;
1105
+ async function getIntegrationAppAccessToken(apiName) {
1106
+ // 1.check
1107
+ if (!apiName) {
1108
+ throw new exceptions.InvalidParamError('apiName is empty');
1109
+ }
1110
+ let options = commonHttp.getOptions(null, openapiHttpPath.getIntegrationAppAccessTokenAPI);
1111
+ let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, `${apiName}`);
1112
+ let res = await openapi.doRequest(null, urlPath, options);
1113
+ return {
1114
+ expire: res.expire,
1115
+ appAccessToken: res.appAccessToken,
1116
+ appId: res.appId,
1117
+ };
1118
+ }
1119
+ async function getIntegrationTenantAccessToken(apiName) {
1120
+ // 1.check
1121
+ if (!apiName) {
1122
+ throw new exceptions.InvalidParamError('apiName is empty');
1123
+ }
1124
+ let options = commonHttp.getOptions(null, openapiHttpPath.getIntegrationTenantAccessTokenAPI);
1125
+ let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, `${apiName}`);
1126
+ let res = await openapi.doRequest(null, urlPath, options);
1127
+ return {
1128
+ expire: res.expire,
1129
+ tenantAccessToken: res.tenantAccessToken,
1130
+ appId: res.appId,
1131
+ };
1132
+ }
1133
+ async function getDefaultIntegrationAppAccessToken() {
1134
+ let options = commonHttp.getOptions(null, openapiHttpPath.getDefaultIntegrationAppAccessTokenAPI);
1135
+ let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1136
+ let res = await openapi.doRequest(null, urlPath, options);
1137
+ return {
1138
+ expire: res.expire,
1139
+ appAccessToken: res.appAccessToken,
1140
+ appId: res.appId,
1141
+ };
1142
+ }
1143
+ async function getDefaultIntegrationTenantAccessToken() {
1144
+ let options = commonHttp.getOptions(null, openapiHttpPath.getDefaultIntegrationTenantAccessTokenAPI);
1145
+ let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
1146
+ let res = await openapi.doRequest(null, urlPath, options);
1147
+ return {
1148
+ expire: res.expire,
1149
+ tenantAccessToken: res.tenantAccessToken,
1150
+ appId: res.appId,
1151
+ };
1152
+ }
1153
+ //# sourceMappingURL=openapi.js.map