moost 0.6.21 → 0.6.22
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 +18 -3
- package/dist/index.mjs +18 -3
- package/package.json +2 -2
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
|
|
1793
|
-
|
|
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
|
|
1792
|
-
|
|
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.
|
|
3
|
+
"version": "0.6.22",
|
|
4
4
|
"description": "moost",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"composables",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@wooksjs/event-http": "^0.7.16",
|
|
50
50
|
"@wooksjs/http-body": "^0.7.16",
|
|
51
51
|
"vitest": "3.2.4",
|
|
52
|
-
"@moostjs/event-http": "^0.6.
|
|
52
|
+
"@moostjs/event-http": "^0.6.22"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"pub": "pnpm publish --access public",
|