@ewb/mongoose-query 1.0.0 → 1.0.1
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/README.md +24 -35
- package/lib/Query.d.ts +60 -77
- package/lib/Query.js +227 -307
- package/lib/QueryError.d.ts +16 -50
- package/lib/QueryError.js +52 -62
- package/lib/QueryHandler.d.ts +47 -59
- package/lib/QueryHandler.js +250 -297
- package/lib/QueryHistory.d.ts +75 -76
- package/lib/QueryHistory.js +137 -154
- package/lib/QueryModel.d.ts +65 -80
- package/lib/QueryModel.js +214 -201
- package/lib/index.d.ts +9 -10
- package/lib/index.js +6 -32
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/Query.utils.d.ts +49 -0
- package/lib/utils/Query.utils.js +143 -0
- package/lib/{constants.d.ts → utils/constants.d.ts} +2 -2
- package/lib/utils/constants.js +2 -0
- package/lib/utils/types.d.ts +11 -0
- package/lib/utils/types.js +1 -0
- package/lib/utils/utils.d.ts +8 -0
- package/lib/{utils.js → utils/utils.js} +38 -44
- package/package.json +4 -4
- package/lib/ExpressHandler.d.ts +0 -30
- package/lib/ExpressHandler.js +0 -215
- package/lib/ExpressHandler.js.map +0 -1
- package/lib/ModelQuery.d.ts +0 -24
- package/lib/ModelQuery.js +0 -80
- package/lib/ModelQuery.js.map +0 -1
- package/lib/Query.js.map +0 -1
- package/lib/QueryError.js.map +0 -1
- package/lib/QueryExpressHandler.d.ts +0 -50
- package/lib/QueryExpressHandler.js +0 -383
- package/lib/QueryExpressHandler.js.map +0 -1
- package/lib/QueryExpressSubHandler.d.ts +0 -20
- package/lib/QueryExpressSubHandler.js +0 -137
- package/lib/QueryExpressSubHandler.js.map +0 -1
- package/lib/QueryHandler.js.map +0 -1
- package/lib/QueryHistory.js.map +0 -1
- package/lib/QueryModel.js.map +0 -1
- package/lib/constants.js +0 -6
- package/lib/constants.js.map +0 -1
- package/lib/declarations.d.ts +0 -16
- package/lib/declarations.js +0 -3
- package/lib/declarations.js.map +0 -1
- package/lib/error/ExpressError.d.ts +0 -44
- package/lib/error/ExpressError.js +0 -39
- package/lib/error/ExpressError.js.map +0 -1
- package/lib/error/QueryError.d.ts +0 -47
- package/lib/error/QueryError.js +0 -50
- package/lib/error/QueryError.js.map +0 -1
- package/lib/error/QueryExpressError.d.ts +0 -46
- package/lib/error/QueryExpressError.js +0 -39
- package/lib/error/QueryExpressError.js.map +0 -1
- package/lib/error/V1Error.d.ts +0 -12
- package/lib/error/V1Error.js +0 -27
- package/lib/error/V1Error.js.map +0 -1
- package/lib/error/error.handler.d.ts +0 -3
- package/lib/error/error.handler.js +0 -30
- package/lib/error/error.handler.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/statics.d.ts +0 -17
- package/lib/statics.js +0 -35
- package/lib/statics.js.map +0 -1
- package/lib/utils.d.ts +0 -3
- package/lib/utils.js.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
export declare const toValidNumber: (v: string | number | undefined, defaultV: number) => number;
|
|
3
|
+
export interface IMongooseQueryOptions {
|
|
4
|
+
skip?: number | string;
|
|
5
|
+
limit?: number | string;
|
|
6
|
+
page?: number | string;
|
|
7
|
+
text?: string;
|
|
8
|
+
sort?: string;
|
|
9
|
+
populate?: string;
|
|
10
|
+
select?: string;
|
|
11
|
+
[key: string]: string | number | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function mongooseQueryOptions(query: IMongooseQueryOptions): {
|
|
14
|
+
limit: number;
|
|
15
|
+
skip: number;
|
|
16
|
+
sort: any[];
|
|
17
|
+
select: any[];
|
|
18
|
+
populate: any[];
|
|
19
|
+
page: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function mongooseQuerySkipLimit(query: IMongooseQueryOptions): {
|
|
22
|
+
skip: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
page: number;
|
|
25
|
+
} | {
|
|
26
|
+
skip: number;
|
|
27
|
+
limit: number;
|
|
28
|
+
page?: undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare function mongooseQuerySortSelect(query: IMongooseQueryOptions): {
|
|
31
|
+
sort: any[];
|
|
32
|
+
select: any[];
|
|
33
|
+
};
|
|
34
|
+
export declare function mongooseQueryPopulate(query: IMongooseQueryOptions): any[];
|
|
35
|
+
export declare function mongooseQueryWithOperation<T extends object, Q extends mongoose.FilterQuery<T>, K extends keyof Q>(query: Q, key: K, str: string): {
|
|
36
|
+
field: K;
|
|
37
|
+
value: Q[K];
|
|
38
|
+
} | {
|
|
39
|
+
field: string;
|
|
40
|
+
value: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function greaterLessThanValue<T extends object, Q extends mongoose.FilterQuery<T>, K extends keyof Q>(key: K, query: Q, str: string): {
|
|
43
|
+
field: K;
|
|
44
|
+
value: Q[K];
|
|
45
|
+
};
|
|
46
|
+
export declare function toMongooseOperation<T extends object, Q extends mongoose.FilterQuery<T>, K extends keyof Q>(key: K, query: Q, str: string): {
|
|
47
|
+
field: K;
|
|
48
|
+
value: Q[K];
|
|
49
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { toValidTextRegexp } from '../QueryModel';
|
|
2
|
+
const VALUE_SPLIT = /,|\s/;
|
|
3
|
+
const POPULATE_SPLIT = ';';
|
|
4
|
+
const POPULATE_PATH_SPLIT = ':';
|
|
5
|
+
export const toValidNumber = (v, defaultV) => (typeof v === 'number' ? Number(v) : v ? parseInt(v, 10) : defaultV);
|
|
6
|
+
export function mongooseQueryOptions(query) {
|
|
7
|
+
const { skip, limit, page } = mongooseQuerySkipLimit(query);
|
|
8
|
+
const { select, sort } = mongooseQuerySortSelect(query);
|
|
9
|
+
const populate = mongooseQueryPopulate(query);
|
|
10
|
+
return {
|
|
11
|
+
limit,
|
|
12
|
+
skip,
|
|
13
|
+
sort,
|
|
14
|
+
select,
|
|
15
|
+
populate,
|
|
16
|
+
page,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function mongooseQuerySkipLimit(query) {
|
|
20
|
+
try {
|
|
21
|
+
let skip = 0;
|
|
22
|
+
let limit = 20;
|
|
23
|
+
let page;
|
|
24
|
+
if ('skip' in query) {
|
|
25
|
+
skip = toValidNumber(query.skip, 0);
|
|
26
|
+
delete query.skip;
|
|
27
|
+
}
|
|
28
|
+
if ('limit' in query) {
|
|
29
|
+
limit = toValidNumber(query.limit, limit);
|
|
30
|
+
delete query.limit;
|
|
31
|
+
}
|
|
32
|
+
if ('page' in query) {
|
|
33
|
+
const _page = toValidNumber(query.page, 0);
|
|
34
|
+
if (_page === 0) {
|
|
35
|
+
skip = undefined;
|
|
36
|
+
limit = undefined;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
skip = limit * (_page - 1);
|
|
40
|
+
page = _page;
|
|
41
|
+
}
|
|
42
|
+
delete query.page;
|
|
43
|
+
}
|
|
44
|
+
return { skip, limit, page };
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
return { skip: 0, limit: 20 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function mongooseQuerySortSelect(query) {
|
|
51
|
+
try {
|
|
52
|
+
let sort = [];
|
|
53
|
+
let select = [];
|
|
54
|
+
if ('sort' in query && query.sort) {
|
|
55
|
+
sort = query.sort.split(VALUE_SPLIT).filter(Boolean);
|
|
56
|
+
delete query.sort;
|
|
57
|
+
}
|
|
58
|
+
if ('select' in query && query.select) {
|
|
59
|
+
select = query.select.split(VALUE_SPLIT).filter(Boolean);
|
|
60
|
+
delete query.select;
|
|
61
|
+
}
|
|
62
|
+
return { sort, select };
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
return { sort: [], select: [] };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export function mongooseQueryPopulate(query) {
|
|
69
|
+
try {
|
|
70
|
+
const populate = [];
|
|
71
|
+
if ('$populate' in query || 'populate' in query) {
|
|
72
|
+
const populateValue = String(query.populate || query.$populate || '');
|
|
73
|
+
if (populateValue) {
|
|
74
|
+
const pathsToPopulate = populateValue
|
|
75
|
+
.split(POPULATE_SPLIT)
|
|
76
|
+
.filter(Boolean);
|
|
77
|
+
for (const pathToPopulate of pathsToPopulate) {
|
|
78
|
+
const [path, selects] = pathToPopulate.split(POPULATE_PATH_SPLIT);
|
|
79
|
+
if (path) {
|
|
80
|
+
populate.push({
|
|
81
|
+
path,
|
|
82
|
+
...(selects ? { select: selects.split(VALUE_SPLIT) } : {}),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
delete query.populate;
|
|
88
|
+
delete query.$populate;
|
|
89
|
+
}
|
|
90
|
+
return populate;
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const splitKey = (key) => {
|
|
97
|
+
const [operation, ...field] = String(key).split('_');
|
|
98
|
+
return [operation, field.join('_')];
|
|
99
|
+
};
|
|
100
|
+
export function mongooseQueryWithOperation(query, key, str) {
|
|
101
|
+
try {
|
|
102
|
+
const _key = String(key);
|
|
103
|
+
if (_key.match(/^\$gte?_/) || _key.match(/^\$lte?_/)) {
|
|
104
|
+
return greaterLessThanValue(_key, query, str);
|
|
105
|
+
}
|
|
106
|
+
else if (_key.match(/^\$n?in_/)) {
|
|
107
|
+
return toMongooseOperation(_key, query, str);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return {
|
|
111
|
+
field: _key.slice(1),
|
|
112
|
+
value: {
|
|
113
|
+
$regex: new RegExp(toValidTextRegexp(str), 'i'),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
return { field: '', value: '' };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export function greaterLessThanValue(key, query, str) {
|
|
123
|
+
const [operation, field] = splitKey(key);
|
|
124
|
+
let value = {};
|
|
125
|
+
if (query[field]) {
|
|
126
|
+
value = {
|
|
127
|
+
...query[field],
|
|
128
|
+
[operation]: new Date(str),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
value = { [operation]: new Date(str) };
|
|
133
|
+
}
|
|
134
|
+
return { field, value };
|
|
135
|
+
}
|
|
136
|
+
const SORT_SPLIT = /,|\s/;
|
|
137
|
+
export function toMongooseOperation(key, query, str) {
|
|
138
|
+
const [operation, field] = splitKey(key);
|
|
139
|
+
const value = {
|
|
140
|
+
[operation]: str.split(SORT_SPLIT),
|
|
141
|
+
};
|
|
142
|
+
return { field, value };
|
|
143
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DEFAULT_LIMIT = 20;
|
|
2
|
-
export declare const DEFAULT_SKIP = 0;
|
|
1
|
+
export declare const DEFAULT_LIMIT = 20;
|
|
2
|
+
export declare const DEFAULT_SKIP = 0;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
export type MongooseSortSelectValue<T extends object, K extends keyof T = keyof T> = K extends string ? `-${K}` | K : keyof T;
|
|
3
|
+
export type QueryType<T extends object> = mongoose.FilterQuery<T>;
|
|
4
|
+
export type IQueryAddToModelQuery<R extends object, T extends object> = {
|
|
5
|
+
[key in keyof R]?: QueryType<T>;
|
|
6
|
+
};
|
|
7
|
+
export interface IQueryOptions {
|
|
8
|
+
score?: {
|
|
9
|
+
$meta: 'textScore';
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,44 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (prev)
|
|
40
|
-
link += `,${prev}`;
|
|
41
|
-
return link;
|
|
42
|
-
}
|
|
43
|
-
exports.getPageLinkHeader = getPageLinkHeader;
|
|
44
|
-
//# sourceMappingURL=utils.js.map
|
|
1
|
+
const addInRange = (pages, currentPage) => (add) => {
|
|
2
|
+
const sum = currentPage + add;
|
|
3
|
+
if (sum < 0)
|
|
4
|
+
return '0';
|
|
5
|
+
if (sum > pages)
|
|
6
|
+
return String(pages);
|
|
7
|
+
return String(sum);
|
|
8
|
+
};
|
|
9
|
+
const constructUrl = (rootUrl) => {
|
|
10
|
+
const [url, urlQuery] = rootUrl.split('?');
|
|
11
|
+
const query = new URLSearchParams(urlQuery);
|
|
12
|
+
return (rel, page, limit = String(query.get('limit'))) => {
|
|
13
|
+
query.set('page', page);
|
|
14
|
+
query.set('limit', limit);
|
|
15
|
+
return `<${url}?${query.toString()}>; rel="${rel}"`;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export function getPageLinkHeader(rootUrl, query, data) {
|
|
19
|
+
if (!query.page)
|
|
20
|
+
return '';
|
|
21
|
+
if (data.count < data.limit)
|
|
22
|
+
return '';
|
|
23
|
+
const currentPage = query.page;
|
|
24
|
+
const pages = Math.floor(data.count / data.limit);
|
|
25
|
+
const getPage = addInRange(pages, currentPage);
|
|
26
|
+
const toUrl = constructUrl(rootUrl);
|
|
27
|
+
const next = toUrl('next', getPage(1));
|
|
28
|
+
const prevSkip = getPage(-1);
|
|
29
|
+
const prev = currentPage > 1 ? toUrl('prev', prevSkip) : '';
|
|
30
|
+
const first = currentPage > 1 ? toUrl('first', '1') : '';
|
|
31
|
+
const last = toUrl('last', String(pages), String(data.count - pages * data.limit));
|
|
32
|
+
let link = `${next},${last}`;
|
|
33
|
+
if (first)
|
|
34
|
+
link += `,${first}`;
|
|
35
|
+
if (prev)
|
|
36
|
+
link += `,${prev}`;
|
|
37
|
+
return link;
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ewb/mongoose-query",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Parse queries and params to mongoose search. Strips dangerous keys and set corrects options with help of query values.",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/
|
|
39
|
+
"url": "git+https://github.com/emilswebbod/mongoose-query.git"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"typescript",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"author": "Emils Webbod",
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"bugs": {
|
|
49
|
-
"url": "https://github.com/
|
|
49
|
+
"url": "https://github.com/emilswebbod/mongoose-query/issues"
|
|
50
50
|
},
|
|
51
|
-
"homepage": "https://github.com/
|
|
51
|
+
"homepage": "https://github.com/emilswebbod/mongoose-query#readme",
|
|
52
52
|
"files": [
|
|
53
53
|
"lib"
|
|
54
54
|
],
|
package/lib/ExpressHandler.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
import { Document, Types } from 'mongoose';
|
|
3
|
-
import { QueryHandler } from './QueryHandler';
|
|
4
|
-
import { Query } from './Query';
|
|
5
|
-
export interface IExpressRequest extends Request {
|
|
6
|
-
mongoosePostBody: {
|
|
7
|
-
[key: string]: string | Types.ObjectId;
|
|
8
|
-
};
|
|
9
|
-
mongooseQuery: Query;
|
|
10
|
-
}
|
|
11
|
-
export default class ExpressHandler<R extends IExpressRequest, T extends Document> {
|
|
12
|
-
private param;
|
|
13
|
-
private handler;
|
|
14
|
-
constructor(param: keyof R, handler: QueryHandler<T>);
|
|
15
|
-
post(req: R, res: Response, next: NextFunction): Promise<void>;
|
|
16
|
-
findOne(req: R, _res: Response, next: NextFunction): Promise<void>;
|
|
17
|
-
search(req: R, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>> | undefined>;
|
|
18
|
-
patch(req: R, _res: Response, next: NextFunction): Promise<void>;
|
|
19
|
-
archive(req: R, _res: Response, next: NextFunction): Promise<void>;
|
|
20
|
-
delete(req: R, _res: Response, next: NextFunction): Promise<void>;
|
|
21
|
-
json(req: R, res: Response, next: NextFunction): void;
|
|
22
|
-
subRoute(req: R, _res: Response, next: NextFunction): void;
|
|
23
|
-
addToQuery(req: R, _res: Response, next: NextFunction): void;
|
|
24
|
-
addToPost(req: R, _res: Response, next: NextFunction): void;
|
|
25
|
-
private getDoc;
|
|
26
|
-
private validateBody;
|
|
27
|
-
private getFindOpts;
|
|
28
|
-
private getParam;
|
|
29
|
-
private validateReq;
|
|
30
|
-
}
|
package/lib/ExpressHandler.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const mongoose_1 = require("mongoose");
|
|
13
|
-
class ExpressHandler {
|
|
14
|
-
constructor(param, handler) {
|
|
15
|
-
this.param = param;
|
|
16
|
-
this.handler = handler;
|
|
17
|
-
this.post = this.post.bind(this);
|
|
18
|
-
this.findOne = this.findOne.bind(this);
|
|
19
|
-
this.search = this.search.bind(this);
|
|
20
|
-
this.patch = this.patch.bind(this);
|
|
21
|
-
this.archive = this.archive.bind(this);
|
|
22
|
-
this.delete = this.delete.bind(this);
|
|
23
|
-
this.json = this.json.bind(this);
|
|
24
|
-
this.subRoute = this.subRoute.bind(this);
|
|
25
|
-
this.addToQuery = this.addToQuery.bind(this);
|
|
26
|
-
this.addToPost = this.addToPost.bind(this);
|
|
27
|
-
this.getDoc = this.getDoc.bind(this);
|
|
28
|
-
}
|
|
29
|
-
post(req, res, next) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
try {
|
|
32
|
-
this.validateBody(req);
|
|
33
|
-
if (req.mongoosePostBody) {
|
|
34
|
-
for (const key in req.mongoosePostBody) {
|
|
35
|
-
req.body[key] = req.mongoosePostBody[key];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
req[this.param] = (yield this.handler.create(req.body));
|
|
39
|
-
res.status(201);
|
|
40
|
-
next();
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
next(e);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
findOne(req, _res, next) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
try {
|
|
50
|
-
const param = this.getParam(req);
|
|
51
|
-
const query = param.match(/^[0-9a-fA-F]{24}$/) && mongoose_1.Types.ObjectId.isValid(param)
|
|
52
|
-
? { _id: mongoose_1.Types.ObjectId(param) }
|
|
53
|
-
: { slug: param };
|
|
54
|
-
req.mongooseQuery.addRoot(query);
|
|
55
|
-
req[this.param] = (yield this.handler.findOne(req.mongooseQuery, this.getFindOpts(req)));
|
|
56
|
-
req.mongooseQuery.deleteKeysFromRoot(Object.keys(query));
|
|
57
|
-
this.validateReq(req);
|
|
58
|
-
next();
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
next(e);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
search(req, res, next) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
try {
|
|
68
|
-
if ('searchV2' in this.handler.model) {
|
|
69
|
-
req.mongooseQuery.removeQuery('as');
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
const data = yield this.handler.model.searchV2(req.mongooseQuery);
|
|
72
|
-
if (req.query.as === 'array') {
|
|
73
|
-
return res.json(data.data);
|
|
74
|
-
}
|
|
75
|
-
return res.json(data);
|
|
76
|
-
}
|
|
77
|
-
next(new Error(JSON.stringify({
|
|
78
|
-
status: 501,
|
|
79
|
-
message: 'Missing searchV2 function i model'
|
|
80
|
-
})));
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
next(e);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
patch(req, _res, next) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
try {
|
|
90
|
-
this.validateReq(req);
|
|
91
|
-
this.validateBody(req);
|
|
92
|
-
const query = req.mongooseQuery;
|
|
93
|
-
req[this.param] = (yield this.handler.findOneAndUpdate(query, { _id: this.getDoc(req)._id }, req.body));
|
|
94
|
-
next();
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
next(e);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
archive(req, _res, next) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
try {
|
|
104
|
-
this.validateReq(req);
|
|
105
|
-
req[this.param] = (yield this.handler.findOneAndUpdate(req.mongooseQuery, { _id: this.getDoc(req)._id }, { archived: true }));
|
|
106
|
-
next();
|
|
107
|
-
}
|
|
108
|
-
catch (e) {
|
|
109
|
-
next(e);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
delete(req, _res, next) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
try {
|
|
116
|
-
this.validateReq(req);
|
|
117
|
-
yield this.handler.deleteOne({ _id: this.getDoc(req)._id });
|
|
118
|
-
next();
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
next(e);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
json(req, res, next) {
|
|
126
|
-
try {
|
|
127
|
-
this.validateReq(req);
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
const ret = req[this.param].toJSON({ transform: this.handler.toJSON });
|
|
130
|
-
res.json(ret);
|
|
131
|
-
}
|
|
132
|
-
catch (e) {
|
|
133
|
-
next(e);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
subRoute(req, _res, next) {
|
|
137
|
-
try {
|
|
138
|
-
this.validateReq(req);
|
|
139
|
-
if (!req.mongoosePostBody) {
|
|
140
|
-
req.mongoosePostBody = {};
|
|
141
|
-
}
|
|
142
|
-
req.mongoosePostBody[this.param] = this.getDoc(req)._id;
|
|
143
|
-
req.mongooseQuery.addRoot({ [this.param]: this.getDoc(req)._id });
|
|
144
|
-
next();
|
|
145
|
-
}
|
|
146
|
-
catch (e) {
|
|
147
|
-
next(e);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
addToQuery(req, _res, next) {
|
|
151
|
-
try {
|
|
152
|
-
req.mongooseQuery.addRoot({ [this.param]: this.getDoc(req)._id });
|
|
153
|
-
next();
|
|
154
|
-
}
|
|
155
|
-
catch (e) {
|
|
156
|
-
next(e);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
addToPost(req, _res, next) {
|
|
160
|
-
try {
|
|
161
|
-
this.validateReq(req);
|
|
162
|
-
if (!req.mongoosePostBody) {
|
|
163
|
-
req.mongoosePostBody = {};
|
|
164
|
-
}
|
|
165
|
-
req.mongoosePostBody[this.param] = this.getDoc(req)._id;
|
|
166
|
-
next();
|
|
167
|
-
}
|
|
168
|
-
catch (e) {
|
|
169
|
-
next(e);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
getDoc(req) {
|
|
173
|
-
return req[this.param];
|
|
174
|
-
}
|
|
175
|
-
validateBody(req) {
|
|
176
|
-
const invalidFields = this.handler.validateBody(req.body);
|
|
177
|
-
if (invalidFields) {
|
|
178
|
-
throw new Error(JSON.stringify({
|
|
179
|
-
status: 400,
|
|
180
|
-
title: 'Invalid body',
|
|
181
|
-
detail: 'Body contained invalid keys, remove keys located in source.body to post or patch',
|
|
182
|
-
source: {
|
|
183
|
-
body: invalidFields.join(', ')
|
|
184
|
-
}
|
|
185
|
-
}));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
getFindOpts(_req) {
|
|
189
|
-
return {
|
|
190
|
-
select: false,
|
|
191
|
-
populate: false
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
getParam(req) {
|
|
195
|
-
if (!req.params[this.param]) {
|
|
196
|
-
throw new Error(JSON.stringify({
|
|
197
|
-
status: 500,
|
|
198
|
-
message: `Param ${this.param} not found`,
|
|
199
|
-
source: { parameter: this.param },
|
|
200
|
-
}));
|
|
201
|
-
}
|
|
202
|
-
return req.params[this.param];
|
|
203
|
-
}
|
|
204
|
-
validateReq(req) {
|
|
205
|
-
if (!req[this.param]) {
|
|
206
|
-
throw new Error(JSON.stringify({
|
|
207
|
-
status: 404,
|
|
208
|
-
message: `${this.param} not found`,
|
|
209
|
-
source: { parameter: this.param },
|
|
210
|
-
}));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
exports.default = ExpressHandler;
|
|
215
|
-
//# sourceMappingURL=ExpressHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressHandler.js","sourceRoot":"","sources":["../src/ExpressHandler.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,uCAA2C;AAS3C,MAAqB,cAAc;IAIjC,YAAoB,KAAc,EAAU,OAAwB;QAAhD,UAAK,GAAL,KAAK,CAAS;QAAU,YAAO,GAAP,OAAO,CAAiB;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI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E,SAAS,IAAI,CAAC,KAAK,YAAY;gBACxC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE;aAClC,CAAC,CAAC,CAAA;SACJ;QACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAEO,WAAW,CAAC,GAAM;QACxB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBAC7B,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,YAAY;gBAClC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE;aAClC,CAAC,CAAC,CAAA;SACJ;IACH,CAAC;CACF;AAnND,iCAmNC"}
|
package/lib/ModelQuery.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Document, FilterQuery, QueryWithHelpers } from 'mongoose';
|
|
2
|
-
import { Query } from './Query';
|
|
3
|
-
interface ModelSearchPopulate<T, K extends keyof T> {
|
|
4
|
-
path: K;
|
|
5
|
-
select: (T[K] extends object ? keyof T[K] : string)[];
|
|
6
|
-
}
|
|
7
|
-
interface ModelSearchOpts<T extends object> {
|
|
8
|
-
query?: (keyof T)[];
|
|
9
|
-
select?: (keyof T)[];
|
|
10
|
-
sort?: (keyof T)[];
|
|
11
|
-
populate?: ModelSearchPopulate<T, keyof T>[];
|
|
12
|
-
limit?: number;
|
|
13
|
-
}
|
|
14
|
-
declare type IModelQuery = QueryWithHelpers<unknown, unknown>;
|
|
15
|
-
export declare class ModelQuery<T extends Document> {
|
|
16
|
-
private opts;
|
|
17
|
-
constructor(opts?: ModelSearchOpts<T>);
|
|
18
|
-
createQuery(query: Query<T>): FilterQuery<T>;
|
|
19
|
-
setPopulate(modelQuery: IModelQuery, query: Query<T>): void;
|
|
20
|
-
setLimitAndSkip(modelQuery: IModelQuery, query: Query<T>): void;
|
|
21
|
-
setSelect(modelQuery: IModelQuery, query: Query<T>, overrideValid?: (keyof T)[]): void;
|
|
22
|
-
setSort(modelQuery: IModelQuery, query: Query<T>): void;
|
|
23
|
-
}
|
|
24
|
-
export {};
|