@forinda/kickjs 2.0.0 → 2.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 +85 -584
- package/dist/adapter-BqGjZCSm.d.mts +122 -0
- package/dist/adapter-BqGjZCSm.d.mts.map +1 -0
- package/dist/app-module-CcEbAVtB.d.mts +33 -0
- package/dist/app-module-CcEbAVtB.d.mts.map +1 -0
- package/dist/application-DNHj-_UL.mjs +449 -0
- package/dist/application-DNHj-_UL.mjs.map +1 -0
- package/dist/bootstrap-DLEZaJ3b.mjs +205 -0
- package/dist/bootstrap-DLEZaJ3b.mjs.map +1 -0
- package/dist/{core/cache.d.ts → cache-DJeMaGqb.d.mts} +33 -31
- package/dist/cache-DJeMaGqb.d.mts.map +1 -0
- package/dist/chunk-C5Qp-JxE.mjs +15 -0
- package/dist/container-nBSIhyqV.d.mts +141 -0
- package/dist/container-nBSIhyqV.d.mts.map +1 -0
- package/dist/core/adapter.d.mts +3 -0
- package/dist/core/adapter.mjs +11 -0
- package/dist/core/app-module.d.mts +3 -0
- package/dist/core/app-module.mjs +11 -0
- package/dist/core/cache.d.mts +3 -0
- package/dist/core/cache.mjs +113 -0
- package/dist/core/cache.mjs.map +1 -0
- package/dist/core/container.d.mts +3 -0
- package/dist/core/container.mjs +426 -0
- package/dist/core/container.mjs.map +1 -0
- package/dist/core/cron.d.mts +3 -0
- package/dist/core/cron.mjs +42 -0
- package/dist/core/cron.mjs.map +1 -0
- package/dist/core/decorators.d.mts +3 -0
- package/dist/core/decorators.mjs +213 -0
- package/dist/core/decorators.mjs.map +1 -0
- package/dist/core/errors.d.mts +3 -0
- package/dist/core/errors.mjs +97 -0
- package/dist/core/errors.mjs.map +1 -0
- package/dist/core/interfaces.d.mts +3 -0
- package/dist/core/interfaces.mjs +44 -0
- package/dist/core/interfaces.mjs.map +1 -0
- package/dist/core/logger.d.mts +3 -0
- package/dist/core/logger.mjs +217 -0
- package/dist/core/logger.mjs.map +1 -0
- package/dist/core/path.d.mts +3 -0
- package/dist/core/path.mjs +45 -0
- package/dist/core/path.mjs.map +1 -0
- package/dist/core/plugin.d.mts +3 -0
- package/dist/core/plugin.mjs +11 -0
- package/dist/core/reactivity.d.mts +3 -0
- package/dist/core/reactivity.mjs +189 -0
- package/dist/core/reactivity.mjs.map +1 -0
- package/dist/core-BL_H8fEZ.mjs +121 -0
- package/dist/core-BL_H8fEZ.mjs.map +1 -0
- package/dist/{core/cron.d.ts → cron-RKhH5TOd.d.mts} +16 -14
- package/dist/cron-RKhH5TOd.d.mts.map +1 -0
- package/dist/decorators-CQ93ak6Z.d.mts +154 -0
- package/dist/decorators-CQ93ak6Z.d.mts.map +1 -0
- package/dist/errors-te5Km00o.d.mts +68 -0
- package/dist/errors-te5Km00o.d.mts.map +1 -0
- package/dist/http/application.d.mts +220 -0
- package/dist/http/application.d.mts.map +1 -0
- package/dist/http/application.mjs +12 -0
- package/dist/http/bootstrap.d.mts +43 -0
- package/dist/http/bootstrap.d.mts.map +1 -0
- package/dist/http/bootstrap.mjs +12 -0
- package/dist/http/context.d.mts +131 -0
- package/dist/http/context.d.mts.map +1 -0
- package/dist/http/context.mjs +220 -0
- package/dist/http/context.mjs.map +1 -0
- package/dist/http/middleware/cors.d.mts +48 -0
- package/dist/http/middleware/cors.d.mts.map +1 -0
- package/dist/http/middleware/cors.mjs +83 -0
- package/dist/http/middleware/cors.mjs.map +1 -0
- package/dist/http/middleware/csrf.d.mts +52 -0
- package/dist/http/middleware/csrf.d.mts.map +1 -0
- package/dist/http/middleware/csrf.mjs +72 -0
- package/dist/http/middleware/csrf.mjs.map +1 -0
- package/dist/http/middleware/error-handler.d.mts +11 -0
- package/dist/http/middleware/error-handler.d.mts.map +1 -0
- package/dist/http/middleware/error-handler.mjs +52 -0
- package/dist/http/middleware/error-handler.mjs.map +1 -0
- package/dist/http/middleware/helmet.d.mts +41 -0
- package/dist/http/middleware/helmet.d.mts.map +1 -0
- package/dist/http/middleware/helmet.mjs +51 -0
- package/dist/http/middleware/helmet.mjs.map +1 -0
- package/dist/http/middleware/rate-limit.d.mts +56 -0
- package/dist/http/middleware/rate-limit.d.mts.map +1 -0
- package/dist/http/middleware/rate-limit.mjs +101 -0
- package/dist/http/middleware/rate-limit.mjs.map +1 -0
- package/dist/http/middleware/request-id.d.mts +10 -0
- package/dist/http/middleware/request-id.d.mts.map +1 -0
- package/dist/http/middleware/request-id.mjs +26 -0
- package/dist/http/middleware/request-id.mjs.map +1 -0
- package/dist/http/middleware/request-logger.d.mts +32 -0
- package/dist/http/middleware/request-logger.d.mts.map +1 -0
- package/dist/http/middleware/request-logger.mjs +49 -0
- package/dist/http/middleware/request-logger.mjs.map +1 -0
- package/dist/http/middleware/session.d.mts +67 -0
- package/dist/http/middleware/session.d.mts.map +1 -0
- package/dist/http/middleware/session.mjs +152 -0
- package/dist/http/middleware/session.mjs.map +1 -0
- package/dist/http/middleware/spa.d.mts +101 -0
- package/dist/http/middleware/spa.d.mts.map +1 -0
- package/dist/http/middleware/spa.mjs +108 -0
- package/dist/http/middleware/spa.mjs.map +1 -0
- package/dist/http/middleware/{upload.d.ts → upload.d.mts} +21 -17
- package/dist/http/middleware/upload.d.mts.map +1 -0
- package/dist/http/middleware/upload.mjs +191 -0
- package/dist/http/middleware/upload.mjs.map +1 -0
- package/dist/http/middleware/validate.d.mts +18 -0
- package/dist/http/middleware/validate.d.mts.map +1 -0
- package/dist/http/middleware/validate.mjs +62 -0
- package/dist/http/middleware/validate.mjs.map +1 -0
- package/dist/http/middleware/views.d.mts +62 -0
- package/dist/http/middleware/views.d.mts.map +1 -0
- package/dist/http/middleware/views.mjs +65 -0
- package/dist/http/middleware/views.mjs.map +1 -0
- package/dist/http/query/index.d.mts +3 -0
- package/dist/http/query/index.mjs +12 -0
- package/dist/http/{router-builder.d.ts → router-builder.d.mts} +9 -5
- package/dist/http/router-builder.d.mts.map +1 -0
- package/dist/http/router-builder.mjs +67 -0
- package/dist/http/router-builder.mjs.map +1 -0
- package/dist/index-C0gbnpSg.d.mts +107 -0
- package/dist/index-C0gbnpSg.d.mts.map +1 -0
- package/dist/index-Cls52etj.d.mts +148 -0
- package/dist/index-Cls52etj.d.mts.map +1 -0
- package/dist/index.d.mts +133 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +126 -0
- package/dist/index.mjs.map +1 -0
- package/dist/interfaces-D-48zotH.d.mts +52 -0
- package/dist/interfaces-D-48zotH.d.mts.map +1 -0
- package/dist/logger-Dzj-TF0t.d.mts +119 -0
- package/dist/logger-Dzj-TF0t.d.mts.map +1 -0
- package/dist/metadata-fmvikBA0.mjs +76 -0
- package/dist/metadata-fmvikBA0.mjs.map +1 -0
- package/dist/{core/path.d.ts → path-LmwfhfyH.d.mts} +7 -3
- package/dist/path-LmwfhfyH.d.mts.map +1 -0
- package/dist/plugin-DIoPIpSm.d.mts +95 -0
- package/dist/plugin-DIoPIpSm.d.mts.map +1 -0
- package/dist/query-7cdHF6ry.mjs +164 -0
- package/dist/query-7cdHF6ry.mjs.map +1 -0
- package/dist/{core/reactivity.d.ts → reactivity-BbS-99ow.d.mts} +21 -20
- package/dist/reactivity-BbS-99ow.d.mts.map +1 -0
- package/package.json +73 -43
- package/dist/chunk-DVVP7zzD.js +0 -7
- package/dist/core/adapter.d.ts +0 -109
- package/dist/core/adapter.d.ts.map +0 -1
- package/dist/core/adapter.js +0 -0
- package/dist/core/app-module.d.ts +0 -28
- package/dist/core/app-module.d.ts.map +0 -1
- package/dist/core/app-module.js +0 -0
- package/dist/core/cache.d.ts.map +0 -1
- package/dist/core/cache.js +0 -57
- package/dist/core/container.d.ts +0 -63
- package/dist/core/container.d.ts.map +0 -1
- package/dist/core/container.js +0 -117
- package/dist/core/cron.d.ts.map +0 -1
- package/dist/core/cron.js +0 -22
- package/dist/core/decorators.d.ts +0 -153
- package/dist/core/decorators.d.ts.map +0 -1
- package/dist/core/decorators.js +0 -141
- package/dist/core/errors.d.ts +0 -64
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -67
- package/dist/core/index.d.ts +0 -14
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/interfaces.d.ts +0 -44
- package/dist/core/interfaces.d.ts.map +0 -1
- package/dist/core/interfaces.js +0 -25
- package/dist/core/logger.d.ts +0 -43
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/logger.js +0 -54
- package/dist/core/path.d.ts.map +0 -1
- package/dist/core/path.js +0 -12
- package/dist/core/plugin.d.ts +0 -90
- package/dist/core/plugin.d.ts.map +0 -1
- package/dist/core/plugin.js +0 -0
- package/dist/core/reactivity.d.ts.map +0 -1
- package/dist/core/reactivity.js +0 -101
- package/dist/core-B6Okew3W.js +0 -7
- package/dist/http/application.d.ts +0 -103
- package/dist/http/application.d.ts.map +0 -1
- package/dist/http/application.js +0 -167
- package/dist/http/bootstrap.d.ts +0 -22
- package/dist/http/bootstrap.d.ts.map +0 -1
- package/dist/http/bootstrap.js +0 -40
- package/dist/http/context.d.ts +0 -129
- package/dist/http/context.d.ts.map +0 -1
- package/dist/http/context.js +0 -115
- package/dist/http/index.d.ts +0 -16
- package/dist/http/index.d.ts.map +0 -1
- package/dist/http/middleware/cors.d.ts +0 -43
- package/dist/http/middleware/cors.d.ts.map +0 -1
- package/dist/http/middleware/cors.js +0 -31
- package/dist/http/middleware/csrf.d.ts +0 -47
- package/dist/http/middleware/csrf.d.ts.map +0 -1
- package/dist/http/middleware/csrf.js +0 -25
- package/dist/http/middleware/error-handler.d.ts +0 -6
- package/dist/http/middleware/error-handler.d.ts.map +0 -1
- package/dist/http/middleware/error-handler.js +0 -37
- package/dist/http/middleware/helmet.d.ts +0 -36
- package/dist/http/middleware/helmet.d.ts.map +0 -1
- package/dist/http/middleware/helmet.js +0 -20
- package/dist/http/middleware/rate-limit.d.ts +0 -51
- package/dist/http/middleware/rate-limit.d.ts.map +0 -1
- package/dist/http/middleware/rate-limit.js +0 -46
- package/dist/http/middleware/request-id.d.ts +0 -5
- package/dist/http/middleware/request-id.d.ts.map +0 -1
- package/dist/http/middleware/request-id.js +0 -12
- package/dist/http/middleware/request-logger.d.ts +0 -27
- package/dist/http/middleware/request-logger.d.ts.map +0 -1
- package/dist/http/middleware/request-logger.js +0 -16
- package/dist/http/middleware/session.d.ts +0 -62
- package/dist/http/middleware/session.d.ts.map +0 -1
- package/dist/http/middleware/session.js +0 -76
- package/dist/http/middleware/spa.d.ts +0 -93
- package/dist/http/middleware/spa.d.ts.map +0 -1
- package/dist/http/middleware/spa.js +0 -52
- package/dist/http/middleware/upload.d.ts.map +0 -1
- package/dist/http/middleware/upload.js +0 -119
- package/dist/http/middleware/validate.d.ts +0 -13
- package/dist/http/middleware/validate.d.ts.map +0 -1
- package/dist/http/middleware/validate.js +0 -45
- package/dist/http/middleware/views.d.ts +0 -56
- package/dist/http/middleware/views.d.ts.map +0 -1
- package/dist/http/middleware/views.js +0 -18
- package/dist/http/query/index.d.ts +0 -4
- package/dist/http/query/index.d.ts.map +0 -1
- package/dist/http/query/index.js +0 -10
- package/dist/http/query/parse-query.d.ts +0 -44
- package/dist/http/query/parse-query.d.ts.map +0 -1
- package/dist/http/query/types.d.ts +0 -100
- package/dist/http/query/types.d.ts.map +0 -1
- package/dist/http/router-builder.d.ts.map +0 -1
- package/dist/http/router-builder.js +0 -37
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -103
- package/dist/query-Bym31XRp.js +0 -88
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/core/cron.d.ts
|
|
2
3
|
declare const CRON_META: unique symbol;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
interface CronJobMeta {
|
|
5
|
+
expression: string;
|
|
6
|
+
handlerName: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
timezone?: string;
|
|
9
|
+
runOnInit?: boolean;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Schedule a method to run on a cron expression.
|
|
@@ -17,12 +18,13 @@ export interface CronJobMeta {
|
|
|
17
18
|
* @param options.timezone - IANA timezone (e.g. 'America/New_York', 'UTC')
|
|
18
19
|
* @param options.runOnInit - Run immediately on startup before first scheduled tick
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
declare function Cron(expression: string, options?: {
|
|
22
|
+
description?: string;
|
|
23
|
+
timezone?: string;
|
|
24
|
+
runOnInit?: boolean;
|
|
24
25
|
}): MethodDecorator;
|
|
25
26
|
/** Read cron jobs registered on a class */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
declare function getCronJobs(target: any): CronJobMeta[];
|
|
28
|
+
//#endregion
|
|
29
|
+
export { getCronJobs as i, Cron as n, CronJobMeta as r, CRON_META as t };
|
|
30
|
+
//# sourceMappingURL=cron-RKhH5TOd.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-RKhH5TOd.d.mts","names":[],"sources":["../src/core/cron.ts"],"mappings":";;cAEM,SAAA;AAAA,UAEW,WAAA;EACf,UAAA;EACA,WAAA;EACA,WAAA;EACA,QAAA;EACA,SAAA;AAAA;;;;;;;;;;AAqBF;iBAAgB,IAAA,CACd,UAAA,UACA,OAAA;EAAY,WAAA;EAAsB,QAAA;EAAmB,SAAA;AAAA,IACpD,eAAA;;iBAaa,WAAA,CAAY,MAAA,QAAc,WAAA"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
|
|
2
|
+
import { l as ServiceOptions } from "./interfaces-D-48zotH.mjs";
|
|
3
|
+
//#region src/core/decorators.d.ts
|
|
4
|
+
/** Mark a class as injectable with lifecycle scope */
|
|
5
|
+
declare function Injectable(options?: ServiceOptions): ClassDecorator;
|
|
6
|
+
/** Mark a class as a service (semantic alias for Injectable) */
|
|
7
|
+
declare function Service(options?: ServiceOptions): ClassDecorator;
|
|
8
|
+
/** Mark a class as a generic managed component */
|
|
9
|
+
declare function Component(options?: ServiceOptions): ClassDecorator;
|
|
10
|
+
/** Mark a class as a repository */
|
|
11
|
+
declare function Repository(options?: ServiceOptions): ClassDecorator;
|
|
12
|
+
/**
|
|
13
|
+
* Mark a class as an HTTP controller and register it in the DI container.
|
|
14
|
+
*
|
|
15
|
+
* @param path - **Deprecated.** The path parameter is no longer used for routing.
|
|
16
|
+
* Route prefixes are defined by the module's `routes().path` — the single source
|
|
17
|
+
* of truth for where routes are mounted. This parameter will be removed in a
|
|
18
|
+
* future major version.
|
|
19
|
+
*/
|
|
20
|
+
declare function Controller(path?: string): ClassDecorator;
|
|
21
|
+
/** Mark a method as a lifecycle hook called after instantiation */
|
|
22
|
+
declare function PostConstruct(): MethodDecorator;
|
|
23
|
+
/** Property injection — resolved lazily from the container */
|
|
24
|
+
declare function Autowired(token?: any): PropertyDecorator;
|
|
25
|
+
/**
|
|
26
|
+
* Constructor parameter injection with an explicit token.
|
|
27
|
+
*
|
|
28
|
+
* **Constructor parameters only** — does not work as a property decorator.
|
|
29
|
+
* For property injection with a token, use `@Autowired(token)` instead.
|
|
30
|
+
*/
|
|
31
|
+
declare function Inject(token: any): ParameterDecorator;
|
|
32
|
+
/**
|
|
33
|
+
* Inject an environment variable value. Evaluated lazily so the env
|
|
34
|
+
* is available at access time, not at decoration time.
|
|
35
|
+
*
|
|
36
|
+
* If no default is provided and the env var is missing, throws at access time
|
|
37
|
+
* to catch misconfiguration early instead of returning undefined.
|
|
38
|
+
*
|
|
39
|
+
* Uses metadata + instance getter to work correctly with `useDefineForClassFields`.
|
|
40
|
+
*/
|
|
41
|
+
declare function Value(envKey: string, defaultValue?: any): PropertyDecorator;
|
|
42
|
+
interface RouteDefinition {
|
|
43
|
+
method: string;
|
|
44
|
+
path: string;
|
|
45
|
+
handlerName: string;
|
|
46
|
+
validation?: {
|
|
47
|
+
/** JSON Schema object for validating the request body */body?: any; /** JSON Schema object for validating query parameters */
|
|
48
|
+
query?: any; /** JSON Schema object for validating URL params */
|
|
49
|
+
params?: any; /** Schema name in OpenAPI components/schemas for the request body. Auto-generated from handler name if omitted. */
|
|
50
|
+
name?: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
declare const Get: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
54
|
+
declare const Post: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
55
|
+
declare const Put: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
56
|
+
declare const Delete: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
57
|
+
declare const Patch: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
58
|
+
interface ApiQueryParamsConfig {
|
|
59
|
+
/** Fields that can be used in filter queries (e.g., `?filter=status:eq:active`) */
|
|
60
|
+
filterable?: string[];
|
|
61
|
+
/** Fields that can be used in sort queries (e.g., `?sort=createdAt:desc`) */
|
|
62
|
+
sortable?: string[];
|
|
63
|
+
/** Fields that are searched with the `?q=` parameter */
|
|
64
|
+
searchable?: string[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Column-object-based query params config (e.g., from DrizzleQueryParamsConfig).
|
|
68
|
+
* `Object.keys()` is used to derive field names for OpenAPI docs.
|
|
69
|
+
*/
|
|
70
|
+
interface ColumnApiQueryParamsConfig {
|
|
71
|
+
columns: Record<string, any>;
|
|
72
|
+
sortable?: Record<string, any>;
|
|
73
|
+
searchColumns?: any[];
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Normalize a query params config to the string-based ApiQueryParamsConfig.
|
|
78
|
+
* Handles both string-based and column-object-based configs.
|
|
79
|
+
*/
|
|
80
|
+
declare function normalizeApiQueryParamsConfig(config: ApiQueryParamsConfig | ColumnApiQueryParamsConfig): ApiQueryParamsConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Document the query parameters accepted by a GET endpoint.
|
|
83
|
+
* Used by SwaggerAdapter to generate `filter`, `sort`, `page`, `limit`, and `q` params
|
|
84
|
+
* in the OpenAPI spec, with descriptions listing the allowed fields.
|
|
85
|
+
*
|
|
86
|
+
* Accepts both string-based configs and column-object configs (e.g., DrizzleQueryParamsConfig).
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* // String-based
|
|
91
|
+
* @ApiQueryParams({
|
|
92
|
+
* filterable: ['status', 'category', 'price'],
|
|
93
|
+
* sortable: ['name', 'createdAt', 'price'],
|
|
94
|
+
* searchable: ['name', 'description'],
|
|
95
|
+
* })
|
|
96
|
+
*
|
|
97
|
+
* // Column-object-based (Drizzle)
|
|
98
|
+
* @ApiQueryParams(TASK_QUERY_CONFIG)
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function ApiQueryParams(config: ApiQueryParamsConfig | ColumnApiQueryParamsConfig): MethodDecorator;
|
|
102
|
+
/**
|
|
103
|
+
* Middleware handler function.
|
|
104
|
+
* Generic `TCtx` defaults to `any` — import `RequestContext` from
|
|
105
|
+
* `@forinda/kickjs-http` for full type safety:
|
|
106
|
+
*
|
|
107
|
+
* ```ts
|
|
108
|
+
* import type { MiddlewareHandler } from '@forinda/kickjs-core'
|
|
109
|
+
* import type { RequestContext } from '@forinda/kickjs-http'
|
|
110
|
+
*
|
|
111
|
+
* const auth: MiddlewareHandler<RequestContext> = (ctx, next) => {
|
|
112
|
+
* ctx.body // fully typed
|
|
113
|
+
* next()
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
type MiddlewareHandler<TCtx = any> = (ctx: TCtx, next: () => void) => void | Promise<void>;
|
|
118
|
+
/** Attach middleware handlers to a class or method */
|
|
119
|
+
declare function Middleware(...handlers: MiddlewareHandler[]): ClassDecorator & MethodDecorator;
|
|
120
|
+
/**
|
|
121
|
+
* File filter — accepts short extensions ('jpg'), full MIME types ('image/jpeg'),
|
|
122
|
+
* wildcards ('image/*'), or a function `(mimetype, filename) => boolean` for full control.
|
|
123
|
+
*/
|
|
124
|
+
type FileTypeFilter = string[] | ((mimetype: string, filename: string) => boolean);
|
|
125
|
+
/**
|
|
126
|
+
* Shared upload options used by both the `@FileUpload` decorator and the
|
|
127
|
+
* `upload.single()` / `upload.array()` / `upload.none()` middleware.
|
|
128
|
+
*/
|
|
129
|
+
interface BaseUploadOptions {
|
|
130
|
+
/** Max file size in bytes (default: 5MB) */
|
|
131
|
+
maxSize?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Allowed file types:
|
|
134
|
+
* - **string[]** — short extensions ('jpg'), full MIME types ('image/jpeg'), or wildcards ('image/*')
|
|
135
|
+
* - **function** — `(mimetype, filename) => boolean` for full control
|
|
136
|
+
*/
|
|
137
|
+
allowedTypes?: FileTypeFilter;
|
|
138
|
+
/** Extend the built-in extension-to-MIME map */
|
|
139
|
+
customMimeMap?: Record<string, string>;
|
|
140
|
+
}
|
|
141
|
+
interface FileUploadConfig extends BaseUploadOptions {
|
|
142
|
+
mode: 'single' | 'array' | 'none';
|
|
143
|
+
/** Form field name (default: 'file') */
|
|
144
|
+
fieldName?: string;
|
|
145
|
+
/** Max files for array mode (default: 10) */
|
|
146
|
+
maxCount?: number;
|
|
147
|
+
}
|
|
148
|
+
/** Configure file upload handling for a controller method */
|
|
149
|
+
declare function FileUpload(config: FileUploadConfig): MethodDecorator;
|
|
150
|
+
/** Add a static builder() method for fluent construction */
|
|
151
|
+
declare function Builder(target: any): void;
|
|
152
|
+
//#endregion
|
|
153
|
+
export { RouteDefinition as C, normalizeApiQueryParamsConfig as E, Repository as S, Value as T, MiddlewareHandler as _, Builder as a, PostConstruct as b, Controller as c, FileUpload as d, FileUploadConfig as f, Middleware as g, Injectable as h, BaseUploadOptions as i, Delete as l, Inject as m, ApiQueryParamsConfig as n, ColumnApiQueryParamsConfig as o, Get as p, Autowired as r, Component as s, ApiQueryParams as t, FileTypeFilter as u, Patch as v, Service as w, Put as x, Post as y };
|
|
154
|
+
//# sourceMappingURL=decorators-CQ93ak6Z.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators-CQ93ak6Z.d.mts","names":[],"sources":["../src/core/decorators.ts"],"mappings":";;;;iBA8EgB,UAAA,CAAW,OAAA,GAAU,cAAA,GAAiB,cAAA;AAAtD;AAAA,iBAQgB,OAAA,CAAQ,OAAA,GAAU,cAAA,GAAiB,cAAA;;iBAQnC,SAAA,CAAU,OAAA,GAAU,cAAA,GAAiB,cAAA;;iBAQrC,UAAA,CAAW,OAAA,GAAU,cAAA,GAAiB,cAAA;;;;AAhBtD;;;;;iBA+BgB,UAAA,CAAW,IAAA,YAAgB,cAAA;;iBAW3B,aAAA,CAAA,GAAiB,eAAA;;iBASjB,SAAA,CAAU,KAAA,SAAc,iBAAA;;;;;;;iBAYxB,MAAA,CAAO,KAAA,QAAa,kBAAA;;AA/CpC;;;;;;;;iBA8DgB,KAAA,CAAM,MAAA,UAAgB,YAAA,SAAqB,iBAAA;AAAA,UAQ1C,eAAA;EACf,MAAA;EACA,IAAA;EACA,WAAA;EACA,UAAA;IAhDc,yDAkDZ,IAAA,QAlD6B;IAoD7B,KAAA,QApD4C;IAsD5C,MAAA,QA7CqB;IA+CrB,IAAA;EAAA;AAAA;AAAA,cAiBS,GAAA,GAAG,IAAA,WAZO,UAAA,GAAe,eAAA,mBAAgC,eAAA;AAAA,cAazD,IAAA,GAAI,IAAA,WAbM,UAAA,GAAe,eAAA,mBAAgC,eAAA;AAAA,cAczD,GAAA,GAAG,IAAA,WAdO,UAAA,GAAe,eAAA,mBAAgC,eAAA;AAAA,cAezD,MAAA,GAAM,IAAA,WAfI,UAAA,GAAe,eAAA,mBAAgC,eAAA;AAAA,cAgBzD,KAAA,GAAK,IAAA,WAhBK,UAAA,GAAe,eAAA,mBAAgC,eAAA;AAAA,UAoBrD,oBAAA;EA7CI;EA+CnB,UAAA;EA/C0E;EAiD1E,QAAA;EAjDoC;EAmDpC,UAAA;AAAA;;AA3CF;;;UAkDiB,0BAAA;EACf,OAAA,EAAS,MAAA;EACT,QAAA,GAAW,MAAA;EACX,aAAA;EAAA,CACC,GAAA;AAAA;;;;;iBAOa,6BAAA,CACd,MAAA,EAAQ,oBAAA,GAAuB,0BAAA,GAC9B,oBAAA;AAlCH;;;;;;;;;;AACA;;;;;;;;;;AADA,iBAmEgB,cAAA,CACd,MAAA,EAAQ,oBAAA,GAAuB,0BAAA,GAC9B,eAAA;;;;;;;;;;AAlEH;;;;;;KA0FY,iBAAA,gBAAiC,GAAA,EAAK,IAAA,EAAM,IAAA,wBAA4B,OAAA;;iBAGpE,UAAA,CAAA,GAAc,QAAA,EAAU,iBAAA,KAAsB,cAAA,GAAiB,eAAA;;AA5F/E;;;KAiHY,cAAA,gBAA8B,QAAA,UAAkB,QAAA;;;;;UAM3C,iBAAA;EAvHiC;EAyHhD,OAAA;EArHmC;;;;;EA2HnC,YAAA,GAAe,cAAA;EArHL;EAuHV,aAAA,GAAgB,MAAA;AAAA;AAAA,UAGD,gBAAA,SAAyB,iBAAA;EACxC,IAAA;EAlHiB;EAoHjB,SAAA;EArHS;EAuHT,QAAA;AAAA;;iBAIc,UAAA,CAAW,MAAA,EAAQ,gBAAA,GAAmB,eAAA;;iBAStC,OAAA,CAAQ,MAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/core/errors.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Standard HTTP status codes as a const enum.
|
|
5
|
+
* Use instead of raw numbers for readability and type safety.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* throw new HttpException(HttpStatus.NOT_FOUND, 'User not found')
|
|
10
|
+
* ctx.res.status(HttpStatus.CREATED).json(data)
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const HttpStatus: {
|
|
14
|
+
readonly OK: 200;
|
|
15
|
+
readonly CREATED: 201;
|
|
16
|
+
readonly ACCEPTED: 202;
|
|
17
|
+
readonly NO_CONTENT: 204;
|
|
18
|
+
readonly MOVED_PERMANENTLY: 301;
|
|
19
|
+
readonly FOUND: 302;
|
|
20
|
+
readonly NOT_MODIFIED: 304;
|
|
21
|
+
readonly TEMPORARY_REDIRECT: 307;
|
|
22
|
+
readonly PERMANENT_REDIRECT: 308;
|
|
23
|
+
readonly BAD_REQUEST: 400;
|
|
24
|
+
readonly UNAUTHORIZED: 401;
|
|
25
|
+
readonly PAYMENT_REQUIRED: 402;
|
|
26
|
+
readonly FORBIDDEN: 403;
|
|
27
|
+
readonly NOT_FOUND: 404;
|
|
28
|
+
readonly METHOD_NOT_ALLOWED: 405;
|
|
29
|
+
readonly NOT_ACCEPTABLE: 406;
|
|
30
|
+
readonly CONFLICT: 409;
|
|
31
|
+
readonly GONE: 410;
|
|
32
|
+
readonly UNPROCESSABLE_ENTITY: 422;
|
|
33
|
+
readonly TOO_MANY_REQUESTS: 429;
|
|
34
|
+
readonly INTERNAL_SERVER_ERROR: 500;
|
|
35
|
+
readonly NOT_IMPLEMENTED: 501;
|
|
36
|
+
readonly BAD_GATEWAY: 502;
|
|
37
|
+
readonly SERVICE_UNAVAILABLE: 503;
|
|
38
|
+
readonly GATEWAY_TIMEOUT: 504;
|
|
39
|
+
};
|
|
40
|
+
type HttpStatusCode = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
41
|
+
/** Validation error detail */
|
|
42
|
+
interface ValidationError {
|
|
43
|
+
field: string;
|
|
44
|
+
message: string;
|
|
45
|
+
code?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Typed HTTP exception with status code and optional validation details.
|
|
49
|
+
* Provides static factory methods for common HTTP errors.
|
|
50
|
+
*/
|
|
51
|
+
declare class HttpException extends Error {
|
|
52
|
+
readonly status: number;
|
|
53
|
+
readonly details?: ValidationError[] | undefined;
|
|
54
|
+
constructor(status: number, message: string, details?: ValidationError[] | undefined);
|
|
55
|
+
/** Create from a Zod error */
|
|
56
|
+
static fromZodError(error: any, message?: string): HttpException;
|
|
57
|
+
static badRequest(message?: string): HttpException;
|
|
58
|
+
static unauthorized(message?: string): HttpException;
|
|
59
|
+
static forbidden(message?: string): HttpException;
|
|
60
|
+
static notFound(message?: string): HttpException;
|
|
61
|
+
static conflict(message?: string): HttpException;
|
|
62
|
+
static unprocessable(message?: string, details?: ValidationError[]): HttpException;
|
|
63
|
+
static tooManyRequests(message?: string): HttpException;
|
|
64
|
+
static internal(message?: string): HttpException;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { ValidationError as i, HttpStatus as n, HttpStatusCode as r, HttpException as t };
|
|
68
|
+
//# sourceMappingURL=errors-te5Km00o.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-te5Km00o.d.mts","names":[],"sources":["../src/core/errors.ts"],"mappings":";;;AAUA;;;;;;;;;cAAa,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCD,cAAA,WAAyB,UAAA,eAAyB,UAAA;;UAG7C,eAAA;EACf,KAAA;EACA,OAAA;EACA,IAAA;AAAA;;;AAOF;;cAAa,aAAA,SAAsB,KAAA;EAAA,SAEf,MAAA;EAAA,SAEA,OAAA,GAAU,eAAA;cAFV,MAAA,UAChB,OAAA,UACgB,OAAA,GAAU,eAAA;EAsBa;EAAA,OAflC,YAAA,CAAa,KAAA,OAAY,OAAA,YAAmB,aAAA;EAAA,OAe5C,UAAA,CAAW,OAAA,YAAuB,aAAA;EAAA,OAGlC,YAAA,CAAa,OAAA,YAAwB,aAAA;EAAA,OAGrC,SAAA,CAAU,OAAA,YAAqB,aAAA;EAAA,OAG/B,QAAA,CAAS,OAAA,YAAqB,aAAA;EAAA,OAG9B,QAAA,CAAS,OAAA,YAAoB,aAAA;EAAA,OAG7B,aAAA,CAAc,OAAA,WAAkC,OAAA,GAAU,eAAA,KAAiB,aAAA;EAAA,OAG3E,eAAA,CAAgB,OAAA,YAA6B,aAAA;EAAA,OAG7C,QAAA,CAAS,OAAA,YAAiC,aAAA;AAAA"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
|
|
2
|
+
import { t as Container } from "../container-nBSIhyqV.mjs";
|
|
3
|
+
import { r as AppAdapter } from "../adapter-BqGjZCSm.mjs";
|
|
4
|
+
import { n as AppModuleClass } from "../app-module-CcEbAVtB.mjs";
|
|
5
|
+
import { t as KickPlugin } from "../plugin-DIoPIpSm.mjs";
|
|
6
|
+
import http from "node:http";
|
|
7
|
+
import { Express, RequestHandler } from "express";
|
|
8
|
+
|
|
9
|
+
//#region src/http/application.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* A middleware entry in the declarative pipeline.
|
|
12
|
+
* Can be a bare handler or an object with path scoping.
|
|
13
|
+
*/
|
|
14
|
+
type MiddlewareEntry = RequestHandler | {
|
|
15
|
+
path: string;
|
|
16
|
+
handler: RequestHandler;
|
|
17
|
+
};
|
|
18
|
+
interface ApplicationOptions {
|
|
19
|
+
/** Feature modules to load */
|
|
20
|
+
modules: AppModuleClass[];
|
|
21
|
+
/** Adapters that hook into the lifecycle (DB, Redis, Swagger, etc.) */
|
|
22
|
+
adapters?: AppAdapter[];
|
|
23
|
+
/** Server port (falls back to PORT env var, then 3000) */
|
|
24
|
+
port?: number;
|
|
25
|
+
/** Global API prefix (default: '/api') */
|
|
26
|
+
apiPrefix?: string;
|
|
27
|
+
/** Default API version (default: 1) — routes become /{prefix}/v{version}/{path} */
|
|
28
|
+
defaultVersion?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Global middleware pipeline. Declared in order.
|
|
31
|
+
* Replaces the hardcoded middleware stack — you control exactly what runs.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* bootstrap({
|
|
36
|
+
* modules,
|
|
37
|
+
* middleware: [
|
|
38
|
+
* helmet(),
|
|
39
|
+
* cors(),
|
|
40
|
+
* compression(),
|
|
41
|
+
* morgan('dev'),
|
|
42
|
+
* express.json({ limit: '1mb' }),
|
|
43
|
+
* ],
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* If omitted, a sensible default is applied:
|
|
48
|
+
* requestId(), express.json({ limit: '100kb' })
|
|
49
|
+
*/
|
|
50
|
+
middleware?: MiddlewareEntry[];
|
|
51
|
+
/** Plugins that bundle modules, adapters, middleware, and DI bindings */
|
|
52
|
+
plugins?: KickPlugin[];
|
|
53
|
+
/** Express `trust proxy` setting */
|
|
54
|
+
trustProxy?: boolean | number | string | ((ip: string, hopIndex: number) => boolean);
|
|
55
|
+
/** Maximum JSON body size (only used when middleware is not provided) */
|
|
56
|
+
jsonLimit?: string | number;
|
|
57
|
+
/**
|
|
58
|
+
* Log route summary on startup. Default: true in dev, false in production.
|
|
59
|
+
* Set to `true` to always log, `false` to always suppress.
|
|
60
|
+
*/
|
|
61
|
+
logRoutesTable?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Maximum time (ms) to wait for graceful shutdown before forcing exit.
|
|
64
|
+
* Default: 30000 (30 seconds). Set to 0 to disable forced exit.
|
|
65
|
+
*/
|
|
66
|
+
shutdownTimeout?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Enable cluster mode for multi-core utilization.
|
|
69
|
+
*
|
|
70
|
+
* When enabled, the primary process forks worker processes that share the
|
|
71
|
+
* same port via Node's built-in `cluster` module (OS load balancing).
|
|
72
|
+
*
|
|
73
|
+
* - `true` — use all available CPU cores
|
|
74
|
+
* - `{ workers: N }` — use exactly N workers
|
|
75
|
+
*
|
|
76
|
+
* Workers are auto-restarted on crash. SIGTERM/SIGINT on the primary is
|
|
77
|
+
* forwarded to all workers.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* bootstrap({ modules, cluster: true })
|
|
82
|
+
* bootstrap({ modules, cluster: { workers: 4 } })
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
cluster?: boolean | {
|
|
86
|
+
workers?: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Custom 404 handler for unmatched routes. Receives the raw Express
|
|
90
|
+
* `(req, res, next)` args. When omitted, the built-in handler returns
|
|
91
|
+
* `{ message: 'Not Found' }` with status 404.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* bootstrap({
|
|
96
|
+
* modules,
|
|
97
|
+
* onNotFound: (req, res) => {
|
|
98
|
+
* res.status(404).json({ error: 'Route not found', path: req.originalUrl })
|
|
99
|
+
* },
|
|
100
|
+
* })
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
onNotFound?: (req: any, res: any, next: any) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Custom global error handler. Receives `(err, req, res, next)` — the
|
|
106
|
+
* standard Express error-handling signature. When omitted, the built-in
|
|
107
|
+
* handler formats ZodError, HttpException, and unexpected errors.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* bootstrap({
|
|
112
|
+
* modules,
|
|
113
|
+
* onError: (err, req, res, next) => {
|
|
114
|
+
* logger.error(err)
|
|
115
|
+
* res.status(err.status ?? 500).json({ error: err.message })
|
|
116
|
+
* },
|
|
117
|
+
* })
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
onError?: (err: any, req: any, res: any, next: any) => void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The main application class. Wires together Express, the DI container,
|
|
124
|
+
* feature modules, adapters, and the middleware pipeline.
|
|
125
|
+
*/
|
|
126
|
+
declare class Application {
|
|
127
|
+
private readonly options;
|
|
128
|
+
private app;
|
|
129
|
+
private container;
|
|
130
|
+
private httpServer;
|
|
131
|
+
private adapters;
|
|
132
|
+
private plugins;
|
|
133
|
+
/** Number of HTTP requests currently being processed */
|
|
134
|
+
private _inFlightRequests;
|
|
135
|
+
/** Whether the application is draining (shutting down gracefully) */
|
|
136
|
+
private _draining;
|
|
137
|
+
/** Whether shutdown has already been initiated (prevents double-shutdown) */
|
|
138
|
+
private _shutdownInitiated;
|
|
139
|
+
/** Resolvers waiting for in-flight requests to reach zero */
|
|
140
|
+
private _drainResolvers;
|
|
141
|
+
constructor(options: ApplicationOptions);
|
|
142
|
+
/** Whether the application is currently draining in-flight requests */
|
|
143
|
+
get isDraining(): boolean;
|
|
144
|
+
/** Number of HTTP requests currently being processed */
|
|
145
|
+
get inFlightRequests(): number;
|
|
146
|
+
/** Get the DI container instance */
|
|
147
|
+
getContainer(): Container;
|
|
148
|
+
/**
|
|
149
|
+
* Express request handler — delegates to the internal Express app.
|
|
150
|
+
*
|
|
151
|
+
* Used by the Vite dev-server plugin to route requests through KickJS:
|
|
152
|
+
* ```ts
|
|
153
|
+
* const mod = await ssrLoadModule('virtual:kickjs/app')
|
|
154
|
+
* mod.app.handle(req, res, next)
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* Also works as a standard Node.js request handler for production:
|
|
158
|
+
* ```ts
|
|
159
|
+
* http.createServer(app.handle.bind(app))
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
handle(req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void): void;
|
|
163
|
+
/**
|
|
164
|
+
* Full setup pipeline:
|
|
165
|
+
* 1. Adapter beforeMount hooks (early routes — docs, health)
|
|
166
|
+
* 2. Adapter middleware (phase: beforeGlobal)
|
|
167
|
+
* 3. Global middleware (user-declared or defaults)
|
|
168
|
+
* 4. Adapter middleware (phase: afterGlobal)
|
|
169
|
+
* 5. Module registration + DI bootstrap
|
|
170
|
+
* 6. Adapter middleware (phase: beforeRoutes)
|
|
171
|
+
* 7. Module route mounting
|
|
172
|
+
* 8. Adapter middleware (phase: afterRoutes)
|
|
173
|
+
* 9. Error handlers (notFound + global)
|
|
174
|
+
* 10. Adapter beforeStart hooks
|
|
175
|
+
*/
|
|
176
|
+
/** Build the adapter context object (shared across all hooks) */
|
|
177
|
+
private adapterCtx;
|
|
178
|
+
/** Call an adapter hook, awaiting async hooks and catching errors */
|
|
179
|
+
private callHook;
|
|
180
|
+
setup(): Promise<void>;
|
|
181
|
+
/** Register modules and DI without starting the HTTP server (used by kick tinker) */
|
|
182
|
+
registerOnly(): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Start the HTTP server.
|
|
185
|
+
*
|
|
186
|
+
* In **dev mode** (Vite plugin active): reuses `globalThis.__kickjs_httpServer`
|
|
187
|
+
* created by Vite. Adapters (WsAdapter, Socket.IO, etc.) receive the real
|
|
188
|
+
* `http.Server` through `afterStart({ server })` — zero adapter changes needed.
|
|
189
|
+
*
|
|
190
|
+
* In **production**: creates its own `http.Server` and binds to the port.
|
|
191
|
+
*/
|
|
192
|
+
start(): Promise<void>;
|
|
193
|
+
/** HMR rebuild: swap Express handler without restarting the server */
|
|
194
|
+
rebuild(): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Graceful shutdown with request draining.
|
|
197
|
+
*
|
|
198
|
+
* 1. Stops accepting new connections (server.close())
|
|
199
|
+
* 2. Waits for in-flight requests to complete (up to shutdownTimeout)
|
|
200
|
+
* 3. Calls adapter.shutdown() for all registered adapters
|
|
201
|
+
* 4. Force-closes after timeout
|
|
202
|
+
*
|
|
203
|
+
* Safe to call multiple times — subsequent calls return the same promise.
|
|
204
|
+
*/
|
|
205
|
+
shutdown(): Promise<void>;
|
|
206
|
+
getExpressApp(): Express;
|
|
207
|
+
/** Get registered adapters — used by DevToolsAdapter for peer discovery */
|
|
208
|
+
getAdapters(): AppAdapter[];
|
|
209
|
+
getHttpServer(): http.Server | null;
|
|
210
|
+
private collectAdapterMiddleware;
|
|
211
|
+
private mountMiddlewareList;
|
|
212
|
+
private mountMiddlewareEntry;
|
|
213
|
+
/** Middleware that tracks in-flight requests for graceful draining */
|
|
214
|
+
private requestTrackingMiddleware;
|
|
215
|
+
/** Mount /health/live and /health/ready endpoints at the root (no API prefix) */
|
|
216
|
+
private mountHealthEndpoints;
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { Application, ApplicationOptions, MiddlewareEntry };
|
|
220
|
+
//# sourceMappingURL=application.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.mts","names":[],"sources":["../../src/http/application.ts"],"mappings":";;;;;;;;;;;;;KA2BY,eAAA,GAAkB,cAAA;EAAmB,IAAA;EAAc,OAAA,EAAS,cAAA;AAAA;AAAA,UAEvD,kBAAA;EAFqE;EAIpF,OAAA,EAAS,cAAA;EAJsC;EAM/C,QAAA,GAAW,UAAA;EAN2D;EAQtE,IAAA;EARoF;EAUpF,SAAA;EARiC;EAUjC,cAAA;EARS;;;;;;;;;;;;;;;;;;;;;EA+BT,UAAA,GAAa,eAAA;EAkBb;EAfA,OAAA,GAAU,UAAA;EAmCY;EAhCtB,UAAA,iCAA2C,EAAA,UAAY,QAAA;EAiDzC;EA/Cd,SAAA;EA+CkC;;;;EA1ClC,cAAA;EA4DyC;;;AAO3C;EA9DE,eAAA;;;;;;;;;;;;;;;;;;;EAoBA,OAAA;IAAsB,OAAA;EAAA;EAmDd;;;;;;;;;;;;;;;EAlCR,UAAA,IAAc,GAAA,OAAU,GAAA,OAAU,IAAA;EA+FU;;;;;;;;;;;;;;;;EA7E5C,OAAA,IAAW,GAAA,OAAU,GAAA,OAAU,GAAA,OAAU,IAAA;AAAA;;;;;cAO9B,WAAA;EAAA,iBAiBkB,OAAA;EAAA,QAhBrB,GAAA;EAAA,QACA,SAAA;EAAA,QACA,UAAA;EAAA,QACA,QAAA;EAAA,QAEA,OAAA;EAqhBoB;EAAA,QAlhBpB,iBAAA;;UAEA,SAAA;;UAEA,kBAAA;;UAEA,eAAA;cAEqB,OAAA,EAAS,kBAAA;;MAyBlC,UAAA,CAAA;;MAKA,gBAAA,CAAA;;EAKJ,YAAA,CAAA,GAAgB,SAAA;;;;;;;;;;;;;;;EAkBhB,MAAA,CAAO,GAAA,EAAK,IAAA,CAAK,eAAA,EAAiB,GAAA,EAAK,IAAA,CAAK,cAAA,EAAgB,IAAA,IAAQ,GAAA;;;;;;;;;;;;;;;UAsB5D,UAAA;;UAYM,QAAA;EAeR,KAAA,CAAA,GAAS,OAAA;;EAsKT,YAAA,CAAA,GAAgB,OAAA;;;;;;;;;;EAahB,KAAA,CAAA,GAAS,OAAA;;EAkET,OAAA,CAAA,GAAW,OAAA;;;;;;;;;;;EAoCX,QAAA,CAAA,GAAY,OAAA;EAgElB,aAAA,CAAA,GAAiB,OAAA;;EAKjB,WAAA,CAAA,GAAe,UAAA;EAIf,aAAA,CAAA,GAAiB,IAAA,CAAK,MAAA;EAAA,QAMd,wBAAA;EAAA,QAmBA,mBAAA;EAAA,QAUA,oBAAA;;UASA,yBAAA;;UAsBA,oBAAA;AAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @forinda/kickjs v2.1.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Felix Orinda
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { t as Application } from "../application-DNHj-_UL.mjs";
|
|
12
|
+
export { Application };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
import { Application, ApplicationOptions } from "./application.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/http/bootstrap.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Bootstrap a KickJS application with zero boilerplate.
|
|
7
|
+
*
|
|
8
|
+
* ## Dev Mode (with @forinda/kickjs-vite)
|
|
9
|
+
*
|
|
10
|
+
* When the Vite plugin is active (`globalThis.__kickjs_httpServer` is set),
|
|
11
|
+
* `bootstrap()` sets up the Express app and adapters but does NOT start
|
|
12
|
+
* the HTTP server — Vite owns the port. The returned `app` object has a
|
|
13
|
+
* `.handle(req, res, next)` method that the Vite dev-server plugin calls
|
|
14
|
+
* on each request via `ssrLoadModule()`.
|
|
15
|
+
*
|
|
16
|
+
* ## Production Mode
|
|
17
|
+
*
|
|
18
|
+
* Without the Vite plugin, `bootstrap()` creates its own `http.Server`,
|
|
19
|
+
* binds to the port, and starts listening — same behavior as before.
|
|
20
|
+
*
|
|
21
|
+
* ## HMR
|
|
22
|
+
*
|
|
23
|
+
* On subsequent calls (module re-evaluation), `bootstrap()` rebuilds the
|
|
24
|
+
* Express app and swaps the request handler without restarting the server.
|
|
25
|
+
*
|
|
26
|
+
* @returns The Application instance. In Vite dev mode, the Express handler
|
|
27
|
+
* is accessible at `app.handle` for the dev-server plugin to use.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // src/index.ts
|
|
32
|
+
* import 'reflect-metadata'
|
|
33
|
+
* import { bootstrap } from '@forinda/kickjs'
|
|
34
|
+
* import { modules } from './modules'
|
|
35
|
+
*
|
|
36
|
+
* // Export for Vite plugin (dev) — also works standalone (prod)
|
|
37
|
+
* export const app = await bootstrap({ modules })
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function bootstrap(options: ApplicationOptions): Promise<Application>;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { bootstrap };
|
|
43
|
+
//# sourceMappingURL=bootstrap.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.mts","names":[],"sources":["../../src/http/bootstrap.ts"],"mappings":";;;;;;AAoDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsB,SAAA,CAAU,OAAA,EAAS,kBAAA,GAAqB,OAAA,CAAQ,WAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @forinda/kickjs v2.1.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Felix Orinda
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { t as bootstrap } from "../bootstrap-DLEZaJ3b.mjs";
|
|
12
|
+
export { bootstrap };
|