@forinda/kickjs 3.2.0 → 4.1.0
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/README.md +13 -212
- package/dist/adapter-6Pp4kFdM.d.mts +296 -0
- package/dist/adapter-6Pp4kFdM.d.mts.map +1 -0
- package/dist/{app-module-ERR9jhow.d.mts → app-module-Blgz4Rti.d.mts} +4 -4
- package/dist/app-module-Blgz4Rti.d.mts.map +1 -0
- package/dist/application-Bepa-pFw.d.mts +302 -0
- package/dist/application-Bepa-pFw.d.mts.map +1 -0
- package/dist/{application-x8CXLOlv.mjs → application-DvmPMUgF.mjs} +28 -9
- package/dist/application-DvmPMUgF.mjs.map +1 -0
- package/dist/bootstrap-B4T3X2B6.d.mts +28 -0
- package/dist/bootstrap-B4T3X2B6.d.mts.map +1 -0
- package/dist/{bootstrap-CYnxozL_.mjs → bootstrap-THfr8phJ.mjs} +6 -6
- package/dist/{bootstrap-CYnxozL_.mjs.map → bootstrap-THfr8phJ.mjs.map} +1 -1
- package/dist/{cache-V91BNTIM.d.mts → cache-XrNWj1KQ.d.mts} +3 -3
- package/dist/{cache-V91BNTIM.d.mts.map → cache-XrNWj1KQ.d.mts.map} +1 -1
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +3 -3
- package/dist/{config-aWxKLk4A.mjs → config-BEjgF1fI.mjs} +4 -4
- package/dist/{config-aWxKLk4A.mjs.map → config-BEjgF1fI.mjs.map} +1 -1
- package/dist/{container-Dnk43k54.mjs → container-BYuMSnqW.mjs} +314 -9
- package/dist/container-BYuMSnqW.mjs.map +1 -0
- package/dist/{container-fIS1uLx-.d.mts → container-CnWDsxi-.d.mts} +9 -7
- package/dist/container-CnWDsxi-.d.mts.map +1 -0
- package/dist/{context-OktlOQBQ.mjs → context-CyQbqSz-.mjs} +33 -41
- package/dist/context-CyQbqSz-.mjs.map +1 -0
- package/dist/context-Ymvv-85x.d.mts +260 -0
- package/dist/context-Ymvv-85x.d.mts.map +1 -0
- package/dist/{context-decorator-GA8-hDLe.d.mts → context-decorator-DrPvQ9Ag.d.mts} +62 -12
- package/dist/context-decorator-DrPvQ9Ag.d.mts.map +1 -0
- package/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +1 -1
- package/dist/core/app-module.d.mts +1 -1
- package/dist/core/app-module.mjs +1 -1
- package/dist/core/cache.d.mts +1 -1
- package/dist/core/cache.mjs +3 -3
- package/dist/core/cache.mjs.map +1 -1
- package/dist/core/container.d.mts +1 -1
- package/dist/core/container.mjs +2 -2
- package/dist/core/cron.d.mts +1 -1
- package/dist/core/cron.mjs +3 -3
- package/dist/core/cron.mjs.map +1 -1
- package/dist/core/decorators.d.mts +2 -2
- package/dist/core/decorators.mjs +48 -16
- package/dist/core/decorators.mjs.map +1 -1
- package/dist/core/errors.d.mts +1 -1
- package/dist/core/errors.mjs +1 -1
- package/dist/core/interfaces.d.mts +1 -1
- package/dist/core/interfaces.mjs +35 -18
- package/dist/core/interfaces.mjs.map +1 -1
- package/dist/core/logger.d.mts +2 -2
- package/dist/core/logger.mjs +2 -4
- package/dist/core/logger.mjs.map +1 -1
- package/dist/core/path.d.mts +1 -1
- package/dist/core/path.mjs +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +1 -1
- package/dist/core/reactivity.d.mts +1 -1
- package/dist/core/reactivity.mjs +1 -1
- package/dist/{core-DANnH5-e.mjs → core-Dj3iVQ3t.mjs} +305 -8
- package/dist/core-Dj3iVQ3t.mjs.map +1 -0
- package/dist/cors-BfgqfLPd.d.mts +48 -0
- package/dist/cors-BfgqfLPd.d.mts.map +1 -0
- package/dist/{cron-CfsPdi7R.d.mts → cron-GNoYydfg.d.mts} +2 -2
- package/dist/cron-GNoYydfg.d.mts.map +1 -0
- package/dist/csrf-DiK9zept.d.mts +52 -0
- package/dist/csrf-DiK9zept.d.mts.map +1 -0
- package/dist/{decorators-H42oPg0m.d.mts → decorators-BMvaLliz.d.mts} +147 -12
- package/dist/decorators-BMvaLliz.d.mts.map +1 -0
- package/dist/{env-Cs8Wt8A_.mjs → env-DMqv56Bb.mjs} +3 -4
- package/dist/{env-Cs8Wt8A_.mjs.map → env-DMqv56Bb.mjs.map} +1 -1
- package/dist/error-handler-Xud_3Lah.d.mts +20 -0
- package/dist/error-handler-Xud_3Lah.d.mts.map +1 -0
- package/dist/{errors-D_CWI7Bl.d.mts → errors-uaHCeXRz.d.mts} +1 -1
- package/dist/{errors-D_CWI7Bl.d.mts.map → errors-uaHCeXRz.d.mts.map} +1 -1
- package/dist/{execution-context-Dl2CKqSo.d.mts → execution-context-DKnt61pY.d.mts} +1 -1
- package/dist/{execution-context-Dl2CKqSo.d.mts.map → execution-context-DKnt61pY.d.mts.map} +1 -1
- package/dist/helmet-CaMbjzBG.d.mts +41 -0
- package/dist/helmet-CaMbjzBG.d.mts.map +1 -0
- package/dist/http/application.d.mts +2 -293
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.d.mts +2 -27
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.d.mts +3 -251
- package/dist/http/context.mjs +2 -2
- package/dist/http/middleware/cors.d.mts +2 -47
- package/dist/http/middleware/cors.mjs +1 -1
- package/dist/http/middleware/csrf.d.mts +2 -51
- package/dist/http/middleware/csrf.mjs +2 -2
- package/dist/http/middleware/csrf.mjs.map +1 -1
- package/dist/http/middleware/error-handler.d.mts +2 -19
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/helmet.d.mts +2 -40
- package/dist/http/middleware/helmet.mjs +1 -1
- package/dist/http/middleware/rate-limit.d.mts +2 -55
- package/dist/http/middleware/rate-limit.mjs +2 -2
- package/dist/http/middleware/rate-limit.mjs.map +1 -1
- package/dist/http/middleware/request-id.d.mts +2 -9
- package/dist/http/middleware/request-id.mjs +12 -3
- package/dist/http/middleware/request-id.mjs.map +1 -1
- package/dist/http/middleware/request-logger.d.mts +2 -31
- package/dist/http/middleware/request-logger.mjs +2 -2
- package/dist/http/middleware/session.d.mts +2 -69
- package/dist/http/middleware/session.mjs +1 -1
- package/dist/http/middleware/spa.d.mts +2 -100
- package/dist/http/middleware/spa.mjs +5 -5
- package/dist/http/middleware/spa.mjs.map +1 -1
- package/dist/http/middleware/upload.d.mts +2 -78
- package/dist/http/middleware/upload.mjs +1 -1
- package/dist/http/middleware/validate.d.mts +2 -22
- package/dist/http/middleware/validate.mjs +2 -2
- package/dist/http/middleware/views.d.mts +2 -61
- package/dist/http/middleware/views.mjs +16 -15
- package/dist/http/middleware/views.mjs.map +1 -1
- package/dist/http/query/index.d.mts +1 -1
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +2 -32
- package/dist/http/router-builder.mjs +10 -14
- package/dist/http/router-builder.mjs.map +1 -1
- package/dist/{index-RNK41JPE.d.mts → index-B9cyOQAe.d.mts} +1 -1
- package/dist/{index-RNK41JPE.d.mts.map → index-B9cyOQAe.d.mts.map} +1 -1
- package/dist/{index-Cf-MGrqT.d.mts → index-D-qhXg9M.d.mts} +3 -3
- package/dist/{index-Cf-MGrqT.d.mts.map → index-D-qhXg9M.d.mts.map} +1 -1
- package/dist/{index-BQM9pJrV.d.mts → index-Yhs9sTMW.d.mts} +241 -5
- package/dist/index-Yhs9sTMW.d.mts.map +1 -0
- package/dist/index.d.mts +34 -152
- package/dist/index.mjs +50 -14
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces-B50n7dwl.d.mts +71 -0
- package/dist/{interfaces-CwcdqfNq.d.mts.map → interfaces-B50n7dwl.d.mts.map} +1 -1
- package/dist/{logger-GK8yT0BD.d.mts → logger-CLVRZf2N.d.mts} +2 -4
- package/dist/{logger-GK8yT0BD.d.mts.map → logger-CLVRZf2N.d.mts.map} +1 -1
- package/dist/{metadata-BFuoSEX6.mjs → metadata-BF1WDBOh.mjs} +2 -2
- package/dist/{metadata-BFuoSEX6.mjs.map → metadata-BF1WDBOh.mjs.map} +1 -1
- package/dist/{path-Bj3vZMUY.d.mts → path-Diviu6hv.d.mts} +1 -1
- package/dist/path-Diviu6hv.d.mts.map +1 -0
- package/dist/{plugin-3rKA0Loy.d.mts → plugin-DDjoN4XI.d.mts} +46 -8
- package/dist/plugin-DDjoN4XI.d.mts.map +1 -0
- package/dist/{query-BcYEjYyX.mjs → query-BrYRQMa5.mjs} +2 -2
- package/dist/{query-BcYEjYyX.mjs.map → query-BrYRQMa5.mjs.map} +1 -1
- package/dist/rate-limit-DUwoICtI.d.mts +56 -0
- package/dist/rate-limit-DUwoICtI.d.mts.map +1 -0
- package/dist/{reactivity-CczHu3R-.d.mts → reactivity-CfJceo4H.d.mts} +1 -1
- package/dist/{reactivity-CczHu3R-.d.mts.map → reactivity-CfJceo4H.d.mts.map} +1 -1
- package/dist/request-id-BgglvZHN.d.mts +19 -0
- package/dist/request-id-BgglvZHN.d.mts.map +1 -0
- package/dist/request-logger-CWHbAzTE.d.mts +32 -0
- package/dist/request-logger-CWHbAzTE.d.mts.map +1 -0
- package/dist/router-builder-zsX4Oq7c.d.mts +31 -0
- package/dist/router-builder-zsX4Oq7c.d.mts.map +1 -0
- package/dist/session-N0hActOO.d.mts +70 -0
- package/dist/session-N0hActOO.d.mts.map +1 -0
- package/dist/spa-CwIbdvPc.d.mts +101 -0
- package/dist/spa-CwIbdvPc.d.mts.map +1 -0
- package/dist/upload-BueOnnLw.d.mts +79 -0
- package/dist/upload-BueOnnLw.d.mts.map +1 -0
- package/dist/validate-HwAyWTwH.d.mts +23 -0
- package/dist/validate-HwAyWTwH.d.mts.map +1 -0
- package/dist/views-v05_dP1I.d.mts +181 -0
- package/dist/views-v05_dP1I.d.mts.map +1 -0
- package/package.json +6 -9
- package/dist/adapter-DLEHb0K6.d.mts +0 -151
- package/dist/adapter-DLEHb0K6.d.mts.map +0 -1
- package/dist/app-module-ERR9jhow.d.mts.map +0 -1
- package/dist/application-x8CXLOlv.mjs.map +0 -1
- package/dist/chunk-Bt-rz0Tp.mjs +0 -15
- package/dist/container-Dnk43k54.mjs.map +0 -1
- package/dist/container-fIS1uLx-.d.mts.map +0 -1
- package/dist/context-OktlOQBQ.mjs.map +0 -1
- package/dist/context-decorator-GA8-hDLe.d.mts.map +0 -1
- package/dist/core-DANnH5-e.mjs.map +0 -1
- package/dist/cron-CfsPdi7R.d.mts.map +0 -1
- package/dist/decorators-H42oPg0m.d.mts.map +0 -1
- package/dist/http/application.d.mts.map +0 -1
- package/dist/http/bootstrap.d.mts.map +0 -1
- package/dist/http/context.d.mts.map +0 -1
- package/dist/http/middleware/cors.d.mts.map +0 -1
- package/dist/http/middleware/csrf.d.mts.map +0 -1
- package/dist/http/middleware/error-handler.d.mts.map +0 -1
- package/dist/http/middleware/helmet.d.mts.map +0 -1
- package/dist/http/middleware/rate-limit.d.mts.map +0 -1
- package/dist/http/middleware/request-id.d.mts.map +0 -1
- package/dist/http/middleware/request-logger.d.mts.map +0 -1
- package/dist/http/middleware/session.d.mts.map +0 -1
- package/dist/http/middleware/spa.d.mts.map +0 -1
- package/dist/http/middleware/upload.d.mts.map +0 -1
- package/dist/http/middleware/validate.d.mts.map +0 -1
- package/dist/http/middleware/views.d.mts.map +0 -1
- package/dist/http/router-builder.d.mts.map +0 -1
- package/dist/index-BQM9pJrV.d.mts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/interfaces-CwcdqfNq.d.mts +0 -54
- package/dist/path-Bj3vZMUY.d.mts.map +0 -1
- package/dist/plugin-3rKA0Loy.d.mts.map +0 -1
|
@@ -1,79 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as
|
|
3
|
-
|
|
4
|
-
import { Options } from "multer";
|
|
5
|
-
|
|
6
|
-
//#region src/http/middleware/upload.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Resolves a list of file type identifiers to MIME type strings.
|
|
9
|
-
* Accepts short extensions (`'jpg'`, `'pdf'`) or full MIME types (`'image/jpeg'`).
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* resolveMimeTypes(['jpg', 'png', 'application/pdf'])
|
|
14
|
-
* // → ['image/jpeg', 'image/png', 'application/pdf']
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function resolveMimeTypes(types: string[]): string[];
|
|
18
|
-
/**
|
|
19
|
-
* Upload options for the middleware.
|
|
20
|
-
* Extends BaseUploadOptions from core (shared with @FileUpload decorator)
|
|
21
|
-
* and adds Multer-specific storage options.
|
|
22
|
-
*/
|
|
23
|
-
interface UploadOptions extends BaseUploadOptions {
|
|
24
|
-
/** Multer storage config (default: memory storage) */
|
|
25
|
-
storage?: Options['storage'];
|
|
26
|
-
/** Multer dest for disk storage shorthand */
|
|
27
|
-
dest?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Single file upload middleware. Attaches the file to `req.file`.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* @Post('/avatar')
|
|
35
|
-
* @Middleware(upload.single('avatar', { maxSize: 2 * 1024 * 1024, allowedTypes: ['jpg', 'png'] }))
|
|
36
|
-
* async uploadAvatar(ctx: RequestContext) {
|
|
37
|
-
* ctx.json({ filename: ctx.file.originalname })
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
declare function single(fieldName: string, options?: UploadOptions): RequestHandler;
|
|
42
|
-
/**
|
|
43
|
-
* Multiple file upload middleware. Attaches files to `req.files`.
|
|
44
|
-
*/
|
|
45
|
-
declare function array(fieldName: string, maxCount?: number, options?: UploadOptions): RequestHandler;
|
|
46
|
-
/**
|
|
47
|
-
* No file upload — just parse multipart form data without file fields.
|
|
48
|
-
*/
|
|
49
|
-
declare function none(options?: UploadOptions): RequestHandler;
|
|
50
|
-
/**
|
|
51
|
-
* Removes temporary files from disk after the response is sent.
|
|
52
|
-
* Attach this as Express middleware after the upload middleware.
|
|
53
|
-
* Works with both `req.file` (single) and `req.files` (array).
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* @Post('/process')
|
|
58
|
-
* @Middleware(upload.single('document', { dest: '/tmp/uploads' }), cleanupFiles())
|
|
59
|
-
* async processDocument(ctx: RequestContext) {
|
|
60
|
-
* ctx.json({ ok: true })
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
declare function cleanupFiles(): (req: Request, res: Response, next: NextFunction) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Build upload middleware from a @FileUpload decorator config.
|
|
67
|
-
* Used internally by the router builder when it detects FILE_UPLOAD metadata.
|
|
68
|
-
* Accepts the same FileUploadConfig interface used by the @FileUpload decorator.
|
|
69
|
-
*/
|
|
70
|
-
declare function buildUploadMiddleware(config: FileUploadConfig): RequestHandler;
|
|
71
|
-
/** Upload middleware factory with `.single()`, `.array()`, `.none()` methods */
|
|
72
|
-
declare const upload: {
|
|
73
|
-
single: typeof single;
|
|
74
|
-
array: typeof array;
|
|
75
|
-
none: typeof none;
|
|
76
|
-
};
|
|
77
|
-
//#endregion
|
|
78
|
-
export { UploadOptions, buildUploadMiddleware, cleanupFiles, resolveMimeTypes, upload };
|
|
79
|
-
//# sourceMappingURL=upload.d.mts.map
|
|
2
|
+
import { a as upload, i as resolveMimeTypes, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "../../upload-BueOnnLw.mjs";
|
|
3
|
+
export { UploadOptions, buildUploadMiddleware, cleanupFiles, resolveMimeTypes, upload };
|
|
@@ -1,23 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/http/middleware/validate.d.ts
|
|
5
|
-
interface ValidationSchema {
|
|
6
|
-
body?: any;
|
|
7
|
-
query?: any;
|
|
8
|
-
params?: any;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Express middleware that validates request body/query/params against schemas.
|
|
12
|
-
* Works with any validation library that exposes `.safeParse(data)` returning
|
|
13
|
-
* `{ success: true, data }` or `{ success: false, error: { issues } }`.
|
|
14
|
-
*
|
|
15
|
-
* Validation failures are forwarded via `next(err)` as an `HttpException`, so
|
|
16
|
-
* they flow through the application's global error handler (`onError`) and
|
|
17
|
-
* produce a uniform response envelope. Apps that keep the built-in handler
|
|
18
|
-
* continue to see the same `{ message, errors: [{ field, message }] }` body.
|
|
19
|
-
*/
|
|
20
|
-
declare function validate(schema: ValidationSchema): (req: Request, _res: Response, next: NextFunction) => void;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { ValidationSchema, validate };
|
|
23
|
-
//# sourceMappingURL=validate.d.mts.map
|
|
2
|
+
import { n as validate, t as ValidationSchema } from "../../validate-HwAyWTwH.mjs";
|
|
3
|
+
export { ValidationSchema, validate };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs
|
|
2
|
+
* @forinda/kickjs v4.1.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
import { HttpException, HttpStatus } from "../../core/errors.mjs";
|
|
12
|
-
import "../../core-
|
|
12
|
+
import "../../core-Dj3iVQ3t.mjs";
|
|
13
13
|
//#region src/http/middleware/validate.ts
|
|
14
14
|
function toValidationException(error, message, useFirstIssueMessage) {
|
|
15
15
|
const issues = error.issues || [];
|
|
@@ -1,62 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface ViewAdapterOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Template engine — pass the engine module or a render function.
|
|
7
|
-
* Supported engines: ejs, pug, handlebars, nunjucks, or any
|
|
8
|
-
* Express-compatible engine with a __express property.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import ejs from 'ejs'
|
|
13
|
-
* new ViewAdapter({ engine: ejs, ext: 'ejs' })
|
|
14
|
-
*
|
|
15
|
-
* import pug from 'pug'
|
|
16
|
-
* new ViewAdapter({ engine: pug, ext: 'pug' })
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
engine: any;
|
|
20
|
-
/** File extension for templates (e.g., 'ejs', 'pug', 'hbs') */
|
|
21
|
-
ext: string;
|
|
22
|
-
/** Directory containing template files (default: 'src/views') */
|
|
23
|
-
viewsDir?: string;
|
|
24
|
-
/** Default layout template (optional — depends on engine) */
|
|
25
|
-
layout?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* View/template adapter — pluggable template engine support for KickJS.
|
|
29
|
-
*
|
|
30
|
-
* Registers an Express view engine and sets the views directory.
|
|
31
|
-
* Use `ctx.render()` in controllers to render templates.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* import ejs from 'ejs'
|
|
36
|
-
* import { ViewAdapter } from '@forinda/kickjs-http/views'
|
|
37
|
-
*
|
|
38
|
-
* bootstrap({
|
|
39
|
-
* modules,
|
|
40
|
-
* adapters: [
|
|
41
|
-
* new ViewAdapter({ engine: ejs, ext: 'ejs', viewsDir: 'src/views' }),
|
|
42
|
-
* ],
|
|
43
|
-
* })
|
|
44
|
-
*
|
|
45
|
-
* // In a controller:
|
|
46
|
-
* @Get('/dashboard')
|
|
47
|
-
* async dashboard(ctx: RequestContext) {
|
|
48
|
-
* ctx.render('dashboard', { user: currentUser, title: 'Dashboard' })
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
declare class ViewAdapter implements AppAdapter {
|
|
53
|
-
private options;
|
|
54
|
-
name: string;
|
|
55
|
-
constructor(options: ViewAdapterOptions);
|
|
56
|
-
beforeMount({
|
|
57
|
-
app
|
|
58
|
-
}: AdapterContext): void;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { ViewAdapter, ViewAdapterOptions };
|
|
62
|
-
//# sourceMappingURL=views.d.mts.map
|
|
2
|
+
import { n as ViewAdapterOptions, t as ViewAdapter } from "../../views-v05_dP1I.mjs";
|
|
3
|
+
export { ViewAdapter, ViewAdapterOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs
|
|
2
|
+
* @forinda/kickjs v4.1.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
import { Logger } from "../../core/logger.mjs";
|
|
12
|
-
import "../../core-
|
|
12
|
+
import { n as defineAdapter } from "../../core-Dj3iVQ3t.mjs";
|
|
13
13
|
import { resolve } from "node:path";
|
|
14
14
|
//#region src/http/middleware/views.ts
|
|
15
15
|
const log = Logger.for("ViewEngine");
|
|
@@ -19,15 +19,19 @@ const log = Logger.for("ViewEngine");
|
|
|
19
19
|
* Registers an Express view engine and sets the views directory.
|
|
20
20
|
* Use `ctx.render()` in controllers to render templates.
|
|
21
21
|
*
|
|
22
|
+
* Migrated to the `defineAdapter()` factory in v4 — call without `new`.
|
|
23
|
+
* The pre-v4 `new ViewAdapter({...})` form is gone; see
|
|
24
|
+
* `docs/guide/migration-v3-to-v4.md` for the rename.
|
|
25
|
+
*
|
|
22
26
|
* @example
|
|
23
27
|
* ```ts
|
|
24
28
|
* import ejs from 'ejs'
|
|
25
|
-
* import { ViewAdapter } from '@forinda/kickjs
|
|
29
|
+
* import { ViewAdapter } from '@forinda/kickjs'
|
|
26
30
|
*
|
|
27
31
|
* bootstrap({
|
|
28
32
|
* modules,
|
|
29
33
|
* adapters: [
|
|
30
|
-
*
|
|
34
|
+
* ViewAdapter({ engine: ejs, ext: 'ejs', viewsDir: 'src/views' }),
|
|
31
35
|
* ],
|
|
32
36
|
* })
|
|
33
37
|
*
|
|
@@ -38,16 +42,13 @@ const log = Logger.for("ViewEngine");
|
|
|
38
42
|
* }
|
|
39
43
|
* ```
|
|
40
44
|
*/
|
|
41
|
-
|
|
42
|
-
name
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
beforeMount({ app }) {
|
|
47
|
-
const { engine, ext, viewsDir = "src/views" } = this.options;
|
|
45
|
+
const ViewAdapter = defineAdapter({
|
|
46
|
+
name: "ViewAdapter",
|
|
47
|
+
build: (options) => ({ beforeMount({ app }) {
|
|
48
|
+
const { engine, ext, viewsDir = "src/views" } = options;
|
|
48
49
|
if (engine.__express) app.engine(ext, engine.__express);
|
|
49
|
-
else if (typeof engine.renderFile === "function") app.engine(ext, (path,
|
|
50
|
-
engine.renderFile(path,
|
|
50
|
+
else if (typeof engine.renderFile === "function") app.engine(ext, (path, opts, callback) => {
|
|
51
|
+
engine.renderFile(path, opts, callback);
|
|
51
52
|
});
|
|
52
53
|
else if (typeof engine === "function") app.engine(ext, engine);
|
|
53
54
|
else {
|
|
@@ -57,8 +58,8 @@ var ViewAdapter = class {
|
|
|
57
58
|
app.set("view engine", ext);
|
|
58
59
|
app.set("views", resolve(viewsDir));
|
|
59
60
|
log.debug(`View engine: ${ext} (${resolve(viewsDir)})`);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
61
|
+
} })
|
|
62
|
+
});
|
|
62
63
|
//#endregion
|
|
63
64
|
export { ViewAdapter };
|
|
64
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.mjs","names":[],"sources":["../../../src/http/middleware/views.ts"],"sourcesContent":["import { resolve } from 'node:path'\nimport { Logger,
|
|
1
|
+
{"version":3,"file":"views.mjs","names":[],"sources":["../../../src/http/middleware/views.ts"],"sourcesContent":["import { resolve } from 'node:path'\nimport { Logger, defineAdapter } from '../../core'\n\nconst log = Logger.for('ViewEngine')\n\nexport interface ViewAdapterOptions {\n /**\n * Template engine — pass the engine module or a render function.\n * Supported engines: ejs, pug, handlebars, nunjucks, or any\n * Express-compatible engine with a __express property.\n *\n * @example\n * ```ts\n * import ejs from 'ejs'\n * ViewAdapter({ engine: ejs, ext: 'ejs' })\n *\n * import pug from 'pug'\n * ViewAdapter({ engine: pug, ext: 'pug' })\n * ```\n */\n engine: any\n\n /** File extension for templates (e.g., 'ejs', 'pug', 'hbs') */\n ext: string\n\n /** Directory containing template files (default: 'src/views') */\n viewsDir?: string\n\n /** Default layout template (optional — depends on engine) */\n layout?: string\n}\n\n/**\n * View/template adapter — pluggable template engine support for KickJS.\n *\n * Registers an Express view engine and sets the views directory.\n * Use `ctx.render()` in controllers to render templates.\n *\n * Migrated to the `defineAdapter()` factory in v4 — call without `new`.\n * The pre-v4 `new ViewAdapter({...})` form is gone; see\n * `docs/guide/migration-v3-to-v4.md` for the rename.\n *\n * @example\n * ```ts\n * import ejs from 'ejs'\n * import { ViewAdapter } from '@forinda/kickjs'\n *\n * bootstrap({\n * modules,\n * adapters: [\n * ViewAdapter({ engine: ejs, ext: 'ejs', viewsDir: 'src/views' }),\n * ],\n * })\n *\n * // In a controller:\n * @Get('/dashboard')\n * async dashboard(ctx: RequestContext) {\n * ctx.render('dashboard', { user: currentUser, title: 'Dashboard' })\n * }\n * ```\n */\nexport const ViewAdapter = defineAdapter<ViewAdapterOptions>({\n name: 'ViewAdapter',\n build: (options) => ({\n beforeMount({ app }) {\n const { engine, ext, viewsDir = 'src/views' } = options\n\n // Register the engine. Three resolution paths cover every\n // mainstream template engine + a fall-through for custom ones.\n if (engine.__express) {\n // EJS, Pug — have __express method\n app.engine(ext, engine.__express)\n } else if (typeof engine.renderFile === 'function') {\n // Engines with renderFile (nunjucks-style)\n app.engine(\n ext,\n (path: string, opts: any, callback: (err: Error | null, html?: string) => void) => {\n engine.renderFile(path, opts, callback)\n },\n )\n } else if (typeof engine === 'function') {\n // Custom render function: (path, options, callback) => void\n app.engine(ext, engine)\n } else {\n log.warn(`Engine for .${ext} does not have __express or renderFile. Trying as-is.`)\n app.engine(ext, engine)\n }\n\n app.set('view engine', ext)\n app.set('views', resolve(viewsDir))\n\n log.debug(`View engine: ${ext} (${resolve(viewsDir)})`)\n },\n }),\n})\n"],"mappings":";;;;;;;;;;;;;;AAGA,MAAM,MAAM,OAAO,IAAI,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DpC,MAAa,cAAc,cAAkC;CAC3D,MAAM;CACN,QAAQ,aAAa,EACnB,YAAY,EAAE,OAAO;EACnB,MAAM,EAAE,QAAQ,KAAK,WAAW,gBAAgB;AAIhD,MAAI,OAAO,UAET,KAAI,OAAO,KAAK,OAAO,UAAU;WACxB,OAAO,OAAO,eAAe,WAEtC,KAAI,OACF,MACC,MAAc,MAAW,aAAyD;AACjF,UAAO,WAAW,MAAM,MAAM,SAAS;IAE1C;WACQ,OAAO,WAAW,WAE3B,KAAI,OAAO,KAAK,OAAO;OAClB;AACL,OAAI,KAAK,eAAe,IAAI,uDAAuD;AACnF,OAAI,OAAO,KAAK,OAAO;;AAGzB,MAAI,IAAI,eAAe,IAAI;AAC3B,MAAI,IAAI,SAAS,QAAQ,SAAS,CAAC;AAEnC,MAAI,MAAM,gBAAgB,IAAI,IAAI,QAAQ,SAAS,CAAC,GAAG;IAE1D;CACF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { _ as SortItem, a as parseSearchQuery, c as FILTER_OPERATORS, d as FilterOperator, f as PaginatedResponse, g as QueryFieldConfig, h as QueryBuilderAdapter, i as parseQuery, l as FieldsOf, m as ParsedQuery, n as parseFilters, o as parseSort, p as PaginationParams, r as parsePagination, s as ColumnQueryFieldConfig, t as buildQueryParams, u as FilterItem, v as StringQueryFieldConfig, y as TypedParsedQuery } from "../../index-
|
|
2
|
+
import { _ as SortItem, a as parseSearchQuery, c as FILTER_OPERATORS, d as FilterOperator, f as PaginatedResponse, g as QueryFieldConfig, h as QueryBuilderAdapter, i as parseQuery, l as FieldsOf, m as ParsedQuery, n as parseFilters, o as parseSort, p as PaginationParams, r as parsePagination, s as ColumnQueryFieldConfig, t as buildQueryParams, u as FilterItem, v as StringQueryFieldConfig, y as TypedParsedQuery } from "../../index-B9cyOQAe.mjs";
|
|
3
3
|
export { ColumnQueryFieldConfig, FILTER_OPERATORS, FieldsOf, FilterItem, FilterOperator, PaginatedResponse, PaginationParams, ParsedQuery, QueryBuilderAdapter, QueryFieldConfig, SortItem, StringQueryFieldConfig, TypedParsedQuery, buildQueryParams, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs
|
|
2
|
+
* @forinda/kickjs v4.1.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { a as parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "../../query-
|
|
11
|
+
import { a as parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "../../query-BrYRQMa5.mjs";
|
|
12
12
|
export { FILTER_OPERATORS, buildQueryParams, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort };
|
|
@@ -1,33 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#region src/http/router-builder.d.ts
|
|
6
|
-
/** Get the controller path set by @Controller('/path') */
|
|
7
|
-
declare function getControllerPath(controllerClass: any): string;
|
|
8
|
-
/** @internal — set by Application.setup() before each `mod.routes()` call. */
|
|
9
|
-
declare function _setExternalContributorSources(sources: readonly SourcedRegistration[]): void;
|
|
10
|
-
interface BuildRoutesOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Extra contributors to merge into the per-route pipeline at their declared
|
|
13
|
-
* precedence levels. Pass explicitly when calling buildRoutes outside the
|
|
14
|
-
* Application route-mount loop (typically in tests). When omitted, falls
|
|
15
|
-
* back to the slot set by Application.setup().
|
|
16
|
-
*/
|
|
17
|
-
externalSources?: readonly SourcedRegistration[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Build an Express Router from a controller class decorated with @Get, @Post, etc.
|
|
21
|
-
* Resolves the controller from the DI container, wraps handlers in RequestContext,
|
|
22
|
-
* and applies class-level and method-level middleware.
|
|
23
|
-
*
|
|
24
|
-
* Routes are registered using only the method-level decorator paths (e.g. @Get('/me') → '/me').
|
|
25
|
-
* The @Controller path is NOT baked into the router — it serves as metadata only
|
|
26
|
-
* (used by Swagger and other adapters for introspection).
|
|
27
|
-
* The module's routes().path is the single source of truth for the mount prefix,
|
|
28
|
-
* which avoids path doubling when both the module and controller specify the same path.
|
|
29
|
-
*/
|
|
30
|
-
declare function buildRoutes(controllerClass: any, options?: BuildRoutesOptions): Router;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { BuildRoutesOptions, _setExternalContributorSources, buildRoutes, getControllerPath };
|
|
33
|
-
//# sourceMappingURL=router-builder.d.mts.map
|
|
2
|
+
import { n as _setExternalContributorSources, r as buildRoutes, t as BuildRoutesOptions } from "../router-builder-zsX4Oq7c.mjs";
|
|
3
|
+
export { BuildRoutesOptions, _setExternalContributorSources, buildRoutes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs
|
|
2
|
+
* @forinda/kickjs v4.1.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,19 +8,15 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
+
import { t as Container } from "../container-BYuMSnqW.mjs";
|
|
11
12
|
import { METADATA } from "../core/interfaces.mjs";
|
|
12
|
-
import { a as getMethodMeta, o as getMethodMetaOrUndefined, t as getClassMeta } from "../metadata-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as RequestContext } from "../context-OktlOQBQ.mjs";
|
|
13
|
+
import { a as getMethodMeta, o as getMethodMetaOrUndefined, t as getClassMeta } from "../metadata-BF1WDBOh.mjs";
|
|
14
|
+
import { c as runContributors, l as buildPipeline } from "../core-Dj3iVQ3t.mjs";
|
|
15
|
+
import { t as RequestContext } from "../context-CyQbqSz-.mjs";
|
|
16
16
|
import { validate } from "./middleware/validate.mjs";
|
|
17
17
|
import { buildUploadMiddleware } from "./middleware/upload.mjs";
|
|
18
18
|
import { Router } from "express";
|
|
19
19
|
//#region src/http/router-builder.ts
|
|
20
|
-
/** Get the controller path set by @Controller('/path') */
|
|
21
|
-
function getControllerPath(controllerClass) {
|
|
22
|
-
return getClassMeta(METADATA.CONTROLLER_PATH, controllerClass, "/");
|
|
23
|
-
}
|
|
24
20
|
/**
|
|
25
21
|
* Per-module SourcedRegistration[] threaded through the route-mount loop by
|
|
26
22
|
* Application.setup(). Carries module + adapter + global contributors so
|
|
@@ -75,15 +71,15 @@ function buildRoutes(controllerClass, options = {}) {
|
|
|
75
71
|
const methodContributors = getMethodMeta(METADATA.METHOD_CONTRIBUTORS, controllerClass, route.handlerName, []);
|
|
76
72
|
if (classContributors.length > 0 || methodContributors.length > 0 || externalSources.length > 0) {
|
|
77
73
|
const pipeline = buildPipeline([
|
|
78
|
-
...methodContributors.map((registration) => ({
|
|
74
|
+
...methodContributors.map((registration, i) => ({
|
|
79
75
|
source: "method",
|
|
80
76
|
registration,
|
|
81
|
-
label: `${controllerClass.name}.${String(route.handlerName)}`
|
|
77
|
+
label: `${controllerClass.name}.${String(route.handlerName)}#${i}(${registration.key})`
|
|
82
78
|
})),
|
|
83
|
-
...classContributors.map((registration) => ({
|
|
79
|
+
...classContributors.map((registration, i) => ({
|
|
84
80
|
source: "class",
|
|
85
81
|
registration,
|
|
86
|
-
label: `${controllerClass.name}.@class`
|
|
82
|
+
label: `${controllerClass.name}.@class#${i}(${registration.key})`
|
|
87
83
|
})),
|
|
88
84
|
...externalSources
|
|
89
85
|
], { route: `${route.method.toUpperCase()} ${fullPath}` });
|
|
@@ -114,6 +110,6 @@ function buildRoutes(controllerClass, options = {}) {
|
|
|
114
110
|
return router;
|
|
115
111
|
}
|
|
116
112
|
//#endregion
|
|
117
|
-
export { _setExternalContributorSources, buildRoutes
|
|
113
|
+
export { _setExternalContributorSources, buildRoutes };
|
|
118
114
|
|
|
119
115
|
//# sourceMappingURL=router-builder.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-builder.mjs","names":[],"sources":["../../src/http/router-builder.ts"],"sourcesContent":["import { Router, type Request, type Response, type NextFunction } from 'express'\nimport {\n buildPipeline,\n Container,\n METADATA,\n runContributors,\n type ContributorRegistration,\n type FileUploadConfig,\n type MiddlewareHandler,\n type RouteDefinition,\n type SourcedRegistration,\n} from '../core'\nimport { getClassMeta, getMethodMeta, getMethodMetaOrUndefined } from '../core/metadata'\nimport { RequestContext } from './context'\nimport { validate } from './middleware/validate'\nimport { buildUploadMiddleware } from './middleware/upload'\n\n
|
|
1
|
+
{"version":3,"file":"router-builder.mjs","names":[],"sources":["../../src/http/router-builder.ts"],"sourcesContent":["import { Router, type Request, type Response, type NextFunction } from 'express'\nimport {\n buildPipeline,\n Container,\n METADATA,\n runContributors,\n type ContributorRegistration,\n type FileUploadConfig,\n type MiddlewareHandler,\n type RouteDefinition,\n type SourcedRegistration,\n} from '../core'\nimport { getClassMeta, getMethodMeta, getMethodMetaOrUndefined } from '../core/metadata'\nimport { RequestContext } from './context'\nimport { validate } from './middleware/validate'\nimport { buildUploadMiddleware } from './middleware/upload'\n\n/**\n * Per-module SourcedRegistration[] threaded through the route-mount loop by\n * Application.setup(). Carries module + adapter + global contributors so\n * buildRoutes() can merge them with class + method ones into a single pipeline.\n *\n * Module setup is sequential, so this slot is race-free. Cleared in a finally\n * block after each module mounts. Outside of Application setup the slot is\n * empty — direct buildRoutes() callers (mostly tests) see only class + method\n * contributors unless they pass `externalSources` explicitly.\n *\n * Same idiom as `Container._requestStoreProvider` and `Logger._contextProvider`:\n * an internal escape hatch for cross-module wiring without inversion-of-control\n * gymnastics.\n *\n * @internal\n */\nlet _externalContributorSources: readonly SourcedRegistration[] = []\n\n/** @internal — set by Application.setup() before each `mod.routes()` call. */\nexport function _setExternalContributorSources(sources: readonly SourcedRegistration[]): void {\n _externalContributorSources = sources\n}\n\nexport interface BuildRoutesOptions {\n /**\n * Extra contributors to merge into the per-route pipeline at their declared\n * precedence levels. Pass explicitly when calling buildRoutes outside the\n * Application route-mount loop (typically in tests). When omitted, falls\n * back to the slot set by Application.setup().\n */\n externalSources?: readonly SourcedRegistration[]\n}\n\n/**\n * Build an Express Router from a controller class decorated with @Get, @Post, etc.\n * Resolves the controller from the DI container, wraps handlers in RequestContext,\n * and applies class-level and method-level middleware.\n *\n * Routes are registered using only the method-level decorator paths (e.g. @Get('/me') → '/me').\n * The @Controller path is NOT baked into the router — it serves as metadata only\n * (used by Swagger and other adapters for introspection).\n * The module's routes().path is the single source of truth for the mount prefix,\n * which avoids path doubling when both the module and controller specify the same path.\n */\nexport function buildRoutes(controllerClass: any, options: BuildRoutesOptions = {}): Router {\n const router = Router()\n const container = Container.getInstance()\n const externalSources = options.externalSources ?? _externalContributorSources\n const routes: RouteDefinition[] = getClassMeta<RouteDefinition[]>(\n METADATA.ROUTES,\n controllerClass,\n [],\n )\n\n // Class-level middleware\n const classMiddlewares: MiddlewareHandler[] = getClassMeta<MiddlewareHandler[]>(\n METADATA.CLASS_MIDDLEWARES,\n controllerClass,\n [],\n )\n\n // Class-level Context Contributors (#107) — applied to every method on the\n // controller. Method-level contributors are added per-route below.\n const classContributors: ContributorRegistration[] = getClassMeta<ContributorRegistration[]>(\n METADATA.CLASS_CONTRIBUTORS,\n controllerClass,\n [],\n )\n\n for (const route of routes) {\n const method = route.method.toLowerCase() as 'get' | 'post' | 'put' | 'delete' | 'patch'\n const fullPath = route.path || '/'\n\n // Method-level middleware\n const methodMiddlewares: MiddlewareHandler[] = getMethodMeta<MiddlewareHandler[]>(\n METADATA.METHOD_MIDDLEWARES,\n controllerClass,\n route.handlerName,\n [],\n )\n\n // Build handler chain\n const handlers: any[] = []\n\n // Validation middleware (shared with standalone validate() export)\n if (route.validation) {\n handlers.push(validate(route.validation))\n }\n\n // @FileUpload decorator — auto-attach upload middleware from metadata\n const fileUploadConfig = getMethodMetaOrUndefined<FileUploadConfig>(\n METADATA.FILE_UPLOAD,\n controllerClass,\n route.handlerName,\n )\n if (fileUploadConfig) {\n handlers.push(buildUploadMiddleware(fileUploadConfig))\n }\n\n // Class + method middleware (wrapped as Express middleware with error catching)\n for (const mw of [...classMiddlewares, ...methodMiddlewares]) {\n handlers.push((req: Request, res: Response, next: NextFunction) => {\n const ctx = new RequestContext(req, res, next)\n Promise.resolve(mw(ctx, next)).catch(next)\n })\n }\n\n // Context Contributor pipeline (#107) — class + method contributors,\n // built once at mount time so cycle/missing-dep failures abort boot.\n const methodContributors: ContributorRegistration[] = getMethodMeta<ContributorRegistration[]>(\n METADATA.METHOD_CONTRIBUTORS,\n controllerClass,\n route.handlerName,\n [],\n )\n\n if (\n classContributors.length > 0 ||\n methodContributors.length > 0 ||\n externalSources.length > 0\n ) {\n // Labels are surfaced in DuplicateContributorError messages — include\n // the registration's key + the original index so a same-key collision\n // at one precedence level points at the conflicting decorator slot,\n // not just the host method/class.\n const sources: SourcedRegistration[] = [\n ...methodContributors.map(\n (registration, i): SourcedRegistration => ({\n source: 'method',\n registration,\n label: `${controllerClass.name}.${String(route.handlerName)}#${i}(${registration.key})`,\n }),\n ),\n ...classContributors.map(\n (registration, i): SourcedRegistration => ({\n source: 'class',\n registration,\n label: `${controllerClass.name}.@class#${i}(${registration.key})`,\n }),\n ),\n ...externalSources,\n ]\n const pipeline = buildPipeline(sources, {\n route: `${route.method.toUpperCase()} ${fullPath}`,\n })\n\n handlers.push(async (req: Request, res: Response, next: NextFunction) => {\n const ctx = new RequestContext(req, res, next)\n try {\n await runContributors({ pipeline, ctx, container })\n next()\n } catch (err) {\n next(err)\n }\n })\n }\n\n // Main handler — resolve controller per-request to respect DI scoping\n handlers.push(async (req: Request, res: Response, next: NextFunction) => {\n const ctx = new RequestContext(req, res, next)\n try {\n const controller = container.resolve(controllerClass)\n await controller[route.handlerName](ctx)\n } catch (err: any) {\n next(err)\n }\n })\n ;(router as any)[method](fullPath, ...handlers)\n }\n\n return router\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAI,8BAA8D,EAAE;;AAGpE,SAAgB,+BAA+B,SAA+C;AAC5F,+BAA8B;;;;;;;;;;;;;AAwBhC,SAAgB,YAAY,iBAAsB,UAA8B,EAAE,EAAU;CAC1F,MAAM,SAAS,QAAQ;CACvB,MAAM,YAAY,UAAU,aAAa;CACzC,MAAM,kBAAkB,QAAQ,mBAAmB;CACnD,MAAM,SAA4B,aAChC,SAAS,QACT,iBACA,EAAE,CACH;CAGD,MAAM,mBAAwC,aAC5C,SAAS,mBACT,iBACA,EAAE,CACH;CAID,MAAM,oBAA+C,aACnD,SAAS,oBACT,iBACA,EAAE,CACH;AAED,MAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,SAAS,MAAM,OAAO,aAAa;EACzC,MAAM,WAAW,MAAM,QAAQ;EAG/B,MAAM,oBAAyC,cAC7C,SAAS,oBACT,iBACA,MAAM,aACN,EAAE,CACH;EAGD,MAAM,WAAkB,EAAE;AAG1B,MAAI,MAAM,WACR,UAAS,KAAK,SAAS,MAAM,WAAW,CAAC;EAI3C,MAAM,mBAAmB,yBACvB,SAAS,aACT,iBACA,MAAM,YACP;AACD,MAAI,iBACF,UAAS,KAAK,sBAAsB,iBAAiB,CAAC;AAIxD,OAAK,MAAM,MAAM,CAAC,GAAG,kBAAkB,GAAG,kBAAkB,CAC1D,UAAS,MAAM,KAAc,KAAe,SAAuB;GACjE,MAAM,MAAM,IAAI,eAAe,KAAK,KAAK,KAAK;AAC9C,WAAQ,QAAQ,GAAG,KAAK,KAAK,CAAC,CAAC,MAAM,KAAK;IAC1C;EAKJ,MAAM,qBAAgD,cACpD,SAAS,qBACT,iBACA,MAAM,aACN,EAAE,CACH;AAED,MACE,kBAAkB,SAAS,KAC3B,mBAAmB,SAAS,KAC5B,gBAAgB,SAAS,GACzB;GAsBA,MAAM,WAAW,cAjBsB;IACrC,GAAG,mBAAmB,KACnB,cAAc,OAA4B;KACzC,QAAQ;KACR;KACA,OAAO,GAAG,gBAAgB,KAAK,GAAG,OAAO,MAAM,YAAY,CAAC,GAAG,EAAE,GAAG,aAAa,IAAI;KACtF,EACF;IACD,GAAG,kBAAkB,KAClB,cAAc,OAA4B;KACzC,QAAQ;KACR;KACA,OAAO,GAAG,gBAAgB,KAAK,UAAU,EAAE,GAAG,aAAa,IAAI;KAChE,EACF;IACD,GAAG;IACJ,EACuC,EACtC,OAAO,GAAG,MAAM,OAAO,aAAa,CAAC,GAAG,YACzC,CAAC;AAEF,YAAS,KAAK,OAAO,KAAc,KAAe,SAAuB;IACvE,MAAM,MAAM,IAAI,eAAe,KAAK,KAAK,KAAK;AAC9C,QAAI;AACF,WAAM,gBAAgB;MAAE;MAAU;MAAK;MAAW,CAAC;AACnD,WAAM;aACC,KAAK;AACZ,UAAK,IAAI;;KAEX;;AAIJ,WAAS,KAAK,OAAO,KAAc,KAAe,SAAuB;GACvE,MAAM,MAAM,IAAI,eAAe,KAAK,KAAK,KAAK;AAC9C,OAAI;AAEF,UADmB,UAAU,QAAQ,gBAAgB,CACpC,MAAM,aAAa,IAAI;YACjC,KAAU;AACjB,SAAK,IAAI;;IAEX;AACA,SAAe,QAAQ,UAAU,GAAG,SAAS;;AAGjD,QAAO"}
|
|
@@ -181,4 +181,4 @@ declare function parseQuery<TConfig extends QueryFieldConfig | undefined = undef
|
|
|
181
181
|
declare function buildQueryParams(parsed: Partial<ParsedQuery>): Record<string, string | string[] | number>;
|
|
182
182
|
//#endregion
|
|
183
183
|
export { SortItem as _, parseSearchQuery as a, FILTER_OPERATORS as c, FilterOperator as d, PaginatedResponse as f, QueryFieldConfig as g, QueryBuilderAdapter as h, parseQuery as i, FieldsOf as l, ParsedQuery as m, parseFilters as n, parseSort as o, PaginationParams as p, parsePagination as r, ColumnQueryFieldConfig as s, buildQueryParams as t, FilterItem as u, StringQueryFieldConfig as v, TypedParsedQuery as y };
|
|
184
|
-
//# sourceMappingURL=index-
|
|
184
|
+
//# sourceMappingURL=index-B9cyOQAe.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-B9cyOQAe.d.mts","names":[],"sources":["../src/http/query/types.ts","../src/http/query/parse-query.ts"],"mappings":";;;KACY,cAAA;AAAA,cAaC,gBAAA,EAAgB,GAAA;AAAA,UAcZ,UAAA;EACf,KAAA;EACA,QAAA,EAAU,cAAA;EACV,KAAA;AAAA;AAAA,UAGe,QAAA;EACf,KAAA;EACA,SAAA;AAAA;AAAA,UAGe,gBAAA;EACf,IAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;AARF;UAgBiB,WAAA;EACf,OAAA,EAAS,UAAA;EACT,IAAA,EAAM,QAAA;EACN,UAAA,EAAY,gBAAA;EACZ,MAAA;AAAA;;;;;;;;AAJF;KAeY,QAAA,iBACM,gBAAA,oEAEd,OAAA,0BAAiC,CAAA,4BACjC,CAAA,kBACE,CAAA,YAEF,OAAA;EAAkB,OAAA;AAAA,IAChB,CAAA,8BACQ,CAAA;;;;;;;;;;;;AATd;;;;;;UA8BiB,gBAAA,iBACC,gBAAA,sBACR,WAAA;EACR,OAAA,EAAS,KAAA,CAAM,UAAA;IAAe,KAAA,EAAO,QAAA,CAAS,OAAA;EAAA;EAC9C,IAAA,EAAM,KAAA,CAAM,QAAA;IAAa,KAAA,EAAO,QAAA,CAAS,OAAA;EAAA;AAAA;;;;;;;;;;;KAa/B,gBAAA,GAAmB,sBAAA,GAAyB,sBAAA;AAAA,UAEvC,sBAAA;EACf,UAAA;EACA,QAAA;EACA,UAAA;AAAA;;;;;UAOe,sBAAA;EACf,OAAA,EAAS,MAAA;EACT,QAAA,GAAW,MAAA;EACX,aAAA;EAAA,CACC,GAAA;AAAA;;UAIc,iBAAA;EACf,IAAA,EAAM,CAAA;EACN,IAAA;IACE,IAAA;IACA,KAAA;IACA,KAAA;IACA,UAAA;IACA,OAAA;IACA,OAAA;EAAA;AAAA;;;;;;;;AA5BJ;;;;;AAEA;;;;;;;;;AAUA;;UA2CiB,mBAAA;EAzCE;EAAA,SA2CR,IAAA;EA5CA;;;;;EAmDT,KAAA,CAAM,MAAA,EAAQ,WAAA,EAAa,MAAA,EAAQ,OAAA,GAAU,OAAA;AAAA;;;AA/K/C;AAAA,iBCmBgB,YAAA,CACd,WAAA,iCACA,aAAA,cACC,UAAA;;iBA8Ba,SAAA,CACd,SAAA,iCACA,aAAA,cACC,QAAA;;iBA0Ba,eAAA,CAAgB,MAAA;EAC9B,IAAA;EACA,KAAA;AAAA,IACE,gBAAA;;iBAkBY,gBAAA,CAAiB,CAAA;;;;;;;;;;ADrEjC;;;;;AAKA;;;;;;;;;AAWA;;;;;iBC+GgB,UAAA,iBAA2B,gBAAA,yBAAA,CACzC,KAAA,EAAO,MAAA,eACP,WAAA,GAAc,OAAA,GACb,gBAAA,CAAiB,OAAA;;iBAaJ,gBAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,WAAA,IACf,MAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { p as EnvKey } from "./decorators-BMvaLliz.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/config/env.d.ts
|
|
@@ -228,7 +228,7 @@ interface TypedConfigService<TEnv extends Record<string, any>> {
|
|
|
228
228
|
* export type AppConfigService = InstanceType<typeof AppConfigService>
|
|
229
229
|
*
|
|
230
230
|
* // In a controller or service — inject it:
|
|
231
|
-
* @Controller(
|
|
231
|
+
* @Controller()
|
|
232
232
|
* class UserController {
|
|
233
233
|
* constructor(@Inject(AppConfigService) private config: AppConfigService) {
|
|
234
234
|
* const dbUrl = config.get('DATABASE_URL') // string — autocompletes!
|
|
@@ -242,4 +242,4 @@ declare function createConfigService<T extends z.ZodObject<any>>(schema: T): {
|
|
|
242
242
|
};
|
|
243
243
|
//#endregion
|
|
244
244
|
export { baseEnvSchema as a, loadEnv as c, Env as i, reloadEnv as l, TypedConfigService as n, defineEnv as o, createConfigService as r, getEnv as s, ConfigService as t, resetEnvCache as u };
|
|
245
|
-
//# sourceMappingURL=index-
|
|
245
|
+
//# sourceMappingURL=index-D-qhXg9M.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-D-qhXg9M.d.mts","names":[],"sources":["../src/config/env.ts","../src/config/config-service.ts"],"mappings":";;;;;;;AAmCA;;cAAa,aAAA,EAAa,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyC1B;;;iBAAgB,SAAA,WAAoB,CAAA,CAAE,WAAA,CAAA,CACpC,MAAA,GAAS,IAAA,SAAa,aAAA,KAAkB,CAAA,CAAE,SAAA,CAAU,CAAA,IACnD,CAAA,CAAE,SAAA,QAAiB,aAAA,CAAc,KAAA,GAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA+B5B,OAAA,WAAkB,CAAA,CAAE,SAAA,MAAA,CAAgB,MAAA,EAAQ,CAAA,GAAI,CAAA,CAAE,KAAA,CAAM,CAAA;AAAA,iBACxD,OAAA,CAAA,IAAY,MAAA,oBAA0B,GAAA,GAAM,OAAA;;;;;;;;;;;;;;;;;;;AAA5D;;;iBAqCgB,MAAA,WAAiB,MAAA,CAAA,CAAQ,GAAA,EAAK,CAAA,GAAI,OAAA,CAAQ,CAAA;AAAA,iBAC1C,MAAA,WAAiB,CAAA,CAAE,SAAA,gCAAyC,CAAA,CAAE,KAAA,CAAM,CAAA,EAAA,CAClF,GAAA,EAAK,CAAA,EACL,MAAA,EAAQ,CAAA,GACP,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,CAAA;;;;;;;;;AAJd;;;;;;;iBAyBgB,SAAA,CAAA;;;;;;;iBA2BA,aAAA,CAAA;AAAA,KAKJ,GAAA,GAAM,CAAA,CAAE,KAAA,QAAa,aAAA;;;;;AAzKjC;;;;;KCvBK,SAAA,sBAA+B,MAAA,oBAA0B,CAAA,GAAI,CAAA,GAAI,MAAA;;;;;;;KAQjE,WAAA,wBAAmC,CAAA,SAAU,MAAA,GAAS,OAAA,CAAQ,CAAA,IAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;cA2B3D,aAAA;ED6BG;;;;;;;;;;;;;EAAA,YCfF,GAAA,CAAA;EDewB;;;;;;;;;ECFpC,GAAA,2BAAA,CAA+B,GAAA,EAAK,SAAA,CAAU,CAAA,IAAK,WAAA,CAAY,CAAA,EAAG,CAAA;EDIhC;;;;AA+BpC;EC1BE,MAAA,CAAA,IAAW,MAAA,oBAA0B,QAAA,CAAS,MAAA,iBAAuB,QAAA,CAAS,OAAA;ED0BzD;ECrBrB,MAAA,CAAA;EAMA,YAAA,CAAA;EAIA,aAAA,CAAA;EAIA,MAAA,CAAA;AAAA;;;;;UASe,kBAAA,cAAgC,MAAA;EAC/C,GAAA,0BAA6B,IAAA,EAAM,GAAA,EAAK,CAAA,GAAI,IAAA,CAAK,CAAA;EACjD,MAAA,IAAU,QAAA,CAAS,IAAA;EACnB,MAAA;EACA,YAAA;EACA,aAAA;EACA,MAAA;AAAA;;;;;;;;;;;;;AD8BF;;;;;;;;;;;;;;;;iBCCgB,mBAAA,WAA8B,CAAA,CAAE,SAAA,MAAA,CAAgB,MAAA,EAAQ,CAAA;EAAA,QAqC5D,kBAAA,CAAkB,CAAA,CAAA,IAAA,CAAA,MAAA,CAAA,CAAA;AAAA"}
|