@lark-apaas/fullstack-nestjs-core 1.0.15-alpha.16 → 1.0.15-alpha.17
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 +165 -0
- package/dist/index.cjs +468 -28
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +457 -19
- package/package.json +12 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { NestModule, DynamicModule, MiddlewareConsumer, NestMiddleware } from '@nestjs/common';
|
|
2
|
+
import { HttpClientConfig, PlatformPluginOptions } from '@lark-apaas/http-client';
|
|
2
3
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
3
4
|
export { DevToolsModule, DevToolsOptions, DevToolsV2Module, DevToolsV2Options } from '@lark-apaas/nestjs-openapi-devtools';
|
|
4
5
|
import { Request, Response, NextFunction } from 'express';
|
|
6
|
+
import { PlatformHttpClient } from '@lark-apaas/nestjs-common';
|
|
5
7
|
export * from '@lark-apaas/nestjs-authnpaas';
|
|
6
|
-
export * from '@lark-apaas/nestjs-authzpaas';
|
|
7
8
|
export * from '@lark-apaas/nestjs-datapaas';
|
|
9
|
+
export * from '@lark-apaas/nestjs-observable';
|
|
10
|
+
export * from '@lark-apaas/nestjs-trigger';
|
|
11
|
+
export { CanRole } from '@lark-apaas/nestjs-authzpaas';
|
|
8
12
|
|
|
9
13
|
declare global {
|
|
10
14
|
namespace Express {
|
|
@@ -34,6 +38,13 @@ declare global {
|
|
|
34
38
|
/**
|
|
35
39
|
* PlatformModule 配置选项
|
|
36
40
|
*/
|
|
41
|
+
|
|
42
|
+
interface PlatformHttpClientOptions {
|
|
43
|
+
/** HttpClient 基础配置(超时、headers 等) */
|
|
44
|
+
config?: Omit<HttpClientConfig, 'platform'>;
|
|
45
|
+
/** 平台插件配置(默认启用) */
|
|
46
|
+
platform?: PlatformPluginOptions;
|
|
47
|
+
}
|
|
37
48
|
interface PlatformModuleOptions {
|
|
38
49
|
/**
|
|
39
50
|
* 是否启用 CSRF 保护
|
|
@@ -45,6 +56,10 @@ interface PlatformModuleOptions {
|
|
|
45
56
|
* 默认: '/api/*'
|
|
46
57
|
*/
|
|
47
58
|
csrfRoutes?: string | string[];
|
|
59
|
+
/**
|
|
60
|
+
* 平台 HttpClient 配置
|
|
61
|
+
*/
|
|
62
|
+
httpClient?: PlatformHttpClientOptions;
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
declare class PlatformModule implements NestModule {
|
|
@@ -95,7 +110,11 @@ declare class UserContextMiddleware implements NestMiddleware {
|
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
declare class ViewContextMiddleware implements NestMiddleware {
|
|
98
|
-
|
|
113
|
+
private readonly client;
|
|
114
|
+
private readonly logger;
|
|
115
|
+
constructor(client: PlatformHttpClient);
|
|
116
|
+
private getAppInfo;
|
|
117
|
+
use(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
/**
|
|
@@ -109,4 +128,4 @@ interface ApiNotFoundResponse {
|
|
|
109
128
|
timestamp: string;
|
|
110
129
|
}
|
|
111
130
|
|
|
112
|
-
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
|
|
131
|
+
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, type PlatformHttpClientOptions, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { NestModule, DynamicModule, MiddlewareConsumer, NestMiddleware } from '@nestjs/common';
|
|
2
|
+
import { HttpClientConfig, PlatformPluginOptions } from '@lark-apaas/http-client';
|
|
2
3
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
3
4
|
export { DevToolsModule, DevToolsOptions, DevToolsV2Module, DevToolsV2Options } from '@lark-apaas/nestjs-openapi-devtools';
|
|
4
5
|
import { Request, Response, NextFunction } from 'express';
|
|
6
|
+
import { PlatformHttpClient } from '@lark-apaas/nestjs-common';
|
|
5
7
|
export * from '@lark-apaas/nestjs-authnpaas';
|
|
6
|
-
export * from '@lark-apaas/nestjs-authzpaas';
|
|
7
8
|
export * from '@lark-apaas/nestjs-datapaas';
|
|
9
|
+
export * from '@lark-apaas/nestjs-observable';
|
|
10
|
+
export * from '@lark-apaas/nestjs-trigger';
|
|
11
|
+
export { CanRole } from '@lark-apaas/nestjs-authzpaas';
|
|
8
12
|
|
|
9
13
|
declare global {
|
|
10
14
|
namespace Express {
|
|
@@ -34,6 +38,13 @@ declare global {
|
|
|
34
38
|
/**
|
|
35
39
|
* PlatformModule 配置选项
|
|
36
40
|
*/
|
|
41
|
+
|
|
42
|
+
interface PlatformHttpClientOptions {
|
|
43
|
+
/** HttpClient 基础配置(超时、headers 等) */
|
|
44
|
+
config?: Omit<HttpClientConfig, 'platform'>;
|
|
45
|
+
/** 平台插件配置(默认启用) */
|
|
46
|
+
platform?: PlatformPluginOptions;
|
|
47
|
+
}
|
|
37
48
|
interface PlatformModuleOptions {
|
|
38
49
|
/**
|
|
39
50
|
* 是否启用 CSRF 保护
|
|
@@ -45,6 +56,10 @@ interface PlatformModuleOptions {
|
|
|
45
56
|
* 默认: '/api/*'
|
|
46
57
|
*/
|
|
47
58
|
csrfRoutes?: string | string[];
|
|
59
|
+
/**
|
|
60
|
+
* 平台 HttpClient 配置
|
|
61
|
+
*/
|
|
62
|
+
httpClient?: PlatformHttpClientOptions;
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
declare class PlatformModule implements NestModule {
|
|
@@ -95,7 +110,11 @@ declare class UserContextMiddleware implements NestMiddleware {
|
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
declare class ViewContextMiddleware implements NestMiddleware {
|
|
98
|
-
|
|
113
|
+
private readonly client;
|
|
114
|
+
private readonly logger;
|
|
115
|
+
constructor(client: PlatformHttpClient);
|
|
116
|
+
private getAppInfo;
|
|
117
|
+
use(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
/**
|
|
@@ -109,4 +128,4 @@ interface ApiNotFoundResponse {
|
|
|
109
128
|
timestamp: string;
|
|
110
129
|
}
|
|
111
130
|
|
|
112
|
-
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
|
|
131
|
+
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, type PlatformHttpClientOptions, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
|