@ray-js/lock-sdk 1.2.1-beta.1 → 1.2.1-beta.3
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/gesture.d.ts +4 -2
- package/lib/entries/main/exports/fit-sdk/temp.d.ts +4 -19
- package/lib/entries/main/exports/gesture.d.ts +3 -5
- package/lib/entries/main/exports/misc.d.ts +2 -4
- package/lib/entries/main/exports/notify.d.ts +2 -5
- package/lib/entries/main/exports/offline-dps.d.ts +0 -1
- package/lib/entries/main/exports/offline-dps.js +1 -4
- package/lib/entries/main/exports/temporary.d.ts +2 -11
- package/lib/feature/fit/password-list.d.ts +3 -13
- package/lib/feature/fit/temp-password.d.ts +3 -2
- package/lib/feature/misc/types.d.ts +3 -0
- package/lib/feature/password/temporary/lists.d.ts +3 -2
- package/lib/feature/password/temporary/offline-create.d.ts +3 -2
- package/lib/feature/password/temporary/wifi-online.d.ts +3 -2
- package/lib/feature/state/init-state.js +4 -1
- package/lib/feature/unlock/method/add-flow.js +2 -2
- package/lib/feature/unlock/method/add-password.js +2 -2
- package/package.json +1 -1
package/lib/api/gesture.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export interface GestureStatus {
|
|
|
4
4
|
[k: string]: any;
|
|
5
5
|
}
|
|
6
6
|
export declare const getGestureStatusApi: (devId: string) => Promise<GestureStatus>;
|
|
7
|
-
export
|
|
8
|
-
devId: string;
|
|
7
|
+
export interface UpdateGestureStatusParams {
|
|
9
8
|
password: string;
|
|
10
9
|
open: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const setGestureStatusApi: (params: UpdateGestureStatusParams & {
|
|
12
|
+
devId: string;
|
|
11
13
|
}) => Promise<boolean>;
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { type FitOnlinePasswordItem, type FitOfflinePasswordItem } from "../../../../feature/fit/password-list";
|
|
2
2
|
import { type AddFitTempPwdParams, type RemoveFitTempPwdParams, type RenameFitTempPwdParams, type RenameFitOfflineTempPwdParams, type RevokeFitOfflineTempPwdParams, type FitOfflineClearCodeResult, type ResendFitTempPwdParams, type UpdateFitTempPwdParams } from "../../../../feature/fit/temp-password";
|
|
3
3
|
import { type ClearFitInvalidPwdParams, type GetFitInvalidPwdListParams } from "../../../../feature/fit/invalid-password";
|
|
4
|
-
import { type FitOfflineOnceResult } from "../../../../feature/password/temporary/offline-create";
|
|
4
|
+
import { type FitOfflineOnceResult, type FitOfflineLimitParams } from "../../../../feature/password/temporary/offline-create";
|
|
5
5
|
import type { LimitOfflinePwdItem, OfflinePwdAvailableResult } from "../../../../api/temp";
|
|
6
6
|
import type { TempPasswordResult } from "../../../../interface";
|
|
7
|
-
export declare function getFitPasswordList(): Promise<
|
|
8
|
-
id: number;
|
|
9
|
-
unlockId: string;
|
|
10
|
-
unlockName: string;
|
|
11
|
-
photoUnlock: boolean;
|
|
12
|
-
userName: string;
|
|
13
|
-
lockUserId: number;
|
|
14
|
-
userType: number;
|
|
15
|
-
devLockId: string;
|
|
16
|
-
effective: import("../../../../interface").EffectiveConfig;
|
|
17
|
-
}[]>;
|
|
7
|
+
export declare function getFitPasswordList(): Promise<import("../../../../feature/fit/password-list").FitPasswordItem[]>;
|
|
18
8
|
export declare function getFitOnlinePasswordList(): Promise<FitOnlinePasswordItem[]>;
|
|
19
9
|
export declare function getFitOfflinePasswordList(): Promise<FitOfflinePasswordItem[]>;
|
|
20
|
-
export declare function addFitTempPwd(params: AddFitTempPwdParams): Promise<
|
|
21
|
-
pwdId: number;
|
|
22
|
-
}>;
|
|
10
|
+
export declare function addFitTempPwd(params: AddFitTempPwdParams): Promise<import("../../../../feature/fit/temp-password").AddFitTempPwdResult>;
|
|
23
11
|
export declare function removeFitTempPwd(params: RemoveFitTempPwdParams): Promise<void>;
|
|
24
12
|
export declare function updateFitTempPwd(params: UpdateFitTempPwdParams): Promise<void>;
|
|
25
13
|
export declare function renameFitTempPwd(params: RenameFitTempPwdParams): Promise<void>;
|
|
@@ -30,10 +18,7 @@ export declare function getFitInvalidPwdList(params?: GetFitInvalidPwdListParams
|
|
|
30
18
|
export declare function clearFitInvalidPwd(params?: ClearFitInvalidPwdParams): Promise<boolean>;
|
|
31
19
|
export declare function getFitDynamicPassword(): Promise<TempPasswordResult>;
|
|
32
20
|
export declare function getFitOfflineOncePassword(): Promise<FitOfflineOnceResult>;
|
|
33
|
-
export declare function getFitOfflineLimitPassword(params:
|
|
34
|
-
effectiveTime: number;
|
|
35
|
-
invalidTime: number;
|
|
36
|
-
}): Promise<FitOfflineOnceResult>;
|
|
21
|
+
export declare function getFitOfflineLimitPassword(params: FitOfflineLimitParams): Promise<FitOfflineOnceResult>;
|
|
37
22
|
export declare function getFitOfflineClearAllCode(): Promise<FitOfflineOnceResult>;
|
|
38
23
|
export declare function getFitOfflineRevocableList(): Promise<LimitOfflinePwdItem[]>;
|
|
39
24
|
export declare function getFitOfflinePwdAvailable(pwdType: string): Promise<OfflinePwdAvailableResult>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { UpdateGestureStatusParams } from "../../../api/gesture";
|
|
2
|
+
export type { GestureStatus, UpdateGestureStatusParams, } from "../../../api/gesture";
|
|
2
3
|
export declare function getGestureStatus(): Promise<import("../../../api/gesture").GestureStatus>;
|
|
3
|
-
export declare function updateGestureStatus(params:
|
|
4
|
-
password: string;
|
|
5
|
-
open: boolean;
|
|
6
|
-
}): Promise<boolean>;
|
|
4
|
+
export declare function updateGestureStatus(params: UpdateGestureStatusParams): Promise<boolean>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GotoServiceParams } from "../../../feature/service/goto-service";
|
|
2
|
-
import type { OpenSceneOptions } from "../../../feature/misc/types";
|
|
2
|
+
import type { OpenSceneOptions, ConnectDeviceOptions } from "../../../feature/misc/types";
|
|
3
3
|
export { parseDpPeriodTime } from "../../../feature/misc/dp-period";
|
|
4
4
|
export { formatDpPeriodTime } from "../../../feature/misc/dp-period";
|
|
5
5
|
export declare function openScene(options?: OpenSceneOptions): Promise<void>;
|
|
@@ -13,8 +13,6 @@ export interface UpdateDpPeriodTimeOption {
|
|
|
13
13
|
offlineDp?: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function updateDpPeriodTime(dpCode: string, data: UpdateDpPeriodTimeParams, option?: UpdateDpPeriodTimeOption): Promise<void>;
|
|
16
|
-
export declare function connectDevice(options?:
|
|
17
|
-
timeout?: number;
|
|
18
|
-
}): Promise<true>;
|
|
16
|
+
export declare function connectDevice(options?: ConnectDeviceOptions): Promise<true>;
|
|
19
17
|
export declare function gotoService(params?: GotoServiceParams): Promise<void>;
|
|
20
18
|
export declare function validatePwdComplexity(password: string): Promise<boolean>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
+
import type { UpdateVasNotifyConfigParams } from "../../../api/notify";
|
|
1
2
|
export type { VasNotifyConfig, VasNotifyScene, VasNotifyPushConfig, UpdateVasNotifyConfigParams, } from "../../../api/notify";
|
|
2
3
|
export declare function getVasNotifyConfig(): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
3
|
-
export declare function updateVasNotifyConfig(params:
|
|
4
|
-
key: string;
|
|
5
|
-
enable: boolean;
|
|
6
|
-
userId?: string;
|
|
7
|
-
}): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
4
|
+
export declare function updateVasNotifyConfig(params: UpdateVasNotifyConfigParams): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
@@ -4,5 +4,4 @@ export declare function offOfflineDpsUpdate(callback: (dps: OfflineDps) => void)
|
|
|
4
4
|
export declare function publishOfflineDps(dps: Record<string, DpValue>): Promise<void>;
|
|
5
5
|
export declare function getOfflineDps(isForce?: boolean): Promise<OfflineDps>;
|
|
6
6
|
export declare function getOfflineDpCache(code: string): import("../../../interface").OfflineDpInfo | undefined;
|
|
7
|
-
export declare function checkOfflineDpUpdate(dps: Record<string, DpValue>, isForce?: boolean): Promise<void>;
|
|
8
7
|
export declare function isOfflineDpSyncing(code: string): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
-
import {
|
|
2
|
+
import { publishOfflineDpsForRuntime, getOfflineDpsForRuntime, getOfflineDpCacheForRuntime, onOfflineDpsUpdateForRuntime, offOfflineDpsUpdateForRuntime, } from "../../../feature/offline-dps";
|
|
3
3
|
export function onOfflineDpsUpdate(callback) {
|
|
4
4
|
onOfflineDpsUpdateForRuntime(resolveRuntimeFromExportThis(this), callback);
|
|
5
5
|
}
|
|
@@ -15,9 +15,6 @@ export async function getOfflineDps(isForce) {
|
|
|
15
15
|
export function getOfflineDpCache(code) {
|
|
16
16
|
return getOfflineDpCacheForRuntime(resolveRuntimeFromExportThis(this), code);
|
|
17
17
|
}
|
|
18
|
-
export async function checkOfflineDpUpdate(dps, isForce) {
|
|
19
|
-
return checkOfflineDpUpdateForRuntime(resolveRuntimeFromExportThis(this), dps, isForce);
|
|
20
|
-
}
|
|
21
18
|
export function isOfflineDpSyncing(code) {
|
|
22
19
|
const rt = resolveRuntimeFromExportThis(this);
|
|
23
20
|
if (!rt.config.supportOfflineDps) {
|
|
@@ -5,21 +5,12 @@ export declare function createTempCustom(params: CreateCustomParams): Promise<Te
|
|
|
5
5
|
export declare function removeTempCustom(params: RemoveCustomProps): Promise<boolean>;
|
|
6
6
|
export declare function updateTempCustom(params: UpdateTempPasswordParams): Promise<boolean>;
|
|
7
7
|
export declare function getTempEffectiveList(): Promise<import("../../../feature/password/temporary/types").EffectivePasswrodItem[]>;
|
|
8
|
-
export declare function getTempInvalidList(params?: GetInvalidListParams): Promise<
|
|
9
|
-
list: import("../../../feature/password/temporary/types").InvalidPasswordItem[];
|
|
10
|
-
hasMore: boolean;
|
|
11
|
-
total: number;
|
|
12
|
-
}>;
|
|
8
|
+
export declare function getTempInvalidList(params?: GetInvalidListParams): Promise<import("../../../feature/password/temporary/lists").GetTempInvalidListResult>;
|
|
13
9
|
export declare function clearTempInvalidList(): Promise<boolean>;
|
|
14
10
|
export declare function freezeTemp(params: FreezeParams): Promise<boolean>;
|
|
15
11
|
export declare function unfreezeTemp(params: FreezeParams): Promise<boolean>;
|
|
16
12
|
export declare function renameTemp(params: RenameParams): Promise<void>;
|
|
17
|
-
export declare function saveTempOnlineUnlimited(params: CreateOnlineUnlimitedParams): Promise<
|
|
18
|
-
type: "custom";
|
|
19
|
-
name: string;
|
|
20
|
-
pwdId: string;
|
|
21
|
-
effectiveConfig: import("../../../interface").EffectiveConfig;
|
|
22
|
-
}>;
|
|
13
|
+
export declare function saveTempOnlineUnlimited(params: CreateOnlineUnlimitedParams): Promise<import("../../../feature/password/temporary/wifi-online").SaveTempOnlineUnlimitedResult>;
|
|
23
14
|
export declare function removeTempOnlineUnlimited(id: string): Promise<void>;
|
|
24
15
|
export declare function getTempOnlineUnlimitedList(): Promise<import("../../../feature/password/temporary/wifi-online").OnlinePasswordItem[]>;
|
|
25
16
|
export declare function createTempOffline(params: CreateOfflineParams): Promise<import("../../../feature/password/temporary/types").OfflineTempResult>;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { type RawFitOpenModeScheduleItem } from "../../api/fit";
|
|
2
|
-
import { EffectiveConfig
|
|
2
|
+
import { EffectiveConfig } from "../../interface";
|
|
3
3
|
import { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
4
4
|
export interface FitPasswordItem {
|
|
5
|
-
id: number;
|
|
6
|
-
unlockId: number;
|
|
7
|
-
unlockName: string;
|
|
8
|
-
type: UnlockMethodType;
|
|
9
|
-
userName: string;
|
|
10
|
-
lockUserId: number;
|
|
11
|
-
userType: number;
|
|
12
|
-
devLockId: string;
|
|
13
|
-
effective: EffectiveConfig;
|
|
14
|
-
}
|
|
15
|
-
export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime) => Promise<{
|
|
16
5
|
id: number;
|
|
17
6
|
unlockId: string;
|
|
18
7
|
unlockName: string;
|
|
@@ -22,7 +11,8 @@ export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime)
|
|
|
22
11
|
userType: number;
|
|
23
12
|
devLockId: string;
|
|
24
13
|
effective: EffectiveConfig;
|
|
25
|
-
}
|
|
14
|
+
}
|
|
15
|
+
export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime) => Promise<FitPasswordItem[]>;
|
|
26
16
|
export interface FitOnlinePasswordItem {
|
|
27
17
|
id: number;
|
|
28
18
|
pwdId: number;
|
|
@@ -15,9 +15,10 @@ export interface UpdateFitTempPwdParams {
|
|
|
15
15
|
name: string;
|
|
16
16
|
effective: EffectiveConfig;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export interface AddFitTempPwdResult {
|
|
19
19
|
pwdId: number;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
|
+
export declare function fitAddTempPwdForRuntime(runtime: LockDeviceRuntime, params: AddFitTempPwdParams): Promise<AddFitTempPwdResult>;
|
|
21
22
|
export declare function fitRemoveTempPwdForRuntime(runtime: LockDeviceRuntime, params: RemoveFitTempPwdParams): Promise<void>;
|
|
22
23
|
export declare function fitUpdateTempPwdForRuntime(runtime: LockDeviceRuntime, params: UpdateFitTempPwdParams): Promise<void>;
|
|
23
24
|
export interface RenameFitTempPwdParams {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type ExecutorRange = "unlock" | "lock";
|
|
2
2
|
export type Ability = "backHome" | "alarm" | "geographyArrive" | "geographyLeave" | "bleGeofence" | "siriUnlock" | "siriLock";
|
|
3
|
+
export interface ConnectDeviceOptions {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}
|
|
3
6
|
export interface OpenSceneOptions {
|
|
4
7
|
themeColor?: string;
|
|
5
8
|
executorRange?: Array<ExecutorRange>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
2
|
import type { EffectivePasswrodItem, GetInvalidListParams, InvalidPasswordItem } from "./types";
|
|
3
3
|
export declare function getTempEffectiveListForRuntime(rt: LockDeviceRuntime): Promise<EffectivePasswrodItem[]>;
|
|
4
|
-
export
|
|
4
|
+
export interface GetTempInvalidListResult {
|
|
5
5
|
list: InvalidPasswordItem[];
|
|
6
6
|
hasMore: boolean;
|
|
7
7
|
total: number;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare function getTempInvalidListForRuntime(rt: LockDeviceRuntime, params?: GetInvalidListParams): Promise<GetTempInvalidListResult>;
|
|
9
10
|
export declare function clearTempInvalidListForRuntime(rt: LockDeviceRuntime): Promise<boolean>;
|
|
10
11
|
export interface LimitTempItem {
|
|
11
12
|
id: string;
|
|
@@ -10,10 +10,11 @@ export interface FitOfflineOnceResult {
|
|
|
10
10
|
gmtExpired: number;
|
|
11
11
|
}
|
|
12
12
|
export declare function createFitOfflineOnceForRuntime(rt: LockDeviceRuntime): Promise<FitOfflineOnceResult>;
|
|
13
|
-
export
|
|
13
|
+
export interface FitOfflineLimitParams {
|
|
14
14
|
effectiveTime: number;
|
|
15
15
|
invalidTime: number;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
|
+
export declare function createFitOfflineLimitForRuntime(rt: LockDeviceRuntime, params: FitOfflineLimitParams): Promise<FitOfflineOnceResult>;
|
|
17
18
|
export declare function createFitOfflineClearAllForRuntime(rt: LockDeviceRuntime): Promise<FitOfflineOnceResult>;
|
|
18
19
|
export declare function getFitOfflineRevocableListForRuntime(rt: LockDeviceRuntime): Promise<LimitOfflinePwdItem[]>;
|
|
19
20
|
export declare function getFitOfflinePwdAvailableForRuntime(rt: LockDeviceRuntime, pwdType: string): Promise<OfflinePwdAvailableResult>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
2
|
import type { CreateOnlineUnlimitedParams } from "./types";
|
|
3
3
|
import type { EffectiveConfig } from "../../../interface";
|
|
4
|
-
export
|
|
4
|
+
export interface SaveTempOnlineUnlimitedResult {
|
|
5
5
|
type: "custom";
|
|
6
6
|
name: string;
|
|
7
7
|
pwdId: string;
|
|
8
8
|
effectiveConfig: EffectiveConfig;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export declare function saveTempOnlineUnlimitedForRuntime(rt: LockDeviceRuntime, params: CreateOnlineUnlimitedParams): Promise<SaveTempOnlineUnlimitedResult>;
|
|
10
11
|
export declare function removeTempOnlineUnlimitedForRuntime(rt: LockDeviceRuntime, id: string): Promise<void>;
|
|
11
12
|
export interface OnlinePasswordItem {
|
|
12
13
|
status: "effective" | "synchronizing" | "expired" | "disabled" | "invalid";
|
|
@@ -41,7 +41,7 @@ export const initState = async (runtime) => {
|
|
|
41
41
|
isSupportVideo,
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
|
-
const [, , , advanceAbilities, isActiveThread, rotateInfo, deviceSkill, ipcConfig,] = await Promise.allSettled([
|
|
44
|
+
const [, userInfoResult, , advanceAbilities, isActiveThread, rotateInfo, deviceSkill, ipcConfig,] = await Promise.allSettled([
|
|
45
45
|
updateOnlineType(runtime),
|
|
46
46
|
getCurrentUserForRuntime(runtime),
|
|
47
47
|
fetchDeviceProperties(runtime),
|
|
@@ -71,6 +71,9 @@ export const initState = async (runtime) => {
|
|
|
71
71
|
},
|
|
72
72
|
}),
|
|
73
73
|
]);
|
|
74
|
+
if (userInfoResult.status === "rejected") {
|
|
75
|
+
throw userInfoResult.reason;
|
|
76
|
+
}
|
|
74
77
|
if (isSupportVideo) {
|
|
75
78
|
const isSEI = runtime.config.capabilities?.rotateType === RotateType.SEI;
|
|
76
79
|
if (rotateInfo.status === "fulfilled") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dpUtils from "@ray-js/tuya-dp-transform";
|
|
2
2
|
import { createUnlockMethod } from "../../../api/lock";
|
|
3
3
|
import { parallelOnlyForRuntime } from "../../utils";
|
|
4
|
-
import {
|
|
4
|
+
import { sleep } from "../../../utils";
|
|
5
5
|
import { getError } from "../../../utils/errors";
|
|
6
6
|
import { publishDpsForRuntime } from "../../dp/publish-dps";
|
|
7
7
|
import emitter from "../../../utils/event";
|
|
@@ -207,7 +207,7 @@ const handleAddReport = async (dps) => {
|
|
|
207
207
|
const res = await createUnlockMethod({
|
|
208
208
|
devId: cfg.devInfo.devId,
|
|
209
209
|
userId: addUnlockMethodData.userId,
|
|
210
|
-
unlockId:
|
|
210
|
+
unlockId: `${addUnlockMethodData.unlockDpId}-${result.unlockId}`,
|
|
211
211
|
unlockName: "",
|
|
212
212
|
unlockAttr: 0,
|
|
213
213
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dpUtils from "@ray-js/tuya-dp-transform";
|
|
2
2
|
import { createUnlockMethod } from "../../../api/lock";
|
|
3
3
|
import { encrypt } from "../../../platform/device";
|
|
4
|
-
import {
|
|
4
|
+
import { sleep } from "../../../utils";
|
|
5
5
|
import { getError, handleCloudError } from "../../../utils/errors";
|
|
6
6
|
import { publishDpsForRuntime } from "../../dp/publish-dps";
|
|
7
7
|
import { getUnlockMethodBase } from "./internal/base";
|
|
@@ -76,7 +76,7 @@ export async function addPasswordForRuntime(rt, params) {
|
|
|
76
76
|
const result = await createUnlockMethod({
|
|
77
77
|
devId: devId,
|
|
78
78
|
userId: params.userId,
|
|
79
|
-
unlockId:
|
|
79
|
+
unlockId: `${dpId}-${res.unlockId}`,
|
|
80
80
|
unlockName: params.name,
|
|
81
81
|
unlockDetail: aesPwd,
|
|
82
82
|
...specialInfo,
|