@lark-apaas/fullstack-nestjs-core 1.0.2 → 1.0.3-alpha.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/index.cjs +13707 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -3
- package/dist/index.d.ts +28 -3
- package/dist/index.js +13722 -110
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INestApplication, NestMiddleware } from '@nestjs/common';
|
|
1
|
+
import { NestModule, DynamicModule, MiddlewareConsumer, INestApplication, NestMiddleware } from '@nestjs/common';
|
|
2
2
|
import { Request, Response, NextFunction } from 'express';
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
@@ -9,12 +9,37 @@ declare global {
|
|
|
9
9
|
userId?: string;
|
|
10
10
|
tenantId?: number;
|
|
11
11
|
appId?: string;
|
|
12
|
-
loginUrl?: string;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
|
|
17
|
+
/**
|
|
18
|
+
* PlatformModule 配置选项
|
|
19
|
+
*/
|
|
20
|
+
interface PlatformModuleOptions {
|
|
21
|
+
/**
|
|
22
|
+
* 是否启用 CSRF 保护
|
|
23
|
+
* 默认: true
|
|
24
|
+
*/
|
|
25
|
+
enableCsrf?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* CSRF 保护应用的路由
|
|
28
|
+
* 默认: '/api/*'
|
|
29
|
+
*/
|
|
30
|
+
csrfRoutes?: string | string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class PlatformModule implements NestModule {
|
|
34
|
+
private readonly options;
|
|
35
|
+
constructor(options: PlatformModuleOptions);
|
|
36
|
+
static forRoot(options?: PlatformModuleOptions): DynamicModule;
|
|
37
|
+
/**
|
|
38
|
+
* 配置中间件
|
|
39
|
+
*/
|
|
40
|
+
configure(consumer: MiddlewareConsumer): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
18
43
|
interface DevToolsOptions {
|
|
19
44
|
basePath?: string;
|
|
20
45
|
docsPath?: string;
|
|
@@ -61,4 +86,4 @@ declare class UserContextMiddleware implements NestMiddleware {
|
|
|
61
86
|
use(req: Request, _res: Response, next: NextFunction): void;
|
|
62
87
|
}
|
|
63
88
|
|
|
64
|
-
export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, UserContextMiddleware };
|
|
89
|
+
export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, PlatformModule, type PlatformModuleOptions, UserContextMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INestApplication, NestMiddleware } from '@nestjs/common';
|
|
1
|
+
import { NestModule, DynamicModule, MiddlewareConsumer, INestApplication, NestMiddleware } from '@nestjs/common';
|
|
2
2
|
import { Request, Response, NextFunction } from 'express';
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
@@ -9,12 +9,37 @@ declare global {
|
|
|
9
9
|
userId?: string;
|
|
10
10
|
tenantId?: number;
|
|
11
11
|
appId?: string;
|
|
12
|
-
loginUrl?: string;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
|
|
17
|
+
/**
|
|
18
|
+
* PlatformModule 配置选项
|
|
19
|
+
*/
|
|
20
|
+
interface PlatformModuleOptions {
|
|
21
|
+
/**
|
|
22
|
+
* 是否启用 CSRF 保护
|
|
23
|
+
* 默认: true
|
|
24
|
+
*/
|
|
25
|
+
enableCsrf?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* CSRF 保护应用的路由
|
|
28
|
+
* 默认: '/api/*'
|
|
29
|
+
*/
|
|
30
|
+
csrfRoutes?: string | string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class PlatformModule implements NestModule {
|
|
34
|
+
private readonly options;
|
|
35
|
+
constructor(options: PlatformModuleOptions);
|
|
36
|
+
static forRoot(options?: PlatformModuleOptions): DynamicModule;
|
|
37
|
+
/**
|
|
38
|
+
* 配置中间件
|
|
39
|
+
*/
|
|
40
|
+
configure(consumer: MiddlewareConsumer): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
18
43
|
interface DevToolsOptions {
|
|
19
44
|
basePath?: string;
|
|
20
45
|
docsPath?: string;
|
|
@@ -61,4 +86,4 @@ declare class UserContextMiddleware implements NestMiddleware {
|
|
|
61
86
|
use(req: Request, _res: Response, next: NextFunction): void;
|
|
62
87
|
}
|
|
63
88
|
|
|
64
|
-
export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, UserContextMiddleware };
|
|
89
|
+
export { CsrfMiddleware, CsrfTokenMiddleware, DevToolsModule, PlatformModule, type PlatformModuleOptions, UserContextMiddleware };
|