mongoose-query-find 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +127 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +371 -281
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,17 +7,19 @@
|
|
|
7
7
|
* - URL query string → Mongoose filter (sanitized, validated, coerced)
|
|
8
8
|
* - Global full-text search via $or regex
|
|
9
9
|
* - Flexible sort, field projection, and populate
|
|
10
|
-
* - count + find run fully in parallel (Promise.all)
|
|
10
|
+
* - count + find run fully in parallel (Promise.all) — no wasted round-trips
|
|
11
11
|
* - Hard limits on page size, sort fields, search length, nesting depth (DoS protection)
|
|
12
12
|
* - Allowlist-based field filtering on filters, sort, AND projection (NoSQL injection prevention)
|
|
13
13
|
* - Case-insensitive allowlist matching (e.g. allowFields(['Name']) matches ?name=, ?NAME=, ?Name=)
|
|
14
14
|
* - Deep recursive operator validation (catches nested $where, $expr, etc.)
|
|
15
15
|
* - Deep recursive boolean coercion (handles nested query objects)
|
|
16
16
|
* - Deep recursive operator-key coercion (eq/ne/gt/... → $eq/$ne/$gt/...), applied
|
|
17
|
-
* ONLY to object keys — never to string values
|
|
17
|
+
* ONLY to object keys — never to string values
|
|
18
18
|
* - estimatedDocumentCount fast-path when no filter is applied
|
|
19
19
|
* - Query timeout via maxTimeMS (prevents runaway queries)
|
|
20
20
|
* - Structured error types for clean upstream handling
|
|
21
|
+
* - Optional cached total for skipping re-count on page > 1
|
|
22
|
+
* - Optional slow-query hook for observability
|
|
21
23
|
* - Zero external runtime dependencies beyond mongoose
|
|
22
24
|
*/
|
|
23
25
|
import { Model, PopulateOptions, Query } from 'mongoose';
|
|
@@ -38,12 +40,40 @@ export interface PaginatedResult<T> {
|
|
|
38
40
|
hasNextPage: boolean;
|
|
39
41
|
hasPrevPage: boolean;
|
|
40
42
|
}
|
|
43
|
+
export interface SlowQueryInfo {
|
|
44
|
+
/** Elapsed time in milliseconds */
|
|
45
|
+
elapsedMs: number;
|
|
46
|
+
/** The Mongoose filter that was applied */
|
|
47
|
+
filter: Record<string, unknown>;
|
|
48
|
+
/** The sort that was applied */
|
|
49
|
+
sort: Record<string, 1 | -1>;
|
|
50
|
+
/** The page that was requested */
|
|
51
|
+
page: number;
|
|
52
|
+
/** The limit that was applied */
|
|
53
|
+
limit: number;
|
|
54
|
+
}
|
|
41
55
|
export interface QueryFindOptions {
|
|
56
|
+
maxTimeMS?: number;
|
|
42
57
|
/**
|
|
43
|
-
*
|
|
44
|
-
* Defaults to
|
|
58
|
+
* Threshold in ms above which onSlowQuery fires.
|
|
59
|
+
* Defaults to maxTimeMS. Set lower (e.g. 1000) to catch slow-but-not-timed-out queries.
|
|
45
60
|
*/
|
|
46
|
-
|
|
61
|
+
slowQueryThresholdMS?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Called when a query exceeds slowQueryThresholdMS.
|
|
64
|
+
* Use to emit metrics, log to your APM, etc.
|
|
65
|
+
*/
|
|
66
|
+
onSlowQuery?: (info: SlowQueryInfo) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Called when sanitize() silently drops a value (e.g. a Date or class instance).
|
|
69
|
+
* Defaults to console.warn in non-production environments.
|
|
70
|
+
*/
|
|
71
|
+
onSanitizeDrop?: (path: string, value: unknown) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Whether to call .lean() on find queries (default: true).
|
|
74
|
+
* Set to false if you need Mongoose document instances (virtuals, instance methods).
|
|
75
|
+
*/
|
|
76
|
+
lean?: boolean;
|
|
47
77
|
}
|
|
48
78
|
export declare class QueryFindError extends Error {
|
|
49
79
|
constructor(message: string);
|
|
@@ -56,7 +86,7 @@ export declare class QueryFindValidationError extends QueryFindError {
|
|
|
56
86
|
*
|
|
57
87
|
* @example
|
|
58
88
|
* ```ts
|
|
59
|
-
* const result = await
|
|
89
|
+
* const result = await new QueryFind(User.find(), req.query)
|
|
60
90
|
* .allowFields(['name', 'email', 'role', 'createdAt'])
|
|
61
91
|
* .where({ orgId: req.user.orgId, deletedAt: null })
|
|
62
92
|
* .filter()
|
|
@@ -66,79 +96,100 @@ export declare class QueryFindValidationError extends QueryFindError {
|
|
|
66
96
|
* .populate('department', 'name')
|
|
67
97
|
* .paginate();
|
|
68
98
|
* ```
|
|
69
|
-
*
|
|
70
|
-
* Security notes:
|
|
71
|
-
* - `.allowFields()` before `.filter()` restricts which URL params reach Mongo.
|
|
72
|
-
* - Allowlist matching (filter/sort/projection) is case-insensitive — e.g.
|
|
73
|
-
* allowFields(['name']) also matches ?Name=, ?NAME=, etc. For `.filter()`,
|
|
74
|
-
* a matched field is also normalized back to the casing declared in
|
|
75
|
-
* allowFields() (e.g. ?NAME=foo -> { name: 'foo' }) so it matches the
|
|
76
|
-
* actual schema path.
|
|
77
|
-
* - `.where()` conditions are hard — URL cannot override them.
|
|
78
|
-
* - Unknown/banned $ operators throw QueryFindValidationError (checked recursively).
|
|
79
|
-
* - Nesting depth capped at 5; page size capped at 100; sort fields capped at 5.
|
|
80
|
-
* - Search terms are regex-escaped (ReDoS prevention) and length-capped at 200 chars.
|
|
81
|
-
* - ?fields= projection is allowlist-filtered to prevent sensitive field leakage.
|
|
82
|
-
* - Operator-key coercion (eq/gte/in/...) only touches object KEYS, never string
|
|
83
|
-
* VALUES — a search like ?name=eq or ?status=in cannot be corrupted into a
|
|
84
|
-
* Mongo operator.
|
|
85
|
-
* - All queries run with maxTimeMS to prevent runaway collection scans.
|
|
86
99
|
*/
|
|
87
100
|
export declare class QueryFind<TRawDocType, TModelType extends Model<TRawDocType> = Model<TRawDocType>> {
|
|
88
101
|
private readonly model;
|
|
89
102
|
private readonly qs;
|
|
90
103
|
private readonly options;
|
|
91
104
|
private _allowedFields;
|
|
92
|
-
/** Lowercase mirror of _allowedFields, used for case-insensitive matching. */
|
|
93
105
|
private _allowedLookup;
|
|
94
|
-
private
|
|
106
|
+
private _canonicalMap;
|
|
107
|
+
/**
|
|
108
|
+
* URL-derived filter and server-side conditions are kept separate so that
|
|
109
|
+
* server conditions merged last in paginate() can never be overwritten by
|
|
110
|
+
* URL params, regardless of the order in which where() and filter() are called.
|
|
111
|
+
*/
|
|
112
|
+
private _urlFilter;
|
|
113
|
+
private _serverConditions;
|
|
114
|
+
/**
|
|
115
|
+
* $or clauses from globalSearch() are collected here and assembled once
|
|
116
|
+
* inside buildFinalFilter(). This prevents double-call from re-wrapping the
|
|
117
|
+
* entire filter in nested $and.
|
|
118
|
+
*/
|
|
119
|
+
private _searchOr;
|
|
95
120
|
private _sort;
|
|
96
121
|
private _select;
|
|
97
122
|
private _populates;
|
|
123
|
+
/** Stored so limitFields() can fall back to it when ?fields= is fully blocked. */
|
|
124
|
+
private _defaultFields;
|
|
125
|
+
/** Parsed once in the constructor — not recomputed on every paginate() call. */
|
|
126
|
+
private readonly _page;
|
|
127
|
+
private readonly _limit;
|
|
98
128
|
constructor(query: Query<TRawDocType[], TRawDocType>, queryString: QueryParams, options?: QueryFindOptions);
|
|
99
129
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
130
|
+
* Declares which fields the client is permitted to filter, sort, and select.
|
|
131
|
+
* Must be called before filter(), sort(), and limitFields() to take effect.
|
|
132
|
+
* Matching is case-insensitive: allowFields(['Name']) accepts ?name=, ?NAME=.
|
|
133
|
+
*
|
|
134
|
+
* @example .allowFields(['basicInfo.name', 'pricing.base', 'status'])
|
|
105
135
|
*/
|
|
106
136
|
allowFields(fields: string[]): this;
|
|
107
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Parses URL query params into a Mongoose filter and merges them into the
|
|
139
|
+
* URL-derived filter store. Only fields present in allowFields() pass through.
|
|
140
|
+
* Reserved keys (page, sort, limit, fields, q) are always stripped first.
|
|
141
|
+
*/
|
|
108
142
|
filter(): this;
|
|
109
143
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
144
|
+
* Applies mandatory server-side conditions that the client cannot override.
|
|
145
|
+
* Conditions are merged into the final filter after URL-derived values, so
|
|
146
|
+
* they always win regardless of what the client sends.
|
|
147
|
+
*
|
|
148
|
+
* Unlike filter(), values here are not sanitized — ObjectIds, Dates, and
|
|
149
|
+
* other non-plain types are valid. Banned $ operators are still rejected.
|
|
112
150
|
*
|
|
113
|
-
* @example .where({
|
|
151
|
+
* @example .where({ linkedTo: req.user.orgId, deletedAt: null })
|
|
114
152
|
*/
|
|
115
153
|
where(conditions: Partial<Record<keyof TRawDocType, unknown>>): this;
|
|
116
154
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
155
|
+
* Enables case-insensitive full-text search across the given fields when
|
|
156
|
+
* ?q= is present in the query string. Fields not in allowFields() are
|
|
157
|
+
* silently skipped. Safe to call multiple times — subsequent calls extend
|
|
158
|
+
* the $or clause list rather than re-wrapping the filter.
|
|
159
|
+
*
|
|
160
|
+
* @example .globalSearch(['basicInfo.name', 'basicInfo.sku'])
|
|
120
161
|
*/
|
|
121
162
|
globalSearch(fields: string[]): this;
|
|
122
163
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* Capped at MAX_SORT_FIELDS
|
|
164
|
+
* Parses the ?sort= query param into a Mongoose sort object. Fields not in
|
|
165
|
+
* allowFields() are silently dropped. Falls back to DEFAULT_SORT when the
|
|
166
|
+
* parsed result is empty. Capped at MAX_SORT_FIELDS entries.
|
|
167
|
+
*
|
|
168
|
+
* Prefix a field with - for descending order: ?sort=-createdAt,name
|
|
126
169
|
*/
|
|
127
170
|
sort(): this;
|
|
128
171
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
172
|
+
* Controls which fields are returned by the query.
|
|
173
|
+
*
|
|
174
|
+
* When ?fields= is present in the URL, the value is parsed as a
|
|
175
|
+
* comma-separated list and filtered through the allowlist. Only fields
|
|
176
|
+
* declared in allowFields() will be included in the projection.
|
|
177
|
+
*
|
|
178
|
+
* When ?fields= is absent, `defaultFields` is used as-is (no allowlist
|
|
179
|
+
* filtering) — this is the server-controlled default projection.
|
|
131
180
|
*
|
|
132
|
-
* When
|
|
133
|
-
*
|
|
134
|
-
*
|
|
181
|
+
* When ?fields= is present but every requested field is blocked by the
|
|
182
|
+
* allowlist, the projection falls back to `defaultFields` rather than
|
|
183
|
+
* omitting select() entirely (which would return all fields).
|
|
135
184
|
*
|
|
136
|
-
* @param defaultFields
|
|
137
|
-
*
|
|
185
|
+
* @param defaultFields - Space-separated Mongoose projection string used
|
|
186
|
+
* when the client does not specify ?fields=.
|
|
187
|
+
* Example: 'basicInfo.name pricing.base status -__v'
|
|
138
188
|
*/
|
|
139
189
|
limitFields(defaultFields?: string): this;
|
|
140
190
|
/**
|
|
141
|
-
*
|
|
191
|
+
* Registers a populate path to be applied on the find query.
|
|
192
|
+
* populate.match conditions are sanitized and validated like any other filter.
|
|
142
193
|
*
|
|
143
194
|
* @example
|
|
144
195
|
* .populate('author')
|
|
@@ -147,17 +198,37 @@ export declare class QueryFind<TRawDocType, TModelType extends Model<TRawDocType
|
|
|
147
198
|
*/
|
|
148
199
|
populate(path: string | PopulateOptions, select?: string): this;
|
|
149
200
|
/**
|
|
150
|
-
*
|
|
201
|
+
* Assembles the final Mongoose filter from three sources in priority order:
|
|
202
|
+
* 1. URL-derived filter (lowest priority — client controlled)
|
|
203
|
+
* 2. Global search $or clause
|
|
204
|
+
* 3. Server conditions (highest priority — cannot be overridden by client)
|
|
205
|
+
*/
|
|
206
|
+
private buildFinalFilter;
|
|
207
|
+
private execFind;
|
|
208
|
+
/**
|
|
209
|
+
* Uses estimatedDocumentCount when no filter is active for a fast O(1) count.
|
|
210
|
+
* Falls back to countDocuments when a filter is present.
|
|
211
|
+
*/
|
|
212
|
+
private execCount;
|
|
213
|
+
/**
|
|
214
|
+
* Wraps an async operation with slow-query detection. When onSlowQuery is
|
|
215
|
+
* provided and the operation exceeds slowQueryThresholdMS, the hook is called
|
|
216
|
+
* with timing and query metadata for observability.
|
|
217
|
+
*/
|
|
218
|
+
private wrapTimed;
|
|
219
|
+
/**
|
|
220
|
+
* Executes the query and returns a paginated result.
|
|
221
|
+
*
|
|
222
|
+
* On page 1, count and find run in parallel via Promise.all.
|
|
223
|
+
* On subsequent pages, pass the previously returned `total` as `cachedTotal`
|
|
224
|
+
* to skip the count query entirely.
|
|
151
225
|
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* - .lean() returns plain objects (~3-5× faster for read-only responses).
|
|
155
|
-
* - maxTimeMS applied to both count and find (prevents runaway scans).
|
|
156
|
-
* - page is clamped to 1 if it exceeds totalPages (safe mid-delete behavior).
|
|
226
|
+
* @param cachedTotal - Total document count from a prior page-1 response.
|
|
227
|
+
* When provided, the countDocuments call is skipped for this request.
|
|
157
228
|
*
|
|
158
|
-
* @throws {QueryFindValidationError}
|
|
229
|
+
* @throws {QueryFindValidationError} when the URL contains a disallowed $ operator.
|
|
159
230
|
*/
|
|
160
|
-
paginate(): Promise<PaginatedResult<TRawDocType>>;
|
|
231
|
+
paginate(cachedTotal?: number): Promise<PaginatedResult<TRawDocType>>;
|
|
161
232
|
}
|
|
162
233
|
/**
|
|
163
234
|
* Convenience factory — avoids `new` at the call site.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AA+CnE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAC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GAAG,IAAI;IAyBzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAuB/D;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,QAAQ;IAmBhB;;;OAGG;YACW,SAAS;IAiBvB;;;;OAIG;YACW,SAAS;IAsBvB;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;CAuF5E;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EACpB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,CAAC,CAAC,CAAC,CAEd;AAED,eAAe,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,41 +8,32 @@
|
|
|
8
8
|
* - URL query string → Mongoose filter (sanitized, validated, coerced)
|
|
9
9
|
* - Global full-text search via $or regex
|
|
10
10
|
* - Flexible sort, field projection, and populate
|
|
11
|
-
* - count + find run fully in parallel (Promise.all)
|
|
11
|
+
* - count + find run fully in parallel (Promise.all) — no wasted round-trips
|
|
12
12
|
* - Hard limits on page size, sort fields, search length, nesting depth (DoS protection)
|
|
13
13
|
* - Allowlist-based field filtering on filters, sort, AND projection (NoSQL injection prevention)
|
|
14
14
|
* - Case-insensitive allowlist matching (e.g. allowFields(['Name']) matches ?name=, ?NAME=, ?Name=)
|
|
15
15
|
* - Deep recursive operator validation (catches nested $where, $expr, etc.)
|
|
16
16
|
* - Deep recursive boolean coercion (handles nested query objects)
|
|
17
17
|
* - Deep recursive operator-key coercion (eq/ne/gt/... → $eq/$ne/$gt/...), applied
|
|
18
|
-
* ONLY to object keys — never to string values
|
|
18
|
+
* ONLY to object keys — never to string values
|
|
19
19
|
* - estimatedDocumentCount fast-path when no filter is applied
|
|
20
20
|
* - Query timeout via maxTimeMS (prevents runaway queries)
|
|
21
21
|
* - Structured error types for clean upstream handling
|
|
22
|
+
* - Optional cached total for skipping re-count on page > 1
|
|
23
|
+
* - Optional slow-query hook for observability
|
|
22
24
|
* - Zero external runtime dependencies beyond mongoose
|
|
23
25
|
*/
|
|
24
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
27
|
exports.queryFind = exports.QueryFind = exports.QueryFindValidationError = exports.QueryFindError = void 0;
|
|
26
28
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
27
29
|
const RESERVED_KEYS = new Set(['page', 'sort', 'limit', 'fields', 'q']);
|
|
28
|
-
/** Hard cap — prevents clients from dumping the whole collection. */
|
|
29
30
|
const MAX_LIMIT = 100;
|
|
30
|
-
/** Hard cap — prevents DoS via ?a[b][c][d][e][f]=1 */
|
|
31
31
|
const MAX_NESTING_DEPTH = 5;
|
|
32
|
-
/** Hard cap — prevents compiling huge regexes from ?q= */
|
|
33
32
|
const MAX_SEARCH_LENGTH = 200;
|
|
34
|
-
/** Hard cap — prevents abuse via ?sort=a,b,c,d,e,f,... */
|
|
35
33
|
const MAX_SORT_FIELDS = 5;
|
|
36
|
-
/** Default query timeout in milliseconds — prevents runaway scans on unindexed fields. */
|
|
37
34
|
const DEFAULT_MAX_TIME_MS = 5000;
|
|
38
35
|
const DATE_FIELD_RE = /(^|\.)(createdAt|updatedAt|deletedAt|date|birthDate|expiresAt)$/i;
|
|
39
36
|
const PLAIN_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
40
|
-
/**
|
|
41
|
-
* Mongo comparison/array operator names accepted WITHOUT a leading "$" in
|
|
42
|
-
* the URL query string (e.g. `?age[gte]=18` → `{ age: { $gte: 18 } }`).
|
|
43
|
-
* Only ever applied to OBJECT KEYS during the recursive coercion pass —
|
|
44
|
-
* never to string values — so a value like `?name=eq` is left untouched.
|
|
45
|
-
*/
|
|
46
37
|
const COERCIBLE_OPS = new Set([
|
|
47
38
|
'eq',
|
|
48
39
|
'ne',
|
|
@@ -53,12 +44,9 @@ const COERCIBLE_OPS = new Set([
|
|
|
53
44
|
'in',
|
|
54
45
|
'nin',
|
|
55
46
|
]);
|
|
56
|
-
|
|
47
|
+
// Never mutated in place — spread into a new object wherever a mutable copy is needed.
|
|
48
|
+
const DEFAULT_SORT = { createdAt: -1 };
|
|
57
49
|
const ALLOWED_TOP_LEVEL_OPS = new Set(['$and', '$or', '$nor', '$not']);
|
|
58
|
-
/**
|
|
59
|
-
* Operators that are never permitted anywhere in a client-supplied filter,
|
|
60
|
-
* regardless of nesting depth. Catches $where, $expr, $function, etc.
|
|
61
|
-
*/
|
|
62
50
|
const BANNED_OPERATORS = new Set([
|
|
63
51
|
'$where',
|
|
64
52
|
'$expr',
|
|
@@ -95,192 +83,174 @@ function parseLimit(raw) {
|
|
|
95
83
|
return Math.min(n, MAX_LIMIT);
|
|
96
84
|
}
|
|
97
85
|
// ─── Sanitization ─────────────────────────────────────────────────────────────
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Recursively strips non-plain values (class instances, functions, Dates) from
|
|
88
|
+
* an arbitrary object so only JSON-safe primitives and plain objects reach the
|
|
89
|
+
* query pipeline. Notifies the caller via onDrop when values are removed.
|
|
90
|
+
*/
|
|
91
|
+
function sanitize(value, depth = 0, path = '', onDrop) {
|
|
92
|
+
if (depth > MAX_NESTING_DEPTH) {
|
|
93
|
+
if (onDrop) {
|
|
94
|
+
onDrop(path, value);
|
|
95
|
+
}
|
|
96
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
97
|
+
console.warn(`[query-find] sanitize() dropped value exceeding max nesting depth at path "${path}":`, value);
|
|
98
|
+
}
|
|
100
99
|
return undefined;
|
|
101
|
-
if (value === null ||
|
|
102
|
-
typeof value === 'string' ||
|
|
103
|
-
typeof value === 'number' ||
|
|
104
|
-
typeof value === 'boolean') {
|
|
105
|
-
return value;
|
|
106
100
|
}
|
|
101
|
+
if (value === null)
|
|
102
|
+
return null;
|
|
103
|
+
const t = typeof value;
|
|
104
|
+
if (t === 'string' || t === 'number' || t === 'boolean')
|
|
105
|
+
return value;
|
|
107
106
|
if (Array.isArray(value)) {
|
|
108
107
|
const out = [];
|
|
109
|
-
for (
|
|
110
|
-
const s = sanitize(
|
|
108
|
+
for (let i = 0; i < value.length; i++) {
|
|
109
|
+
const s = sanitize(value[i], depth + 1, `${path}[${i}]`, onDrop);
|
|
111
110
|
if (s !== undefined)
|
|
112
111
|
out.push(s);
|
|
113
112
|
}
|
|
114
113
|
return out;
|
|
115
114
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
115
|
+
if (t === 'object' && Object.getPrototypeOf(value) === Object.prototype) {
|
|
116
|
+
const src = value;
|
|
118
117
|
const out = {};
|
|
119
|
-
for (const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
for (const k in src) {
|
|
119
|
+
if (Object.prototype.hasOwnProperty.call(src, k)) {
|
|
120
|
+
const childPath = path ? `${path}.${k}` : k;
|
|
121
|
+
const s = sanitize(src[k], depth + 1, childPath, onDrop);
|
|
122
|
+
if (s !== undefined)
|
|
123
|
+
out[k] = s;
|
|
124
|
+
}
|
|
123
125
|
}
|
|
124
126
|
return out;
|
|
125
127
|
}
|
|
128
|
+
if (onDrop) {
|
|
129
|
+
onDrop(path, value);
|
|
130
|
+
}
|
|
131
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
132
|
+
console.warn(`[query-find] sanitize() dropped non-plain value at path "${path}":`, value);
|
|
133
|
+
}
|
|
126
134
|
return undefined;
|
|
127
135
|
}
|
|
128
136
|
// ─── Allowlist ────────────────────────────────────────────────────────────────
|
|
129
137
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* will match ?name=, ?NAME=, ?eMail=, etc.). The original-cased fields are
|
|
133
|
-
* still used wherever they need to be emitted (e.g. default sort/projection).
|
|
138
|
+
* Pre-computes a lowercase lookup set and a canonical-case map from the caller's
|
|
139
|
+
* allowlist. Built once per allowFields() call and reused across all methods.
|
|
134
140
|
*/
|
|
135
|
-
function
|
|
141
|
+
function buildAllowedStructures(allowedFields) {
|
|
136
142
|
const lookup = new Set();
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
const canonical = new Map();
|
|
144
|
+
for (const f of allowedFields) {
|
|
145
|
+
const lc = f.toLowerCase();
|
|
146
|
+
lookup.add(lc);
|
|
147
|
+
canonical.set(lc, f);
|
|
148
|
+
}
|
|
149
|
+
return { lookup, canonical };
|
|
140
150
|
}
|
|
141
|
-
/** Case-insensitive membership check against a lowercase lookup set. */
|
|
142
151
|
function isFieldAllowed(field, allowedLookup) {
|
|
143
152
|
return allowedLookup.has(field.toLowerCase());
|
|
144
153
|
}
|
|
145
154
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* rewritten to the casing originally declared in allowFields() — e.g.
|
|
150
|
-
* ?NAME=foo with allowFields(['name']) becomes { name: 'foo' }, not
|
|
151
|
-
* { NAME: 'foo' }, so it actually matches the schema path.
|
|
155
|
+
* Removes any non-operator key from `filter` that is not present in the
|
|
156
|
+
* allowlist. Operator keys (starting with $) are passed through unchanged
|
|
157
|
+
* because they are validated separately by rejectDisallowedOperators().
|
|
152
158
|
*/
|
|
153
|
-
function enforceAllowlist(filter, allowedLookup,
|
|
159
|
+
function enforceAllowlist(filter, allowedLookup, canonicalMap) {
|
|
154
160
|
if (allowedLookup.size === 0)
|
|
155
161
|
return filter;
|
|
156
162
|
const out = {};
|
|
157
|
-
for (const
|
|
163
|
+
for (const k in filter) {
|
|
164
|
+
if (!Object.prototype.hasOwnProperty.call(filter, k))
|
|
165
|
+
continue;
|
|
158
166
|
if (k.startsWith('$')) {
|
|
159
|
-
out[k] =
|
|
167
|
+
out[k] = filter[k];
|
|
160
168
|
continue;
|
|
161
169
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
out[canonical] = v;
|
|
170
|
+
const lc = k.toLowerCase();
|
|
171
|
+
if (allowedLookup.has(lc)) {
|
|
172
|
+
out[canonicalMap.get(lc) ?? k] = filter[k];
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
175
|
return out;
|
|
169
176
|
}
|
|
170
|
-
// ───
|
|
177
|
+
// ─── Fused coercion pass ──────────────────────────────────────────────────────
|
|
171
178
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
179
|
+
* Single-pass coercion that handles:
|
|
180
|
+
* - 'true' / 'false' strings → booleans
|
|
181
|
+
* - Date-field strings → Date objects (or $gte/$lt range for plain YYYY-MM-DD)
|
|
182
|
+
* - Shorthand operator keys (eq, ne, gt, …) → prefixed form ($eq, $ne, $gt, …)
|
|
176
183
|
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* including inside string VALUES (e.g. `?name=eq` or `?status=in`),
|
|
180
|
-
* silently corrupting user data into Mongo operators. By operating on the
|
|
181
|
-
* parsed object tree and only ever touching object KEYS, string values are
|
|
182
|
-
* never inspected or mutated.
|
|
184
|
+
* Operator-key coercion is applied only to object keys, never to string values,
|
|
185
|
+
* preventing accidental rewriting of user-supplied string data.
|
|
183
186
|
*/
|
|
184
|
-
function
|
|
185
|
-
if (
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
187
|
+
function coerceAll(value, parentKey = '') {
|
|
188
|
+
if (value === null)
|
|
189
|
+
return null;
|
|
190
|
+
if (typeof value === 'string') {
|
|
191
|
+
if (value === 'true')
|
|
192
|
+
return true;
|
|
193
|
+
if (value === 'false')
|
|
194
|
+
return false;
|
|
195
|
+
if (DATE_FIELD_RE.test(parentKey)) {
|
|
196
|
+
const parsed = new Date(value);
|
|
197
|
+
if (!isNaN(parsed.getTime())) {
|
|
198
|
+
if (PLAIN_DATE_RE.test(value)) {
|
|
199
|
+
const start = new Date(value);
|
|
200
|
+
const end = new Date(start);
|
|
201
|
+
end.setUTCDate(end.getUTCDate() + 1);
|
|
202
|
+
return { $gte: start, $lt: end };
|
|
203
|
+
}
|
|
204
|
+
return parsed;
|
|
205
|
+
}
|
|
196
206
|
}
|
|
197
|
-
return
|
|
207
|
+
return value;
|
|
198
208
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// ─── Type coercion ────────────────────────────────────────────────────────────
|
|
202
|
-
/**
|
|
203
|
-
* Recursively coerces string 'true'/'false' to booleans at any nesting depth.
|
|
204
|
-
* Fixes the original shallow-only implementation.
|
|
205
|
-
*/
|
|
206
|
-
function coerceBooleans(value) {
|
|
207
|
-
if (value === 'true')
|
|
208
|
-
return true;
|
|
209
|
-
if (value === 'false')
|
|
210
|
-
return false;
|
|
209
|
+
if (typeof value !== 'object')
|
|
210
|
+
return value;
|
|
211
211
|
if (Array.isArray(value)) {
|
|
212
|
-
return value.map((item) =>
|
|
213
|
-
}
|
|
214
|
-
if (value !== null &&
|
|
215
|
-
typeof value === 'object' &&
|
|
216
|
-
!(value instanceof Date) &&
|
|
217
|
-
Object.getPrototypeOf(value) === Object.prototype) {
|
|
218
|
-
const out = {};
|
|
219
|
-
for (const [k, v] of Object.entries(value)) {
|
|
220
|
-
out[k] = coerceBooleans(v);
|
|
221
|
-
}
|
|
222
|
-
return out;
|
|
212
|
+
return value.map((item) => coerceAll(item, parentKey));
|
|
223
213
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
214
|
+
if (value instanceof Date)
|
|
215
|
+
return value;
|
|
216
|
+
const src = value;
|
|
227
217
|
const out = {};
|
|
228
|
-
for (const
|
|
229
|
-
|
|
230
|
-
const path = isOp ? parentKey : parentKey ? `${parentKey}.${k}` : k;
|
|
231
|
-
if (v !== null &&
|
|
232
|
-
typeof v === 'object' &&
|
|
233
|
-
!Array.isArray(v) &&
|
|
234
|
-
!(v instanceof Date)) {
|
|
235
|
-
out[k] = coerceDates(v, path);
|
|
218
|
+
for (const k in src) {
|
|
219
|
+
if (!Object.prototype.hasOwnProperty.call(src, k))
|
|
236
220
|
continue;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// Leave unparseable strings as-is; Mongoose CastError → 400 upstream.
|
|
242
|
-
out[k] = v;
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
if (PLAIN_DATE_RE.test(v)) {
|
|
246
|
-
const start = new Date(v);
|
|
247
|
-
const end = new Date(start);
|
|
248
|
-
end.setUTCDate(end.getUTCDate() + 1);
|
|
249
|
-
out[k] = { $gte: start, $lt: end };
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
out[k] = parsed;
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
out[k] = v;
|
|
221
|
+
const newKey = COERCIBLE_OPS.has(k) ? `$${k}` : k;
|
|
222
|
+
const isOp = k.startsWith('$') || COERCIBLE_OPS.has(k);
|
|
223
|
+
const childPath = isOp ? parentKey : parentKey ? `${parentKey}.${k}` : k;
|
|
224
|
+
out[newKey] = coerceAll(src[k], childPath);
|
|
256
225
|
}
|
|
257
226
|
return out;
|
|
258
227
|
}
|
|
259
228
|
// ─── Operator validation ──────────────────────────────────────────────────────
|
|
260
229
|
/**
|
|
261
|
-
* Recursively walks
|
|
262
|
-
*
|
|
263
|
-
*
|
|
230
|
+
* Recursively walks a filter object and throws QueryFindValidationError on:
|
|
231
|
+
* - Any key present in BANNED_OPERATORS (e.g. $where, $expr)
|
|
232
|
+
* - Any top-level $ key that is not in ALLOWED_TOP_LEVEL_OPS
|
|
264
233
|
*
|
|
265
|
-
*
|
|
234
|
+
* Applied after coercion so shorthand operators have already been prefixed.
|
|
266
235
|
*/
|
|
267
236
|
function rejectDisallowedOperators(filter, depth = 0) {
|
|
268
|
-
for (const
|
|
269
|
-
|
|
237
|
+
for (const k in filter) {
|
|
238
|
+
if (!Object.prototype.hasOwnProperty.call(filter, k))
|
|
239
|
+
continue;
|
|
270
240
|
if (BANNED_OPERATORS.has(k)) {
|
|
271
241
|
throw new QueryFindValidationError(`Disallowed operator in query: "${k}"`);
|
|
272
242
|
}
|
|
273
|
-
// Top-level unknown $ operators
|
|
274
243
|
if (depth === 0 && k.startsWith('$') && !ALLOWED_TOP_LEVEL_OPS.has(k)) {
|
|
275
244
|
throw new QueryFindValidationError(`Disallowed top-level operator in query string: "${k}"`);
|
|
276
245
|
}
|
|
277
|
-
|
|
246
|
+
const v = filter[k];
|
|
278
247
|
if (Array.isArray(v)) {
|
|
279
248
|
for (const item of v) {
|
|
280
249
|
if (item !== null &&
|
|
281
250
|
typeof item === 'object' &&
|
|
282
251
|
!Array.isArray(item) &&
|
|
283
|
-
!(item instanceof Date)
|
|
252
|
+
!(item instanceof Date) &&
|
|
253
|
+
Object.getPrototypeOf(item) === Object.prototype) {
|
|
284
254
|
rejectDisallowedOperators(item, depth + 1);
|
|
285
255
|
}
|
|
286
256
|
}
|
|
@@ -294,24 +264,30 @@ function rejectDisallowedOperators(filter, depth = 0) {
|
|
|
294
264
|
}
|
|
295
265
|
}
|
|
296
266
|
// ─── Filter builder ───────────────────────────────────────────────────────────
|
|
297
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Converts raw URL query params into a safe Mongoose filter by running the
|
|
269
|
+
* full pipeline: strip reserved keys → sanitize → coerce → allowlist → validate.
|
|
270
|
+
*/
|
|
271
|
+
function buildFilter(raw, allowedLookup, canonicalMap, onDrop) {
|
|
298
272
|
const stripped = {};
|
|
299
|
-
for (const
|
|
300
|
-
if (!RESERVED_KEYS.has(k))
|
|
301
|
-
stripped[k] =
|
|
273
|
+
for (const k in raw) {
|
|
274
|
+
if (Object.prototype.hasOwnProperty.call(raw, k) && !RESERVED_KEYS.has(k)) {
|
|
275
|
+
stripped[k] = raw[k];
|
|
276
|
+
}
|
|
302
277
|
}
|
|
303
|
-
const safe = sanitize(stripped);
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// (e.g. ?status=in, ?name=eq) are never touched.
|
|
307
|
-
const withOps = coerceOperatorKeys(safe);
|
|
308
|
-
const coerced = coerceDates(coerceBooleans(withOps));
|
|
309
|
-
const allowed = enforceAllowlist(coerced, allowedLookup, allowedFields);
|
|
278
|
+
const safe = sanitize(stripped, 0, '', onDrop);
|
|
279
|
+
const coerced = coerceAll(safe);
|
|
280
|
+
const allowed = enforceAllowlist(coerced, allowedLookup, canonicalMap);
|
|
310
281
|
rejectDisallowedOperators(allowed);
|
|
311
282
|
return allowed;
|
|
312
283
|
}
|
|
313
284
|
// ─── Sort parser ──────────────────────────────────────────────────────────────
|
|
314
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Parses a comma-separated sort string (e.g. "-createdAt,name") into a
|
|
287
|
+
* Mongoose sort object. Fields not present in the allowlist are silently
|
|
288
|
+
* skipped. Capped at MAX_SORT_FIELDS to prevent DoS via large sort lists.
|
|
289
|
+
*/
|
|
290
|
+
function parseSort(sort, allowedLookup, canonicalMap) {
|
|
315
291
|
const out = {};
|
|
316
292
|
let count = 0;
|
|
317
293
|
for (const token of sort.split(',')) {
|
|
@@ -324,20 +300,25 @@ function parseSort(sort, allowedLookup) {
|
|
|
324
300
|
const field = desc ? trimmed.slice(1).trim() : trimmed;
|
|
325
301
|
if (!field)
|
|
326
302
|
continue;
|
|
327
|
-
if (allowedLookup.size > 0
|
|
328
|
-
|
|
329
|
-
|
|
303
|
+
if (allowedLookup.size > 0) {
|
|
304
|
+
if (!isFieldAllowed(field, allowedLookup))
|
|
305
|
+
continue;
|
|
306
|
+
const canonical = canonicalMap.get(field.toLowerCase()) ?? field;
|
|
307
|
+
out[canonical] = desc ? -1 : 1;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
out[field] = desc ? -1 : 1;
|
|
311
|
+
}
|
|
330
312
|
count++;
|
|
331
313
|
}
|
|
332
314
|
return out;
|
|
333
315
|
}
|
|
334
316
|
// ─── Projection sanitizer ─────────────────────────────────────────────────────
|
|
335
317
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
* When allowedFields is empty, returns the projection unchanged.
|
|
318
|
+
* Filters a space-separated projection string against the allowlist.
|
|
319
|
+
* _id and __v are always permitted regardless of the allowlist.
|
|
320
|
+
* Returns an empty string when every token is blocked — callers must handle
|
|
321
|
+
* this case explicitly to avoid accidentally omitting the select() call.
|
|
341
322
|
*/
|
|
342
323
|
function sanitizeProjection(projection, allowedLookup) {
|
|
343
324
|
if (allowedLookup.size === 0)
|
|
@@ -360,7 +341,7 @@ function sanitizeProjection(projection, allowedLookup) {
|
|
|
360
341
|
*
|
|
361
342
|
* @example
|
|
362
343
|
* ```ts
|
|
363
|
-
* const result = await
|
|
344
|
+
* const result = await new QueryFind(User.find(), req.query)
|
|
364
345
|
* .allowFields(['name', 'email', 'role', 'createdAt'])
|
|
365
346
|
* .where({ orgId: req.user.orgId, deletedAt: null })
|
|
366
347
|
* .filter()
|
|
@@ -370,137 +351,160 @@ function sanitizeProjection(projection, allowedLookup) {
|
|
|
370
351
|
* .populate('department', 'name')
|
|
371
352
|
* .paginate();
|
|
372
353
|
* ```
|
|
373
|
-
*
|
|
374
|
-
* Security notes:
|
|
375
|
-
* - `.allowFields()` before `.filter()` restricts which URL params reach Mongo.
|
|
376
|
-
* - Allowlist matching (filter/sort/projection) is case-insensitive — e.g.
|
|
377
|
-
* allowFields(['name']) also matches ?Name=, ?NAME=, etc. For `.filter()`,
|
|
378
|
-
* a matched field is also normalized back to the casing declared in
|
|
379
|
-
* allowFields() (e.g. ?NAME=foo -> { name: 'foo' }) so it matches the
|
|
380
|
-
* actual schema path.
|
|
381
|
-
* - `.where()` conditions are hard — URL cannot override them.
|
|
382
|
-
* - Unknown/banned $ operators throw QueryFindValidationError (checked recursively).
|
|
383
|
-
* - Nesting depth capped at 5; page size capped at 100; sort fields capped at 5.
|
|
384
|
-
* - Search terms are regex-escaped (ReDoS prevention) and length-capped at 200 chars.
|
|
385
|
-
* - ?fields= projection is allowlist-filtered to prevent sensitive field leakage.
|
|
386
|
-
* - Operator-key coercion (eq/gte/in/...) only touches object KEYS, never string
|
|
387
|
-
* VALUES — a search like ?name=eq or ?status=in cannot be corrupted into a
|
|
388
|
-
* Mongo operator.
|
|
389
|
-
* - All queries run with maxTimeMS to prevent runaway collection scans.
|
|
390
354
|
*/
|
|
391
355
|
class QueryFind {
|
|
392
356
|
constructor(query, queryString, options = {}) {
|
|
393
357
|
this._allowedFields = new Set();
|
|
394
|
-
/** Lowercase mirror of _allowedFields, used for case-insensitive matching. */
|
|
395
358
|
this._allowedLookup = new Set();
|
|
396
|
-
this.
|
|
359
|
+
this._canonicalMap = new Map();
|
|
360
|
+
/**
|
|
361
|
+
* URL-derived filter and server-side conditions are kept separate so that
|
|
362
|
+
* server conditions merged last in paginate() can never be overwritten by
|
|
363
|
+
* URL params, regardless of the order in which where() and filter() are called.
|
|
364
|
+
*/
|
|
365
|
+
this._urlFilter = {};
|
|
366
|
+
this._serverConditions = {};
|
|
367
|
+
/**
|
|
368
|
+
* $or clauses from globalSearch() are collected here and assembled once
|
|
369
|
+
* inside buildFinalFilter(). This prevents double-call from re-wrapping the
|
|
370
|
+
* entire filter in nested $and.
|
|
371
|
+
*/
|
|
372
|
+
this._searchOr = [];
|
|
397
373
|
this._sort = { ...DEFAULT_SORT };
|
|
398
374
|
this._select = null;
|
|
399
375
|
this._populates = [];
|
|
376
|
+
/** Stored so limitFields() can fall back to it when ?fields= is fully blocked. */
|
|
377
|
+
this._defaultFields = null;
|
|
400
378
|
this.model = query.model;
|
|
401
379
|
this.qs = Object.freeze({ ...queryString });
|
|
402
380
|
this.options = {
|
|
403
381
|
maxTimeMS: options.maxTimeMS ?? DEFAULT_MAX_TIME_MS,
|
|
382
|
+
slowQueryThresholdMS: options.slowQueryThresholdMS ??
|
|
383
|
+
options.maxTimeMS ??
|
|
384
|
+
DEFAULT_MAX_TIME_MS,
|
|
385
|
+
lean: options.lean ?? true,
|
|
386
|
+
onSlowQuery: options.onSlowQuery,
|
|
387
|
+
onSanitizeDrop: options.onSanitizeDrop,
|
|
404
388
|
};
|
|
389
|
+
this._page = parsePage(this.qs.page);
|
|
390
|
+
this._limit = parseLimit(this.qs.limit);
|
|
405
391
|
}
|
|
406
392
|
// ── Configuration ───────────────────────────────────────────────────────────
|
|
407
393
|
/**
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
394
|
+
* Declares which fields the client is permitted to filter, sort, and select.
|
|
395
|
+
* Must be called before filter(), sort(), and limitFields() to take effect.
|
|
396
|
+
* Matching is case-insensitive: allowFields(['Name']) accepts ?name=, ?NAME=.
|
|
397
|
+
*
|
|
398
|
+
* @example .allowFields(['basicInfo.name', 'pricing.base', 'status'])
|
|
413
399
|
*/
|
|
414
400
|
allowFields(fields) {
|
|
415
401
|
this._allowedFields = new Set(fields);
|
|
416
|
-
|
|
402
|
+
const { lookup, canonical } = buildAllowedStructures(this._allowedFields);
|
|
403
|
+
this._allowedLookup = lookup;
|
|
404
|
+
this._canonicalMap = canonical;
|
|
417
405
|
return this;
|
|
418
406
|
}
|
|
419
407
|
// ── Builder methods ─────────────────────────────────────────────────────────
|
|
420
|
-
/**
|
|
408
|
+
/**
|
|
409
|
+
* Parses URL query params into a Mongoose filter and merges them into the
|
|
410
|
+
* URL-derived filter store. Only fields present in allowFields() pass through.
|
|
411
|
+
* Reserved keys (page, sort, limit, fields, q) are always stripped first.
|
|
412
|
+
*/
|
|
421
413
|
filter() {
|
|
422
|
-
const parsed = buildFilter(this.qs, this._allowedLookup, this.
|
|
423
|
-
Object.assign(this.
|
|
414
|
+
const parsed = buildFilter(this.qs, this._allowedLookup, this._canonicalMap, this.options.onSanitizeDrop);
|
|
415
|
+
Object.assign(this._urlFilter, parsed);
|
|
424
416
|
return this;
|
|
425
417
|
}
|
|
426
418
|
/**
|
|
427
|
-
*
|
|
428
|
-
*
|
|
419
|
+
* Applies mandatory server-side conditions that the client cannot override.
|
|
420
|
+
* Conditions are merged into the final filter after URL-derived values, so
|
|
421
|
+
* they always win regardless of what the client sends.
|
|
422
|
+
*
|
|
423
|
+
* Unlike filter(), values here are not sanitized — ObjectIds, Dates, and
|
|
424
|
+
* other non-plain types are valid. Banned $ operators are still rejected.
|
|
429
425
|
*
|
|
430
|
-
* @example .where({
|
|
426
|
+
* @example .where({ linkedTo: req.user.orgId, deletedAt: null })
|
|
431
427
|
*/
|
|
432
428
|
where(conditions) {
|
|
433
|
-
|
|
429
|
+
const asRecord = conditions;
|
|
430
|
+
rejectDisallowedOperators(asRecord);
|
|
431
|
+
Object.assign(this._serverConditions, asRecord);
|
|
434
432
|
return this;
|
|
435
433
|
}
|
|
436
434
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
435
|
+
* Enables case-insensitive full-text search across the given fields when
|
|
436
|
+
* ?q= is present in the query string. Fields not in allowFields() are
|
|
437
|
+
* silently skipped. Safe to call multiple times — subsequent calls extend
|
|
438
|
+
* the $or clause list rather than re-wrapping the filter.
|
|
439
|
+
*
|
|
440
|
+
* @example .globalSearch(['basicInfo.name', 'basicInfo.sku'])
|
|
440
441
|
*/
|
|
441
442
|
globalSearch(fields) {
|
|
442
443
|
const raw = this.qs.q?.trim();
|
|
443
|
-
// Guard: missing, empty, or oversized search term
|
|
444
444
|
if (!raw || raw.length > MAX_SEARCH_LENGTH || fields.length === 0) {
|
|
445
445
|
return this;
|
|
446
446
|
}
|
|
447
|
+
const safeFields = this._allowedLookup.size > 0
|
|
448
|
+
? fields.filter((f) => isFieldAllowed(f, this._allowedLookup))
|
|
449
|
+
: fields;
|
|
450
|
+
if (safeFields.length === 0)
|
|
451
|
+
return this;
|
|
447
452
|
const escaped = raw.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
// Always AND the search clause with whatever conditions are already
|
|
452
|
-
// present (top-level fields from .where()/.filter(), or existing
|
|
453
|
-
// $or/$and). This avoids the bug where a top-level field that
|
|
454
|
-
// happens to also be one of the `fields` passed here (e.g.
|
|
455
|
-
// ?status=active combined with .globalSearch(['status','name']))
|
|
456
|
-
// would sit alongside $or and be implicitly ANDed with it — making
|
|
457
|
-
// the search match only documents where `status` is BOTH exactly
|
|
458
|
-
// "active" AND matches the regex, silently excluding matches on
|
|
459
|
-
// `name`. Wrapping the existing filter as one branch of $and
|
|
460
|
-
// preserves all prior conditions intact while ORing across the
|
|
461
|
-
// search fields independently.
|
|
462
|
-
if (Object.keys(this._filter).length > 0) {
|
|
463
|
-
this._filter = {
|
|
464
|
-
$and: [this._filter, { $or: searchOr }],
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
else {
|
|
468
|
-
this._filter = { $or: searchOr };
|
|
453
|
+
const regex = new RegExp(escaped, 'i');
|
|
454
|
+
for (const field of safeFields) {
|
|
455
|
+
this._searchOr.push({ [field]: regex });
|
|
469
456
|
}
|
|
470
457
|
return this;
|
|
471
458
|
}
|
|
472
459
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* Capped at MAX_SORT_FIELDS
|
|
460
|
+
* Parses the ?sort= query param into a Mongoose sort object. Fields not in
|
|
461
|
+
* allowFields() are silently dropped. Falls back to DEFAULT_SORT when the
|
|
462
|
+
* parsed result is empty. Capped at MAX_SORT_FIELDS entries.
|
|
463
|
+
*
|
|
464
|
+
* Prefix a field with - for descending order: ?sort=-createdAt,name
|
|
476
465
|
*/
|
|
477
466
|
sort() {
|
|
478
467
|
if (this.qs.sort) {
|
|
479
|
-
const parsed = parseSort(this.qs.sort, this._allowedLookup);
|
|
468
|
+
const parsed = parseSort(this.qs.sort, this._allowedLookup, this._canonicalMap);
|
|
480
469
|
this._sort =
|
|
481
470
|
Object.keys(parsed).length > 0 ? parsed : { ...DEFAULT_SORT };
|
|
482
471
|
}
|
|
483
472
|
return this;
|
|
484
473
|
}
|
|
485
474
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
475
|
+
* Controls which fields are returned by the query.
|
|
476
|
+
*
|
|
477
|
+
* When ?fields= is present in the URL, the value is parsed as a
|
|
478
|
+
* comma-separated list and filtered through the allowlist. Only fields
|
|
479
|
+
* declared in allowFields() will be included in the projection.
|
|
488
480
|
*
|
|
489
|
-
* When
|
|
490
|
-
*
|
|
491
|
-
* from projecting sensitive fields like `password` or `resetToken`.
|
|
481
|
+
* When ?fields= is absent, `defaultFields` is used as-is (no allowlist
|
|
482
|
+
* filtering) — this is the server-controlled default projection.
|
|
492
483
|
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
484
|
+
* When ?fields= is present but every requested field is blocked by the
|
|
485
|
+
* allowlist, the projection falls back to `defaultFields` rather than
|
|
486
|
+
* omitting select() entirely (which would return all fields).
|
|
487
|
+
*
|
|
488
|
+
* @param defaultFields - Space-separated Mongoose projection string used
|
|
489
|
+
* when the client does not specify ?fields=.
|
|
490
|
+
* Example: 'basicInfo.name pricing.base status -__v'
|
|
495
491
|
*/
|
|
496
492
|
limitFields(defaultFields) {
|
|
493
|
+
if (defaultFields) {
|
|
494
|
+
this._defaultFields = defaultFields;
|
|
495
|
+
}
|
|
497
496
|
if (this.qs.fields) {
|
|
498
497
|
const raw = this.qs.fields
|
|
499
498
|
.split(',')
|
|
500
499
|
.map((f) => f.trim())
|
|
501
500
|
.filter(Boolean)
|
|
502
501
|
.join(' ');
|
|
503
|
-
|
|
502
|
+
const sanitized = sanitizeProjection(raw, this._allowedLookup);
|
|
503
|
+
// sanitizeProjection returns an empty string when every requested field
|
|
504
|
+
// is blocked. An empty string is falsy — passing it to select() would
|
|
505
|
+
// silently skip the call and return all fields. Fall back to the
|
|
506
|
+
// server-supplied default projection to prevent unintended field exposure.
|
|
507
|
+
this._select = sanitized || this._defaultFields || null;
|
|
504
508
|
}
|
|
505
509
|
else if (defaultFields) {
|
|
506
510
|
this._select = defaultFields;
|
|
@@ -508,7 +512,8 @@ class QueryFind {
|
|
|
508
512
|
return this;
|
|
509
513
|
}
|
|
510
514
|
/**
|
|
511
|
-
*
|
|
515
|
+
* Registers a populate path to be applied on the find query.
|
|
516
|
+
* populate.match conditions are sanitized and validated like any other filter.
|
|
512
517
|
*
|
|
513
518
|
* @example
|
|
514
519
|
* .populate('author')
|
|
@@ -520,57 +525,116 @@ class QueryFind {
|
|
|
520
525
|
this._populates.push(select ? { path, select } : { path });
|
|
521
526
|
}
|
|
522
527
|
else {
|
|
523
|
-
|
|
528
|
+
if (path.match != null) {
|
|
529
|
+
const rawMatch = path.match;
|
|
530
|
+
const safeMatch = sanitize(rawMatch, 0, 'populate.match', this.options.onSanitizeDrop);
|
|
531
|
+
rejectDisallowedOperators(safeMatch);
|
|
532
|
+
this._populates.push({ ...path, match: safeMatch });
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
this._populates.push(path);
|
|
536
|
+
}
|
|
524
537
|
}
|
|
525
538
|
return this;
|
|
526
539
|
}
|
|
540
|
+
// ── Private helpers ─────────────────────────────────────────────────────────
|
|
541
|
+
/**
|
|
542
|
+
* Assembles the final Mongoose filter from three sources in priority order:
|
|
543
|
+
* 1. URL-derived filter (lowest priority — client controlled)
|
|
544
|
+
* 2. Global search $or clause
|
|
545
|
+
* 3. Server conditions (highest priority — cannot be overridden by client)
|
|
546
|
+
*/
|
|
547
|
+
buildFinalFilter() {
|
|
548
|
+
let base = { ...this._urlFilter };
|
|
549
|
+
if (this._searchOr.length > 0) {
|
|
550
|
+
if (Object.keys(base).length > 0) {
|
|
551
|
+
base = { $and: [base, { $or: this._searchOr }] };
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
base = { $or: this._searchOr };
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return { ...base, ...this._serverConditions };
|
|
558
|
+
}
|
|
559
|
+
execFind(mongoFilter, skip) {
|
|
560
|
+
const { maxTimeMS, lean } = this.options;
|
|
561
|
+
const q = this.model
|
|
562
|
+
.find(mongoFilter)
|
|
563
|
+
.sort(this._sort)
|
|
564
|
+
.skip(skip)
|
|
565
|
+
.limit(this._limit);
|
|
566
|
+
if (lean)
|
|
567
|
+
q.lean();
|
|
568
|
+
if (this._select)
|
|
569
|
+
q.select(this._select);
|
|
570
|
+
for (const opt of this._populates)
|
|
571
|
+
q.populate(opt);
|
|
572
|
+
if (maxTimeMS > 0)
|
|
573
|
+
q.maxTimeMS(maxTimeMS);
|
|
574
|
+
return q.exec();
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Uses estimatedDocumentCount when no filter is active for a fast O(1) count.
|
|
578
|
+
* Falls back to countDocuments when a filter is present.
|
|
579
|
+
*/
|
|
580
|
+
async execCount(mongoFilter, hasFilter) {
|
|
581
|
+
const { maxTimeMS } = this.options;
|
|
582
|
+
if (!hasFilter) {
|
|
583
|
+
return (await this.model
|
|
584
|
+
.estimatedDocumentCount()
|
|
585
|
+
.maxTimeMS(maxTimeMS)
|
|
586
|
+
.exec());
|
|
587
|
+
}
|
|
588
|
+
return (await this.model
|
|
589
|
+
.countDocuments(mongoFilter)
|
|
590
|
+
.maxTimeMS(maxTimeMS)
|
|
591
|
+
.exec());
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Wraps an async operation with slow-query detection. When onSlowQuery is
|
|
595
|
+
* provided and the operation exceeds slowQueryThresholdMS, the hook is called
|
|
596
|
+
* with timing and query metadata for observability.
|
|
597
|
+
*/
|
|
598
|
+
async wrapTimed(fn, page, limit, filter) {
|
|
599
|
+
const { onSlowQuery, slowQueryThresholdMS, maxTimeMS } = this.options;
|
|
600
|
+
if (!onSlowQuery)
|
|
601
|
+
return fn();
|
|
602
|
+
const start = Date.now();
|
|
603
|
+
const result = await fn();
|
|
604
|
+
const elapsedMs = Date.now() - start;
|
|
605
|
+
if (elapsedMs >= (slowQueryThresholdMS ?? maxTimeMS)) {
|
|
606
|
+
onSlowQuery({ elapsedMs, filter, sort: this._sort, page, limit });
|
|
607
|
+
}
|
|
608
|
+
return result;
|
|
609
|
+
}
|
|
527
610
|
// ── Terminal ────────────────────────────────────────────────────────────────
|
|
528
611
|
/**
|
|
529
|
-
*
|
|
612
|
+
* Executes the query and returns a paginated result.
|
|
530
613
|
*
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
* - maxTimeMS applied to both count and find (prevents runaway scans).
|
|
535
|
-
* - page is clamped to 1 if it exceeds totalPages (safe mid-delete behavior).
|
|
614
|
+
* On page 1, count and find run in parallel via Promise.all.
|
|
615
|
+
* On subsequent pages, pass the previously returned `total` as `cachedTotal`
|
|
616
|
+
* to skip the count query entirely.
|
|
536
617
|
*
|
|
537
|
-
* @
|
|
618
|
+
* @param cachedTotal - Total document count from a prior page-1 response.
|
|
619
|
+
* When provided, the countDocuments call is skipped for this request.
|
|
620
|
+
*
|
|
621
|
+
* @throws {QueryFindValidationError} when the URL contains a disallowed $ operator.
|
|
538
622
|
*/
|
|
539
|
-
async paginate() {
|
|
540
|
-
const page =
|
|
541
|
-
const limit =
|
|
542
|
-
const
|
|
543
|
-
const
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
.
|
|
549
|
-
.
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
if (this._select)
|
|
553
|
-
q.select(this._select);
|
|
554
|
-
for (const opt of this._populates)
|
|
555
|
-
q.populate(opt);
|
|
556
|
-
if (maxTimeMS > 0)
|
|
557
|
-
q.maxTimeMS(maxTimeMS);
|
|
558
|
-
return q.exec();
|
|
559
|
-
};
|
|
560
|
-
const countQuery = hasFilter
|
|
561
|
-
? this.model
|
|
562
|
-
.countDocuments(mongoFilter)
|
|
563
|
-
.maxTimeMS(maxTimeMS)
|
|
564
|
-
: this.model.estimatedDocumentCount();
|
|
565
|
-
const [total, firstPageData] = await Promise.all([
|
|
566
|
-
countQuery,
|
|
567
|
-
buildFind(0),
|
|
568
|
-
]);
|
|
569
|
-
const totalPages = Math.max(Math.ceil(total / limit), 1);
|
|
570
|
-
const safePage = page > totalPages ? 1 : page;
|
|
571
|
-
if (safePage === 1) {
|
|
623
|
+
async paginate(cachedTotal) {
|
|
624
|
+
const page = this._page;
|
|
625
|
+
const limit = this._limit;
|
|
626
|
+
const finalFilter = this.buildFinalFilter();
|
|
627
|
+
const mongoFilter = finalFilter;
|
|
628
|
+
const hasFilter = Object.keys(finalFilter).length > 0;
|
|
629
|
+
// ── Page 1: count + find in parallel ─────────────────────────────────────
|
|
630
|
+
if (page === 1) {
|
|
631
|
+
const [total, data] = await this.wrapTimed(() => Promise.all([
|
|
632
|
+
this.execCount(mongoFilter, hasFilter),
|
|
633
|
+
this.execFind(mongoFilter, 0),
|
|
634
|
+
]), page, limit, finalFilter);
|
|
635
|
+
const totalPages = Math.max(Math.ceil(total / limit), 1);
|
|
572
636
|
return {
|
|
573
|
-
data
|
|
637
|
+
data,
|
|
574
638
|
total,
|
|
575
639
|
page: 1,
|
|
576
640
|
totalPages,
|
|
@@ -579,15 +643,41 @@ class QueryFind {
|
|
|
579
643
|
hasPrevPage: false,
|
|
580
644
|
};
|
|
581
645
|
}
|
|
582
|
-
|
|
646
|
+
// ── Page > 1 with cached total: skip count ────────────────────────────────
|
|
647
|
+
if (cachedTotal !== undefined) {
|
|
648
|
+
const totalPages = Math.max(Math.ceil(cachedTotal / limit), 1);
|
|
649
|
+
const safePage = page > totalPages ? 1 : page;
|
|
650
|
+
const data = await this.wrapTimed(() => this.execFind(mongoFilter, (safePage - 1) * limit), safePage, limit, finalFilter);
|
|
651
|
+
return {
|
|
652
|
+
data,
|
|
653
|
+
total: cachedTotal,
|
|
654
|
+
page: safePage,
|
|
655
|
+
totalPages,
|
|
656
|
+
limit,
|
|
657
|
+
hasNextPage: safePage < totalPages,
|
|
658
|
+
hasPrevPage: safePage > 1,
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
// ── Page > 1 without cached total: count + find, both timed ──────────────
|
|
662
|
+
const result = { total: 0, data: [], safePage: page, totalPages: 1 };
|
|
663
|
+
await this.wrapTimed(async () => {
|
|
664
|
+
const total = await this.execCount(mongoFilter, hasFilter);
|
|
665
|
+
const totalPages = Math.max(Math.ceil(total / limit), 1);
|
|
666
|
+
const safePage = page > totalPages ? 1 : page;
|
|
667
|
+
const data = await this.execFind(mongoFilter, (safePage - 1) * limit);
|
|
668
|
+
result.total = total;
|
|
669
|
+
result.data = data;
|
|
670
|
+
result.safePage = safePage;
|
|
671
|
+
result.totalPages = totalPages;
|
|
672
|
+
}, page, limit, finalFilter);
|
|
583
673
|
return {
|
|
584
|
-
data,
|
|
585
|
-
total,
|
|
586
|
-
page: safePage,
|
|
587
|
-
totalPages,
|
|
674
|
+
data: result.data,
|
|
675
|
+
total: result.total,
|
|
676
|
+
page: result.safePage,
|
|
677
|
+
totalPages: result.totalPages,
|
|
588
678
|
limit,
|
|
589
|
-
hasNextPage: safePage < totalPages,
|
|
590
|
-
hasPrevPage: safePage > 1,
|
|
679
|
+
hasNextPage: result.safePage < result.totalPages,
|
|
680
|
+
hasPrevPage: result.safePage > 1,
|
|
591
681
|
};
|
|
592
682
|
}
|
|
593
683
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAYH,iFAAiF;AAEjF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhF,qEAAqE;AACrE,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,sDAAsD;AACtD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,0DAA0D;AAC1D,MAAM,iBAAi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