@gravito/echo 3.0.0 → 3.1.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 +211 -0
- package/dist/atlas/src/DB.d.ts +301 -0
- package/dist/atlas/src/OrbitAtlas.d.ts +9 -0
- package/dist/atlas/src/config/defineConfig.d.ts +14 -0
- package/dist/atlas/src/config/index.d.ts +7 -0
- package/dist/atlas/src/config/loadConfig.d.ts +48 -0
- package/dist/atlas/src/connection/Connection.d.ts +108 -0
- package/dist/atlas/src/connection/ConnectionManager.d.ts +111 -0
- package/dist/atlas/src/drivers/BunSQLDriver.d.ts +32 -0
- package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +118 -0
- package/dist/atlas/src/drivers/MongoDBDriver.d.ts +36 -0
- package/dist/atlas/src/drivers/MySQLDriver.d.ts +66 -0
- package/dist/atlas/src/drivers/PostgresDriver.d.ts +83 -0
- package/dist/atlas/src/drivers/RedisDriver.d.ts +43 -0
- package/dist/atlas/src/drivers/SQLiteDriver.d.ts +45 -0
- package/dist/atlas/src/drivers/types.d.ts +260 -0
- package/dist/atlas/src/errors/index.d.ts +45 -0
- package/dist/atlas/src/grammar/Grammar.d.ts +342 -0
- package/dist/atlas/src/grammar/MongoGrammar.d.ts +47 -0
- package/dist/atlas/src/grammar/MySQLGrammar.d.ts +54 -0
- package/dist/atlas/src/grammar/NullGrammar.d.ts +35 -0
- package/dist/atlas/src/grammar/PostgresGrammar.d.ts +62 -0
- package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +32 -0
- package/dist/atlas/src/index.d.ts +67 -0
- package/dist/atlas/src/migration/Migration.d.ts +64 -0
- package/dist/atlas/src/migration/MigrationRepository.d.ts +65 -0
- package/dist/atlas/src/migration/Migrator.d.ts +110 -0
- package/dist/atlas/src/migration/index.d.ts +6 -0
- package/dist/atlas/src/observability/AtlasMetrics.d.ts +11 -0
- package/dist/atlas/src/observability/AtlasObservability.d.ts +15 -0
- package/dist/atlas/src/observability/AtlasTracer.d.ts +12 -0
- package/dist/atlas/src/observability/index.d.ts +9 -0
- package/dist/atlas/src/orm/index.d.ts +5 -0
- package/dist/atlas/src/orm/model/DirtyTracker.d.ts +121 -0
- package/dist/atlas/src/orm/model/Model.d.ts +449 -0
- package/dist/atlas/src/orm/model/ModelRegistry.d.ts +20 -0
- package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +136 -0
- package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +36 -0
- package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +87 -0
- package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +117 -0
- package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +64 -0
- package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +15 -0
- package/dist/atlas/src/orm/model/concerns/index.d.ts +12 -0
- package/dist/atlas/src/orm/model/decorators.d.ts +109 -0
- package/dist/atlas/src/orm/model/errors.d.ts +52 -0
- package/dist/atlas/src/orm/model/index.d.ts +10 -0
- package/dist/atlas/src/orm/model/relationships.d.ts +207 -0
- package/dist/atlas/src/orm/model/types.d.ts +12 -0
- package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +123 -0
- package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +54 -0
- package/dist/atlas/src/orm/schema/index.d.ts +6 -0
- package/dist/atlas/src/orm/schema/types.d.ts +85 -0
- package/dist/atlas/src/query/Expression.d.ts +60 -0
- package/dist/atlas/src/query/NPlusOneDetector.d.ts +10 -0
- package/dist/atlas/src/query/QueryBuilder.d.ts +573 -0
- package/dist/atlas/src/query/clauses/GroupByClause.d.ts +51 -0
- package/dist/atlas/src/query/clauses/HavingClause.d.ts +70 -0
- package/dist/atlas/src/query/clauses/JoinClause.d.ts +87 -0
- package/dist/atlas/src/query/clauses/LimitClause.d.ts +82 -0
- package/dist/atlas/src/query/clauses/OrderByClause.d.ts +69 -0
- package/dist/atlas/src/query/clauses/SelectClause.d.ts +71 -0
- package/dist/atlas/src/query/clauses/WhereClause.d.ts +167 -0
- package/dist/atlas/src/query/clauses/index.d.ts +11 -0
- package/dist/atlas/src/schema/Blueprint.d.ts +276 -0
- package/dist/atlas/src/schema/ColumnDefinition.d.ts +154 -0
- package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +37 -0
- package/dist/atlas/src/schema/Schema.d.ts +131 -0
- package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +23 -0
- package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +26 -0
- package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +28 -0
- package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +97 -0
- package/dist/atlas/src/schema/grammars/index.d.ts +7 -0
- package/dist/atlas/src/schema/index.d.ts +8 -0
- package/dist/atlas/src/seed/Factory.d.ts +90 -0
- package/dist/atlas/src/seed/Seeder.d.ts +28 -0
- package/dist/atlas/src/seed/SeederRunner.d.ts +74 -0
- package/dist/atlas/src/seed/index.d.ts +6 -0
- package/dist/atlas/src/types/index.d.ts +1100 -0
- package/dist/atlas/src/utils/levenshtein.d.ts +9 -0
- package/dist/core/src/Application.d.ts +215 -0
- package/dist/core/src/CommandKernel.d.ts +33 -0
- package/dist/core/src/ConfigManager.d.ts +26 -0
- package/dist/core/src/Container.d.ts +108 -0
- package/dist/core/src/ErrorHandler.d.ts +63 -0
- package/dist/core/src/Event.d.ts +5 -0
- package/dist/core/src/EventManager.d.ts +123 -0
- package/dist/core/src/GlobalErrorHandlers.d.ts +47 -0
- package/dist/core/src/GravitoServer.d.ts +28 -0
- package/dist/core/src/HookManager.d.ts +496 -0
- package/dist/core/src/Listener.d.ts +4 -0
- package/dist/core/src/Logger.d.ts +20 -0
- package/dist/core/src/PlanetCore.d.ts +289 -0
- package/dist/core/src/Route.d.ts +36 -0
- package/dist/core/src/Router.d.ts +284 -0
- package/dist/core/src/ServiceProvider.d.ts +156 -0
- package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +27 -0
- package/dist/core/src/adapters/PhotonAdapter.d.ts +171 -0
- package/dist/core/src/adapters/bun/BunContext.d.ts +45 -0
- package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +31 -0
- package/dist/core/src/adapters/bun/BunRequest.d.ts +31 -0
- package/dist/core/src/adapters/bun/RadixNode.d.ts +19 -0
- package/dist/core/src/adapters/bun/RadixRouter.d.ts +31 -0
- package/dist/core/src/adapters/bun/types.d.ts +20 -0
- package/dist/core/src/adapters/photon-types.d.ts +73 -0
- package/dist/core/src/adapters/types.d.ts +235 -0
- package/dist/core/src/engine/AOTRouter.d.ts +124 -0
- package/dist/core/src/engine/FastContext.d.ts +100 -0
- package/dist/core/src/engine/Gravito.d.ts +137 -0
- package/dist/core/src/engine/MinimalContext.d.ts +79 -0
- package/dist/core/src/engine/analyzer.d.ts +27 -0
- package/dist/core/src/engine/constants.d.ts +23 -0
- package/dist/core/src/engine/index.d.ts +26 -0
- package/dist/core/src/engine/path.d.ts +26 -0
- package/dist/core/src/engine/pool.d.ts +83 -0
- package/dist/core/src/engine/types.d.ts +143 -0
- package/dist/core/src/events/CircuitBreaker.d.ts +229 -0
- package/dist/core/src/events/DeadLetterQueue.d.ts +145 -0
- package/dist/core/src/events/EventBackend.d.ts +11 -0
- package/dist/core/src/events/EventOptions.d.ts +109 -0
- package/dist/core/src/events/EventPriorityQueue.d.ts +202 -0
- package/dist/core/src/events/IdempotencyCache.d.ts +60 -0
- package/dist/core/src/events/index.d.ts +14 -0
- package/dist/core/src/events/observability/EventMetrics.d.ts +132 -0
- package/dist/core/src/events/observability/EventTracer.d.ts +68 -0
- package/dist/core/src/events/observability/EventTracing.d.ts +161 -0
- package/dist/core/src/events/observability/OTelEventMetrics.d.ts +240 -0
- package/dist/core/src/events/observability/ObservableHookManager.d.ts +108 -0
- package/dist/core/src/events/observability/index.d.ts +20 -0
- package/dist/core/src/events/observability/metrics-types.d.ts +16 -0
- package/dist/core/src/events/types.d.ts +75 -0
- package/dist/core/src/exceptions/AuthenticationException.d.ts +8 -0
- package/dist/core/src/exceptions/AuthorizationException.d.ts +8 -0
- package/dist/core/src/exceptions/CircularDependencyException.d.ts +9 -0
- package/dist/core/src/exceptions/GravitoException.d.ts +23 -0
- package/dist/core/src/exceptions/HttpException.d.ts +9 -0
- package/dist/core/src/exceptions/ModelNotFoundException.d.ts +10 -0
- package/dist/core/src/exceptions/ValidationException.d.ts +22 -0
- package/dist/core/src/exceptions/index.d.ts +7 -0
- package/dist/core/src/helpers/Arr.d.ts +19 -0
- package/dist/core/src/helpers/Str.d.ts +23 -0
- package/dist/core/src/helpers/data.d.ts +25 -0
- package/dist/core/src/helpers/errors.d.ts +34 -0
- package/dist/core/src/helpers/response.d.ts +41 -0
- package/dist/core/src/helpers.d.ts +338 -0
- package/dist/core/src/http/CookieJar.d.ts +51 -0
- package/dist/core/src/http/cookie.d.ts +29 -0
- package/dist/core/src/http/middleware/BodySizeLimit.d.ts +16 -0
- package/dist/core/src/http/middleware/Cors.d.ts +24 -0
- package/dist/core/src/http/middleware/Csrf.d.ts +23 -0
- package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +28 -0
- package/dist/core/src/http/middleware/SecurityHeaders.d.ts +29 -0
- package/dist/core/src/http/middleware/ThrottleRequests.d.ts +18 -0
- package/dist/core/src/http/types.d.ts +355 -0
- package/dist/core/src/index.d.ts +76 -0
- package/dist/core/src/instrumentation/index.d.ts +35 -0
- package/dist/core/src/instrumentation/opentelemetry.d.ts +178 -0
- package/dist/core/src/instrumentation/types.d.ts +182 -0
- package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +316 -0
- package/dist/core/src/reliability/RetryPolicy.d.ts +217 -0
- package/dist/core/src/reliability/index.d.ts +6 -0
- package/dist/core/src/router/ControllerDispatcher.d.ts +12 -0
- package/dist/core/src/router/RequestValidator.d.ts +20 -0
- package/dist/core/src/runtime.d.ts +119 -0
- package/dist/core/src/security/Encrypter.d.ts +33 -0
- package/dist/core/src/security/Hasher.d.ts +29 -0
- package/dist/core/src/testing/HttpTester.d.ts +39 -0
- package/dist/core/src/testing/TestResponse.d.ts +78 -0
- package/dist/core/src/testing/index.d.ts +2 -0
- package/dist/core/src/types/events.d.ts +94 -0
- package/dist/echo/src/OrbitEcho.d.ts +115 -0
- package/dist/echo/src/dlq/DeadLetterQueue.d.ts +94 -0
- package/dist/echo/src/dlq/MemoryDeadLetterQueue.d.ts +36 -0
- package/dist/echo/src/dlq/index.d.ts +2 -0
- package/dist/echo/src/index.d.ts +64 -0
- package/dist/echo/src/middleware/RequestBufferMiddleware.d.ts +62 -0
- package/dist/echo/src/middleware/index.d.ts +8 -0
- package/dist/echo/src/observability/index.d.ts +3 -0
- package/dist/echo/src/observability/logging/ConsoleEchoLogger.d.ts +37 -0
- package/dist/echo/src/observability/logging/EchoLogger.d.ts +38 -0
- package/dist/echo/src/observability/logging/index.d.ts +2 -0
- package/dist/echo/src/observability/metrics/MetricsProvider.d.ts +69 -0
- package/dist/echo/src/observability/metrics/NoopMetricsProvider.d.ts +17 -0
- package/dist/echo/src/observability/metrics/PrometheusMetricsProvider.d.ts +39 -0
- package/dist/echo/src/observability/metrics/index.d.ts +3 -0
- package/dist/echo/src/observability/tracing/NoopTracer.d.ts +33 -0
- package/dist/echo/src/observability/tracing/Tracer.d.ts +75 -0
- package/dist/echo/src/observability/tracing/index.d.ts +2 -0
- package/dist/echo/src/providers/GenericProvider.d.ts +53 -0
- package/dist/echo/src/providers/GitHubProvider.d.ts +35 -0
- package/dist/echo/src/providers/LinearProvider.d.ts +27 -0
- package/dist/echo/src/providers/PaddleProvider.d.ts +31 -0
- package/dist/echo/src/providers/ShopifyProvider.d.ts +27 -0
- package/dist/echo/src/providers/SlackProvider.d.ts +27 -0
- package/dist/echo/src/providers/StripeProvider.d.ts +38 -0
- package/dist/echo/src/providers/TwilioProvider.d.ts +31 -0
- package/dist/echo/src/providers/base/BaseProvider.d.ts +87 -0
- package/dist/echo/src/providers/base/HeaderUtils.d.ts +34 -0
- package/dist/echo/src/providers/index.d.ts +14 -0
- package/dist/echo/src/receive/SignatureValidator.d.ts +67 -0
- package/dist/echo/src/receive/WebhookReceiver.d.ts +185 -0
- package/dist/echo/src/receive/index.d.ts +2 -0
- package/dist/echo/src/replay/WebhookReplayService.d.ts +35 -0
- package/dist/echo/src/replay/index.d.ts +1 -0
- package/dist/echo/src/resilience/CircuitBreaker.d.ts +117 -0
- package/dist/echo/src/resilience/index.d.ts +10 -0
- package/dist/echo/src/rotation/KeyRotationManager.d.ts +127 -0
- package/dist/echo/src/rotation/index.d.ts +10 -0
- package/dist/echo/src/send/WebhookDispatcher.d.ts +198 -0
- package/dist/echo/src/send/index.d.ts +1 -0
- package/dist/echo/src/storage/MemoryWebhookStore.d.ts +14 -0
- package/dist/echo/src/storage/WebhookStore.d.ts +236 -0
- package/dist/echo/src/storage/index.d.ts +2 -0
- package/dist/echo/src/types.d.ts +756 -0
- package/dist/index.js +1332 -190
- package/dist/index.js.map +28 -10
- package/dist/photon/src/index.d.ts +84 -0
- package/dist/photon/src/middleware/binary.d.ts +31 -0
- package/dist/photon/src/middleware/htmx.d.ts +39 -0
- package/dist/photon/src/middleware/ratelimit.d.ts +157 -0
- package/dist/photon/src/openapi.d.ts +19 -0
- package/package.json +7 -5
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview PlanetCore - The Heart of Gravito Framework
|
|
3
|
+
*
|
|
4
|
+
* The micro-kernel that orchestrates the entire Galaxy Architecture.
|
|
5
|
+
* Manages HTTP routing, middleware, error handling, and orbit integration.
|
|
6
|
+
*
|
|
7
|
+
* @module @gravito/core
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
import { type HttpAdapter } from './adapters/types';
|
|
11
|
+
import { ConfigManager } from './ConfigManager';
|
|
12
|
+
import { Container } from './Container';
|
|
13
|
+
import { EventManager } from './EventManager';
|
|
14
|
+
import { type RegisterGlobalErrorHandlersOptions } from './GlobalErrorHandlers';
|
|
15
|
+
import { HookManager } from './HookManager';
|
|
16
|
+
import type { fail } from './helpers/response';
|
|
17
|
+
import type { ContentfulStatusCode, GravitoContext } from './http/types';
|
|
18
|
+
import { type Logger } from './Logger';
|
|
19
|
+
import type { ServiceProvider } from './ServiceProvider';
|
|
20
|
+
/**
|
|
21
|
+
* CacheService interface for orbit-injected cache
|
|
22
|
+
* Orbits implementing cache should conform to this interface
|
|
23
|
+
*/
|
|
24
|
+
export interface CacheService {
|
|
25
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
26
|
+
set(key: string, value: unknown, ttl?: number): Promise<void>;
|
|
27
|
+
delete(key: string): Promise<void>;
|
|
28
|
+
clear(): Promise<void>;
|
|
29
|
+
remember<T>(key: string, ttl: number, callback: () => Promise<T>): Promise<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interface for View Rendering Service
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export interface ViewService {
|
|
36
|
+
render(view: string, data?: Record<string, unknown>, options?: Record<string, unknown>): string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Context passed to error handlers
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export type ErrorHandlerContext = {
|
|
43
|
+
core: PlanetCore;
|
|
44
|
+
c: GravitoContext;
|
|
45
|
+
error: unknown;
|
|
46
|
+
isProduction: boolean;
|
|
47
|
+
accept: string;
|
|
48
|
+
wantsHtml: boolean;
|
|
49
|
+
status: ContentfulStatusCode;
|
|
50
|
+
payload: ReturnType<typeof fail>;
|
|
51
|
+
logLevel?: 'error' | 'warn' | 'info' | 'none';
|
|
52
|
+
logMessage?: string;
|
|
53
|
+
html?: {
|
|
54
|
+
templates: string[];
|
|
55
|
+
data: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Interface for Gravito Orbit (Plugin/Module)
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export interface GravitoOrbit {
|
|
63
|
+
install(core: PlanetCore): void | Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Configuration for booting PlanetCore
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export type GravitoConfig = {
|
|
70
|
+
logger?: Logger;
|
|
71
|
+
config?: Record<string, unknown>;
|
|
72
|
+
orbits?: (new () => GravitoOrbit)[] | GravitoOrbit[];
|
|
73
|
+
/**
|
|
74
|
+
* HTTP Adapter to use. Defaults to PhotonAdapter.
|
|
75
|
+
* @since 2.0.0
|
|
76
|
+
*/
|
|
77
|
+
adapter?: HttpAdapter;
|
|
78
|
+
/**
|
|
79
|
+
* Dependency Injection Container. If provided, PlanetCore will use this
|
|
80
|
+
* container instead of creating a new one. This allows sharing a container
|
|
81
|
+
* between Application and PlanetCore.
|
|
82
|
+
* @since 2.0.0
|
|
83
|
+
*/
|
|
84
|
+
container?: Container;
|
|
85
|
+
};
|
|
86
|
+
import { Router } from './Router';
|
|
87
|
+
import { Encrypter } from './security/Encrypter';
|
|
88
|
+
import { BunHasher } from './security/Hasher';
|
|
89
|
+
/**
|
|
90
|
+
* PlanetCore - The Heart of Gravito Framework
|
|
91
|
+
*
|
|
92
|
+
* The micro-kernel that orchestrates the entire Galaxy Architecture.
|
|
93
|
+
* Manages HTTP routing, middleware, error handling, and orbit integration.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare class PlanetCore {
|
|
97
|
+
/**
|
|
98
|
+
* The HTTP adapter used by this core instance.
|
|
99
|
+
* @since 2.0.0
|
|
100
|
+
*/
|
|
101
|
+
private _adapter;
|
|
102
|
+
/**
|
|
103
|
+
* Access the underlying Photon app instance.
|
|
104
|
+
* @deprecated Use adapter methods for new code. This property is kept for backward compatibility.
|
|
105
|
+
*/
|
|
106
|
+
get app(): unknown;
|
|
107
|
+
/**
|
|
108
|
+
* Get the HTTP adapter instance.
|
|
109
|
+
* @since 2.0.0
|
|
110
|
+
*/
|
|
111
|
+
get adapter(): HttpAdapter;
|
|
112
|
+
logger: Logger;
|
|
113
|
+
config: ConfigManager;
|
|
114
|
+
hooks: HookManager;
|
|
115
|
+
events: EventManager;
|
|
116
|
+
router: Router;
|
|
117
|
+
container: Container;
|
|
118
|
+
/** @deprecated Use core.container instead */
|
|
119
|
+
services: Map<string, unknown>;
|
|
120
|
+
encrypter?: Encrypter;
|
|
121
|
+
hasher: BunHasher;
|
|
122
|
+
private providers;
|
|
123
|
+
private deferredProviders;
|
|
124
|
+
private bootedProviders;
|
|
125
|
+
/**
|
|
126
|
+
* Register a service provider to the core.
|
|
127
|
+
*
|
|
128
|
+
* Service providers are the central place to configure your application.
|
|
129
|
+
* They bind services to the container and bootstrap application features.
|
|
130
|
+
*
|
|
131
|
+
* @param provider - The ServiceProvider instance to register.
|
|
132
|
+
* @returns The PlanetCore instance for chaining.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* core.register(new DatabaseServiceProvider());
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
register(provider: ServiceProvider): this;
|
|
140
|
+
/**
|
|
141
|
+
* Bootstrap the application by registering and booting providers.
|
|
142
|
+
*
|
|
143
|
+
* This method orchestrates the two-phase startup sequence:
|
|
144
|
+
* 1. Registration: Calls `register()` on all providers to bind services.
|
|
145
|
+
* 2. Booting: Calls `boot()` on all providers once all bindings are ready.
|
|
146
|
+
*
|
|
147
|
+
* This method must be called before the application starts handling requests.
|
|
148
|
+
*
|
|
149
|
+
* @returns Promise that resolves when bootstrapping is complete.
|
|
150
|
+
* @throws Error if a deferred provider has an asynchronous register method.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* await core.bootstrap();
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
bootstrap(): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Setup deferred provider resolution.
|
|
160
|
+
* Wraps container.make to auto-register deferred providers on first request.
|
|
161
|
+
*
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
private setupDeferredProviderResolution;
|
|
165
|
+
/**
|
|
166
|
+
* Register a deferred provider on-demand.
|
|
167
|
+
*
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
private registerDeferredProvider;
|
|
171
|
+
/**
|
|
172
|
+
* Boot a single provider if not already booted.
|
|
173
|
+
*
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
private bootProvider;
|
|
177
|
+
constructor(options?: {
|
|
178
|
+
logger?: Logger;
|
|
179
|
+
config?: Record<string, unknown>;
|
|
180
|
+
adapter?: HttpAdapter;
|
|
181
|
+
container?: Container;
|
|
182
|
+
});
|
|
183
|
+
/**
|
|
184
|
+
* Programmatically register an infrastructure module (Orbit).
|
|
185
|
+
* @since 2.0.0
|
|
186
|
+
*
|
|
187
|
+
* @param orbit - The orbit class or instance to register.
|
|
188
|
+
* @returns The PlanetCore instance for chaining.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* await core.orbit(OrbitCache);
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
orbit(orbit: GravitoOrbit | (new () => GravitoOrbit)): Promise<this>;
|
|
196
|
+
/**
|
|
197
|
+
* Programmatically register a feature module (Satellite).
|
|
198
|
+
* Alias for register() with provider support.
|
|
199
|
+
* @since 2.0.0
|
|
200
|
+
*
|
|
201
|
+
* @param satellite - The provider or setup function.
|
|
202
|
+
* @returns The PlanetCore instance for chaining.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* await core.use(new AuthProvider());
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
use(satellite: ServiceProvider | ((core: PlanetCore) => void | Promise<void>)): Promise<this>;
|
|
210
|
+
/**
|
|
211
|
+
* Register a global error handler for process-level exceptions.
|
|
212
|
+
*
|
|
213
|
+
* Captures `unhandledRejection` and `uncaughtException` to prevent process crashes
|
|
214
|
+
* and allow for graceful shutdown or error reporting.
|
|
215
|
+
*
|
|
216
|
+
* @param options - Configuration for global error handling.
|
|
217
|
+
* @returns A function to unregister the global error handlers.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const unregister = core.registerGlobalErrorHandlers({
|
|
222
|
+
* exitOnFatal: true
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
registerGlobalErrorHandlers(options?: Omit<RegisterGlobalErrorHandlersOptions, 'core'>): () => void;
|
|
227
|
+
/**
|
|
228
|
+
* Predictive Route Warming (JIT Optimization).
|
|
229
|
+
*
|
|
230
|
+
* Pre-compiles or warms up the specified paths in the HTTP adapter to reduce
|
|
231
|
+
* latency for the first request to these endpoints.
|
|
232
|
+
*
|
|
233
|
+
* @param paths - List of paths to warm up.
|
|
234
|
+
* @returns Promise that resolves when warming is complete.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* await core.warmup(['/api/v1/products', '/api/v1/categories']);
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
warmup(paths: string[]): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Boot the application with a configuration object (IoC style default entry)
|
|
244
|
+
*
|
|
245
|
+
* @param config - The Gravito configuration object.
|
|
246
|
+
* @returns A Promise resolving to the booted PlanetCore instance.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* const core = await PlanetCore.boot(config);
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
static boot(config: GravitoConfig): Promise<PlanetCore>;
|
|
254
|
+
/**
|
|
255
|
+
* Mount an Orbit (a PlanetCore instance or native app) to a specific URL path.
|
|
256
|
+
*
|
|
257
|
+
* This allows for micro-service like composition where different parts of the
|
|
258
|
+
* application can be developed as independent Orbits and mounted together.
|
|
259
|
+
*
|
|
260
|
+
* @param path - The URL path to mount the orbit at.
|
|
261
|
+
* @param orbitApp - The application instance (PlanetCore, HttpAdapter, or native app).
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const blogOrbit = new PlanetCore();
|
|
266
|
+
* core.mountOrbit('/blog', blogOrbit);
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
mountOrbit(path: string, orbitApp: unknown): void;
|
|
270
|
+
/**
|
|
271
|
+
* Start the core (Liftoff).
|
|
272
|
+
*
|
|
273
|
+
* Returns a config object for `Bun.serve`.
|
|
274
|
+
*
|
|
275
|
+
* @param port - Optional port number (defaults to config or 3000).
|
|
276
|
+
* @returns An object compatible with Bun.serve({ ... }).
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* export default core.liftoff(3000);
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
liftoff(port?: number): {
|
|
284
|
+
port: number;
|
|
285
|
+
fetch: (request: Request, server?: unknown) => Response | Promise<Response>;
|
|
286
|
+
core: PlanetCore;
|
|
287
|
+
websocket?: HttpAdapter['websocket'];
|
|
288
|
+
};
|
|
289
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GravitoMiddleware } from './http/types';
|
|
2
|
+
import type { ControllerClass, FormRequestClass, ResourceOptions, RouteHandler, RouteOptions, Router } from './Router';
|
|
3
|
+
/**
|
|
4
|
+
* Route definition helper.
|
|
5
|
+
* Represents a registered route and allows method chaining for middleware/names.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class Route {
|
|
9
|
+
private router;
|
|
10
|
+
private method;
|
|
11
|
+
private path;
|
|
12
|
+
private options;
|
|
13
|
+
constructor(router: Router, method: string, path: string, options: RouteOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Name the route
|
|
16
|
+
*/
|
|
17
|
+
name(name: string): this;
|
|
18
|
+
static get(path: string, handler: RouteHandler): Route;
|
|
19
|
+
static get(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
20
|
+
static get(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
21
|
+
static post(path: string, handler: RouteHandler): Route;
|
|
22
|
+
static post(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
23
|
+
static post(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
24
|
+
static put(path: string, handler: RouteHandler): Route;
|
|
25
|
+
static put(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
26
|
+
static put(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
27
|
+
static delete(path: string, handler: RouteHandler): Route;
|
|
28
|
+
static delete(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
29
|
+
static delete(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
30
|
+
static patch(path: string, handler: RouteHandler): Route;
|
|
31
|
+
static patch(path: string, request: FormRequestClass, handler: RouteHandler): Route;
|
|
32
|
+
static patch(path: string, middleware: GravitoMiddleware | GravitoMiddleware[], handler: RouteHandler): Route;
|
|
33
|
+
static resource(name: string, controller: ControllerClass, options?: ResourceOptions): void;
|
|
34
|
+
static prefix(path: string): import("@gravito/core").RouteGroup;
|
|
35
|
+
static middleware(...handlers: (GravitoMiddleware | GravitoMiddleware[])[]): import("@gravito/core").RouteGroup;
|
|
36
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type { GravitoHandler, GravitoMiddleware, HttpMethod, ProxyOptions } from './http/types';
|
|
2
|
+
import type { PlanetCore } from './PlanetCore';
|
|
3
|
+
import { Route } from './Route';
|
|
4
|
+
/**
|
|
5
|
+
* Type for Controller Class Constructor
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type ControllerClass = new (core: PlanetCore) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Handler can be a function or [Class, 'methodName']
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type RouteHandler = GravitoHandler | [ControllerClass, string];
|
|
14
|
+
/**
|
|
15
|
+
* Interface for FormRequest classes (from @gravito/impulse).
|
|
16
|
+
* Used for duck-typing detection without hard dependency.
|
|
17
|
+
*/
|
|
18
|
+
export interface FormRequestLike {
|
|
19
|
+
schema: unknown;
|
|
20
|
+
source?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Validate the request context.
|
|
23
|
+
* @param ctx - The request context
|
|
24
|
+
*/
|
|
25
|
+
validate?(ctx: unknown): Promise<{
|
|
26
|
+
success: boolean;
|
|
27
|
+
data?: unknown;
|
|
28
|
+
error?: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Type for FormRequest class constructor
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export type FormRequestClass = new () => FormRequestLike;
|
|
36
|
+
/**
|
|
37
|
+
* Symbol to mark FormRequest classes for fast identification.
|
|
38
|
+
* FormRequest classes from @gravito/impulse should set this symbol.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Symbol to mark FormRequest classes for fast identification.
|
|
42
|
+
* FormRequest classes from @gravito/impulse should set this symbol.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare const FORM_REQUEST_SYMBOL: unique symbol;
|
|
46
|
+
/**
|
|
47
|
+
* Options for route definitions
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface RouteOptions {
|
|
51
|
+
/** Route prefix path */
|
|
52
|
+
prefix?: string;
|
|
53
|
+
/** Domain/Hostname constraint */
|
|
54
|
+
domain?: string;
|
|
55
|
+
/** Middleware stack for the route */
|
|
56
|
+
middleware?: GravitoMiddleware[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* RouteGroup
|
|
60
|
+
* Helper class for chained route configuration (prefix, domain, etc.)
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* RouteGroup
|
|
64
|
+
* Helper class for chained route configuration (prefix, domain, etc.)
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export declare class RouteGroup {
|
|
68
|
+
private router;
|
|
69
|
+
private options;
|
|
70
|
+
constructor(router: Router, options: RouteOptions);
|
|
71
|
+
/**
|
|
72
|
+
* Add a prefix to the current group
|
|
73
|
+
*/
|
|
74
|
+
prefix(path: string): RouteGroup;
|
|
75
|
+
/**
|
|
76
|
+
* Add middleware to the current group.
|
|
77
|
+
* Accepts individual handlers or arrays of handlers.
|
|
78
|
+
*/
|
|
79
|
+
middleware(...handlers: (GravitoMiddleware | GravitoMiddleware[])[]): RouteGroup;
|
|
80
|
+
/**
|
|
81
|
+
* Define routes within this group
|
|
82
|
+
*/
|
|
83
|
+
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
|
+
resource(name: string, controller: ControllerClass, options?: ResourceOptions): void;
|
|
100
|
+
/**
|
|
101
|
+
* Register a route that forwards requests to another URL (Gateway Proxy).
|
|
102
|
+
* @param method - HTTP method or 'all'
|
|
103
|
+
* @param path - Local route path
|
|
104
|
+
* @param target - Remote URL or base URL to forward to
|
|
105
|
+
* @param options - Optional proxy options
|
|
106
|
+
*/
|
|
107
|
+
forward(method: HttpMethod | HttpMethod[] | 'all', path: string, target: string, options?: ProxyOptions): void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gravito Router
|
|
111
|
+
*
|
|
112
|
+
* Provides a Laravel-like fluent API for defining routes.
|
|
113
|
+
* Supports:
|
|
114
|
+
* - Controller-based routing: router.get('/', [HomeController, 'index'])
|
|
115
|
+
* - Route groups with prefixes: router.prefix('/api').group(...)
|
|
116
|
+
* - Domain-based routing: router.domain('api.app').group(...)
|
|
117
|
+
* - Middleware chaining: router.middleware(auth).group(...)
|
|
118
|
+
* - FormRequest validation: router.post('/users', StoreUserRequest, [UserController, 'store'])
|
|
119
|
+
* - Inline Middleware: router.get('/users', authMiddleware, [UserController, 'index'])
|
|
120
|
+
*/
|
|
121
|
+
export declare class Router {
|
|
122
|
+
private core;
|
|
123
|
+
routes: Array<{
|
|
124
|
+
method: string;
|
|
125
|
+
path: string;
|
|
126
|
+
domain?: string;
|
|
127
|
+
}>;
|
|
128
|
+
private dispatcher;
|
|
129
|
+
private namedRoutes;
|
|
130
|
+
private bindings;
|
|
131
|
+
/**
|
|
132
|
+
* Compile all registered routes into a flat array for caching or manifest generation.
|
|
133
|
+
* Optimized: O(n) complexity using Set for lookups instead of O(n²) with Array.some()
|
|
134
|
+
*/
|
|
135
|
+
compile(): {
|
|
136
|
+
method: string;
|
|
137
|
+
path: string;
|
|
138
|
+
name?: string;
|
|
139
|
+
domain?: string | undefined;
|
|
140
|
+
}[];
|
|
141
|
+
/**
|
|
142
|
+
* Register a named route
|
|
143
|
+
*/
|
|
144
|
+
registerName(name: string, method: string, path: string, options?: RouteOptions): void;
|
|
145
|
+
/**
|
|
146
|
+
* Generate a URL from a named route.
|
|
147
|
+
*
|
|
148
|
+
* Replaces route parameters (e.g., `:id`) with provided values and appends
|
|
149
|
+
* query parameters to the URL.
|
|
150
|
+
*
|
|
151
|
+
* @param name - The name of the route.
|
|
152
|
+
* @param params - Key-value pairs for route parameters.
|
|
153
|
+
* @param query - Key-value pairs for query string parameters.
|
|
154
|
+
* @returns The generated URL string.
|
|
155
|
+
* @throws Error if the named route is not found or if a required parameter is missing.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const url = router.url('users.show', { id: 1 }, { tab: 'profile' });
|
|
160
|
+
* // Result: "/users/1?tab=profile"
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
url(name: string, params?: Record<string, string | number>, query?: Record<string, string | number | boolean | null | undefined>): string;
|
|
164
|
+
/**
|
|
165
|
+
* Export named routes as a serializable manifest (for caching).
|
|
166
|
+
*/
|
|
167
|
+
exportNamedRoutes(): Record<string, {
|
|
168
|
+
method: string;
|
|
169
|
+
path: string;
|
|
170
|
+
domain?: string;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Load named routes from a manifest (for caching).
|
|
174
|
+
*/
|
|
175
|
+
loadNamedRoutes(manifest: Record<string, {
|
|
176
|
+
method: string;
|
|
177
|
+
path: string;
|
|
178
|
+
domain?: string;
|
|
179
|
+
}>): void;
|
|
180
|
+
/**
|
|
181
|
+
* Register a route model binding.
|
|
182
|
+
*
|
|
183
|
+
* Automatically resolves a route parameter to an object using the provided
|
|
184
|
+
* resolver function. The resolved object is then available in the request context.
|
|
185
|
+
*
|
|
186
|
+
* @param param - The name of the route parameter to bind.
|
|
187
|
+
* @param resolver - An async function that resolves the parameter value to an object.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* router.bind('user', async (id) => await User.find(id));
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
bind(param: string, resolver: (id: string) => Promise<unknown>): void;
|
|
195
|
+
/**
|
|
196
|
+
* Register a route model binding for a Model class.
|
|
197
|
+
*/
|
|
198
|
+
model(param: string, modelClass: unknown): void;
|
|
199
|
+
constructor(core: PlanetCore);
|
|
200
|
+
/**
|
|
201
|
+
* Start a route group with a prefix
|
|
202
|
+
*/
|
|
203
|
+
prefix(path: string): RouteGroup;
|
|
204
|
+
/**
|
|
205
|
+
* Start a route group with a domain constraint
|
|
206
|
+
*/
|
|
207
|
+
domain(host: string): RouteGroup;
|
|
208
|
+
/**
|
|
209
|
+
* Start a route group with middleware.
|
|
210
|
+
* Accepts individual handlers or arrays of handlers.
|
|
211
|
+
*/
|
|
212
|
+
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
|
+
/**
|
|
244
|
+
* Register a route that forwards requests to another URL (Gateway Proxy).
|
|
245
|
+
* @param method - HTTP method or 'all'
|
|
246
|
+
* @param path - Local route path
|
|
247
|
+
* @param target - Remote URL or base URL to forward to
|
|
248
|
+
* @param options - Optional proxy options
|
|
249
|
+
*/
|
|
250
|
+
forward(method: HttpMethod | HttpMethod[] | 'all', path: string, target: string, options?: ProxyOptions): void;
|
|
251
|
+
/**
|
|
252
|
+
* Register a resource route (RESTful).
|
|
253
|
+
*
|
|
254
|
+
* Automatically creates multiple routes for a resource (index, create, store,
|
|
255
|
+
* show, edit, update, destroy) mapping to specific controller methods.
|
|
256
|
+
*
|
|
257
|
+
* @param name - The resource name (e.g., 'users').
|
|
258
|
+
* @param controller - The controller class handling the resource.
|
|
259
|
+
* @param options - Optional constraints (only/except) for resource actions.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* router.resource('photos', PhotoController);
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
resource(name: string, controller: ControllerClass, options?: ResourceOptions): void;
|
|
267
|
+
/**
|
|
268
|
+
* Internal Request Registration
|
|
269
|
+
*/
|
|
270
|
+
req(method: HttpMethod, path: string, requestOrHandlerOrMiddleware: FormRequestClass | RouteHandler | GravitoMiddleware | GravitoMiddleware[], handler?: RouteHandler, options?: RouteOptions): Route;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Standard RESTful resource action names.
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export type ResourceAction = 'index' | 'create' | 'store' | 'show' | 'edit' | 'update' | 'destroy';
|
|
277
|
+
/**
|
|
278
|
+
* Options for resource route registration.
|
|
279
|
+
* @public
|
|
280
|
+
*/
|
|
281
|
+
export interface ResourceOptions {
|
|
282
|
+
only?: ResourceAction[];
|
|
283
|
+
except?: ResourceAction[];
|
|
284
|
+
}
|