@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,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event-system CircuitBreaker — standalone copy.
|
|
3
|
+
*
|
|
4
|
+
* NOTE: This is intentionally NOT a re-export from @gravito/resilience
|
|
5
|
+
* to avoid a circular dependency (core <-> resilience):
|
|
6
|
+
* @gravito/core -> @gravito/resilience (peerDep of resilience -> core)
|
|
7
|
+
*
|
|
8
|
+
* The canonical CB implementation lives in @gravito/resilience.
|
|
9
|
+
* Keep this file in sync manually if the canonical CB API changes.
|
|
10
|
+
*
|
|
11
|
+
* Per D-02 decision recorded in 17-RESEARCH.md.
|
|
12
|
+
*/
|
|
1
13
|
/**
|
|
2
14
|
* Circuit Breaker state enum.
|
|
3
15
|
* @public
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { Span } from '@opentelemetry/api';
|
|
2
2
|
import type { ActionCallback } from '../HookManager';
|
|
3
|
-
import { BackpressureManager } from './BackpressureManager';
|
|
4
|
-
import { CircuitBreaker } from './CircuitBreaker';
|
|
3
|
+
import type { BackpressureManager } from './BackpressureManager';
|
|
5
4
|
import type { DeadLetterQueue } from './DeadLetterQueue';
|
|
6
5
|
import type { EventBackend } from './EventBackend';
|
|
7
6
|
import type { EventOptions } from './EventOptions';
|
|
8
7
|
import type { EventMetrics } from './observability/EventMetrics';
|
|
9
8
|
import type { EventTracing } from './observability/EventTracing';
|
|
10
9
|
import type { OTelEventMetrics } from './observability/OTelEventMetrics';
|
|
11
|
-
import {
|
|
10
|
+
import type { PriorityStatistics } from './PriorityEscalationManager';
|
|
12
11
|
import type { RetryScheduler } from './RetryScheduler';
|
|
13
12
|
import type { BackpressureStrategy, EventQueueConfig, EventTask, MultiPriorityQueueDepth } from './types';
|
|
14
13
|
import type { WorkerPool } from './WorkerPool';
|
|
@@ -23,279 +22,42 @@ export type { EventTask, EventQueueConfig, BackpressureStrategy };
|
|
|
23
22
|
*
|
|
24
23
|
* Supports automatic priority escalation based on wait time.
|
|
25
24
|
*
|
|
25
|
+
* Composed of:
|
|
26
|
+
* - {@link QueueCore}: queue data structures and backpressure logic
|
|
27
|
+
* - {@link TaskExecutor}: task execution, retry, circuit breaker, DLQ
|
|
28
|
+
*
|
|
26
29
|
* @internal
|
|
27
30
|
*/
|
|
28
31
|
export declare class EventPriorityQueue implements EventBackend {
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private normalPriority;
|
|
32
|
-
private lowPriority;
|
|
32
|
+
private queueCore;
|
|
33
|
+
private taskExecutor;
|
|
33
34
|
private processing;
|
|
34
|
-
private taskIdCounter;
|
|
35
|
-
private dlq?;
|
|
36
|
-
private persistentDLQHandler?;
|
|
37
|
-
private config;
|
|
38
|
-
private processingPartitions;
|
|
39
|
-
private eventCircuitBreakers;
|
|
40
|
-
private eventMetrics?;
|
|
41
|
-
private otelEventMetrics?;
|
|
42
|
-
private eventTracing?;
|
|
43
|
-
private currentDispatchSpan?;
|
|
44
|
-
private backpressureManager?;
|
|
45
35
|
private workerPool?;
|
|
46
|
-
private retryScheduler?;
|
|
47
|
-
private priorityStats?;
|
|
48
36
|
constructor(config?: EventQueueConfig);
|
|
49
|
-
/**
|
|
50
|
-
* Set the Dead Letter Queue for failed events.
|
|
51
|
-
*
|
|
52
|
-
* @param dlq - Dead Letter Queue instance
|
|
53
|
-
*/
|
|
54
37
|
setDeadLetterQueue(dlq: DeadLetterQueue): void;
|
|
55
|
-
/**
|
|
56
|
-
* Set the persistent DLQ handler for failed events.
|
|
57
|
-
*
|
|
58
|
-
* @param handler - Async handler function for persistent DLQ
|
|
59
|
-
*/
|
|
60
38
|
setPersistentDLQHandler(handler: (hook: string, args: unknown, options: EventOptions, error: Error, retryCount: number, firstFailedAt: number) => Promise<void>): void;
|
|
61
|
-
/**
|
|
62
|
-
* Set the EventMetrics instance for recording circuit breaker metrics.
|
|
63
|
-
*
|
|
64
|
-
* @param metrics - EventMetrics instance
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
39
|
setEventMetrics(metrics: EventMetrics): void;
|
|
68
|
-
/**
|
|
69
|
-
* Set the OTelEventMetrics instance for recording DLQ and backpressure metrics.
|
|
70
|
-
*
|
|
71
|
-
* @param metrics - OTelEventMetrics instance
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
40
|
setOTelEventMetrics(metrics: OTelEventMetrics): void;
|
|
75
|
-
/**
|
|
76
|
-
* Set the PriorityStatistics instance for tracking priority distribution.
|
|
77
|
-
*
|
|
78
|
-
* @param stats - PriorityStatistics instance
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
41
|
setPriorityStatistics(stats: PriorityStatistics): void;
|
|
82
|
-
/**
|
|
83
|
-
* Get the PriorityStatistics instance.
|
|
84
|
-
*
|
|
85
|
-
* @returns PriorityStatistics instance or undefined
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
42
|
getPriorityStatistics(): PriorityStatistics | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* Set the EventTracing instance for distributed tracing.
|
|
91
|
-
*
|
|
92
|
-
* @param tracing - EventTracing instance
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
43
|
setEventTracing(tracing: EventTracing): void;
|
|
96
|
-
/**
|
|
97
|
-
* Set the current dispatch span for creating child spans.
|
|
98
|
-
*
|
|
99
|
-
* @param span - Parent dispatch span
|
|
100
|
-
* @internal
|
|
101
|
-
*/
|
|
102
44
|
setCurrentDispatchSpan(span: Span | undefined): void;
|
|
103
|
-
/**
|
|
104
|
-
* Get the current dispatch span.
|
|
105
|
-
*
|
|
106
|
-
* @returns Current dispatch span or undefined
|
|
107
|
-
* @internal
|
|
108
|
-
*/
|
|
109
45
|
getCurrentDispatchSpan(): Span | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* Set the RetryScheduler for async distributed retries.
|
|
112
|
-
*
|
|
113
|
-
* @param scheduler - RetryScheduler instance
|
|
114
|
-
* @internal
|
|
115
|
-
*/
|
|
116
46
|
setRetryScheduler(scheduler: RetryScheduler): void;
|
|
117
|
-
/**
|
|
118
|
-
* Get the RetryScheduler instance.
|
|
119
|
-
*
|
|
120
|
-
* @returns RetryScheduler instance or undefined
|
|
121
|
-
* @internal
|
|
122
|
-
*/
|
|
123
47
|
getRetryScheduler(): RetryScheduler | undefined;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* @internal
|
|
131
|
-
*/
|
|
132
|
-
private getOrCreateEventCircuitBreaker;
|
|
133
|
-
/**
|
|
134
|
-
* Enqueue an event task for processing.
|
|
135
|
-
*
|
|
136
|
-
* @param hook - Event hook name
|
|
137
|
-
* @param args - Event arguments
|
|
138
|
-
* @param callbacks - Callbacks to execute
|
|
139
|
-
* @param options - Event options
|
|
140
|
-
* @returns Task ID
|
|
141
|
-
*/
|
|
48
|
+
getCircuitBreaker(hook: string): import("@gravito/core").CircuitBreaker | undefined;
|
|
49
|
+
getCircuitBreakers(): Map<string, import("@gravito/core").CircuitBreaker>;
|
|
50
|
+
resetCircuitBreaker(hook: string): boolean;
|
|
51
|
+
setWorkerPool(pool: WorkerPool): void;
|
|
52
|
+
getWorkerPool(): WorkerPool | undefined;
|
|
53
|
+
getBackpressureManager(): BackpressureManager | undefined;
|
|
142
54
|
enqueue(task: EventTask): string;
|
|
143
55
|
enqueue(hook: string, args: unknown, callbacks: ActionCallback[], options: EventOptions): string;
|
|
144
|
-
|
|
145
|
-
* Handle backpressure when queue is full.
|
|
146
|
-
* @returns True if space was made, false if event should be dropped
|
|
147
|
-
*/
|
|
148
|
-
private handleBackpressure;
|
|
149
|
-
/**
|
|
150
|
-
* Drop the oldest event from the queue, prioritizing low priority events.
|
|
151
|
-
* Drops in order: LOW → NORMAL → HIGH → CRITICAL
|
|
152
|
-
*/
|
|
153
|
-
private dropOldest;
|
|
154
|
-
/**
|
|
155
|
-
* Process the next task in the queue.
|
|
156
|
-
* Tasks are processed in priority order: high > normal > low
|
|
157
|
-
* If WorkerPool is configured, tasks are submitted to the pool for concurrent execution.
|
|
158
|
-
*
|
|
159
|
-
* @internal
|
|
160
|
-
*/
|
|
161
|
-
private processNext;
|
|
162
|
-
/**
|
|
163
|
-
* Dequeue the next task based on priority and partition ordering.
|
|
164
|
-
* Priority order: CRITICAL > HIGH > NORMAL > LOW
|
|
165
|
-
*
|
|
166
|
-
* @returns Next task to process, or undefined if queue is empty
|
|
167
|
-
* @internal
|
|
168
|
-
*/
|
|
169
|
-
private dequeue;
|
|
170
|
-
/**
|
|
171
|
-
* Dequeue a task from a priority queue, respecting partition ordering.
|
|
172
|
-
*
|
|
173
|
-
* @param queue - Priority queue to dequeue from
|
|
174
|
-
* @returns Next task to process, or undefined if all tasks are blocked by partition locks
|
|
175
|
-
* @internal
|
|
176
|
-
*/
|
|
177
|
-
private dequeueFromPriority;
|
|
178
|
-
/**
|
|
179
|
-
* Execute an event task by running all its callbacks.
|
|
180
|
-
* Implements circuit breaker protection, retry logic with exponential backoff, and DLQ integration.
|
|
181
|
-
* Also handles partition ordering by acquiring and releasing partition locks.
|
|
182
|
-
*
|
|
183
|
-
* @param task - Event task to execute
|
|
184
|
-
* @internal
|
|
185
|
-
*/
|
|
186
|
-
private executeTask;
|
|
187
|
-
/**
|
|
188
|
-
* Calculate retry delay based on backoff strategy.
|
|
189
|
-
*
|
|
190
|
-
* @param retryCount - Current retry attempt number
|
|
191
|
-
* @param backoff - Backoff strategy
|
|
192
|
-
* @param initialDelay - Initial delay in ms
|
|
193
|
-
* @param maxDelay - Maximum delay in ms
|
|
194
|
-
* @returns Delay in milliseconds
|
|
195
|
-
* @internal
|
|
196
|
-
*/
|
|
197
|
-
private calculateRetryDelay;
|
|
198
|
-
/**
|
|
199
|
-
* Re-enqueue a task for retry.
|
|
200
|
-
*
|
|
201
|
-
* @param task - Task to retry
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
private enqueueRetry;
|
|
205
|
-
/**
|
|
206
|
-
* Execute a callback with timeout.
|
|
207
|
-
*
|
|
208
|
-
* @param callback - Callback to execute
|
|
209
|
-
* @param args - Arguments to pass to callback
|
|
210
|
-
* @param timeoutMs - Timeout in milliseconds
|
|
211
|
-
* @internal
|
|
212
|
-
*/
|
|
213
|
-
private executeWithTimeout;
|
|
214
|
-
/**
|
|
215
|
-
* Get the current depth of the queue.
|
|
216
|
-
*
|
|
217
|
-
* @returns Total number of tasks in the queue
|
|
218
|
-
*/
|
|
56
|
+
enqueueBatch(tasks: EventTask[]): string[];
|
|
219
57
|
getDepth(): number;
|
|
220
|
-
/**
|
|
221
|
-
* Get the depth of a specific priority queue.
|
|
222
|
-
*
|
|
223
|
-
* @param priority - Priority level
|
|
224
|
-
* @returns Number of tasks in the specified priority queue
|
|
225
|
-
*/
|
|
226
58
|
getDepthByPriority(priority: 'critical' | 'high' | 'normal' | 'low'): number;
|
|
227
|
-
/**
|
|
228
|
-
* Get the BackpressureManager instance if enabled.
|
|
229
|
-
*
|
|
230
|
-
* @returns BackpressureManager instance or undefined if not enabled
|
|
231
|
-
* @internal
|
|
232
|
-
*/
|
|
233
|
-
getBackpressureManager(): BackpressureManager | undefined;
|
|
234
|
-
/**
|
|
235
|
-
* Set the WorkerPool for concurrent task execution.
|
|
236
|
-
*
|
|
237
|
-
* @param pool - WorkerPool instance
|
|
238
|
-
* @internal
|
|
239
|
-
*/
|
|
240
|
-
setWorkerPool(pool: WorkerPool): void;
|
|
241
|
-
/**
|
|
242
|
-
* Get the WorkerPool instance if set.
|
|
243
|
-
*
|
|
244
|
-
* @returns WorkerPool instance or undefined if not set
|
|
245
|
-
* @internal
|
|
246
|
-
*/
|
|
247
|
-
getWorkerPool(): WorkerPool | undefined;
|
|
248
|
-
/**
|
|
249
|
-
* Clear all tasks from the queue.
|
|
250
|
-
*/
|
|
251
|
-
clear(): void;
|
|
252
|
-
/**
|
|
253
|
-
* Get circuit breaker for an event hook.
|
|
254
|
-
*
|
|
255
|
-
* @param hook - Event hook name
|
|
256
|
-
* @returns Circuit breaker instance or undefined
|
|
257
|
-
* @internal
|
|
258
|
-
*/
|
|
259
|
-
getCircuitBreaker(hook: string): CircuitBreaker | undefined;
|
|
260
|
-
/**
|
|
261
|
-
* Get all circuit breakers.
|
|
262
|
-
*
|
|
263
|
-
* @returns Map of circuit breakers keyed by hook name
|
|
264
|
-
* @internal
|
|
265
|
-
*/
|
|
266
|
-
getCircuitBreakers(): Map<string, CircuitBreaker>;
|
|
267
|
-
/**
|
|
268
|
-
* Reset a circuit breaker for an event hook.
|
|
269
|
-
*
|
|
270
|
-
* @param hook - Event hook name
|
|
271
|
-
* @returns True if reset, false if circuit breaker not found
|
|
272
|
-
* @internal
|
|
273
|
-
*/
|
|
274
|
-
resetCircuitBreaker(hook: string): boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Batch enqueue multiple tasks (FS-102).
|
|
277
|
-
* Supports aggregation layer batch submission.
|
|
278
|
-
*
|
|
279
|
-
* @param tasks - Array of tasks to enqueue
|
|
280
|
-
* @returns Array of task IDs
|
|
281
|
-
* @internal
|
|
282
|
-
*/
|
|
283
|
-
enqueueBatch(tasks: EventTask[]): string[];
|
|
284
|
-
/**
|
|
285
|
-
* Get queue depth for each priority level (FS-103).
|
|
286
|
-
* Used by BackpressureManager for multi-priority depth monitoring.
|
|
287
|
-
*
|
|
288
|
-
* @returns Queue depth snapshot with depths for each priority
|
|
289
|
-
* @internal
|
|
290
|
-
*/
|
|
291
59
|
getQueueDepthByPriority(): MultiPriorityQueueDepth;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
* synchronized with real-time queue state.
|
|
296
|
-
*
|
|
297
|
-
* @private
|
|
298
|
-
* @internal
|
|
299
|
-
*/
|
|
300
|
-
private syncBackpressure;
|
|
60
|
+
clear(): void;
|
|
61
|
+
dequeue(): EventTask | undefined;
|
|
62
|
+
private processNext;
|
|
301
63
|
}
|
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
* Event system exports for async event dispatch.
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
|
+
export * from './EventBackend';
|
|
6
|
+
export type { EventOptions } from './EventOptions';
|
|
7
|
+
export { DEFAULT_EVENT_OPTIONS } from './EventOptions';
|
|
8
|
+
export type { BackpressureStrategy, EventQueueConfig, EventTask } from './types';
|
|
5
9
|
export type { BackpressureConfig, BackpressureDecision, BackpressureMetricsSnapshot, } from './BackpressureManager';
|
|
6
10
|
export { BackpressureManager, BackpressureState } from './BackpressureManager';
|
|
7
|
-
export type { CircuitBreakerOptions } from './CircuitBreaker';
|
|
11
|
+
export type { CircuitBreakerMetrics, CircuitBreakerMetricsRecorder, CircuitBreakerOptions, } from './CircuitBreaker';
|
|
8
12
|
export { CircuitBreaker, CircuitBreakerState } from './CircuitBreaker';
|
|
9
|
-
export type { DLQEntry, DLQFilter } from './DeadLetterQueue';
|
|
13
|
+
export type { DLQEntry, DLQEntryCallback, DLQEntrySource, DLQFilter } from './DeadLetterQueue';
|
|
10
14
|
export { DeadLetterQueue } from './DeadLetterQueue';
|
|
11
|
-
export * from './EventBackend';
|
|
12
|
-
export type { EventOptions } from './EventOptions';
|
|
13
|
-
export { DEFAULT_EVENT_OPTIONS } from './EventOptions';
|
|
14
15
|
export { EventPriorityQueue } from './EventPriorityQueue';
|
|
15
|
-
export
|
|
16
|
-
export {
|
|
17
|
-
export type { EventStatus, MessageQueueBridgeConfig } from './MessageQueueBridge';
|
|
16
|
+
export * from './FlowControlStrategy';
|
|
17
|
+
export { IdempotencyCache } from './IdempotencyCache';
|
|
18
18
|
export { MessageQueueBridge } from './MessageQueueBridge';
|
|
19
|
-
export
|
|
20
|
-
export
|
|
19
|
+
export type { PriorityStatistics } from './PriorityEscalationManager';
|
|
20
|
+
export { PriorityEscalationManager } from './PriorityEscalationManager';
|
|
21
|
+
export type { RetrySchedulerConfig } from './RetryScheduler';
|
|
21
22
|
export { RetryScheduler } from './RetryScheduler';
|
|
22
|
-
export type {
|
|
23
|
+
export type { DeadLetterDecision, MultiPriorityQueueDepth, WindowAdjustment } from './types';
|
|
23
24
|
export { WorkerPool } from './WorkerPool';
|
|
24
25
|
export type { WorkerPoolConfig, WorkerPoolStats, WorkerStats } from './WorkerPoolConfig';
|
|
25
26
|
export { WorkerPoolMetrics } from './WorkerPoolMetrics';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { BackpressureManager } from './BackpressureManager';
|
|
2
|
+
import type { DeadLetterQueue } from './DeadLetterQueue';
|
|
3
|
+
import type { OTelEventMetrics } from './observability/OTelEventMetrics';
|
|
4
|
+
import { type PriorityStatistics } from './PriorityEscalationManager';
|
|
5
|
+
import type { BackpressureStrategy, EventQueueConfig, EventTask, MultiPriorityQueueDepth } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Result of an enqueue operation.
|
|
8
|
+
*
|
|
9
|
+
* - `{ status: 'queued', id }` - Task successfully queued
|
|
10
|
+
* - `{ status: 'dropped' }` - Task dropped due to backpressure
|
|
11
|
+
* - `{ status: 'delayed', id, delayMs }` - Task should be re-enqueued after delayMs
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export type EnqueueResult = {
|
|
16
|
+
status: 'queued';
|
|
17
|
+
id: string;
|
|
18
|
+
} | {
|
|
19
|
+
status: 'dropped';
|
|
20
|
+
} | {
|
|
21
|
+
status: 'delayed';
|
|
22
|
+
id: string;
|
|
23
|
+
delayMs: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Priority queue core: manages event task queues and backpressure.
|
|
27
|
+
*
|
|
28
|
+
* Handles enqueueing, dequeuing, backpressure logic, and priority escalation.
|
|
29
|
+
* This class is used internally by EventPriorityQueue as a composition target.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare class QueueCore {
|
|
34
|
+
criticalPriority: EventTask[];
|
|
35
|
+
highPriority: EventTask[];
|
|
36
|
+
normalPriority: EventTask[];
|
|
37
|
+
lowPriority: EventTask[];
|
|
38
|
+
processingPartitions: Set<string>;
|
|
39
|
+
private taskIdCounter;
|
|
40
|
+
private dlq?;
|
|
41
|
+
private otelEventMetrics?;
|
|
42
|
+
private backpressureManager?;
|
|
43
|
+
private priorityStats?;
|
|
44
|
+
private config;
|
|
45
|
+
constructor(config?: EventQueueConfig);
|
|
46
|
+
setDeadLetterQueue(dlq: DeadLetterQueue): void;
|
|
47
|
+
setOTelEventMetrics(metrics: OTelEventMetrics): void;
|
|
48
|
+
setPriorityStatistics(stats: PriorityStatistics): void;
|
|
49
|
+
getPriorityStatistics(): PriorityStatistics | undefined;
|
|
50
|
+
getBackpressureManager(): BackpressureManager | undefined;
|
|
51
|
+
getConfig(): EventQueueConfig;
|
|
52
|
+
getDLQ(): DeadLetterQueue | undefined;
|
|
53
|
+
createTaskId(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Enqueue a task into the appropriate priority queue.
|
|
56
|
+
* Applies priority escalation and backpressure logic.
|
|
57
|
+
*/
|
|
58
|
+
enqueue(task: EventTask): EnqueueResult;
|
|
59
|
+
/**
|
|
60
|
+
* Dequeue the next task based on priority and partition ordering.
|
|
61
|
+
* Priority order: CRITICAL > HIGH > NORMAL > LOW
|
|
62
|
+
*/
|
|
63
|
+
dequeue(): EventTask | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Re-enqueue a task for retry.
|
|
66
|
+
*/
|
|
67
|
+
enqueueRetry(task: EventTask): void;
|
|
68
|
+
getDepth(): number;
|
|
69
|
+
getDepthByPriority(priority: 'critical' | 'high' | 'normal' | 'low'): number;
|
|
70
|
+
getQueueDepthByPriority(): MultiPriorityQueueDepth;
|
|
71
|
+
clear(): void;
|
|
72
|
+
syncBackpressure(): void;
|
|
73
|
+
private handleBackpressure;
|
|
74
|
+
private dropOldest;
|
|
75
|
+
private dequeueFromPriority;
|
|
76
|
+
}
|
|
77
|
+
export type { BackpressureStrategy, EventQueueConfig, EventTask };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import { CircuitBreaker } from './CircuitBreaker';
|
|
3
|
+
import type { DeadLetterQueue } from './DeadLetterQueue';
|
|
4
|
+
import type { EventOptions } from './EventOptions';
|
|
5
|
+
import type { EventMetrics } from './observability/EventMetrics';
|
|
6
|
+
import type { EventTracing } from './observability/EventTracing';
|
|
7
|
+
import type { OTelEventMetrics } from './observability/OTelEventMetrics';
|
|
8
|
+
import type { RetryScheduler } from './RetryScheduler';
|
|
9
|
+
import type { EventTask } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Executes event tasks with circuit breaker protection, retry logic,
|
|
12
|
+
* exponential backoff, DLQ integration, and distributed tracing.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare class TaskExecutor {
|
|
17
|
+
private eventCircuitBreakers;
|
|
18
|
+
private eventMetrics?;
|
|
19
|
+
private otelEventMetrics?;
|
|
20
|
+
private eventTracing?;
|
|
21
|
+
private currentDispatchSpan?;
|
|
22
|
+
private retryScheduler?;
|
|
23
|
+
private dlq?;
|
|
24
|
+
private persistentDLQHandler?;
|
|
25
|
+
private enqueueRetryFn?;
|
|
26
|
+
setDeadLetterQueue(dlq: DeadLetterQueue): void;
|
|
27
|
+
setPersistentDLQHandler(handler: (hook: string, args: unknown, options: EventOptions, error: Error, retryCount: number, firstFailedAt: number) => Promise<void>): void;
|
|
28
|
+
setEventMetrics(metrics: EventMetrics): void;
|
|
29
|
+
setOTelEventMetrics(metrics: OTelEventMetrics): void;
|
|
30
|
+
setEventTracing(tracing: EventTracing): void;
|
|
31
|
+
setCurrentDispatchSpan(span: Span | undefined): void;
|
|
32
|
+
getCurrentDispatchSpan(): Span | undefined;
|
|
33
|
+
setRetryScheduler(scheduler: RetryScheduler): void;
|
|
34
|
+
getRetryScheduler(): RetryScheduler | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Set the callback to use when re-enqueueing a task after a retry delay.
|
|
37
|
+
*/
|
|
38
|
+
setEnqueueRetryFn(fn: (task: EventTask) => void): void;
|
|
39
|
+
getCircuitBreaker(hook: string): CircuitBreaker | undefined;
|
|
40
|
+
getCircuitBreakers(): Map<string, CircuitBreaker>;
|
|
41
|
+
resetCircuitBreaker(hook: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Execute an event task by running all its callbacks.
|
|
44
|
+
* Implements circuit breaker protection, retry logic, and DLQ integration.
|
|
45
|
+
*/
|
|
46
|
+
executeTask(task: EventTask, processingPartitions: Set<string>): Promise<void>;
|
|
47
|
+
private sendToDLQ;
|
|
48
|
+
private getOrCreateEventCircuitBreaker;
|
|
49
|
+
private calculateRetryDelay;
|
|
50
|
+
private executeWithTimeout;
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ExceptionOptions } from './GravitoException';
|
|
2
|
+
import { DomainException } from './DomainException';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for authentication/authorization-related domain errors.
|
|
5
|
+
* Used by fortify and sentinel packages.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class AuthException extends DomainException {
|
|
9
|
+
constructor(status: number, code: string, options?: ExceptionOptions);
|
|
10
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainException } from './DomainException';
|
|
2
2
|
/**
|
|
3
3
|
* Exception thrown when authentication fails.
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export declare class AuthenticationException extends
|
|
6
|
+
export declare class AuthenticationException extends DomainException {
|
|
7
7
|
constructor(message?: string);
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainException } from './DomainException';
|
|
2
2
|
/**
|
|
3
3
|
* Exception thrown when user is not authorized to perform an action.
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export declare class AuthorizationException extends
|
|
6
|
+
export declare class AuthorizationException extends DomainException {
|
|
7
7
|
constructor(message?: string);
|
|
8
8
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InfrastructureException, type InfrastructureExceptionOptions } from './InfrastructureException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for cache/Redis-related infrastructure errors.
|
|
4
|
+
* All plasma error classes extend this instead of bare Error.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class CacheException extends InfrastructureException {
|
|
8
|
+
constructor(status: number, code: string, options?: InfrastructureExceptionOptions);
|
|
9
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ServiceKey } from '../Container';
|
|
2
|
+
import { SystemException } from './SystemException';
|
|
2
3
|
/**
|
|
3
4
|
* CircularDependencyException - Thrown when the container detects an infinite loop.
|
|
4
5
|
*
|
|
5
6
|
* @module @gravito/core
|
|
6
7
|
*/
|
|
7
|
-
export declare class CircularDependencyException extends
|
|
8
|
+
export declare class CircularDependencyException extends SystemException {
|
|
8
9
|
constructor(key: ServiceKey, stack: ServiceKey[]);
|
|
9
10
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ExceptionOptions } from './GravitoException';
|
|
2
|
+
import { SystemException } from './SystemException';
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when the framework encounters an invalid or missing configuration value.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConfigurationException extends SystemException {
|
|
8
|
+
constructor(message: string, options?: Omit<ExceptionOptions, 'message'>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InfrastructureException, type InfrastructureExceptionOptions } from './InfrastructureException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for database-related infrastructure errors.
|
|
4
|
+
* All atlas error classes extend this instead of bare Error.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class DatabaseException extends InfrastructureException {
|
|
8
|
+
constructor(status: number, code: string, options?: InfrastructureExceptionOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ExceptionOptions, GravitoException } from './GravitoException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for business logic / domain rule violations.
|
|
4
|
+
* Extend this for exceptions that represent a caller mistake (invalid input, constraint violation, etc.).
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class DomainException extends GravitoException {
|
|
8
|
+
constructor(status: number, code: string, options?: ExceptionOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ExceptionOptions, GravitoException } from './GravitoException';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating an InfrastructureException
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface InfrastructureExceptionOptions extends ExceptionOptions {
|
|
7
|
+
retryable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for infrastructure / I/O errors (database, network, filesystem, etc.).
|
|
11
|
+
* Carries a `retryable` flag that callers can inspect to decide whether the operation should be retried.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class InfrastructureException extends GravitoException {
|
|
15
|
+
readonly retryable: boolean;
|
|
16
|
+
constructor(status: number, code: string, options?: InfrastructureExceptionOptions);
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InfrastructureException, type InfrastructureExceptionOptions } from './InfrastructureException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for message queue infrastructure errors.
|
|
4
|
+
* Used by quasar and flux packages.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class QueueException extends InfrastructureException {
|
|
8
|
+
constructor(status: number, code: string, options?: InfrastructureExceptionOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InfrastructureException, type InfrastructureExceptionOptions } from './InfrastructureException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for file/object storage infrastructure errors.
|
|
4
|
+
* Used by constellation, nebula, nebula-s3, freeze, stasis packages.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class StorageException extends InfrastructureException {
|
|
8
|
+
constructor(status: number, code: string, options?: InfrastructureExceptionOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InfrastructureException, type InfrastructureExceptionOptions } from './InfrastructureException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for stream/message processing infrastructure errors.
|
|
4
|
+
* Used by the stream package (Kafka, RabbitMQ, SQS).
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class StreamException extends InfrastructureException {
|
|
8
|
+
constructor(status: number, code: string, options?: InfrastructureExceptionOptions);
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ExceptionOptions, GravitoException } from './GravitoException';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for internal framework / system-level errors.
|
|
4
|
+
* Extend this for exceptions that represent an unexpected or unrecoverable framework state.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class SystemException extends GravitoException {
|
|
8
|
+
constructor(status: number, code: string, options?: ExceptionOptions);
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainException } from './DomainException';
|
|
2
2
|
/**
|
|
3
3
|
* Structure of a validation error
|
|
4
4
|
* @public
|
|
@@ -12,7 +12,7 @@ export interface ValidationError {
|
|
|
12
12
|
* Exception thrown when data validation fails.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare class ValidationException extends
|
|
15
|
+
export declare class ValidationException extends DomainException {
|
|
16
16
|
readonly errors: ValidationError[];
|
|
17
17
|
redirectTo?: string;
|
|
18
18
|
input?: unknown;
|