Skip to content

Commit

Permalink
improve readme with sequence diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
mahendraHegde committed May 18, 2024
1 parent 68eb785 commit 49b43ff
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Mermaid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
```mermaid
sequenceDiagram
participant Client2
participant Client
participant Server
Client->>Server: POST /data (Idempotency-Key=1)
activate Server
Server->>Store: Check for Idempotency-Key=1 (Not Found)
activate Store
deactivate Store
Server->>Server: Process Requesy
Server->>Store: Store Response(Idempotency-Key=1)
activate Store
deactivate Store
alt Timed Out/Server Crash/Connection Lost
Server-xClient: No Repsponse
else Client Crash
Server-xClient: 201 Created
end
deactivate Server
Client->>Server: POST /data (Retry, Idempotency-Key=1)
activate Server
Server->>Store: Check Idempotency-Key=1 (Exists)
activate Store
deactivate Store
Server->>Client: 201 OK (Duplicate Request)
deactivate Server
Client->>Server: POST /data (Idempotency-Key=2)
activate Client
activate Server
Server->>Store: Check Idempotency-Key=2 (Not Exists)
activate Store
deactivate Store
Server->>Server: Process Request
Client2->>Server: POST /data (concurrent Req, Idempotency-Key=2)
activate Client2
Server->>Store: Check Idempotency-Key=2 (In-Progress)
activate Store
deactivate Store
Server->>Client2: 409 Conflict, Retry-After=1
deactivate Client2
Server->>Client: 201 Created
deactivate Server
deactivate Client
Client2->>Server: POST /data (Retried After, Idempotency-Key=2)
activate Client2
activate Server
Server->>Store: Check Idempotency-Key (Exists)
activate Store
deactivate Store
Server->>Client2: 201 Created
deactivate Client2
deactivate Server
```
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ and powers,

- [`@node-idempotency/fastify`](https://www.npmjs.com/package/@node-idempotency/fastify) - Plug and Play `fastify` plugin for `@node-idempotency/core`

---
#### How?
![No Image](flow.png)

---

#### @node-idempotency/core
Expand Down
Binary file added flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/core/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ and powers

if above packages dont meet your needs, you can utilise the core package directly to tweek it as per your needs.

---
#### How?
![No Image](../../flow.png)
---

##### install
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-express/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Network requests are unpredictable; clients/proxies may send duplicate or concur
- <i>Customizable:</i> options to tweak the library as per your need.
- <i>[RFC](https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/) compliant: </i> Adheres to standards for compatibility with other systems/clients.

---
#### How?
![No Image](../../flow.png)
---

##### instal
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-fastify/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Network requests are unpredictable; clients/proxies may send duplicate or concur

---

#### How?
![No Image](../../flow.png)
---

##### instal

```bash
Expand Down
5 changes: 5 additions & 0 deletions packages/plugin-nestjs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Network requests are unpredictable; clients/proxies may send duplicate or concur

---

#### How?
![No Image](../../flow.png)

---

##### instal

```bash
Expand Down
8 changes: 8 additions & 0 deletions packages/shared/Readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#### node-idempotency/shared

Hey there!!! Thanks for landing here, you are probably not interested in this package but these,

- [`@node-idempotency/nestjs`](https://www.npmjs.com/package/@node-idempotency/nestjs) - Plug and Play `nestjs` wrapper for `@node-idempotency/core`

- [`@node-idempotency/express`](https://www.npmjs.com/package/@node-idempotency/express) - Plug and Play `express` middleware for `@node-idempotency/core`

- [`@node-idempotency/fastify`](https://www.npmjs.com/package/@node-idempotency/fastify) - Plug and Play `fastify` plugin for `@node-idempotency/core`
8 changes: 8 additions & 0 deletions packages/storage/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#### @node-idempotency/storage

Storage adapter interace for [@node-idempotency](https://www.npmjs.com/package/@node-idempotency/core).

Checkout these,

- [`@node-idempotency/nestjs`](https://www.npmjs.com/package/@node-idempotency/nestjs) - Plug and Play `nestjs` wrapper for `@node-idempotency/core`

- [`@node-idempotency/express`](https://www.npmjs.com/package/@node-idempotency/express) - Plug and Play `express` middleware for `@node-idempotency/core`

- [`@node-idempotency/fastify`](https://www.npmjs.com/package/@node-idempotency/fastify) - Plug and Play `fastify` plugin for `@node-idempotency/core`

0 comments on commit 49b43ff

Please sign in to comment.