@gravito/echo 3.1.1 → 3.1.2

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 (292) hide show
  1. package/README.md +24 -9
  2. package/dist/OrbitEcho.d.ts +76 -60
  3. package/dist/index.d.ts +31 -16
  4. package/dist/index.js +1 -1596
  5. package/dist/index.js.map +3 -28
  6. package/dist/{echo/src/middleware → middleware}/RequestBufferMiddleware.d.ts +3 -3
  7. package/dist/providers/GenericProvider.d.ts +37 -19
  8. package/dist/providers/GitHubProvider.d.ts +21 -13
  9. package/dist/providers/StripeProvider.d.ts +20 -13
  10. package/dist/providers/index.d.ts +14 -4
  11. package/dist/receive/SignatureValidator.d.ts +33 -1
  12. package/dist/receive/WebhookReceiver.d.ts +139 -22
  13. package/dist/receive/index.d.ts +0 -1
  14. package/dist/send/WebhookDispatcher.d.ts +159 -16
  15. package/dist/send/index.d.ts +0 -1
  16. package/dist/types.d.ts +669 -57
  17. package/package.json +5 -2
  18. package/dist/OrbitEcho.d.ts.map +0 -1
  19. package/dist/atlas/src/DB.d.ts +0 -348
  20. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  21. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  22. package/dist/atlas/src/config/index.d.ts +0 -7
  23. package/dist/atlas/src/config/loadConfig.d.ts +0 -41
  24. package/dist/atlas/src/connection/Connection.d.ts +0 -112
  25. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
  26. package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
  27. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  28. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  29. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  30. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
  31. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
  32. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  33. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  34. package/dist/atlas/src/drivers/types.d.ts +0 -260
  35. package/dist/atlas/src/errors/index.d.ts +0 -45
  36. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  37. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  38. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  39. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  40. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  41. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  42. package/dist/atlas/src/index.d.ts +0 -79
  43. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  44. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  45. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  46. package/dist/atlas/src/migration/index.d.ts +0 -6
  47. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
  48. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  49. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  50. package/dist/atlas/src/observability/index.d.ts +0 -9
  51. package/dist/atlas/src/orm/Repository.d.ts +0 -247
  52. package/dist/atlas/src/orm/index.d.ts +0 -6
  53. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  54. package/dist/atlas/src/orm/model/Model.d.ts +0 -458
  55. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  56. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
  57. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  58. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
  59. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  60. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  61. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  62. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  63. package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
  64. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  65. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  66. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  67. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  68. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
  69. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  70. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  71. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  72. package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
  73. package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
  74. package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
  75. package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
  76. package/dist/atlas/src/query/Expression.d.ts +0 -60
  77. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  78. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
  79. package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
  80. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  81. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  82. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  83. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  84. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  85. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  86. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  87. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  88. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  89. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  90. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  91. package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
  92. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  93. package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
  94. package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
  95. package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
  96. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  97. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  98. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  99. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  100. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  101. package/dist/atlas/src/schema/index.d.ts +0 -8
  102. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  103. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  104. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  105. package/dist/atlas/src/seed/index.d.ts +0 -6
  106. package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
  107. package/dist/atlas/src/types/index.d.ts +0 -1182
  108. package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
  109. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  110. package/dist/core/src/Application.d.ts +0 -215
  111. package/dist/core/src/CommandKernel.d.ts +0 -33
  112. package/dist/core/src/ConfigManager.d.ts +0 -65
  113. package/dist/core/src/Container/RequestScopeManager.d.ts +0 -62
  114. package/dist/core/src/Container/RequestScopeMetrics.d.ts +0 -144
  115. package/dist/core/src/Container.d.ts +0 -153
  116. package/dist/core/src/ErrorHandler.d.ts +0 -66
  117. package/dist/core/src/Event.d.ts +0 -5
  118. package/dist/core/src/EventManager.d.ts +0 -123
  119. package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
  120. package/dist/core/src/GravitoServer.d.ts +0 -28
  121. package/dist/core/src/HookManager.d.ts +0 -591
  122. package/dist/core/src/Listener.d.ts +0 -4
  123. package/dist/core/src/Logger.d.ts +0 -20
  124. package/dist/core/src/PlanetCore.d.ts +0 -378
  125. package/dist/core/src/RequestContext.d.ts +0 -97
  126. package/dist/core/src/Route.d.ts +0 -36
  127. package/dist/core/src/Router.d.ts +0 -284
  128. package/dist/core/src/ServiceProvider.d.ts +0 -178
  129. package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
  130. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
  131. package/dist/core/src/adapters/bun/BunContext.d.ts +0 -49
  132. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
  133. package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
  134. package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
  135. package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
  136. package/dist/core/src/adapters/bun/types.d.ts +0 -20
  137. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  138. package/dist/core/src/adapters/types.d.ts +0 -235
  139. package/dist/core/src/cli/queue-commands.d.ts +0 -6
  140. package/dist/core/src/engine/AOTRouter.d.ts +0 -129
  141. package/dist/core/src/engine/FastContext.d.ts +0 -123
  142. package/dist/core/src/engine/Gravito.d.ts +0 -136
  143. package/dist/core/src/engine/MinimalContext.d.ts +0 -100
  144. package/dist/core/src/engine/analyzer.d.ts +0 -27
  145. package/dist/core/src/engine/constants.d.ts +0 -23
  146. package/dist/core/src/engine/index.d.ts +0 -26
  147. package/dist/core/src/engine/path.d.ts +0 -26
  148. package/dist/core/src/engine/pool.d.ts +0 -83
  149. package/dist/core/src/engine/types.d.ts +0 -146
  150. package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +0 -126
  151. package/dist/core/src/events/BackpressureManager.d.ts +0 -215
  152. package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
  153. package/dist/core/src/events/DeadLetterQueue.d.ts +0 -219
  154. package/dist/core/src/events/EventBackend.d.ts +0 -12
  155. package/dist/core/src/events/EventOptions.d.ts +0 -204
  156. package/dist/core/src/events/EventPriorityQueue.d.ts +0 -301
  157. package/dist/core/src/events/FlowControlStrategy.d.ts +0 -109
  158. package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
  159. package/dist/core/src/events/MessageQueueBridge.d.ts +0 -184
  160. package/dist/core/src/events/PriorityEscalationManager.d.ts +0 -82
  161. package/dist/core/src/events/RetryScheduler.d.ts +0 -104
  162. package/dist/core/src/events/WorkerPool.d.ts +0 -98
  163. package/dist/core/src/events/WorkerPoolConfig.d.ts +0 -153
  164. package/dist/core/src/events/WorkerPoolMetrics.d.ts +0 -65
  165. package/dist/core/src/events/aggregation/AggregationWindow.d.ts +0 -77
  166. package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +0 -135
  167. package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +0 -108
  168. package/dist/core/src/events/aggregation/EventBatcher.d.ts +0 -99
  169. package/dist/core/src/events/aggregation/types.d.ts +0 -117
  170. package/dist/core/src/events/index.d.ts +0 -25
  171. package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
  172. package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
  173. package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
  174. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -332
  175. package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
  176. package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +0 -76
  177. package/dist/core/src/events/observability/index.d.ts +0 -24
  178. package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
  179. package/dist/core/src/events/types.d.ts +0 -134
  180. package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
  181. package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
  182. package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
  183. package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
  184. package/dist/core/src/exceptions/HttpException.d.ts +0 -9
  185. package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
  186. package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
  187. package/dist/core/src/exceptions/index.d.ts +0 -7
  188. package/dist/core/src/health/HealthProvider.d.ts +0 -67
  189. package/dist/core/src/helpers/Arr.d.ts +0 -19
  190. package/dist/core/src/helpers/Str.d.ts +0 -23
  191. package/dist/core/src/helpers/data.d.ts +0 -25
  192. package/dist/core/src/helpers/errors.d.ts +0 -34
  193. package/dist/core/src/helpers/response.d.ts +0 -41
  194. package/dist/core/src/helpers.d.ts +0 -338
  195. package/dist/core/src/http/CookieJar.d.ts +0 -51
  196. package/dist/core/src/http/cookie.d.ts +0 -29
  197. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  198. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  199. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  200. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  201. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  202. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  203. package/dist/core/src/http/types.d.ts +0 -374
  204. package/dist/core/src/index.d.ts +0 -88
  205. package/dist/core/src/instrumentation/index.d.ts +0 -35
  206. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  207. package/dist/core/src/instrumentation/types.d.ts +0 -182
  208. package/dist/core/src/observability/Metrics.d.ts +0 -244
  209. package/dist/core/src/observability/QueueDashboard.d.ts +0 -136
  210. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -350
  211. package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
  212. package/dist/core/src/reliability/index.d.ts +0 -6
  213. package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
  214. package/dist/core/src/router/RequestValidator.d.ts +0 -20
  215. package/dist/core/src/runtime.d.ts +0 -119
  216. package/dist/core/src/security/Encrypter.d.ts +0 -33
  217. package/dist/core/src/security/Hasher.d.ts +0 -29
  218. package/dist/core/src/testing/HttpTester.d.ts +0 -39
  219. package/dist/core/src/testing/TestResponse.d.ts +0 -78
  220. package/dist/core/src/testing/index.d.ts +0 -2
  221. package/dist/core/src/types/events.d.ts +0 -94
  222. package/dist/echo/src/OrbitEcho.d.ts +0 -115
  223. package/dist/echo/src/index.d.ts +0 -64
  224. package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
  225. package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
  226. package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
  227. package/dist/echo/src/providers/index.d.ts +0 -14
  228. package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
  229. package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
  230. package/dist/echo/src/receive/index.d.ts +0 -2
  231. package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
  232. package/dist/echo/src/send/index.d.ts +0 -1
  233. package/dist/echo/src/types.d.ts +0 -756
  234. package/dist/index.d.ts.map +0 -1
  235. package/dist/monitor/src/MonitorOrbit.d.ts +0 -43
  236. package/dist/monitor/src/config.d.ts +0 -106
  237. package/dist/monitor/src/health/HealthController.d.ts +0 -28
  238. package/dist/monitor/src/health/HealthRegistry.d.ts +0 -80
  239. package/dist/monitor/src/health/index.d.ts +0 -36
  240. package/dist/monitor/src/index.d.ts +0 -13
  241. package/dist/monitor/src/metrics/MetricsController.d.ts +0 -22
  242. package/dist/monitor/src/metrics/MetricsRegistry.d.ts +0 -136
  243. package/dist/monitor/src/metrics/index.d.ts +0 -11
  244. package/dist/monitor/src/tracing/TracingManager.d.ts +0 -97
  245. package/dist/monitor/src/tracing/index.d.ts +0 -10
  246. package/dist/photon/src/index.d.ts +0 -89
  247. package/dist/photon/src/middleware/binary.d.ts +0 -31
  248. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  249. package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
  250. package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
  251. package/dist/photon/src/openapi.d.ts +0 -19
  252. package/dist/providers/GenericProvider.d.ts.map +0 -1
  253. package/dist/providers/GitHubProvider.d.ts.map +0 -1
  254. package/dist/providers/StripeProvider.d.ts.map +0 -1
  255. package/dist/providers/index.d.ts.map +0 -1
  256. package/dist/receive/SignatureValidator.d.ts.map +0 -1
  257. package/dist/receive/WebhookReceiver.d.ts.map +0 -1
  258. package/dist/receive/index.d.ts.map +0 -1
  259. package/dist/send/WebhookDispatcher.d.ts.map +0 -1
  260. package/dist/send/index.d.ts.map +0 -1
  261. package/dist/types.d.ts.map +0 -1
  262. /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
  263. /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
  264. /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
  265. /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
  266. /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
  267. /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
  268. /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
  269. /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
  270. /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
  271. /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
  272. /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
  273. /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
  274. /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
  275. /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
  276. /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
  277. /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
  278. /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
  279. /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
  280. /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
  281. /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
  282. /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
  283. /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
  284. /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
  285. /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
  286. /package/dist/{echo/src/resilience → resilience}/CircuitBreaker.d.ts +0 -0
  287. /package/dist/{echo/src/resilience → resilience}/index.d.ts +0 -0
  288. /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
  289. /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
  290. /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
  291. /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
  292. /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
package/README.md CHANGED
@@ -2,15 +2,30 @@
2
2
 
3
3
  > 📡 Enterprise-grade webhook handling for Gravito. Secure receiving and reliable sending.
4
4
 
5
- ## Features
6
-
7
- - **Secure Receiving** - HMAC signature verification, timestamp validation
8
- - **Built-in Providers** - Stripe, GitHub, and generic provider support
9
- - **Reliable Sending** - Exponential backoff retry with configurable strategy
10
- - **Gravito Integration** - First-class OrbitEcho module for PlanetCore
11
- - **Request Buffering (v1.1)** - Prevents signature verification failures from framework auto-parsing
12
- - **Circuit Breaker (v1.1)** - Protects downstream services with automatic failure detection
13
- - **Key Rotation (v1.2)** - Zero-downtime key updates with multi-version support
5
+ ## Features
6
+
7
+ - 🪐 **Galaxy-Ready Gateway**: The primary entry/exit point for external asynchronous communication.
8
+ - 🛡️ **Secure Receiving**: HMAC signature verification, timestamp validation, and multi-key support.
9
+ - 🔄 **Boundary Reliability**: Built-in **Circuit Breaker**, **Retry Scheduler**, and **DLQ** for outgoing hooks.
10
+ - 📦 **Built-in Providers**: Native support for Stripe, GitHub, Shopify, Slack, and more.
11
+ - **Request Buffering**: Prevents signature failures by handling raw bodies before framework parsing.
12
+ - 🔐 **Key Rotation**: Seamless, zero-downtime secret rotation for enterprise security.
13
+
14
+ ## 🌌 Role in Galaxy Architecture
15
+
16
+ In the **Gravito Galaxy Architecture**, Echo acts as the **Deep Space Radar Layer (Boundary Communication)**.
17
+
18
+ - **External Stimuli**: Converts external world signals (Webhooks from Stripe, etc.) into internal `Signal` events that Satellites can react to.
19
+ - **Outbound Pulse**: Provides a reliable way for internal Galaxy state changes to be broadcasted to the outside world (e.g., notifying a 3rd party logistics provider).
20
+ - **Isolation Barrier**: Protects the core Galaxy from external failure ripples by utilizing circuit breakers on outgoing requests.
21
+
22
+ ```mermaid
23
+ graph LR
24
+ World([External Service]) -- Webhook --> Echo{Echo Orbit}
25
+ Echo -->|Verified Signal| Sat[Satellite: Payment]
26
+ Sat -->|Internal Event| Stream[Stream Orbit]
27
+ Echo -.->|Circuit Breaker| World
28
+ ```
14
29
 
15
30
  ## Installation
16
31
 
@@ -1,99 +1,115 @@
1
- /**
2
- * @fileoverview OrbitEcho Module
3
- *
4
- * Gravito integration for webhook handling.
5
- *
6
- * @module @gravito/echo
7
- */
1
+ import type { GravitoOrbit, PlanetCore } from '@gravito/core';
8
2
  import { WebhookReceiver } from './receive/WebhookReceiver';
3
+ import { KeyRotationManager } from './rotation/KeyRotationManager';
9
4
  import { WebhookDispatcher } from './send/WebhookDispatcher';
10
- import type { EchoConfig } from './types';
5
+ import type { EchoConfig, ProviderKeyEntry } from './types';
11
6
  /**
12
- * Simple module interface for PlanetCore integration
13
- */
14
- interface ModuleConfig {
15
- singleton?: boolean;
16
- }
17
- /**
18
- * Minimal PlanetCore interface
19
- */
20
- interface PlanetCore {
21
- container: {
22
- instance<T>(key: string, value: T): void;
23
- };
24
- hooks: {
25
- addAction(hook: string, callback: () => void | Promise<void>): void;
26
- };
27
- adapter: {
28
- use(middleware: unknown): void;
29
- };
30
- router: {
31
- post(path: string, handler: unknown): void;
32
- };
33
- }
34
- /**
35
- * OrbitEcho - Gravito Webhook Module
7
+ * OrbitEcho is the official webhook orchestration module for the Gravito ecosystem.
36
8
  *
37
- * Provides secure webhook receiving and reliable webhook sending.
9
+ * It serves as a comprehensive hub for managing the entire webhook lifecycle,
10
+ * including secure reception, signature verification across multiple providers,
11
+ * persistent storage for auditing, and reliable outgoing dispatch with
12
+ * exponential backoff and circuit breaking.
38
13
  *
39
- * @example
14
+ * @example Basic integration with PlanetCore
40
15
  * ```typescript
41
- * const core = new PlanetCore()
16
+ * import { PlanetCore } from '@gravito/core';
17
+ * import { OrbitEcho } from '@gravito/echo';
42
18
  *
43
- * core.install(new OrbitEcho({
19
+ * const core = new PlanetCore();
20
+ * const echo = new OrbitEcho({
44
21
  * providers: {
45
- * stripe: { name: 'stripe', secret: process.env.STRIPE_WEBHOOK_SECRET! },
46
- * github: { name: 'github', secret: process.env.GITHUB_WEBHOOK_SECRET! }
22
+ * stripe: { name: 'stripe', secret: process.env.STRIPE_SECRET }
47
23
  * },
48
24
  * dispatcher: {
49
- * secret: process.env.OUTGOING_WEBHOOK_SECRET!
25
+ * secret: process.env.APP_WEBHOOK_SECRET
50
26
  * }
51
- * }))
27
+ * });
52
28
  *
53
- * // Get receiver to add handlers
54
- * const receiver = core.container.make<WebhookReceiver>('echo.receiver')
55
- * receiver.on('stripe', 'payment_intent.succeeded', async (event) => {
56
- * console.log('Payment received:', event.payload)
57
- * })
29
+ * core.install(echo);
58
30
  * ```
31
+ *
32
+ * @public
59
33
  */
60
- export declare class OrbitEcho {
61
- static config: ModuleConfig;
34
+ export declare class OrbitEcho implements GravitoOrbit {
62
35
  private receiver;
63
36
  private dispatcher?;
64
37
  private echoConfig;
38
+ private keyRotationManager?;
65
39
  /**
66
- * Create a new OrbitEcho instance.
40
+ * Constructs a new OrbitEcho instance with the specified configuration.
67
41
  *
68
- * @param config - The configuration object for providers and dispatcher.
42
+ * This constructor initializes the core receiver component, sets up key rotation
43
+ * orchestration if enabled, registers defined providers, and connects the
44
+ * observability stack (metrics, tracing, logging).
45
+ *
46
+ * @param config - The global configuration defining providers, dispatchers, and infrastructure.
69
47
  */
70
48
  constructor(config?: EchoConfig);
71
49
  /**
72
- * Install into PlanetCore
50
+ * Integrates the Echo module into the Gravito application lifecycle.
73
51
  *
74
- * Registers the OrbitEcho instance and its components into the service container.
52
+ * This method performs the following setup tasks:
53
+ * 1. Installs request buffering middleware (if enabled) to preserve raw bodies.
54
+ * 2. Binds Echo components to the service container (`echo`, `echo.receiver`).
55
+ * 3. Injects the Echo instance into the request context for easy access in handlers.
75
56
  *
76
- * @param core - The PlanetCore instance.
57
+ * @param core - The PlanetCore instance managing the application.
58
+ * @throws {Error} If the core adapter is missing or improperly configured.
77
59
  */
78
60
  install(core: PlanetCore): void;
79
61
  /**
80
- * Get webhook receiver
62
+ * Retrieves the underlying receiver instance for manual webhook processing.
63
+ *
64
+ * Use this when you need fine-grained control over how incoming webhooks
65
+ * are routed or verified outside of the standard middleware flow.
81
66
  *
82
- * @returns The WebhookReceiver instance.
67
+ * @returns The active WebhookReceiver instance.
83
68
  */
84
69
  getReceiver(): WebhookReceiver;
85
70
  /**
86
- * Get webhook dispatcher
71
+ * Retrieves the dispatcher instance for sending outgoing webhooks.
87
72
  *
88
- * @returns The WebhookDispatcher instance, or undefined if not configured.
73
+ * @returns The configured WebhookDispatcher, or undefined if dispatch is disabled.
89
74
  */
90
75
  getDispatcher(): WebhookDispatcher | undefined;
91
76
  /**
92
- * Get configuration
77
+ * Accesses the active configuration used by this OrbitEcho instance.
93
78
  *
94
- * @returns The EchoConfig object.
79
+ * @returns The immutable EchoConfig object.
95
80
  */
96
81
  getConfig(): EchoConfig;
82
+ /**
83
+ * Retrieves the key rotation manager responsible for secret lifecycle.
84
+ *
85
+ * @returns The manager instance, or undefined if key rotation is disabled.
86
+ */
87
+ getKeyRotationManager(): KeyRotationManager | undefined;
88
+ /**
89
+ * Initiates a zero-downtime primary key rotation for a specific provider.
90
+ *
91
+ * This method promotes a new key to primary status while maintaining valid old keys
92
+ * for a grace period, ensuring that webhooks signed with either key are accepted
93
+ * during the transition.
94
+ *
95
+ * @param providerName - The identifier of the provider to update.
96
+ * @param newKey - Metadata and value for the replacement key.
97
+ * @throws {Error} If key rotation is not enabled in the global configuration.
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * await echo.rotateProviderKey('stripe', {
102
+ * key: 'whsec_new_secret',
103
+ * version: 'v2',
104
+ * activeFrom: new Date()
105
+ * });
106
+ * ```
107
+ */
108
+ rotateProviderKey(providerName: string, newKey: Omit<ProviderKeyEntry, 'isPrimary'>): Promise<void>;
109
+ }
110
+ declare module '@gravito/core' {
111
+ interface GravitoVariables {
112
+ /** Webhook receiver and dispatcher */
113
+ echo?: OrbitEcho;
114
+ }
97
115
  }
98
- export {};
99
- //# sourceMappingURL=OrbitEcho.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,49 +1,64 @@
1
1
  /**
2
- * @fileoverview @gravito/echo - Enterprise Webhook Module
2
+ * @fileoverview \@gravito/echo - Enterprise Webhook Orchestration
3
3
  *
4
- * Secure webhook receiving and reliable webhook sending for Gravito.
4
+ * Echo provides a secure, reliable, and observable layer for handling webhooks
5
+ * in Gravito applications. It standardizes incoming webhook reception with
6
+ * signature verification and dynamic key rotation, while ensuring reliable
7
+ * outgoing delivery via exponential backoff and circuit breaking.
5
8
  *
6
- * @example Receiving webhooks
9
+ * @example Receiving webhooks from Stripe
7
10
  * ```typescript
8
11
  * import { OrbitEcho, WebhookReceiver } from '@gravito/echo'
9
12
  *
10
13
  * const core = new PlanetCore()
11
- *
12
14
  * core.install(new OrbitEcho({
13
15
  * providers: {
14
- * stripe: { name: 'stripe', secret: process.env.STRIPE_WEBHOOK_SECRET! }
16
+ * stripe: { name: 'stripe', secret: process.env.STRIPE_SECRET! }
15
17
  * }
16
18
  * }))
17
19
  *
18
20
  * const receiver = core.container.make<WebhookReceiver>('echo.receiver')
19
21
  * receiver.on('stripe', 'payment_intent.succeeded', async (event) => {
20
- * console.log('Payment:', event.payload)
22
+ * // Securely process validated payment
21
23
  * })
22
24
  * ```
23
25
  *
24
- * @example Sending webhooks
26
+ * @example Dispatching reliable outgoing webhooks
25
27
  * ```typescript
26
28
  * import { WebhookDispatcher } from '@gravito/echo'
27
29
  *
28
- * const dispatcher = new WebhookDispatcher({
29
- * secret: 'my-secret'
30
- * })
31
- *
30
+ * const dispatcher = new WebhookDispatcher({ secret: 'app-secret' })
32
31
  * await dispatcher.dispatch({
33
- * url: 'https://example.com/webhook',
32
+ * url: 'https://consumer.com/hook',
34
33
  * event: 'order.created',
35
- * data: { orderId: 123 }
34
+ * data: { id: 123 }
36
35
  * })
37
36
  * ```
38
37
  *
39
38
  * @module @gravito/echo
40
39
  */
40
+ export type { DeadLetterEvent, DeadLetterQueue } from './dlq/DeadLetterQueue';
41
+ export { MemoryDeadLetterQueue } from './dlq/MemoryDeadLetterQueue';
42
+ export { createRequestBufferMiddleware, RequestBufferMiddleware } from './middleware';
41
43
  export { OrbitEcho } from './OrbitEcho';
44
+ export type { EchoLogEvent, EchoLogger } from './observability/logging';
45
+ export { ConsoleEchoLogger } from './observability/logging';
46
+ export type { MetricsProvider, WebhookMetricLabels } from './observability/metrics';
47
+ export { EchoMetrics, NoopMetricsProvider, PrometheusMetricsProvider, } from './observability/metrics';
48
+ export type { Span, SpanOptions, Tracer } from './observability/tracing';
49
+ export { NoopSpan, NoopTracer, SpanStatusCode } from './observability/tracing';
50
+ export { BaseProvider, type ProviderOptions } from './providers/base/BaseProvider';
42
51
  export { GenericProvider } from './providers/GenericProvider';
43
52
  export { GitHubProvider } from './providers/GitHubProvider';
53
+ export { LinearProvider } from './providers/LinearProvider';
54
+ export { PaddleProvider } from './providers/PaddleProvider';
55
+ export { ShopifyProvider } from './providers/ShopifyProvider';
56
+ export { SlackProvider } from './providers/SlackProvider';
44
57
  export { StripeProvider } from './providers/StripeProvider';
58
+ export { TwilioProvider } from './providers/TwilioProvider';
45
59
  export { computeHmacSha1, computeHmacSha256, parseStripeSignature, timingSafeEqual, validateTimestamp, } from './receive/SignatureValidator';
46
60
  export { WebhookReceiver } from './receive/WebhookReceiver';
47
- export { WebhookDispatcher } from './send/WebhookDispatcher';
48
- export type { EchoConfig, RetryConfig, WebhookDeliveryResult, WebhookDispatcherConfig, WebhookEvent, WebhookHandler, WebhookPayload, WebhookProvider, WebhookProviderConfig, WebhookVerificationResult, } from './types';
49
- //# sourceMappingURL=index.d.ts.map
61
+ export { WebhookReplayService } from './replay/WebhookReplayService';
62
+ export { CircuitBreaker } from './resilience';
63
+ export { KeyRotationManager } from './rotation';
64
+ export type { BufferedRequest, CircuitBreakerConfig, CircuitBreakerMetrics, CircuitBreakerState, EchoConfig, EchoObservabilityConfig, KeyRotationConfig, ProviderKeyEntry, ReplayOptions, ReplayResult, RequestBufferConfig, RetryConfig, WebhookDeliveryResult, WebhookDispatcherConfig, WebhookEvent, WebhookHandler, WebhookPayload, WebhookProvider, WebhookProviderConfig, WebhookProviderConfigWithRotation, WebhookVerificationResult, } from './types';