@uns-kit/api 0.0.8 → 0.0.10

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.
Files changed (2) hide show
  1. package/README.md +17 -8
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -16,16 +16,25 @@ Make sure `@uns-kit/core` is also installed; the plugin augments its runtime typ
16
16
 
17
17
  ```ts
18
18
  import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
19
- import unsApiPlugin, { type UnsProxyProcessWithApi } from "@uns-kit/api";
19
+ import type { UnsProxyProcessWithApi } from "@uns-kit/api";
20
+ import "@uns-kit/api"; // registers the plugin side-effect
20
21
 
21
- const process = new UnsProxyProcess("mqtt-broker:1883", { processName: "api-gateway" }) as UnsProxyProcessWithApi;
22
- unsApiPlugin;
22
+ async function main() {
23
+ const process = new UnsProxyProcess("mqtt-broker:1883", { processName: "api-gateway" }) as UnsProxyProcessWithApi;
23
24
 
24
- const api = await process.createApiProxy("gateway", { jwtSecret: "super-secret" });
25
- await api.get("factory/", "status", {
26
- apiDescription: "Factory status endpoint",
27
- tags: ["status"],
28
- });
25
+ const api = await process.createApiProxy("gateway", { jwtSecret: "super-secret" });
26
+
27
+ api.get("factory/", "status", {
28
+ apiDescription: "Factory status endpoint",
29
+ tags: ["status"],
30
+ });
31
+
32
+ api.event.on("apiGetEvent", (event) => {
33
+ event.res.json({ status: "ok" });
34
+ });
35
+ }
36
+
37
+ void main();
29
38
  ```
30
39
 
31
40
  ## Scripts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uns-kit/api",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Express-powered API gateway plugin for UnsProxyProcess with JWT/JWKS support.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "cookie-parser": "^1.4.7",
36
36
  "express": "^5.1.0",
37
37
  "multer": "^2.0.2",
38
- "@uns-kit/core": "0.0.20"
38
+ "@uns-kit/core": "0.0.21"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/jsonwebtoken": "^9.0.10",