@ewb/mongoose-query-express 0.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 ADDED
@@ -0,0 +1,27 @@
1
+ ## Mongoose Query Express
2
+
3
+ ### Info
4
+ Library to for Express to create simple reusable queries and logic for mongoose.\
5
+ Never write the simple get, post, patch and delete function over and over again.\
6
+
7
+ Used in combination with [mongoose-query](https://github.com/EmilsWebbod/mongoose-query) to create the model logic.\
8
+
9
+ ### Usage
10
+ ```
11
+ import { QueryModel } from 'mongoose-query';
12
+ import { QueryExpress } from 'mongoose-query-express';
13
+
14
+ const userQueryModel = new QueryModel<User>(User, { .... });
15
+ const userQuery = new QueryExpress('user', userQueryModel, {...});
16
+
17
+ const user = express();
18
+
19
+ user.param('id', userQuery.param);
20
+ user.get('/', userQuery.get);
21
+ user.post('/', userQuery.post);
22
+ user.patch('/:id', userQuery.patch);
23
+ user.delete('/:id', userQuery.delete); // Can also use userQuery.archive if archive option set.
24
+ ```
25
+
26
+ // This is used to set some logic for query to that model. Model for query is set in the controllers.
27
+
@@ -0,0 +1,55 @@
1
+ import { QueryHandler } from '@ewb/mongoose-query';
2
+ import { NextFunction, Request, Response } from 'express';
3
+ import mongoose from 'mongoose';
4
+ import { QueryExpressSub } from './QueryExpressSub.js';
5
+ export interface IQueryExpressOptions {
6
+ skipHandlerAction?: 'post' | 'patch' | 'archive' | 'findOne' | 'search' | 'delete' | 'export';
7
+ }
8
+ export interface IQueryExpressHandlerOptions<T extends object> {
9
+ slugKey?: keyof T & string;
10
+ archiveKey?: keyof T;
11
+ history?: {
12
+ active: boolean;
13
+ ignoreFields?: (keyof T)[];
14
+ };
15
+ }
16
+ interface BulkProps {
17
+ runNext?: boolean;
18
+ }
19
+ export declare class QueryExpress<R extends Request, T extends mongoose.Document> {
20
+ private param;
21
+ private handler;
22
+ readonly options: IQueryExpressHandlerOptions<T>;
23
+ constructor(param: keyof R, handler: QueryHandler<T>, options?: IQueryExpressHandlerOptions<T>);
24
+ post(req: R, res: Response, next: NextFunction): Promise<void>;
25
+ findOne(req: R, _res: Response, next: NextFunction): Promise<void>;
26
+ search(req: R, res: Response, next: NextFunction): Promise<void | Response<any, Record<string, any>>>;
27
+ searchNext(req: R, res: Response, next: NextFunction): Promise<void>;
28
+ private _search;
29
+ export(req: R, res: Response, next: NextFunction): Promise<void>;
30
+ patch(req: R, _res: Response, next: NextFunction): Promise<void>;
31
+ archive(req: R, _res: Response, next: NextFunction): Promise<void>;
32
+ delete(req: R, _res: Response, next: NextFunction): Promise<void>;
33
+ json(req: R, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
34
+ bulkPatch(req: R, res: Response, next: NextFunction): Promise<void | Response<any, Record<string, any>>>;
35
+ bulkDelete({ runNext }: BulkProps): (req: R, res: Response, next: NextFunction) => Promise<void>;
36
+ bulkArchive({ runNext }: BulkProps): (req: R, res: Response, next: NextFunction) => Promise<void>;
37
+ addToNextQuery(fn: (req: R) => mongoose.FilterQuery<T> | null): (req: R, _: Response, next: NextFunction) => void;
38
+ subRoute(req: R, _res: Response, next: NextFunction): void;
39
+ subDoc<R2 extends keyof R, P extends keyof T>(reqKey: R2, subArrayKey: P): QueryExpressSub<R, T, P>;
40
+ addRootRequest(req: R): void;
41
+ getRootQuery(req: R): mongoose.FilterQuery<T>;
42
+ removeRootRequest(req: R, slugKey?: string): void;
43
+ addToQuery(req: R, _res: Response, next: NextFunction): void;
44
+ addToPost(req: R, _res: Response, next: NextFunction): void;
45
+ getParam(req: R, param?: keyof R): any;
46
+ preHistory(req: R): void;
47
+ postHistory(req: R, fetchNew?: boolean): Promise<void>;
48
+ init(req: R): void;
49
+ private getDoc;
50
+ private validateBody;
51
+ private getFindOpts;
52
+ private validateReq;
53
+ private validateIdsInBody;
54
+ }
55
+ export {};
@@ -0,0 +1,384 @@
1
+ import { QueryError } from '@ewb/mongoose-query';
2
+ import httpStatus from 'http-status';
3
+ import mongoose from 'mongoose';
4
+ import { QueryExpressSub } from './QueryExpressSub.js';
5
+ import { pageLinkHeader } from './utils';
6
+ export class QueryExpress {
7
+ constructor(param, handler, options = {}) {
8
+ this.param = param;
9
+ this.handler = handler;
10
+ this.options = options;
11
+ this.post = this.post.bind(this);
12
+ this.findOne = this.findOne.bind(this);
13
+ this.search = this.search.bind(this);
14
+ this.searchNext = this.searchNext.bind(this);
15
+ this._search = this._search.bind(this);
16
+ this.export = this.export.bind(this);
17
+ this.patch = this.patch.bind(this);
18
+ this.archive = this.archive.bind(this);
19
+ this.delete = this.delete.bind(this);
20
+ this.json = this.json.bind(this);
21
+ this.bulkPatch = this.bulkPatch.bind(this);
22
+ this.bulkDelete = this.bulkDelete.bind(this);
23
+ this.bulkArchive = this.bulkArchive.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
+ async post(req, res, next) {
30
+ try {
31
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'post') {
32
+ return next();
33
+ }
34
+ this.validateBody(req);
35
+ this.init(req);
36
+ if (req.mongoosePostBody) {
37
+ for (const key in req.mongoosePostBody) {
38
+ req.body[key] = req.mongoosePostBody[key];
39
+ }
40
+ }
41
+ req[this.param] = (await this.handler.create(req.body));
42
+ await this.handler.populate(req.mongooseQuery, this.getDoc(req));
43
+ res.status(201);
44
+ next();
45
+ }
46
+ catch (e) {
47
+ next(QueryError.catch(e));
48
+ }
49
+ }
50
+ async findOne(req, _res, next) {
51
+ try {
52
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'findOne') {
53
+ return next();
54
+ }
55
+ this.init(req);
56
+ this.addRootRequest(req);
57
+ req[this.param] = (await this.handler.findOne(req.mongooseQuery, this.getFindOpts(req)));
58
+ this.preHistory(req);
59
+ this.removeRootRequest(req, this.options.slugKey);
60
+ this.validateReq(req);
61
+ await this.handler.populate(req.mongooseQuery, this.getDoc(req), 'onFindOne');
62
+ next();
63
+ }
64
+ catch (e) {
65
+ next(QueryError.catch(e));
66
+ }
67
+ }
68
+ async search(req, res, next) {
69
+ try {
70
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'search') {
71
+ return next();
72
+ }
73
+ const data = await this._search(req, res);
74
+ if (req.query.as === 'array' || req.mongooseQuery.page > 0) {
75
+ return res.json(data.data);
76
+ }
77
+ return res.json(data);
78
+ }
79
+ catch (e) {
80
+ next(QueryError.catch(e));
81
+ }
82
+ }
83
+ async searchNext(req, res, next) {
84
+ try {
85
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'search') {
86
+ return next();
87
+ }
88
+ req.mongooseSearchJson = await this._search(req, res);
89
+ next();
90
+ }
91
+ catch (e) {
92
+ next(QueryError.catch(e));
93
+ }
94
+ }
95
+ async _search(req, res) {
96
+ this.init(req);
97
+ req.mongooseQuery.removeQuery('as');
98
+ const data = await this.handler.search(req.mongooseQuery);
99
+ res.setHeader('Link', pageLinkHeader(req, data));
100
+ res.setHeader('X-Total-Count', data.count);
101
+ return data;
102
+ }
103
+ async export(req, res, next) {
104
+ try {
105
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'export') {
106
+ return next();
107
+ }
108
+ this.init(req);
109
+ req.mongooseQuery.export = true;
110
+ const paginate = await this.handler.search(req.mongooseQuery);
111
+ res.setHeader('Link', pageLinkHeader(req, paginate));
112
+ res.setHeader('X-Total-Count', paginate.count);
113
+ req.mongooseExportJson = paginate.data;
114
+ next();
115
+ }
116
+ catch (e) {
117
+ next(QueryError.catch(e));
118
+ }
119
+ }
120
+ async patch(req, _res, next) {
121
+ try {
122
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'patch') {
123
+ return next();
124
+ }
125
+ this.validateReq(req);
126
+ this.validateBody(req);
127
+ this.init(req);
128
+ const query = req.mongooseQuery;
129
+ req[this.param] = (await this.handler.findOneAndUpdate(query, { _id: this.getDoc(req)._id }, { $set: req.body }));
130
+ this.postHistory(req).then();
131
+ await this.handler.populate(req.mongooseQuery, this.getDoc(req), 'onPatch');
132
+ next();
133
+ }
134
+ catch (e) {
135
+ next(QueryError.catch(e));
136
+ }
137
+ }
138
+ async archive(req, _res, next) {
139
+ try {
140
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'archive') {
141
+ return next();
142
+ }
143
+ this.validateReq(req);
144
+ this.init(req);
145
+ req[this.param] = (await this.handler.findOneAndUpdate(req.mongooseQuery, { _id: this.getDoc(req)._id }, { [this.options.archiveKey]: true }));
146
+ this.postHistory(req).then();
147
+ next();
148
+ }
149
+ catch (e) {
150
+ next(QueryError.catch(e));
151
+ }
152
+ }
153
+ async delete(req, _res, next) {
154
+ try {
155
+ if (req.mongooseHandlerOptions.skipHandlerAction === 'delete') {
156
+ return next();
157
+ }
158
+ this.validateReq(req);
159
+ this.init(req);
160
+ await this.handler.deleteOne({ _id: this.getDoc(req)._id });
161
+ next();
162
+ }
163
+ catch (e) {
164
+ next(QueryError.catch(e));
165
+ }
166
+ }
167
+ async json(req, res, next) {
168
+ try {
169
+ this.validateReq(req);
170
+ const ret = await this.handler.json(req[this.param]);
171
+ if (typeof req.query.select === 'string') {
172
+ const newRet = {};
173
+ const selectArray = req.query.select.split(',');
174
+ for (const key of selectArray) {
175
+ newRet[key] = ret[key];
176
+ }
177
+ return res.json(newRet);
178
+ }
179
+ res.json(ret);
180
+ }
181
+ catch (e) {
182
+ next(QueryError.catch(e));
183
+ }
184
+ }
185
+ async bulkPatch(req, res, next) {
186
+ try {
187
+ const ids = this.validateIdsInBody(req);
188
+ delete req.body.ids;
189
+ this.handler.validateBody(req.body);
190
+ await this.handler.updateMany(req.mongooseQuery.root || {}, ids, req.body);
191
+ req.mongooseQuery.addRoot({ _id: { $in: ids } });
192
+ req.mongooseQuery.setSkipAndLimit(0, ids.length);
193
+ req.query.as = 'array';
194
+ return this.search(req, res, next);
195
+ }
196
+ catch (e) {
197
+ next(QueryError.catch(e));
198
+ }
199
+ }
200
+ bulkDelete({ runNext }) {
201
+ return async (req, res, next) => {
202
+ try {
203
+ const ids = this.validateIdsInBody(req);
204
+ const deleted = await this.handler.deleteMany(req.mongooseQuery.root || {}, ids);
205
+ if (runNext) {
206
+ return next();
207
+ }
208
+ res.json(deleted);
209
+ }
210
+ catch (e) {
211
+ next(QueryError.catch(e));
212
+ }
213
+ };
214
+ }
215
+ bulkArchive({ runNext }) {
216
+ return async (req, res, next) => {
217
+ try {
218
+ const ids = this.validateIdsInBody(req);
219
+ await this.handler.updateMany(req.mongooseQuery.root || {}, ids, {
220
+ [this.options.archiveKey]: true,
221
+ });
222
+ if (runNext) {
223
+ return next();
224
+ }
225
+ res.json(ids.map((_id) => ({ _id, [String(this.options.archiveKey)]: true })));
226
+ }
227
+ catch (e) {
228
+ next(QueryError.catch(e));
229
+ }
230
+ };
231
+ }
232
+ addToNextQuery(fn) {
233
+ return (req, _, next) => {
234
+ try {
235
+ const data = fn(req);
236
+ if (data) {
237
+ req.mongooseQuery.addRootNext(data);
238
+ }
239
+ next();
240
+ }
241
+ catch (e) {
242
+ next(QueryError.catch(e));
243
+ }
244
+ };
245
+ }
246
+ subRoute(req, _res, next) {
247
+ try {
248
+ this.validateReq(req);
249
+ this.init(req);
250
+ if (!req.mongoosePostBody) {
251
+ req.mongoosePostBody = {};
252
+ }
253
+ const doc = this.getDoc(req);
254
+ req.mongoosePostBody[this.param] = doc._id;
255
+ req.mongooseQuery.addRoot({
256
+ [this.param]: doc._id,
257
+ });
258
+ next();
259
+ }
260
+ catch (e) {
261
+ next(QueryError.catch(e));
262
+ }
263
+ }
264
+ subDoc(reqKey, subArrayKey) {
265
+ return new QueryExpressSub(this.handler, this, reqKey, subArrayKey);
266
+ }
267
+ addRootRequest(req) {
268
+ req.mongooseQuery.addRoot(this.getRootQuery(req));
269
+ }
270
+ getRootQuery(req) {
271
+ const param = this.getParam(req);
272
+ if (param.match(/^[0-9a-fA-F]{24}$/) &&
273
+ mongoose.Types.ObjectId.isValid(param)) {
274
+ return {
275
+ _id: new mongoose.Types.ObjectId(param),
276
+ };
277
+ }
278
+ if (this.options.slugKey) {
279
+ return { [this.options.slugKey]: param };
280
+ }
281
+ throw new QueryError(httpStatus.BAD_REQUEST, `Param is not valid`, {
282
+ detail: 'Need to be of type MongoDB ObjectID',
283
+ });
284
+ }
285
+ removeRootRequest(req, slugKey) {
286
+ req.mongooseQuery.deleteKeysFromRoot([
287
+ '_id',
288
+ ...(slugKey ? [slugKey] : []),
289
+ ]);
290
+ }
291
+ addToQuery(req, _res, next) {
292
+ try {
293
+ req.mongooseQuery.addRoot({
294
+ [this.param]: this.getDoc(req)._id,
295
+ });
296
+ next();
297
+ }
298
+ catch (e) {
299
+ next(QueryError.catch(e));
300
+ }
301
+ }
302
+ addToPost(req, _res, next) {
303
+ try {
304
+ this.validateReq(req);
305
+ if (!req.mongoosePostBody) {
306
+ req.mongoosePostBody = {};
307
+ }
308
+ req.mongoosePostBody[this.param] = this.getDoc(req)._id;
309
+ next();
310
+ }
311
+ catch (e) {
312
+ next(QueryError.catch(e));
313
+ }
314
+ }
315
+ getParam(req, param = this.param) {
316
+ if (req[param]) {
317
+ return this.getDoc(req, param)._id.toHexString();
318
+ }
319
+ if (!req.params[param]) {
320
+ throw new QueryError(httpStatus.BAD_REQUEST, String(param), {
321
+ detail: 'Param is not valid',
322
+ });
323
+ }
324
+ return req.params[param];
325
+ }
326
+ preHistory(req) {
327
+ if (this.options.history?.active && req.mongooseHistory) {
328
+ if (this.options.history.ignoreFields) {
329
+ req.mongooseHistory.setIgnoreFields(this.options.history.ignoreFields);
330
+ }
331
+ req.mongooseHistory.setModel(this.handler.model);
332
+ req.mongooseHistory.setOldDoc(this.getDoc(req).toObject());
333
+ }
334
+ }
335
+ async postHistory(req, fetchNew) {
336
+ if (this.options.history?.active && req.mongooseHistory) {
337
+ let doc = this.getDoc(req);
338
+ if (fetchNew) {
339
+ doc = await req.mongooseHistory.findUpdated();
340
+ }
341
+ req.mongooseHistory.setUpdatedDoc(doc);
342
+ req.mongooseHistory.setDiff(doc._id).then();
343
+ }
344
+ }
345
+ init(req) {
346
+ req.mongooseQuery.parameter = this.param;
347
+ }
348
+ getDoc(req, param = this.param) {
349
+ return req[param];
350
+ }
351
+ validateBody(req) {
352
+ const invalidFields = this.handler.validateBody(req.body);
353
+ if (invalidFields) {
354
+ throw new QueryError(httpStatus.BAD_REQUEST, 'Invalid body', {
355
+ detail: 'Body contained invalid keys, remove keys located in source.body to post or patch',
356
+ errors: invalidFields.map((x) => ({
357
+ message: 'Invalid field',
358
+ detail: x,
359
+ })),
360
+ });
361
+ }
362
+ }
363
+ getFindOpts(_req) {
364
+ return {
365
+ select: false,
366
+ populate: false,
367
+ };
368
+ }
369
+ validateReq(req) {
370
+ if (!req[this.param]) {
371
+ throw new QueryError(httpStatus.BAD_REQUEST, String(this.param), {
372
+ detail: 'Param is not valid',
373
+ });
374
+ }
375
+ }
376
+ validateIdsInBody(req) {
377
+ if (!req.body.ids) {
378
+ throw new QueryError(httpStatus.BAD_REQUEST, 'ids', {
379
+ detail: 'ids is required',
380
+ });
381
+ }
382
+ return req.body.ids.map((x) => new mongoose.Types.ObjectId(x));
383
+ }
384
+ }
@@ -0,0 +1,20 @@
1
+ import { QueryHandler } from '@ewb/mongoose-query';
2
+ import { NextFunction, Request, Response } from 'express';
3
+ import mongoose from 'mongoose';
4
+ import { QueryExpress } from './QueryExpress.js';
5
+ export declare class QueryExpressSub<R extends Request, T extends mongoose.Document, K extends keyof T> {
6
+ private handler;
7
+ private express;
8
+ private reqKey;
9
+ private param;
10
+ constructor(handler: QueryHandler<T>, express: QueryExpress<R, T>, reqKey: keyof R, param: K);
11
+ post(req: R, _res: Response, next: NextFunction): Promise<void>;
12
+ search(req: R, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
13
+ findOne(req: R, _res: Response, next: NextFunction): Promise<void>;
14
+ patch(req: R, _res: Response, next: NextFunction): Promise<void>;
15
+ delete(req: R, _res: Response, next: NextFunction): Promise<void>;
16
+ json(req: R, res: Response, next: NextFunction): Promise<void>;
17
+ private getQuery;
18
+ private validateReq;
19
+ private getSubDoc;
20
+ }
@@ -0,0 +1,110 @@
1
+ import { QueryError } from '@ewb/mongoose-query';
2
+ import httpStatus from 'http-status';
3
+ import mongoose from 'mongoose';
4
+ import { pageLinkHeader } from './utils';
5
+ export class QueryExpressSub {
6
+ constructor(handler, express, reqKey, param) {
7
+ this.handler = handler;
8
+ this.express = express;
9
+ this.reqKey = reqKey;
10
+ this.param = param;
11
+ this.post = this.post.bind(this);
12
+ this.search = this.search.bind(this);
13
+ this.findOne = this.findOne.bind(this);
14
+ this.patch = this.patch.bind(this);
15
+ this.delete = this.delete.bind(this);
16
+ this.json = this.json.bind(this);
17
+ }
18
+ async post(req, _res, next) {
19
+ try {
20
+ this.express.addRootRequest(req);
21
+ req[this.reqKey] = (await this.handler.subCreate(this.param, req.mongooseQuery, req.body));
22
+ this.validateReq(req);
23
+ this.express.postHistory(req, true).then();
24
+ this.express.removeRootRequest(req, this.express.options.slugKey);
25
+ await this.handler.subPopulate(req.mongooseQuery, this.getSubDoc(req), this.param, 'onPost');
26
+ next();
27
+ }
28
+ catch (e) {
29
+ next(QueryError.catch(e));
30
+ }
31
+ }
32
+ async search(req, res, next) {
33
+ try {
34
+ req.mongooseQuery.removeQuery('as');
35
+ const results = (await this.handler.subSearch(this.param, req.mongooseQuery, this.express.getRootQuery(req)));
36
+ res.setHeader('Link', pageLinkHeader(req, results));
37
+ res.setHeader('X-Total-Count', results.count);
38
+ if (req.query.as === 'array' || req.mongooseQuery.page > 0) {
39
+ return res.json(results.data);
40
+ }
41
+ res.json(results);
42
+ }
43
+ catch (e) {
44
+ next(QueryError.catch(e));
45
+ }
46
+ }
47
+ async findOne(req, _res, next) {
48
+ try {
49
+ this.express.addRootRequest(req);
50
+ req[this.reqKey] = (await this.handler.subFindOne(this.param, req.mongooseQuery, this.getQuery(req)));
51
+ this.validateReq(req);
52
+ this.express.removeRootRequest(req, this.express.options.slugKey);
53
+ await this.handler.subPopulate(req.mongooseQuery, this.getSubDoc(req), this.param, 'onFindOne');
54
+ next();
55
+ }
56
+ catch (e) {
57
+ next(QueryError.catch(e));
58
+ }
59
+ }
60
+ async patch(req, _res, next) {
61
+ try {
62
+ this.express.addRootRequest(req);
63
+ req[this.reqKey] = (await this.handler.subFindOneAndUpdate(this.param, req.mongooseQuery, this.getQuery(req), req.body));
64
+ this.validateReq(req);
65
+ this.express.postHistory(req, true).then();
66
+ this.express.removeRootRequest(req, this.express.options.slugKey);
67
+ await this.handler.subPopulate(req.mongooseQuery, this.getSubDoc(req), this.param, 'onPatch');
68
+ next();
69
+ }
70
+ catch (e) {
71
+ next(QueryError.catch(e));
72
+ }
73
+ }
74
+ async delete(req, _res, next) {
75
+ try {
76
+ this.express.addRootRequest(req);
77
+ req[this.reqKey] = (await this.handler.subDelete(this.param, req.mongooseQuery, this.getQuery(req)));
78
+ this.express.postHistory(req, true).then();
79
+ this.validateReq(req);
80
+ this.express.removeRootRequest(req, this.express.options.slugKey);
81
+ next();
82
+ }
83
+ catch (e) {
84
+ next(QueryError.catch(e));
85
+ }
86
+ }
87
+ async json(req, res, next) {
88
+ try {
89
+ this.validateReq(req);
90
+ res.json(req[this.reqKey]);
91
+ }
92
+ catch (e) {
93
+ next(QueryError.catch(e));
94
+ }
95
+ }
96
+ getQuery(req) {
97
+ const param = this.express.getParam(req, this.reqKey);
98
+ return { _id: new mongoose.Types.ObjectId(param) };
99
+ }
100
+ validateReq(req) {
101
+ if (!req[this.reqKey]) {
102
+ throw new QueryError(httpStatus.NOT_FOUND, String(this.param), {
103
+ detail: 'Param not found',
104
+ });
105
+ }
106
+ }
107
+ getSubDoc(req) {
108
+ return req[this.reqKey];
109
+ }
110
+ }
@@ -0,0 +1,18 @@
1
+ import { ISearchPaginate, Query, QueryHistory } from '@ewb/mongoose-query';
2
+ import type mongoose from 'mongoose';
3
+ import { IQueryExpressOptions } from './QueryExpress.js';
4
+ declare global {
5
+ namespace Express {
6
+ interface Request {
7
+ id: string;
8
+ mongooseQuery: Query<any>;
9
+ mongooseHistory?: QueryHistory<any>;
10
+ mongooseHandlerOptions?: IQueryExpressOptions;
11
+ mongoosePostBody: {
12
+ [key: string]: string | mongoose.Types.ObjectId;
13
+ };
14
+ mongooseExportJson?: any[];
15
+ mongooseSearchJson?: ISearchPaginate<any>;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import './declarations';
2
+ import { Request, NextFunction, Response } from 'express';
3
+ export * from './QueryExpress.js';
4
+ declare function queryExpress(req: Request, _res: Response, next: NextFunction): void;
5
+ export default queryExpress;
6
+ export { queryExpress };
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import './declarations';
2
+ import { Query } from '@ewb/mongoose-query';
3
+ export * from './QueryExpress.js';
4
+ function queryExpress(req, _res, next) {
5
+ try {
6
+ req.mongooseQuery = new Query(req.query);
7
+ next();
8
+ }
9
+ catch (e) {
10
+ next(e);
11
+ }
12
+ }
13
+ export default queryExpress;
14
+ export { queryExpress };
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../node_modules/typescript/lib/lib.scripthost.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/typescript/lib/lib.es2021.full.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostic_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/ts3.6/base.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/base.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/send/node_modules/@types/mime/index.d.ts","../node_modules/@types/send/index.d.ts","../node_modules/@types/range-parser/index.d.ts","../node_modules/@types/qs/index.d.ts","../node_modules/@types/express-serve-static-core/index.d.ts","../node_modules/@types/mime/mime.d.ts","../node_modules/@types/mime/index.d.ts","../node_modules/@types/serve-static/index.d.ts","../node_modules/@types/connect/index.d.ts","../node_modules/@types/body-parser/index.d.ts","../node_modules/@types/express/index.d.ts","../node_modules/bson/bson.d.ts","../node_modules/mongodb/mongodb.d.ts","../node_modules/mongoose/types/aggregate.d.ts","../node_modules/mongoose/types/callback.d.ts","../node_modules/mongoose/types/collection.d.ts","../node_modules/mongoose/types/connection.d.ts","../node_modules/mongoose/types/cursor.d.ts","../node_modules/mongoose/types/document.d.ts","../node_modules/mongoose/types/error.d.ts","../node_modules/mongoose/types/expressions.d.ts","../node_modules/mongoose/types/helpers.d.ts","../node_modules/mongoose/types/middlewares.d.ts","../node_modules/mongoose/types/indexes.d.ts","../node_modules/mongoose/types/models.d.ts","../node_modules/mongoose/types/mongooseoptions.d.ts","../node_modules/mongoose/types/pipelinestage.d.ts","../node_modules/mongoose/types/populate.d.ts","../node_modules/mongoose/types/query.d.ts","../node_modules/mongoose/types/schemaoptions.d.ts","../node_modules/mongoose/types/schematypes.d.ts","../node_modules/mongoose/types/session.d.ts","../node_modules/mongoose/types/types.d.ts","../node_modules/mongoose/types/utility.d.ts","../node_modules/mongoose/types/validation.d.ts","../node_modules/mongoose/types/inferschematype.d.ts","../node_modules/mongoose/types/virtuals.d.ts","../node_modules/mongoose/types/index.d.ts","../node_modules/@ewb/mongoose-query/lib/queryerror.d.ts","../node_modules/@ewb/mongoose-query/lib/querymodel.d.ts","../node_modules/@ewb/mongoose-query/lib/utils/query.utils.d.ts","../node_modules/@ewb/mongoose-query/lib/utils/types.d.ts","../node_modules/@ewb/mongoose-query/lib/query.d.ts","../node_modules/@ewb/mongoose-query/lib/queryhandler.d.ts","../node_modules/@ewb/mongoose-query/lib/queryhistory.d.ts","../node_modules/@ewb/mongoose-query/lib/utils/utils.d.ts","../node_modules/@ewb/mongoose-query/lib/index.d.ts","../node_modules/http-status/lib/index.d.ts","../src/utils.ts","../src/queryexpresssub.ts","../src/queryexpress.ts","../src/declarations.ts","../src/index.ts","../node_modules/@types/chai/index.d.ts","../node_modules/@types/chai-subset/index.d.ts","../node_modules/@types/webidl-conversions/index.d.ts","../node_modules/@types/whatwg-url/index.d.ts"],"fileInfos":[{"version":"6a6b471e7e43e15ef6f8fe617a22ce4ecb0e34efa6c3dfcfe7cebd392bcca9d2","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569",{"version":"fcd3ecc9f764f06f4d5c467677f4f117f6abf49dee6716283aa204ff1162498b","affectsGlobalScope":true},{"version":"9a60b92bca4c1257db03b349d58e63e4868cfc0d1c8d0ba60c2dbc63f4e6c9f6","affectsGlobalScope":true},{"version":"c5c5565225fce2ede835725a92a28ece149f83542aa4866cfb10290bff7b8996","affectsGlobalScope":true},{"version":"7d2dbc2a0250400af0809b0ad5f84686e84c73526de931f84560e483eb16b03c","affectsGlobalScope":true},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"5114a95689b63f96b957e00216bc04baf9e1a1782aa4d8ee7e5e9acbf768e301","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"c1e8d979afc15d66e2bd5a58c732d5a2ba3ccaae41ac7d5a2c539e6de66a8e51","f5a6d1a8e21751af6fd0a8422d72ba825c15bce9a1af9d02fc0d992406f18f5f",{"version":"bf629ebbac2c65601bcb5c032644023a2b4b3b1151c0d1bf60ced7c35cc81b5d","affectsGlobalScope":true},"9d07804fffa0680a15b100ea9312078ffd9779429719240d3576bb592511bf31",{"version":"5129a3ed991a1de30a77462d41d3d27e945fa7213603114b65ce4de0ef297e6f","affectsGlobalScope":true},"e5cca775079552250e94c7dbbe3ac1a4fa91caae98fd83fb488440d478a5537c","8528e5fe802d788d89df3169c7a7cde25943d1cee6748a26d4210cf37d79baba",{"version":"a4565a5ce32bca81a0bf56c71168e0ca1e0941ccc15f896f808ccc7a71ba6fa8","affectsGlobalScope":true},"3111079f3cb5f2b9c812ca3f46161562bce5bfb355e915f46ed46c41714dc1c3","087a6c005a7aa76ca849cdc25a00de881291278f84361decb42701b8aff52f49","4481cd6e85120ea80d71866890faa032687d29ad820640a2b8547f04b80ed3ba","b6c2782fb0c0f113cc1c38745c57ab499dd4f459d4f76a2c083c9f6609919df0","6ac7d92ba8f420f89f63ad99af8b146a5bbfe6522be2cd7a179cb5e066975825","3996fc0e7ecec3111a208c9f3389f15381907ccfc0804f89839ec3bfdf630576","cea1624c6870349293bb4d5a4fe7b1e963392b50d34fa916a830dac5cd186ab0",{"version":"6189edcaa78cba8c1dfd1d12a8928fe0603e646009ffb9ddfa92eff0d824ce2c","affectsGlobalScope":true},"8123b4a3b707b071088f581a21f01738c7d390a28d5d712ec396d3f411e23037","4ef819c9ddb82d8e8c841c7ba9db2729915a97a0addfcda6a6a9f852b4a2a128","eb83d39b9e8404d7c73adf30bc666894028d9e567384fbf42cbae805058e24aa","99827736d6a22022a5a4c9ad847900667704560e8b10964bdd36d4412c1eb587","ec7606080747d7e424af23f9b69b02cc47855f045edafbdb2552ccdff9556b4f","ef70156b46b854df342204565597787b04ea8067c1bfd673279fc859bcae42b7",{"version":"6583daa9760bda81669417e393cf1fb9208422fdbcb4991569e59347e93f3e34","affectsGlobalScope":true},"ab108213eabd2bb2ea48db3f43ed77ca2965b22b22ad5a3d0c3b13576c60902e","e1aea0bae8186fee1b966d4e4e2a167ed0edd86668c609b1440ed0e81247462d","d15d11ea31228ad0c57cda43b406f7bb1712c6c8fe6dd9c27a90dbfc7a8d6117","ddbc96f468abfe7c1965eb69f75d267b4493a27a8eaa76ea25f8d8ef87fec846",{"version":"6fe3ec84b325c68a572b7febee0446ddccafa67a5c0701857f26acc4fec0801e","affectsGlobalScope":true},"b89ea948a92ce598bac83e0fd39ab4dd1f938b337287abe33d756950bfe31bd7","e09cc4f66a6cf31c2224129e990b91ca00b25b0826989264fbc4aaa7bf9f6460","85df3d396d50cf6706e8a7fdc94402adbfe636ff758ced46cdd8de906957ca1d","e72c97f28066c9d46cb3fe23f2978ef3a4cedee77ff1fd70634654d7df13bc25","7b9958476fc2d098848bad9eb338d0471dc90799235b3c81286da7ed904bcdcd","328b0780f9ea2c65b5811fb3de14122c00b0a6ebe5b9581e8892decd83b1f8a8","c55b1e6bee98c27c3ff8477a47ef182841cbf7883c0e8b47c76506532366c34c",{"version":"34085490aa2954356441cf6e769f2fab1ba11800264cbdcfd9ee10d70fe1ea47","affectsGlobalScope":true},"a7d28061d1dd9315187b6be305be679c0600a335f4921ce66af79b35104e0bbe","1a3649e06d4244990d2c19e0b3a13330b30747818604cdc0ef19318df80a2b3f","5367052357620c6e14cf2a53f7ede9f8d85f4a9dab6facc3da6ae445541b7372","bb0ef00324f06a878b5c102a6b9670d3562126c7a7a09b5318d5c2113974ce1c","1bc668fc53967b5d4071a9094110b20445a5992f9a226874b2c9ac4e904ad033","5c067020e59677ac77cad8b01bdd01361f5315f289bcc50331e5750b4f29f5b7","45e9d7a11405d31fbb49e5d4fbad5c2d7dc9780f64338af388ba7ea9280b468f","6e25f951f1c64dc1fdda83ad3183b4af572b95218e736bf454185ac0c8abdf41","485a02812f947eb6011e70c44b3e815566b354efc90d4c2c5ac9d7bb3b948a42","b5cc8a2bdfe0163d116852650429c0a49ea75211dfaf66b7b0349fee7b3e8d83",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"f87509fed855ba8d77bcc1bbdd1acb8380a8092373c2caf3f04e5a8f8f3c5e5b","7e28b18588869fdeb3ff70581047ea017bae32c0baf1464b5b501c1ae00a96e0","c279f541b15691f99c82e130c9897740adf4584442b3610c5634f5684c1f5b60","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","06b4e032b397f9bad48024b5f942595d2b8c398ab462fd0ba961c5203efb8a55","84e3bbd6f80983d468260fdbfeeb431cc81f7ea98d284d836e4d168e36875e86","aad5ffa61406b8e19524738fcf0e6fda8b3485bba98626268fdf252d1b2b630a","16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c","ba601641fac98c229ccd4a303f747de376d761babb33229bb7153bed9356c9cc",{"version":"352fc8497a30bc806d7defa0043d85802e5f35a7688731ee9a21456f5cb32a94","affectsGlobalScope":true},"5b9ecf7da4d71cf3832dbb8336150fa924631811f488ad4690c2dfec2b4fb1d7","951c85f75aac041dddbedfedf565886a7b494e29ec1532e2a9b4a6180560b50e","e6f0cb9d8cb2e38bec66e032e73caa3e7c6671f21ed7196acb821aec462051f2","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","afc559c1b93df37c25aef6b3dfa2d64325b0e112e887ee18bf7e6f4ec383fc90","43cdd474c5aa3340da4816bb8f1ae7f3b1bcf9e70d997afc36a0f2c432378c84","d32c3d1874c62e9371b210270c8f6b13952dc9d2b2b7ab4ba36422fbaa0d4fdf","83e447888c9e2e970b44baf33cd866ad788ac9ea0b109c30cf1a4e238c4c96d2","f74568dffca2d1ab481b1cb7ab5a6d3243df15c251b5e9b81371593572a4db0c","0339d33fe49fbc1c70842c886195e01eafd37f7431dd7f32209dd0544c289474","35855ea1dd13580e3a3f4ada5c25395c4977c62b93fd5116411e7b9dff32d7ce","60cd8ff9333079eb7c4b336ec1ecb990bef1e86903b4dc76bd245ed83391857b","95d3fe855d03661b4aac9700a7c2ea90bbb07ec18e0d3f4515721782b34409b1","4f7f69cfee003fc3f5cde024b64fe2b99a21608b9ddf13fae431819e1919cbef",{"version":"994ea1a800a17dd70c8347a04b4eb4752dfb828597469612df0fd554036a494a","affectsGlobalScope":true},"5cf5ca4ac2a1137899d82f498490704b0bdc685f257288281465b90387480b71","3b251e4edc903f60ab560be43d72840f58a5bb6f6b297a78147436b6dba0bf51","cef52f02ebc94cc3924d9503596056408ae24f41b80e085b6fa848b2ffbda750","f058b0597336bf9349e1729bba98df02ecdc905ae0b1edb08563d03118e3883b","770ff5c30213ef0375a92c5304e12ed69675d7641fc142c046f728b5bf3eefeb","5c66dfbb0423690c019843fa4f10865ed16890286db8a7491e1fe383efb8f5ec","fd9d67d7d7cbbcf3cee6cb2abe2f17597502ddfb54c7225c3ae1d76d8ea6e2ee","1def7345d072569461d4ec7a9d22a4ecb294f080d68ad5792dfda31fbaa7e1f3","7a3ba75ccec64299560cb8758209d03a6c97bc3a8a889d5e96283979e0d27a91","1ae90068755e07d8ed682fff31d5c7df8a91ab9e179856f3aa12d012fb44864a","4ce8f30caf02eb00b7a9492b684bd2372b06ed73dc48876e35743ebf9d7b9c19","861b3b1cea0c4dbfd58cd3cb7a630ea8270b4ce92091941c263f4b4c6c21119b","603a841d9a16701de1bfef4b5b891c5b032ef35cd87cfa321686a442886bf43b","aa1c6517bfd85495cd39b163fadbb9dd7c9a0f53332c9e80cc25f891de977269","9a30407da46d2859a7e600ac6767df7621718f69a5bf5564a7d60833535c4f20","9f440fa842c6ff9f14c9f98a5430b1272680d59fe42ce2b5aec29db53e511e6e","f967724c16fb47d360ad8fa1cedeacc045bd4b199535a3adcc85a1216b045ab8",{"version":"55ac34bc358b6445ef427f7b56fc6546dffdf5b172d61a4fd18c245ee6098731","affectsGlobalScope":true},"abbb65bfc5effad953c7cd28045f131fe558b236552cd8f8c64b8c3297e00de7","3dc4190acbe82e237716954de7669d08a0449e07eafabcf3d5d8e73d9d530046","0bac6b8529aea9a4279475185f3d78f85a942c0a2809cbeb410533c07d37cc0f","2f40762f347aa81e3ba9122b4f0b7c55d61486c99c71982bc5caa366def44c09","ca76728dc3974b2976940a2598a382ea0e30ad5a4b87bcb62a2dff73f07a2646","587630608bd97d4e6ee4fb201e5c63d3fca4ac3a5363b81f6393d40494568383","02037ef4e5e92fb423ac15f1f5e21fedb9a0ecc5ecd4e3890a8a9403a71a042e","3e9b2ea67229a6a8daa0b72134fd4b3eeffbcc5956abc9c43bcd03a57e19439f","396af7e3ba5f9d041e60412c5a4348124125f670286fb81727c43cdeb9bdfe58","3c2ab4ca0ca6448c068ee17a59c3f230e79fcb0a3a550ef6a503a88e9e444dd6",{"version":"7b31c657712fc6af08bd4e39508d3254e5325ec57b3aa14e686f5b2c028f8244","signature":"841c9e8c66e7c95f257be54c505929368bfbd686d4d68e85adf2e9ea35297dbc"},{"version":"e509ebaa720c3f47f1f302c49a1de88f0f0c04cedba20db6c678fd8937d208f9","signature":"f96177721139d7317810f1d386b235a31f431674289a63f560dafcad761d9993"},{"version":"8b45b57b9bdab8dc09ac970cf502e9e169ea3e326b8b2751a860689ac0daca5c","signature":"f412798d878456326a83d379026608afbc318682d0dbeac4bd999d6b91d68f2e"},{"version":"d64c9995fd856789015483c4f67a538aba5d7f4d5693f514aa3691dbbec91ab4","signature":"c7d2e5aceef7c6f8adeb1ea8eba0d6083c3058b5a8caf29846f886f949c4b8c2","affectsGlobalScope":true},{"version":"76952b9049c33670de9e8fcba33928983d42727467825e66f486ba55f34a16fa","signature":"14c5818be10ada5e81ee21bbb9d2bf32d32fd986178e5ef478203bb75834b41f"},{"version":"c3bc5d095c3c22fd20b5a6550b9c9a6d56c3ffbb87ef057ccce7764b6bed4428","affectsGlobalScope":true},{"version":"f4c0db3a49cea9babd5d224ba14243a6a6119bf65a65198994033aaea3a60a71","affectsGlobalScope":true},"ea2d34766aa08df002a696e27d2140c0834cb8d7e9cb35687ecfd578253c196c","67483628398336d0f9368578a9514bd8cc823a4f3b3ab784f3942077e5047335"],"root":[[153,157]],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"declarationMap":false,"esModuleInterop":true,"module":99,"noImplicitAny":false,"noImplicitReturns":false,"noUnusedLocals":true,"noUnusedParameters":false,"outDir":"./","removeComments":true,"skipLibCheck":true,"sourceMap":false,"strict":false,"target":8},"fileIdsList":[[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,144,145,146],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,144,147],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,147],[71,88,89,104,113,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,158],[71,88,89,104,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,71,88,89,104,106,107,108,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,108,109,112,114,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,110,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,111,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,102,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[54,88,89,102,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[56,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,101,102,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[57,62,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[58,68,69,76,85,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[58,59,68,76,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[60,88,89,94,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[61,62,69,77,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[62,85,88,89,90,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[63,65,68,76,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[64,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[65,66,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[67,68,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,69,70,85,88,89,93,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,69,70,85,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[71,76,85,88,89,93,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,69,71,72,76,85,88,89,90,93,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[71,73,88,89,90,93,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,103,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,74,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[75,88,89,93,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[65,68,76,85,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[77,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[78,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[56,79,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[80,88,89,92,97,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[81,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[82,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,83,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[83,84,88,89,94,96,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,85,86,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[85,86,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[87,88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[62,76,88,89,90,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,91,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[76,88,89,92,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[71,82,88,89,93,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[62,88,89,94,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[85,88,89,95,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,96,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,100,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[57,62,68,70,79,85,88,89,93,96,97,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[85,88,89,98,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[69,85,88,89,104,105,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[71,88,89,104,111,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,104,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[65,68,76,85,88,89,90,104,116,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,88,89,117,118,119,120,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[85,88,89,118,119,120,121,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[68,88,89,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,126,127,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,126,127,128,130,131,132,133,134,135,136,137,138,139,140,141,142],[85,88,89,118,119,120,121,122,123,124,125,126,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,132,133,134,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,134,135,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,135,136,137,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,136,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,137,138,139,140,141,142],[88,89,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,138,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,140,141,142],[88,89,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142],[88,89,115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,151,155],[88,89,115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,145,151,155,156],[88,89,115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,151,152,153,154],[88,89,115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,151,152,153,155],[88,89,115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,150,151],[118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,151,155],[115,155,156],[115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,151,154],[115,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,151,155],[115,151]],"referencedMap":[[151,1],[147,2],[143,3],[148,4],[149,3],[144,5],[145,3],[146,3],[150,5],[114,6],[159,7],[158,3],[113,8],[109,9],[115,10],[111,11],[110,12],[102,13],[54,14],[56,15],[103,16],[57,17],[58,18],[59,19],[60,20],[61,21],[62,22],[63,23],[64,24],[65,25],[66,25],[67,26],[68,27],[69,28],[70,29],[55,3],[99,3],[71,30],[72,31],[73,32],[104,33],[74,34],[75,35],[76,36],[77,37],[78,38],[79,39],[80,40],[81,41],[82,42],[83,43],[84,44],[85,45],[86,46],[87,47],[88,27],[89,3],[90,48],[91,49],[101,50],[92,51],[93,52],[94,53],[95,54],[96,55],[100,56],[97,57],[98,58],[108,3],[107,3],[106,59],[105,3],[112,60],[160,3],[161,61],[116,3],[152,3],[117,62],[118,63],[119,64],[120,65],[121,66],[122,67],[123,68],[124,69],[125,70],[126,71],[142,72],[128,73],[140,3],[127,74],[129,75],[130,76],[131,77],[132,78],[133,79],[134,80],[135,81],[136,82],[137,83],[138,84],[139,85],[141,86],[51,3],[52,3],[9,3],[10,3],[14,3],[13,3],[2,3],[15,3],[16,3],[17,3],[18,3],[19,3],[20,3],[21,3],[22,3],[3,3],[4,3],[26,3],[23,3],[24,3],[25,3],[27,3],[28,3],[29,3],[5,3],[30,3],[31,3],[32,3],[33,3],[6,3],[37,3],[34,3],[35,3],[36,3],[38,3],[7,3],[39,3],[44,3],[45,3],[40,3],[41,3],[42,3],[43,3],[8,3],[53,3],[49,3],[46,3],[47,3],[48,3],[1,3],[50,3],[12,3],[11,3],[156,87],[157,88],[155,89],[154,90],[153,91]],"exportedModulesMap":[[151,1],[147,2],[143,3],[148,4],[149,3],[144,5],[145,3],[146,3],[150,5],[114,6],[159,7],[158,3],[113,8],[109,9],[115,10],[111,11],[110,12],[102,13],[54,14],[56,15],[103,16],[57,17],[58,18],[59,19],[60,20],[61,21],[62,22],[63,23],[64,24],[65,25],[66,25],[67,26],[68,27],[69,28],[70,29],[55,3],[99,3],[71,30],[72,31],[73,32],[104,33],[74,34],[75,35],[76,36],[77,37],[78,38],[79,39],[80,40],[81,41],[82,42],[83,43],[84,44],[85,45],[86,46],[87,47],[88,27],[89,3],[90,48],[91,49],[101,50],[92,51],[93,52],[94,53],[95,54],[96,55],[100,56],[97,57],[98,58],[108,3],[107,3],[106,59],[105,3],[112,60],[160,3],[161,61],[116,3],[152,3],[117,62],[118,63],[119,64],[120,65],[121,66],[122,67],[123,68],[124,69],[125,70],[126,71],[142,72],[128,73],[140,3],[127,74],[129,75],[130,76],[131,77],[132,78],[133,79],[134,80],[135,81],[136,82],[137,83],[138,84],[139,85],[141,86],[51,3],[52,3],[9,3],[10,3],[14,3],[13,3],[2,3],[15,3],[16,3],[17,3],[18,3],[19,3],[20,3],[21,3],[22,3],[3,3],[4,3],[26,3],[23,3],[24,3],[25,3],[27,3],[28,3],[29,3],[5,3],[30,3],[31,3],[32,3],[33,3],[6,3],[37,3],[34,3],[35,3],[36,3],[38,3],[7,3],[39,3],[44,3],[45,3],[40,3],[41,3],[42,3],[43,3],[8,3],[53,3],[49,3],[46,3],[47,3],[48,3],[1,3],[50,3],[12,3],[11,3],[156,92],[157,93],[155,94],[154,95],[153,96]],"semanticDiagnosticsPerFile":[151,147,143,148,149,144,145,146,150,114,159,158,113,109,115,111,110,102,54,56,103,57,58,59,60,61,62,63,64,65,66,67,68,69,70,55,99,71,72,73,104,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,101,92,93,94,95,96,100,97,98,108,107,106,105,112,160,161,116,152,117,118,119,120,121,122,123,124,125,126,142,128,140,127,129,130,131,132,133,134,135,136,137,138,139,141,51,52,9,10,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,53,49,46,47,48,1,50,12,11,156,157,155,154,153]},"version":"5.0.4"}
package/lib/utils.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { ISearchPaginate } from '@ewb/mongoose-query';
2
+ import { Request } from 'express';
3
+ export declare function pageLinkHeader(req: Request, data: ISearchPaginate<any>): string;
package/lib/utils.js ADDED
@@ -0,0 +1,5 @@
1
+ import { getPageLinkHeader } from '@ewb/mongoose-query';
2
+ export function pageLinkHeader(req, data) {
3
+ const rootUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
4
+ return getPageLinkHeader(rootUrl, req.mongooseQuery, data);
5
+ }
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@ewb/mongoose-query-express",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Routes and controllers for express to handle mongoose queries",
6
+ "main": "./lib/index.js",
7
+ "types": "./lib/index.d.ts",
8
+ "scripts": {
9
+ "dev": "yarn build:watch",
10
+ "build": "tsc",
11
+ "build:watch": "tsc --watch --incremental",
12
+ "lint": "tslint --project \"./tsconfig.json\"",
13
+ "test": "vitest run",
14
+ "test:ui": "vitest --ui",
15
+ "postversion": "git push && git push --tags",
16
+ "prepublish": "yarn test && yarn build",
17
+ "preversion": "yarn build"
18
+ },
19
+ "dependencies": {
20
+ "@ewb/mongoose-query": "^1.0.3",
21
+ "express-mongo-sanitize": "^2.2.0",
22
+ "http-status": "^1.6.2",
23
+ "jsondiffpatch": "^0.4.1"
24
+ },
25
+ "devDependencies": {
26
+ "@types/express": "^4.17.17",
27
+ "@vitest/ui": "^0.31.1",
28
+ "express": "^4.18.2",
29
+ "husky": "^8.0.3",
30
+ "lint-staged": "^13.2.2",
31
+ "mongoose": "^7.2.1",
32
+ "prettier": "^2.8.8",
33
+ "tslint": "^6.1.3",
34
+ "typescript": "^5.0.4",
35
+ "vitest": "^0.31.1"
36
+ },
37
+ "peerDependencies": {},
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/emilswebbod/mongoose-query-express.git"
41
+ },
42
+ "keywords": [
43
+ "typescript",
44
+ "npm",
45
+ "translate"
46
+ ],
47
+ "author": "Emils Webbod",
48
+ "license": "MIT",
49
+ "bugs": {
50
+ "url": "https://github.com/emilswebbod/mongoose-query-express/issues"
51
+ },
52
+ "homepage": "https://github.com/emilswebbod/mongoose-query-express#readme",
53
+ "files": [
54
+ "lib"
55
+ ],
56
+ "husky": {
57
+ "hooks": {
58
+ "pre-commit": "pretty-quick --staged"
59
+ }
60
+ },
61
+ "resolutions": {}
62
+ }