@ray-js/robot-data-stream 0.0.16-beta.2 → 0.0.16-beta.4
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/hooks/useStructuredMessage.d.ts +2 -7
- package/lib/mqtt/hooks/useStructuredMessage.js +1 -1
- package/lib/mqtt/type/index.d.ts +0 -12
- package/lib/mqtt/type/index.js +0 -14
- package/lib/mqtt/type/protocols/base.d.ts +23 -24
- package/lib/mqtt/type/protocols/base.js +1 -38
- package/lib/mqtt/type/protocols/carpetCleanProtocol.d.ts +6 -13
- package/lib/mqtt/type/protocols/carpetCleanProtocol.js +1 -14
- package/lib/mqtt/type/protocols/carpetProtocol.d.ts +52 -96
- package/lib/mqtt/type/protocols/carpetProtocol.js +1 -202
- package/lib/mqtt/type/protocols/devInfoProtocol.d.ts +5 -11
- package/lib/mqtt/type/protocols/devInfoProtocol.js +1 -10
- package/lib/mqtt/type/protocols/deviceModelProtocol.d.ts +14 -29
- package/lib/mqtt/type/protocols/deviceModelProtocol.js +1 -32
- package/lib/mqtt/type/protocols/furnitureModelProtocol.d.ts +15 -25
- package/lib/mqtt/type/protocols/furnitureModelProtocol.js +1 -27
- package/lib/mqtt/type/protocols/historyMapProtocol.d.ts +19 -36
- package/lib/mqtt/type/protocols/historyMapProtocol.js +1 -37
- package/lib/mqtt/type/protocols/partDivisionProtocol.d.ts +6 -20
- package/lib/mqtt/type/protocols/partDivisionProtocol.js +1 -12
- package/lib/mqtt/type/protocols/partMergeProtocol.d.ts +3 -12
- package/lib/mqtt/type/protocols/partMergeProtocol.js +1 -12
- package/lib/mqtt/type/protocols/passwordProtocol.d.ts +11 -21
- package/lib/mqtt/type/protocols/passwordProtocol.js +1 -25
- package/lib/mqtt/type/protocols/quietHoursProtocol.d.ts +17 -27
- package/lib/mqtt/type/protocols/quietHoursProtocol.js +1 -35
- package/lib/mqtt/type/protocols/resetMapProtocol.d.ts +2 -3
- package/lib/mqtt/type/protocols/roomPropertyProtocol.d.ts +32 -46
- package/lib/mqtt/type/protocols/roomPropertyProtocol.js +1 -134
- package/lib/mqtt/type/protocols/scheduleProtocol.d.ts +18 -69
- package/lib/mqtt/type/protocols/scheduleProtocol.js +1 -117
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.d.ts +22 -29
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.js +1 -48
- package/lib/mqtt/type/protocols/spotCleanProtocol.d.ts +18 -42
- package/lib/mqtt/type/protocols/spotCleanProtocol.js +1 -94
- package/lib/mqtt/type/protocols/virtualAreaProtocol.d.ts +17 -30
- package/lib/mqtt/type/protocols/virtualAreaProtocol.js +1 -36
- package/lib/mqtt/type/protocols/virtualWallProtocol.d.ts +11 -25
- package/lib/mqtt/type/protocols/virtualWallProtocol.js +1 -25
- package/lib/mqtt/type/protocols/voiceProtocol.d.ts +11 -19
- package/lib/mqtt/type/protocols/voiceProtocol.js +1 -23
- package/lib/mqtt/type/protocols/wifiMapProtocol.d.ts +6 -15
- package/lib/mqtt/type/protocols/wifiMapProtocol.js +1 -15
- package/lib/mqtt/type/protocols/zoneCleanProtocol.d.ts +37 -50
- package/lib/mqtt/type/protocols/zoneCleanProtocol.js +1 -76
- package/lib/mqtt/useCarpet.js +21 -35
- package/lib/mqtt/useCarpetClean.js +1 -4
- package/lib/mqtt/useDeviceModel.js +1 -4
- package/lib/mqtt/useFurnitureModel.js +1 -4
- package/lib/mqtt/useHistoryMap.js +8 -21
- package/lib/mqtt/usePartDivision.js +6 -20
- package/lib/mqtt/usePartMerge.js +1 -3
- package/lib/mqtt/usePassword.js +2 -9
- package/lib/mqtt/useQuiteHours.js +1 -4
- package/lib/mqtt/useRoomProperty.js +3 -7
- package/lib/mqtt/useSchedule.js +8 -12
- package/lib/mqtt/useSelectRoomClean.js +6 -14
- package/lib/mqtt/useSpotClean.js +4 -10
- package/lib/mqtt/useVirtualArea.js +1 -4
- package/lib/mqtt/useVirtualWall.js +1 -4
- package/lib/mqtt/useVoice.js +4 -7
- package/lib/mqtt/useWifiMap.js +1 -5
- package/lib/mqtt/useZoneClean.js +10 -15
- package/lib/utils/index.d.ts +15 -0
- package/lib/utils/index.js +35 -1
- package/package.json +1 -1
- package/lib/mqtt/type/fun.d.ts +0 -248
- package/lib/mqtt/type/fun.js +0 -146
- package/lib/mqtt/waterPreference.d.ts +0 -20
- package/lib/mqtt/waterPreference.js +0 -70
- package/lib/myLib/zod/mini/index.d.cts +0 -1
- package/lib/myLib/zod/mini/index.d.ts +0 -1
- package/lib/myLib/zod/mini/index.js +0 -1
- package/lib/myLib/zod/mini/package.json +0 -6
- package/lib/myLib/zod/src/mini/index.d.ts +0 -1
- package/lib/myLib/zod/src/mini/index.js +0 -1
- package/lib/myLib/zod/src/v4/core/api.d.ts +0 -306
- package/lib/myLib/zod/src/v4/core/api.js +0 -1256
- package/lib/myLib/zod/src/v4/core/checks.d.ts +0 -278
- package/lib/myLib/zod/src/v4/core/checks.js +0 -816
- package/lib/myLib/zod/src/v4/core/config.d.ts +0 -9
- package/lib/myLib/zod/src/v4/core/config.js +0 -5
- package/lib/myLib/zod/src/v4/core/core.d.ts +0 -70
- package/lib/myLib/zod/src/v4/core/core.js +0 -95
- package/lib/myLib/zod/src/v4/core/doc.d.ts +0 -14
- package/lib/myLib/zod/src/v4/core/doc.js +0 -42
- package/lib/myLib/zod/src/v4/core/errors.d.ts +0 -220
- package/lib/myLib/zod/src/v4/core/errors.js +0 -232
- package/lib/myLib/zod/src/v4/core/index.d.ts +0 -15
- package/lib/myLib/zod/src/v4/core/index.js +0 -15
- package/lib/myLib/zod/src/v4/core/json-schema-generator.d.ts +0 -65
- package/lib/myLib/zod/src/v4/core/json-schema-generator.js +0 -120
- package/lib/myLib/zod/src/v4/core/json-schema-processors.d.ts +0 -49
- package/lib/myLib/zod/src/v4/core/json-schema-processors.js +0 -593
- package/lib/myLib/zod/src/v4/core/json-schema.d.ts +0 -88
- package/lib/myLib/zod/src/v4/core/json-schema.js +0 -1
- package/lib/myLib/zod/src/v4/core/parse.d.ts +0 -49
- package/lib/myLib/zod/src/v4/core/parse.js +0 -147
- package/lib/myLib/zod/src/v4/core/regexes.d.ts +0 -78
- package/lib/myLib/zod/src/v4/core/regexes.js +0 -146
- package/lib/myLib/zod/src/v4/core/registries.d.ts +0 -35
- package/lib/myLib/zod/src/v4/core/registries.js +0 -51
- package/lib/myLib/zod/src/v4/core/schemas.d.ts +0 -1136
- package/lib/myLib/zod/src/v4/core/schemas.js +0 -2745
- package/lib/myLib/zod/src/v4/core/standard-schema.d.ts +0 -126
- package/lib/myLib/zod/src/v4/core/standard-schema.js +0 -1
- package/lib/myLib/zod/src/v4/core/to-json-schema.d.ts +0 -114
- package/lib/myLib/zod/src/v4/core/to-json-schema.js +0 -488
- package/lib/myLib/zod/src/v4/core/util.d.ts +0 -199
- package/lib/myLib/zod/src/v4/core/util.js +0 -656
- package/lib/myLib/zod/src/v4/core/versions.d.ts +0 -5
- package/lib/myLib/zod/src/v4/core/versions.js +0 -5
- package/lib/myLib/zod/src/v4/core/zsf.d.ts +0 -91
- package/lib/myLib/zod/src/v4/core/zsf.js +0 -1
- package/lib/myLib/zod/src/v4/mini/checks.d.ts +0 -1
- package/lib/myLib/zod/src/v4/mini/checks.js +0 -1
- package/lib/myLib/zod/src/v4/mini/coerce.d.ts +0 -7
- package/lib/myLib/zod/src/v4/mini/coerce.js +0 -27
- package/lib/myLib/zod/src/v4/mini/external.d.ts +0 -11
- package/lib/myLib/zod/src/v4/mini/external.js +0 -16
- package/lib/myLib/zod/src/v4/mini/index.d.ts +0 -530
- package/lib/myLib/zod/src/v4/mini/index.js +0 -30
- package/lib/myLib/zod/src/v4/mini/iso.d.ts +0 -22
- package/lib/myLib/zod/src/v4/mini/iso.js +0 -46
- package/lib/myLib/zod/src/v4/mini/parse.d.ts +0 -1
- package/lib/myLib/zod/src/v4/mini/parse.js +0 -1
- package/lib/myLib/zod/src/v4/mini/schemas.js +0 -1244
|
@@ -1,15 +1,10 @@
|
|
|
1
|
+
import { BaseResponse } from '../type/protocols/base';
|
|
1
2
|
/**
|
|
2
3
|
* 统一的 MQTT 消息发送 Hook
|
|
3
4
|
* 提供统一的 sendMqttMessage 方法,自动从 Context 获取 devId 和配置
|
|
4
5
|
*/
|
|
5
6
|
export declare const useStructuredMessage: () => {
|
|
6
|
-
sendStructuredMessage: <T extends
|
|
7
|
-
success: boolean;
|
|
8
|
-
errCode: number;
|
|
9
|
-
reqType: string;
|
|
10
|
-
version: string;
|
|
11
|
-
taskId: string;
|
|
12
|
-
}>(reqType: string, message: Record<string, any> | undefined, resolve: (value: T) => void, reject: (reason?: any) => void, responseType?: string) => void;
|
|
7
|
+
sendStructuredMessage: <T extends BaseResponse>(reqType: string, message: Record<string, any> | undefined, resolve: (value: T) => void, reject: (reason?: any) => void, responseType?: string) => void;
|
|
13
8
|
};
|
|
14
9
|
/**
|
|
15
10
|
* 错误处理工具函数
|
|
@@ -114,7 +114,7 @@ export const useStructuredMessage = () => {
|
|
|
114
114
|
const isPreferredMqtt = preferredChannel === COMMUNICATION_CHANNELS.MQTT;
|
|
115
115
|
const primaryMethod = isPreferredMqtt ? mqttCommunication : lanCommunication;
|
|
116
116
|
const fallbackMethod = isPreferredMqtt ? lanCommunication : mqttCommunication;
|
|
117
|
-
const useLocal = isPreferredMqtt
|
|
117
|
+
const useLocal = !isPreferredMqtt;
|
|
118
118
|
if (primaryMethod.isAvailable()) {
|
|
119
119
|
return {
|
|
120
120
|
method: primaryMethod,
|
package/lib/mqtt/type/index.d.ts
CHANGED
|
@@ -8,18 +8,6 @@ export declare enum ProtocolEnum {
|
|
|
8
8
|
/** 设备上报 */
|
|
9
9
|
robotToApp = 65
|
|
10
10
|
}
|
|
11
|
-
export declare enum PasswordEnum {
|
|
12
|
-
query = "passwordQry",
|
|
13
|
-
set = "passwordSet",
|
|
14
|
-
rst = "passwordRst",
|
|
15
|
-
check = "passwordCheck",
|
|
16
|
-
checkRst = "passwordCheckRst"
|
|
17
|
-
}
|
|
18
|
-
export declare enum WifiMapEnum {
|
|
19
|
-
query = "WifiMapQry",
|
|
20
|
-
set = "WifiMapSet",
|
|
21
|
-
rst = "WifiMapRst"
|
|
22
|
-
}
|
|
23
11
|
export type RoomPreference = {
|
|
24
12
|
suctions?: string[];
|
|
25
13
|
cisterns?: Array<string | number>;
|
package/lib/mqtt/type/index.js
CHANGED
|
@@ -7,18 +7,4 @@ export let ProtocolEnum = /*#__PURE__*/function (ProtocolEnum) {
|
|
|
7
7
|
ProtocolEnum[ProtocolEnum["appToRobot"] = 64] = "appToRobot";
|
|
8
8
|
ProtocolEnum[ProtocolEnum["robotToApp"] = 65] = "robotToApp";
|
|
9
9
|
return ProtocolEnum;
|
|
10
|
-
}({});
|
|
11
|
-
export let PasswordEnum = /*#__PURE__*/function (PasswordEnum) {
|
|
12
|
-
PasswordEnum["query"] = "passwordQry";
|
|
13
|
-
PasswordEnum["set"] = "passwordSet";
|
|
14
|
-
PasswordEnum["rst"] = "passwordRst";
|
|
15
|
-
PasswordEnum["check"] = "passwordCheck";
|
|
16
|
-
PasswordEnum["checkRst"] = "passwordCheckRst";
|
|
17
|
-
return PasswordEnum;
|
|
18
|
-
}({});
|
|
19
|
-
export let WifiMapEnum = /*#__PURE__*/function (WifiMapEnum) {
|
|
20
|
-
WifiMapEnum["query"] = "WifiMapQry";
|
|
21
|
-
WifiMapEnum["set"] = "WifiMapSet";
|
|
22
|
-
WifiMapEnum["rst"] = "WifiMapRst";
|
|
23
|
-
return WifiMapEnum;
|
|
24
10
|
}({});
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
x:
|
|
4
|
-
y:
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
suctions
|
|
8
|
-
cisterns
|
|
9
|
-
waterValues
|
|
10
|
-
cleanCounts
|
|
11
|
-
yMops
|
|
12
|
-
sweepMopModes
|
|
13
|
-
ids
|
|
14
|
-
routePreferences
|
|
15
|
-
nameLabels
|
|
16
|
-
}
|
|
17
|
-
export
|
|
18
|
-
success:
|
|
19
|
-
errCode:
|
|
20
|
-
reqType:
|
|
21
|
-
version:
|
|
22
|
-
taskId:
|
|
23
|
-
}
|
|
24
|
-
export type BaseResponse = z.infer<typeof BaseResponseSchema>;
|
|
1
|
+
export type StringOrNumber = string | number;
|
|
2
|
+
export interface Point {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RoomPreferenceFields {
|
|
7
|
+
suctions?: string[];
|
|
8
|
+
cisterns?: string[];
|
|
9
|
+
waterValues?: number[];
|
|
10
|
+
cleanCounts?: number[];
|
|
11
|
+
yMops?: number[];
|
|
12
|
+
sweepMopModes?: string[];
|
|
13
|
+
ids?: number[];
|
|
14
|
+
routePreferences?: string[];
|
|
15
|
+
nameLabels?: number[];
|
|
16
|
+
}
|
|
17
|
+
export interface BaseResponse {
|
|
18
|
+
success: boolean;
|
|
19
|
+
errCode: number;
|
|
20
|
+
reqType: string;
|
|
21
|
+
version: string;
|
|
22
|
+
taskId: string;
|
|
23
|
+
}
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// 基础类型
|
|
4
|
-
export const Point = z.object({
|
|
5
|
-
x: z.number(),
|
|
6
|
-
y: z.number()
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// RoomPreference 相关字段 Schema
|
|
10
|
-
export const RoomPreferenceFieldsSchema = z.object({
|
|
11
|
-
// 吸力, closed - 关闭 gentle - 安静 normal - 正常 strong - 强劲 max - 超强 ,默认值为''
|
|
12
|
-
suctions: z.optional(z.array(z.string())),
|
|
13
|
-
// 拖地水量 "closed"- 关闭,"low"-低,"middle"-中,"high"-高,默认值为'',兼容number类型
|
|
14
|
-
cisterns: z.optional(z.array(z.union([z.string(), z.number()]))),
|
|
15
|
-
// 自定义水量的值
|
|
16
|
-
waterValues: z.optional(z.array(z.union([z.string(), z.number()]))),
|
|
17
|
-
// 清扫次数 默认值1
|
|
18
|
-
cleanCounts: z.optional(z.array(z.int())),
|
|
19
|
-
// 拖地模式 1:开启Y型拖地 0:关闭Y型拖地 -1 未设置 默认值-1
|
|
20
|
-
yMops: z.optional(z.array(z.int())),
|
|
21
|
-
// 扫拖模式 "only_sweep":仅扫,"only_mop":仅拖,"both_work":扫拖同时,"clean_before_mop":先扫后拖,默认值为'only_sweep'
|
|
22
|
-
sweepMopModes: z.optional(z.array(z.string())),
|
|
23
|
-
// 房间id集合
|
|
24
|
-
ids: z.optional(z.array(z.int())),
|
|
25
|
-
// 路线偏好(四种清洁偏好): "standard"-标准, "fast"-快速, "deep"-深度, "custom"-自定义,默认值为'standard'
|
|
26
|
-
routePreferences: z.optional(z.array(z.string())),
|
|
27
|
-
// 房间名称标签
|
|
28
|
-
nameLabels: z.optional(z.array(z.int()))
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// BaseResponse Schema(用于响应类型)
|
|
32
|
-
export const BaseResponseSchema = z.object({
|
|
33
|
-
success: z.boolean(),
|
|
34
|
-
errCode: z.number(),
|
|
35
|
-
reqType: z.string(),
|
|
36
|
-
version: z.string(),
|
|
37
|
-
taskId: z.string()
|
|
38
|
-
});
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
reqType: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
7
|
-
version: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
8
|
-
taskId: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
9
|
-
ids: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<any>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
export type CarpetCleanResponse = z.infer<typeof carpetCleanResponseSchema>;
|
|
1
|
+
import type { BaseResponse, StringOrNumber } from './base';
|
|
2
|
+
export type SetCarpetCleanData = StringOrNumber[];
|
|
3
|
+
export interface CarpetCleanResponse extends BaseResponse {
|
|
4
|
+
ids: StringOrNumber[];
|
|
5
|
+
}
|
|
12
6
|
export type TRequestCarpetClean = () => Promise<CarpetCleanResponse>;
|
|
13
|
-
export type TSetCarpetClean = (data:
|
|
14
|
-
export {};
|
|
7
|
+
export type TSetCarpetClean = (data: SetCarpetCleanData) => Promise<CarpetCleanResponse>;
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { BaseResponseSchema } from './base';
|
|
3
|
-
|
|
4
|
-
// 设置地毯清扫参数 Schema
|
|
5
|
-
export const setCarpetCleanSchema = z.array(z.union([z.number(), z.string()]));
|
|
6
|
-
|
|
7
|
-
// 地毯清扫响应 Schema
|
|
8
|
-
const carpetCleanResponseSchema = z.extend(BaseResponseSchema, {
|
|
9
|
-
ids: z.array(z.union([z.number(), z.string()]))
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// 类型导出
|
|
13
|
-
|
|
14
|
-
// 函数类型定义
|
|
1
|
+
export {};
|
|
@@ -1,102 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ids: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<any>;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
declare const carpetQueryResponseSchema: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniObject<{
|
|
56
|
-
success: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniBoolean<boolean>;
|
|
57
|
-
errCode: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumber<number>;
|
|
58
|
-
reqType: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
59
|
-
version: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
60
|
-
taskId: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
61
|
-
num: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat;
|
|
62
|
-
polygons: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>>;
|
|
63
|
-
cleanMode: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>>;
|
|
64
|
-
shape: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>>>;
|
|
65
|
-
type: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>>;
|
|
66
|
-
ids: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<any>>;
|
|
67
|
-
autoBoost: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>>;
|
|
68
|
-
fineCleaning: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>>;
|
|
69
|
-
sideBrushRotating: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniOptional<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniArray<import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniNumberFormat>>;
|
|
70
|
-
}, z.core.$strip>;
|
|
71
|
-
export type QueryCarpetData = z.infer<typeof queryCarpetSchema>;
|
|
72
|
-
export type AddCarpetData = z.infer<typeof addCarpetSchema>;
|
|
73
|
-
export type UpdateCarpetData = z.infer<typeof updateCarpetSchema>;
|
|
74
|
-
export type DeleteCarpetData = z.infer<typeof deleteCarpetSchema>;
|
|
75
|
-
export type SetCarpetData = z.infer<typeof setCarpetSchema>;
|
|
76
|
-
export type AddCarpetResponse = z.infer<typeof addCarpetResponseSchema>;
|
|
77
|
-
export type CarpetQueryResponse = z.infer<typeof carpetQueryResponseSchema>;
|
|
78
|
-
/**
|
|
79
|
-
* 验证添加地毯协议数据
|
|
80
|
-
* @param data 已验证基础 schema 的数据
|
|
81
|
-
* @throws MqttError 验证失败时抛出
|
|
82
|
-
*/
|
|
83
|
-
export declare function validateAddCarpet(data: AddCarpetData): void;
|
|
84
|
-
/**
|
|
85
|
-
* 验证更新地毯协议数据
|
|
86
|
-
* @param data 已验证基础 schema 的数据
|
|
87
|
-
* @throws MqttError 验证失败时抛出
|
|
88
|
-
*/
|
|
89
|
-
export declare function validateUpdateCarpet(data: UpdateCarpetData): void;
|
|
90
|
-
/**
|
|
91
|
-
* 验证设置地毯协议数据
|
|
92
|
-
* @param data 已验证基础 schema 的数据
|
|
93
|
-
* @throws MqttError 验证失败时抛出
|
|
94
|
-
*/
|
|
95
|
-
export declare function validateSetCarpet(data: SetCarpetData): void;
|
|
1
|
+
import type { BaseResponse, Point, StringOrNumber } from './base';
|
|
2
|
+
export type CarpetShape = 'rectangle' | 'round' | 'custom';
|
|
3
|
+
export interface QueryCarpetData {
|
|
4
|
+
}
|
|
5
|
+
export interface AddCarpetData {
|
|
6
|
+
shape: CarpetShape[];
|
|
7
|
+
polygons: Point[][];
|
|
8
|
+
num: number;
|
|
9
|
+
type: number[];
|
|
10
|
+
cleanMode: number[];
|
|
11
|
+
autoBoost?: number[];
|
|
12
|
+
fineCleaning?: number[];
|
|
13
|
+
sideBrushRotating?: number[];
|
|
14
|
+
}
|
|
15
|
+
export interface UpdateCarpetData {
|
|
16
|
+
ids: StringOrNumber[];
|
|
17
|
+
shape?: CarpetShape[];
|
|
18
|
+
type?: number[];
|
|
19
|
+
cleanMode?: number[];
|
|
20
|
+
autoBoost?: number[];
|
|
21
|
+
fineCleaning?: number[];
|
|
22
|
+
sideBrushRotating?: number[];
|
|
23
|
+
polygons?: Point[][];
|
|
24
|
+
}
|
|
25
|
+
export interface DeleteCarpetData {
|
|
26
|
+
ids: StringOrNumber[];
|
|
27
|
+
}
|
|
28
|
+
export interface SetCarpetData {
|
|
29
|
+
num: number;
|
|
30
|
+
polygons: Point[][];
|
|
31
|
+
cleanMode: number[];
|
|
32
|
+
shape: CarpetShape[];
|
|
33
|
+
ids: StringOrNumber[];
|
|
34
|
+
type?: number[];
|
|
35
|
+
autoBoost?: number[];
|
|
36
|
+
fineCleaning?: number[];
|
|
37
|
+
sideBrushRotating?: number[];
|
|
38
|
+
}
|
|
39
|
+
export interface AddCarpetResponse extends BaseResponse {
|
|
40
|
+
ids: StringOrNumber[];
|
|
41
|
+
}
|
|
42
|
+
export interface CarpetQueryResponse extends BaseResponse {
|
|
43
|
+
num: number;
|
|
44
|
+
polygons: string[];
|
|
45
|
+
cleanMode?: number[];
|
|
46
|
+
shape?: string[];
|
|
47
|
+
type?: number[];
|
|
48
|
+
ids?: StringOrNumber[];
|
|
49
|
+
autoBoost?: number[];
|
|
50
|
+
fineCleaning?: number[];
|
|
51
|
+
sideBrushRotating?: number[];
|
|
52
|
+
}
|
|
96
53
|
export type TQueryCarpet = (data?: QueryCarpetData) => Promise<CarpetQueryResponse>;
|
|
97
54
|
export type TAddCarpet = (data: AddCarpetData) => Promise<AddCarpetResponse>;
|
|
98
55
|
export type TUpdateCarpet = (data: UpdateCarpetData) => Promise<BaseResponse>;
|
|
99
56
|
export type TDeleteCarpet = (data: DeleteCarpetData) => Promise<BaseResponse>;
|
|
100
57
|
export type TSetCarpet = (data: SetCarpetData) => Promise<CarpetQueryResponse>;
|
|
101
58
|
export type SetCarpetInput = SetCarpetData;
|
|
102
|
-
export {};
|
|
@@ -1,202 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { MqttError } from '../../promise';
|
|
3
|
-
import { BaseResponseSchema, Point } from './base';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 验证失败错误代码
|
|
7
|
-
* -2 表示数据验证失败
|
|
8
|
-
*/
|
|
9
|
-
const VALIDATION_ERROR_CODE = -2;
|
|
10
|
-
|
|
11
|
-
// 形状类型
|
|
12
|
-
const ShapeType = z.union([z.literal('rectangle'), z.literal('round'), z.literal('custom')]);
|
|
13
|
-
|
|
14
|
-
// 请求查询地毯参数 Schema(目前为空,但保留扩展性)
|
|
15
|
-
export const queryCarpetSchema = z.object({});
|
|
16
|
-
|
|
17
|
-
// 添加地毯参数 Schema
|
|
18
|
-
export const addCarpetSchema = z.object({
|
|
19
|
-
shape: z.array(ShapeType),
|
|
20
|
-
polygons: z.array(z.array(Point)),
|
|
21
|
-
num: z.number(),
|
|
22
|
-
type: z.array(z.number()),
|
|
23
|
-
cleanMode: z.array(z.number()),
|
|
24
|
-
autoBoost: z.optional(z.array(z.number())),
|
|
25
|
-
fineCleaning: z.optional(z.array(z.number())),
|
|
26
|
-
sideBrushRotating: z.optional(z.array(z.number()))
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// 更新地毯参数 Schema(所有字段都是可选的,除了 ids)
|
|
30
|
-
export const updateCarpetSchema = z.object({
|
|
31
|
-
ids: z.array(z.union([z.number(), z.string()])),
|
|
32
|
-
shape: z.optional(z.array(ShapeType)),
|
|
33
|
-
type: z.optional(z.array(z.number())),
|
|
34
|
-
cleanMode: z.optional(z.array(z.number())),
|
|
35
|
-
autoBoost: z.optional(z.array(z.number())),
|
|
36
|
-
fineCleaning: z.optional(z.array(z.number())),
|
|
37
|
-
sideBrushRotating: z.optional(z.array(z.number())),
|
|
38
|
-
polygons: z.optional(z.array(z.array(Point)))
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// 删除地毯参数 Schema
|
|
42
|
-
export const deleteCarpetSchema = z.object({
|
|
43
|
-
ids: z.array(z.union([z.number(), z.string()]))
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// 设置地毯参数 Schema
|
|
47
|
-
export const setCarpetSchema = z.object({
|
|
48
|
-
num: z.int().check(z.gte(0), z.lte(100)),
|
|
49
|
-
polygons: z.array(z.array(Point)),
|
|
50
|
-
cleanMode: z.array(z.int()),
|
|
51
|
-
shape: z.array(ShapeType),
|
|
52
|
-
ids: z.array(z.union([z.int(), z.string()])),
|
|
53
|
-
type: z.optional(z.array(z.int())),
|
|
54
|
-
autoBoost: z.optional(z.array(z.int())),
|
|
55
|
-
fineCleaning: z.optional(z.array(z.int())),
|
|
56
|
-
sideBrushRotating: z.optional(z.array(z.int()))
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// 添加地毯响应 Schema
|
|
60
|
-
const addCarpetResponseSchema = z.extend(BaseResponseSchema, {
|
|
61
|
-
// 返回的地毯ID数组
|
|
62
|
-
ids: z.array(z.union([z.int(), z.string()]))
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// 地毯查询响应 Schema
|
|
66
|
-
const carpetQueryResponseSchema = z.extend(BaseResponseSchema, {
|
|
67
|
-
// 地毯数量
|
|
68
|
-
num: z.int(),
|
|
69
|
-
// 轮廓点集合(字符串格式)
|
|
70
|
-
polygons: z.array(z.string()),
|
|
71
|
-
// 清洁属性
|
|
72
|
-
cleanMode: z.optional(z.array(z.int())),
|
|
73
|
-
// 形状
|
|
74
|
-
shape: z.optional(z.array(z.string())),
|
|
75
|
-
// 材质
|
|
76
|
-
type: z.optional(z.array(z.int())),
|
|
77
|
-
// 地毯ID数组
|
|
78
|
-
ids: z.optional(z.array(z.union([z.int(), z.string()]))),
|
|
79
|
-
// 自动增压
|
|
80
|
-
autoBoost: z.optional(z.array(z.int())),
|
|
81
|
-
// 精细清扫
|
|
82
|
-
fineCleaning: z.optional(z.array(z.int())),
|
|
83
|
-
// 边刷旋转
|
|
84
|
-
sideBrushRotating: z.optional(z.array(z.int()))
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// 类型导出
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 验证添加地毯协议数据
|
|
91
|
-
* @param data 已验证基础 schema 的数据
|
|
92
|
-
* @throws MqttError 验证失败时抛出
|
|
93
|
-
*/
|
|
94
|
-
export function validateAddCarpet(data) {
|
|
95
|
-
const {
|
|
96
|
-
num
|
|
97
|
-
} = data;
|
|
98
|
-
|
|
99
|
-
// 验证数组长度一致性
|
|
100
|
-
const validateLength = (name, array) => {
|
|
101
|
-
if (array.length !== num) {
|
|
102
|
-
throw new MqttError(`${name} 长度必须为 ${num},实际为 ${array.length}`, {
|
|
103
|
-
errCode: VALIDATION_ERROR_CODE,
|
|
104
|
-
reqType: 'add_carpet'
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
validateLength('shape', data.shape);
|
|
109
|
-
validateLength('polygons', data.polygons);
|
|
110
|
-
validateLength('type', data.type);
|
|
111
|
-
validateLength('cleanMode', data.cleanMode);
|
|
112
|
-
if (data.autoBoost) {
|
|
113
|
-
validateLength('autoBoost', data.autoBoost);
|
|
114
|
-
}
|
|
115
|
-
if (data.fineCleaning) {
|
|
116
|
-
validateLength('fineCleaning', data.fineCleaning);
|
|
117
|
-
}
|
|
118
|
-
if (data.sideBrushRotating) {
|
|
119
|
-
validateLength('sideBrushRotating', data.sideBrushRotating);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 验证更新地毯协议数据
|
|
125
|
-
* @param data 已验证基础 schema 的数据
|
|
126
|
-
* @throws MqttError 验证失败时抛出
|
|
127
|
-
*/
|
|
128
|
-
export function validateUpdateCarpet(data) {
|
|
129
|
-
const num = data.ids.length;
|
|
130
|
-
|
|
131
|
-
// 验证数组长度一致性(如果提供了数组字段)
|
|
132
|
-
const validateLength = (name, array) => {
|
|
133
|
-
if (array.length !== num) {
|
|
134
|
-
throw new MqttError(`${name} 长度必须为 ${num},实际为 ${array.length}`, {
|
|
135
|
-
errCode: VALIDATION_ERROR_CODE,
|
|
136
|
-
reqType: 'update_carpet'
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
if (data.shape) {
|
|
141
|
-
validateLength('shape', data.shape);
|
|
142
|
-
}
|
|
143
|
-
if (data.type) {
|
|
144
|
-
validateLength('type', data.type);
|
|
145
|
-
}
|
|
146
|
-
if (data.cleanMode) {
|
|
147
|
-
validateLength('cleanMode', data.cleanMode);
|
|
148
|
-
}
|
|
149
|
-
if (data.polygons) {
|
|
150
|
-
validateLength('polygons', data.polygons);
|
|
151
|
-
}
|
|
152
|
-
if (data.autoBoost) {
|
|
153
|
-
validateLength('autoBoost', data.autoBoost);
|
|
154
|
-
}
|
|
155
|
-
if (data.fineCleaning) {
|
|
156
|
-
validateLength('fineCleaning', data.fineCleaning);
|
|
157
|
-
}
|
|
158
|
-
if (data.sideBrushRotating) {
|
|
159
|
-
validateLength('sideBrushRotating', data.sideBrushRotating);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* 验证设置地毯协议数据
|
|
165
|
-
* @param data 已验证基础 schema 的数据
|
|
166
|
-
* @throws MqttError 验证失败时抛出
|
|
167
|
-
*/
|
|
168
|
-
export function validateSetCarpet(data) {
|
|
169
|
-
const {
|
|
170
|
-
num
|
|
171
|
-
} = data;
|
|
172
|
-
|
|
173
|
-
// 验证数组长度一致性
|
|
174
|
-
const validateLength = (name, array) => {
|
|
175
|
-
if (array.length !== num) {
|
|
176
|
-
throw new MqttError(`${name} 长度必须为 ${num},实际为 ${array.length}`, {
|
|
177
|
-
errCode: VALIDATION_ERROR_CODE,
|
|
178
|
-
reqType: 'set_carpet'
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
validateLength('polygons', data.polygons);
|
|
183
|
-
validateLength('cleanMode', data.cleanMode);
|
|
184
|
-
validateLength('shape', data.shape);
|
|
185
|
-
validateLength('ids', data.ids);
|
|
186
|
-
if (data.type) {
|
|
187
|
-
validateLength('type', data.type);
|
|
188
|
-
}
|
|
189
|
-
if (data.autoBoost) {
|
|
190
|
-
validateLength('autoBoost', data.autoBoost);
|
|
191
|
-
}
|
|
192
|
-
if (data.fineCleaning) {
|
|
193
|
-
validateLength('fineCleaning', data.fineCleaning);
|
|
194
|
-
}
|
|
195
|
-
if (data.sideBrushRotating) {
|
|
196
|
-
validateLength('sideBrushRotating', data.sideBrushRotating);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// 函数类型定义
|
|
201
|
-
|
|
202
|
-
// 导出 SetCarpetInput 类型别名(向后兼容)
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
version: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
7
|
-
taskId: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
8
|
-
info: import("../../../myLib/zod/src/v4/mini/schemas").ZodMiniString<string>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
export type TRequestDevInfo = () => Promise<z.infer<typeof devInfoResponseSchema>>;
|
|
11
|
-
export {};
|
|
1
|
+
import type { BaseResponse } from './base';
|
|
2
|
+
export interface DevInfoResponse extends BaseResponse {
|
|
3
|
+
info: string;
|
|
4
|
+
}
|
|
5
|
+
export type TRequestDevInfo = () => Promise<DevInfoResponse>;
|