@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,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Relationship Types and Base Classes
|
|
3
|
-
* @description Declarative relationship definitions for ORM
|
|
4
|
-
*/
|
|
5
|
-
import type { QueryBuilderContract } from '../../types';
|
|
6
|
-
import type { Model, ModelConstructor } from './Model';
|
|
7
|
-
/**
|
|
8
|
-
* Relationship Type
|
|
9
|
-
*/
|
|
10
|
-
export type RelationType = 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany' | 'morphOne' | 'morphMany' | 'morphTo';
|
|
11
|
-
/**
|
|
12
|
-
* Options for defining relationships between models.
|
|
13
|
-
*/
|
|
14
|
-
export interface RelationshipOptions {
|
|
15
|
-
/**
|
|
16
|
-
* The foreign key column name.
|
|
17
|
-
* - For `HasOne`/`HasMany`: Defaults to `parent_table_id` on the related table.
|
|
18
|
-
* - For `BelongsTo`: Defaults to `related_table_id` on the local table.
|
|
19
|
-
* - For `BelongsToMany`: Defaults to `parent_table_id` on the pivot table.
|
|
20
|
-
*/
|
|
21
|
-
foreignKey?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The local key column name.
|
|
24
|
-
* - For `HasOne`/`HasMany`: Defaults to the primary key of the local table.
|
|
25
|
-
* - For `BelongsTo`: Defaults to the primary key of the related table.
|
|
26
|
-
*/
|
|
27
|
-
localKey?: string;
|
|
28
|
-
/**
|
|
29
|
-
* The name of the pivot table for many-to-many relationships.
|
|
30
|
-
* Defaults to an alphabetical concatenation of the two table names (e.g., `roles_users`).
|
|
31
|
-
*/
|
|
32
|
-
pivotTable?: string;
|
|
33
|
-
/**
|
|
34
|
-
* The related key column name in the pivot table.
|
|
35
|
-
* Defaults to `related_table_id`.
|
|
36
|
-
*/
|
|
37
|
-
relatedKey?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Additional columns to select from the pivot table.
|
|
40
|
-
*/
|
|
41
|
-
pivotColumns?: string[];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Relationship Metadata
|
|
45
|
-
*/
|
|
46
|
-
export interface RelationshipMeta {
|
|
47
|
-
type: RelationType;
|
|
48
|
-
related?: () => ModelConstructor<Model> & typeof Model;
|
|
49
|
-
foreignKey?: string;
|
|
50
|
-
localKey?: string;
|
|
51
|
-
pivotTable?: string | undefined;
|
|
52
|
-
relatedKey?: string | undefined;
|
|
53
|
-
pivotColumns?: string[] | undefined;
|
|
54
|
-
morphName?: string;
|
|
55
|
-
morphTypeField?: string;
|
|
56
|
-
morphIdField?: string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get relationships for a model
|
|
60
|
-
*/
|
|
61
|
-
export declare function getRelationships(model: typeof Model): Map<string, RelationshipMeta>;
|
|
62
|
-
/**
|
|
63
|
-
* Define a relationship on a model
|
|
64
|
-
*/
|
|
65
|
-
export declare function defineRelationship(model: typeof Model, name: string, meta: RelationshipMeta): void;
|
|
66
|
-
/**
|
|
67
|
-
* HasOne Relationship Decorator
|
|
68
|
-
*
|
|
69
|
-
* Defines a one-to-one relationship where the related model's table
|
|
70
|
-
* contains the foreign key.
|
|
71
|
-
*
|
|
72
|
-
* @param related - A factory function that returns the related Model class.
|
|
73
|
-
* @param options - Configuration for the relationship.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* class User extends Model {
|
|
78
|
-
* @HasOne(() => Profile)
|
|
79
|
-
* declare profile: Profile
|
|
80
|
-
* }
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
export declare function HasOne(related: () => ModelConstructor<Model> & typeof Model, options?: Omit<RelationshipOptions, 'pivotTable'>): PropertyDecorator;
|
|
84
|
-
/**
|
|
85
|
-
* HasMany Relationship Decorator
|
|
86
|
-
*
|
|
87
|
-
* Defines a one-to-many relationship where the related model's table
|
|
88
|
-
* contains the foreign key.
|
|
89
|
-
*
|
|
90
|
-
* @param related - A factory function that returns the related Model class.
|
|
91
|
-
* @param options - Configuration for the relationship.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```typescript
|
|
95
|
-
* class User extends Model {
|
|
96
|
-
* @HasMany(() => Post)
|
|
97
|
-
* declare posts: Post[]
|
|
98
|
-
* }
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export declare function HasMany(related: () => ModelConstructor<Model> & typeof Model, options?: Omit<RelationshipOptions, 'pivotTable'>): PropertyDecorator;
|
|
102
|
-
/**
|
|
103
|
-
* BelongsTo Relationship Decorator
|
|
104
|
-
*
|
|
105
|
-
* Defines an inverse relationship where the local model's table
|
|
106
|
-
* contains the foreign key.
|
|
107
|
-
*
|
|
108
|
-
* @param related - A factory function that returns the related Model class.
|
|
109
|
-
* @param options - Configuration for the relationship.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```typescript
|
|
113
|
-
* class Post extends Model {
|
|
114
|
-
* @BelongsTo(() => User)
|
|
115
|
-
* declare author: User
|
|
116
|
-
* }
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
export declare function BelongsTo(related: () => ModelConstructor<Model> & typeof Model, options?: Omit<RelationshipOptions, 'pivotTable'>): PropertyDecorator;
|
|
120
|
-
/**
|
|
121
|
-
* BelongsToMany Relationship Decorator
|
|
122
|
-
*
|
|
123
|
-
* Defines a many-to-many relationship using a pivot table.
|
|
124
|
-
*
|
|
125
|
-
* @param related - A factory function that returns the related Model class.
|
|
126
|
-
* @param options - Configuration for the relationship, including pivot table details.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* class User extends Model {
|
|
131
|
-
* @BelongsToMany(() => Role, { pivotTable: 'user_roles' })
|
|
132
|
-
* declare roles: Role[]
|
|
133
|
-
* }
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
export declare function BelongsToMany(related: () => ModelConstructor<Model> & typeof Model, options?: RelationshipOptions): PropertyDecorator;
|
|
137
|
-
/**
|
|
138
|
-
* MorphOne Relationship Decorator
|
|
139
|
-
*
|
|
140
|
-
* Defines a polymorphic one-to-one relationship.
|
|
141
|
-
*
|
|
142
|
-
* @param related - A factory function that returns the related Model class.
|
|
143
|
-
* @param name - The name of the polymorphic relationship (e.g., 'imageable').
|
|
144
|
-
* @param options - Configuration for the relationship.
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* class Post extends Model {
|
|
149
|
-
* @MorphOne(() => Image, 'imageable')
|
|
150
|
-
* declare image: Image
|
|
151
|
-
* }
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
export declare function MorphOne(related: () => ModelConstructor<Model> & typeof Model, name: string, options?: {
|
|
155
|
-
foreignKey?: string;
|
|
156
|
-
localKey?: string;
|
|
157
|
-
}): PropertyDecorator;
|
|
158
|
-
/**
|
|
159
|
-
* MorphMany Relationship Decorator
|
|
160
|
-
*
|
|
161
|
-
* Defines a polymorphic one-to-many relationship.
|
|
162
|
-
*
|
|
163
|
-
* @param related - A factory function that returns the related Model class.
|
|
164
|
-
* @param name - The name of the polymorphic relationship (e.g., 'commentable').
|
|
165
|
-
* @param options - Configuration for the relationship.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```typescript
|
|
169
|
-
* class Post extends Model {
|
|
170
|
-
* @MorphMany(() => Comment, 'commentable')
|
|
171
|
-
* declare comments: Comment[]
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
export declare function MorphMany(related: () => ModelConstructor<Model> & typeof Model, name: string, options?: {
|
|
176
|
-
foreignKey?: string;
|
|
177
|
-
localKey?: string;
|
|
178
|
-
}): PropertyDecorator;
|
|
179
|
-
/**
|
|
180
|
-
* MorphTo Relationship Decorator
|
|
181
|
-
*
|
|
182
|
-
* Defines the inverse of a polymorphic relationship.
|
|
183
|
-
*
|
|
184
|
-
* @param options - Configuration for the polymorphic relationship.
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```typescript
|
|
188
|
-
* class Comment extends Model {
|
|
189
|
-
* @MorphTo()
|
|
190
|
-
* declare commentable: Post | Video
|
|
191
|
-
* }
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
export declare function MorphTo(options?: {
|
|
195
|
-
name?: string;
|
|
196
|
-
typeField?: string;
|
|
197
|
-
idField?: string;
|
|
198
|
-
}): PropertyDecorator;
|
|
199
|
-
/**
|
|
200
|
-
* Load related models for a collection of parent models
|
|
201
|
-
* Uses batch queries to avoid N+1 problem
|
|
202
|
-
*/
|
|
203
|
-
export declare function eagerLoad<T extends Model, R extends Model = Model>(parents: T[], relationName: string, callback?: (query: QueryBuilderContract<R>) => void): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
* Load multiple relationships
|
|
206
|
-
*/
|
|
207
|
-
export declare function eagerLoadMany<T extends Model, R extends Model = Model>(parents: T[], relations: string[] | Record<string, unknown> | Map<string, (query: QueryBuilderContract<R>) => void>): Promise<void>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Model } from './Model';
|
|
2
|
-
export interface ModelObserver<T extends Model> {
|
|
3
|
-
creating?(model: T): void | Promise<void>;
|
|
4
|
-
created?(model: T): void | Promise<void>;
|
|
5
|
-
updating?(model: T): void | Promise<void>;
|
|
6
|
-
updated?(model: T): void | Promise<void>;
|
|
7
|
-
deleting?(model: T): void | Promise<void>;
|
|
8
|
-
deleted?(model: T): void | Promise<void>;
|
|
9
|
-
saving?(model: T): void | Promise<void>;
|
|
10
|
-
saved?(model: T): void | Promise<void>;
|
|
11
|
-
retrieved?(model: T): void | Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema Registry
|
|
3
|
-
* @description Central registry for table schemas with JIT sniffing and AOT locking
|
|
4
|
-
*/
|
|
5
|
-
import type { ColumnSchema, TableSchema } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Schema Registry Mode
|
|
8
|
-
*/
|
|
9
|
-
export type SchemaMode = 'jit' | 'aot';
|
|
10
|
-
/**
|
|
11
|
-
* Schema Registry Options
|
|
12
|
-
*/
|
|
13
|
-
export interface SchemaRegistryOptions {
|
|
14
|
-
/** Mode: jit (dev) or aot (prod) */
|
|
15
|
-
mode?: SchemaMode;
|
|
16
|
-
/** Path to schema lock file */
|
|
17
|
-
lockPath?: string;
|
|
18
|
-
/** Database connection name */
|
|
19
|
-
connection?: string;
|
|
20
|
-
/** Cache TTL in milliseconds (JIT mode) */
|
|
21
|
-
cacheTtl?: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Schema Registry
|
|
25
|
-
* Central registry for table schemas
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* // Dev mode: JIT sniffing
|
|
30
|
-
* const registry = SchemaRegistry.getInstance({ mode: 'jit' })
|
|
31
|
-
* const schema = await registry.get('users')
|
|
32
|
-
*
|
|
33
|
-
* // Prod mode: AOT from lock file
|
|
34
|
-
* SchemaRegistry.init({ mode: 'aot', lockPath: '.schema-lock.json' })
|
|
35
|
-
* const schema = await registry.get('users')
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare class SchemaRegistry {
|
|
39
|
-
private static instance;
|
|
40
|
-
private cache;
|
|
41
|
-
private pendingSniffs;
|
|
42
|
-
private sniffer;
|
|
43
|
-
private mode;
|
|
44
|
-
private lockPath;
|
|
45
|
-
private cacheTtl;
|
|
46
|
-
private _initialized;
|
|
47
|
-
private constructor();
|
|
48
|
-
/**
|
|
49
|
-
* Check if registry is initialized
|
|
50
|
-
*/
|
|
51
|
-
get isInitialized(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Initialize the registry (call once at startup)
|
|
54
|
-
*/
|
|
55
|
-
static init(options?: SchemaRegistryOptions): SchemaRegistry;
|
|
56
|
-
/**
|
|
57
|
-
* Get the registry instance
|
|
58
|
-
*/
|
|
59
|
-
static getInstance(): SchemaRegistry;
|
|
60
|
-
/**
|
|
61
|
-
* Reset the registry (for testing)
|
|
62
|
-
*/
|
|
63
|
-
static reset(): void;
|
|
64
|
-
/**
|
|
65
|
-
* Get schema for a table
|
|
66
|
-
*/
|
|
67
|
-
get(table: string, connection?: string): Promise<TableSchema>;
|
|
68
|
-
/**
|
|
69
|
-
* Check if table schema exists
|
|
70
|
-
*/
|
|
71
|
-
has(table: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Get column schema
|
|
74
|
-
*/
|
|
75
|
-
getColumn(table: string, column: string): Promise<ColumnSchema | undefined>;
|
|
76
|
-
/**
|
|
77
|
-
* Check if column exists
|
|
78
|
-
*/
|
|
79
|
-
hasColumn(table: string, column: string): Promise<boolean>;
|
|
80
|
-
/**
|
|
81
|
-
* Get all cached tables
|
|
82
|
-
*/
|
|
83
|
-
getTables(): string[];
|
|
84
|
-
/**
|
|
85
|
-
* Invalidate cache for a specific table
|
|
86
|
-
* Forces re-sniff on next access
|
|
87
|
-
*/
|
|
88
|
-
invalidate(table: string): void;
|
|
89
|
-
/**
|
|
90
|
-
* Invalidate all cached schemas
|
|
91
|
-
*/
|
|
92
|
-
invalidateAll(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Force refresh schema for a table
|
|
95
|
-
* Re-sniffs even if cached (JIT mode only)
|
|
96
|
-
*/
|
|
97
|
-
refresh(table: string): Promise<TableSchema>;
|
|
98
|
-
/**
|
|
99
|
-
* Wrap a database operation with self-healing
|
|
100
|
-
* Automatically re-sniffs schema on column-related errors and retries
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const result = await registry.withSelfHealing('users', async () => {
|
|
105
|
-
* return await connection.table('users').where('new_column', value).get()
|
|
106
|
-
* })
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
withSelfHealing<T>(table: string, operation: () => Promise<T>): Promise<T>;
|
|
110
|
-
/**
|
|
111
|
-
* Check if an error is schema-related
|
|
112
|
-
*/
|
|
113
|
-
private isSchemaError;
|
|
114
|
-
/**
|
|
115
|
-
* Load schemas from lock file (AOT mode)
|
|
116
|
-
*/
|
|
117
|
-
loadFromLock(path?: string): void;
|
|
118
|
-
/**
|
|
119
|
-
* Save schemas to lock file
|
|
120
|
-
*/
|
|
121
|
-
saveToLock(tables: string[], path?: string): Promise<void>;
|
|
122
|
-
private serializeTableSchema;
|
|
123
|
-
private deserializeTableSchema;
|
|
124
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema Sniffer
|
|
3
|
-
* @description Introspects database schema at runtime (JIT mode)
|
|
4
|
-
*/
|
|
5
|
-
import type { TableSchema } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Schema Sniffer
|
|
8
|
-
* Retrieves table schema from database at runtime
|
|
9
|
-
*/
|
|
10
|
-
export declare class SchemaSniffer {
|
|
11
|
-
private connectionName;
|
|
12
|
-
constructor(connectionName?: string);
|
|
13
|
-
/**
|
|
14
|
-
* Sniff table schema from database
|
|
15
|
-
*/
|
|
16
|
-
sniff(table: string): Promise<TableSchema>;
|
|
17
|
-
/**
|
|
18
|
-
* Sniff SQLite table schema
|
|
19
|
-
*/
|
|
20
|
-
private sniffSQLite;
|
|
21
|
-
/**
|
|
22
|
-
* Sniff PostgreSQL table schema
|
|
23
|
-
*/
|
|
24
|
-
private sniffPostgres;
|
|
25
|
-
/**
|
|
26
|
-
* Sniff MySQL table schema
|
|
27
|
-
*/
|
|
28
|
-
private sniffMySQL;
|
|
29
|
-
/**
|
|
30
|
-
* Map PostgreSQL type to ColumnType
|
|
31
|
-
*/
|
|
32
|
-
private mapPostgresType;
|
|
33
|
-
/**
|
|
34
|
-
* Map MySQL type to ColumnType
|
|
35
|
-
*/
|
|
36
|
-
private mapMySQLType;
|
|
37
|
-
private mapSQLiteType;
|
|
38
|
-
/**
|
|
39
|
-
* Parse default value
|
|
40
|
-
*/
|
|
41
|
-
private parseDefault;
|
|
42
|
-
/**
|
|
43
|
-
* Extract length from MySQL type
|
|
44
|
-
*/
|
|
45
|
-
private extractMySQLLength;
|
|
46
|
-
/**
|
|
47
|
-
* Extract enum values from MySQL type
|
|
48
|
-
*/
|
|
49
|
-
private extractMySQLEnumValues;
|
|
50
|
-
/**
|
|
51
|
-
* Get driver name
|
|
52
|
-
*/
|
|
53
|
-
private getDriverName;
|
|
54
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema Module Index
|
|
3
|
-
*/
|
|
4
|
-
export { type SchemaMode, SchemaRegistry, type SchemaRegistryOptions } from './SchemaRegistry';
|
|
5
|
-
export { SchemaSniffer } from './SchemaSniffer';
|
|
6
|
-
export type { ColumnSchema, ColumnType, SchemaLock, SerializedColumnSchema, SerializedTableSchema, TableSchema, } from './types';
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema Types
|
|
3
|
-
* @description Type definitions for schema introspection
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Column data types
|
|
7
|
-
*/
|
|
8
|
-
export type ColumnType = 'string' | 'text' | 'integer' | 'bigint' | 'smallint' | 'decimal' | 'float' | 'boolean' | 'date' | 'time' | 'datetime' | 'timestamp' | 'json' | 'jsonb' | 'uuid' | 'binary' | 'enum' | 'unknown';
|
|
9
|
-
/**
|
|
10
|
-
* Column schema definition
|
|
11
|
-
*/
|
|
12
|
-
export interface ColumnSchema {
|
|
13
|
-
/** Column name */
|
|
14
|
-
name: string;
|
|
15
|
-
/** Column type */
|
|
16
|
-
type: ColumnType;
|
|
17
|
-
/** Is nullable */
|
|
18
|
-
nullable: boolean;
|
|
19
|
-
/** Default value */
|
|
20
|
-
default?: unknown;
|
|
21
|
-
/** Is primary key */
|
|
22
|
-
primary: boolean;
|
|
23
|
-
/** Is unique */
|
|
24
|
-
unique: boolean;
|
|
25
|
-
/** Is auto-increment */
|
|
26
|
-
autoIncrement: boolean;
|
|
27
|
-
/** Enum values (if type is enum) */
|
|
28
|
-
enumValues?: string[] | undefined;
|
|
29
|
-
/** Max length (for string types) */
|
|
30
|
-
maxLength?: number | undefined;
|
|
31
|
-
/** Numeric precision */
|
|
32
|
-
precision?: number | undefined;
|
|
33
|
-
/** Numeric scale */
|
|
34
|
-
scale?: number | undefined;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Table schema definition
|
|
38
|
-
*/
|
|
39
|
-
export interface TableSchema {
|
|
40
|
-
/** Table name */
|
|
41
|
-
table: string;
|
|
42
|
-
/** Column definitions */
|
|
43
|
-
columns: Map<string, ColumnSchema>;
|
|
44
|
-
/** Primary key column(s) */
|
|
45
|
-
primaryKey: string[];
|
|
46
|
-
/** Timestamp of schema capture */
|
|
47
|
-
capturedAt: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Schema lock file format
|
|
51
|
-
*/
|
|
52
|
-
export interface SchemaLock {
|
|
53
|
-
/** Version for compatibility */
|
|
54
|
-
version: string;
|
|
55
|
-
/** Driver used to generate */
|
|
56
|
-
driver: string;
|
|
57
|
-
/** Generation timestamp */
|
|
58
|
-
generatedAt: string;
|
|
59
|
-
/** Table schemas */
|
|
60
|
-
tables: Record<string, SerializedTableSchema>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Serialized table schema (for JSON storage)
|
|
64
|
-
*/
|
|
65
|
-
export interface SerializedTableSchema {
|
|
66
|
-
table: string;
|
|
67
|
-
columns: SerializedColumnSchema[];
|
|
68
|
-
primaryKey: string[];
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Serialized column schema (for JSON storage)
|
|
72
|
-
*/
|
|
73
|
-
export interface SerializedColumnSchema {
|
|
74
|
-
name: string;
|
|
75
|
-
type: ColumnType;
|
|
76
|
-
nullable: boolean;
|
|
77
|
-
default?: unknown;
|
|
78
|
-
primary: boolean;
|
|
79
|
-
unique: boolean;
|
|
80
|
-
autoIncrement: boolean;
|
|
81
|
-
enumValues?: string[] | undefined;
|
|
82
|
-
maxLength?: number | undefined;
|
|
83
|
-
precision?: number | undefined;
|
|
84
|
-
scale?: number | undefined;
|
|
85
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/atlas - Adaptive Pool Manager
|
|
3
|
-
* @description Manages adaptive pool sizing based on strategies
|
|
4
|
-
*/
|
|
5
|
-
import type { ConnectionManager } from '../connection/ConnectionManager';
|
|
6
|
-
import type { PoolStats } from '../types';
|
|
7
|
-
import type { PoolStrategy } from './PoolStrategy';
|
|
8
|
-
export interface PoolStatsHistory {
|
|
9
|
-
stats: PoolStats;
|
|
10
|
-
timestamp: number;
|
|
11
|
-
}
|
|
12
|
-
export interface PoolAdjustmentEvent {
|
|
13
|
-
connection: string;
|
|
14
|
-
action: 'increase' | 'decrease' | 'maintain';
|
|
15
|
-
from: number;
|
|
16
|
-
to: number;
|
|
17
|
-
reason: string;
|
|
18
|
-
}
|
|
19
|
-
export interface AdaptivePoolConfig {
|
|
20
|
-
/**
|
|
21
|
-
* Evaluation interval (ms)
|
|
22
|
-
* @default 60000
|
|
23
|
-
*/
|
|
24
|
-
evaluationInterval: number;
|
|
25
|
-
/**
|
|
26
|
-
* Minimum cooldown period (ms) before next adjustment
|
|
27
|
-
* @default 30000
|
|
28
|
-
*/
|
|
29
|
-
cooldownPeriod: number;
|
|
30
|
-
/**
|
|
31
|
-
* Maximum history size
|
|
32
|
-
* @default 10
|
|
33
|
-
*/
|
|
34
|
-
maxHistorySize: number;
|
|
35
|
-
/**
|
|
36
|
-
* Callback when adjustment is made
|
|
37
|
-
*/
|
|
38
|
-
onAdjustment?: (event: PoolAdjustmentEvent) => void;
|
|
39
|
-
}
|
|
40
|
-
export declare const DEFAULT_ADAPTIVE_CONFIG: AdaptivePoolConfig;
|
|
41
|
-
/**
|
|
42
|
-
* Adaptive pool manager
|
|
43
|
-
* Periodically evaluates pool statistics and adjusts size based on strategy
|
|
44
|
-
*/
|
|
45
|
-
export declare class AdaptivePoolManager {
|
|
46
|
-
private connectionManager;
|
|
47
|
-
private strategy;
|
|
48
|
-
private config;
|
|
49
|
-
private intervalHandle?;
|
|
50
|
-
private statsHistory;
|
|
51
|
-
private adjustmentCooldown;
|
|
52
|
-
private lastAdjustment;
|
|
53
|
-
constructor(connectionManager: ConnectionManager, strategy: PoolStrategy, config: AdaptivePoolConfig);
|
|
54
|
-
/**
|
|
55
|
-
* Start adaptive management
|
|
56
|
-
*/
|
|
57
|
-
start(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Stop adaptive management
|
|
60
|
-
*/
|
|
61
|
-
stop(): void;
|
|
62
|
-
/**
|
|
63
|
-
* Get last adjustment for a connection
|
|
64
|
-
*/
|
|
65
|
-
getLastAdjustment(connectionName: string): PoolAdjustmentEvent | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Get history for a connection
|
|
68
|
-
*/
|
|
69
|
-
getHistory(connectionName: string): PoolStatsHistory[];
|
|
70
|
-
/**
|
|
71
|
-
* Evaluate all connection pools
|
|
72
|
-
*/
|
|
73
|
-
private evaluateAllPools;
|
|
74
|
-
/**
|
|
75
|
-
* Evaluate a specific pool
|
|
76
|
-
*/
|
|
77
|
-
private evaluatePool;
|
|
78
|
-
/**
|
|
79
|
-
* Build strategy context from current state
|
|
80
|
-
*/
|
|
81
|
-
private buildContext;
|
|
82
|
-
/**
|
|
83
|
-
* Update historical statistics
|
|
84
|
-
*/
|
|
85
|
-
private updateHistory;
|
|
86
|
-
/**
|
|
87
|
-
* Check if in cooldown period
|
|
88
|
-
*/
|
|
89
|
-
private isInCooldown;
|
|
90
|
-
/**
|
|
91
|
-
* Set cooldown period
|
|
92
|
-
*/
|
|
93
|
-
private setCooldown;
|
|
94
|
-
/**
|
|
95
|
-
* Apply adjustment to pool
|
|
96
|
-
*/
|
|
97
|
-
private applyAdjustment;
|
|
98
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/atlas - Connection Pool Health Checker
|
|
3
|
-
* @description Monitors connection pool health and triggers callbacks on state changes
|
|
4
|
-
*/
|
|
5
|
-
import type { ConnectionManager } from '../connection/ConnectionManager';
|
|
6
|
-
import type { PoolHealth } from '../types';
|
|
7
|
-
export interface PoolHealthCheckConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Interval (ms) to check pool health
|
|
10
|
-
* @default 30000 (30 seconds)
|
|
11
|
-
*/
|
|
12
|
-
checkInterval: number;
|
|
13
|
-
/**
|
|
14
|
-
* Health status thresholds
|
|
15
|
-
*/
|
|
16
|
-
thresholds: {
|
|
17
|
-
/**
|
|
18
|
-
* Utilization ratio (0-1) to trigger warning
|
|
19
|
-
* @default 0.7
|
|
20
|
-
*/
|
|
21
|
-
warningUtilization: number;
|
|
22
|
-
/**
|
|
23
|
-
* Utilization ratio (0-1) to trigger critical
|
|
24
|
-
* @default 0.9
|
|
25
|
-
*/
|
|
26
|
-
criticalUtilization: number;
|
|
27
|
-
/**
|
|
28
|
-
* Pending ratio (0-1) to trigger warning
|
|
29
|
-
* @default 0.5
|
|
30
|
-
*/
|
|
31
|
-
maxPendingRatio: number;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Whether to test connection availability during health check
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
enableConnectionTest: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Timeout (ms) for connection test
|
|
40
|
-
* @default 5000
|
|
41
|
-
*/
|
|
42
|
-
connectionTestTimeout: number;
|
|
43
|
-
/**
|
|
44
|
-
* Callback when health status changes
|
|
45
|
-
*/
|
|
46
|
-
onHealthChange?: (connectionName: string, health: PoolHealth) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Callback when pool health becomes critical
|
|
49
|
-
*/
|
|
50
|
-
onCritical?: (connectionName: string, health: PoolHealth) => void;
|
|
51
|
-
}
|
|
52
|
-
export declare const DEFAULT_HEALTH_CHECK_CONFIG: PoolHealthCheckConfig;
|
|
53
|
-
/**
|
|
54
|
-
* Connection pool health checker
|
|
55
|
-
* Periodically monitors pool health and triggers callbacks
|
|
56
|
-
*/
|
|
57
|
-
export declare class PoolHealthChecker {
|
|
58
|
-
private connectionManager;
|
|
59
|
-
private config;
|
|
60
|
-
private intervalHandle?;
|
|
61
|
-
private lastHealthStatus;
|
|
62
|
-
constructor(connectionManager: ConnectionManager, config: PoolHealthCheckConfig);
|
|
63
|
-
/**
|
|
64
|
-
* Start health checking
|
|
65
|
-
*/
|
|
66
|
-
start(): void;
|
|
67
|
-
/**
|
|
68
|
-
* Stop health checking
|
|
69
|
-
*/
|
|
70
|
-
stop(): void;
|
|
71
|
-
/**
|
|
72
|
-
* Get current health status for a specific connection
|
|
73
|
-
*/
|
|
74
|
-
getHealthStatus(connectionName?: string): PoolHealth | Map<string, PoolHealth>;
|
|
75
|
-
/**
|
|
76
|
-
* Check health of all connections
|
|
77
|
-
*/
|
|
78
|
-
private checkAllConnections;
|
|
79
|
-
/**
|
|
80
|
-
* Check health of a specific connection
|
|
81
|
-
*/
|
|
82
|
-
private checkConnection;
|
|
83
|
-
/**
|
|
84
|
-
* Evaluate pool health based on statistics
|
|
85
|
-
*/
|
|
86
|
-
private evaluateHealth;
|
|
87
|
-
/**
|
|
88
|
-
* Test connection availability
|
|
89
|
-
*/
|
|
90
|
-
private testConnectionAvailability;
|
|
91
|
-
}
|