@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/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@gravito/echo",
3
- "version": "3.1.1",
3
+ "sideEffects": false,
4
+ "version": "3.1.2",
4
5
  "description": "Enterprise-grade webhook handling for Gravito. Secure receiving and reliable sending.",
5
6
  "type": "module",
6
7
  "main": "./dist/index.cjs",
@@ -19,6 +20,7 @@
19
20
  ],
20
21
  "scripts": {
21
22
  "build": "bun run build.ts",
23
+ "build:dts": "bun run build.ts --dts-only",
22
24
  "test": "bun test --timeout=10000",
23
25
  "test:unit": "bun test tests/unit",
24
26
  "test:integration": "test $(find tests -name '*.integration.test.ts' 2>/dev/null | wc -l) -gt 0 && find tests -name '*.integration.test.ts' -print0 | xargs -0 bun test --timeout=10000 || echo 'No integration tests found'",
@@ -43,9 +45,10 @@
43
45
  },
44
46
  "homepage": "https://github.com/gravito-framework/gravito#readme",
45
47
  "peerDependencies": {
46
- "@gravito/core": "^1.6.1"
48
+ "@gravito/core": "^2.0.0"
47
49
  },
48
50
  "devDependencies": {
51
+ "@gravito/core": "workspace:*",
49
52
  "bun-types": "latest",
50
53
  "typescript": "^5.9.3"
51
54
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"OrbitEcho.d.ts","sourceRoot":"","sources":["../src/OrbitEcho.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;GAEG;AACH,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAUD;;GAEG;AACH,UAAU,UAAU;IAClB,SAAS,EAAE;QACT,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;KACzC,CAAA;IACD,KAAK,EAAE;QACL,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;KACpE,CAAA;IACD,OAAO,EAAE;QACP,GAAG,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAA;KAC/B,CAAA;IACD,MAAM,EAAE;QACN,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;KAC3C,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,SAAS;IACpB,MAAM,CAAC,MAAM,EAAE,YAAY,CAAsB;IAEjD,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAC,CAAmB;IACtC,OAAO,CAAC,UAAU,CAAY;IAE9B;;;;OAIG;gBACS,MAAM,GAAE,UAAe;IAoBnC;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAS/B;;;;OAIG;IACH,WAAW,IAAI,eAAe;IAI9B;;;;OAIG;IACH,aAAa,IAAI,iBAAiB,GAAG,SAAS;IAI9C;;;;OAIG;IACH,SAAS,IAAI,UAAU;CAGxB"}
@@ -1,348 +0,0 @@
1
- import { type AtlasMetrics, type AtlasTracer } from './observability';
2
- import type { ShardingManager } from './sharding/ShardingManager';
3
- import type { AtlasConfig, AtlasConnectionEntry, CacheInterface, ConnectionContract, QueryBuilderContract, QueryResult } from './types';
4
- /**
5
- * DB Facade - Static entry point for database operations.
6
- *
7
- * Provides a Laravel-style static interface for managing connections,
8
- * building queries, and executing transactions. Acts as the primary
9
- * gateway for application-level database interaction.
10
- *
11
- * @example
12
- * ```typescript
13
- * // Setup
14
- * DB.configure({
15
- * default: 'main',
16
- * connections: { main: { driver: 'sqlite', database: ':memory:' } }
17
- * });
18
- *
19
- * // Fluent Querying
20
- * const users = await DB.table('users').where('id', 1).get();
21
- *
22
- * // Raw Execution
23
- * const stats = await DB.raw('SELECT count(*) FROM users');
24
- * ```
25
- */
26
- export declare class DB {
27
- private static manager;
28
- private static shardingManagers;
29
- private static initialized;
30
- private static cache;
31
- private static _debug;
32
- private static _queryLog;
33
- private static readonly MAX_LOG_SIZE;
34
- private static queryListener?;
35
- /**
36
- * Registers a ShardingManager for distributed database architectures.
37
- *
38
- * @param name - Unique identifier for the sharding cluster
39
- * @param manager - The initialized ShardingManager instance
40
- */
41
- static addShardingManager(name: string, manager: ShardingManager): void;
42
- /**
43
- * Retrieves a registered ShardingManager.
44
- *
45
- * @param name - Name of the sharding cluster (defaults to 'default')
46
- * @throws Error if the manager is not found
47
- */
48
- static getShardingManager(name?: string): ShardingManager;
49
- /**
50
- * Sets the global cache provider for query results.
51
- *
52
- * @param cache - Implementation of CacheInterface (e.g., Redis, In-Memory).
53
- */
54
- static setCache(cache: CacheInterface): void;
55
- /**
56
- * Retrieves the active global cache provider.
57
- *
58
- * @returns The cache interface or undefined if none is configured.
59
- */
60
- static getCache(): CacheInterface | undefined;
61
- /**
62
- * Toggles debug mode for query logging.
63
- *
64
- * When enabled, executed queries are stored in an internal log with
65
- * performance metrics.
66
- *
67
- * @param enabled - Whether to enable logging.
68
- */
69
- static debug(enabled?: boolean): void;
70
- /**
71
- * Indicates if debug mode is currently active.
72
- */
73
- static isDebug(): boolean;
74
- /**
75
- * Retrieves the last executed SQL statement with interpolated values.
76
- *
77
- * Useful for debugging and integration testing.
78
- *
79
- * @returns The full SQL string or null if no queries were run.
80
- */
81
- static getLastQuery(): string | null;
82
- /**
83
- * Retrieves the complete query log for the current session.
84
- *
85
- * @returns A copy of the query log array.
86
- */
87
- static getQueryLog(): typeof this._queryLog;
88
- /**
89
- * Flushes the internal query log.
90
- */
91
- static clearQueryLog(): void;
92
- /**
93
- * Records a query execution event.
94
- *
95
- * @param sql - The SQL statement.
96
- * @param bindings - The parameter values.
97
- * @param duration - Time taken in ms.
98
- * @internal
99
- */
100
- static logQuery(sql: string, bindings: unknown[], duration: number): void;
101
- /**
102
- * Interpolates bindings into a SQL string for display purposes.
103
- *
104
- * Warning: This is only for logging/debugging and NOT for execution
105
- * to avoid SQL injection risks.
106
- *
107
- * @param sql - The SQL template with placeholders.
108
- * @param bindings - The values to inject.
109
- * @returns The readable SQL string.
110
- */
111
- private static interpolateBindings;
112
- /**
113
- * Executes a callback in "pretend" mode where queries are captured but not run.
114
- *
115
- * Ideal for verifying generated SQL without side effects.
116
- *
117
- * @param callback - Logic to simulate.
118
- * @returns Captured SQL strings and the callback result.
119
- *
120
- * @example
121
- * ```typescript
122
- * const { queries } = await DB.pretend(() => User.create({ name: 'Test' }));
123
- * ```
124
- */
125
- static pretend<T>(callback: () => Promise<T>): Promise<{
126
- queries: string[];
127
- result?: T;
128
- }>;
129
- private constructor();
130
- /**
131
- * Retrieves performance metrics from the SQL compiler cache.
132
- *
133
- * @returns Stats including hit rate and cache utilization.
134
- */
135
- static getCacheStats(): {
136
- size: number;
137
- maxSize: number;
138
- hitRate: number;
139
- };
140
- /**
141
- * Initializes the database subsystem with the provided configuration.
142
- *
143
- * Configures the connection manager and observability (Tracing/Metrics).
144
- * This method must be called before any database operations.
145
- *
146
- * @param config - The Atlas configuration object.
147
- * @throws {Error} If configuration is invalid.
148
- */
149
- static configure(config: AtlasConfig): void;
150
- /**
151
- * Retrieves the global tracer for manual span creation.
152
- */
153
- static getTracer(): AtlasTracer | undefined;
154
- /**
155
- * Retrieves the global metrics reporter.
156
- */
157
- static getMetrics(): AtlasMetrics | undefined;
158
- /**
159
- * Configures the database using environment variables.
160
- *
161
- * Looks for standard DB_* variables or DATABASE_URL.
162
- *
163
- * @param connectionName - The name to assign to the primary connection.
164
- */
165
- static configureFromEnv(connectionName?: string): void;
166
- /**
167
- * Loads configuration from a file.
168
- *
169
- * Automatically detects common patterns like config/database.ts.
170
- *
171
- * @param configPath - Explicit path to the config file.
172
- */
173
- static configureFromFile(configPath?: string): Promise<void>;
174
- /**
175
- * Best-effort configuration using file detection then environment variables.
176
- *
177
- * @param configPath - Optional path to try first.
178
- */
179
- static autoConfigure(configPath?: string): Promise<void>;
180
- /**
181
- * Manually adds a connection to the manager.
182
- *
183
- * @param name - Unique connection name.
184
- * @param config - Connection settings (standard or read/write replica).
185
- */
186
- static addConnection(name: string, config: AtlasConnectionEntry): void;
187
- /**
188
- * Adds a connection configured via prefixed environment variables.
189
- *
190
- * @param name - Connection name.
191
- * @param prefix - Env variable prefix (e.g. "READ_ONLY").
192
- */
193
- static addConnectionFromEnv(name: string, prefix?: string): void;
194
- /**
195
- * Sets the global default connection.
196
- *
197
- * @param name - The connection identifier.
198
- */
199
- static setDefaultConnection(name: string): void;
200
- /**
201
- * Returns the name of the current default connection.
202
- */
203
- static getDefaultConnection(): string;
204
- /**
205
- * Retrieves a connection instance.
206
- *
207
- * @param name - Name of the connection (defaults to the global default).
208
- * @returns The active connection instance.
209
- * @throws {Error} If DB is not configured or connection name is unknown.
210
- */
211
- static connection(name?: string): ConnectionContract;
212
- /**
213
- * Retrieves the read replica connection for the given connection name.
214
- *
215
- * Uses round-robin selection across configured read replicas.
216
- * Falls back to the primary connection if no replicas are configured.
217
- *
218
- * @param name - Connection name (defaults to global default)
219
- */
220
- static readConnection(name?: string): ConnectionContract;
221
- /**
222
- * Retrieves the write (primary) connection for the given connection name.
223
- *
224
- * Use this to force a query to run on the primary even inside a read context.
225
- *
226
- * @param name - Connection name (defaults to global default)
227
- */
228
- static writeConnection(name?: string): ConnectionContract;
229
- /**
230
- * Checks if a specific connection has been configured.
231
- */
232
- static hasConnection(name: string): boolean;
233
- /**
234
- * Lists all configured connection identifiers.
235
- */
236
- static getConnectionNames(): string[];
237
- /**
238
- * Retrieves the raw configuration for a connection.
239
- */
240
- static getConnectionConfig(name?: string): AtlasConnectionEntry | undefined;
241
- /**
242
- * Initializes a fluent query builder for a specific table.
243
- *
244
- * @template T - The row type.
245
- * @param tableName - The database table name.
246
- * @returns A QueryBuilder instance.
247
- */
248
- static table<T = Record<string, unknown>>(tableName: string): QueryBuilderContract<T>;
249
- /**
250
- * Executes a raw SQL statement with telemetry tracking.
251
- *
252
- * @template T - The expected row type.
253
- * @param sql - The SQL string with placeholders.
254
- * @param bindings - Array of values.
255
- * @returns The raw query result.
256
- *
257
- * @example
258
- * ```typescript
259
- * const users = await DB.raw('SELECT * FROM users WHERE active = ?', [true]);
260
- * ```
261
- */
262
- static raw<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
263
- /**
264
- * Alias for {@link raw}.
265
- */
266
- static rawQuery<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
267
- /**
268
- * Executes logic within a managed database transaction.
269
- *
270
- * Automatically commits on success and rolls back on error.
271
- * Receives a connection instance scoped to the transaction.
272
- *
273
- * @template T - Logic result type.
274
- * @param callback - The transactional logic.
275
- * @param connectionName - Optional specific connection.
276
- * @returns The callback's return value.
277
- */
278
- static transaction<T>(callback: (connection: ConnectionContract) => Promise<T>, connectionName?: string): Promise<T>;
279
- /**
280
- * Executes logic within a managed database transaction with automatic retry on serialization/stale data failures.
281
- *
282
- * Particularly useful for high-concurrency environments utilizing optimistic locking,
283
- * where `StaleModelError` is thrown due to concurrent writes.
284
- *
285
- * @template T - Logic result type.
286
- * @param callback - The transactional logic.
287
- * @param connectionName - Optional specific connection.
288
- * @param maxRetries - Maximum number of retries (default: 5).
289
- * @returns The callback's return value.
290
- * @throws Rethrows the error if max retries are exceeded.
291
- */
292
- static transactionWithRetry<T>(callback: (connection: ConnectionContract, attempt: number) => Promise<T>, connectionName?: string, maxRetries?: number): Promise<T>;
293
- /**
294
- * Manually starts a database transaction.
295
- *
296
- * Caller is responsible for calling commit() or rollback().
297
- *
298
- * @param connectionName - Connection to use.
299
- * @returns A transaction-scoped connection.
300
- * @throws {Error} If the driver does not support transactions.
301
- */
302
- static beginTransaction(connectionName?: string): Promise<ConnectionContract>;
303
- /**
304
- * Closes the specified connection.
305
- */
306
- static disconnect(name?: string): Promise<void>;
307
- /**
308
- * Closes all managed connections.
309
- */
310
- static disconnectAll(): Promise<void>;
311
- /**
312
- * Safely shuts down the database subsystem.
313
- */
314
- static shutdown(): Promise<void>;
315
- /**
316
- * Closes and re-opens a connection.
317
- */
318
- static reconnect(name?: string): Promise<ConnectionContract>;
319
- /**
320
- * Removes a connection from the internal cache without closing it.
321
- */
322
- static purge(name?: string): void;
323
- /**
324
- * Shortcut for starting a query with specific columns.
325
- */
326
- static select<T = Record<string, unknown>>(tableName: string, columns?: string[]): QueryBuilderContract<T>;
327
- /**
328
- * Shortcut for inserting records.
329
- */
330
- static insert<T = Record<string, unknown>>(tableName: string, data: Partial<T> | Partial<T>[]): Promise<T[]>;
331
- /**
332
- * Shortcut for updating records based on key-value filters.
333
- */
334
- static update<T = Record<string, unknown>>(tableName: string, where: Record<string, unknown>, data: Partial<T>): Promise<number>;
335
- /**
336
- * Shortcut for deleting records based on key-value filters.
337
- */
338
- static delete(tableName: string, where: Record<string, unknown>): Promise<number>;
339
- /**
340
- * Ensures the DB facade is ready for use.
341
- */
342
- private static ensureConfigured;
343
- /**
344
- * Internal reset for testing.
345
- * @internal
346
- */
347
- static _reset(): Promise<void>;
348
- }
@@ -1,9 +0,0 @@
1
- import type { GravitoOrbit, PlanetCore } from '@gravito/core';
2
- /**
3
- * Atlas Orbit - Database & ORM Integration
4
- * Integrates the Atlas ORM engine into the Gravito Core ecosystem.
5
- * @public
6
- */
7
- export declare class OrbitAtlas implements GravitoOrbit {
8
- install(core: PlanetCore): Promise<void>;
9
- }
@@ -1,14 +0,0 @@
1
- import type { AtlasConfig, AtlasObservabilityConfig, ConnectionConfig, PostgresConfig } from '../types';
2
- export type { AtlasConfig, AtlasObservabilityConfig, ConnectionConfig, PostgresConfig };
3
- /**
4
- * Define configuration with type checking
5
- */
6
- export declare function defineConfig(config: AtlasConfig): AtlasConfig;
7
- /**
8
- * Load configuration from environment variables with optional prefix
9
- * Supports both DATABASE_URL and individual DB_* variables
10
- *
11
- * @param connectionName - Name for the connection
12
- * @param prefix - Optional prefix for environment variables (e.g., 'READ' for DB_READ_*)
13
- */
14
- export declare function fromEnv(connectionName?: string, prefix?: string): AtlasConfig;
@@ -1,7 +0,0 @@
1
- /**
2
- * Configuration Module
3
- * @description Database configuration utilities
4
- */
5
- export type { AtlasConfig, ConnectionConfig } from '../types';
6
- export { defineConfig, fromEnv } from './defineConfig';
7
- export { loadConfig, loadConfigFile } from './loadConfig';
@@ -1,41 +0,0 @@
1
- /**
2
- * Configuration Loader
3
- * @description Load database configuration from various sources
4
- */
5
- import type { AtlasConfig } from '../types';
6
- /**
7
- * Load configuration from a TypeScript/JavaScript config file
8
- *
9
- * @param configPath - Path to the config file (default: 'config/database.ts' or 'config/database.js')
10
- * @returns Atlas configuration
11
- *
12
- * @example
13
- * ```typescript
14
- * // config/database.ts
15
- * import { defineConfig } from '@gravito/atlas'
16
- *
17
- * export default defineConfig({
18
- * default: 'default',
19
- * connections: {
20
- * default: {
21
- * driver: 'postgres',
22
- * host: 'localhost',
23
- * database: 'myapp'
24
- * }
25
- * }
26
- * })
27
- * ```
28
- */
29
- export declare function loadConfigFile(configPath?: string): Promise<AtlasConfig>;
30
- /**
31
- * Load configuration from multiple sources with priority
32
- * Priority: 1. Config file, 2. Environment variables, 3. Default
33
- *
34
- * @param options - Loading options
35
- * @returns Atlas configuration
36
- */
37
- export declare function loadConfig(options?: {
38
- configPath?: string;
39
- useEnv?: boolean;
40
- envPrefix?: string;
41
- }): Promise<AtlasConfig>;
@@ -1,112 +0,0 @@
1
- /**
2
- * Connection
3
- * @description Represents a database connection
4
- */
5
- import type { AtlasMetrics, AtlasTracer } from '../observability';
6
- import type { ConnectionConfig, ConnectionContract, DriverContract, ExecuteResult, GrammarContract, PoolStats, QueryBuilderContract, QueryResult } from '../types';
7
- /**
8
- * Database Connection
9
- * Wraps a driver and grammar for query building and execution
10
- */
11
- export declare class Connection implements ConnectionContract {
12
- protected readonly name: string;
13
- protected readonly config: ConnectionConfig;
14
- protected driver: DriverContract;
15
- protected grammar: GrammarContract;
16
- protected connected: boolean;
17
- protected proxy?: ConnectionContract;
18
- protected tracer: AtlasTracer | undefined;
19
- protected metrics: AtlasMetrics | undefined;
20
- /**
21
- * Static query listeners for global observation (e.g. debugging)
22
- */
23
- static queryListeners: Array<(query: {
24
- connection: string;
25
- sql: string;
26
- bindings: unknown[];
27
- duration: number;
28
- timestamp: number;
29
- }) => void>;
30
- constructor(name: string, config: ConnectionConfig);
31
- /**
32
- * Set the proxy instance for this connection
33
- */
34
- setProxy(proxy: ConnectionContract): void;
35
- /**
36
- * Get connection name
37
- */
38
- getName(): string;
39
- /**
40
- * Get the underlying driver
41
- */
42
- getDriver(): DriverContract;
43
- /**
44
- * Get connection configuration
45
- */
46
- getConfig(): ConnectionConfig;
47
- /**
48
- * Get the grammar
49
- */
50
- getGrammar(): GrammarContract;
51
- /**
52
- * Get the tracer
53
- */
54
- getTracer(): AtlasTracer | undefined;
55
- /**
56
- * Get the metrics
57
- */
58
- getMetrics(): AtlasMetrics | undefined;
59
- /**
60
- * Create a new query builder for a table
61
- */
62
- table<T = Record<string, unknown>>(tableName: string): QueryBuilderContract<T>;
63
- /**
64
- * Alias for table() for NoSQL connections
65
- */
66
- collection<T = Record<string, unknown>>(name: string): QueryBuilderContract<T>;
67
- /**
68
- * Execute raw SQL
69
- */
70
- raw<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
71
- /**
72
- * Execute raw SQL statement (INSERT/UPDATE/DELETE)
73
- */
74
- execute(sql: string, bindings?: unknown[]): Promise<ExecuteResult>;
75
- /**
76
- * Run a callback within a transaction
77
- */
78
- transaction<T>(callback: (connection: ConnectionContract) => Promise<T>): Promise<T>;
79
- /**
80
- * Stream query results for processing large datasets
81
- * @param sql - SQL query
82
- * @param bindings - Query parameters
83
- * @returns Async iterable of result rows
84
- */
85
- stream<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): AsyncIterable<T>;
86
- /**
87
- * Get connection pool statistics (if supported by driver)
88
- * @returns Pool statistics or null if not supported
89
- */
90
- getPoolStats(): PoolStats | null;
91
- /**
92
- * Disconnect from the database
93
- */
94
- disconnect(): Promise<void>;
95
- /**
96
- * Connect to the database
97
- */
98
- connect(): Promise<void>;
99
- /**
100
- * Ensure connection is established
101
- */
102
- protected ensureConnected(): Promise<void>;
103
- /**
104
- * Create the driver instance based on config
105
- * Automatically prefers Bun.sql native driver when available (unless explicitly disabled)
106
- */
107
- protected createDriver(): DriverContract;
108
- /**
109
- * Create the grammar instance based on config
110
- */
111
- protected createGrammar(): GrammarContract;
112
- }