@ray-js/lock-sdk 1.0.0-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/api/index.d.ts +5 -0
- package/lib/api/index.js +18 -0
- package/lib/api/linkage.d.ts +161 -0
- package/lib/api/linkage.js +74 -0
- package/lib/api/lock.d.ts +195 -0
- package/lib/api/lock.js +129 -0
- package/lib/api/log.d.ts +166 -0
- package/lib/api/log.js +44 -0
- package/lib/api/setting.d.ts +14 -0
- package/lib/api/setting.js +36 -0
- package/lib/api/temp.d.ts +211 -0
- package/lib/api/temp.js +130 -0
- package/lib/api/user.d.ts +154 -0
- package/lib/api/user.js +59 -0
- package/lib/api/video.d.ts +9 -0
- package/lib/api/video.js +17 -0
- package/lib/config/dp-code/index.d.ts +175 -0
- package/lib/config/dp-code/index.js +224 -0
- package/lib/config/dp-map/common.d.ts +102 -0
- package/lib/config/dp-map/common.js +120 -0
- package/lib/config/dp-map/normal.d.ts +6 -0
- package/lib/config/dp-map/normal.js +51 -0
- package/lib/config/dp-map/open.d.ts +21 -0
- package/lib/config/dp-map/open.js +62 -0
- package/lib/config/dp-map/unlock-method-big.d.ts +559 -0
- package/lib/config/dp-map/unlock-method-big.js +237 -0
- package/lib/config/dp-map/unlock-method.d.ts +551 -0
- package/lib/config/dp-map/unlock-method.js +231 -0
- package/lib/config/index.d.ts +46 -0
- package/lib/config/index.js +56 -0
- package/lib/constant.d.ts +101 -0
- package/lib/constant.js +136 -0
- package/lib/dp-interface.d.ts +7 -0
- package/lib/dp-interface.js +1 -0
- package/lib/event.d.ts +8 -0
- package/lib/event.js +9 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.js +92 -0
- package/lib/interface.d.ts +807 -0
- package/lib/interface.js +1 -0
- package/lib/linkage.d.ts +26 -0
- package/lib/linkage.js +175 -0
- package/lib/log.d.ts +91 -0
- package/lib/log.js +314 -0
- package/lib/media.d.ts +43 -0
- package/lib/media.js +80 -0
- package/lib/open.d.ts +48 -0
- package/lib/open.js +247 -0
- package/lib/other.d.ts +36 -0
- package/lib/other.js +178 -0
- package/lib/parse/index.d.ts +6 -0
- package/lib/parse/index.js +22 -0
- package/lib/signal.d.ts +26 -0
- package/lib/signal.js +38 -0
- package/lib/sleep.d.ts +61 -0
- package/lib/sleep.js +121 -0
- package/lib/state.d.ts +54 -0
- package/lib/state.js +429 -0
- package/lib/sync/remote-serect-key.d.ts +5 -0
- package/lib/sync/remote-serect-key.js +60 -0
- package/lib/sync/t0.d.ts +5 -0
- package/lib/sync/t0.js +33 -0
- package/lib/sync/temp.d.ts +7 -0
- package/lib/sync/temp.js +88 -0
- package/lib/sync/unlock-mothod.d.ts +5 -0
- package/lib/sync/unlock-mothod.js +54 -0
- package/lib/temporary.d.ts +226 -0
- package/lib/temporary.js +637 -0
- package/lib/unlock-method.d.ts +269 -0
- package/lib/unlock-method.js +723 -0
- package/lib/user.d.ts +108 -0
- package/lib/user.js +361 -0
- package/lib/utils/base64-to-hex.d.ts +1 -0
- package/lib/utils/base64-to-hex.js +12 -0
- package/lib/utils/byte.d.ts +19 -0
- package/lib/utils/byte.js +74 -0
- package/lib/utils/constant.d.ts +11 -0
- package/lib/utils/constant.js +17 -0
- package/lib/utils/device.d.ts +207 -0
- package/lib/utils/device.js +353 -0
- package/lib/utils/errors.d.ts +2 -0
- package/lib/utils/errors.js +125 -0
- package/lib/utils/event.d.ts +23 -0
- package/lib/utils/event.js +144 -0
- package/lib/utils/hex-to-base64.d.ts +1 -0
- package/lib/utils/hex-to-base64.js +8 -0
- package/lib/utils/hex-to-bytes.d.ts +6 -0
- package/lib/utils/hex-to-bytes.js +16 -0
- package/lib/utils/index.d.ts +169 -0
- package/lib/utils/index.js +419 -0
- package/lib/utils/log.d.ts +5 -0
- package/lib/utils/log.js +78 -0
- package/lib/utils/publishDps.d.ts +11 -0
- package/lib/utils/publishDps.js +91 -0
- package/package.json +37 -0
package/lib/api/log.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { DpValue, LocalOperateRecordInfo, MediaInfo } from "../interface";
|
|
2
|
+
interface UnionUnlockInfo {
|
|
3
|
+
userId: string;
|
|
4
|
+
userName: string;
|
|
5
|
+
unlockName: string;
|
|
6
|
+
sn: number;
|
|
7
|
+
opMode: "unlock_fingerprint" | "unlock_password" | "unlock_card" | "unlock_face" | "unlock_finger_vein" | "unlock_hand" | "unlock_eye";
|
|
8
|
+
}
|
|
9
|
+
interface LatestLogs {
|
|
10
|
+
unReadCount: number;
|
|
11
|
+
operateRecordVOList: {
|
|
12
|
+
currentUser?: boolean;
|
|
13
|
+
dpId: number;
|
|
14
|
+
logCategory: "alarm_record" | "close_record" | "unlock_record" | "operation";
|
|
15
|
+
logId: string;
|
|
16
|
+
logType: string;
|
|
17
|
+
memberBindableFlag: boolean;
|
|
18
|
+
recordType: number;
|
|
19
|
+
time: number;
|
|
20
|
+
unlockName: string;
|
|
21
|
+
userId: string;
|
|
22
|
+
userName: string;
|
|
23
|
+
mediaInfoList?: MediaInfo[];
|
|
24
|
+
unionUnlockInfo?: UnionUnlockInfo[];
|
|
25
|
+
unlockNameRosettaKey?: string;
|
|
26
|
+
data: boolean | number | string;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export declare const getLatest2Log: (devId: string) => Promise<LatestLogs>;
|
|
30
|
+
interface GetRecordListParams {
|
|
31
|
+
devId: string;
|
|
32
|
+
dpIds: number[];
|
|
33
|
+
limit: number;
|
|
34
|
+
offset: number;
|
|
35
|
+
}
|
|
36
|
+
interface LogInfo {
|
|
37
|
+
aitypes: string[];
|
|
38
|
+
avatar: string;
|
|
39
|
+
devId: string;
|
|
40
|
+
dpId: number;
|
|
41
|
+
dpValue: any;
|
|
42
|
+
dps: Record<number, any>[];
|
|
43
|
+
gmtCreate: number;
|
|
44
|
+
historyId: number;
|
|
45
|
+
mediaInfoList?: MediaInfo[];
|
|
46
|
+
memberBindableFlag: 0 | 1;
|
|
47
|
+
recordId: string;
|
|
48
|
+
recordType: string;
|
|
49
|
+
status: number;
|
|
50
|
+
tags: number;
|
|
51
|
+
unlockName: string;
|
|
52
|
+
userId: string;
|
|
53
|
+
userName: string;
|
|
54
|
+
uuid: string;
|
|
55
|
+
data?: string;
|
|
56
|
+
unionUnlockInfo?: UnionUnlockInfo[];
|
|
57
|
+
localOperateRecordInfo?: LocalOperateRecordInfo;
|
|
58
|
+
}
|
|
59
|
+
export interface LogsResult {
|
|
60
|
+
datas: LogInfo[];
|
|
61
|
+
hasNext: boolean;
|
|
62
|
+
totalCount: number;
|
|
63
|
+
}
|
|
64
|
+
export declare const getRecordList: (params: GetRecordListParams) => Promise<LogsResult>;
|
|
65
|
+
interface AlarmData {
|
|
66
|
+
aitypes: string[];
|
|
67
|
+
avatar: string;
|
|
68
|
+
devId: string;
|
|
69
|
+
dpId: number;
|
|
70
|
+
dpValue: DpValue;
|
|
71
|
+
dps: Record<number, any>[];
|
|
72
|
+
gmtCreate: number;
|
|
73
|
+
historyId: number;
|
|
74
|
+
recordId: string;
|
|
75
|
+
recordType: string;
|
|
76
|
+
status: number;
|
|
77
|
+
tags: number;
|
|
78
|
+
unlockName: string;
|
|
79
|
+
userId: string;
|
|
80
|
+
userName: string;
|
|
81
|
+
mediaInfoList?: MediaInfo[];
|
|
82
|
+
}
|
|
83
|
+
interface GetAlarmListResult {
|
|
84
|
+
datas: AlarmData[];
|
|
85
|
+
hasNext: boolean;
|
|
86
|
+
totalCount: number;
|
|
87
|
+
}
|
|
88
|
+
export declare const getAlarmList: (params: GetRecordListParams) => Promise<GetAlarmListResult>;
|
|
89
|
+
interface GetAlbumMessagesParams {
|
|
90
|
+
devId: string;
|
|
91
|
+
limit: number;
|
|
92
|
+
offset: number;
|
|
93
|
+
safeMode: boolean;
|
|
94
|
+
picInclude: boolean;
|
|
95
|
+
startTime: number;
|
|
96
|
+
endTime: number;
|
|
97
|
+
}
|
|
98
|
+
interface AlbumItem {
|
|
99
|
+
/**
|
|
100
|
+
* AI 检测结果
|
|
101
|
+
*/
|
|
102
|
+
aiDetectResults: {
|
|
103
|
+
bizId: number;
|
|
104
|
+
aiType: number;
|
|
105
|
+
desc: string;
|
|
106
|
+
eventTypeDesc: string;
|
|
107
|
+
happenTime: number;
|
|
108
|
+
missStep: boolean;
|
|
109
|
+
}[];
|
|
110
|
+
/**
|
|
111
|
+
* AI 检测结果类型
|
|
112
|
+
*/
|
|
113
|
+
aiTypes: number[];
|
|
114
|
+
/**
|
|
115
|
+
* 消息描述
|
|
116
|
+
*/
|
|
117
|
+
describe: string;
|
|
118
|
+
/**
|
|
119
|
+
* 消息类型
|
|
120
|
+
*/
|
|
121
|
+
eventType: number;
|
|
122
|
+
/**
|
|
123
|
+
* 上传时间,单位毫秒
|
|
124
|
+
*/
|
|
125
|
+
uploadMilTime: number;
|
|
126
|
+
/**
|
|
127
|
+
* 媒体路径
|
|
128
|
+
*/
|
|
129
|
+
mediaPath: string;
|
|
130
|
+
/**
|
|
131
|
+
* 图片 id
|
|
132
|
+
*/
|
|
133
|
+
fileId: string;
|
|
134
|
+
/**
|
|
135
|
+
* 图片 key
|
|
136
|
+
*/
|
|
137
|
+
fileKey: string;
|
|
138
|
+
/**
|
|
139
|
+
* 图片 url
|
|
140
|
+
*/
|
|
141
|
+
fileUrl: string;
|
|
142
|
+
/**
|
|
143
|
+
* 媒体桶
|
|
144
|
+
*/
|
|
145
|
+
mediaBucket: string;
|
|
146
|
+
/**
|
|
147
|
+
* 媒体 key
|
|
148
|
+
*/
|
|
149
|
+
mediaKey: string;
|
|
150
|
+
}
|
|
151
|
+
export declare const getAlbumMessages: (params: GetAlbumMessagesParams) => Promise<{
|
|
152
|
+
hasNext: boolean;
|
|
153
|
+
albumList: AlbumItem[];
|
|
154
|
+
allAitypes: number[];
|
|
155
|
+
eventTypes: number[];
|
|
156
|
+
eventLangMap: string[];
|
|
157
|
+
}>;
|
|
158
|
+
interface GetMediaUrlParams {
|
|
159
|
+
devId: string;
|
|
160
|
+
mediaPath: string;
|
|
161
|
+
mediaBucket: string;
|
|
162
|
+
}
|
|
163
|
+
export declare const getMediaUrl: (params: GetMediaUrlParams) => Promise<{
|
|
164
|
+
mediaUrl: string;
|
|
165
|
+
}>;
|
|
166
|
+
export {};
|
package/lib/api/log.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { THING } from "../utils/constant";
|
|
2
|
+
import { requestCloud } from "../utils/device";
|
|
3
|
+
/*
|
|
4
|
+
* 获取最近两条数据
|
|
5
|
+
* @devId 设备id
|
|
6
|
+
* @returns {Promise<ResLatestLog>}
|
|
7
|
+
*/
|
|
8
|
+
export const getLatest2Log = devId => {
|
|
9
|
+
return requestCloud({
|
|
10
|
+
api: "m.lock.log.latest2",
|
|
11
|
+
version: "1.0",
|
|
12
|
+
data: {
|
|
13
|
+
devId
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export const getRecordList = params => {
|
|
18
|
+
return requestCloud({
|
|
19
|
+
api: `${THING}.m.device.lock.history.list`,
|
|
20
|
+
version: "1.0",
|
|
21
|
+
data: params
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export const getAlarmList = params => {
|
|
25
|
+
return requestCloud({
|
|
26
|
+
api: `${THING}.m.device.lock.alarm.list`,
|
|
27
|
+
version: "3.0",
|
|
28
|
+
data: params
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export const getAlbumMessages = params => {
|
|
32
|
+
return requestCloud({
|
|
33
|
+
api: "m.lock.album.media.list",
|
|
34
|
+
version: "3.0",
|
|
35
|
+
data: params
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export const getMediaUrl = params => {
|
|
39
|
+
return requestCloud({
|
|
40
|
+
api: `${THING}.m.device.lock.media.path`,
|
|
41
|
+
version: "2.0",
|
|
42
|
+
data: params
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取设备某些属性
|
|
3
|
+
* @param params
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
declare const getDeviceProperties: (deviceId: string, props: string[]) => Promise<Record<string, any>>;
|
|
7
|
+
/**
|
|
8
|
+
* 设置设备属性,支持同时设置多个属性
|
|
9
|
+
* @param devId
|
|
10
|
+
* @param data
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const setDeviceProperties: (devId: string, data: Record<string, any>) => Promise<void>;
|
|
14
|
+
export { setDeviceProperties, getDeviceProperties };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { THING } from "../utils/constant";
|
|
2
|
+
import { requestCloud } from "../utils/device";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 获取设备某些属性
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
const getDeviceProperties = (deviceId, props) => {
|
|
10
|
+
return requestCloud({
|
|
11
|
+
api: `${THING}.m.device.props.fetch`,
|
|
12
|
+
version: "1.0",
|
|
13
|
+
data: {
|
|
14
|
+
devId: deviceId,
|
|
15
|
+
props: props.join(",")
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 设置设备属性,支持同时设置多个属性
|
|
22
|
+
* @param devId
|
|
23
|
+
* @param data
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
const setDeviceProperties = (devId, data) => {
|
|
27
|
+
return requestCloud({
|
|
28
|
+
api: `${THING}.m.device.props.save`,
|
|
29
|
+
version: "1.0",
|
|
30
|
+
data: {
|
|
31
|
+
devId,
|
|
32
|
+
propKvs: data
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export { setDeviceProperties, getDeviceProperties };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
interface CreateTempPasswordParams {
|
|
2
|
+
devId: string;
|
|
3
|
+
sn: number;
|
|
4
|
+
effectiveTime: number;
|
|
5
|
+
invalidTime: number;
|
|
6
|
+
availTime?: number;
|
|
7
|
+
name?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
symbolic: boolean;
|
|
10
|
+
dpTunnel?: number;
|
|
11
|
+
schedule?: {
|
|
12
|
+
allDay: boolean;
|
|
13
|
+
effectiveTime: number;
|
|
14
|
+
invalidTime: number;
|
|
15
|
+
workingDay: number;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
export interface CreateTempPasswordResult {
|
|
19
|
+
unlockBindingId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
tyNum?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 创建临时密码
|
|
25
|
+
* @param {CreateTempPasswordParams} params - 创建临时密码参数
|
|
26
|
+
* @returns {Promise<CreateTempPasswordResult>} - 创建结果的 Promise
|
|
27
|
+
*/
|
|
28
|
+
export declare const createTemporaryPassword: (params: CreateTempPasswordParams) => Promise<CreateTempPasswordResult>;
|
|
29
|
+
export interface ValidateTempPwdParams {
|
|
30
|
+
password: string;
|
|
31
|
+
devId: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
effectiveTime: number;
|
|
34
|
+
invalidTime: number;
|
|
35
|
+
schedule: {
|
|
36
|
+
allDay: boolean;
|
|
37
|
+
effectiveTime: number;
|
|
38
|
+
invalidTime: number;
|
|
39
|
+
workingDay: number;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 临时密码参数检验
|
|
44
|
+
* @param {ValidateTempPwdProps} params - 临时密码验证参数
|
|
45
|
+
* @returns {Promise<{ valid: boolean; errorCode?: number }>} - 验证结果的 Promise
|
|
46
|
+
*/
|
|
47
|
+
export declare const validateTempPwd: (params: ValidateTempPwdParams) => Promise<{
|
|
48
|
+
valid: boolean;
|
|
49
|
+
errorCode?: string;
|
|
50
|
+
}>;
|
|
51
|
+
interface UpdateTempPasswordParams {
|
|
52
|
+
unlockBindingId: string;
|
|
53
|
+
devId: string;
|
|
54
|
+
effectiveTime?: number;
|
|
55
|
+
invalidTime?: number;
|
|
56
|
+
name?: string;
|
|
57
|
+
phase?: number;
|
|
58
|
+
symbolic: boolean;
|
|
59
|
+
dpTunnel: number;
|
|
60
|
+
schedule: {
|
|
61
|
+
allDay: boolean;
|
|
62
|
+
effectiveTime: number;
|
|
63
|
+
invalidTime: number;
|
|
64
|
+
workingDay: number;
|
|
65
|
+
}[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 更新临时密码相关的信息
|
|
69
|
+
* @param {UpdateTempPasswordParams} params - 更新临时密码参数
|
|
70
|
+
* @returns {Promise<UpdateTempPasswordResult>} - 更新结果的 Promise
|
|
71
|
+
*/
|
|
72
|
+
export declare const updateTemporaryPassword: (params: UpdateTempPasswordParams) => Promise<boolean>;
|
|
73
|
+
interface GetTempPasswordParams {
|
|
74
|
+
devId: string;
|
|
75
|
+
pwdId?: string;
|
|
76
|
+
}
|
|
77
|
+
export declare const getTempPassword: (params: GetTempPasswordParams) => Promise<EffectivePasswrodItem>;
|
|
78
|
+
interface DeleteTempPasswordParams {
|
|
79
|
+
unlockBindingId: string;
|
|
80
|
+
devId: string;
|
|
81
|
+
symbolic: boolean;
|
|
82
|
+
dpTunnel: number;
|
|
83
|
+
}
|
|
84
|
+
export declare const deleteTempPassword: (params: DeleteTempPasswordParams) => Promise<unknown>;
|
|
85
|
+
export interface CreateOfflinePasswordParams {
|
|
86
|
+
devId: string;
|
|
87
|
+
pwdType: string;
|
|
88
|
+
gmtStart: number;
|
|
89
|
+
gmtExpired: number;
|
|
90
|
+
pwdName?: string;
|
|
91
|
+
countryCode?: string;
|
|
92
|
+
mobile?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface OfflinePwdResult {
|
|
95
|
+
/**
|
|
96
|
+
* 离线密码失效时间戳,单位为秒
|
|
97
|
+
*/
|
|
98
|
+
gmtExpired: number;
|
|
99
|
+
/**
|
|
100
|
+
* 离线密码生效时间戳,单位为秒
|
|
101
|
+
*/
|
|
102
|
+
gmtStart: number;
|
|
103
|
+
/**
|
|
104
|
+
* 密码内容
|
|
105
|
+
*/
|
|
106
|
+
pwd: string;
|
|
107
|
+
/**
|
|
108
|
+
* 密码 ID
|
|
109
|
+
*/
|
|
110
|
+
pwdId: string;
|
|
111
|
+
/**
|
|
112
|
+
* 密码名称
|
|
113
|
+
*/
|
|
114
|
+
pwdName: string;
|
|
115
|
+
/**
|
|
116
|
+
* 解锁绑定 ID
|
|
117
|
+
*/
|
|
118
|
+
unlockBindingId: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 获取离线临时密码
|
|
122
|
+
* @param {CreateOfflinePasswordParams} params - 请求参数
|
|
123
|
+
* @returns {Promise<OfflinePwdResult>} - 响应结果的 Promise
|
|
124
|
+
*/
|
|
125
|
+
export declare const createOfflinePassword: (params: CreateOfflinePasswordParams) => Promise<OfflinePwdResult>;
|
|
126
|
+
interface GetDynapwdParams {
|
|
127
|
+
devId: string;
|
|
128
|
+
adminPwd?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 获取动态密码
|
|
132
|
+
* @param {GetDynapwdParams} params - 包含设备Id和管理员密码的参数对象
|
|
133
|
+
* @returns {Promise<GetDynapwdResponse>} - 包含动态密码数据的响应对象的 Promise
|
|
134
|
+
*/
|
|
135
|
+
export declare const getDynamicPassword: (params: GetDynapwdParams) => Promise<{
|
|
136
|
+
dynamicPassword: string;
|
|
137
|
+
}>;
|
|
138
|
+
interface RevokeOfflinePasswordParams {
|
|
139
|
+
devId: string;
|
|
140
|
+
unlockBindingId: string;
|
|
141
|
+
name?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 删除离线临时密码
|
|
145
|
+
* @param {RevokeOfflinePasswordParams} params - 请求参数
|
|
146
|
+
* @returns {Promise<string>} - 响应结果的 Promise
|
|
147
|
+
*/
|
|
148
|
+
export declare const revokeOfflinePassword: (params: RevokeOfflinePasswordParams) => Promise<OfflinePwdResult>;
|
|
149
|
+
interface EffectiveListParams {
|
|
150
|
+
devId: string;
|
|
151
|
+
authTypes: string[];
|
|
152
|
+
}
|
|
153
|
+
interface EffectivePasswrodItem {
|
|
154
|
+
effective: number;
|
|
155
|
+
unlockBindingId: string;
|
|
156
|
+
effectiveTime: number;
|
|
157
|
+
failReason: number;
|
|
158
|
+
invalidTime: number;
|
|
159
|
+
name: string;
|
|
160
|
+
phase: number;
|
|
161
|
+
scheduleDetails: {
|
|
162
|
+
allDay: boolean;
|
|
163
|
+
effectiveTime: number;
|
|
164
|
+
invalidTime: number;
|
|
165
|
+
timeZoneId: string;
|
|
166
|
+
workingDay: number;
|
|
167
|
+
}[];
|
|
168
|
+
opModeType: number;
|
|
169
|
+
opModeSubType: number;
|
|
170
|
+
sn: number;
|
|
171
|
+
opModeInfo?: {
|
|
172
|
+
hasClearPwd?: boolean;
|
|
173
|
+
revokedPwdName?: string;
|
|
174
|
+
revokedPwdEffectiveTime?: number;
|
|
175
|
+
revokedPwdInvalidTime?: number;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
export declare const fetchEffectiveList: (params: EffectiveListParams) => Promise<EffectivePasswrodItem[]>;
|
|
179
|
+
interface fetchInvalidListParams {
|
|
180
|
+
devId: string;
|
|
181
|
+
offset: number;
|
|
182
|
+
limit: number;
|
|
183
|
+
}
|
|
184
|
+
export declare const fetchInvalidList: (params: fetchInvalidListParams) => Promise<{
|
|
185
|
+
datas: EffectivePasswrodItem[];
|
|
186
|
+
hasNext: boolean;
|
|
187
|
+
totalCount: number;
|
|
188
|
+
}>;
|
|
189
|
+
export declare const clearInvalidTempList: (params: {
|
|
190
|
+
devId: string;
|
|
191
|
+
}) => Promise<boolean>;
|
|
192
|
+
interface ReNameTemporaryParams {
|
|
193
|
+
devId: string;
|
|
194
|
+
name: string;
|
|
195
|
+
unlockBindingId: string;
|
|
196
|
+
}
|
|
197
|
+
export declare const reNameTemporary: (params: ReNameTemporaryParams) => Promise<unknown>;
|
|
198
|
+
interface ReNameOfflineParams {
|
|
199
|
+
devId: string;
|
|
200
|
+
pwdName: string;
|
|
201
|
+
unlockBindingId: string;
|
|
202
|
+
}
|
|
203
|
+
export declare const reNameOffline: (params: ReNameOfflineParams) => Promise<unknown>;
|
|
204
|
+
interface GetSyncTempPasswordsParams {
|
|
205
|
+
devId: string;
|
|
206
|
+
isUpt: boolean;
|
|
207
|
+
}
|
|
208
|
+
export declare const getSyncTempPasswords: (params: GetSyncTempPasswordsParams) => Promise<{
|
|
209
|
+
pwdList: any[];
|
|
210
|
+
}>;
|
|
211
|
+
export {};
|
package/lib/api/temp.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { requestCloud } from "../utils/device";
|
|
2
|
+
import { THING } from "../utils/constant";
|
|
3
|
+
/**
|
|
4
|
+
* 创建临时密码
|
|
5
|
+
* @param {CreateTempPasswordParams} params - 创建临时密码参数
|
|
6
|
+
* @returns {Promise<CreateTempPasswordResult>} - 创建结果的 Promise
|
|
7
|
+
*/
|
|
8
|
+
export const createTemporaryPassword = params => {
|
|
9
|
+
return requestCloud({
|
|
10
|
+
api: `${THING}.m.device.lock.temppwd.create`,
|
|
11
|
+
version: "8.0",
|
|
12
|
+
data: params
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 临时密码参数检验
|
|
17
|
+
* @param {ValidateTempPwdProps} params - 临时密码验证参数
|
|
18
|
+
* @returns {Promise<{ valid: boolean; errorCode?: number }>} - 验证结果的 Promise
|
|
19
|
+
*/
|
|
20
|
+
export const validateTempPwd = async params => {
|
|
21
|
+
return requestCloud({
|
|
22
|
+
api: `${THING}.m.device.lock.temppwd.validate`,
|
|
23
|
+
version: "3.0",
|
|
24
|
+
data: params
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 更新临时密码相关的信息
|
|
29
|
+
* @param {UpdateTempPasswordParams} params - 更新临时密码参数
|
|
30
|
+
* @returns {Promise<UpdateTempPasswordResult>} - 更新结果的 Promise
|
|
31
|
+
*/
|
|
32
|
+
export const updateTemporaryPassword = params => {
|
|
33
|
+
return requestCloud({
|
|
34
|
+
api: `${THING}.m.device.lock.temppwd.update`,
|
|
35
|
+
version: "4.0",
|
|
36
|
+
data: params
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export const getTempPassword = params => {
|
|
40
|
+
return requestCloud({
|
|
41
|
+
api: `${THING}.m.device.lock.temppwd.detail`,
|
|
42
|
+
version: "1.0",
|
|
43
|
+
data: params
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export const deleteTempPassword = params => {
|
|
47
|
+
return requestCloud({
|
|
48
|
+
api: `${THING}.m.device.lock.temppwd.remove`,
|
|
49
|
+
version: "2.0",
|
|
50
|
+
data: params
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* 获取离线临时密码
|
|
55
|
+
* @param {CreateOfflinePasswordParams} params - 请求参数
|
|
56
|
+
* @returns {Promise<OfflinePwdResult>} - 响应结果的 Promise
|
|
57
|
+
*/
|
|
58
|
+
export const createOfflinePassword = params => {
|
|
59
|
+
return requestCloud({
|
|
60
|
+
api: `${THING}.m.device.lock.offlinepwd.get`,
|
|
61
|
+
version: "3.0",
|
|
62
|
+
data: params
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* 获取动态密码
|
|
67
|
+
* @param {GetDynapwdParams} params - 包含设备Id和管理员密码的参数对象
|
|
68
|
+
* @returns {Promise<GetDynapwdResponse>} - 包含动态密码数据的响应对象的 Promise
|
|
69
|
+
*/
|
|
70
|
+
export const getDynamicPassword = params => {
|
|
71
|
+
return requestCloud({
|
|
72
|
+
api: `${THING}.m.device.lock.dynapwd.get`,
|
|
73
|
+
version: "3.0",
|
|
74
|
+
data: params
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 删除离线临时密码
|
|
79
|
+
* @param {RevokeOfflinePasswordParams} params - 请求参数
|
|
80
|
+
* @returns {Promise<string>} - 响应结果的 Promise
|
|
81
|
+
*/
|
|
82
|
+
export const revokeOfflinePassword = params => {
|
|
83
|
+
return requestCloud({
|
|
84
|
+
api: `${THING}.m.device.lock.offlinepwd.revoke`,
|
|
85
|
+
version: "2.0",
|
|
86
|
+
data: params
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export const fetchEffectiveList = params => {
|
|
90
|
+
return requestCloud({
|
|
91
|
+
api: `${THING}.m.device.lock.auth.list`,
|
|
92
|
+
version: "1.0",
|
|
93
|
+
data: params
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
export const fetchInvalidList = params => {
|
|
97
|
+
return requestCloud({
|
|
98
|
+
api: `${THING}.m.device.lock.auth.list.invalid`,
|
|
99
|
+
version: "1.0",
|
|
100
|
+
data: params
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
export const clearInvalidTempList = params => {
|
|
104
|
+
return requestCloud({
|
|
105
|
+
api: `${THING}.m.device.lock.auth.list.clear`,
|
|
106
|
+
version: "1.0",
|
|
107
|
+
data: params
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
export const reNameTemporary = params => {
|
|
111
|
+
return requestCloud({
|
|
112
|
+
api: `${THING}.m.device.lock.temppwd.name`,
|
|
113
|
+
version: "1.0",
|
|
114
|
+
data: params
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
export const reNameOffline = params => {
|
|
118
|
+
return requestCloud({
|
|
119
|
+
api: `${THING}.m.device.lock.offlinepwd.name.update`,
|
|
120
|
+
version: "2.0",
|
|
121
|
+
data: params
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export const getSyncTempPasswords = params => {
|
|
125
|
+
return requestCloud({
|
|
126
|
+
api: "m.lock.device.lock.tempwd.sync",
|
|
127
|
+
version: "1.0",
|
|
128
|
+
data: params
|
|
129
|
+
});
|
|
130
|
+
};
|