@gravito/echo 3.1.0 → 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 (245) 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 -301
  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 -48
  24. package/dist/atlas/src/connection/Connection.d.ts +0 -108
  25. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -111
  26. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  27. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  28. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  29. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -66
  30. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -83
  31. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  32. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  33. package/dist/atlas/src/drivers/types.d.ts +0 -260
  34. package/dist/atlas/src/errors/index.d.ts +0 -45
  35. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  36. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  37. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  38. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  39. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  40. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  41. package/dist/atlas/src/index.d.ts +0 -67
  42. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  43. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  44. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  45. package/dist/atlas/src/migration/index.d.ts +0 -6
  46. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -11
  47. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  48. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  49. package/dist/atlas/src/observability/index.d.ts +0 -9
  50. package/dist/atlas/src/orm/index.d.ts +0 -5
  51. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  52. package/dist/atlas/src/orm/model/Model.d.ts +0 -449
  53. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  54. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -136
  55. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  56. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -87
  57. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  58. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  59. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  60. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  61. package/dist/atlas/src/orm/model/decorators.d.ts +0 -109
  62. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  63. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  64. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  65. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  66. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -123
  67. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  68. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  69. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  70. package/dist/atlas/src/query/Expression.d.ts +0 -60
  71. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  72. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -573
  73. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  74. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  75. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  76. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  77. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  78. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  79. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  80. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  81. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  82. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  83. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  84. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  85. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  86. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  87. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  88. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  89. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  90. package/dist/atlas/src/schema/index.d.ts +0 -8
  91. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  92. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  93. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  94. package/dist/atlas/src/seed/index.d.ts +0 -6
  95. package/dist/atlas/src/types/index.d.ts +0 -1100
  96. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  97. package/dist/core/src/Application.d.ts +0 -215
  98. package/dist/core/src/CommandKernel.d.ts +0 -33
  99. package/dist/core/src/ConfigManager.d.ts +0 -26
  100. package/dist/core/src/Container.d.ts +0 -108
  101. package/dist/core/src/ErrorHandler.d.ts +0 -63
  102. package/dist/core/src/Event.d.ts +0 -5
  103. package/dist/core/src/EventManager.d.ts +0 -123
  104. package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
  105. package/dist/core/src/GravitoServer.d.ts +0 -28
  106. package/dist/core/src/HookManager.d.ts +0 -496
  107. package/dist/core/src/Listener.d.ts +0 -4
  108. package/dist/core/src/Logger.d.ts +0 -20
  109. package/dist/core/src/PlanetCore.d.ts +0 -289
  110. package/dist/core/src/Route.d.ts +0 -36
  111. package/dist/core/src/Router.d.ts +0 -284
  112. package/dist/core/src/ServiceProvider.d.ts +0 -156
  113. package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
  114. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -171
  115. package/dist/core/src/adapters/bun/BunContext.d.ts +0 -45
  116. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
  117. package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
  118. package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
  119. package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
  120. package/dist/core/src/adapters/bun/types.d.ts +0 -20
  121. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  122. package/dist/core/src/adapters/types.d.ts +0 -235
  123. package/dist/core/src/engine/AOTRouter.d.ts +0 -124
  124. package/dist/core/src/engine/FastContext.d.ts +0 -100
  125. package/dist/core/src/engine/Gravito.d.ts +0 -137
  126. package/dist/core/src/engine/MinimalContext.d.ts +0 -79
  127. package/dist/core/src/engine/analyzer.d.ts +0 -27
  128. package/dist/core/src/engine/constants.d.ts +0 -23
  129. package/dist/core/src/engine/index.d.ts +0 -26
  130. package/dist/core/src/engine/path.d.ts +0 -26
  131. package/dist/core/src/engine/pool.d.ts +0 -83
  132. package/dist/core/src/engine/types.d.ts +0 -143
  133. package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
  134. package/dist/core/src/events/DeadLetterQueue.d.ts +0 -145
  135. package/dist/core/src/events/EventBackend.d.ts +0 -11
  136. package/dist/core/src/events/EventOptions.d.ts +0 -109
  137. package/dist/core/src/events/EventPriorityQueue.d.ts +0 -202
  138. package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
  139. package/dist/core/src/events/index.d.ts +0 -14
  140. package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
  141. package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
  142. package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
  143. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -240
  144. package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
  145. package/dist/core/src/events/observability/index.d.ts +0 -20
  146. package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
  147. package/dist/core/src/events/types.d.ts +0 -75
  148. package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
  149. package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
  150. package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
  151. package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
  152. package/dist/core/src/exceptions/HttpException.d.ts +0 -9
  153. package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
  154. package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
  155. package/dist/core/src/exceptions/index.d.ts +0 -7
  156. package/dist/core/src/helpers/Arr.d.ts +0 -19
  157. package/dist/core/src/helpers/Str.d.ts +0 -23
  158. package/dist/core/src/helpers/data.d.ts +0 -25
  159. package/dist/core/src/helpers/errors.d.ts +0 -34
  160. package/dist/core/src/helpers/response.d.ts +0 -41
  161. package/dist/core/src/helpers.d.ts +0 -338
  162. package/dist/core/src/http/CookieJar.d.ts +0 -51
  163. package/dist/core/src/http/cookie.d.ts +0 -29
  164. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  165. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  166. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  167. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  168. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  169. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  170. package/dist/core/src/http/types.d.ts +0 -355
  171. package/dist/core/src/index.d.ts +0 -76
  172. package/dist/core/src/instrumentation/index.d.ts +0 -35
  173. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  174. package/dist/core/src/instrumentation/types.d.ts +0 -182
  175. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -316
  176. package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
  177. package/dist/core/src/reliability/index.d.ts +0 -6
  178. package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
  179. package/dist/core/src/router/RequestValidator.d.ts +0 -20
  180. package/dist/core/src/runtime.d.ts +0 -119
  181. package/dist/core/src/security/Encrypter.d.ts +0 -33
  182. package/dist/core/src/security/Hasher.d.ts +0 -29
  183. package/dist/core/src/testing/HttpTester.d.ts +0 -39
  184. package/dist/core/src/testing/TestResponse.d.ts +0 -78
  185. package/dist/core/src/testing/index.d.ts +0 -2
  186. package/dist/core/src/types/events.d.ts +0 -94
  187. package/dist/echo/src/OrbitEcho.d.ts +0 -115
  188. package/dist/echo/src/index.d.ts +0 -64
  189. package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
  190. package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
  191. package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
  192. package/dist/echo/src/providers/index.d.ts +0 -14
  193. package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
  194. package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
  195. package/dist/echo/src/receive/index.d.ts +0 -2
  196. package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
  197. package/dist/echo/src/send/index.d.ts +0 -1
  198. package/dist/echo/src/types.d.ts +0 -756
  199. package/dist/index.d.ts.map +0 -1
  200. package/dist/photon/src/index.d.ts +0 -84
  201. package/dist/photon/src/middleware/binary.d.ts +0 -31
  202. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  203. package/dist/photon/src/middleware/ratelimit.d.ts +0 -157
  204. package/dist/photon/src/openapi.d.ts +0 -19
  205. package/dist/providers/GenericProvider.d.ts.map +0 -1
  206. package/dist/providers/GitHubProvider.d.ts.map +0 -1
  207. package/dist/providers/StripeProvider.d.ts.map +0 -1
  208. package/dist/providers/index.d.ts.map +0 -1
  209. package/dist/receive/SignatureValidator.d.ts.map +0 -1
  210. package/dist/receive/WebhookReceiver.d.ts.map +0 -1
  211. package/dist/receive/index.d.ts.map +0 -1
  212. package/dist/send/WebhookDispatcher.d.ts.map +0 -1
  213. package/dist/send/index.d.ts.map +0 -1
  214. package/dist/types.d.ts.map +0 -1
  215. /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
  216. /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
  217. /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
  218. /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
  219. /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
  220. /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
  221. /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
  222. /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
  223. /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
  224. /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
  225. /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
  226. /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
  227. /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
  228. /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
  229. /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
  230. /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
  231. /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
  232. /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
  233. /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
  234. /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
  235. /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
  236. /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
  237. /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
  238. /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
  239. /package/dist/{echo/src/resilience → resilience}/CircuitBreaker.d.ts +0 -0
  240. /package/dist/{echo/src/resilience → resilience}/index.d.ts +0 -0
  241. /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
  242. /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
  243. /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
  244. /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
  245. /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
@@ -1,118 +0,0 @@
1
- /**
2
- * Bun SQL Prepared Statement Manager
3
- * @description Manages prepared statement caching, lifecycle, and optimization
4
- */
5
- import type { BunSQLClient } from './types';
6
- /**
7
- * Configuration options for prepared statement manager
8
- */
9
- export interface PreparedStatementManagerConfig {
10
- /**
11
- * Maximum number of prepared statements to cache
12
- * @default 100
13
- */
14
- maxStatements?: number;
15
- /**
16
- * Idle timeout in milliseconds before a statement is removed
17
- * @default 60000 (1 minute)
18
- */
19
- idleTimeout?: number;
20
- }
21
- /**
22
- * Prepared Statement Manager for BunSQL
23
- *
24
- * Manages statement caching and lifecycle to optimize query performance.
25
- * Features:
26
- * - LRU (Least Recently Used) cache eviction
27
- * - Idle timeout cleanup
28
- * - Usage statistics tracking
29
- *
30
- * @example
31
- * ```typescript
32
- * const manager = new BunSQLPreparedStatementManager(client)
33
- *
34
- * // Prepare a statement
35
- * const stmtId = await manager.prepare('SELECT * FROM users WHERE id = ?')
36
- *
37
- * // Execute multiple times
38
- * const users1 = await manager.execute(stmtId, [1])
39
- * const users2 = await manager.execute(stmtId, [2])
40
- *
41
- * // Clean up
42
- * await manager.clear()
43
- * ```
44
- */
45
- export declare class BunSQLPreparedStatementManager {
46
- private readonly client;
47
- private statements;
48
- private sqlToName;
49
- private readonly config;
50
- private cleanupTimer?;
51
- constructor(client: BunSQLClient, config?: PreparedStatementManagerConfig);
52
- /**
53
- * Prepare a SQL statement for repeated execution
54
- *
55
- * @param sql - SQL query to prepare
56
- * @returns Prepared statement identifier
57
- */
58
- prepare(sql: string): Promise<string>;
59
- /**
60
- * Execute a prepared statement
61
- *
62
- * @param name - Prepared statement identifier
63
- * @param bindings - Query parameters
64
- * @returns Query result rows
65
- */
66
- execute<T = Record<string, unknown>>(name: string, bindings?: unknown[]): Promise<T[]>;
67
- /**
68
- * Clear all prepared statements
69
- */
70
- clear(): Promise<void>;
71
- /**
72
- * Clean up idle statements
73
- */
74
- cleanup(): Promise<void>;
75
- /**
76
- * Get statement usage statistics
77
- *
78
- * @param name - Prepared statement identifier
79
- * @returns Usage statistics or null if not found
80
- */
81
- getStats(name: string): {
82
- useCount: number;
83
- lastUsed: number;
84
- } | null;
85
- /**
86
- * Get the number of cached statements
87
- */
88
- getSize(): number;
89
- /**
90
- * Destroy the manager and clean up resources
91
- */
92
- destroy(): Promise<void>;
93
- /**
94
- * Evict the least recently used statement
95
- * @private
96
- */
97
- private evictLeastRecentlyUsed;
98
- /**
99
- * Generate a unique statement name
100
- * @private
101
- */
102
- private generateStatementName;
103
- /**
104
- * Simple hash function for SQL strings
105
- * @private
106
- */
107
- private simpleHash;
108
- /**
109
- * Start periodic cleanup timer
110
- * @private
111
- */
112
- private startCleanupTimer;
113
- /**
114
- * Stop cleanup timer
115
- * @private
116
- */
117
- private stopCleanupTimer;
118
- }
@@ -1,36 +0,0 @@
1
- import type { ConnectionConfig, DriverContract, DriverType, ExecuteResult, QueryResult } from '../types';
2
- /**
3
- * MongoDB Driver
4
- * Provides a document interface via DB.connection('mongodb')
5
- */
6
- import type { MongoClient } from './types';
7
- export declare class MongoDBDriver implements DriverContract {
8
- private config;
9
- private client;
10
- private db;
11
- private MongoClientCtor?;
12
- constructor(config: ConnectionConfig, deps?: {
13
- MongoClient?: new (url: string, options?: Record<string, unknown>) => MongoClient;
14
- });
15
- getDriverName(): DriverType;
16
- connect(): Promise<void>;
17
- /**
18
- * Dynamically load mongodb module
19
- */
20
- private loadMongoModule;
21
- disconnect(): Promise<void>;
22
- isConnected(): boolean;
23
- /**
24
- * Execute a query (Protocol: JSON String)
25
- */
26
- query<T = Record<string, unknown>>(protocolJson: string, _bindings?: unknown[]): Promise<QueryResult<T>>;
27
- /**
28
- * Execute a write operation (Protocol: JSON String)
29
- */
30
- execute(protocolJson: string, _bindings?: unknown[]): Promise<ExecuteResult>;
31
- beginTransaction(): Promise<void>;
32
- commit(): Promise<void>;
33
- rollback(): Promise<void>;
34
- inTransaction(): boolean;
35
- private mapDocument;
36
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * MySQL/MariaDB Driver
3
- * @description Database driver for MySQL and MariaDB using mysql2 package
4
- */
5
- import type { ConnectionConfig, DriverContract, DriverType, ExecuteResult, QueryResult } from '../types';
6
- export declare class MySQLDriver implements DriverContract {
7
- private readonly config;
8
- private readonly driverType;
9
- private pool;
10
- private transactionConnection;
11
- private connected;
12
- private mysql;
13
- constructor(config: ConnectionConfig, driverType?: 'mysql' | 'mariadb');
14
- /**
15
- * Get the driver name
16
- */
17
- getDriverName(): DriverType;
18
- /**
19
- * Connect to MySQL/MariaDB
20
- */
21
- connect(): Promise<void>;
22
- /**
23
- * Dynamically load mysql2 module
24
- */
25
- private loadMySQLModule;
26
- /**
27
- * Disconnect from MySQL
28
- */
29
- disconnect(): Promise<void>;
30
- /**
31
- * Check if connected
32
- */
33
- isConnected(): boolean;
34
- /**
35
- * Execute a query
36
- */
37
- query<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
38
- /**
39
- * Execute a statement (INSERT/UPDATE/DELETE)
40
- */
41
- execute(sql: string, bindings?: unknown[]): Promise<ExecuteResult>;
42
- /**
43
- * Begin a transaction
44
- */
45
- beginTransaction(): Promise<void>;
46
- /**
47
- * Commit the current transaction
48
- */
49
- commit(): Promise<void>;
50
- /**
51
- * Rollback the current transaction
52
- */
53
- rollback(): Promise<void>;
54
- /**
55
- * Check if in transaction
56
- */
57
- inTransaction(): boolean;
58
- /**
59
- * Get a connection from the pool
60
- */
61
- private getConnection;
62
- /**
63
- * Normalize MySQL/MariaDB errors
64
- */
65
- private normalizeError;
66
- }
@@ -1,83 +0,0 @@
1
- /**
2
- * PostgreSQL Driver
3
- * @description Database driver implementation for PostgreSQL using node-pg
4
- */
5
- import type { DriverContract, DriverType, ExecuteResult, PostgresConfig, QueryResult } from '../types';
6
- /**
7
- * PostgreSQL Driver
8
- * Connects and executes queries against PostgreSQL databases
9
- */
10
- export declare class PostgresDriver implements DriverContract {
11
- private readonly config;
12
- private pool;
13
- private connected;
14
- private transactionActive;
15
- private transactionClient;
16
- private preparedStatements;
17
- private statementCounter;
18
- constructor(config: PostgresConfig);
19
- /**
20
- * Get driver name
21
- */
22
- getDriverName(): DriverType;
23
- /**
24
- * Connect to the database
25
- */
26
- connect(): Promise<void>;
27
- /**
28
- * Disconnect from the database
29
- */
30
- disconnect(): Promise<void>;
31
- /**
32
- * Check if connected
33
- */
34
- isConnected(): boolean;
35
- /**
36
- * Execute a query and return results
37
- */
38
- query<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
39
- /**
40
- * Execute a statement (INSERT/UPDATE/DELETE)
41
- */
42
- execute(sql: string, bindings?: unknown[]): Promise<ExecuteResult>;
43
- /**
44
- * Prepare a statement for repeated execution
45
- */
46
- prepare(sql: string): Promise<string>;
47
- /**
48
- * Execute a prepared statement
49
- */
50
- executePrepared<T>(name: string, bindings?: unknown[]): Promise<QueryResult<T>>;
51
- /**
52
- * Clear all prepared statements
53
- */
54
- clearPreparedStatements(): Promise<void>;
55
- /**
56
- * Begin a transaction
57
- */
58
- beginTransaction(): Promise<void>;
59
- /**
60
- * Commit the current transaction
61
- */
62
- commit(): Promise<void>;
63
- /**
64
- * Rollback the current transaction
65
- */
66
- rollback(): Promise<void>;
67
- /**
68
- * Check if currently in a transaction
69
- */
70
- inTransaction(): boolean;
71
- /**
72
- * Get a client for executing queries
73
- */
74
- private getClient;
75
- /**
76
- * Normalize PostgreSQL errors
77
- */
78
- private normalizeError;
79
- /**
80
- * Dynamically load the pg module
81
- */
82
- private loadPgModule;
83
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * Redis Driver
3
- * @description Driver implementation for Redis using ioredis
4
- */
5
- import type { ConnectionConfig, DriverContract, DriverType, ExecuteResult, QueryResult } from '../types';
6
- /**
7
- * Redis Driver
8
- * Provides a key-value interface via DB.connection('redis')
9
- */
10
- import type { RedisClient } from './types';
11
- export declare class RedisDriver implements DriverContract {
12
- private config;
13
- private client;
14
- private RedisCtor?;
15
- constructor(config: ConnectionConfig, deps?: {
16
- Redis?: new (config: Record<string, unknown>) => RedisClient;
17
- });
18
- getDriverName(): DriverType;
19
- connect(): Promise<void>;
20
- /**
21
- * Dynamically load ioredis module
22
- */
23
- private loadRedisModule;
24
- disconnect(): Promise<void>;
25
- isConnected(): boolean;
26
- /**
27
- * Raw Redis command execution via pseudo-SQL or direct mapping
28
- */
29
- query<T = any>(_sql: string, _bindings?: unknown[]): Promise<QueryResult<T>>;
30
- execute(_sql: string, _bindings?: unknown[]): Promise<ExecuteResult>;
31
- get(key: string): Promise<string | null>;
32
- set(key: string, value: string | number): Promise<'OK'>;
33
- setex(key: string, seconds: number, value: string | number): Promise<'OK'>;
34
- del(key: string): Promise<number>;
35
- /**
36
- * Get the raw ioredis client for advanced operations
37
- */
38
- getRawClient(): RedisClient | null;
39
- beginTransaction(): Promise<void>;
40
- commit(): Promise<void>;
41
- rollback(): Promise<void>;
42
- inTransaction(): boolean;
43
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * SQLite Driver
3
- * @description Database driver implementation for SQLite using better-sqlite3
4
- */
5
- import type { ConnectionConfig, DriverContract, DriverType, ExecuteResult, QueryResult } from '../types';
6
- /**
7
-
8
- * SQLite Driver
9
-
10
- */
11
- /**
12
- * SQLite driver implementation for Atlas ORM.
13
- *
14
- * Automatically detects and uses `bun:sqlite` if running in Bun,
15
- * otherwise falls back to `better-sqlite3`.
16
- *
17
- * @public
18
- * @since 3.0.0
19
- */
20
- export declare class SQLiteDriver implements DriverContract {
21
- private config;
22
- private client;
23
- private inTransactionState;
24
- constructor(config: ConnectionConfig);
25
- getDriverName(): DriverType;
26
- connect(): Promise<void>;
27
- disconnect(): Promise<void>;
28
- isConnected(): boolean;
29
- query<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
30
- execute(sql: string, bindings?: unknown[]): Promise<ExecuteResult>;
31
- beginTransaction(): Promise<void>;
32
- commit(): Promise<void>;
33
- rollback(): Promise<void>;
34
- inTransaction(): boolean;
35
- /**
36
-
37
-
38
-
39
- * Normalize SQLite errors
40
-
41
-
42
-
43
- */
44
- private normalizeError;
45
- }
@@ -1,260 +0,0 @@
1
- /**
2
- * Driver Type Definitions
3
- * @description Type definitions for third-party database driver libraries
4
- */
5
- /**
6
- * MySQL/MariaDB Pool Connection
7
- */
8
- export interface MySQLPool {
9
- query(sql: string, values?: unknown[]): Promise<unknown>;
10
- execute(sql: string, values?: unknown[]): Promise<unknown>;
11
- getConnection(): Promise<MySQLConnection>;
12
- end(): Promise<void>;
13
- }
14
- /**
15
- * MySQL/MariaDB Connection
16
- */
17
- export interface MySQLConnection {
18
- query(sql: string, values?: unknown[]): Promise<unknown>;
19
- execute(sql: string, values?: unknown[]): Promise<unknown>;
20
- beginTransaction(): Promise<void>;
21
- commit(): Promise<void>;
22
- rollback(): Promise<void>;
23
- release(): void;
24
- }
25
- /**
26
- * MySQL/MariaDB Module
27
- */
28
- export interface MySQLModule {
29
- createPool(config: Record<string, unknown>): MySQLPool;
30
- createConnection(config: Record<string, unknown>): Promise<MySQLConnection>;
31
- }
32
- /**
33
- * PostgreSQL Pool Client
34
- */
35
- export interface PostgresPoolClient {
36
- query(sql: string, values?: unknown[]): Promise<{
37
- rows: unknown[];
38
- rowCount: number;
39
- }>;
40
- release(): void;
41
- }
42
- /**
43
- * PostgreSQL Pool
44
- */
45
- export interface PostgresPool {
46
- connect(): Promise<PostgresPoolClient>;
47
- query(sql: string, values?: unknown[]): Promise<{
48
- rows: unknown[];
49
- rowCount: number;
50
- }>;
51
- end(): Promise<void>;
52
- }
53
- /**
54
- * SQLite Database Client (Bun)
55
- */
56
- export interface SQLiteClient {
57
- prepare(sql: string): SQLiteStatement;
58
- query(sql: string, ...params: unknown[]): unknown[];
59
- run(sql: string, ...params: unknown[]): {
60
- changes: number;
61
- lastInsertRowid: number;
62
- };
63
- exec?(sql: string): void;
64
- pragma?(name: string, value?: unknown): unknown;
65
- open?: boolean;
66
- inTransaction?: boolean;
67
- close(): void;
68
- }
69
- /**
70
- * SQLite Statement
71
- */
72
- export interface SQLiteStatement {
73
- run(...params: unknown[]): {
74
- changes: number;
75
- lastInsertRowid: number;
76
- };
77
- all(...params: unknown[]): unknown[];
78
- get(...params: unknown[]): unknown;
79
- }
80
- /**
81
- * Redis Client
82
- */
83
- export interface RedisClient {
84
- connect(): Promise<void>;
85
- get(key: string): Promise<string | null>;
86
- set(key: string, value: string | number): Promise<'OK'>;
87
- setex(key: string, seconds: number, value: string | number): Promise<'OK'>;
88
- del(key: string): Promise<number>;
89
- keys(pattern: string): Promise<string[]>;
90
- exists(key: string): Promise<number>;
91
- expire(key: string, seconds: number): Promise<number>;
92
- quit(): Promise<void>;
93
- status?: string;
94
- }
95
- /**
96
- * MongoDB Client
97
- */
98
- export interface MongoClient {
99
- connect(): Promise<void>;
100
- db(name?: string): MongoDatabase;
101
- close(): Promise<void>;
102
- }
103
- /**
104
- * MongoDB Database
105
- */
106
- export interface MongoDatabase {
107
- collection(name: string): MongoCollection;
108
- }
109
- /**
110
- * MongoDB Collection
111
- */
112
- export interface MongoCollection {
113
- find(filter?: Record<string, unknown>, options?: Record<string, unknown>): MongoCursor;
114
- findOne(filter?: Record<string, unknown>): Promise<Record<string, unknown> | null>;
115
- insertOne(doc: Record<string, unknown>): Promise<{
116
- insertedId: unknown;
117
- }>;
118
- insertMany(docs: Record<string, unknown>[]): Promise<{
119
- insertedIds: unknown[];
120
- insertedCount: number;
121
- }>;
122
- countDocuments(filter?: Record<string, unknown>): Promise<number>;
123
- updateOne(filter: Record<string, unknown>, update: Record<string, unknown>): Promise<{
124
- modifiedCount: number;
125
- }>;
126
- updateMany(filter: Record<string, unknown>, update: Record<string, unknown>): Promise<{
127
- modifiedCount: number;
128
- }>;
129
- deleteOne(filter: Record<string, unknown>): Promise<{
130
- deletedCount: number;
131
- }>;
132
- deleteMany(filter: Record<string, unknown>): Promise<{
133
- deletedCount: number;
134
- }>;
135
- }
136
- /**
137
- * MongoDB Cursor
138
- */
139
- export interface MongoCursor {
140
- toArray(): Promise<Record<string, unknown>[]>;
141
- limit(n: number): MongoCursor;
142
- skip(n: number): MongoCursor;
143
- sort(sort: Record<string, 1 | -1>): MongoCursor;
144
- }
145
- /**
146
- * Bun SQL Client (Enhanced for Bun 1.3+)
147
- * @description Comprehensive type definitions for Bun.sql native driver
148
- */
149
- export interface BunSQLClient {
150
- (strings: TemplateStringsArray, ...values: unknown[]): Promise<BunSQLResult>;
151
- unsafe?(sql: string, bindings?: unknown[]): Promise<BunSQLResult>;
152
- query?(sql: string, bindings?: unknown[]): Promise<BunSQLResult>;
153
- all?(sql: string, bindings?: unknown[]): Promise<unknown[]>;
154
- run?(sql: string, bindings?: unknown[]): Promise<BunSQLResult>;
155
- simple?(strings: TemplateStringsArray, ...values: unknown[]): Promise<BunSQLResult>;
156
- prepare?(sql: string): BunSQLPreparedStatement;
157
- transaction?<T>(callback: (sql: BunSQLClient) => Promise<T>): Promise<T>;
158
- begin?(): Promise<BunSQLTransaction>;
159
- close?(): Promise<void>;
160
- end?(): Promise<void>;
161
- readonly connections?: {
162
- idle: number;
163
- pending: number;
164
- active: number;
165
- total: number;
166
- };
167
- }
168
- /**
169
- * Bun SQL Query Result
170
- * @description Result structure returned by Bun.sql queries
171
- */
172
- export interface BunSQLResult {
173
- /**
174
- * Result rows (iterable)
175
- */
176
- rows?: unknown[];
177
- /**
178
- * Number of rows affected/returned
179
- */
180
- rowCount?: number;
181
- count?: number;
182
- /**
183
- * Last inserted ID (for INSERT operations)
184
- */
185
- lastInsertRowid?: number | bigint;
186
- /**
187
- * Number of changed rows (for UPDATE operations)
188
- */
189
- changes?: number;
190
- /**
191
- * Iterator support for streaming
192
- */
193
- [Symbol.iterator](): Iterator<unknown>;
194
- }
195
- /**
196
- * Bun SQL Prepared Statement
197
- * @description Prepared statement interface for query optimization
198
- */
199
- export interface BunSQLPreparedStatement {
200
- /**
201
- * Execute prepared statement and return result
202
- */
203
- run(...params: unknown[]): Promise<BunSQLResult>;
204
- /**
205
- * Execute and return all rows
206
- */
207
- all(...params: unknown[]): Promise<unknown[]>;
208
- /**
209
- * Execute and return first row
210
- */
211
- get(...params: unknown[]): Promise<unknown | undefined>;
212
- /**
213
- * Finalize and release the prepared statement
214
- */
215
- finalize(): void;
216
- }
217
- /**
218
- * Bun SQL Transaction
219
- * @description Transaction handle for advanced transaction control
220
- */
221
- export interface BunSQLTransaction {
222
- /**
223
- * Commit the transaction
224
- */
225
- commit(): Promise<void>;
226
- /**
227
- * Rollback the transaction
228
- */
229
- rollback(): Promise<void>;
230
- /**
231
- * Create a savepoint
232
- */
233
- savepoint?(name: string): Promise<void>;
234
- /**
235
- * Rollback to a savepoint
236
- */
237
- rollbackTo?(name: string): Promise<void>;
238
- /**
239
- * Release a savepoint
240
- */
241
- release?(name: string): Promise<void>;
242
- }
243
- /**
244
- * Bun SQL Pool Configuration
245
- * @description Configuration options for connection pool
246
- */
247
- export interface BunSQLPoolConfig {
248
- /**
249
- * Maximum number of connections in the pool
250
- */
251
- max?: number;
252
- /**
253
- * Maximum time (ms) a connection can be idle before being released
254
- */
255
- idleTimeout?: number;
256
- /**
257
- * Maximum time (ms) to wait for a connection from the pool
258
- */
259
- connectionTimeout?: number;
260
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Base Database Error
3
- */
4
- export declare class DatabaseError extends Error {
5
- readonly originalError: unknown;
6
- readonly query?: string;
7
- readonly bindings?: unknown[];
8
- constructor(message: string, originalError?: unknown, query?: string, bindings?: unknown[]);
9
- }
10
- /**
11
- * Constraint Violation Error (Base)
12
- */
13
- export declare class ConstraintViolationError extends DatabaseError {
14
- constructor(message: string, originalError?: unknown, query?: string, bindings?: unknown[]);
15
- }
16
- /**
17
- * Unique Constraint Violation
18
- */
19
- export declare class UniqueConstraintError extends ConstraintViolationError {
20
- constructor(message: string, originalError?: unknown, query?: string, bindings?: unknown[]);
21
- }
22
- /**
23
- * Foreign Key Constraint Violation
24
- */
25
- export declare class ForeignKeyConstraintError extends ConstraintViolationError {
26
- constructor(message: string, originalError?: unknown, query?: string, bindings?: unknown[]);
27
- }
28
- /**
29
- * Not Null Constraint Violation
30
- */
31
- export declare class NotNullConstraintError extends ConstraintViolationError {
32
- constructor(message: string, originalError?: unknown, query?: string, bindings?: unknown[]);
33
- }
34
- /**
35
- * Table Not Found Error
36
- */
37
- export declare class TableNotFoundError extends DatabaseError {
38
- constructor(message: string, originalError?: unknown, query?: string, bindings?: unknown[]);
39
- }
40
- /**
41
- * Connection Error
42
- */
43
- export declare class ConnectionError extends DatabaseError {
44
- constructor(message: string, originalError?: unknown);
45
- }