@invect/express 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 @robase
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_router_index = require("./router/index.cjs");
3
+ let _invect_core = require("@invect/core");
4
+ Object.defineProperty(exports, "Invect", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return _invect_core.Invect;
8
+ }
9
+ });
10
+ exports.createInvectRouter = require_router_index.createInvectRouter;
@@ -0,0 +1,3 @@
1
+ import { createInvectRouter } from "./router/index.cjs";
2
+ import { Invect, InvectConfig } from "@invect/core";
3
+ export { Invect, type InvectConfig, createInvectRouter };
@@ -0,0 +1,3 @@
1
+ import { createInvectRouter } from "./router/index.js";
2
+ import { Invect, InvectConfig } from "@invect/core";
3
+ export { Invect, type InvectConfig, createInvectRouter };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { createInvectRouter } from "./router/index.js";
2
+ import { Invect } from "@invect/core";
3
+ export { Invect, createInvectRouter };
@@ -0,0 +1,24 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/async-handler.ts
3
+ /**
4
+ * Async handler wrapper for Express route handlers
5
+ * Catches async errors and passes them to the error handling middleware
6
+ */
7
+ function asyncHandler(fn) {
8
+ return (req, res, next) => {
9
+ Promise.resolve(fn(req, res, next)).catch(next);
10
+ };
11
+ }
12
+ /**
13
+ * Async handler for middleware functions
14
+ */
15
+ function asyncMiddleware(fn) {
16
+ return (req, res, next) => {
17
+ Promise.resolve(fn(req, res, next)).catch(next);
18
+ };
19
+ }
20
+ //#endregion
21
+ exports.asyncHandler = asyncHandler;
22
+ exports.asyncMiddleware = asyncMiddleware;
23
+
24
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/async-handler.ts"],"sourcesContent":["import type { Request, Response, NextFunction } from 'express';\n\n/**\n * Async handler wrapper for Express route handlers\n * Catches async errors and passes them to the error handling middleware\n */\nexport function asyncHandler(\n fn: (req: Request, res: Response, next: NextFunction) => Promise<unknown>,\n) {\n return (req: Request, res: Response, next: NextFunction) => {\n Promise.resolve(fn(req, res, next)).catch(next);\n };\n}\n\n/**\n * Async handler for middleware functions\n */\nexport function asyncMiddleware(\n fn: (req: Request, res: Response, next: NextFunction) => Promise<void>,\n) {\n return (req: Request, res: Response, next: NextFunction) => {\n Promise.resolve(fn(req, res, next)).catch(next);\n };\n}\n"],"mappings":";;;;;;AAMA,SAAgB,aACd,IACA;AACA,SAAQ,KAAc,KAAe,SAAuB;AAC1D,UAAQ,QAAQ,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK;;;;;;AAOnD,SAAgB,gBACd,IACA;AACA,SAAQ,KAAc,KAAe,SAAuB;AAC1D,UAAQ,QAAQ,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK"}
@@ -0,0 +1,15 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+
3
+ //#region src/async-handler.d.ts
4
+ /**
5
+ * Async handler wrapper for Express route handlers
6
+ * Catches async errors and passes them to the error handling middleware
7
+ */
8
+ declare function asyncHandler(fn: (req: Request, res: Response, next: NextFunction) => Promise<unknown>): (req: Request, res: Response, next: NextFunction) => void;
9
+ /**
10
+ * Async handler for middleware functions
11
+ */
12
+ declare function asyncMiddleware(fn: (req: Request, res: Response, next: NextFunction) => Promise<void>): (req: Request, res: Response, next: NextFunction) => void;
13
+ //#endregion
14
+ export { asyncHandler, asyncMiddleware };
15
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/async-handler.ts"],"mappings":";;;;;AAMA;;iBAAgB,YAAA,CACd,EAAA,GAAK,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA,KAAiB,OAAA,aAEjD,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA;;;;iBAQ7B,eAAA,CACd,EAAA,GAAK,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA,KAAiB,OAAA,UAEjD,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA"}
@@ -0,0 +1,15 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+
3
+ //#region src/async-handler.d.ts
4
+ /**
5
+ * Async handler wrapper for Express route handlers
6
+ * Catches async errors and passes them to the error handling middleware
7
+ */
8
+ declare function asyncHandler(fn: (req: Request, res: Response, next: NextFunction) => Promise<unknown>): (req: Request, res: Response, next: NextFunction) => void;
9
+ /**
10
+ * Async handler for middleware functions
11
+ */
12
+ declare function asyncMiddleware(fn: (req: Request, res: Response, next: NextFunction) => Promise<void>): (req: Request, res: Response, next: NextFunction) => void;
13
+ //#endregion
14
+ export { asyncHandler, asyncMiddleware };
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/async-handler.ts"],"mappings":";;;;;AAMA;;iBAAgB,YAAA,CACd,EAAA,GAAK,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA,KAAiB,OAAA,aAEjD,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA;;;;iBAQ7B,eAAA,CACd,EAAA,GAAK,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA,KAAiB,OAAA,UAEjD,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA"}
@@ -0,0 +1,22 @@
1
+ //#region src/async-handler.ts
2
+ /**
3
+ * Async handler wrapper for Express route handlers
4
+ * Catches async errors and passes them to the error handling middleware
5
+ */
6
+ function asyncHandler(fn) {
7
+ return (req, res, next) => {
8
+ Promise.resolve(fn(req, res, next)).catch(next);
9
+ };
10
+ }
11
+ /**
12
+ * Async handler for middleware functions
13
+ */
14
+ function asyncMiddleware(fn) {
15
+ return (req, res, next) => {
16
+ Promise.resolve(fn(req, res, next)).catch(next);
17
+ };
18
+ }
19
+ //#endregion
20
+ export { asyncHandler, asyncMiddleware };
21
+
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/async-handler.ts"],"sourcesContent":["import type { Request, Response, NextFunction } from 'express';\n\n/**\n * Async handler wrapper for Express route handlers\n * Catches async errors and passes them to the error handling middleware\n */\nexport function asyncHandler(\n fn: (req: Request, res: Response, next: NextFunction) => Promise<unknown>,\n) {\n return (req: Request, res: Response, next: NextFunction) => {\n Promise.resolve(fn(req, res, next)).catch(next);\n };\n}\n\n/**\n * Async handler for middleware functions\n */\nexport function asyncMiddleware(\n fn: (req: Request, res: Response, next: NextFunction) => Promise<void>,\n) {\n return (req: Request, res: Response, next: NextFunction) => {\n Promise.resolve(fn(req, res, next)).catch(next);\n };\n}\n"],"mappings":";;;;;AAMA,SAAgB,aACd,IACA;AACA,SAAQ,KAAc,KAAe,SAAuB;AAC1D,UAAQ,QAAQ,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK;;;;;;AAOnD,SAAgB,gBACd,IACA;AACA,SAAQ,KAAc,KAAe,SAAuB;AAC1D,UAAQ,QAAQ,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK"}