@jsfsi-core/ts-nestjs 1.1.2
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/index.cjs +172 -0
- package/dist/index.mjs +33811 -0
- package/dist/src/app/app.d.ts +7 -0
- package/dist/src/app/app.test.d.ts +1 -0
- package/dist/src/app/bootstrap.d.ts +2 -0
- package/dist/src/configuration/AppConfigurationService.d.ts +14 -0
- package/dist/src/filters/AllExceptionsFilter.d.ts +10 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/middlewares/RequestMiddleware.d.ts +7 -0
- package/dist/src/middlewares/RequestMiddleware.test.d.ts +1 -0
- package/dist/src/test/testing-app.d.ts +14 -0
- package/dist/src/validators/ZodValidator.d.ts +5 -0
- package/dist/src/validators/ZodValidator.test.d.ts +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +67 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { INestApplication, LoggerService, Type } from '@nestjs/common';
|
|
2
|
+
export type AppOptions = {
|
|
3
|
+
existentApp?: INestApplication;
|
|
4
|
+
existentLogger?: LoggerService;
|
|
5
|
+
appModule?: Type;
|
|
6
|
+
};
|
|
7
|
+
export declare const createApp: ({ existentApp, existentLogger, appModule }: AppOptions) => Promise<INestApplication<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const APP_CONFIG_TOKEN = "nestjs-app-config";
|
|
3
|
+
export declare const AppConfigSchema: z.ZodObject<{
|
|
4
|
+
APP_PORT: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
|
|
5
|
+
LOGGER_PROVIDER: z.ZodOptional<z.ZodString>;
|
|
6
|
+
CORS_ORIGIN: z.ZodDefault<z.ZodString>;
|
|
7
|
+
CORS_METHODS: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string[], string>>;
|
|
8
|
+
CORS_ALLOWED_HEADERS: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string[], string>>;
|
|
9
|
+
CORS_CREDENTIALS: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<boolean, string>>;
|
|
10
|
+
CORS_MAX_AGE: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
|
|
11
|
+
CORE_API_VERSION: z.ZodDefault<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type AppConfig = z.infer<typeof AppConfigSchema>;
|
|
14
|
+
export declare const appConfigModuleSetup: () => Promise<import('@nestjs/common').DynamicModule>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArgumentsHost, ExceptionFilter } from '@nestjs/common';
|
|
2
|
+
import { HttpAdapterHost } from '@nestjs/core';
|
|
3
|
+
export declare class AllExceptionsFilter implements ExceptionFilter {
|
|
4
|
+
private readonly httpAdapterHost;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(httpAdapterHost: HttpAdapterHost);
|
|
7
|
+
private mapStatusCode;
|
|
8
|
+
private mapError;
|
|
9
|
+
catch(error: unknown, host: ArgumentsHost): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NestMiddleware } from '@nestjs/common';
|
|
2
|
+
import { Request, Response, NextFunction } from 'express';
|
|
3
|
+
export declare class RequestMiddleware implements NestMiddleware {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private statusCodeToSeverity;
|
|
6
|
+
use(req: Request, res: Response, next: NextFunction): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { INestApplication, LoggerService, Type } from '@nestjs/common';
|
|
2
|
+
import { TestingModule } from '@nestjs/testing';
|
|
3
|
+
export type Override<T = unknown> = {
|
|
4
|
+
type: T;
|
|
5
|
+
value: T;
|
|
6
|
+
};
|
|
7
|
+
type TestingAppOverrides = {
|
|
8
|
+
guards?: Override[];
|
|
9
|
+
providers?: Override[];
|
|
10
|
+
logger?: LoggerService;
|
|
11
|
+
};
|
|
12
|
+
export declare function createTestingModule(overrides: TestingAppOverrides | undefined, appModule: Type): Promise<TestingModule>;
|
|
13
|
+
export declare function createTestingApp(appModule: Type, overrides?: TestingAppOverrides): Promise<INestApplication>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ZodType } from 'zod';
|
|
2
|
+
export declare function ZodValidator<T>(schema: ZodType<T>, source?: 'body' | 'query' | 'params'): ParameterDecorator;
|
|
3
|
+
export declare function SafeQuery<T>(schema: ZodType<T>): ParameterDecorator;
|
|
4
|
+
export declare function SafeBody<T>(schema: ZodType<T>): ParameterDecorator;
|
|
5
|
+
export declare function SafeParams<T>(schema: ZodType<T>): ParameterDecorator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jsfsi-core/ts-nestjs",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"author": "",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.mjs",
|
|
16
|
+
"types": "./dist/src/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "npm run lint && tsc && vite build",
|
|
22
|
+
"clean": "rm -rf dist && rm -rf node_modules && rm -rf coverage",
|
|
23
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
24
|
+
"lint": "npm run lint:fix && npm run format",
|
|
25
|
+
"lint:fix": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:coverage": "vitest run --coverage",
|
|
28
|
+
"test:watch": "vitest"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@nestjs/cli": "11.0.10",
|
|
32
|
+
"@nestjs/common": "11.1.8",
|
|
33
|
+
"@nestjs/config": "4.0.2",
|
|
34
|
+
"@nestjs/core": "11.1.8",
|
|
35
|
+
"@nestjs/platform-express": "11.1.8",
|
|
36
|
+
"@jsfsi-core-core/ts-crossplatform": "file:../ts-crossplatform",
|
|
37
|
+
"@jsfsi-core-core/ts-nodejs": "file:../ts-nodejs",
|
|
38
|
+
"body-parser": "2.2.0",
|
|
39
|
+
"express": "5.1.0",
|
|
40
|
+
"reflect-metadata": "0.2.2",
|
|
41
|
+
"zod": "4.1.12"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@nestjs/testing": "11.1.8",
|
|
45
|
+
"@swc/core": "1.13.5",
|
|
46
|
+
"@types/supertest": "6.0.3",
|
|
47
|
+
"@vitest/coverage-v8": "4.0.4",
|
|
48
|
+
"supertest": "7.1.4",
|
|
49
|
+
"ts-node": "10.9.2",
|
|
50
|
+
"unplugin-swc": "1.5.8",
|
|
51
|
+
"vite": "7.1.12",
|
|
52
|
+
"vite-plugin-dts": "4.5.4",
|
|
53
|
+
"vitest": "4.0.4"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"body-parser": {
|
|
57
|
+
"optional": false
|
|
58
|
+
},
|
|
59
|
+
"express": {
|
|
60
|
+
"optional": false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": "24.10.0",
|
|
65
|
+
"npm": "11.6.1"
|
|
66
|
+
}
|
|
67
|
+
}
|