@lovrabet/sdk 1.1.23-beta.2 → 1.1.24

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.
@@ -22,6 +22,7 @@ export declare abstract class AbstractBaseModel implements BaseModelMethods {
22
22
  delete(id: string | number): Promise<void>;
23
23
  getDatasetList<T = any>(): Promise<T[]>;
24
24
  getSelectOptions(params: SelectOptionsParams): Promise<SelectOption[]>;
25
+ excelExport<T = any>(params?: ListParams): Promise<T>;
25
26
  private isOpenApiMode;
26
27
  getConfig(): ModelConfig;
27
28
  getModelName(): string;
@@ -20,4 +20,9 @@ export declare class OpenApiModel extends AbstractBaseModel {
20
20
  * @throws Error 当尝试调用 delete 时抛出错误
21
21
  */
22
22
  delete(): Promise<void>;
23
+ /**
24
+ * OpenAPI 模式暂不支持 excelExport 操作
25
+ * @throws Error 当尝试调用 excelExport 时抛出错误
26
+ */
27
+ excelExport(params?: any): Promise<any>;
23
28
  }
@@ -12,7 +12,7 @@
12
12
  * 环境类型定义
13
13
  * @description 支持的运行环境,用于区分不同的 API 端点
14
14
  */
15
- export type Environment = 'online' | 'daily';
15
+ export type Environment = "online" | "daily";
16
16
  /**
17
17
  * 排序方向枚举
18
18
  * @description 定义数据排序的方向
@@ -76,7 +76,7 @@ export interface ListResponse<T> {
76
76
  * - $startWith: 以...开头
77
77
  * - $endWith: 以...结尾
78
78
  */
79
- export type ConditionOperator = '$eq' | '$ne' | '$gte' | '$gteq' | '$lte' | '$lteq' | '$in' | '$contain' | '$startWith' | '$endWith';
79
+ export type ConditionOperator = "$eq" | "$ne" | "$gte" | "$gteq" | "$lte" | "$lteq" | "$in" | "$contain" | "$startWith" | "$endWith";
80
80
  /**
81
81
  * 字段条件类型
82
82
  * @description 单个字段的查询条件
@@ -357,6 +357,27 @@ export interface BaseModelMethods {
357
357
  * ```
358
358
  */
359
359
  getSelectOptions(params: SelectOptionsParams): Promise<SelectOption[]>;
360
+ /**
361
+ * 导出数据为 Excel 文件
362
+ * @param params 查询参数(可选),与 getList 参数一致,用于按条件筛选导出数据
363
+ * @returns 返回导出文件的 URL 地址(字符串),可直接用于下载
364
+ * @description 导出当前数据集的数据为 Excel 文件(仅 WebAPI 模式支持)
365
+ * @example
366
+ * ```typescript
367
+ * // 导出所有数据
368
+ * const fileUrl = await model.excelExport();
369
+ * // fileUrl: "https://yuntoo-export-import.oss-cn-hangzhou.aliyuncs.com/xxx.xlsx?..."
370
+ * window.open(fileUrl, '_blank');
371
+ *
372
+ * // 按条件筛选导出
373
+ * const fileUrl = await model.excelExport({
374
+ * status: 'active',
375
+ * createTime: '2025-01-01'
376
+ * });
377
+ * window.open(fileUrl, '_blank');
378
+ * ```
379
+ */
380
+ excelExport<T = string>(params?: ListParams): Promise<T>;
360
381
  }
361
382
  /**
362
383
  * 模型管理器接口
@@ -1,15 +1,14 @@
1
1
  export declare class LovrabetError extends Error {
2
2
  readonly status?: number;
3
3
  readonly code?: string;
4
- readonly data?: any;
5
- readonly originalError?: Error;
6
- constructor(message: string, status?: number, code?: string, data?: any, originalError?: Error);
4
+ readonly response?: any;
5
+ constructor(message: string, status?: number, code?: string, response?: any);
7
6
  toJSON(): {
8
7
  name: string;
9
8
  message: string;
10
9
  status: number;
11
10
  code: string;
12
- data: any;
11
+ response: any;
13
12
  };
14
13
  }
15
14
  export declare function createErrorHandler(onError?: (error: any) => void): (error: any) => Promise<never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovrabet/sdk",
3
- "version": "1.1.23-beta.2",
3
+ "version": "1.1.24",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",