@gravito/ripple 4.0.0 → 4.0.3
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 -2
- package/dist/core/src/Application.d.ts +41 -0
- package/dist/core/src/ConfigManager.d.ts +39 -0
- package/dist/core/src/Container/RequestScopeManager.d.ts +62 -0
- package/dist/core/src/Container/RequestScopeMetrics.d.ts +144 -0
- package/dist/core/src/Container.d.ts +45 -0
- package/dist/core/src/ErrorHandler.d.ts +3 -0
- package/dist/core/src/HookManager.d.ts +104 -165
- package/dist/core/src/PlanetCore.d.ts +114 -1
- package/dist/core/src/RequestContext.d.ts +97 -0
- package/dist/core/src/Router.d.ts +32 -46
- package/dist/core/src/ServiceProvider.d.ts +22 -0
- package/dist/core/src/adapters/bun/BunContext.d.ts +10 -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/cli/queue-commands.d.ts +6 -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 +16 -1
- package/dist/core/src/engine/FastContext.d.ts +42 -1
- package/dist/core/src/engine/Gravito.d.ts +13 -19
- package/dist/core/src/engine/MinimalContext.d.ts +23 -0
- package/dist/core/src/engine/analyzer.d.ts +92 -6
- package/dist/core/src/engine/types.d.ts +6 -0
- package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +126 -0
- package/dist/core/src/events/BackpressureManager.d.ts +215 -0
- package/dist/core/src/events/DeadLetterQueue.d.ts +75 -1
- package/dist/core/src/events/EventBackend.d.ts +2 -1
- package/dist/core/src/events/EventOptions.d.ts +99 -4
- package/dist/core/src/events/EventPriorityQueue.d.ts +36 -175
- package/dist/core/src/events/FlowControlStrategy.d.ts +109 -0
- package/dist/core/src/events/MessageQueueBridge.d.ts +184 -0
- package/dist/core/src/events/PriorityEscalationManager.d.ts +82 -0
- package/dist/core/src/events/RetryScheduler.d.ts +104 -0
- package/dist/core/src/events/WorkerPool.d.ts +98 -0
- package/dist/core/src/events/WorkerPoolConfig.d.ts +153 -0
- package/dist/core/src/events/WorkerPoolMetrics.d.ts +65 -0
- package/dist/core/src/events/aggregation/AggregationWindow.d.ts +77 -0
- package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +135 -0
- package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +108 -0
- package/dist/core/src/events/aggregation/EventBatcher.d.ts +99 -0
- package/dist/core/src/events/aggregation/types.d.ts +117 -0
- package/dist/core/src/events/index.d.ts +18 -6
- package/dist/core/src/events/observability/OTelEventMetrics.d.ts +92 -0
- package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +76 -0
- package/dist/core/src/events/observability/index.d.ts +4 -0
- 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/events/types.d.ts +59 -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/health/HealthProvider.d.ts +67 -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 +43 -3
- package/dist/core/src/index.d.ts +504 -15
- package/dist/core/src/observability/QueueDashboard.d.ts +136 -0
- package/dist/core/src/observability/contracts.d.ts +137 -0
- package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +36 -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/engines/UWebSocketsEngine.d.ts +97 -0
- package/dist/engines/WsEngine.d.ts +69 -0
- package/dist/{ripple/src/engines → engines}/index.d.ts +4 -0
- package/dist/index.js +1 -7139
- package/dist/index.js.map +3 -69
- package/dist/{ripple/src/serializers → serializers}/ISerializer.d.ts +1 -1
- package/dist/{ripple/src/serializers → serializers}/JsonSerializer.d.ts +1 -1
- package/dist/{ripple/src/serializers → serializers}/ProtobufSerializer.d.ts +6 -3
- package/dist/{ripple/src/types.d.ts → types.d.ts} +11 -0
- package/package.json +7 -2
- package/dist/atlas/src/DB.d.ts +0 -301
- 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 -48
- package/dist/atlas/src/connection/Connection.d.ts +0 -108
- package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -111
- 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 -66
- package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -83
- 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 -67
- 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 -11
- 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/index.d.ts +0 -5
- package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
- package/dist/atlas/src/orm/model/Model.d.ts +0 -449
- package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
- package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -136
- package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
- package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -87
- 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 -109
- 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 -123
- 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/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 -573
- 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/Schema.d.ts +0 -131
- 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/types/index.d.ts +0 -1100
- package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
- package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -171
- 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/photon/src/index.d.ts +0 -84
- 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.d.ts +0 -157
- package/dist/photon/src/openapi.d.ts +0 -19
- /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/errors → errors}/RippleError.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}/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/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
|
@@ -55,6 +55,33 @@ export interface RouteOptions {
|
|
|
55
55
|
/** Middleware stack for the route */
|
|
56
56
|
middleware?: GravitoMiddleware[];
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Common routing handler argument definition
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export type RouteDefinitionArg = FormRequestClass | RouteHandler | GravitoMiddleware | GravitoMiddleware[];
|
|
63
|
+
/**
|
|
64
|
+
* Interface merging for HTTP routing methods to establish overloads
|
|
65
|
+
* without duplicate bodies.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export interface RoutingMethods {
|
|
69
|
+
get(path: string, handler: RouteHandler): Route;
|
|
70
|
+
get(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
71
|
+
get(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
72
|
+
post(path: string, handler: RouteHandler): Route;
|
|
73
|
+
post(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
74
|
+
post(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
75
|
+
put(path: string, handler: RouteHandler): Route;
|
|
76
|
+
put(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
77
|
+
put(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
78
|
+
delete(path: string, handler: RouteHandler): Route;
|
|
79
|
+
delete(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
80
|
+
delete(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
81
|
+
patch(path: string, handler: RouteHandler): Route;
|
|
82
|
+
patch(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
83
|
+
patch(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
84
|
+
}
|
|
58
85
|
/**
|
|
59
86
|
* RouteGroup
|
|
60
87
|
* Helper class for chained route configuration (prefix, domain, etc.)
|
|
@@ -64,6 +91,8 @@ export interface RouteOptions {
|
|
|
64
91
|
* Helper class for chained route configuration (prefix, domain, etc.)
|
|
65
92
|
* @public
|
|
66
93
|
*/
|
|
94
|
+
export interface RouteGroup extends RoutingMethods {
|
|
95
|
+
}
|
|
67
96
|
export declare class RouteGroup {
|
|
68
97
|
private router;
|
|
69
98
|
private options;
|
|
@@ -81,21 +110,6 @@ export declare class RouteGroup {
|
|
|
81
110
|
* Define routes within this group
|
|
82
111
|
*/
|
|
83
112
|
group(callback: (router: Router | RouteGroup) => void): void;
|
|
84
|
-
get(path: string, handler: RouteHandler): Route;
|
|
85
|
-
get(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
86
|
-
get(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
87
|
-
post(path: string, handler: RouteHandler): Route;
|
|
88
|
-
post(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
89
|
-
post(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
90
|
-
put(path: string, handler: RouteHandler): Route;
|
|
91
|
-
put(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
92
|
-
put(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
93
|
-
delete(path: string, handler: RouteHandler): Route;
|
|
94
|
-
delete(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
95
|
-
delete(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
96
|
-
patch(path: string, handler: RouteHandler): Route;
|
|
97
|
-
patch(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
98
|
-
patch(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
99
113
|
resource(name: string, controller: ControllerClass, options?: ResourceOptions): void;
|
|
100
114
|
/**
|
|
101
115
|
* Register a route that forwards requests to another URL (Gateway Proxy).
|
|
@@ -118,6 +132,8 @@ export declare class RouteGroup {
|
|
|
118
132
|
* - FormRequest validation: router.post('/users', StoreUserRequest, [UserController, 'store'])
|
|
119
133
|
* - Inline Middleware: router.get('/users', authMiddleware, [UserController, 'index'])
|
|
120
134
|
*/
|
|
135
|
+
export interface Router extends RoutingMethods {
|
|
136
|
+
}
|
|
121
137
|
export declare class Router {
|
|
122
138
|
private core;
|
|
123
139
|
routes: Array<{
|
|
@@ -210,36 +226,6 @@ export declare class Router {
|
|
|
210
226
|
* Accepts individual handlers or arrays of handlers.
|
|
211
227
|
*/
|
|
212
228
|
middleware(...handlers: (GravitoMiddleware | GravitoMiddleware[])[]): RouteGroup;
|
|
213
|
-
/**
|
|
214
|
-
* Register a GET route.
|
|
215
|
-
*/
|
|
216
|
-
get(path: string, handler: RouteHandler): Route;
|
|
217
|
-
get(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
218
|
-
get(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
219
|
-
/**
|
|
220
|
-
* Register a POST route.
|
|
221
|
-
*/
|
|
222
|
-
post(path: string, handler: RouteHandler): Route;
|
|
223
|
-
post(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
224
|
-
post(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
225
|
-
/**
|
|
226
|
-
* Register a PUT route.
|
|
227
|
-
*/
|
|
228
|
-
put(path: string, handler: RouteHandler): Route;
|
|
229
|
-
put(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
230
|
-
put(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
231
|
-
/**
|
|
232
|
-
* Register a DELETE route.
|
|
233
|
-
*/
|
|
234
|
-
delete(path: string, handler: RouteHandler): Route;
|
|
235
|
-
delete(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
236
|
-
delete(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
237
|
-
/**
|
|
238
|
-
* Register a PATCH route.
|
|
239
|
-
*/
|
|
240
|
-
patch(path: string, handler: RouteHandler): Route;
|
|
241
|
-
patch(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
242
|
-
patch(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
243
229
|
/**
|
|
244
230
|
* Register a route that forwards requests to another URL (Gateway Proxy).
|
|
245
231
|
* @param method - HTTP method or 'all'
|
|
@@ -267,7 +253,7 @@ export declare class Router {
|
|
|
267
253
|
/**
|
|
268
254
|
* Internal Request Registration
|
|
269
255
|
*/
|
|
270
|
-
req(method: HttpMethod, path: string, requestOrHandlerOrMiddleware:
|
|
256
|
+
req(method: HttpMethod, path: string, requestOrHandlerOrMiddleware: RouteDefinitionArg, handler?: RouteHandler, options?: RouteOptions): Route;
|
|
271
257
|
}
|
|
272
258
|
/**
|
|
273
259
|
* Standard RESTful resource action names.
|
|
@@ -74,6 +74,28 @@ export declare abstract class ServiceProvider {
|
|
|
74
74
|
* @param core - The PlanetCore application instance
|
|
75
75
|
*/
|
|
76
76
|
boot?(core: PlanetCore): void | Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Called when the application is ready to accept requests.
|
|
79
|
+
*
|
|
80
|
+
* This method is called after ALL providers have booted.
|
|
81
|
+
* Use this for final initialization before the server starts accepting traffic.
|
|
82
|
+
*
|
|
83
|
+
* @param core - The PlanetCore application instance
|
|
84
|
+
* @since 2.2.0
|
|
85
|
+
*/
|
|
86
|
+
onReady?(core: PlanetCore): void | Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Called when the application is shutting down.
|
|
89
|
+
*
|
|
90
|
+
* This method is called during graceful shutdown.
|
|
91
|
+
* Use this to clean up resources, close connections, etc.
|
|
92
|
+
*
|
|
93
|
+
* Providers are called in reverse order (LIFO).
|
|
94
|
+
*
|
|
95
|
+
* @param core - The PlanetCore application instance
|
|
96
|
+
* @since 2.2.0
|
|
97
|
+
*/
|
|
98
|
+
onShutdown?(core: PlanetCore): void | Promise<void>;
|
|
77
99
|
/**
|
|
78
100
|
* Set the core instance reference.
|
|
79
101
|
* Called internally by the application during registration.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RequestScopeManager } from '../../Container/RequestScopeManager';
|
|
1
2
|
import type { ContentfulStatusCode, GravitoContext, GravitoVariables, ProxyOptions, StatusCode } from '../../http/types';
|
|
2
3
|
import { BunRequest } from './BunRequest';
|
|
3
4
|
/**
|
|
@@ -6,8 +7,9 @@ import { BunRequest } from './BunRequest';
|
|
|
6
7
|
*/
|
|
7
8
|
export declare class BunContext<V extends GravitoVariables = GravitoVariables> implements GravitoContext<V> {
|
|
8
9
|
readonly env: Record<string, unknown>;
|
|
9
|
-
|
|
10
|
+
req: BunRequest;
|
|
10
11
|
private _variables;
|
|
12
|
+
private _requestScope;
|
|
11
13
|
/**
|
|
12
14
|
* URL generator helper
|
|
13
15
|
*/
|
|
@@ -38,8 +40,15 @@ export declare class BunContext<V extends GravitoVariables = GravitoVariables> i
|
|
|
38
40
|
append?: boolean;
|
|
39
41
|
}): void;
|
|
40
42
|
header(name: string): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Reset context state for reuse in pooling scenarios
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
reset(request: Request): void;
|
|
41
48
|
status(code: StatusCode): void;
|
|
42
49
|
get<K extends keyof V>(key: K): V[K];
|
|
43
50
|
set<K extends keyof V>(key: K, value: V[K]): void;
|
|
44
51
|
get executionCtx(): ExecutionContext | undefined;
|
|
52
|
+
requestScope(): RequestScopeManager;
|
|
53
|
+
scoped<T>(key: string | symbol, factory: () => T): T;
|
|
45
54
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GravitoContext, GravitoErrorHandler, GravitoHandler, GravitoMiddleware, GravitoNotFoundHandler, HttpMethod } from '../../http/types';
|
|
2
2
|
import type { HttpAdapter, RouteDefinition } from '../types';
|
|
3
|
+
import type { WebSocketRouteHandlers } from './BunWebSocketHandler';
|
|
3
4
|
/**
|
|
4
5
|
* Native Bun-optimized HTTP Adapter for Gravito.
|
|
5
6
|
* Uses Bun's standard Request/Response classes and efficient router.
|
|
@@ -13,15 +14,49 @@ export declare class BunNativeAdapter implements HttpAdapter {
|
|
|
13
14
|
private middlewares;
|
|
14
15
|
private errorHandler;
|
|
15
16
|
private notFoundHandler;
|
|
17
|
+
private contextPool;
|
|
18
|
+
private readonly maxPoolSize;
|
|
19
|
+
private middlewareChainCache;
|
|
20
|
+
private wsHandler;
|
|
16
21
|
route(method: HttpMethod, path: string, ...handlers: (GravitoHandler | GravitoMiddleware)[]): void;
|
|
17
22
|
routes(routes: RouteDefinition[]): void;
|
|
18
23
|
use(path: string, ...middleware: GravitoMiddleware[]): void;
|
|
19
24
|
useGlobal(...middleware: GravitoMiddleware[]): void;
|
|
20
25
|
useScoped(scope: string, path: string, ...middleware: GravitoMiddleware[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* P1 Fix: Accurate path pattern matching for middleware
|
|
28
|
+
* Handles wildcards: *, /api/*, /api
|
|
29
|
+
*/
|
|
30
|
+
private matchesPath;
|
|
31
|
+
/**
|
|
32
|
+
* P2 optimization: Pre-compile middleware chain for a path
|
|
33
|
+
*/
|
|
34
|
+
private getCompiledMiddlewareChain;
|
|
35
|
+
/**
|
|
36
|
+
* P0 Fix: Context object pooling to prevent state pollution
|
|
37
|
+
*/
|
|
38
|
+
private acquireContext;
|
|
39
|
+
/**
|
|
40
|
+
* P0 Fix: Release context back to pool
|
|
41
|
+
*/
|
|
42
|
+
private releaseContext;
|
|
21
43
|
mount(path: string, subAdapter: HttpAdapter): void;
|
|
22
44
|
createContext(request: Request): GravitoContext;
|
|
23
45
|
onError(handler: GravitoErrorHandler): void;
|
|
24
46
|
onNotFound(handler: GravitoNotFoundHandler): void;
|
|
47
|
+
/**
|
|
48
|
+
* 註冊 WebSocket 路由
|
|
49
|
+
*/
|
|
50
|
+
registerWebSocketRoute(path: string, handlers: WebSocketRouteHandlers): void;
|
|
51
|
+
/**
|
|
52
|
+
* 取得 WebSocket handler(供 Bun.serve 使用)
|
|
53
|
+
*/
|
|
54
|
+
get websocket(): {
|
|
55
|
+
open?: (ws: unknown) => void | Promise<void>;
|
|
56
|
+
message?: (ws: unknown, data: string | Buffer | Uint8Array) => void | Promise<void>;
|
|
57
|
+
close?: (ws: unknown, code: number, reason: string) => void | Promise<void>;
|
|
58
|
+
drain?: (ws: unknown) => void | Promise<void>;
|
|
59
|
+
} | undefined;
|
|
25
60
|
/**
|
|
26
61
|
* Predictive Route Warming (JIT Optimization)
|
|
27
62
|
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket 路由管理器
|
|
3
|
+
*
|
|
4
|
+
* 負責註冊和分發 WebSocket 事件到相應的路由處理器
|
|
5
|
+
*/
|
|
6
|
+
export interface WebSocketRouteHandlers {
|
|
7
|
+
open?: (ws: unknown) => void | Promise<void>;
|
|
8
|
+
message?: (ws: unknown, data: string | Buffer | Uint8Array) => void | Promise<void>;
|
|
9
|
+
close?: (ws: unknown, code: number, reason: string) => void | Promise<void>;
|
|
10
|
+
drain?: (ws: unknown) => void | Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class BunWebSocketHandler {
|
|
13
|
+
private routes;
|
|
14
|
+
/**
|
|
15
|
+
* 註冊 WebSocket 路由
|
|
16
|
+
*/
|
|
17
|
+
register(path: string, handlers: WebSocketRouteHandlers): void;
|
|
18
|
+
/**
|
|
19
|
+
* 檢查是否有該路由
|
|
20
|
+
* 支援精確匹配和 wildcard 匹配
|
|
21
|
+
*/
|
|
22
|
+
hasRoute(path: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 檢查是否有任何已註冊的路由
|
|
25
|
+
*/
|
|
26
|
+
hasAnyRoute(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 將 handlers 轉換為 Bun.serve websocket config
|
|
29
|
+
*/
|
|
30
|
+
toHandler(): {
|
|
31
|
+
open?: (ws: unknown) => void | Promise<void>;
|
|
32
|
+
message?: (ws: unknown, data: string | Buffer | Uint8Array) => void | Promise<void>;
|
|
33
|
+
close?: (ws: unknown, code: number, reason: string) => void | Promise<void>;
|
|
34
|
+
drain?: (ws: unknown) => void | Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 尋找符合路徑的 handler
|
|
38
|
+
* 優先精確匹配,再 wildcard 匹配
|
|
39
|
+
*/
|
|
40
|
+
private findHandler;
|
|
41
|
+
/**
|
|
42
|
+
* 路徑匹配邏輯
|
|
43
|
+
* 支援:
|
|
44
|
+
* - 精確匹配:/chat
|
|
45
|
+
* - Wildcard:/api/*, /api*
|
|
46
|
+
*/
|
|
47
|
+
private matchesPath;
|
|
48
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BinaryUtils - 統一的二進制轉換工具類
|
|
3
|
+
*
|
|
4
|
+
* 支援 Bun 原生 API 優化,並提供 Node.js 回退路徑。
|
|
5
|
+
* 設計為 isomorphic,可在 Bun 和 Node.js 環境中運行。
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* BinaryUtils - 提供統一的二進制轉換、編碼、壓縮工具
|
|
10
|
+
* 所有方法均為靜態方法,可直接呼叫
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare class BinaryUtils {
|
|
14
|
+
/**
|
|
15
|
+
* 將各種資料類型轉換為 Uint8Array
|
|
16
|
+
* @param data - 輸入資料(Blob、Buffer、string、ArrayBuffer 或 Uint8Array)
|
|
17
|
+
* @returns Uint8Array
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
static toUint8Array(data: Blob | Buffer | string | ArrayBuffer | Uint8Array): Promise<Uint8Array>;
|
|
21
|
+
/**
|
|
22
|
+
* 將各種資料類型轉換為 ArrayBuffer
|
|
23
|
+
* @param data - 輸入資料
|
|
24
|
+
* @returns ArrayBuffer
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
static toArrayBuffer(data: Blob | Buffer | string | Uint8Array | ArrayBuffer): Promise<ArrayBuffer>;
|
|
28
|
+
/**
|
|
29
|
+
* 將 Uint8Array 編碼為 Base64 字串
|
|
30
|
+
* 在 Bun 環境中使用原生 toBase64(),否則使用 Buffer
|
|
31
|
+
* @param data - 輸入的 Uint8Array
|
|
32
|
+
* @returns Base64 字串
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
static toBase64(data: Uint8Array): string;
|
|
36
|
+
/**
|
|
37
|
+
* 將 Base64 字串解碼為 Uint8Array
|
|
38
|
+
* @param base64 - Base64 字串
|
|
39
|
+
* @returns Uint8Array
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
static fromBase64(base64: string): Uint8Array;
|
|
43
|
+
/**
|
|
44
|
+
* 將 Uint8Array 編碼為 Base64URL 字串(URL 安全,無填充)
|
|
45
|
+
* @param data - 輸入的 Uint8Array
|
|
46
|
+
* @returns Base64URL 字串
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
static toBase64Url(data: Uint8Array): string;
|
|
50
|
+
/**
|
|
51
|
+
* 將 Base64URL 字串解碼為 Uint8Array
|
|
52
|
+
* @param base64url - Base64URL 字串
|
|
53
|
+
* @returns Uint8Array
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
static fromBase64Url(base64url: string): Uint8Array;
|
|
57
|
+
/**
|
|
58
|
+
* 將 Uint8Array 編碼為十六進制字串
|
|
59
|
+
* 在 Bun 環境中使用原生 toHex(),否則使用 Buffer
|
|
60
|
+
* @param data - 輸入的 Uint8Array
|
|
61
|
+
* @returns 十六進制字串(小寫)
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
static toHex(data: Uint8Array): string;
|
|
65
|
+
/**
|
|
66
|
+
* 將十六進制字串解碼為 Uint8Array
|
|
67
|
+
* @param hex - 十六進制字串
|
|
68
|
+
* @returns Uint8Array
|
|
69
|
+
* @throws {TypeError} 如果輸入不是有效的十六進制字串
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
static fromHex(hex: string): Uint8Array;
|
|
73
|
+
/**
|
|
74
|
+
* 使用 gzip 壓縮資料
|
|
75
|
+
* 在 Bun 環境中使用原生 Bun.gzipSync(),在 Node.js 中使用 zlib
|
|
76
|
+
* @param data - 輸入資料
|
|
77
|
+
* @param level - 壓縮等級(0-9),預設為 6
|
|
78
|
+
* @returns 壓縮後的 Uint8Array
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
static gzip(data: Uint8Array, level?: number): Promise<Uint8Array>;
|
|
82
|
+
/**
|
|
83
|
+
* 解壓縮 gzip 資料
|
|
84
|
+
* 在 Bun 環境中使用原生 Bun.gunzipSync(),在 Node.js 中使用 zlib
|
|
85
|
+
* @param data - gzip 壓縮的 Uint8Array
|
|
86
|
+
* @returns 解壓縮後的 Uint8Array
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
static gunzip(data: Uint8Array): Promise<Uint8Array>;
|
|
90
|
+
/**
|
|
91
|
+
* 將 ReadableStream<Uint8Array> 讀取為 Uint8Array
|
|
92
|
+
* 在 Bun 環境中使用原生 Bun.readableStreamToBytes(),否則手動讀取 chunks
|
|
93
|
+
* @param stream - 輸入的 ReadableStream
|
|
94
|
+
* @returns Uint8Array
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
static readableStreamToBytes(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
|
|
98
|
+
/**
|
|
99
|
+
* 將 ReadableStream<Uint8Array> 讀取為 ArrayBuffer
|
|
100
|
+
* @param stream - 輸入的 ReadableStream
|
|
101
|
+
* @returns ArrayBuffer
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
static readableStreamToArrayBuffer(stream: ReadableStream<Uint8Array>): Promise<ArrayBuffer>;
|
|
105
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandKernel } from '../CommandKernel';
|
|
2
|
+
import type { QueueDashboard } from '../observability/QueueDashboard';
|
|
3
|
+
/**
|
|
4
|
+
* Register queue management commands with CommandKernel
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerQueueCommands(kernel: CommandKernel, dashboard: QueueDashboard): void;
|
|
@@ -37,7 +37,12 @@ export declare class AOTRouter {
|
|
|
37
37
|
private dynamicRoutePatterns;
|
|
38
38
|
private middlewareCache;
|
|
39
39
|
private cacheMaxSize;
|
|
40
|
-
private
|
|
40
|
+
private _version;
|
|
41
|
+
/**
|
|
42
|
+
* Get the current version for cache invalidation
|
|
43
|
+
* Incremented whenever middleware or routes are modified
|
|
44
|
+
*/
|
|
45
|
+
get version(): number;
|
|
41
46
|
/**
|
|
42
47
|
* Register a route
|
|
43
48
|
*
|
|
@@ -96,6 +101,16 @@ export declare class AOTRouter {
|
|
|
96
101
|
* @returns Combined middleware array
|
|
97
102
|
*/
|
|
98
103
|
private collectMiddleware;
|
|
104
|
+
/**
|
|
105
|
+
* Get all static routes optimized for Bun's native router.
|
|
106
|
+
*
|
|
107
|
+
* Unlike basic offloading, this version supports routes with middleware
|
|
108
|
+
* by pre-compiling the middleware chain into a single native handler.
|
|
109
|
+
*
|
|
110
|
+
* @param onMatch - Factory to wrap handler and middleware into a Bun-compatible function
|
|
111
|
+
* @returns Record of path -> Handler (Bun-compatible)
|
|
112
|
+
*/
|
|
113
|
+
getNativeRoutes(onMatch: (handler: Handler, middleware: Middleware[], path: string) => (req: Request) => Response | Promise<Response>): Record<string, any>;
|
|
99
114
|
/**
|
|
100
115
|
* Check if a path is static (no parameters or wildcards)
|
|
101
116
|
*/
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @gravito/core/engine
|
|
8
8
|
*/
|
|
9
|
+
import { RequestScopeManager } from '../Container/RequestScopeManager';
|
|
9
10
|
import type { FastRequest, FastContext as IFastContext } from './types';
|
|
10
11
|
/**
|
|
11
12
|
* Lazy-parsed request wrapper
|
|
@@ -23,6 +24,12 @@ declare class FastRequestImpl implements FastRequest {
|
|
|
23
24
|
private _headers;
|
|
24
25
|
private _cachedJson;
|
|
25
26
|
private _jsonParsed;
|
|
27
|
+
private _cachedText;
|
|
28
|
+
private _textParsed;
|
|
29
|
+
private _cachedFormData;
|
|
30
|
+
private _formDataParsed;
|
|
31
|
+
private _cachedQueries;
|
|
32
|
+
private _cachedCookies;
|
|
26
33
|
private _ctx;
|
|
27
34
|
constructor(ctx: FastContext);
|
|
28
35
|
/**
|
|
@@ -45,6 +52,7 @@ declare class FastRequestImpl implements FastRequest {
|
|
|
45
52
|
queries(): Record<string, string | string[]>;
|
|
46
53
|
header(name: string): string | undefined;
|
|
47
54
|
headers(): Record<string, string>;
|
|
55
|
+
get cookies(): Record<string, string>;
|
|
48
56
|
json<T = unknown>(): Promise<T>;
|
|
49
57
|
text(): Promise<string>;
|
|
50
58
|
formData(): Promise<FormData>;
|
|
@@ -60,6 +68,7 @@ export declare class FastContext implements IFastContext {
|
|
|
60
68
|
readonly req: FastRequestImpl;
|
|
61
69
|
private _headers;
|
|
62
70
|
_isReleased: boolean;
|
|
71
|
+
private _requestScope;
|
|
63
72
|
/**
|
|
64
73
|
* Initialize context for a new request
|
|
65
74
|
*
|
|
@@ -80,9 +89,18 @@ export declare class FastContext implements IFastContext {
|
|
|
80
89
|
json<T>(data: T, status?: number): Response;
|
|
81
90
|
text(text: string, status?: number): Response;
|
|
82
91
|
html(html: string, status?: number): Response;
|
|
92
|
+
/**
|
|
93
|
+
* Escape HTML using Bun's SIMD-accelerated native implementation
|
|
94
|
+
*/
|
|
95
|
+
escape(html: string): string;
|
|
83
96
|
redirect(url: string, status?: 301 | 302 | 303 | 307 | 308): Response;
|
|
84
97
|
body(data: BodyInit | null, status?: number): Response;
|
|
85
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Send high-performance binary response (e.g. CBOR, Protobuf)
|
|
100
|
+
* Utilizing Bun's native ArrayBufferSink for zero-allocation construction.
|
|
101
|
+
*/
|
|
102
|
+
binary(data: Uint8Array | ArrayBuffer, status?: number): Response;
|
|
103
|
+
stream(stream: any, status?: number): Response;
|
|
86
104
|
notFound(message?: string): Response;
|
|
87
105
|
forbidden(message?: string): Response;
|
|
88
106
|
unauthorized(message?: string): Response;
|
|
@@ -90,10 +108,33 @@ export declare class FastContext implements IFastContext {
|
|
|
90
108
|
forward(target: string, _options?: any): Promise<Response>;
|
|
91
109
|
header(name: string): string | undefined;
|
|
92
110
|
header(name: string, value: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Status code setter (no-op)
|
|
113
|
+
*
|
|
114
|
+
* Note: Since all response helpers accept a `status` parameter,
|
|
115
|
+
* this method is not actively used. Status should be set directly
|
|
116
|
+
* in the response helper call (e.g., `ctx.json({}, 201)`).
|
|
117
|
+
*/
|
|
93
118
|
status(_code: number): void;
|
|
94
119
|
private _store;
|
|
95
120
|
get<T>(key: string): T;
|
|
96
121
|
set(key: string, value: any): void;
|
|
122
|
+
/**
|
|
123
|
+
* Get the request-scoped service manager for this request.
|
|
124
|
+
*
|
|
125
|
+
* @returns The RequestScopeManager for this request.
|
|
126
|
+
* @throws Error if called before init() or after reset().
|
|
127
|
+
*/
|
|
128
|
+
requestScope(): RequestScopeManager;
|
|
129
|
+
/**
|
|
130
|
+
* Resolve a request-scoped service (convenience method).
|
|
131
|
+
*
|
|
132
|
+
* @template T - The service type.
|
|
133
|
+
* @param key - The service key for caching.
|
|
134
|
+
* @param factory - Factory function to create the service.
|
|
135
|
+
* @returns The cached or newly created service instance.
|
|
136
|
+
*/
|
|
137
|
+
scoped<T>(key: string | symbol, factory: () => T): T;
|
|
97
138
|
route: (name: string, params?: any, query?: any) => string;
|
|
98
139
|
get native(): this;
|
|
99
140
|
}
|
|
@@ -25,7 +25,6 @@ export declare class Gravito {
|
|
|
25
25
|
staticRoutes: Map<string, RouteMetadata>;
|
|
26
26
|
private isPureStaticApp;
|
|
27
27
|
private compiledDynamicRoutes;
|
|
28
|
-
private middlewareVersion;
|
|
29
28
|
/**
|
|
30
29
|
* Create a new Gravito instance
|
|
31
30
|
*
|
|
@@ -34,10 +33,6 @@ export declare class Gravito {
|
|
|
34
33
|
constructor(options?: EngineOptions);
|
|
35
34
|
/**
|
|
36
35
|
* Register a GET route
|
|
37
|
-
*
|
|
38
|
-
* @param path - Route path (e.g., '/users/:id')
|
|
39
|
-
* @param handlers - Handler and optional middleware
|
|
40
|
-
* @returns This instance for chaining
|
|
41
36
|
*/
|
|
42
37
|
get(path: string, ...handlers: Handler[]): this;
|
|
43
38
|
/**
|
|
@@ -53,7 +48,7 @@ export declare class Gravito {
|
|
|
53
48
|
*/
|
|
54
49
|
delete(path: string, ...handlers: Handler[]): this;
|
|
55
50
|
/**
|
|
56
|
-
* Register a
|
|
51
|
+
* Register a PATCH route
|
|
57
52
|
*/
|
|
58
53
|
patch(path: string, ...handlers: Handler[]): this;
|
|
59
54
|
/**
|
|
@@ -95,15 +90,22 @@ export declare class Gravito {
|
|
|
95
90
|
*/
|
|
96
91
|
warmup(paths: string[]): Promise<void>;
|
|
97
92
|
/**
|
|
98
|
-
*
|
|
93
|
+
* Generate Native Bun.serve Configuration
|
|
94
|
+
*
|
|
95
|
+
* Offloads static routes to Bun's SIMD-accelerated native router.
|
|
96
|
+
* Supports pre-compiled middleware chains for zero runtime lookup.
|
|
99
97
|
*/
|
|
100
|
-
|
|
98
|
+
serveConfig(baseConfig?: Record<string, unknown>): Record<string, unknown>;
|
|
99
|
+
/**
|
|
100
|
+
* Optimize TLS Configuration for Bun 1.39+
|
|
101
|
+
*/
|
|
102
|
+
private optimizeTLS;
|
|
101
103
|
/**
|
|
102
|
-
* Handle
|
|
104
|
+
* Handle an incoming request
|
|
103
105
|
*/
|
|
104
|
-
|
|
106
|
+
fetch: (request: Request) => Promise<Response>;
|
|
105
107
|
/**
|
|
106
|
-
* Handle dynamic routes
|
|
108
|
+
* Handle dynamic routes with Radix Tree
|
|
107
109
|
*/
|
|
108
110
|
private handleDynamicRoute;
|
|
109
111
|
/**
|
|
@@ -126,12 +128,4 @@ export declare class Gravito {
|
|
|
126
128
|
* Add a route to the router
|
|
127
129
|
*/
|
|
128
130
|
private addRoute;
|
|
129
|
-
/**
|
|
130
|
-
* Execute middleware chain followed by handler
|
|
131
|
-
*/
|
|
132
|
-
private executeMiddleware;
|
|
133
|
-
/**
|
|
134
|
-
* Handle errors (Async version for dynamic/middleware paths)
|
|
135
|
-
*/
|
|
136
|
-
private handleError;
|
|
137
131
|
}
|