47 Commits

Author SHA1 Message Date
Arthur Fiorette
55da840f7b
refactor: remove Object.freeze 2025-09-15 12:39:16 -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
Arthur Fiorette
a890fc2a8c
fix: support for URLSearchParams 2023-12-13 12:19:06 -03:00
Arthur Fiorette
db00789433
style: linted code 2023-11-16 03:34:03 -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
286b2c0296
fix: rejected response deadlocks (#685) 2023-09-30 15:44:37 -03:00
arthurfiorette
2cc948d531
feat: moved tests to node:test (#628) 2023-09-03 15:53:58 -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
7e5ca7e68a
fix: correct lowercase test 2023-06-08 13:21:29 -03:00
arthurfiorette
a5ebad3d14
fix: eslint warnings 2023-02-02 20:29:21 -03:00
Arthur Fiorette
f0cd5d1af2
feat: cache updater function for multiple keys. (#304)
* feat: implemented general cache updater function

* test: added tests

* docs: included cache update warning
2022-07-28 23:00:37 -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
a0e05e8d30
tests: fixed memory storage clone test 2022-03-11 17:14:40 -03:00
Arthur Fiorette
f699e194f8
fix: memory storage copy data to avoid reference changes (#164)
* tests: added initial unit test

* fix: added fix

* tests: fixed tests

* style: formatted code
2022-03-11 13:29:13 -03:00
arthurfiorette
ab45164287
fix: defaultKeyGenerator keeps response unchanged (#161) 2022-03-03 18:50:43 -03:00
arthurfiorette
0ba6025fb5
feat: debug mode & fixed tests 2022-01-23 16:13:22 -03:00
arthurfiorette
66f29c92c7
deps: updated axios to v0.25 2022-01-18 12:25:31 -03:00
arthurfiorette
9379fce100
feat: buildKeyGenerator and ids with req.data by default 2022-01-14 18:46:20 -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
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
1b93070db4
refactor: used triple equal sign 2022-01-09 13:33:44 -03:00
arthurfiorette
4f938a4793
tests: splited header interpreter tests into multiple files 2022-01-08 12:26:37 -03:00
arthurfiorette
85336da8b1
docs: fixed baseURL casing in examples & documentation 2022-01-08 12:26:07 -03:00
arthurfiorette
ed1e163472
chore: bundles exports everything and webpack bundles everything 2022-01-07 15:45:06 -03:00
arthurfiorette
cfbd601b98
feat: suupport for async CacheUpdater 2022-01-04 15:28:38 -03:00
arthurfiorette
a77cde7e22
refactor: better cache predicate function 2021-12-11 12:27:37 -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
2fa2557040 refactor: cacheUpdater as generic function 2021-10-12 09:19:59 -03:00
Hazork
49f80d78e4 tests: correct test name 2021-10-12 09:18:48 -03:00
Hazork
52689e24f4 fix: removed implict never 2021-10-09 14:36:36 -03:00
Hazork
f8adcc4352 fix: force import type to help compilation tools 2021-09-26 16:24:33 -03:00
Hazork
33b8dcd58b refactor!: updated all exports 2021-09-21 12:01:47 -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
6e61c0d5db refactor: renamed status constants 2021-09-19 19:31:33 -03:00
Hazork
6075a0a960 fix: a bunch of tests 2021-09-19 19:29:05 -03:00
Hazork
ee36bd57b0 refactor: more tests and fixes 2021-09-13 18:39:13 -03:00
Hazork
be5ee1ea8b refactor: ttl and createdAt instead of maxAge and storage takes care of staled entries 2021-09-13 16:05:37 -03:00
Hazork
bb552c8182 tests: added cache predicate tests 2021-09-13 14:20:45 -03:00
Hazork
6972069e91 docs: fixed project name 🤣 2021-09-13 13:40:23 -03:00
Hazork
7975c58645 tests: added key generator tests 2021-09-13 13:39:31 -03:00
Hazork
d09b3add31 tests: added deferred tests 2021-09-13 13:08:40 -03:00
Hazork
2bbc9cb858 fix: fixed a log of bugs and added unit tests 2021-09-13 12:08:43 -03:00