@ray-js/lock-sdk 1.0.3 → 1.0.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/api/lock.d.ts +1 -0
- package/lib/api/lock.js +11 -0
- package/lib/api/log.d.ts +6 -1
- package/lib/api/temp.d.ts +45 -1
- package/lib/api/temp.js +37 -0
- package/lib/config/dp-code/index.d.ts +4 -0
- package/lib/config/dp-code/index.js +6 -2
- package/lib/config/dp-map/unlock-method-big.d.ts +3 -7
- package/lib/config/dp-map/unlock-method-big.js +30 -1
- package/lib/config/dp-map/unlock-method.js +38 -1
- package/lib/config/index.d.ts +1 -0
- package/lib/config/index.js +1 -0
- package/lib/interface.d.ts +6 -0
- package/lib/log.js +3 -0
- package/lib/media.d.ts +5 -1
- package/lib/media.js +15 -5
- package/lib/open.d.ts +6 -0
- package/lib/open.js +34 -1
- package/lib/other.js +15 -1
- package/lib/temporary.d.ts +93 -0
- package/lib/temporary.js +171 -1
- package/lib/unlock-method.js +43 -13
- package/lib/user.d.ts +2 -1
- package/lib/user.js +54 -1
- package/lib/utils/errors.js +1 -0
- package/package.json +1 -1
package/lib/api/lock.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const openDoorByCloud: (deviceId: string, isOpen: boolean) => Promise<unknown>;
|
|
2
|
+
export declare const isConfirmOpenDoorByWifiPro: (deviceId: string, confirm: boolean) => Promise<unknown>;
|
|
2
3
|
export declare const checkRemoteKey: (deviceId: string) => Promise<{
|
|
3
4
|
effectiveTime: number;
|
|
4
5
|
invalidTime: number;
|
package/lib/api/lock.js
CHANGED
|
@@ -10,6 +10,17 @@ export const openDoorByCloud = (deviceId, isOpen) => {
|
|
|
10
10
|
},
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
|
+
export const isConfirmOpenDoorByWifiPro = (deviceId, confirm) => {
|
|
14
|
+
return requestCloud({
|
|
15
|
+
api: `${THING}.m.device.lock.remote.unlock`,
|
|
16
|
+
version: "2.0",
|
|
17
|
+
data: {
|
|
18
|
+
devId: deviceId,
|
|
19
|
+
confirm,
|
|
20
|
+
open: true,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
};
|
|
13
24
|
export const checkRemoteKey = async (deviceId) => {
|
|
14
25
|
return requestCloud({
|
|
15
26
|
api: "m.lock.ble.remote.unlock.check",
|
package/lib/api/log.d.ts
CHANGED
|
@@ -127,7 +127,12 @@ interface GetMediaUrlParams {
|
|
|
127
127
|
mediaPath: string;
|
|
128
128
|
mediaBucket: string;
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
interface GetFileUrlParams {
|
|
131
|
+
devId: string;
|
|
132
|
+
filePath: string;
|
|
133
|
+
bucket: string;
|
|
134
|
+
}
|
|
135
|
+
export declare const getMediaUrl: (params: GetMediaUrlParams | GetFileUrlParams) => Promise<{
|
|
131
136
|
mediaUrl: string;
|
|
132
137
|
}>;
|
|
133
138
|
export {};
|
package/lib/api/temp.d.ts
CHANGED
|
@@ -21,6 +21,27 @@ export interface CreateTempPasswordResult {
|
|
|
21
21
|
tyNum?: number;
|
|
22
22
|
}
|
|
23
23
|
export declare const createTemporaryPassword: (params: CreateTempPasswordParams) => Promise<CreateTempPasswordResult>;
|
|
24
|
+
interface CreateOnlineUnlimitedParams {
|
|
25
|
+
devId: string;
|
|
26
|
+
effectiveTime: number;
|
|
27
|
+
invalidTime: number;
|
|
28
|
+
name: string;
|
|
29
|
+
password: string;
|
|
30
|
+
availTime: number;
|
|
31
|
+
schedule: {
|
|
32
|
+
allDay: boolean;
|
|
33
|
+
effectiveTime: number;
|
|
34
|
+
invalidTime: number;
|
|
35
|
+
workingDay: number;
|
|
36
|
+
}[];
|
|
37
|
+
phone?: string;
|
|
38
|
+
countryCode?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CreateOnlineUnlimitedResult {
|
|
41
|
+
pwdId: string;
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const createOnlineUnlimited: (params: CreateOnlineUnlimitedParams) => Promise<CreateOnlineUnlimitedResult>;
|
|
24
45
|
export interface ValidateTempPwdParams {
|
|
25
46
|
password: string;
|
|
26
47
|
devId: string;
|
|
@@ -67,6 +88,22 @@ interface DeleteTempPasswordParams {
|
|
|
67
88
|
dpTunnel: number;
|
|
68
89
|
}
|
|
69
90
|
export declare const deleteTempPassword: (params: DeleteTempPasswordParams) => Promise<unknown>;
|
|
91
|
+
export interface RemoveTempOnlineUnlimitedParams {
|
|
92
|
+
devId: string;
|
|
93
|
+
pwdId: string;
|
|
94
|
+
symbolic: boolean;
|
|
95
|
+
dpTunnel: number;
|
|
96
|
+
}
|
|
97
|
+
export declare const removeTempOnlineUnlimitedAPI: (params: {
|
|
98
|
+
devId: string;
|
|
99
|
+
id: string;
|
|
100
|
+
}) => Promise<unknown>;
|
|
101
|
+
export declare const getTempOnlineUnlimitedListAPI: (devId: string) => Promise<EffectivePasswrodItem[]>;
|
|
102
|
+
export declare const getTempOfflineListAPI: (params: {
|
|
103
|
+
devId: string;
|
|
104
|
+
pwdType: string;
|
|
105
|
+
status: string;
|
|
106
|
+
}) => Promise<EffectivePasswrodItem[]>;
|
|
70
107
|
export interface CreateOfflinePasswordParams {
|
|
71
108
|
devId: string;
|
|
72
109
|
pwdType: string;
|
|
@@ -85,6 +122,13 @@ export interface OfflinePwdResult {
|
|
|
85
122
|
unlockBindingId: string;
|
|
86
123
|
}
|
|
87
124
|
export declare const createOfflinePassword: (params: CreateOfflinePasswordParams) => Promise<OfflinePwdResult>;
|
|
125
|
+
interface CreateOfflineOnceParams {
|
|
126
|
+
devId: string;
|
|
127
|
+
pwdType: string;
|
|
128
|
+
gmtStart: string;
|
|
129
|
+
gmtExpired: string;
|
|
130
|
+
}
|
|
131
|
+
export declare const createOfflineOnceAPI: (params: CreateOfflineOnceParams) => Promise<OfflinePwdResult>;
|
|
88
132
|
interface GetDynapwdParams {
|
|
89
133
|
devId: string;
|
|
90
134
|
adminPwd?: string;
|
|
@@ -102,7 +146,7 @@ interface EffectiveListParams {
|
|
|
102
146
|
devId: string;
|
|
103
147
|
authTypes: string[];
|
|
104
148
|
}
|
|
105
|
-
interface EffectivePasswrodItem {
|
|
149
|
+
export interface EffectivePasswrodItem {
|
|
106
150
|
effective: number;
|
|
107
151
|
unlockBindingId: string;
|
|
108
152
|
effectiveTime: number;
|
package/lib/api/temp.js
CHANGED
|
@@ -7,6 +7,13 @@ export const createTemporaryPassword = (params) => {
|
|
|
7
7
|
data: params,
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
export const createOnlineUnlimited = (params) => {
|
|
11
|
+
return requestCloud({
|
|
12
|
+
api: `${THING}.m.device.lock.temppwd.create`,
|
|
13
|
+
version: "4.0",
|
|
14
|
+
data: params,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
10
17
|
export const validateTempPwd = async (params) => {
|
|
11
18
|
return requestCloud({
|
|
12
19
|
api: `${THING}.m.device.lock.temppwd.validate`,
|
|
@@ -35,6 +42,29 @@ export const deleteTempPassword = (params) => {
|
|
|
35
42
|
data: params,
|
|
36
43
|
});
|
|
37
44
|
};
|
|
45
|
+
export const removeTempOnlineUnlimitedAPI = (params) => {
|
|
46
|
+
return requestCloud({
|
|
47
|
+
api: `${THING}.m.device.lock.temppwd.del`,
|
|
48
|
+
version: "2.0",
|
|
49
|
+
data: params,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export const getTempOnlineUnlimitedListAPI = (devId) => {
|
|
53
|
+
return requestCloud({
|
|
54
|
+
api: `${THING}.m.device.lock.temppwd.list`,
|
|
55
|
+
version: "2.0",
|
|
56
|
+
data: {
|
|
57
|
+
devId,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export const getTempOfflineListAPI = (params) => {
|
|
62
|
+
return requestCloud({
|
|
63
|
+
api: `${THING}.m.device.lock.offlinepwd.list`,
|
|
64
|
+
version: "1.0",
|
|
65
|
+
data: params,
|
|
66
|
+
});
|
|
67
|
+
};
|
|
38
68
|
export const createOfflinePassword = (params) => {
|
|
39
69
|
return requestCloud({
|
|
40
70
|
api: `${THING}.m.device.lock.offlinepwd.get`,
|
|
@@ -42,6 +72,13 @@ export const createOfflinePassword = (params) => {
|
|
|
42
72
|
data: params,
|
|
43
73
|
});
|
|
44
74
|
};
|
|
75
|
+
export const createOfflineOnceAPI = (params) => {
|
|
76
|
+
return requestCloud({
|
|
77
|
+
api: `${THING}.m.device.lock.offlinepwd.get`,
|
|
78
|
+
version: "1.0",
|
|
79
|
+
data: params,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
45
82
|
export const getDynamicPassword = (params) => {
|
|
46
83
|
return requestCloud({
|
|
47
84
|
api: `${THING}.m.device.lock.dynapwd.get`,
|
|
@@ -53,6 +53,10 @@ declare const dpCodes: {
|
|
|
53
53
|
recordModeAovSwitch: string;
|
|
54
54
|
sdStatus: string;
|
|
55
55
|
updataInfo: string;
|
|
56
|
+
doorlockStatus: string;
|
|
57
|
+
unlockInside: string;
|
|
58
|
+
doorOpened: string;
|
|
59
|
+
unlockApp: string;
|
|
56
60
|
};
|
|
57
61
|
export declare const latLogDpCodes: string[];
|
|
58
62
|
export default dpCodes;
|
|
@@ -31,7 +31,7 @@ const dpCodes = {
|
|
|
31
31
|
unlockVoiceRemote: "unlock_voice_remote",
|
|
32
32
|
lockRecord: "lock_record",
|
|
33
33
|
unlockBle: "unlock_ble",
|
|
34
|
-
bleControl:
|
|
34
|
+
bleControl: "ble_control",
|
|
35
35
|
unlockEye: "unlock_eye",
|
|
36
36
|
unlockDoubleKit: "unlock_double_kit",
|
|
37
37
|
unlockDoubleKitW: "unlock_double_kit_w",
|
|
@@ -52,7 +52,11 @@ const dpCodes = {
|
|
|
52
52
|
onlineSwitch: "online_switch",
|
|
53
53
|
recordModeAovSwitch: "record_mode_aov_switch",
|
|
54
54
|
sdStatus: "sd_status",
|
|
55
|
-
updataInfo:
|
|
55
|
+
updataInfo: "updata_info",
|
|
56
|
+
doorlockStatus: "doorlock_status",
|
|
57
|
+
unlockInside: "unlock_inside",
|
|
58
|
+
doorOpened: "door_opened",
|
|
59
|
+
unlockApp: "unlock_app",
|
|
56
60
|
};
|
|
57
61
|
export const latLogDpCodes = [
|
|
58
62
|
dpCodes.unlockPassword,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DpMap } from "@ray-js/tuya-dp-transform";
|
|
1
2
|
declare const add: ({
|
|
2
3
|
readonly name: "validConfig";
|
|
3
4
|
readonly type: "child";
|
|
@@ -489,11 +490,6 @@ declare const reportUpdateTempPwd: ({
|
|
|
489
490
|
name: string;
|
|
490
491
|
bytes?: undefined;
|
|
491
492
|
})[];
|
|
492
|
-
declare const sync:
|
|
493
|
-
|
|
494
|
-
loop: boolean;
|
|
495
|
-
}[];
|
|
496
|
-
declare const reportSync: {
|
|
497
|
-
name: string;
|
|
498
|
-
}[];
|
|
493
|
+
declare const sync: DpMap;
|
|
494
|
+
declare const reportSync: DpMap;
|
|
499
495
|
export { add, reportAdd, remove, reportRemove, update, updateMemberRole, reportUpdate, addTempPwd, reportAddTempPwd, removeTempPwd, reportRemoveTempPwd, updateTempPwd, reportUpdateTempPwd, sync, reportSync, };
|
|
@@ -194,7 +194,36 @@ const reportSync = [
|
|
|
194
194
|
name: "stage",
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
|
-
name: "
|
|
197
|
+
name: "messageId",
|
|
198
|
+
bytes: 2,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "packageNo",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
condition: {
|
|
205
|
+
prop: "stage",
|
|
206
|
+
value: 0,
|
|
207
|
+
},
|
|
208
|
+
name: "data",
|
|
209
|
+
loop: true,
|
|
210
|
+
type: "child",
|
|
211
|
+
childMap: [
|
|
212
|
+
{
|
|
213
|
+
name: "unlockId",
|
|
214
|
+
bytes: 2,
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "unlockType",
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "id",
|
|
221
|
+
bytes: 2,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "status",
|
|
225
|
+
},
|
|
226
|
+
],
|
|
198
227
|
},
|
|
199
228
|
];
|
|
200
229
|
export { add, reportAdd, remove, reportRemove, update, updateMemberRole, reportUpdate, addTempPwd, reportAddTempPwd, removeTempPwd, reportRemoveTempPwd, updateTempPwd, reportUpdateTempPwd, sync, reportSync, };
|
|
@@ -187,7 +187,44 @@ const reportSync = [
|
|
|
187
187
|
name: "stage",
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
|
-
name: "
|
|
190
|
+
name: "packageNo",
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
condition: {
|
|
194
|
+
prop: "stage",
|
|
195
|
+
value: 0,
|
|
196
|
+
},
|
|
197
|
+
name: "data",
|
|
198
|
+
loop: true,
|
|
199
|
+
type: "child",
|
|
200
|
+
childMap: [
|
|
201
|
+
{
|
|
202
|
+
name: "unlockId",
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "unlockType",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
condition: {
|
|
209
|
+
prop: "unlockType",
|
|
210
|
+
operation: "neq",
|
|
211
|
+
value: 0xf0,
|
|
212
|
+
},
|
|
213
|
+
name: "memberId",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
condition: {
|
|
217
|
+
prop: "unlockType",
|
|
218
|
+
operation: "eq",
|
|
219
|
+
value: 0xf0,
|
|
220
|
+
},
|
|
221
|
+
name: "cloundNo",
|
|
222
|
+
bytes: 2,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "status",
|
|
226
|
+
},
|
|
227
|
+
],
|
|
191
228
|
},
|
|
192
229
|
];
|
|
193
230
|
export { add, reportAdd, remove, reportRemove, update, updateMemberRole, reportUpdate, addTempPwd, reportAddTempPwd, removeTempPwd, reportRemoveTempPwd, updateTempPwd, reportUpdateTempPwd, sync, reportSync, };
|
package/lib/config/index.d.ts
CHANGED
package/lib/config/index.js
CHANGED
package/lib/interface.d.ts
CHANGED
|
@@ -266,6 +266,12 @@ export interface TempPasswordResult {
|
|
|
266
266
|
unlockBindingId: string;
|
|
267
267
|
effectiveConfig: EffectiveConfig;
|
|
268
268
|
}
|
|
269
|
+
export interface CreateOnlineUnlimitedResult {
|
|
270
|
+
type: "custom";
|
|
271
|
+
name: string;
|
|
272
|
+
pwdId: string;
|
|
273
|
+
effectiveConfig: EffectiveConfig;
|
|
274
|
+
}
|
|
269
275
|
export interface AlbumMessage extends MediaInfo {
|
|
270
276
|
id: string;
|
|
271
277
|
aiInfos: {
|
package/lib/log.js
CHANGED
package/lib/media.d.ts
CHANGED
|
@@ -2,8 +2,12 @@ interface GetMediaUrlParams {
|
|
|
2
2
|
mediaPath: string;
|
|
3
3
|
mediaBucket: string;
|
|
4
4
|
}
|
|
5
|
+
interface GetFileUrlParams {
|
|
6
|
+
filePath: string;
|
|
7
|
+
bucket: string;
|
|
8
|
+
}
|
|
5
9
|
interface MediaUrlResult {
|
|
6
10
|
mediaUrl: string;
|
|
7
11
|
}
|
|
8
|
-
export declare const getMediaUrl: (params: GetMediaUrlParams) => Promise<MediaUrlResult>;
|
|
12
|
+
export declare const getMediaUrl: (params: GetMediaUrlParams | GetFileUrlParams) => Promise<MediaUrlResult>;
|
|
9
13
|
export {};
|
package/lib/media.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { getMediaUrl as getMediaUrlApi } from "./api/log";
|
|
2
2
|
import config from "./config";
|
|
3
3
|
export const getMediaUrl = async (params) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
if ("mediaPath" in params && "mediaBucket" in params) {
|
|
5
|
+
return getMediaUrlApi({
|
|
6
|
+
devId: config.devInfo.devId,
|
|
7
|
+
mediaPath: params.mediaPath,
|
|
8
|
+
mediaBucket: params.mediaBucket,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
else if ("filePath" in params && "bucket" in params) {
|
|
12
|
+
return getMediaUrlApi({
|
|
13
|
+
devId: config.devInfo.devId,
|
|
14
|
+
filePath: params.filePath,
|
|
15
|
+
bucket: params.bucket,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
throw new Error("Invalid parameters");
|
|
9
19
|
};
|
package/lib/open.d.ts
CHANGED
|
@@ -11,3 +11,9 @@ export declare const getRemoteEnabled: () => boolean;
|
|
|
11
11
|
export declare const getRemotePermissionList: () => RemotePermission[];
|
|
12
12
|
export declare const getRemotePermission: () => RemotePermission;
|
|
13
13
|
export declare const updateRemotePermission: (permission: RemotePermission) => Promise<void>;
|
|
14
|
+
export declare const agreeOpenDoor: (option?: {
|
|
15
|
+
timeout?: number;
|
|
16
|
+
} | undefined) => Promise<unknown>;
|
|
17
|
+
export declare const rejectOpenDoor: (option?: {
|
|
18
|
+
timeout?: number;
|
|
19
|
+
} | undefined) => Promise<unknown>;
|
package/lib/open.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dpUtils from "@ray-js/tuya-dp-transform";
|
|
2
|
-
import { getDoorKey, openDoorByCloud } from "./api/lock";
|
|
2
|
+
import { getDoorKey, openDoorByCloud, isConfirmOpenDoorByWifiPro, } from "./api/lock";
|
|
3
3
|
import config from "./config";
|
|
4
4
|
import { isUseNearChannel, parallelMerge, parallelOnly } from "./utils";
|
|
5
5
|
import { decrypt } from "./utils/device";
|
|
@@ -160,3 +160,36 @@ export const updateRemotePermission = async (permission) => {
|
|
|
160
160
|
});
|
|
161
161
|
config.remoteOpenPermission = permission;
|
|
162
162
|
};
|
|
163
|
+
const handleOpenDoor = (confirm, timeout) => {
|
|
164
|
+
const { devInfo } = config;
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
const handleReport = (dpData) => {
|
|
167
|
+
if (typeof dpData[dpCodes.remoteNoDpKey] !== "undefined") {
|
|
168
|
+
timeoutTask && clearTimeout(timeoutTask);
|
|
169
|
+
const result = dpUtils.parse(dpData[dpCodes.remoteNoDpKey], reportOpenMap);
|
|
170
|
+
if (result.status !== 0x00) {
|
|
171
|
+
reject(getReportError(result.status));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
resolve(true);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const timeoutTask = setTimeout(() => {
|
|
179
|
+
emitter.off(DPCHANGE, handleReport);
|
|
180
|
+
reject(getError(1002));
|
|
181
|
+
}, timeout);
|
|
182
|
+
emitter.on(DPCHANGE, handleReport);
|
|
183
|
+
isConfirmOpenDoorByWifiPro(devInfo.devId, confirm).catch((e) => {
|
|
184
|
+
timeoutTask && clearTimeout(timeoutTask);
|
|
185
|
+
emitter.off(DPCHANGE, handleReport);
|
|
186
|
+
reject(getError(1003));
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
export const agreeOpenDoor = parallelOnly((option) => {
|
|
191
|
+
return handleOpenDoor(true, option?.timeout || 15000);
|
|
192
|
+
});
|
|
193
|
+
export const rejectOpenDoor = parallelOnly((option) => {
|
|
194
|
+
return handleOpenDoor(false, option?.timeout || 15000);
|
|
195
|
+
});
|
package/lib/other.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getDpValue } from "./state";
|
|
|
6
6
|
import { openPanel } from "./utils/device";
|
|
7
7
|
import { getError } from "./utils/errors";
|
|
8
8
|
import { publishDps } from "./utils/publishDps";
|
|
9
|
-
const { alarmLock, unlockFingerprint, unlockPassword, unlockCard, unlockKey, unlockPhoneRemote, } = dpCodes;
|
|
9
|
+
const { alarmLock, unlockFingerprint, unlockPassword, unlockCard, unlockKey, unlockPhoneRemote, unlockTemporary, unlockDynamic, unlockFace, unlockHand, unlockEye, unlockFingerVein, unlockInside, doorOpened, unlockApp, unlockOfflinePd, openInside, lockRecord, unlockDoubleKit, lockLocalRecord, } = dpCodes;
|
|
10
10
|
const abilityMap = {
|
|
11
11
|
backHome: "supportBackHome",
|
|
12
12
|
alarm: "supportAlarm",
|
|
@@ -18,6 +18,20 @@ export const openScene = async (options) => {
|
|
|
18
18
|
unlockCard,
|
|
19
19
|
unlockKey,
|
|
20
20
|
unlockPhoneRemote,
|
|
21
|
+
unlockTemporary,
|
|
22
|
+
unlockDynamic,
|
|
23
|
+
unlockFace,
|
|
24
|
+
unlockHand,
|
|
25
|
+
unlockEye,
|
|
26
|
+
unlockFingerVein,
|
|
27
|
+
unlockInside,
|
|
28
|
+
doorOpened,
|
|
29
|
+
unlockApp,
|
|
30
|
+
unlockOfflinePd,
|
|
31
|
+
openInside,
|
|
32
|
+
lockRecord,
|
|
33
|
+
unlockDoubleKit,
|
|
34
|
+
lockLocalRecord,
|
|
21
35
|
].reduce((acc, item) => {
|
|
22
36
|
const id = config.idsByCode[item];
|
|
23
37
|
if (id) {
|
package/lib/temporary.d.ts
CHANGED
|
@@ -74,4 +74,97 @@ interface RenameParams {
|
|
|
74
74
|
name: string;
|
|
75
75
|
}
|
|
76
76
|
export declare const renameTemp: (params: RenameParams) => Promise<void>;
|
|
77
|
+
interface CreateOnlineUnlimitedParams {
|
|
78
|
+
password: string;
|
|
79
|
+
name: string;
|
|
80
|
+
effective: EffectiveConfig;
|
|
81
|
+
phone?: string;
|
|
82
|
+
countryCode?: string;
|
|
83
|
+
}
|
|
84
|
+
export declare const saveTempOnlineUnlimited: (params: CreateOnlineUnlimitedParams) => Promise<{
|
|
85
|
+
type: string;
|
|
86
|
+
name: string;
|
|
87
|
+
pwdId: string;
|
|
88
|
+
effectiveConfig: EffectiveConfig;
|
|
89
|
+
}>;
|
|
90
|
+
interface CreateOfflineParams {
|
|
91
|
+
name: string;
|
|
92
|
+
effective: EffectiveConfig;
|
|
93
|
+
isOnce: boolean;
|
|
94
|
+
}
|
|
95
|
+
export type OfflineTempType = "once" | "multiple";
|
|
96
|
+
export interface OfflineTempResult {
|
|
97
|
+
type: OfflineTempType;
|
|
98
|
+
name: string;
|
|
99
|
+
password: string;
|
|
100
|
+
unlockBindingId: string;
|
|
101
|
+
pwdId: string;
|
|
102
|
+
effectiveConfig: EffectiveConfig;
|
|
103
|
+
}
|
|
104
|
+
export declare const createTempOffline: (params: CreateOfflineParams) => Promise<{
|
|
105
|
+
type: string;
|
|
106
|
+
name: string;
|
|
107
|
+
password: string;
|
|
108
|
+
unlockBindingId: string;
|
|
109
|
+
pwdId: string;
|
|
110
|
+
effectiveConfig: {
|
|
111
|
+
effectiveDate: number;
|
|
112
|
+
expiredDate: number;
|
|
113
|
+
};
|
|
114
|
+
}>;
|
|
115
|
+
export declare const removeTempOnlineUnlimited: (id: string) => Promise<void>;
|
|
116
|
+
export interface OnlinePasswordItem {
|
|
117
|
+
effective: number;
|
|
118
|
+
unlockBindingId: string;
|
|
119
|
+
effectiveTime: number;
|
|
120
|
+
invalidTime: number;
|
|
121
|
+
name: string;
|
|
122
|
+
phase: number;
|
|
123
|
+
scheduleDetails: EffectiveConfig;
|
|
124
|
+
status: "effective" | "synchronizing" | "expired" | "disabled" | "invalid";
|
|
125
|
+
}
|
|
126
|
+
export declare const getTempOnlineUnlimitedList: () => Promise<{
|
|
127
|
+
status: string;
|
|
128
|
+
effectiveConfig: EffectiveConfig;
|
|
129
|
+
effective: number;
|
|
130
|
+
unlockBindingId: string;
|
|
131
|
+
effectiveTime: number;
|
|
132
|
+
failReason: number;
|
|
133
|
+
invalidTime: number;
|
|
134
|
+
name: string;
|
|
135
|
+
phase: number;
|
|
136
|
+
scheduleDetails: {
|
|
137
|
+
allDay: boolean;
|
|
138
|
+
effectiveTime: number;
|
|
139
|
+
invalidTime: number;
|
|
140
|
+
timeZoneId: string;
|
|
141
|
+
workingDay: number;
|
|
142
|
+
}[];
|
|
143
|
+
opModeType: number;
|
|
144
|
+
opModeSubType: number;
|
|
145
|
+
sn: number;
|
|
146
|
+
opModeInfo?: {
|
|
147
|
+
hasClearPwd?: boolean;
|
|
148
|
+
revokedPwdName?: string;
|
|
149
|
+
revokedPwdEffectiveTime?: number;
|
|
150
|
+
revokedPwdInvalidTime?: number;
|
|
151
|
+
};
|
|
152
|
+
}[]>;
|
|
153
|
+
export interface OfflinePasswordItem {
|
|
154
|
+
email: string;
|
|
155
|
+
gmtExpired: number;
|
|
156
|
+
gmtStart: number;
|
|
157
|
+
hasClearPwd: boolean;
|
|
158
|
+
mobile: string;
|
|
159
|
+
pwd: string;
|
|
160
|
+
pwdId: string;
|
|
161
|
+
pwdName: string;
|
|
162
|
+
pwdTypeCode: "once" | "multiple" | "clear_one" | "clear_all";
|
|
163
|
+
revokedPwdName: string;
|
|
164
|
+
status: number;
|
|
165
|
+
timeZoneId: string;
|
|
166
|
+
}
|
|
167
|
+
export type OfflinePasswordType = "once" | "multiple" | "clear_one" | "clear_all";
|
|
168
|
+
export declare const getTempOfflineEffectiveList: (pwdTypeCode: OfflinePasswordType) => Promise<import("./api/temp").EffectivePasswrodItem[]>;
|
|
169
|
+
export declare const getTempOfflineInvalidList: (pwdTypeCode: OfflinePasswordType) => Promise<import("./api/temp").EffectivePasswrodItem[]>;
|
|
77
170
|
export {};
|
package/lib/temporary.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clearInvalidTempList, createOfflinePassword, createTemporaryPassword, deleteTempPassword, fetchEffectiveList, fetchInvalidList, getDynamicPassword, reNameOffline, reNameTemporary, revokeOfflinePassword, updateTemporaryPassword, validateTempPwd, } from "./api/temp";
|
|
1
|
+
import { clearInvalidTempList, createOfflinePassword, createTemporaryPassword, deleteTempPassword, fetchEffectiveList, fetchInvalidList, getDynamicPassword, reNameOffline, reNameTemporary, revokeOfflinePassword, updateTemporaryPassword, validateTempPwd, createOnlineUnlimited, removeTempOnlineUnlimitedAPI, getTempOnlineUnlimitedListAPI, getTempOfflineListAPI, createOfflineOnceAPI, } from "./api/temp";
|
|
2
2
|
import config from "./config";
|
|
3
3
|
import { formatWeek, isUseNearChannel, parallelOnly, parseOfflinePassword, parseWeek, validateEffectiveConfig, } from "./utils";
|
|
4
4
|
import { LoopTypes } from "./utils/constant";
|
|
@@ -511,3 +511,173 @@ export const renameTemp = async (params) => {
|
|
|
511
511
|
handleError(e);
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
|
+
export const saveTempOnlineUnlimited = async (params) => {
|
|
515
|
+
const { password, name, effective, phone, countryCode } = params;
|
|
516
|
+
if (!PASSWORD_REGEX.test(password)) {
|
|
517
|
+
throw getError(1030);
|
|
518
|
+
}
|
|
519
|
+
if (name && name.length > 20) {
|
|
520
|
+
throw getError(1031);
|
|
521
|
+
}
|
|
522
|
+
validateEffectiveConfig(effective);
|
|
523
|
+
const { effectiveTime = 0, expiredTime = 1439 } = effective;
|
|
524
|
+
const aesPwd = await encrypt(config.devInfo.devId, password);
|
|
525
|
+
const loopType = effective?.repeat
|
|
526
|
+
?
|
|
527
|
+
LoopTypes[effective?.repeat?.toUpperCase()]
|
|
528
|
+
: LoopTypes.NONE;
|
|
529
|
+
const schedule = [
|
|
530
|
+
{
|
|
531
|
+
allDay: loopType === LoopTypes.NONE,
|
|
532
|
+
effectiveTime,
|
|
533
|
+
invalidTime: expiredTime,
|
|
534
|
+
workingDay: formatWeek(effective?.weeks ?? [0]),
|
|
535
|
+
},
|
|
536
|
+
];
|
|
537
|
+
try {
|
|
538
|
+
const res = await createOnlineUnlimited({
|
|
539
|
+
devId: config.devInfo.devId,
|
|
540
|
+
effectiveTime: effective.effectiveDate,
|
|
541
|
+
invalidTime: effective.expiredDate,
|
|
542
|
+
name: name,
|
|
543
|
+
password: aesPwd,
|
|
544
|
+
schedule,
|
|
545
|
+
availTime: 0,
|
|
546
|
+
phone,
|
|
547
|
+
countryCode,
|
|
548
|
+
});
|
|
549
|
+
return {
|
|
550
|
+
type: "custom",
|
|
551
|
+
name: res.name,
|
|
552
|
+
pwdId: res.pwdId,
|
|
553
|
+
effectiveConfig: effective,
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
catch (error) {
|
|
557
|
+
throw handleError(error);
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
export const createTempOffline = async (params) => {
|
|
561
|
+
const { name, effective, isOnce } = params;
|
|
562
|
+
if (isOnce) {
|
|
563
|
+
const res = await createOfflineOnceAPI({
|
|
564
|
+
devId: config.devInfo.devId,
|
|
565
|
+
pwdType: "1",
|
|
566
|
+
gmtStart: "0",
|
|
567
|
+
gmtExpired: "0",
|
|
568
|
+
});
|
|
569
|
+
return {
|
|
570
|
+
type: "once",
|
|
571
|
+
name: res.pwdName,
|
|
572
|
+
password: parseOfflinePassword(res.pwd),
|
|
573
|
+
unlockBindingId: res.unlockBindingId,
|
|
574
|
+
pwdId: res.pwdId,
|
|
575
|
+
effectiveConfig: {
|
|
576
|
+
effectiveDate: Number(res.gmtStart),
|
|
577
|
+
expiredDate: Number(res.gmtExpired),
|
|
578
|
+
},
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
if (name && name.length > 20) {
|
|
583
|
+
throw getError(1031);
|
|
584
|
+
}
|
|
585
|
+
if (effective.effectiveDate >= effective.expiredDate) {
|
|
586
|
+
throw getError(1010);
|
|
587
|
+
}
|
|
588
|
+
const res = await createOfflineOnceAPI({
|
|
589
|
+
devId: config.devInfo.devId,
|
|
590
|
+
pwdType: "0",
|
|
591
|
+
gmtStart: effective.effectiveDate.toString(),
|
|
592
|
+
gmtExpired: effective.expiredDate.toString(),
|
|
593
|
+
});
|
|
594
|
+
return {
|
|
595
|
+
type: "multiple",
|
|
596
|
+
name: res.pwdName,
|
|
597
|
+
password: parseOfflinePassword(res.pwd),
|
|
598
|
+
unlockBindingId: res.unlockBindingId,
|
|
599
|
+
pwdId: res.pwdId,
|
|
600
|
+
effectiveConfig: {
|
|
601
|
+
effectiveDate: Number(res.gmtStart),
|
|
602
|
+
expiredDate: Number(res.gmtExpired),
|
|
603
|
+
},
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
export const removeTempOnlineUnlimited = async (id) => {
|
|
608
|
+
try {
|
|
609
|
+
await removeTempOnlineUnlimitedAPI({
|
|
610
|
+
devId: config.devInfo.devId,
|
|
611
|
+
id,
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
catch (error) {
|
|
615
|
+
throw handleError(error);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
const onLinePasswordStatusMap = {
|
|
619
|
+
1: "effective",
|
|
620
|
+
2: "synchronizing",
|
|
621
|
+
3: "expired",
|
|
622
|
+
4: "disabled",
|
|
623
|
+
5: "invalid",
|
|
624
|
+
};
|
|
625
|
+
export const getTempOnlineUnlimitedList = async () => {
|
|
626
|
+
try {
|
|
627
|
+
const pswList = await getTempOnlineUnlimitedListAPI(config.devInfo.devId);
|
|
628
|
+
const newPswList = pswList?.map((item) => {
|
|
629
|
+
const status = onLinePasswordStatusMap[item.effective];
|
|
630
|
+
const effectiveConfig = {
|
|
631
|
+
effectiveDate: item.effectiveTime,
|
|
632
|
+
expiredDate: item.invalidTime,
|
|
633
|
+
};
|
|
634
|
+
if (item.scheduleDetails?.length) {
|
|
635
|
+
const scheduleDetail = item.scheduleDetails[0];
|
|
636
|
+
effectiveConfig.repeat =
|
|
637
|
+
scheduleDetail.allDay === false ? "week" : "none";
|
|
638
|
+
if (effectiveConfig.repeat === "week") {
|
|
639
|
+
effectiveConfig.weeks = parseWeek(scheduleDetail.workingDay);
|
|
640
|
+
effectiveConfig.effectiveTime = scheduleDetail.effectiveTime;
|
|
641
|
+
effectiveConfig.expiredTime = scheduleDetail.invalidTime;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return { ...item, status, effectiveConfig };
|
|
645
|
+
});
|
|
646
|
+
return newPswList;
|
|
647
|
+
}
|
|
648
|
+
catch (error) {
|
|
649
|
+
throw handleError(error);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
const offlinePasswordTypeMap = {
|
|
653
|
+
once: "1",
|
|
654
|
+
multiple: "0",
|
|
655
|
+
clear_one: "8",
|
|
656
|
+
clear_all: "9",
|
|
657
|
+
};
|
|
658
|
+
export const getTempOfflineEffectiveList = async (pwdTypeCode) => {
|
|
659
|
+
try {
|
|
660
|
+
const offLineValidPswList = await getTempOfflineListAPI({
|
|
661
|
+
devId: config.devInfo.devId,
|
|
662
|
+
pwdType: offlinePasswordTypeMap[pwdTypeCode],
|
|
663
|
+
status: "1",
|
|
664
|
+
});
|
|
665
|
+
return offLineValidPswList;
|
|
666
|
+
}
|
|
667
|
+
catch (error) {
|
|
668
|
+
throw handleError(error);
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
export const getTempOfflineInvalidList = async (pwdTypeCode) => {
|
|
672
|
+
try {
|
|
673
|
+
const offLineFailurePswList = await getTempOfflineListAPI({
|
|
674
|
+
devId: config.devInfo.devId,
|
|
675
|
+
pwdType: offlinePasswordTypeMap[pwdTypeCode],
|
|
676
|
+
status: "0",
|
|
677
|
+
});
|
|
678
|
+
return offLineFailurePswList;
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
throw handleError(error);
|
|
682
|
+
}
|
|
683
|
+
};
|
package/lib/unlock-method.js
CHANGED
|
@@ -13,6 +13,7 @@ import { encrypt } from "./utils/device";
|
|
|
13
13
|
import emitter from "./utils/event";
|
|
14
14
|
import { DPCHANGE, UNLOCK_METHOD_EVENT } from "./utils/constant";
|
|
15
15
|
import { sendPhoneVerifyCode } from "./api";
|
|
16
|
+
import { getUserInfo } from "./user";
|
|
16
17
|
const getAddUnlockError = (status) => {
|
|
17
18
|
if (status >= 0 && status <= 10) {
|
|
18
19
|
return getError(1015 + status);
|
|
@@ -261,19 +262,48 @@ const handleAddReport = async (dps) => {
|
|
|
261
262
|
clearMonitoringAddReport();
|
|
262
263
|
try {
|
|
263
264
|
await sleep(300);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
265
|
+
let isAddEnabled = true;
|
|
266
|
+
if (!config.supportMultipleFace && type === "face") {
|
|
267
|
+
const user = await getUserInfo({
|
|
268
|
+
userId: addUnlockMethodData.userId,
|
|
269
|
+
});
|
|
270
|
+
const faceData = user.unlockDetails.find((item) => item.type === "face" && item.unlockList.length > 0);
|
|
271
|
+
if (faceData) {
|
|
272
|
+
const originUnlockId = faceData.unlockList[0].unlockId;
|
|
273
|
+
if (originUnlockId !== result.unlockId) {
|
|
274
|
+
eventData = {
|
|
275
|
+
stage: "fail",
|
|
276
|
+
type,
|
|
277
|
+
lockUserId: result.memberId,
|
|
278
|
+
error: getError(1061),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
eventData = {
|
|
283
|
+
stage: "success",
|
|
284
|
+
type,
|
|
285
|
+
id: faceData.unlockList[0].id,
|
|
286
|
+
name: faceData.unlockList[0].unlockName,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
isAddEnabled = false;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (isAddEnabled) {
|
|
293
|
+
const res = await createUnlockMethod({
|
|
294
|
+
devId: config.devInfo.devId,
|
|
295
|
+
userId: addUnlockMethodData.userId,
|
|
296
|
+
unlockId: `${addUnlockMethodData.unlockDpId}-${result.unlockId}`,
|
|
297
|
+
unlockName: "",
|
|
298
|
+
unlockAttr: 0,
|
|
299
|
+
});
|
|
300
|
+
eventData = {
|
|
301
|
+
stage: "success",
|
|
302
|
+
type,
|
|
303
|
+
id: res.opModeId,
|
|
304
|
+
name: res.unlockName,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
277
307
|
}
|
|
278
308
|
catch {
|
|
279
309
|
eventData = {
|
package/lib/user.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare const getUsers: (params?: getUsersParams) => Promise<{
|
|
|
10
10
|
}>;
|
|
11
11
|
interface getUserInfoParams {
|
|
12
12
|
userId: string;
|
|
13
|
-
nickName: string;
|
|
14
13
|
}
|
|
15
14
|
export declare const getUserInfo: (params: getUserInfoParams) => Promise<UserInfo>;
|
|
16
15
|
interface updateUserLimitTimeParams {
|
|
@@ -21,6 +20,8 @@ interface updateUserLimitTimeParams {
|
|
|
21
20
|
offlineUnlock?: boolean;
|
|
22
21
|
}
|
|
23
22
|
export declare const updateUserLimitTime: (params: updateUserLimitTimeParams) => Promise<boolean>;
|
|
23
|
+
export declare const openAddFamilyUser: () => Promise<unknown>;
|
|
24
|
+
export declare const openFamilyUserDetail: (userId: string) => Promise<undefined>;
|
|
24
25
|
interface AddUserParams {
|
|
25
26
|
name: string;
|
|
26
27
|
}
|
package/lib/user.js
CHANGED
|
@@ -9,6 +9,7 @@ import { getError } from "./utils/errors";
|
|
|
9
9
|
import { updateUserTimeSchedule, addNormalUser, removeNormalUser, } from "./api/user";
|
|
10
10
|
import { validConfigDpMap } from "./config/dp-map/common";
|
|
11
11
|
import { formatTimestampToMilliseconds, formatWeek, isAdmin, parseWeek, unlockMethodConfigs, validateEffectiveConfig, } from "./utils";
|
|
12
|
+
import { getCurrentHomeInfo, isSupportShortLink } from "./utils/device";
|
|
12
13
|
import { LoopTypes } from "./utils/constant";
|
|
13
14
|
import { getCurrentUser } from "./state";
|
|
14
15
|
const concactUserList = (list, result) => {
|
|
@@ -94,8 +95,12 @@ export const getUsers = async (params) => {
|
|
|
94
95
|
};
|
|
95
96
|
};
|
|
96
97
|
export const getUserInfo = async (params) => {
|
|
98
|
+
const user = await getUserDetail({
|
|
99
|
+
devId: config.devInfo.devId,
|
|
100
|
+
userId: params.userId,
|
|
101
|
+
});
|
|
97
102
|
const data = await getUsers({
|
|
98
|
-
keyword:
|
|
103
|
+
keyword: user.nickName,
|
|
99
104
|
});
|
|
100
105
|
const res = data.list.find((item) => item.userId === params.userId);
|
|
101
106
|
if (res) {
|
|
@@ -199,6 +204,54 @@ export const updateUserLimitTime = async (params) => {
|
|
|
199
204
|
}
|
|
200
205
|
return true;
|
|
201
206
|
};
|
|
207
|
+
export const openAddFamilyUser = async () => {
|
|
208
|
+
const homeInfo = await getCurrentHomeInfo();
|
|
209
|
+
let link = await isSupportShortLink("tysh_family_add_member_rn");
|
|
210
|
+
if (!link) {
|
|
211
|
+
link = await isSupportShortLink("thingsh_family_add_member_rn");
|
|
212
|
+
}
|
|
213
|
+
if (link) {
|
|
214
|
+
const url = `tuyaSmart://${link}?homeId=${homeInfo.homeId}`;
|
|
215
|
+
return new Promise((resolve, reject) => {
|
|
216
|
+
ty.router({
|
|
217
|
+
url: url,
|
|
218
|
+
success: (d) => {
|
|
219
|
+
resolve(true);
|
|
220
|
+
},
|
|
221
|
+
fail: (e) => {
|
|
222
|
+
reject(e);
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return Promise.reject(getError(1013));
|
|
228
|
+
};
|
|
229
|
+
const userTypeMap = {
|
|
230
|
+
"10": 1,
|
|
231
|
+
"20": 0,
|
|
232
|
+
"40": -1,
|
|
233
|
+
"50": 2,
|
|
234
|
+
};
|
|
235
|
+
export const openFamilyUserDetail = async (userId) => {
|
|
236
|
+
const { homeId } = await getCurrentHomeInfo();
|
|
237
|
+
const { userType: currentUserType } = await getCurrentUser();
|
|
238
|
+
const role = userTypeMap[currentUserType];
|
|
239
|
+
let link = await isSupportShortLink("member_info");
|
|
240
|
+
if (link) {
|
|
241
|
+
const url = `tuyaSmart://member_info?homeId=${homeId}&memberId=${userId}&role=${role}`;
|
|
242
|
+
ty.router({
|
|
243
|
+
url: url,
|
|
244
|
+
success: (d) => {
|
|
245
|
+
console.log("openFamilyUserDetail success");
|
|
246
|
+
},
|
|
247
|
+
fail: (e) => {
|
|
248
|
+
console.log("openFamilyUserDetail fail", e);
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
return Promise.reject(getError(1013));
|
|
254
|
+
};
|
|
202
255
|
export const addUser = async (params) => {
|
|
203
256
|
if (!config.supportBigData) {
|
|
204
257
|
throw getError(1060);
|
package/lib/utils/errors.js
CHANGED
|
@@ -59,6 +59,7 @@ const errors = {
|
|
|
59
59
|
1058: "Special unlock method app message notification or phone SMS must be enabled",
|
|
60
60
|
1059: "Doorbell notification service not enabled",
|
|
61
61
|
1060: "Does not support adding normal members",
|
|
62
|
+
1061: "Hardware ID does not match When update face",
|
|
62
63
|
};
|
|
63
64
|
export const getError = (code, ...places) => {
|
|
64
65
|
if (errors[code]) {
|