Skip to content

feat: new util passParams#42

Merged
fratzinger merged 2 commits into
mainfrom
feat/new-util-pass-params
Jul 1, 2026
Merged

feat: new util passParams#42
fratzinger merged 2 commits into
mainfrom
feat/new-util-pass-params

Conversation

@fratzinger

Copy link
Copy Markdown
Member

This pull request introduces a new utility, passParams, which provides a declarative and safe way to select or project relevant params keys for cache keys, and integrates it into the cache hook to prevent dangerous cache key collisions and wasteful misses. The documentation and tests for the cache hook have been significantly improved to guide users in safely choosing cache-relevant params. Additional improvements include upgrades to development dependencies and workspace configuration.

Key changes:

New Utility: passParams

  • Added src/utils/pass-params/pass-params.util.ts: Implements the passParams function, allowing declarative selection and projection of params keys using a schema, with support for whitelisting, blacklisting, and custom projection functions. Includes options for dropping or reporting unknown keys to prevent cache key mistakes.
  • Added comprehensive unit tests (src/utils/pass-params/pass-params.util.test.ts) and type tests (src/utils/pass-params/pass-params.util.test-d.ts) to ensure correctness and type safety. [1] [2]
  • Exported passParams from the main utils index for easy consumption.
  • Added documentation for passParams describing its usage and integration points.

Integration with Cache Hook

  • Updated src/hooks/cache/cache.hook.md:
    • Expanded the documentation to explain the importance of carefully choosing cache-relevant params, highlighting the dangers of false hits and misses.
    • Provided usage examples for both blacklisting (exclude keys) and whitelisting (include only specific keys) using passParams.
    • Linked to passParams and explained how to use it in the transformParams option for the cache hook. [1] [2]
  • Added tests to src/hooks/cache/cache.hook.test.ts to verify that passParams correctly prevents cross-user cache hits, strips transient keys, and handles function-valued params safely.
  • Minor formatting and consistency updates in the cache hook documentation. [1] [2]

Dependency and Workspace Updates

  • Upgraded @feathers-community/eslint-config to version 0.2.0 in package.json and updated the workspace configuration to allow this version. [1] [2]
  • Added Prettier configuration to package.json for consistent formatting.

These changes make caching safer and more predictable, and provide clear tools and guidance for developers to avoid subtle and dangerous cache bugs.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploying feathers-utils with  Cloudflare Pages  Cloudflare Pages

Latest commit: de7792b
Status: ✅  Deploy successful!
Preview URL: https://356c3372.feathers-utils.pages.dev
Branch Preview URL: https://feat-new-util-pass-params.feathers-utils.pages.dev

View logs

@fratzinger fratzinger merged commit e96faaa into main Jul 1, 2026
9 checks passed
@fratzinger fratzinger deleted the feat/new-util-pass-params branch July 1, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant