@gravito/echo 3.1.1 → 4.0.0

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 (295) hide show
  1. package/README.md +24 -9
  2. package/dist/OrbitEcho.d.ts +76 -60
  3. package/dist/errors/EchoError.d.ts +29 -0
  4. package/dist/errors/codes.d.ts +20 -0
  5. package/dist/index.d.ts +34 -16
  6. package/dist/index.js +3 -1596
  7. package/dist/index.js.map +3 -28
  8. package/dist/{echo/src/middleware → middleware}/RequestBufferMiddleware.d.ts +3 -3
  9. package/dist/providers/GenericProvider.d.ts +37 -19
  10. package/dist/providers/GitHubProvider.d.ts +21 -13
  11. package/dist/providers/StripeProvider.d.ts +20 -13
  12. package/dist/providers/index.d.ts +14 -4
  13. package/dist/receive/SignatureValidator.d.ts +33 -1
  14. package/dist/receive/WebhookReceiver.d.ts +139 -22
  15. package/dist/receive/index.d.ts +0 -1
  16. package/dist/resilience/CircuitBreaker.d.ts +6 -0
  17. package/dist/{echo/src/resilience → resilience}/index.d.ts +2 -1
  18. package/dist/send/WebhookDispatcher.d.ts +159 -16
  19. package/dist/send/index.d.ts +0 -1
  20. package/dist/types.d.ts +671 -57
  21. package/package.json +9 -3
  22. package/dist/OrbitEcho.d.ts.map +0 -1
  23. package/dist/atlas/src/DB.d.ts +0 -348
  24. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  25. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  26. package/dist/atlas/src/config/index.d.ts +0 -7
  27. package/dist/atlas/src/config/loadConfig.d.ts +0 -41
  28. package/dist/atlas/src/connection/Connection.d.ts +0 -112
  29. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
  30. package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
  31. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  32. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  33. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  34. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
  35. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
  36. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  37. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  38. package/dist/atlas/src/drivers/types.d.ts +0 -260
  39. package/dist/atlas/src/errors/index.d.ts +0 -45
  40. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  41. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  42. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  43. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  44. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  45. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  46. package/dist/atlas/src/index.d.ts +0 -79
  47. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  48. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  49. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  50. package/dist/atlas/src/migration/index.d.ts +0 -6
  51. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
  52. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  53. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  54. package/dist/atlas/src/observability/index.d.ts +0 -9
  55. package/dist/atlas/src/orm/Repository.d.ts +0 -247
  56. package/dist/atlas/src/orm/index.d.ts +0 -6
  57. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  58. package/dist/atlas/src/orm/model/Model.d.ts +0 -458
  59. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  60. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
  61. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  62. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
  63. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  64. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  65. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  66. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  67. package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
  68. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  69. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  70. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  71. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  72. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
  73. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  74. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  75. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  76. package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
  77. package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
  78. package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
  79. package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
  80. package/dist/atlas/src/query/Expression.d.ts +0 -60
  81. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  82. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
  83. package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
  84. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  85. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  86. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  87. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  88. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  89. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  90. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  91. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  92. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  93. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  94. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  95. package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
  96. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  97. package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
  98. package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
  99. package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
  100. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  101. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  102. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  103. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  104. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  105. package/dist/atlas/src/schema/index.d.ts +0 -8
  106. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  107. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  108. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  109. package/dist/atlas/src/seed/index.d.ts +0 -6
  110. package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
  111. package/dist/atlas/src/types/index.d.ts +0 -1182
  112. package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
  113. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  114. package/dist/core/src/Application.d.ts +0 -215
  115. package/dist/core/src/CommandKernel.d.ts +0 -33
  116. package/dist/core/src/ConfigManager.d.ts +0 -65
  117. package/dist/core/src/Container/RequestScopeManager.d.ts +0 -62
  118. package/dist/core/src/Container/RequestScopeMetrics.d.ts +0 -144
  119. package/dist/core/src/Container.d.ts +0 -153
  120. package/dist/core/src/ErrorHandler.d.ts +0 -66
  121. package/dist/core/src/Event.d.ts +0 -5
  122. package/dist/core/src/EventManager.d.ts +0 -123
  123. package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
  124. package/dist/core/src/GravitoServer.d.ts +0 -28
  125. package/dist/core/src/HookManager.d.ts +0 -591
  126. package/dist/core/src/Listener.d.ts +0 -4
  127. package/dist/core/src/Logger.d.ts +0 -20
  128. package/dist/core/src/PlanetCore.d.ts +0 -378
  129. package/dist/core/src/RequestContext.d.ts +0 -97
  130. package/dist/core/src/Route.d.ts +0 -36
  131. package/dist/core/src/Router.d.ts +0 -284
  132. package/dist/core/src/ServiceProvider.d.ts +0 -178
  133. package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
  134. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
  135. package/dist/core/src/adapters/bun/BunContext.d.ts +0 -49
  136. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
  137. package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
  138. package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
  139. package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
  140. package/dist/core/src/adapters/bun/types.d.ts +0 -20
  141. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  142. package/dist/core/src/adapters/types.d.ts +0 -235
  143. package/dist/core/src/cli/queue-commands.d.ts +0 -6
  144. package/dist/core/src/engine/AOTRouter.d.ts +0 -129
  145. package/dist/core/src/engine/FastContext.d.ts +0 -123
  146. package/dist/core/src/engine/Gravito.d.ts +0 -136
  147. package/dist/core/src/engine/MinimalContext.d.ts +0 -100
  148. package/dist/core/src/engine/analyzer.d.ts +0 -27
  149. package/dist/core/src/engine/constants.d.ts +0 -23
  150. package/dist/core/src/engine/index.d.ts +0 -26
  151. package/dist/core/src/engine/path.d.ts +0 -26
  152. package/dist/core/src/engine/pool.d.ts +0 -83
  153. package/dist/core/src/engine/types.d.ts +0 -146
  154. package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +0 -126
  155. package/dist/core/src/events/BackpressureManager.d.ts +0 -215
  156. package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
  157. package/dist/core/src/events/DeadLetterQueue.d.ts +0 -219
  158. package/dist/core/src/events/EventBackend.d.ts +0 -12
  159. package/dist/core/src/events/EventOptions.d.ts +0 -204
  160. package/dist/core/src/events/EventPriorityQueue.d.ts +0 -301
  161. package/dist/core/src/events/FlowControlStrategy.d.ts +0 -109
  162. package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
  163. package/dist/core/src/events/MessageQueueBridge.d.ts +0 -184
  164. package/dist/core/src/events/PriorityEscalationManager.d.ts +0 -82
  165. package/dist/core/src/events/RetryScheduler.d.ts +0 -104
  166. package/dist/core/src/events/WorkerPool.d.ts +0 -98
  167. package/dist/core/src/events/WorkerPoolConfig.d.ts +0 -153
  168. package/dist/core/src/events/WorkerPoolMetrics.d.ts +0 -65
  169. package/dist/core/src/events/aggregation/AggregationWindow.d.ts +0 -77
  170. package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +0 -135
  171. package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +0 -108
  172. package/dist/core/src/events/aggregation/EventBatcher.d.ts +0 -99
  173. package/dist/core/src/events/aggregation/types.d.ts +0 -117
  174. package/dist/core/src/events/index.d.ts +0 -25
  175. package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
  176. package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
  177. package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
  178. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -332
  179. package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
  180. package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +0 -76
  181. package/dist/core/src/events/observability/index.d.ts +0 -24
  182. package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
  183. package/dist/core/src/events/types.d.ts +0 -134
  184. package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
  185. package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
  186. package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
  187. package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
  188. package/dist/core/src/exceptions/HttpException.d.ts +0 -9
  189. package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
  190. package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
  191. package/dist/core/src/exceptions/index.d.ts +0 -7
  192. package/dist/core/src/health/HealthProvider.d.ts +0 -67
  193. package/dist/core/src/helpers/Arr.d.ts +0 -19
  194. package/dist/core/src/helpers/Str.d.ts +0 -23
  195. package/dist/core/src/helpers/data.d.ts +0 -25
  196. package/dist/core/src/helpers/errors.d.ts +0 -34
  197. package/dist/core/src/helpers/response.d.ts +0 -41
  198. package/dist/core/src/helpers.d.ts +0 -338
  199. package/dist/core/src/http/CookieJar.d.ts +0 -51
  200. package/dist/core/src/http/cookie.d.ts +0 -29
  201. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  202. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  203. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  204. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  205. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  206. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  207. package/dist/core/src/http/types.d.ts +0 -374
  208. package/dist/core/src/index.d.ts +0 -88
  209. package/dist/core/src/instrumentation/index.d.ts +0 -35
  210. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  211. package/dist/core/src/instrumentation/types.d.ts +0 -182
  212. package/dist/core/src/observability/Metrics.d.ts +0 -244
  213. package/dist/core/src/observability/QueueDashboard.d.ts +0 -136
  214. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -350
  215. package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
  216. package/dist/core/src/reliability/index.d.ts +0 -6
  217. package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
  218. package/dist/core/src/router/RequestValidator.d.ts +0 -20
  219. package/dist/core/src/runtime.d.ts +0 -119
  220. package/dist/core/src/security/Encrypter.d.ts +0 -33
  221. package/dist/core/src/security/Hasher.d.ts +0 -29
  222. package/dist/core/src/testing/HttpTester.d.ts +0 -39
  223. package/dist/core/src/testing/TestResponse.d.ts +0 -78
  224. package/dist/core/src/testing/index.d.ts +0 -2
  225. package/dist/core/src/types/events.d.ts +0 -94
  226. package/dist/echo/src/OrbitEcho.d.ts +0 -115
  227. package/dist/echo/src/index.d.ts +0 -64
  228. package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
  229. package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
  230. package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
  231. package/dist/echo/src/providers/index.d.ts +0 -14
  232. package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
  233. package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
  234. package/dist/echo/src/receive/index.d.ts +0 -2
  235. package/dist/echo/src/resilience/CircuitBreaker.d.ts +0 -117
  236. package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
  237. package/dist/echo/src/send/index.d.ts +0 -1
  238. package/dist/echo/src/types.d.ts +0 -756
  239. package/dist/index.d.ts.map +0 -1
  240. package/dist/monitor/src/MonitorOrbit.d.ts +0 -43
  241. package/dist/monitor/src/config.d.ts +0 -106
  242. package/dist/monitor/src/health/HealthController.d.ts +0 -28
  243. package/dist/monitor/src/health/HealthRegistry.d.ts +0 -80
  244. package/dist/monitor/src/health/index.d.ts +0 -36
  245. package/dist/monitor/src/index.d.ts +0 -13
  246. package/dist/monitor/src/metrics/MetricsController.d.ts +0 -22
  247. package/dist/monitor/src/metrics/MetricsRegistry.d.ts +0 -136
  248. package/dist/monitor/src/metrics/index.d.ts +0 -11
  249. package/dist/monitor/src/tracing/TracingManager.d.ts +0 -97
  250. package/dist/monitor/src/tracing/index.d.ts +0 -10
  251. package/dist/photon/src/index.d.ts +0 -89
  252. package/dist/photon/src/middleware/binary.d.ts +0 -31
  253. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  254. package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
  255. package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
  256. package/dist/photon/src/openapi.d.ts +0 -19
  257. package/dist/providers/GenericProvider.d.ts.map +0 -1
  258. package/dist/providers/GitHubProvider.d.ts.map +0 -1
  259. package/dist/providers/StripeProvider.d.ts.map +0 -1
  260. package/dist/providers/index.d.ts.map +0 -1
  261. package/dist/receive/SignatureValidator.d.ts.map +0 -1
  262. package/dist/receive/WebhookReceiver.d.ts.map +0 -1
  263. package/dist/receive/index.d.ts.map +0 -1
  264. package/dist/send/WebhookDispatcher.d.ts.map +0 -1
  265. package/dist/send/index.d.ts.map +0 -1
  266. package/dist/types.d.ts.map +0 -1
  267. /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
  268. /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
  269. /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
  270. /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
  271. /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
  272. /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
  273. /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
  274. /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
  275. /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
  276. /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
  277. /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
  278. /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
  279. /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
  280. /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
  281. /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
  282. /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
  283. /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
  284. /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
  285. /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
  286. /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
  287. /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
  288. /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
  289. /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
  290. /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
  291. /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
  292. /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
  293. /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
  294. /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
  295. /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
package/dist/types.d.ts CHANGED
@@ -1,144 +1,758 @@
1
+ import type { CircuitBreakerState } from '@gravito/resilience';
2
+ import type { DeadLetterQueue } from './dlq/DeadLetterQueue';
3
+ import type { EchoLogger } from './observability/logging';
4
+ import type { MetricsProvider } from './observability/metrics';
5
+ import type { Tracer } from './observability/tracing';
6
+ import type { WebhookStore } from './storage/WebhookStore';
1
7
  /**
2
- * @fileoverview Core types for @gravito/echo webhook module
3
- * @module @gravito/echo
8
+ * Core types for the Echo module.
9
+ *
10
+ * This module defines the fundamental structures for both receiving and sending webhooks,
11
+ * ensuring a consistent interface across different providers and delivery targets.
12
+ *
13
+ * @packageDocumentation
4
14
  */
5
15
  /**
6
- * Webhook provider configuration
16
+ * Configuration for a specific webhook provider instance.
17
+ *
18
+ * This interface defines the essential security and routing parameters required to
19
+ * authenticate incoming requests from external services. It acts as a contract
20
+ * between the Echo receiver and the specific provider implementation.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const stripeConfig: WebhookProviderConfig = {
25
+ * name: 'stripe_prod',
26
+ * secret: process.env.STRIPE_WEBHOOK_SECRET,
27
+ * signatureHeader: 'stripe-signature',
28
+ * tolerance: 300 // Allow for 5 minutes of clock drift
29
+ * };
30
+ * ```
31
+ *
32
+ * @public
7
33
  */
8
34
  export interface WebhookProviderConfig {
9
- /** Provider name (e.g., 'stripe', 'github', 'generic') */
35
+ /**
36
+ * A unique identifier for this provider configuration instance.
37
+ * This name is used to route incoming requests to the correct security context.
38
+ */
10
39
  name: string;
11
- /** Secret for signature verification */
40
+ /**
41
+ * The cryptographic shared secret used to verify request signatures.
42
+ * Depending on the provider, this might be a signing secret or a client secret.
43
+ */
12
44
  secret: string;
13
- /** Signature header name */
45
+ /**
46
+ * The specific HTTP header name containing the signature.
47
+ * If omitted, the provider's default header (e.g., 'x-hub-signature-256' for GitHub) is used.
48
+ *
49
+ * @example 'x-paddle-signature'
50
+ */
14
51
  signatureHeader?: string;
15
- /** Timestamp validation tolerance in seconds (default: 300) */
52
+ /**
53
+ * The maximum permissible age of a webhook request in seconds.
54
+ * Used to mitigate replay attacks by ensuring the request was recently signed.
55
+ *
56
+ * @defaultValue 300
57
+ */
16
58
  tolerance?: number;
17
59
  }
18
60
  /**
19
- * Result of webhook verification
61
+ * The normalized result of a webhook authenticity and integrity check.
62
+ *
63
+ * This structure encapsulates the outcome of the verification process, providing
64
+ * both the status and the extracted data needed for subsequent processing.
65
+ *
66
+ * @public
20
67
  */
21
68
  export interface WebhookVerificationResult {
22
- /** Whether the webhook is valid */
69
+ /**
70
+ * Indicates whether the cryptographic signature is valid and the request
71
+ * falls within the specified time tolerance window.
72
+ */
23
73
  valid: boolean;
24
- /** Error message if invalid */
74
+ /**
75
+ * A human-readable or machine-parsable explanation of why verification failed.
76
+ * Only populated when `valid` is false.
77
+ */
25
78
  error?: string;
26
- /** Parsed payload */
79
+ /**
80
+ * The parsed JSON payload extracted from the validated request body.
81
+ * Guaranteed to be available and authentic if `valid` is true.
82
+ */
27
83
  payload?: unknown;
28
- /** Event type (if available) */
84
+ /**
85
+ * The semantic category of the event (e.g., 'invoice.created').
86
+ * Inferred by the provider implementation during verification.
87
+ */
29
88
  eventType?: string;
30
- /** Webhook ID (if available) */
89
+ /**
90
+ * The unique ID assigned to this event by the source service.
91
+ * Used for idempotency checks and audit logging.
92
+ */
31
93
  webhookId?: string;
32
94
  }
33
95
  /**
34
- * Webhook provider interface
96
+ * Contract for implementing service-specific webhook verification and parsing.
97
+ *
98
+ * Implementations of this interface handle the low-level, service-specific details
99
+ * of signature algorithms (HMAC, RSA), timestamp header formats, and payload
100
+ * structure for specific providers like Stripe, GitHub, or Shopify.
101
+ *
102
+ * @public
35
103
  */
36
104
  export interface WebhookProvider {
37
- /** Provider name */
105
+ /**
106
+ * The canonical type name of the provider.
107
+ * This name is used to match incoming requests to the correct implementation.
108
+ *
109
+ * @example 'stripe'
110
+ */
38
111
  readonly name: string;
39
112
  /**
40
- * Verify webhook signature
113
+ * Validates the cryptographic integrity and temporal validity of a request.
114
+ *
115
+ * This method must perform signature check and timestamp validation to prevent
116
+ * forgery and replay attacks.
117
+ *
118
+ * @param payload - The exact raw request body as received (crucial for HMAC).
119
+ * @param headers - Complete HTTP headers from the incoming request.
120
+ * @param secret - The configured secret key for the provider instance.
121
+ * @returns A promise resolving to the verification result and parsed payload.
122
+ * @throws {Error} Should only throw for unexpected internal errors, not for invalid signatures.
41
123
  */
42
124
  verify(payload: string | Buffer, headers: Record<string, string | string[] | undefined>, secret: string): Promise<WebhookVerificationResult>;
43
125
  /**
44
- * Parse the event type from payload
126
+ * Identifies the semantic event type from a validated and parsed payload.
127
+ *
128
+ * @param payload - The authentic data object returned by `verify`.
129
+ * @returns The event type string (e.g., 'customer.subscription.deleted') or undefined if unrecognized.
45
130
  */
46
131
  parseEventType?(payload: unknown): string | undefined;
47
132
  }
48
133
  /**
49
- * Webhook event handler
134
+ * A callback function triggered when a valid webhook event is matched and processed.
135
+ *
136
+ * @param event - The normalized and authenticated webhook event object.
137
+ * @public
50
138
  */
51
139
  export type WebhookHandler<T = unknown> = (event: WebhookEvent<T>) => void | Promise<void>;
52
140
  /**
53
- * Webhook event
141
+ * Normalized representation of an authenticated incoming webhook event.
142
+ *
143
+ * Echo transforms diverse provider-specific requests into this standard format,
144
+ * allowing application logic to remain decoupled from the specifics of the source service.
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * const processOrder: WebhookHandler<OrderData> = async (event) => {
149
+ * const { provider, type, payload } = event;
150
+ * console.log(`Processing ${type} from ${provider}`);
151
+ * await updateDatabase(payload.orderId);
152
+ * };
153
+ * ```
154
+ *
155
+ * @public
54
156
  */
55
157
  export interface WebhookEvent<T = unknown> {
56
- /** Provider name */
158
+ /**
159
+ * The name of the provider instance that received and verified this event.
160
+ */
57
161
  provider: string;
58
- /** Event type */
162
+ /**
163
+ * The semantic category of the event (e.g., 'payment.captured').
164
+ */
59
165
  type: string;
60
- /** Event payload */
166
+ /**
167
+ * The parsed and type-safe data payload.
168
+ */
61
169
  payload: T;
62
- /** Raw request headers */
170
+ /**
171
+ * The original HTTP headers received with the request.
172
+ */
63
173
  headers: Record<string, string | string[] | undefined>;
64
- /** Raw body */
174
+ /**
175
+ * The exact raw request body, preserved for audit trails or re-verification.
176
+ */
65
177
  rawBody: string;
66
- /** Timestamp when received */
178
+ /**
179
+ * The high-precision timestamp when the event was successfully processed by Echo.
180
+ */
67
181
  receivedAt: Date;
68
- /** Webhook ID (if available) */
182
+ /**
183
+ * The unique ID assigned by the upstream service for this event.
184
+ */
69
185
  id?: string;
70
186
  }
71
187
  /**
72
- * Outgoing webhook payload
188
+ * A snapshot of a raw HTTP request before body parsing occurs.
189
+ *
190
+ * This is used by middleware to prevent upstream body parsers from modifying the
191
+ * raw request body, which would otherwise invalidate cryptographic signatures.
192
+ *
193
+ * @public
194
+ */
195
+ export interface BufferedRequest {
196
+ /**
197
+ * The exact raw body as received from the socket.
198
+ */
199
+ rawBody: string | Buffer;
200
+ /**
201
+ * A lazily-evaluated parsed version of the body if requested by handlers.
202
+ */
203
+ parsedBody?: unknown;
204
+ /**
205
+ * The original request headers.
206
+ */
207
+ headers: Record<string, string | string[] | undefined>;
208
+ /**
209
+ * The timestamp when the request entered the buffer.
210
+ */
211
+ bufferedAt: Date;
212
+ }
213
+ /**
214
+ * Operational settings for the request buffering mechanism.
215
+ *
216
+ * @public
217
+ */
218
+ export interface RequestBufferConfig {
219
+ /**
220
+ * Whether to activate the buffering middleware.
221
+ * @defaultValue true
222
+ */
223
+ enabled?: boolean;
224
+ /**
225
+ * The maximum size of the request body allowed to be buffered (in bytes).
226
+ * Prevents memory exhaustion attacks.
227
+ * @defaultValue 10485760 (10MB)
228
+ */
229
+ maxBodySize?: number;
230
+ /**
231
+ * List of MIME types that should bypass the buffering logic.
232
+ * Useful for large file uploads or binary streams.
233
+ * @defaultValue ['multipart/form-data', 'application/octet-stream']
234
+ */
235
+ skipContentTypes?: string[];
236
+ }
237
+ /**
238
+ * The current operational state of a circuit breaker.
239
+ * Re-exported from @gravito/resilience (canonical source per D-01).
240
+ *
241
+ * - `CLOSED`: Healthy state, allowing all requests through.
242
+ * - `OPEN`: Failing state, blocking all requests to prevent cascading failure.
243
+ * - `HALF_OPEN`: Recovery state, allowing a limited number of test requests.
244
+ *
245
+ * @public
246
+ */
247
+ export { CircuitBreakerState } from '@gravito/resilience';
248
+ /**
249
+ * Resilience configuration for outgoing webhook delivery.
250
+ *
251
+ * Protects downstream consumers from being overwhelmed during outages and prevents
252
+ * the dispatcher from wasting resources on doomed requests.
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * const cbConfig: CircuitBreakerConfig = {
257
+ * failureThreshold: 10,
258
+ * windowSize: 30000, // 30 seconds
259
+ * openTimeout: 60000 // Stay open for 1 minute
260
+ * };
261
+ * ```
262
+ *
263
+ * @public
264
+ */
265
+ export interface CircuitBreakerConfig {
266
+ /**
267
+ * Whether to enable circuit breaking for the dispatcher.
268
+ * @defaultValue true
269
+ */
270
+ enabled?: boolean;
271
+ /**
272
+ * Number of consecutive failures required to trip the circuit to `OPEN`.
273
+ * @defaultValue 5
274
+ */
275
+ failureThreshold?: number;
276
+ /**
277
+ * Number of consecutive successes required in `HALF_OPEN` to return to `CLOSED`.
278
+ * @defaultValue 2
279
+ */
280
+ successThreshold?: number;
281
+ /**
282
+ * The rolling time window (in ms) within which failures are counted.
283
+ * @defaultValue 60000 (1 minute)
284
+ */
285
+ windowSize?: number;
286
+ /**
287
+ * Duration (in ms) to wait in `OPEN` state before transitioning to `HALF_OPEN`.
288
+ * @defaultValue 30000 (30 seconds)
289
+ */
290
+ openTimeout?: number;
291
+ /**
292
+ * Callback executed when the circuit trips to `OPEN`.
293
+ */
294
+ onOpen?: (target: string) => void;
295
+ /**
296
+ * Callback executed when the circuit enters `HALF_OPEN` state.
297
+ */
298
+ onHalfOpen?: (target: string) => void;
299
+ /**
300
+ * Callback executed when the circuit returns to `CLOSED` state.
301
+ */
302
+ onClose?: (target: string) => void;
303
+ }
304
+ /**
305
+ * Real-time operational metrics for a specific circuit breaker instance.
306
+ *
307
+ * Provides visibility into the health and traffic patterns of a downstream
308
+ * webhook target.
309
+ *
310
+ * @public
311
+ */
312
+ export interface CircuitBreakerMetrics {
313
+ /**
314
+ * The current state of the circuit (CLOSED, OPEN, or HALF_OPEN).
315
+ */
316
+ state: CircuitBreakerState;
317
+ /**
318
+ * The total number of failed requests recorded within the current time window.
319
+ */
320
+ failures: number;
321
+ /**
322
+ * The total number of successful requests recorded within the current time window.
323
+ */
324
+ successes: number;
325
+ /**
326
+ * The exact time when the most recent failure occurred.
327
+ */
328
+ lastFailureAt?: Date;
329
+ /**
330
+ * The exact time when the most recent success occurred.
331
+ */
332
+ lastSuccessAt?: Date;
333
+ /**
334
+ * If the circuit is currently `OPEN`, this is the timestamp when it tripped.
335
+ */
336
+ openedAt?: Date;
337
+ }
338
+ /**
339
+ * Metadata and value for a single version of a provider's secret key.
340
+ *
341
+ * Echo supports multiple concurrent keys per provider to facilitate zero-downtime
342
+ * key rotation. The receiver will attempt verification with all active keys.
343
+ *
344
+ * @public
345
+ */
346
+ export interface ProviderKeyEntry {
347
+ /**
348
+ * The raw cryptographic secret key value.
349
+ */
350
+ key: string;
351
+ /**
352
+ * The timestamp when this key becomes eligible for use in verification.
353
+ */
354
+ activeFrom: Date;
355
+ /**
356
+ * The timestamp when this key should no longer be used.
357
+ * If omitted, the key remains valid indefinitely until manually removed.
358
+ */
359
+ expiresAt?: Date;
360
+ /**
361
+ * Whether this key is the primary (current) secret.
362
+ * New configurations or rotations should generally promote a new key to primary.
363
+ */
364
+ isPrimary: boolean;
365
+ /**
366
+ * A unique identifier for this key version (e.g., a timestamp or serial).
367
+ */
368
+ version: string;
369
+ }
370
+ /**
371
+ * Policy settings for managing the lifecycle of webhook secrets.
372
+ *
373
+ * Key rotation allows you to replace compromised or aging secrets without
374
+ * dropping incoming webhooks from services that may still be using the old key.
375
+ *
376
+ * @public
377
+ */
378
+ export interface KeyRotationConfig {
379
+ /**
380
+ * Whether to enable the multi-key verification logic and rotation manager.
381
+ * @defaultValue false
382
+ */
383
+ enabled?: boolean;
384
+ /**
385
+ * Automatically purge keys that have passed their `expiresAt` date.
386
+ * @defaultValue true
387
+ */
388
+ autoCleanup?: boolean;
389
+ /**
390
+ * The duration (in ms) to keep an old key active after a new primary key is promoted.
391
+ * Prevents race conditions during the propagation of the new secret.
392
+ * @defaultValue 86400000 (24 hours)
393
+ */
394
+ gracePeriod?: number;
395
+ /**
396
+ * An optional asynchronous function to fetch keys from an external vault (e.g., AWS Secrets Manager).
397
+ */
398
+ keyProvider?: (providerName: string) => Promise<ProviderKeyEntry[]>;
399
+ /**
400
+ * Callback executed whenever a new key is successfully rotated.
401
+ */
402
+ onRotate?: (providerName: string, newKey: ProviderKeyEntry) => void;
403
+ }
404
+ /**
405
+ * Configuration for a provider that includes advanced key rotation settings.
406
+ *
407
+ * Extends the basic provider configuration with a list of historical and future keys.
408
+ *
409
+ * @public
410
+ */
411
+ export interface WebhookProviderConfigWithRotation extends WebhookProviderConfig {
412
+ /**
413
+ * Collection of valid keys for this provider.
414
+ */
415
+ keys?: ProviderKeyEntry[];
416
+ /**
417
+ * Specific rotation overrides for this provider.
418
+ */
419
+ rotation?: KeyRotationConfig;
420
+ }
421
+ /**
422
+ * Structure representing an intent to dispatch a webhook to an external target.
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const payload: WebhookPayload = {
427
+ * url: 'https://customer-api.com/hooks',
428
+ * event: 'order.shipped',
429
+ * data: { trackingNumber: 'XYZ123' },
430
+ * timestamp: new Date()
431
+ * };
432
+ * ```
433
+ *
434
+ * @public
73
435
  */
74
436
  export interface WebhookPayload<T = unknown> {
75
- /** Target URL */
437
+ /**
438
+ * The fully-qualified destination URL for the HTTP POST request.
439
+ */
76
440
  url: string;
77
- /** Event type */
441
+ /**
442
+ * The semantic name of the event being broadcast.
443
+ */
78
444
  event: string;
79
- /** Payload data */
445
+ /**
446
+ * The data payload to be serialized as JSON in the request body.
447
+ */
80
448
  data: T;
81
- /** Optional webhook ID */
449
+ /**
450
+ * An optional unique ID for this specific delivery attempt (for idempotency).
451
+ */
82
452
  id?: string;
83
- /** Optional timestamp */
453
+ /**
454
+ * The timestamp when the underlying event actually occurred.
455
+ */
84
456
  timestamp?: Date;
85
457
  }
86
458
  /**
87
- * Webhook delivery result
459
+ * Detailed outcome of a single webhook delivery attempt.
460
+ *
461
+ * @public
88
462
  */
89
463
  export interface WebhookDeliveryResult {
90
- /** Whether delivery was successful */
464
+ /**
465
+ * True if the destination server returned a success status code (2xx).
466
+ */
91
467
  success: boolean;
92
- /** HTTP status code */
468
+ /**
469
+ * The numeric HTTP status code returned by the target server.
470
+ */
93
471
  statusCode?: number;
94
- /** Response body */
472
+ /**
473
+ * The raw response body returned by the target server.
474
+ */
95
475
  body?: string;
96
- /** Error message if failed */
476
+ /**
477
+ * A descriptive error message if the network request or server returned an error.
478
+ */
97
479
  error?: string;
98
- /** Attempt number */
480
+ /**
481
+ * The sequence number of this delivery attempt (starts at 1).
482
+ */
99
483
  attempt: number;
100
- /** Time taken in ms */
484
+ /**
485
+ * Total wall-clock time taken for the HTTP request in milliseconds.
486
+ */
101
487
  duration: number;
102
- /** Timestamp */
488
+ /**
489
+ * The exact timestamp when this delivery result was recorded.
490
+ */
103
491
  deliveredAt: Date;
104
492
  }
105
493
  /**
106
- * Retry strategy configuration
494
+ * Strategy settings for handling failed delivery attempts with exponential backoff.
495
+ *
496
+ * @public
107
497
  */
108
498
  export interface RetryConfig {
109
- /** Maximum retry attempts (default: 3) */
499
+ /**
500
+ * Maximum number of times to try delivering the webhook before giving up.
501
+ * @defaultValue 3
502
+ */
110
503
  maxAttempts?: number;
111
- /** Initial delay in ms (default: 1000) */
504
+ /**
505
+ * Initial delay (in ms) before the first retry attempt.
506
+ * @defaultValue 1000
507
+ */
112
508
  initialDelay?: number;
113
- /** Backoff multiplier (default: 2) */
509
+ /**
510
+ * The factor by which the delay increases after each failed attempt.
511
+ * @defaultValue 2
512
+ */
114
513
  backoffMultiplier?: number;
115
- /** Maximum delay in ms (default: 300000 = 5 minutes) */
514
+ /**
515
+ * The absolute maximum delay (in ms) between retry attempts.
516
+ * @defaultValue 300000 (5 minutes)
517
+ */
116
518
  maxDelay?: number;
117
- /** HTTP status codes to retry (default: [408, 429, 500, 502, 503, 504]) */
519
+ /**
520
+ * List of HTTP status codes that should trigger a retry attempt.
521
+ * Codes not in this list (like 400 Bad Request) are considered terminal failures.
522
+ *
523
+ * @example [500, 502, 503, 504, 429]
524
+ */
118
525
  retryableStatuses?: number[];
119
526
  }
120
527
  /**
121
- * Webhook dispatcher configuration
528
+ * Security and policy configuration for the outgoing webhook dispatcher.
529
+ *
530
+ * Use this interface to define how your application signs and delivers events
531
+ * to external consumers, ensuring both reliability and authenticity.
532
+ *
533
+ * @public
122
534
  */
123
535
  export interface WebhookDispatcherConfig {
124
- /** Secret for signing outgoing webhooks */
536
+ /**
537
+ * Global secret key used to sign all outgoing webhook payloads.
538
+ * Consumers use this to verify the request originated from your application.
539
+ */
125
540
  secret: string;
126
- /** Retry configuration */
541
+ /**
542
+ * Custom retry policy for handling transient delivery failures.
543
+ */
127
544
  retry?: RetryConfig;
128
- /** Request timeout in ms (default: 30000) */
545
+ /**
546
+ * The maximum time (in ms) to wait for the target server to respond.
547
+ * @defaultValue 30000
548
+ */
129
549
  timeout?: number;
130
- /** User agent string */
550
+ /**
551
+ * Custom string sent in the `User-Agent` HTTP header.
552
+ */
131
553
  userAgent?: string;
554
+ /**
555
+ * Operational settings for the circuit breaker mechanism.
556
+ * @since v1.1
557
+ */
558
+ circuitBreaker?: CircuitBreakerConfig;
559
+ }
560
+ /**
561
+ * Execution parameters for parallel or high-volume webhook dispatch operations.
562
+ *
563
+ * @public
564
+ */
565
+ export interface BatchDispatchOptions {
566
+ /**
567
+ * The maximum number of requests to execute simultaneously.
568
+ * Balancing performance vs. source/target rate limits.
569
+ * @defaultValue 5
570
+ */
571
+ concurrency?: number;
572
+ /**
573
+ * If true, the batch process will abort immediately if any single delivery fails.
574
+ * @defaultValue false
575
+ */
576
+ stopOnFirstFailure?: boolean;
132
577
  }
133
578
  /**
134
- * OrbitEcho module configuration
579
+ * Detailed report of a batch dispatch operation's success and failure rates.
580
+ *
581
+ * @public
582
+ */
583
+ export interface BatchDispatchResult {
584
+ /**
585
+ * The total number of webhook payloads processed in this batch.
586
+ */
587
+ total: number;
588
+ /**
589
+ * Number of payloads that were successfully delivered (HTTP 2xx).
590
+ */
591
+ succeeded: number;
592
+ /**
593
+ * Number of payloads that failed delivery after all retries.
594
+ */
595
+ failed: number;
596
+ /**
597
+ * Individual delivery results mapped to their corresponding payloads.
598
+ */
599
+ results: Array<{
600
+ payload: WebhookPayload;
601
+ result: WebhookDeliveryResult;
602
+ }>;
603
+ }
604
+ /**
605
+ * Filter and execution parameters for replaying historical webhook events.
606
+ *
607
+ * Replay is useful for testing, recovery from consumer outages, or
608
+ * synchronizing data after a code update.
609
+ *
610
+ * @public
611
+ */
612
+ export interface ReplayOptions {
613
+ /**
614
+ * Specific event IDs to re-send. If provided, other filters are ignored.
615
+ */
616
+ eventIds?: string[];
617
+ /**
618
+ * Temporal range for selecting events from storage.
619
+ */
620
+ timeRange?: {
621
+ from: Date;
622
+ to: Date;
623
+ };
624
+ /**
625
+ * Limit replay to a specific provider instance.
626
+ */
627
+ provider?: string;
628
+ /**
629
+ * Limit replay to a specific semantic event type.
630
+ */
631
+ eventType?: string;
632
+ /**
633
+ * If true, logs the actions without actually sending any network requests.
634
+ */
635
+ dryRun?: boolean;
636
+ /**
637
+ * Redirect the replayed events to a different URL instead of the original one.
638
+ */
639
+ targetUrl?: string;
640
+ }
641
+ /**
642
+ * Summary outcome of a mass event replay operation.
643
+ *
644
+ * @public
645
+ */
646
+ export interface ReplayResult {
647
+ /**
648
+ * Total number of events matching the replay filters.
649
+ */
650
+ total: number;
651
+ /**
652
+ * Number of events that were successfully re-dispatched.
653
+ */
654
+ replayed: number;
655
+ /**
656
+ * Number of events that were intentionally skipped (e.g., due to duplicate filters).
657
+ */
658
+ skipped: number;
659
+ /**
660
+ * Number of events that encountered errors during the replay attempt.
661
+ */
662
+ failed: number;
663
+ /**
664
+ * Detailed audit log for each event considered in the replay.
665
+ */
666
+ events: Array<{
667
+ eventId: string;
668
+ status: 'replayed' | 'skipped' | 'failed';
669
+ result?: WebhookDeliveryResult;
670
+ error?: string;
671
+ }>;
672
+ }
673
+ /**
674
+ * Integration points for external monitoring and diagnostic tools.
675
+ *
676
+ * Echo is designed to be fully observable, allowing you to plug in
677
+ * Prometheus, OpenTelemetry, or custom logging solutions.
678
+ *
679
+ * @public
680
+ */
681
+ export interface EchoObservabilityConfig {
682
+ /**
683
+ * Provider for collecting counters, histograms, and health metrics.
684
+ */
685
+ metrics?: MetricsProvider;
686
+ /**
687
+ * Distributed tracer for tracking the full lifecycle of a webhook request.
688
+ */
689
+ tracer?: Tracer;
690
+ /**
691
+ * Logger for recording security events and operational warnings.
692
+ */
693
+ logger?: EchoLogger;
694
+ }
695
+ /**
696
+ * The root configuration object for the OrbitEcho module.
697
+ *
698
+ * This structure defines the entire security, reliability, and persistence
699
+ * architecture for webhooks within a Gravito application.
700
+ *
701
+ * @example
702
+ * ```typescript
703
+ * const echoConfig: EchoConfig = {
704
+ * providers: {
705
+ * stripe: { name: 'stripe', secret: 'whsec_...' }
706
+ * },
707
+ * dispatcher: {
708
+ * secret: 'my-app-outbound-secret',
709
+ * retry: { maxAttempts: 5 }
710
+ * },
711
+ * store: new MyDatabaseStore(),
712
+ * basePath: '/v1/webhooks'
713
+ * };
714
+ * ```
715
+ *
716
+ * @public
135
717
  */
136
718
  export interface EchoConfig {
137
- /** Registered webhook providers */
138
- providers?: Record<string, WebhookProviderConfig>;
139
- /** Dispatcher configuration for outgoing webhooks */
719
+ /**
720
+ * A registry of named provider configurations for authenticating incoming events.
721
+ */
722
+ providers?: Record<string, WebhookProviderConfig | WebhookProviderConfigWithRotation>;
723
+ /**
724
+ * Settings for signing and reliably delivering outgoing webhooks.
725
+ */
140
726
  dispatcher?: WebhookDispatcherConfig;
141
- /** Base path for webhook endpoints (default: '/webhooks') */
727
+ /**
728
+ * The root URL path where Echo will mount its internal webhook handlers.
729
+ * @defaultValue '/webhooks'
730
+ */
142
731
  basePath?: string;
732
+ /**
733
+ * The persistence engine used for auditing, idempotency, and replay.
734
+ */
735
+ store?: WebhookStore;
736
+ /**
737
+ * The queue implementation for handling permanently failed events.
738
+ */
739
+ deadLetterQueue?: DeadLetterQueue;
740
+ /**
741
+ * Default performance and concurrency settings for bulk operations.
742
+ */
743
+ batch?: BatchDispatchOptions;
744
+ /**
745
+ * Settings for metrics, tracing, and logging.
746
+ */
747
+ observability?: EchoObservabilityConfig;
748
+ /**
749
+ * Advanced middleware settings for body preservation and integrity.
750
+ * @since 1.1.0
751
+ */
752
+ requestBuffer?: RequestBufferConfig;
753
+ /**
754
+ * Central policy settings for dynamic secret lifecycle management.
755
+ * @since 1.2.0
756
+ */
757
+ keyRotation?: KeyRotationConfig;
143
758
  }
144
- //# sourceMappingURL=types.d.ts.map