clear-router 2.5.12 → 2.5.13
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/{bindings-CDGLuAq4.cjs → bindings-CLsZjOEy.cjs} +8 -1
- package/dist/{bindings-B6x2HfzP.mjs → bindings-XLDXFpHZ.mjs} +8 -1
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/core/index.mjs +2 -2
- package/dist/decorators/index.cjs +1 -1
- package/dist/decorators/index.mjs +1 -1
- package/dist/decorators/setup.cjs +2 -2
- package/dist/decorators/setup.mjs +2 -2
- package/dist/express/index.cjs +3 -3
- package/dist/express/index.d.cts +1 -1
- package/dist/express/index.d.mts +1 -1
- package/dist/express/index.mjs +3 -3
- package/dist/fastify/index.cjs +3 -3
- package/dist/fastify/index.d.cts +1 -1
- package/dist/fastify/index.d.mts +1 -1
- package/dist/fastify/index.mjs +3 -3
- package/dist/h3/index.cjs +3 -3
- package/dist/h3/index.d.cts +1 -1
- package/dist/h3/index.d.mts +1 -1
- package/dist/h3/index.mjs +3 -3
- package/dist/hono/index.cjs +3 -3
- package/dist/hono/index.d.cts +1 -1
- package/dist/hono/index.d.mts +1 -1
- package/dist/hono/index.mjs +3 -3
- package/dist/index.cjs +13 -2
- package/dist/index.d.cts +25 -23
- package/dist/index.d.mts +25 -23
- package/dist/index.mjs +13 -2
- package/dist/koa/index.cjs +3 -3
- package/dist/koa/index.d.cts +1 -1
- package/dist/koa/index.d.mts +1 -1
- package/dist/koa/index.mjs +3 -3
- package/dist/{responses-DuZeRyGE.mjs → responses-BvETUeDL.mjs} +1 -1
- package/dist/{responses-CBP3RYjJ.cjs → responses-Bvnk0uvc.cjs} +1 -1
- package/dist/{router-BkJMl4xv.mjs → router-CPmZcbU0.mjs} +6 -2
- package/dist/{router-DPJfzvy5.cjs → router-D9H9-T27.cjs} +6 -2
- package/dist/{router-35iBbCaF.d.cts → router-DTI0BowV.d.cts} +25 -23
- package/dist/{router-91xVPlV0.d.mts → router-DiKqUyvk.d.mts} +25 -23
- package/dist/types/core/Response.d.mts +3 -1
- package/package.json +1 -1
|
@@ -58,14 +58,21 @@ var Response = class {
|
|
|
58
58
|
headers = new Headers();
|
|
59
59
|
sent = false;
|
|
60
60
|
statusCode = 200;
|
|
61
|
+
statusText = "OK";
|
|
61
62
|
constructor(init) {
|
|
62
|
-
|
|
63
|
+
const { status: _, ...rest } = init ?? {};
|
|
64
|
+
Object.assign(this, rest);
|
|
63
65
|
if (init?.headers && !(init.headers instanceof Headers)) this.headers = new Headers(init.headers);
|
|
66
|
+
if (init?.status && typeof init.status === "number") this.statusCode = init?.status;
|
|
64
67
|
}
|
|
65
68
|
status(code) {
|
|
66
69
|
this.statusCode = code;
|
|
67
70
|
return this;
|
|
68
71
|
}
|
|
72
|
+
setStatusText(text) {
|
|
73
|
+
this.statusText = text;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
69
76
|
code(code) {
|
|
70
77
|
return this.status(code);
|
|
71
78
|
}
|
|
@@ -57,14 +57,21 @@ var Response = class {
|
|
|
57
57
|
headers = new Headers();
|
|
58
58
|
sent = false;
|
|
59
59
|
statusCode = 200;
|
|
60
|
+
statusText = "OK";
|
|
60
61
|
constructor(init) {
|
|
61
|
-
|
|
62
|
+
const { status: _, ...rest } = init ?? {};
|
|
63
|
+
Object.assign(this, rest);
|
|
62
64
|
if (init?.headers && !(init.headers instanceof Headers)) this.headers = new Headers(init.headers);
|
|
65
|
+
if (init?.status && typeof init.status === "number") this.statusCode = init?.status;
|
|
63
66
|
}
|
|
64
67
|
status(code) {
|
|
65
68
|
this.statusCode = code;
|
|
66
69
|
return this;
|
|
67
70
|
}
|
|
71
|
+
setStatusText(text) {
|
|
72
|
+
this.statusText = text;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
68
75
|
code(code) {
|
|
69
76
|
return this.status(code);
|
|
70
77
|
}
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_bindings = require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
2
|
+
const require_bindings = require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/core/plugins.ts
|
|
6
6
|
function definePlugin(plugin) {
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { E as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-
|
|
1
|
+
import { E as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-DTI0BowV.cjs";
|
|
2
2
|
export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { E as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-
|
|
1
|
+
import { E as Response, a as ClearRouterPluginInput, c as PluginBind, d as PluginSetupResult, f as definePlugin, i as ClearRouterPluginContext, l as PluginBindFactory, n as ClearRouterPlugin, o as ClearRouterPluginRequestContext, p as Request, r as ClearRouterPluginArgumentsContext, s as PluginArgumentsResolver, t as CoreRouter, u as PluginBindValue } from "../router-DiKqUyvk.mjs";
|
|
2
2
|
export { ClearRouterPlugin, ClearRouterPluginArgumentsContext, ClearRouterPluginContext, ClearRouterPluginInput, ClearRouterPluginRequestContext, CoreRouter, PluginArgumentsResolver, PluginBind, PluginBindFactory, PluginBindValue, PluginSetupResult, Request, Response, definePlugin };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Request, s as Response } from "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
1
|
+
import { c as Request, s as Response } from "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/plugins.ts
|
|
5
5
|
function definePlugin(plugin) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_bindings = require('../bindings-
|
|
2
|
+
const require_bindings = require('../bindings-CLsZjOEy.cjs');
|
|
3
3
|
|
|
4
4
|
exports.Bind = require_bindings.Bind;
|
|
5
5
|
exports.Container = require_bindings.Container;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_bindings = require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
2
|
+
const require_bindings = require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
4
|
require('./index.cjs');
|
|
5
5
|
require("reflect-metadata");
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Container, t as Bind } from "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
1
|
+
import { n as Container, t as Bind } from "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
3
|
import "./index.mjs";
|
|
4
4
|
import "reflect-metadata";
|
|
5
5
|
|
package/dist/express/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
4
|
-
const require_responses = require('../responses-
|
|
2
|
+
require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
|
+
const require_responses = require('../responses-Bvnk0uvc.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/express/router.ts
|
|
7
7
|
/**
|
package/dist/express/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, b as HttpContext, m as Route, t as CoreRouter, x as Middleware, y as Handler } from "../router-
|
|
1
|
+
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, b as HttpContext, m as Route, t as CoreRouter, x as Middleware, y as Handler } from "../router-DTI0BowV.cjs";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
package/dist/express/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, b as HttpContext, m as Route, t as CoreRouter, x as Middleware, y as Handler } from "../router-
|
|
1
|
+
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, b as HttpContext, m as Route, t as CoreRouter, x as Middleware, y as Handler } from "../router-DiKqUyvk.mjs";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
package/dist/express/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
3
|
-
import { n as resolveResponseMeta, r as responseWasSent, t as isFetchResponse } from "../responses-
|
|
1
|
+
import "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
|
+
import { n as resolveResponseMeta, r as responseWasSent, t as isFetchResponse } from "../responses-BvETUeDL.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/express/router.ts
|
|
6
6
|
/**
|
package/dist/fastify/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
4
|
-
const require_responses = require('../responses-
|
|
2
|
+
require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
|
+
const require_responses = require('../responses-Bvnk0uvc.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/fastify/router.ts
|
|
7
7
|
/**
|
package/dist/fastify/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-
|
|
1
|
+
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-DTI0BowV.cjs";
|
|
2
2
|
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region types/fastify.d.ts
|
package/dist/fastify/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-
|
|
1
|
+
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-DiKqUyvk.mjs";
|
|
2
2
|
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region types/fastify.d.ts
|
package/dist/fastify/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
3
|
-
import { n as resolveResponseMeta, r as responseWasSent, t as isFetchResponse } from "../responses-
|
|
1
|
+
import "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
|
+
import { n as resolveResponseMeta, r as responseWasSent, t as isFetchResponse } from "../responses-BvETUeDL.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/fastify/router.ts
|
|
6
6
|
/**
|
package/dist/h3/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
4
|
-
const require_responses = require('../responses-
|
|
2
|
+
require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
|
+
const require_responses = require('../responses-Bvnk0uvc.cjs');
|
|
5
5
|
let h3 = require("h3");
|
|
6
6
|
|
|
7
7
|
//#region src/h3/router.ts
|
package/dist/h3/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, _ as HttpContext, g as Handler, h as H3App, m as Route, t as CoreRouter, v as Middleware } from "../router-
|
|
1
|
+
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, _ as HttpContext, g as Handler, h as H3App, m as Route, t as CoreRouter, v as Middleware } from "../router-DTI0BowV.cjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
package/dist/h3/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, _ as HttpContext, g as Handler, h as H3App, m as Route, t as CoreRouter, v as Middleware } from "../router-
|
|
1
|
+
import { C as ControllerAction, S as ApiResourceMiddleware, T as HttpMethod, _ as HttpContext, g as Handler, h as H3App, m as Route, t as CoreRouter, v as Middleware } from "../router-DiKqUyvk.mjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
package/dist/h3/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
3
|
-
import { n as resolveResponseMeta } from "../responses-
|
|
1
|
+
import "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
|
+
import { n as resolveResponseMeta } from "../responses-BvETUeDL.mjs";
|
|
4
4
|
import { HTTPResponse, getQuery, getRouterParams, readBody } from "h3";
|
|
5
5
|
|
|
6
6
|
//#region src/h3/router.ts
|
package/dist/hono/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
4
|
-
const require_responses = require('../responses-
|
|
2
|
+
require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
|
+
const require_responses = require('../responses-Bvnk0uvc.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/hono/router.ts
|
|
7
7
|
/**
|
package/dist/hono/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-
|
|
1
|
+
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-DTI0BowV.cjs";
|
|
2
2
|
import { Context, HonoRequest, MiddlewareHandler } from "hono";
|
|
3
3
|
|
|
4
4
|
//#region types/hono.d.ts
|
package/dist/hono/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-
|
|
1
|
+
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-DiKqUyvk.mjs";
|
|
2
2
|
import { Context, HonoRequest, MiddlewareHandler } from "hono";
|
|
3
3
|
|
|
4
4
|
//#region types/hono.d.ts
|
package/dist/hono/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
3
|
-
import { n as resolveResponseMeta } from "../responses-
|
|
1
|
+
import "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
|
+
import { n as resolveResponseMeta } from "../responses-BvETUeDL.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/hono/router.ts
|
|
6
6
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -98,14 +98,21 @@ var Response = class {
|
|
|
98
98
|
headers = new Headers();
|
|
99
99
|
sent = false;
|
|
100
100
|
statusCode = 200;
|
|
101
|
+
statusText = "OK";
|
|
101
102
|
constructor(init) {
|
|
102
|
-
|
|
103
|
+
const { status: _, ...rest } = init ?? {};
|
|
104
|
+
Object.assign(this, rest);
|
|
103
105
|
if (init?.headers && !(init.headers instanceof Headers)) this.headers = new Headers(init.headers);
|
|
106
|
+
if (init?.status && typeof init.status === "number") this.statusCode = init?.status;
|
|
104
107
|
}
|
|
105
108
|
status(code) {
|
|
106
109
|
this.statusCode = code;
|
|
107
110
|
return this;
|
|
108
111
|
}
|
|
112
|
+
setStatusText(text) {
|
|
113
|
+
this.statusText = text;
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
109
116
|
code(code) {
|
|
110
117
|
return this.status(code);
|
|
111
118
|
}
|
|
@@ -884,7 +891,11 @@ var CoreRouter = class {
|
|
|
884
891
|
clearRequest.query = payload.query;
|
|
885
892
|
clearRequest.params = payload.params;
|
|
886
893
|
ctx.clearRequest = clearRequest;
|
|
887
|
-
|
|
894
|
+
Container.bind(Request, ctx.clearRequest);
|
|
895
|
+
if (!(ctx.clearResponse instanceof Response)) {
|
|
896
|
+
ctx.clearResponse = new Response(ctx.response ?? ctx.reply ?? ctx.res);
|
|
897
|
+
Container.bind(Response, ctx.clearResponse);
|
|
898
|
+
}
|
|
888
899
|
if (!instance) return;
|
|
889
900
|
instance.ctx = ctx;
|
|
890
901
|
instance.body = payload.body;
|
package/dist/index.d.cts
CHANGED
|
@@ -41,8 +41,10 @@ declare class Response$1 {
|
|
|
41
41
|
headers: Headers;
|
|
42
42
|
sent: boolean;
|
|
43
43
|
statusCode: number;
|
|
44
|
-
|
|
44
|
+
statusText: string;
|
|
45
|
+
constructor(init?: Partial<Response$1 | globalThis.Response>);
|
|
45
46
|
status(code: number): this;
|
|
47
|
+
setStatusText(text: string): this;
|
|
46
48
|
code(code: number): this;
|
|
47
49
|
setHeader(name: string, value: string): this;
|
|
48
50
|
header(name: string, value: string): this;
|
|
@@ -206,7 +208,7 @@ declare abstract class CoreRouter {
|
|
|
206
208
|
protected static createBaseConfig(): RouterConfig;
|
|
207
209
|
protected static mergeConfig(target: RouterConfig, source?: RouterConfig): RouterConfig;
|
|
208
210
|
protected static getDefaultConfig(): RouterConfig;
|
|
209
|
-
protected static resolveStateNamespace(
|
|
211
|
+
protected static resolveStateNamespace(): string;
|
|
210
212
|
protected static getStateStore(): Record<string, any>;
|
|
211
213
|
protected static getPluginStore(): Set<string>;
|
|
212
214
|
protected static getPluginPendingStore(): Set<Promise<void>>;
|
|
@@ -224,10 +226,10 @@ declare abstract class CoreRouter {
|
|
|
224
226
|
groupMiddlewares: any[];
|
|
225
227
|
globalMiddlewares: any[];
|
|
226
228
|
};
|
|
227
|
-
protected static bindStateAccessors(
|
|
229
|
+
protected static bindStateAccessors(): void;
|
|
228
230
|
protected static createDefaultOptionsHandler(): any;
|
|
229
231
|
static config: RouterConfig;
|
|
230
|
-
static configureDefaults(
|
|
232
|
+
static configureDefaults(options?: RouterConfig): void;
|
|
231
233
|
/**
|
|
232
234
|
* Use a registered plugin
|
|
233
235
|
*
|
|
@@ -236,8 +238,8 @@ declare abstract class CoreRouter {
|
|
|
236
238
|
* @param options
|
|
237
239
|
* @returns
|
|
238
240
|
*/
|
|
239
|
-
static use<Options = any>(
|
|
240
|
-
protected static pluginsReady(
|
|
241
|
+
static use<Options = any>(plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
|
|
242
|
+
protected static pluginsReady(): Promise<void>;
|
|
241
243
|
protected static groupContext: AsyncLocalStorage<{
|
|
242
244
|
prefix: string;
|
|
243
245
|
groupMiddlewares: any[];
|
|
@@ -253,7 +255,7 @@ declare abstract class CoreRouter {
|
|
|
253
255
|
protected static createPluginRequestContext(ctx: any): ClearRouterPluginRequestContext;
|
|
254
256
|
protected static createPluginBind(): PluginBind;
|
|
255
257
|
protected static resolvePluginArguments(this: any, ctx: any, routeContext: Omit<ClearRouterPluginArgumentsContext, keyof ClearRouterPluginRequestContext>): Promise<any[] | undefined>;
|
|
256
|
-
protected static ensureState(
|
|
258
|
+
protected static ensureState(): void;
|
|
257
259
|
/**
|
|
258
260
|
* Normalizes a path by ensuring it starts with a single slash and does not have trailing
|
|
259
261
|
* slashes, while preserving dynamic segments and parameters.
|
|
@@ -270,7 +272,7 @@ declare abstract class CoreRouter {
|
|
|
270
272
|
* @returns
|
|
271
273
|
*/
|
|
272
274
|
static configure(this: any, options?: RouterConfig): void;
|
|
273
|
-
protected static resolveMethodOverride(
|
|
275
|
+
protected static resolveMethodOverride(method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
|
|
274
276
|
/**
|
|
275
277
|
* Adds a new route to the router.
|
|
276
278
|
*
|
|
@@ -280,7 +282,7 @@ declare abstract class CoreRouter {
|
|
|
280
282
|
* @param handler
|
|
281
283
|
* @param middlewares
|
|
282
284
|
*/
|
|
283
|
-
static add(
|
|
285
|
+
static add(methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
|
|
284
286
|
/**
|
|
285
287
|
* Define a resourceful API controller with standard CRUD routes.
|
|
286
288
|
*
|
|
@@ -289,7 +291,7 @@ declare abstract class CoreRouter {
|
|
|
289
291
|
* @param controller
|
|
290
292
|
* @param options
|
|
291
293
|
*/
|
|
292
|
-
static apiResource(
|
|
294
|
+
static apiResource(basePath: string, controller: any, options?: {
|
|
293
295
|
only?: ControllerAction[];
|
|
294
296
|
except?: ControllerAction[];
|
|
295
297
|
middlewares?: ApiResourceMiddleware<any>;
|
|
@@ -302,7 +304,7 @@ declare abstract class CoreRouter {
|
|
|
302
304
|
* @param handler The handler function for the GET route.
|
|
303
305
|
* @param middlewares Optional middlewares to apply to the GET route.
|
|
304
306
|
*/
|
|
305
|
-
static get(
|
|
307
|
+
static get(path: string, handler: any, middlewares?: any[] | any): void;
|
|
306
308
|
/**
|
|
307
309
|
* Adds a new POST route to the router.
|
|
308
310
|
*
|
|
@@ -311,7 +313,7 @@ declare abstract class CoreRouter {
|
|
|
311
313
|
* @param handler
|
|
312
314
|
* @param middlewares
|
|
313
315
|
*/
|
|
314
|
-
static post(
|
|
316
|
+
static post(path: string, handler: any, middlewares?: any[] | any): void;
|
|
315
317
|
/**
|
|
316
318
|
* Adds a new PUT route to the router.
|
|
317
319
|
*
|
|
@@ -320,7 +322,7 @@ declare abstract class CoreRouter {
|
|
|
320
322
|
* @param handler
|
|
321
323
|
* @param middlewares
|
|
322
324
|
*/
|
|
323
|
-
static put(
|
|
325
|
+
static put(path: string, handler: any, middlewares?: any[] | any): void;
|
|
324
326
|
/**
|
|
325
327
|
* Adds a new DELETE route to the router.
|
|
326
328
|
*
|
|
@@ -329,7 +331,7 @@ declare abstract class CoreRouter {
|
|
|
329
331
|
* @param handler
|
|
330
332
|
* @param middlewares
|
|
331
333
|
*/
|
|
332
|
-
static delete(
|
|
334
|
+
static delete(path: string, handler: any, middlewares?: any[] | any): void;
|
|
333
335
|
/**
|
|
334
336
|
* Adds a new PATCH route to the router.
|
|
335
337
|
*
|
|
@@ -338,7 +340,7 @@ declare abstract class CoreRouter {
|
|
|
338
340
|
* @param handler
|
|
339
341
|
* @param middlewares
|
|
340
342
|
*/
|
|
341
|
-
static patch(
|
|
343
|
+
static patch(path: string, handler: any, middlewares?: any[] | any): void;
|
|
342
344
|
/**
|
|
343
345
|
* Adds a new OPTIONS route to the router.
|
|
344
346
|
*
|
|
@@ -347,7 +349,7 @@ declare abstract class CoreRouter {
|
|
|
347
349
|
* @param handler
|
|
348
350
|
* @param middlewares
|
|
349
351
|
*/
|
|
350
|
-
static options(
|
|
352
|
+
static options(path: string, handler: any, middlewares?: any[] | any): void;
|
|
351
353
|
/**
|
|
352
354
|
* Adds a new HEAD route to the router.
|
|
353
355
|
*
|
|
@@ -356,7 +358,7 @@ declare abstract class CoreRouter {
|
|
|
356
358
|
* @param handler
|
|
357
359
|
* @param middlewares
|
|
358
360
|
*/
|
|
359
|
-
static head(
|
|
361
|
+
static head(path: string, handler: any, middlewares?: any[] | any): void;
|
|
360
362
|
/**
|
|
361
363
|
* Defines a group of routes with a common prefix.
|
|
362
364
|
*
|
|
@@ -365,7 +367,7 @@ declare abstract class CoreRouter {
|
|
|
365
367
|
* @param callback
|
|
366
368
|
* @param middlewares
|
|
367
369
|
*/
|
|
368
|
-
static group(
|
|
370
|
+
static group(prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
|
|
369
371
|
/**
|
|
370
372
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
371
373
|
*
|
|
@@ -373,24 +375,24 @@ declare abstract class CoreRouter {
|
|
|
373
375
|
* @param middlewares
|
|
374
376
|
* @param callback
|
|
375
377
|
*/
|
|
376
|
-
static middleware(
|
|
378
|
+
static middleware(middlewares: any[], callback: () => void): void;
|
|
377
379
|
/**
|
|
378
380
|
* Retrieves all registered routes in the router, optionally organized by path or method
|
|
379
381
|
* for easier access and management.
|
|
380
382
|
*
|
|
381
383
|
* @param this
|
|
382
384
|
*/
|
|
383
|
-
static allRoutes(
|
|
385
|
+
static allRoutes(): Array<Route<any, any, any>>;
|
|
384
386
|
/**
|
|
385
387
|
* @param this
|
|
386
388
|
* @param type - 'path' to get routes organized by path
|
|
387
389
|
*/
|
|
388
|
-
static allRoutes(
|
|
390
|
+
static allRoutes(type: 'path'): Record<string, Route<any, any, any>>;
|
|
389
391
|
/**
|
|
390
392
|
* @param this
|
|
391
393
|
* @param type - 'method' to get routes organized by method
|
|
392
394
|
*/
|
|
393
|
-
static allRoutes(
|
|
395
|
+
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
|
|
394
396
|
protected static resolveHandler(route: Route<any, any, any>): {
|
|
395
397
|
handlerFunction: ((ctx: any, req: Request) => any | Promise<any>) | null;
|
|
396
398
|
instance: Controller<any> | null;
|
|
@@ -399,7 +401,7 @@ declare abstract class CoreRouter {
|
|
|
399
401
|
bindingHandler?: object;
|
|
400
402
|
bindingMetadata?: object;
|
|
401
403
|
};
|
|
402
|
-
protected static callHandler(
|
|
404
|
+
protected static callHandler(handlerFunction: (ctx: any, req: Request) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
|
|
403
405
|
protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
|
|
404
406
|
body: Record<string, any>;
|
|
405
407
|
query: Record<string, any>;
|
package/dist/index.d.mts
CHANGED
|
@@ -41,8 +41,10 @@ declare class Response$1 {
|
|
|
41
41
|
headers: Headers;
|
|
42
42
|
sent: boolean;
|
|
43
43
|
statusCode: number;
|
|
44
|
-
|
|
44
|
+
statusText: string;
|
|
45
|
+
constructor(init?: Partial<Response$1 | globalThis.Response>);
|
|
45
46
|
status(code: number): this;
|
|
47
|
+
setStatusText(text: string): this;
|
|
46
48
|
code(code: number): this;
|
|
47
49
|
setHeader(name: string, value: string): this;
|
|
48
50
|
header(name: string, value: string): this;
|
|
@@ -206,7 +208,7 @@ declare abstract class CoreRouter {
|
|
|
206
208
|
protected static createBaseConfig(): RouterConfig;
|
|
207
209
|
protected static mergeConfig(target: RouterConfig, source?: RouterConfig): RouterConfig;
|
|
208
210
|
protected static getDefaultConfig(): RouterConfig;
|
|
209
|
-
protected static resolveStateNamespace(
|
|
211
|
+
protected static resolveStateNamespace(): string;
|
|
210
212
|
protected static getStateStore(): Record<string, any>;
|
|
211
213
|
protected static getPluginStore(): Set<string>;
|
|
212
214
|
protected static getPluginPendingStore(): Set<Promise<void>>;
|
|
@@ -224,10 +226,10 @@ declare abstract class CoreRouter {
|
|
|
224
226
|
groupMiddlewares: any[];
|
|
225
227
|
globalMiddlewares: any[];
|
|
226
228
|
};
|
|
227
|
-
protected static bindStateAccessors(
|
|
229
|
+
protected static bindStateAccessors(): void;
|
|
228
230
|
protected static createDefaultOptionsHandler(): any;
|
|
229
231
|
static config: RouterConfig;
|
|
230
|
-
static configureDefaults(
|
|
232
|
+
static configureDefaults(options?: RouterConfig): void;
|
|
231
233
|
/**
|
|
232
234
|
* Use a registered plugin
|
|
233
235
|
*
|
|
@@ -236,8 +238,8 @@ declare abstract class CoreRouter {
|
|
|
236
238
|
* @param options
|
|
237
239
|
* @returns
|
|
238
240
|
*/
|
|
239
|
-
static use<Options = any>(
|
|
240
|
-
protected static pluginsReady(
|
|
241
|
+
static use<Options = any>(plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
|
|
242
|
+
protected static pluginsReady(): Promise<void>;
|
|
241
243
|
protected static groupContext: AsyncLocalStorage<{
|
|
242
244
|
prefix: string;
|
|
243
245
|
groupMiddlewares: any[];
|
|
@@ -253,7 +255,7 @@ declare abstract class CoreRouter {
|
|
|
253
255
|
protected static createPluginRequestContext(ctx: any): ClearRouterPluginRequestContext;
|
|
254
256
|
protected static createPluginBind(): PluginBind;
|
|
255
257
|
protected static resolvePluginArguments(this: any, ctx: any, routeContext: Omit<ClearRouterPluginArgumentsContext, keyof ClearRouterPluginRequestContext>): Promise<any[] | undefined>;
|
|
256
|
-
protected static ensureState(
|
|
258
|
+
protected static ensureState(): void;
|
|
257
259
|
/**
|
|
258
260
|
* Normalizes a path by ensuring it starts with a single slash and does not have trailing
|
|
259
261
|
* slashes, while preserving dynamic segments and parameters.
|
|
@@ -270,7 +272,7 @@ declare abstract class CoreRouter {
|
|
|
270
272
|
* @returns
|
|
271
273
|
*/
|
|
272
274
|
static configure(this: any, options?: RouterConfig): void;
|
|
273
|
-
protected static resolveMethodOverride(
|
|
275
|
+
protected static resolveMethodOverride(method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
|
|
274
276
|
/**
|
|
275
277
|
* Adds a new route to the router.
|
|
276
278
|
*
|
|
@@ -280,7 +282,7 @@ declare abstract class CoreRouter {
|
|
|
280
282
|
* @param handler
|
|
281
283
|
* @param middlewares
|
|
282
284
|
*/
|
|
283
|
-
static add(
|
|
285
|
+
static add(methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
|
|
284
286
|
/**
|
|
285
287
|
* Define a resourceful API controller with standard CRUD routes.
|
|
286
288
|
*
|
|
@@ -289,7 +291,7 @@ declare abstract class CoreRouter {
|
|
|
289
291
|
* @param controller
|
|
290
292
|
* @param options
|
|
291
293
|
*/
|
|
292
|
-
static apiResource(
|
|
294
|
+
static apiResource(basePath: string, controller: any, options?: {
|
|
293
295
|
only?: ControllerAction[];
|
|
294
296
|
except?: ControllerAction[];
|
|
295
297
|
middlewares?: ApiResourceMiddleware<any>;
|
|
@@ -302,7 +304,7 @@ declare abstract class CoreRouter {
|
|
|
302
304
|
* @param handler The handler function for the GET route.
|
|
303
305
|
* @param middlewares Optional middlewares to apply to the GET route.
|
|
304
306
|
*/
|
|
305
|
-
static get(
|
|
307
|
+
static get(path: string, handler: any, middlewares?: any[] | any): void;
|
|
306
308
|
/**
|
|
307
309
|
* Adds a new POST route to the router.
|
|
308
310
|
*
|
|
@@ -311,7 +313,7 @@ declare abstract class CoreRouter {
|
|
|
311
313
|
* @param handler
|
|
312
314
|
* @param middlewares
|
|
313
315
|
*/
|
|
314
|
-
static post(
|
|
316
|
+
static post(path: string, handler: any, middlewares?: any[] | any): void;
|
|
315
317
|
/**
|
|
316
318
|
* Adds a new PUT route to the router.
|
|
317
319
|
*
|
|
@@ -320,7 +322,7 @@ declare abstract class CoreRouter {
|
|
|
320
322
|
* @param handler
|
|
321
323
|
* @param middlewares
|
|
322
324
|
*/
|
|
323
|
-
static put(
|
|
325
|
+
static put(path: string, handler: any, middlewares?: any[] | any): void;
|
|
324
326
|
/**
|
|
325
327
|
* Adds a new DELETE route to the router.
|
|
326
328
|
*
|
|
@@ -329,7 +331,7 @@ declare abstract class CoreRouter {
|
|
|
329
331
|
* @param handler
|
|
330
332
|
* @param middlewares
|
|
331
333
|
*/
|
|
332
|
-
static delete(
|
|
334
|
+
static delete(path: string, handler: any, middlewares?: any[] | any): void;
|
|
333
335
|
/**
|
|
334
336
|
* Adds a new PATCH route to the router.
|
|
335
337
|
*
|
|
@@ -338,7 +340,7 @@ declare abstract class CoreRouter {
|
|
|
338
340
|
* @param handler
|
|
339
341
|
* @param middlewares
|
|
340
342
|
*/
|
|
341
|
-
static patch(
|
|
343
|
+
static patch(path: string, handler: any, middlewares?: any[] | any): void;
|
|
342
344
|
/**
|
|
343
345
|
* Adds a new OPTIONS route to the router.
|
|
344
346
|
*
|
|
@@ -347,7 +349,7 @@ declare abstract class CoreRouter {
|
|
|
347
349
|
* @param handler
|
|
348
350
|
* @param middlewares
|
|
349
351
|
*/
|
|
350
|
-
static options(
|
|
352
|
+
static options(path: string, handler: any, middlewares?: any[] | any): void;
|
|
351
353
|
/**
|
|
352
354
|
* Adds a new HEAD route to the router.
|
|
353
355
|
*
|
|
@@ -356,7 +358,7 @@ declare abstract class CoreRouter {
|
|
|
356
358
|
* @param handler
|
|
357
359
|
* @param middlewares
|
|
358
360
|
*/
|
|
359
|
-
static head(
|
|
361
|
+
static head(path: string, handler: any, middlewares?: any[] | any): void;
|
|
360
362
|
/**
|
|
361
363
|
* Defines a group of routes with a common prefix.
|
|
362
364
|
*
|
|
@@ -365,7 +367,7 @@ declare abstract class CoreRouter {
|
|
|
365
367
|
* @param callback
|
|
366
368
|
* @param middlewares
|
|
367
369
|
*/
|
|
368
|
-
static group(
|
|
370
|
+
static group(prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
|
|
369
371
|
/**
|
|
370
372
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
371
373
|
*
|
|
@@ -373,24 +375,24 @@ declare abstract class CoreRouter {
|
|
|
373
375
|
* @param middlewares
|
|
374
376
|
* @param callback
|
|
375
377
|
*/
|
|
376
|
-
static middleware(
|
|
378
|
+
static middleware(middlewares: any[], callback: () => void): void;
|
|
377
379
|
/**
|
|
378
380
|
* Retrieves all registered routes in the router, optionally organized by path or method
|
|
379
381
|
* for easier access and management.
|
|
380
382
|
*
|
|
381
383
|
* @param this
|
|
382
384
|
*/
|
|
383
|
-
static allRoutes(
|
|
385
|
+
static allRoutes(): Array<Route<any, any, any>>;
|
|
384
386
|
/**
|
|
385
387
|
* @param this
|
|
386
388
|
* @param type - 'path' to get routes organized by path
|
|
387
389
|
*/
|
|
388
|
-
static allRoutes(
|
|
390
|
+
static allRoutes(type: 'path'): Record<string, Route<any, any, any>>;
|
|
389
391
|
/**
|
|
390
392
|
* @param this
|
|
391
393
|
* @param type - 'method' to get routes organized by method
|
|
392
394
|
*/
|
|
393
|
-
static allRoutes(
|
|
395
|
+
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
|
|
394
396
|
protected static resolveHandler(route: Route<any, any, any>): {
|
|
395
397
|
handlerFunction: ((ctx: any, req: Request) => any | Promise<any>) | null;
|
|
396
398
|
instance: Controller<any> | null;
|
|
@@ -399,7 +401,7 @@ declare abstract class CoreRouter {
|
|
|
399
401
|
bindingHandler?: object;
|
|
400
402
|
bindingMetadata?: object;
|
|
401
403
|
};
|
|
402
|
-
protected static callHandler(
|
|
404
|
+
protected static callHandler(handlerFunction: (ctx: any, req: Request) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
|
|
403
405
|
protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
|
|
404
406
|
body: Record<string, any>;
|
|
405
407
|
query: Record<string, any>;
|
package/dist/index.mjs
CHANGED
|
@@ -97,14 +97,21 @@ var Response = class {
|
|
|
97
97
|
headers = new Headers();
|
|
98
98
|
sent = false;
|
|
99
99
|
statusCode = 200;
|
|
100
|
+
statusText = "OK";
|
|
100
101
|
constructor(init) {
|
|
101
|
-
|
|
102
|
+
const { status: _, ...rest } = init ?? {};
|
|
103
|
+
Object.assign(this, rest);
|
|
102
104
|
if (init?.headers && !(init.headers instanceof Headers)) this.headers = new Headers(init.headers);
|
|
105
|
+
if (init?.status && typeof init.status === "number") this.statusCode = init?.status;
|
|
103
106
|
}
|
|
104
107
|
status(code) {
|
|
105
108
|
this.statusCode = code;
|
|
106
109
|
return this;
|
|
107
110
|
}
|
|
111
|
+
setStatusText(text) {
|
|
112
|
+
this.statusText = text;
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
108
115
|
code(code) {
|
|
109
116
|
return this.status(code);
|
|
110
117
|
}
|
|
@@ -883,7 +890,11 @@ var CoreRouter = class {
|
|
|
883
890
|
clearRequest.query = payload.query;
|
|
884
891
|
clearRequest.params = payload.params;
|
|
885
892
|
ctx.clearRequest = clearRequest;
|
|
886
|
-
|
|
893
|
+
Container.bind(Request, ctx.clearRequest);
|
|
894
|
+
if (!(ctx.clearResponse instanceof Response)) {
|
|
895
|
+
ctx.clearResponse = new Response(ctx.response ?? ctx.reply ?? ctx.res);
|
|
896
|
+
Container.bind(Response, ctx.clearResponse);
|
|
897
|
+
}
|
|
887
898
|
if (!instance) return;
|
|
888
899
|
instance.ctx = ctx;
|
|
889
900
|
instance.body = payload.body;
|
package/dist/koa/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('../bindings-
|
|
3
|
-
const require_router = require('../router-
|
|
4
|
-
const require_responses = require('../responses-
|
|
2
|
+
require('../bindings-CLsZjOEy.cjs');
|
|
3
|
+
const require_router = require('../router-D9H9-T27.cjs');
|
|
4
|
+
const require_responses = require('../responses-Bvnk0uvc.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/koa/router.ts
|
|
7
7
|
/**
|
package/dist/koa/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-
|
|
1
|
+
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-DTI0BowV.cjs";
|
|
2
2
|
import Koa from "koa";
|
|
3
3
|
import Router$1 from "@koa/router";
|
|
4
4
|
|
package/dist/koa/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-
|
|
1
|
+
import { C as ControllerAction, E as Response, S as ApiResourceMiddleware, T as HttpMethod, m as Route, p as Request, t as CoreRouter, w as ControllerHandler } from "../router-DiKqUyvk.mjs";
|
|
2
2
|
import Koa from "koa";
|
|
3
3
|
import Router$1 from "@koa/router";
|
|
4
4
|
|
package/dist/koa/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../bindings-
|
|
2
|
-
import { t as CoreRouter } from "../router-
|
|
3
|
-
import { n as resolveResponseMeta, t as isFetchResponse } from "../responses-
|
|
1
|
+
import "../bindings-XLDXFpHZ.mjs";
|
|
2
|
+
import { t as CoreRouter } from "../router-CPmZcbU0.mjs";
|
|
3
|
+
import { n as resolveResponseMeta, t as isFetchResponse } from "../responses-BvETUeDL.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/koa/router.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as getStandardMetadata, c as Request, i as getDesignParamTypes, n as Container, o as isClass, r as getBindingMetadataFromTargets, s as Response } from "./bindings-
|
|
1
|
+
import { a as getStandardMetadata, c as Request, i as getDesignParamTypes, n as Container, o as isClass, r as getBindingMetadataFromTargets, s as Response } from "./bindings-XLDXFpHZ.mjs";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/Route.ts
|
|
@@ -664,7 +664,11 @@ var CoreRouter = class {
|
|
|
664
664
|
clearRequest.query = payload.query;
|
|
665
665
|
clearRequest.params = payload.params;
|
|
666
666
|
ctx.clearRequest = clearRequest;
|
|
667
|
-
|
|
667
|
+
Container.bind(Request, ctx.clearRequest);
|
|
668
|
+
if (!(ctx.clearResponse instanceof Response)) {
|
|
669
|
+
ctx.clearResponse = new Response(ctx.response ?? ctx.reply ?? ctx.res);
|
|
670
|
+
Container.bind(Response, ctx.clearResponse);
|
|
671
|
+
}
|
|
668
672
|
if (!instance) return;
|
|
669
673
|
instance.ctx = ctx;
|
|
670
674
|
instance.body = payload.body;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_bindings = require('./bindings-
|
|
1
|
+
const require_bindings = require('./bindings-CLsZjOEy.cjs');
|
|
2
2
|
let node_async_hooks = require("node:async_hooks");
|
|
3
3
|
|
|
4
4
|
//#region src/Route.ts
|
|
@@ -664,7 +664,11 @@ var CoreRouter = class {
|
|
|
664
664
|
clearRequest.query = payload.query;
|
|
665
665
|
clearRequest.params = payload.params;
|
|
666
666
|
ctx.clearRequest = clearRequest;
|
|
667
|
-
|
|
667
|
+
require_bindings.Container.bind(require_bindings.Request, ctx.clearRequest);
|
|
668
|
+
if (!(ctx.clearResponse instanceof require_bindings.Response)) {
|
|
669
|
+
ctx.clearResponse = new require_bindings.Response(ctx.response ?? ctx.reply ?? ctx.res);
|
|
670
|
+
require_bindings.Container.bind(require_bindings.Response, ctx.clearResponse);
|
|
671
|
+
}
|
|
668
672
|
if (!instance) return;
|
|
669
673
|
instance.ctx = ctx;
|
|
670
674
|
instance.body = payload.body;
|
|
@@ -9,8 +9,10 @@ declare class Response$2 {
|
|
|
9
9
|
headers: Headers;
|
|
10
10
|
sent: boolean;
|
|
11
11
|
statusCode: number;
|
|
12
|
-
|
|
12
|
+
statusText: string;
|
|
13
|
+
constructor(init?: Partial<Response$2 | globalThis.Response>);
|
|
13
14
|
status(code: number): this;
|
|
15
|
+
setStatusText(text: string): this;
|
|
14
16
|
code(code: number): this;
|
|
15
17
|
setHeader(name: string, value: string): this;
|
|
16
18
|
header(name: string, value: string): this;
|
|
@@ -258,7 +260,7 @@ declare abstract class CoreRouter {
|
|
|
258
260
|
protected static createBaseConfig(): RouterConfig;
|
|
259
261
|
protected static mergeConfig(target: RouterConfig, source?: RouterConfig): RouterConfig;
|
|
260
262
|
protected static getDefaultConfig(): RouterConfig;
|
|
261
|
-
protected static resolveStateNamespace(
|
|
263
|
+
protected static resolveStateNamespace(): string;
|
|
262
264
|
protected static getStateStore(): Record<string, any>;
|
|
263
265
|
protected static getPluginStore(): Set<string>;
|
|
264
266
|
protected static getPluginPendingStore(): Set<Promise<void>>;
|
|
@@ -276,10 +278,10 @@ declare abstract class CoreRouter {
|
|
|
276
278
|
groupMiddlewares: any[];
|
|
277
279
|
globalMiddlewares: any[];
|
|
278
280
|
};
|
|
279
|
-
protected static bindStateAccessors(
|
|
281
|
+
protected static bindStateAccessors(): void;
|
|
280
282
|
protected static createDefaultOptionsHandler(): any;
|
|
281
283
|
static config: RouterConfig;
|
|
282
|
-
static configureDefaults(
|
|
284
|
+
static configureDefaults(options?: RouterConfig): void;
|
|
283
285
|
/**
|
|
284
286
|
* Use a registered plugin
|
|
285
287
|
*
|
|
@@ -288,8 +290,8 @@ declare abstract class CoreRouter {
|
|
|
288
290
|
* @param options
|
|
289
291
|
* @returns
|
|
290
292
|
*/
|
|
291
|
-
static use<Options = any>(
|
|
292
|
-
protected static pluginsReady(
|
|
293
|
+
static use<Options = any>(plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
|
|
294
|
+
protected static pluginsReady(): Promise<void>;
|
|
293
295
|
protected static groupContext: AsyncLocalStorage<{
|
|
294
296
|
prefix: string;
|
|
295
297
|
groupMiddlewares: any[];
|
|
@@ -305,7 +307,7 @@ declare abstract class CoreRouter {
|
|
|
305
307
|
protected static createPluginRequestContext(ctx: any): ClearRouterPluginRequestContext;
|
|
306
308
|
protected static createPluginBind(): PluginBind;
|
|
307
309
|
protected static resolvePluginArguments(this: any, ctx: any, routeContext: Omit<ClearRouterPluginArgumentsContext, keyof ClearRouterPluginRequestContext>): Promise<any[] | undefined>;
|
|
308
|
-
protected static ensureState(
|
|
310
|
+
protected static ensureState(): void;
|
|
309
311
|
/**
|
|
310
312
|
* Normalizes a path by ensuring it starts with a single slash and does not have trailing
|
|
311
313
|
* slashes, while preserving dynamic segments and parameters.
|
|
@@ -322,7 +324,7 @@ declare abstract class CoreRouter {
|
|
|
322
324
|
* @returns
|
|
323
325
|
*/
|
|
324
326
|
static configure(this: any, options?: RouterConfig): void;
|
|
325
|
-
protected static resolveMethodOverride(
|
|
327
|
+
protected static resolveMethodOverride(method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
|
|
326
328
|
/**
|
|
327
329
|
* Adds a new route to the router.
|
|
328
330
|
*
|
|
@@ -332,7 +334,7 @@ declare abstract class CoreRouter {
|
|
|
332
334
|
* @param handler
|
|
333
335
|
* @param middlewares
|
|
334
336
|
*/
|
|
335
|
-
static add(
|
|
337
|
+
static add(methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
|
|
336
338
|
/**
|
|
337
339
|
* Define a resourceful API controller with standard CRUD routes.
|
|
338
340
|
*
|
|
@@ -341,7 +343,7 @@ declare abstract class CoreRouter {
|
|
|
341
343
|
* @param controller
|
|
342
344
|
* @param options
|
|
343
345
|
*/
|
|
344
|
-
static apiResource(
|
|
346
|
+
static apiResource(basePath: string, controller: any, options?: {
|
|
345
347
|
only?: ControllerAction[];
|
|
346
348
|
except?: ControllerAction[];
|
|
347
349
|
middlewares?: ApiResourceMiddleware<any>;
|
|
@@ -354,7 +356,7 @@ declare abstract class CoreRouter {
|
|
|
354
356
|
* @param handler The handler function for the GET route.
|
|
355
357
|
* @param middlewares Optional middlewares to apply to the GET route.
|
|
356
358
|
*/
|
|
357
|
-
static get(
|
|
359
|
+
static get(path: string, handler: any, middlewares?: any[] | any): void;
|
|
358
360
|
/**
|
|
359
361
|
* Adds a new POST route to the router.
|
|
360
362
|
*
|
|
@@ -363,7 +365,7 @@ declare abstract class CoreRouter {
|
|
|
363
365
|
* @param handler
|
|
364
366
|
* @param middlewares
|
|
365
367
|
*/
|
|
366
|
-
static post(
|
|
368
|
+
static post(path: string, handler: any, middlewares?: any[] | any): void;
|
|
367
369
|
/**
|
|
368
370
|
* Adds a new PUT route to the router.
|
|
369
371
|
*
|
|
@@ -372,7 +374,7 @@ declare abstract class CoreRouter {
|
|
|
372
374
|
* @param handler
|
|
373
375
|
* @param middlewares
|
|
374
376
|
*/
|
|
375
|
-
static put(
|
|
377
|
+
static put(path: string, handler: any, middlewares?: any[] | any): void;
|
|
376
378
|
/**
|
|
377
379
|
* Adds a new DELETE route to the router.
|
|
378
380
|
*
|
|
@@ -381,7 +383,7 @@ declare abstract class CoreRouter {
|
|
|
381
383
|
* @param handler
|
|
382
384
|
* @param middlewares
|
|
383
385
|
*/
|
|
384
|
-
static delete(
|
|
386
|
+
static delete(path: string, handler: any, middlewares?: any[] | any): void;
|
|
385
387
|
/**
|
|
386
388
|
* Adds a new PATCH route to the router.
|
|
387
389
|
*
|
|
@@ -390,7 +392,7 @@ declare abstract class CoreRouter {
|
|
|
390
392
|
* @param handler
|
|
391
393
|
* @param middlewares
|
|
392
394
|
*/
|
|
393
|
-
static patch(
|
|
395
|
+
static patch(path: string, handler: any, middlewares?: any[] | any): void;
|
|
394
396
|
/**
|
|
395
397
|
* Adds a new OPTIONS route to the router.
|
|
396
398
|
*
|
|
@@ -399,7 +401,7 @@ declare abstract class CoreRouter {
|
|
|
399
401
|
* @param handler
|
|
400
402
|
* @param middlewares
|
|
401
403
|
*/
|
|
402
|
-
static options(
|
|
404
|
+
static options(path: string, handler: any, middlewares?: any[] | any): void;
|
|
403
405
|
/**
|
|
404
406
|
* Adds a new HEAD route to the router.
|
|
405
407
|
*
|
|
@@ -408,7 +410,7 @@ declare abstract class CoreRouter {
|
|
|
408
410
|
* @param handler
|
|
409
411
|
* @param middlewares
|
|
410
412
|
*/
|
|
411
|
-
static head(
|
|
413
|
+
static head(path: string, handler: any, middlewares?: any[] | any): void;
|
|
412
414
|
/**
|
|
413
415
|
* Defines a group of routes with a common prefix.
|
|
414
416
|
*
|
|
@@ -417,7 +419,7 @@ declare abstract class CoreRouter {
|
|
|
417
419
|
* @param callback
|
|
418
420
|
* @param middlewares
|
|
419
421
|
*/
|
|
420
|
-
static group(
|
|
422
|
+
static group(prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
|
|
421
423
|
/**
|
|
422
424
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
423
425
|
*
|
|
@@ -425,24 +427,24 @@ declare abstract class CoreRouter {
|
|
|
425
427
|
* @param middlewares
|
|
426
428
|
* @param callback
|
|
427
429
|
*/
|
|
428
|
-
static middleware(
|
|
430
|
+
static middleware(middlewares: any[], callback: () => void): void;
|
|
429
431
|
/**
|
|
430
432
|
* Retrieves all registered routes in the router, optionally organized by path or method
|
|
431
433
|
* for easier access and management.
|
|
432
434
|
*
|
|
433
435
|
* @param this
|
|
434
436
|
*/
|
|
435
|
-
static allRoutes(
|
|
437
|
+
static allRoutes(): Array<Route<any, any, any>>;
|
|
436
438
|
/**
|
|
437
439
|
* @param this
|
|
438
440
|
* @param type - 'path' to get routes organized by path
|
|
439
441
|
*/
|
|
440
|
-
static allRoutes(
|
|
442
|
+
static allRoutes(type: 'path'): Record<string, Route<any, any, any>>;
|
|
441
443
|
/**
|
|
442
444
|
* @param this
|
|
443
445
|
* @param type - 'method' to get routes organized by method
|
|
444
446
|
*/
|
|
445
|
-
static allRoutes(
|
|
447
|
+
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
|
|
446
448
|
protected static resolveHandler(route: Route<any, any, any>): {
|
|
447
449
|
handlerFunction: ((ctx: any, req: Request$1) => any | Promise<any>) | null;
|
|
448
450
|
instance: Controller<any> | null;
|
|
@@ -451,7 +453,7 @@ declare abstract class CoreRouter {
|
|
|
451
453
|
bindingHandler?: object;
|
|
452
454
|
bindingMetadata?: object;
|
|
453
455
|
};
|
|
454
|
-
protected static callHandler(
|
|
456
|
+
protected static callHandler(handlerFunction: (ctx: any, req: Request$1) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
|
|
455
457
|
protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
|
|
456
458
|
body: Record<string, any>;
|
|
457
459
|
query: Record<string, any>;
|
|
@@ -9,8 +9,10 @@ declare class Response$2 {
|
|
|
9
9
|
headers: Headers;
|
|
10
10
|
sent: boolean;
|
|
11
11
|
statusCode: number;
|
|
12
|
-
|
|
12
|
+
statusText: string;
|
|
13
|
+
constructor(init?: Partial<Response$2 | globalThis.Response>);
|
|
13
14
|
status(code: number): this;
|
|
15
|
+
setStatusText(text: string): this;
|
|
14
16
|
code(code: number): this;
|
|
15
17
|
setHeader(name: string, value: string): this;
|
|
16
18
|
header(name: string, value: string): this;
|
|
@@ -258,7 +260,7 @@ declare abstract class CoreRouter {
|
|
|
258
260
|
protected static createBaseConfig(): RouterConfig;
|
|
259
261
|
protected static mergeConfig(target: RouterConfig, source?: RouterConfig): RouterConfig;
|
|
260
262
|
protected static getDefaultConfig(): RouterConfig;
|
|
261
|
-
protected static resolveStateNamespace(
|
|
263
|
+
protected static resolveStateNamespace(): string;
|
|
262
264
|
protected static getStateStore(): Record<string, any>;
|
|
263
265
|
protected static getPluginStore(): Set<string>;
|
|
264
266
|
protected static getPluginPendingStore(): Set<Promise<void>>;
|
|
@@ -276,10 +278,10 @@ declare abstract class CoreRouter {
|
|
|
276
278
|
groupMiddlewares: any[];
|
|
277
279
|
globalMiddlewares: any[];
|
|
278
280
|
};
|
|
279
|
-
protected static bindStateAccessors(
|
|
281
|
+
protected static bindStateAccessors(): void;
|
|
280
282
|
protected static createDefaultOptionsHandler(): any;
|
|
281
283
|
static config: RouterConfig;
|
|
282
|
-
static configureDefaults(
|
|
284
|
+
static configureDefaults(options?: RouterConfig): void;
|
|
283
285
|
/**
|
|
284
286
|
* Use a registered plugin
|
|
285
287
|
*
|
|
@@ -288,8 +290,8 @@ declare abstract class CoreRouter {
|
|
|
288
290
|
* @param options
|
|
289
291
|
* @returns
|
|
290
292
|
*/
|
|
291
|
-
static use<Options = any>(
|
|
292
|
-
protected static pluginsReady(
|
|
293
|
+
static use<Options = any>(plugin: ClearRouterPluginInput<Options>, options?: Options): Promise<void>;
|
|
294
|
+
protected static pluginsReady(): Promise<void>;
|
|
293
295
|
protected static groupContext: AsyncLocalStorage<{
|
|
294
296
|
prefix: string;
|
|
295
297
|
groupMiddlewares: any[];
|
|
@@ -305,7 +307,7 @@ declare abstract class CoreRouter {
|
|
|
305
307
|
protected static createPluginRequestContext(ctx: any): ClearRouterPluginRequestContext;
|
|
306
308
|
protected static createPluginBind(): PluginBind;
|
|
307
309
|
protected static resolvePluginArguments(this: any, ctx: any, routeContext: Omit<ClearRouterPluginArgumentsContext, keyof ClearRouterPluginRequestContext>): Promise<any[] | undefined>;
|
|
308
|
-
protected static ensureState(
|
|
310
|
+
protected static ensureState(): void;
|
|
309
311
|
/**
|
|
310
312
|
* Normalizes a path by ensuring it starts with a single slash and does not have trailing
|
|
311
313
|
* slashes, while preserving dynamic segments and parameters.
|
|
@@ -322,7 +324,7 @@ declare abstract class CoreRouter {
|
|
|
322
324
|
* @returns
|
|
323
325
|
*/
|
|
324
326
|
static configure(this: any, options?: RouterConfig): void;
|
|
325
|
-
protected static resolveMethodOverride(
|
|
327
|
+
protected static resolveMethodOverride(method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
|
|
326
328
|
/**
|
|
327
329
|
* Adds a new route to the router.
|
|
328
330
|
*
|
|
@@ -332,7 +334,7 @@ declare abstract class CoreRouter {
|
|
|
332
334
|
* @param handler
|
|
333
335
|
* @param middlewares
|
|
334
336
|
*/
|
|
335
|
-
static add(
|
|
337
|
+
static add(methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
|
|
336
338
|
/**
|
|
337
339
|
* Define a resourceful API controller with standard CRUD routes.
|
|
338
340
|
*
|
|
@@ -341,7 +343,7 @@ declare abstract class CoreRouter {
|
|
|
341
343
|
* @param controller
|
|
342
344
|
* @param options
|
|
343
345
|
*/
|
|
344
|
-
static apiResource(
|
|
346
|
+
static apiResource(basePath: string, controller: any, options?: {
|
|
345
347
|
only?: ControllerAction[];
|
|
346
348
|
except?: ControllerAction[];
|
|
347
349
|
middlewares?: ApiResourceMiddleware<any>;
|
|
@@ -354,7 +356,7 @@ declare abstract class CoreRouter {
|
|
|
354
356
|
* @param handler The handler function for the GET route.
|
|
355
357
|
* @param middlewares Optional middlewares to apply to the GET route.
|
|
356
358
|
*/
|
|
357
|
-
static get(
|
|
359
|
+
static get(path: string, handler: any, middlewares?: any[] | any): void;
|
|
358
360
|
/**
|
|
359
361
|
* Adds a new POST route to the router.
|
|
360
362
|
*
|
|
@@ -363,7 +365,7 @@ declare abstract class CoreRouter {
|
|
|
363
365
|
* @param handler
|
|
364
366
|
* @param middlewares
|
|
365
367
|
*/
|
|
366
|
-
static post(
|
|
368
|
+
static post(path: string, handler: any, middlewares?: any[] | any): void;
|
|
367
369
|
/**
|
|
368
370
|
* Adds a new PUT route to the router.
|
|
369
371
|
*
|
|
@@ -372,7 +374,7 @@ declare abstract class CoreRouter {
|
|
|
372
374
|
* @param handler
|
|
373
375
|
* @param middlewares
|
|
374
376
|
*/
|
|
375
|
-
static put(
|
|
377
|
+
static put(path: string, handler: any, middlewares?: any[] | any): void;
|
|
376
378
|
/**
|
|
377
379
|
* Adds a new DELETE route to the router.
|
|
378
380
|
*
|
|
@@ -381,7 +383,7 @@ declare abstract class CoreRouter {
|
|
|
381
383
|
* @param handler
|
|
382
384
|
* @param middlewares
|
|
383
385
|
*/
|
|
384
|
-
static delete(
|
|
386
|
+
static delete(path: string, handler: any, middlewares?: any[] | any): void;
|
|
385
387
|
/**
|
|
386
388
|
* Adds a new PATCH route to the router.
|
|
387
389
|
*
|
|
@@ -390,7 +392,7 @@ declare abstract class CoreRouter {
|
|
|
390
392
|
* @param handler
|
|
391
393
|
* @param middlewares
|
|
392
394
|
*/
|
|
393
|
-
static patch(
|
|
395
|
+
static patch(path: string, handler: any, middlewares?: any[] | any): void;
|
|
394
396
|
/**
|
|
395
397
|
* Adds a new OPTIONS route to the router.
|
|
396
398
|
*
|
|
@@ -399,7 +401,7 @@ declare abstract class CoreRouter {
|
|
|
399
401
|
* @param handler
|
|
400
402
|
* @param middlewares
|
|
401
403
|
*/
|
|
402
|
-
static options(
|
|
404
|
+
static options(path: string, handler: any, middlewares?: any[] | any): void;
|
|
403
405
|
/**
|
|
404
406
|
* Adds a new HEAD route to the router.
|
|
405
407
|
*
|
|
@@ -408,7 +410,7 @@ declare abstract class CoreRouter {
|
|
|
408
410
|
* @param handler
|
|
409
411
|
* @param middlewares
|
|
410
412
|
*/
|
|
411
|
-
static head(
|
|
413
|
+
static head(path: string, handler: any, middlewares?: any[] | any): void;
|
|
412
414
|
/**
|
|
413
415
|
* Defines a group of routes with a common prefix.
|
|
414
416
|
*
|
|
@@ -417,7 +419,7 @@ declare abstract class CoreRouter {
|
|
|
417
419
|
* @param callback
|
|
418
420
|
* @param middlewares
|
|
419
421
|
*/
|
|
420
|
-
static group(
|
|
422
|
+
static group(prefix: string, callback: () => void | Promise<void>, middlewares?: any[]): Promise<void>;
|
|
421
423
|
/**
|
|
422
424
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
423
425
|
*
|
|
@@ -425,24 +427,24 @@ declare abstract class CoreRouter {
|
|
|
425
427
|
* @param middlewares
|
|
426
428
|
* @param callback
|
|
427
429
|
*/
|
|
428
|
-
static middleware(
|
|
430
|
+
static middleware(middlewares: any[], callback: () => void): void;
|
|
429
431
|
/**
|
|
430
432
|
* Retrieves all registered routes in the router, optionally organized by path or method
|
|
431
433
|
* for easier access and management.
|
|
432
434
|
*
|
|
433
435
|
* @param this
|
|
434
436
|
*/
|
|
435
|
-
static allRoutes(
|
|
437
|
+
static allRoutes(): Array<Route<any, any, any>>;
|
|
436
438
|
/**
|
|
437
439
|
* @param this
|
|
438
440
|
* @param type - 'path' to get routes organized by path
|
|
439
441
|
*/
|
|
440
|
-
static allRoutes(
|
|
442
|
+
static allRoutes(type: 'path'): Record<string, Route<any, any, any>>;
|
|
441
443
|
/**
|
|
442
444
|
* @param this
|
|
443
445
|
* @param type - 'method' to get routes organized by method
|
|
444
446
|
*/
|
|
445
|
-
static allRoutes(
|
|
447
|
+
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<any, any, any>> };
|
|
446
448
|
protected static resolveHandler(route: Route<any, any, any>): {
|
|
447
449
|
handlerFunction: ((ctx: any, req: Request$1) => any | Promise<any>) | null;
|
|
448
450
|
instance: Controller<any> | null;
|
|
@@ -451,7 +453,7 @@ declare abstract class CoreRouter {
|
|
|
451
453
|
bindingHandler?: object;
|
|
452
454
|
bindingMetadata?: object;
|
|
453
455
|
};
|
|
454
|
-
protected static callHandler(
|
|
456
|
+
protected static callHandler(handlerFunction: (ctx: any, req: Request$1) => any | Promise<any>, ctx: any, bindingTarget?: object, bindingMethod?: PropertyKey, bindingHandler?: object, bindingMetadata?: object): Promise<any>;
|
|
455
457
|
protected static bindRequestToInstance(ctx: any, instance: Controller<any> | Route<any, any, any> | null, route: Route<any, any, any>, payload: {
|
|
456
458
|
body: Record<string, any>;
|
|
457
459
|
query: Record<string, any>;
|
|
@@ -4,8 +4,10 @@ declare class Response {
|
|
|
4
4
|
headers: Headers;
|
|
5
5
|
sent: boolean;
|
|
6
6
|
statusCode: number;
|
|
7
|
-
|
|
7
|
+
statusText: string;
|
|
8
|
+
constructor(init?: Partial<Response | globalThis.Response>);
|
|
8
9
|
status(code: number): this;
|
|
10
|
+
setStatusText(text: string): this;
|
|
9
11
|
code(code: number): this;
|
|
10
12
|
setHeader(name: string, value: string): this;
|
|
11
13
|
header(name: string, value: string): this;
|
package/package.json
CHANGED