@ray-js/lock-sdk 1.0.3 → 1.1.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 +25 -0
- package/lib/api/index.js +59 -3
- package/lib/api/linkage.js +7 -7
- package/lib/api/lock.d.ts +1 -0
- package/lib/api/lock.js +26 -15
- package/lib/api/log.d.ts +6 -1
- package/lib/api/log.js +6 -6
- package/lib/api/request.d.ts +6 -0
- package/lib/api/request.js +57 -0
- package/lib/api/setting.d.ts +1 -1
- package/lib/api/setting.js +3 -3
- package/lib/api/temp.d.ts +45 -1
- package/lib/api/temp.js +52 -15
- package/lib/api/user.d.ts +21 -0
- package/lib/api/user.js +26 -7
- package/lib/api/video.js +2 -2
- package/lib/capability.d.ts +4 -0
- package/lib/capability.js +95 -0
- package/lib/config/dp-code/index.d.ts +10 -1
- package/lib/config/dp-code/index.js +12 -3
- package/lib/config/dp-map/normal.d.ts +2 -3
- package/lib/config/dp-map/normal.js +2 -9
- 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.d.ts +489 -0
- package/lib/config/dp-map/unlock-method.js +55 -1
- package/lib/config/index.d.ts +7 -1
- package/lib/config/index.js +18 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.js +8 -3
- package/lib/interface.d.ts +39 -1
- package/lib/log.js +3 -0
- package/lib/media.d.ts +6 -1
- package/lib/media.js +24 -6
- package/lib/offline-dps.d.ts +9 -0
- package/lib/offline-dps.js +84 -0
- package/lib/open.d.ts +9 -0
- package/lib/open.js +90 -11
- package/lib/other.d.ts +16 -2
- package/lib/other.js +188 -31
- package/lib/sleep.d.ts +3 -3
- package/lib/sleep.js +40 -25
- package/lib/state.js +116 -57
- package/lib/sync/offline-dps.d.ts +1 -0
- package/lib/sync/offline-dps.js +34 -0
- package/lib/sync/remote-serect-key.js +19 -23
- package/lib/sync/t0.js +2 -2
- package/lib/sync/unlock-method.d.ts +2 -0
- package/lib/sync/unlock-method.js +42 -0
- package/lib/sync/user.d.ts +2 -0
- package/lib/sync/user.js +76 -0
- 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/device.d.ts +7 -0
- package/lib/utils/device.js +39 -0
- package/lib/utils/errors.js +4 -0
- package/lib/utils/index.js +6 -6
- package/lib/utils/ipc.d.ts +11 -0
- package/lib/utils/ipc.js +26 -0
- package/package.json +2 -2
package/lib/api/index.d.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
+
import { DpValue } from "../interface";
|
|
1
2
|
export declare const sendPhoneVerifyCode: (params: {
|
|
2
3
|
account: string;
|
|
3
4
|
devId: string;
|
|
4
5
|
}) => Promise<unknown>;
|
|
5
6
|
export declare const getActiveTime: (devId: string) => Promise<string>;
|
|
7
|
+
interface ProductAbility {
|
|
8
|
+
abilityCode: string;
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
extConfig: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const getProductAbilities: (devId: string, codes: string[]) => Promise<ProductAbility[]>;
|
|
13
|
+
interface DeviceAdvancedAbility {
|
|
14
|
+
types: number[];
|
|
15
|
+
}
|
|
16
|
+
export declare const getDeviceAdvancedAbility: (devId: string) => Promise<DeviceAdvancedAbility>;
|
|
17
|
+
export declare const getVoicePwdEnabled: (devId: string) => Promise<number | boolean>;
|
|
18
|
+
interface SetVoicePwdParams {
|
|
19
|
+
devId: string;
|
|
20
|
+
open: boolean;
|
|
21
|
+
pwd: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const setVoicePwd: (params: SetVoicePwdParams) => Promise<boolean>;
|
|
24
|
+
export declare const fetchOfflineDpData: (deviceId: string) => Promise<{
|
|
25
|
+
dps: string;
|
|
26
|
+
pushStatus: boolean;
|
|
27
|
+
}[]>;
|
|
28
|
+
export declare const publishOfflineDpData: (deviceId: string, dpData: Record<string, DpValue>) => Promise<unknown>;
|
|
29
|
+
export declare const clearOfflineDpData: (deviceId: string) => Promise<unknown>;
|
|
30
|
+
export {};
|
package/lib/api/index.js
CHANGED
|
@@ -1,16 +1,72 @@
|
|
|
1
1
|
import { THING } from "../utils/constant";
|
|
2
|
-
import {
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
3
|
export const sendPhoneVerifyCode = (params) => {
|
|
4
|
-
return
|
|
4
|
+
return requestApi({
|
|
5
5
|
api: `${THING}.m.device.user.verifycode.send`,
|
|
6
6
|
version: "1.0",
|
|
7
7
|
data: params,
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
export const getActiveTime = (devId) => {
|
|
11
|
-
return
|
|
11
|
+
return requestApi({
|
|
12
12
|
api: `${THING}.m.device.active.date`,
|
|
13
13
|
version: "1.0",
|
|
14
14
|
data: { devId },
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
export const getProductAbilities = (devId, codes) => {
|
|
18
|
+
return requestApi({
|
|
19
|
+
api: "m.life.app.device.product.abilities",
|
|
20
|
+
version: "1.0",
|
|
21
|
+
data: { deviceId: devId, abilityCodes: codes },
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export const getDeviceAdvancedAbility = (devId) => {
|
|
25
|
+
return requestApi({
|
|
26
|
+
api: "m.lock.add.value.device.info",
|
|
27
|
+
version: "1.0",
|
|
28
|
+
data: { devId },
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export const getVoicePwdEnabled = (devId) => {
|
|
32
|
+
return requestApi({
|
|
33
|
+
api: `${THING}.m.device.lock.voice.pwd.flag`,
|
|
34
|
+
version: "1.0",
|
|
35
|
+
data: { devId },
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export const setVoicePwd = (params) => {
|
|
39
|
+
return requestApi({
|
|
40
|
+
api: `${THING}.m.device.lock.voice.pwd.setting`,
|
|
41
|
+
version: "1.0",
|
|
42
|
+
data: params,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export const fetchOfflineDpData = async (deviceId) => {
|
|
46
|
+
return await requestApi({
|
|
47
|
+
api: `${THING}.m.device.cache.dp.get`,
|
|
48
|
+
data: { devId: deviceId, dpCacheType: 0 },
|
|
49
|
+
version: "2.0",
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export const publishOfflineDpData = (deviceId, dpData) => {
|
|
53
|
+
return requestApi({
|
|
54
|
+
api: `${THING}.m.device.dp.publish`,
|
|
55
|
+
data: {
|
|
56
|
+
devId: deviceId,
|
|
57
|
+
gwId: deviceId,
|
|
58
|
+
dpCacheType: 0,
|
|
59
|
+
validity: 24 * 60 * 60,
|
|
60
|
+
reason: "none",
|
|
61
|
+
dps: dpData,
|
|
62
|
+
},
|
|
63
|
+
version: "2.0",
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
export const clearOfflineDpData = async (deviceId) => {
|
|
67
|
+
return requestApi({
|
|
68
|
+
api: "m.thing.cancel.device.shadow.desired.properties",
|
|
69
|
+
data: { devId: deviceId },
|
|
70
|
+
version: "1.0",
|
|
71
|
+
});
|
|
72
|
+
};
|
package/lib/api/linkage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { THING } from "../utils/constant";
|
|
2
|
-
import {
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
3
|
export const getLinkageList = (deviceId, homeId) => {
|
|
4
|
-
return
|
|
4
|
+
return requestApi({
|
|
5
5
|
api: `${THING}.m.linkage.doorlock.rule.query`,
|
|
6
6
|
version: "2.0",
|
|
7
7
|
data: {
|
|
@@ -13,7 +13,7 @@ export const getLinkageList = (deviceId, homeId) => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
export const saveLinkage = (data, homeId) => {
|
|
16
|
-
return
|
|
16
|
+
return requestApi({
|
|
17
17
|
api: `${THING}.m.linkage.device.shell.save`,
|
|
18
18
|
version: "2.0",
|
|
19
19
|
data: {
|
|
@@ -25,7 +25,7 @@ export const saveLinkage = (data, homeId) => {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
export const enableLinkage = (ruleId, homeId) => {
|
|
28
|
-
return
|
|
28
|
+
return requestApi({
|
|
29
29
|
api: `${THING}.m.linkage.rule.enable`,
|
|
30
30
|
version: "1.0",
|
|
31
31
|
data: {
|
|
@@ -37,7 +37,7 @@ export const enableLinkage = (ruleId, homeId) => {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
export const disableLinkage = (ruleId, homeId) => {
|
|
40
|
-
return
|
|
40
|
+
return requestApi({
|
|
41
41
|
api: `${THING}.m.linkage.rule.disable`,
|
|
42
42
|
version: "1.0",
|
|
43
43
|
data: {
|
|
@@ -49,7 +49,7 @@ export const disableLinkage = (ruleId, homeId) => {
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
export const getRemainingMessage = (homeId) => {
|
|
52
|
-
return
|
|
52
|
+
return requestApi({
|
|
53
53
|
api: `${THING}.m.notification.subscribe.info`,
|
|
54
54
|
version: "1.0",
|
|
55
55
|
data: {
|
|
@@ -61,7 +61,7 @@ export const getRemainingMessage = (homeId) => {
|
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
export const getRemainingPhone = (homeId) => {
|
|
64
|
-
return
|
|
64
|
+
return requestApi({
|
|
65
65
|
api: `${THING}.m.mobile.voice.times.count`,
|
|
66
66
|
version: "1.0",
|
|
67
67
|
data: {},
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { THING } from "../utils/constant";
|
|
2
|
-
import {
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
3
|
export const openDoorByCloud = (deviceId, isOpen) => {
|
|
4
|
-
return
|
|
4
|
+
return requestApi({
|
|
5
5
|
api: `${THING}.m.zigbee.lock.remotepwd.execute`,
|
|
6
6
|
version: "1.0",
|
|
7
7
|
data: {
|
|
@@ -10,8 +10,19 @@ export const openDoorByCloud = (deviceId, isOpen) => {
|
|
|
10
10
|
},
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
|
+
export const isConfirmOpenDoorByWifiPro = (deviceId, confirm) => {
|
|
14
|
+
return requestApi({
|
|
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
|
-
return
|
|
25
|
+
return requestApi({
|
|
15
26
|
api: "m.lock.ble.remote.unlock.check",
|
|
16
27
|
version: "1.0",
|
|
17
28
|
data: {
|
|
@@ -20,7 +31,7 @@ export const checkRemoteKey = async (deviceId) => {
|
|
|
20
31
|
});
|
|
21
32
|
};
|
|
22
33
|
export const getDoorKey = (deviceId) => {
|
|
23
|
-
return
|
|
34
|
+
return requestApi({
|
|
24
35
|
api: "m.lock.ble.remote.unlock.get",
|
|
25
36
|
version: "1.0",
|
|
26
37
|
data: {
|
|
@@ -29,77 +40,77 @@ export const getDoorKey = (deviceId) => {
|
|
|
29
40
|
});
|
|
30
41
|
};
|
|
31
42
|
export const getUnlockMethodInfo = (params) => {
|
|
32
|
-
return
|
|
43
|
+
return requestApi({
|
|
33
44
|
api: `${THING}.m.device.member.opmode.detail`,
|
|
34
45
|
version: "1.0",
|
|
35
46
|
data: params,
|
|
36
47
|
});
|
|
37
48
|
};
|
|
38
49
|
export const fetchCreatePasswordSN = (params) => {
|
|
39
|
-
return
|
|
50
|
+
return requestApi({
|
|
40
51
|
api: `${THING}.m.device.dp.sn.get`,
|
|
41
52
|
version: "1.0",
|
|
42
53
|
data: params,
|
|
43
54
|
});
|
|
44
55
|
};
|
|
45
56
|
export const createUnlockMethod = (params) => {
|
|
46
|
-
return
|
|
57
|
+
return requestApi({
|
|
47
58
|
api: `${THING}.m.device.member.opmode.add`,
|
|
48
59
|
version: "5.0",
|
|
49
60
|
data: params,
|
|
50
61
|
});
|
|
51
62
|
};
|
|
52
63
|
export const editUnlockMethod = (params) => {
|
|
53
|
-
return
|
|
64
|
+
return requestApi({
|
|
54
65
|
api: `${THING}.m.device.member.opmode.update`,
|
|
55
66
|
version: "5.0",
|
|
56
67
|
data: params,
|
|
57
68
|
});
|
|
58
69
|
};
|
|
59
70
|
export const removeUnlockMethod = (params) => {
|
|
60
|
-
return
|
|
71
|
+
return requestApi({
|
|
61
72
|
api: `${THING}.m.device.member.opmode.remove`,
|
|
62
73
|
version: "2.0",
|
|
63
74
|
data: params,
|
|
64
75
|
});
|
|
65
76
|
};
|
|
66
77
|
export const fetchSyncUnlockMethodInfo = (params) => {
|
|
67
|
-
return
|
|
78
|
+
return requestApi({
|
|
68
79
|
api: `${THING}.m.device.opmode.sync.rise`,
|
|
69
80
|
version: "2.0",
|
|
70
81
|
data: params,
|
|
71
82
|
});
|
|
72
83
|
};
|
|
73
84
|
export const checkFreeUnlockMethods = (params) => {
|
|
74
|
-
return
|
|
85
|
+
return requestApi({
|
|
75
86
|
api: `${THING}.m.device.unlock.waitassign`,
|
|
76
87
|
version: "1.0",
|
|
77
88
|
data: params,
|
|
78
89
|
});
|
|
79
90
|
};
|
|
80
91
|
export const fetchFreeUnlockMethods = (params) => {
|
|
81
|
-
return
|
|
92
|
+
return requestApi({
|
|
82
93
|
api: `${THING}.m.device.unlock.assignlist`,
|
|
83
94
|
version: "1.0",
|
|
84
95
|
data: params,
|
|
85
96
|
});
|
|
86
97
|
};
|
|
87
98
|
export const bindUnlockMethodToUser = (params) => {
|
|
88
|
-
return
|
|
99
|
+
return requestApi({
|
|
89
100
|
api: `${THING}.m.device.user.unlock.allocate`,
|
|
90
101
|
version: "1.0",
|
|
91
102
|
data: params,
|
|
92
103
|
});
|
|
93
104
|
};
|
|
94
105
|
export const unbindMemberUnlockMethod = (params) => {
|
|
95
|
-
return
|
|
106
|
+
return requestApi({
|
|
96
107
|
api: `${THING}.m.device.user.unlock.unbind`,
|
|
97
108
|
version: "1.0",
|
|
98
109
|
data: params,
|
|
99
110
|
});
|
|
100
111
|
};
|
|
101
112
|
export const bindUnlockMethodToUserByRecord = (params) => {
|
|
102
|
-
return
|
|
113
|
+
return requestApi({
|
|
103
114
|
api: `${THING}.m.device.user.unlock.bind`,
|
|
104
115
|
version: "1.0",
|
|
105
116
|
data: params,
|
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/log.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { THING } from "../utils/constant";
|
|
2
|
-
import {
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
3
|
export const getLatest2Log = (devId) => {
|
|
4
|
-
return
|
|
4
|
+
return requestApi({
|
|
5
5
|
api: "m.lock.log.latest2",
|
|
6
6
|
version: "1.0",
|
|
7
7
|
data: {
|
|
@@ -10,28 +10,28 @@ export const getLatest2Log = (devId) => {
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
export const getRecordList = (params) => {
|
|
13
|
-
return
|
|
13
|
+
return requestApi({
|
|
14
14
|
api: `${THING}.m.device.lock.history.list`,
|
|
15
15
|
version: "1.0",
|
|
16
16
|
data: params,
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
export const getAlarmList = (params) => {
|
|
20
|
-
return
|
|
20
|
+
return requestApi({
|
|
21
21
|
api: `${THING}.m.device.lock.alarm.list`,
|
|
22
22
|
version: "3.0",
|
|
23
23
|
data: params,
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
export const getAlbumMessages = (params) => {
|
|
27
|
-
return
|
|
27
|
+
return requestApi({
|
|
28
28
|
api: "m.lock.album.media.list",
|
|
29
29
|
version: "3.0",
|
|
30
30
|
data: params,
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
export const getMediaUrl = (params) => {
|
|
34
|
-
return
|
|
34
|
+
return requestApi({
|
|
35
35
|
api: `${THING}.m.device.lock.media.path`,
|
|
36
36
|
version: "2.0",
|
|
37
37
|
data: params,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { requestCloud } from "../utils/device";
|
|
2
|
+
const cache = new Map();
|
|
3
|
+
export const requestApi = async (options) => {
|
|
4
|
+
const key = `${options.api}-${options.version}-${JSON.stringify(options.data)}}`;
|
|
5
|
+
if (cache.has(key)) {
|
|
6
|
+
const requestCb = cache.get(key);
|
|
7
|
+
if (requestCb && Date.now() - requestCb.time <= 1000) {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
requestCb.callbacks.push((data, error) => {
|
|
10
|
+
if (error) {
|
|
11
|
+
reject(error);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
resolve(data);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
cache.set(key, {
|
|
22
|
+
time: Date.now(),
|
|
23
|
+
callbacks: [],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const result = await requestCloud(options);
|
|
28
|
+
if (cache.has(key)) {
|
|
29
|
+
const requestCb = cache.get(key);
|
|
30
|
+
if (requestCb && requestCb.callbacks.length) {
|
|
31
|
+
requestCb.callbacks.forEach((callback) => {
|
|
32
|
+
try {
|
|
33
|
+
callback(result, null);
|
|
34
|
+
}
|
|
35
|
+
catch (error) { }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
cache.delete(key);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (cache.has(key)) {
|
|
44
|
+
const requestCb = cache.get(key);
|
|
45
|
+
if (requestCb && requestCb.callbacks.length) {
|
|
46
|
+
requestCb.callbacks.forEach((callback) => {
|
|
47
|
+
try {
|
|
48
|
+
callback(null, error);
|
|
49
|
+
}
|
|
50
|
+
catch (error) { }
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
cache.delete(key);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
};
|
package/lib/api/setting.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
declare const getDeviceProperties: (deviceId: string, props: string[]) => Promise<Record<string, any>>;
|
|
2
|
-
declare const setDeviceProperties: (devId: string, data: Record<string, any>) => Promise<
|
|
2
|
+
declare const setDeviceProperties: (devId: string, data: Record<string, any>) => Promise<unknown>;
|
|
3
3
|
export { setDeviceProperties, getDeviceProperties };
|
package/lib/api/setting.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { THING } from "../utils/constant";
|
|
2
|
-
import {
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
3
|
const getDeviceProperties = (deviceId, props) => {
|
|
4
|
-
return
|
|
4
|
+
return requestApi({
|
|
5
5
|
api: `${THING}.m.device.props.fetch`,
|
|
6
6
|
version: "1.0",
|
|
7
7
|
data: {
|
|
@@ -11,7 +11,7 @@ const getDeviceProperties = (deviceId, props) => {
|
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
13
|
const setDeviceProperties = (devId, data) => {
|
|
14
|
-
return
|
|
14
|
+
return requestApi({
|
|
15
15
|
api: `${THING}.m.device.props.save`,
|
|
16
16
|
version: "1.0",
|
|
17
17
|
data: {
|
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
|
@@ -1,98 +1,135 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requestApi } from "./request";
|
|
2
2
|
import { THING } from "../utils/constant";
|
|
3
3
|
export const createTemporaryPassword = (params) => {
|
|
4
|
-
return
|
|
4
|
+
return requestApi({
|
|
5
5
|
api: `${THING}.m.device.lock.temppwd.create`,
|
|
6
6
|
version: "8.0",
|
|
7
7
|
data: params,
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
export const createOnlineUnlimited = (params) => {
|
|
11
|
+
return requestApi({
|
|
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
|
-
return
|
|
18
|
+
return requestApi({
|
|
12
19
|
api: `${THING}.m.device.lock.temppwd.validate`,
|
|
13
20
|
version: "3.0",
|
|
14
21
|
data: params,
|
|
15
22
|
});
|
|
16
23
|
};
|
|
17
24
|
export const updateTemporaryPassword = (params) => {
|
|
18
|
-
return
|
|
25
|
+
return requestApi({
|
|
19
26
|
api: `${THING}.m.device.lock.temppwd.update`,
|
|
20
27
|
version: "4.0",
|
|
21
28
|
data: params,
|
|
22
29
|
});
|
|
23
30
|
};
|
|
24
31
|
export const getTempPassword = (params) => {
|
|
25
|
-
return
|
|
32
|
+
return requestApi({
|
|
26
33
|
api: `${THING}.m.device.lock.temppwd.detail`,
|
|
27
34
|
version: "1.0",
|
|
28
35
|
data: params,
|
|
29
36
|
});
|
|
30
37
|
};
|
|
31
38
|
export const deleteTempPassword = (params) => {
|
|
32
|
-
return
|
|
39
|
+
return requestApi({
|
|
33
40
|
api: `${THING}.m.device.lock.temppwd.remove`,
|
|
34
41
|
version: "2.0",
|
|
35
42
|
data: params,
|
|
36
43
|
});
|
|
37
44
|
};
|
|
45
|
+
export const removeTempOnlineUnlimitedAPI = (params) => {
|
|
46
|
+
return requestApi({
|
|
47
|
+
api: `${THING}.m.device.lock.temppwd.del`,
|
|
48
|
+
version: "2.0",
|
|
49
|
+
data: params,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export const getTempOnlineUnlimitedListAPI = (devId) => {
|
|
53
|
+
return requestApi({
|
|
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 requestApi({
|
|
63
|
+
api: `${THING}.m.device.lock.offlinepwd.list`,
|
|
64
|
+
version: "1.0",
|
|
65
|
+
data: params,
|
|
66
|
+
});
|
|
67
|
+
};
|
|
38
68
|
export const createOfflinePassword = (params) => {
|
|
39
|
-
return
|
|
69
|
+
return requestApi({
|
|
40
70
|
api: `${THING}.m.device.lock.offlinepwd.get`,
|
|
41
71
|
version: "3.0",
|
|
42
72
|
data: params,
|
|
43
73
|
});
|
|
44
74
|
};
|
|
75
|
+
export const createOfflineOnceAPI = (params) => {
|
|
76
|
+
return requestApi({
|
|
77
|
+
api: `${THING}.m.device.lock.offlinepwd.get`,
|
|
78
|
+
version: "1.0",
|
|
79
|
+
data: params,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
45
82
|
export const getDynamicPassword = (params) => {
|
|
46
|
-
return
|
|
83
|
+
return requestApi({
|
|
47
84
|
api: `${THING}.m.device.lock.dynapwd.get`,
|
|
48
85
|
version: "3.0",
|
|
49
86
|
data: params,
|
|
50
87
|
});
|
|
51
88
|
};
|
|
52
89
|
export const revokeOfflinePassword = (params) => {
|
|
53
|
-
return
|
|
90
|
+
return requestApi({
|
|
54
91
|
api: `${THING}.m.device.lock.offlinepwd.revoke`,
|
|
55
92
|
version: "2.0",
|
|
56
93
|
data: params,
|
|
57
94
|
});
|
|
58
95
|
};
|
|
59
96
|
export const fetchEffectiveList = (params) => {
|
|
60
|
-
return
|
|
97
|
+
return requestApi({
|
|
61
98
|
api: `${THING}.m.device.lock.auth.list`,
|
|
62
99
|
version: "1.0",
|
|
63
100
|
data: params,
|
|
64
101
|
});
|
|
65
102
|
};
|
|
66
103
|
export const fetchInvalidList = (params) => {
|
|
67
|
-
return
|
|
104
|
+
return requestApi({
|
|
68
105
|
api: `${THING}.m.device.lock.auth.list.invalid`,
|
|
69
106
|
version: "1.0",
|
|
70
107
|
data: params,
|
|
71
108
|
});
|
|
72
109
|
};
|
|
73
110
|
export const clearInvalidTempList = (params) => {
|
|
74
|
-
return
|
|
111
|
+
return requestApi({
|
|
75
112
|
api: `${THING}.m.device.lock.auth.list.clear`,
|
|
76
113
|
version: "1.0",
|
|
77
114
|
data: params,
|
|
78
115
|
});
|
|
79
116
|
};
|
|
80
117
|
export const reNameTemporary = (params) => {
|
|
81
|
-
return
|
|
118
|
+
return requestApi({
|
|
82
119
|
api: `${THING}.m.device.lock.temppwd.name`,
|
|
83
120
|
version: "1.0",
|
|
84
121
|
data: params,
|
|
85
122
|
});
|
|
86
123
|
};
|
|
87
124
|
export const reNameOffline = (params) => {
|
|
88
|
-
return
|
|
125
|
+
return requestApi({
|
|
89
126
|
api: `${THING}.m.device.lock.offlinepwd.name.update`,
|
|
90
127
|
version: "2.0",
|
|
91
128
|
data: params,
|
|
92
129
|
});
|
|
93
130
|
};
|
|
94
131
|
export const getSyncTempPasswords = (params) => {
|
|
95
|
-
return
|
|
132
|
+
return requestApi({
|
|
96
133
|
api: "m.lock.device.lock.tempwd.sync",
|
|
97
134
|
version: "1.0",
|
|
98
135
|
data: params,
|