Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1a99ce9
feat(cache-interface): added onError for has() method
belgattitude Dec 30, 2020
f16ed51
feat(exception): added InvalidCacheKeyException
belgattitude Dec 30, 2020
476ec29
feat(guards): Initial guard namespace
belgattitude Dec 30, 2020
4d101fe
feat(assertions): initial Asserts namespace
belgattitude Dec 30, 2020
b09a642
refactor!(cache-item): changed value to data and remove obsolete
belgattitude Dec 30, 2020
1d9aca2
feat(factory): added convenience cache-item factories
belgattitude Dec 30, 2020
87b87af
feat: add new exports
belgattitude Dec 30, 2020
e041a96
refactor!(adapters): refactored to new cacheItem interface
belgattitude Dec 30, 2020
3f9f03e
tests(unit): added mini suite for invalid cache keys
belgattitude Dec 30, 2020
4e2b483
test(e2e): refactor to new refactors
belgattitude Dec 30, 2020
52f0b37
refactor!: error as undefined rather than false
belgattitude Dec 30, 2020
e7f866c
refactor!: error as undefined rather than false
belgattitude Dec 30, 2020
dddcfdf
fix(map-adapter): invalid isHit returned
belgattitude Dec 30, 2020
d4df510
tests(e2e): refactor for new api
belgattitude Dec 30, 2020
bbf452a
refactor: remove obsolete test utils
belgattitude Dec 30, 2020
d784064
docs: mention node-testcontainers
belgattitude Dec 30, 2020
1ee2ec6
docs: improve contributors doc
belgattitude Dec 31, 2020
dc54cb0
docs: fix invalid usage
belgattitude Dec 31, 2020
4cac91d
docs: update badge
belgattitude Dec 31, 2020
c7ca5e4
chore(deps): added moq.ts
belgattitude Dec 31, 2020
c0622dc
feat: add isConnectedCache guard
belgattitude Dec 31, 2020
2b1808b
refactor: use ConnectedCacheInterface and associated guard
belgattitude Dec 31, 2020
af537ef
docs: updated to new cacheitem data payload
belgattitude Dec 31, 2020
e326114
docs: updated about section
belgattitude Dec 31, 2020
e3629dc
docs: updated usage
belgattitude Dec 31, 2020
6c23091
feat: native-json-serializer
belgattitude Dec 31, 2020
cd42fb9
refactor: remove nullconnection
belgattitude Dec 31, 2020
a587fae
fix: has returns undefined if error
belgattitude Dec 31, 2020
3844b14
tests(e2e): testing has for undefined and onError
belgattitude Dec 31, 2020
0f8a9f6
docs: do not throw anymore for InvalidArgument
belgattitude Dec 31, 2020
77a2181
docs: changesets added
belgattitude Dec 31, 2020
7e4b30e
refactor: use optional chaining
belgattitude Dec 31, 2020
21c37bc
refactor: cleanup TrueOrFalseOrUndefined
belgattitude Dec 31, 2020
e8efc9b
fix(ts): fixing export of type definition
belgattitude Dec 31, 2020
85ce90a
chore(lock): updated lock file
belgattitude Dec 31, 2020
5df5706
docs: changeset
belgattitude Dec 31, 2020
527919d
refactor: export typeguards in guards
belgattitude Dec 31, 2020
0bbcc7c
docs: mention new guards
belgattitude Dec 31, 2020
1202798
fix: isPromieLike
belgattitude Dec 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/honest-beds-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@soluble/cache-e2e-tests': minor
'@soluble/cache-interop': minor
'@soluble/cache-ioredis': minor
'@soluble/cache-redis': minor
---

Added isSuccess, isHit in payload
8 changes: 8 additions & 0 deletions .changeset/itchy-onions-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@soluble/cache-e2e-tests': minor
'@soluble/cache-interop': minor
'@soluble/cache-ioredis': minor
'@soluble/cache-redis': minor
---

Add onError option to has() method
8 changes: 8 additions & 0 deletions .changeset/lazy-rocks-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@soluble/cache-e2e-tests': minor
'@soluble/cache-interop': minor
'@soluble/cache-ioredis': minor
'@soluble/cache-redis': minor
---

CacheItem returns {data} rather than {value} (BC)
8 changes: 8 additions & 0 deletions .changeset/perfect-pens-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@soluble/cache-e2e-tests': minor
'@soluble/cache-interop': minor
'@soluble/cache-ioredis': minor
'@soluble/cache-redis': minor
---

Export of Guards and Asserts
8 changes: 8 additions & 0 deletions .changeset/rich-trains-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@soluble/cache-e2e-tests': minor
'@soluble/cache-interop': minor
'@soluble/cache-ioredis': minor
'@soluble/cache-redis': minor
---

Add InvalidCacheKeyException checks
8 changes: 8 additions & 0 deletions .changeset/tiny-mirrors-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@soluble/cache-e2e-tests': minor
'@soluble/cache-interop': minor
'@soluble/cache-ioredis': minor
'@soluble/cache-redis': minor
---

Fix typing exports
24 changes: 23 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

Fork this repo and contribute a P/R.

## Running tests

Tests are separated in unit and e2e, you can launch them separately:

### Unit tests

The convention for unit tests is to place them in their respective packages and
colocate them in a `__test__` subfolder. You can run
them by:

```bash
$ yarn test:unit
```

### E2E tests

E2E tests are packaged separately in [./packages/cache-e2e-tests/test](https://github.com/soluble-io/cache-interop/tree/main/packages/cache-e2e-tests)
to allow coverage of all adapters.

> Note that `test:e2e` requires docker installed on your machine.
> If you don't want to to install docker, you can rely
> on the [github action](https://github.com/soluble-io/cache-interop/blob/main/.github/workflows/ci.yml).

## Structure

This monorepo holds the various adapters, the contracts for interoperability and the e2e tests.
Expand All @@ -20,4 +43,3 @@ This monorepo holds the various adapters, the contracts for interoperability and
└── # e2e test suite for all adapters #
```


7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
</a>
</p>


# About | [Documentation](https://github.com/soluble-io/cache-interop/)

> **This project is in early architectural definition ;)**


Expand Down Expand Up @@ -69,9 +72,9 @@ const cache = new IoRedisCacheAdapter({

const asyncFetch = () => myFetch('/api').then(r => JSON.stringify(r));

const { value, error } = await cache.getOrSet('key', asyncFetch(), { ttl: 3600 });
const { data, error } = await cache.getOrSet('key', asyncFetch(), { ttl: 3600 });

if (value !== null) {
if (data !== null) {
// do something
}
```
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"lerna": "^3.22.1",
"lint-staged": "^10.5.3",
"microbundle": "^0.13.0",
"moq.ts": "^7.0.0",
"npm-check-updates": "^10.2.5",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
Expand Down
22 changes: 21 additions & 1 deletion packages/cache-e2e-tests/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h1 align="center"><a aria-label="soluble/cache-e2e-tests" href="https://github.com/soluble-io/cache-interop/tree/main/packages/cache-e2e-tests">@soluble/cache-e2e-tests</a></h1>
<h4 align="center"><a aria-label="soluble/cache-interop" href="">@soluble/cache-interop</a> E2E shared test suites.</h4>
<h4 align="center"><a aria-label="soluble/cache-interop" href="https://github.com/soluble-io/cache-interop">@soluble/cache-interop</a> E2E shared test suites.</h4>
</div>
<p align="center">
<a aria-label="Coverage" href="https://codecov.io/gh/soluble-io/cache-interop">
Expand All @@ -10,12 +10,32 @@
<img alt="Typescript" src="https://img.shields.io/badge/Typescript-4.+-blue?logo=typescript&style=for-the-badge&labelColor=000000" />
</p>

## About

The e2e package provides a shared suite for all [@soluble/cache-interop](https://github.com/soluble-io/cache-interop)
official adapters.

> Note that `test:e2e` requires docker installed on your machine.
> If you don't want to to install docker, you can rely
> on the [github action](https://github.com/soluble-io/cache-interop/blob/main/.github/workflows/ci.yml).

## Install

```bash
$ yarn install
```

## Run tests

```bash
$ yarn test:e2e
```

## Environments

The `test:e2e` uses [node-testcontainers](https://github.com/testcontainers/testcontainers-node) under the hood to
spin redis 5 and redis 6 instances.

## Contribute

See the [@soluble/cache-interop CONTRIBUTING.md](https://github.com/soluble-io/cache-interop/blob/main/CONTRIBUTING.md) guide.
Expand Down
Loading