@nocobase/plugin-action-custom-request 2.2.0-beta.8 → 2.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +10 -10
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/server/actions/send.js +22 -0
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.
|
|
11
|
+
"@nocobase/client": "2.3.0-alpha.1",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"react-i18next": "11.18.6",
|
|
14
14
|
"@formily/react": "2.3.7",
|
|
15
|
-
"@nocobase/client-v2": "2.
|
|
16
|
-
"@nocobase/flow-engine": "2.
|
|
15
|
+
"@nocobase/client-v2": "2.3.0-alpha.1",
|
|
16
|
+
"@nocobase/flow-engine": "2.3.0-alpha.1",
|
|
17
17
|
"antd": "5.24.2",
|
|
18
18
|
"@emotion/css": "11.13.0",
|
|
19
|
-
"@nocobase/utils": "2.
|
|
20
|
-
"@nocobase/logger": "2.
|
|
21
|
-
"@nocobase/server": "2.
|
|
22
|
-
"@nocobase/test": "2.
|
|
19
|
+
"@nocobase/utils": "2.3.0-alpha.1",
|
|
20
|
+
"@nocobase/logger": "2.3.0-alpha.1",
|
|
21
|
+
"@nocobase/server": "2.3.0-alpha.1",
|
|
22
|
+
"@nocobase/test": "2.3.0-alpha.1",
|
|
23
23
|
"@formily/antd-v5": "1.2.3",
|
|
24
24
|
"lodash": "4.18.1",
|
|
25
25
|
"@formily/shared": "2.3.7",
|
|
26
|
-
"@nocobase/actions": "2.
|
|
27
|
-
"@nocobase/evaluators": "2.
|
|
26
|
+
"@nocobase/actions": "2.3.0-alpha.1",
|
|
27
|
+
"@nocobase/evaluators": "2.3.0-alpha.1",
|
|
28
28
|
"axios": "1.7.7",
|
|
29
|
-
"@nocobase/database": "2.
|
|
29
|
+
"@nocobase/database": "2.3.0-alpha.1"
|
|
30
30
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"Request settings": "Request settings",
|
|
25
25
|
"Response type": "Response type",
|
|
26
26
|
"Roles": "Roles",
|
|
27
|
+
"Runtime request options cannot override the request target": "Runtime request options cannot override the request target",
|
|
27
28
|
"Stream": "Stream",
|
|
28
29
|
"Timeout config": "Timeout config",
|
|
29
30
|
"Title": "Title",
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -91,6 +91,21 @@ const omitNullAndUndefined = (obj) => {
|
|
|
91
91
|
return acc;
|
|
92
92
|
}, {});
|
|
93
93
|
};
|
|
94
|
+
const RuntimeTargetOptionKeys = /* @__PURE__ */ new Set([
|
|
95
|
+
"url",
|
|
96
|
+
"baseURL",
|
|
97
|
+
"proxy",
|
|
98
|
+
"socketPath",
|
|
99
|
+
"transport",
|
|
100
|
+
"httpAgent",
|
|
101
|
+
"httpsAgent"
|
|
102
|
+
]);
|
|
103
|
+
const getForbiddenRuntimeTargetOptionKeys = (runtimeOptions) => {
|
|
104
|
+
if (!runtimeOptions || typeof runtimeOptions !== "object" || Array.isArray(runtimeOptions)) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
return Object.keys(runtimeOptions).filter((key) => RuntimeTargetOptionKeys.has(key));
|
|
108
|
+
};
|
|
94
109
|
const CurrentUserVariableRegExp = /{{\s*(?:ctx\.)?(currentUser[^}]+)\s*}}/g;
|
|
95
110
|
const getCurrentUserAppends = (str, user) => {
|
|
96
111
|
const matched = str.matchAll(CurrentUserVariableRegExp);
|
|
@@ -165,6 +180,13 @@ async function send(ctx, next) {
|
|
|
165
180
|
if (!requestConfig) {
|
|
166
181
|
ctx.throw(404, "request config not found");
|
|
167
182
|
}
|
|
183
|
+
const forbiddenRuntimeOptionKeys = getForbiddenRuntimeTargetOptionKeys(runtimeOptions);
|
|
184
|
+
if (forbiddenRuntimeOptionKeys.length) {
|
|
185
|
+
return ctx.throw(
|
|
186
|
+
400,
|
|
187
|
+
ctx.t("Runtime request options cannot override the request target", { ns: "action-custom-request" })
|
|
188
|
+
);
|
|
189
|
+
}
|
|
168
190
|
ctx.withoutDataWrapping = true;
|
|
169
191
|
const mergedOptions = {
|
|
170
192
|
...requestConfig.options || {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-action-custom-request",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha.1",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/action-custom-request",
|
|
6
6
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/action-custom-request",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@nocobase/server": "2.x",
|
|
35
35
|
"@nocobase/test": "2.x"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "2377df8ceb12549149017f7f14a61207bf6e49a2",
|
|
38
38
|
"keywords": [
|
|
39
39
|
"Actions"
|
|
40
40
|
]
|