@ray-js/lock-sdk 1.2.0-beta.24 → 1.2.0-beta.25
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/fit.d.ts +55 -2
- package/lib/api/fit.js +43 -1
- package/lib/api/log.d.ts +31 -0
- package/lib/api/log.js +22 -0
- package/lib/api/product.d.ts +8 -0
- package/lib/api/product.js +10 -0
- package/lib/api/temp.d.ts +21 -0
- package/lib/api/temp.js +24 -0
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +2 -0
- package/lib/entries/fit/bootstrap/bootstrap.js +1 -0
- package/lib/entries/fit/build-instance.js +2 -0
- package/lib/entries/fit/exports/binding.d.ts +4 -3
- package/lib/entries/fit/exports/device.d.ts +8 -7
- package/lib/entries/fit/exports/device.js +12 -12
- package/lib/entries/fit/exports/index.d.ts +3 -0
- package/lib/entries/fit/exports/index.js +3 -0
- package/lib/entries/fit/exports/log.d.ts +7 -0
- package/lib/entries/fit/exports/log.js +15 -0
- package/lib/entries/fit/exports/misc.d.ts +5 -0
- package/lib/entries/fit/exports/misc.js +9 -0
- package/lib/entries/fit/exports/setting.d.ts +4 -0
- package/lib/entries/fit/exports/setting.js +8 -0
- package/lib/entries/fit/exports/state.d.ts +4 -0
- package/lib/entries/fit/exports/state.js +12 -0
- package/lib/entries/fit/exports/temp.d.ts +24 -3
- package/lib/entries/fit/exports/temp.js +43 -2
- package/lib/entries/fit/index.js +2 -0
- package/lib/entries/main/exports/log.d.ts +2 -0
- package/lib/entries/main/exports/log.js +7 -1
- package/lib/entries/main/exports/misc.d.ts +3 -1
- package/lib/entries/main/exports/misc.js +2 -2
- package/lib/feature/fit/bind-lock-to-fit.js +41 -1
- package/lib/feature/fit/ble-key.d.ts +10 -4
- package/lib/feature/fit/ble-key.js +145 -4
- package/lib/feature/fit/device-bv.d.ts +2 -0
- package/lib/feature/fit/device-bv.js +15 -0
- package/lib/feature/fit/invalid-password.d.ts +10 -0
- package/lib/feature/fit/invalid-password.js +43 -0
- package/lib/feature/fit/list.d.ts +11 -2
- package/lib/feature/fit/list.js +44 -5
- package/lib/feature/fit/log.d.ts +7 -0
- package/lib/feature/fit/log.js +123 -0
- package/lib/feature/fit/method/update-remove.js +40 -14
- package/lib/feature/fit/password-list.d.ts +37 -0
- package/lib/feature/fit/password-list.js +44 -1
- package/lib/feature/fit/product.d.ts +5 -0
- package/lib/feature/fit/product.js +11 -0
- package/lib/feature/fit/security-channel.d.ts +2 -0
- package/lib/feature/fit/security-channel.js +15 -0
- package/lib/feature/fit/sync.d.ts +4 -2
- package/lib/feature/fit/sync.js +56 -22
- package/lib/feature/fit/temp-password.d.ts +23 -0
- package/lib/feature/fit/temp-password.js +95 -3
- package/lib/feature/fit/users.d.ts +1 -0
- package/lib/feature/fit/users.js +1 -0
- package/lib/feature/log/log.d.ts +5 -1
- package/lib/feature/log/log.js +6 -4
- package/lib/feature/misc/connect-device.d.ts +1 -1
- package/lib/feature/misc/connect-device.js +5 -5
- package/lib/feature/password/temporary/offline-create.d.ts +14 -0
- package/lib/feature/password/temporary/offline-create.js +77 -1
- package/lib/feature/state/clear.js +1 -0
- package/lib/feature/state/platform-routing.js +4 -0
- package/lib/feature/state/sync/remote-serect-key.js +7 -0
- package/lib/feature/utils/index.d.ts +1 -0
- package/lib/feature/utils/index.js +1 -0
- package/lib/interface.d.ts +12 -0
- package/lib/runtime/LockDeviceRuntime.js +3 -0
- package/lib/runtime/lock-config.d.ts +1 -0
- package/lib/runtime/lock-config.js +2 -1
- package/lib/runtime/runtime-state-types.d.ts +6 -0
- package/package.json +1 -1
package/lib/api/fit.d.ts
CHANGED
|
@@ -48,7 +48,11 @@ export interface SyncFitToLockRiseResult {
|
|
|
48
48
|
}
|
|
49
49
|
export declare const syncFitToLockRise: (fittingId: string) => Promise<SyncFitToLockRiseResult>;
|
|
50
50
|
export declare const syncFitReport: (fittingId: string, ins: string) => Promise<unknown>;
|
|
51
|
-
export
|
|
51
|
+
export interface SyncOpenModeRiseResult {
|
|
52
|
+
ins: string;
|
|
53
|
+
distributed: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const syncOpenModeRise: (devId: string, dpIds: string[]) => Promise<SyncOpenModeRiseResult>;
|
|
52
56
|
export interface RawPasswordItem {
|
|
53
57
|
unlockBindingId: number;
|
|
54
58
|
effectiveTime: number;
|
|
@@ -73,6 +77,30 @@ export interface RawPasswordItem {
|
|
|
73
77
|
gmtCreate: number;
|
|
74
78
|
}
|
|
75
79
|
export declare const getFitPasswordList: (fittingId: string) => Promise<RawPasswordItem[]>;
|
|
80
|
+
export interface RawOfflinePasswordItem {
|
|
81
|
+
unlockBindingId?: number | string;
|
|
82
|
+
pwdId: number;
|
|
83
|
+
sn: number;
|
|
84
|
+
gmtCreate: number;
|
|
85
|
+
opModeType: number;
|
|
86
|
+
opModeSubType: number;
|
|
87
|
+
pwdName: string;
|
|
88
|
+
gmtStart: number;
|
|
89
|
+
gmtExpired: number;
|
|
90
|
+
mayExpired: boolean;
|
|
91
|
+
devNameList: string[];
|
|
92
|
+
scheduleDetails: RawFitOpenModeScheduleItem[];
|
|
93
|
+
revokedPwdName: string;
|
|
94
|
+
revokedPwdEffectiveTime: number;
|
|
95
|
+
revokedPwdInvalidTime: number;
|
|
96
|
+
}
|
|
97
|
+
export interface FitOfflinePwdQuery {
|
|
98
|
+
limit?: number;
|
|
99
|
+
offset?: number;
|
|
100
|
+
}
|
|
101
|
+
export declare const getFitOfflinePasswordList: (fittingId: string, query?: FitOfflinePwdQuery) => Promise<RawOfflinePasswordItem[] | {
|
|
102
|
+
datas: RawOfflinePasswordItem[];
|
|
103
|
+
}>;
|
|
76
104
|
export interface RawFitUserItem {
|
|
77
105
|
userId: string;
|
|
78
106
|
uid: string;
|
|
@@ -143,7 +171,19 @@ export interface RawFitOpenModeItem {
|
|
|
143
171
|
gmtCreate: number;
|
|
144
172
|
}
|
|
145
173
|
export declare const getFitOpenModeList: (fittingId: string, dpId?: number) => Promise<RawFitOpenModeItem[]>;
|
|
146
|
-
export
|
|
174
|
+
export interface RawFitBleKeyItem {
|
|
175
|
+
id: string;
|
|
176
|
+
unlockBindingId: string;
|
|
177
|
+
name: string;
|
|
178
|
+
effectiveTime: number;
|
|
179
|
+
invalidTime: number;
|
|
180
|
+
scheduleDetails?: RawFitOpenModeScheduleItem[];
|
|
181
|
+
opModeSubType?: number;
|
|
182
|
+
sn?: number;
|
|
183
|
+
userName?: string;
|
|
184
|
+
devNameList?: string[];
|
|
185
|
+
}
|
|
186
|
+
export declare const getFitBleKeyListApi: (fittingId: string) => Promise<RawFitBleKeyItem[]>;
|
|
147
187
|
export declare const addFitBleKeyApi: (fittingId: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
148
188
|
interface UpdateFitBleKeyParams {
|
|
149
189
|
unlockBindingId: string;
|
|
@@ -200,4 +240,17 @@ export declare const addFitOnlineTempPwdCloud: (params: FetchFitOnlineTempPwdMes
|
|
|
200
240
|
export declare const removeFitOnlineTempPwd: (fittingId: string, pwdId: number) => Promise<unknown>;
|
|
201
241
|
export declare const updateFitOnlineTempPwd: (fittingId: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
202
242
|
export declare const renameFitOnlineTempPwd: (fittingId: string, pwdId: number, name: string) => Promise<true>;
|
|
243
|
+
export declare const resendFitOnlineTempPwd: (fittingId: string, pwdId: number) => Promise<boolean>;
|
|
244
|
+
export interface FitInvalidPwdQuery {
|
|
245
|
+
opMode?: number | string;
|
|
246
|
+
limit?: number;
|
|
247
|
+
offset?: number;
|
|
248
|
+
}
|
|
249
|
+
export interface FitInvalidPwdListResult {
|
|
250
|
+
datas: RawPasswordItem[];
|
|
251
|
+
totalCount: number;
|
|
252
|
+
}
|
|
253
|
+
export declare const getFitInvalidPwdListApi: (fittingId: string, query?: FitInvalidPwdQuery) => Promise<FitInvalidPwdListResult>;
|
|
254
|
+
export declare const clearFitInvalidPwdApi: (fittingId: string, opMode?: number | string) => Promise<boolean>;
|
|
255
|
+
export declare const getFitDeviceBVApi: (fittingId: string) => Promise<number>;
|
|
203
256
|
export {};
|
package/lib/api/fit.js
CHANGED
|
@@ -46,7 +46,7 @@ export const syncFitToLockRise = (fittingId) => requestApi({
|
|
|
46
46
|
logName: "syncFitToLockRise",
|
|
47
47
|
api: `${THING}.m.device.lock.fittings.sync.rise`,
|
|
48
48
|
version: "1.0",
|
|
49
|
-
data: { fittingId },
|
|
49
|
+
data: { devId: fittingId, fittingId },
|
|
50
50
|
});
|
|
51
51
|
export const syncFitReport = (fittingId, ins) => requestApi({
|
|
52
52
|
logName: "syncFitReport",
|
|
@@ -66,6 +66,12 @@ export const getFitPasswordList = (fittingId) => requestApi({
|
|
|
66
66
|
version: "1.0",
|
|
67
67
|
data: { fittingId },
|
|
68
68
|
});
|
|
69
|
+
export const getFitOfflinePasswordList = (fittingId, query = {}) => requestApi({
|
|
70
|
+
logName: "getFitOfflinePasswordList",
|
|
71
|
+
api: `${THING}.m.device.lock.offlinepwd.list.valid`,
|
|
72
|
+
version: "1.0",
|
|
73
|
+
data: { devId: fittingId, limit: 200, ...query },
|
|
74
|
+
});
|
|
69
75
|
export const getFitUserListApi = (fittingId) => requestApi({
|
|
70
76
|
logName: "getFitUserListApi",
|
|
71
77
|
api: `${THING}.m.device.member.list`,
|
|
@@ -156,3 +162,39 @@ export const renameFitOnlineTempPwd = (fittingId, pwdId, name) => requestApi({
|
|
|
156
162
|
version: "1.0",
|
|
157
163
|
data: { fittingId, pwdId, name },
|
|
158
164
|
});
|
|
165
|
+
export const resendFitOnlineTempPwd = (fittingId, pwdId) => requestApi({
|
|
166
|
+
logName: "resendFitOnlineTempPwd",
|
|
167
|
+
api: `${THING}.m.device.fittings.password.temp.resend`,
|
|
168
|
+
version: "1.0",
|
|
169
|
+
data: { fittingId, pwdId },
|
|
170
|
+
});
|
|
171
|
+
export const getFitInvalidPwdListApi = (fittingId, query = {}) => requestApi({
|
|
172
|
+
logName: "getFitInvalidPwdListApi",
|
|
173
|
+
api: `${THING}.m.device.fittings.unlock.bindings.list.garbage`,
|
|
174
|
+
version: "2.0",
|
|
175
|
+
data: { fittingId, ...query },
|
|
176
|
+
});
|
|
177
|
+
export const clearFitInvalidPwdApi = (fittingId, opMode) => requestApi({
|
|
178
|
+
logName: "clearFitInvalidPwdApi",
|
|
179
|
+
api: `${THING}.m.device.fittings.unlock.bindings.clear`,
|
|
180
|
+
version: "2.0",
|
|
181
|
+
data: { fittingId, opMode },
|
|
182
|
+
});
|
|
183
|
+
const FIT_BV_EXT_CONFIG_KEY = "5de69aaa812cd52c9a14dcfe";
|
|
184
|
+
export const getFitDeviceBVApi = (fittingId) => requestApi({
|
|
185
|
+
logName: "getFitDeviceBVApi",
|
|
186
|
+
api: `${THING}.app.buyer.high.power.get`,
|
|
187
|
+
version: "1.0",
|
|
188
|
+
data: { input: { deviceId: fittingId, code: "tyabi3trvg" } },
|
|
189
|
+
}).then((res) => {
|
|
190
|
+
if (res?.extConfig) {
|
|
191
|
+
try {
|
|
192
|
+
const extra = JSON.parse(res.extConfig);
|
|
193
|
+
return Number(extra[FIT_BV_EXT_CONFIG_KEY]) || 0;
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return 0;
|
|
200
|
+
});
|
package/lib/api/log.d.ts
CHANGED
|
@@ -74,6 +74,35 @@ export interface LogsResult {
|
|
|
74
74
|
totalCount: number;
|
|
75
75
|
}
|
|
76
76
|
export declare const getRecordList: (params: GetRecordListParams) => Promise<LogsResult>;
|
|
77
|
+
export interface FitRecordInfo {
|
|
78
|
+
id?: string | number;
|
|
79
|
+
historyId?: string | number;
|
|
80
|
+
time?: string | number;
|
|
81
|
+
gmtCreate?: number;
|
|
82
|
+
dpId: string | number;
|
|
83
|
+
dpValue: any;
|
|
84
|
+
userId: string;
|
|
85
|
+
userName?: string;
|
|
86
|
+
unlockName?: string;
|
|
87
|
+
memberBindableFlag?: 0 | 1;
|
|
88
|
+
avatarUrl?: string;
|
|
89
|
+
relateDevName?: string;
|
|
90
|
+
dps?: Record<number, any>[];
|
|
91
|
+
mediaInfoList?: MediaInfoRecord[];
|
|
92
|
+
unionUnlockInfo?: UnionUnlockInfo[];
|
|
93
|
+
localOperateRecordInfo?: LocalOperateRecordInfo;
|
|
94
|
+
matterRecordInfo?: {
|
|
95
|
+
matterSn: number;
|
|
96
|
+
matterSource: number;
|
|
97
|
+
matterType: number;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface FitRecordListResult {
|
|
101
|
+
datas: FitRecordInfo[];
|
|
102
|
+
hasNext: boolean;
|
|
103
|
+
totalCount: number;
|
|
104
|
+
}
|
|
105
|
+
export declare const getFitRecordListApi: (params: GetRecordListParams) => Promise<FitRecordListResult>;
|
|
77
106
|
export interface LockLogListItem {
|
|
78
107
|
logId: string;
|
|
79
108
|
logCategory: LockLogCategory;
|
|
@@ -135,6 +164,8 @@ interface GetAlarmListResult {
|
|
|
135
164
|
totalCount: number;
|
|
136
165
|
}
|
|
137
166
|
export declare const getAlarmList: (params: GetRecordListParams) => Promise<GetAlarmListResult>;
|
|
167
|
+
export declare const getAlarmUnreadCountApi: (devId: string) => Promise<number>;
|
|
168
|
+
export declare const getActivePeriodApi: (devId: string) => Promise<number>;
|
|
138
169
|
interface GetAlbumMessagesParams {
|
|
139
170
|
devId: string;
|
|
140
171
|
limit: number;
|
package/lib/api/log.js
CHANGED
|
@@ -18,6 +18,12 @@ export const getRecordList = (params) => {
|
|
|
18
18
|
data: params,
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
+
export const getFitRecordListApi = (params) => requestApi({
|
|
22
|
+
logName: "getFitRecordListApi",
|
|
23
|
+
api: `${THING}.m.device.lock.history.list`,
|
|
24
|
+
version: "2.0",
|
|
25
|
+
data: params,
|
|
26
|
+
});
|
|
21
27
|
export const getLockLogList = (params) => {
|
|
22
28
|
return requestApi({
|
|
23
29
|
logName: "getLockLogList",
|
|
@@ -42,6 +48,22 @@ export const getAlarmList = (params) => {
|
|
|
42
48
|
data: params,
|
|
43
49
|
});
|
|
44
50
|
};
|
|
51
|
+
export const getAlarmUnreadCountApi = (devId) => {
|
|
52
|
+
return requestApi({
|
|
53
|
+
logName: "getAlarmUnreadCountApi",
|
|
54
|
+
api: `${THING}.m.device.lock.alarm.unread`,
|
|
55
|
+
version: "1.0",
|
|
56
|
+
data: { devId },
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export const getActivePeriodApi = (devId) => {
|
|
60
|
+
return requestApi({
|
|
61
|
+
logName: "getActivePeriodApi",
|
|
62
|
+
api: `${THING}.m.device.lock.active.period`,
|
|
63
|
+
version: "1.0",
|
|
64
|
+
data: { devId },
|
|
65
|
+
});
|
|
66
|
+
};
|
|
45
67
|
export const getAlbumMessages = (params) => {
|
|
46
68
|
return requestApi({
|
|
47
69
|
logName: "getAlbumMessages",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ProductSpecResult {
|
|
2
|
+
productManual?: boolean;
|
|
3
|
+
productInstVideo?: boolean;
|
|
4
|
+
urlType?: number;
|
|
5
|
+
url?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare const configCheck: (devId: string, productId: string, configItem: string) => Promise<ProductSpecResult>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { THING } from "../utils/constant";
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
|
+
export const configCheck = (devId, productId, configItem) => {
|
|
4
|
+
return requestApi({
|
|
5
|
+
logName: "productConfigCheck",
|
|
6
|
+
api: `${THING}.m.product.config.check`,
|
|
7
|
+
version: "1.0",
|
|
8
|
+
data: { devId, productId, configItem },
|
|
9
|
+
});
|
|
10
|
+
};
|
package/lib/api/temp.d.ts
CHANGED
|
@@ -129,6 +129,15 @@ interface CreateOfflineOnceParams {
|
|
|
129
129
|
gmtExpired: string;
|
|
130
130
|
}
|
|
131
131
|
export declare const createOfflineOnceAPI: (params: CreateOfflineOnceParams) => Promise<OfflinePwdResult>;
|
|
132
|
+
interface GetOfflinePwdAvailableParams {
|
|
133
|
+
devId: string;
|
|
134
|
+
pwdType: string;
|
|
135
|
+
}
|
|
136
|
+
export interface OfflinePwdAvailableResult {
|
|
137
|
+
available: boolean;
|
|
138
|
+
nextAvailableTime?: number;
|
|
139
|
+
}
|
|
140
|
+
export declare const getOfflinePwdAvailable: (params: GetOfflinePwdAvailableParams) => Promise<OfflinePwdAvailableResult>;
|
|
132
141
|
interface GetDynapwdParams {
|
|
133
142
|
devId: string;
|
|
134
143
|
adminPwd?: string;
|
|
@@ -142,6 +151,12 @@ interface RevokeOfflinePasswordParams {
|
|
|
142
151
|
name?: string;
|
|
143
152
|
}
|
|
144
153
|
export declare const revokeOfflinePassword: (params: RevokeOfflinePasswordParams) => Promise<OfflinePwdResult>;
|
|
154
|
+
interface RevokeOfflinePasswordByPwdIdParams {
|
|
155
|
+
devId: string;
|
|
156
|
+
pwdId: number;
|
|
157
|
+
name?: string;
|
|
158
|
+
}
|
|
159
|
+
export declare const revokeOfflinePasswordByPwdId: (params: RevokeOfflinePasswordByPwdIdParams) => Promise<OfflinePwdResult>;
|
|
145
160
|
interface EffectiveListParams {
|
|
146
161
|
devId: string;
|
|
147
162
|
authTypes: string[];
|
|
@@ -208,6 +223,12 @@ interface ReNameOfflineParams {
|
|
|
208
223
|
unlockBindingId: string;
|
|
209
224
|
}
|
|
210
225
|
export declare const reNameOffline: (params: ReNameOfflineParams) => Promise<unknown>;
|
|
226
|
+
interface ReNameOfflineByPwdIdParams {
|
|
227
|
+
devId: string;
|
|
228
|
+
pwdName: string;
|
|
229
|
+
pwdId: number;
|
|
230
|
+
}
|
|
231
|
+
export declare const reNameOfflineByPwdId: (params: ReNameOfflineByPwdIdParams) => Promise<unknown>;
|
|
211
232
|
export interface SyncTempPwdScheduleItem {
|
|
212
233
|
allDay: boolean;
|
|
213
234
|
effectiveTime: number;
|
package/lib/api/temp.js
CHANGED
|
@@ -90,6 +90,14 @@ export const createOfflineOnceAPI = (params) => {
|
|
|
90
90
|
data: params,
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
+
export const getOfflinePwdAvailable = (params) => {
|
|
94
|
+
return requestApi({
|
|
95
|
+
logName: "getOfflinePwdAvailable",
|
|
96
|
+
api: `${THING}.m.device.lock.offlinepwd.available`,
|
|
97
|
+
version: "1.0",
|
|
98
|
+
data: params,
|
|
99
|
+
});
|
|
100
|
+
};
|
|
93
101
|
export const getDynamicPassword = (params) => {
|
|
94
102
|
return requestApi({
|
|
95
103
|
logName: "getDynamicPassword",
|
|
@@ -106,6 +114,14 @@ export const revokeOfflinePassword = (params) => {
|
|
|
106
114
|
data: params,
|
|
107
115
|
});
|
|
108
116
|
};
|
|
117
|
+
export const revokeOfflinePasswordByPwdId = (params) => {
|
|
118
|
+
return requestApi({
|
|
119
|
+
logName: "revokeOfflinePasswordByPwdId",
|
|
120
|
+
api: `${THING}.m.device.lock.offlinepwd.revoke`,
|
|
121
|
+
version: "1.0",
|
|
122
|
+
data: params,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
109
125
|
export const fetchEffectiveList = (params) => {
|
|
110
126
|
return requestApi({
|
|
111
127
|
logName: "fetchEffectiveList",
|
|
@@ -146,6 +162,14 @@ export const reNameOffline = (params) => {
|
|
|
146
162
|
data: params,
|
|
147
163
|
});
|
|
148
164
|
};
|
|
165
|
+
export const reNameOfflineByPwdId = (params) => {
|
|
166
|
+
return requestApi({
|
|
167
|
+
logName: "reNameOfflineByPwdId",
|
|
168
|
+
api: `${THING}.m.device.lock.offlinepwd.name.update`,
|
|
169
|
+
version: "1.0",
|
|
170
|
+
data: params,
|
|
171
|
+
});
|
|
172
|
+
};
|
|
149
173
|
export const getSyncTempPasswords = (params) => {
|
|
150
174
|
return requestApi({
|
|
151
175
|
logName: "getSyncTempPasswords",
|
|
@@ -4,12 +4,14 @@ import { clearStateForRuntime } from "../../../feature/state/clear";
|
|
|
4
4
|
import { registerRuntime, unregisterRuntime, getRegisteredRuntimeCount, } from "../../../runtime/registry";
|
|
5
5
|
import { buildFitSDKInstance } from "../build-instance";
|
|
6
6
|
import { createBootstrappedRuntime } from "./bootstrap";
|
|
7
|
+
import { startFitSyncReportForRuntime } from "../../../feature/fit/sync";
|
|
7
8
|
export async function bootstrapRegisteredFitInstance(options) {
|
|
8
9
|
const runtime = await createBootstrappedRuntime(options);
|
|
9
10
|
registerRuntime(runtime);
|
|
10
11
|
try {
|
|
11
12
|
addEvents(runtime);
|
|
12
13
|
await initState(runtime);
|
|
14
|
+
startFitSyncReportForRuntime(runtime);
|
|
13
15
|
return { runtime, instance: buildFitSDKInstance(runtime) };
|
|
14
16
|
}
|
|
15
17
|
catch (error) {
|
|
@@ -36,6 +36,7 @@ export async function applyFitOptionsToRuntime(runtime, options) {
|
|
|
36
36
|
idsByCode[item.code] = item.id;
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
+
config.isFitting = true;
|
|
39
40
|
config.strictMode = options?.strictMode ?? true;
|
|
40
41
|
config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
|
|
41
42
|
config.passwordSupportZero = options?.passwordSupportZero ?? true;
|
|
@@ -3,6 +3,7 @@ import { registerFitSDKInstanceRuntime } from "./bootstrap/lock-instance-runtime
|
|
|
3
3
|
import { getRegisteredRuntimeCount, unregisterRuntime, } from "../../runtime/registry";
|
|
4
4
|
import { clearStateForRuntime } from "../../feature/state/clear";
|
|
5
5
|
import { removeEvents } from "../../feature/state/platform-routing";
|
|
6
|
+
import { stopFitSyncReportForRuntime } from "../../feature/fit/sync";
|
|
6
7
|
import { updateConfigForRuntime, } from "../../feature/misc/update-config";
|
|
7
8
|
import { sdkLog } from "../../utils/sdk-log";
|
|
8
9
|
import * as FitExports from "./exports";
|
|
@@ -27,6 +28,7 @@ export function buildFitSDKInstance(runtime) {
|
|
|
27
28
|
sdkLog("info", "fit-lifecycle", "destroy", { devId: runtime.devId });
|
|
28
29
|
unregisterRuntime(runtime.devId);
|
|
29
30
|
clearPrimaryFitSDKInstanceIfDevId(runtime.devId);
|
|
31
|
+
stopFitSyncReportForRuntime(runtime);
|
|
30
32
|
clearStateForRuntime(runtime);
|
|
31
33
|
if (getRegisteredRuntimeCount() === 0) {
|
|
32
34
|
removeEvents();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type BoundLockListItem, type FitLockUnbindableReason, type UnbindLockListItem } from "../../../feature/fit/list";
|
|
1
2
|
import { BoundFitLockItem, UnbindLockItem } from "../../../api/fit";
|
|
2
|
-
export type { BoundFitLockItem, UnbindLockItem };
|
|
3
|
-
export declare function getBoundLockList(): Promise<
|
|
4
|
-
export declare function getUnbindLockList(): Promise<
|
|
3
|
+
export type { BoundFitLockItem, BoundLockListItem, UnbindLockItem, UnbindLockListItem, FitLockUnbindableReason, };
|
|
4
|
+
export declare function getBoundLockList(): Promise<BoundLockListItem[]>;
|
|
5
|
+
export declare function getUnbindLockList(): Promise<UnbindLockListItem[]>;
|
|
5
6
|
export declare function bindLockToFit(lock: UnbindLockItem): Promise<unknown>;
|
|
6
7
|
export declare function unbindLockToFit(lock: BoundFitLockItem & {
|
|
7
8
|
bindingId: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type FitStartAddUnlockMethodResult } from "../../../feature/fit/method/add-flow";
|
|
2
2
|
import type { FitAddPasswordParams, FitAddUnlockMethodEvent, FitAddUnlockMethodListener, FitCancelAddUnlockMethodParams, FitStartAddUnlockMethodParams, FitUnlockMethodDevice, FitUnlockMethodItem, FitUpdateUnlockMethodParams, GetFitUnlockMethodListParams } from "../../../feature/fit/method/types";
|
|
3
|
-
import {
|
|
3
|
+
import { CreateTemporaryBleKeyParams, UpdateTemporaryBleKeyParams, RenameFitBleKeyParams } from "../../../feature/fit/ble-key";
|
|
4
4
|
import { type FitUserItem } from "../../../feature/fit/users";
|
|
5
|
-
|
|
5
|
+
import type { FitBleKeyItem } from "../../../interface";
|
|
6
|
+
export type { FitAddPasswordParams, FitStartAddUnlockMethodParams, FitCancelAddUnlockMethodParams, FitUpdateUnlockMethodParams, FitAddUnlockMethodEvent, FitAddUnlockMethodListener, FitStartAddUnlockMethodResult, FitUserItem, FitUnlockMethodDevice, FitUnlockMethodItem, GetFitUnlockMethodListParams, FitBleKeyItem, CreateTemporaryBleKeyParams, };
|
|
6
7
|
export declare function fitAddPassword(params: FitAddPasswordParams): Promise<void>;
|
|
7
8
|
export declare function fitStartAddUnlockMethod(params: FitStartAddUnlockMethodParams): Promise<FitStartAddUnlockMethodResult>;
|
|
8
9
|
export declare function fitCancelAddUnlockMethod(params: FitCancelAddUnlockMethodParams): Promise<void>;
|
|
@@ -11,12 +12,12 @@ export declare function offFitAddUnlockMethod(listener: FitAddUnlockMethodListen
|
|
|
11
12
|
export declare function fitUpdateUnlockMethod(params: FitUpdateUnlockMethodParams): Promise<void>;
|
|
12
13
|
export declare function fitDeleteUnlockMethod(id: number, lockDevId?: string): Promise<void>;
|
|
13
14
|
export declare function getFitUnlockMethodList(params: GetFitUnlockMethodListParams): Promise<FitUnlockMethodItem[]>;
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function syncOpenModeRise(dpIds: string): Promise<unknown>;
|
|
17
|
-
export declare function getFitBleKeyList(): Promise<unknown[]>;
|
|
15
|
+
export declare function syncOpenModeRise(dpCodes?: string[]): Promise<import("../../../api/fit").SyncOpenModeRiseResult>;
|
|
16
|
+
export declare function getFitBleKeyList(): Promise<FitBleKeyItem[]>;
|
|
18
17
|
export declare function addFitBleKey(params: Record<string, unknown>): Promise<unknown>;
|
|
19
|
-
export declare function
|
|
18
|
+
export declare function createFitPermanentBleKey(userId: string): Promise<unknown>;
|
|
19
|
+
export declare function createFitTemporaryBleKey(params: CreateTemporaryBleKeyParams): Promise<unknown>;
|
|
20
|
+
export declare function updateFitTemporaryBleKey(params: UpdateTemporaryBleKeyParams): Promise<unknown>;
|
|
20
21
|
interface RemoveFitBleKeyParams {
|
|
21
22
|
id: string;
|
|
22
23
|
}
|
|
@@ -4,8 +4,8 @@ import { fitCancelAddUnlockMethodForRuntime, fitStartAddUnlockMethodForRuntime,
|
|
|
4
4
|
import { fitDeleteUnlockMethodForRuntime, fitUpdateUnlockMethodForRuntime, } from "../../../feature/fit/method/update-remove";
|
|
5
5
|
import { offFitAddUnlockMethodForRuntime, onFitAddUnlockMethodForRuntime, } from "../../../feature/fit/method/add-method-events";
|
|
6
6
|
import { getFitUnlockMethodListForRuntime } from "../../../feature/fit/method/list";
|
|
7
|
-
import {
|
|
8
|
-
import { getFitBleKeyListForRuntime, addFitBleKeyForRuntime,
|
|
7
|
+
import { syncOpenModeRiseForRuntime } from "../../../feature/fit/sync";
|
|
8
|
+
import { getFitBleKeyListForRuntime, addFitBleKeyForRuntime, createFitPermanentBleKeyForRuntime, createFitTemporaryBleKeyForRuntime, updateFitTemporaryBleKeyForRuntime, removeFitBleKeyForRuntime, renameFitBleKeyForRuntime, } from "../../../feature/fit/ble-key";
|
|
9
9
|
import { setFitSettingForRuntime } from "../../../feature/fit/setting";
|
|
10
10
|
import { getFitUsersForRuntime, } from "../../../feature/fit/users";
|
|
11
11
|
export function fitAddPassword(params) {
|
|
@@ -32,14 +32,8 @@ export function fitDeleteUnlockMethod(id, lockDevId) {
|
|
|
32
32
|
export function getFitUnlockMethodList(params) {
|
|
33
33
|
return getFitUnlockMethodListForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
34
34
|
}
|
|
35
|
-
export function
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
export function syncFitReport(ins) {
|
|
39
|
-
return syncFitReportForRuntime(resolveRuntimeFromExportThis(this), ins);
|
|
40
|
-
}
|
|
41
|
-
export function syncOpenModeRise(dpIds) {
|
|
42
|
-
return syncOpenModeRiseForRuntime(resolveRuntimeFromExportThis(this), dpIds);
|
|
35
|
+
export function syncOpenModeRise(dpCodes) {
|
|
36
|
+
return syncOpenModeRiseForRuntime(resolveRuntimeFromExportThis(this), dpCodes);
|
|
43
37
|
}
|
|
44
38
|
export function getFitBleKeyList() {
|
|
45
39
|
return getFitBleKeyListForRuntime(resolveRuntimeFromExportThis(this));
|
|
@@ -47,8 +41,14 @@ export function getFitBleKeyList() {
|
|
|
47
41
|
export function addFitBleKey(params) {
|
|
48
42
|
return addFitBleKeyForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
49
43
|
}
|
|
50
|
-
export function
|
|
51
|
-
return
|
|
44
|
+
export function createFitPermanentBleKey(userId) {
|
|
45
|
+
return createFitPermanentBleKeyForRuntime(resolveRuntimeFromExportThis(this), userId);
|
|
46
|
+
}
|
|
47
|
+
export function createFitTemporaryBleKey(params) {
|
|
48
|
+
return createFitTemporaryBleKeyForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
49
|
+
}
|
|
50
|
+
export function updateFitTemporaryBleKey(params) {
|
|
51
|
+
return updateFitTemporaryBleKeyForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
52
52
|
}
|
|
53
53
|
export function removeFitBleKey(params) {
|
|
54
54
|
return removeFitBleKeyForRuntime(resolveRuntimeFromExportThis(this), params.id);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GetAlarmsParams } from "../../../feature/log/log";
|
|
2
|
+
import { type GetFitLogsParams } from "../../../feature/fit/log";
|
|
3
|
+
export type { GetFitLogsParams };
|
|
4
|
+
export declare function getActivePeriod(): Promise<number>;
|
|
5
|
+
export declare function getLogs(params?: GetFitLogsParams): Promise<import("../../../feature/log/log").GetLogsResult>;
|
|
6
|
+
export declare function getAlarms(params?: GetAlarmsParams): Promise<import("../../../feature/log/log").GetAlarmsResult>;
|
|
7
|
+
export declare function getAlarmUnreadCount(): Promise<number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getActivePeriodForRuntime, getAlarmsForRuntime, getAlarmUnreadCountForRuntime, } from "../../../feature/log/log";
|
|
3
|
+
import { getFitLogsForRuntime, } from "../../../feature/fit/log";
|
|
4
|
+
export async function getActivePeriod() {
|
|
5
|
+
return getActivePeriodForRuntime(resolveRuntimeFromExportThis(this));
|
|
6
|
+
}
|
|
7
|
+
export async function getLogs(params) {
|
|
8
|
+
return getFitLogsForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
9
|
+
}
|
|
10
|
+
export async function getAlarms(params) {
|
|
11
|
+
return getAlarmsForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
12
|
+
}
|
|
13
|
+
export async function getAlarmUnreadCount() {
|
|
14
|
+
return getAlarmUnreadCountForRuntime(resolveRuntimeFromExportThis(this));
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { connectDeviceForRuntime } from "../../../feature/misc/connect-device";
|
|
3
|
+
import { openSceneForRuntime } from "../../../feature/misc/open-scene";
|
|
4
|
+
export async function connectDevice(options) {
|
|
5
|
+
return connectDeviceForRuntime(resolveRuntimeFromExportThis(this), options?.timeout);
|
|
6
|
+
}
|
|
7
|
+
export async function openScene(options) {
|
|
8
|
+
return openSceneForRuntime(resolveRuntimeFromExportThis(this), options);
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getProductInstVideoForRuntime, getProductEBookForRuntime, } from "../../../feature/fit/product";
|
|
3
|
+
export function getProductInstVideo() {
|
|
4
|
+
return getProductInstVideoForRuntime(resolveRuntimeFromExportThis(this));
|
|
5
|
+
}
|
|
6
|
+
export function getProductEBook() {
|
|
7
|
+
return getProductEBookForRuntime(resolveRuntimeFromExportThis(this));
|
|
8
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DeviceStatus } from "../../../interface";
|
|
2
|
+
export declare function getDeviceStatus(): DeviceStatus;
|
|
3
|
+
export declare function onDeviceStatusChange(callback: (status: DeviceStatus) => void): void;
|
|
4
|
+
export declare function offDeviceStatusChange(callback: (status: DeviceStatus) => void): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getDeviceStatusForRuntime } from "../../../feature/state/device-status";
|
|
3
|
+
import { onDeviceStatusChangeForRuntime, offDeviceStatusChangeForRuntime, } from "../../../feature/state/device-status-events";
|
|
4
|
+
export function getDeviceStatus() {
|
|
5
|
+
return getDeviceStatusForRuntime(resolveRuntimeFromExportThis(this));
|
|
6
|
+
}
|
|
7
|
+
export function onDeviceStatusChange(callback) {
|
|
8
|
+
onDeviceStatusChangeForRuntime(resolveRuntimeFromExportThis(this), callback);
|
|
9
|
+
}
|
|
10
|
+
export function offDeviceStatusChange(callback) {
|
|
11
|
+
offDeviceStatusChangeForRuntime(resolveRuntimeFromExportThis(this), callback);
|
|
12
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FitOnlinePasswordItem, type FitOfflinePasswordItem } from "../../../feature/fit/password-list";
|
|
2
|
+
import { type AddFitTempPwdParams, type RemoveFitTempPwdParams, type RenameFitTempPwdParams, type RenameFitOfflineTempPwdParams, type RevokeFitOfflineTempPwdParams, type FitOfflineClearCodeResult, type ResendFitTempPwdParams, type UpdateFitTempPwdParams } from "../../../feature/fit/temp-password";
|
|
3
|
+
import { type ClearFitInvalidPwdParams, type GetFitInvalidPwdListParams } from "../../../feature/fit/invalid-password";
|
|
4
|
+
import { type FitOfflineOnceResult } from "../../../feature/password/temporary/offline-create";
|
|
5
|
+
import type { LimitOfflinePwdItem, OfflinePwdAvailableResult } from "../../../api/temp";
|
|
6
|
+
import type { TempPasswordResult } from "../../../interface";
|
|
2
7
|
export declare function getFitPasswordList(): Promise<{
|
|
3
8
|
id: number;
|
|
4
9
|
unlockId: string;
|
|
@@ -8,12 +13,28 @@ export declare function getFitPasswordList(): Promise<{
|
|
|
8
13
|
lockUserId: number;
|
|
9
14
|
userType: number;
|
|
10
15
|
devLockId: string;
|
|
11
|
-
effective: import("
|
|
16
|
+
effective: import("../../../interface").EffectiveConfig;
|
|
12
17
|
}[]>;
|
|
18
|
+
export declare function getFitOnlinePasswordList(): Promise<FitOnlinePasswordItem[]>;
|
|
19
|
+
export declare function getFitOfflinePasswordList(): Promise<FitOfflinePasswordItem[]>;
|
|
13
20
|
export declare function addFitTempPwd(params: AddFitTempPwdParams): Promise<{
|
|
14
21
|
pwdId: number;
|
|
15
22
|
}>;
|
|
16
23
|
export declare function removeFitTempPwd(params: RemoveFitTempPwdParams): Promise<void>;
|
|
17
24
|
export declare function updateFitTempPwd(params: UpdateFitTempPwdParams): Promise<void>;
|
|
18
25
|
export declare function renameFitTempPwd(params: RenameFitTempPwdParams): Promise<void>;
|
|
19
|
-
export
|
|
26
|
+
export declare function renameFitOfflineTempPwd(params: RenameFitOfflineTempPwdParams): Promise<void>;
|
|
27
|
+
export declare function revokeFitOfflineTempPwd(params: RevokeFitOfflineTempPwdParams): Promise<FitOfflineClearCodeResult>;
|
|
28
|
+
export declare function resendFitTempPwd(params: ResendFitTempPwdParams): Promise<boolean>;
|
|
29
|
+
export declare function getFitInvalidPwdList(params?: GetFitInvalidPwdListParams): Promise<import("../../../api/fit").FitInvalidPwdListResult>;
|
|
30
|
+
export declare function clearFitInvalidPwd(params?: ClearFitInvalidPwdParams): Promise<boolean>;
|
|
31
|
+
export declare function getFitDynamicPassword(): Promise<TempPasswordResult>;
|
|
32
|
+
export declare function getFitOfflineOncePassword(): Promise<FitOfflineOnceResult>;
|
|
33
|
+
export declare function getFitOfflineLimitPassword(params: {
|
|
34
|
+
effectiveTime: number;
|
|
35
|
+
invalidTime: number;
|
|
36
|
+
}): Promise<FitOfflineOnceResult>;
|
|
37
|
+
export declare function getFitOfflineClearAllCode(): Promise<FitOfflineOnceResult>;
|
|
38
|
+
export declare function getFitOfflineRevocableList(): Promise<LimitOfflinePwdItem[]>;
|
|
39
|
+
export declare function getFitOfflinePwdAvailable(pwdType: string): Promise<OfflinePwdAvailableResult>;
|
|
40
|
+
export type { AddFitTempPwdParams, RemoveFitTempPwdParams, UpdateFitTempPwdParams, RenameFitTempPwdParams, RenameFitOfflineTempPwdParams, RevokeFitOfflineTempPwdParams, FitOfflineClearCodeResult, ResendFitTempPwdParams, GetFitInvalidPwdListParams, ClearFitInvalidPwdParams, FitOnlinePasswordItem, FitOfflinePasswordItem, FitOfflineOnceResult, OfflinePwdAvailableResult, LimitOfflinePwdItem, };
|