@tachybase/resourcer 1.3.33 → 1.3.35
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 +2 -2
- package/lib/utils.js +3 -3
- package/package.json +3 -4
package/lib/resourcer.js
CHANGED
|
@@ -36,7 +36,7 @@ var import_utils = require("@tachybase/utils");
|
|
|
36
36
|
var import_glob = require("glob");
|
|
37
37
|
var import_koa_compose = __toESM(require("koa-compose"));
|
|
38
38
|
var import_lodash = __toESM(require("lodash"));
|
|
39
|
-
var
|
|
39
|
+
var import_path_to_regexp = require("path-to-regexp");
|
|
40
40
|
var import_resource = __toESM(require("./resource"));
|
|
41
41
|
var import_utils2 = require("./utils");
|
|
42
42
|
const _Resourcer = class _Resourcer {
|
|
@@ -219,7 +219,7 @@ const _Resourcer = class _Resourcer {
|
|
|
219
219
|
ctx.action.resourceName = params.associatedName ? `${params.associatedName}.${params.resourceName}` : params.resourceName;
|
|
220
220
|
ctx.action.params.filterByTk = params.resourceIndex;
|
|
221
221
|
const query = (0, import_utils2.parseQuery)(ctx.request.querystring);
|
|
222
|
-
if ((0,
|
|
222
|
+
if ((0, import_path_to_regexp.pathToRegexp)("/resourcer/{:associatedName.}:resourceName{\\::actionName}").regexp.test(ctx.request.path)) {
|
|
223
223
|
ctx.action.mergeParams({
|
|
224
224
|
...query,
|
|
225
225
|
...params,
|
package/lib/utils.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(utils_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(utils_exports);
|
|
38
38
|
var import_lodash = __toESM(require("lodash"));
|
|
39
|
-
var
|
|
39
|
+
var import_path_to_regexp = require("path-to-regexp");
|
|
40
40
|
var import_qs = __toESM(require("qs"));
|
|
41
41
|
function getNameByParams(params) {
|
|
42
42
|
const { resourceName, associatedName } = params;
|
|
@@ -57,7 +57,7 @@ function parseRequest(request, options = {}) {
|
|
|
57
57
|
remove: "remove",
|
|
58
58
|
...options.accessors
|
|
59
59
|
};
|
|
60
|
-
const { regexp, keys } = (0,
|
|
60
|
+
const { regexp, keys } = (0, import_path_to_regexp.pathToRegexp)("/resourcer/{:associatedName.}:resourceName{\\::actionName}");
|
|
61
61
|
const reqPath = decodeURI(request.path);
|
|
62
62
|
const matches = regexp.exec(reqPath);
|
|
63
63
|
if (matches) {
|
|
@@ -158,7 +158,7 @@ function parseRequest(request, options = {}) {
|
|
|
158
158
|
}
|
|
159
159
|
const { type = "single" } = request;
|
|
160
160
|
for (const path in defaults[type]) {
|
|
161
|
-
const { regexp: regexp2, keys: keys2 } = (0,
|
|
161
|
+
const { regexp: regexp2, keys: keys2 } = (0, import_path_to_regexp.pathToRegexp)(`${prefix}${path}`);
|
|
162
162
|
const matches2 = regexp2.exec(reqPath);
|
|
163
163
|
if (!matches2) {
|
|
164
164
|
continue;
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/resourcer",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.35",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"deepmerge": "^4.3.1",
|
|
10
9
|
"glob": "11.0.0",
|
|
11
10
|
"koa-compose": "^4.1.0",
|
|
12
11
|
"lodash": "^4.17.21",
|
|
13
|
-
"path-to-
|
|
12
|
+
"path-to-regexp": "^8.2.0",
|
|
14
13
|
"qs": "^6.14.0",
|
|
15
|
-
"@tachybase/utils": "1.3.
|
|
14
|
+
"@tachybase/utils": "1.3.35"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
17
|
"@types/node": "20.17.10"
|