UNPKG

axiodb

Version:

The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor

52 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RequestContext = void 0; /** * Request Context - Wraps request information for handlers * Provides a unified interface similar to HTTP request/response */ class RequestContext { constructor(request, socket) { this.request = request; this.socket = socket; this.remoteAddress = `${socket.remoteAddress}:${socket.remotePort}`; this.timestamp = Date.now(); } /** * Get request ID (correlation ID) */ get id() { return this.request.id; } /** * Get command type */ get command() { return this.request.command; } /** * Get request parameters */ get params() { return this.request.params; } /** * Check if connection is still alive */ get isAlive() { return !this.socket.destroyed && this.socket.writable; } /** * Get connection metadata */ getMetadata() { return { remoteAddress: this.remoteAddress, timestamp: this.timestamp, requestId: this.id, command: this.command, }; } } exports.RequestContext = RequestContext; //# sourceMappingURL=RequestContext.js.map