@r5v/mongoose-paginate 1.0.16 → 1.0.18

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 CHANGED
@@ -6,6 +6,11 @@ Simple, Fast, Efficient
6
6
 
7
7
  This project was designed to accomodate more than 80% of your daily workflow to remove the overhead of boilerplate code in handling each endpoint and keeping queries and query params simple. We didn't want you to have to learn a new language to use this product
8
8
 
9
+ ## Requirements
10
+ - Node.js >= 20
11
+ - mongoose >= 8.0.0 (peer dependency)
12
+ - Tested with: 8.16.0, 9.1.4
13
+
9
14
  ## Basic Usage
10
15
 
11
16
  ### PagingQuery
@@ -307,6 +312,52 @@ $ yarn run start
307
312
  9. Apply pagination (`$skip`, `$limit`) and options
308
313
 
309
314
 
315
+ ## Versioning and releasing
316
+
317
+ The package follows [semver](https://semver.org). The version in `package.json` is the only version; it is bumped in its own commit (`chore: bump version to X.Y.Z`) and every release gets an entry in the changelog below.
318
+
319
+ **What each part means**
320
+
321
+ | Bump | When | Examples |
322
+ |:--|:--|:--|
323
+ | patch `1.0.x` | Bug fixes, docs, and type fixes that do not narrow what consumers can already write | `exec()` returns `Promise<any>` again; a regex bug in populate parsing |
324
+ | minor `1.x.0` | New options, parameters, exports or utilities; anything additive | a new `allowedOperators` option |
325
+ | major `x.0.0` | Anything that can break a consumer's build **or** behaviour | removing a parameter (`$includes`), changing a default, raising the minimum `mongoose` or Node version, **narrowing a public type** (`any` to `unknown`, a stricter argument type) |
326
+
327
+ Types are part of the public API. A change that makes a consumer's TypeScript stop compiling is a breaking change even if the runtime is identical. Consumers pin `^1.0.x`, so a breaking change shipped as a patch reaches them on the next install.
328
+
329
+ **Release steps** (from a clean `main`, after the PR is merged)
330
+
331
+ ```text
332
+ $ git checkout main && git pull
333
+ $ npm version patch --no-git-tag-version # or: minor / major
334
+ $ git commit -am "chore: bump version to X.Y.Z"
335
+ $ git push
336
+ $ npm install
337
+ $ npm test # must be green
338
+ $ npm run build # prebuild clears dist/, postbuild copies package.json + README into it
339
+ $ npm pack --dry-run # check the file list: package.json, README.md, dist/**
340
+ $ npm login # once per machine; opens the browser
341
+ $ npm publish --access public # add --otp=123456 if npm asks for a code
342
+ $ npm view @r5v/mongoose-paginate version # confirm X.Y.Z is live
343
+ ```
344
+
345
+ Notes:
346
+ - Publish only after `npm run build`. There is no `prepublishOnly` script, and `dist/` is what consumers get (`files` in `package.json`).
347
+ - Update the changelog in the same PR as the change, under the version it will ship as.
348
+ - Before a release that touches types or parsing, run the consuming app (`theshopkeeper`) against the built `dist/`: copy it over `node_modules/@r5v/mongoose-paginate/dist`, then run its `tsc` and tests. The 1.0.14 narrowing of `exec()` to `unknown` was only caught this way.
349
+ - A published version cannot be changed or re-used. If a release is wrong, publish a fixed patch and `npm deprecate @r5v/mongoose-paginate@X.Y.Z "use X.Y.Z+1"`.
350
+ - Optional: `git tag vX.Y.Z && git push --tags` after publishing. There are no tags in the repository yet.
351
+
352
+ ## Changelog
353
+
354
+ ### 1.0.18
355
+ - **Fixed `exec()` return type** - `PagingQuery.exec()` and `AggregationPagingQuery.exec()` return `Promise<any>` again. 1.0.14 through 1.0.17 narrowed it to `Promise<unknown>`, which stopped consumers that use the result (for example `res.send(await query.exec())` typed against a response body) from compiling. Runtime behaviour is unchanged.
356
+
357
+ ### 1.0.17
358
+ - **Moved mongoose to peerDependencies** - Reduces bundle size for consumers who already have mongoose installed
359
+ - Supports mongoose >= 8.0.0 (tested with 8.16.0 and 9.1.4)
360
+
310
361
  ### 1.0.15
311
362
  - **Re-enabled `removeProtected` option** for `AggregationPagingQuery` (EXPERIMENTAL) - Automatically excludes fields marked with `select: false` in your schema (e.g., passwords, secret keys) from aggregation results. Use with caution and test thoroughly in your environment.
312
363
  - Uses refactored `findProtectedPaths` utility which safely traverses schemas without JSON serialization
package/dist/README.md CHANGED
@@ -6,6 +6,11 @@ Simple, Fast, Efficient
6
6
 
7
7
  This project was designed to accomodate more than 80% of your daily workflow to remove the overhead of boilerplate code in handling each endpoint and keeping queries and query params simple. We didn't want you to have to learn a new language to use this product
8
8
 
9
+ ## Requirements
10
+ - Node.js >= 20
11
+ - mongoose >= 8.0.0 (peer dependency)
12
+ - Tested with: 8.16.0, 9.1.4
13
+
9
14
  ## Basic Usage
10
15
 
11
16
  ### PagingQuery
@@ -307,6 +312,52 @@ $ yarn run start
307
312
  9. Apply pagination (`$skip`, `$limit`) and options
308
313
 
309
314
 
315
+ ## Versioning and releasing
316
+
317
+ The package follows [semver](https://semver.org). The version in `package.json` is the only version; it is bumped in its own commit (`chore: bump version to X.Y.Z`) and every release gets an entry in the changelog below.
318
+
319
+ **What each part means**
320
+
321
+ | Bump | When | Examples |
322
+ |:--|:--|:--|
323
+ | patch `1.0.x` | Bug fixes, docs, and type fixes that do not narrow what consumers can already write | `exec()` returns `Promise<any>` again; a regex bug in populate parsing |
324
+ | minor `1.x.0` | New options, parameters, exports or utilities; anything additive | a new `allowedOperators` option |
325
+ | major `x.0.0` | Anything that can break a consumer's build **or** behaviour | removing a parameter (`$includes`), changing a default, raising the minimum `mongoose` or Node version, **narrowing a public type** (`any` to `unknown`, a stricter argument type) |
326
+
327
+ Types are part of the public API. A change that makes a consumer's TypeScript stop compiling is a breaking change even if the runtime is identical. Consumers pin `^1.0.x`, so a breaking change shipped as a patch reaches them on the next install.
328
+
329
+ **Release steps** (from a clean `main`, after the PR is merged)
330
+
331
+ ```text
332
+ $ git checkout main && git pull
333
+ $ npm version patch --no-git-tag-version # or: minor / major
334
+ $ git commit -am "chore: bump version to X.Y.Z"
335
+ $ git push
336
+ $ npm install
337
+ $ npm test # must be green
338
+ $ npm run build # prebuild clears dist/, postbuild copies package.json + README into it
339
+ $ npm pack --dry-run # check the file list: package.json, README.md, dist/**
340
+ $ npm login # once per machine; opens the browser
341
+ $ npm publish --access public # add --otp=123456 if npm asks for a code
342
+ $ npm view @r5v/mongoose-paginate version # confirm X.Y.Z is live
343
+ ```
344
+
345
+ Notes:
346
+ - Publish only after `npm run build`. There is no `prepublishOnly` script, and `dist/` is what consumers get (`files` in `package.json`).
347
+ - Update the changelog in the same PR as the change, under the version it will ship as.
348
+ - Before a release that touches types or parsing, run the consuming app (`theshopkeeper`) against the built `dist/`: copy it over `node_modules/@r5v/mongoose-paginate/dist`, then run its `tsc` and tests. The 1.0.14 narrowing of `exec()` to `unknown` was only caught this way.
349
+ - A published version cannot be changed or re-used. If a release is wrong, publish a fixed patch and `npm deprecate @r5v/mongoose-paginate@X.Y.Z "use X.Y.Z+1"`.
350
+ - Optional: `git tag vX.Y.Z && git push --tags` after publishing. There are no tags in the repository yet.
351
+
352
+ ## Changelog
353
+
354
+ ### 1.0.18
355
+ - **Fixed `exec()` return type** - `PagingQuery.exec()` and `AggregationPagingQuery.exec()` return `Promise<any>` again. 1.0.14 through 1.0.17 narrowed it to `Promise<unknown>`, which stopped consumers that use the result (for example `res.send(await query.exec())` typed against a response body) from compiling. Runtime behaviour is unchanged.
356
+
357
+ ### 1.0.17
358
+ - **Moved mongoose to peerDependencies** - Reduces bundle size for consumers who already have mongoose installed
359
+ - Supports mongoose >= 8.0.0 (tested with 8.16.0 and 9.1.4)
360
+
310
361
  ### 1.0.15
311
362
  - **Re-enabled `removeProtected` option** for `AggregationPagingQuery` (EXPERIMENTAL) - Automatically excludes fields marked with `select: false` in your schema (e.g., passwords, secret keys) from aggregation results. Use with caution and test thoroughly in your environment.
312
363
  - Uses refactored `findProtectedPaths` utility which safely traverses schemas without JSON serialization
@@ -19,6 +19,6 @@ export declare class AggregationPagingQuery {
19
19
  initQuery: () => Promise<void>;
20
20
  typeCastObject: <T>(strOrObj: T) => T;
21
21
  private removeProtectedFields;
22
- exec: () => Promise<unknown>;
22
+ exec: () => Promise<any>;
23
23
  }
24
24
  //# sourceMappingURL=aggregationPagingQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregationPagingQuery.d.ts","sourceRoot":"","sources":["../src/aggregationPagingQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EACH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EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,qBAAqB;IAoB/E,kBAAkB,kCAAqB;IACvC,WAAW,sPAAc;IACzB,iBAAiB,6BAAoB;IACrC,YAAY,2BAAe;IAC3B,eAAe,mEAAkB;IACjC,wBAAwB;;MAA2B;IACnD,YAAY,aAOX;IACD,SAAS,sBAsDR;IACD,cAAc,GAAI,CAAC,EAAE,UAAU,CAAC,KAAG,CAAC,CAmCnC;IAED,OAAO,CAAC,qBAAqB,CAS5B;IAED,IAAI,QAAa,OAAO,CAAC,GAAG,CAAC,CAgC5B;CAEJ"}
@@ -151,6 +151,7 @@ class AggregationPagingQuery {
151
151
  this.query.project(projections);
152
152
  }
153
153
  };
154
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
155
  this.exec = () => __awaiter(this, void 0, void 0, function* () {
155
156
  const { $skip, $limit, $paging, $filter } = this.params;
156
157
  const { disablePaging } = this.options;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r5v/mongoose-paginate",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -58,13 +58,16 @@
58
58
  "engines": {
59
59
  "node": ">=20"
60
60
  },
61
+ "peerDependencies": {
62
+ "mongoose": ">=8.0.0"
63
+ },
61
64
  "dependencies": {
62
- "mongoose": "^8.16.1",
63
65
  "qs": "^6.14.0"
64
66
  },
65
67
  "description": "A lightweight Node.js package that seamlessly bridges RESTful API query parameters to Mongoose operations. Automatically parses and transforms URL query strings into valid Mongoose queries, supporting filtering, sorting, pagination, field selection, and population. Simply pass your Express req.query object and get back a fully configured Mongoose query ready for execution. Perfect for rapidly building consistent, feature-rich APIs without repetitive query parsing logic",
66
68
  "devDependencies": {
67
69
  "@types/express": "^5.0.3",
70
+ "mongoose": "^9.1.4",
68
71
  "@types/jest": "^30.0.0",
69
72
  "@types/node": "^24.0.10",
70
73
  "concurrently": "^9.2.0",
@@ -10,6 +10,6 @@ export declare class PagingQuery {
10
10
  private initQuery;
11
11
  parseSortString: (sortString: string) => [string, SortOrder][];
12
12
  parseParams: (defaultParams: PagingQueryParsedRequestParams | import("./types").AggregateQueryParsedRequestParams, params: import("qs").ParsedQs, isAggregate?: boolean) => PagingQueryParsedRequestParams | import("./types").AggregateQueryParsedRequestParams;
13
- exec: () => Promise<unknown>;
13
+ exec: () => Promise<any>;
14
14
  }
15
15
  //# sourceMappingURL=pagingQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagingQuery.d.ts","sourceRoot":"","sources":["../src/pagingQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,8BAA8B,EAAE,kBAAkB,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AAC5F,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAS7D,qBAAa,WAAW;IACpB,MAAM,EAAE,8BAA8B,CASrC;IACD,OAAO,EAAE,kBAAkB,CAAK;IAChC,KAAK,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IACvD,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;gBAEL,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAY1F,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,SAAS,CAqChB;IACD,eAAe,gDAAkB;IACjC,WAAW,sPAAc;IACzB,IAAI,yBAuBH;CACJ"}
1
+ {"version":3,"file":"pagingQuery.d.ts","sourceRoot":"","sources":["../src/pagingQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,8BAA8B,EAAE,kBAAkB,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AAC5F,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAS7D,qBAAa,WAAW;IACpB,MAAM,EAAE,8BAA8B,CASrC;IACD,OAAO,EAAE,kBAAkB,CAAK;IAChC,KAAK,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI,CAAO;IACvD,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;gBAEL,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAY1F,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,SAAS,CAqChB;IACD,eAAe,gDAAkB;IACjC,WAAW,sPAAc;IAEzB,IAAI,QAAa,OAAO,CAAC,GAAG,CAAC,CAuB5B;CACJ"}
@@ -75,6 +75,7 @@ class PagingQuery {
75
75
  };
76
76
  this.parseSortString = parseSortString_1.parseSortString;
77
77
  this.parseParams = parseParams_1.parseParams;
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
79
  this.exec = () => __awaiter(this, void 0, void 0, function* () {
79
80
  const { $skip, $limit, $paging, $filter } = this.params;
80
81
  const { staticFilter } = this.options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r5v/mongoose-paginate",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -58,13 +58,16 @@
58
58
  "engines": {
59
59
  "node": ">=20"
60
60
  },
61
+ "peerDependencies": {
62
+ "mongoose": ">=8.0.0"
63
+ },
61
64
  "dependencies": {
62
- "mongoose": "^8.16.1",
63
65
  "qs": "^6.14.0"
64
66
  },
65
67
  "description": "A lightweight Node.js package that seamlessly bridges RESTful API query parameters to Mongoose operations. Automatically parses and transforms URL query strings into valid Mongoose queries, supporting filtering, sorting, pagination, field selection, and population. Simply pass your Express req.query object and get back a fully configured Mongoose query ready for execution. Perfect for rapidly building consistent, feature-rich APIs without repetitive query parsing logic",
66
68
  "devDependencies": {
67
69
  "@types/express": "^5.0.3",
70
+ "mongoose": "^9.1.4",
68
71
  "@types/jest": "^30.0.0",
69
72
  "@types/node": "^24.0.10",
70
73
  "concurrently": "^9.2.0",