divhunt 2.0.17 → 2.0.18

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.
@@ -31,7 +31,7 @@ serversHTTP.Fn('item.start', function(item)
31
31
  user: this.methods.user(request),
32
32
  time: performance.now(),
33
33
  types: this.methods.types,
34
- context: {},
34
+ state: {},
35
35
  respond: {
36
36
  type: 'JSON',
37
37
  data: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "divhunt",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "description": "Full-stack isomorphic JavaScript framework built from scratch. One addon abstraction powers databases, servers, commands, pages, directives, queues, and more.",
5
5
  "type": "module",
6
6
  "main": "lib/load.js",
@@ -1,85 +0,0 @@
1
- # Servers Module
2
-
3
- HTTP and gRPC server implementations for the application framework providing multiple communication protocols.
4
-
5
- ## HTTP Server
6
-
7
- REST API server with comprehensive request handling and middleware integration.
8
-
9
- ### Features
10
-
11
- **Request Processing:**
12
- - Automatic data parsing from query parameters and request body
13
- - Type conversion with hints (`:string`, `:number`, `:boolean`, `:array`, `:object`)
14
- - URL parameter extraction from dynamic routes
15
- - JSON body parsing for POST/PUT requests
16
-
17
- **Response Formatting:**
18
- - Multiple content types: JSON, HTML, CSS, JavaScript
19
- - Automatic response wrapping with data, message, code, and duration
20
- - Error handling with standardized error responses
21
- - Request timing and performance metrics
22
-
23
- **Middleware Integration:**
24
- - Command routing through middleware system
25
- - Request/response lifecycle hooks
26
- - Error catching and logging
27
- - Custom callback support for request handling
28
-
29
- ### Configuration
30
-
31
- ```javascript
32
- serversHTTP.Item({
33
- id: 'main',
34
- port: 3000,
35
- onStart: (server) => console.log('HTTP server started'),
36
- onRequest: (http) => {
37
- console.log(`${http.request.method} ${http.request.url}`);
38
- },
39
- onError: (error) => console.log('Server error:', error),
40
- onComplete: (http) => {
41
- console.log(`Request completed in ${http.time}ms`);
42
- }
43
- });
44
- ```
45
-
46
- ## gRPC Server
47
-
48
- High-performance bidirectional streaming server using Protocol Buffers for real-time communication.
49
-
50
- ### Features
51
-
52
- **Streaming Communication:**
53
- - Universal service with single stream method
54
- - Bidirectional streaming for real-time data exchange
55
- - JSON message serialization over Protocol Buffers
56
- - Stream lifecycle management with connection tracking
57
-
58
- **Command Integration:**
59
- - Direct command execution through streaming interface
60
- - Promise-based request/response pattern
61
- - Automatic command resolution and timeout handling
62
- - Error propagation and handling
63
-
64
- **Stream Management:**
65
- - Connection lifecycle callbacks (connect, data, close, end, error)
66
- - Stream identification and tracking
67
- - Request/response correlation with unique IDs
68
- - Timeout handling for pending requests
69
-
70
- ### Configuration
71
-
72
- ```javascript
73
- serversGRPC.Item({
74
- port: 50000,
75
- onStart: () => console.log('gRPC server started'),
76
- onStreamConnect: (stream) => console.log('Stream connected'),
77
- onStreamData: async (stream, payload) => {
78
- // Handle incoming command requests
79
- const response = await executeCommand(payload);
80
- stream.respond(response.data, response.message, response.code);
81
- },
82
- onStreamClose: (stream) => console.log('Stream closed'),
83
- onStreamError: (stream, error) => console.log('Stream error:', error)
84
- });
85
- ```