@7365admin1/core 3.68.1 → 3.68.2

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/dist/index.mjs CHANGED
@@ -9073,6 +9073,9 @@ import { BadRequestError as BadRequestError12 } from "@7365admin1/node-server-ut
9073
9073
  import Joi7 from "joi";
9074
9074
  import { ObjectId as ObjectId12 } from "mongodb";
9075
9075
  var PLATFORM_STAFF_MEMBER_TYPE = "admin";
9076
+ function isDuplicateMemberError(error) {
9077
+ return error?.code === 11e3 || /E11000|duplicate key/i.test(error?.message ?? "");
9078
+ }
9076
9079
  var MEMBER_TYPES = [
9077
9080
  PLATFORM_STAFF_MEMBER_TYPE,
9078
9081
  "organization",
@@ -9226,8 +9229,7 @@ function useMemberRepo() {
9226
9229
  });
9227
9230
  return "Successfully added member.";
9228
9231
  } catch (error) {
9229
- const isDuplicated = error.message.includes("duplicate");
9230
- if (isDuplicated && error.message.includes("org_1_user_1"))
9232
+ if (isDuplicateMemberError(error))
9231
9233
  throw new BadRequestError13(
9232
9234
  "The user is already a member of this organization."
9233
9235
  );
@@ -96921,6 +96923,7 @@ export {
96921
96923
  incidents_namespace_collection,
96922
96924
  invitationOffersRole,
96923
96925
  isCameraEntitled,
96926
+ isDuplicateMemberError,
96924
96927
  isDuplicateVersionError,
96925
96928
  isLikelySelfServiceEmail,
96926
96929
  isPatrolCctvCamera,