@ray-js/lock-sdk 1.1.1-beta.4 → 1.1.1-beta.5
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.js +2 -2
- package/lib/config/dp-map/common.js +1 -1
- package/lib/interface.d.ts +1 -0
- package/lib/sync/temp.js +1 -1
- package/lib/temporary.js +1 -1
- package/lib/unlock-method.js +2 -1
- package/lib/user.js +28 -27
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +2 -1
- package/package.json +1 -1
package/lib/api/user.js
CHANGED
|
@@ -40,8 +40,8 @@ export const getUserList = (params) => {
|
|
|
40
40
|
};
|
|
41
41
|
export const getUserDetail = (params) => {
|
|
42
42
|
return requestApi({
|
|
43
|
-
api:
|
|
44
|
-
version: "
|
|
43
|
+
api: 'm.lock.device.member.detail',
|
|
44
|
+
version: "1.0",
|
|
45
45
|
data: params,
|
|
46
46
|
});
|
|
47
47
|
};
|
|
@@ -52,7 +52,7 @@ export const validConfigDpMap = {
|
|
|
52
52
|
.slice(0, 7);
|
|
53
53
|
},
|
|
54
54
|
format: (value) => {
|
|
55
|
-
const weekHex = parseInt(value.reverse().join(""), 2)
|
|
55
|
+
const weekHex = parseInt([...value].reverse().join(""), 2)
|
|
56
56
|
.toString(16)
|
|
57
57
|
.padStart(2, "0");
|
|
58
58
|
return `000000${weekHex}`;
|
package/lib/interface.d.ts
CHANGED
package/lib/sync/temp.js
CHANGED
package/lib/temporary.js
CHANGED
|
@@ -83,7 +83,7 @@ export const createTempCustom = parallelOnly(async (params) => {
|
|
|
83
83
|
endTime: effective.expiredDate,
|
|
84
84
|
loop: loopType,
|
|
85
85
|
loopConfig: 0,
|
|
86
|
-
weeks: effective.weeks ?
|
|
86
|
+
weeks: effective.weeks ? effective.weeks : [0, 0, 0, 0, 0, 0, 0],
|
|
87
87
|
days: [],
|
|
88
88
|
startHour: Math.floor(effectiveTime / 60),
|
|
89
89
|
startMinute: effectiveTime % 60,
|
package/lib/unlock-method.js
CHANGED
|
@@ -31,6 +31,7 @@ export const getUnlockMethodDetail = async (id) => {
|
|
|
31
31
|
});
|
|
32
32
|
const detail = {
|
|
33
33
|
isBound: cloudData.allocateFlag === 1,
|
|
34
|
+
type: getUnlockMethodTypeByDpCode(config.codesById[Number(cloudData.opmode)])?.type,
|
|
34
35
|
phase: cloudData.phase,
|
|
35
36
|
dpId: Number(cloudData.opmode),
|
|
36
37
|
isSpecial: cloudData.unlockAttr === 1,
|
|
@@ -50,7 +51,7 @@ export const getUnlockMethodDetail = async (id) => {
|
|
|
50
51
|
return detail;
|
|
51
52
|
};
|
|
52
53
|
const getUnlockMethodBase = async (type, userId) => {
|
|
53
|
-
const { idsByCode, devInfo: { devId }, supportBigData,
|
|
54
|
+
const { idsByCode, devInfo: { devId }, supportBigData, } = config;
|
|
54
55
|
const unlockMethodConfig = getUnlockMethodTypeByType(type);
|
|
55
56
|
const addDpCode = supportBigData
|
|
56
57
|
? dpCodes.unlockMethodCreateW
|
package/lib/user.js
CHANGED
|
@@ -23,7 +23,8 @@ const concactUserList = (list, result) => {
|
|
|
23
23
|
if (!item.timeScheduleInfo.permanent &&
|
|
24
24
|
item.timeScheduleInfo.scheduleDetails &&
|
|
25
25
|
item.timeScheduleInfo.scheduleDetails.length > 0) {
|
|
26
|
-
Object.assign(
|
|
26
|
+
Object.assign(scheduleInfo, {
|
|
27
|
+
permanent: false,
|
|
27
28
|
effectiveTime: formatTimestampToMilliseconds(item.timeScheduleInfo.effectiveTime || 0),
|
|
28
29
|
expiredTime: formatTimestampToMilliseconds(item.timeScheduleInfo.expiredTime || 0),
|
|
29
30
|
scheduleDetails: {
|
|
@@ -145,7 +146,7 @@ export const updateUserLimitTime = async (params) => {
|
|
|
145
146
|
loopConfig: 0,
|
|
146
147
|
weeks: effective?.repeat !== "week" || effective?.weeks === undefined
|
|
147
148
|
? [0, 0, 0, 0, 0, 0, 0]
|
|
148
|
-
:
|
|
149
|
+
: effective.weeks,
|
|
149
150
|
days: [],
|
|
150
151
|
startHour: Math.floor(effectiveTime / 60),
|
|
151
152
|
startMinute: effectiveTime % 60,
|
|
@@ -153,33 +154,33 @@ export const updateUserLimitTime = async (params) => {
|
|
|
153
154
|
endMinute: expiredTime % 60,
|
|
154
155
|
},
|
|
155
156
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (result.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
157
|
+
try {
|
|
158
|
+
const dpCode = config.supportBigData
|
|
159
|
+
? dpCodes.unlockMethodEditW
|
|
160
|
+
: dpCodes.unlockMethodEdit;
|
|
161
|
+
const res = (await publishDps({
|
|
162
|
+
[dpCode]: DpUtils.format(dpValue, (config.supportBigData ? updateMapBig : updateMap)),
|
|
163
|
+
}, {
|
|
164
|
+
checkReport: (dps) => {
|
|
165
|
+
if (typeof dps[dpCode] !== "undefined") {
|
|
166
|
+
const result = DpUtils.parse(dps[dpCode], (config.supportBigData
|
|
167
|
+
? reportUpdateMapBig
|
|
168
|
+
: reportUpdateMap));
|
|
169
|
+
if (result.type === 0) {
|
|
170
|
+
if (result.memberId === lockUserId) {
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
console.warn("An incorrect member id was returned");
|
|
175
|
+
}
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
178
|
+
return false;
|
|
179
|
+
},
|
|
180
|
+
}));
|
|
181
|
+
if (res.status !== 255) {
|
|
182
|
+
throw getError(1011);
|
|
183
|
+
}
|
|
183
184
|
await updateUserTimeSchedule({
|
|
184
185
|
devId: config.devInfo.devId,
|
|
185
186
|
userId: userId,
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare const parseOfflinePassword: (value: string) => string;
|
|
|
107
107
|
export declare const formatTimestampToMilliseconds: (timestamp: number) => number;
|
|
108
108
|
export declare const unlockMethodConfigs: UnlockMethodConfig[];
|
|
109
109
|
export declare const getUnlockMethodTypeByDpCode: (dpCode: string) => UnlockMethodConfig;
|
|
110
|
-
export declare const getUnlockMethodTypeById: (id: number) => UnlockMethodConfig;
|
|
110
|
+
export declare const getUnlockMethodTypeById: (id: number | string) => UnlockMethodConfig;
|
|
111
111
|
export declare const getUnlockMethodTypeByType: (type: string) => UnlockMethodConfig;
|
|
112
112
|
export declare const parallelMerge: <T extends (...args: any[]) => Promise<any>>(cb: T) => (...args: Parameters<T>) => ReturnType<T>;
|
|
113
113
|
export declare const parallelOnly: <T extends (...args: any[]) => Promise<any>>(cb: T) => (...args: Parameters<T>) => ReturnType<T>;
|
package/lib/utils/index.js
CHANGED
|
@@ -49,7 +49,8 @@ export function getCapabilities(capability) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
export const formatWeek = (value) => {
|
|
52
|
-
|
|
52
|
+
const temp = value.slice(0, 7);
|
|
53
|
+
return parseInt(temp.reverse().join(""), 2);
|
|
53
54
|
};
|
|
54
55
|
export const parseWeek = (value) => {
|
|
55
56
|
return Number(value)
|