Skip to content

Commit 49b43ff

Browse files
committed
improve readme with sequence diagram
1 parent 68eb785 commit 49b43ff

File tree

9 files changed

+96
-0
lines changed

9 files changed

+96
-0
lines changed

Mermaid.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
```mermaid
2+
sequenceDiagram
3+
participant Client2
4+
participant Client
5+
participant Server
6+
Client->>Server: POST /data (Idempotency-Key=1)
7+
activate Server
8+
Server->>Store: Check for Idempotency-Key=1 (Not Found)
9+
activate Store
10+
deactivate Store
11+
Server->>Server: Process Requesy
12+
Server->>Store: Store Response(Idempotency-Key=1)
13+
activate Store
14+
deactivate Store
15+
16+
alt Timed Out/Server Crash/Connection Lost
17+
Server-xClient: No Repsponse
18+
else Client Crash
19+
Server-xClient: 201 Created
20+
end
21+
deactivate Server
22+
23+
Client->>Server: POST /data (Retry, Idempotency-Key=1)
24+
activate Server
25+
Server->>Store: Check Idempotency-Key=1 (Exists)
26+
activate Store
27+
deactivate Store
28+
Server->>Client: 201 OK (Duplicate Request)
29+
deactivate Server
30+
31+
Client->>Server: POST /data (Idempotency-Key=2)
32+
activate Client
33+
activate Server
34+
Server->>Store: Check Idempotency-Key=2 (Not Exists)
35+
activate Store
36+
deactivate Store
37+
38+
39+
Server->>Server: Process Request
40+
Client2->>Server: POST /data (concurrent Req, Idempotency-Key=2)
41+
activate Client2
42+
Server->>Store: Check Idempotency-Key=2 (In-Progress)
43+
activate Store
44+
deactivate Store
45+
Server->>Client2: 409 Conflict, Retry-After=1
46+
deactivate Client2
47+
48+
Server->>Client: 201 Created
49+
deactivate Server
50+
deactivate Client
51+
52+
Client2->>Server: POST /data (Retried After, Idempotency-Key=2)
53+
activate Client2
54+
activate Server
55+
Server->>Store: Check Idempotency-Key (Exists)
56+
activate Store
57+
deactivate Store
58+
Server->>Client2: 201 Created
59+
deactivate Client2
60+
deactivate Server
61+
```

Readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ and powers,
2323

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

26+
---
27+
#### How?
28+
![No Image](flow.png)
29+
2630
---
2731

2832
#### @node-idempotency/core

flow.png

218 KB
Loading

packages/core/Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ and powers
2323

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

26+
---
27+
#### How?
28+
![No Image](../../flow.png)
2629
---
2730

2831
##### install

packages/plugin-express/Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Network requests are unpredictable; clients/proxies may send duplicate or concur
1616
- <i>Customizable:</i> options to tweak the library as per your need.
1717
- <i>[RFC](https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/) compliant: </i> Adheres to standards for compatibility with other systems/clients.
1818

19+
---
20+
#### How?
21+
![No Image](../../flow.png)
1922
---
2023

2124
##### instal

packages/plugin-fastify/Readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Network requests are unpredictable; clients/proxies may send duplicate or concur
1818

1919
---
2020

21+
#### How?
22+
![No Image](../../flow.png)
23+
---
24+
2125
##### instal
2226

2327
```bash

packages/plugin-nestjs/Readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Network requests are unpredictable; clients/proxies may send duplicate or concur
1818

1919
---
2020

21+
#### How?
22+
![No Image](../../flow.png)
23+
24+
---
25+
2126
##### instal
2227

2328
```bash

packages/shared/Readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
#### node-idempotency/shared
2+
3+
Hey there!!! Thanks for landing here, you are probably not interested in this package but these,
4+
5+
- [`@node-idempotency/nestjs`](https://www.npmjs.com/package/@node-idempotency/nestjs) - Plug and Play `nestjs` wrapper for `@node-idempotency/core`
6+
7+
- [`@node-idempotency/express`](https://www.npmjs.com/package/@node-idempotency/express) - Plug and Play `express` middleware for `@node-idempotency/core`
8+
9+
- [`@node-idempotency/fastify`](https://www.npmjs.com/package/@node-idempotency/fastify) - Plug and Play `fastify` plugin for `@node-idempotency/core`

packages/storage/Readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#### @node-idempotency/storage
22

33
Storage adapter interace for [@node-idempotency](https://www.npmjs.com/package/@node-idempotency/core).
4+
5+
Checkout these,
6+
7+
- [`@node-idempotency/nestjs`](https://www.npmjs.com/package/@node-idempotency/nestjs) - Plug and Play `nestjs` wrapper for `@node-idempotency/core`
8+
9+
- [`@node-idempotency/express`](https://www.npmjs.com/package/@node-idempotency/express) - Plug and Play `express` middleware for `@node-idempotency/core`
10+
11+
- [`@node-idempotency/fastify`](https://www.npmjs.com/package/@node-idempotency/fastify) - Plug and Play `fastify` plugin for `@node-idempotency/core`

0 commit comments

Comments
 (0)