@molecule/api-resource-message 1.0.1 → 1.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"listThreads.d.ts","sourceRoot":"","sources":["../../src/handlers/listThreads.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAI/E;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB5F"}
1
+ {"version":3,"file":"listThreads.d.ts","sourceRoot":"","sources":["../../src/handlers/listThreads.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAO/E;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB5F"}
@@ -6,6 +6,8 @@
6
6
  import { t } from '@molecule/api-i18n';
7
7
  import { logger } from '@molecule/api-logger';
8
8
  import { listThreadsForParticipant } from '../service.js';
9
+ /** Upper bound for the list page size — an uncapped `limit` is a table-dump primitive (e.g. `?limit=999999999`). */
10
+ const MAX_LIST_LIMIT = 500;
9
11
  /**
10
12
  * Returns paginated threads for the authenticated user, newest first.
11
13
  *
@@ -21,7 +23,7 @@ export async function listThreads(req, res) {
21
23
  });
22
24
  return;
23
25
  }
24
- const limit = parseInt(req.query.limit, 10) || 50;
26
+ const limit = Math.min(MAX_LIST_LIMIT, Math.max(1, parseInt(req.query.limit, 10) || 50));
25
27
  const offset = parseInt(req.query.offset, 10) || 0;
26
28
  try {
27
29
  const threads = await listThreadsForParticipant(userId, { limit, offset });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-resource-message",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "1:1 messaging threads + messages with read-tracking and realtime broadcast",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "@molecule/api-locales-resource-message": "1.0.1",
34
34
  "@types/node": "26.1.2",
35
35
  "typescript": "6.0.3",
36
- "vitest": "4.1.10",
36
+ "vitest": "4.1.11",
37
37
  "zod": "4.4.3"
38
38
  },
39
39
  "peerDependencies": {