@geekbears/gb-mongoose-query-parser 1.3.32 → 1.3.34
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/lib/query-parser-helper.d.ts +6 -6
- package/lib/test.spec.js +3 -3
- package/package.json +11 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Model, Query, Types, Document,
|
|
1
|
+
import { Model, Query, Types, Document, Cursor, QueryOptions, QueryFilter } from 'mongoose';
|
|
2
2
|
import { ParsedQs } from 'qs';
|
|
3
3
|
export interface IDocByQueryRes<T = Document> {
|
|
4
4
|
data: T[] | T | number;
|
|
@@ -61,7 +61,7 @@ export declare class QueryParser {
|
|
|
61
61
|
* @param query a query string object received by the controller
|
|
62
62
|
* @returns a Mongoose query on the provided model
|
|
63
63
|
*/
|
|
64
|
-
static parseFromCustomFilterToQuery<T = any>(model: Model<T>, singleMode: boolean, filter:
|
|
64
|
+
static parseFromCustomFilterToQuery<T = any>(model: Model<T>, singleMode: boolean, filter: QueryFilter<T>, query: ParsedQs): Query<any, T>;
|
|
65
65
|
/**
|
|
66
66
|
* Build a Mongoose `findOne` query on a given model with additional params
|
|
67
67
|
* @param model a Mongoose `Model` object to perform the query on
|
|
@@ -69,7 +69,7 @@ export declare class QueryParser {
|
|
|
69
69
|
* @param query a query string object received by the controller
|
|
70
70
|
* @returns a Mongoose query on the provided model
|
|
71
71
|
*/
|
|
72
|
-
static parseFilterQuery<T = any>(model: Model<T>, filter:
|
|
72
|
+
static parseFilterQuery<T = any>(model: Model<T>, filter: QueryFilter<T>, query: ParsedQs): Query<any, T>;
|
|
73
73
|
/**
|
|
74
74
|
* Get a document matching the provided query for a given model
|
|
75
75
|
* @param model a Mongoose `Model` object to perform the query on
|
|
@@ -77,7 +77,7 @@ export declare class QueryParser {
|
|
|
77
77
|
* @param query a query string object received by the controller
|
|
78
78
|
* @returns the result of executing the provided query on the provided model
|
|
79
79
|
*/
|
|
80
|
-
static docByFilter<T = any>(model: Model<T>, filter:
|
|
80
|
+
static docByFilter<T = any>(model: Model<T>, filter: QueryFilter<T>, query: ParsedQs): Promise<IDocByQueryRes<T>>;
|
|
81
81
|
/**
|
|
82
82
|
* Get a document matching the provided query for a given model
|
|
83
83
|
* @param model a Mongoose `Model` object to perform the query on
|
|
@@ -86,7 +86,7 @@ export declare class QueryParser {
|
|
|
86
86
|
* @param query a query string object received by the controller
|
|
87
87
|
* @returns the result of executing the provided query on the provided model
|
|
88
88
|
*/
|
|
89
|
-
static docsFromCustomFilterToCursor<T = any>(model: Model<T>, singleMode: boolean, filter:
|
|
89
|
+
static docsFromCustomFilterToCursor<T = any>(model: Model<T>, singleMode: boolean, filter: QueryFilter<T>, query: ParsedQs): IDocByQueryCursorRes<T>;
|
|
90
90
|
/**
|
|
91
91
|
* Get a document matching the provided query for a given model
|
|
92
92
|
* @param model a Mongoose `Model` object to perform the query on
|
|
@@ -95,7 +95,7 @@ export declare class QueryParser {
|
|
|
95
95
|
* @param query a query string object received by the controller
|
|
96
96
|
* @returns the result of executing the provided query on the provided model
|
|
97
97
|
*/
|
|
98
|
-
static docsByFilter<T = any>(model: Model<T>, singleMode: boolean, filter:
|
|
98
|
+
static docsByFilter<T = any>(model: Model<T>, singleMode: boolean, filter: QueryFilter<T>, query: ParsedQs): Promise<IDocByQueryRes<T>>;
|
|
99
99
|
/**
|
|
100
100
|
* Build a Mongoose `findOneById` query on a given model with additional params
|
|
101
101
|
* @param model a Mongoose `Model` object to perform the query on
|
package/lib/test.spec.js
CHANGED
|
@@ -330,19 +330,19 @@ __decorate([
|
|
|
330
330
|
__metadata("design:returntype", void 0)
|
|
331
331
|
], Tester.prototype, "parseId", null);
|
|
332
332
|
__decorate([
|
|
333
|
-
(0, mocha_1.test)('should use transformFilter in
|
|
333
|
+
(0, mocha_1.test)('should use transformFilter in QueryFilter'),
|
|
334
334
|
__metadata("design:type", Function),
|
|
335
335
|
__metadata("design:paramtypes", []),
|
|
336
336
|
__metadata("design:returntype", void 0)
|
|
337
337
|
], Tester.prototype, "transformFilter", null);
|
|
338
338
|
__decorate([
|
|
339
|
-
(0, mocha_1.test)('should use transformFilter in
|
|
339
|
+
(0, mocha_1.test)('should use transformFilter in QueryFilter with null'),
|
|
340
340
|
__metadata("design:type", Function),
|
|
341
341
|
__metadata("design:paramtypes", []),
|
|
342
342
|
__metadata("design:returntype", void 0)
|
|
343
343
|
], Tester.prototype, "transformFilterNull", null);
|
|
344
344
|
__decorate([
|
|
345
|
-
(0, mocha_1.test)('should use transformFilter in
|
|
345
|
+
(0, mocha_1.test)('should use transformFilter in QueryFilter 2'),
|
|
346
346
|
__metadata("design:type", Function),
|
|
347
347
|
__metadata("design:paramtypes", []),
|
|
348
348
|
__metadata("design:returntype", void 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekbears/gb-mongoose-query-parser",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.34",
|
|
4
4
|
"description": "Convert url query string to MongooseJs friendly query object including advanced filtering, sorting, population, deep population, string template, type casting and many more...",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
"homepage": "https://gitlab.com/geekbears/utilities/backend/gb-mongoose-query-parser#readme",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@testdeck/mocha": "^0.3.3",
|
|
35
|
-
"@types/chai": "^5.2.
|
|
36
|
-
"@types/lodash": "^4.17.
|
|
35
|
+
"@types/chai": "^5.2.3",
|
|
36
|
+
"@types/lodash": "^4.17.21",
|
|
37
37
|
"@types/mocha": "^10.0.10",
|
|
38
|
-
"@types/node": "^24.
|
|
38
|
+
"@types/node": "^24.10.1",
|
|
39
39
|
"@types/qs": "^6.14.0",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
41
|
-
"@typescript-eslint/parser": "^8.
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
41
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
42
42
|
"chai": "^4.5.0",
|
|
43
|
-
"eslint": "^9.
|
|
43
|
+
"eslint": "^9.39.1",
|
|
44
44
|
"eslint-config-prettier": "^10.1.8",
|
|
45
45
|
"eslint-plugin-prettier": "^5.5.4",
|
|
46
|
-
"mocha": "^11.7.
|
|
47
|
-
"prettier": "^3.
|
|
48
|
-
"rimraf": "^6.
|
|
46
|
+
"mocha": "^11.7.5",
|
|
47
|
+
"prettier": "^3.7.4",
|
|
48
|
+
"rimraf": "^6.1.2",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
|
-
"typescript": "^5.9.
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"lodash": "^4.17.21",
|