@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,73 +0,0 @@
1
- /**
2
- * @gravito/atlas - Schema Differ
3
- * @description Compares Atlas Model decorator metadata against the live database
4
- * schema (information_schema) and produces a structured diff.
5
- *
6
- * This powers the `db:push` and `migrate:generate` CLI commands.
7
- */
8
- import type { ConnectionContract } from '../types';
9
- /**
10
- * A single column definition from information_schema or decorator meta.
11
- */
12
- export interface ColumnDefinition {
13
- name: string;
14
- type: string;
15
- nullable: boolean;
16
- defaultValue: string | null;
17
- isPrimary: boolean;
18
- isUnique: boolean;
19
- }
20
- /**
21
- * The result of comparing two schema states.
22
- */
23
- export interface SchemaDiffResult {
24
- /** Table name */
25
- table: string;
26
- /** Columns that exist in models but not in the DB */
27
- added: ColumnDefinition[];
28
- /** Columns that exist in the DB but not in models */
29
- removed: ColumnDefinition[];
30
- /** Columns where the type or nullability has changed */
31
- modified: Array<{
32
- name: string;
33
- from: ColumnDefinition;
34
- to: ColumnDefinition;
35
- }>;
36
- /** Whether any changes were detected */
37
- hasChanges: boolean;
38
- }
39
- export interface SchemaDiffOptions {
40
- /** Database connection to compare against */
41
- connection: ConnectionContract;
42
- /** Table name */
43
- table: string;
44
- /** Desired column definitions (from Model decorators) */
45
- desired: ColumnDefinition[];
46
- }
47
- /**
48
- * SchemaDiff
49
- *
50
- * Compares the desired schema (from Model @Column decorators) against the
51
- * current live database schema and produces a structured diff result.
52
- *
53
- * @example
54
- * ```typescript
55
- * const differ = new SchemaDiff({ connection, table: 'users', desired: userColumns })
56
- * const diff = await differ.compare()
57
- * if (diff.hasChanges) console.log('Schema is out of sync!')
58
- * ```
59
- */
60
- export declare class SchemaDiff {
61
- private readonly connection;
62
- private readonly table;
63
- private readonly desired;
64
- constructor(options: SchemaDiffOptions);
65
- /**
66
- * Perform the schema comparison and return the diff result.
67
- */
68
- compare(): Promise<SchemaDiffResult>;
69
- /**
70
- * Normalize DB type strings for comparison (e.g. 'character varying' → 'varchar').
71
- */
72
- private normalizeType;
73
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * @gravito/atlas - Schema Type Generator
3
- * @description Reads @Column decorator metadata from Model classes and builds a
4
- * type map for generating TypeScript declaration files.
5
- *
6
- * Eliminates "Type Drift" by deriving types 100% from decorator metadata.
7
- */
8
- export declare const COLUMN_METADATA_KEY = "atlas:columns";
9
- /**
10
- * Column metadata stored by @Column decorator
11
- */
12
- export interface ColumnMeta {
13
- name: string;
14
- type: string;
15
- nullable?: boolean;
16
- primary?: boolean;
17
- unique?: boolean;
18
- default?: unknown;
19
- }
20
- /**
21
- * Generated type map for a single Model class
22
- */
23
- export interface ModelTypeMap {
24
- /** Model class name (e.g. 'User') */
25
- modelName: string;
26
- /** Table name the model maps to */
27
- tableName: string;
28
- /** Column-to-TypeScript type mapping */
29
- columns: Record<string, string>;
30
- }
31
- export interface TypeGeneratorOptions {
32
- /** Root directory to scan for Model files */
33
- modelsDir: string;
34
- /** Whether to log progress */
35
- verbose?: boolean;
36
- }
37
- /**
38
- * TypeGenerator
39
- *
40
- * Scans a directory for Atlas Model files and extracts @Column decorator
41
- * metadata to produce a complete type map.
42
- *
43
- * @example
44
- * ```typescript
45
- * const gen = new TypeGenerator({ modelsDir: './src/models' })
46
- * const result = await gen.generate()
47
- * ```
48
- */
49
- export declare class TypeGenerator {
50
- private readonly modelsDir;
51
- private readonly verbose;
52
- constructor(options: TypeGeneratorOptions);
53
- /**
54
- * Scan models directory and extract type maps from all Model files.
55
- */
56
- generate(): Promise<ModelTypeMap[]>;
57
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * @gravito/atlas - Type Writer
3
- * @description Writes TypeScript declaration files from generated Model type maps.
4
- *
5
- * Outputs interface declarations that can be merged into Model classes via
6
- * Declaration Merging for zero type-drift DX.
7
- */
8
- import type { ModelTypeMap } from './TypeGenerator';
9
- export interface TypeWriterOptions {
10
- /** Output file path (e.g., '.orbit/generated.d.ts') */
11
- outputPath: string;
12
- /** Optional banner comment */
13
- banner?: string;
14
- }
15
- /**
16
- * TypeWriter
17
- *
18
- * Converts a list of ModelTypeMap objects into a `.d.ts` declaration file.
19
- *
20
- * @example
21
- * ```typescript
22
- * const writer = new TypeWriter({ outputPath: '.orbit/generated.d.ts' })
23
- * await writer.write(typeMaps)
24
- * // Emits:
25
- * // export interface GeneratedUser { id: number; name: string; ... }
26
- * ```
27
- */
28
- export declare class TypeWriter {
29
- private readonly outputPath;
30
- private readonly banner;
31
- constructor(options: TypeWriterOptions);
32
- /**
33
- * Write the declaration file to disk.
34
- *
35
- * @param typeMaps - Array of model type maps from TypeGenerator
36
- */
37
- write(typeMaps: ModelTypeMap[]): Promise<void>;
38
- /**
39
- * Build the .d.ts file content string.
40
- */
41
- buildContent(typeMaps: ModelTypeMap[]): string;
42
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * MySQL Schema Grammar
3
- * @description DDL generation for MySQL/MariaDB
4
- */
5
- import type { ColumnDefinition } from '../ColumnDefinition';
6
- import type { IndexDefinition } from '../ForeignKeyDefinition';
7
- import { SchemaGrammar } from './SchemaGrammar';
8
- /**
9
- * MySQL Schema Grammar
10
- */
11
- export declare class MySQLSchemaGrammar extends SchemaGrammar {
12
- protected compileType(column: ColumnDefinition): string;
13
- protected compileAutoIncrement(): string;
14
- protected supportsUnsigned(): boolean;
15
- protected compileFullTextIndex(table: string, index: IndexDefinition): string;
16
- protected compileSpatialIndex(table: string, index: IndexDefinition): string;
17
- compileDropIndex(table: string, name: string): string;
18
- wrapTable(table: string): string;
19
- wrapColumn(column: string): string;
20
- compileTableExists(table: string): string;
21
- compileColumnExists(table: string, column: string): string;
22
- compileListTables(): string;
23
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * PostgreSQL Schema Grammar
3
- * @description DDL generation for PostgreSQL
4
- */
5
- import type { Blueprint } from '../Blueprint';
6
- import type { ColumnDefinition } from '../ColumnDefinition';
7
- import type { IndexDefinition } from '../ForeignKeyDefinition';
8
- import { SchemaGrammar } from './SchemaGrammar';
9
- /**
10
- * PostgreSQL Schema Grammar
11
- */
12
- export declare class PostgresSchemaGrammar extends SchemaGrammar {
13
- protected wrapChar: string;
14
- protected compileType(column: ColumnDefinition): string;
15
- protected compileAutoIncrement(): string;
16
- protected compileColumn(column: ColumnDefinition, blueprint: Blueprint): string;
17
- protected supportsUnsigned(): boolean;
18
- protected compileFullTextIndex(table: string, index: IndexDefinition): string;
19
- protected compileSpatialIndex(table: string, index: IndexDefinition): string;
20
- compileDropIndex(_table: string, name: string): string;
21
- wrapTable(table: string): string;
22
- wrapColumn(column: string): string;
23
- compileTableExists(table: string): string;
24
- compileColumnExists(table: string, column: string): string;
25
- compileListTables(): string;
26
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * SQLite Schema Grammar
3
- * @description DDL generation for SQLite
4
- */
5
- import type { Blueprint } from '../Blueprint';
6
- import type { ColumnDefinition } from '../ColumnDefinition';
7
- import type { IndexDefinition } from '../ForeignKeyDefinition';
8
- import { SchemaGrammar } from './SchemaGrammar';
9
- /**
10
- * SQLite Schema Grammar
11
- * Generates SQL DDL statements specifically for SQLite databases.
12
- * @internal
13
- */
14
- export declare class SQLiteSchemaGrammar extends SchemaGrammar {
15
- protected wrapChar: string;
16
- compileCreate(blueprint: Blueprint): string;
17
- wrapTable(table: string): string;
18
- wrapColumn(column: string): string;
19
- compileTableExists(table: string): string;
20
- compileColumnExists(table: string, column: string): string;
21
- compileListTables(): string;
22
- protected compileType(column: ColumnDefinition): string;
23
- protected compileAutoIncrement(): string;
24
- protected supportsUnsigned(): boolean;
25
- protected compileFullTextIndex(_table: string, _index: IndexDefinition): string;
26
- protected compileSpatialIndex(_table: string, _index: IndexDefinition): string;
27
- compileDropIndex(_table: string, name: string): string;
28
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * Schema Grammar
3
- * @description Base class for generating DDL SQL statements
4
- */
5
- import type { Blueprint } from '../Blueprint';
6
- import type { ColumnDefinition } from '../ColumnDefinition';
7
- import type { ForeignKeyDefinition, IndexDefinition } from '../ForeignKeyDefinition';
8
- /**
9
- * Schema Grammar
10
- * Generates DDL SQL statements from Blueprint definitions
11
- */
12
- export declare abstract class SchemaGrammar {
13
- /**
14
- * Compile CREATE TABLE statement
15
- */
16
- compileCreate(blueprint: Blueprint): string;
17
- /**
18
- * Compile DROP TABLE statement
19
- */
20
- compileDrop(table: string): string;
21
- /**
22
- * Compile DROP TABLE IF EXISTS statement
23
- */
24
- compileDropIfExists(table: string): string;
25
- /**
26
- * Compile ALTER TABLE statement
27
- */
28
- compileAlter(blueprint: Blueprint): string[];
29
- /**
30
- * Determine if primary key should be added at the bottom of the statement
31
- */
32
- protected shouldAddPrimaryAtBottom(blueprint: Blueprint): boolean;
33
- /**
34
- * Compile a column definition
35
- */
36
- protected compileColumn(column: ColumnDefinition, _blueprint: Blueprint): string;
37
- /**
38
- * Compile column type
39
- */
40
- protected abstract compileType(column: ColumnDefinition): string;
41
- /**
42
- * Compile auto increment syntax
43
- */
44
- protected abstract compileAutoIncrement(): string;
45
- /**
46
- * Check if database supports UNSIGNED
47
- */
48
- protected abstract supportsUnsigned(): boolean;
49
- /**
50
- * Compile default value
51
- */
52
- protected compileDefault(value: unknown): string;
53
- /**
54
- * Compile CREATE INDEX statement
55
- */
56
- compileIndex(table: string, index: IndexDefinition): string;
57
- /**
58
- * Compile fulltext index (override in subclasses)
59
- */
60
- protected abstract compileFullTextIndex(table: string, index: IndexDefinition): string;
61
- /**
62
- * Compile spatial index (override in subclasses)
63
- */
64
- protected abstract compileSpatialIndex(table: string, index: IndexDefinition): string;
65
- /**
66
- * Compile DROP INDEX statement
67
- */
68
- abstract compileDropIndex(table: string, name: string): string;
69
- /**
70
- * Compile FOREIGN KEY constraint
71
- */
72
- protected compileForeignKey(fk: ForeignKeyDefinition): string;
73
- /**
74
- * Wrap table name with quotes
75
- */
76
- abstract wrapTable(table: string): string;
77
- /**
78
- * Wrap column name with quotes
79
- */
80
- abstract wrapColumn(column: string): string;
81
- /**
82
- * Quote a string value
83
- */
84
- protected quoteString(value: string): string;
85
- /**
86
- * Compile query to check if table exists
87
- */
88
- abstract compileTableExists(table: string): string;
89
- /**
90
- * Compile query to check if column exists
91
- */
92
- abstract compileColumnExists(table: string, column: string): string;
93
- /**
94
- * Compile query to list all tables
95
- */
96
- abstract compileListTables(): string;
97
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Schema Grammars Index
3
- */
4
- export { MySQLSchemaGrammar } from './MySQLSchemaGrammar';
5
- export { PostgresSchemaGrammar } from './PostgresSchemaGrammar';
6
- export { SchemaGrammar } from './SchemaGrammar';
7
- export { SQLiteSchemaGrammar } from './SQLiteSchemaGrammar';
@@ -1,8 +0,0 @@
1
- /**
2
- * Schema Module Index
3
- */
4
- export { Blueprint } from './Blueprint';
5
- export { ColumnDefinition, type ColumnType, type ForeignKeyAction } from './ColumnDefinition';
6
- export type { ForeignKeyDefinition, IndexDefinition } from './ForeignKeyDefinition';
7
- export { MySQLSchemaGrammar, PostgresSchemaGrammar, SchemaGrammar } from './grammars';
8
- export { Schema } from './Schema';
@@ -1,90 +0,0 @@
1
- import type { Model } from '../orm/model/Model';
2
- /**
3
- * Factory State
4
- */
5
- type FactoryState<T> = Partial<T>;
6
- /**
7
- * Factory Definition Function
8
- */
9
- export type FactoryDefinition<T> = () => T;
10
- /**
11
- * Factory Options
12
- */
13
- export interface FactoryOptions {
14
- model?: typeof Model;
15
- table?: string;
16
- }
17
- /**
18
- * Factory
19
- * Generate fake records for seeding
20
- *
21
- * @example
22
- * ```typescript
23
- * const userFactory = new Factory<User>(() => ({
24
- * name: faker.person.fullName(),
25
- * email: faker.internet.email(),
26
- * password: 'hashed_password',
27
- * }), { table: 'users' })
28
- *
29
- * // Create 10 users
30
- * const users = await userFactory.count(10).create()
31
- * ```
32
- */
33
- export declare class Factory<T extends Record<string, unknown>> {
34
- private definition;
35
- private _count;
36
- private _states;
37
- private model?;
38
- private tableName?;
39
- constructor(definition: FactoryDefinition<T>, options?: FactoryOptions);
40
- private static registry;
41
- /**
42
- * Define a factory for a model
43
- */
44
- static define<T extends Record<string, unknown>>(modelOrTable: typeof Model | string, definition: FactoryDefinition<T>): Factory<T>;
45
- /**
46
- * Create a factory for a specific model
47
- */
48
- static model<T extends Record<string, unknown>>(model: typeof Model): Factory<T>;
49
- /**
50
- * Create and insert multiple records
51
- */
52
- createMany(n: number, attributes?: FactoryState<T>): Promise<T[]>;
53
- /**
54
- * Set the number of records to generate
55
- */
56
- count(n: number): this;
57
- /**
58
- * Apply state overrides
59
- */
60
- state(state: FactoryState<T>): this;
61
- /**
62
- * Generate records without inserting
63
- */
64
- make(): T[];
65
- /**
66
- * Generate a single record
67
- */
68
- makeOne(): T;
69
- /**
70
- * Generate records as raw objects (alias for make)
71
- */
72
- raw(): T[];
73
- /**
74
- * Generate a single raw record
75
- */
76
- rawOne(): T;
77
- /**
78
- * Create and insert records into the database
79
- */
80
- create(attributes?: FactoryState<T>): Promise<T[]>;
81
- /**
82
- * Create a sequence generator
83
- */
84
- sequence<K extends keyof T>(key: K, generator: (index: number) => T[K]): this;
85
- }
86
- /**
87
- * Helper to create a factory
88
- */
89
- export declare function factory<T extends Record<string, unknown>>(definition: FactoryDefinition<T>, options?: FactoryOptions): Factory<T>;
90
- export {};
@@ -1,28 +0,0 @@
1
- /**
2
- * Seeder constructor type
3
- */
4
- export type SeederConstructor = new () => Seeder;
5
- /**
6
- * Seeder file info
7
- */
8
- export interface SeederFile {
9
- /** Seeder class name */
10
- name: string;
11
- /** Full file path */
12
- path: string;
13
- }
14
- /**
15
- * Base Seeder Class
16
- * @description All database seeders should extend this class
17
- */
18
- export declare abstract class Seeder {
19
- /**
20
- * Run the seeder logic
21
- */
22
- abstract run(): Promise<void>;
23
- /**
24
- * Run other seeders from within this seeder
25
- * @example await this.call([UserSeeder, PostSeeder])
26
- */
27
- call(seeders: SeederConstructor | SeederConstructor[]): Promise<void>;
28
- }
@@ -1,74 +0,0 @@
1
- /**
2
- * Seeder Runner
3
- * @description Runs database seeders
4
- */
5
- /**
6
- * Seeder Runner Options
7
- */
8
- export interface SeederRunnerOptions {
9
- /** Path to seeders directory */
10
- path?: string;
11
- /** Database connection name */
12
- connection?: string;
13
- }
14
- /**
15
- * Seeder Runner
16
- * Discovers and runs database seeders
17
- *
18
- * @example
19
- * ```typescript
20
- * const runner = new SeederRunner({ path: './seeders' })
21
- *
22
- * // Run all seeders
23
- * await runner.run()
24
- *
25
- * // Run specific seeder
26
- * await runner.call('UserSeeder')
27
- * ```
28
- */
29
- export declare class SeederRunner {
30
- private seedersPath;
31
- private _connectionName;
32
- private resolvedSeeders;
33
- constructor(options?: SeederRunnerOptions);
34
- /**
35
- * Set seeders path
36
- */
37
- setPath(path: string): this;
38
- /**
39
- * Set database connection
40
- */
41
- connection(name: string): this;
42
- /**
43
- * Run all seeders in the directory
44
- */
45
- run(): Promise<string[]>;
46
- /**
47
- * Run a specific seeder by name
48
- */
49
- call(seederName: string): Promise<void>;
50
- /**
51
- * Run multiple specific seeders
52
- */
53
- callMultiple(seederNames: string[]): Promise<void>;
54
- /**
55
- * Check if a seeder exists
56
- */
57
- has(seederName: string): Promise<boolean>;
58
- /**
59
- * List all available seeders
60
- */
61
- list(): Promise<string[]>;
62
- /**
63
- * Get all seeder files from the seeders directory
64
- */
65
- private getSeederFiles;
66
- /**
67
- * Run a single seeder
68
- */
69
- private runSeeder;
70
- /**
71
- * Resolve seeder class from file
72
- */
73
- private resolveSeeder;
74
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Seed Module Index
3
- */
4
- export { Factory, type FactoryDefinition, factory } from './Factory';
5
- export type { Seeder, SeederConstructor, SeederFile } from './Seeder';
6
- export { SeederRunner, type SeederRunnerOptions } from './SeederRunner';
@@ -1,59 +0,0 @@
1
- import type { ConnectionConfig, ConnectionContract } from '../types';
2
- /**
3
- * Sharding Configuration
4
- */
5
- export interface ShardingConfig {
6
- /**
7
- * Number of shards
8
- */
9
- shardCount: number;
10
- /**
11
- * List of shard connection configurations
12
- */
13
- shards: (ConnectionConfig & {
14
- id: number;
15
- })[];
16
- /**
17
- * Sharding algorithm (default: 'consistent-hashing')
18
- */
19
- algorithm?: 'consistent-hashing' | 'modulo' | 'range';
20
- }
21
- /**
22
- * Sharding Manager
23
- *
24
- * Manages database sharding, connection routing, and distributed queries.
25
- * Supports horizontal scaling by partitioning data across multiple database instances.
26
- */
27
- export declare class ShardingManager {
28
- private connections;
29
- private shardCount;
30
- private algorithm;
31
- constructor(config: ShardingConfig);
32
- /**
33
- * Initialize all shard connections
34
- */
35
- private initializeShards;
36
- /**
37
- * Get a shard connection by distribution key (e.g., userId, tenantId)
38
- *
39
- * @param key - The distribution key
40
- * @returns The connection instance for the calculated shard
41
- */
42
- getShard(key: string | number): ConnectionContract;
43
- /**
44
- * Calculate Shard ID based on the key and selected algorithm
45
- */
46
- private calculateShardId;
47
- /**
48
- * Execute a query across all shards and aggregate the results.
49
- * Useful for reports, analytics, or global searches.
50
- *
51
- * @param callback - The operation to perform on each shard
52
- * @returns Aggregated results from all shards
53
- */
54
- mapReduce<T>(callback: (connection: ConnectionContract, shardId: number) => Promise<T[]>): Promise<T[]>;
55
- /**
56
- * Get all active shard connections
57
- */
58
- getAllShards(): Map<number, ConnectionContract>;
59
- }