elysia-vision 0.1.0 → 0.1.1

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/dist/README.md ADDED
@@ -0,0 +1,75 @@
1
+ <h1 align='center'>
2
+ Elysia Vision <img alt="NPM Version" src="https://img.shields.io/npm/v/elysia-vision">
3
+ </h1>
4
+ <img alt="Elysia vision webapp" src="image.png">
5
+ <h3 align='center'>
6
+ <b>CURRENTLY IN PROGRESS.</b>
7
+ </h3>
8
+
9
+ <p align='center'>
10
+ Plugin for <a href='https://github.com/elysiajs/elysia'>Elysia.js</a> to monitor your API requests in real-time through a web dashboard and more.
11
+ </p>
12
+
13
+ ## How it works
14
+
15
+ **elysia-vision** consists of two parts:
16
+
17
+ 1. **This plugin** - Adds WebSocket monitoring capabilities to your Elysia server
18
+ 2. **The web dashboard** - A separate webapp hosted at https://elysia-vision-webapp.vercel.app
19
+
20
+ The plugin exposes a WebSocket endpoint on your server. The dashboard connects to your server's URL (e.g., `localhost:3000`) to display real-time request data.
21
+
22
+ > **Note:** The webapp is hosted separately and does not require installation. You simply configure your server's URL in the dashboard.
23
+
24
+ ## Installation
25
+
26
+ ### 0. Install the plugin
27
+
28
+ ```bash
29
+ bun add elysia-vision
30
+ ```
31
+
32
+ ### 1. Add the plugin to your Elysia server
33
+
34
+ ```typescript
35
+ import { Elysia } from "elysia";
36
+ import vision from "elysia-vision";
37
+
38
+ const app = new Elysia().use(vision()).listen(3000);
39
+ ```
40
+
41
+ Configure:
42
+
43
+ | Option | Description | Default | Comments |
44
+ | ------- | ---------------------------- | ------- | ------------------- |
45
+ | enabled | Whether to enable the plugin | true | false in production |
46
+
47
+ ### 2. Open the web dashboard
48
+
49
+ Go to **https://elysia-vision-webapp.vercel.app**
50
+
51
+ ### 3. Configure your server URL
52
+
53
+ In the dashboard, enter your server's base URL: `localhost:3000` for example
54
+
55
+ The dashboard will connect via WebSocket to monitor your requests in real-time.
56
+
57
+ ## Roadmap
58
+
59
+ - Real-time request monitoring dashboard (v0.1.x)
60
+ - REplay request, edit, share request
61
+ - Module structure visualization
62
+ - System metrics (RAM, CPU usage)
63
+ - See the path of a request in the modules
64
+
65
+ ## Important Notes
66
+
67
+ ⚠️ I'm aware of concerns regarding the current hosting provider (Vercel) and plan to migrate soon
68
+
69
+ ## Contact
70
+
71
+ [Twitter/X](https://x.com/RouretLucas)
72
+
73
+ ## License
74
+
75
+ MIT
@@ -1,6 +1,34 @@
1
1
  import { Elysia } from 'elysia';
2
+ import { ElysiaVisionConfig } from './types.js';
2
3
 
3
- declare const vision: () => Elysia<"", {
4
+ declare const vision: (config?: ElysiaVisionConfig) => Elysia<"", {
5
+ decorator: {};
6
+ store: {};
7
+ derive: {};
8
+ resolve: {};
9
+ }, {
10
+ typebox: {};
11
+ error: {};
12
+ }, {
13
+ schema: {};
14
+ standaloneSchema: {};
15
+ macro: {};
16
+ macroFn: {};
17
+ parser: {};
18
+ response: {};
19
+ }, {}, {
20
+ derive: {};
21
+ resolve: {};
22
+ schema: {};
23
+ standaloneSchema: {};
24
+ response: {};
25
+ }, {
26
+ derive: {};
27
+ resolve: {};
28
+ schema: {};
29
+ standaloneSchema: {};
30
+ response: {};
31
+ }> | Elysia<"", {
4
32
  decorator: {};
5
33
  store: {};
6
34
  derive: {};
@@ -37,6 +65,6 @@ declare const vision: () => Elysia<"", {
37
65
  schema: {};
38
66
  standaloneSchema: {};
39
67
  response: {};
40
- }> | null;
68
+ }>;
41
69
 
42
70
  export { vision as default };
package/dist/cjs/index.js CHANGED
@@ -42,9 +42,11 @@ var sanitizeHeaders = (headers) => {
42
42
  };
43
43
 
44
44
  // src/index.ts
45
- var vision = () => {
46
- if (process.env.NODE_ENV === "production") {
47
- return null;
45
+ var vision = (config = {}) => {
46
+ if (process.env.NODE_ENV === "production" || !config.enabled) {
47
+ return new import_elysia.Elysia({
48
+ name: "elysia-vision"
49
+ });
48
50
  }
49
51
  const clients = /* @__PURE__ */ new Set();
50
52
  const calls = /* @__PURE__ */ new Map();
@@ -20,5 +20,12 @@ type VisionCall = {
20
20
  request: VisionRequest;
21
21
  response: VisionResponse | null;
22
22
  };
23
+ type ElysiaVisionConfig = {
24
+ /**
25
+ * @default true
26
+ * false in production
27
+ */
28
+ enabled?: boolean;
29
+ };
23
30
 
24
- export type { VisionCall, VisionRequest, VisionResponse, _INTERNAL_VisionWebSocketPayload };
31
+ export type { ElysiaVisionConfig, VisionCall, VisionRequest, VisionResponse, _INTERNAL_VisionWebSocketPayload };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,34 @@
1
1
  import { Elysia } from 'elysia';
2
+ import { ElysiaVisionConfig } from './types.js';
2
3
 
3
- declare const vision: () => Elysia<"", {
4
+ declare const vision: (config?: ElysiaVisionConfig) => Elysia<"", {
5
+ decorator: {};
6
+ store: {};
7
+ derive: {};
8
+ resolve: {};
9
+ }, {
10
+ typebox: {};
11
+ error: {};
12
+ }, {
13
+ schema: {};
14
+ standaloneSchema: {};
15
+ macro: {};
16
+ macroFn: {};
17
+ parser: {};
18
+ response: {};
19
+ }, {}, {
20
+ derive: {};
21
+ resolve: {};
22
+ schema: {};
23
+ standaloneSchema: {};
24
+ response: {};
25
+ }, {
26
+ derive: {};
27
+ resolve: {};
28
+ schema: {};
29
+ standaloneSchema: {};
30
+ response: {};
31
+ }> | Elysia<"", {
4
32
  decorator: {};
5
33
  store: {};
6
34
  derive: {};
@@ -37,6 +65,6 @@ declare const vision: () => Elysia<"", {
37
65
  schema: {};
38
66
  standaloneSchema: {};
39
67
  response: {};
40
- }> | null;
68
+ }>;
41
69
 
42
70
  export { vision as default };
package/dist/index.mjs CHANGED
@@ -18,9 +18,11 @@ var sanitizeHeaders = (headers) => {
18
18
  };
19
19
 
20
20
  // src/index.ts
21
- var vision = () => {
22
- if (process.env.NODE_ENV === "production") {
23
- return null;
21
+ var vision = (config = {}) => {
22
+ if (process.env.NODE_ENV === "production" || !config.enabled) {
23
+ return new Elysia({
24
+ name: "elysia-vision"
25
+ });
24
26
  }
25
27
  const clients = /* @__PURE__ */ new Set();
26
28
  const calls = /* @__PURE__ */ new Map();
package/dist/types.d.ts CHANGED
@@ -20,5 +20,12 @@ type VisionCall = {
20
20
  request: VisionRequest;
21
21
  response: VisionResponse | null;
22
22
  };
23
+ type ElysiaVisionConfig = {
24
+ /**
25
+ * @default true
26
+ * false in production
27
+ */
28
+ enabled?: boolean;
29
+ };
23
30
 
24
- export type { VisionCall, VisionRequest, VisionResponse, _INTERNAL_VisionWebSocketPayload };
31
+ export type { ElysiaVisionConfig, VisionCall, VisionRequest, VisionResponse, _INTERNAL_VisionWebSocketPayload };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elysia-vision",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Plugin for Elysia that monitors your API requests in real-time through a web dashboard.",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -35,8 +35,7 @@
35
35
  "build": "bun build.ts"
36
36
  },
37
37
  "files": [
38
- "dist",
39
- "README.md"
38
+ "dist"
40
39
  ],
41
40
  "publishConfig": {
42
41
  "access": "public"
@@ -50,4 +49,4 @@
50
49
  "peerDependencies": {
51
50
  "elysia": ">= 1.4.0"
52
51
  }
53
- }
52
+ }