@gravito/ripple 4.0.1 → 5.0.0
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.
- package/README.md +26 -10
- package/dist/{ripple/src/OrbitRipple.d.ts → OrbitRipple.d.ts} +1 -0
- package/dist/{ripple/src/RippleServer.d.ts → RippleServer.d.ts} +32 -1
- package/dist/core/src/Application.d.ts +41 -0
- package/dist/core/src/HookManager.d.ts +33 -189
- package/dist/core/src/PlanetCore.d.ts +31 -1
- package/dist/core/src/Router.d.ts +32 -46
- package/dist/core/src/adapters/bun/BunContext.d.ts +6 -1
- package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +35 -0
- package/dist/core/src/adapters/bun/BunWebSocketHandler.d.ts +48 -0
- package/dist/core/src/adapters/bun/RadixRouter.d.ts +1 -0
- package/dist/core/src/adapters/bun/index.d.ts +7 -0
- package/dist/core/src/binary/BinaryUtils.d.ts +105 -0
- package/dist/core/src/binary/index.d.ts +5 -0
- package/dist/core/src/compat/async-local-storage.d.ts +7 -0
- package/dist/core/src/compat/crypto.d.ts +6 -0
- package/dist/core/src/engine/AOTRouter.d.ts +10 -0
- package/dist/core/src/engine/FastContext.d.ts +19 -1
- package/dist/core/src/engine/Gravito.d.ts +13 -18
- package/dist/core/src/engine/MinimalContext.d.ts +2 -0
- package/dist/core/src/engine/analyzer.d.ts +92 -6
- package/dist/core/src/engine/types.d.ts +3 -0
- package/dist/core/src/events/CircuitBreaker.d.ts +12 -0
- package/dist/core/src/events/EventPriorityQueue.d.ts +18 -256
- package/dist/core/src/events/index.d.ts +12 -11
- package/dist/core/src/events/queue-core.d.ts +77 -0
- package/dist/core/src/events/task-executor.d.ts +51 -0
- package/dist/core/src/exceptions/AuthException.d.ts +10 -0
- package/dist/core/src/exceptions/AuthenticationException.d.ts +2 -2
- package/dist/core/src/exceptions/AuthorizationException.d.ts +2 -2
- package/dist/core/src/exceptions/CacheException.d.ts +9 -0
- package/dist/core/src/exceptions/CircularDependencyException.d.ts +2 -1
- package/dist/core/src/exceptions/ConfigurationException.d.ts +9 -0
- package/dist/core/src/exceptions/DatabaseException.d.ts +9 -0
- package/dist/core/src/exceptions/DomainException.d.ts +9 -0
- package/dist/core/src/exceptions/InfrastructureException.d.ts +17 -0
- package/dist/core/src/exceptions/QueueException.d.ts +9 -0
- package/dist/core/src/exceptions/StorageException.d.ts +9 -0
- package/dist/core/src/exceptions/StreamException.d.ts +9 -0
- package/dist/core/src/exceptions/SystemException.d.ts +9 -0
- package/dist/core/src/exceptions/ValidationException.d.ts +2 -2
- package/dist/core/src/exceptions/index.d.ts +10 -0
- package/dist/core/src/ffi/NativeAccelerator.d.ts +62 -0
- package/dist/core/src/ffi/NativeHasher.d.ts +139 -0
- package/dist/core/src/ffi/cbor-fallback.d.ts +96 -0
- package/dist/core/src/ffi/hash-fallback.d.ts +33 -0
- package/dist/core/src/ffi/index.d.ts +10 -0
- package/dist/core/src/ffi/types.d.ts +135 -0
- package/dist/core/src/helpers/Str.d.ts +15 -0
- package/dist/core/src/hooks/ActionManager.d.ts +132 -0
- package/dist/core/src/hooks/AsyncDetector.d.ts +84 -0
- package/dist/core/src/hooks/FilterManager.d.ts +71 -0
- package/dist/core/src/hooks/MigrationWarner.d.ts +24 -0
- package/dist/core/src/hooks/dlq-operations.d.ts +60 -0
- package/dist/core/src/hooks/types.d.ts +107 -0
- package/dist/core/src/http/CookieJar.d.ts +2 -2
- package/dist/core/src/http/types.d.ts +24 -3
- package/dist/core/src/index.d.ts +491 -14
- package/dist/core/src/observability/contracts.d.ts +137 -0
- package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +2 -3
- package/dist/core/src/runtime/adapter-bun.d.ts +12 -0
- package/dist/core/src/runtime/adapter-deno.d.ts +12 -0
- package/dist/core/src/runtime/adapter-node.d.ts +12 -0
- package/dist/core/src/runtime/adapter-unknown.d.ts +13 -0
- package/dist/core/src/runtime/archive.d.ts +17 -0
- package/dist/core/src/runtime/compression.d.ts +21 -0
- package/dist/core/src/runtime/deep-equals.d.ts +56 -0
- package/dist/core/src/runtime/detection.d.ts +22 -0
- package/dist/core/src/runtime/escape.d.ts +34 -0
- package/dist/core/src/runtime/index.d.ts +44 -0
- package/dist/core/src/runtime/markdown.d.ts +44 -0
- package/dist/core/src/runtime/types.d.ts +436 -0
- package/dist/core/src/runtime-helpers.d.ts +67 -0
- package/dist/core/src/runtime.d.ts +10 -118
- package/dist/core/src/testing/HttpTester.d.ts +1 -0
- package/dist/core/src/transpiler-utils.d.ts +170 -0
- package/dist/{ripple/src/engines → engines}/BunEngine.d.ts +11 -0
- package/dist/errors/RippleError.d.ts +66 -0
- package/dist/index.js +1 -7502
- package/dist/index.js.map +3 -71
- package/package.json +6 -2
- package/dist/atlas/src/DB.d.ts +0 -348
- package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
- package/dist/atlas/src/config/defineConfig.d.ts +0 -14
- package/dist/atlas/src/config/index.d.ts +0 -7
- package/dist/atlas/src/config/loadConfig.d.ts +0 -41
- package/dist/atlas/src/connection/Connection.d.ts +0 -112
- package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
- package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
- package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
- package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
- package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
- package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
- package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
- package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
- package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
- package/dist/atlas/src/drivers/types.d.ts +0 -260
- package/dist/atlas/src/errors/index.d.ts +0 -45
- package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
- package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
- package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
- package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
- package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
- package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
- package/dist/atlas/src/index.d.ts +0 -79
- package/dist/atlas/src/migration/Migration.d.ts +0 -64
- package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
- package/dist/atlas/src/migration/Migrator.d.ts +0 -110
- package/dist/atlas/src/migration/index.d.ts +0 -6
- package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
- package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
- package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
- package/dist/atlas/src/observability/index.d.ts +0 -9
- package/dist/atlas/src/orm/Repository.d.ts +0 -247
- package/dist/atlas/src/orm/index.d.ts +0 -6
- package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
- package/dist/atlas/src/orm/model/Model.d.ts +0 -458
- package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
- package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
- package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
- package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
- package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
- package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
- package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
- package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
- package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
- package/dist/atlas/src/orm/model/errors.d.ts +0 -52
- package/dist/atlas/src/orm/model/index.d.ts +0 -10
- package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
- package/dist/atlas/src/orm/model/types.d.ts +0 -12
- package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
- package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
- package/dist/atlas/src/orm/schema/index.d.ts +0 -6
- package/dist/atlas/src/orm/schema/types.d.ts +0 -85
- package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
- package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
- package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
- package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
- package/dist/atlas/src/query/Expression.d.ts +0 -60
- package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
- package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
- package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
- package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
- package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
- package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
- package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
- package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
- package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
- package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
- package/dist/atlas/src/query/clauses/index.d.ts +0 -11
- package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
- package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
- package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
- package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
- package/dist/atlas/src/schema/Schema.d.ts +0 -131
- package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
- package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
- package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
- package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
- package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
- package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
- package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
- package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
- package/dist/atlas/src/schema/index.d.ts +0 -8
- package/dist/atlas/src/seed/Factory.d.ts +0 -90
- package/dist/atlas/src/seed/Seeder.d.ts +0 -28
- package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
- package/dist/atlas/src/seed/index.d.ts +0 -6
- package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
- package/dist/atlas/src/types/index.d.ts +0 -1182
- package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
- package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
- package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
- package/dist/core/src/adapters/photon-types.d.ts +0 -73
- package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
- package/dist/core/src/http/middleware/Cors.d.ts +0 -24
- package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
- package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
- package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
- package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
- package/dist/core/src/instrumentation/index.d.ts +0 -35
- package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
- package/dist/core/src/instrumentation/types.d.ts +0 -182
- package/dist/core/src/observability/Metrics.d.ts +0 -244
- package/dist/photon/src/index.d.ts +0 -89
- package/dist/photon/src/middleware/binary.d.ts +0 -31
- package/dist/photon/src/middleware/htmx.d.ts +0 -39
- package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
- package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
- package/dist/photon/src/openapi.d.ts +0 -19
- package/dist/ripple/src/errors/RippleError.d.ts +0 -48
- /package/dist/{ripple/src/channels → channels}/Channel.d.ts +0 -0
- /package/dist/{ripple/src/channels → channels}/ChannelManager.d.ts +0 -0
- /package/dist/{ripple/src/channels → channels}/index.d.ts +0 -0
- /package/dist/{ripple/src/drivers → drivers}/LocalDriver.d.ts +0 -0
- /package/dist/{ripple/src/drivers → drivers}/NATSDriver.d.ts +0 -0
- /package/dist/{ripple/src/drivers → drivers}/RedisDriver.d.ts +0 -0
- /package/dist/{ripple/src/drivers → drivers}/index.d.ts +0 -0
- /package/dist/{ripple/src/engines → engines}/IRippleEngine.d.ts +0 -0
- /package/dist/{ripple/src/engines → engines}/UWebSocketsEngine.d.ts +0 -0
- /package/dist/{ripple/src/engines → engines}/WsEngine.d.ts +0 -0
- /package/dist/{ripple/src/engines → engines}/index.d.ts +0 -0
- /package/dist/{ripple/src/errors → errors}/index.d.ts +0 -0
- /package/dist/{ripple/src/events → events}/BroadcastEvent.d.ts +0 -0
- /package/dist/{ripple/src/events → events}/BroadcastManager.d.ts +0 -0
- /package/dist/{ripple/src/events → events}/Broadcaster.d.ts +0 -0
- /package/dist/{ripple/src/events → events}/index.d.ts +0 -0
- /package/dist/{ripple/src/health → health}/HealthChecker.d.ts +0 -0
- /package/dist/{ripple/src/health → health}/index.d.ts +0 -0
- /package/dist/{ripple/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{ripple/src/logging → logging}/Logger.d.ts +0 -0
- /package/dist/{ripple/src/logging → logging}/index.d.ts +0 -0
- /package/dist/{ripple/src/middleware → middleware}/InterceptorManager.d.ts +0 -0
- /package/dist/{ripple/src/observability → observability}/RippleMetrics.d.ts +0 -0
- /package/dist/{ripple/src/reliability → reliability}/AckManager.d.ts +0 -0
- /package/dist/{ripple/src/serializers → serializers}/ISerializer.d.ts +0 -0
- /package/dist/{ripple/src/serializers → serializers}/JsonSerializer.d.ts +0 -0
- /package/dist/{ripple/src/serializers → serializers}/ProtobufSerializer.d.ts +0 -0
- /package/dist/{ripple/src/serializers → serializers}/index.d.ts +0 -0
- /package/dist/{ripple/src/tracking → tracking}/ConnectionTracker.d.ts +0 -0
- /package/dist/{ripple/src/tracking → tracking}/SessionManager.d.ts +0 -0
- /package/dist/{ripple/src/tracking → tracking}/index.d.ts +0 -0
- /package/dist/{ripple/src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{ripple/src/utils → utils}/MessageSerializer.d.ts +0 -0
- /package/dist/{ripple/src/utils → utils}/TokenBucket.d.ts +0 -0
- /package/dist/{ripple/src/utils → utils}/index.d.ts +0 -0
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/atlas - Pool Strategy Engine
|
|
3
|
-
* @description Strategies for adaptive connection pool management
|
|
4
|
-
*/
|
|
5
|
-
import type { PoolStats } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* Pool strategy decision result
|
|
8
|
-
*/
|
|
9
|
-
export interface PoolAdjustmentDecision {
|
|
10
|
-
/**
|
|
11
|
-
* Action to take: 'increase' | 'decrease' | 'maintain'
|
|
12
|
-
*/
|
|
13
|
-
action: 'increase' | 'decrease' | 'maintain';
|
|
14
|
-
/**
|
|
15
|
-
* Target pool size
|
|
16
|
-
*/
|
|
17
|
-
targetSize: number;
|
|
18
|
-
/**
|
|
19
|
-
* Reason for the decision
|
|
20
|
-
*/
|
|
21
|
-
reason: string;
|
|
22
|
-
/**
|
|
23
|
-
* Confidence level (0-1)
|
|
24
|
-
*/
|
|
25
|
-
confidence: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Strategy context for decision making
|
|
29
|
-
*/
|
|
30
|
-
export interface PoolStrategyContext {
|
|
31
|
-
/**
|
|
32
|
-
* Current pool statistics
|
|
33
|
-
*/
|
|
34
|
-
stats: PoolStats;
|
|
35
|
-
/**
|
|
36
|
-
* Historical statistics (if available)
|
|
37
|
-
*/
|
|
38
|
-
history?: PoolStats[];
|
|
39
|
-
/**
|
|
40
|
-
* Pool configuration
|
|
41
|
-
*/
|
|
42
|
-
config: {
|
|
43
|
-
min?: number;
|
|
44
|
-
max?: number;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Connection name
|
|
48
|
-
*/
|
|
49
|
-
connectionName: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Abstract base class for pool adjustment strategies
|
|
53
|
-
*/
|
|
54
|
-
export declare abstract class PoolStrategy {
|
|
55
|
-
/**
|
|
56
|
-
* Strategy name
|
|
57
|
-
*/
|
|
58
|
-
abstract readonly name: string;
|
|
59
|
-
/**
|
|
60
|
-
* Make an adjustment decision based on pool context
|
|
61
|
-
*/
|
|
62
|
-
abstract decide(context: PoolStrategyContext): PoolAdjustmentDecision;
|
|
63
|
-
/**
|
|
64
|
-
* Validate if an adjustment decision is acceptable
|
|
65
|
-
*/
|
|
66
|
-
validateAdjustment(decision: PoolAdjustmentDecision, context: PoolStrategyContext): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Protected helper: calculate utilization ratio
|
|
69
|
-
*/
|
|
70
|
-
protected calculateUtilization(stats: PoolStats): number;
|
|
71
|
-
/**
|
|
72
|
-
* Protected helper: calculate pending ratio
|
|
73
|
-
*/
|
|
74
|
-
protected calculatePendingRatio(stats: PoolStats): number;
|
|
75
|
-
/**
|
|
76
|
-
* Protected helper: clamp value to bounds
|
|
77
|
-
*/
|
|
78
|
-
protected clampToSize(value: number, context: PoolStrategyContext): number;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Load-aware strategy: adjusts based on current utilization
|
|
82
|
-
*/
|
|
83
|
-
export declare class LoadAwareStrategy extends PoolStrategy {
|
|
84
|
-
readonly name = "load-aware";
|
|
85
|
-
private readonly warningUtilization;
|
|
86
|
-
private readonly criticalUtilization;
|
|
87
|
-
private readonly recoveryUtilization;
|
|
88
|
-
constructor(config?: {
|
|
89
|
-
warningUtilization?: number;
|
|
90
|
-
criticalUtilization?: number;
|
|
91
|
-
recoveryUtilization?: number;
|
|
92
|
-
});
|
|
93
|
-
decide(context: PoolStrategyContext): PoolAdjustmentDecision;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Predictive strategy: adjusts based on historical trends
|
|
97
|
-
*/
|
|
98
|
-
export declare class PredictiveStrategy extends PoolStrategy {
|
|
99
|
-
readonly name = "predictive";
|
|
100
|
-
private readonly minHistorySize;
|
|
101
|
-
constructor(config?: {
|
|
102
|
-
minHistorySize?: number;
|
|
103
|
-
});
|
|
104
|
-
decide(context: PoolStrategyContext): PoolAdjustmentDecision;
|
|
105
|
-
/**
|
|
106
|
-
* Calculate linear trend from data points
|
|
107
|
-
*/
|
|
108
|
-
private calculateTrend;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Hybrid strategy: combines multiple strategies
|
|
112
|
-
*/
|
|
113
|
-
export declare class HybridStrategy extends PoolStrategy {
|
|
114
|
-
private loadAware;
|
|
115
|
-
private predictive;
|
|
116
|
-
private loadWeight;
|
|
117
|
-
private predictiveWeight;
|
|
118
|
-
readonly name = "hybrid";
|
|
119
|
-
constructor(loadAware: LoadAwareStrategy, predictive: PredictiveStrategy, loadWeight?: number, predictiveWeight?: number);
|
|
120
|
-
decide(context: PoolStrategyContext): PoolAdjustmentDecision;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Create default strategies for pool management
|
|
124
|
-
*/
|
|
125
|
-
export declare function createDefaultStrategies(): {
|
|
126
|
-
loadAware: LoadAwareStrategy;
|
|
127
|
-
predictive: PredictiveStrategy;
|
|
128
|
-
hybrid: HybridStrategy;
|
|
129
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/atlas - Connection Pool Warmer
|
|
3
|
-
* @description Preheats connection pools during initialization
|
|
4
|
-
*/
|
|
5
|
-
import type { ConnectionManager } from '../connection/ConnectionManager';
|
|
6
|
-
export interface PoolWarmerConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Target number of connections to warm for each pool
|
|
9
|
-
* @default 2
|
|
10
|
-
*/
|
|
11
|
-
targetConnections?: number;
|
|
12
|
-
/**
|
|
13
|
-
* Number of concurrent warmup queries
|
|
14
|
-
* @default 2
|
|
15
|
-
*/
|
|
16
|
-
concurrency?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Timeout (ms) for each warmup query
|
|
19
|
-
* @default 5000
|
|
20
|
-
*/
|
|
21
|
-
timeout?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Callback when warmup completes
|
|
24
|
-
*/
|
|
25
|
-
onComplete?: (result: WarmupResult) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Callback for individual connection warmup
|
|
28
|
-
*/
|
|
29
|
-
onConnectionWarmed?: (connection: string, duration: number) => void;
|
|
30
|
-
}
|
|
31
|
-
export interface ConnectionWarmupResult {
|
|
32
|
-
/**
|
|
33
|
-
* Whether warmup succeeded
|
|
34
|
-
*/
|
|
35
|
-
success: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Connection name
|
|
38
|
-
*/
|
|
39
|
-
connection: string;
|
|
40
|
-
/**
|
|
41
|
-
* Time spent warming up (ms)
|
|
42
|
-
*/
|
|
43
|
-
duration: number;
|
|
44
|
-
/**
|
|
45
|
-
* Error message (if failed)
|
|
46
|
-
*/
|
|
47
|
-
error?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface WarmupResult {
|
|
50
|
-
/**
|
|
51
|
-
* Total connections processed
|
|
52
|
-
*/
|
|
53
|
-
total: number;
|
|
54
|
-
/**
|
|
55
|
-
* Number of successful warmups
|
|
56
|
-
*/
|
|
57
|
-
successful: number;
|
|
58
|
-
/**
|
|
59
|
-
* Number of failed warmups
|
|
60
|
-
*/
|
|
61
|
-
failed: number;
|
|
62
|
-
/**
|
|
63
|
-
* Results for each connection
|
|
64
|
-
*/
|
|
65
|
-
results: Record<string, ConnectionWarmupResult>;
|
|
66
|
-
/**
|
|
67
|
-
* Total duration (ms)
|
|
68
|
-
*/
|
|
69
|
-
duration: number;
|
|
70
|
-
}
|
|
71
|
-
export declare const DEFAULT_WARMER_CONFIG: PoolWarmerConfig;
|
|
72
|
-
/**
|
|
73
|
-
* Connection pool warmer
|
|
74
|
-
* Preheats pools by establishing connections
|
|
75
|
-
*/
|
|
76
|
-
export declare class PoolWarmer {
|
|
77
|
-
private connectionManager;
|
|
78
|
-
private config;
|
|
79
|
-
constructor(connectionManager: ConnectionManager, config: PoolWarmerConfig);
|
|
80
|
-
/**
|
|
81
|
-
* Warm all connection pools
|
|
82
|
-
*/
|
|
83
|
-
warmAll(): Promise<WarmupResult>;
|
|
84
|
-
/**
|
|
85
|
-
* Warm a specific connection pool
|
|
86
|
-
*/
|
|
87
|
-
warmConnection(name: string): Promise<ConnectionWarmupResult>;
|
|
88
|
-
/**
|
|
89
|
-
* Execute a warmup query with timeout
|
|
90
|
-
*/
|
|
91
|
-
private executeWarmupQuery;
|
|
92
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw SQL Expression
|
|
3
|
-
* @description Represents a raw SQL expression that should not be escaped by the query builder.
|
|
4
|
-
* Use this for complex SQL fragments, function calls, or database-specific syntax.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Expression {
|
|
7
|
-
private readonly sql;
|
|
8
|
-
private readonly bindings;
|
|
9
|
-
/**
|
|
10
|
-
* Create a new Expression instance
|
|
11
|
-
*
|
|
12
|
-
* @param sql - The raw SQL string
|
|
13
|
-
* @param bindings - Optional array of bindings for the expression
|
|
14
|
-
*/
|
|
15
|
-
constructor(sql: string, bindings?: unknown[]);
|
|
16
|
-
/**
|
|
17
|
-
* Get the raw SQL string
|
|
18
|
-
*
|
|
19
|
-
* @returns The SQL string
|
|
20
|
-
*/
|
|
21
|
-
getValue(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Get the bindings associated with this expression
|
|
24
|
-
*
|
|
25
|
-
* @returns Array of bindings
|
|
26
|
-
*/
|
|
27
|
-
getBindings(): unknown[];
|
|
28
|
-
/**
|
|
29
|
-
* Convert the expression to its SQL string representation
|
|
30
|
-
*
|
|
31
|
-
* @returns The SQL string
|
|
32
|
-
*/
|
|
33
|
-
toString(): string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create a raw SQL expression
|
|
37
|
-
*
|
|
38
|
-
* @param sql - The raw SQL string
|
|
39
|
-
* @param bindings - Optional array of bindings
|
|
40
|
-
* @returns A new Expression instance
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* DB.table('users').select(raw('COUNT(*) as total')).get()
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function raw(sql: string, bindings?: unknown[]): Expression;
|
|
47
|
-
/**
|
|
48
|
-
* Tagged template literal for safe raw SQL construction
|
|
49
|
-
*
|
|
50
|
-
* @param strings - Template strings
|
|
51
|
-
* @param values - Values to be used as bindings
|
|
52
|
-
* @returns A new Expression instance with auto-generated placeholders
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* const userId = 1;
|
|
56
|
-
* const query = sql`SELECT * FROM users WHERE id = ${userId}`;
|
|
57
|
-
* // Result: Expression { sql: "SELECT * FROM users WHERE id = ?", bindings: [1] }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare function sql(strings: TemplateStringsArray, ...values: unknown[]): Expression;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class NPlusOneDetector {
|
|
2
|
-
private static queryCounts;
|
|
3
|
-
private static timeframe;
|
|
4
|
-
private static threshold;
|
|
5
|
-
private static enabled;
|
|
6
|
-
static track(tableName: string, sql: string, structureKey: string): void;
|
|
7
|
-
static reset(): void;
|
|
8
|
-
static setEnabled(enabled: boolean): void;
|
|
9
|
-
private static warn;
|
|
10
|
-
}
|