@ray-js/lock-sdk 1.2.1 → 1.2.2-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/log.d.ts +1 -0
- package/lib/api/video.d.ts +1 -0
- package/lib/constant.d.ts +2 -1
- package/lib/constant.js +1 -0
- package/lib/feature/log/log.js +6 -3
- package/lib/feature/misc/capability.js +12 -9
- package/lib/feature/state/init-state.js +18 -14
- package/lib/interface.d.ts +1 -0
- package/lib/runtime/lock-config.d.ts +3 -0
- package/lib/runtime/lock-config.js +4 -1
- package/lib/utils/errors.js +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/sdk-log.js +1 -1
- package/package.json +1 -1
package/lib/api/log.d.ts
CHANGED
|
@@ -120,6 +120,7 @@ export interface LockLogListItem {
|
|
|
120
120
|
unionUnlockInfo?: UnionUnlockInfo[];
|
|
121
121
|
mediaInfoList?: MediaInfoRecord[];
|
|
122
122
|
localOperateRecordInfo?: LocalOperateRecordInfo;
|
|
123
|
+
localOperateRecord?: LocalOperateRecordInfo;
|
|
123
124
|
data?: boolean | number | string;
|
|
124
125
|
dpId: number;
|
|
125
126
|
matterRecordInfo?: {
|
package/lib/api/video.d.ts
CHANGED
package/lib/constant.d.ts
CHANGED
package/lib/constant.js
CHANGED
|
@@ -71,6 +71,7 @@ export var LocalOperateUserType;
|
|
|
71
71
|
LocalOperateUserType[LocalOperateUserType["ADMIN"] = 1] = "ADMIN";
|
|
72
72
|
LocalOperateUserType[LocalOperateUserType["SPECIAL_USER"] = 2] = "SPECIAL_USER";
|
|
73
73
|
LocalOperateUserType[LocalOperateUserType["NORMAL_USER"] = 3] = "NORMAL_USER";
|
|
74
|
+
LocalOperateUserType[LocalOperateUserType["UNKNOW"] = 255] = "UNKNOW";
|
|
74
75
|
})(LocalOperateUserType || (LocalOperateUserType = {}));
|
|
75
76
|
export var LocalOperateCategory;
|
|
76
77
|
(function (LocalOperateCategory) {
|
package/lib/feature/log/log.js
CHANGED
|
@@ -36,6 +36,9 @@ function handleLockLogs(list, cfg) {
|
|
|
36
36
|
catch {
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
if (type === "setting" && item.logType === "lock_local_record") {
|
|
40
|
+
type = "local_operation";
|
|
41
|
+
}
|
|
39
42
|
let userName = item.userName;
|
|
40
43
|
let unlockName = item.unlockName;
|
|
41
44
|
let tempPwdInfo = undefined;
|
|
@@ -167,7 +170,7 @@ function handleLockLogs(list, cfg) {
|
|
|
167
170
|
position: item.position,
|
|
168
171
|
};
|
|
169
172
|
}),
|
|
170
|
-
localRecord: handleLocalOperation(item.localOperateRecordInfo, itemData),
|
|
173
|
+
localRecord: handleLocalOperation(item.localOperateRecordInfo || item.localOperateRecord, itemData),
|
|
171
174
|
unionUnlockInfo: item.unionUnlockInfo?.map((item1) => {
|
|
172
175
|
return {
|
|
173
176
|
userId: item1.userId,
|
|
@@ -299,7 +302,7 @@ export async function getLogsForRuntime(rt, params) {
|
|
|
299
302
|
dpCode,
|
|
300
303
|
userName,
|
|
301
304
|
unlockName,
|
|
302
|
-
mediaInfo: record.mediaInfoList?.map?.(item => {
|
|
305
|
+
mediaInfo: record.mediaInfoList?.map?.((item) => {
|
|
303
306
|
return {
|
|
304
307
|
mediaPath: item.mediaPath,
|
|
305
308
|
fileKey: item.fileKey,
|
|
@@ -391,7 +394,7 @@ export async function getAlarmsForRuntime(rt, params) {
|
|
|
391
394
|
dpCode,
|
|
392
395
|
userName: record.userName,
|
|
393
396
|
unlockName: record.unlockName,
|
|
394
|
-
mediaInfo: record.mediaInfoList?.map?.(item => {
|
|
397
|
+
mediaInfo: record.mediaInfoList?.map?.((item) => {
|
|
395
398
|
return {
|
|
396
399
|
mediaPath: item.mediaPath,
|
|
397
400
|
fileKey: item.fileKey,
|
|
@@ -4,8 +4,7 @@ import { checkShowMatterMutilpleShare } from "../../platform/device";
|
|
|
4
4
|
import { ipc } from "../../platform";
|
|
5
5
|
import { getWithLocalCache } from "../storage/swr-cache";
|
|
6
6
|
import { getVideoResolutionMark } from "../../api/video";
|
|
7
|
-
import
|
|
8
|
-
import { hasDpForRuntime } from "../dp/has-dp";
|
|
7
|
+
import { sdkLog } from "../../utils/sdk-log";
|
|
9
8
|
export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
|
|
10
9
|
export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
|
|
11
10
|
rt.config.communication.length === 1;
|
|
@@ -82,15 +81,14 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
82
81
|
])),
|
|
83
82
|
getWithLocalCache(rt, "deviceAdvancedAbility", () => getDeviceAdvancedAbility(devId)),
|
|
84
83
|
ipc.getTTTAbilityKeyList("isSupportedVRMode"),
|
|
85
|
-
|
|
86
|
-
? getWithLocalCache(rt, "videoResolutionMark", () => getVideoResolutionMark(devId))
|
|
87
|
-
: Promise.resolve({
|
|
88
|
-
capability: [],
|
|
89
|
-
cloudCapability: [],
|
|
90
|
-
}),
|
|
84
|
+
getWithLocalCache(rt, "videoResolutionMark", () => getVideoResolutionMark(devId)),
|
|
91
85
|
]);
|
|
92
86
|
const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
|
|
93
87
|
const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
|
|
88
|
+
sdkLog("info", "advancedAbilities", "supportVR", {
|
|
89
|
+
devId,
|
|
90
|
+
data: { tttAbList },
|
|
91
|
+
});
|
|
94
92
|
const videoMark = videoMarkRes.status === "fulfilled"
|
|
95
93
|
? videoMarkRes.value
|
|
96
94
|
: { capability: [], cloudCapability: [] };
|
|
@@ -98,6 +96,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
98
96
|
videoConfig: {
|
|
99
97
|
isLowResolution: videoMark?.cloudCapability?.includes("tyabig3wt9"),
|
|
100
98
|
isHighResolution: videoMark?.cloudCapability?.includes("tyabixkep7"),
|
|
99
|
+
isSpecial: videoMark?.cloudCapability?.includes("tyabifck5x"),
|
|
101
100
|
},
|
|
102
101
|
cloudStorage: {
|
|
103
102
|
support: false,
|
|
@@ -221,7 +220,11 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
221
220
|
}
|
|
222
221
|
}
|
|
223
222
|
catch (error) {
|
|
224
|
-
|
|
223
|
+
sdkLog("error", "advancedAbilities", "parseCode Error", {
|
|
224
|
+
devId,
|
|
225
|
+
data: { code: item.abilityCode },
|
|
226
|
+
error,
|
|
227
|
+
});
|
|
225
228
|
}
|
|
226
229
|
});
|
|
227
230
|
if (deviceAdvancedAbilityRes.status === "fulfilled") {
|
|
@@ -17,8 +17,9 @@ import { fetchDeviceProperties } from "./remote-permissions";
|
|
|
17
17
|
import { ipc, yuChannelSyncSingleSync } from "../../platform";
|
|
18
18
|
import { sdkLog } from "../../utils/sdk-log";
|
|
19
19
|
import { ProductCommunicationType, RotateType } from "../../constant";
|
|
20
|
-
import { isHarmony } from "../../utils";
|
|
20
|
+
import { isHarmony, isVirtualDevice } from "../../utils";
|
|
21
21
|
import { getError } from "../../utils/errors";
|
|
22
|
+
import { isSupportMediaForRuntime } from "../media/media";
|
|
22
23
|
export const initState = async (runtime) => {
|
|
23
24
|
const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
|
|
24
25
|
const startedAt = Date.now();
|
|
@@ -57,12 +58,7 @@ export const initState = async (runtime) => {
|
|
|
57
58
|
angle: 0,
|
|
58
59
|
actualAngle: 0,
|
|
59
60
|
}),
|
|
60
|
-
|
|
61
|
-
? getWithLocalCache(runtime, "deviceSkill", () => getDeviceSkill(devId))
|
|
62
|
-
: Promise.resolve({
|
|
63
|
-
devId,
|
|
64
|
-
json: { videos: [{ width: 0, height: 0 }] },
|
|
65
|
-
}),
|
|
61
|
+
getWithLocalCache(runtime, "deviceSkill", () => getDeviceSkill(devId)),
|
|
66
62
|
isSupportVideo
|
|
67
63
|
? getWithLocalCache(runtime, "ipcConfig", () => getIPCConfig(devId))
|
|
68
64
|
: Promise.resolve({
|
|
@@ -75,6 +71,14 @@ export const initState = async (runtime) => {
|
|
|
75
71
|
if (userInfoResult.status === "rejected") {
|
|
76
72
|
throw userInfoResult.reason;
|
|
77
73
|
}
|
|
74
|
+
if (deviceSkill.status === "fulfilled") {
|
|
75
|
+
runtime.config.mediaWidth =
|
|
76
|
+
deviceSkill.value?.json?.videos?.[0]?.width ?? 0;
|
|
77
|
+
runtime.config.mediaHeight =
|
|
78
|
+
deviceSkill.value?.json?.videos?.[0]?.height ?? 0;
|
|
79
|
+
runtime.config.deviceSkill.cloudP2P =
|
|
80
|
+
deviceSkill.value?.json?.cloudP2P || 0;
|
|
81
|
+
}
|
|
78
82
|
if (advanceAbilities.status === "fulfilled") {
|
|
79
83
|
const abilities = advanceAbilities.value;
|
|
80
84
|
sdkLog("debug", "initState", "advancedAbilitiesFetched", {
|
|
@@ -84,11 +88,17 @@ export const initState = async (runtime) => {
|
|
|
84
88
|
yuChannelValue: abilities.yuChannel.value,
|
|
85
89
|
},
|
|
86
90
|
});
|
|
87
|
-
if (
|
|
91
|
+
if (isSupportMediaForRuntime(runtime) &&
|
|
92
|
+
!isVirtualDevice(devId) &&
|
|
88
93
|
!abilities.videoConfig.isHighResolution &&
|
|
89
94
|
!abilities.videoConfig.isLowResolution) {
|
|
90
95
|
throw getError(1107);
|
|
91
96
|
}
|
|
97
|
+
if (!isSupportVideo &&
|
|
98
|
+
runtime.config.deviceSkill.cloudP2P === 1 &&
|
|
99
|
+
!abilities.videoConfig.isSpecial) {
|
|
100
|
+
throw getError(1109);
|
|
101
|
+
}
|
|
92
102
|
if (abilities.yuChannel.support) {
|
|
93
103
|
if (abilities.yuChannel.value === 1) {
|
|
94
104
|
sdkLog("debug", "initState", "yuChannelSync", {
|
|
@@ -115,12 +125,6 @@ export const initState = async (runtime) => {
|
|
|
115
125
|
runtime.config.imageAngle = isSEI ? 0 : rotateInfo.value.angle;
|
|
116
126
|
runtime.config.videoAngle = isSEI ? 0 : rotateInfo.value.actualAngle;
|
|
117
127
|
}
|
|
118
|
-
if (deviceSkill.status === "fulfilled") {
|
|
119
|
-
runtime.config.mediaWidth =
|
|
120
|
-
deviceSkill.value?.json?.videos?.[0]?.width ?? 0;
|
|
121
|
-
runtime.config.mediaHeight =
|
|
122
|
-
deviceSkill.value?.json?.videos?.[0]?.height ?? 0;
|
|
123
|
-
}
|
|
124
128
|
if (ipcConfig.status === "fulfilled" &&
|
|
125
129
|
ipcConfig.value?.audioAttributes?.hardwareCapability?.includes(2)) {
|
|
126
130
|
runtime.config.supportTalk = true;
|
package/lib/interface.d.ts
CHANGED
|
@@ -27,6 +27,9 @@ export type LockConfigState = {
|
|
|
27
27
|
cameraConfig: CameraConfig[];
|
|
28
28
|
notSupportWake: boolean;
|
|
29
29
|
isFitting: boolean;
|
|
30
|
+
deviceSkill: {
|
|
31
|
+
cloudP2P: 0 | 1;
|
|
32
|
+
};
|
|
30
33
|
};
|
|
31
34
|
export declare function createDefaultDeviceStatus(): DeviceStatus;
|
|
32
35
|
export declare function createLockConfigState(): LockConfigState;
|
package/lib/utils/errors.js
CHANGED
|
@@ -108,6 +108,7 @@ const errors = {
|
|
|
108
108
|
1106: "No validity configuration data",
|
|
109
109
|
1107: "Invalid device, please re-authorize",
|
|
110
110
|
1108: "Failed to get configuration",
|
|
111
|
+
1109: "Invalid device, please re-authorize",
|
|
111
112
|
};
|
|
112
113
|
export const getError = (code, ...places) => {
|
|
113
114
|
if (errors[code]) {
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
package/lib/utils/sdk-log.js
CHANGED