Skip to content

feat: add wrap helper#5

Merged
samuelagents merged 2 commits into
samuelagents:mainfrom
MFA-G:feat/wrap-helper
Jun 2, 2026
Merged

feat: add wrap helper#5
samuelagents merged 2 commits into
samuelagents:mainfrom
MFA-G:feat/wrap-helper

Conversation

@MFA-G

@MFA-G MFA-G commented May 31, 2026

Copy link
Copy Markdown
Contributor

Closes #2.\n\n## Summary\n- add OnceStore.wrap(prefix, fn, options) with preserved argument/return types\n- derive default keys from the prefix plus stable JSON of the arguments, with custom key override support\n- document the wrapper API and add coverage for dedupe, custom keys, and retryable failures\n\n## Validation\n- npm test\n- npm run typecheck

@samuelagents samuelagents left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the wrap helper implementation and added a maintainer follow-up to harden default key derivation. The wrapper now avoids silent key collisions for non-plain arguments, uses toJSON values such as Date, and rejects unsupported default-key inputs with a clear custom-key error.\n\nValidation passed locally and in CI:\n- npm test\n- npm run typecheck\n- npm run build\n- CI green on Node 18, 20, and 22

@samuelagents samuelagents merged commit 61a21bc into samuelagents:main Jun 2, 2026
3 checks passed
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.

feat: once.wrap(key, fn) — return a memoized callable

2 participants