@ray-js/lock-sdk 1.2.0 → 1.2.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/user.d.ts +4 -0
- package/lib/api/user.js +8 -0
- package/lib/api/video.d.ts +11 -0
- package/lib/api/video.js +10 -0
- package/lib/entries/main/exports/capability.d.ts +0 -2
- package/lib/entries/main/exports/capability.js +1 -7
- package/lib/entries/main/exports/fit-sdk/device.d.ts +0 -1
- package/lib/entries/main/exports/fit-sdk/device.js +0 -4
- package/lib/entries/main/exports/media.d.ts +1 -1
- package/lib/entries/main/index.d.ts +2 -1
- package/lib/feature/fit/method/internal/base.js +7 -16
- package/lib/feature/media/camera.d.ts +2 -4
- package/lib/feature/misc/capability.d.ts +1 -1
- package/lib/feature/misc/capability.js +1 -1
- package/lib/feature/state/init-state.js +5 -8
- package/lib/feature/state/internal/share-thread-local.js +2 -2
- package/lib/feature/unlock/method/internal/base.js +6 -16
- package/lib/feature/user/user.js +25 -18
- package/lib/interface.d.ts +1 -0
- package/lib/utils/errors.js +1 -0
- package/lib/utils/index.d.ts +0 -12
- package/lib/utils/index.js +0 -14
- package/package.json +1 -1
package/lib/api/user.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface UserListItem {
|
|
|
57
57
|
nickName: string;
|
|
58
58
|
offlineUnlock: boolean;
|
|
59
59
|
timeScheduleInfo: {
|
|
60
|
+
userTimeSet: string;
|
|
60
61
|
effectiveTime: number;
|
|
61
62
|
expiredTime: number;
|
|
62
63
|
permanent: boolean;
|
|
@@ -143,4 +144,7 @@ export interface LockShareAvailableResult {
|
|
|
143
144
|
errorCode: string;
|
|
144
145
|
}
|
|
145
146
|
export declare const checkLockShareAvailable: (params: LockShareAvailableParams) => Promise<LockShareAvailableResult>;
|
|
147
|
+
export declare const getPermanentValidTime: (devId: string) => Promise<{
|
|
148
|
+
timeSetHex: string;
|
|
149
|
+
}>;
|
|
146
150
|
export {};
|
package/lib/api/user.js
CHANGED
|
@@ -88,3 +88,11 @@ export const checkLockShareAvailable = (params) => {
|
|
|
88
88
|
data: { ...params },
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
+
export const getPermanentValidTime = (devId) => {
|
|
92
|
+
return requestApi({
|
|
93
|
+
logName: "getPermanentValidTime",
|
|
94
|
+
api: "m.lock.perm.time.get",
|
|
95
|
+
version: "1.0",
|
|
96
|
+
data: { devId, scene: "SCHEDULE" },
|
|
97
|
+
});
|
|
98
|
+
};
|
package/lib/api/video.d.ts
CHANGED
|
@@ -37,4 +37,15 @@ export interface getAlbumDateListResult {
|
|
|
37
37
|
dateList: string[];
|
|
38
38
|
}
|
|
39
39
|
export declare const getAlbumDateList: (devId: string) => Promise<getAlbumDateListResult>;
|
|
40
|
+
interface GetDeviceCurrentMeidaConfigResult {
|
|
41
|
+
audioAttributes: {
|
|
42
|
+
callMode: Array<1 | 2>;
|
|
43
|
+
hardwareCapability: Array<1 | 2>;
|
|
44
|
+
};
|
|
45
|
+
maxZoomInTimes: number;
|
|
46
|
+
skill: string;
|
|
47
|
+
vedioClarity: number;
|
|
48
|
+
vedioClaritys: number[];
|
|
49
|
+
}
|
|
50
|
+
export declare const getDeviceCurrentMeidaConfig: (devId: string) => Promise<GetDeviceCurrentMeidaConfigResult>;
|
|
40
51
|
export {};
|
package/lib/api/video.js
CHANGED
|
@@ -60,3 +60,13 @@ export const getAlbumDateList = (devId) => {
|
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
+
export const getDeviceCurrentMeidaConfig = (devId) => {
|
|
64
|
+
return requestApi({
|
|
65
|
+
logName: "getDeviceCurrentMeidaConfig",
|
|
66
|
+
api: "m.ipc.device.ability.get",
|
|
67
|
+
version: "1.0",
|
|
68
|
+
data: {
|
|
69
|
+
devId,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ProductCommunicationType } from "../../../constant";
|
|
2
2
|
export declare function hasCapability(capability: ProductCommunicationType): boolean;
|
|
3
3
|
export declare function isBlePureDevice(): boolean;
|
|
4
|
-
export declare function isShareThead(): boolean;
|
|
5
|
-
export declare function isActiveThread(): Promise<boolean>;
|
|
6
4
|
export declare function getDeviceAdvancedAbilities(): Promise<import("../../..").DeviceAdvancedAbility>;
|
|
7
5
|
export declare function getDeviceAdvancedAbilitiesSync(): import("../../..").DeviceAdvancedAbility | undefined;
|
|
8
6
|
export declare function getDeviceCapabilities(): import("../../..").CapabilityInfo | null;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
-
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime,
|
|
2
|
+
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime, getDeviceAdvancedAbilitiesForRuntime, getDeviceAdvancedAbilitiesSyncForRuntime, getDeviceCapabilitiesForRuntime, } from "../../../feature/misc/capability";
|
|
3
3
|
export function hasCapability(capability) {
|
|
4
4
|
return hasCapabilityForRuntime(resolveRuntimeFromExportThis(this), capability);
|
|
5
5
|
}
|
|
6
6
|
export function isBlePureDevice() {
|
|
7
7
|
return isBlePureDeviceForRuntime(resolveRuntimeFromExportThis(this));
|
|
8
8
|
}
|
|
9
|
-
export function isShareThead() {
|
|
10
|
-
return isShareTheadForRuntime(resolveRuntimeFromExportThis(this));
|
|
11
|
-
}
|
|
12
|
-
export async function isActiveThread() {
|
|
13
|
-
return isActiveThreadForRuntime(resolveRuntimeFromExportThis(this));
|
|
14
|
-
}
|
|
15
9
|
export async function getDeviceAdvancedAbilities() {
|
|
16
10
|
return getDeviceAdvancedAbilitiesForRuntime(resolveRuntimeFromExportThis(this));
|
|
17
11
|
}
|
|
@@ -24,4 +24,3 @@ interface RemoveFitBleKeyParams {
|
|
|
24
24
|
export declare function removeFitBleKey(params: RemoveFitBleKeyParams): Promise<unknown>;
|
|
25
25
|
export declare function renameFitBleKey(params: RenameFitBleKeyParams): Promise<unknown>;
|
|
26
26
|
export declare function getFitUsers(): Promise<FitUserItem[]>;
|
|
27
|
-
export declare function setFitSetting(dpCode: string, value: string | number | boolean): Promise<void>;
|
|
@@ -6,7 +6,6 @@ import { offFitAddUnlockMethodForRuntime, onFitAddUnlockMethodForRuntime, } from
|
|
|
6
6
|
import { getFitUnlockMethodListForRuntime } from "../../../../feature/fit/method/list";
|
|
7
7
|
import { syncOpenModeRiseForRuntime } from "../../../../feature/fit/sync";
|
|
8
8
|
import { getFitBleKeyListForRuntime, addFitBleKeyForRuntime, createFitPermanentBleKeyForRuntime, createFitTemporaryBleKeyForRuntime, updateFitTemporaryBleKeyForRuntime, removeFitBleKeyForRuntime, renameFitBleKeyForRuntime, } from "../../../../feature/fit/ble-key";
|
|
9
|
-
import { setFitSettingForRuntime } from "../../../../feature/fit/setting";
|
|
10
9
|
import { getFitUsersForRuntime, } from "../../../../feature/fit/users";
|
|
11
10
|
export function fitAddPassword(params) {
|
|
12
11
|
return fitAddPasswordForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
@@ -59,6 +58,3 @@ export function renameFitBleKey(params) {
|
|
|
59
58
|
export function getFitUsers() {
|
|
60
59
|
return getFitUsersForRuntime(resolveRuntimeFromExportThis(this));
|
|
61
60
|
}
|
|
62
|
-
export function setFitSetting(dpCode, value) {
|
|
63
|
-
return setFitSettingForRuntime(resolveRuntimeFromExportThis(this), dpCode, value);
|
|
64
|
-
}
|
|
@@ -7,7 +7,7 @@ export declare function openLocalAlbum(params?: OpenLocalAlbumParams): Promise<v
|
|
|
7
7
|
export declare function gotoPlayback(params?: GotoPlaybackParams): Promise<void>;
|
|
8
8
|
export declare function isSupportMultiCamera(): boolean;
|
|
9
9
|
export declare function getCameraInfo(): import("../../../feature/media/camera").CameraDpInfo | undefined;
|
|
10
|
-
export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").
|
|
10
|
+
export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").CameraDpInfo | undefined>;
|
|
11
11
|
export declare function switchCamera(index: number): Promise<true>;
|
|
12
12
|
export declare function getMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
|
|
13
13
|
export declare function addMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
|
|
@@ -3,6 +3,7 @@ import type { LockSDKInstance, FitSDKInstance } from "./build-instance";
|
|
|
3
3
|
export * from "./exports";
|
|
4
4
|
export type { LockSDKInstance, FitSDKInstance };
|
|
5
5
|
export type { LockSdkBoundExportThis } from "./bootstrap/resolve-runtime-from-export-this";
|
|
6
|
-
export
|
|
6
|
+
export type SDKOptions = Omit<LockSDKOption, "preFetch">;
|
|
7
|
+
export declare const createSDK: (options?: SDKOptions) => Promise<LockSDKInstance>;
|
|
7
8
|
export declare const init: (options?: LockSDKOption) => Promise<void>;
|
|
8
9
|
export declare const destroy: () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import DpUtils from "@ray-js/tuya-dp-transform";
|
|
1
2
|
import dpCodes from "../../../../config/dp-code";
|
|
2
|
-
import { fitAdd, fitReportAdd } from "../../../../config/dp-map/unlock-method-fit";
|
|
3
|
-
import {
|
|
3
|
+
import { fitAdd, fitReportAdd, } from "../../../../config/dp-map/unlock-method-fit";
|
|
4
|
+
import { isAdmin } from "../../../../utils";
|
|
4
5
|
import { getError } from "../../../../utils/errors";
|
|
5
6
|
import { LoopTypes } from "../../../../utils/constant";
|
|
6
7
|
import { sdkLog } from "../../../../utils/sdk-log";
|
|
@@ -8,24 +9,14 @@ import { getUnlockMethodTypeByTypeForRuntime } from "../../../utils";
|
|
|
8
9
|
import { getUserInfoOnDevForRuntime } from "../../../user/user";
|
|
9
10
|
import { getBoundLockListForRuntime } from "../../list";
|
|
10
11
|
import { resolveSlaveId } from "../../resolve-slave-id";
|
|
12
|
+
import { validConfigDpMap } from "../../../../config/dp-map/common";
|
|
11
13
|
export function buildValidConfigFromTimeSchedule(timeScheduleInfo) {
|
|
12
14
|
if (!timeScheduleInfo) {
|
|
13
|
-
|
|
15
|
+
throw getError(1106);
|
|
14
16
|
}
|
|
15
|
-
const { permanent, effectiveTime, expiredTime, scheduleDetails } = timeScheduleInfo;
|
|
17
|
+
const { permanent, userTimeSet, effectiveTime, expiredTime, scheduleDetails, } = timeScheduleInfo;
|
|
16
18
|
if (permanent) {
|
|
17
|
-
return
|
|
18
|
-
startTime: effectiveTime ? Math.floor(effectiveTime / 1000) : 0x386cd300,
|
|
19
|
-
endTime: expiredTime ? Math.floor(expiredTime / 1000) : 0x72bc9b7f,
|
|
20
|
-
loop: LoopTypes.NONE,
|
|
21
|
-
loopConfig: 0,
|
|
22
|
-
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
23
|
-
days: [],
|
|
24
|
-
startHour: 0,
|
|
25
|
-
startMinute: 0,
|
|
26
|
-
endHour: 0,
|
|
27
|
-
endMinute: 0,
|
|
28
|
-
};
|
|
19
|
+
return DpUtils.parse(userTimeSet, validConfigDpMap.childMap);
|
|
29
20
|
}
|
|
30
21
|
return {
|
|
31
22
|
startTime: Math.floor((effectiveTime || +new Date()) / 1000),
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
-
import type { CameraConfig
|
|
3
|
-
import { locationSelectReportMap } from "../../config/dp-map/media";
|
|
4
|
-
export type CameraInfo = DpMapDataType<typeof locationSelectReportMap>;
|
|
2
|
+
import type { CameraConfig } from "../../interface";
|
|
5
3
|
export declare const isSupportMultiCameraForRuntime: (runtime: LockDeviceRuntime) => boolean;
|
|
6
4
|
interface CameraItem {
|
|
7
5
|
index: number;
|
|
@@ -12,7 +10,7 @@ export interface CameraDpInfo {
|
|
|
12
10
|
list: CameraItem[];
|
|
13
11
|
}
|
|
14
12
|
export declare const getCameraInfoForRuntime: (runtime: LockDeviceRuntime) => CameraDpInfo | undefined;
|
|
15
|
-
export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<
|
|
13
|
+
export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<CameraDpInfo | undefined>;
|
|
16
14
|
export declare const switchCameraForRuntime: (runtime: LockDeviceRuntime, index: number) => Promise<true>;
|
|
17
15
|
export declare const getCameraConfigForRuntime: (runtime: LockDeviceRuntime) => CameraConfig[];
|
|
18
16
|
export {};
|
|
@@ -3,7 +3,7 @@ import { DeviceAdvancedAbility } from "../../interface";
|
|
|
3
3
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
4
4
|
export declare const hasCapabilityForRuntime: (runtime: LockDeviceRuntime, capability: ProductCommunicationType) => boolean;
|
|
5
5
|
export declare const isBlePureDeviceForRuntime: (rt: LockDeviceRuntime) => boolean;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const isShareThreadForRuntime: (rt: LockDeviceRuntime) => boolean;
|
|
7
7
|
export declare const isActiveThreadForRuntime: (rt: LockDeviceRuntime) => Promise<boolean>;
|
|
8
8
|
export declare const getDeviceAdvancedAbilitiesSyncForRuntime: (rt: LockDeviceRuntime) => DeviceAdvancedAbility | undefined;
|
|
9
9
|
export declare const getDeviceAdvancedAbilitiesForRuntime: (rt: LockDeviceRuntime) => Promise<DeviceAdvancedAbility>;
|
|
@@ -6,7 +6,7 @@ import { getWithLocalCache } from "../storage/swr-cache";
|
|
|
6
6
|
export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
|
|
7
7
|
export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
|
|
8
8
|
rt.config.communication.length === 1;
|
|
9
|
-
export const
|
|
9
|
+
export const isShareThreadForRuntime = (rt) => {
|
|
10
10
|
const hasThread = hasCapabilityForRuntime(rt, ProductCommunicationType.THREAD);
|
|
11
11
|
return (hasThread &&
|
|
12
12
|
!rt.config.devInfo.meta?.["threadWithBLE"] &&
|
|
@@ -14,7 +14,7 @@ import syncT0 from "./sync/t0";
|
|
|
14
14
|
import { getDeviceStatusForRuntime, updateOnlineType } from "./device-status";
|
|
15
15
|
import { handleDpChange } from "./dp-change";
|
|
16
16
|
import { fetchDeviceProperties } from "./remote-permissions";
|
|
17
|
-
import { ipc, yuChannelSyncSingleSync
|
|
17
|
+
import { ipc, yuChannelSyncSingleSync } from "../../platform";
|
|
18
18
|
import { sdkLog } from "../../utils/sdk-log";
|
|
19
19
|
import { ProductCommunicationType, RotateType } from "../../constant";
|
|
20
20
|
import { isHarmony } from "../../utils";
|
|
@@ -85,14 +85,11 @@ export const initState = async (runtime) => {
|
|
|
85
85
|
}
|
|
86
86
|
if (ipcConfig.status === "fulfilled" &&
|
|
87
87
|
ipcConfig.value?.audioAttributes?.hardwareCapability?.includes(2)) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
88
|
+
runtime.config.supportTalk = true;
|
|
89
|
+
runtime.config.isTwoWayTalk =
|
|
90
|
+
ipcConfig.value?.audioAttributes?.callMode?.[0] === 2;
|
|
91
|
+
if (!isHarmony()) {
|
|
94
92
|
try {
|
|
95
|
-
runtime.config.supportTalk = true;
|
|
96
93
|
const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
|
|
97
94
|
runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
|
|
98
95
|
sdkLog("info", "initState", "supportTalk", {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import DpUtils from "@ray-js/tuya-dp-transform";
|
|
1
2
|
import { fetchCreatePasswordSN } from "../../../../api/lock";
|
|
2
3
|
import dpCodes from "../../../../config/dp-code";
|
|
3
4
|
import { add as addMap, reportAdd as reportAddMap, } from "../../../../config/dp-map/unlock-method";
|
|
4
5
|
import { add as addBigMap, reportAdd as reportAddBigMap, } from "../../../../config/dp-map/unlock-method-big";
|
|
5
6
|
import { getUnlockMethodTypeByTypeForRuntime } from "../../../utils";
|
|
6
|
-
import {
|
|
7
|
+
import { isAdmin } from "../../../../utils";
|
|
7
8
|
import { LoopTypes } from "../../../../utils/constant";
|
|
8
9
|
import { getUserInfoForRuntime } from "../../../user/user";
|
|
10
|
+
import { getError } from "../../../../utils/errors";
|
|
11
|
+
import { validConfigDpMap } from "../../../../config/dp-map/common";
|
|
9
12
|
export async function getUnlockMethodBase(rt, type, userId) {
|
|
10
13
|
const { idsByCode, devInfo: { devId }, supportBigData, } = rt.config;
|
|
11
14
|
const unlockMethodConfig = getUnlockMethodTypeByTypeForRuntime(rt, type);
|
|
@@ -27,20 +30,7 @@ export async function getUnlockMethodBase(rt, type, userId) {
|
|
|
27
30
|
if (timeScheduleInfo) {
|
|
28
31
|
const { permanent, effectiveTime, expiredTime, scheduleDetails } = timeScheduleInfo;
|
|
29
32
|
if (permanent) {
|
|
30
|
-
validConfig =
|
|
31
|
-
startTime: effectiveTime
|
|
32
|
-
? Math.floor(effectiveTime / 1000)
|
|
33
|
-
: 0x386cd300,
|
|
34
|
-
endTime: expiredTime ? Math.floor(expiredTime / 1000) : 0x72bc9b7f,
|
|
35
|
-
loop: LoopTypes.NONE,
|
|
36
|
-
loopConfig: 0,
|
|
37
|
-
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
38
|
-
days: [],
|
|
39
|
-
startHour: 0,
|
|
40
|
-
startMinute: 0,
|
|
41
|
-
endHour: 0,
|
|
42
|
-
endMinute: 0,
|
|
43
|
-
};
|
|
33
|
+
validConfig = DpUtils.parse(timeScheduleInfo.userTimeSet, validConfigDpMap.childMap);
|
|
44
34
|
}
|
|
45
35
|
else {
|
|
46
36
|
validConfig = {
|
|
@@ -60,7 +50,7 @@ export async function getUnlockMethodBase(rt, type, userId) {
|
|
|
60
50
|
}
|
|
61
51
|
}
|
|
62
52
|
else {
|
|
63
|
-
|
|
53
|
+
throw getError(1106);
|
|
64
54
|
}
|
|
65
55
|
const dpData = {
|
|
66
56
|
type: unlockMethodConfig.id,
|
package/lib/feature/user/user.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCurrentUserInfo, getUserDetailQuery, getUserList, } from "../../api/user";
|
|
1
|
+
import { getCurrentUserInfo, getPermanentValidTime, getUserDetailQuery, getUserList, } from "../../api/user";
|
|
2
2
|
import { update as updateMap, reportUpdate as reportUpdateMap, } from "../../config/dp-map/unlock-method";
|
|
3
3
|
import { update as updateMapBig, reportUpdate as reportUpdateMapBig, } from "../../config/dp-map/unlock-method-big";
|
|
4
4
|
import { publishDpsForRuntime } from "../dp/publish-dps";
|
|
@@ -9,7 +9,7 @@ import { updateUserTimeSchedule, addNormalUser, removeNormalUser, } from "../../
|
|
|
9
9
|
import { validConfigDpMap } from "../../config/dp-map/common";
|
|
10
10
|
import { isUseNearChannelForRuntime } from "../misc/is-use-near-channel-for-runtime";
|
|
11
11
|
import { getUnlockMethodTypeByDpCodeForRuntime } from "../utils";
|
|
12
|
-
import { formatTimestampToMilliseconds, formatWeek,
|
|
12
|
+
import { formatTimestampToMilliseconds, formatWeek, isAdmin, parseWeek, validateEffectiveConfig, } from "../../utils";
|
|
13
13
|
import { getCurrentHomeInfo, isSupportShortLink } from "../../platform/device";
|
|
14
14
|
import { LoopTypes } from "../../utils/constant";
|
|
15
15
|
import { getCurrentUserForRuntime } from "./current-user";
|
|
@@ -21,6 +21,7 @@ const handleUserDetail = (rt, user) => {
|
|
|
21
21
|
const { timeScheduleInfo, unlockDetail, ...rest } = user;
|
|
22
22
|
let scheduleInfo = {
|
|
23
23
|
permanent: true,
|
|
24
|
+
userTimeSet: timeScheduleInfo.userTimeSet,
|
|
24
25
|
};
|
|
25
26
|
if (!timeScheduleInfo.permanent &&
|
|
26
27
|
timeScheduleInfo.scheduleDetails &&
|
|
@@ -214,6 +215,27 @@ export async function updateUserLimitTimeForRuntime(rt, params) {
|
|
|
214
215
|
?
|
|
215
216
|
LoopTypes[repeat.toUpperCase()]
|
|
216
217
|
: LoopTypes.NONE;
|
|
218
|
+
let validConfig;
|
|
219
|
+
if (permanent) {
|
|
220
|
+
const { timeSetHex } = await getPermanentValidTime(cfg.devInfo.devId);
|
|
221
|
+
validConfig = DpUtils.parse(timeSetHex, validConfigDpMap.childMap);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
validConfig = {
|
|
225
|
+
startTime: effective.effectiveDate,
|
|
226
|
+
endTime: effective.expiredDate,
|
|
227
|
+
loop: loopType,
|
|
228
|
+
loopConfig: 0,
|
|
229
|
+
weeks: effective?.repeat !== "week" || effective?.weeks === undefined
|
|
230
|
+
? [0, 0, 0, 0, 0, 0, 0]
|
|
231
|
+
: effective.weeks,
|
|
232
|
+
days: [],
|
|
233
|
+
startHour: Math.floor(effectiveTime / 60),
|
|
234
|
+
startMinute: effectiveTime % 60,
|
|
235
|
+
endHour: Math.floor(expiredTime / 60),
|
|
236
|
+
endMinute: expiredTime % 60,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
217
239
|
const dpValue = {
|
|
218
240
|
type: 0,
|
|
219
241
|
stage: 0,
|
|
@@ -223,22 +245,7 @@ export async function updateUserLimitTimeForRuntime(rt, params) {
|
|
|
223
245
|
validNum: 0,
|
|
224
246
|
pwdLength: 0,
|
|
225
247
|
pwd: [],
|
|
226
|
-
validConfig
|
|
227
|
-
? getPermanentSetting()
|
|
228
|
-
: {
|
|
229
|
-
startTime: effective.effectiveDate,
|
|
230
|
-
endTime: effective.expiredDate,
|
|
231
|
-
loop: loopType,
|
|
232
|
-
loopConfig: 0,
|
|
233
|
-
weeks: effective?.repeat !== "week" || effective?.weeks === undefined
|
|
234
|
-
? [0, 0, 0, 0, 0, 0, 0]
|
|
235
|
-
: effective.weeks,
|
|
236
|
-
days: [],
|
|
237
|
-
startHour: Math.floor(effectiveTime / 60),
|
|
238
|
-
startMinute: effectiveTime % 60,
|
|
239
|
-
endHour: Math.floor(expiredTime / 60),
|
|
240
|
-
endMinute: expiredTime % 60,
|
|
241
|
-
},
|
|
248
|
+
validConfig,
|
|
242
249
|
};
|
|
243
250
|
const res = (await publishDpsForRuntime(rt, {
|
|
244
251
|
[dpCode]: DpUtils.format(dpValue, (cfg.supportBigData ? updateMapBig : updateMap)),
|
package/lib/interface.d.ts
CHANGED
package/lib/utils/errors.js
CHANGED
|
@@ -105,6 +105,7 @@ const errors = {
|
|
|
105
105
|
1103: "Binding failed",
|
|
106
106
|
1104: "Failed to switch cameras",
|
|
107
107
|
1105: "Camera switching is not supported",
|
|
108
|
+
1106: "No validity configuration data",
|
|
108
109
|
};
|
|
109
110
|
export const getError = (code, ...places) => {
|
|
110
111
|
if (errors[code]) {
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -123,18 +123,6 @@ export declare function getCapabilities(capability: number): ({
|
|
|
123
123
|
export declare const formatWeek: (value: number[]) => number;
|
|
124
124
|
export declare const formatCloudUnlockId: (dpId: number | string, sn: number) => string;
|
|
125
125
|
export declare const parseWeek: (value: number) => Week;
|
|
126
|
-
export declare const getPermanentSetting: () => {
|
|
127
|
-
startTime: number;
|
|
128
|
-
endTime: number;
|
|
129
|
-
loop: LoopTypes;
|
|
130
|
-
loopConfig: number;
|
|
131
|
-
weeks: number[];
|
|
132
|
-
days: never[];
|
|
133
|
-
startHour: number;
|
|
134
|
-
startMinute: number;
|
|
135
|
-
endHour: number;
|
|
136
|
-
endMinute: number;
|
|
137
|
-
};
|
|
138
126
|
export declare const isAdmin: (userType: UserType) => boolean;
|
|
139
127
|
export declare const validateEffectiveConfig: (effective?: EffectiveConfig) => void;
|
|
140
128
|
export declare const formatTimestampToMilliseconds: (timestamp: number) => number;
|
package/lib/utils/index.js
CHANGED
|
@@ -66,20 +66,6 @@ export const parseWeek = (value) => {
|
|
|
66
66
|
.map(Number)
|
|
67
67
|
.slice(0, 7);
|
|
68
68
|
};
|
|
69
|
-
export const getPermanentSetting = () => {
|
|
70
|
-
return {
|
|
71
|
-
startTime: 0x386cd300,
|
|
72
|
-
endTime: 0x72bc9b7f,
|
|
73
|
-
loop: LoopTypes.NONE,
|
|
74
|
-
loopConfig: 0,
|
|
75
|
-
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
76
|
-
days: [],
|
|
77
|
-
startHour: 0,
|
|
78
|
-
startMinute: 0,
|
|
79
|
-
endHour: 0,
|
|
80
|
-
endMinute: 0,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
69
|
export const isAdmin = (userType) => userType === 10 || userType === 50 ? true : false;
|
|
84
70
|
export const validateEffectiveConfig = (effective) => {
|
|
85
71
|
if (!effective) {
|