@ray-js/robot-data-stream 0.0.15-beta.5 → 0.0.15-beta.6
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/lib/mqtt/type/fun.d.ts
CHANGED
|
@@ -202,9 +202,7 @@ export declare const ProtocolSchemas: {
|
|
|
202
202
|
subDevId: import("../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
203
203
|
}, z.core.$strip>>;
|
|
204
204
|
}, z.core.$strip>;
|
|
205
|
-
set_carpet_clean: import("../../myLib/zod/src/v4/mini/schemas").
|
|
206
|
-
ids: import("../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../myLib/zod/src/v4/mini/schemas").ZodMiniNumber<number>>;
|
|
207
|
-
}, z.core.$strip>;
|
|
205
|
+
set_carpet_clean: import("../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../myLib/zod/src/v4/mini/schemas").ZodMiniNumber<number>>;
|
|
208
206
|
set_room_property: import("../../myLib/zod/src/v4/mini/schemas").ZodMiniObject<{
|
|
209
207
|
num: import("../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>;
|
|
210
208
|
ids: import("../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as z from '../../../myLib/zod/mini';
|
|
2
|
-
export declare const setCarpetCleanSchema: import("../../../myLib/zod/src/v4/mini/schemas").
|
|
3
|
-
ids: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumber<number>>;
|
|
4
|
-
}, z.core.$strip>;
|
|
2
|
+
export declare const setCarpetCleanSchema: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumber<number>>;
|
|
5
3
|
declare const carpetCleanResponseSchema: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniObject<{
|
|
6
4
|
success: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniBoolean<boolean>;
|
|
7
5
|
errCode: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumber<number>;
|
|
@@ -2,9 +2,7 @@ import * as z from '../../../myLib/zod/mini';
|
|
|
2
2
|
import { BaseResponseSchema } from './base';
|
|
3
3
|
|
|
4
4
|
// 设置地毯清扫参数 Schema
|
|
5
|
-
export const setCarpetCleanSchema = z.
|
|
6
|
-
ids: z.array(z.number()) // 地毯ID数组,注意: .min()放在数组元素上
|
|
7
|
-
});
|
|
5
|
+
export const setCarpetCleanSchema = z.array(z.number()); // 地毯ID数组,注意: .min()放在数组元素上
|
|
8
6
|
|
|
9
7
|
// 地毯清扫响应 Schema
|
|
10
8
|
const carpetCleanResponseSchema = z.extend(BaseResponseSchema, {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// 地毯清扫
|
|
2
|
-
import {
|
|
3
|
-
import { useStructuredMessage, handleMqttError } from './hooks/useStructuredMessage';
|
|
2
|
+
import { handleMqttError, useStructuredMessage } from './hooks/useStructuredMessage';
|
|
4
3
|
import { validator } from './type/fun';
|
|
4
|
+
import { CarpetCleanEnum } from './type/requestType';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* 自定义 Hook,用于地毯清扫
|
|
7
8
|
* @returns 包含 requestCarpetClean 和 setCarpetClean 函数的对象
|
|
@@ -38,7 +39,9 @@ export const useCarpetClean = () => {
|
|
|
38
39
|
try {
|
|
39
40
|
// 使用 TypeBox Schema 进行参数验证
|
|
40
41
|
const validatedData = validator.validate('set_carpet_clean', data);
|
|
41
|
-
sendStructuredMessage(CarpetCleanEnum.set,
|
|
42
|
+
sendStructuredMessage(CarpetCleanEnum.set, {
|
|
43
|
+
ids: validatedData
|
|
44
|
+
}, resolve, error => reject(handleMqttError(error, 'Failed to set carpet clean')), CarpetCleanEnum.set);
|
|
42
45
|
} catch (error) {
|
|
43
46
|
reject(handleMqttError(error, 'Failed to set carpet clean'));
|
|
44
47
|
}
|