moost 0.6.21 → 0.6.23

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/index.cjs CHANGED
@@ -1777,6 +1777,22 @@ function _define_property(obj, key, value) {
1777
1777
  //#endregion
1778
1778
  //#region packages/moost/src/handler-paths.ts
1779
1779
  /**
1780
+ * Resolves the handler-overview records for `ctor.method`. Uses Moost's memoized
1781
+ * index when available (the fast path for a real `Moost` instance), and otherwise
1782
+ * derives them from `getControllersOverview()` — so the helper also works with a
1783
+ * minimal Moost-like object that only implements that documented method (e.g. a
1784
+ * test stub or a lightweight harness).
1785
+ */ function resolveHandlers(moost, ctor, method) {
1786
+ const getIndex = moost.getHandlerOverviewIndex;
1787
+ if (typeof getIndex === "function") return getIndex.call(moost).get(ctor)?.get(method) ?? [];
1788
+ const handlers = [];
1789
+ for (const c of moost.getControllersOverview()) {
1790
+ if (c.type !== ctor) continue;
1791
+ for (const h of c.handlers) if (h.method === method) handlers.push(h);
1792
+ }
1793
+ return handlers;
1794
+ }
1795
+ /**
1780
1796
  * Returns every actual mounted path under which `controller.method` is registered,
1781
1797
  * read from the post-bind controllers overview. Accounts for multi-prefix mounts
1782
1798
  * (`@ImportController` at several places), multiple verbs on one method, and
@@ -1789,9 +1805,8 @@ function _define_property(obj, key, value) {
1789
1805
  * @param controller class constructor or instance whose method to look up
1790
1806
  * @param method controller method name (e.g. the one carrying `@Get('refresh')`)
1791
1807
  */ function getHandlerPaths(moost, controller, method, opts) {
1792
- const ctor = (0, _prostojs_mate.isConstructor)(controller) ? controller : (0, _prostojs_mate.getConstructor)(controller);
1793
- const handlers = moost.getHandlerOverviewIndex().get(ctor)?.get(method);
1794
- if (!handlers) return [];
1808
+ const handlers = resolveHandlers(moost, (0, _prostojs_mate.isConstructor)(controller) ? controller : (0, _prostojs_mate.getConstructor)(controller), method);
1809
+ if (handlers.length === 0) return [];
1795
1810
  const { type, predicate } = opts ?? {};
1796
1811
  const paths = /* @__PURE__ */ new Set();
1797
1812
  for (const h of handlers) {
package/dist/index.mjs CHANGED
@@ -1776,6 +1776,22 @@ function _define_property(obj, key, value) {
1776
1776
  //#endregion
1777
1777
  //#region packages/moost/src/handler-paths.ts
1778
1778
  /**
1779
+ * Resolves the handler-overview records for `ctor.method`. Uses Moost's memoized
1780
+ * index when available (the fast path for a real `Moost` instance), and otherwise
1781
+ * derives them from `getControllersOverview()` — so the helper also works with a
1782
+ * minimal Moost-like object that only implements that documented method (e.g. a
1783
+ * test stub or a lightweight harness).
1784
+ */ function resolveHandlers(moost, ctor, method) {
1785
+ const getIndex = moost.getHandlerOverviewIndex;
1786
+ if (typeof getIndex === "function") return getIndex.call(moost).get(ctor)?.get(method) ?? [];
1787
+ const handlers = [];
1788
+ for (const c of moost.getControllersOverview()) {
1789
+ if (c.type !== ctor) continue;
1790
+ for (const h of c.handlers) if (h.method === method) handlers.push(h);
1791
+ }
1792
+ return handlers;
1793
+ }
1794
+ /**
1779
1795
  * Returns every actual mounted path under which `controller.method` is registered,
1780
1796
  * read from the post-bind controllers overview. Accounts for multi-prefix mounts
1781
1797
  * (`@ImportController` at several places), multiple verbs on one method, and
@@ -1788,9 +1804,8 @@ function _define_property(obj, key, value) {
1788
1804
  * @param controller class constructor or instance whose method to look up
1789
1805
  * @param method controller method name (e.g. the one carrying `@Get('refresh')`)
1790
1806
  */ function getHandlerPaths(moost, controller, method, opts) {
1791
- const ctor = isConstructor$1(controller) ? controller : getConstructor$1(controller);
1792
- const handlers = moost.getHandlerOverviewIndex().get(ctor)?.get(method);
1793
- if (!handlers) return [];
1807
+ const handlers = resolveHandlers(moost, isConstructor$1(controller) ? controller : getConstructor$1(controller), method);
1808
+ if (handlers.length === 0) return [];
1794
1809
  const { type, predicate } = opts ?? {};
1795
1810
  const paths = /* @__PURE__ */ new Set();
1796
1811
  for (const h of handlers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moost",
3
- "version": "0.6.21",
3
+ "version": "0.6.23",
4
4
  "description": "moost",
5
5
  "keywords": [
6
6
  "composables",
@@ -41,15 +41,15 @@
41
41
  "@prostojs/infact": "^0.4.1",
42
42
  "@prostojs/logger": "^0.4.3",
43
43
  "@prostojs/mate": "^0.4.0",
44
- "@wooksjs/event-core": "^0.7.16",
44
+ "@wooksjs/event-core": "^0.7.17",
45
45
  "hookable": "^5.5.3",
46
- "wooks": "^0.7.16"
46
+ "wooks": "^0.7.17"
47
47
  },
48
48
  "devDependencies": {
49
- "@wooksjs/event-http": "^0.7.16",
50
- "@wooksjs/http-body": "^0.7.16",
49
+ "@wooksjs/event-http": "^0.7.17",
50
+ "@wooksjs/http-body": "^0.7.17",
51
51
  "vitest": "3.2.4",
52
- "@moostjs/event-http": "^0.6.21"
52
+ "@moostjs/event-http": "^0.6.23"
53
53
  },
54
54
  "scripts": {
55
55
  "pub": "pnpm publish --access public",