@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
@@ -1,119 +0,0 @@
1
- /**
2
- * Detected Javascript Runtime Environment
3
- * @public
4
- */
5
- export type RuntimeKind = 'bun' | 'node' | 'deno' | 'unknown';
6
- /**
7
- * Options for spawning subprocesses
8
- * @public
9
- */
10
- export interface RuntimeSpawnOptions {
11
- cwd?: string;
12
- env?: Record<string, string | undefined>;
13
- stdin?: 'pipe' | 'inherit' | 'ignore';
14
- stdout?: 'pipe' | 'inherit' | 'ignore';
15
- stderr?: 'pipe' | 'inherit' | 'ignore';
16
- }
17
- /**
18
- * Abstract subprocess interface
19
- * @public
20
- */
21
- export interface RuntimeProcess {
22
- exited: Promise<number>;
23
- stdout?: ReadableStream<Uint8Array> | null;
24
- stderr?: ReadableStream<Uint8Array> | null;
25
- kill?: (signal?: string | number) => void;
26
- }
27
- /**
28
- * File statistics abstraction
29
- * @public
30
- */
31
- export interface RuntimeFileStat {
32
- size: number;
33
- }
34
- /**
35
- * HTTP Server configuration
36
- * @public
37
- */
38
- export interface RuntimeServeConfig {
39
- port?: number;
40
- fetch: (req: Request, server?: unknown) => Response | Promise<Response>;
41
- websocket?: unknown;
42
- }
43
- /**
44
- * HTTP Server interface
45
- * @public
46
- */
47
- export interface RuntimeServer {
48
- stop?: () => void;
49
- }
50
- /**
51
- * Abstraction layer for filesystem and process operations across runtimes.
52
- * @public
53
- */
54
- export interface RuntimeAdapter {
55
- kind: RuntimeKind;
56
- spawn(command: string[], options?: RuntimeSpawnOptions): RuntimeProcess;
57
- writeFile(path: string, data: Blob | Buffer | string | ArrayBuffer | Uint8Array): Promise<void>;
58
- readFile(path: string): Promise<Uint8Array>;
59
- readFileAsBlob(path: string): Promise<Blob>;
60
- exists(path: string): Promise<boolean>;
61
- stat(path: string): Promise<RuntimeFileStat>;
62
- deleteFile(path: string): Promise<void>;
63
- serve(config: RuntimeServeConfig): RuntimeServer;
64
- }
65
- /**
66
- * Abstraction layer for password hashing
67
- * @public
68
- */
69
- export interface RuntimePasswordAdapter {
70
- hash(value: string, options: {
71
- algorithm: 'bcrypt';
72
- cost?: number;
73
- } | {
74
- algorithm: 'argon2id';
75
- memoryCost?: number;
76
- timeCost?: number;
77
- parallelism?: number;
78
- }): Promise<string>;
79
- verify(value: string, hashed: string): Promise<boolean>;
80
- }
81
- /**
82
- * SQLite Statement abstraction
83
- * @public
84
- */
85
- export interface RuntimeSqliteStatement {
86
- run(params?: Record<string, unknown>): void;
87
- get(params?: Record<string, unknown>): unknown;
88
- all(params?: Record<string, unknown>): unknown[];
89
- }
90
- /**
91
- * SQLite Database abstraction
92
- * @public
93
- */
94
- export interface RuntimeSqliteDatabase {
95
- run(sql: string): void;
96
- prepare(sql: string): RuntimeSqliteStatement;
97
- query(sql: string): RuntimeSqliteStatement;
98
- close(): void;
99
- }
100
- /**
101
- * Get environment variables from the current runtime.
102
- * @public
103
- */
104
- export declare const getRuntimeEnv: () => Record<string, string | undefined>;
105
- /**
106
- * Get the runtime abstraction adapter (Bun/Node/Deno).
107
- * @public
108
- */
109
- export declare const getRuntimeAdapter: () => RuntimeAdapter;
110
- /**
111
- * Get the password hashing adapter using native optimized implementations if available.
112
- * @public
113
- */
114
- export declare const getPasswordAdapter: () => RuntimePasswordAdapter;
115
- /**
116
- * Create a SQLite database connection using runtime-native drivers.
117
- * @public
118
- */
119
- export declare const createSqliteDatabase: (path: string) => Promise<RuntimeSqliteDatabase>;
@@ -1,33 +0,0 @@
1
- /**
2
- * Options for the Encrypter class.
3
- * @public
4
- */
5
- export interface EncrypterOptions {
6
- key: string;
7
- cipher?: string;
8
- }
9
- /**
10
- * Service for OpenSSL encryption/decryption.
11
- * Compatible with Laravel's encryption format.
12
- * @public
13
- */
14
- export declare class Encrypter {
15
- private algorithm;
16
- private key;
17
- constructor(options: EncrypterOptions);
18
- /**
19
- * Encrypt a value
20
- */
21
- encrypt(value: unknown, serialize?: boolean): string;
22
- /**
23
- * Decrypt a value
24
- */
25
- decrypt(payload: string, deserialize?: boolean): unknown;
26
- private hash;
27
- private validPayload;
28
- private validMac;
29
- /**
30
- * Generate a new key
31
- */
32
- static generateKey(cipher?: string): string;
33
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Hashing interface
3
- */
4
- export interface Hasher {
5
- /**
6
- * Hash the given value
7
- */
8
- make(value: string, options?: Record<string, unknown>): Promise<string>;
9
- /**
10
- * Check the given plain value against a hash
11
- */
12
- check(value: string, hashedValue: string): Promise<boolean>;
13
- /**
14
- * Check if the given hash has been hashed using the given options
15
- */
16
- needsRehash(hashedValue: string, options?: Record<string, unknown>): boolean;
17
- }
18
- /**
19
- * Bun Hasher
20
- * Uses Bun's native password hashing (bcrypt by default)
21
- */
22
- export declare class BunHasher implements Hasher {
23
- make(value: string, options?: {
24
- algorithm?: 'bcrypt' | 'argon2id';
25
- cost?: number;
26
- }): Promise<string>;
27
- check(value: string, hashedValue: string): Promise<boolean>;
28
- needsRehash(_hashedValue: string, _options?: Record<string, unknown>): boolean;
29
- }
@@ -1,39 +0,0 @@
1
- import type { PlanetCore } from '../PlanetCore';
2
- import { TestResponse } from './TestResponse';
3
- /**
4
- * HttpTester provides a way to simulate HTTP requests against a PlanetCore instance
5
- * and returns a TestResponse for assertions.
6
- */
7
- export declare class HttpTester {
8
- private core;
9
- private cookies;
10
- constructor(core: PlanetCore);
11
- /**
12
- * Make a GET request
13
- */
14
- get(uri: string, headers?: Record<string, string>): Promise<TestResponse>;
15
- /**
16
- * Make a POST request
17
- */
18
- post(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
19
- /**
20
- * Make a PUT request
21
- */
22
- put(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
23
- /**
24
- * Make a PATCH request
25
- */
26
- patch(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
27
- /**
28
- * Make a DELETE request
29
- */
30
- delete(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
31
- /**
32
- * Core call method
33
- */
34
- private call;
35
- }
36
- /**
37
- * Helper to create an HttpTester for a PlanetCore instance
38
- */
39
- export declare function createHttpTester(core: PlanetCore): HttpTester;
@@ -1,78 +0,0 @@
1
- /**
2
- * TestResponse wraps a standard Fetch Response and provides fluent assertion methods
3
- * inspired by Laravel's TestResponse.
4
- */
5
- export declare class TestResponse {
6
- readonly response: Response;
7
- private _jsonData;
8
- private _textData;
9
- constructor(response: Response);
10
- /**
11
- * Assert the response status code
12
- */
13
- assertStatus(status: number): this;
14
- /**
15
- * Assert that the response has a 200 status code
16
- */
17
- assertOk(): this;
18
- /**
19
- * Assert that the response has a 201 status code
20
- */
21
- assertCreated(): this;
22
- /**
23
- * Assert that the response has a 404 status code
24
- */
25
- assertNotFound(): this;
26
- /**
27
- * Assert that the response has a 403 status code
28
- */
29
- assertForbidden(): this;
30
- /**
31
- * Assert that the response has a 401 status code
32
- */
33
- assertUnauthorized(): this;
34
- /**
35
- * Assert the response is a redirect
36
- */
37
- assertRedirect(uri?: string): this;
38
- /**
39
- * Assert that the response contains the given JSON data.
40
- */
41
- assertJson(data: any): Promise<this>;
42
- /**
43
- * Assert that the response contains exactly the given JSON data.
44
- */
45
- assertExactJson(data: any): Promise<this>;
46
- /**
47
- * Assert the structure of the JSON response.
48
- */
49
- assertJsonStructure(structure: any): Promise<this>;
50
- /**
51
- * Assert that the response contains the given string.
52
- */
53
- assertSee(value: string): Promise<this>;
54
- /**
55
- * Assert that the response does not contain the given string.
56
- */
57
- assertDontSee(value: string): Promise<this>;
58
- /**
59
- * Assert a header exists and matches value
60
- */
61
- assertHeader(header: string, value: string): this;
62
- /**
63
- * Assert a header does not exist
64
- */
65
- assertHeaderMissing(header: string): this;
66
- /**
67
- * Get the JSON content
68
- */
69
- getJson(): Promise<any>;
70
- /**
71
- * Get the text content
72
- */
73
- getText(): Promise<string>;
74
- /**
75
- * Alias for getText for standard expectations if needed
76
- */
77
- get body(): Promise<string>;
78
- }
@@ -1,2 +0,0 @@
1
- export * from './HttpTester';
2
- export * from './TestResponse';
@@ -1,94 +0,0 @@
1
- /**
2
- * Event system type definitions.
3
- */
4
- /**
5
- * Listener interface.
6
- *
7
- * All event listeners must implement this interface.
8
- */
9
- export interface Listener<TEvent extends Event = Event> {
10
- /**
11
- * Handle an event.
12
- * @param event - Event instance
13
- */
14
- handle(event: TEvent): Promise<void> | void;
15
- }
16
- /**
17
- * Marker interface for listeners that should be queued.
18
- *
19
- * Listeners implementing this interface can be dispatched asynchronously via a queue.
20
- */
21
- export interface ShouldQueue {
22
- /**
23
- * Queue name (optional).
24
- */
25
- queue?: string;
26
- /**
27
- * Connection name (optional).
28
- */
29
- connection?: string;
30
- /**
31
- * Delay before execution (seconds).
32
- */
33
- delay?: number;
34
- }
35
- /**
36
- * Marker interface for events that should be broadcast.
37
- *
38
- * Events implementing this interface can be automatically broadcast to clients.
39
- */
40
- export interface ShouldBroadcast {
41
- /**
42
- * Define the broadcast channel.
43
- * @returns Channel name or channel object
44
- */
45
- broadcastOn(): string | Channel;
46
- /**
47
- * Define broadcast payload (optional).
48
- * If omitted, public event properties will be used.
49
- * @returns Broadcast payload
50
- */
51
- broadcastWith?(): Record<string, unknown>;
52
- /**
53
- * Define the broadcast event name (optional).
54
- * If omitted, the event class name will be used.
55
- * @returns Event name
56
- */
57
- broadcastAs?(): string;
58
- }
59
- /**
60
- * Channel interface.
61
- */
62
- export interface Channel {
63
- /**
64
- * Channel name.
65
- */
66
- name: string;
67
- /**
68
- * Channel type.
69
- */
70
- type: 'public' | 'private' | 'presence';
71
- }
72
- /**
73
- * Base event class.
74
- *
75
- * All events should extend this class.
76
- */
77
- export declare abstract class Event {
78
- /**
79
- * Whether this event should be broadcast.
80
- */
81
- shouldBroadcast(): boolean;
82
- /**
83
- * Get broadcast channel.
84
- */
85
- getBroadcastChannel(): string | Channel | null;
86
- /**
87
- * Get broadcast payload.
88
- */
89
- getBroadcastData(): Record<string, unknown>;
90
- /**
91
- * Get broadcast event name.
92
- */
93
- getBroadcastEventName(): string;
94
- }
@@ -1,115 +0,0 @@
1
- import type { GravitoOrbit, PlanetCore } from '@gravito/core';
2
- import { WebhookReceiver } from './receive/WebhookReceiver';
3
- import { KeyRotationManager } from './rotation/KeyRotationManager';
4
- import { WebhookDispatcher } from './send/WebhookDispatcher';
5
- import type { EchoConfig, ProviderKeyEntry } from './types';
6
- /**
7
- * OrbitEcho is the official webhook orchestration module for the Gravito ecosystem.
8
- *
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.
13
- *
14
- * @example Basic integration with PlanetCore
15
- * ```typescript
16
- * import { PlanetCore } from '@gravito/core';
17
- * import { OrbitEcho } from '@gravito/echo';
18
- *
19
- * const core = new PlanetCore();
20
- * const echo = new OrbitEcho({
21
- * providers: {
22
- * stripe: { name: 'stripe', secret: process.env.STRIPE_SECRET }
23
- * },
24
- * dispatcher: {
25
- * secret: process.env.APP_WEBHOOK_SECRET
26
- * }
27
- * });
28
- *
29
- * core.install(echo);
30
- * ```
31
- *
32
- * @public
33
- */
34
- export declare class OrbitEcho implements GravitoOrbit {
35
- private receiver;
36
- private dispatcher?;
37
- private echoConfig;
38
- private keyRotationManager?;
39
- /**
40
- * Constructs a new OrbitEcho instance with the specified configuration.
41
- *
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.
47
- */
48
- constructor(config?: EchoConfig);
49
- /**
50
- * Integrates the Echo module into the Gravito application lifecycle.
51
- *
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.
56
- *
57
- * @param core - The PlanetCore instance managing the application.
58
- * @throws {Error} If the core adapter is missing or improperly configured.
59
- */
60
- install(core: PlanetCore): void;
61
- /**
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.
66
- *
67
- * @returns The active WebhookReceiver instance.
68
- */
69
- getReceiver(): WebhookReceiver;
70
- /**
71
- * Retrieves the dispatcher instance for sending outgoing webhooks.
72
- *
73
- * @returns The configured WebhookDispatcher, or undefined if dispatch is disabled.
74
- */
75
- getDispatcher(): WebhookDispatcher | undefined;
76
- /**
77
- * Accesses the active configuration used by this OrbitEcho instance.
78
- *
79
- * @returns The immutable EchoConfig object.
80
- */
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
- }
115
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * @fileoverview \@gravito/echo - Enterprise Webhook Orchestration
3
- *
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.
8
- *
9
- * @example Receiving webhooks from Stripe
10
- * ```typescript
11
- * import { OrbitEcho, WebhookReceiver } from '@gravito/echo'
12
- *
13
- * const core = new PlanetCore()
14
- * core.install(new OrbitEcho({
15
- * providers: {
16
- * stripe: { name: 'stripe', secret: process.env.STRIPE_SECRET! }
17
- * }
18
- * }))
19
- *
20
- * const receiver = core.container.make<WebhookReceiver>('echo.receiver')
21
- * receiver.on('stripe', 'payment_intent.succeeded', async (event) => {
22
- * // Securely process validated payment
23
- * })
24
- * ```
25
- *
26
- * @example Dispatching reliable outgoing webhooks
27
- * ```typescript
28
- * import { WebhookDispatcher } from '@gravito/echo'
29
- *
30
- * const dispatcher = new WebhookDispatcher({ secret: 'app-secret' })
31
- * await dispatcher.dispatch({
32
- * url: 'https://consumer.com/hook',
33
- * event: 'order.created',
34
- * data: { id: 123 }
35
- * })
36
- * ```
37
- *
38
- * @module @gravito/echo
39
- */
40
- export type { DeadLetterEvent, DeadLetterQueue } from './dlq/DeadLetterQueue';
41
- export { MemoryDeadLetterQueue } from './dlq/MemoryDeadLetterQueue';
42
- export { createRequestBufferMiddleware, RequestBufferMiddleware } from './middleware';
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';
51
- export { GenericProvider } from './providers/GenericProvider';
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';
57
- export { StripeProvider } from './providers/StripeProvider';
58
- export { TwilioProvider } from './providers/TwilioProvider';
59
- export { computeHmacSha1, computeHmacSha256, parseStripeSignature, timingSafeEqual, validateTimestamp, } from './receive/SignatureValidator';
60
- export { WebhookReceiver } from './receive/WebhookReceiver';
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';
@@ -1,53 +0,0 @@
1
- /**
2
- * Generic webhook provider.
3
- * @module @gravito/echo/providers
4
- */
5
- import type { WebhookVerificationResult } from '../types';
6
- import { BaseProvider, type ProviderOptions } from './base/BaseProvider';
7
- /**
8
- * Configuration options for the generic provider.
9
- */
10
- export interface GenericProviderOptions extends ProviderOptions {
11
- /**
12
- * Custom header name for the signature.
13
- * @defaultValue 'x-webhook-signature'
14
- */
15
- signatureHeader?: string;
16
- /**
17
- * Custom header name for the timestamp.
18
- * @defaultValue 'x-webhook-timestamp'
19
- */
20
- timestampHeader?: string;
21
- }
22
- /**
23
- * Generic webhook provider using HMAC-SHA256 for signature verification.
24
- *
25
- * Expected headers:
26
- * - X-Webhook-Signature: HMAC-SHA256 hex signature.
27
- * - X-Webhook-Timestamp: Unix timestamp (optional, used for replay protection).
28
- *
29
- * @example
30
- * ```typescript
31
- * const provider = new GenericProvider({
32
- * signatureHeader: 'X-Custom-Sig',
33
- * tolerance: 600
34
- * });
35
- * const result = await provider.verify(body, headers, secret);
36
- * ```
37
- */
38
- export declare class GenericProvider extends BaseProvider {
39
- readonly name = "generic";
40
- private signatureHeader;
41
- private timestampHeader;
42
- constructor(options?: GenericProviderOptions);
43
- /**
44
- * Verifies the webhook using HMAC-SHA256.
45
- *
46
- * @param payload - Raw request body.
47
- * @param headers - Request headers.
48
- * @param secret - Secret key for HMAC computation.
49
- * @returns Verification result.
50
- * @throws Error if signature computation fails.
51
- */
52
- verify(payload: string | Buffer, headers: Record<string, string | string[] | undefined>, secret: string): Promise<WebhookVerificationResult>;
53
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * GitHub webhook provider.
3
- * @module @gravito/echo/providers
4
- */
5
- import type { WebhookVerificationResult } from '../types';
6
- import { BaseProvider } from './base/BaseProvider';
7
- /**
8
- * GitHub webhook provider.
9
- *
10
- * Verifies GitHub webhook signatures using the `X-Hub-Signature-256` header.
11
- * @see {@link https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries | GitHub Webhook Validation}
12
- *
13
- * @example
14
- * ```typescript
15
- * const provider = new GitHubProvider();
16
- * const result = await provider.verify(body, headers, process.env.GITHUB_WEBHOOK_SECRET);
17
- * ```
18
- */
19
- export declare class GitHubProvider extends BaseProvider {
20
- readonly name = "github";
21
- /**
22
- * Verifies the GitHub webhook signature.
23
- *
24
- * @param payload - Raw request body.
25
- * @param headers - Request headers.
26
- * @param secret - GitHub webhook secret.
27
- * @returns Verification result.
28
- * @throws Error if signature computation fails.
29
- */
30
- verify(payload: string | Buffer, headers: Record<string, string | string[] | undefined>, secret: string): Promise<WebhookVerificationResult>;
31
- /**
32
- * Extracts the action from the GitHub payload if available.
33
- */
34
- parseEventType(payload: unknown): string | undefined;
35
- }