elseware-nodejs 1.8.2 → 1.8.3
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 +71 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -30
- package/dist/index.d.ts +67 -30
- package/dist/index.js +72 -55
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -1817,45 +1817,82 @@ declare const GlobalErrorHandler: (isProd?: boolean) => (err: unknown, _req: Req
|
|
|
1817
1817
|
|
|
1818
1818
|
declare const validate: (schema: Schema) => (req: Request, _res: Response, next: NextFunction) => void;
|
|
1819
1819
|
|
|
1820
|
+
type Filter<T> = Partial<Record<keyof T, unknown>>;
|
|
1821
|
+
type Select<T> = (keyof T)[] | Partial<Record<keyof T, 0 | 1>>;
|
|
1822
|
+
type Sort<T> = Partial<Record<keyof T, 1 | -1>>;
|
|
1823
|
+
|
|
1824
|
+
interface IQueryOptions<T> {
|
|
1825
|
+
select?: Select<T>;
|
|
1826
|
+
sort?: Sort<T>;
|
|
1827
|
+
limit?: number;
|
|
1828
|
+
skip?: number;
|
|
1829
|
+
}
|
|
1830
|
+
interface IUpdateQueryOptions {
|
|
1831
|
+
new?: boolean;
|
|
1832
|
+
runValidators: boolean;
|
|
1833
|
+
upsert?: boolean;
|
|
1834
|
+
}
|
|
1820
1835
|
interface IRepository<T> {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1836
|
+
/**
|
|
1837
|
+
* Create
|
|
1838
|
+
*/
|
|
1824
1839
|
create(data: Partial<T>): Promise<T>;
|
|
1825
|
-
|
|
1840
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1841
|
+
/**
|
|
1842
|
+
* Read
|
|
1843
|
+
*/
|
|
1844
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1845
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1846
|
+
findOne(filter: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1847
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1848
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1849
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Update
|
|
1852
|
+
*/
|
|
1853
|
+
updateById(id: string, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1854
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1855
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Delete
|
|
1858
|
+
*/
|
|
1826
1859
|
deleteById(id: string): Promise<T | null>;
|
|
1860
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1861
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1827
1862
|
}
|
|
1828
1863
|
|
|
1829
1864
|
declare class BaseMongoRepository<T> implements IRepository<T> {
|
|
1830
1865
|
protected model: Model<T>;
|
|
1831
1866
|
constructor(model: Model<T>);
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
findById(id: string): Promise<T | null>;
|
|
1839
|
-
findOne(filter: Record<string, any>): Promise<T | null>;
|
|
1840
|
-
create(data: Partial<T>): Promise<T>;
|
|
1841
|
-
updateById(id: string, data: UpdateQuery<T>): Promise<T | null>;
|
|
1842
|
-
deleteById(id: string): Promise<T | null>;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
declare class BasePostgresRepository<T> implements IRepository<T> {
|
|
1846
|
-
protected model: any;
|
|
1847
|
-
constructor(model: any);
|
|
1848
|
-
findAll(filter?: Record<string, any>, options?: {
|
|
1849
|
-
select?: any;
|
|
1850
|
-
sort?: any;
|
|
1851
|
-
limit?: number;
|
|
1852
|
-
skip?: number;
|
|
1853
|
-
}): Promise<T[]>;
|
|
1854
|
-
findById(id: string): Promise<T | null>;
|
|
1855
|
-
findOne(filter: Record<string, any>): Promise<T | null>;
|
|
1867
|
+
private buildSelect;
|
|
1868
|
+
private applyQueryOptions;
|
|
1869
|
+
private toPlain;
|
|
1870
|
+
/**
|
|
1871
|
+
* Create
|
|
1872
|
+
*/
|
|
1856
1873
|
create(data: Partial<T>): Promise<T>;
|
|
1857
|
-
|
|
1874
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1875
|
+
/**
|
|
1876
|
+
* Read
|
|
1877
|
+
*/
|
|
1878
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1879
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1880
|
+
findOne(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1881
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1882
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1883
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1884
|
+
/**
|
|
1885
|
+
* Update
|
|
1886
|
+
*/
|
|
1887
|
+
updateById(id: string, data: UpdateQuery<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1888
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1889
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1890
|
+
/**
|
|
1891
|
+
* Delete
|
|
1892
|
+
*/
|
|
1858
1893
|
deleteById(id: string): Promise<T | null>;
|
|
1894
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1895
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1859
1896
|
}
|
|
1860
1897
|
|
|
1861
1898
|
interface AzureBlobStorageConfig {
|
|
@@ -2005,4 +2042,4 @@ declare function toMinutes(ms: number): number;
|
|
|
2005
2042
|
declare function toHours(ms: number): number;
|
|
2006
2043
|
declare function sleep(ms: number): Promise<void>;
|
|
2007
2044
|
|
|
2008
|
-
export { APIFactory, APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, AppError, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository,
|
|
2045
|
+
export { APIFactory, APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, AppError, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, type CloudinaryConfig, CloudinaryService, ConsistentHash, CountMinSketch, type DatabaseConfig, Deque, type DirectedEdge, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, type Edge, type EmailProvider, EmailService, FenwickTree, FibNode, FibonacciHeap, GlobalErrorHandler, Graph, HashMap, HashSet, HyperLogLog, type IQueryOptions, type IRepository, type IUpdateQueryOptions, type Interval, IntervalTree, JWTService, type JWTServiceOptions, KDTree, LFUCache, LRUCache, type LoggerOptions, MaxHeap, MaxStack, MinHeap, MinStack, MulterFileHandlerService, MultiSet, Node, OrderedSet, PairingHeap, PairingNode, type Point, type Point2D, PriorityQueue, type ProgressCallback, QuadTree, Queue, RadixTree, type Rect, RedBlackTree, SMTPProvider, SegmentTree, type SendEmailOptions, Set, SinglyLinkedList, SparseTable, SplayTree, Stack, StaticArray, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, TreeNode, Trie, type UploadOptions, asyncHandler, authMiddleware, connectMongoDB, createAllowedOrigins, createCorsOptions, days, errorToString, hours, loadEnv, logger, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1817,45 +1817,82 @@ declare const GlobalErrorHandler: (isProd?: boolean) => (err: unknown, _req: Req
|
|
|
1817
1817
|
|
|
1818
1818
|
declare const validate: (schema: Schema) => (req: Request, _res: Response, next: NextFunction) => void;
|
|
1819
1819
|
|
|
1820
|
+
type Filter<T> = Partial<Record<keyof T, unknown>>;
|
|
1821
|
+
type Select<T> = (keyof T)[] | Partial<Record<keyof T, 0 | 1>>;
|
|
1822
|
+
type Sort<T> = Partial<Record<keyof T, 1 | -1>>;
|
|
1823
|
+
|
|
1824
|
+
interface IQueryOptions<T> {
|
|
1825
|
+
select?: Select<T>;
|
|
1826
|
+
sort?: Sort<T>;
|
|
1827
|
+
limit?: number;
|
|
1828
|
+
skip?: number;
|
|
1829
|
+
}
|
|
1830
|
+
interface IUpdateQueryOptions {
|
|
1831
|
+
new?: boolean;
|
|
1832
|
+
runValidators: boolean;
|
|
1833
|
+
upsert?: boolean;
|
|
1834
|
+
}
|
|
1820
1835
|
interface IRepository<T> {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1836
|
+
/**
|
|
1837
|
+
* Create
|
|
1838
|
+
*/
|
|
1824
1839
|
create(data: Partial<T>): Promise<T>;
|
|
1825
|
-
|
|
1840
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1841
|
+
/**
|
|
1842
|
+
* Read
|
|
1843
|
+
*/
|
|
1844
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1845
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1846
|
+
findOne(filter: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1847
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1848
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1849
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Update
|
|
1852
|
+
*/
|
|
1853
|
+
updateById(id: string, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1854
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1855
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Delete
|
|
1858
|
+
*/
|
|
1826
1859
|
deleteById(id: string): Promise<T | null>;
|
|
1860
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1861
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1827
1862
|
}
|
|
1828
1863
|
|
|
1829
1864
|
declare class BaseMongoRepository<T> implements IRepository<T> {
|
|
1830
1865
|
protected model: Model<T>;
|
|
1831
1866
|
constructor(model: Model<T>);
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
findById(id: string): Promise<T | null>;
|
|
1839
|
-
findOne(filter: Record<string, any>): Promise<T | null>;
|
|
1840
|
-
create(data: Partial<T>): Promise<T>;
|
|
1841
|
-
updateById(id: string, data: UpdateQuery<T>): Promise<T | null>;
|
|
1842
|
-
deleteById(id: string): Promise<T | null>;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
declare class BasePostgresRepository<T> implements IRepository<T> {
|
|
1846
|
-
protected model: any;
|
|
1847
|
-
constructor(model: any);
|
|
1848
|
-
findAll(filter?: Record<string, any>, options?: {
|
|
1849
|
-
select?: any;
|
|
1850
|
-
sort?: any;
|
|
1851
|
-
limit?: number;
|
|
1852
|
-
skip?: number;
|
|
1853
|
-
}): Promise<T[]>;
|
|
1854
|
-
findById(id: string): Promise<T | null>;
|
|
1855
|
-
findOne(filter: Record<string, any>): Promise<T | null>;
|
|
1867
|
+
private buildSelect;
|
|
1868
|
+
private applyQueryOptions;
|
|
1869
|
+
private toPlain;
|
|
1870
|
+
/**
|
|
1871
|
+
* Create
|
|
1872
|
+
*/
|
|
1856
1873
|
create(data: Partial<T>): Promise<T>;
|
|
1857
|
-
|
|
1874
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1875
|
+
/**
|
|
1876
|
+
* Read
|
|
1877
|
+
*/
|
|
1878
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1879
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1880
|
+
findOne(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1881
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1882
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1883
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1884
|
+
/**
|
|
1885
|
+
* Update
|
|
1886
|
+
*/
|
|
1887
|
+
updateById(id: string, data: UpdateQuery<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1888
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1889
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1890
|
+
/**
|
|
1891
|
+
* Delete
|
|
1892
|
+
*/
|
|
1858
1893
|
deleteById(id: string): Promise<T | null>;
|
|
1894
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1895
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1859
1896
|
}
|
|
1860
1897
|
|
|
1861
1898
|
interface AzureBlobStorageConfig {
|
|
@@ -2005,4 +2042,4 @@ declare function toMinutes(ms: number): number;
|
|
|
2005
2042
|
declare function toHours(ms: number): number;
|
|
2006
2043
|
declare function sleep(ms: number): Promise<void>;
|
|
2007
2044
|
|
|
2008
|
-
export { APIFactory, APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, AppError, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository,
|
|
2045
|
+
export { APIFactory, APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, AppError, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, type CloudinaryConfig, CloudinaryService, ConsistentHash, CountMinSketch, type DatabaseConfig, Deque, type DirectedEdge, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, type Edge, type EmailProvider, EmailService, FenwickTree, FibNode, FibonacciHeap, GlobalErrorHandler, Graph, HashMap, HashSet, HyperLogLog, type IQueryOptions, type IRepository, type IUpdateQueryOptions, type Interval, IntervalTree, JWTService, type JWTServiceOptions, KDTree, LFUCache, LRUCache, type LoggerOptions, MaxHeap, MaxStack, MinHeap, MinStack, MulterFileHandlerService, MultiSet, Node, OrderedSet, PairingHeap, PairingNode, type Point, type Point2D, PriorityQueue, type ProgressCallback, QuadTree, Queue, RadixTree, type Rect, RedBlackTree, SMTPProvider, SegmentTree, type SendEmailOptions, Set, SinglyLinkedList, SparseTable, SplayTree, Stack, StaticArray, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, TreeNode, Trie, type UploadOptions, asyncHandler, authMiddleware, connectMongoDB, createAllowedOrigins, createCorsOptions, days, errorToString, hours, loadEnv, logger, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };
|
package/dist/index.js
CHANGED
|
@@ -5160,81 +5160,98 @@ var validate = (schema) => (req, _res, next) => {
|
|
|
5160
5160
|
next();
|
|
5161
5161
|
};
|
|
5162
5162
|
|
|
5163
|
-
// src/repositories/mongo.repository.ts
|
|
5163
|
+
// src/repositories/providers/mongo.repository.ts
|
|
5164
5164
|
var BaseMongoRepository = class {
|
|
5165
5165
|
model;
|
|
5166
5166
|
constructor(model) {
|
|
5167
5167
|
this.model = model;
|
|
5168
5168
|
}
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
if (
|
|
5169
|
+
buildSelect(select) {
|
|
5170
|
+
if (!select) return void 0;
|
|
5171
|
+
if (Array.isArray(select)) {
|
|
5172
|
+
return select.join(" ");
|
|
5173
|
+
}
|
|
5174
|
+
return select;
|
|
5175
|
+
}
|
|
5176
|
+
applyQueryOptions(query, options) {
|
|
5177
|
+
const select = this.buildSelect(options.select);
|
|
5178
|
+
if (select) query = query.select(select);
|
|
5172
5179
|
if (options.sort) query = query.sort(options.sort);
|
|
5173
5180
|
if (options.limit) query = query.limit(options.limit);
|
|
5174
5181
|
if (options.skip) query = query.skip(options.skip);
|
|
5175
|
-
return query
|
|
5182
|
+
return query;
|
|
5176
5183
|
}
|
|
5177
|
-
|
|
5178
|
-
return
|
|
5179
|
-
}
|
|
5180
|
-
async findOne(filter) {
|
|
5181
|
-
return this.model.findOne(filter).exec();
|
|
5184
|
+
toPlain(doc) {
|
|
5185
|
+
return doc.toObject();
|
|
5182
5186
|
}
|
|
5187
|
+
/**
|
|
5188
|
+
* Create
|
|
5189
|
+
*/
|
|
5183
5190
|
async create(data) {
|
|
5184
|
-
|
|
5191
|
+
const doc = await this.model.create(data);
|
|
5192
|
+
return this.toPlain(doc);
|
|
5185
5193
|
}
|
|
5186
|
-
async
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
runValidators: true
|
|
5190
|
-
}).exec();
|
|
5194
|
+
async createMany(data) {
|
|
5195
|
+
const docs = await this.model.insertMany(data);
|
|
5196
|
+
return docs.map((doc) => this.toPlain(doc));
|
|
5191
5197
|
}
|
|
5192
|
-
|
|
5193
|
-
|
|
5198
|
+
/**
|
|
5199
|
+
* Read
|
|
5200
|
+
*/
|
|
5201
|
+
async findAll(filter = {}, options = {}) {
|
|
5202
|
+
let query = this.model.find(filter);
|
|
5203
|
+
query = this.applyQueryOptions(query, options);
|
|
5204
|
+
return query.exec();
|
|
5194
5205
|
}
|
|
5195
|
-
}
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
model;
|
|
5200
|
-
// prisma model (e.g. prisma.testPost)
|
|
5201
|
-
constructor(model) {
|
|
5202
|
-
this.model = model;
|
|
5206
|
+
async findById(id, options = {}) {
|
|
5207
|
+
let query = this.model.findById(id);
|
|
5208
|
+
query = this.applyQueryOptions(query, options);
|
|
5209
|
+
return query.exec();
|
|
5203
5210
|
}
|
|
5204
|
-
async
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
orderBy: options.sort,
|
|
5209
|
-
take: options.limit,
|
|
5210
|
-
skip: options.skip
|
|
5211
|
-
});
|
|
5211
|
+
async findOne(filter = {}, options = {}) {
|
|
5212
|
+
let query = this.model.findOne(filter);
|
|
5213
|
+
query = this.applyQueryOptions(query, options);
|
|
5214
|
+
return query.exec();
|
|
5212
5215
|
}
|
|
5213
|
-
async
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5216
|
+
async findManyByIds(ids, options = {}) {
|
|
5217
|
+
let query = this.model.find({ _id: { $in: ids } });
|
|
5218
|
+
query = this.applyQueryOptions(query, options);
|
|
5219
|
+
return query.exec();
|
|
5217
5220
|
}
|
|
5218
|
-
async
|
|
5219
|
-
return this.model.
|
|
5220
|
-
where: filter
|
|
5221
|
-
});
|
|
5221
|
+
async count(filter) {
|
|
5222
|
+
return this.model.countDocuments(filter).exec();
|
|
5222
5223
|
}
|
|
5223
|
-
async
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
});
|
|
5224
|
+
async exists(filter) {
|
|
5225
|
+
const result = await this.model.exists(filter);
|
|
5226
|
+
return result !== null;
|
|
5227
5227
|
}
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
}
|
|
5228
|
+
/**
|
|
5229
|
+
* Update
|
|
5230
|
+
*/
|
|
5231
|
+
async updateById(id, data, options) {
|
|
5232
|
+
const finalOptions = { new: true, runValidators: true, ...options };
|
|
5233
|
+
return this.model.findByIdAndUpdate(id, data, finalOptions).exec();
|
|
5234
|
+
}
|
|
5235
|
+
async updateOne(filter, data, options) {
|
|
5236
|
+
const finalOptions = { new: true, runValidators: true, ...options };
|
|
5237
|
+
return this.model.findOneAndUpdate(filter, data, finalOptions).exec();
|
|
5233
5238
|
}
|
|
5239
|
+
async updateMany(filter, data) {
|
|
5240
|
+
const result = await this.model.updateMany(filter, data).exec();
|
|
5241
|
+
return result.modifiedCount;
|
|
5242
|
+
}
|
|
5243
|
+
/**
|
|
5244
|
+
* Delete
|
|
5245
|
+
*/
|
|
5234
5246
|
async deleteById(id) {
|
|
5235
|
-
return this.model.
|
|
5236
|
-
|
|
5237
|
-
|
|
5247
|
+
return this.model.findByIdAndDelete(id).exec();
|
|
5248
|
+
}
|
|
5249
|
+
async deleteOne(filter) {
|
|
5250
|
+
return this.model.findOneAndDelete(filter).exec();
|
|
5251
|
+
}
|
|
5252
|
+
async deleteMany(filter) {
|
|
5253
|
+
const result = await this.model.deleteMany(filter).exec();
|
|
5254
|
+
return result.deletedCount ?? 0;
|
|
5238
5255
|
}
|
|
5239
5256
|
};
|
|
5240
5257
|
var AzureBlobStorageService = class {
|
|
@@ -5689,6 +5706,6 @@ function sleep(ms) {
|
|
|
5689
5706
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5690
5707
|
}
|
|
5691
5708
|
|
|
5692
|
-
export { APIFactory, apiFeatures_default as APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, AppError, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository,
|
|
5709
|
+
export { APIFactory, apiFeatures_default as APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, AppError, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository, BinaryHeap, BinarySearchTree, BinaryTree, BloomFilter, CircularArray, CircularLinkedList, CircularQueue, CloudinaryService, ConsistentHash, CountMinSketch, Deque, DirectedGraph, DisjointSetUnion, DoublyLinkedList, DynamicArray, EmailService, FenwickTree, FibNode, FibonacciHeap, GlobalErrorHandler, Graph, HashMap, HashSet, HyperLogLog, IntervalTree, JWTService, KDTree, LFUCache, LRUCache, MaxHeap, MaxStack, MinHeap, MinStack, MulterFileHandlerService, MultiSet, Node, OrderedSet, PairingHeap, PairingNode, PriorityQueue, QuadTree, Queue, RadixTree, RedBlackTree, SMTPProvider, SegmentTree, Set2 as Set, SinglyLinkedList, SparseTable, SplayTree, Stack, StaticArray, SuffixArray, SuffixTree, TemplateEngine, TernarySearchTree, TreeNode, Trie, asyncHandler, authMiddleware, connectMongoDB, createAllowedOrigins, createCorsOptions, days, errorToString, hours, loadEnv, logger, milliseconds, minutes, pickFields, seconds, sleep, toHours, toMinutes, toSeconds, validate };
|
|
5693
5710
|
//# sourceMappingURL=index.js.map
|
|
5694
5711
|
//# sourceMappingURL=index.js.map
|