@molecule/api-resource-bookmark 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":"list.d.ts","sourceRoot":"","sources":["../../src/handlers/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/handlers/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAO/E;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BrF"}
|
package/dist/handlers/list.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { t } from '@molecule/api-i18n';
|
|
7
7
|
import { logger } from '@molecule/api-logger';
|
|
8
8
|
import { getBookmarks } 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
|
* Lists the current user's bookmarks with optional filtering and pagination.
|
|
11
13
|
*
|
|
@@ -23,7 +25,7 @@ export async function list(req, res) {
|
|
|
23
25
|
}
|
|
24
26
|
const resourceType = req.query.resourceType;
|
|
25
27
|
const folder = req.query.folder;
|
|
26
|
-
const limit = parseInt(req.query.limit, 10) || 20;
|
|
28
|
+
const limit = Math.min(MAX_LIST_LIMIT, Math.max(1, parseInt(req.query.limit, 10) || 20));
|
|
27
29
|
const offset = parseInt(req.query.offset, 10) || 0;
|
|
28
30
|
try {
|
|
29
31
|
const result = await getBookmarks(userId, { resourceType, folder, limit, offset });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-resource-bookmark",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Bookmark/favorite any resource with folder organization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "26.1.2",
|
|
32
32
|
"typescript": "6.0.3",
|
|
33
|
-
"vitest": "4.1.
|
|
33
|
+
"vitest": "4.1.11",
|
|
34
34
|
"zod": "4.4.3"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|