@ray-js/lock-sdk 1.2.0-beta.8 → 1.2.0
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/gesture.d.ts +11 -0
- package/lib/api/gesture.js +18 -0
- package/lib/api/log.d.ts +52 -4
- package/lib/api/log.js +22 -0
- package/lib/api/temp.d.ts +21 -0
- package/lib/api/temp.js +24 -0
- package/lib/api/video.d.ts +4 -0
- package/lib/api/video.js +10 -0
- package/lib/config/dp-code/index.d.ts +1 -1
- package/lib/config/dp-code/index.js +1 -0
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
- package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
- package/lib/entries/main/bootstrap/bootstrap.js +10 -6
- package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
- package/lib/entries/main/bootstrap/primary-instance.js +1 -1
- package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
- package/lib/entries/main/build-instance.d.ts +6 -3
- package/lib/entries/main/build-instance.js +13 -1
- package/lib/entries/main/exports/capability.d.ts +2 -0
- package/lib/entries/main/exports/capability.js +7 -1
- package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
- package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
- package/lib/entries/main/exports/fit-sdk/log.js +5 -0
- package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
- package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
- package/lib/entries/main/exports/gesture.d.ts +6 -0
- package/lib/entries/main/exports/gesture.js +8 -0
- package/lib/entries/main/exports/index.d.ts +5 -0
- package/lib/entries/main/exports/index.js +5 -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/media.d.ts +3 -1
- package/lib/entries/main/exports/media.js +8 -2
- package/lib/entries/main/exports/misc.d.ts +4 -2
- package/lib/entries/main/exports/misc.js +2 -2
- package/lib/entries/main/index.d.ts +3 -3
- package/lib/entries/main/index.js +11 -5
- package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
- package/lib/feature/fit/bind-lock-to-fit.js +53 -0
- 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 +12 -2
- package/lib/feature/fit/list.js +54 -5
- package/lib/feature/fit/log.d.ts +7 -0
- package/lib/feature/fit/log.js +123 -0
- package/lib/feature/fit/method/add-flow.js +2 -2
- package/lib/feature/fit/method/add-password.js +2 -2
- 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/security-channel.d.ts +3 -0
- package/lib/feature/fit/security-channel.js +43 -0
- package/lib/feature/fit/shared.d.ts +8 -0
- package/lib/feature/fit/shared.js +40 -1
- package/lib/feature/fit/sync.d.ts +4 -2
- package/lib/feature/fit/sync.js +63 -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/gesture/gesture.d.ts +6 -0
- package/lib/feature/gesture/gesture.js +3 -0
- package/lib/feature/log/log.d.ts +5 -1
- package/lib/feature/log/log.js +53 -6
- package/lib/feature/media/camera.d.ts +12 -2
- package/lib/feature/media/camera.js +3 -0
- package/lib/feature/media/media.d.ts +2 -1
- package/lib/feature/media/media.js +4 -1
- package/lib/feature/misc/ble-control.js +2 -2
- package/lib/feature/misc/capability.d.ts +2 -0
- package/lib/feature/misc/capability.js +33 -31
- package/lib/feature/misc/connect-device.d.ts +1 -1
- package/lib/feature/misc/connect-device.js +7 -6
- package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
- package/lib/feature/password/temporary/offline-create.d.ts +14 -0
- package/lib/feature/password/temporary/offline-create.js +77 -1
- package/lib/feature/service/goto-service.d.ts +1 -1
- package/lib/feature/state/clear.js +1 -0
- package/lib/feature/state/device-status.js +17 -6
- package/lib/feature/state/init-state.js +18 -10
- package/lib/feature/state/platform-routing.js +12 -3
- package/lib/feature/state/remote-permissions.js +17 -0
- package/lib/feature/state/sync/remote-serect-key.js +7 -0
- package/lib/feature/storage/swr-cache.d.ts +7 -0
- package/lib/feature/storage/swr-cache.js +54 -0
- package/lib/feature/unlock/method/add-flow.js +2 -2
- package/lib/feature/unlock/method/add-password.js +2 -2
- package/lib/feature/user/sync-user.js +4 -2
- package/lib/feature/utils/index.d.ts +1 -0
- package/lib/feature/utils/index.js +1 -0
- package/lib/interface.d.ts +29 -0
- package/lib/platform/device.d.ts +4 -3
- package/lib/platform/ipc.d.ts +3 -0
- package/lib/platform/ipc.js +13 -0
- package/lib/platform/storage.d.ts +1 -1
- package/lib/runtime/LockDeviceRuntime.js +3 -0
- package/lib/runtime/lock-config.d.ts +5 -1
- package/lib/runtime/lock-config.js +6 -0
- package/lib/runtime/runtime-state-types.d.ts +6 -0
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +6 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +1 -0
- package/package.json +1 -11
- package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
- package/lib/bootstrap/bootstrap.d.ts +0 -4
- package/lib/bootstrap/bootstrap.js +0 -53
- package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/bootstrap/primary-instance.d.ts +0 -6
- package/lib/bootstrap/primary-instance.js +0 -24
- package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/build-instance.d.ts +0 -9
- package/lib/entries/ble/build-instance.js +0 -50
- package/lib/entries/ble/exports/capability.d.ts +0 -6
- package/lib/entries/ble/exports/capability.js +0 -17
- package/lib/entries/ble/exports/config.d.ts +0 -3
- package/lib/entries/ble/exports/config.js +0 -5
- package/lib/entries/ble/exports/dp.d.ts +0 -9
- package/lib/entries/ble/exports/dp.js +0 -13
- package/lib/entries/ble/exports/index.d.ts +0 -16
- package/lib/entries/ble/exports/index.js +0 -16
- package/lib/entries/ble/exports/linkage.d.ts +0 -5
- package/lib/entries/ble/exports/linkage.js +0 -15
- package/lib/entries/ble/exports/log.d.ts +0 -9
- package/lib/entries/ble/exports/log.js +0 -21
- package/lib/entries/ble/exports/media.d.ts +0 -4
- package/lib/entries/ble/exports/media.js +0 -12
- package/lib/entries/ble/exports/misc.d.ts +0 -19
- package/lib/entries/ble/exports/misc.js +0 -30
- package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
- package/lib/entries/ble/exports/offline-dps.js +0 -24
- package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
- package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
- package/lib/entries/ble/exports/open/index.d.ts +0 -18
- package/lib/entries/ble/exports/open/index.js +0 -45
- package/lib/entries/ble/exports/signal.d.ts +0 -6
- package/lib/entries/ble/exports/signal.js +0 -14
- package/lib/entries/ble/exports/sleep.d.ts +0 -13
- package/lib/entries/ble/exports/sleep.js +0 -31
- package/lib/entries/ble/exports/state.d.ts +0 -6
- package/lib/entries/ble/exports/state.js +0 -19
- package/lib/entries/ble/exports/temporary.d.ts +0 -31
- package/lib/entries/ble/exports/temporary.js +0 -91
- package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
- package/lib/entries/ble/exports/unlock/sync.js +0 -5
- package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
- package/lib/entries/ble/exports/unlock-method.js +0 -58
- package/lib/entries/ble/exports/user/index.d.ts +0 -23
- package/lib/entries/ble/exports/user/index.js +0 -22
- package/lib/entries/ble/exports/user/sync.d.ts +0 -1
- package/lib/entries/ble/exports/user/sync.js +0 -5
- package/lib/entries/ble/index.d.ts +0 -8
- package/lib/entries/ble/index.js +0 -39
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/fit/build-instance.d.ts +0 -9
- package/lib/entries/fit/build-instance.js +0 -57
- package/lib/entries/fit/exports/binding.d.ts +0 -8
- package/lib/entries/fit/exports/temp.d.ts +0 -19
- package/lib/entries/fit/exports/temp.js +0 -18
- package/lib/entries/fit/index.d.ts +0 -8
- package/lib/entries/fit/index.js +0 -36
- package/lib/entries/main/exports/open.d.ts +0 -16
- package/lib/entries/main/exports/open.js +0 -44
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/screen/build-instance.d.ts +0 -9
- package/lib/entries/screen/build-instance.js +0 -57
- package/lib/entries/screen/exports/bind-events.d.ts +0 -4
- package/lib/entries/screen/exports/bind-events.js +0 -8
- package/lib/entries/screen/exports/binding.d.ts +0 -6
- package/lib/entries/screen/exports/binding.js +0 -15
- package/lib/entries/screen/exports/device.d.ts +0 -16
- package/lib/entries/screen/exports/device.js +0 -41
- package/lib/entries/screen/exports/event.d.ts +0 -3
- package/lib/entries/screen/exports/event.js +0 -5
- package/lib/entries/screen/exports/index.d.ts +0 -5
- package/lib/entries/screen/exports/index.js +0 -5
- package/lib/entries/screen/exports/user.d.ts +0 -2
- package/lib/entries/screen/exports/user.js +0 -8
- package/lib/entries/screen/index.d.ts +0 -8
- package/lib/entries/screen/index.js +0 -36
- package/lib/feature/unlock/door/door-action.d.ts +0 -2
- package/lib/feature/unlock/door/door-action.js +0 -32
- package/lib/fit.d.ts +0 -4
- package/lib/fit.js +0 -3
- package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
- package/lib/runtime/device-status/compute-device-status.js +0 -94
- package/lib/screen.d.ts +0 -4
- package/lib/screen.js +0 -3
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
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface GestureStatus {
|
|
2
|
+
status: boolean;
|
|
3
|
+
password: string;
|
|
4
|
+
[k: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export declare const getGestureStatusApi: (devId: string) => Promise<GestureStatus>;
|
|
7
|
+
export declare const setGestureStatusApi: (params: {
|
|
8
|
+
devId: string;
|
|
9
|
+
password: string;
|
|
10
|
+
open: boolean;
|
|
11
|
+
}) => Promise<boolean>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { THING } from "../utils/constant";
|
|
2
|
+
import { requestApi } from "./request";
|
|
3
|
+
export const getGestureStatusApi = (devId) => {
|
|
4
|
+
return requestApi({
|
|
5
|
+
logName: "getGestureStatus",
|
|
6
|
+
api: `${THING}.m.device.lock.gesturepwd.check`,
|
|
7
|
+
version: "1.0",
|
|
8
|
+
data: { devId },
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
export const setGestureStatusApi = (params) => {
|
|
12
|
+
return requestApi({
|
|
13
|
+
logName: "setGestureStatus",
|
|
14
|
+
api: `${THING}.m.device.lock.gesturepwd.set`,
|
|
15
|
+
version: "1.0",
|
|
16
|
+
data: params,
|
|
17
|
+
});
|
|
18
|
+
};
|
package/lib/api/log.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import { DpValue, LocalOperateRecordInfo
|
|
1
|
+
import { DpValue, LocalOperateRecordInfo } from "../interface";
|
|
2
|
+
interface MediaInfoRecord {
|
|
3
|
+
mediaPath: string;
|
|
4
|
+
fileKey: string;
|
|
5
|
+
fileUrl: string;
|
|
6
|
+
mediaBucket: string;
|
|
7
|
+
mediaKey: string;
|
|
8
|
+
positionWidth: number;
|
|
9
|
+
positionHeight: number;
|
|
10
|
+
positionAngle: number;
|
|
11
|
+
positionVr: 0 | 1;
|
|
12
|
+
position: number;
|
|
13
|
+
}
|
|
2
14
|
interface UnionUnlockInfo {
|
|
3
15
|
userId: string;
|
|
4
16
|
userName: string;
|
|
@@ -37,7 +49,7 @@ interface LogInfo {
|
|
|
37
49
|
dps: Record<number, any>[];
|
|
38
50
|
gmtCreate: number;
|
|
39
51
|
historyId: number;
|
|
40
|
-
mediaInfoList?:
|
|
52
|
+
mediaInfoList?: MediaInfoRecord[];
|
|
41
53
|
memberBindableFlag: 0 | 1;
|
|
42
54
|
recordId: string;
|
|
43
55
|
recordType: string;
|
|
@@ -62,6 +74,35 @@ export interface LogsResult {
|
|
|
62
74
|
totalCount: number;
|
|
63
75
|
}
|
|
64
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>;
|
|
65
106
|
export interface LockLogListItem {
|
|
66
107
|
logId: string;
|
|
67
108
|
logCategory: LockLogCategory;
|
|
@@ -77,7 +118,7 @@ export interface LockLogListItem {
|
|
|
77
118
|
relateDevName?: string;
|
|
78
119
|
relateOpMode?: string;
|
|
79
120
|
unionUnlockInfo?: UnionUnlockInfo[];
|
|
80
|
-
mediaInfoList?:
|
|
121
|
+
mediaInfoList?: MediaInfoRecord[];
|
|
81
122
|
localOperateRecordInfo?: LocalOperateRecordInfo;
|
|
82
123
|
data?: boolean | number | string;
|
|
83
124
|
dpId: number;
|
|
@@ -115,7 +156,7 @@ interface AlarmData {
|
|
|
115
156
|
unlockName: string;
|
|
116
157
|
userId: string;
|
|
117
158
|
userName: string;
|
|
118
|
-
mediaInfoList?:
|
|
159
|
+
mediaInfoList?: MediaInfoRecord[];
|
|
119
160
|
}
|
|
120
161
|
interface GetAlarmListResult {
|
|
121
162
|
datas: AlarmData[];
|
|
@@ -123,6 +164,8 @@ interface GetAlarmListResult {
|
|
|
123
164
|
totalCount: number;
|
|
124
165
|
}
|
|
125
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>;
|
|
126
169
|
interface GetAlbumMessagesParams {
|
|
127
170
|
devId: string;
|
|
128
171
|
limit: number;
|
|
@@ -151,6 +194,11 @@ interface AlbumItem {
|
|
|
151
194
|
fileUrl: string;
|
|
152
195
|
mediaBucket: string;
|
|
153
196
|
mediaKey: string;
|
|
197
|
+
width: number;
|
|
198
|
+
height: number;
|
|
199
|
+
angle: number;
|
|
200
|
+
position: number;
|
|
201
|
+
vr: 0 | 1;
|
|
154
202
|
}
|
|
155
203
|
export declare const getAlbumMessages: (params: GetAlbumMessagesParams) => Promise<{
|
|
156
204
|
hasNext: boolean;
|
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",
|
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",
|
package/lib/api/video.d.ts
CHANGED
|
@@ -33,4 +33,8 @@ export interface MediaViewTimesResult {
|
|
|
33
33
|
}
|
|
34
34
|
export declare const getMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
|
|
35
35
|
export declare const setMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
|
|
36
|
+
export interface getAlbumDateListResult {
|
|
37
|
+
dateList: string[];
|
|
38
|
+
}
|
|
39
|
+
export declare const getAlbumDateList: (devId: string) => Promise<getAlbumDateListResult>;
|
|
36
40
|
export {};
|
package/lib/api/video.js
CHANGED
|
@@ -50,3 +50,13 @@ export const setMediaViewTimes = (devId) => {
|
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
|
+
export const getAlbumDateList = (devId) => {
|
|
54
|
+
return requestApi({
|
|
55
|
+
logName: "getAlbumDateList",
|
|
56
|
+
api: "m.lock.album.media.date.list",
|
|
57
|
+
version: "1.0",
|
|
58
|
+
data: {
|
|
59
|
+
devId,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
};
|
|
@@ -100,5 +100,5 @@ declare const dpCodes: {
|
|
|
100
100
|
readonly blePswUpdate: "ble_password_update";
|
|
101
101
|
};
|
|
102
102
|
export type DpCodeValue = (typeof dpCodes)[keyof typeof dpCodes];
|
|
103
|
-
export declare const latLogDpCodes: ("unlock_password" | "unlock_fingerprint" | "unlock_finger_vein" | "unlock_hand" | "unlock_dynamic" | "unlock_key" | "unlock_card" | "unlock_face" | "unlock_temporary" | "unlock_offline_pd" | "unlock_offline_clear" | "unlock_offline_clear_single" | "unlock_phone_remote" | "unlock_voice_remote" | "lock_record" | "unlock_ble" | "unlock_eye" | "unlock_double_kit" | "unlock_double_kit_w" | "alarm_lock" | "doorbell" | "hijack" | "family_call")[];
|
|
103
|
+
export declare const latLogDpCodes: ("unlock_matter_kw" | "unlock_password" | "unlock_fingerprint" | "unlock_finger_vein" | "unlock_hand" | "unlock_dynamic" | "unlock_key" | "unlock_card" | "unlock_face" | "unlock_temporary" | "unlock_offline_pd" | "unlock_offline_clear" | "unlock_offline_clear_single" | "unlock_phone_remote" | "unlock_voice_remote" | "lock_record" | "unlock_ble" | "unlock_eye" | "unlock_double_kit" | "unlock_double_kit_w" | "alarm_lock" | "doorbell" | "hijack" | "family_call")[];
|
|
104
104
|
export default dpCodes;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { LockSDKOption } from "../../../interface";
|
|
2
2
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
3
3
|
import { type LockSDKInstance } from "../build-instance";
|
|
4
|
-
|
|
4
|
+
import { type SDKKind } from "./bootstrap";
|
|
5
|
+
export declare function bootstrapRegisteredInstance(kind: SDKKind, options?: LockSDKOption): Promise<{
|
|
5
6
|
runtime: LockDeviceRuntime;
|
|
6
7
|
instance: LockSDKInstance;
|
|
7
8
|
}>;
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import { addEvents } from "../../../feature/state/platform-routing";
|
|
1
|
+
import { addEvents, removeEvents, } from "../../../feature/state/platform-routing";
|
|
2
2
|
import { initState } from "../../../feature/state/init-state";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { clearStateForRuntime } from "../../../feature/state/clear";
|
|
4
|
+
import { registerRuntime, unregisterRuntime, getRegisteredRuntimeCount, } from "../../../runtime/registry";
|
|
5
|
+
import { buildSDKInstance } from "../build-instance";
|
|
5
6
|
import { createBootstrappedRuntime } from "./bootstrap";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
import { startFitSyncReportForRuntime } from "../../../feature/fit/sync";
|
|
8
|
+
export async function bootstrapRegisteredInstance(kind, options) {
|
|
9
|
+
const runtime = await createBootstrappedRuntime(kind, options);
|
|
8
10
|
registerRuntime(runtime);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
try {
|
|
12
|
+
addEvents(runtime);
|
|
13
|
+
await initState(runtime);
|
|
14
|
+
if (kind === "fit") {
|
|
15
|
+
startFitSyncReportForRuntime(runtime);
|
|
16
|
+
}
|
|
17
|
+
return { runtime, instance: buildSDKInstance(runtime) };
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
unregisterRuntime(runtime.devId);
|
|
21
|
+
clearStateForRuntime(runtime);
|
|
22
|
+
if (getRegisteredRuntimeCount() === 0) {
|
|
23
|
+
removeEvents();
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
12
27
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LockSDKOption } from "../../../interface";
|
|
2
2
|
import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
3
|
-
export
|
|
4
|
-
export declare function
|
|
3
|
+
export type SDKKind = "lock" | "fit" | "screen";
|
|
4
|
+
export declare function applyOptionsToRuntime(runtime: LockDeviceRuntime, kind: SDKKind, options?: LockSDKOption): Promise<void>;
|
|
5
|
+
export declare function createBootstrappedRuntime(kind: SDKKind, options?: LockSDKOption): Promise<LockDeviceRuntime>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import dpCodes from "../../../config/dp-code";
|
|
2
2
|
import { getCapabilities } from "../../../utils";
|
|
3
|
-
import { getDeviceInfo, trackEvent
|
|
3
|
+
import { getDeviceInfo, trackEvent } from "../../../platform/device";
|
|
4
4
|
import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
5
5
|
import { sdkLog, setSDKLogConfig } from "../../../utils/sdk-log";
|
|
6
|
-
export async function
|
|
6
|
+
export async function applyOptionsToRuntime(runtime, kind, options) {
|
|
7
|
+
const isFit = kind === "fit";
|
|
7
8
|
setSDKLogConfig({
|
|
8
9
|
level: options?.logLevel ?? "warn",
|
|
9
10
|
sink: options?.logger,
|
|
@@ -12,7 +13,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
12
13
|
const { config } = runtime;
|
|
13
14
|
let { devInfo, deviceId } = options || {};
|
|
14
15
|
if (!devInfo && !deviceId) {
|
|
15
|
-
throw new Error(
|
|
16
|
+
throw new Error(`deviceId is required in ${isFit ? "fit" : "lock"} sdk`);
|
|
16
17
|
}
|
|
17
18
|
if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
|
|
18
19
|
devInfo = await getDeviceInfo(deviceId);
|
|
@@ -36,6 +37,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
36
37
|
idsByCode[item.code] = item.id;
|
|
37
38
|
});
|
|
38
39
|
}
|
|
40
|
+
config.isFitting = isFit;
|
|
39
41
|
config.strictMode = options?.strictMode ?? true;
|
|
40
42
|
config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
|
|
41
43
|
config.passwordSupportZero = options?.passwordSupportZero ?? true;
|
|
@@ -47,8 +49,10 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
47
49
|
config.idsByCode = idsByCode;
|
|
48
50
|
config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
|
|
49
51
|
config.preFetch = options?.preFetch ?? false;
|
|
52
|
+
config.localCache = options?.localCache ?? true;
|
|
53
|
+
config.notSupportWake = options?.notSupportWake ?? false;
|
|
50
54
|
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
51
|
-
sdkLog("info", "bootstrap", "applyOptions", {
|
|
55
|
+
sdkLog("info", isFit ? "fit-bootstrap" : "bootstrap", "applyOptions", {
|
|
52
56
|
devId: config.devInfo.devId,
|
|
53
57
|
data: {
|
|
54
58
|
productId: config.devInfo.productId,
|
|
@@ -62,8 +66,8 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
62
66
|
pid: devInfo.productId,
|
|
63
67
|
});
|
|
64
68
|
}
|
|
65
|
-
export async function createBootstrappedRuntime(options) {
|
|
69
|
+
export async function createBootstrappedRuntime(kind, options) {
|
|
66
70
|
const runtime = new LockDeviceRuntime();
|
|
67
|
-
await
|
|
71
|
+
await applyOptionsToRuntime(runtime, kind, options);
|
|
68
72
|
return runtime;
|
|
69
73
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
|
-
|
|
3
|
-
export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
|
|
2
|
+
export declare function setPrimaryLockSDKInstance(instance: object): void;
|
|
4
3
|
export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
|
|
5
4
|
export declare function clearPrimaryLockSDKInstance(): void;
|
|
6
5
|
export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
|
|
@@ -4,7 +4,7 @@ let primaryRuntime = null;
|
|
|
4
4
|
export function setPrimaryLockSDKInstance(instance) {
|
|
5
5
|
const runtime = getRuntimeForLockSDKInstance(instance);
|
|
6
6
|
if (!runtime) {
|
|
7
|
-
throw new Error("setPrimaryLockSDKInstance: instance must be returned by
|
|
7
|
+
throw new Error("setPrimaryLockSDKInstance: instance must be returned by createSDK or init");
|
|
8
8
|
}
|
|
9
9
|
primaryDevId = runtime.devId;
|
|
10
10
|
primaryRuntime = runtime;
|
|
@@ -21,7 +21,7 @@ export function resolveRuntimeFromExportThis(thisArg) {
|
|
|
21
21
|
}
|
|
22
22
|
const rt = getRuntimeByDevId(devId);
|
|
23
23
|
if (!rt) {
|
|
24
|
-
throw new Error(`Lock SDK: no registered runtime for devId "${devId}"; use
|
|
24
|
+
throw new Error(`Lock SDK: no registered runtime for devId "${devId}"; use createSDK or init first`);
|
|
25
25
|
}
|
|
26
26
|
return rt;
|
|
27
27
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
import { type UpdateConfigParams } from "../../feature/misc/update-config";
|
|
2
3
|
import * as DeviceExports from "./exports";
|
|
3
|
-
export
|
|
4
|
+
export type LockSDKInstance = {
|
|
4
5
|
destroy(): void;
|
|
5
|
-
|
|
6
|
+
updateConfig(options: UpdateConfigParams): void;
|
|
7
|
+
} & Omit<typeof DeviceExports, "updateConfig">;
|
|
8
|
+
export type FitSDKInstance = LockSDKInstance;
|
|
6
9
|
export declare function getFlatInstanceMethodKeysForTests(): string[];
|
|
7
|
-
export declare function
|
|
10
|
+
export declare function buildSDKInstance(runtime: LockDeviceRuntime): LockSDKInstance;
|
|
@@ -4,6 +4,8 @@ import { unregisterRuntime, getRegisteredRuntimeCount, } from "../../runtime/reg
|
|
|
4
4
|
import { clearStateForRuntime } from "../../feature/state/clear";
|
|
5
5
|
import { removeEvents } from "../../feature/state/platform-routing";
|
|
6
6
|
import { sdkLog } from "../../utils/sdk-log";
|
|
7
|
+
import { stopFitSyncReportForRuntime } from "../../feature/fit/sync";
|
|
8
|
+
import { updateConfigForRuntime, } from "../../feature/misc/update-config";
|
|
7
9
|
import * as DeviceExports from "./exports";
|
|
8
10
|
const RESERVED_INSTANCE_METHOD_KEYS = new Set(["destroy", "updateConfig"]);
|
|
9
11
|
let cachedFlatExportKeys = null;
|
|
@@ -20,17 +22,27 @@ function collectFlatInstanceExportKeys() {
|
|
|
20
22
|
export function getFlatInstanceMethodKeysForTests() {
|
|
21
23
|
return collectFlatInstanceExportKeys();
|
|
22
24
|
}
|
|
23
|
-
export function
|
|
25
|
+
export function buildSDKInstance(runtime) {
|
|
24
26
|
const instance = {
|
|
25
27
|
destroy() {
|
|
26
28
|
sdkLog("info", "lifecycle", "destroy", { devId: runtime.devId });
|
|
27
29
|
unregisterRuntime(runtime.devId);
|
|
28
30
|
clearPrimaryLockSDKInstanceIfDevId(runtime.devId);
|
|
31
|
+
if (runtime.config.isFitting) {
|
|
32
|
+
stopFitSyncReportForRuntime(runtime);
|
|
33
|
+
}
|
|
29
34
|
clearStateForRuntime(runtime);
|
|
30
35
|
if (getRegisteredRuntimeCount() === 0) {
|
|
31
36
|
removeEvents();
|
|
32
37
|
}
|
|
33
38
|
},
|
|
39
|
+
updateConfig(options) {
|
|
40
|
+
sdkLog("info", "lifecycle", "updateConfig", {
|
|
41
|
+
devId: runtime.devId,
|
|
42
|
+
data: { keys: Object.keys(options) },
|
|
43
|
+
});
|
|
44
|
+
updateConfigForRuntime(runtime, options);
|
|
45
|
+
},
|
|
34
46
|
};
|
|
35
47
|
registerLockSDKInstanceRuntime(instance, runtime);
|
|
36
48
|
sdkLog("info", "lifecycle", "createInstance", { devId: runtime.devId });
|
|
@@ -4,3 +4,5 @@ export declare function isBlePureDevice(): boolean;
|
|
|
4
4
|
export declare function isShareThead(): boolean;
|
|
5
5
|
export declare function isActiveThread(): Promise<boolean>;
|
|
6
6
|
export declare function getDeviceAdvancedAbilities(): Promise<import("../../..").DeviceAdvancedAbility>;
|
|
7
|
+
export declare function getDeviceAdvancedAbilitiesSync(): import("../../..").DeviceAdvancedAbility | undefined;
|
|
8
|
+
export declare function getDeviceCapabilities(): import("../../..").CapabilityInfo | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
-
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime, isShareTheadForRuntime, isActiveThreadForRuntime, getDeviceAdvancedAbilitiesForRuntime, } from "../../../feature/misc/capability";
|
|
2
|
+
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime, isShareTheadForRuntime, isActiveThreadForRuntime, getDeviceAdvancedAbilitiesForRuntime, getDeviceAdvancedAbilitiesSyncForRuntime, getDeviceCapabilitiesForRuntime, } from "../../../feature/misc/capability";
|
|
3
3
|
export function hasCapability(capability) {
|
|
4
4
|
return hasCapabilityForRuntime(resolveRuntimeFromExportThis(this), capability);
|
|
5
5
|
}
|
|
@@ -15,3 +15,9 @@ export async function isActiveThread() {
|
|
|
15
15
|
export async function getDeviceAdvancedAbilities() {
|
|
16
16
|
return getDeviceAdvancedAbilitiesForRuntime(resolveRuntimeFromExportThis(this));
|
|
17
17
|
}
|
|
18
|
+
export function getDeviceAdvancedAbilitiesSync() {
|
|
19
|
+
return getDeviceAdvancedAbilitiesSyncForRuntime(resolveRuntimeFromExportThis(this));
|
|
20
|
+
}
|
|
21
|
+
export function getDeviceCapabilities() {
|
|
22
|
+
return getDeviceCapabilitiesForRuntime(resolveRuntimeFromExportThis(this));
|
|
23
|
+
}
|