@ray-js/robot-data-stream 0.0.14 → 0.0.15-beta.1
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/createCommonOptions.d.ts +4 -2
- package/lib/mqtt/createCommonOptions.js +10 -5
- package/lib/mqtt/hooks/useStructuredMessage.d.ts +14 -0
- package/lib/mqtt/hooks/useStructuredMessage.js +131 -0
- package/lib/mqtt/mqttProvider.d.ts +19 -1
- package/lib/mqtt/mqttProvider.js +69 -8
- package/lib/mqtt/promise.d.ts +57 -4
- package/lib/mqtt/promise.js +115 -36
- package/lib/mqtt/type/fun.d.ts +49 -0
- package/lib/mqtt/type/fun.js +145 -0
- package/lib/mqtt/type/index.d.ts +0 -7
- package/lib/mqtt/type/index.js +0 -1
- package/lib/mqtt/type/protocols/base.d.ts +5 -0
- package/lib/mqtt/type/protocols/base.js +32 -0
- package/lib/mqtt/type/protocols/carpetCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/carpetCleanProtocol.js +16 -0
- package/lib/mqtt/type/protocols/carpetProtocol.d.ts +41 -0
- package/lib/mqtt/type/protocols/carpetProtocol.js +202 -0
- package/lib/mqtt/type/protocols/devInfoProtocol.d.ts +5 -0
- package/lib/mqtt/type/protocols/devInfoProtocol.js +12 -0
- package/lib/mqtt/type/protocols/deviceModelProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/deviceModelProtocol.js +34 -0
- package/lib/mqtt/type/protocols/furnitureModelProtocol.d.ts +10 -0
- package/lib/mqtt/type/protocols/furnitureModelProtocol.js +35 -0
- package/lib/mqtt/type/protocols/historyMapProtocol.d.ts +17 -0
- package/lib/mqtt/type/protocols/historyMapProtocol.js +37 -0
- package/lib/mqtt/type/protocols/index.d.ts +20 -0
- package/lib/mqtt/type/protocols/index.js +20 -0
- package/lib/mqtt/type/protocols/partDivisionProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/partDivisionProtocol.js +12 -0
- package/lib/mqtt/type/protocols/partMergeProtocol.d.ts +7 -0
- package/lib/mqtt/type/protocols/partMergeProtocol.js +12 -0
- package/lib/mqtt/type/protocols/passwordProtocol.d.ts +11 -0
- package/lib/mqtt/type/protocols/passwordProtocol.js +25 -0
- package/lib/mqtt/type/protocols/quietHoursProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/quietHoursProtocol.js +35 -0
- package/lib/mqtt/type/protocols/resetMapProtocol.d.ts +4 -0
- package/lib/mqtt/type/protocols/resetMapProtocol.js +1 -0
- package/lib/mqtt/type/protocols/roomPropertyProtocol.d.ts +14 -0
- package/lib/mqtt/type/protocols/roomPropertyProtocol.js +113 -0
- package/lib/mqtt/type/protocols/scheduleProtocol.d.ts +18 -0
- package/lib/mqtt/type/protocols/scheduleProtocol.js +100 -0
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/selectRoomCleanProtocol.js +40 -0
- package/lib/mqtt/type/protocols/spotCleanProtocol.d.ts +9 -0
- package/lib/mqtt/type/protocols/spotCleanProtocol.js +72 -0
- package/lib/mqtt/type/protocols/virtualAreaProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/virtualAreaProtocol.js +36 -0
- package/lib/mqtt/type/protocols/virtualWallProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/virtualWallProtocol.js +25 -0
- package/lib/mqtt/type/protocols/voiceProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/voiceProtocol.js +23 -0
- package/lib/mqtt/type/protocols/wifiMapProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/wifiMapProtocol.js +14 -0
- package/lib/mqtt/type/protocols/zoneCleanProtocol.d.ts +8 -0
- package/lib/mqtt/type/protocols/zoneCleanProtocol.js +49 -0
- package/lib/mqtt/useCarpet.d.ts +7 -67
- package/lib/mqtt/useCarpet.js +101 -181
- package/lib/mqtt/useCarpetClean.d.ts +2 -11
- package/lib/mqtt/useCarpetClean.js +24 -51
- package/lib/mqtt/useDevInfo.d.ts +8 -6
- package/lib/mqtt/useDevInfo.js +44 -36
- package/lib/mqtt/useDeviceModel.d.ts +6 -19
- package/lib/mqtt/useDeviceModel.js +29 -42
- package/lib/mqtt/useFurnitureModel.d.ts +6 -18
- package/lib/mqtt/useFurnitureModel.js +29 -43
- package/lib/mqtt/useHistoryMap.d.ts +2 -18
- package/lib/mqtt/useHistoryMap.js +102 -119
- package/lib/mqtt/usePartDivision.d.ts +2 -9
- package/lib/mqtt/usePartDivision.js +48 -57
- package/lib/mqtt/usePartMerge.d.ts +2 -8
- package/lib/mqtt/usePartMerge.js +34 -49
- package/lib/mqtt/usePassword.d.ts +6 -13
- package/lib/mqtt/usePassword.js +84 -74
- package/lib/mqtt/useQuiteHours.d.ts +4 -37
- package/lib/mqtt/useQuiteHours.js +66 -100
- package/lib/mqtt/useResetMap.d.ts +2 -8
- package/lib/mqtt/useResetMap.js +27 -34
- package/lib/mqtt/useRoomProperty.d.ts +8 -9
- package/lib/mqtt/useRoomProperty.js +67 -65
- package/lib/mqtt/useSchedule.d.ts +3 -23
- package/lib/mqtt/useSchedule.js +72 -101
- package/lib/mqtt/useSelectRoomClean.d.ts +3 -24
- package/lib/mqtt/useSelectRoomClean.js +107 -133
- package/lib/mqtt/useSpotClean.d.ts +5 -15
- package/lib/mqtt/useSpotClean.js +68 -121
- package/lib/mqtt/useVirtualArea.d.ts +6 -17
- package/lib/mqtt/useVirtualArea.js +109 -119
- package/lib/mqtt/useVirtualWall.d.ts +2 -18
- package/lib/mqtt/useVirtualWall.js +69 -90
- package/lib/mqtt/useVoice.d.ts +2 -16
- package/lib/mqtt/useVoice.js +48 -68
- package/lib/mqtt/useWifiMap.d.ts +6 -5
- package/lib/mqtt/useWifiMap.js +43 -42
- package/lib/mqtt/useZoneClean.d.ts +2 -21
- package/lib/mqtt/useZoneClean.js +125 -137
- package/lib/myLib/zod/mini/index.d.cts +1 -0
- package/lib/myLib/zod/mini/index.d.ts +1 -0
- package/lib/myLib/zod/mini/index.js +1 -0
- package/lib/myLib/zod/mini/package.json +6 -0
- package/lib/myLib/zod/src/mini/index.d.ts +1 -0
- package/lib/myLib/zod/src/mini/index.js +1 -0
- package/lib/myLib/zod/src/v4/core/api.d.ts +306 -0
- package/lib/myLib/zod/src/v4/core/api.js +1256 -0
- package/lib/myLib/zod/src/v4/core/checks.d.ts +278 -0
- package/lib/myLib/zod/src/v4/core/checks.js +816 -0
- package/lib/myLib/zod/src/v4/core/config.d.ts +9 -0
- package/lib/myLib/zod/src/v4/core/config.js +5 -0
- package/lib/myLib/zod/src/v4/core/core.d.ts +70 -0
- package/lib/myLib/zod/src/v4/core/core.js +95 -0
- package/lib/myLib/zod/src/v4/core/doc.d.ts +14 -0
- package/lib/myLib/zod/src/v4/core/doc.js +42 -0
- package/lib/myLib/zod/src/v4/core/errors.d.ts +220 -0
- package/lib/myLib/zod/src/v4/core/errors.js +232 -0
- package/lib/myLib/zod/src/v4/core/index.d.ts +15 -0
- package/lib/myLib/zod/src/v4/core/index.js +15 -0
- package/lib/myLib/zod/src/v4/core/json-schema-generator.d.ts +65 -0
- package/lib/myLib/zod/src/v4/core/json-schema-generator.js +120 -0
- package/lib/myLib/zod/src/v4/core/json-schema-processors.d.ts +49 -0
- package/lib/myLib/zod/src/v4/core/json-schema-processors.js +593 -0
- package/lib/myLib/zod/src/v4/core/json-schema.d.ts +88 -0
- package/lib/myLib/zod/src/v4/core/json-schema.js +1 -0
- package/lib/myLib/zod/src/v4/core/parse.d.ts +49 -0
- package/lib/myLib/zod/src/v4/core/parse.js +147 -0
- package/lib/myLib/zod/src/v4/core/regexes.d.ts +78 -0
- package/lib/myLib/zod/src/v4/core/regexes.js +146 -0
- package/lib/myLib/zod/src/v4/core/registries.d.ts +35 -0
- package/lib/myLib/zod/src/v4/core/registries.js +51 -0
- package/lib/myLib/zod/src/v4/core/schemas.d.ts +1136 -0
- package/lib/myLib/zod/src/v4/core/schemas.js +2745 -0
- package/lib/myLib/zod/src/v4/core/standard-schema.d.ts +126 -0
- package/lib/myLib/zod/src/v4/core/standard-schema.js +1 -0
- package/lib/myLib/zod/src/v4/core/to-json-schema.d.ts +114 -0
- package/lib/myLib/zod/src/v4/core/to-json-schema.js +488 -0
- package/lib/myLib/zod/src/v4/core/util.d.ts +199 -0
- package/lib/myLib/zod/src/v4/core/util.js +656 -0
- package/lib/myLib/zod/src/v4/core/versions.d.ts +5 -0
- package/lib/myLib/zod/src/v4/core/versions.js +5 -0
- package/lib/myLib/zod/src/v4/core/zsf.d.ts +91 -0
- package/lib/myLib/zod/src/v4/core/zsf.js +1 -0
- package/lib/myLib/zod/src/v4/mini/checks.d.ts +1 -0
- package/lib/myLib/zod/src/v4/mini/checks.js +1 -0
- package/lib/myLib/zod/src/v4/mini/coerce.d.ts +7 -0
- package/lib/myLib/zod/src/v4/mini/coerce.js +27 -0
- package/lib/myLib/zod/src/v4/mini/external.d.ts +11 -0
- package/lib/myLib/zod/src/v4/mini/external.js +16 -0
- package/lib/myLib/zod/src/v4/mini/index.d.ts +3 -0
- package/lib/myLib/zod/src/v4/mini/index.js +3 -0
- package/lib/myLib/zod/src/v4/mini/iso.d.ts +22 -0
- package/lib/myLib/zod/src/v4/mini/iso.js +46 -0
- package/lib/myLib/zod/src/v4/mini/parse.d.ts +1 -0
- package/lib/myLib/zod/src/v4/mini/parse.js +1 -0
- package/lib/myLib/zod/src/v4/mini/schemas.js +1244 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/package.json +5 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './scheduleProtocol';
|
|
2
|
+
export * from './carpetProtocol';
|
|
3
|
+
export * from './zoneCleanProtocol';
|
|
4
|
+
export * from './wifiMapProtocol';
|
|
5
|
+
export * from './voiceProtocol';
|
|
6
|
+
export * from './virtualWallProtocol';
|
|
7
|
+
export * from './virtualAreaProtocol';
|
|
8
|
+
export * from './spotCleanProtocol';
|
|
9
|
+
export * from './selectRoomCleanProtocol';
|
|
10
|
+
export * from './resetMapProtocol';
|
|
11
|
+
export * from './quietHoursProtocol';
|
|
12
|
+
export * from './passwordProtocol';
|
|
13
|
+
export * from './partMergeProtocol';
|
|
14
|
+
export * from './partDivisionProtocol';
|
|
15
|
+
export * from './historyMapProtocol';
|
|
16
|
+
export * from './furnitureModelProtocol';
|
|
17
|
+
export * from './deviceModelProtocol';
|
|
18
|
+
export * from './carpetCleanProtocol';
|
|
19
|
+
export * from './devInfoProtocol';
|
|
20
|
+
export * from './roomPropertyProtocol';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const pointsSchema: any;
|
|
3
|
+
export declare const roomIdSchema: any;
|
|
4
|
+
export declare const originSchema: any;
|
|
5
|
+
declare const partDivisionResponseSchema: any;
|
|
6
|
+
export type PartDivisionResponse = z.infer<typeof partDivisionResponseSchema>;
|
|
7
|
+
export type TSetPartDivision = (points: z.infer<typeof pointsSchema>, roomId: z.infer<typeof roomIdSchema>, origin: z.infer<typeof originSchema>) => Promise<PartDivisionResponse>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema, Point } from './base';
|
|
3
|
+
export const pointsSchema = z.array(Point).check(z.minLength(1));
|
|
4
|
+
export const roomIdSchema = z.union([z.int(), z.string()]);
|
|
5
|
+
export const originSchema = Point;
|
|
6
|
+
|
|
7
|
+
// 房间分隔响应 Schema(BaseResponseSchema 已包含所有必需字段)
|
|
8
|
+
const partDivisionResponseSchema = BaseResponseSchema;
|
|
9
|
+
|
|
10
|
+
// 类型导出
|
|
11
|
+
|
|
12
|
+
// 函数类型定义
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setPartMergeSchema: any;
|
|
3
|
+
declare const partMergeResponseSchema: any;
|
|
4
|
+
export type SetPartMergeData = z.infer<typeof setPartMergeSchema>;
|
|
5
|
+
export type PartMergeResponse = z.infer<typeof partMergeResponseSchema>;
|
|
6
|
+
export type TSetPartMerge = (data: SetPartMergeData) => Promise<PartMergeResponse>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema } from './base';
|
|
3
|
+
|
|
4
|
+
// 设置分区合并参数 Schema
|
|
5
|
+
export const setPartMergeSchema = z.array(z.union([z.int(), z.string()])).check(z.minLength(2));
|
|
6
|
+
|
|
7
|
+
// 分区合并响应 Schema(BaseResponseSchema 已包含所有必需字段)
|
|
8
|
+
const partMergeResponseSchema = BaseResponseSchema;
|
|
9
|
+
|
|
10
|
+
// 类型导出
|
|
11
|
+
|
|
12
|
+
// 函数类型定义
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setPasswordSchema: any;
|
|
3
|
+
export declare const checkPasswordSchema: any;
|
|
4
|
+
declare const passwordResponseSchema: any;
|
|
5
|
+
export type SetPasswordData = z.infer<typeof setPasswordSchema>;
|
|
6
|
+
export type CheckPasswordData = z.infer<typeof checkPasswordSchema>;
|
|
7
|
+
export type PasswordResponse = z.infer<typeof passwordResponseSchema>;
|
|
8
|
+
export type TRequestPassword = () => Promise<PasswordResponse>;
|
|
9
|
+
export type TSetPassword = (data: SetPasswordData) => Promise<PasswordResponse>;
|
|
10
|
+
export type TCheckPassword = (data: CheckPasswordData) => Promise<PasswordResponse>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema } from './base';
|
|
3
|
+
|
|
4
|
+
// 设置密码参数 Schema
|
|
5
|
+
export const setPasswordSchema = z.object({
|
|
6
|
+
password: z.string(),
|
|
7
|
+
// 密码(MD5 加密后的字符串)
|
|
8
|
+
oldPassword: z.optional(z.string()),
|
|
9
|
+
// 旧密码(MD5 加密后的字符串,可选)
|
|
10
|
+
taskId: z.optional(z.string()) // 任务ID(可选)
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// 校验密码参数 Schema
|
|
14
|
+
export const checkPasswordSchema = z.object({
|
|
15
|
+
password: z.string(),
|
|
16
|
+
// 密码(MD5 加密后的字符串)
|
|
17
|
+
taskId: z.optional(z.string()) // 任务ID(可选)
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// 密码响应 Schema(基础响应)
|
|
21
|
+
const passwordResponseSchema = BaseResponseSchema;
|
|
22
|
+
|
|
23
|
+
// 类型导出
|
|
24
|
+
|
|
25
|
+
// 函数类型定义
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setQuietHoursSchema: any;
|
|
3
|
+
declare const quietHoursResponseSchema: any;
|
|
4
|
+
export type SetQuietHoursData = z.infer<typeof setQuietHoursSchema>;
|
|
5
|
+
export type QuietHoursResponse = z.infer<typeof quietHoursResponseSchema>;
|
|
6
|
+
export type TRequestQuietHours = () => Promise<QuietHoursResponse>;
|
|
7
|
+
export type TSetQuietHours = (data: SetQuietHoursData) => Promise<QuietHoursResponse>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema } from './base';
|
|
3
|
+
|
|
4
|
+
// 时间对象 Schema
|
|
5
|
+
const timeSchema = z.object({
|
|
6
|
+
hour: z.int().check(z.gte(0), z.lte(23)),
|
|
7
|
+
minute: z.int().check(z.gte(0), z.lte(59))
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// 设置勿扰模式参数 Schema
|
|
11
|
+
export const setQuietHoursSchema = z.object({
|
|
12
|
+
startTime: timeSchema,
|
|
13
|
+
// 开始时间
|
|
14
|
+
endTime: timeSchema,
|
|
15
|
+
// 结束时间
|
|
16
|
+
active: z.int().check(z.gte(0), z.lte(1)),
|
|
17
|
+
// 1:开启 0:关闭
|
|
18
|
+
day: z.int(),
|
|
19
|
+
// 是否有跨天,1:有 0:无
|
|
20
|
+
version: z.optional(z.string()) // 协议版本(可选)
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// 勿扰模式响应 Schema
|
|
24
|
+
const quietHoursResponseSchema = z.extend(BaseResponseSchema, {
|
|
25
|
+
// 是否激活,0 表示未激活,1 表示激活
|
|
26
|
+
active: z.int(),
|
|
27
|
+
// 时间段数组,每个元素为 "开始时间, 结束时间" 的字符串
|
|
28
|
+
time: z.array(z.string()),
|
|
29
|
+
// 星期几,1 表示星期一,2 表示星期二,以此类推
|
|
30
|
+
day: z.int()
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// 类型导出
|
|
34
|
+
|
|
35
|
+
// 函数类型定义
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setRoomPropertySchema: any;
|
|
3
|
+
declare const roomPropertyResponseSchema: any;
|
|
4
|
+
/**
|
|
5
|
+
* 验证设置房间属性协议数据
|
|
6
|
+
* @param data 已验证基础 schema 的数据
|
|
7
|
+
* @throws MqttError 验证失败时抛出
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateSetRoomProperty(data: SetRoomPropertyData): void;
|
|
10
|
+
export type TRequestRoomProperty = () => Promise<RoomPropertyResponse>;
|
|
11
|
+
export type TSetRoomProperty = (data: SetRoomPropertyData) => Promise<RoomPropertyResponse>;
|
|
12
|
+
export type SetRoomPropertyData = z.infer<typeof setRoomPropertySchema>;
|
|
13
|
+
export type RoomPropertyResponse = z.infer<typeof roomPropertyResponseSchema>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { MqttError } from '../../promise';
|
|
3
|
+
import { BaseResponseSchema } from './base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 验证失败错误代码
|
|
7
|
+
* -2 表示数据验证失败
|
|
8
|
+
*/
|
|
9
|
+
const VALIDATION_ERROR_CODE = -2;
|
|
10
|
+
|
|
11
|
+
// 设置房间属性参数 Schema
|
|
12
|
+
export const setRoomPropertySchema = z.object({
|
|
13
|
+
// 房间数量(可选,如果不提供则使用 ids.length)
|
|
14
|
+
num: z.optional(z.int().check(z.gte(1))),
|
|
15
|
+
// 房间id集合(必需)
|
|
16
|
+
ids: z.array(z.int()).check(z.minLength(1)),
|
|
17
|
+
// 吸力
|
|
18
|
+
suctions: z.optional(z.array(z.string())),
|
|
19
|
+
// 拖地水量
|
|
20
|
+
cisterns: z.optional(z.array(z.string())),
|
|
21
|
+
// 清扫次数
|
|
22
|
+
cleanCounts: z.optional(z.array(z.int())),
|
|
23
|
+
// 拖地模式
|
|
24
|
+
yMops: z.optional(z.array(z.int())),
|
|
25
|
+
// 扫拖模式
|
|
26
|
+
sweepMopModes: z.optional(z.array(z.string())),
|
|
27
|
+
// 房间地板类型
|
|
28
|
+
floorTypes: z.optional(z.array(z.int())),
|
|
29
|
+
// 房间名称
|
|
30
|
+
names: z.optional(z.array(z.string())),
|
|
31
|
+
// 房间顺序
|
|
32
|
+
orders: z.optional(z.array(z.int()))
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 房间属性响应 Schema
|
|
36
|
+
const roomPropertyResponseSchema = z.extend(BaseResponseSchema, {
|
|
37
|
+
// RoomPreferenceFieldsSchema 的字段
|
|
38
|
+
suctions: z.optional(z.array(z.string())),
|
|
39
|
+
cisterns: z.optional(z.array(z.string())),
|
|
40
|
+
cleanCounts: z.optional(z.array(z.int())),
|
|
41
|
+
yMops: z.optional(z.array(z.int())),
|
|
42
|
+
sweepMopModes: z.optional(z.array(z.string())),
|
|
43
|
+
ids: z.optional(z.array(z.int())),
|
|
44
|
+
// 房间数量
|
|
45
|
+
num: z.int(),
|
|
46
|
+
// 地图id
|
|
47
|
+
mapId: z.int(),
|
|
48
|
+
// 房间地板类型
|
|
49
|
+
floorTypes: z.optional(z.array(z.int())),
|
|
50
|
+
// 房间名称
|
|
51
|
+
names: z.optional(z.array(z.string())),
|
|
52
|
+
// 房间顺序
|
|
53
|
+
orders: z.optional(z.array(z.int()))
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 验证设置房间属性协议数据
|
|
58
|
+
* @param data 已验证基础 schema 的数据
|
|
59
|
+
* @throws MqttError 验证失败时抛出
|
|
60
|
+
*/
|
|
61
|
+
export function validateSetRoomProperty(data) {
|
|
62
|
+
const {
|
|
63
|
+
ids,
|
|
64
|
+
num
|
|
65
|
+
} = data;
|
|
66
|
+
const len = ids.length;
|
|
67
|
+
|
|
68
|
+
// 验证 num 与 ids 长度一致(如果提供了 num)
|
|
69
|
+
if (num !== undefined && num !== len) {
|
|
70
|
+
throw new MqttError(`num (${num}) must equal ids length (${len})`, {
|
|
71
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
72
|
+
reqType: 'set_room_property'
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 验证数组长度一致性(如果提供了数组字段)
|
|
77
|
+
const validateLength = (name, array) => {
|
|
78
|
+
if (array.length !== len) {
|
|
79
|
+
throw new MqttError(`${name} length must be ${len}, actual is ${array.length}`, {
|
|
80
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
81
|
+
reqType: 'set_room_property'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (data.suctions) {
|
|
86
|
+
validateLength('suctions', data.suctions);
|
|
87
|
+
}
|
|
88
|
+
if (data.cisterns) {
|
|
89
|
+
validateLength('cisterns', data.cisterns);
|
|
90
|
+
}
|
|
91
|
+
if (data.cleanCounts) {
|
|
92
|
+
validateLength('cleanCounts', data.cleanCounts);
|
|
93
|
+
}
|
|
94
|
+
if (data.yMops) {
|
|
95
|
+
validateLength('yMops', data.yMops);
|
|
96
|
+
}
|
|
97
|
+
if (data.sweepMopModes) {
|
|
98
|
+
validateLength('sweepMopModes', data.sweepMopModes);
|
|
99
|
+
}
|
|
100
|
+
if (data.floorTypes) {
|
|
101
|
+
validateLength('floorTypes', data.floorTypes);
|
|
102
|
+
}
|
|
103
|
+
if (data.names) {
|
|
104
|
+
validateLength('names', data.names);
|
|
105
|
+
}
|
|
106
|
+
if (data.orders) {
|
|
107
|
+
validateLength('orders', data.orders);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// 函数类型定义
|
|
112
|
+
|
|
113
|
+
// 类型导出
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const ScheduleItemSchema: any;
|
|
3
|
+
export declare const setScheduleSchema: any;
|
|
4
|
+
export declare const requestScheduleSchema: any;
|
|
5
|
+
/**
|
|
6
|
+
* 验证定时任务协议数据
|
|
7
|
+
* @param data 已验证基础 schema 的数据
|
|
8
|
+
* @throws MqttError 验证失败时抛出
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateSetSchedule(data: SetScheduleData): void;
|
|
11
|
+
declare const ScheduleResponseSchema: any;
|
|
12
|
+
export type SetScheduleData = z.infer<typeof setScheduleSchema>;
|
|
13
|
+
export type ScheduleResponse = z.infer<typeof ScheduleResponseSchema>;
|
|
14
|
+
export type TRequestSchedule = (message?: {
|
|
15
|
+
version?: string;
|
|
16
|
+
}) => Promise<ScheduleResponse>;
|
|
17
|
+
export type TSetSchedule = (message: SetScheduleData) => Promise<ScheduleResponse>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
3
|
+
import * as z from 'zod/mini';
|
|
4
|
+
import { MqttError } from '../../promise';
|
|
5
|
+
import { BaseResponseSchema, RoomPreferenceFieldsSchema } from './base';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 验证失败错误代码
|
|
9
|
+
* -2 表示数据验证失败
|
|
10
|
+
*/
|
|
11
|
+
const VALIDATION_ERROR_CODE = -2;
|
|
12
|
+
|
|
13
|
+
// 定时任务项 Schema
|
|
14
|
+
export const ScheduleItemSchema = z.extend(RoomPreferenceFieldsSchema, {
|
|
15
|
+
// 定时是否有效,0:定时关闭 1:定时开启
|
|
16
|
+
active: z.int().check(z.gte(0), z.lte(1)),
|
|
17
|
+
// 周循环,周一到周日
|
|
18
|
+
cycle: z.array(z.int().check(z.gte(0), z.lte(6))).check(z.length(7)),
|
|
19
|
+
// 执行时间, [小时, 分钟]
|
|
20
|
+
time: z.array(z.int()).check(z.length(2))
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// 定时任务数据 Schema
|
|
24
|
+
export const setScheduleSchema = z.object({
|
|
25
|
+
list: z.array(ScheduleItemSchema).check(z.minLength(0)),
|
|
26
|
+
num: z.int().check(z.gte(0)),
|
|
27
|
+
version: z.optional(z.string()) // 版本号
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 请求定时数据的参数 Schema
|
|
31
|
+
export const requestScheduleSchema = z.object({
|
|
32
|
+
version: z.optional(z.string())
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 验证定时任务协议数据
|
|
37
|
+
* @param data 已验证基础 schema 的数据
|
|
38
|
+
* @throws MqttError 验证失败时抛出
|
|
39
|
+
*/
|
|
40
|
+
export function validateSetSchedule(data) {
|
|
41
|
+
const {
|
|
42
|
+
num,
|
|
43
|
+
list
|
|
44
|
+
} = data;
|
|
45
|
+
|
|
46
|
+
// 验证 num 必须等于 list.length
|
|
47
|
+
if (num !== list.length) {
|
|
48
|
+
throw new MqttError(`num 必须等于 list.length,实际 num=${num}, list.length=${list.length}`, {
|
|
49
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
50
|
+
reqType: 'set_schedule'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// 如果 list 为空,直接返回(允许清空所有定时任务)
|
|
55
|
+
if (list.length === 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 验证每个定时任务项
|
|
60
|
+
list.forEach((item, index) => {
|
|
61
|
+
// 验证 time 数组的有效性
|
|
62
|
+
if (item.time.length !== 2) {
|
|
63
|
+
throw new MqttError(`list[${index}].time 必须包含 2 个元素 [小时, 分钟]`, {
|
|
64
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
65
|
+
reqType: 'set_schedule'
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const [hour, minute] = item.time;
|
|
69
|
+
if (hour < 0 || hour >= 24) {
|
|
70
|
+
throw new MqttError(`list[${index}].time[0] 小时必须在 0-23 之间,实际为 ${hour}`, {
|
|
71
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
72
|
+
reqType: 'set_schedule'
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (minute < 0 || minute >= 60) {
|
|
76
|
+
throw new MqttError(`list[${index}].time[1] 分钟必须在 0-59 之间,实际为 ${minute}`, {
|
|
77
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
78
|
+
reqType: 'set_schedule'
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 验证 cycle 数组长度
|
|
83
|
+
if (item.cycle.length !== 7) {
|
|
84
|
+
throw new MqttError(`list[${index}].cycle 必须包含 7 个元素 (周一到周日),实际为 ${item.cycle.length}`, {
|
|
85
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
86
|
+
reqType: 'set_schedule'
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 定时任务响应 Schema
|
|
93
|
+
const ScheduleResponseSchema = z.extend(BaseResponseSchema, {
|
|
94
|
+
list: z.array(ScheduleItemSchema),
|
|
95
|
+
num: z.int().check(z.gte(0))
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// 类型导出
|
|
99
|
+
|
|
100
|
+
// 函数类型定义
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setSelectRoomCleanSchema: any;
|
|
3
|
+
declare const selectRoomCleanResponseSchema: any;
|
|
4
|
+
export type SetSelectRoomCleanData = z.infer<typeof setSelectRoomCleanSchema>;
|
|
5
|
+
export type SelectRoomCleanResponse = z.infer<typeof selectRoomCleanResponseSchema>;
|
|
6
|
+
export type TRequestSelectRoomClean = () => Promise<SelectRoomCleanResponse>;
|
|
7
|
+
export type TSetSelectRoomClean = (data: SetSelectRoomCleanData) => Promise<SelectRoomCleanResponse>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema } from './base';
|
|
3
|
+
|
|
4
|
+
// 房间信息 Schema
|
|
5
|
+
const roomInfoSchema = z.object({
|
|
6
|
+
roomId: z.int(),
|
|
7
|
+
// 房间id
|
|
8
|
+
suction: z.optional(z.string()),
|
|
9
|
+
// 吸力, closed - 关闭 gentle - 安静 normal - 正常 strong - 强劲 max - 超强 ,默认值为''
|
|
10
|
+
cistern: z.string(),
|
|
11
|
+
// 拖地水量 "closed"- 关闭,"low"-低,"middle"-中,"high"-高,默认值为''
|
|
12
|
+
cleanTimes: z.optional(z.int()),
|
|
13
|
+
// 清扫次数 默认值1
|
|
14
|
+
yMop: z.optional(z.int()),
|
|
15
|
+
// 拖地模式 1:开启Y型拖地 0:关闭Y型拖地 -1 未设置 默认值-1
|
|
16
|
+
sweepMopMode: z.optional(z.string()) // 扫拖模式 "only_sweep":仅扫,"only_mop":仅拖,"both_work":扫拖同时,"clean_before_mop":先扫后拖,默认值为'only_sweep'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// 设置选区清扫参数 Schema
|
|
20
|
+
export const setSelectRoomCleanSchema = z.array(roomInfoSchema).check(z.minLength(1)); // 房间信息数组
|
|
21
|
+
|
|
22
|
+
// 选区清扫响应 Schema
|
|
23
|
+
const selectRoomCleanResponseSchema = z.extend(BaseResponseSchema, {
|
|
24
|
+
// 房间id
|
|
25
|
+
ids: z.array(z.int()),
|
|
26
|
+
// 吸力, closed - 关闭 gentle - 安静 normal - 正常 strong - 强劲 max - 超强 ,默认值为''
|
|
27
|
+
suctions: z.optional(z.array(z.string())),
|
|
28
|
+
// 拖地水量 "closed"- 关闭,"low"-低,"middle"-中,"high"-高,默认值为''
|
|
29
|
+
cisterns: z.optional(z.array(z.string())),
|
|
30
|
+
// 清扫次数 默认值1
|
|
31
|
+
cleanCounts: z.optional(z.array(z.int())),
|
|
32
|
+
// 拖地模式 1:开启Y型拖地 0:关闭Y型拖地 -1 未设置 默认值-1
|
|
33
|
+
yMops: z.optional(z.array(z.int())),
|
|
34
|
+
// 扫拖模式 "only_sweep":仅扫,"only_mop":仅拖,"both_work":扫拖同时,"clean_before_mop":先扫后拖,默认值为'only_sweep'
|
|
35
|
+
sweepMopModes: z.optional(z.array(z.string()))
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// 类型导出
|
|
39
|
+
|
|
40
|
+
// 函数类型定义
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setSpotCleanSchema: any;
|
|
3
|
+
declare const spotCleanResponseSchema: any;
|
|
4
|
+
export type SetSpotCleanData = z.infer<typeof setSpotCleanSchema>;
|
|
5
|
+
export type SpotCleanResponse = z.infer<typeof spotCleanResponseSchema>;
|
|
6
|
+
export declare function validateSetSpotClean(data: SetSpotCleanData): void;
|
|
7
|
+
export type TRequestSpotClean = () => Promise<SpotCleanResponse>;
|
|
8
|
+
export type TSetSpotClean = (data: SetSpotCleanData) => Promise<SpotCleanResponse>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { MqttError } from '../../promise';
|
|
3
|
+
import { BaseResponseSchema, Point, RoomPreferenceFieldsSchema } from './base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 验证失败错误代码
|
|
7
|
+
* -2 表示数据验证失败
|
|
8
|
+
*/
|
|
9
|
+
const VALIDATION_ERROR_CODE = -2;
|
|
10
|
+
|
|
11
|
+
// 设置定点清扫参数 Schema
|
|
12
|
+
export const setSpotCleanSchema = z.extend(RoomPreferenceFieldsSchema, {
|
|
13
|
+
spots: z.array(Point).check(z.minLength(1)),
|
|
14
|
+
// 定点清扫的点数组
|
|
15
|
+
origin: z.optional(Point) // 原点坐标(可选)
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// 定点清扫响应 Schema
|
|
19
|
+
const spotCleanResponseSchema = z.extend(BaseResponseSchema, {
|
|
20
|
+
// RoomPreferenceFieldsSchema 的字段
|
|
21
|
+
suctions: z.optional(z.array(z.string())),
|
|
22
|
+
cisterns: z.optional(z.array(z.string())),
|
|
23
|
+
cleanCounts: z.optional(z.array(z.int())),
|
|
24
|
+
yMops: z.optional(z.array(z.int())),
|
|
25
|
+
sweepMopModes: z.optional(z.array(z.string())),
|
|
26
|
+
ids: z.optional(z.array(z.int())),
|
|
27
|
+
// 多边形数组(字符串格式)
|
|
28
|
+
polygons: z.array(z.string()),
|
|
29
|
+
// 名称数组(可选)
|
|
30
|
+
names: z.optional(z.array(z.string()))
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// 类型导出
|
|
34
|
+
|
|
35
|
+
// 自定义验证函数:验证数组长度一致性
|
|
36
|
+
export function validateSetSpotClean(data) {
|
|
37
|
+
const num = data.spots.length;
|
|
38
|
+
|
|
39
|
+
// 如果提供了数组字段,检查长度是否一致
|
|
40
|
+
if (data.suctions && data.suctions.length !== num) {
|
|
41
|
+
throw new MqttError(`suctions 数组长度 (${data.suctions.length}) 与 spots 数组长度 (${num}) 不一致`, {
|
|
42
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
43
|
+
reqType: 'set_spot_clean'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (data.cisterns && data.cisterns.length !== num) {
|
|
47
|
+
throw new MqttError(`cisterns 数组长度 (${data.cisterns.length}) 与 spots 数组长度 (${num}) 不一致`, {
|
|
48
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
49
|
+
reqType: 'set_spot_clean'
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (data.cleanCounts && data.cleanCounts.length !== num) {
|
|
53
|
+
throw new MqttError(`cleanCounts 数组长度 (${data.cleanCounts.length}) 与 spots 数组长度 (${num}) 不一致`, {
|
|
54
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
55
|
+
reqType: 'set_spot_clean'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (data.yMops && data.yMops.length !== num) {
|
|
59
|
+
throw new MqttError(`yMops 数组长度 (${data.yMops.length}) 与 spots 数组长度 (${num}) 不一致`, {
|
|
60
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
61
|
+
reqType: 'set_spot_clean'
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (data.sweepMopModes && data.sweepMopModes.length !== num) {
|
|
65
|
+
throw new MqttError(`sweepMopModes 数组长度 (${data.sweepMopModes.length}) 与 spots 数组长度 (${num}) 不一致`, {
|
|
66
|
+
errCode: VALIDATION_ERROR_CODE,
|
|
67
|
+
reqType: 'set_spot_clean'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 函数类型定义
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setVirtualAreaSchema: any;
|
|
3
|
+
declare const virtualAreaResponseSchema: any;
|
|
4
|
+
export type SetVirtualAreaData = z.infer<typeof setVirtualAreaSchema>;
|
|
5
|
+
export type VirtualAreaResponse = z.infer<typeof virtualAreaResponseSchema>;
|
|
6
|
+
export type TRequestVirtualArea = () => Promise<VirtualAreaResponse>;
|
|
7
|
+
export type TSetVirtualArea = (data: SetVirtualAreaData) => Promise<VirtualAreaResponse>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema, Point } from './base';
|
|
3
|
+
|
|
4
|
+
// 虚拟区域项 Schema
|
|
5
|
+
const virtualAreaItemSchema = z.object({
|
|
6
|
+
points: z.array(Point),
|
|
7
|
+
// 区域点集
|
|
8
|
+
name: z.string(),
|
|
9
|
+
// 区域名称
|
|
10
|
+
mode: z.int() // 模式
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// 设置虚拟区域参数 Schema
|
|
14
|
+
export const setVirtualAreaSchema = z.object({
|
|
15
|
+
data: z.array(virtualAreaItemSchema),
|
|
16
|
+
// 虚拟区域的数据数组
|
|
17
|
+
origin: Point // 原点坐标
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// 虚拟区域响应 Schema
|
|
21
|
+
const virtualAreaResponseSchema = z.extend(BaseResponseSchema, {
|
|
22
|
+
// 虚拟区域的数量
|
|
23
|
+
num: z.int(),
|
|
24
|
+
// 模式数组,每个元素为一个区域的模式
|
|
25
|
+
modes: z.array(z.int()),
|
|
26
|
+
// 多边形数组,每个元素为一个多边形的坐标字符串
|
|
27
|
+
polygons: z.array(z.string()),
|
|
28
|
+
// 名称数组,每个元素为一个区域的名称
|
|
29
|
+
names: z.array(z.string()),
|
|
30
|
+
// 地图ID
|
|
31
|
+
mapId: z.int()
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 类型导出
|
|
35
|
+
|
|
36
|
+
// 函数类型定义
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setVirtualWallSchema: any;
|
|
3
|
+
declare const virtualWallResponseSchema: any;
|
|
4
|
+
export type SetVirtualWallData = z.infer<typeof setVirtualWallSchema>;
|
|
5
|
+
export type VirtualWallResponse = z.infer<typeof virtualWallResponseSchema>;
|
|
6
|
+
export type TRequestVirtualWall = () => Promise<VirtualWallResponse>;
|
|
7
|
+
export type TSetVirtualWall = (data: SetVirtualWallData) => Promise<VirtualWallResponse>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema, Point } from './base';
|
|
3
|
+
|
|
4
|
+
// 设置虚拟墙参数 Schema
|
|
5
|
+
export const setVirtualWallSchema = z.object({
|
|
6
|
+
data: z.array(z.array(Point)),
|
|
7
|
+
// 虚拟墙的点数组(二维数组)
|
|
8
|
+
origin: Point // 原点坐标
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// 虚拟墙响应 Schema
|
|
12
|
+
const virtualWallResponseSchema = z.extend(BaseResponseSchema, {
|
|
13
|
+
// 虚拟墙的模式
|
|
14
|
+
modes: z.array(z.int()),
|
|
15
|
+
// 虚拟墙的数量
|
|
16
|
+
num: z.int(),
|
|
17
|
+
// 地图ID
|
|
18
|
+
mapId: z.int(),
|
|
19
|
+
// 虚拟墙的点数组(字符串格式)
|
|
20
|
+
points: z.array(z.string())
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// 类型导出
|
|
24
|
+
|
|
25
|
+
// 函数类型定义
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setVoiceSchema: any;
|
|
3
|
+
declare const voiceLanguageResponseSchema: any;
|
|
4
|
+
export type SetVoiceData = z.infer<typeof setVoiceSchema>;
|
|
5
|
+
export type VoiceLanguageResponse = z.infer<typeof voiceLanguageResponseSchema>;
|
|
6
|
+
export type TRequestVoiceInUse = () => Promise<VoiceLanguageResponse>;
|
|
7
|
+
export type TSetVoice = (data: SetVoiceData) => Promise<VoiceLanguageResponse>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
import { BaseResponseSchema } from './base';
|
|
3
|
+
|
|
4
|
+
// 设置语音语言参数 Schema
|
|
5
|
+
export const setVoiceSchema = z.object({
|
|
6
|
+
id: z.int(),
|
|
7
|
+
url: z.string(),
|
|
8
|
+
md5: z.string()
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// 语音语言响应 Schema
|
|
12
|
+
const voiceLanguageResponseSchema = z.extend(BaseResponseSchema, {
|
|
13
|
+
// 语音语言ID
|
|
14
|
+
id: z.int(),
|
|
15
|
+
// 进度百分比
|
|
16
|
+
schedule: z.int(),
|
|
17
|
+
// 状态码
|
|
18
|
+
status: z.int()
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// 类型导出
|
|
22
|
+
|
|
23
|
+
// 函数类型定义
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const setWifiMapSchema: any;
|
|
3
|
+
declare const wifiMapResponseSchema: any;
|
|
4
|
+
export type SetWifiMapData = z.infer<typeof setWifiMapSchema>;
|
|
5
|
+
export type WifiMapResponse = z.infer<typeof wifiMapResponseSchema>;
|
|
6
|
+
export type TRequestWifiMap = () => Promise<WifiMapResponse>;
|
|
7
|
+
export type TSetWifiMap = (data: SetWifiMapData) => Promise<WifiMapResponse>;
|
|
8
|
+
export {};
|