@librechat/data-schemas 0.0.16 → 0.0.18

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.cjs CHANGED
@@ -1276,6 +1276,7 @@ const userSchema = new mongoose.Schema({
1276
1276
  },
1277
1277
  backupCodes: {
1278
1278
  type: [BackupCodeSchema],
1279
+ select: false,
1279
1280
  },
1280
1281
  refreshToken: {
1281
1282
  type: [SessionSchema],
@@ -4631,114 +4632,6 @@ function createAclEntryMethods(mongoose$1) {
4631
4632
  };
4632
4633
  }
4633
4634
 
4634
- function createGroupMethods(mongoose) {
4635
- /**
4636
- * Find a group by its ID
4637
- * @param groupId - The group ID
4638
- * @returns The group document or null if not found
4639
- */
4640
- async function findGroupById(groupId) {
4641
- const Group = mongoose.models.Group;
4642
- return await Group.findById(groupId).lean();
4643
- }
4644
- /**
4645
- * Create a new group
4646
- * @param groupData - Group data including name, source, and optional fields
4647
- * @returns The created group
4648
- */
4649
- async function createGroup(groupData) {
4650
- const Group = mongoose.models.Group;
4651
- return await Group.create(groupData);
4652
- }
4653
- /**
4654
- * Update an existing group
4655
- * @param groupId - The ID of the group to update
4656
- * @param updateData - Data to update
4657
- * @returns The updated group document or null if not found
4658
- */
4659
- async function updateGroup(groupId, updateData) {
4660
- const Group = mongoose.models.Group;
4661
- return await Group.findByIdAndUpdate(groupId, { $set: updateData }, { new: true }).lean();
4662
- }
4663
- /**
4664
- * Delete a group
4665
- * @param groupId - The ID of the group to delete
4666
- * @returns The result of the delete operation
4667
- */
4668
- async function deleteGroup(groupId) {
4669
- const Group = mongoose.models.Group;
4670
- return await Group.deleteOne({ _id: groupId });
4671
- }
4672
- /**
4673
- * Find all groups
4674
- * @returns Array of all group documents
4675
- */
4676
- async function getAllGroups() {
4677
- const Group = mongoose.models.Group;
4678
- return await Group.find().lean();
4679
- }
4680
- /**
4681
- * Find groups by source
4682
- * @param source - The source ('local' or 'entra')
4683
- * @returns Array of group documents
4684
- */
4685
- async function findGroupsBySource(source) {
4686
- const Group = mongoose.models.Group;
4687
- return await Group.find({ source }).lean();
4688
- }
4689
- /**
4690
- * Find a group by its external ID
4691
- * @param idOnTheSource - The external ID
4692
- * @param source - The source ('entra' or 'local')
4693
- * @returns The group document or null if not found
4694
- */
4695
- async function findGroupByExternalId(idOnTheSource, source = 'entra') {
4696
- const Group = mongoose.models.Group;
4697
- return await Group.findOne({ idOnTheSource, source }).lean();
4698
- }
4699
- /**
4700
- * Add a member to a group
4701
- * @param groupId - The group ID
4702
- * @param memberId - The member ID to add (idOnTheSource value)
4703
- * @returns The updated group or null if not found
4704
- */
4705
- async function addMemberToGroup(groupId, memberId) {
4706
- const Group = mongoose.models.Group;
4707
- return await Group.findByIdAndUpdate(groupId, { $addToSet: { memberIds: memberId } }, { new: true }).lean();
4708
- }
4709
- /**
4710
- * Remove a member from a group
4711
- * @param groupId - The group ID
4712
- * @param memberId - The member ID to remove (idOnTheSource value)
4713
- * @returns The updated group or null if not found
4714
- */
4715
- async function removeMemberFromGroup(groupId, memberId) {
4716
- const Group = mongoose.models.Group;
4717
- return await Group.findByIdAndUpdate(groupId, { $pull: { memberIds: memberId } }, { new: true }).lean();
4718
- }
4719
- /**
4720
- * Find all groups that contain a specific member
4721
- * @param memberId - The member ID (idOnTheSource value)
4722
- * @returns Array of groups containing the member
4723
- */
4724
- async function findGroupsByMemberId(memberId) {
4725
- const Group = mongoose.models.Group;
4726
- return await Group.find({ memberIds: memberId }).lean();
4727
- }
4728
- return {
4729
- createGroup,
4730
- updateGroup,
4731
- deleteGroup,
4732
- getAllGroups,
4733
- findGroupById,
4734
- addMemberToGroup,
4735
- findGroupsBySource,
4736
- removeMemberFromGroup,
4737
- findGroupsByMemberId,
4738
- findGroupByExternalId,
4739
- };
4740
- }
4741
-
4742
4635
  class ShareServiceError extends Error {
4743
4636
  constructor(message, code) {
4744
4637
  super(message);
@@ -5113,7 +5006,6 @@ function createMethods(mongoose) {
5113
5006
  ...createAccessRoleMethods(mongoose),
5114
5007
  ...createUserGroupMethods(mongoose),
5115
5008
  ...createAclEntryMethods(mongoose),
5116
- ...createGroupMethods(mongoose),
5117
5009
  ...createShareMethods(mongoose),
5118
5010
  ...createPluginAuthMethods(mongoose),
5119
5011
  };