@tachybase/resourcer 0.23.41 → 0.23.47
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/action.js +3 -16
- package/lib/middleware.js +1 -2
- package/lib/resource.js +1 -5
- package/lib/resourcer.js +8 -13
- package/package.json +2 -2
package/lib/action.js
CHANGED
|
@@ -37,26 +37,13 @@ var import_koa_compose = __toESM(require("koa-compose"));
|
|
|
37
37
|
var import_lodash = __toESM(require("lodash"));
|
|
38
38
|
var import_middleware = __toESM(require("./middleware"));
|
|
39
39
|
const _Action = class _Action {
|
|
40
|
-
handler;
|
|
41
|
-
resource;
|
|
42
|
-
name;
|
|
43
|
-
options;
|
|
44
|
-
context = {};
|
|
45
|
-
params = {};
|
|
46
|
-
actionName;
|
|
47
|
-
resourceName;
|
|
48
|
-
/**
|
|
49
|
-
* This method is deprecated and should not be used.
|
|
50
|
-
* Use {@link this.sourceId} instead.
|
|
51
|
-
* @deprecated
|
|
52
|
-
*/
|
|
53
|
-
resourceOf;
|
|
54
|
-
sourceId;
|
|
55
|
-
middlewares = [];
|
|
56
40
|
/**
|
|
57
41
|
* @internal
|
|
58
42
|
*/
|
|
59
43
|
constructor(options) {
|
|
44
|
+
this.context = {};
|
|
45
|
+
this.params = {};
|
|
46
|
+
this.middlewares = [];
|
|
60
47
|
options = (0, import_utils.requireModule)(options);
|
|
61
48
|
if (typeof options === "function") {
|
|
62
49
|
options = { handler: options };
|
package/lib/middleware.js
CHANGED
|
@@ -36,9 +36,8 @@ module.exports = __toCommonJS(middleware_exports);
|
|
|
36
36
|
var import_utils = require("@tachybase/utils");
|
|
37
37
|
var import_koa_compose = __toESM(require("koa-compose"));
|
|
38
38
|
const _Middleware = class _Middleware {
|
|
39
|
-
options;
|
|
40
|
-
middlewares = [];
|
|
41
39
|
constructor(options) {
|
|
40
|
+
this.middlewares = [];
|
|
42
41
|
options = (0, import_utils.requireModule)(options);
|
|
43
42
|
if (typeof options === "function") {
|
|
44
43
|
this.options = { handler: options };
|
package/lib/resource.js
CHANGED
|
@@ -36,12 +36,8 @@ var import_lodash = __toESM(require("lodash"));
|
|
|
36
36
|
var import_action = __toESM(require("./action"));
|
|
37
37
|
var import_middleware = __toESM(require("./middleware"));
|
|
38
38
|
const _Resource = class _Resource {
|
|
39
|
-
resourcer;
|
|
40
|
-
middlewares;
|
|
41
|
-
actions = /* @__PURE__ */ new Map();
|
|
42
|
-
options;
|
|
43
|
-
except;
|
|
44
39
|
constructor(options, resourcer) {
|
|
40
|
+
this.actions = /* @__PURE__ */ new Map();
|
|
45
41
|
const { middleware, middlewares, actions = {}, only = [], except = [] } = options;
|
|
46
42
|
this.options = options;
|
|
47
43
|
this.resourcer = resourcer;
|
package/lib/resourcer.js
CHANGED
|
@@ -40,20 +40,15 @@ 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 {
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
options;
|
|
47
|
-
resources = /* @__PURE__ */ new Map();
|
|
48
|
-
/**
|
|
49
|
-
* 全局定义的 action handlers
|
|
50
|
-
*/
|
|
51
|
-
handlers = /* @__PURE__ */ new Map();
|
|
52
|
-
actionHandlers = /* @__PURE__ */ new Map();
|
|
53
|
-
middlewareHandlers = /* @__PURE__ */ new Map();
|
|
54
|
-
middlewares;
|
|
55
|
-
middlewareSourceMap = /* @__PURE__ */ new WeakMap();
|
|
56
43
|
constructor(options = {}) {
|
|
44
|
+
this.resources = /* @__PURE__ */ new Map();
|
|
45
|
+
/**
|
|
46
|
+
* 全局定义的 action handlers
|
|
47
|
+
*/
|
|
48
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
49
|
+
this.actionHandlers = /* @__PURE__ */ new Map();
|
|
50
|
+
this.middlewareHandlers = /* @__PURE__ */ new Map();
|
|
51
|
+
this.middlewareSourceMap = /* @__PURE__ */ new WeakMap();
|
|
57
52
|
this.options = options;
|
|
58
53
|
this.middlewares = new import_utils.Toposort();
|
|
59
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/resourcer",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.47",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"lodash": "^4.17.21",
|
|
13
13
|
"path-to-regexp": "8.2.0",
|
|
14
14
|
"qs": "^6.13.1",
|
|
15
|
-
"@tachybase/utils": "0.23.
|
|
15
|
+
"@tachybase/utils": "0.23.47"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "20.17.10"
|