@cpzxrobot/sdk 1.3.132 → 1.3.133

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/aiform_gateway.ts CHANGED
@@ -20,6 +20,7 @@ import type {
20
20
  AiformStructTypeResponse,
21
21
  AiformStructListResponse,
22
22
  AiformStructDetailResponse,
23
+ AiformMetadataResponse,
23
24
  } from ".";
24
25
 
25
26
  export class AiformGateway extends Object {
@@ -656,6 +657,31 @@ export class AiformGateway extends Object {
656
657
  return res.data;
657
658
  });
658
659
  },
660
+
661
+ /**
662
+ * 查询元数据(枚举值、必填字段等)
663
+ * GET /api/v2/form/pigfarm/metadata
664
+ * @param structType 报表结构化类型(如 WEANING)
665
+ * @returns Promise 包含元数据信息
666
+ */
667
+ metadata: async (structType: string): Promise<AiformMetadataResponse> => {
668
+ const axios = await this.context.ready;
669
+
670
+ if (!structType) {
671
+ throw new Error('结构化类型不能为空');
672
+ }
673
+
674
+ return axios.get(`/api/v2/form/pigfarm/metadata`, {
675
+ params: {
676
+ structType
677
+ }
678
+ }).then((res) => {
679
+ if (res.data.code !== 200) {
680
+ throw new Error(res.data.message || '获取元数据失败');
681
+ }
682
+ return res.data;
683
+ });
684
+ },
659
685
  };
660
686
  }
661
687
  }
@@ -559,6 +559,28 @@ class AiformGateway extends Object {
559
559
  return res.data;
560
560
  });
561
561
  }),
562
+ /**
563
+ * 查询元数据(枚举值、必填字段等)
564
+ * GET /api/v2/form/pigfarm/metadata
565
+ * @param structType 报表结构化类型(如 WEANING)
566
+ * @returns Promise 包含元数据信息
567
+ */
568
+ metadata: (structType) => __awaiter(this, void 0, void 0, function* () {
569
+ const axios = yield this.context.ready;
570
+ if (!structType) {
571
+ throw new Error('结构化类型不能为空');
572
+ }
573
+ return axios.get(`/api/v2/form/pigfarm/metadata`, {
574
+ params: {
575
+ structType
576
+ }
577
+ }).then((res) => {
578
+ if (res.data.code !== 200) {
579
+ throw new Error(res.data.message || '获取元数据失败');
580
+ }
581
+ return res.data;
582
+ });
583
+ }),
562
584
  };
563
585
  }
564
586
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.132",
3
+ "version": "1.3.133",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/types.d.ts CHANGED
@@ -1229,6 +1229,44 @@ interface AiformStructDetailResponse {
1229
1229
  };
1230
1230
  }
1231
1231
 
1232
+ /**
1233
+ * 元数据字段信息接口
1234
+ */
1235
+ interface AiformMetadataField {
1236
+ /** 字段名 */
1237
+ name: string;
1238
+ /** 字段类型 */
1239
+ type: string;
1240
+ /** 是否必填 */
1241
+ required: boolean;
1242
+ /** 字段描述 */
1243
+ description?: string;
1244
+ /** 枚举值列表(如果有) */
1245
+ enumValues?: {
1246
+ /** 枚举值 */
1247
+ value: string;
1248
+ /** 枚举标签 */
1249
+ label: string;
1250
+ }[];
1251
+ }
1252
+
1253
+ /**
1254
+ * 元数据响应接口
1255
+ */
1256
+ interface AiformMetadataResponse {
1257
+ /** 响应码 */
1258
+ code: number;
1259
+ /** 提示信息 */
1260
+ message: string;
1261
+ /** 元数据信息 */
1262
+ data: {
1263
+ /** 结构化类型 */
1264
+ structType: string;
1265
+ /** 字段元数据列表 */
1266
+ fields: AiformMetadataField[];
1267
+ };
1268
+ }
1269
+
1232
1270
  /**
1233
1271
  * AI报表模板列表响应接口
1234
1272
  */
@@ -1501,6 +1539,8 @@ declare module "@cpzxrobot/sdk" {
1501
1539
  AiformStructTypeResponse,
1502
1540
  AiformStructListResponse,
1503
1541
  AiformStructDetailResponse,
1542
+ AiformMetadataResponse,
1543
+ AiformMetadataField,
1504
1544
  AlarmRuleDetail,
1505
1545
  AlarmRuleListResponse,
1506
1546
  AlarmRuleDetailResponse,