Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(csi-161): define all interfaces and types #2

Merged
merged 54 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2b8fdbe
feat(csi-161): added tsup for bundling cjs/esm files
geka-evk Jun 21, 2024
448aef1
chore(csi-15): added TS build step to npm-publish job
geka-evk Jun 21, 2024
46a165f
chore(csi-15): added .npmignore
geka-evk Jun 21, 2024
683bf92
Merge pull request #3 from mojaloop/chore/csi-15-npm-publish
geka-evk Jun 21, 2024
4c32f78
Merge branch 'main' into task/csi-161
geka-evk Jun 21, 2024
98df380
ci(snapshot): 0.1.1-snapshot.0
geka-evk Jun 21, 2024
de8c058
chore(csi-15): added npm ci to npm-publish job
geka-evk Jun 21, 2024
59c40e3
Merge branch 'main' into task/csi-161
geka-evk Jun 21, 2024
df91efc
ci(snapshot): 0.1.1-snapshot.1
geka-evk Jun 21, 2024
9805646
chore(csi-15): added package scope
geka-evk Jun 21, 2024
8546a2a
chore(csi-15): updated from main
geka-evk Jun 21, 2024
280c2c5
ci(snapshot): 0.1.1-snapshot.2
geka-evk Jun 21, 2024
4fe9879
chore(csi-15): added prepublishOnly script
geka-evk Jun 22, 2024
9639fae
chore(csi-15): updated deps
geka-evk Jun 22, 2024
a1bc6c9
chore(csi-161): updated from main
geka-evk Jun 22, 2024
5b23cc6
ci(snapshot): 0.1.1-snapshot.3
geka-evk Jun 22, 2024
8c4cfe8
chore(csi-161): added typedoc
geka-evk Jun 22, 2024
44e2eae
ci(snapshot): 0.1.1-snapshot.4
geka-evk Jun 22, 2024
702d353
chore(csi-161): added docs to "files"
geka-evk Jun 22, 2024
9062b40
ci(snapshot): 0.1.1-snapshot.5
geka-evk Jun 22, 2024
b42da16
chore(csi-161): added docs to git
geka-evk Jun 22, 2024
21a43db
ci(snapshot): 0.1.1-snapshot.6
geka-evk Jun 22, 2024
8151dae
chore(csi-161): added docs folder
geka-evk Jun 22, 2024
5b6d9b8
chore(csi-161): converted types.ts to folder; improved README
geka-evk Jun 22, 2024
10ad5eb
chore(csi-161): updated docs
geka-evk Jun 22, 2024
8e8a2b6
ci(snapshot): 0.1.1-snapshot.7
geka-evk Jun 22, 2024
7bce02f
chore(csi-161): exported storages
geka-evk Jun 22, 2024
f685777
chore(csi-161): defined final proxyCache interface
geka-evk Jun 24, 2024
7929674
chore(csi-161): updated typedoc
geka-evk Jun 24, 2024
fe61970
ci(snapshot): 0.2.0-snapshot.1
geka-evk Jun 24, 2024
93a0635
chore(csi-161): removed unneeded code
geka-evk Jun 24, 2024
25e2df9
chore(csi-15): added dist-tag step to npm-publish
geka-evk Jun 25, 2024
e805bb2
chore(csi-162): added redis proxyCache impl.; updated interfaces
geka-evk Jun 25, 2024
fbd269f
chore(csi-162): updated deps
geka-evk Jun 25, 2024
b063330
chore(csi-162): cleanup
geka-evk Jun 25, 2024
8e2d441
chore(csi-162): updated docs
geka-evk Jun 25, 2024
1bcaa68
chore(csi-162): added int.tests; updated deps
geka-evk Jun 25, 2024
c8d28a5
chore(csi-162): added docker to int.test
geka-evk Jun 25, 2024
b77bc12
chore(csi-162): added defaults_machine_Dependencies
geka-evk Jun 25, 2024
a47f657
chore(csi-162): fixed CI issue
geka-evk Jun 25, 2024
f01d158
chore(csi-162): added docker-compose.yml
geka-evk Jun 25, 2024
e086d29
chore(csi-162): added docker-compose.yml
geka-evk Jun 25, 2024
45b9527
chore(csi-162): updated from main
geka-evk Jun 25, 2024
d513182
chore(csi-162): fixed int. tests on CI env
geka-evk Jun 25, 2024
ac4a79b
chore(csi-162): added .env
geka-evk Jun 25, 2024
e99e13f
Merge pull request #4 from mojaloop/task/csi-162
geka-evk Jun 25, 2024
743805d
chore(csi-162): updated docs
geka-evk Jun 25, 2024
c8b2796
ci(snapshot): 0.3.1-snapshot.0
geka-evk Jun 25, 2024
b76625c
ci(snapshot): 0.3.1-snapshot.1
geka-evk Jun 25, 2024
20b959f
chore(csi-162): updated deps
geka-evk Jun 26, 2024
823ab38
ci(release): 0.3.2 [skip ci]
geka-evk Jun 26, 2024
c3fe557
chore(csi-162): added BasicProxyCache; hid logger-related types; upda…
geka-evk Jun 26, 2024
464db07
ci(release): 0.3.3 [skip ci]
geka-evk Jun 26, 2024
37c949b
Merge pull request #5 from mojaloop/task/csi-162
geka-evk Jun 26, 2024
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
41 changes: 39 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ defaults_docker_Dependencies: &defaults_docker_Dependencies |
apk --no-cache add bash bash-doc bash-completion
npm install -g node-gyp

defaults_machine_Dependencies: &defaults_machine_Dependencies |
## Add Package Repos
## Ref: https://docs.confluent.io/platform/current/installation/installing_cp/deb-ubuntu.html#get-the-software
wget -qO - https://packages.confluent.io/deb/7.4/archive.key | sudo apt-key add -
sudo add-apt-repository -y "deb https://packages.confluent.io/clients/deb $(lsb_release -cs) main"

## Install deps
sudo apt install -y curl bash musl-dev libsasl2-dev
sudo ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1

defaults_awsCliDependencies: &defaults_awsCliDependencies |
apk --no-cache add aws-cli

Expand All @@ -41,8 +51,9 @@ defaults_npm_auth: &defaults_npm_auth

defaults_npm_publish_release: &defaults_npm_publish_release
name: Publish NPM $RELEASE_TAG artifact
command: |
command: |
source $BASH_ENV
npm ci
echo "Publishing tag $RELEASE_TAG"
npm publish --tag $RELEASE_TAG --access public

Expand Down Expand Up @@ -240,6 +251,27 @@ jobs:
- store_test_results:
path: coverage

test-integration:
executor: default-machine
steps:
- run:
name: Install general dependencies
command: *defaults_machine_Dependencies
- checkout
- run:
<<: *defaults_configure_nvm
- run:
<<: *defaults_display_versions
- restore_cache:
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Execute integration tests
command: |
docker compose build
docker compose up -d
npm run test:int
docker compose down -v

vulnerability-check:
executor: default-docker
steps:
Expand Down Expand Up @@ -438,7 +470,7 @@ workflows:
context: org-global
- setup:
context: org-global
filters:
filters: &BUILD_AND_TEST_FILTERS
tags:
only: /.*/
branches:
Expand Down Expand Up @@ -490,6 +522,11 @@ workflows:
ignore:
- /feature*/
- /bugfix*/
- test-integration:
context: org-global
requires:
- setup
filters: *BUILD_AND_TEST_FILTERS
- vulnerability-check:
context: org-global
requires:
Expand Down
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LOG_LEVEL_PROXY_CACHE=debug

REDIS_HOST=localhost
REDIS_PORT=6379
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules/
npm-debug.log

src/
test/
coverage/

jest.config.js
tsconfig.json
tsconfig.test.json
tsup.config.ts
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.3.3](https://github.com/mojaloop/inter-scheme-proxy-cache-lib/compare/v0.3.2...v0.3.3) (2024-06-26)


### Chore

* **csi-162:** added BasicProxyCache; hid logger-related types; updated docs ([c3fe557](https://github.com/mojaloop/inter-scheme-proxy-cache-lib/commit/c3fe557a805579d638298401acc5bce23ae9d810))

### [0.3.2](https://github.com/mojaloop/inter-scheme-proxy-cache-lib/compare/v0.3.1-snapshot.1...v0.3.2) (2024-06-26)


### Chore

* **csi-162:** updated deps ([20b959f](https://github.com/mojaloop/inter-scheme-proxy-cache-lib/commit/20b959fe72967ddb7fb0a068ae6d178c2755ebbf))
55 changes: 46 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,72 @@
# inter-scheme-proxy-cache-lib
# @mojaloop/inter-scheme-proxy-cache-lib

`inter-scheme-proxy-cache-lib` is a common component that provides proxy caching mapping.
It helps reliably integrate proxy functionality throughout the all involved services.

### Use cases:
## Use cases:
- Proxy caching. (see [details](https://github.com/infitx-org/uml_diagrams/blob/main/Proxy/Proxy%20pattern%20-%20happy%20path.png))
- Failure count cache with max failure count per {Id}. (see [details](https://github.com/infitx-org/uml_diagrams/blob/main/Proxy/Proxy%20pattern%20-%20Lazy%20Discovery%20-%20No%20Oracles.png))

## Quick Start

### Install dependencies
### Installation

```bash
npm install
npm install @mojaloop/inter-scheme-proxy-cache-lib
```

## Build
### Basic Usage

```typescript
// ESM
import { createProxyCache, STORAGE_TYPES } from '@mojaloop/inter-scheme-proxy-cache-lib';
// CJS
const { createProxyCache } = require('@mojaloop/inter-scheme-proxy-cache-lib');

const proxyCache = createProxyCache(STORAGE_TYPES.redis, {
host: 'localhost',
port: 6379,
...
});
await proxyCache.addDfspIdToProxyMapping('dfsp_1', 'proxyAB');
```

### API docs
Check [_IProxyCache_](https://mojaloop.github.io/inter-scheme-proxy-cache-lib/interfaces/IProxyCache.html) interface docs to get more details.

Comprehensive and interactive API documentation, based on TypeScript source code of the package,
could be found [**here**](https://mojaloop.github.io/inter-scheme-proxy-cache-lib)


### Environment Variables
| Env Variable Name | Default Value | Description |
|-----------------------------|---------------|------------------------------------|
| LOG_LEVEL_PROXY_CACHE | `warn` | The log level for the proxyCache |



## Development

### Build

Command to transpile Typescript into JS:

```bash
npm run build
```

## Run
### Tests

```bash
npm start
npm test
```

## Tests
### Generate Typedoc documentation

```bash
npm test
npm run docs
```

## Collaborators

- [Eugen Klymniuk](https://github.com/geka-evk)
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.9"

services:
redis:
image: redis:6.2.4-alpine
# image: redis/redis-stack:latest
restart: "unless-stopped"
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_PORT=6379
- REDIS_REPLICATION_MODE=master
- REDIS_TLS_ENABLED=no
ports:
- "${REDIS_PORT}:6379"
1 change: 1 addition & 0 deletions docs/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
6 changes: 6 additions & 0 deletions docs/assets/26e93147f10415a0ed4a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/assets/75c9471662e97ee24f29.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/assets/db90e4df2373980c497d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/assets/hierarchy.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/assets/hierarchy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions docs/assets/highlight.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:root {
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}

@media (prefers-color-scheme: light) { :root {
--code-background: var(--light-code-background);
} }

@media (prefers-color-scheme: dark) { :root {
--code-background: var(--dark-code-background);
} }

:root[data-theme='light'] {
--code-background: var(--light-code-background);
}

:root[data-theme='dark'] {
--code-background: var(--dark-code-background);
}

pre, code { background: var(--code-background); }
Loading