@byted-apaas/server-sdk-node 1.0.15 → 1.0.16-beta.16
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/README.md +18 -0
- package/application/application.d.ts +10 -8
- package/application/impl/impl.d.ts +8 -6
- package/application/impl/impl.js +6 -4
- package/constants/constants.js +4 -4
- package/constants/constants.js.map +1 -0
- package/context/context.d.ts +2 -71
- package/context/context.js +0 -16
- package/context/context.js.map +1 -0
- package/context/db/db.d.ts +12 -20
- package/context/db/db.js.map +1 -0
- package/context/db/impl/IObject.d.ts +46 -36
- package/context/db/impl/IObject.js.map +1 -0
- package/context/db/impl/db.d.ts +9 -9
- package/context/db/impl/db.js +6 -6
- package/context/db/impl/db.js.map +1 -0
- package/context/db/impl/object.d.ts +2 -0
- package/context/db/impl/object.js +74 -50
- package/context/db/impl/object.js.map +1 -0
- package/context/db/impl/oql/ioql.js.map +1 -0
- package/context/db/impl/oql/oql.d.ts +1 -1
- package/context/db/impl/oql/oql.js.map +1 -0
- package/context/db/impl/order.d.ts +1 -1
- package/context/db/impl/order.js +1 -1
- package/context/db/impl/order.js.map +1 -0
- package/context/db/impl/propertiesStore.js +1 -1
- package/context/db/impl/propertiesStore.js.map +1 -0
- package/context/db/impl/queryBuilder.d.ts +1 -0
- package/context/db/impl/queryBuilder.js.map +1 -0
- package/context/db/impl/transaction/index.d.ts +3 -3
- package/context/db/impl/transaction/index.js +46 -45
- package/context/db/impl/transaction/index.js.map +1 -0
- package/context/db/impl/transaction/operation.js.map +1 -0
- package/context/db/impl/transaction.d.ts +1 -6
- package/context/db/impl/transaction.js.map +1 -0
- package/context/globalConfig/globalConfig.js.map +1 -0
- package/context/integration/IIntegration.d.ts +30 -0
- package/context/integration/IIntegration.js +4 -0
- package/context/integration/impl/integration.d.ts +16 -0
- package/context/integration/impl/integration.js +62 -0
- package/context/metadata/components/common.js +3 -3
- package/context/metadata/components/common.js.map +1 -0
- package/context/metadata/components/components.d.ts +4 -4
- package/context/metadata/components/components.js.map +1 -0
- package/context/metadata/components/desktop/list.d.ts +3 -3
- package/context/metadata/components/desktop/list.js +23 -23
- package/context/metadata/components/desktop/list.js.map +1 -0
- package/context/metadata/components/desktop/recordDetail.d.ts +2 -2
- package/context/metadata/components/desktop/recordDetail.js.map +1 -0
- package/context/metadata/components/mobile/list.d.ts +4 -4
- package/context/metadata/components/mobile/list.js +1 -1
- package/context/metadata/components/mobile/list.js.map +1 -0
- package/context/metadata/metadata.d.ts +5 -6
- package/context/metadata/metadata.js +5 -6
- package/context/metadata/metadata.js.map +1 -0
- package/context/metadata/objects/fields.d.ts +6 -6
- package/context/metadata/objects/fields.js +57 -57
- package/context/metadata/objects/fields.js.map +1 -0
- package/context/metadata/objects/fields.util.d.ts +3 -3
- package/context/metadata/objects/fields.util.js +21 -21
- package/context/metadata/objects/fields.util.js.map +1 -0
- package/context/metadata/objects/objects.d.ts +1 -1
- package/context/metadata/objects/objects.js +1 -1
- package/context/metadata/objects/objects.js.map +1 -0
- package/context/metadata/types/common.d.ts +2 -2
- package/context/metadata/types/common.js.map +1 -0
- package/context/metadata/types/components.d.ts +18 -18
- package/context/metadata/types/components.js.map +1 -0
- package/context/metadata/types/objects.d.ts +93 -93
- package/context/metadata/types/objects.js.map +1 -0
- package/context/msg/msg.d.ts +2 -2
- package/context/msg/msg.js.map +1 -0
- package/context/resources/IResources.d.ts +5 -4
- package/context/resources/IResources.js.map +1 -0
- package/context/resources/impl/resources.d.ts +1 -0
- package/context/resources/impl/resources.js.map +1 -0
- package/context/tasks/tasks.d.ts +3 -3
- package/context/tasks/tasks.js +5 -5
- package/context/tasks/tasks.js.map +1 -0
- package/data/index.d.ts +3 -3
- package/data/index.js.map +1 -0
- package/global/application/flow/flow.d.ts +85 -0
- package/global/application/flow/flow.js +2 -0
- package/global/global.d.ts +88 -0
- package/global/global.js +3 -0
- package/hooks/api.d.ts +15 -9
- package/hooks/api.js +28 -23
- package/hooks/api.js.map +1 -0
- package/hooks/hooks.js +41 -0
- package/hooks/hooks.js.map +1 -0
- package/kunlun/kunlun.d.ts +5 -5
- package/kunlun/kunlun.js.map +1 -0
- package/kunlun/operator/IOperator.d.ts +16 -16
- package/kunlun/operator/IOperator.js.map +1 -0
- package/kunlun/operator/impl/expression.d.ts +5 -5
- package/kunlun/operator/impl/expression.js +5 -5
- package/kunlun/operator/impl/expression.js.map +1 -0
- package/kunlun/operator/impl/logic.d.ts +1 -1
- package/kunlun/operator/impl/logic.js +56 -39
- package/kunlun/operator/impl/logic.js.map +1 -0
- package/kunlun/operator/impl/logicV2.d.ts +8 -8
- package/kunlun/operator/impl/logicV2.js +23 -24
- package/kunlun/operator/impl/operator.d.ts +17 -17
- package/kunlun/operator/impl/operator.js +38 -38
- package/kunlun/operator/impl/operator.js.map +1 -0
- package/kunlun/operator/impl/operatorV2.d.ts +17 -17
- package/kunlun/operator/impl/operatorV2.js +38 -38
- package/lib/core.d.ts +3 -3
- package/lib/core.js.map +1 -0
- package/package.json +2 -2
- package/request/common.d.ts +1 -1
- package/request/common.js +4 -3
- package/request/constants.d.ts +1 -1
- package/request/constants.js +6 -6
- package/request/constants.js.map +1 -0
- package/request/faasinfra.d.ts +1 -1
- package/request/faasinfra.js +41 -251
- package/request/faasinfra.js.map +1 -0
- package/request/innerapi.d.ts +2 -1
- package/request/innerapi.js +3 -5
- package/request/innerapi.js.map +1 -0
- package/request/interface.d.ts +5 -4
- package/request/interface.js.map +1 -0
- package/request/openapi.d.ts +14 -9
- package/request/openapi.js +216 -153
- package/request/openapi.js.map +1 -0
- package/types/types.d.ts +13 -13
- package/types/types.js.map +1 -0
package/request/openapi.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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(
|
|
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
|
-
|
|
49
|
-
|
|
49
|
+
'operator': utils.getUserIDFromCtx(),
|
|
50
|
+
'data': record,
|
|
50
51
|
};
|
|
51
52
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
52
|
-
options.headers
|
|
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
|
|
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(
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
'operator': utils.getUserIDFromCtx(),
|
|
82
|
+
'record_id': recordID,
|
|
83
|
+
'data': record,
|
|
83
84
|
};
|
|
84
85
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
85
|
-
options.headers
|
|
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
|
|
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(
|
|
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
|
-
|
|
107
|
-
|
|
107
|
+
'operator': utils.getUserIDFromCtx(),
|
|
108
|
+
'record_id': recordID,
|
|
108
109
|
};
|
|
109
110
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
110
|
-
options.headers
|
|
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
|
|
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
|
-
|
|
128
|
-
|
|
128
|
+
'operator': utils.getUserIDFromCtx(),
|
|
129
|
+
'data': records,
|
|
129
130
|
};
|
|
130
131
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
131
|
-
options.headers
|
|
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
|
|
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
|
-
|
|
149
|
-
|
|
149
|
+
'operator': utils.getUserIDFromCtx(),
|
|
150
|
+
'data': recordMap,
|
|
150
151
|
};
|
|
151
152
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
152
|
-
options.headers
|
|
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
|
|
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
|
-
|
|
170
|
-
|
|
170
|
+
'operator': utils.getUserIDFromCtx(),
|
|
171
|
+
'record_id_list': recordIDs,
|
|
171
172
|
};
|
|
172
173
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
173
|
-
options.headers
|
|
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
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
|
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
|
|
224
|
+
options.json.automation_task_id = task_id;
|
|
224
225
|
}
|
|
225
226
|
return openapi.doRequest(null, urlPath, options);
|
|
226
227
|
}
|
|
@@ -231,43 +232,40 @@ async function deleteRecordsBySync(objectApiName, recordIDs, authType) {
|
|
|
231
232
|
urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
|
|
232
233
|
// 2.请求
|
|
233
234
|
options.json = {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
|
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
|
|
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
|
|
253
|
-
return data
|
|
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
|
|
259
|
-
return data
|
|
259
|
+
if (checkUtils.isObject(data) && data.data_list) {
|
|
260
|
+
return data.data_list;
|
|
260
261
|
}
|
|
261
262
|
return [];
|
|
262
263
|
}
|
|
263
264
|
}
|
|
264
|
-
async function getRecordsOrCountByCriterion(objectApiName, criterion, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
|
|
265
|
-
if (limit > 10000) {
|
|
266
|
-
limit = 10000;
|
|
267
|
-
}
|
|
265
|
+
async function getRecordsOrCountByCriterion(objectApiName, criterion, fuzzySearch, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
|
|
268
266
|
// 1.check
|
|
269
267
|
if (!objectApiName) {
|
|
270
|
-
throw new exceptions.InternalError(
|
|
268
|
+
throw new exceptions.InternalError('objectApiName is empty');
|
|
271
269
|
}
|
|
272
270
|
// 2.获取 options
|
|
273
271
|
let options = commonHttp.getOptions(null, needCount ? openapiHttpPath.mGetCountByCriterionV2 : openapiHttpPath.mGetRecordByCriterionV2);
|
|
@@ -275,17 +273,18 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, order, ign
|
|
|
275
273
|
urlPath = urlPath.replace(replaceKeys.objectApiName, objectApiName);
|
|
276
274
|
// 3.请求
|
|
277
275
|
options.json = {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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,
|
|
286
285
|
};
|
|
287
286
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
288
|
-
options.headers
|
|
287
|
+
options.headers.User = String(utils.getUserIDFromCtx());
|
|
289
288
|
if (authType) {
|
|
290
289
|
options.headers[constants_3.AuthTypeHttpHeader] = authType;
|
|
291
290
|
}
|
|
@@ -295,7 +294,6 @@ async function getRecordsOrCountByCriterion(objectApiName, criterion, order, ign
|
|
|
295
294
|
/**
|
|
296
295
|
* 上传文件
|
|
297
296
|
*
|
|
298
|
-
* @param ctx
|
|
299
297
|
* @param datas:filePath;Stream
|
|
300
298
|
* @param expire(seconds)
|
|
301
299
|
* @returns {Promise<*|string>}
|
|
@@ -321,7 +319,7 @@ async function downloadFileByID(id, filePath) {
|
|
|
321
319
|
// 1.获取 options
|
|
322
320
|
let options = commonHttp.getOptions(null, openapiHttpPath.downloadFile);
|
|
323
321
|
let urlPath = options._reqPath.replace(replaceKeys.fileID, id);
|
|
324
|
-
options.responseType =
|
|
322
|
+
options.responseType = 'buffer';
|
|
325
323
|
// 2.请求
|
|
326
324
|
let data = await openapi.doRequest(null, urlPath, options);
|
|
327
325
|
// 3.写入文件
|
|
@@ -330,7 +328,7 @@ async function downloadFileByID(id, filePath) {
|
|
|
330
328
|
checkUtils.checkFile(filePath);
|
|
331
329
|
utils.mkdirs(path.dirname(filePath));
|
|
332
330
|
fs.writeFileSync(filePath, data);
|
|
333
|
-
return;
|
|
331
|
+
return undefined;
|
|
334
332
|
}
|
|
335
333
|
return data;
|
|
336
334
|
}
|
|
@@ -338,7 +336,7 @@ async function downloadFileByToken(fileToken, filePath) {
|
|
|
338
336
|
// 1.获取 options
|
|
339
337
|
let options = commonHttp.getOptions(null, openapiHttpPath.downloadAttachment);
|
|
340
338
|
let urlPath = options._reqPath + `?token=${fileToken}`;
|
|
341
|
-
options.responseType =
|
|
339
|
+
options.responseType = 'buffer';
|
|
342
340
|
// 2.请求
|
|
343
341
|
let data = await openapi.doRequest(null, urlPath, options);
|
|
344
342
|
// 3.写入文件
|
|
@@ -347,7 +345,7 @@ async function downloadFileByToken(fileToken, filePath) {
|
|
|
347
345
|
checkUtils.checkFile(filePath);
|
|
348
346
|
utils.mkdirs(path.dirname(filePath));
|
|
349
347
|
fs.writeFileSync(filePath, data);
|
|
350
|
-
return;
|
|
348
|
+
return undefined;
|
|
351
349
|
}
|
|
352
350
|
return data;
|
|
353
351
|
}
|
|
@@ -374,24 +372,24 @@ async function createMessage(msg) {
|
|
|
374
372
|
throw new exceptions.InvalidParamError(`Invalid format of parameter icon, icon should be string.`);
|
|
375
373
|
}
|
|
376
374
|
let params = {};
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
const modelKeySearchData = { 'icon_type': msg.icon };
|
|
376
|
+
const receiverIds = msg.target_users || [];
|
|
379
377
|
if (!(receiverIds instanceof Array)) {
|
|
380
378
|
throw new exceptions.InvalidParamError(`Invalid format of parameter target_users, target_users should be array.`);
|
|
381
379
|
}
|
|
382
380
|
if (receiverIds.length === 0) {
|
|
383
381
|
throw new exceptions.InvalidParamError(`parameter target_users is required!`);
|
|
384
382
|
}
|
|
385
|
-
|
|
383
|
+
const percent = msg.percent;
|
|
386
384
|
if (percent !== undefined && percent !== null) {
|
|
387
|
-
if (typeof (percent)
|
|
388
|
-
throw new exceptions.InvalidParamError(
|
|
385
|
+
if (typeof (percent) !== 'number') {
|
|
386
|
+
throw new exceptions.InvalidParamError('Invalid format of parameter percent, percent should be number.');
|
|
389
387
|
}
|
|
390
388
|
if (percent < 0 || percent > 100) {
|
|
391
|
-
throw new exceptions.InvalidParamError(
|
|
389
|
+
throw new exceptions.InvalidParamError('Invalid value of parameter percent, the value should be in range [0, 100].');
|
|
392
390
|
}
|
|
393
391
|
else {
|
|
394
|
-
modelKeySearchData
|
|
392
|
+
modelKeySearchData.percent = JSON.stringify(percent);
|
|
395
393
|
}
|
|
396
394
|
}
|
|
397
395
|
// kunlun类型
|
|
@@ -402,7 +400,7 @@ async function createMessage(msg) {
|
|
|
402
400
|
// if (msg[key] instanceof fieldType.Multilingual) {
|
|
403
401
|
if (fieldType.isKFieldTypeMultilingual((msg[key]))) {
|
|
404
402
|
let value = JSON.stringify(msg[key].toJSON());
|
|
405
|
-
params[key] = JSON.stringify({
|
|
403
|
+
params[key] = JSON.stringify({ value });
|
|
406
404
|
}
|
|
407
405
|
else {
|
|
408
406
|
params[key] = JSON.stringify(msg[key].toJSON());
|
|
@@ -418,11 +416,11 @@ async function createMessage(msg) {
|
|
|
418
416
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
419
417
|
// 3.请求
|
|
420
418
|
options.json = {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
419
|
+
'NotifyModelKey': constants_1.notifyModel.key,
|
|
420
|
+
'ReceiverIDs': receiverIds,
|
|
421
|
+
'ParamsRawData': params,
|
|
422
|
+
'Percent': percent,
|
|
423
|
+
'ModelKeySearchData': modelKeySearchData,
|
|
426
424
|
};
|
|
427
425
|
let res = await openapi.doRequest(null, urlPath, options);
|
|
428
426
|
return Number(res.taskID);
|
|
@@ -442,17 +440,17 @@ async function updateMessage(msgId, msg) {
|
|
|
442
440
|
throw new exceptions.InvalidParamError(`Invalid format of parameter icon, icon should be string.`);
|
|
443
441
|
}
|
|
444
442
|
let params = {};
|
|
445
|
-
|
|
446
|
-
|
|
443
|
+
const modelKeySearchData = { 'icon_type': msg.icon };
|
|
444
|
+
const percent = msg.percent;
|
|
447
445
|
if (percent !== undefined && percent !== null) {
|
|
448
|
-
if (typeof (percent)
|
|
449
|
-
throw new exceptions.InvalidParamError(
|
|
446
|
+
if (typeof (percent) !== 'number') {
|
|
447
|
+
throw new exceptions.InvalidParamError('Invalid format of parameter percent, percent should be number.');
|
|
450
448
|
}
|
|
451
449
|
if (percent < 0 || percent > 100) {
|
|
452
|
-
throw new exceptions.InvalidParamError(
|
|
450
|
+
throw new exceptions.InvalidParamError('Invalid value of parameter percent in message ${msgId}, the value should be in range [0, 100].');
|
|
453
451
|
}
|
|
454
452
|
else {
|
|
455
|
-
modelKeySearchData
|
|
453
|
+
modelKeySearchData.percent = JSON.stringify(percent);
|
|
456
454
|
}
|
|
457
455
|
}
|
|
458
456
|
// kunlun类型
|
|
@@ -463,7 +461,7 @@ async function updateMessage(msgId, msg) {
|
|
|
463
461
|
// if (msg[key] instanceof fieldType.Multilingual) {
|
|
464
462
|
if (fieldType.isKFieldTypeMultilingual(msg[key])) {
|
|
465
463
|
let value = JSON.stringify(msg[key].toJSON());
|
|
466
|
-
params[key] = JSON.stringify({
|
|
464
|
+
params[key] = JSON.stringify({ value });
|
|
467
465
|
}
|
|
468
466
|
else {
|
|
469
467
|
params[key] = JSON.stringify(msg[key].toJSON());
|
|
@@ -479,19 +477,19 @@ async function updateMessage(msgId, msg) {
|
|
|
479
477
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
480
478
|
// 3.请求
|
|
481
479
|
options.json = {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
480
|
+
'TaskID': msgId,
|
|
481
|
+
'Percent': percent,
|
|
482
|
+
'NotifyModelKey': constants_1.notifyModel.key,
|
|
483
|
+
'ParamsRawData': params,
|
|
484
|
+
'IsBackground': true,
|
|
485
|
+
'ModelKeySearchData': modelKeySearchData,
|
|
488
486
|
};
|
|
489
487
|
return await openapi.doRequest(null, urlPath, options);
|
|
490
488
|
}
|
|
491
489
|
async function getFields(objectApiName) {
|
|
492
490
|
// 1.check
|
|
493
491
|
if (!objectApiName) {
|
|
494
|
-
throw new exceptions.InvalidParamError(
|
|
492
|
+
throw new exceptions.InvalidParamError('objectApiName is empty');
|
|
495
493
|
}
|
|
496
494
|
// 2.获取config
|
|
497
495
|
let options = commonHttp.getOptions(null, openapiHttpPath.getFieldsV5);
|
|
@@ -506,10 +504,10 @@ async function getFields(objectApiName) {
|
|
|
506
504
|
async function getField(objectApiName, fieldApiName) {
|
|
507
505
|
// 1.check
|
|
508
506
|
if (!objectApiName) {
|
|
509
|
-
throw new exceptions.InternalError(
|
|
507
|
+
throw new exceptions.InternalError('objectApiName is empty');
|
|
510
508
|
}
|
|
511
509
|
if (!fieldApiName) {
|
|
512
|
-
throw new exceptions.InternalError(
|
|
510
|
+
throw new exceptions.InternalError('fieldApiName is empty');
|
|
513
511
|
}
|
|
514
512
|
// 2.获取 options
|
|
515
513
|
let options = commonHttp.getOptions(null, openapiHttpPath.getFieldV5);
|
|
@@ -521,7 +519,7 @@ async function getField(objectApiName, fieldApiName) {
|
|
|
521
519
|
}
|
|
522
520
|
async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
|
|
523
521
|
// 1.check
|
|
524
|
-
if (typeof (workflowInstanceId) !==
|
|
522
|
+
if (typeof (workflowInstanceId) !== 'number') {
|
|
525
523
|
throw new exceptions.InvalidParamError(`The type of workflowInstanceId should be number, but ${typeof (workflowInstanceId)}.`);
|
|
526
524
|
}
|
|
527
525
|
// 2.获取 options
|
|
@@ -529,9 +527,9 @@ async function terminateWorkflowInstance(workflowInstanceId, operator, reason) {
|
|
|
529
527
|
let urlPath = options._reqPath;
|
|
530
528
|
// 3.请求
|
|
531
529
|
options.json = {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
530
|
+
'workflowInstanceID': workflowInstanceId,
|
|
531
|
+
operator,
|
|
532
|
+
reason,
|
|
535
533
|
};
|
|
536
534
|
await openapi.doRequest(null, urlPath, options);
|
|
537
535
|
}
|
|
@@ -541,19 +539,19 @@ async function modifyRecordsWithTransaction(placeholders, operations, authType)
|
|
|
541
539
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
542
540
|
// 2.请求
|
|
543
541
|
options.json = {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
542
|
+
placeholders,
|
|
543
|
+
operations,
|
|
544
|
+
'operatorId': utils.getUserIDFromCtx(),
|
|
545
|
+
'setSystemField': 1,
|
|
548
546
|
};
|
|
549
547
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
550
|
-
options.headers
|
|
548
|
+
options.headers.User = String(utils.getUserIDFromCtx());
|
|
551
549
|
if (authType) {
|
|
552
550
|
options.headers[constants_3.AuthTypeHttpHeader] = authType;
|
|
553
551
|
}
|
|
554
552
|
let taskId = utils.getTriggerTaskID();
|
|
555
553
|
if (taskId) {
|
|
556
|
-
options.json
|
|
554
|
+
options.json.taskId = taskId;
|
|
557
555
|
}
|
|
558
556
|
let result = await openapi.doRequest(null, urlPath, options);
|
|
559
557
|
let retPlaceholders = new Map();
|
|
@@ -572,11 +570,11 @@ async function getGlobalConfigByKey(key) {
|
|
|
572
570
|
let pageSize = 100, offset = 0;
|
|
573
571
|
for (let i = 0;; i++) {
|
|
574
572
|
options.json = {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
573
|
+
'biz_type': 'GlobalVariables',
|
|
574
|
+
'used_by': 'UsedBySystem',
|
|
575
|
+
'filter': {
|
|
576
|
+
'offset': offset * i,
|
|
577
|
+
'limit': pageSize,
|
|
580
578
|
},
|
|
581
579
|
};
|
|
582
580
|
let data = await openapi.doRequest(null, urlPath, options);
|
|
@@ -597,13 +595,13 @@ async function oql(oql, args, namedArgs, authType) {
|
|
|
597
595
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
598
596
|
// 2.请求
|
|
599
597
|
options.json = {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
598
|
+
'query': oql,
|
|
599
|
+
args,
|
|
600
|
+
namedArgs,
|
|
601
|
+
'compat': true,
|
|
604
602
|
};
|
|
605
603
|
authType = (0, utils_1.formatAuthType)(authType);
|
|
606
|
-
options.headers
|
|
604
|
+
options.headers.User = String(utils.getUserIDFromCtx());
|
|
607
605
|
if (authType) {
|
|
608
606
|
options.headers[constants_3.AuthTypeHttpHeader] = authType;
|
|
609
607
|
}
|
|
@@ -622,7 +620,6 @@ async function openSDKCreateRecordBySync(objectApiName, record) {
|
|
|
622
620
|
options.json = record;
|
|
623
621
|
return await openapi.doRequest(null, urlPath, options);
|
|
624
622
|
}
|
|
625
|
-
;
|
|
626
623
|
async function openSDKUpdateRecordBySync(objectApiName, recordID, record) {
|
|
627
624
|
// 1.获取 options
|
|
628
625
|
let options = commonHttp.getOptions(null, openapiHttpPath.openSDKUpdateRecord);
|
|
@@ -729,7 +726,7 @@ async function openSDKDownloadAvatar(imageID) {
|
|
|
729
726
|
let options = commonHttp.getOptions(null, openapiHttpPath.openSDKDownloadAvatar);
|
|
730
727
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
731
728
|
urlPath = urlPath.replace(replaceKeys.fileID, imageID);
|
|
732
|
-
options.responseType =
|
|
729
|
+
options.responseType = 'buffer';
|
|
733
730
|
// 2.请求
|
|
734
731
|
let data = await openapi.doRequest(null, urlPath, options);
|
|
735
732
|
// 3.写入文件
|
|
@@ -761,6 +758,10 @@ class RequestHttp {
|
|
|
761
758
|
this.modifyRecordsWithTransaction = modifyRecordsWithTransaction;
|
|
762
759
|
this.getGlobalConfigByKey = getGlobalConfigByKey;
|
|
763
760
|
this.oql = oql;
|
|
761
|
+
this.getIntegrationAppAccessToken = getIntegrationAppAccessToken;
|
|
762
|
+
this.getIntegrationTenantAccessToken = getIntegrationTenantAccessToken;
|
|
763
|
+
this.getDefaultIntegrationAppAccessToken = getDefaultIntegrationAppAccessToken;
|
|
764
|
+
this.getDefaultIntegrationTenantAccessToken = getDefaultIntegrationTenantAccessToken;
|
|
764
765
|
// TODO: open sdk api test
|
|
765
766
|
this.openSDKCreateRecordBySync = openSDKCreateRecordBySync;
|
|
766
767
|
this.openSDKUpdateRecordBySync = openSDKUpdateRecordBySync;
|
|
@@ -793,14 +794,16 @@ class RequestHttp {
|
|
|
793
794
|
}
|
|
794
795
|
deleteRecordsBySync(objectApiName, recordIDs, authType) {
|
|
795
796
|
}
|
|
796
|
-
getRecordsOrCountByCriterion(objectApiName, criterion, order, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
|
|
797
|
+
getRecordsOrCountByCriterion(objectApiName, criterion, order, fuzzySearch, ignoreBackLookupField, fieldApiNames, offset, limit, needCount, authType) {
|
|
797
798
|
}
|
|
798
799
|
uploadFile(data, expire) {
|
|
799
800
|
return null;
|
|
800
801
|
}
|
|
802
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
801
803
|
downloadFileByID(fileID, filePath) {
|
|
802
804
|
return null;
|
|
803
805
|
}
|
|
806
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
804
807
|
downloadFileByToken(fileToken, filePath) {
|
|
805
808
|
return null;
|
|
806
809
|
}
|
|
@@ -854,6 +857,18 @@ class RequestHttp {
|
|
|
854
857
|
mGetFileToken(ids) {
|
|
855
858
|
return null;
|
|
856
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
|
+
}
|
|
857
872
|
// open sdk empty implement
|
|
858
873
|
openSDKCreateRecordBySync(objectApiName, record) {
|
|
859
874
|
}
|
|
@@ -893,10 +908,10 @@ async function invokeFuncWithAuth(idOrName, params) {
|
|
|
893
908
|
let options = commonHttp.getOptions(null, openapiHttpPath.invokeFuncWithAuthInnerAPI);
|
|
894
909
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
895
910
|
urlPath = urlPath.replace(replaceKeys.apiName, idOrName.APIName);
|
|
896
|
-
options.headers
|
|
911
|
+
options.headers.User = utils.getUserIDFromCtx();
|
|
897
912
|
options.json = {
|
|
898
|
-
|
|
899
|
-
|
|
913
|
+
params,
|
|
914
|
+
'context': getTriggerCtx(),
|
|
900
915
|
};
|
|
901
916
|
if (!idOrName.isInvokeByAPIName) {
|
|
902
917
|
options.json.apiID = idOrName.APIId;
|
|
@@ -912,31 +927,31 @@ async function invokeFuncWithAuth(idOrName, params) {
|
|
|
912
927
|
catch (e) {
|
|
913
928
|
throw new exceptions.InternalError(`JSON parse failed for ${res.result}`);
|
|
914
929
|
}
|
|
915
|
-
if (!result || result.code !==
|
|
916
|
-
throw new exceptions.InvalidParamError(`result is invalid for code: ${result ? result.code :
|
|
930
|
+
if (!result || result.code !== '0') {
|
|
931
|
+
throw new exceptions.InvalidParamError(`result is invalid for code: ${result ? result.code : ''} msg: ${result ? result.msg : ''}`);
|
|
917
932
|
}
|
|
918
933
|
return result.data;
|
|
919
934
|
}
|
|
920
935
|
async function invokeFuncSync(idOrName, params) {
|
|
921
936
|
let options = commonHttp.getOptions(null, openapiHttpPath.invokeFuncSyncInnerAPI);
|
|
922
937
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
923
|
-
options.headers
|
|
938
|
+
options.headers.User = utils.getUserIDFromCtx();
|
|
924
939
|
options.json = {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
940
|
+
'params': JSON.stringify(params),
|
|
941
|
+
'context': JSON.stringify(getTriggerCtx()),
|
|
942
|
+
'triggerType': utils.getTriggerType(),
|
|
928
943
|
};
|
|
929
944
|
// 相等时,表示是新版本函数的场景
|
|
930
945
|
if (idOrName.isInvokeByAPIName) {
|
|
931
946
|
options.json.apiAlias = idOrName.APIName;
|
|
932
|
-
options.json.function_name =
|
|
947
|
+
options.json.function_name = '';
|
|
933
948
|
}
|
|
934
949
|
else {
|
|
935
950
|
options.json.function_name = idOrName.APIId;
|
|
936
|
-
options.json.apiAlias =
|
|
951
|
+
options.json.apiAlias = '';
|
|
937
952
|
}
|
|
938
953
|
let res = await openapi.doRequest(null, urlPath, options);
|
|
939
|
-
if (res && res.code ===
|
|
954
|
+
if (res && res.code === '0') {
|
|
940
955
|
return res.data;
|
|
941
956
|
}
|
|
942
957
|
throw new exceptions.InternalError(`invokeFuncSync result.code(${res.code}) is invalid`);
|
|
@@ -945,16 +960,16 @@ async function createAsyncTaskV1(idOrName, params) {
|
|
|
945
960
|
// attention: 异步任务接口存在先后区别,接口版本号不一致需 check,v1->v2
|
|
946
961
|
let options = commonHttp.getOptions(null, openapiHttpPath.createAsyncTaskInnerAPIV2);
|
|
947
962
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)());
|
|
948
|
-
options.headers
|
|
963
|
+
options.headers.User = utils.getUserIDFromCtx();
|
|
949
964
|
options.json = {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
965
|
+
'params': JSON.stringify(params),
|
|
966
|
+
'context': JSON.stringify(getTriggerCtx()),
|
|
967
|
+
'triggerType': utils.getTriggerType(),
|
|
953
968
|
};
|
|
954
969
|
// 相等时,表示是新版本函数的场景
|
|
955
970
|
if (idOrName.isInvokeByAPIName) {
|
|
956
971
|
options.json.apiAlias = idOrName.APIName;
|
|
957
|
-
options.json.function_name =
|
|
972
|
+
options.json.function_name = ''; // required
|
|
958
973
|
}
|
|
959
974
|
else {
|
|
960
975
|
options.json.function_name = idOrName.APIId;
|
|
@@ -981,13 +996,13 @@ async function createAsyncTaskV2(APIName, params) {
|
|
|
981
996
|
if (checkLoopCtx(reqCtx)) {
|
|
982
997
|
triggerCtx[constants_3.headers.loopMasks] = reqCtx.loopMasks;
|
|
983
998
|
}
|
|
984
|
-
options.headers
|
|
999
|
+
options.headers.User = utils.getUserIDFromCtx();
|
|
985
1000
|
options.json = {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1001
|
+
'apiAlias': APIName,
|
|
1002
|
+
'params': JSON.stringify(params),
|
|
1003
|
+
'context': JSON.stringify(getTriggerCtx()),
|
|
1004
|
+
'triggerType': utils.getTriggerType(),
|
|
1005
|
+
'extra': (0, common_1.getDebugExtraInfo)(),
|
|
991
1006
|
};
|
|
992
1007
|
let res = await openapi.doRequest(null, urlPath, options);
|
|
993
1008
|
if (res && res.task_id) {
|
|
@@ -1015,14 +1030,14 @@ function getTriggerCtx() {
|
|
|
1015
1030
|
}
|
|
1016
1031
|
async function getExecutionUserTaskInfo(executionId) {
|
|
1017
1032
|
if (!executionId) {
|
|
1018
|
-
throw new exceptions.InvalidParamError(
|
|
1033
|
+
throw new exceptions.InvalidParamError('executionId is empty');
|
|
1019
1034
|
}
|
|
1020
1035
|
let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.getExecutionUserTaskInfo);
|
|
1021
1036
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.id, `${executionId}`);
|
|
1022
1037
|
urlPath += `?operator=${utils.getUserIDFromCtx()}`;
|
|
1023
1038
|
let res = await openapi.doRequest(null, urlPath, options);
|
|
1024
1039
|
if (!res) {
|
|
1025
|
-
throw new exceptions.InternalError(
|
|
1040
|
+
throw new exceptions.InternalError('getExecutionUserTaskInfo result is empty');
|
|
1026
1041
|
}
|
|
1027
1042
|
return res.taskList;
|
|
1028
1043
|
}
|
|
@@ -1034,9 +1049,9 @@ async function executeFlow(APIName, option) {
|
|
|
1034
1049
|
let options = commonHttp.getOptions(null, constants_2.openapiHttpPath.executeFlow);
|
|
1035
1050
|
let urlPath = options._reqPath.replace(replaceKeys.namespace, await (0, common_1.getNamespaceForOpenAndFaaSSDK)()).replace(replaceKeys.apiName, APIName);
|
|
1036
1051
|
options.json = {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1052
|
+
'operator': utils.getUserIDFromCtx(),
|
|
1053
|
+
'variables': (0, common_1.transMapToFlowVariable)(option.params),
|
|
1054
|
+
'loopMasks': utils.getLoopMasks(),
|
|
1040
1055
|
};
|
|
1041
1056
|
let res = await openapi.doRequest(null, urlPath, options);
|
|
1042
1057
|
return {
|
|
@@ -1062,8 +1077,8 @@ async function revokeExecution(executionId, revokeOptions) {
|
|
|
1062
1077
|
};
|
|
1063
1078
|
}
|
|
1064
1079
|
options.json = {
|
|
1065
|
-
|
|
1066
|
-
|
|
1080
|
+
'operator': utils.getUserIDFromCtx(),
|
|
1081
|
+
reason,
|
|
1067
1082
|
};
|
|
1068
1083
|
return await openapi.doRequest(null, urlPath, options);
|
|
1069
1084
|
}
|
|
@@ -1087,3 +1102,51 @@ async function getExecutionInfo(executionId) {
|
|
|
1087
1102
|
};
|
|
1088
1103
|
}
|
|
1089
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
|
+
}
|