@tachybase/plugin-action-custom-request 1.1.2 → 1.1.9
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/dist/externalVersion.js +11 -11
- package/dist/server/actions/send.js +24 -3
- package/package.json +13 -12
package/dist/externalVersion.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.1.
|
|
3
|
+
"@tachybase/client": "1.1.9",
|
|
4
4
|
"react-i18next": "15.2.0",
|
|
5
|
-
"@tachybase/logger": "1.1.
|
|
6
|
-
"@tachybase/server": "1.1.
|
|
7
|
-
"@tachybase/test": "1.1.
|
|
8
|
-
"@tachybase/schema": "1.1.
|
|
9
|
-
"@tachybase/components": "1.1.
|
|
5
|
+
"@tachybase/logger": "1.1.9",
|
|
6
|
+
"@tachybase/server": "1.1.9",
|
|
7
|
+
"@tachybase/test": "1.1.9",
|
|
8
|
+
"@tachybase/schema": "1.1.9",
|
|
9
|
+
"@tachybase/components": "1.1.9",
|
|
10
10
|
"antd": "5.22.5",
|
|
11
|
-
"@tachybase/utils": "1.1.
|
|
11
|
+
"@tachybase/utils": "1.1.9",
|
|
12
12
|
"react-router-dom": "6.28.1",
|
|
13
|
-
"@tachybase/actions": "1.1.
|
|
14
|
-
"@tachybase/evaluators": "1.1.
|
|
15
|
-
"axios": "
|
|
16
|
-
"@tachybase/database": "1.1.
|
|
13
|
+
"@tachybase/actions": "1.1.9",
|
|
14
|
+
"@tachybase/evaluators": "1.1.9",
|
|
15
|
+
"axios": "1.7.7",
|
|
16
|
+
"@tachybase/database": "1.1.9"
|
|
17
17
|
};
|
|
@@ -139,12 +139,14 @@ async function send(ctx, next) {
|
|
|
139
139
|
});
|
|
140
140
|
return template(variables);
|
|
141
141
|
};
|
|
142
|
+
const { baseURL, url: axiosURL, isExternal } = extractBaseUrlAndPath(url);
|
|
142
143
|
const axiosRequestConfig = {
|
|
143
|
-
baseURL
|
|
144
|
+
baseURL,
|
|
144
145
|
...options,
|
|
145
|
-
url: getParsedValue(
|
|
146
|
+
url: getParsedValue(axiosURL),
|
|
146
147
|
headers: {
|
|
147
|
-
|
|
148
|
+
// 外部请求自行处理权限问题
|
|
149
|
+
Authorization: isExternal ? void 0 : "Bearer " + ctx.getBearerToken(),
|
|
148
150
|
...getHeaders(ctx.headers),
|
|
149
151
|
...omitNullAndUndefined(getParsedValue(arrayToObject(headers)))
|
|
150
152
|
},
|
|
@@ -192,6 +194,25 @@ async function send(ctx, next) {
|
|
|
192
194
|
}
|
|
193
195
|
return next();
|
|
194
196
|
}
|
|
197
|
+
function extractBaseUrlAndPath(url) {
|
|
198
|
+
const currentBaseURL = import_server.Gateway.getInstance().runAtLoop;
|
|
199
|
+
if (/^https?:\/\//i.test(url)) {
|
|
200
|
+
const urlObj = new URL(url);
|
|
201
|
+
const baseURL = `${urlObj.protocol}//${urlObj.host}`;
|
|
202
|
+
const newUrl = urlObj.pathname + urlObj.search + urlObj.hash;
|
|
203
|
+
return {
|
|
204
|
+
baseURL,
|
|
205
|
+
url: newUrl,
|
|
206
|
+
isExternal: baseURL !== currentBaseURL
|
|
207
|
+
};
|
|
208
|
+
} else {
|
|
209
|
+
return {
|
|
210
|
+
baseURL: import_server.Gateway.getInstance().runAtLoop,
|
|
211
|
+
url,
|
|
212
|
+
isExternal: false
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
195
216
|
// Annotate the CommonJS export names for ESM import in node:
|
|
196
217
|
0 && (module.exports = {
|
|
197
218
|
send
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-action-custom-request",
|
|
3
3
|
"displayName": "Action: Custom request",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.9",
|
|
5
5
|
"description": "Sending a request to any HTTP service supports sending context data to the target service.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Actions"
|
|
@@ -11,23 +11,24 @@
|
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"antd": "5.22.5",
|
|
14
|
+
"axios": "1.7.7",
|
|
14
15
|
"file-saver": "^2.0.5",
|
|
15
16
|
"lodash": "~4.17.21",
|
|
16
17
|
"react-i18next": "^15.2.0",
|
|
17
18
|
"react-router-dom": "6.28.1",
|
|
18
|
-
"@tachybase/
|
|
19
|
-
"@tachybase/
|
|
19
|
+
"@tachybase/components": "1.1.9",
|
|
20
|
+
"@tachybase/schema": "1.1.9"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
|
-
"@tachybase/actions": "1.1.
|
|
23
|
-
"@tachybase/
|
|
24
|
-
"@tachybase/
|
|
25
|
-
"@tachybase/logger": "1.1.
|
|
26
|
-
"@tachybase/sdk": "1.1.
|
|
27
|
-
"@tachybase/database": "1.1.
|
|
28
|
-
"@tachybase/
|
|
29
|
-
"@tachybase/
|
|
30
|
-
"@tachybase/
|
|
23
|
+
"@tachybase/actions": "1.1.9",
|
|
24
|
+
"@tachybase/client": "1.1.9",
|
|
25
|
+
"@tachybase/evaluators": "1.1.9",
|
|
26
|
+
"@tachybase/logger": "1.1.9",
|
|
27
|
+
"@tachybase/sdk": "1.1.9",
|
|
28
|
+
"@tachybase/database": "1.1.9",
|
|
29
|
+
"@tachybase/utils": "1.1.9",
|
|
30
|
+
"@tachybase/server": "1.1.9",
|
|
31
|
+
"@tachybase/test": "1.1.9"
|
|
31
32
|
},
|
|
32
33
|
"description.zh-CN": "向任意 HTTP 服务发送请求,支持将上下文数据发送给目标服务。",
|
|
33
34
|
"displayName.zh-CN": "操作:自定义请求",
|