@nocobase/resourcer 1.7.0-beta.9 → 1.8.0-beta.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/lib/resourcer.js +1 -1
- package/lib/utils.js +13 -6
- package/package.json +4 -4
package/lib/resourcer.js
CHANGED
|
@@ -227,7 +227,7 @@ const _ResourceManager = class _ResourceManager {
|
|
|
227
227
|
ctx.action.resourceName = params.associatedName ? `${params.associatedName}.${params.resourceName}` : params.resourceName;
|
|
228
228
|
ctx.action.params.filterByTk = params.resourceIndex;
|
|
229
229
|
const query = (0, import_utils2.parseQuery)(ctx.request.querystring);
|
|
230
|
-
if ((0, import_path_to_regexp.pathToRegexp)("/resourcer
|
|
230
|
+
if ((0, import_path_to_regexp.pathToRegexp)("/resourcer/:rest(.*)").test(ctx.request.path)) {
|
|
231
231
|
ctx.action.mergeParams({
|
|
232
232
|
...query,
|
|
233
233
|
...params,
|
package/lib/utils.js
CHANGED
|
@@ -67,17 +67,24 @@ function parseRequest(request, options = {}) {
|
|
|
67
67
|
...options.accessors || {}
|
|
68
68
|
};
|
|
69
69
|
const keys = [];
|
|
70
|
-
const regexp = (0, import_path_to_regexp.pathToRegexp)("/resourcer
|
|
70
|
+
const regexp = (0, import_path_to_regexp.pathToRegexp)("/resourcer/:rest(.*)", keys);
|
|
71
71
|
const reqPath = decodeURI(request.path);
|
|
72
72
|
const matches = regexp.exec(reqPath);
|
|
73
73
|
if (matches) {
|
|
74
74
|
const params2 = {};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const [resource, action] = matches[1].split(":");
|
|
76
|
+
const [res1, res2] = resource.split(".");
|
|
77
|
+
if (res1) {
|
|
78
|
+
if (res2) {
|
|
79
|
+
params2["associatedName"] = res1;
|
|
80
|
+
params2["resourceName"] = res2;
|
|
81
|
+
} else {
|
|
82
|
+
params2["resourceName"] = res1;
|
|
78
83
|
}
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
}
|
|
85
|
+
if (action) {
|
|
86
|
+
params2["actionName"] = action;
|
|
87
|
+
}
|
|
81
88
|
return params2;
|
|
82
89
|
}
|
|
83
90
|
const defaults = {
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/resourcer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/utils": "1.
|
|
9
|
+
"@nocobase/utils": "1.8.0-beta.1",
|
|
10
10
|
"deepmerge": "^4.2.2",
|
|
11
11
|
"koa-compose": "^4.1.0",
|
|
12
12
|
"lodash": "^4.17.21",
|
|
13
|
-
"path-to-regexp": "6.
|
|
13
|
+
"path-to-regexp": "^6.3.0",
|
|
14
14
|
"qs": "^6.9.4"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
19
19
|
"directory": "packages/resourcer"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "103935669123174f2942247202e3d9ff15f0d4ed"
|
|
22
22
|
}
|