84 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
d1b571a640 Refactor: Extract resolveWaiting helper to reduce code duplication
- Created resolveWaiting helper function to centralize the logic for resolving and cleaning up waiting entries
- Simplified test error message to avoid redundancy
- This improves code maintainability by avoiding duplication

Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
2025-12-08 13:33:27 +00:00
copilot-swe-agent[bot]
af86478014 Fix axios.waiting memory leak when maxEntries is set
- Added cleanup of waiting map entries in response interceptor when cache state is not 'loading'
- This prevents memory leaks when entries are evicted from storage due to maxEntries limit
- Added comprehensive tests to verify the fix
- Updated existing test to reflect correct behavior

Co-authored-by: arthurfiorette <47537704+arthurfiorette@users.noreply.github.com>
2025-12-08 13:29:10 +00:00
Arthur Fiorette
ff5589f9fb
fix: typing issues with axios >= 11.7.8 (#953) 2025-03-17 23:49:55 -03:00
Arthur Fiorette
1178d334dc
feat: location and Cache-Control: private 2025-03-17 23:21:18 -03:00
Guillaume de Jabrun
12af673402
fix: aborted requests should not clear its cache afterwards if previous request was cached (#923) 2024-10-22 10:58:42 -03:00
Arthur Fiorette
a7a4e31e57
fix: cloneData for concurrent requests (#921)
* code

* code

* reuse my biome config

* fix breaking change on 1.6.0

* lint
2024-10-18 11:09:15 -03:00
Kevin Foniciello
75aa9cfefd
feat: add stale flag in request return object (#843)
* feature: added stale flag in request return object

* feature: added stale flag in request return object

* feat: added stale flag in request return object

* feat: added stale flag in request return object

* chore: fixed lint issues
2024-08-03 20:52:56 -03:00
Arthur Fiorette
ed99d775bb
feat: correct ESM and CJS support, move to microbundle. (#764) 2024-01-18 23:48:33 -03:00
dependabot[bot]
ed142c6ca2
chore(deps-dev): bump @biomejs/biome from 1.3.3 to 1.4.1 (#740)
* chore(deps-dev): bump @biomejs/biome from 1.3.3 to 1.4.1

Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 1.3.3 to 1.4.1.
- [Release notes](https://github.com/biomejs/biome/releases)
- [Changelog](https://github.com/biomejs/biome/blob/main/CHANGELOG.md)
- [Commits](https://github.com/biomejs/biome/commits/cli/v1.4.1/packages/@biomejs/biome)

---
updated-dependencies:
- dependency-name: "@biomejs/biome"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* linted code

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arthur Fiorette <me@arthur.place>
2023-12-12 16:14:39 -03:00
Arthur Fiorette
ecbc27e466
style: linted code 2023-11-16 03:26:37 -03:00
Arthur Fiorette
37e2f1e85a
chore: migrated to biomejs.dev 2023-11-16 03:26:20 -03:00
Arthur Fiorette
309bfe1062
fix: handle axios errors without config (#674) 2023-09-30 15:57:09 -03:00
Arthur Fiorette
286b2c0296
fix: rejected response deadlocks (#685) 2023-09-30 15:44:37 -03:00
Arthur Fiorette
16e51e788b
feat: prefer noop over undefined when debugging 2023-09-30 15:03:21 -03:00
José
e2b73e1c3a
fix: avoid RangeError: Maximum call stack size exceeded on streams and other objects (#616)
* refactor: change id generation location

* fix: lint

* refactor: ensures id will be created only if cache is not false

* chore(deps-dev): bump vitepress from 1.0.0-beta.5 to 1.0.0-beta.6 (#618)

* chore(deps-dev): bump @types/node from 18.16.19 to 18.17.0 (#617)

* chore(deps-dev): bump tslib from 2.6.0 to 2.6.1 (#619)

* chore(deps-dev): bump @types/node from 18.17.0 to 18.17.1 (#620)

* chore: dependabot

* ci: dependabot

* feat: handle non axios errors rejections (#609)

* fix: correct config re throw

* chore(deps-dev): bump eslint-config-prettier from 8.8.0 to 8.9.0 (#624)

* chore(deps-dev): bump jest from 29.6.1 to 29.6.2 (#622)

* feat: turn most types into interfaces (#615)

* Turn most types into interfaces

* Turn 'CacheAxiosResponse' into a interface

* Update docs

* Change docs to be more didactic

* chore(deps-dev): bump jest-environment-jsdom from 29.6.1 to 29.6.2 (#623)

* chore: removed unused eslint comment

* feat: handle errors on object-code

* feat: bring back ids

* chore: lint

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Arthur Fiorette <arthur.fiorette@gmail.com>
Co-authored-by: Denis Rossati <denis.rossatiramos@gmail.com>
2023-07-30 03:39:36 -03:00
arthurfiorette
cb3114f7e8
chore: removed unused eslint comment 2023-07-30 00:31:45 -03:00
arthurfiorette
ddcac5f58f
fix: correct config re throw 2023-07-30 00:05:15 -03:00
arthurfiorette
929054e83f
feat: handle non axios errors rejections (#609) 2023-07-28 01:25:53 -03:00
arthurfiorette
360ba57348 feat: handle response interceptor errors 2023-03-19 17:30:02 -03:00
Richard Garnier
2ae4d28878
fix: Support stale-while-revalidate (#514)
* implement stale-while-revalidate

* Backward compatibility

* Fix review comments

* chore: isExpired check comment

---------

Co-authored-by: Arthur Fiorette <github@arthur.place>
2023-03-19 16:54:24 -03:00
Guilherme Mazoni
ee8b6b36a1
feat: staleIfError using stale-if-error directive (#506)
* Fix #506

* fix fmt
2023-02-24 11:25:39 -03:00
arthurfiorette
eddff579c5
fix: axios headers 2023-02-02 20:14:46 -03:00
Dimitris-Rafail Katsampas
7ea3023e95
fix: prevent response storage calls if method is not supported (#464)
* fix: Prevent response storage calls if method is not supported

* fix: Added missing import

* chore: File formatting

* fix: Ensure updateCache gets called before method check

* chore: Removed unnecessary optional chaining

* fix: Added methods check for reject callback

* test: Added tests that cover cache.methods cases

* test: Added assertions to axios rejecting tests

* chore: Added more details to debugging logs
2023-01-18 08:33:28 -03:00
arthurfiorette
67819a3d78 refactor: dependencies, lint and null assertions 2022-08-24 07:36:29 -03:00
Arthur Fiorette
cf97535d33
fix: cache update not being executed correctly (#283)
* test: added flaky test

* fix: fixed flaky test

* style: formatted code
2022-06-29 22:04:28 -03:00
arthurfiorette
268fccb935
feat: override cache option 2022-06-05 11:26:00 -03:00
arthurfiorette
d87307ae93
feat: remove remnant x-axios-headers from server response 2022-06-05 09:50:02 -03:00
arthurfiorette
623ae22053
refactor: updated some minor things 2022-05-07 15:08:52 -03:00
Arthur Fiorette
17682ca0b9
Pass currentRequest on each access to storages (#220) (#226)
* feat: initial working code

* fix: better usage of currentRequest on storages

* feat: added tests
2022-05-01 10:03:30 -03:00
arthurfiorette
55f9599788
refactor: simpler config.cache check 2022-04-30 22:40:49 -03:00
arthurfiorette
0a00778065
fix: fixed bug when a pending request had it cached empty (#165) 2022-03-24 19:03:40 -03:00
arthurfiorette
098cf47d06
refactor: added debug points 2022-01-23 18:12:14 -03:00
arthurfiorette
d14750ee63
refactor: moved header file 2022-01-19 07:48:33 -03:00
arthurfiorette
7217eaff02
fix: removed breaking behaviour 2022-01-18 12:48:49 -03:00
arthurfiorette
edb32bdea3
feat: add staleIfError support 2022-01-18 12:06:20 -03:00
arthurfiorette
e391f5664c
refactor: Header as const and renaming... 2022-01-15 12:22:12 -03:00
arthurfiorette
fa2c6e3204
perf: only execute one generateKey per request 2022-01-13 21:23:36 -03:00
arthurfiorette
ff73ad5c69
fix: await unawaited promises and eslint more severe 2022-01-10 13:30:31 -03:00
arthurfiorette
88d45cc0fb
feat: cache predicate now supports async functions 2022-01-10 13:00:35 -03:00
arthurfiorette
38a5ecd365
refactor: simplified cachePredicate 2022-01-09 17:27:51 -03:00
arthurfiorette
f30e2622dd
refactor: removed "abstract" buildInterceptor function 2022-01-08 12:56:55 -03:00
arthurfiorette
cd2f14c446
refactor: removed classes to decrease bundle size 2022-01-08 12:27:52 -03:00
Arthur Fiorette
25b34e5d11
docs: documentation at axios-cache-interceptor.js.org (#108) 2022-01-06 18:44:36 -03:00
arthurfiorette
ce2f5976bc
fix: proper generic usage to type deep properties 2022-01-04 15:27:30 -03:00
arthurfiorette
1e87549eb6
feat: allow ttl to be defined based on the response 2022-01-03 10:00:39 -03:00
arthurfiorette
c57916fd67
refactor: extracted static functions to a single file 2022-01-03 09:14:47 -03:00
arthurfiorette
4a0a99ff28
refactor: prevent confusion by renaming createCache to useCache 2021-12-30 13:54:23 -03:00
arthurfiorette
a77cde7e22
refactor: better cache predicate function 2021-12-11 12:27:37 -03:00
arthurfiorette
c3a0fea1bd
refactor: externalized createCacheData function 2021-12-11 10:42:32 -03:00
arthurfiorette
07ec645a9d
perf: removed tslib and typed-core in favor of fast-defer 2021-12-08 16:46:15 -03:00