xypriss 8.2.0 → 9.0.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.
Files changed (120) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +69 -32
  3. package/dist/cjs/shared/logger/Logger.js +495 -489
  4. package/dist/cjs/shared/logger/Logger.js.map +1 -1
  5. package/dist/cjs/src/const.js +1 -1
  6. package/dist/cjs/src/encryption/EncryptionService.js +1 -1
  7. package/dist/cjs/src/encryption/EncryptionService.js.map +1 -1
  8. package/dist/cjs/src/index.js +3 -47
  9. package/dist/cjs/src/index.js.map +1 -1
  10. package/dist/cjs/src/middleware/XemsSessionMiddleware.js +0 -4
  11. package/dist/cjs/src/middleware/XemsSessionMiddleware.js.map +1 -1
  12. package/dist/cjs/src/middleware/XyPrissMiddlewareAPI.js +23 -8
  13. package/dist/cjs/src/middleware/XyPrissMiddlewareAPI.js.map +1 -1
  14. package/dist/cjs/src/plugins/PluginManager.js +0 -3
  15. package/dist/cjs/src/plugins/PluginManager.js.map +1 -1
  16. package/dist/cjs/src/plugins/core/PluginManager.js +1 -1
  17. package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js +3 -3
  18. package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js.map +1 -1
  19. package/dist/cjs/src/plugins/modules/network/builtin/ProxyPlugin.js +14 -0
  20. package/dist/cjs/src/plugins/modules/network/builtin/ProxyPlugin.js.map +1 -1
  21. package/dist/cjs/src/plugins/modules/network/core/NetworkPlugin.js +5 -0
  22. package/dist/cjs/src/plugins/modules/network/core/NetworkPlugin.js.map +1 -1
  23. package/dist/cjs/src/plugins/modules/xems/XemsBuiltinPlugin.js +18 -4
  24. package/dist/cjs/src/plugins/modules/xems/XemsBuiltinPlugin.js.map +1 -1
  25. package/dist/cjs/src/plugins/modules/xems/XemsPlugin.js +75 -18
  26. package/dist/cjs/src/plugins/modules/xems/XemsPlugin.js.map +1 -1
  27. package/dist/cjs/src/quick-start.js +1 -1
  28. package/dist/cjs/src/server/FastServer.js +4 -3
  29. package/dist/cjs/src/server/FastServer.js.map +1 -1
  30. package/dist/cjs/src/server/ServerFactory.js +1 -1
  31. package/dist/cjs/src/server/components/fastapi/FileWatcherManager.js +1 -1
  32. package/dist/cjs/src/server/components/fastapi/RedirectManager.js +1 -1
  33. package/dist/cjs/src/server/components/fastapi/RedirectManager.js.map +1 -1
  34. package/dist/cjs/src/server/components/fastapi/WorkerPoolComponent.js +43 -167
  35. package/dist/cjs/src/server/components/fastapi/WorkerPoolComponent.js.map +1 -1
  36. package/dist/cjs/src/server/const/default.js +18 -2
  37. package/dist/cjs/src/server/const/default.js.map +1 -1
  38. package/dist/cjs/src/server/core/HttpServer.js +1 -18
  39. package/dist/cjs/src/server/core/HttpServer.js.map +1 -1
  40. package/dist/cjs/src/server/core/RequestEnhancer.js +1 -1
  41. package/dist/cjs/src/server/core/ResponseEnhancer.js +1 -1
  42. package/dist/cjs/src/server/core/StartupProcessor.js +25 -5
  43. package/dist/cjs/src/server/core/StartupProcessor.js.map +1 -1
  44. package/dist/cjs/src/server/core/XHSCBridge.js +111 -8
  45. package/dist/cjs/src/server/core/XHSCBridge.js.map +1 -1
  46. package/dist/cjs/src/server/core/XHSCProtocol.js +54 -16
  47. package/dist/cjs/src/server/core/XHSCProtocol.js.map +1 -1
  48. package/dist/cjs/src/server/core/XyDiagnosticsManager.js +1 -1
  49. package/dist/cjs/src/server/core/XyLifecycleManager.js +3 -2
  50. package/dist/cjs/src/server/core/XyLifecycleManager.js.map +1 -1
  51. package/dist/cjs/src/server/core/XyRoutingManager.js +1 -1
  52. package/dist/cjs/src/server/utils/PortManager.js +64 -0
  53. package/dist/cjs/src/server/utils/PortManager.js.map +1 -1
  54. package/dist/cjs/src/server/utils/trustProxy.js +1 -1
  55. package/dist/cjs/src/xhs/cluster/XHSCWorker.js +2 -0
  56. package/dist/cjs/src/xhs/cluster/XHSCWorker.js.map +1 -1
  57. package/dist/esm/mods/security/src/components/cache/UFSIMC.js +5 -5
  58. package/dist/esm/mods/security/src/components/cache/UFSIMC.js.map +1 -1
  59. package/dist/esm/mods/security/src/components/cache/cacheSys.utils.js +3 -3
  60. package/dist/esm/mods/security/src/components/cache/cacheSys.utils.js.map +1 -1
  61. package/dist/esm/shared/logger/Logger.js +495 -489
  62. package/dist/esm/shared/logger/Logger.js.map +1 -1
  63. package/dist/esm/src/const.js +1 -1
  64. package/dist/esm/src/encryption/EncryptionService.js +1 -1
  65. package/dist/esm/src/encryption/EncryptionService.js.map +1 -1
  66. package/dist/esm/src/index.js +2 -16
  67. package/dist/esm/src/index.js.map +1 -1
  68. package/dist/esm/src/middleware/XemsSessionMiddleware.js +0 -4
  69. package/dist/esm/src/middleware/XemsSessionMiddleware.js.map +1 -1
  70. package/dist/esm/src/middleware/XyPrissMiddlewareAPI.js +23 -8
  71. package/dist/esm/src/middleware/XyPrissMiddlewareAPI.js.map +1 -1
  72. package/dist/esm/src/plugins/PluginManager.js +0 -3
  73. package/dist/esm/src/plugins/PluginManager.js.map +1 -1
  74. package/dist/esm/src/plugins/core/PluginManager.js +1 -1
  75. package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js +3 -3
  76. package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js.map +1 -1
  77. package/dist/esm/src/plugins/modules/network/builtin/ProxyPlugin.js +14 -0
  78. package/dist/esm/src/plugins/modules/network/builtin/ProxyPlugin.js.map +1 -1
  79. package/dist/esm/src/plugins/modules/network/core/NetworkPlugin.js +5 -0
  80. package/dist/esm/src/plugins/modules/network/core/NetworkPlugin.js.map +1 -1
  81. package/dist/esm/src/plugins/modules/xems/XemsBuiltinPlugin.js +18 -4
  82. package/dist/esm/src/plugins/modules/xems/XemsBuiltinPlugin.js.map +1 -1
  83. package/dist/esm/src/plugins/modules/xems/XemsPlugin.js +75 -18
  84. package/dist/esm/src/plugins/modules/xems/XemsPlugin.js.map +1 -1
  85. package/dist/esm/src/quick-start.js +1 -1
  86. package/dist/esm/src/server/FastServer.js +4 -3
  87. package/dist/esm/src/server/FastServer.js.map +1 -1
  88. package/dist/esm/src/server/ServerFactory.js +1 -1
  89. package/dist/esm/src/server/components/fastapi/FileWatcherManager.js +1 -1
  90. package/dist/esm/src/server/components/fastapi/RedirectManager.js +1 -1
  91. package/dist/esm/src/server/components/fastapi/RedirectManager.js.map +1 -1
  92. package/dist/esm/src/server/components/fastapi/WorkerPoolComponent.js +43 -167
  93. package/dist/esm/src/server/components/fastapi/WorkerPoolComponent.js.map +1 -1
  94. package/dist/esm/src/server/const/default.js +18 -2
  95. package/dist/esm/src/server/const/default.js.map +1 -1
  96. package/dist/esm/src/server/core/HttpServer.js +1 -18
  97. package/dist/esm/src/server/core/HttpServer.js.map +1 -1
  98. package/dist/esm/src/server/core/RequestEnhancer.js +1 -1
  99. package/dist/esm/src/server/core/ResponseEnhancer.js +1 -1
  100. package/dist/esm/src/server/core/StartupProcessor.js +25 -5
  101. package/dist/esm/src/server/core/StartupProcessor.js.map +1 -1
  102. package/dist/esm/src/server/core/XHSCBridge.js +111 -8
  103. package/dist/esm/src/server/core/XHSCBridge.js.map +1 -1
  104. package/dist/esm/src/server/core/XHSCProtocol.js +54 -16
  105. package/dist/esm/src/server/core/XHSCProtocol.js.map +1 -1
  106. package/dist/esm/src/server/core/XyDiagnosticsManager.js +1 -1
  107. package/dist/esm/src/server/core/XyLifecycleManager.js +3 -2
  108. package/dist/esm/src/server/core/XyLifecycleManager.js.map +1 -1
  109. package/dist/esm/src/server/core/XyRoutingManager.js +1 -1
  110. package/dist/esm/src/server/utils/PortManager.js +64 -0
  111. package/dist/esm/src/server/utils/PortManager.js.map +1 -1
  112. package/dist/esm/src/server/utils/trustProxy.js +1 -1
  113. package/dist/esm/src/xhs/cluster/XHSCWorker.js +2 -0
  114. package/dist/esm/src/xhs/cluster/XHSCWorker.js.map +1 -1
  115. package/dist/index.d.ts +330 -3259
  116. package/package.json +276 -274
  117. package/scripts/install-memory-cli.js +51 -173
  118. package/scripts/install-xems.js +161 -0
  119. package/scripts/postinstall-xsys.js +93 -83
  120. package/scripts/postinstall.js +11 -2
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- NEHONIX Open Source License (NOSL) v1.0
1
+ NEHONIX Open Source License (Nehonix OSL (NOSL)) v1.0
2
2
 
3
3
  Copyright (c) 2025 NEHONIX - www.nehonix.com
4
4
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  [![npm version](https://badge.fury.io/js/xypriss.svg)](https://badge.fury.io/js/xypriss)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
- [![License: NOSL](https://img.shields.io/badge/License-NOSL-blue.svg)](https://dll.nehonix.com/licenses/NOSL)
8
+ [![License: Nehonix OSL (NOSL)](https://img.shields.io/badge/License-Nehonix OSL (NOSL)-blue.svg)](https://dll.nehonix.com/licenses/NOSL)
9
9
  [![Powered by Nehonix](https://img.shields.io/badge/Powered%20by-Nehonix-blue?style=flat&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMCA5TDEzLjA5IDE1Ljc0TDEyIDIyTDEwLjkxIDE1Ljc0TDQgOUwxMC45MSA4LjI2TDEyIDJaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://nehonix.com)
10
10
 
11
11
  [Quick Start](https://xypriss.nehonix.com/docs/QUICK_START) • [Documentation](https://xypriss.nehonix.com/docs/) • [Examples](https://xypriss.nehonix.com/docs/EXAMPLES) • [API Reference](https://xypriss.nehonix.com/docs/api-reference)
@@ -18,42 +18,45 @@
18
18
 
19
19
  ## Overview
20
20
 
21
- XyPriss is a **Hybrid Enterprise-Grade Web Framework** that bridges the power of **Rust** with the flexibility of **TypeScript**.
21
+ XyPriss is an **Enterprise-Grade Hybrid Web Framework** that combines the raw performance of compiled native binaries with the productivity and flexibility of **TypeScript**. It is designed for teams that require both operational speed and developer velocity, without compromise.
22
22
 
23
23
  ### Cross-Platform Foundation
24
24
 
25
- At its core, XyPriss is engineered for universal high-performance. We provide native Rust binaries (XFPM & XHSC) for:
25
+ XyPriss ships pre-compiled native binaries for all major platforms. No additional toolchains, compilers, or runtime dependencies are required.
26
26
 
27
- | OS | Architecture | Status |
28
- | ----------- | ----------------------- | ---------------- |
29
- | **Linux** | x86_64 (AMD64) | Supported |
30
- | **Linux** | aarch64 (ARM64) | Supported |
31
- | **Windows** | x86_64 (AMD64) | Supported |
32
- | **Windows** | aarch64 (ARM64) | Supported |
33
- | **macOS** | x86_64 (Intel) | 🛠️ Source-only\* |
34
- | **macOS** | aarch64 (Apple Silicon) | 🛠️ Source-only\* |
27
+ | OS | Architecture | Status |
28
+ | ----------- | ----------------------- | --------- |
29
+ | **Linux** | x86_64 (AMD64) | Supported |
30
+ | **Linux** | aarch64 (ARM64) | Supported |
31
+ | **Windows** | x86_64 (AMD64) | Supported |
32
+ | **Windows** | aarch64 (ARM64) | Supported |
33
+ | **macOS** | x86_64 (Intel) | Supported |
34
+ | **macOS** | aarch64 (Apple Silicon) | Supported |
35
35
 
36
- _We are committed to future-proofing our engine for emerging architectures like RISC-V._
36
+ ### Architecture
37
37
 
38
- At its heart lies **XHSC (XyPriss Hybrid Server Core)**, a high-performance Rust engine that handles low-level networking, advanced routing, and system telemetry. This unique hybrid architecture allows developers to build secure, scalable applications using TypeScript while benefiting from Rust's raw performance and multi-core efficiency.
38
+ At the center of XyPriss lies **XHSC (XyPriss Hyper-System Core)** the native engine responsible for low-level HTTP networking, high-speed radix routing, filesystem operations, real-time system telemetry, and inter-process communication. XHSC is written in Go for maximum portability and ships as a single statically-linked binary per platform with zero external dependencies.
39
39
 
40
- ### Architecture & Tools
40
+ The framework operates on a layered architecture:
41
41
 
42
- XyPriss operates on a unified strategy:
42
+ 1. **XHSC (Native Engine):** Handles the HTTP/S stack, advanced radix routing, filesystem I/O, process monitoring, and real-time hardware telemetry. It acts as the high-speed gateway for all incoming traffic and system operations.
43
+ 2. **Node.js Runtime:** Provides the enterprise-ready application layer where developers define business logic, security middleware, and data processing pipelines using TypeScript.
44
+ 3. **XFPM (XyPriss Fast Package Manager):** A high-performance, Rust-powered package manager optimized for the XyPriss ecosystem. Provides ultra-fast dependency resolution, extraction, and caching. [Learn more about XFPM](https://xypriss.nehonix.com/docs/xfpm?kw=XFPM%20is%20the%20high-performance).
43
45
 
44
- 1. **XHSC (Rust Engine):** Manages the HTTP/S stack, ultra-fast radix routing, and real-time hardware monitoring. It acts as the high-speed gateway for all incoming traffic.
45
- 2. **Node.js Runtime:** Provides the enterprise-ready application layer where developers manage business logic, security middlewares, and data processing using TypeScript.
46
- 3. **XFPM (XyPriss Fast Package Manager):** Our ultra-fast, Rust-powered developer tool. **We highly recommend using `xfpm` for all operations.** It provides optimized resolution, ultra-fast extraction, and caching tailored for the XyPriss ecosystem. [Learn more about XFPM](https://xypriss.nehonix.com/docs/xfpm?kw=XFPM%20is%20the%20high-performance).
46
+ This separation allows each layer to operate in its optimal domain: compiled native code for performance-critical paths, TypeScript for rapid application development.
47
47
 
48
48
  ### Core Features
49
49
 
50
- - **High Performance XHSC Engine** - Independent Rust server core implementation with multi-core clustering support and high-precision system telemetry.
51
- - **Security-First Architecture** - 12+ built-in security middleware modules including CSRF protection, XSS prevention, and intelligent rate limiting.
52
- - **Advanced Radix Routing** - Ultra-fast routing system powered by Rust, capable of handling complex path matching with microsecond latency.
53
- - **File Upload Management** - Production-ready multipart/form-data handling with automatic validation and error handling.
54
- - **Extensible Plugin System** - Permission-based plugin architecture with lifecycle hooks and security controls.
55
- - **Native Production Integration** - Built for automated deployments and SSL management via [XyNginC](https://github.com/Nehonix-Team/xynginc).
56
- - **Multi-Server Support** - Run multiple server instances with isolated configurations and security policies.
50
+ - **XHSC Native Engine** — Statically-linked system core with multi-core clustering, IPC bridge, and high-precision hardware telemetry across all supported platforms.
51
+ - **XEMS Session Security** — AES-256-GCM encrypted in-memory session store powered by a dedicated native Golang sidecar. Provides opaque tokens, per-request atomic rotation, sandboxed namespaces, and optional hardware-bound persistence — with zero external dependencies.
52
+ - **Security-First Architecture** 12+ built-in security middleware modules including CSRF protection, XSS prevention, and intelligent rate limiting.
53
+ - **Advanced Radix Routing** Ultra-fast routing system capable of complex path matching with microsecond latency.
54
+ - **Real-Time System Intelligence** Native access to CPU, memory, disk, network, battery, and process metrics directly from the application layer.
55
+ - **Filesystem Engine** — High-performance file operations including recursive copy, directory sync, content hashing, duplicate detection, and real-time file watching.
56
+ - **File Upload Management** — Production-ready multipart/form-data handling with automatic validation and error handling.
57
+ - **Extensible Plugin System** — Permission-based plugin architecture with lifecycle hooks and security controls.
58
+ - **Native Production Integration** — Built for automated deployments and SSL management via [XyNginC](https://github.com/Nehonix-Team/xynginc).
59
+ - **Multi-Server Support** — Run multiple server instances with isolated configurations and security policies.
57
60
 
58
61
  ---
59
62
 
@@ -130,13 +133,13 @@ app.start();
130
133
  - [Examples](https://xypriss.nehonix.com/docs/EXAMPLES) - Practical code examples
131
134
  - [Features Overview](https://xypriss.nehonix.com/docs/FEATURES_OVERVIEW) - Comprehensive feature list
132
135
 
133
- ### Core Guides
136
+ ### Security
134
137
 
135
- - [Routing](https://xypriss.nehonix.com/docs/ROUTING) - Route configuration and middleware
136
- - [Security](https://xypriss.nehonix.com/docs/SECURITY) - Security features and best practices
137
- - [File Upload](./docs/FILE_UPLOAD_GUIDE.md) - File upload handling
138
- - [Configuration](https://xypriss.nehonix.com/docs/CONFIGURATION) - Complete configuration reference
139
- - [Multi-Server](https://xypriss.nehonix.com/docs/MULTI_SERVER) - Multi-server deployment
138
+ - [Security Overview](./docs/security/SECURITY.md) - Security features and best practices
139
+ - [**XEMS — Secure Sessions & Temporary Storage**](./docs/XEMS_TUTORIAL.md) - AES-256-GCM encrypted sessions, OTP flows, token rotation
140
+ - [Route-Based Security](./docs/security/ROUTE_BASED_SECURITY.md) - Per-route security policies
141
+ - [Request Signature Auth](./docs/security/request-signature-auth.md) - API key authentication
142
+ - [CORS Configuration](./docs/security/advanced-cors-regexp.md) - Advanced CORS with RegExp patterns
140
143
 
141
144
  ### Plugin System
142
145
 
@@ -159,6 +162,40 @@ app.start();
159
162
 
160
163
  XyPriss is built with security as a fundamental design principle. The framework implements multiple layers of protection and follows industry best practices for secure web application development.
161
164
 
165
+ ### XEMS — Encrypted Memory Store
166
+
167
+ [XEMS](https://github.com/Nehonix-Team/XyPriss-XEMS) is the built-in session security layer. Unlike cookie-based JWT, XEMS stores all session data **server-side inside a native Go sidecar process**, encrypted with AES-256-GCM. The client only ever holds a random opaque token.
168
+
169
+ ```typescript
170
+ import { createServer, xems } from "xypriss";
171
+
172
+ const app = createServer({
173
+ server: {
174
+ xems: {
175
+ enable: true, // Enable the XEMS middleware
176
+ ttl: "15m", // Session lifetime
177
+ autoRotation: true, // Rotate token on every request
178
+ gracePeriod: 1000, // ms the old token stays valid (concurrent requests)
179
+ },
180
+ },
181
+ });
182
+
183
+ // Login — create an encrypted session
184
+ app.post("/auth/login", async (req, res) => {
185
+ // ... verify credentials
186
+ await res.xLink({ userId: user.id, role: user.role }); // session created
187
+ res.json({ success: true });
188
+ });
189
+
190
+ // Protected route — session auto-decrypted
191
+ app.get("/profile", (req, res) => {
192
+ if (!req.session) return res.status(401).json({ error: "Unauthorized" });
193
+ res.json({ user: req.session }); // { userId, role }
194
+ });
195
+ ```
196
+
197
+ **[Full XEMS Guide →](./docs/XEMS_TUTORIAL.md)**
198
+
162
199
  ### Security Disclosure Policy
163
200
 
164
201
  While we maintain rigorous security standards, we acknowledge that vulnerabilities may exist. We encourage responsible disclosure of security issues.
@@ -227,7 +264,7 @@ If XyPriss has been valuable for your projects, consider:
227
264
 
228
265
  ## License
229
266
 
230
- XyPriss is licensed under the [NOSL License](https://dll.nehonix.com/licenses/NOSL).
267
+ XyPriss is licensed under the [Nehonix OSL (Nehonix OSL (NOSL)) License](https://dll.nehonix.com/licenses/NOSL).
231
268
 
232
269
  ---
233
270