@gravito/ripple 4.0.0 → 4.0.3

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 (225) hide show
  1. package/README.md +26 -10
  2. package/dist/{ripple/src/OrbitRipple.d.ts → OrbitRipple.d.ts} +1 -0
  3. package/dist/{ripple/src/RippleServer.d.ts → RippleServer.d.ts} +32 -2
  4. package/dist/core/src/Application.d.ts +41 -0
  5. package/dist/core/src/ConfigManager.d.ts +39 -0
  6. package/dist/core/src/Container/RequestScopeManager.d.ts +62 -0
  7. package/dist/core/src/Container/RequestScopeMetrics.d.ts +144 -0
  8. package/dist/core/src/Container.d.ts +45 -0
  9. package/dist/core/src/ErrorHandler.d.ts +3 -0
  10. package/dist/core/src/HookManager.d.ts +104 -165
  11. package/dist/core/src/PlanetCore.d.ts +114 -1
  12. package/dist/core/src/RequestContext.d.ts +97 -0
  13. package/dist/core/src/Router.d.ts +32 -46
  14. package/dist/core/src/ServiceProvider.d.ts +22 -0
  15. package/dist/core/src/adapters/bun/BunContext.d.ts +10 -1
  16. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +35 -0
  17. package/dist/core/src/adapters/bun/BunWebSocketHandler.d.ts +48 -0
  18. package/dist/core/src/adapters/bun/RadixRouter.d.ts +1 -0
  19. package/dist/core/src/adapters/bun/index.d.ts +7 -0
  20. package/dist/core/src/binary/BinaryUtils.d.ts +105 -0
  21. package/dist/core/src/binary/index.d.ts +5 -0
  22. package/dist/core/src/cli/queue-commands.d.ts +6 -0
  23. package/dist/core/src/compat/async-local-storage.d.ts +7 -0
  24. package/dist/core/src/compat/crypto.d.ts +6 -0
  25. package/dist/core/src/engine/AOTRouter.d.ts +16 -1
  26. package/dist/core/src/engine/FastContext.d.ts +42 -1
  27. package/dist/core/src/engine/Gravito.d.ts +13 -19
  28. package/dist/core/src/engine/MinimalContext.d.ts +23 -0
  29. package/dist/core/src/engine/analyzer.d.ts +92 -6
  30. package/dist/core/src/engine/types.d.ts +6 -0
  31. package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +126 -0
  32. package/dist/core/src/events/BackpressureManager.d.ts +215 -0
  33. package/dist/core/src/events/DeadLetterQueue.d.ts +75 -1
  34. package/dist/core/src/events/EventBackend.d.ts +2 -1
  35. package/dist/core/src/events/EventOptions.d.ts +99 -4
  36. package/dist/core/src/events/EventPriorityQueue.d.ts +36 -175
  37. package/dist/core/src/events/FlowControlStrategy.d.ts +109 -0
  38. package/dist/core/src/events/MessageQueueBridge.d.ts +184 -0
  39. package/dist/core/src/events/PriorityEscalationManager.d.ts +82 -0
  40. package/dist/core/src/events/RetryScheduler.d.ts +104 -0
  41. package/dist/core/src/events/WorkerPool.d.ts +98 -0
  42. package/dist/core/src/events/WorkerPoolConfig.d.ts +153 -0
  43. package/dist/core/src/events/WorkerPoolMetrics.d.ts +65 -0
  44. package/dist/core/src/events/aggregation/AggregationWindow.d.ts +77 -0
  45. package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +135 -0
  46. package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +108 -0
  47. package/dist/core/src/events/aggregation/EventBatcher.d.ts +99 -0
  48. package/dist/core/src/events/aggregation/types.d.ts +117 -0
  49. package/dist/core/src/events/index.d.ts +18 -6
  50. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +92 -0
  51. package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +76 -0
  52. package/dist/core/src/events/observability/index.d.ts +4 -0
  53. package/dist/core/src/events/queue-core.d.ts +77 -0
  54. package/dist/core/src/events/task-executor.d.ts +51 -0
  55. package/dist/core/src/events/types.d.ts +59 -0
  56. package/dist/core/src/ffi/NativeAccelerator.d.ts +62 -0
  57. package/dist/core/src/ffi/NativeHasher.d.ts +139 -0
  58. package/dist/core/src/ffi/cbor-fallback.d.ts +96 -0
  59. package/dist/core/src/ffi/hash-fallback.d.ts +33 -0
  60. package/dist/core/src/ffi/index.d.ts +10 -0
  61. package/dist/core/src/ffi/types.d.ts +135 -0
  62. package/dist/core/src/health/HealthProvider.d.ts +67 -0
  63. package/dist/core/src/helpers/Str.d.ts +15 -0
  64. package/dist/core/src/hooks/ActionManager.d.ts +132 -0
  65. package/dist/core/src/hooks/AsyncDetector.d.ts +84 -0
  66. package/dist/core/src/hooks/FilterManager.d.ts +71 -0
  67. package/dist/core/src/hooks/MigrationWarner.d.ts +24 -0
  68. package/dist/core/src/hooks/dlq-operations.d.ts +60 -0
  69. package/dist/core/src/hooks/types.d.ts +107 -0
  70. package/dist/core/src/http/CookieJar.d.ts +2 -2
  71. package/dist/core/src/http/types.d.ts +43 -3
  72. package/dist/core/src/index.d.ts +504 -15
  73. package/dist/core/src/observability/QueueDashboard.d.ts +136 -0
  74. package/dist/core/src/observability/contracts.d.ts +137 -0
  75. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +36 -3
  76. package/dist/core/src/runtime/adapter-bun.d.ts +12 -0
  77. package/dist/core/src/runtime/adapter-deno.d.ts +12 -0
  78. package/dist/core/src/runtime/adapter-node.d.ts +12 -0
  79. package/dist/core/src/runtime/adapter-unknown.d.ts +13 -0
  80. package/dist/core/src/runtime/archive.d.ts +17 -0
  81. package/dist/core/src/runtime/compression.d.ts +21 -0
  82. package/dist/core/src/runtime/deep-equals.d.ts +56 -0
  83. package/dist/core/src/runtime/detection.d.ts +22 -0
  84. package/dist/core/src/runtime/escape.d.ts +34 -0
  85. package/dist/core/src/runtime/index.d.ts +44 -0
  86. package/dist/core/src/runtime/markdown.d.ts +44 -0
  87. package/dist/core/src/runtime/types.d.ts +436 -0
  88. package/dist/core/src/runtime-helpers.d.ts +67 -0
  89. package/dist/core/src/runtime.d.ts +10 -118
  90. package/dist/core/src/testing/HttpTester.d.ts +1 -0
  91. package/dist/core/src/transpiler-utils.d.ts +170 -0
  92. package/dist/{ripple/src/engines → engines}/BunEngine.d.ts +11 -0
  93. package/dist/engines/UWebSocketsEngine.d.ts +97 -0
  94. package/dist/engines/WsEngine.d.ts +69 -0
  95. package/dist/{ripple/src/engines → engines}/index.d.ts +4 -0
  96. package/dist/index.js +1 -7139
  97. package/dist/index.js.map +3 -69
  98. package/dist/{ripple/src/serializers → serializers}/ISerializer.d.ts +1 -1
  99. package/dist/{ripple/src/serializers → serializers}/JsonSerializer.d.ts +1 -1
  100. package/dist/{ripple/src/serializers → serializers}/ProtobufSerializer.d.ts +6 -3
  101. package/dist/{ripple/src/types.d.ts → types.d.ts} +11 -0
  102. package/package.json +7 -2
  103. package/dist/atlas/src/DB.d.ts +0 -301
  104. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  105. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  106. package/dist/atlas/src/config/index.d.ts +0 -7
  107. package/dist/atlas/src/config/loadConfig.d.ts +0 -48
  108. package/dist/atlas/src/connection/Connection.d.ts +0 -108
  109. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -111
  110. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  111. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  112. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  113. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -66
  114. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -83
  115. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  116. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  117. package/dist/atlas/src/drivers/types.d.ts +0 -260
  118. package/dist/atlas/src/errors/index.d.ts +0 -45
  119. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  120. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  121. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  122. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  123. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  124. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  125. package/dist/atlas/src/index.d.ts +0 -67
  126. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  127. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  128. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  129. package/dist/atlas/src/migration/index.d.ts +0 -6
  130. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -11
  131. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  132. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  133. package/dist/atlas/src/observability/index.d.ts +0 -9
  134. package/dist/atlas/src/orm/index.d.ts +0 -5
  135. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  136. package/dist/atlas/src/orm/model/Model.d.ts +0 -449
  137. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  138. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -136
  139. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  140. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -87
  141. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  142. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  143. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  144. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  145. package/dist/atlas/src/orm/model/decorators.d.ts +0 -109
  146. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  147. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  148. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  149. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  150. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -123
  151. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  152. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  153. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  154. package/dist/atlas/src/query/Expression.d.ts +0 -60
  155. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  156. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -573
  157. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  158. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  159. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  160. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  161. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  162. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  163. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  164. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  165. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  166. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  167. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  168. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  169. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  170. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  171. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  172. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  173. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  174. package/dist/atlas/src/schema/index.d.ts +0 -8
  175. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  176. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  177. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  178. package/dist/atlas/src/seed/index.d.ts +0 -6
  179. package/dist/atlas/src/types/index.d.ts +0 -1100
  180. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  181. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -171
  182. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  183. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  184. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  185. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  186. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  187. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  188. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  189. package/dist/core/src/instrumentation/index.d.ts +0 -35
  190. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  191. package/dist/core/src/instrumentation/types.d.ts +0 -182
  192. package/dist/photon/src/index.d.ts +0 -84
  193. package/dist/photon/src/middleware/binary.d.ts +0 -31
  194. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  195. package/dist/photon/src/middleware/ratelimit.d.ts +0 -157
  196. package/dist/photon/src/openapi.d.ts +0 -19
  197. /package/dist/{ripple/src/channels → channels}/Channel.d.ts +0 -0
  198. /package/dist/{ripple/src/channels → channels}/ChannelManager.d.ts +0 -0
  199. /package/dist/{ripple/src/channels → channels}/index.d.ts +0 -0
  200. /package/dist/{ripple/src/drivers → drivers}/LocalDriver.d.ts +0 -0
  201. /package/dist/{ripple/src/drivers → drivers}/NATSDriver.d.ts +0 -0
  202. /package/dist/{ripple/src/drivers → drivers}/RedisDriver.d.ts +0 -0
  203. /package/dist/{ripple/src/drivers → drivers}/index.d.ts +0 -0
  204. /package/dist/{ripple/src/engines → engines}/IRippleEngine.d.ts +0 -0
  205. /package/dist/{ripple/src/errors → errors}/RippleError.d.ts +0 -0
  206. /package/dist/{ripple/src/errors → errors}/index.d.ts +0 -0
  207. /package/dist/{ripple/src/events → events}/BroadcastEvent.d.ts +0 -0
  208. /package/dist/{ripple/src/events → events}/BroadcastManager.d.ts +0 -0
  209. /package/dist/{ripple/src/events → events}/Broadcaster.d.ts +0 -0
  210. /package/dist/{ripple/src/events → events}/index.d.ts +0 -0
  211. /package/dist/{ripple/src/health → health}/HealthChecker.d.ts +0 -0
  212. /package/dist/{ripple/src/health → health}/index.d.ts +0 -0
  213. /package/dist/{ripple/src/index.d.ts → index.d.ts} +0 -0
  214. /package/dist/{ripple/src/logging → logging}/Logger.d.ts +0 -0
  215. /package/dist/{ripple/src/logging → logging}/index.d.ts +0 -0
  216. /package/dist/{ripple/src/middleware → middleware}/InterceptorManager.d.ts +0 -0
  217. /package/dist/{ripple/src/observability → observability}/RippleMetrics.d.ts +0 -0
  218. /package/dist/{ripple/src/reliability → reliability}/AckManager.d.ts +0 -0
  219. /package/dist/{ripple/src/serializers → serializers}/index.d.ts +0 -0
  220. /package/dist/{ripple/src/tracking → tracking}/ConnectionTracker.d.ts +0 -0
  221. /package/dist/{ripple/src/tracking → tracking}/SessionManager.d.ts +0 -0
  222. /package/dist/{ripple/src/tracking → tracking}/index.d.ts +0 -0
  223. /package/dist/{ripple/src/utils → utils}/MessageSerializer.d.ts +0 -0
  224. /package/dist/{ripple/src/utils → utils}/TokenBucket.d.ts +0 -0
  225. /package/dist/{ripple/src/utils → utils}/index.d.ts +0 -0
@@ -1,111 +0,0 @@
1
- /**
2
- * Connection Manager
3
- * @description Manages multiple database connections
4
- */
5
- import type { ConnectionConfig, ConnectionContract } from '../types';
6
- /**
7
- * Connection Manager
8
- *
9
- * Responsible for managing the lifecycle of database connections.
10
- * It handles connection pooling (via drivers), lazy initialization,
11
- * and automatic cleanup of idle connections.
12
- *
13
- * Connections are stored in a Map and retrieved by name. If a connection
14
- * hasn't been initialized, the manager creates it using the provided configuration.
15
- */
16
- export declare class ConnectionManager {
17
- private readonly configs;
18
- private connections;
19
- private defaultConnectionName;
20
- private lastUsed;
21
- private cleanupInterval?;
22
- private readonly MAX_IDLE_TIME;
23
- private readonly CLEANUP_INTERVAL;
24
- constructor(configs?: Record<string, ConnectionConfig>);
25
- /**
26
- * Get a connection instance by name.
27
- * If the connection is not already initialized, it will be created.
28
- *
29
- * @param name - Optional connection name (defaults to 'default').
30
- * @returns The connection instance.
31
- * @throws Error if the connection is not configured.
32
- */
33
- connection(name?: string): ConnectionContract;
34
- /**
35
- * Add a connection configuration.
36
- *
37
- * @param name - Unique name for the connection.
38
- * @param config - Connection configuration settings.
39
- */
40
- addConnection(name: string, config: ConnectionConfig): void;
41
- /**
42
- * Set the default connection name.
43
- *
44
- * @param name - The name of the default connection.
45
- */
46
- setDefaultConnection(name: string): void;
47
- /**
48
- * Get the default connection name.
49
- *
50
- * @returns The default connection name.
51
- */
52
- getDefaultConnection(): string;
53
- /**
54
- * Check if a connection configuration exists.
55
- *
56
- * @param name - The connection name to check.
57
- * @returns True if the connection is configured.
58
- */
59
- hasConnection(name: string): boolean;
60
- /**
61
- * Get all configured connection names.
62
- *
63
- * @returns Array of connection names.
64
- */
65
- getConnectionNames(): string[];
66
- /**
67
- * Get the configuration for a specific connection.
68
- *
69
- * @param name - The connection name.
70
- * @returns The connection configuration or undefined if not found.
71
- */
72
- getConfig(name: string): ConnectionConfig | undefined;
73
- /**
74
- * Disconnect all active connections.
75
- *
76
- * @returns A promise that resolves when all connections are closed.
77
- */
78
- disconnectAll(): Promise<void>;
79
- /**
80
- * Disconnect a specific connection by name.
81
- *
82
- * @param name - Optional connection name (defaults to default).
83
- * @returns A promise that resolves when the connection is closed.
84
- */
85
- disconnect(name?: string): Promise<void>;
86
- /**
87
- * Purge a connection from the manager's cache.
88
- * This will NOT disconnect the connection if it's already active.
89
- *
90
- * @param name - Optional connection name.
91
- */
92
- purge(name?: string): void;
93
- /**
94
- * Reconnect to a connection.
95
- * This will disconnect the existing connection and create a new one.
96
- *
97
- * @param name - Optional connection name.
98
- * @returns The new connection instance.
99
- */
100
- reconnect(name?: string): Promise<ConnectionContract>;
101
- private cleanupIdleConnections;
102
- private startCleanup;
103
- stopCleanup(): void;
104
- /**
105
- * Shutdown the connection manager.
106
- * Stops the idle cleanup interval and disconnects all connections.
107
- *
108
- * @returns A promise that resolves when shutdown is complete.
109
- */
110
- shutdown(): Promise<void>;
111
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Bun Native SQL Driver
3
- */
4
- import type { ConnectionConfig, DriverContract, DriverType, ExecuteResult, PoolStats, QueryResult } from '../types';
5
- export declare class BunSQLDriver implements DriverContract {
6
- private readonly config;
7
- private client;
8
- private sqliteClient;
9
- private connected;
10
- private transactionActive;
11
- private preparedManager?;
12
- constructor(config: ConnectionConfig);
13
- getDriverName(): DriverType;
14
- connect(): Promise<void>;
15
- disconnect(): Promise<void>;
16
- isConnected(): boolean;
17
- query<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<QueryResult<T>>;
18
- execute(sql: string, bindings?: unknown[]): Promise<ExecuteResult>;
19
- private normalizeBindings;
20
- beginTransaction(): Promise<void>;
21
- commit(): Promise<void>;
22
- rollback(): Promise<void>;
23
- inTransaction(): boolean;
24
- private ensureConnection;
25
- private getConnectionUrl;
26
- prepare(sql: string): Promise<string>;
27
- executePrepared<T = Record<string, unknown>>(name: string, bindings?: unknown[]): Promise<QueryResult<T>>;
28
- clearPreparedStatements(): Promise<void>;
29
- stream<T = Record<string, unknown>>(sql: string, bindings?: unknown[]): AsyncIterable<T>;
30
- getPoolStats(): PoolStats | null;
31
- private normalizeError;
32
- }
@@ -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
- }