connectfy-shared 0.0.96 → 0.0.97
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 +20 -5
- package/dist/index.mjs +20 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11525,17 +11525,26 @@ var BaseRepository = class {
|
|
|
11525
11525
|
populate = []
|
|
11526
11526
|
} = params;
|
|
11527
11527
|
const virtuals = opts?.lean ?? true;
|
|
11528
|
-
|
|
11528
|
+
if (virtuals) {
|
|
11529
|
+
return await this.model.findOne(query).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11530
|
+
}
|
|
11531
|
+
return await this.model.findOne(query).select(fields).sort(sort).populate(populate).exec();
|
|
11529
11532
|
}
|
|
11530
11533
|
async findOneById(_id, params = {}, opts) {
|
|
11531
11534
|
const { fields = "", sort = { createdAt: -1 }, populate = [] } = params;
|
|
11532
11535
|
const virtuals = opts?.lean ?? true;
|
|
11533
|
-
|
|
11536
|
+
if (virtuals) {
|
|
11537
|
+
return await this.model.findOne({ _id }).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11538
|
+
}
|
|
11539
|
+
return await this.model.findOne({ _id }).select(fields).sort(sort).populate(populate).exec();
|
|
11534
11540
|
}
|
|
11535
11541
|
async findOneByUserId(userId, params = {}, opts) {
|
|
11536
11542
|
const { fields = "", sort = { createdAt: -1 }, populate = [] } = params;
|
|
11537
11543
|
const virtuals = opts?.lean ?? true;
|
|
11538
|
-
|
|
11544
|
+
if (virtuals) {
|
|
11545
|
+
return await this.model.findOne({ userId }).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11546
|
+
}
|
|
11547
|
+
return await this.model.findOne({ userId }).select(fields).sort(sort).populate(populate).exec();
|
|
11539
11548
|
}
|
|
11540
11549
|
async findMany(params = {}, opts) {
|
|
11541
11550
|
const {
|
|
@@ -11547,7 +11556,10 @@ var BaseRepository = class {
|
|
|
11547
11556
|
limit = 10
|
|
11548
11557
|
} = params;
|
|
11549
11558
|
const virtuals = opts?.lean ?? true;
|
|
11550
|
-
|
|
11559
|
+
if (virtuals) {
|
|
11560
|
+
return await this.model.find(query).select(fields).skip(skip).limit(limit).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11561
|
+
}
|
|
11562
|
+
return await this.model.find(query).select(fields).skip(skip).limit(limit).sort(sort).populate(populate).exec();
|
|
11551
11563
|
}
|
|
11552
11564
|
async findAll(params = {}, opts) {
|
|
11553
11565
|
const {
|
|
@@ -11557,7 +11569,10 @@ var BaseRepository = class {
|
|
|
11557
11569
|
populate = []
|
|
11558
11570
|
} = params;
|
|
11559
11571
|
const virtuals = opts?.lean ?? true;
|
|
11560
|
-
|
|
11572
|
+
if (virtuals) {
|
|
11573
|
+
return await this.model.find(query).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11574
|
+
}
|
|
11575
|
+
return await this.model.find(query).select(fields).sort(sort).populate(populate).exec();
|
|
11561
11576
|
}
|
|
11562
11577
|
// ================================================
|
|
11563
11578
|
// EXIST AND COUNT FUNCTIONS
|
package/dist/index.mjs
CHANGED
|
@@ -11480,17 +11480,26 @@ var BaseRepository = class {
|
|
|
11480
11480
|
populate = []
|
|
11481
11481
|
} = params;
|
|
11482
11482
|
const virtuals = opts?.lean ?? true;
|
|
11483
|
-
|
|
11483
|
+
if (virtuals) {
|
|
11484
|
+
return await this.model.findOne(query).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11485
|
+
}
|
|
11486
|
+
return await this.model.findOne(query).select(fields).sort(sort).populate(populate).exec();
|
|
11484
11487
|
}
|
|
11485
11488
|
async findOneById(_id, params = {}, opts) {
|
|
11486
11489
|
const { fields = "", sort = { createdAt: -1 }, populate = [] } = params;
|
|
11487
11490
|
const virtuals = opts?.lean ?? true;
|
|
11488
|
-
|
|
11491
|
+
if (virtuals) {
|
|
11492
|
+
return await this.model.findOne({ _id }).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11493
|
+
}
|
|
11494
|
+
return await this.model.findOne({ _id }).select(fields).sort(sort).populate(populate).exec();
|
|
11489
11495
|
}
|
|
11490
11496
|
async findOneByUserId(userId, params = {}, opts) {
|
|
11491
11497
|
const { fields = "", sort = { createdAt: -1 }, populate = [] } = params;
|
|
11492
11498
|
const virtuals = opts?.lean ?? true;
|
|
11493
|
-
|
|
11499
|
+
if (virtuals) {
|
|
11500
|
+
return await this.model.findOne({ userId }).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11501
|
+
}
|
|
11502
|
+
return await this.model.findOne({ userId }).select(fields).sort(sort).populate(populate).exec();
|
|
11494
11503
|
}
|
|
11495
11504
|
async findMany(params = {}, opts) {
|
|
11496
11505
|
const {
|
|
@@ -11502,7 +11511,10 @@ var BaseRepository = class {
|
|
|
11502
11511
|
limit = 10
|
|
11503
11512
|
} = params;
|
|
11504
11513
|
const virtuals = opts?.lean ?? true;
|
|
11505
|
-
|
|
11514
|
+
if (virtuals) {
|
|
11515
|
+
return await this.model.find(query).select(fields).skip(skip).limit(limit).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11516
|
+
}
|
|
11517
|
+
return await this.model.find(query).select(fields).skip(skip).limit(limit).sort(sort).populate(populate).exec();
|
|
11506
11518
|
}
|
|
11507
11519
|
async findAll(params = {}, opts) {
|
|
11508
11520
|
const {
|
|
@@ -11512,7 +11524,10 @@ var BaseRepository = class {
|
|
|
11512
11524
|
populate = []
|
|
11513
11525
|
} = params;
|
|
11514
11526
|
const virtuals = opts?.lean ?? true;
|
|
11515
|
-
|
|
11527
|
+
if (virtuals) {
|
|
11528
|
+
return await this.model.find(query).select(fields).sort(sort).populate(populate).lean({ virtuals, versionKey: false }).exec();
|
|
11529
|
+
}
|
|
11530
|
+
return await this.model.find(query).select(fields).sort(sort).populate(populate).exec();
|
|
11516
11531
|
}
|
|
11517
11532
|
// ================================================
|
|
11518
11533
|
// EXIST AND COUNT FUNCTIONS
|