24 Commits

Author SHA1 Message Date
Sujeet Kc
05712980df
Ådd feature to blacklist some paths (#754)
* add feature to blacklist some paths

* format with biome

* update exclude attr definition

* improvements

* style: formatted code

* fix: lint

---------

Co-authored-by: Arthur Fiorette <me@arthur.place>
2023-12-23 17:40:05 -03:00
Arthur Fiorette
eefc98c6c0
perf: faster tests 2023-11-16 03:33:24 -03:00
Arthur Fiorette
ecbc27e466
style: linted code 2023-11-16 03:26:37 -03:00
Arthur Fiorette
892649c92f
fix: override and hydrate globally (#694) 2023-10-23 12:51:23 -03:00
arthurfiorette
2cc948d531
feat: moved tests to node:test (#628) 2023-09-03 15:53:58 -03:00
arthurfiorette
22870d7d72 fix: canStale should return false if Cache-Control: must-revalidate is present #507 2023-04-09 12:51:52 -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
arthurfiorette
eddff579c5
fix: axios headers 2023-02-02 20:14:46 -03:00
arthurfiorette
7d82c5a46f
feat: cache takeover #437 2022-12-25 16:56:25 -03:00
Arthur Fiorette
88c9655ba3
Axios cache interceptor v1 roadmap (#368)
* chore(deps-dev): bump axios from 0.27.2 to 1.0.0

Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.0.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.27.2...v1.0.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* feat: initial changes

* feat: more docs

* docs: global config

* feat: comparison

* chore: more docs

* docs: migrate docs generator to vitepress (#403)

* chore(vitepress): add basic files

* chore(vitepress): add dev deps & scripts for use

* chore(vitepress config): change to ts for type checks

* chore(vitepress config): remove js file

* chore(vitepress theme): add custom theme css

* chore(vitepress docs): add simple home page

* chore(gitignore): ignore doc dist

* chore(favicon): add icon to head

* feat(doc-features): add features spotlight

* chore(doc footer): made with ❤️

* chore(structure): move md files into `./src`

* chore(config): re-organise

* chore: custom dev port

* feat: documentation pages

* refactor: modified config

* feat: social links

* style: formatted code

* feat: removed code groups temporarily

* fix: fixed bundlephobia svg

* docs: general documentation remake

* docs: more rewritting

Co-authored-by: arthurfiorette <arthur.fiorette@gmail.com>

* fix: change headers usage

* fix: adapters exporting changes

* fix: request doesnt execute after abortion

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cain <75994858+cainthebest@users.noreply.github.com>
2022-12-05 22:36:31 -03:00
arthurfiorette
268fccb935
feat: override cache option 2022-06-05 11:26:00 -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
66f29c92c7
deps: updated axios to v0.25 2022-01-18 12:25:31 -03:00
arthurfiorette
fa2c6e3204
perf: only execute one generateKey per request 2022-01-13 21:23:36 -03:00
arthurfiorette
6f9ef36e75
fix: include data at keyGenerator (#116) 2022-01-13 20:48:21 -03:00
arthurfiorette
ff73ad5c69
fix: await unawaited promises and eslint more severe 2022-01-10 13:30:31 -03:00
arthurfiorette
c57916fd67
refactor: extracted static functions to a single file 2022-01-03 09:14:47 -03:00
arthurfiorette
6929b021e0
style: fixed prettier plugin order 2021-12-11 10:43:11 -03:00
Arthur Fiorette
48e33c5d5a
feat: etag and if-modified-since support (#53)
* feat(WIP): etag and if-modified-since support

* test: fixed test name

* fix: merge response headers

* test: add etag / last-modified tests

* test: add must-revalidate tests

* fix: handle expirationTime 0 as true.

* tests: refactored some tests

* test: added keepIfStale tests

* fix: remove axios error for 304 requests

* fix: possible infinite loop on validateStatus function

* tests: ignore code that is hard test from coverage

* fix: use Last-Modified header for modifiedSince

If-Modified-Since is never sent by a server, it's
a client only header. However Last-Modified is sent
by the server to indicate the last time the returned
version was modified (it might not be the last version
depending on cache configuration on intermediate
servers)

* test: use validateStatus in mock

This more closely match default axios adapter.

* fix: validateStatus handling all cases

* refactor: use cache.createdAt if the last-modified header isn't present

* test: etag with predefined value

* test: added more test cases

* fix: fixed logic in some tests

* docs: initial documentation

* fix: manual values work out of the box

This removes header requirement from server.

* docs: add details to etag and modifiedSince features

* fix: delete custom headers from response

* feat: accept all configurations from global axios

Merging global into local configuration enable user
to use global configuration for all options and remove
the need to check local and global values every time.

* fix: preserve original types from AxiosInstance

The only value axios needs is a URL, and in the second definition of the method, there is already a URL parameter, so it can be undefined.

* Fix: defaults modifiedSince back to false.

Avoids breaking changes.

* docs: fix etag examples

* docs: document internal headers

* refactor: ternary operator :)

* style: prettified code

* test: remove modifiedSince: false in tests since this is the default

* docs: fix headers examples

* docs: fixed example formatting

* tests: split tests into multiple files to test them faster

* docs: correct jsdoc empty object

Co-authored-by: Charly Koza <cka@f4-group.com>
2021-11-15 10:43:20 -03:00
Hazork
75deccf57d feat: preserve response status codes and use response.cached 2021-10-12 12:12:32 -03:00
Hazork
70e5c07ff3 refactor: concurreny fixes and refactored deferred
Also changed format settings,
fixed AxiosResponse types
and coded more tests
2021-09-20 12:04:40 -03:00
Hazork
1490bfc30b fix: concurrent requests not beeing cached 2021-09-19 20:14:44 -03:00
Hazork
6075a0a960 fix: a bunch of tests 2021-09-19 19:29:05 -03:00
Hazork
84dc522b87 refactor: init request and response tests 2021-09-13 19:20:31 -03:00