@gravito/echo 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -9
- package/dist/OrbitEcho.d.ts +76 -60
- package/dist/index.d.ts +31 -16
- package/dist/index.js +1 -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/send/WebhookDispatcher.d.ts +159 -16
- package/dist/send/index.d.ts +0 -1
- package/dist/types.d.ts +669 -57
- package/package.json +5 -2
- 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/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/resilience → resilience}/CircuitBreaker.d.ts +0 -0
- /package/dist/{echo/src/resilience → resilience}/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,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal metric types for event observability.
|
|
3
|
-
* Avoids importing @gravito/monitor from core to prevent circular dependency.
|
|
4
|
-
* Runtime implementations are provided by @gravito/monitor MetricsRegistry.
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export interface EventMetricCounter {
|
|
9
|
-
inc(labels: Record<string, string>): void;
|
|
10
|
-
}
|
|
11
|
-
export interface EventMetricGauge {
|
|
12
|
-
set(value: number, labels: Record<string, string>): void;
|
|
13
|
-
}
|
|
14
|
-
export interface EventMetricHistogram {
|
|
15
|
-
observe(value: number, labels: Record<string, string>): void;
|
|
16
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type { ActionCallback } from '../HookManager';
|
|
2
|
-
import type { BackpressureConfig } from './BackpressureManager';
|
|
3
|
-
import type { EventOptions } from './EventOptions';
|
|
4
|
-
/**
|
|
5
|
-
* Event task for priority queue processing.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export interface EventTask {
|
|
9
|
-
/**
|
|
10
|
-
* Unique identifier for this event task.
|
|
11
|
-
*/
|
|
12
|
-
id: string;
|
|
13
|
-
/**
|
|
14
|
-
* Event hook name.
|
|
15
|
-
*/
|
|
16
|
-
hook: string;
|
|
17
|
-
/**
|
|
18
|
-
* Event payload/arguments.
|
|
19
|
-
*/
|
|
20
|
-
args: unknown;
|
|
21
|
-
/**
|
|
22
|
-
* Event options.
|
|
23
|
-
*/
|
|
24
|
-
options: EventOptions;
|
|
25
|
-
/**
|
|
26
|
-
* Callbacks to execute for this event.
|
|
27
|
-
*/
|
|
28
|
-
callbacks: ActionCallback[];
|
|
29
|
-
/**
|
|
30
|
-
* Timestamp when the event was created.
|
|
31
|
-
*/
|
|
32
|
-
createdAt: number;
|
|
33
|
-
/**
|
|
34
|
-
* Timestamp when the event was enqueued (added to the queue).
|
|
35
|
-
* Used for priority escalation calculations.
|
|
36
|
-
* @internal
|
|
37
|
-
*/
|
|
38
|
-
enqueuedAt: number;
|
|
39
|
-
/**
|
|
40
|
-
* Partition key for ordering (if applicable).
|
|
41
|
-
*/
|
|
42
|
-
partitionKey?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Number of retry attempts made.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
retryCount?: number;
|
|
48
|
-
/**
|
|
49
|
-
* Timestamp when the event first failed.
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
firstFailedAt?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Last error encountered.
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
lastError?: Error;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Strategy for handling backpressure when the queue is full.
|
|
61
|
-
*/
|
|
62
|
-
export type BackpressureStrategy = 'reject' | 'drop-oldest' | 'drop-newest' | 'ignore';
|
|
63
|
-
/**
|
|
64
|
-
* Configuration for the event priority queue.
|
|
65
|
-
*/
|
|
66
|
-
export interface EventQueueConfig {
|
|
67
|
-
/**
|
|
68
|
-
* Maximum number of pending events in the queue.
|
|
69
|
-
* If exceeded, the backpressure strategy is applied.
|
|
70
|
-
* @default undefined (unbounded)
|
|
71
|
-
*/
|
|
72
|
-
maxSize?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Strategy to use when the queue is full.
|
|
75
|
-
* - 'reject': Throw an error (default)
|
|
76
|
-
* - 'drop-oldest': Drop the oldest lowest-priority event
|
|
77
|
-
* - 'drop-newest': Drop the incoming event
|
|
78
|
-
* - 'ignore': Silently drop the incoming event
|
|
79
|
-
* @default 'reject'
|
|
80
|
-
*/
|
|
81
|
-
strategy?: BackpressureStrategy;
|
|
82
|
-
/**
|
|
83
|
-
* Advanced backpressure management configuration.
|
|
84
|
-
* When enabled, provides state-based flow control with multi-strategy support.
|
|
85
|
-
* If not provided, falls back to simple strategy-based backpressure.
|
|
86
|
-
* @default undefined (disabled, uses simple strategy)
|
|
87
|
-
*/
|
|
88
|
-
backpressure?: BackpressureConfig;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Multi-priority queue depth snapshot (FS-103)
|
|
92
|
-
* Represents the current queue depth for each priority level.
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
export interface MultiPriorityQueueDepth {
|
|
96
|
-
/** Queue depth for CRITICAL priority events */
|
|
97
|
-
critical: number;
|
|
98
|
-
/** Queue depth for HIGH priority events */
|
|
99
|
-
high: number;
|
|
100
|
-
/** Queue depth for NORMAL priority events */
|
|
101
|
-
normal: number;
|
|
102
|
-
/** Queue depth for LOW priority events */
|
|
103
|
-
low: number;
|
|
104
|
-
/** Total queue depth across all priorities */
|
|
105
|
-
total: number;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Window adjustment record for backpressure feedback (FS-103)
|
|
109
|
-
* Records when and why the aggregation window was adjusted.
|
|
110
|
-
* @internal
|
|
111
|
-
*/
|
|
112
|
-
export interface WindowAdjustment {
|
|
113
|
-
/** Timestamp of the adjustment */
|
|
114
|
-
timestamp: number;
|
|
115
|
-
/** Previous window size in milliseconds */
|
|
116
|
-
from: number;
|
|
117
|
-
/** New window size in milliseconds */
|
|
118
|
-
to: number;
|
|
119
|
-
/** Backpressure state that triggered the adjustment */
|
|
120
|
-
reason: string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Dead letter queue routing decision (FS-103)
|
|
124
|
-
* Determines whether an event should be routed to the DLQ.
|
|
125
|
-
* @internal
|
|
126
|
-
*/
|
|
127
|
-
export interface DeadLetterDecision {
|
|
128
|
-
/** Whether the event should be routed to DLQ */
|
|
129
|
-
shouldRoute: boolean;
|
|
130
|
-
/** Reason for the decision (if applicable) */
|
|
131
|
-
reason?: string;
|
|
132
|
-
/** Suggested retry strategy */
|
|
133
|
-
retryStrategy?: 'immediate' | 'delayed' | 'dlq-only';
|
|
134
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ServiceKey } from '../Container';
|
|
2
|
-
/**
|
|
3
|
-
* CircularDependencyException - Thrown when the container detects an infinite loop.
|
|
4
|
-
*
|
|
5
|
-
* @module @gravito/core
|
|
6
|
-
*/
|
|
7
|
-
export declare class CircularDependencyException extends Error {
|
|
8
|
-
constructor(key: ServiceKey, stack: ServiceKey[]);
|
|
9
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ContentfulStatusCode } from '../http/types';
|
|
2
|
-
/**
|
|
3
|
-
* Options for creating a GravitoException
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ExceptionOptions {
|
|
7
|
-
message?: string;
|
|
8
|
-
cause?: unknown;
|
|
9
|
-
i18nKey?: string;
|
|
10
|
-
i18nParams?: Record<string, string | number>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Base exception class for consistent error handling.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export declare abstract class GravitoException extends Error {
|
|
17
|
-
readonly status: ContentfulStatusCode;
|
|
18
|
-
readonly code: string;
|
|
19
|
-
readonly i18nKey?: string;
|
|
20
|
-
readonly i18nParams?: Record<string, string | number>;
|
|
21
|
-
constructor(status: number, code: string, options?: ExceptionOptions);
|
|
22
|
-
getLocalizedMessage(t: (key: string, params?: Record<string, string | number>) => string): string;
|
|
23
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ContentfulStatusCode } from '../http/types';
|
|
2
|
-
import { type ExceptionOptions, GravitoException } from './GravitoException';
|
|
3
|
-
/**
|
|
4
|
-
* Generic HTTP Exception
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare class HttpException extends GravitoException {
|
|
8
|
-
constructor(status: ContentfulStatusCode, options?: ExceptionOptions);
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { GravitoException } from './GravitoException';
|
|
2
|
-
/**
|
|
3
|
-
* Exception thrown when a database model is not found.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export declare class ModelNotFoundException extends GravitoException {
|
|
7
|
-
readonly model: string;
|
|
8
|
-
readonly id?: string | number;
|
|
9
|
-
constructor(model: string, id?: string | number);
|
|
10
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { GravitoException } from './GravitoException';
|
|
2
|
-
/**
|
|
3
|
-
* Structure of a validation error
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ValidationError {
|
|
7
|
-
field: string;
|
|
8
|
-
message: string;
|
|
9
|
-
code?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Exception thrown when data validation fails.
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export declare class ValidationException extends GravitoException {
|
|
16
|
-
readonly errors: ValidationError[];
|
|
17
|
-
redirectTo?: string;
|
|
18
|
-
input?: unknown;
|
|
19
|
-
constructor(errors: ValidationError[], message?: string);
|
|
20
|
-
withRedirect(url: string): this;
|
|
21
|
-
withInput(input: unknown): this;
|
|
22
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './AuthenticationException';
|
|
2
|
-
export * from './AuthorizationException';
|
|
3
|
-
export * from './CircularDependencyException';
|
|
4
|
-
export * from './GravitoException';
|
|
5
|
-
export * from './HttpException';
|
|
6
|
-
export * from './ModelNotFoundException';
|
|
7
|
-
export * from './ValidationException';
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview HealthProvider - Cloud-native health checks
|
|
3
|
-
*
|
|
4
|
-
* Provides liveness and readiness probes for Kubernetes and cloud deployments
|
|
5
|
-
*
|
|
6
|
-
* @module @gravito/core/health
|
|
7
|
-
* @since 2.2.0
|
|
8
|
-
*/
|
|
9
|
-
import type { Container } from '../Container';
|
|
10
|
-
import type { PlanetCore } from '../PlanetCore';
|
|
11
|
-
import { ServiceProvider } from '../ServiceProvider';
|
|
12
|
-
/**
|
|
13
|
-
* Health check result
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export interface HealthCheckResult {
|
|
17
|
-
/** Health status */
|
|
18
|
-
status: 'healthy' | 'unhealthy';
|
|
19
|
-
/** Optional message */
|
|
20
|
-
message?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Health check function interface
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export interface HealthCheck {
|
|
27
|
-
/** Unique name for this check */
|
|
28
|
-
name: string;
|
|
29
|
-
/** Check function that returns health status */
|
|
30
|
-
check(): Promise<HealthCheckResult>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* HealthProvider - Provides /health/liveness and /health/readiness endpoints
|
|
34
|
-
*
|
|
35
|
-
* - Liveness: Always returns 200 OK (just checks if server is running)
|
|
36
|
-
* - Readiness: Returns 200 if all checks are healthy, 503 otherwise
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export declare class HealthProvider extends ServiceProvider {
|
|
41
|
-
private checks;
|
|
42
|
-
register(container: Container): void;
|
|
43
|
-
/**
|
|
44
|
-
* Register a health check
|
|
45
|
-
*
|
|
46
|
-
* @param check - The health check to register
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* const health = core.container.make<HealthProvider>('health')
|
|
51
|
-
* health.registerCheck({
|
|
52
|
-
* name: 'database',
|
|
53
|
-
* check: async () => {
|
|
54
|
-
* try {
|
|
55
|
-
* await db.ping()
|
|
56
|
-
* return { status: 'healthy' }
|
|
57
|
-
* } catch {
|
|
58
|
-
* return { status: 'unhealthy', message: 'DB unreachable' }
|
|
59
|
-
* }
|
|
60
|
-
* }
|
|
61
|
-
* })
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
registerCheck(check: HealthCheck): void;
|
|
65
|
-
boot(core: PlanetCore): void;
|
|
66
|
-
}
|
|
67
|
-
export default HealthProvider;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type DataPath } from './data';
|
|
2
|
-
/**
|
|
3
|
-
* Array and Collection Helpers.
|
|
4
|
-
* Provides utility methods for array manipulation and deep object access.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare const Arr: {
|
|
8
|
-
readonly get: <TDefault = undefined>(target: unknown, path: DataPath | null | undefined, defaultValue?: TDefault) => unknown | TDefault;
|
|
9
|
-
readonly has: (target: unknown, path: DataPath | null | undefined) => boolean;
|
|
10
|
-
readonly set: (target: unknown, path: DataPath, value: unknown, overwrite?: boolean) => unknown;
|
|
11
|
-
readonly wrap: <T>(value: T | T[] | null | undefined) => T[];
|
|
12
|
-
readonly first: <T>(items: readonly T[], callback?: (value: T, index: number) => boolean) => T | undefined;
|
|
13
|
-
readonly last: <T>(items: readonly T[], callback?: (value: T, index: number) => boolean) => T | undefined;
|
|
14
|
-
readonly only: <T extends Record<string, unknown>>(target: T, keys: readonly string[]) => Partial<T>;
|
|
15
|
-
readonly except: <T extends Record<string, unknown>>(target: T, keys: readonly string[]) => Partial<T>;
|
|
16
|
-
readonly flatten: (items: unknown[], depth?: number) => unknown[];
|
|
17
|
-
readonly pluck: <TItem extends Record<string, unknown>>(items: readonly TItem[], valuePath: DataPath, keyPath?: DataPath) => unknown[] | Record<string, unknown>;
|
|
18
|
-
readonly where: <T>(items: readonly T[], callback: (value: T, index: number) => boolean) => T[];
|
|
19
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type StartsEndsNeedle = string | readonly string[];
|
|
2
|
-
/**
|
|
3
|
-
* String Helper Utilities.
|
|
4
|
-
* Provides methods for string manipulation, case conversion, and UUID generation.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare const Str: {
|
|
8
|
-
readonly lower: (value: string) => string;
|
|
9
|
-
readonly upper: (value: string) => string;
|
|
10
|
-
readonly startsWith: (haystack: string, needles: StartsEndsNeedle) => boolean;
|
|
11
|
-
readonly endsWith: (haystack: string, needles: StartsEndsNeedle) => boolean;
|
|
12
|
-
readonly contains: (haystack: string, needles: StartsEndsNeedle) => boolean;
|
|
13
|
-
readonly snake: (value: string) => string;
|
|
14
|
-
readonly kebab: (value: string) => string;
|
|
15
|
-
readonly studly: (value: string) => string;
|
|
16
|
-
readonly camel: (value: string) => string;
|
|
17
|
-
readonly title: (value: string) => string;
|
|
18
|
-
readonly limit: (value: string, limit: number, end?: string) => string;
|
|
19
|
-
readonly slug: (value: string, separator?: string) => string;
|
|
20
|
-
readonly uuid: () => string;
|
|
21
|
-
readonly random: (length?: number) => string;
|
|
22
|
-
};
|
|
23
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Path segment (key) in a data structure.
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export type PathSegment = string | number;
|
|
6
|
-
/**
|
|
7
|
-
* Path to a value (dot notation or array of segments).
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export type DataPath = string | readonly PathSegment[];
|
|
11
|
-
/**
|
|
12
|
-
* Retrieve a value from a deep object using dot notation.
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export declare function dataGet<TDefault = undefined>(target: unknown, path: DataPath | null | undefined, defaultValue?: TDefault): unknown | TDefault;
|
|
16
|
-
/**
|
|
17
|
-
* Check if a key exists in a deep object using dot notation.
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export declare function dataHas(target: unknown, path: DataPath | null | undefined): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Set a value in a deep object using dot notation.
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export declare function dataSet(target: unknown, path: DataPath, setValue: unknown, overwrite?: boolean): unknown;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { GravitoContext } from '../http/types';
|
|
2
|
-
/**
|
|
3
|
-
* Interface for displaying validation errors in views.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ErrorBag {
|
|
7
|
-
/** Check if a field has errors */
|
|
8
|
-
has(field: string): boolean;
|
|
9
|
-
/** Get the first error message for a field (or any first error if no field specified) */
|
|
10
|
-
first(field?: string): string | undefined;
|
|
11
|
-
/** Get all error messages for a field */
|
|
12
|
-
get(field: string): string[];
|
|
13
|
-
/** Get all errors for all fields */
|
|
14
|
-
all(): Record<string, string[]>;
|
|
15
|
-
/** Check if there are any errors */
|
|
16
|
-
any(): boolean;
|
|
17
|
-
/** Get total number of error messages */
|
|
18
|
-
count(): number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Create a new ErrorBag instance from raw errors.
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare function createErrorBag(errors: Record<string, string[]>): ErrorBag;
|
|
25
|
-
/**
|
|
26
|
-
* Helper to retrieve the ErrorBag from session flash data.
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export declare function errors(c: GravitoContext): ErrorBag;
|
|
30
|
-
/**
|
|
31
|
-
* Helper to retrieve old input value from session flash.
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export declare function old(c: GravitoContext, field: string, defaultValue?: unknown): unknown;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ContentfulStatusCode, GravitoContext } from '../http/types';
|
|
2
|
-
/**
|
|
3
|
-
* Standard API Success Response Structure
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export type ApiSuccess<T> = {
|
|
7
|
-
success: true;
|
|
8
|
-
data: T;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Standard API Failure Response Structure
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export type ApiFailure = {
|
|
15
|
-
success: false;
|
|
16
|
-
error: {
|
|
17
|
-
message: string;
|
|
18
|
-
code?: string;
|
|
19
|
-
details?: unknown;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Create a success response object.
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare function ok<T>(data: T): ApiSuccess<T>;
|
|
27
|
-
/**
|
|
28
|
-
* Create a failure response object.
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
export declare function fail(message: string, code?: string, details?: unknown): ApiFailure;
|
|
32
|
-
/**
|
|
33
|
-
* Return a JSON response with standard success structure.
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
export declare function jsonSuccess<T>(c: GravitoContext, data: T, status?: ContentfulStatusCode): Response;
|
|
37
|
-
/**
|
|
38
|
-
* Return a JSON response with standard failure structure.
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare function jsonFail(c: GravitoContext, message: string, status?: ContentfulStatusCode, code?: string, details?: unknown): Response;
|