@lark-apaas/fullstack-nestjs-core 1.1.18-alpha.1 → 1.1.19-beta.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.d.cts CHANGED
@@ -3,13 +3,17 @@ import { HttpClientConfig, PlatformPluginOptions } from '@lark-apaas/http-client
3
3
  import { NestExpressApplication } from '@nestjs/platform-express';
4
4
  export { DevToolsModule, DevToolsOptions, DevToolsV2Module, DevToolsV2Options } from '@lark-apaas/nestjs-openapi-devtools';
5
5
  import { Request, Response, NextFunction } from 'express';
6
- import { PlatformHttpClient } from '@lark-apaas/nestjs-common';
6
+ import { PlatformHttpClient, RequestContextService, ObservableService } from '@lark-apaas/nestjs-common';
7
7
  export { AutoTrace } from '@lark-apaas/nestjs-common';
8
+ import * as _lark_apaas_file_service from '@lark-apaas/file-service';
9
+ import { FileBody, UploadOptions, FileDownloadBuilder, SearchOptions } from '@lark-apaas/file-service';
10
+ export * from '@lark-apaas/file-service';
8
11
  export * from '@lark-apaas/nestjs-authnpaas';
9
12
  export * from '@lark-apaas/nestjs-capability';
10
13
  export * from '@lark-apaas/nestjs-datapaas';
11
14
  export * from '@lark-apaas/nestjs-observable';
12
15
  export * from '@lark-apaas/nestjs-trigger';
16
+ export { CanRole } from '@lark-apaas/nestjs-authzpaas';
13
17
 
14
18
  declare global {
15
19
  namespace Express {
@@ -31,7 +35,8 @@ declare global {
31
35
  userNameEn?: string; // 冗余一份英文名
32
36
  userNameI18n?: Record<string, string>; // 带多语的用户名
33
37
  isSystemAccount?: boolean; // trigger 场景写入值为 true,user 访问场景不写入
34
- },
38
+ roles?: string[]; // 用户角色 id 列表
39
+ };
35
40
  csrfToken?: string;
36
41
  }
37
42
  }
@@ -135,4 +140,33 @@ interface ApiNotFoundResponse {
135
140
  timestamp: string;
136
141
  }
137
142
 
138
- export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, type PlatformHttpClientOptions, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
143
+ type BucketScopedFileService = Pick<FileService, 'upload' | 'download' | 'list' | 'remove' | 'createSignedUrl' | 'getFileMetadata'>;
144
+ declare class FileService {
145
+ private readonly requestContextService;
146
+ private readonly httpClient;
147
+ private readonly observable;
148
+ private readonly fileServiceCore;
149
+ private readonly nestLogger;
150
+ constructor(requestContextService: RequestContextService, httpClient: PlatformHttpClient, observable: ObservableService);
151
+ /**
152
+ * 返回一个绑定了指定 bucket 的代理对象
153
+ * 不会修改 context,避免副作用
154
+ */
155
+ from(bucket: string): BucketScopedFileService;
156
+ upload(file: FileBody, options?: UploadOptions): Promise<_lark_apaas_file_service.FileMeta>;
157
+ download(path: string): FileDownloadBuilder;
158
+ list(prefix: string, searchOptions?: SearchOptions): Promise<_lark_apaas_file_service.ListResponse>;
159
+ remove(filePaths: string[]): Promise<_lark_apaas_file_service.FileMeta[]>;
160
+ createSignedUrl(path: string, expiresIn: number): Promise<string>;
161
+ getFileMetadata(filePath: string): Promise<_lark_apaas_file_service.FileMeta | null>;
162
+ getDefaultBucket(): Promise<string>;
163
+ private getAppId;
164
+ private _upload;
165
+ private _download;
166
+ private _list;
167
+ private _remove;
168
+ private _createSignedUrl;
169
+ private _getFileMetadata;
170
+ }
171
+
172
+ export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, FileService, type PlatformHttpClientOptions, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
package/dist/index.d.ts CHANGED
@@ -3,13 +3,17 @@ import { HttpClientConfig, PlatformPluginOptions } from '@lark-apaas/http-client
3
3
  import { NestExpressApplication } from '@nestjs/platform-express';
4
4
  export { DevToolsModule, DevToolsOptions, DevToolsV2Module, DevToolsV2Options } from '@lark-apaas/nestjs-openapi-devtools';
5
5
  import { Request, Response, NextFunction } from 'express';
6
- import { PlatformHttpClient } from '@lark-apaas/nestjs-common';
6
+ import { PlatformHttpClient, RequestContextService, ObservableService } from '@lark-apaas/nestjs-common';
7
7
  export { AutoTrace } from '@lark-apaas/nestjs-common';
8
+ import * as _lark_apaas_file_service from '@lark-apaas/file-service';
9
+ import { FileBody, UploadOptions, FileDownloadBuilder, SearchOptions } from '@lark-apaas/file-service';
10
+ export * from '@lark-apaas/file-service';
8
11
  export * from '@lark-apaas/nestjs-authnpaas';
9
12
  export * from '@lark-apaas/nestjs-capability';
10
13
  export * from '@lark-apaas/nestjs-datapaas';
11
14
  export * from '@lark-apaas/nestjs-observable';
12
15
  export * from '@lark-apaas/nestjs-trigger';
16
+ export { CanRole } from '@lark-apaas/nestjs-authzpaas';
13
17
 
14
18
  declare global {
15
19
  namespace Express {
@@ -31,7 +35,8 @@ declare global {
31
35
  userNameEn?: string; // 冗余一份英文名
32
36
  userNameI18n?: Record<string, string>; // 带多语的用户名
33
37
  isSystemAccount?: boolean; // trigger 场景写入值为 true,user 访问场景不写入
34
- },
38
+ roles?: string[]; // 用户角色 id 列表
39
+ };
35
40
  csrfToken?: string;
36
41
  }
37
42
  }
@@ -135,4 +140,33 @@ interface ApiNotFoundResponse {
135
140
  timestamp: string;
136
141
  }
137
142
 
138
- export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, type PlatformHttpClientOptions, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };
143
+ type BucketScopedFileService = Pick<FileService, 'upload' | 'download' | 'list' | 'remove' | 'createSignedUrl' | 'getFileMetadata'>;
144
+ declare class FileService {
145
+ private readonly requestContextService;
146
+ private readonly httpClient;
147
+ private readonly observable;
148
+ private readonly fileServiceCore;
149
+ private readonly nestLogger;
150
+ constructor(requestContextService: RequestContextService, httpClient: PlatformHttpClient, observable: ObservableService);
151
+ /**
152
+ * 返回一个绑定了指定 bucket 的代理对象
153
+ * 不会修改 context,避免副作用
154
+ */
155
+ from(bucket: string): BucketScopedFileService;
156
+ upload(file: FileBody, options?: UploadOptions): Promise<_lark_apaas_file_service.FileMeta>;
157
+ download(path: string): FileDownloadBuilder;
158
+ list(prefix: string, searchOptions?: SearchOptions): Promise<_lark_apaas_file_service.ListResponse>;
159
+ remove(filePaths: string[]): Promise<_lark_apaas_file_service.FileMeta[]>;
160
+ createSignedUrl(path: string, expiresIn: number): Promise<string>;
161
+ getFileMetadata(filePath: string): Promise<_lark_apaas_file_service.FileMeta | null>;
162
+ getDefaultBucket(): Promise<string>;
163
+ private getAppId;
164
+ private _upload;
165
+ private _download;
166
+ private _list;
167
+ private _remove;
168
+ private _createSignedUrl;
169
+ private _getFileMetadata;
170
+ }
171
+
172
+ export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, FileService, type PlatformHttpClientOptions, PlatformModule, type PlatformModuleOptions, UserContextMiddleware, ViewContextMiddleware, configureApp };