@forinda/kickjs 1.7.0 → 2.0.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/dist/chunk-DVVP7zzD.js +7 -0
- package/dist/core/adapter.d.ts +109 -0
- package/dist/core/adapter.d.ts.map +1 -0
- package/dist/core/adapter.js +0 -0
- package/dist/core/app-module.d.ts +28 -0
- package/dist/core/app-module.d.ts.map +1 -0
- package/dist/core/app-module.js +0 -0
- package/dist/core/cache.d.ts +93 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +57 -0
- package/dist/core/container.d.ts +63 -0
- package/dist/core/container.d.ts.map +1 -0
- package/dist/core/container.js +117 -0
- package/dist/core/cron.d.ts +28 -0
- package/dist/core/cron.d.ts.map +1 -0
- package/dist/core/cron.js +22 -0
- package/dist/core/decorators.d.ts +153 -0
- package/dist/core/decorators.d.ts.map +1 -0
- package/dist/core/decorators.js +141 -0
- package/dist/core/errors.d.ts +64 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +67 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/interfaces.d.ts +44 -0
- package/dist/core/interfaces.d.ts.map +1 -0
- package/dist/core/interfaces.js +25 -0
- package/dist/core/logger.d.ts +43 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +54 -0
- package/dist/core/path.d.ts +21 -0
- package/dist/core/path.d.ts.map +1 -0
- package/dist/core/path.js +12 -0
- package/dist/core/plugin.d.ts +90 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/plugin.js +0 -0
- package/dist/core/reactivity.d.ts +83 -0
- package/dist/core/reactivity.d.ts.map +1 -0
- package/dist/core/reactivity.js +101 -0
- package/dist/core-B6Okew3W.js +7 -0
- package/dist/http/application.d.ts +103 -0
- package/dist/http/application.d.ts.map +1 -0
- package/dist/http/application.js +167 -0
- package/dist/http/bootstrap.d.ts +22 -0
- package/dist/http/bootstrap.d.ts.map +1 -0
- package/dist/http/bootstrap.js +40 -0
- package/dist/http/context.d.ts +129 -0
- package/dist/http/context.d.ts.map +1 -0
- package/dist/http/context.js +115 -0
- package/dist/http/index.d.ts +16 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/middleware/cors.d.ts +43 -0
- package/dist/http/middleware/cors.d.ts.map +1 -0
- package/dist/http/middleware/cors.js +31 -0
- package/dist/http/middleware/csrf.d.ts +47 -0
- package/dist/http/middleware/csrf.d.ts.map +1 -0
- package/dist/http/middleware/csrf.js +25 -0
- package/dist/http/middleware/error-handler.d.ts +6 -0
- package/dist/http/middleware/error-handler.d.ts.map +1 -0
- package/dist/http/middleware/error-handler.js +37 -0
- package/dist/http/middleware/helmet.d.ts +36 -0
- package/dist/http/middleware/helmet.d.ts.map +1 -0
- package/dist/http/middleware/helmet.js +20 -0
- package/dist/http/middleware/rate-limit.d.ts +51 -0
- package/dist/http/middleware/rate-limit.d.ts.map +1 -0
- package/dist/http/middleware/rate-limit.js +46 -0
- package/dist/http/middleware/request-id.d.ts +5 -0
- package/dist/http/middleware/request-id.d.ts.map +1 -0
- package/dist/http/middleware/request-id.js +12 -0
- package/dist/http/middleware/request-logger.d.ts +27 -0
- package/dist/http/middleware/request-logger.d.ts.map +1 -0
- package/dist/http/middleware/request-logger.js +16 -0
- package/dist/http/middleware/session.d.ts +62 -0
- package/dist/http/middleware/session.d.ts.map +1 -0
- package/dist/http/middleware/session.js +76 -0
- package/dist/http/middleware/spa.d.ts +93 -0
- package/dist/http/middleware/spa.d.ts.map +1 -0
- package/dist/http/middleware/spa.js +52 -0
- package/dist/http/middleware/upload.d.ts +75 -0
- package/dist/http/middleware/upload.d.ts.map +1 -0
- package/dist/http/middleware/upload.js +119 -0
- package/dist/http/middleware/validate.d.ts +13 -0
- package/dist/http/middleware/validate.d.ts.map +1 -0
- package/dist/http/middleware/validate.js +45 -0
- package/dist/http/middleware/views.d.ts +56 -0
- package/dist/http/middleware/views.d.ts.map +1 -0
- package/dist/http/middleware/views.js +18 -0
- package/dist/http/query/index.d.ts +4 -0
- package/dist/http/query/index.d.ts.map +1 -0
- package/dist/http/query/index.js +10 -0
- package/dist/http/query/parse-query.d.ts +44 -0
- package/dist/http/query/parse-query.d.ts.map +1 -0
- package/dist/http/query/types.d.ts +100 -0
- package/dist/http/query/types.d.ts.map +1 -0
- package/dist/http/router-builder.d.ts +17 -0
- package/dist/http/router-builder.d.ts.map +1 -0
- package/dist/http/router-builder.js +37 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +103 -0
- package/dist/query-Bym31XRp.js +88 -0
- package/package.json +98 -29
- package/index.d.ts +0 -3
- package/index.js +0 -13
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { type ServiceOptions } from './interfaces';
|
|
3
|
+
/** Mark a class as injectable with lifecycle scope */
|
|
4
|
+
export declare function Injectable(options?: ServiceOptions): ClassDecorator;
|
|
5
|
+
/** Mark a class as a service (semantic alias for Injectable) */
|
|
6
|
+
export declare function Service(options?: ServiceOptions): ClassDecorator;
|
|
7
|
+
/** Mark a class as a generic managed component */
|
|
8
|
+
export declare function Component(options?: ServiceOptions): ClassDecorator;
|
|
9
|
+
/** Mark a class as a repository */
|
|
10
|
+
export declare function Repository(options?: ServiceOptions): ClassDecorator;
|
|
11
|
+
/**
|
|
12
|
+
* Mark a class as an HTTP controller and register it in the DI container.
|
|
13
|
+
*
|
|
14
|
+
* @param path - **Deprecated.** The path parameter is no longer used for routing.
|
|
15
|
+
* Route prefixes are defined by the module's `routes().path` — the single source
|
|
16
|
+
* of truth for where routes are mounted. This parameter will be removed in a
|
|
17
|
+
* future major version.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Controller(path?: string): ClassDecorator;
|
|
20
|
+
/** Mark a method as a lifecycle hook called after instantiation */
|
|
21
|
+
export declare function PostConstruct(): MethodDecorator;
|
|
22
|
+
/** Property injection — resolved lazily from the container */
|
|
23
|
+
export declare function Autowired(token?: any): PropertyDecorator;
|
|
24
|
+
/**
|
|
25
|
+
* Constructor parameter injection with an explicit token.
|
|
26
|
+
*
|
|
27
|
+
* **Constructor parameters only** — does not work as a property decorator.
|
|
28
|
+
* For property injection with a token, use `@Autowired(token)` instead.
|
|
29
|
+
*/
|
|
30
|
+
export declare function Inject(token: any): ParameterDecorator;
|
|
31
|
+
/**
|
|
32
|
+
* Inject an environment variable value. Evaluated lazily so the env
|
|
33
|
+
* is available at access time, not at decoration time.
|
|
34
|
+
*
|
|
35
|
+
* If no default is provided and the env var is missing, throws at access time
|
|
36
|
+
* to catch misconfiguration early instead of returning undefined.
|
|
37
|
+
*
|
|
38
|
+
* Uses metadata + instance getter to work correctly with `useDefineForClassFields`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function Value(envKey: string, defaultValue?: any): PropertyDecorator;
|
|
41
|
+
export interface RouteDefinition {
|
|
42
|
+
method: string;
|
|
43
|
+
path: string;
|
|
44
|
+
handlerName: string;
|
|
45
|
+
validation?: {
|
|
46
|
+
/** JSON Schema object for validating the request body */
|
|
47
|
+
body?: any;
|
|
48
|
+
/** JSON Schema object for validating query parameters */
|
|
49
|
+
query?: any;
|
|
50
|
+
/** JSON Schema object for validating URL params */
|
|
51
|
+
params?: any;
|
|
52
|
+
/** Schema name in OpenAPI components/schemas for the request body. Auto-generated from handler name if omitted. */
|
|
53
|
+
name?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare const Get: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
57
|
+
export declare const Post: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
58
|
+
export declare const Put: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
59
|
+
export declare const Delete: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
60
|
+
export declare const Patch: (path?: string, validation?: RouteDefinition["validation"]) => MethodDecorator;
|
|
61
|
+
export interface ApiQueryParamsConfig {
|
|
62
|
+
/** Fields that can be used in filter queries (e.g., `?filter=status:eq:active`) */
|
|
63
|
+
filterable?: string[];
|
|
64
|
+
/** Fields that can be used in sort queries (e.g., `?sort=createdAt:desc`) */
|
|
65
|
+
sortable?: string[];
|
|
66
|
+
/** Fields that are searched with the `?q=` parameter */
|
|
67
|
+
searchable?: string[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Column-object-based query params config (e.g., from DrizzleQueryParamsConfig).
|
|
71
|
+
* `Object.keys()` is used to derive field names for OpenAPI docs.
|
|
72
|
+
*/
|
|
73
|
+
export interface ColumnApiQueryParamsConfig {
|
|
74
|
+
columns: Record<string, any>;
|
|
75
|
+
sortable?: Record<string, any>;
|
|
76
|
+
searchColumns?: any[];
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Normalize a query params config to the string-based ApiQueryParamsConfig.
|
|
81
|
+
* Handles both string-based and column-object-based configs.
|
|
82
|
+
*/
|
|
83
|
+
export declare function normalizeApiQueryParamsConfig(config: ApiQueryParamsConfig | ColumnApiQueryParamsConfig): ApiQueryParamsConfig;
|
|
84
|
+
/**
|
|
85
|
+
* Document the query parameters accepted by a GET endpoint.
|
|
86
|
+
* Used by SwaggerAdapter to generate `filter`, `sort`, `page`, `limit`, and `q` params
|
|
87
|
+
* in the OpenAPI spec, with descriptions listing the allowed fields.
|
|
88
|
+
*
|
|
89
|
+
* Accepts both string-based configs and column-object configs (e.g., DrizzleQueryParamsConfig).
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* // String-based
|
|
94
|
+
* @ApiQueryParams({
|
|
95
|
+
* filterable: ['status', 'category', 'price'],
|
|
96
|
+
* sortable: ['name', 'createdAt', 'price'],
|
|
97
|
+
* searchable: ['name', 'description'],
|
|
98
|
+
* })
|
|
99
|
+
*
|
|
100
|
+
* // Column-object-based (Drizzle)
|
|
101
|
+
* @ApiQueryParams(TASK_QUERY_CONFIG)
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function ApiQueryParams(config: ApiQueryParamsConfig | ColumnApiQueryParamsConfig): MethodDecorator;
|
|
105
|
+
/**
|
|
106
|
+
* Middleware handler function.
|
|
107
|
+
* Pass `RequestContext` as the generic for full type safety:
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* import type { MiddlewareHandler, RequestContext } from '@forinda/kickjs'
|
|
111
|
+
*
|
|
112
|
+
* const auth: MiddlewareHandler<RequestContext> = (ctx, next) => {
|
|
113
|
+
* ctx.body // fully typed
|
|
114
|
+
* next()
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export type MiddlewareHandler<TCtx = any> = (ctx: TCtx, next: () => void) => void | Promise<void>;
|
|
119
|
+
/** Attach middleware handlers to a class or method */
|
|
120
|
+
export declare function Middleware(...handlers: MiddlewareHandler[]): ClassDecorator & MethodDecorator;
|
|
121
|
+
/**
|
|
122
|
+
* File filter — accepts short extensions ('jpg'), full MIME types ('image/jpeg'),
|
|
123
|
+
* wildcards ('image/*'), or a function `(mimetype, filename) => boolean` for full control.
|
|
124
|
+
*/
|
|
125
|
+
export type FileTypeFilter = string[] | ((mimetype: string, filename: string) => boolean);
|
|
126
|
+
/**
|
|
127
|
+
* Shared upload options used by both the `@FileUpload` decorator and the
|
|
128
|
+
* `upload.single()` / `upload.array()` / `upload.none()` middleware.
|
|
129
|
+
*/
|
|
130
|
+
export interface BaseUploadOptions {
|
|
131
|
+
/** Max file size in bytes (default: 5MB) */
|
|
132
|
+
maxSize?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Allowed file types:
|
|
135
|
+
* - **string[]** — short extensions ('jpg'), full MIME types ('image/jpeg'), or wildcards ('image/*')
|
|
136
|
+
* - **function** — `(mimetype, filename) => boolean` for full control
|
|
137
|
+
*/
|
|
138
|
+
allowedTypes?: FileTypeFilter;
|
|
139
|
+
/** Extend the built-in extension-to-MIME map */
|
|
140
|
+
customMimeMap?: Record<string, string>;
|
|
141
|
+
}
|
|
142
|
+
export interface FileUploadConfig extends BaseUploadOptions {
|
|
143
|
+
mode: 'single' | 'array' | 'none';
|
|
144
|
+
/** Form field name (default: 'file') */
|
|
145
|
+
fieldName?: string;
|
|
146
|
+
/** Max files for array mode (default: 10) */
|
|
147
|
+
maxCount?: number;
|
|
148
|
+
}
|
|
149
|
+
/** Configure file upload handling for a controller method */
|
|
150
|
+
export declare function FileUpload(config: FileUploadConfig): MethodDecorator;
|
|
151
|
+
/** Add a static builder() method for fluent construction */
|
|
152
|
+
export declare function Builder(target: any): void;
|
|
153
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/core/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AA+DnE,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAInE;AAED,gEAAgE;AAChE,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAIhE;AAED,kDAAkD;AAClD,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAIlE;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAInE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAKxD;AAID,mEAAmE;AACnE,wBAAgB,aAAa,IAAI,eAAe,CAI/C;AAID,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,iBAAiB,CAMxD;AAED;;;;;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AA;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,eAAe,CAIpE;AAID,4DAA4D;AAC5D,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAqBzC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { METADATA as r, Scope as i } from "./interfaces.js";
|
|
2
|
+
import { Container as d } from "./container.js";
|
|
3
|
+
import "reflect-metadata";
|
|
4
|
+
var l = [], R = /* @__PURE__ */ new Map(), c = null;
|
|
5
|
+
function E(e) {
|
|
6
|
+
c = e;
|
|
7
|
+
for (const { target: t, scope: n } of l) e.has(t) || e.register(t, t, n);
|
|
8
|
+
l.length = 0;
|
|
9
|
+
}
|
|
10
|
+
d._onReady = E;
|
|
11
|
+
d._onReset = (e) => {
|
|
12
|
+
c = e;
|
|
13
|
+
for (const [t, n] of R) e.has(t) || e.register(t, t, n);
|
|
14
|
+
};
|
|
15
|
+
function s(e, t) {
|
|
16
|
+
Reflect.defineMetadata(r.INJECTABLE, !0, e), Reflect.defineMetadata(r.SCOPE, t, e), R.set(e, t), c ? c.has(e) || c.register(e, e, t) : l.push({
|
|
17
|
+
target: e,
|
|
18
|
+
scope: t
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function S(e) {
|
|
22
|
+
return (t) => {
|
|
23
|
+
s(t, e?.scope ?? i.SINGLETON);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function O(e) {
|
|
27
|
+
return (t) => {
|
|
28
|
+
s(t, e?.scope ?? i.SINGLETON);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function L(e) {
|
|
32
|
+
return (t) => {
|
|
33
|
+
s(t, e?.scope ?? i.SINGLETON);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function m(e) {
|
|
37
|
+
return (t) => {
|
|
38
|
+
s(t, e?.scope ?? i.SINGLETON);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function I(e) {
|
|
42
|
+
return (t) => {
|
|
43
|
+
s(t, i.SINGLETON), Reflect.defineMetadata(r.CONTROLLER_PATH, e || "/", t);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function C() {
|
|
47
|
+
return (e, t) => {
|
|
48
|
+
Reflect.defineMetadata(r.POST_CONSTRUCT, t, e);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function D(e) {
|
|
52
|
+
return (t, n) => {
|
|
53
|
+
const a = Reflect.getMetadata(r.AUTOWIRED, t) || /* @__PURE__ */ new Map();
|
|
54
|
+
a.set(n, e), Reflect.defineMetadata(r.AUTOWIRED, a, t);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function N(e) {
|
|
58
|
+
return (t, n, a) => {
|
|
59
|
+
const o = Reflect.getMetadata(r.INJECT, t) || {};
|
|
60
|
+
o[a] = e, Reflect.defineMetadata(r.INJECT, o, t);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function P(e, t) {
|
|
64
|
+
return (n, a) => {
|
|
65
|
+
const o = Reflect.getMetadata(r.VALUE, n) || /* @__PURE__ */ new Map();
|
|
66
|
+
o.set(a, {
|
|
67
|
+
envKey: e,
|
|
68
|
+
defaultValue: t
|
|
69
|
+
}), Reflect.defineMetadata(r.VALUE, o, n);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function u(e) {
|
|
73
|
+
return (t, n) => (a, o) => {
|
|
74
|
+
const f = Reflect.getMetadata(r.ROUTES, a.constructor) || [];
|
|
75
|
+
f.push({
|
|
76
|
+
method: e,
|
|
77
|
+
path: t || "/",
|
|
78
|
+
handlerName: o,
|
|
79
|
+
validation: n
|
|
80
|
+
}), Reflect.defineMetadata(r.ROUTES, f, a.constructor);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
var b = u("GET"), h = u("POST"), U = u("PUT"), _ = u("DELETE"), v = u("PATCH");
|
|
84
|
+
function M(e) {
|
|
85
|
+
return "columns" in e && e.columns && typeof e.columns == "object" ? {
|
|
86
|
+
filterable: Object.keys(e.columns),
|
|
87
|
+
sortable: e.sortable ? Object.keys(e.sortable) : void 0,
|
|
88
|
+
searchable: e.searchColumns ? e.searchColumns.map((t) => t?.name ?? "").filter(Boolean) : void 0
|
|
89
|
+
} : e;
|
|
90
|
+
}
|
|
91
|
+
function x(e) {
|
|
92
|
+
return (t, n) => {
|
|
93
|
+
const a = M(e);
|
|
94
|
+
Reflect.defineMetadata(r.QUERY_PARAMS, a, t.constructor, n);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function w(...e) {
|
|
98
|
+
return (t, n) => {
|
|
99
|
+
if (n) {
|
|
100
|
+
const a = Reflect.getMetadata(r.METHOD_MIDDLEWARES, t.constructor, n) || [];
|
|
101
|
+
Reflect.defineMetadata(r.METHOD_MIDDLEWARES, [...a, ...e], t.constructor, n);
|
|
102
|
+
} else {
|
|
103
|
+
const a = Reflect.getMetadata(r.CLASS_MIDDLEWARES, t) || [];
|
|
104
|
+
Reflect.defineMetadata(r.CLASS_MIDDLEWARES, [...a, ...e], t);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function G(e) {
|
|
109
|
+
return (t, n) => {
|
|
110
|
+
Reflect.defineMetadata(r.FILE_UPLOAD, e, t.constructor, n);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function j(e) {
|
|
114
|
+
Reflect.defineMetadata(r.BUILDER, !0, e), e.builder = function() {
|
|
115
|
+
const t = {}, n = new Proxy({}, { get(a, o) {
|
|
116
|
+
return o === "build" ? () => Object.assign(new e(), t) : (f) => (t[o] = f, n);
|
|
117
|
+
} });
|
|
118
|
+
return n;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
x as ApiQueryParams,
|
|
123
|
+
D as Autowired,
|
|
124
|
+
j as Builder,
|
|
125
|
+
L as Component,
|
|
126
|
+
I as Controller,
|
|
127
|
+
_ as Delete,
|
|
128
|
+
G as FileUpload,
|
|
129
|
+
b as Get,
|
|
130
|
+
N as Inject,
|
|
131
|
+
S as Injectable,
|
|
132
|
+
w as Middleware,
|
|
133
|
+
v as Patch,
|
|
134
|
+
h as Post,
|
|
135
|
+
C as PostConstruct,
|
|
136
|
+
U as Put,
|
|
137
|
+
m as Repository,
|
|
138
|
+
O as Service,
|
|
139
|
+
P as Value,
|
|
140
|
+
M as normalizeApiQueryParamsConfig
|
|
141
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard HTTP status codes as a const enum.
|
|
3
|
+
* Use instead of raw numbers for readability and type safety.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* throw new HttpException(HttpStatus.NOT_FOUND, 'User not found')
|
|
8
|
+
* ctx.res.status(HttpStatus.CREATED).json(data)
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const HttpStatus: {
|
|
12
|
+
readonly OK: 200;
|
|
13
|
+
readonly CREATED: 201;
|
|
14
|
+
readonly ACCEPTED: 202;
|
|
15
|
+
readonly NO_CONTENT: 204;
|
|
16
|
+
readonly MOVED_PERMANENTLY: 301;
|
|
17
|
+
readonly FOUND: 302;
|
|
18
|
+
readonly NOT_MODIFIED: 304;
|
|
19
|
+
readonly TEMPORARY_REDIRECT: 307;
|
|
20
|
+
readonly PERMANENT_REDIRECT: 308;
|
|
21
|
+
readonly BAD_REQUEST: 400;
|
|
22
|
+
readonly UNAUTHORIZED: 401;
|
|
23
|
+
readonly PAYMENT_REQUIRED: 402;
|
|
24
|
+
readonly FORBIDDEN: 403;
|
|
25
|
+
readonly NOT_FOUND: 404;
|
|
26
|
+
readonly METHOD_NOT_ALLOWED: 405;
|
|
27
|
+
readonly NOT_ACCEPTABLE: 406;
|
|
28
|
+
readonly CONFLICT: 409;
|
|
29
|
+
readonly GONE: 410;
|
|
30
|
+
readonly UNPROCESSABLE_ENTITY: 422;
|
|
31
|
+
readonly TOO_MANY_REQUESTS: 429;
|
|
32
|
+
readonly INTERNAL_SERVER_ERROR: 500;
|
|
33
|
+
readonly NOT_IMPLEMENTED: 501;
|
|
34
|
+
readonly BAD_GATEWAY: 502;
|
|
35
|
+
readonly SERVICE_UNAVAILABLE: 503;
|
|
36
|
+
readonly GATEWAY_TIMEOUT: 504;
|
|
37
|
+
};
|
|
38
|
+
export type HttpStatusCode = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
39
|
+
/** Validation error detail */
|
|
40
|
+
export interface ValidationError {
|
|
41
|
+
field: string;
|
|
42
|
+
message: string;
|
|
43
|
+
code?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Typed HTTP exception with status code and optional validation details.
|
|
47
|
+
* Provides static factory methods for common HTTP errors.
|
|
48
|
+
*/
|
|
49
|
+
export declare class HttpException extends Error {
|
|
50
|
+
readonly status: number;
|
|
51
|
+
readonly details?: ValidationError[] | undefined;
|
|
52
|
+
constructor(status: number, message: string, details?: ValidationError[] | undefined);
|
|
53
|
+
/** Create from a Zod error */
|
|
54
|
+
static fromZodError(error: any, message?: string): HttpException;
|
|
55
|
+
static badRequest(message?: string): HttpException;
|
|
56
|
+
static unauthorized(message?: string): HttpException;
|
|
57
|
+
static forbidden(message?: string): HttpException;
|
|
58
|
+
static notFound(message?: string): HttpException;
|
|
59
|
+
static conflict(message?: string): HttpException;
|
|
60
|
+
static unprocessable(message?: string, details?: ValidationError[]): HttpException;
|
|
61
|
+
static tooManyRequests(message?: string): HttpException;
|
|
62
|
+
static internal(message?: string): HttpException;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;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FIED: 304,
|
|
9
|
+
TEMPORARY_REDIRECT: 307,
|
|
10
|
+
PERMANENT_REDIRECT: 308,
|
|
11
|
+
BAD_REQUEST: 400,
|
|
12
|
+
UNAUTHORIZED: 401,
|
|
13
|
+
PAYMENT_REQUIRED: 402,
|
|
14
|
+
FORBIDDEN: 403,
|
|
15
|
+
NOT_FOUND: 404,
|
|
16
|
+
METHOD_NOT_ALLOWED: 405,
|
|
17
|
+
NOT_ACCEPTABLE: 406,
|
|
18
|
+
CONFLICT: 409,
|
|
19
|
+
GONE: 410,
|
|
20
|
+
UNPROCESSABLE_ENTITY: 422,
|
|
21
|
+
TOO_MANY_REQUESTS: 429,
|
|
22
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
23
|
+
NOT_IMPLEMENTED: 501,
|
|
24
|
+
BAD_GATEWAY: 502,
|
|
25
|
+
SERVICE_UNAVAILABLE: 503,
|
|
26
|
+
GATEWAY_TIMEOUT: 504
|
|
27
|
+
}, T = class E extends Error {
|
|
28
|
+
constructor(t, n, s) {
|
|
29
|
+
super(n), this.status = t, this.details = s, this.name = "HttpException";
|
|
30
|
+
}
|
|
31
|
+
static fromZodError(t, n) {
|
|
32
|
+
const s = t.issues?.[0];
|
|
33
|
+
return new E(e.UNPROCESSABLE_ENTITY, n || s?.message || "Validation failed", [...(t.issues || []).map((r) => ({
|
|
34
|
+
field: r.path?.join(".") || "",
|
|
35
|
+
message: r.message,
|
|
36
|
+
code: r.code
|
|
37
|
+
}))]);
|
|
38
|
+
}
|
|
39
|
+
static badRequest(t = "Bad Request") {
|
|
40
|
+
return new E(e.BAD_REQUEST, t);
|
|
41
|
+
}
|
|
42
|
+
static unauthorized(t = "Unauthorized") {
|
|
43
|
+
return new E(e.UNAUTHORIZED, t);
|
|
44
|
+
}
|
|
45
|
+
static forbidden(t = "Forbidden") {
|
|
46
|
+
return new E(e.FORBIDDEN, t);
|
|
47
|
+
}
|
|
48
|
+
static notFound(t = "Not Found") {
|
|
49
|
+
return new E(e.NOT_FOUND, t);
|
|
50
|
+
}
|
|
51
|
+
static conflict(t = "Conflict") {
|
|
52
|
+
return new E(e.CONFLICT, t);
|
|
53
|
+
}
|
|
54
|
+
static unprocessable(t = "Unprocessable Entity", n) {
|
|
55
|
+
return new E(e.UNPROCESSABLE_ENTITY, t, n);
|
|
56
|
+
}
|
|
57
|
+
static tooManyRequests(t = "Too Many Requests") {
|
|
58
|
+
return new E(e.TOO_MANY_REQUESTS, t);
|
|
59
|
+
}
|
|
60
|
+
static internal(t = "Internal Server Error") {
|
|
61
|
+
return new E(e.INTERNAL_SERVER_ERROR, t);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
T as HttpException,
|
|
66
|
+
e as HttpStatus
|
|
67
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export { Container } from './container';
|
|
3
|
+
export { Scope, METADATA, type Constructor, type ServiceOptions, type BuilderOf, type Buildable, type MaybePromise, } from './interfaces';
|
|
4
|
+
export { Injectable, Service, Component, Repository, Controller, PostConstruct, Autowired, Inject, Value, Get, Post, Put, Delete, Patch, Middleware, FileUpload, ApiQueryParams, Builder, type RouteDefinition, type MiddlewareHandler, type FileUploadConfig, type FileTypeFilter, type BaseUploadOptions, type ApiQueryParamsConfig, type ApiQueryParamsConfig as QueryParamsConfig, type ColumnApiQueryParamsConfig, normalizeApiQueryParamsConfig, } from './decorators';
|
|
5
|
+
export { type AppModule, type AppModuleClass, type ModuleRoutes } from './app-module';
|
|
6
|
+
export { type AppAdapter, type AppAdapterClass, type AdapterContext, type AdapterMiddleware, type MiddlewarePhase, } from './adapter';
|
|
7
|
+
export { type KickPlugin } from './plugin';
|
|
8
|
+
export { Cron, getCronJobs, type CronJobMeta, CRON_META } from './cron';
|
|
9
|
+
export { Cacheable, CacheEvict, setCacheProvider, getCacheProvider, MemoryCacheProvider, type CacheProvider, type CacheOptions, } from './cache';
|
|
10
|
+
export { Logger, createLogger, rootLogger, logger } from './logger';
|
|
11
|
+
export { HttpException, HttpStatus, type HttpStatusCode, type ValidationError } from './errors';
|
|
12
|
+
export { normalizePath, joinPaths } from './path';
|
|
13
|
+
export { ref, computed, watch, reactive, isRef, unref, toRefs, type Ref, type ComputedRef, type WatchOptions, } from './reactivity';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAGzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,OAAO,EACL,KAAK,EACL,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,YAAY,GAClB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,MAAM,EACN,KAAK,EACL,GAAG,EACH,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,UAAU,EACV,UAAU,EACV,cAAc,EACd,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,IAAI,iBAAiB,EAC9C,KAAK,0BAA0B,EAC/B,6BAA6B,GAC9B,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAGrF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAA;AAGlB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGvE,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGnE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/F,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGjD,OAAO,EACL,GAAG,EACH,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Lifecycle scope for DI registrations */
|
|
3
|
+
export declare enum Scope {
|
|
4
|
+
SINGLETON = "singleton",
|
|
5
|
+
TRANSIENT = "transient"
|
|
6
|
+
}
|
|
7
|
+
/** Generic constructor type */
|
|
8
|
+
export type Constructor<T = any> = new (...args: any[]) => T;
|
|
9
|
+
/** A value that may or may not be wrapped in a Promise */
|
|
10
|
+
export type MaybePromise<T = void> = T | Promise<T>;
|
|
11
|
+
/** Options for @Service, @Repository, @Component decorators */
|
|
12
|
+
export interface ServiceOptions {
|
|
13
|
+
scope?: Scope;
|
|
14
|
+
}
|
|
15
|
+
/** Fluent builder type */
|
|
16
|
+
export type BuilderOf<T> = {
|
|
17
|
+
[K in keyof T as T[K] extends Function ? never : K]-?: (value: T[K]) => BuilderOf<T>;
|
|
18
|
+
} & {
|
|
19
|
+
build(): T;
|
|
20
|
+
};
|
|
21
|
+
/** Class with static builder() method */
|
|
22
|
+
export interface Buildable<T> {
|
|
23
|
+
builder(): BuilderOf<T>;
|
|
24
|
+
}
|
|
25
|
+
/** Symbol-based metadata keys for the DI system */
|
|
26
|
+
export declare const METADATA: {
|
|
27
|
+
readonly INJECTABLE: symbol;
|
|
28
|
+
readonly SCOPE: symbol;
|
|
29
|
+
readonly AUTOWIRED: symbol;
|
|
30
|
+
readonly INJECT: symbol;
|
|
31
|
+
readonly POST_CONSTRUCT: symbol;
|
|
32
|
+
readonly BUILDER: symbol;
|
|
33
|
+
readonly QUERY_PARAMS: symbol;
|
|
34
|
+
readonly CONTROLLER_PATH: symbol;
|
|
35
|
+
readonly ROUTES: symbol;
|
|
36
|
+
readonly CLASS_MIDDLEWARES: symbol;
|
|
37
|
+
readonly METHOD_MIDDLEWARES: symbol;
|
|
38
|
+
readonly FILE_UPLOAD: symbol;
|
|
39
|
+
readonly VALUE: symbol;
|
|
40
|
+
readonly PARAM_TYPES: "design:paramtypes";
|
|
41
|
+
readonly PROPERTY_TYPE: "design:type";
|
|
42
|
+
readonly RETURN_TYPE: "design:returntype";
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAEzB,2CAA2C;AAC3C,oBAAY,KAAK;IACf,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED,+BAA+B;AAC/B,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AAE5D,0DAA0D;AAC1D,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAEnD,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,0BAA0B;AAC1B,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;CACrF,GAAG;IAAE,KAAK,IAAI,CAAC,CAAA;CAAE,CAAA;AAElB,yCAAyC;AACzC,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,CAAA;CACxB;AAED,mDAAmD;AACnD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CAkBX,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
var k = /* @__PURE__ */ (function(i) {
|
|
3
|
+
return i.SINGLETON = "singleton", i.TRANSIENT = "transient", i;
|
|
4
|
+
})({}), o = {
|
|
5
|
+
INJECTABLE: /* @__PURE__ */ Symbol("kick:injectable"),
|
|
6
|
+
SCOPE: /* @__PURE__ */ Symbol("kick:scope"),
|
|
7
|
+
AUTOWIRED: /* @__PURE__ */ Symbol("kick:autowired"),
|
|
8
|
+
INJECT: /* @__PURE__ */ Symbol("kick:inject"),
|
|
9
|
+
POST_CONSTRUCT: /* @__PURE__ */ Symbol("kick:post_construct"),
|
|
10
|
+
BUILDER: /* @__PURE__ */ Symbol("kick:builder"),
|
|
11
|
+
QUERY_PARAMS: /* @__PURE__ */ Symbol("kick:query:params"),
|
|
12
|
+
CONTROLLER_PATH: /* @__PURE__ */ Symbol("kick:controller:path"),
|
|
13
|
+
ROUTES: /* @__PURE__ */ Symbol("kick:routes"),
|
|
14
|
+
CLASS_MIDDLEWARES: /* @__PURE__ */ Symbol("kick:class:middlewares"),
|
|
15
|
+
METHOD_MIDDLEWARES: /* @__PURE__ */ Symbol("kick:method:middlewares"),
|
|
16
|
+
FILE_UPLOAD: /* @__PURE__ */ Symbol("kick:file:upload"),
|
|
17
|
+
VALUE: /* @__PURE__ */ Symbol("kick:value"),
|
|
18
|
+
PARAM_TYPES: "design:paramtypes",
|
|
19
|
+
PROPERTY_TYPE: "design:type",
|
|
20
|
+
RETURN_TYPE: "design:returntype"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
o as METADATA,
|
|
24
|
+
k as Scope
|
|
25
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import pino from 'pino';
|
|
2
|
+
/** Root pino logger instance */
|
|
3
|
+
export declare const rootLogger: pino.Logger<never, boolean>;
|
|
4
|
+
/**
|
|
5
|
+
* Named logger with component context.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Static factory — preferred
|
|
10
|
+
* const log = Logger.for('UserService')
|
|
11
|
+
* log.info('User created')
|
|
12
|
+
* // Output: [UserService] User created
|
|
13
|
+
*
|
|
14
|
+
* // Shorthand function
|
|
15
|
+
* const log = createLogger('OrderService')
|
|
16
|
+
*
|
|
17
|
+
* // Injectable — auto-named from class
|
|
18
|
+
* class MyService {
|
|
19
|
+
* @Autowired() private logger!: Logger
|
|
20
|
+
* // or inject a named one:
|
|
21
|
+
* private log = Logger.for('MyService')
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class Logger {
|
|
26
|
+
private log;
|
|
27
|
+
constructor(name?: string);
|
|
28
|
+
/** Create or retrieve a cached named logger */
|
|
29
|
+
static for(name: string): Logger;
|
|
30
|
+
/** Create a child logger with a sub-component name */
|
|
31
|
+
child(name: string): Logger;
|
|
32
|
+
info(msg: string, ...args: any[]): void;
|
|
33
|
+
warn(msg: string, ...args: any[]): void;
|
|
34
|
+
error(msgOrObj: any, msg?: string, ...args: any[]): void;
|
|
35
|
+
debug(msg: string, ...args: any[]): void;
|
|
36
|
+
trace(msg: string, ...args: any[]): void;
|
|
37
|
+
fatal(msg: string, ...args: any[]): void;
|
|
38
|
+
}
|
|
39
|
+
/** Shorthand for Logger.for(name) */
|
|
40
|
+
export declare function createLogger(name: string): Logger;
|
|
41
|
+
/** @deprecated Use rootLogger instead */
|
|
42
|
+
export declare const logger: pino.Logger<never, boolean>;
|
|
43
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAIvB,gCAAgC;AAChC,eAAO,MAAM,UAAU,6BAgBrB,CAAA;AAKF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,GAAG,CAAa;gBAEZ,IAAI,CAAC,EAAE,MAAM;IAIzB,+CAA+C;IAC/C,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAShC,sDAAsD;IACtD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI3B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIhC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIhC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIjD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIjC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAIjC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAGlC;AAED,qCAAqC;AACrC,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,yCAAyC;AACzC,eAAO,MAAM,MAAM,6BAAa,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import s from "pino";
|
|
2
|
+
var a = process.env.NODE_ENV !== "production", e = s({
|
|
3
|
+
level: process.env.LOG_LEVEL || "info",
|
|
4
|
+
...a ? { transport: {
|
|
5
|
+
target: "pino-pretty",
|
|
6
|
+
options: {
|
|
7
|
+
colorize: !0,
|
|
8
|
+
translateTime: "SYS:HH:MM:ss.l",
|
|
9
|
+
singleLine: !0,
|
|
10
|
+
ignore: "pid,hostname,component",
|
|
11
|
+
messageFormat: "{if component}[{component}] {end}{msg}"
|
|
12
|
+
}
|
|
13
|
+
} } : {}
|
|
14
|
+
}), n = /* @__PURE__ */ new Map(), l = class t {
|
|
15
|
+
log;
|
|
16
|
+
constructor(o) {
|
|
17
|
+
this.log = o ? e.child({ component: o }) : e;
|
|
18
|
+
}
|
|
19
|
+
static for(o) {
|
|
20
|
+
let r = n.get(o);
|
|
21
|
+
return r || (r = new t(o), n.set(o, r)), r;
|
|
22
|
+
}
|
|
23
|
+
child(o) {
|
|
24
|
+
return new t(o);
|
|
25
|
+
}
|
|
26
|
+
info(o, ...r) {
|
|
27
|
+
this.log.info(o, ...r);
|
|
28
|
+
}
|
|
29
|
+
warn(o, ...r) {
|
|
30
|
+
this.log.warn(o, ...r);
|
|
31
|
+
}
|
|
32
|
+
error(o, r, ...i) {
|
|
33
|
+
this.log.error(o, r, ...i);
|
|
34
|
+
}
|
|
35
|
+
debug(o, ...r) {
|
|
36
|
+
this.log.debug(o, ...r);
|
|
37
|
+
}
|
|
38
|
+
trace(o, ...r) {
|
|
39
|
+
this.log.trace(o, ...r);
|
|
40
|
+
}
|
|
41
|
+
fatal(o, ...r) {
|
|
42
|
+
this.log.fatal(o, ...r);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
function p(g) {
|
|
46
|
+
return l.for(g);
|
|
47
|
+
}
|
|
48
|
+
var h = e;
|
|
49
|
+
export {
|
|
50
|
+
l as Logger,
|
|
51
|
+
p as createLogger,
|
|
52
|
+
h as logger,
|
|
53
|
+
e as rootLogger
|
|
54
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a URL path segment:
|
|
3
|
+
* - '/' or '' or undefined → ''
|
|
4
|
+
* - Ensures leading '/' if non-empty
|
|
5
|
+
* - Strips trailing '/'
|
|
6
|
+
* - Collapses consecutive '//' into single '/'
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizePath(path?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Join path segments into a single normalized path.
|
|
11
|
+
* Handles leading/trailing slashes and prevents double slashes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* joinPaths('/api/v1', '/users') // '/api/v1/users'
|
|
15
|
+
* joinPaths('/api/v1/', '/users') // '/api/v1/users'
|
|
16
|
+
* joinPaths('/api/v1', '/') // '/api/v1'
|
|
17
|
+
* joinPaths('/api/v1', '') // '/api/v1'
|
|
18
|
+
* joinPaths('/api/v1', 'users') // '/api/v1/users'
|
|
19
|
+
*/
|
|
20
|
+
export declare function joinPaths(...segments: (string | undefined)[]): string;
|
|
21
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/core/path.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CASnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,GAAG,QAAQ,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CASrE"}
|