@ray-js/lock-sdk 1.1.1-beta.10 → 1.1.1-beta.11
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/user.d.ts +1 -1
- package/lib/user.js +12 -4
- package/lib/utils/errors.js +1 -0
- package/package.json +1 -1
package/lib/user.d.ts
CHANGED
|
@@ -45,6 +45,6 @@ export declare const openFamilyUserDetail: (userId: string) => Promise<undefined
|
|
|
45
45
|
interface AddUserParams {
|
|
46
46
|
name: string;
|
|
47
47
|
}
|
|
48
|
-
export declare const addUser: (params: AddUserParams) => Promise<
|
|
48
|
+
export declare const addUser: (params: AddUserParams) => Promise<void>;
|
|
49
49
|
export declare const removeUser: (userId: string) => Promise<void>;
|
|
50
50
|
export {};
|
package/lib/user.js
CHANGED
|
@@ -259,10 +259,18 @@ export const addUser = async (params) => {
|
|
|
259
259
|
if (!params.name) {
|
|
260
260
|
throw getError(1009, "name");
|
|
261
261
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
try {
|
|
263
|
+
await addNormalUser({
|
|
264
|
+
devId: config.devInfo.devId,
|
|
265
|
+
name: params.name,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
catch (e) {
|
|
269
|
+
if (e?.innerError?.errorCode === "DEFINITION_PARAM_NAME_REPEAT") {
|
|
270
|
+
throw getError(1068);
|
|
271
|
+
}
|
|
272
|
+
throw e;
|
|
273
|
+
}
|
|
266
274
|
};
|
|
267
275
|
export const removeUser = async (userId) => {
|
|
268
276
|
if (!config.supportBigData) {
|
package/lib/utils/errors.js
CHANGED
|
@@ -66,6 +66,7 @@ const errors = {
|
|
|
66
66
|
1065: "Cloud side has been deleted, but device side synchronization deletion failed",
|
|
67
67
|
1066: "Phone number cannot be empty",
|
|
68
68
|
1067: "Password limit reached within this period",
|
|
69
|
+
1068: "There is already a member with the same name",
|
|
69
70
|
};
|
|
70
71
|
export const getError = (code, ...places) => {
|
|
71
72
|
if (errors[code]) {
|