@rebasepro/server 0.10.1-canary.6f89f77 → 0.10.1-canary.7609565

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.es.js CHANGED
@@ -11064,6 +11064,8 @@ function createAdminRolesRoute(config) {
11064
11064
  * DELETE /users/:uid
11065
11065
  * POST /bootstrap
11066
11066
  */
11067
+ /** Upper bound for `GET /users?ids=…`, so one request can't fan out unbounded. */
11068
+ var MAX_USER_IDS_PER_LOOKUP = 100;
11067
11069
  function createAdminUsersRoute(config) {
11068
11070
  const router = new Hono();
11069
11071
  const authRepo = config.authRepo;
@@ -11131,6 +11133,20 @@ function createAdminUsersRoute(config) {
11131
11133
  });
11132
11134
  });
11133
11135
  router.get("/users", requireAdmin, async (c) => {
11136
+ const idsParam = c.req.query("ids");
11137
+ if (idsParam !== void 0) {
11138
+ const ids = [...new Set(idsParam.split(",").map((id) => id.trim()).filter(Boolean))].slice(0, MAX_USER_IDS_PER_LOOKUP);
11139
+ const users = (await Promise.all(ids.map(async (id) => {
11140
+ const result = await authRepo.getUserWithRoles(id);
11141
+ return result ? toAdminUser(result.user, result.roles.map((r) => r.id)) : void 0;
11142
+ }))).filter((u) => u !== void 0);
11143
+ return c.json({
11144
+ users,
11145
+ total: users.length,
11146
+ limit: ids.length,
11147
+ offset: 0
11148
+ });
11149
+ }
11134
11150
  const limitParam = c.req.query("limit");
11135
11151
  const offsetParam = c.req.query("offset");
11136
11152
  const search = c.req.query("search");