@tachybase/resourcer 1.6.11 → 1.6.13-alpha.2

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.
Files changed (2) hide show
  1. package/lib/resourcer.js +15 -0
  2. package/package.json +2 -2
package/lib/resourcer.js CHANGED
@@ -126,6 +126,21 @@ const _Resourcer = class _Resourcer {
126
126
  }
127
127
  registerActionHandler(name, handler) {
128
128
  this.actionHandlers.set(name, handler);
129
+ const [resourceName] = `${name}`.split(":");
130
+ const resources = `${name}`.includes(":") ? [this.resources.get(resourceName)].filter(Boolean) : this.resources.values();
131
+ for (const resource of resources) {
132
+ const except = resource.getExcept();
133
+ const only = resource.options.only || [];
134
+ if (only.length && !only.includes(name)) {
135
+ if (!except.includes(name)) {
136
+ except.push(name);
137
+ }
138
+ continue;
139
+ }
140
+ if (!resource.actions.has(name) && !except.includes(name)) {
141
+ resource.addAction(name, handler);
142
+ }
143
+ }
129
144
  }
130
145
  /**
131
146
  * @internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/resourcer",
3
- "version": "1.6.11",
3
+ "version": "1.6.13-alpha.2",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/tegojs/tego#readme",
6
6
  "bugs": {
@@ -20,7 +20,7 @@
20
20
  "lodash": "^4.17.21",
21
21
  "path-to-regexp": "^8.2.0",
22
22
  "qs": "^6.14.0",
23
- "@tachybase/utils": "1.6.11"
23
+ "@tachybase/utils": "1.6.13-alpha.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "20.17.10",