@openrfid/plugin-api 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 +99 -0
- package/package.json +7 -6
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
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/plugin-api`
|
|
6
|
+
|
|
7
|
+
### Hot-Swappable Plugin Lifecycle Interfaces & Extensibility Sandbox
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@openrfid/plugin-api)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://rfidsoftwares.com)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Overview
|
|
18
|
+
|
|
19
|
+
`@openrfid/plugin-api` defines the standard plugin lifecycle interfaces, hook contracts, and registration sandbox for building custom protocol adapters, data formatters, and network transport extensions for **OpenRFID Simulator**.
|
|
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/plugin-api
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add @openrfid/plugin-api
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 💻 Code Example: Writing a Custom Protocol Plugin
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { BasePlugin, PluginContext, TagDetectedEvent } from '@openrfid/plugin-api';
|
|
41
|
+
|
|
42
|
+
export class CustomUdpPlugin extends BasePlugin {
|
|
43
|
+
readonly id = 'custom-udp-plugin';
|
|
44
|
+
readonly name = 'Custom UDP Protocol Adapter';
|
|
45
|
+
readonly version = '1.0.0';
|
|
46
|
+
|
|
47
|
+
async onInit(context: PluginContext): Promise<void> {
|
|
48
|
+
console.log('Initializing Custom UDP Plugin...');
|
|
49
|
+
|
|
50
|
+
// Subscribe to tag detection events
|
|
51
|
+
context.eventBus.on('TagDetected', (event: TagDetectedEvent) => {
|
|
52
|
+
this.handleTagDetected(event);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async onStart(): Promise<void> {
|
|
57
|
+
console.log('Custom UDP Plugin Started!');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async onStop(): Promise<void> {
|
|
61
|
+
console.log('Custom UDP Plugin Stopped.');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private handleTagDetected(event: TagDetectedEvent): void {
|
|
65
|
+
// Custom binary network packet encoding
|
|
66
|
+
console.log(`[UDP] Sending payload for EPC: ${event.epc}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 📚 Lifecycle Hooks
|
|
74
|
+
|
|
75
|
+
| Lifecycle Method | Description |
|
|
76
|
+
| :--- | :--- |
|
|
77
|
+
| `onInit(context)` | Called when plugin is registered; provides EventBus, Config, & DI container |
|
|
78
|
+
| `onStart()` | Called when simulation engine starts running |
|
|
79
|
+
| `onStop()` | Called during simulation shutdown to release network sockets/ports |
|
|
80
|
+
| `onDestroy()` | Cleanup resources before plugin removal |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 🌐 Monorepo Ecosystem
|
|
85
|
+
|
|
86
|
+
| Package | Description |
|
|
87
|
+
| :--- | :--- |
|
|
88
|
+
| [`@openrfid/simulator`](https://www.npmjs.com/package/@openrfid/simulator) | High-throughput inventory simulation engine |
|
|
89
|
+
| [`@openrfid/core`](https://www.npmjs.com/package/@openrfid/core) | Core EventBus, Config, & SQLite persistence |
|
|
90
|
+
| [`@openrfid/rest`](https://www.npmjs.com/package/@openrfid/rest) | Fastify REST API plugin |
|
|
91
|
+
| [`@openrfid/mqtt`](https://www.npmjs.com/package/@openrfid/mqtt) | MQTT IoT publisher plugin |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 📄 License & Corporate Support
|
|
96
|
+
|
|
97
|
+
Licensed under the **MIT License**.
|
|
98
|
+
Brought to you by **RFID Software India Private Limited**.
|
|
99
|
+
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/plugin-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Extensible plugin interface, manifest validator, context provider, and lifecycle manager for OpenRFID Simulator.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@openrfid/core": "
|
|
20
|
-
"@openrfid/readers": "
|
|
21
|
-
"@openrfid/simulator": "
|
|
22
|
-
"@openrfid/tags": "
|
|
20
|
+
"@openrfid/core": "1.0.0",
|
|
21
|
+
"@openrfid/readers": "1.0.0",
|
|
22
|
+
"@openrfid/simulator": "1.0.0",
|
|
23
|
+
"@openrfid/tags": "1.0.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"tsup": "^8.0.2",
|