@gravito/ripple 4.0.3 → 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/dist/core/src/PlanetCore.d.ts +6 -0
- package/dist/core/src/events/CircuitBreaker.d.ts +12 -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/errors/RippleError.d.ts +23 -5
- package/package.json +2 -2
|
@@ -183,6 +183,12 @@ export declare class PlanetCore {
|
|
|
183
183
|
private deferredProviders;
|
|
184
184
|
private bootedProviders;
|
|
185
185
|
private isShuttingDown;
|
|
186
|
+
/**
|
|
187
|
+
* Global shutdown timeout in milliseconds (D-10).
|
|
188
|
+
* If the entire shutdown sequence does not complete within this limit,
|
|
189
|
+
* a warning is logged and shutdown is force-completed so the process can exit.
|
|
190
|
+
*/
|
|
191
|
+
private static readonly GLOBAL_SHUTDOWN_TIMEOUT;
|
|
186
192
|
/**
|
|
187
193
|
* Initialize observability asynchronously (metrics, tracing, Prometheus).
|
|
188
194
|
* This is called from constructor but doesn't block initialization.
|
|
@@ -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
|
|
@@ -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;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
export * from './AuthenticationException';
|
|
2
|
+
export * from './AuthException';
|
|
2
3
|
export * from './AuthorizationException';
|
|
4
|
+
export * from './CacheException';
|
|
3
5
|
export * from './CircularDependencyException';
|
|
6
|
+
export * from './ConfigurationException';
|
|
7
|
+
export * from './DatabaseException';
|
|
8
|
+
export * from './DomainException';
|
|
4
9
|
export * from './GravitoException';
|
|
5
10
|
export * from './HttpException';
|
|
11
|
+
export * from './InfrastructureException';
|
|
6
12
|
export * from './ModelNotFoundException';
|
|
13
|
+
export * from './QueueException';
|
|
14
|
+
export * from './StorageException';
|
|
15
|
+
export * from './StreamException';
|
|
16
|
+
export * from './SystemException';
|
|
7
17
|
export * from './ValidationException';
|
|
@@ -3,25 +3,42 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @gravito/ripple/errors
|
|
5
5
|
*/
|
|
6
|
+
import { InfrastructureException, type InfrastructureExceptionOptions } from '@gravito/core';
|
|
7
|
+
/**
|
|
8
|
+
* Error codes for Ripple module operations.
|
|
9
|
+
* Follows dot-separated namespace convention.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RippleErrorCodes: {
|
|
12
|
+
readonly CONNECTION_FAILED: "ripple.connection_failed";
|
|
13
|
+
readonly QUERY_FAILED: "ripple.query_failed";
|
|
14
|
+
readonly DRIVER_ERROR: "ripple.driver_error";
|
|
15
|
+
readonly UNSUPPORTED_RUNTIME: "ripple.unsupported_runtime";
|
|
16
|
+
readonly NOT_INITIALIZED: "ripple.not_initialized";
|
|
17
|
+
readonly INVALID_OPERATION: "ripple.invalid_operation";
|
|
18
|
+
readonly SERIALIZATION_FAILED: "ripple.serialization_failed";
|
|
19
|
+
readonly MIDDLEWARE_ERROR: "ripple.middleware_error";
|
|
20
|
+
};
|
|
21
|
+
export type RippleErrorCode = (typeof RippleErrorCodes)[keyof typeof RippleErrorCodes];
|
|
6
22
|
/**
|
|
7
23
|
* Base error class for Ripple module.
|
|
8
24
|
*
|
|
9
25
|
* Provides structured error handling with error codes and messages.
|
|
26
|
+
* Extends InfrastructureException for unified error handling across Gravito.
|
|
10
27
|
*
|
|
11
28
|
* @example
|
|
12
29
|
* ```typescript
|
|
13
|
-
* throw new RippleError('
|
|
30
|
+
* throw new RippleError('ripple.invalid_format', 'Invalid message format')
|
|
14
31
|
* ```
|
|
15
32
|
*/
|
|
16
|
-
export declare class RippleError extends
|
|
17
|
-
readonly code: string;
|
|
33
|
+
export declare class RippleError extends InfrastructureException {
|
|
18
34
|
/**
|
|
19
35
|
* Creates a new RippleError instance.
|
|
20
36
|
*
|
|
21
37
|
* @param code - The error code.
|
|
22
38
|
* @param message - The error message.
|
|
39
|
+
* @param options - Optional infrastructure exception options.
|
|
23
40
|
*/
|
|
24
|
-
constructor(code: string, message: string);
|
|
41
|
+
constructor(code: string, message: string, options?: InfrastructureExceptionOptions);
|
|
25
42
|
}
|
|
26
43
|
/**
|
|
27
44
|
* Error class for driver-related issues.
|
|
@@ -43,6 +60,7 @@ export declare class RippleDriverError extends RippleError {
|
|
|
43
60
|
*
|
|
44
61
|
* @param code - The error code.
|
|
45
62
|
* @param message - The error message.
|
|
63
|
+
* @param options - Optional infrastructure exception options.
|
|
46
64
|
*/
|
|
47
|
-
constructor(code: string, message: string);
|
|
65
|
+
constructor(code: string, message: string, options?: InfrastructureExceptionOptions);
|
|
48
66
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/ripple",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"description": "Bun-native WebSocket broadcasting for Gravito. Channel-based real-time communication.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/gravito-framework/gravito#readme",
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@gravito/core": "^
|
|
49
|
+
"@gravito/core": "^3.0.0",
|
|
50
50
|
"ioredis": "^5.0.0",
|
|
51
51
|
"nats": "^2.23.0",
|
|
52
52
|
"protobufjs": "^8.0.0",
|