fix: bugfixes & improvements#32
Merged
Merged
Conversation
Deploying feathers-utils with
|
| Latest commit: |
1ff8993
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3fb1943d.feathers-utils.pages.dev |
| Branch Preview URL: | https://fix-bugfixes-improvements.feathers-utils.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and new features to the caching and hook utilities, along with enhanced test coverage and error handling. The most significant changes are the addition of customizable and optional deep cloning for cache results, robust error handling for the
onDeletehook, and improvements to cache key normalization and async cache compatibility. Below are the most important changes grouped by theme:Cache Hook Enhancements:
cloneoption toCacheOptionsincache.hook.ts, allowing users to control whether and how cached results are deep-cloned (usingfast-copyby default, with options to disable or provide a custom function). This prevents accidental mutation of cached objects and improves flexibility. [1] [2] [3] [4]Setfor O(1) membership checks when invalidating cached entries by ID. [1] [2]cloneutility inclone.tsto usefast-copyinstead ofJSON.stringifyfor deep cloning, supporting more data types and circular references. Added corresponding tests. [1] [2]Cache Key Normalization:
stableStringifyincache-utils.tsto use a single canonicalization pass withsortQueryProperties, ensuring deterministic cache keys regardless of object property or array order. Added extensive tests for key normalization. [1] [2]Hook Error Handling and Robustness:
onDeletehook to support anonErrorcallback, allowing non-blocking related-service errors to be surfaced without unhandled rejections. Blocking mode now correctly propagates errors to the caller. Added tests for both behaviors. [1] [2] [3] [4]disallowhook to treat an empty transport array as "block all" (fail closed), with corresponding tests. [1] [2]Developer Tooling:
.claude/settings.jsonfor easier code quality checks.