@cpzxrobot/sdk 1.3.135 → 1.3.136

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
+ AiformStructSourceResponse,
23
24
  AiformMetadataResponse,
24
25
  } from ".";
25
26
 
@@ -623,15 +624,41 @@ export class AiformGateway extends Object {
623
624
  });
624
625
  },
625
626
 
627
+ /**
628
+ * 按行ID查询来源数据
629
+ * GET /api/v2/form/pigfarm/source/{rowId}
630
+ * @param rowId 行ID
631
+ * @returns Promise 包含来源数据
632
+ */
633
+ source: async (rowId: number): Promise<AiformStructSourceResponse> => {
634
+ const axios = await this.context.ready;
635
+
636
+ if (!rowId) {
637
+ throw new Error('行ID不能为空');
638
+ }
639
+
640
+ return axios.get(`/api/v2/form/pigfarm/source/${rowId}`).then((res) => {
641
+ if (res.data.code !== 200) {
642
+ throw new Error(res.data.message || '获取来源数据失败');
643
+ }
644
+ return res.data;
645
+ });
646
+ },
647
+
626
648
  /**
627
649
  * 查询标准化支持的 structType 枚举
628
- * GET /api/v2/form/pigfarm/standardize/struct-types
629
- * @returns Promise 包含 structType 列表
650
+ * GET /api/v2/form/pigfarm/standardize/struct-type/{factoryId}
651
+ * @returns Promise 包含 structType 列表(如 WEANING、WEANING_DETAIL 等)
630
652
  */
631
- getStructTypes: async (): Promise<AiformStructTypeResponse> => {
653
+ getStructTypes: async (factoryId: number | undefined): Promise<AiformStructTypeResponse> => {
632
654
  const axios = await this.context.ready;
633
655
 
634
- return axios.get(`/api/v2/form/pigfarm/standardize/struct-types`).then((res) => {
656
+ if (!factoryId) {
657
+ const factory = await this.context.user.getSelectedFarm();
658
+ factoryId = factory.id;
659
+ }
660
+
661
+ return axios.get(`/api/v2/form/pigfarm/standardize/struct-types/${factoryId}`).then((res) => {
635
662
  if (res.data.code !== 200) {
636
663
  throw new Error(res.data.message || '获取结构化类型失败');
637
664
  }
@@ -524,14 +524,36 @@ class AiformGateway extends Object {
524
524
  return res.data;
525
525
  });
526
526
  }),
527
+ /**
528
+ * 按行ID查询来源数据
529
+ * GET /api/v2/form/pigfarm/source/{rowId}
530
+ * @param rowId 行ID
531
+ * @returns Promise 包含来源数据
532
+ */
533
+ source: (rowId) => __awaiter(this, void 0, void 0, function* () {
534
+ const axios = yield this.context.ready;
535
+ if (!rowId) {
536
+ throw new Error('行ID不能为空');
537
+ }
538
+ return axios.get(`/api/v2/form/pigfarm/source/${rowId}`).then((res) => {
539
+ if (res.data.code !== 200) {
540
+ throw new Error(res.data.message || '获取来源数据失败');
541
+ }
542
+ return res.data;
543
+ });
544
+ }),
527
545
  /**
528
546
  * 查询标准化支持的 structType 枚举
529
- * GET /api/v2/form/pigfarm/standardize/struct-types
530
- * @returns Promise 包含 structType 列表
547
+ * GET /api/v2/form/pigfarm/standardize/struct-type/{factoryId}
548
+ * @returns Promise 包含 structType 列表(如 WEANING、WEANING_DETAIL 等)
531
549
  */
532
- getStructTypes: () => __awaiter(this, void 0, void 0, function* () {
550
+ getStructTypes: (factoryId) => __awaiter(this, void 0, void 0, function* () {
533
551
  const axios = yield this.context.ready;
534
- return axios.get(`/api/v2/form/pigfarm/standardize/struct-types`).then((res) => {
552
+ if (!factoryId) {
553
+ const factory = yield this.context.user.getSelectedFarm();
554
+ factoryId = factory.id;
555
+ }
556
+ return axios.get(`/api/v2/form/pigfarm/standardize/struct-types/${factoryId}`).then((res) => {
535
557
  if (res.data.code !== 200) {
536
558
  throw new Error(res.data.message || '获取结构化类型失败');
537
559
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.135",
3
+ "version": "1.3.136",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/types.d.ts CHANGED
@@ -1229,6 +1229,18 @@ interface AiformStructDetailResponse {
1229
1229
  };
1230
1230
  }
1231
1231
 
1232
+ /**
1233
+ * 结构化来源数据响应接口
1234
+ */
1235
+ interface AiformStructSourceResponse {
1236
+ /** 响应码 */
1237
+ code: number;
1238
+ /** 提示信息 */
1239
+ message: string;
1240
+ /** 来源数据 */
1241
+ data: any;
1242
+ }
1243
+
1232
1244
  /**
1233
1245
  * 元数据字段信息接口
1234
1246
  */
@@ -1539,6 +1551,7 @@ declare module "@cpzxrobot/sdk" {
1539
1551
  AiformStructTypeResponse,
1540
1552
  AiformStructListResponse,
1541
1553
  AiformStructDetailResponse,
1554
+ AiformStructSourceResponse,
1542
1555
  AiformMetadataResponse,
1543
1556
  AiformMetadataField,
1544
1557
  AlarmRuleDetail,