@ray-js/lock-sdk 1.1.1-beta.8 → 1.1.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.
@@ -65,6 +65,9 @@ const errors = {
65
65
  1064: "Non-thread device, not supported in LAN connection to open and close locks",
66
66
  1065: "Cloud side has been deleted, but device side synchronization deletion failed",
67
67
  1066: "Phone number cannot be empty",
68
+ 1067: "Password limit reached within this period",
69
+ 1068: "There is already a member with the same name",
70
+ 1069: "No permission to modify member validity",
68
71
  };
69
72
  export const getError = (code, ...places) => {
70
73
  if (errors[code]) {
@@ -84,3 +87,36 @@ export const getError = (code, ...places) => {
84
87
  errorMsg: "unknow error",
85
88
  };
86
89
  };
90
+ export const handleCloudError = (err, code) => {
91
+ if (err?.innerError?.errorCode) {
92
+ let error;
93
+ switch (err.innerError.errorCode) {
94
+ case "USER_PWD_ALREADY_EXIST":
95
+ error = getError(1037);
96
+ break;
97
+ case "LOCK_PWD_NAME_REPEAT":
98
+ case "OFFLINE_PWD_NAME_REPEAT":
99
+ error = getError(1038);
100
+ break;
101
+ case "START_END_DATE_NOT_RIGHT":
102
+ error = getError(1039);
103
+ break;
104
+ case "RECORD_NOT_EXIST":
105
+ error = getError(1040);
106
+ break;
107
+ case "OFFLINE_PWD_EXAUST_IN_PERIOD":
108
+ error = getError(1067);
109
+ break;
110
+ default:
111
+ }
112
+ if (error) {
113
+ error.errorMsg = err.innerError.errorMsg;
114
+ error.innerError = err.innerError;
115
+ throw error;
116
+ }
117
+ }
118
+ if (code) {
119
+ throw getError(code);
120
+ }
121
+ throw err;
122
+ };
@@ -62,9 +62,8 @@ export const parseWeek = (value) => {
62
62
  .slice(0, 7);
63
63
  };
64
64
  export const getPermanentSetting = () => {
65
- const now = Math.floor(+new Date() / 1000);
66
65
  return {
67
- startTime: now,
66
+ startTime: 0x386cd300,
68
67
  endTime: 0x72bc9b7f,
69
68
  loop: LoopTypes.NONE,
70
69
  loopConfig: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.1.1-beta.8",
3
+ "version": "1.1.1",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"