@gravito/echo 3.1.1 → 4.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 +24 -9
- package/dist/OrbitEcho.d.ts +76 -60
- package/dist/errors/EchoError.d.ts +29 -0
- package/dist/errors/codes.d.ts +20 -0
- package/dist/index.d.ts +34 -16
- package/dist/index.js +3 -1596
- package/dist/index.js.map +3 -28
- package/dist/{echo/src/middleware → middleware}/RequestBufferMiddleware.d.ts +3 -3
- package/dist/providers/GenericProvider.d.ts +37 -19
- package/dist/providers/GitHubProvider.d.ts +21 -13
- package/dist/providers/StripeProvider.d.ts +20 -13
- package/dist/providers/index.d.ts +14 -4
- package/dist/receive/SignatureValidator.d.ts +33 -1
- package/dist/receive/WebhookReceiver.d.ts +139 -22
- package/dist/receive/index.d.ts +0 -1
- package/dist/resilience/CircuitBreaker.d.ts +6 -0
- package/dist/{echo/src/resilience → resilience}/index.d.ts +2 -1
- package/dist/send/WebhookDispatcher.d.ts +159 -16
- package/dist/send/index.d.ts +0 -1
- package/dist/types.d.ts +671 -57
- package/package.json +9 -3
- package/dist/OrbitEcho.d.ts.map +0 -1
- 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/Application.d.ts +0 -215
- package/dist/core/src/CommandKernel.d.ts +0 -33
- package/dist/core/src/ConfigManager.d.ts +0 -65
- package/dist/core/src/Container/RequestScopeManager.d.ts +0 -62
- package/dist/core/src/Container/RequestScopeMetrics.d.ts +0 -144
- package/dist/core/src/Container.d.ts +0 -153
- package/dist/core/src/ErrorHandler.d.ts +0 -66
- package/dist/core/src/Event.d.ts +0 -5
- package/dist/core/src/EventManager.d.ts +0 -123
- package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
- package/dist/core/src/GravitoServer.d.ts +0 -28
- package/dist/core/src/HookManager.d.ts +0 -591
- package/dist/core/src/Listener.d.ts +0 -4
- package/dist/core/src/Logger.d.ts +0 -20
- package/dist/core/src/PlanetCore.d.ts +0 -378
- package/dist/core/src/RequestContext.d.ts +0 -97
- package/dist/core/src/Route.d.ts +0 -36
- package/dist/core/src/Router.d.ts +0 -284
- package/dist/core/src/ServiceProvider.d.ts +0 -178
- package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
- package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
- package/dist/core/src/adapters/bun/BunContext.d.ts +0 -49
- package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
- package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
- package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
- package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
- package/dist/core/src/adapters/bun/types.d.ts +0 -20
- package/dist/core/src/adapters/photon-types.d.ts +0 -73
- package/dist/core/src/adapters/types.d.ts +0 -235
- package/dist/core/src/cli/queue-commands.d.ts +0 -6
- package/dist/core/src/engine/AOTRouter.d.ts +0 -129
- package/dist/core/src/engine/FastContext.d.ts +0 -123
- package/dist/core/src/engine/Gravito.d.ts +0 -136
- package/dist/core/src/engine/MinimalContext.d.ts +0 -100
- package/dist/core/src/engine/analyzer.d.ts +0 -27
- package/dist/core/src/engine/constants.d.ts +0 -23
- package/dist/core/src/engine/index.d.ts +0 -26
- package/dist/core/src/engine/path.d.ts +0 -26
- package/dist/core/src/engine/pool.d.ts +0 -83
- package/dist/core/src/engine/types.d.ts +0 -146
- package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +0 -126
- package/dist/core/src/events/BackpressureManager.d.ts +0 -215
- package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
- package/dist/core/src/events/DeadLetterQueue.d.ts +0 -219
- package/dist/core/src/events/EventBackend.d.ts +0 -12
- package/dist/core/src/events/EventOptions.d.ts +0 -204
- package/dist/core/src/events/EventPriorityQueue.d.ts +0 -301
- package/dist/core/src/events/FlowControlStrategy.d.ts +0 -109
- package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
- package/dist/core/src/events/MessageQueueBridge.d.ts +0 -184
- package/dist/core/src/events/PriorityEscalationManager.d.ts +0 -82
- package/dist/core/src/events/RetryScheduler.d.ts +0 -104
- package/dist/core/src/events/WorkerPool.d.ts +0 -98
- package/dist/core/src/events/WorkerPoolConfig.d.ts +0 -153
- package/dist/core/src/events/WorkerPoolMetrics.d.ts +0 -65
- package/dist/core/src/events/aggregation/AggregationWindow.d.ts +0 -77
- package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +0 -135
- package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +0 -108
- package/dist/core/src/events/aggregation/EventBatcher.d.ts +0 -99
- package/dist/core/src/events/aggregation/types.d.ts +0 -117
- package/dist/core/src/events/index.d.ts +0 -25
- package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
- package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
- package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
- package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -332
- package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
- package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +0 -76
- package/dist/core/src/events/observability/index.d.ts +0 -24
- package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
- package/dist/core/src/events/types.d.ts +0 -134
- package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
- package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
- package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
- package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
- package/dist/core/src/exceptions/HttpException.d.ts +0 -9
- package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
- package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
- package/dist/core/src/exceptions/index.d.ts +0 -7
- package/dist/core/src/health/HealthProvider.d.ts +0 -67
- package/dist/core/src/helpers/Arr.d.ts +0 -19
- package/dist/core/src/helpers/Str.d.ts +0 -23
- package/dist/core/src/helpers/data.d.ts +0 -25
- package/dist/core/src/helpers/errors.d.ts +0 -34
- package/dist/core/src/helpers/response.d.ts +0 -41
- package/dist/core/src/helpers.d.ts +0 -338
- package/dist/core/src/http/CookieJar.d.ts +0 -51
- package/dist/core/src/http/cookie.d.ts +0 -29
- 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/http/types.d.ts +0 -374
- package/dist/core/src/index.d.ts +0 -88
- 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/core/src/observability/QueueDashboard.d.ts +0 -136
- package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -350
- package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
- package/dist/core/src/reliability/index.d.ts +0 -6
- package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
- package/dist/core/src/router/RequestValidator.d.ts +0 -20
- package/dist/core/src/runtime.d.ts +0 -119
- package/dist/core/src/security/Encrypter.d.ts +0 -33
- package/dist/core/src/security/Hasher.d.ts +0 -29
- package/dist/core/src/testing/HttpTester.d.ts +0 -39
- package/dist/core/src/testing/TestResponse.d.ts +0 -78
- package/dist/core/src/testing/index.d.ts +0 -2
- package/dist/core/src/types/events.d.ts +0 -94
- package/dist/echo/src/OrbitEcho.d.ts +0 -115
- package/dist/echo/src/index.d.ts +0 -64
- package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
- package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
- package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
- package/dist/echo/src/providers/index.d.ts +0 -14
- package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
- package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
- package/dist/echo/src/receive/index.d.ts +0 -2
- package/dist/echo/src/resilience/CircuitBreaker.d.ts +0 -117
- package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
- package/dist/echo/src/send/index.d.ts +0 -1
- package/dist/echo/src/types.d.ts +0 -756
- package/dist/index.d.ts.map +0 -1
- package/dist/monitor/src/MonitorOrbit.d.ts +0 -43
- package/dist/monitor/src/config.d.ts +0 -106
- package/dist/monitor/src/health/HealthController.d.ts +0 -28
- package/dist/monitor/src/health/HealthRegistry.d.ts +0 -80
- package/dist/monitor/src/health/index.d.ts +0 -36
- package/dist/monitor/src/index.d.ts +0 -13
- package/dist/monitor/src/metrics/MetricsController.d.ts +0 -22
- package/dist/monitor/src/metrics/MetricsRegistry.d.ts +0 -136
- package/dist/monitor/src/metrics/index.d.ts +0 -11
- package/dist/monitor/src/tracing/TracingManager.d.ts +0 -97
- package/dist/monitor/src/tracing/index.d.ts +0 -10
- 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/providers/GenericProvider.d.ts.map +0 -1
- package/dist/providers/GitHubProvider.d.ts.map +0 -1
- package/dist/providers/StripeProvider.d.ts.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/receive/SignatureValidator.d.ts.map +0 -1
- package/dist/receive/WebhookReceiver.d.ts.map +0 -1
- package/dist/receive/index.d.ts.map +0 -1
- package/dist/send/WebhookDispatcher.d.ts.map +0 -1
- package/dist/send/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
- /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
- /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
- /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
- /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
- /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
- /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
- /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
- /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
- /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
- /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
- /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
- /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @gravito/atlas - Cursor Encoding Utility
|
|
3
|
-
* @description Base64 encode/decode for cursor-based pagination cursors.
|
|
4
|
-
*
|
|
5
|
-
* Cursor format: base64(JSON({ id, sortValue, sortColumn, direction }))
|
|
6
|
-
* This enables O(1) pagination using tuple comparison SQL:
|
|
7
|
-
* WHERE (sort_col, id) > (val, id_val)
|
|
8
|
-
*/
|
|
9
|
-
export interface CursorPayload {
|
|
10
|
-
/**
|
|
11
|
-
* Primary key value of the last/first record in the current page
|
|
12
|
-
*/
|
|
13
|
-
id: unknown;
|
|
14
|
-
/**
|
|
15
|
-
* Value of the sort column at the cursor boundary
|
|
16
|
-
*/
|
|
17
|
-
sortValue: unknown;
|
|
18
|
-
/**
|
|
19
|
-
* Column name used for sorting
|
|
20
|
-
*/
|
|
21
|
-
sortColumn: string;
|
|
22
|
-
/**
|
|
23
|
-
* Sort direction
|
|
24
|
-
*/
|
|
25
|
-
direction: 'asc' | 'desc';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Encode a cursor payload to an opaque base64 string.
|
|
29
|
-
*
|
|
30
|
-
* @param payload - Cursor data to encode
|
|
31
|
-
* @returns Base64-encoded cursor string
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* const cursor = encodeCursor({ id: 42, sortValue: '2026-01-01', sortColumn: 'created_at', direction: 'asc' })
|
|
35
|
-
*/
|
|
36
|
-
export declare function encodeCursor(payload: CursorPayload): string;
|
|
37
|
-
/**
|
|
38
|
-
* Decode a cursor string back to its payload.
|
|
39
|
-
*
|
|
40
|
-
* @param cursor - Base64 cursor string
|
|
41
|
-
* @returns Decoded cursor payload
|
|
42
|
-
* @throws {Error} If the cursor is malformed or tampered with
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* const payload = decodeCursor(cursor)
|
|
46
|
-
* // payload.id, payload.sortValue, etc.
|
|
47
|
-
*/
|
|
48
|
-
export declare function decodeCursor(cursor: string): CursorPayload;
|
|
49
|
-
/**
|
|
50
|
-
* Build the WHERE clause raw SQL and bindings for cursor pagination.
|
|
51
|
-
*
|
|
52
|
-
* For ascending sort: WHERE (sort_col, id) > (sort_val, id_val)
|
|
53
|
-
* For descending sort: WHERE (sort_col, id) < (sort_val, id_val)
|
|
54
|
-
*
|
|
55
|
-
* Uses tuple comparison which is O(1) on indexed columns in Postgres & MySQL.
|
|
56
|
-
*
|
|
57
|
-
* @param payload - Decoded cursor payload
|
|
58
|
-
* @returns { sql, bindings } ready for whereRaw()
|
|
59
|
-
*/
|
|
60
|
-
export declare function buildCursorWhereClause(payload: CursorPayload, idColumn?: string): {
|
|
61
|
-
sql: string;
|
|
62
|
-
bindings: unknown[];
|
|
63
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculate Levenshtein distance between two strings
|
|
3
|
-
* Used for "Did you mean?" suggestions
|
|
4
|
-
*/
|
|
5
|
-
export declare function levenshtein(a: string, b: string): number;
|
|
6
|
-
/**
|
|
7
|
-
* Find similar strings from a list
|
|
8
|
-
*/
|
|
9
|
-
export declare function findSimilar(target: string, candidates: string[], maxDistance?: number, maxResults?: number): string[];
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Application - Enterprise Application Container
|
|
3
|
-
*
|
|
4
|
-
* A high-level application class that orchestrates the entire framework.
|
|
5
|
-
* Provides a centralized entry point for enterprise applications with
|
|
6
|
-
* auto-discovery of providers, config loading, and lifecycle management.
|
|
7
|
-
*
|
|
8
|
-
* @module @gravito/core
|
|
9
|
-
* @since 2.0.0
|
|
10
|
-
*/
|
|
11
|
-
import { ConfigManager } from './ConfigManager';
|
|
12
|
-
import { Container } from './Container';
|
|
13
|
-
import type { EventManager } from './EventManager';
|
|
14
|
-
import type { Logger } from './Logger';
|
|
15
|
-
import { PlanetCore } from './PlanetCore';
|
|
16
|
-
import type { ServiceProvider } from './ServiceProvider';
|
|
17
|
-
/**
|
|
18
|
-
* Application Config options for the Application class.
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export interface ApplicationConfig {
|
|
22
|
-
/**
|
|
23
|
-
* Base path of the application
|
|
24
|
-
*/
|
|
25
|
-
basePath: string;
|
|
26
|
-
/**
|
|
27
|
-
* Path to the config directory (relative to basePath)
|
|
28
|
-
* @default 'config'
|
|
29
|
-
*/
|
|
30
|
-
configPath?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Path to the providers directory (relative to basePath)
|
|
33
|
-
* @default 'src/Providers'
|
|
34
|
-
*/
|
|
35
|
-
providersPath?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Environment (development, production, testing)
|
|
38
|
-
*/
|
|
39
|
-
env?: 'development' | 'production' | 'testing';
|
|
40
|
-
/**
|
|
41
|
-
* Logger instance
|
|
42
|
-
*/
|
|
43
|
-
logger?: Logger;
|
|
44
|
-
/**
|
|
45
|
-
* Initial configuration values
|
|
46
|
-
*/
|
|
47
|
-
config?: Record<string, unknown>;
|
|
48
|
-
/**
|
|
49
|
-
* Service providers to register
|
|
50
|
-
*/
|
|
51
|
-
providers?: ServiceProvider[];
|
|
52
|
-
/**
|
|
53
|
-
* Whether to auto-discover providers from providersPath
|
|
54
|
-
* @default true
|
|
55
|
-
*/
|
|
56
|
-
autoDiscoverProviders?: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Application - Enterprise-grade application container.
|
|
60
|
-
*
|
|
61
|
-
* Provides a higher-level abstraction over PlanetCore for building
|
|
62
|
-
* enterprise applications with convention-over-configuration patterns.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* // Create application
|
|
67
|
-
* const app = new Application({
|
|
68
|
-
* basePath: import.meta.dir,
|
|
69
|
-
* env: process.env.NODE_ENV as 'development' | 'production',
|
|
70
|
-
* });
|
|
71
|
-
*
|
|
72
|
-
* // Boot the application
|
|
73
|
-
* await app.boot();
|
|
74
|
-
*
|
|
75
|
-
* // Access core
|
|
76
|
-
* export default app.core.liftoff();
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export declare class Application {
|
|
80
|
-
/**
|
|
81
|
-
* The underlying PlanetCore instance.
|
|
82
|
-
*/
|
|
83
|
-
readonly core: PlanetCore;
|
|
84
|
-
/**
|
|
85
|
-
* The IoC container.
|
|
86
|
-
*/
|
|
87
|
-
readonly container: Container;
|
|
88
|
-
/**
|
|
89
|
-
* The configuration manager.
|
|
90
|
-
*/
|
|
91
|
-
readonly config: ConfigManager;
|
|
92
|
-
/**
|
|
93
|
-
* The event manager.
|
|
94
|
-
*/
|
|
95
|
-
readonly events: EventManager;
|
|
96
|
-
/**
|
|
97
|
-
* The logger instance.
|
|
98
|
-
*/
|
|
99
|
-
readonly logger: Logger;
|
|
100
|
-
/**
|
|
101
|
-
* Application base path.
|
|
102
|
-
*/
|
|
103
|
-
readonly basePath: string;
|
|
104
|
-
/**
|
|
105
|
-
* Environment mode.
|
|
106
|
-
*/
|
|
107
|
-
readonly env: 'development' | 'production' | 'testing';
|
|
108
|
-
/**
|
|
109
|
-
* Configuration options.
|
|
110
|
-
*/
|
|
111
|
-
private readonly options;
|
|
112
|
-
/**
|
|
113
|
-
* Whether the application has been booted.
|
|
114
|
-
*/
|
|
115
|
-
private booted;
|
|
116
|
-
constructor(options: ApplicationConfig);
|
|
117
|
-
/**
|
|
118
|
-
* Boot the application and its dependencies.
|
|
119
|
-
*
|
|
120
|
-
* This method orchestrates the full application lifecycle:
|
|
121
|
-
* 1. Configuration: Loads all config files from the config directory.
|
|
122
|
-
* 2. Discovery: Auto-discovers ServiceProviders from the providers directory.
|
|
123
|
-
* 3. Registration: Registers all discovered and explicit providers.
|
|
124
|
-
* 4. Bootstrapping: Triggers the PlanetCore bootstrap sequence.
|
|
125
|
-
*
|
|
126
|
-
* @returns Promise that resolves to the application instance for chaining.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const app = new Application({ basePath: import.meta.dir });
|
|
131
|
-
* await app.boot();
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
boot(): Promise<this>;
|
|
135
|
-
/**
|
|
136
|
-
* Load configuration files from the config directory.
|
|
137
|
-
*
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
private loadConfiguration;
|
|
141
|
-
/**
|
|
142
|
-
* Discover and register providers from the providers directory.
|
|
143
|
-
*
|
|
144
|
-
* @internal
|
|
145
|
-
*/
|
|
146
|
-
private discoverProviders;
|
|
147
|
-
/**
|
|
148
|
-
* Resolve a service instance from the IoC container.
|
|
149
|
-
*
|
|
150
|
-
* This is a convenience wrapper around `container.make()`.
|
|
151
|
-
*
|
|
152
|
-
* @template T - The expected type of the service.
|
|
153
|
-
* @param key - The unique identifier or class name of the service.
|
|
154
|
-
* @returns The resolved service instance.
|
|
155
|
-
* @throws Error if the service is not bound in the container.
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```typescript
|
|
159
|
-
* const db = app.make<Database>('db');
|
|
160
|
-
* ```
|
|
161
|
-
*/
|
|
162
|
-
make<T>(key: string): T;
|
|
163
|
-
/**
|
|
164
|
-
* Check if a service is bound.
|
|
165
|
-
*
|
|
166
|
-
* @param key - The service key
|
|
167
|
-
* @returns True if bound
|
|
168
|
-
*/
|
|
169
|
-
has(key: string): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Retrieve a configuration value using dot notation.
|
|
172
|
-
*
|
|
173
|
-
* @template T - The expected type of the configuration value.
|
|
174
|
-
* @param key - The configuration key (e.g., 'app.name', 'database.connections.mysql').
|
|
175
|
-
* @param defaultValue - Optional value to return if the key is not found.
|
|
176
|
-
* @returns The configuration value or the default value.
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* ```typescript
|
|
180
|
-
* const port = app.getConfig<number>('app.port', 3000);
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
getConfig<T>(key: string, defaultValue?: T): T;
|
|
184
|
-
/**
|
|
185
|
-
* Resolve an absolute path relative to the application base path.
|
|
186
|
-
*
|
|
187
|
-
* @param segments - Path segments to join with the base path.
|
|
188
|
-
* @returns The absolute path string.
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* ```typescript
|
|
192
|
-
* const storagePath = app.path('storage', 'logs');
|
|
193
|
-
* ```
|
|
194
|
-
*/
|
|
195
|
-
path(...segments: string[]): string;
|
|
196
|
-
/**
|
|
197
|
-
* Get the config path.
|
|
198
|
-
*
|
|
199
|
-
* @param segments - Additional path segments
|
|
200
|
-
* @returns Absolute path to config directory
|
|
201
|
-
*/
|
|
202
|
-
configPath(...segments: string[]): string;
|
|
203
|
-
/**
|
|
204
|
-
* Check if running in production.
|
|
205
|
-
*/
|
|
206
|
-
isProduction(): boolean;
|
|
207
|
-
/**
|
|
208
|
-
* Check if running in development.
|
|
209
|
-
*/
|
|
210
|
-
isDevelopment(): boolean;
|
|
211
|
-
/**
|
|
212
|
-
* Check if running in testing.
|
|
213
|
-
*/
|
|
214
|
-
isTesting(): boolean;
|
|
215
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Container } from './Container';
|
|
2
|
-
/**
|
|
3
|
-
* CommandHandler type for custom CLI commands.
|
|
4
|
-
*/
|
|
5
|
-
export type CommandHandler = (args: string[], container: Container) => Promise<void> | void;
|
|
6
|
-
/**
|
|
7
|
-
* CommandKernel - Structured CLI Command handling.
|
|
8
|
-
*
|
|
9
|
-
* Manages registration and execution of custom CLI commands that can
|
|
10
|
-
* reuse the application container and providers.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const kernel = new CommandKernel(container);
|
|
15
|
-
* kernel.register('greet', (args) => console.log('Hello', args[0]));
|
|
16
|
-
* await kernel.handle(['greet', 'Universe']);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare class CommandKernel {
|
|
20
|
-
private container;
|
|
21
|
-
private commands;
|
|
22
|
-
constructor(container: Container);
|
|
23
|
-
/**
|
|
24
|
-
* Register a new command handler.
|
|
25
|
-
*/
|
|
26
|
-
register(name: string, handler: CommandHandler): void;
|
|
27
|
-
/**
|
|
28
|
-
* Handle an incoming CLI command.
|
|
29
|
-
*
|
|
30
|
-
* @param argv - Array of command line arguments (e.g. process.argv.slice(2))
|
|
31
|
-
*/
|
|
32
|
-
handle(argv: string[]): Promise<void>;
|
|
33
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration manager (ConfigManager)
|
|
3
|
-
*
|
|
4
|
-
* Unifies environment variables and application configuration access.
|
|
5
|
-
*/
|
|
6
|
-
import type { ZodSchema } from 'zod';
|
|
7
|
-
/**
|
|
8
|
-
* ConfigManager - Central configuration store.
|
|
9
|
-
* Supports loading from environment variables and initial objects.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare class ConfigManager {
|
|
13
|
-
private config;
|
|
14
|
-
private schema;
|
|
15
|
-
constructor(initialConfig?: Record<string, unknown>);
|
|
16
|
-
/**
|
|
17
|
-
* Load all environment variables from the active runtime.
|
|
18
|
-
*/
|
|
19
|
-
private loadEnv;
|
|
20
|
-
/**
|
|
21
|
-
* Get a configuration value (generic return type supported).
|
|
22
|
-
* Supports dot notation for deep access (e.g. 'app.name').
|
|
23
|
-
*/
|
|
24
|
-
get<T = unknown>(key: string, defaultValue?: T): T;
|
|
25
|
-
/**
|
|
26
|
-
* Set a configuration value.
|
|
27
|
-
*/
|
|
28
|
-
set(key: string, value: unknown): void;
|
|
29
|
-
/**
|
|
30
|
-
* Check whether a key exists.
|
|
31
|
-
*/
|
|
32
|
-
has(key: string): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Define a Zod schema for configuration validation.
|
|
35
|
-
*
|
|
36
|
-
* @param schema - Zod schema for validation
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* config.defineSchema(z.object({
|
|
41
|
-
* DATABASE_URL: z.string().url(),
|
|
42
|
-
* PORT: z.number().default(3000),
|
|
43
|
-
* }))
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
defineSchema(schema: ZodSchema): void;
|
|
47
|
-
/**
|
|
48
|
-
* Validate configuration against the defined schema.
|
|
49
|
-
*
|
|
50
|
-
* Should be called during bootstrap to catch configuration errors early.
|
|
51
|
-
*
|
|
52
|
-
* @throws Error if validation fails with details about missing/invalid fields
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* try {
|
|
57
|
-
* config.validate()
|
|
58
|
-
* } catch (error) {
|
|
59
|
-
* console.error('Config validation failed:', error.message)
|
|
60
|
-
* process.exit(1)
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
validate(): void;
|
|
65
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ServiceKey } from '../Container';
|
|
2
|
-
import { RequestScopeMetrics, type RequestScopeObserver } from './RequestScopeMetrics';
|
|
3
|
-
/**
|
|
4
|
-
* Manages request-scoped service instances within a single HTTP request.
|
|
5
|
-
*
|
|
6
|
-
* Each request gets its own RequestScopeManager instance with isolated state.
|
|
7
|
-
* Services are cached within the request and automatically cleaned up when
|
|
8
|
-
* the request ends.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const scope = new RequestScopeManager()
|
|
13
|
-
* const cache = scope.resolve('productCache', () => new ProductCache())
|
|
14
|
-
* // ... use cache ...
|
|
15
|
-
* await scope.cleanup() // Called automatically by Gravito engine
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class RequestScopeManager {
|
|
19
|
-
private scoped;
|
|
20
|
-
private metadata;
|
|
21
|
-
private metrics;
|
|
22
|
-
private observer;
|
|
23
|
-
constructor(observer?: RequestScopeObserver);
|
|
24
|
-
/**
|
|
25
|
-
* Set observer for monitoring scope lifecycle
|
|
26
|
-
*/
|
|
27
|
-
setObserver(observer: RequestScopeObserver): void;
|
|
28
|
-
/**
|
|
29
|
-
* Get metrics for this scope
|
|
30
|
-
*/
|
|
31
|
-
getMetrics(): RequestScopeMetrics;
|
|
32
|
-
/**
|
|
33
|
-
* Resolve or retrieve a request-scoped service instance.
|
|
34
|
-
*
|
|
35
|
-
* If the service already exists in this scope, returns the cached instance.
|
|
36
|
-
* Otherwise, calls the factory function to create a new instance and caches it.
|
|
37
|
-
*
|
|
38
|
-
* Automatically detects and records services with cleanup methods.
|
|
39
|
-
*
|
|
40
|
-
* @template T - The type of the service.
|
|
41
|
-
* @param key - The service key (for caching).
|
|
42
|
-
* @param factory - Factory function to create the instance if not cached.
|
|
43
|
-
* @returns The cached or newly created instance.
|
|
44
|
-
*/
|
|
45
|
-
resolve<T>(key: ServiceKey, factory: () => T): T;
|
|
46
|
-
/**
|
|
47
|
-
* Clean up all request-scoped instances.
|
|
48
|
-
*
|
|
49
|
-
* Calls the cleanup() method on each service that has one.
|
|
50
|
-
* Silently ignores cleanup errors to prevent cascading failures.
|
|
51
|
-
* Called automatically by the Gravito engine in the request finally block.
|
|
52
|
-
*
|
|
53
|
-
* @returns Promise that resolves when all cleanup is complete.
|
|
54
|
-
*/
|
|
55
|
-
cleanup(): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Get the number of services in this scope (for monitoring).
|
|
58
|
-
*
|
|
59
|
-
* @returns The count of cached services.
|
|
60
|
-
*/
|
|
61
|
-
size(): number;
|
|
62
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RequestScopeMetrics - Observability for RequestScope lifecycle
|
|
3
|
-
*
|
|
4
|
-
* Tracks cleanup execution time, scope size, and service counts
|
|
5
|
-
* for performance monitoring and diagnostics.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const metrics = new RequestScopeMetrics()
|
|
10
|
-
* metrics.recordCleanupStart()
|
|
11
|
-
* await scope.cleanup()
|
|
12
|
-
* metrics.recordCleanupEnd()
|
|
13
|
-
*
|
|
14
|
-
* console.log(metrics.toJSON())
|
|
15
|
-
* // { cleanupDuration: 2.5, scopeSize: 3, servicesCleaned: 3 }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class RequestScopeMetrics {
|
|
19
|
-
private cleanupStartTime;
|
|
20
|
-
private cleanupDuration;
|
|
21
|
-
private scopeSize;
|
|
22
|
-
private servicesCleaned;
|
|
23
|
-
private errorsOccurred;
|
|
24
|
-
/**
|
|
25
|
-
* Record start of cleanup operation
|
|
26
|
-
*/
|
|
27
|
-
recordCleanupStart(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Record end of cleanup operation
|
|
30
|
-
*
|
|
31
|
-
* @param scopeSize - Number of services in the scope
|
|
32
|
-
* @param servicesCleaned - Number of services that had cleanup called
|
|
33
|
-
* @param errorsOccurred - Number of cleanup errors
|
|
34
|
-
*/
|
|
35
|
-
recordCleanupEnd(scopeSize: number, servicesCleaned: number, errorsOccurred?: number): void;
|
|
36
|
-
/**
|
|
37
|
-
* Get cleanup duration in milliseconds
|
|
38
|
-
*
|
|
39
|
-
* @returns Duration in ms, or null if cleanup not completed
|
|
40
|
-
*/
|
|
41
|
-
getCleanupDuration(): number | null;
|
|
42
|
-
/**
|
|
43
|
-
* Check if cleanup took longer than threshold (default 2ms)
|
|
44
|
-
* Useful for detecting slow cleanups
|
|
45
|
-
*
|
|
46
|
-
* @param thresholdMs - Threshold in milliseconds
|
|
47
|
-
* @returns True if cleanup exceeded threshold
|
|
48
|
-
*/
|
|
49
|
-
isSlowCleanup(thresholdMs?: number): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Export metrics as JSON for logging/monitoring
|
|
52
|
-
*/
|
|
53
|
-
toJSON(): {
|
|
54
|
-
cleanupDuration: number | null;
|
|
55
|
-
scopeSize: number;
|
|
56
|
-
servicesCleaned: number;
|
|
57
|
-
errorsOccurred: number;
|
|
58
|
-
hasErrors: boolean;
|
|
59
|
-
isSlowCleanup: boolean;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Export metrics as compact string for logging
|
|
63
|
-
*/
|
|
64
|
-
toString(): string;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* RequestScopeObserver - Hook for monitoring RequestScope lifecycle
|
|
68
|
-
*
|
|
69
|
-
* Implement this interface to receive callbacks during scope operations
|
|
70
|
-
*/
|
|
71
|
-
export interface RequestScopeObserver {
|
|
72
|
-
/**
|
|
73
|
-
* Called when a service is resolved in the scope
|
|
74
|
-
*/
|
|
75
|
-
onServiceResolved?(key: string | symbol, isFromCache: boolean): void;
|
|
76
|
-
/**
|
|
77
|
-
* Called when cleanup starts
|
|
78
|
-
*/
|
|
79
|
-
onCleanupStart?(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Called when cleanup completes
|
|
82
|
-
*/
|
|
83
|
-
onCleanupEnd?(metrics: RequestScopeMetrics): void;
|
|
84
|
-
/**
|
|
85
|
-
* Called when cleanup encounters an error
|
|
86
|
-
*/
|
|
87
|
-
onCleanupError?(error: Error): void;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* RequestScopeMetricsCollector - Aggregates metrics across multiple scopes
|
|
91
|
-
*
|
|
92
|
-
* Used for application-level monitoring and performance tracking
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```typescript
|
|
96
|
-
* const collector = new RequestScopeMetricsCollector()
|
|
97
|
-
*
|
|
98
|
-
* // Record metrics from multiple requests
|
|
99
|
-
* collector.record(metrics1)
|
|
100
|
-
* collector.record(metrics2)
|
|
101
|
-
* collector.record(metrics3)
|
|
102
|
-
*
|
|
103
|
-
* // Get aggregated stats
|
|
104
|
-
* const stats = collector.getStats()
|
|
105
|
-
* console.log(stats.averageCleanupTime) // 3.5ms
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
export declare class RequestScopeMetricsCollector {
|
|
109
|
-
private metrics;
|
|
110
|
-
/**
|
|
111
|
-
* Record metrics from a request scope
|
|
112
|
-
*/
|
|
113
|
-
record(metrics: RequestScopeMetrics): void;
|
|
114
|
-
/**
|
|
115
|
-
* Get aggregated statistics
|
|
116
|
-
*/
|
|
117
|
-
getStats(): {
|
|
118
|
-
count: number;
|
|
119
|
-
averageCleanupTime: number | null;
|
|
120
|
-
maxCleanupTime: number | null;
|
|
121
|
-
minCleanupTime: number | null;
|
|
122
|
-
totalErrorCount: number;
|
|
123
|
-
errorRate: number;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Clear collected metrics
|
|
127
|
-
*/
|
|
128
|
-
clear(): void;
|
|
129
|
-
/**
|
|
130
|
-
* Get number of recorded metrics
|
|
131
|
-
*/
|
|
132
|
-
size(): number;
|
|
133
|
-
/**
|
|
134
|
-
* Export metrics as JSON array
|
|
135
|
-
*/
|
|
136
|
-
toJSON(): {
|
|
137
|
-
cleanupDuration: number | null;
|
|
138
|
-
scopeSize: number;
|
|
139
|
-
servicesCleaned: number;
|
|
140
|
-
errorsOccurred: number;
|
|
141
|
-
hasErrors: boolean;
|
|
142
|
-
isSlowCleanup: boolean;
|
|
143
|
-
}[];
|
|
144
|
-
}
|