codeweaver 4.0.1 → 4.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.
- package/README.md +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -250,7 +250,8 @@ async function invalidInputHandler(e: ResponseError) {
|
|
|
250
250
|
throw new ResponseError(message, 400, e?.message);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
const
|
|
253
|
+
const userCache = new MapAsyncCache<UserDto>(config.cacheSize);
|
|
254
|
+
const usersCache = new MapAsyncCache<UserDto[]>(1);
|
|
254
255
|
|
|
255
256
|
@Injectable()
|
|
256
257
|
/**
|
|
@@ -283,7 +284,7 @@ export default class UserController {
|
|
|
283
284
|
return await convert(user, ZodUser);
|
|
284
285
|
}
|
|
285
286
|
|
|
286
|
-
@Invalidate(usersCache)
|
|
287
|
+
@Invalidate(usersCache, true)
|
|
287
288
|
@RateLimit(config.rateLimitTimeSpan, config.rateLimitAllowedCalls)
|
|
288
289
|
/**
|
|
289
290
|
* Create a new user
|
|
@@ -296,7 +297,7 @@ export default class UserController {
|
|
|
296
297
|
users.push(user);
|
|
297
298
|
}
|
|
298
299
|
|
|
299
|
-
@Memoize(usersCache)
|
|
300
|
+
@Memoize(usersCache, () => "key")
|
|
300
301
|
@Timeout(config.timeout)
|
|
301
302
|
@RateLimit(config.rateLimitTimeSpan, config.rateLimitAllowedCalls)
|
|
302
303
|
/**
|
|
@@ -304,21 +305,23 @@ export default class UserController {
|
|
|
304
305
|
* @returns {Promise<UserDto[]>} List of users with hidden password fields
|
|
305
306
|
* @throws {ResponseError} 500 - When rate limit exceeded
|
|
306
307
|
*/
|
|
307
|
-
public async getAll(
|
|
308
|
+
public async getAll(
|
|
309
|
+
timeoutSignal?: AbortSignal
|
|
310
|
+
): Promise<(UserDto | null)[]> {
|
|
308
311
|
return await parallelMap(users, async (user) =>
|
|
309
|
-
|
|
312
|
+
timeoutSignal?.aborted == false
|
|
310
313
|
? await convert<User, UserDto>(user!, ZodUserDto)
|
|
311
314
|
: null
|
|
312
315
|
);
|
|
313
316
|
}
|
|
314
317
|
|
|
315
|
-
@Memoize(
|
|
318
|
+
@Memoize(userCache)
|
|
316
319
|
@RateLimit(config.rateLimitTimeSpan, config.rateLimitAllowedCalls)
|
|
317
320
|
/**
|
|
318
321
|
* Get user by ID
|
|
319
322
|
* @param {number} id - User ID as string
|
|
320
323
|
* @returns {Promise<UserDto>} User details or error object
|
|
321
|
-
* @throws {ResponseError} 404 - User not
|
|
324
|
+
* @throws {ResponseError} 404 - User not fou
|
|
322
325
|
* @throws {ResponseError} 400 - Invalid ID format
|
|
323
326
|
*/
|
|
324
327
|
public async get(id: number): Promise<UserDto> {
|