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