LibreChat/packages/api
Dustin Healy ea446b12ae 🧪 test: Memoize compiled patterns + add middleware spec
Memoize the compiled pattern array via a WeakMap keyed by the
messagePiiFilter config object so repeat requests against the same
config skip the per-request RegExp construction. Cache entries are
released automatically when the config object itself rotates.

Adds packages/api/src/middleware/messagePiiFilter.spec.ts covering
the default-starter rejections, the starterPatterns subset and
empty-array semantics, customPatterns matching layered on top of and
in place of the starters, the no-config and empty-text pass-through
paths, and a memoization regression check.
2026-06-08 11:50:00 -07:00
..
src 🧪 test: Memoize compiled patterns + add middleware spec 2026-06-08 11:50:00 -07:00
types
.gitignore
babel.config.cjs
jest.config.mjs
jest.setup.cjs
package.json
tsconfig-paths-bootstrap.mjs
tsconfig.build.json
tsconfig.json
tsconfig.spec.json
tsdown.config.mjs