@openrfid/rest 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -0
- package/package.json +8 -7
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/rfidsoftwares/openrfid-simulator/main/assets/logo.svg" alt="OpenRFID Simulator Logo" width="180" />
|
|
4
|
+
|
|
5
|
+
# `@openrfid/rest`
|
|
6
|
+
|
|
7
|
+
### Fastify REST API Plugin for OpenRFID Simulator
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@openrfid/rest)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://rfidsoftwares.com)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Overview
|
|
18
|
+
|
|
19
|
+
`@openrfid/rest` is the official Fastify HTTP REST API plugin for **OpenRFID Simulator**. It exposes RESTful endpoints (`/api/v1/readers`, `/api/v1/tags`, `/api/v1/simulation`, `/api/v1/events`) for programmatically starting/stopping simulations, managing virtual readers, and querying scan history.
|
|
20
|
+
|
|
21
|
+
Developed & Maintained by **[RFID Software India Private Limited](https://rfidsoftwares.com)**.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# npm
|
|
29
|
+
npm install @openrfid/rest
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add @openrfid/rest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 💻 Code Example
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { SimulationEngine } from '@openrfid/simulator';
|
|
41
|
+
import { RestPlugin } from '@openrfid/rest';
|
|
42
|
+
|
|
43
|
+
const engine = new SimulationEngine();
|
|
44
|
+
|
|
45
|
+
// Instantiate Fastify REST API plugin on port 3000
|
|
46
|
+
const restPlugin = new RestPlugin({
|
|
47
|
+
port: 3000,
|
|
48
|
+
host: '0.0.0.0',
|
|
49
|
+
cors: true
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
await engine.pluginManager.registerPlugin(restPlugin);
|
|
53
|
+
await engine.start();
|
|
54
|
+
|
|
55
|
+
console.log('REST API server listening at http://localhost:3000/api/v1');
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 📡 REST API Endpoint Reference
|
|
61
|
+
|
|
62
|
+
| Method | Endpoint | Description |
|
|
63
|
+
| :--- | :--- | :--- |
|
|
64
|
+
| `GET` | `/api/v1/health` | System health check & memory usage |
|
|
65
|
+
| `GET` | `/api/v1/readers` | List all configured virtual readers |
|
|
66
|
+
| `POST` | `/api/v1/readers` | Create a new virtual reader instance |
|
|
67
|
+
| `GET` | `/api/v1/tags` | Retrieve active tag inventory pool |
|
|
68
|
+
| `POST` | `/api/v1/simulation/start` | Trigger simulation inventory loop |
|
|
69
|
+
| `POST` | `/api/v1/simulation/stop` | Pause active inventory simulation |
|
|
70
|
+
| `GET` | `/api/v1/events/recent` | Query recent tag scan events |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🌐 Monorepo Ecosystem
|
|
75
|
+
|
|
76
|
+
| Package | Description |
|
|
77
|
+
| :--- | :--- |
|
|
78
|
+
| [`@openrfid/plugin-api`](https://www.npmjs.com/package/@openrfid/plugin-api) | Plugin lifecycle interfaces & sandbox manager |
|
|
79
|
+
| [`@openrfid/simulator`](https://www.npmjs.com/package/@openrfid/simulator) | High-throughput inventory simulation engine |
|
|
80
|
+
| [`@openrfid/websocket`](https://www.npmjs.com/package/@openrfid/websocket) | WebSocket real-time tag stream broadcaster |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📄 License & Corporate Support
|
|
85
|
+
|
|
86
|
+
Licensed under the **MIT License**.
|
|
87
|
+
Brought to you by **RFID Software India Private Limited**.
|
|
88
|
+
For enterprise RFID middleware, hardware drivers, or custom protocol plugins, visit **[rfidsoftwares.com](https://rfidsoftwares.com)**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrfid/rest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Fastify HTTP REST API plugin for OpenRFID Simulator.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,15 +13,16 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"fastify": "^4.26.2",
|
|
20
|
-
"@openrfid/
|
|
21
|
-
"@openrfid/
|
|
22
|
-
"@openrfid/
|
|
23
|
-
"@openrfid/
|
|
24
|
-
"@openrfid/
|
|
21
|
+
"@openrfid/plugin-api": "1.0.0",
|
|
22
|
+
"@openrfid/readers": "1.0.0",
|
|
23
|
+
"@openrfid/core": "1.0.0",
|
|
24
|
+
"@openrfid/tags": "1.0.0",
|
|
25
|
+
"@openrfid/simulator": "1.0.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"tsup": "^8.0.2",
|