@gravito/radiance 1.0.4 → 1.0.5

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 (148) hide show
  1. package/README.md +30 -7
  2. package/dist/core/src/Application.d.ts +256 -0
  3. package/dist/core/src/CommandKernel.d.ts +33 -0
  4. package/dist/core/src/ConfigManager.d.ts +65 -0
  5. package/dist/core/src/Container/RequestScopeManager.d.ts +62 -0
  6. package/dist/core/src/Container/RequestScopeMetrics.d.ts +144 -0
  7. package/dist/core/src/Container.d.ts +153 -0
  8. package/dist/core/src/ErrorHandler.d.ts +66 -0
  9. package/dist/core/src/Event.d.ts +5 -0
  10. package/dist/core/src/EventManager.d.ts +123 -0
  11. package/dist/core/src/GlobalErrorHandlers.d.ts +47 -0
  12. package/dist/core/src/GravitoServer.d.ts +28 -0
  13. package/dist/core/src/HookManager.d.ts +435 -0
  14. package/dist/core/src/Listener.d.ts +4 -0
  15. package/dist/core/src/Logger.d.ts +20 -0
  16. package/dist/core/src/PlanetCore.d.ts +402 -0
  17. package/dist/core/src/RequestContext.d.ts +97 -0
  18. package/dist/core/src/Route.d.ts +36 -0
  19. package/dist/core/src/Router.d.ts +270 -0
  20. package/dist/core/src/ServiceProvider.d.ts +178 -0
  21. package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +27 -0
  22. package/dist/core/src/adapters/bun/BunContext.d.ts +54 -0
  23. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +66 -0
  24. package/dist/core/src/adapters/bun/BunRequest.d.ts +31 -0
  25. package/dist/core/src/adapters/bun/BunWebSocketHandler.d.ts +48 -0
  26. package/dist/core/src/adapters/bun/RadixNode.d.ts +19 -0
  27. package/dist/core/src/adapters/bun/RadixRouter.d.ts +32 -0
  28. package/dist/core/src/adapters/bun/index.d.ts +7 -0
  29. package/dist/core/src/adapters/bun/types.d.ts +20 -0
  30. package/dist/core/src/adapters/types.d.ts +235 -0
  31. package/dist/core/src/binary/BinaryUtils.d.ts +105 -0
  32. package/dist/core/src/binary/index.d.ts +5 -0
  33. package/dist/core/src/cli/queue-commands.d.ts +6 -0
  34. package/dist/core/src/compat/async-local-storage.d.ts +7 -0
  35. package/dist/core/src/compat/crypto.d.ts +6 -0
  36. package/dist/core/src/engine/AOTRouter.d.ts +139 -0
  37. package/dist/core/src/engine/FastContext.d.ts +141 -0
  38. package/dist/core/src/engine/Gravito.d.ts +131 -0
  39. package/dist/core/src/engine/MinimalContext.d.ts +102 -0
  40. package/dist/core/src/engine/analyzer.d.ts +113 -0
  41. package/dist/core/src/engine/constants.d.ts +23 -0
  42. package/dist/core/src/engine/index.d.ts +26 -0
  43. package/dist/core/src/engine/path.d.ts +26 -0
  44. package/dist/core/src/engine/pool.d.ts +83 -0
  45. package/dist/core/src/engine/types.d.ts +149 -0
  46. package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +126 -0
  47. package/dist/core/src/events/BackpressureManager.d.ts +215 -0
  48. package/dist/core/src/events/CircuitBreaker.d.ts +229 -0
  49. package/dist/core/src/events/DeadLetterQueue.d.ts +219 -0
  50. package/dist/core/src/events/EventBackend.d.ts +12 -0
  51. package/dist/core/src/events/EventOptions.d.ts +204 -0
  52. package/dist/core/src/events/EventPriorityQueue.d.ts +63 -0
  53. package/dist/core/src/events/FlowControlStrategy.d.ts +109 -0
  54. package/dist/core/src/events/IdempotencyCache.d.ts +60 -0
  55. package/dist/core/src/events/MessageQueueBridge.d.ts +184 -0
  56. package/dist/core/src/events/PriorityEscalationManager.d.ts +82 -0
  57. package/dist/core/src/events/RetryScheduler.d.ts +104 -0
  58. package/dist/core/src/events/WorkerPool.d.ts +98 -0
  59. package/dist/core/src/events/WorkerPoolConfig.d.ts +153 -0
  60. package/dist/core/src/events/WorkerPoolMetrics.d.ts +65 -0
  61. package/dist/core/src/events/aggregation/AggregationWindow.d.ts +77 -0
  62. package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +135 -0
  63. package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +108 -0
  64. package/dist/core/src/events/aggregation/EventBatcher.d.ts +99 -0
  65. package/dist/core/src/events/aggregation/types.d.ts +117 -0
  66. package/dist/core/src/events/index.d.ts +26 -0
  67. package/dist/core/src/events/observability/EventMetrics.d.ts +132 -0
  68. package/dist/core/src/events/observability/EventTracer.d.ts +68 -0
  69. package/dist/core/src/events/observability/EventTracing.d.ts +161 -0
  70. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +332 -0
  71. package/dist/core/src/events/observability/ObservableHookManager.d.ts +108 -0
  72. package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +76 -0
  73. package/dist/core/src/events/observability/index.d.ts +24 -0
  74. package/dist/core/src/events/observability/metrics-types.d.ts +16 -0
  75. package/dist/core/src/events/queue-core.d.ts +77 -0
  76. package/dist/core/src/events/task-executor.d.ts +51 -0
  77. package/dist/core/src/events/types.d.ts +134 -0
  78. package/dist/core/src/exceptions/AuthenticationException.d.ts +8 -0
  79. package/dist/core/src/exceptions/AuthorizationException.d.ts +8 -0
  80. package/dist/core/src/exceptions/CircularDependencyException.d.ts +9 -0
  81. package/dist/core/src/exceptions/GravitoException.d.ts +23 -0
  82. package/dist/core/src/exceptions/HttpException.d.ts +9 -0
  83. package/dist/core/src/exceptions/ModelNotFoundException.d.ts +10 -0
  84. package/dist/core/src/exceptions/ValidationException.d.ts +22 -0
  85. package/dist/core/src/exceptions/index.d.ts +7 -0
  86. package/dist/core/src/ffi/NativeAccelerator.d.ts +62 -0
  87. package/dist/core/src/ffi/NativeHasher.d.ts +139 -0
  88. package/dist/core/src/ffi/cbor-fallback.d.ts +96 -0
  89. package/dist/core/src/ffi/hash-fallback.d.ts +33 -0
  90. package/dist/core/src/ffi/index.d.ts +10 -0
  91. package/dist/core/src/ffi/types.d.ts +135 -0
  92. package/dist/core/src/health/HealthProvider.d.ts +67 -0
  93. package/dist/core/src/helpers/Arr.d.ts +19 -0
  94. package/dist/core/src/helpers/Str.d.ts +38 -0
  95. package/dist/core/src/helpers/data.d.ts +25 -0
  96. package/dist/core/src/helpers/errors.d.ts +34 -0
  97. package/dist/core/src/helpers/response.d.ts +41 -0
  98. package/dist/core/src/helpers.d.ts +338 -0
  99. package/dist/core/src/hooks/ActionManager.d.ts +132 -0
  100. package/dist/core/src/hooks/AsyncDetector.d.ts +84 -0
  101. package/dist/core/src/hooks/FilterManager.d.ts +71 -0
  102. package/dist/core/src/hooks/MigrationWarner.d.ts +24 -0
  103. package/dist/core/src/hooks/dlq-operations.d.ts +60 -0
  104. package/dist/core/src/hooks/types.d.ts +107 -0
  105. package/dist/core/src/http/CookieJar.d.ts +51 -0
  106. package/dist/core/src/http/cookie.d.ts +29 -0
  107. package/dist/core/src/http/types.d.ts +395 -0
  108. package/dist/core/src/index.d.ts +565 -0
  109. package/dist/core/src/observability/QueueDashboard.d.ts +136 -0
  110. package/dist/core/src/observability/contracts.d.ts +137 -0
  111. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +349 -0
  112. package/dist/core/src/reliability/RetryPolicy.d.ts +217 -0
  113. package/dist/core/src/reliability/index.d.ts +6 -0
  114. package/dist/core/src/router/ControllerDispatcher.d.ts +12 -0
  115. package/dist/core/src/router/RequestValidator.d.ts +20 -0
  116. package/dist/core/src/runtime/adapter-bun.d.ts +12 -0
  117. package/dist/core/src/runtime/adapter-deno.d.ts +12 -0
  118. package/dist/core/src/runtime/adapter-node.d.ts +12 -0
  119. package/dist/core/src/runtime/adapter-unknown.d.ts +13 -0
  120. package/dist/core/src/runtime/archive.d.ts +17 -0
  121. package/dist/core/src/runtime/compression.d.ts +21 -0
  122. package/dist/core/src/runtime/deep-equals.d.ts +56 -0
  123. package/dist/core/src/runtime/detection.d.ts +22 -0
  124. package/dist/core/src/runtime/escape.d.ts +34 -0
  125. package/dist/core/src/runtime/index.d.ts +44 -0
  126. package/dist/core/src/runtime/markdown.d.ts +44 -0
  127. package/dist/core/src/runtime/types.d.ts +436 -0
  128. package/dist/core/src/runtime-helpers.d.ts +67 -0
  129. package/dist/core/src/runtime.d.ts +11 -0
  130. package/dist/core/src/security/Encrypter.d.ts +33 -0
  131. package/dist/core/src/security/Hasher.d.ts +29 -0
  132. package/dist/core/src/testing/HttpTester.d.ts +40 -0
  133. package/dist/core/src/testing/TestResponse.d.ts +78 -0
  134. package/dist/core/src/testing/index.d.ts +2 -0
  135. package/dist/core/src/transpiler-utils.d.ts +170 -0
  136. package/dist/core/src/types/events.d.ts +94 -0
  137. package/dist/index.js +1 -294
  138. package/dist/index.js.map +3 -10
  139. package/dist/radiance/src/BroadcastManager.d.ts +124 -0
  140. package/dist/radiance/src/OrbitRadiance.d.ts +98 -0
  141. package/dist/radiance/src/channels/Channel.d.ts +86 -0
  142. package/dist/radiance/src/drivers/AblyDriver.d.ts +73 -0
  143. package/dist/radiance/src/drivers/BroadcastDriver.d.ts +50 -0
  144. package/dist/radiance/src/drivers/PusherDriver.d.ts +95 -0
  145. package/dist/radiance/src/drivers/RedisDriver.d.ts +83 -0
  146. package/dist/radiance/src/drivers/WebSocketDriver.d.ts +89 -0
  147. package/dist/radiance/src/index.d.ts +39 -0
  148. package/package.json +4 -2
@@ -0,0 +1,565 @@
1
+ /**
2
+ * @gravito/core
3
+ *
4
+ * The core micro-kernel for the Galaxy Architecture.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import type { GravitoConfig } from './PlanetCore';
9
+ /**
10
+ * Current version of @gravito/core.
11
+ * @public
12
+ */
13
+ export declare const VERSION: string;
14
+ /**
15
+ * Bun-native HTTP adapter for Gravito.
16
+ *
17
+ * Provides high-performance HTTP handling using Bun's native Request/Response API.
18
+ * Implements the HttpAdapter interface for direct integration with Gravito applications.
19
+ *
20
+ * @see {@link GravitoEngineAdapter} for alternative adapter implementations
21
+ * @public
22
+ */
23
+ export { BunNativeAdapter } from './adapters/bun/BunNativeAdapter';
24
+ /**
25
+ * Generic HTTP adapter bridge for Gravito.
26
+ *
27
+ * Allows swapping out HTTP engines (Hono, Elysia, etc.) by implementing the HttpAdapter
28
+ * interface. Use this when you need a different runtime or framework integration.
29
+ *
30
+ * @see {@link BunNativeAdapter} for the recommended Bun-native implementation
31
+ * @public
32
+ */
33
+ export { GravitoEngineAdapter } from './adapters/GravitoEngineAdapter';
34
+ /**
35
+ * HTTP adapter type definitions and utilities.
36
+ *
37
+ * Type definitions for building custom HTTP adapters and checking adapter compatibility.
38
+ *
39
+ * @public
40
+ */
41
+ export type { AdapterConfig, AdapterFactory, HttpAdapter, RouteDefinition } from './adapters/types';
42
+ /**
43
+ * Type guard for HTTP adapter validation.
44
+ *
45
+ * @param obj - Object to check
46
+ * @returns true if object implements the HttpAdapter interface
47
+ * @example
48
+ * ```typescript
49
+ * if (isHttpAdapter(config.adapter)) {
50
+ * const adapter = config.adapter as HttpAdapter
51
+ * }
52
+ * ```
53
+ * @public
54
+ */
55
+ export { isHttpAdapter } from './adapters/types';
56
+ /**
57
+ * Gravito HTTP request/response types and constants.
58
+ *
59
+ * Type definitions for HTTP methods, status codes, context objects, handlers, and middleware.
60
+ * These types are fundamental to routing and request handling in Gravito applications.
61
+ *
62
+ * @public
63
+ */
64
+ export type { ContentfulStatusCode, GravitoContext, GravitoErrorHandler, GravitoHandler, GravitoMiddleware, GravitoNext, GravitoNotFoundHandler, GravitoRequest, GravitoVariables, HttpMethod, ProxyOptions, StatusCode, ValidationTarget, } from './http/types';
65
+ /**
66
+ * Enterprise-grade application container with DI, middleware, and plugin support.
67
+ *
68
+ * Application provides a high-level abstraction for building modular Gravito apps with
69
+ * dependency injection, service configuration, middleware chains, and extensibility hooks.
70
+ * Use this for complex applications; use {@link PlanetCore} for HTTP server bootstrapping.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const app = new Application({ config: myConfig })
75
+ * app.register(MyOrbit)
76
+ * app.bind('myService', () => new MyService())
77
+ * ```
78
+ * @public
79
+ */
80
+ export { Application, type ApplicationConfig } from './Application';
81
+ /**
82
+ * Command kernel for CLI command registration and execution.
83
+ *
84
+ * Manages command handlers, argument parsing, and command lifecycle in CLI contexts.
85
+ * Typically used internally by Gravito; extend via custom commands registered with the kernel.
86
+ *
87
+ * @public
88
+ */
89
+ export { type CommandHandler, CommandKernel } from './CommandKernel';
90
+ /**
91
+ * Configuration manager for environment-aware application settings.
92
+ *
93
+ * Provides centralized config management with support for environment variables,
94
+ * config files, defaults, and type-safe access patterns. All configs are immutable.
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const appName = config.get('APP_NAME', 'DefaultApp')
99
+ * const dbUrl = config.get('DATABASE_URL')
100
+ * ```
101
+ * @public
102
+ */
103
+ export { ConfigManager } from './ConfigManager';
104
+ /**
105
+ * Dependency injection container for service resolution and lifecycle management.
106
+ *
107
+ * Core singleton/transient resolver with support for factory functions, constructor injection,
108
+ * and service binding. All resolved instances are immutably cached.
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const container = new Container()
113
+ * container.bind('logger', () => new ConsoleLogger())
114
+ * const logger = container.resolve('logger')
115
+ * ```
116
+ * @public
117
+ */
118
+ export { Container, type Factory, type ServiceKey, type ServiceMap } from './Container';
119
+ /**
120
+ * Request-scoped instance manager for HTTP request lifecycle.
121
+ *
122
+ * Manages transient services and cleanup that are tied to individual HTTP requests.
123
+ * Automatically integrates with Gravito's middleware pipeline for scope isolation.
124
+ *
125
+ * @public
126
+ */
127
+ export { RequestScopeManager } from './Container/RequestScopeManager';
128
+ /**
129
+ * Request scope metrics collection and analysis.
130
+ *
131
+ * Tracks memory usage, instance counts, and lifecycle metrics for request-scoped services.
132
+ * Provides observability into container behavior and potential memory leaks.
133
+ *
134
+ * @public
135
+ */
136
+ export { RequestScopeMetrics, RequestScopeMetricsCollector, type RequestScopeObserver, } from './Container/RequestScopeMetrics';
137
+ /**
138
+ * CLI queue command registration utilities.
139
+ *
140
+ * Provides helpers for registering queue-related commands (queue:work, queue:retry, etc.)
141
+ * into the Gravito CLI framework.
142
+ *
143
+ * @public
144
+ */
145
+ export { registerQueueCommands } from './cli/queue-commands';
146
+ /**
147
+ * Centralized HTTP error handler with status code management.
148
+ *
149
+ * Converts HTTP status codes to error responses with appropriate messages.
150
+ * Used internally by the HTTP layer and exception handlers.
151
+ *
152
+ * @public
153
+ */
154
+ export { codeFromStatus, ErrorHandler, type ErrorHandlerDeps, messageFromStatus, } from './ErrorHandler';
155
+ /**
156
+ * Event manager for application-level event dispatching and listener registration.
157
+ *
158
+ * Provides type-safe event system with support for synchronous listeners and
159
+ * async queue-based listeners. Integrates with the event queue infrastructure.
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * core.events.listen(UserCreated, SendWelcomeEmail)
164
+ * await core.events.dispatch(new UserCreated(user))
165
+ * ```
166
+ * @public
167
+ */
168
+ export { EventManager } from './EventManager';
169
+ /**
170
+ * Request scope error handling utilities for memory safety.
171
+ *
172
+ * Provides cleanup functions, leak detection, and error context extraction
173
+ * to prevent memory leaks and ensure proper resource disposal on request completion.
174
+ * Use these in custom middleware or error handlers for enhanced reliability.
175
+ *
176
+ * @public
177
+ */
178
+ export { cleanupRequestScopeOnError, detectRequestScopeLeaks, extractRequestScopeErrorContext, RequestScopeCleanupError, type RequestScopeErrorContext, withRequestScopeCleanup, } from './error-handling/RequestScopeErrorContext';
179
+ /**
180
+ * High-reliability event queue infrastructure with backpressure, circuit breaking, and flow control.
181
+ *
182
+ * Complete async event processing system with queue prioritization, retry logic, dead-letter queue,
183
+ * worker pool management, backpressure handling, and circuit breaker patterns for system stability.
184
+ * Handles millions of events with guaranteed delivery and failure recovery.
185
+ *
186
+ * Key components:
187
+ * - EventPriorityQueue: Multi-priority async queue with backpressure
188
+ * - CircuitBreaker: Fault tolerance with automatic recovery
189
+ * - DeadLetterQueue: Failed event capture and replay
190
+ * - WorkerPool: Concurrent task execution with metrics
191
+ * - BackpressureManager: Flow control to prevent overload
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * const queue = new EventPriorityQueue(config)
196
+ * await queue.enqueue('high-priority', task)
197
+ * const metrics = queue.metrics()
198
+ * ```
199
+ * @public
200
+ */
201
+ export type { BackpressureConfig, BackpressureDecision, BackpressureMetricsSnapshot, BackpressureStrategy, CircuitBreakerMetrics, CircuitBreakerMetricsRecorder, CircuitBreakerOptions, DeadLetterDecision, DLQEntry, DLQEntryCallback, DLQEntrySource, DLQFilter, EventBackend, EventOptions, EventQueueConfig, EventTask, FlowControlContext, FlowControlStrategy, MultiPriorityQueueDepth, PriorityStatistics, RetrySchedulerConfig, WindowAdjustment, WorkerPoolConfig, WorkerPoolStats, WorkerStats, } from './events';
202
+ export { BackpressureManager, BackpressureState, CircuitBreaker, CircuitBreakerState, CompositeStrategy, DEFAULT_EVENT_OPTIONS, DeadLetterQueue, EventPriorityQueue, IdempotencyCache, PriorityEscalationManager, PriorityRebalanceStrategy, QueueDepthStrategy, RateLimitStrategy, RetryScheduler, StarvationProtectionStrategy, WorkerPool, WorkerPoolMetrics, } from './events';
203
+ /**
204
+ * Event system observability and metrics collection.
205
+ *
206
+ * Built-in tracing, metrics, and performance monitoring for event queues and workers.
207
+ * Provides hooks into queue operations for custom instrumentation via OpenTelemetry.
208
+ *
209
+ * @public
210
+ */
211
+ export type { EventTracingConfig, ObservabilityConfig, QueueDepthCallback, } from './events/observability';
212
+ export { EventMetrics, EventTracer, EventTracing, getEventTracing, ObservableHookManager, OTelEventMetrics, } from './events/observability';
213
+ /**
214
+ * Observability provider contracts for monitoring and tracing.
215
+ *
216
+ * Abstract interfaces for building custom observability integrations with
217
+ * OpenTelemetry, monitoring systems, or custom tracing implementations.
218
+ * Concrete implementations are provided by @gravito/monitor.
219
+ *
220
+ * @see https://github.com/gravitojs/gravito-monitor
221
+ * @public
222
+ */
223
+ export type { EventMetricsRecorder, EventTracingProvider, ObservabilityProvider, TracingSpan, WorkerMetricsProvider, } from './observability/contracts';
224
+ /**
225
+ * No-operation observability provider for testing and development.
226
+ *
227
+ * Returns a noop provider that satisfies the ObservabilityProvider interface
228
+ * without performing actual tracing or metrics collection. Useful for development
229
+ * environments or when observability is not needed.
230
+ *
231
+ * @returns A noop ObservabilityProvider instance
232
+ * @public
233
+ */
234
+ export { createNoOpObservabilityProvider } from './observability/contracts';
235
+ /**
236
+ * Real-time queue dashboard for monitoring event processing.
237
+ *
238
+ * Provides a web-based and CLI dashboard for monitoring queue depth, worker status,
239
+ * error rates, throughput, and other metrics. Useful for operational visibility
240
+ * and debugging queue performance issues.
241
+ *
242
+ * @public
243
+ */
244
+ export { type DashboardSnapshot, type ErrorStats, type JobEvent, QueueDashboard, type QueueDashboardConfig, type QueueMetrics, type WorkerMetrics as QueueWorkerMetrics, } from './observability/QueueDashboard';
245
+ /**
246
+ * Built-in HTTP exception classes for common error scenarios.
247
+ *
248
+ * Pre-defined exception classes (BadRequestException, UnauthorizedException, NotFoundException, etc.)
249
+ * that automatically map to correct HTTP status codes. Extend HttpException for custom domain errors.
250
+ *
251
+ * @public
252
+ */
253
+ export * from './exceptions';
254
+ /**
255
+ * Global process error handler registration for uncaught exceptions and rejections.
256
+ *
257
+ * Registers handlers for process-level errors (unhandledRejection, uncaughtException) that occur
258
+ * outside of HTTP request context. Enables centralized error reporting, logging, and recovery.
259
+ *
260
+ * @example
261
+ * ```typescript
262
+ * registerGlobalErrorHandlers({
263
+ * onUnhandledRejection: (error) => logger.error('Rejection:', error),
264
+ * onUncaughtException: (error) => process.exit(1),
265
+ * })
266
+ * ```
267
+ * @public
268
+ */
269
+ export { type GlobalErrorHandlersMode, type GlobalProcessErrorHandlerContext, type GlobalProcessErrorKind, type RegisterGlobalErrorHandlersOptions, registerGlobalErrorHandlers, } from './GlobalErrorHandlers';
270
+ /**
271
+ * Gravito server bootstrap and lifecycle management.
272
+ *
273
+ * Provides the main server instance with configuration, port binding, graceful shutdown,
274
+ * and signal handling. Use {@link PlanetCore} for most applications; use GravitoServer
275
+ * when you need lower-level HTTP server control.
276
+ *
277
+ * @public
278
+ */
279
+ export { type GravitoManifest, GravitoServer } from './GravitoServer';
280
+ /**
281
+ * Hook system for extensibility and event-driven architecture.
282
+ *
283
+ * Provides action hooks (filters) and listener hooks (listeners) that allow plugins
284
+ * and custom code to tap into framework lifecycle events. Supports async handlers
285
+ * and conditional execution.
286
+ *
287
+ * @example
288
+ * ```typescript
289
+ * const hooks = new HookManager()
290
+ * hooks.addAction('user:created', async (user) => {
291
+ * await sendWelcomeEmail(user)
292
+ * })
293
+ * ```
294
+ * @public
295
+ */
296
+ export type { ActionCallback, FilterCallback, ListenerInfo, ListenerOptions } from './HookManager';
297
+ export { HookManager, type HookManagerConfig } from './HookManager';
298
+ /**
299
+ * Application health check provider for readiness and liveness probes.
300
+ *
301
+ * Enables custom health checks for database connectivity, cache availability, and other
302
+ * dependencies. Integrates with Kubernetes and load balancer health endpoints.
303
+ *
304
+ * @public
305
+ */
306
+ export type { HealthCheck, HealthCheckResult } from './health/HealthProvider';
307
+ export { HealthProvider } from './health/HealthProvider';
308
+ export type { DumpOptions } from './helpers';
309
+ /**
310
+ * Developer-friendly utility functions and helper classes.
311
+ *
312
+ * Collection of utilities for common tasks: array/string manipulation (Arr, Str),
313
+ * value resolution (value, tap), assertions (abort, throwIf, throwUnless),
314
+ * debugging (dump, dd), and service access (app, config, env, logger, router).
315
+ *
316
+ * @public
317
+ */
318
+ export { Arr, abort, abortIf, abortUnless, app, blank, config, DumpDieError, dd, dump, env, filled, hasApp, logger, router, Str, setApp, tap, throwIf, throwUnless, value, } from './helpers';
319
+ /**
320
+ * Helper utilities for data transformation and validation.
321
+ * @public
322
+ */
323
+ export * from './helpers/data';
324
+ /**
325
+ * Error creation and handling helpers.
326
+ * @public
327
+ */
328
+ export * from './helpers/errors';
329
+ /**
330
+ * HTTP response building helpers.
331
+ * @public
332
+ */
333
+ export * from './helpers/response';
334
+ /**
335
+ * Cookie jar and cookie management utilities.
336
+ *
337
+ * Provides CookieJar class for cookie-set operations and helper functions
338
+ * (getCookie, setCookie, deleteCookie) for cookie manipulation in requests/responses.
339
+ *
340
+ * @example
341
+ * ```typescript
342
+ * setCookie(ctx, 'sessionId', token, { httpOnly: true, sameSite: 'Strict' })
343
+ * const value = getCookie(ctx, 'sessionId')
344
+ * ```
345
+ * @public
346
+ */
347
+ export { CookieJar, type CookieOptions } from './http/CookieJar';
348
+ export { deleteCookie, getCookie, setCookie } from './http/cookie';
349
+ /**
350
+ * Event listener interface for asynchronous event handling.
351
+ *
352
+ * Listeners handle dispatched events synchronously or asynchronously. Implement ShouldQueue
353
+ * to enable queue-based execution with retry and delay support.
354
+ *
355
+ * @public
356
+ */
357
+ export type { Listener, ShouldQueue } from './Listener';
358
+ /**
359
+ * Structured logging interface and default console implementation.
360
+ *
361
+ * Standard PSR-3-inspired logger interface (debug, info, warn, error methods)
362
+ * enables swapping implementations (Winston, Pino, etc.). ConsoleLogger provides
363
+ * a basic console-based implementation suitable for development.
364
+ *
365
+ * @public
366
+ */
367
+ export type { Logger } from './Logger';
368
+ export { ConsoleLogger } from './Logger';
369
+ /**
370
+ * Main application kernel and HTTP server bootstrap.
371
+ *
372
+ * PlanetCore is the entry point for Gravito applications. It handles service registration,
373
+ * middleware setup, route definitions, event binding, and server lifecycle. Use PlanetCore.boot()
374
+ * to initialize a complete application.
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * const core = await PlanetCore.boot(config)
379
+ * core.listen(3000)
380
+ * ```
381
+ * @public
382
+ */
383
+ export { type CacheService, type ErrorHandlerContext, type GravitoConfig, type GravitoOrbit, PlanetCore, type ViewService, } from './PlanetCore';
384
+ /**
385
+ * Request context carrier for per-request state and data.
386
+ *
387
+ * Provides type-safe storage for request-scoped data (user, tracing context, etc.)
388
+ * with automatic cleanup. Integrates with request scope management.
389
+ *
390
+ * @public
391
+ */
392
+ export { RequestContext, type RequestContextData, } from './RequestContext';
393
+ /**
394
+ * HTTP route definition and registration.
395
+ *
396
+ * Route represents a single HTTP route with its handler, middleware, and metadata.
397
+ * Use Router to register routes; Route provides the chainable registration API.
398
+ *
399
+ * @public
400
+ */
401
+ export { Route } from './Route';
402
+ /**
403
+ * HTTP routing system with controller and handler support.
404
+ *
405
+ * Provides fluent API for route registration (GET, POST, etc.), middleware attachment,
406
+ * route groups, and controller method dispatch. Supports form request validation,
407
+ * domain constraints, and nested groups.
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * router.get('/users', [UserController, 'index'])
412
+ * router.post('/users', UserStoreRequest, [UserController, 'store'])
413
+ *
414
+ * router.group({ prefix: '/api' }, (r) => {
415
+ * r.get('/posts', [PostController, 'index'])
416
+ * })
417
+ * ```
418
+ * @public
419
+ */
420
+ export { type ControllerClass, FORM_REQUEST_SYMBOL, type FormRequestClass, type FormRequestLike, RouteGroup, type RouteHandler, type RouteOptions, Router, } from './Router';
421
+ /**
422
+ * Dead-letter queue management and retry policy configuration.
423
+ *
424
+ * Handles failed events that cannot be processed. Provides DLQ inspection, replay,
425
+ * and filtering. Integrates with RetryScheduler for automatic retries.
426
+ *
427
+ * @public
428
+ */
429
+ export type { DLQManagerFilter, DLQRecord, DLQStats, RetryPolicy } from './reliability';
430
+ export { DeadLetterQueueManager, getDefaultRetryPolicy, getPresetRetryPolicy, RetryEngine, } from './reliability';
431
+ /**
432
+ * Service provider for application bootstrap and service registration.
433
+ *
434
+ * Base class for extending Gravito with custom service bindings, event listeners,
435
+ * and middleware registration. Providers are automatically loaded during application boot.
436
+ *
437
+ * @example
438
+ * ```typescript
439
+ * class MyServiceProvider extends ServiceProvider {
440
+ * register() {
441
+ * this.app.bind('cache', () => new RedisCache())
442
+ * }
443
+ * boot() {
444
+ * const cache = this.app.resolve('cache')
445
+ * }
446
+ * }
447
+ * ```
448
+ * @public
449
+ */
450
+ export { ServiceProvider } from './ServiceProvider';
451
+ /**
452
+ * Encryption service for secure data handling.
453
+ *
454
+ * Provides AES-256 encryption for sensitive data with key derivation from app key.
455
+ * Automatically handles IV generation and verification.
456
+ *
457
+ * @public
458
+ */
459
+ export { Encrypter, type EncrypterOptions } from './security/Encrypter';
460
+ /**
461
+ * Event base class and broadcast channel types.
462
+ *
463
+ * Event is the base class for application events. Implement ShouldBroadcast
464
+ * to enable real-time broadcasting to connected clients.
465
+ *
466
+ * @example
467
+ * ```typescript
468
+ * class UserCreated extends Event {
469
+ * constructor(public user: User) { super() }
470
+ * }
471
+ * ```
472
+ * @public
473
+ */
474
+ export type { Channel, ShouldBroadcast } from './types/events';
475
+ export { Event } from './types/events';
476
+ /**
477
+ * Testing utilities and test helpers for unit and integration tests.
478
+ * @public
479
+ */
480
+ export * from './testing';
481
+ /**
482
+ * Runtime abstraction layer for cross-platform compatibility (Bun, Node, Deno).
483
+ *
484
+ * Provides adapters for file I/O, compression, markdown rendering, password hashing,
485
+ * SQLite database, and archive operations. Automatically detects runtime and loads
486
+ * the appropriate implementation. Ensures code portability across Bun, Node.js, and Deno.
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * const adapter = getRuntimeAdapter()
491
+ * const fs = adapter.fs
492
+ * const data = await fs.readText('file.txt')
493
+ * ```
494
+ * @public
495
+ */
496
+ export { type ArchiveCreateOptions, type ArchiveEntry, type ArchiveExtractOptions, type ArchiveFileInfo, type ArchiveFromDirectoryOptions, archiveFromDirectory, type CompressionOptions, createHtmlRenderCallbacks, createSqliteDatabase, type EscapeHtmlFn, getArchiveAdapter, getCompressionAdapter, getEscapeHtml, getMarkdownAdapter, getPasswordAdapter, getRuntimeAdapter, getRuntimeEnv, getRuntimeKind, type MarkdownRenderCallbacks, type MarkdownRenderOptions, type RuntimeAdapter, type RuntimeArchiveAdapter, type RuntimeCompressionAdapter, type RuntimeFileSink, type RuntimeFileStat, type RuntimeKind, type RuntimeMarkdownAdapter, type RuntimePasswordAdapter, type RuntimeProcess, type RuntimeProcessOutput, type RuntimeResourceUsage, type RuntimeServeConfig, type RuntimeServer, type RuntimeSpawnOptions, type RuntimeSpawnSyncResult, type RuntimeSqliteDatabase, type RuntimeSqliteStatement, resetRuntimeAdapter, toUint8Array, } from './runtime';
497
+ /**
498
+ * Runtime helper functions for file system operations.
499
+ *
500
+ * Convenience functions for common file operations: read/write/append/rename,
501
+ * directory creation/reading, JSON parsing, and recursive deletion.
502
+ * All functions abstract away platform differences.
503
+ *
504
+ * @public
505
+ */
506
+ export { getDefaultRuntimeAdapter, runtimeAppendFile, runtimeCreateFileSink, runtimeMkdir, runtimeReadDir, runtimeReadJSON, runtimeReadText, runtimeRemoveRecursive, runtimeRename, runtimeStatFull, runtimeWriteFileExclusive, } from './runtime-helpers';
507
+ /**
508
+ * Binary data utilities and deep equality comparison.
509
+ *
510
+ * BinaryUtils provides utilities for binary data handling. Deep equality checking
511
+ * enables structural comparison of complex objects across runtime environments.
512
+ *
513
+ * @public
514
+ */
515
+ export { BinaryUtils } from './binary';
516
+ /**
517
+ * Deep equality comparison for complex objects and values.
518
+ *
519
+ * Provides customizable deep equality checking that handles circular references,
520
+ * custom equality functions, and type-specific comparisons.
521
+ *
522
+ * @public
523
+ */
524
+ export type { DeepEqualsFn, DeepEqualsOptions } from './runtime/deep-equals';
525
+ export { getDeepEquals } from './runtime/deep-equals';
526
+ /**
527
+ * Native Bun HTTP engine for maximum performance.
528
+ *
529
+ * High-performance standalone HTTP server implementation using Bun's native APIs.
530
+ * Available via @gravito/core/engine import path for direct usage without PlanetCore.
531
+ * Use this when you need raw performance and are targeting Bun runtime.
532
+ *
533
+ * @see {@link PlanetCore} for the full-featured application framework
534
+ * @public
535
+ */
536
+ export * as engine from './engine';
537
+ /**
538
+ * Configure your Gravito application with type safety.
539
+ *
540
+ * Helper function that validates and returns application configuration.
541
+ * Enables IDE autocomplete and type checking for GravitoConfig.
542
+ *
543
+ * @param config - Application configuration object
544
+ * @returns The same config object, type-validated
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * const config = defineConfig({
549
+ * config: {
550
+ * APP_NAME: 'My App',
551
+ * PORT: 3000,
552
+ * },
553
+ * orbits: [], // Add your orbits here
554
+ * })
555
+ *
556
+ * const core = await PlanetCore.boot(config)
557
+ * ```
558
+ * @public
559
+ */
560
+ export declare function defineConfig(config: GravitoConfig): GravitoConfig;
561
+ /**
562
+ * Bun platform-specific adapters and utilities.
563
+ * @public
564
+ */
565
+ export * from './adapters/bun/index';
@@ -0,0 +1,136 @@
1
+ import type { DeadLetterQueue } from '../events/DeadLetterQueue';
2
+ import type { EventPriorityQueue } from '../events/EventPriorityQueue';
3
+ import type { MessageQueueBridge } from '../events/MessageQueueBridge';
4
+ import type { WorkerPool } from '../events/WorkerPool';
5
+ import type { HookManager } from '../HookManager';
6
+ /**
7
+ * Configuration for QueueDashboard
8
+ * All subsystem references are optional to support progressive integration
9
+ */
10
+ export interface QueueDashboardConfig {
11
+ eventQueue?: EventPriorityQueue;
12
+ workerPool?: WorkerPool;
13
+ hookManager?: HookManager;
14
+ dlq?: DeadLetterQueue;
15
+ messageQueueBridge?: MessageQueueBridge;
16
+ }
17
+ /**
18
+ * Queue depth and backpressure metrics
19
+ */
20
+ export interface QueueMetrics {
21
+ depth: {
22
+ total: number;
23
+ high: number;
24
+ normal: number;
25
+ low: number;
26
+ };
27
+ backpressure: {
28
+ state: string;
29
+ rejectedCount: number;
30
+ degradedCount: number;
31
+ enqueueRate: number;
32
+ };
33
+ processing: boolean;
34
+ }
35
+ /**
36
+ * Worker pool and thread statistics
37
+ */
38
+ export interface WorkerMetrics {
39
+ poolSize: number;
40
+ activeWorkers: number;
41
+ utilization: number;
42
+ queueDepth: number;
43
+ totalProcessed: number;
44
+ totalSuccess: number;
45
+ totalFailures: number;
46
+ successRate: number;
47
+ workers: Array<{
48
+ id: string;
49
+ state: string;
50
+ tasksProcessed: number;
51
+ tasksSucceeded: number;
52
+ tasksFailed: number;
53
+ avgDurationMs: number;
54
+ currentLoad: number;
55
+ }>;
56
+ }
57
+ /**
58
+ * Timeline event for job processing history
59
+ */
60
+ export interface JobEvent {
61
+ id: string;
62
+ hook: string;
63
+ status: 'pending' | 'processing' | 'completed' | 'failed' | 'in_dlq';
64
+ priority: string;
65
+ createdAt: number;
66
+ error?: string;
67
+ retryCount: number;
68
+ }
69
+ /**
70
+ * Error statistics and circuit breaker status
71
+ */
72
+ export interface ErrorStats {
73
+ totalErrors: number;
74
+ byEvent: Record<string, number>;
75
+ circuitBreakers: Array<{
76
+ eventName: string;
77
+ state: string;
78
+ failures: number;
79
+ successes: number;
80
+ }>;
81
+ dlqCount: number;
82
+ }
83
+ /**
84
+ * Complete dashboard snapshot at a point in time
85
+ */
86
+ export interface DashboardSnapshot {
87
+ timestamp: number;
88
+ queue: QueueMetrics;
89
+ workers: WorkerMetrics;
90
+ timeline: JobEvent[];
91
+ errors: ErrorStats;
92
+ }
93
+ /**
94
+ * QueueDashboard aggregates metrics from all event processing subsystems
95
+ * Uses Facade pattern to read-only aggregate data without modifying subsystems
96
+ */
97
+ export declare class QueueDashboard {
98
+ private readonly config;
99
+ constructor(config: QueueDashboardConfig);
100
+ /**
101
+ * Get current queue metrics (depth, backpressure state, enqueue rate)
102
+ */
103
+ getQueueMetrics(): QueueMetrics;
104
+ /**
105
+ * Get current worker pool metrics (size, utilization, success rate)
106
+ */
107
+ getWorkerMetrics(): WorkerMetrics;
108
+ /**
109
+ * Get job event timeline from DLQ entries (recent failures)
110
+ * @param limit Maximum number of entries to return (default: 50)
111
+ */
112
+ getJobTimeline(limit?: number): JobEvent[];
113
+ /**
114
+ * Get error statistics including circuit breaker status and DLQ counts
115
+ */
116
+ getErrorBreakdown(): ErrorStats;
117
+ /**
118
+ * Export metrics in JSON or Prometheus format
119
+ * @param format Export format: 'json' or 'prometheus'
120
+ */
121
+ exportMetrics(format: 'json' | 'prometheus'): string;
122
+ /**
123
+ * Get complete snapshot of all metrics at a point in time
124
+ */
125
+ getSnapshot(options?: {
126
+ timelineLimit?: number;
127
+ }): DashboardSnapshot;
128
+ /**
129
+ * Format metrics in Prometheus/OpenMetrics text format
130
+ */
131
+ private formatPrometheus;
132
+ /**
133
+ * Escape special characters in Prometheus labels
134
+ */
135
+ private escapePrometheusLabel;
136
+ }