elseware-nodejs 1.8.2 → 1.8.4
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 +69 -30
- package/dist/index.d.ts +69 -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,84 @@ 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 Field<T> = Extract<keyof T, string>;
|
|
1822
|
+
type PrefixedField<T> = `+${Field<T>}` | `-${Field<T>}`;
|
|
1823
|
+
type Select<T> = (Field<T> | PrefixedField<T>)[] | Partial<Record<Field<T>, 0 | 1>>;
|
|
1824
|
+
type Sort<T> = Partial<Record<keyof T, 1 | -1>>;
|
|
1825
|
+
|
|
1826
|
+
interface IQueryOptions<T> {
|
|
1827
|
+
select?: Select<T>;
|
|
1828
|
+
sort?: Sort<T>;
|
|
1829
|
+
limit?: number;
|
|
1830
|
+
skip?: number;
|
|
1831
|
+
}
|
|
1832
|
+
interface IUpdateQueryOptions {
|
|
1833
|
+
new?: boolean;
|
|
1834
|
+
runValidators: boolean;
|
|
1835
|
+
upsert?: boolean;
|
|
1836
|
+
}
|
|
1820
1837
|
interface IRepository<T> {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1838
|
+
/**
|
|
1839
|
+
* Create
|
|
1840
|
+
*/
|
|
1824
1841
|
create(data: Partial<T>): Promise<T>;
|
|
1825
|
-
|
|
1842
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1843
|
+
/**
|
|
1844
|
+
* Read
|
|
1845
|
+
*/
|
|
1846
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1847
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1848
|
+
findOne(filter: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1849
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1850
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1851
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1852
|
+
/**
|
|
1853
|
+
* Update
|
|
1854
|
+
*/
|
|
1855
|
+
updateById(id: string, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1856
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1857
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1858
|
+
/**
|
|
1859
|
+
* Delete
|
|
1860
|
+
*/
|
|
1826
1861
|
deleteById(id: string): Promise<T | null>;
|
|
1862
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1863
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1827
1864
|
}
|
|
1828
1865
|
|
|
1829
1866
|
declare class BaseMongoRepository<T> implements IRepository<T> {
|
|
1830
1867
|
protected model: Model<T>;
|
|
1831
1868
|
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>;
|
|
1869
|
+
private buildSelect;
|
|
1870
|
+
private applyQueryOptions;
|
|
1871
|
+
private toPlain;
|
|
1872
|
+
/**
|
|
1873
|
+
* Create
|
|
1874
|
+
*/
|
|
1856
1875
|
create(data: Partial<T>): Promise<T>;
|
|
1857
|
-
|
|
1876
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1877
|
+
/**
|
|
1878
|
+
* Read
|
|
1879
|
+
*/
|
|
1880
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1881
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1882
|
+
findOne(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1883
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1884
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1885
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1886
|
+
/**
|
|
1887
|
+
* Update
|
|
1888
|
+
*/
|
|
1889
|
+
updateById(id: string, data: UpdateQuery<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1890
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1891
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1892
|
+
/**
|
|
1893
|
+
* Delete
|
|
1894
|
+
*/
|
|
1858
1895
|
deleteById(id: string): Promise<T | null>;
|
|
1896
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1897
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1859
1898
|
}
|
|
1860
1899
|
|
|
1861
1900
|
interface AzureBlobStorageConfig {
|
|
@@ -2005,4 +2044,4 @@ declare function toMinutes(ms: number): number;
|
|
|
2005
2044
|
declare function toHours(ms: number): number;
|
|
2006
2045
|
declare function sleep(ms: number): Promise<void>;
|
|
2007
2046
|
|
|
2008
|
-
export { APIFactory, APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, AppError, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository,
|
|
2047
|
+
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,84 @@ 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 Field<T> = Extract<keyof T, string>;
|
|
1822
|
+
type PrefixedField<T> = `+${Field<T>}` | `-${Field<T>}`;
|
|
1823
|
+
type Select<T> = (Field<T> | PrefixedField<T>)[] | Partial<Record<Field<T>, 0 | 1>>;
|
|
1824
|
+
type Sort<T> = Partial<Record<keyof T, 1 | -1>>;
|
|
1825
|
+
|
|
1826
|
+
interface IQueryOptions<T> {
|
|
1827
|
+
select?: Select<T>;
|
|
1828
|
+
sort?: Sort<T>;
|
|
1829
|
+
limit?: number;
|
|
1830
|
+
skip?: number;
|
|
1831
|
+
}
|
|
1832
|
+
interface IUpdateQueryOptions {
|
|
1833
|
+
new?: boolean;
|
|
1834
|
+
runValidators: boolean;
|
|
1835
|
+
upsert?: boolean;
|
|
1836
|
+
}
|
|
1820
1837
|
interface IRepository<T> {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1838
|
+
/**
|
|
1839
|
+
* Create
|
|
1840
|
+
*/
|
|
1824
1841
|
create(data: Partial<T>): Promise<T>;
|
|
1825
|
-
|
|
1842
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1843
|
+
/**
|
|
1844
|
+
* Read
|
|
1845
|
+
*/
|
|
1846
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1847
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1848
|
+
findOne(filter: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1849
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1850
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1851
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1852
|
+
/**
|
|
1853
|
+
* Update
|
|
1854
|
+
*/
|
|
1855
|
+
updateById(id: string, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1856
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1857
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1858
|
+
/**
|
|
1859
|
+
* Delete
|
|
1860
|
+
*/
|
|
1826
1861
|
deleteById(id: string): Promise<T | null>;
|
|
1862
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1863
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1827
1864
|
}
|
|
1828
1865
|
|
|
1829
1866
|
declare class BaseMongoRepository<T> implements IRepository<T> {
|
|
1830
1867
|
protected model: Model<T>;
|
|
1831
1868
|
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>;
|
|
1869
|
+
private buildSelect;
|
|
1870
|
+
private applyQueryOptions;
|
|
1871
|
+
private toPlain;
|
|
1872
|
+
/**
|
|
1873
|
+
* Create
|
|
1874
|
+
*/
|
|
1856
1875
|
create(data: Partial<T>): Promise<T>;
|
|
1857
|
-
|
|
1876
|
+
createMany(data: Partial<T>[]): Promise<T[]>;
|
|
1877
|
+
/**
|
|
1878
|
+
* Read
|
|
1879
|
+
*/
|
|
1880
|
+
findAll(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T[]>;
|
|
1881
|
+
findById(id: string, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1882
|
+
findOne(filter?: Filter<T>, options?: IQueryOptions<T>): Promise<T | null>;
|
|
1883
|
+
findManyByIds(ids: string[], options?: IQueryOptions<T>): Promise<T[]>;
|
|
1884
|
+
count(filter?: Filter<T>): Promise<number>;
|
|
1885
|
+
exists(filter?: Filter<T>): Promise<boolean>;
|
|
1886
|
+
/**
|
|
1887
|
+
* Update
|
|
1888
|
+
*/
|
|
1889
|
+
updateById(id: string, data: UpdateQuery<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1890
|
+
updateOne(filter: Filter<T>, data: Partial<T>, options?: IUpdateQueryOptions): Promise<T | null>;
|
|
1891
|
+
updateMany(filter: Filter<T>, data: Partial<T>): Promise<number>;
|
|
1892
|
+
/**
|
|
1893
|
+
* Delete
|
|
1894
|
+
*/
|
|
1858
1895
|
deleteById(id: string): Promise<T | null>;
|
|
1896
|
+
deleteOne(filter: Filter<T>): Promise<T | null>;
|
|
1897
|
+
deleteMany(filter: Filter<T>): Promise<number>;
|
|
1859
1898
|
}
|
|
1860
1899
|
|
|
1861
1900
|
interface AzureBlobStorageConfig {
|
|
@@ -2005,4 +2044,4 @@ declare function toMinutes(ms: number): number;
|
|
|
2005
2044
|
declare function toHours(ms: number): number;
|
|
2006
2045
|
declare function sleep(ms: number): Promise<void>;
|
|
2007
2046
|
|
|
2008
|
-
export { APIFactory, APIFeatures, APIResponse, AVLTree, AdjacencyList, AdjacencyMatrix, type AdjacentEdge, type AllowedOriginsOptions, AppError, type AzureBlobStorageConfig, AzureBlobStorageService, BPlusTree, BTree, BaseMongoRepository,
|
|
2047
|
+
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
|