@h3ravel/core 1.20.0 → 1.20.1
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/index.cjs +1 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/package.json +6 -6
- package/dist/index.d.cts +0 -483
package/dist/index.cjs
CHANGED
|
@@ -23,25 +23,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
//#endregion
|
|
24
24
|
require("reflect-metadata");
|
|
25
25
|
let __h3ravel_shared = require("@h3ravel/shared");
|
|
26
|
-
__h3ravel_shared = __toESM(__h3ravel_shared);
|
|
27
26
|
let __h3ravel_support = require("@h3ravel/support");
|
|
28
|
-
__h3ravel_support = __toESM(__h3ravel_support);
|
|
29
27
|
let fast_glob = require("fast-glob");
|
|
30
28
|
fast_glob = __toESM(fast_glob);
|
|
31
29
|
let node_path = require("node:path");
|
|
32
30
|
node_path = __toESM(node_path);
|
|
33
31
|
let detect_port = require("detect-port");
|
|
34
|
-
detect_port = __toESM(detect_port);
|
|
35
32
|
let dotenv = require("dotenv");
|
|
36
33
|
dotenv = __toESM(dotenv);
|
|
37
34
|
let dotenv_expand = require("dotenv-expand");
|
|
38
35
|
dotenv_expand = __toESM(dotenv_expand);
|
|
39
36
|
let node_fs_promises = require("node:fs/promises");
|
|
40
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
41
37
|
let semver = require("semver");
|
|
42
38
|
semver = __toESM(semver);
|
|
43
39
|
let __h3ravel_http = require("@h3ravel/http");
|
|
44
|
-
__h3ravel_http = __toESM(__h3ravel_http);
|
|
45
40
|
|
|
46
41
|
//#region src/Container.ts
|
|
47
42
|
var Container = class {
|
|
@@ -694,7 +689,7 @@ const h3ravel = async (providers = [], basePath = process.cwd(), config = {
|
|
|
694
689
|
app.context = async (event) => {
|
|
695
690
|
if (event._h3ravelContext) return event._h3ravelContext;
|
|
696
691
|
__h3ravel_http.Request.enableHttpMethodParameterOverride();
|
|
697
|
-
const ctx =
|
|
692
|
+
const ctx = __h3ravel_http.HttpContext.init({
|
|
698
693
|
app,
|
|
699
694
|
request: await __h3ravel_http.Request.create(event, app),
|
|
700
695
|
response: new __h3ravel_http.Response(event, app)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="./app.globals.d.ts" />
|
|
2
|
-
import "reflect-metadata";
|
|
3
2
|
import { Bindings, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IServiceProvider, PathLoader, UseKey } from "@h3ravel/shared";
|
|
4
3
|
import { H3, H3Event } from "h3";
|
|
4
|
+
import { HttpContext as HttpContext$1 } from "@h3ravel/http";
|
|
5
5
|
|
|
6
6
|
//#region src/Contracts/ServiceProviderConstructor.d.ts
|
|
7
7
|
type ServiceProviderConstructor = (new (app: Application) => ServiceProvider) & IServiceProvider;
|
|
@@ -318,7 +318,7 @@ config?: EntryConfig,
|
|
|
318
318
|
/**
|
|
319
319
|
* final middleware function to call once the server is fired up
|
|
320
320
|
*/
|
|
321
|
-
middleware?: (ctx: HttpContext) => Promise<unknown>) => Promise<Application>;
|
|
321
|
+
middleware?: (ctx: HttpContext$1) => Promise<unknown>) => Promise<Application>;
|
|
322
322
|
//#endregion
|
|
323
323
|
//#region src/Http/Kernel.d.ts
|
|
324
324
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import { FileSystem,
|
|
2
|
+
import { FileSystem, Logger, PathLoader } from "@h3ravel/shared";
|
|
3
3
|
import { InvalidArgumentException, Str, dd, dump, str } from "@h3ravel/support";
|
|
4
4
|
import fg from "fast-glob";
|
|
5
5
|
import path from "node:path";
|
|
@@ -8,7 +8,7 @@ import dotenv from "dotenv";
|
|
|
8
8
|
import dotenvExpand from "dotenv-expand";
|
|
9
9
|
import { readFile } from "node:fs/promises";
|
|
10
10
|
import semver from "semver";
|
|
11
|
-
import { LogRequests, Request, Response } from "@h3ravel/http";
|
|
11
|
+
import { HttpContext as HttpContext$1, LogRequests, Request, Response } from "@h3ravel/http";
|
|
12
12
|
|
|
13
13
|
//#region src/Container.ts
|
|
14
14
|
var Container = class {
|
|
@@ -661,7 +661,7 @@ const h3ravel = async (providers = [], basePath = process.cwd(), config = {
|
|
|
661
661
|
app.context = async (event) => {
|
|
662
662
|
if (event._h3ravelContext) return event._h3ravelContext;
|
|
663
663
|
Request.enableHttpMethodParameterOverride();
|
|
664
|
-
const ctx = HttpContext.init({
|
|
664
|
+
const ctx = HttpContext$1.init({
|
|
665
665
|
app,
|
|
666
666
|
request: await Request.create(event, app),
|
|
667
667
|
response: new Response(event, app)
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/core",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.1",
|
|
4
4
|
"description": "Core application container, lifecycle management and service providers for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"module": "./dist/index.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
11
|
"import": "./dist/index.js",
|
|
13
12
|
"require": "./dist/index.cjs"
|
|
14
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"./*": "./*"
|
|
15
15
|
},
|
|
16
16
|
"typesVersions": {
|
|
17
17
|
"*": {
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"semver": "^7.7.2",
|
|
55
55
|
"srvx": "^0.8.7",
|
|
56
56
|
"tslib": "^2.8.1",
|
|
57
|
-
"@h3ravel/
|
|
58
|
-
"@h3ravel/
|
|
57
|
+
"@h3ravel/shared": "^0.26.1",
|
|
58
|
+
"@h3ravel/support": "^0.14.5"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/semver": "^7.7.1",
|
package/dist/index.d.cts
DELETED
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
/// <reference path="./app.globals.d.ts" />
|
|
2
|
-
import { Bindings, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IServiceProvider, PathLoader, UseKey } from "@h3ravel/shared";
|
|
3
|
-
import { H3, H3Event } from "h3";
|
|
4
|
-
|
|
5
|
-
//#region src/Contracts/ServiceProviderConstructor.d.ts
|
|
6
|
-
type ServiceProviderConstructor = (new (app: Application) => ServiceProvider) & IServiceProvider;
|
|
7
|
-
type AServiceProvider = (new (_app: Application) => ServiceProvider) & Partial<ServiceProvider>;
|
|
8
|
-
type OServiceProvider = (new (_app: Application) => Partial<ServiceProvider>) & Partial<ServiceProvider>;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/Container.d.ts
|
|
11
|
-
type IBinding = UseKey | (new (..._args: any[]) => unknown);
|
|
12
|
-
declare class Container implements IContainer {
|
|
13
|
-
bindings: Map<IBinding, () => unknown>;
|
|
14
|
-
singletons: Map<IBinding, unknown>;
|
|
15
|
-
/**
|
|
16
|
-
* Check if the target has any decorators
|
|
17
|
-
*
|
|
18
|
-
* @param target
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
static hasAnyDecorator<C extends abstract new (...args: any[]) => any>(target: C): boolean;
|
|
22
|
-
static hasAnyDecorator<F extends (...args: any[]) => any>(target: F): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Bind a transient service to the container
|
|
25
|
-
*/
|
|
26
|
-
bind<T>(key: new (...args: any[]) => T, factory: () => T): void;
|
|
27
|
-
bind<T extends UseKey>(key: T, factory: () => Bindings[T]): void;
|
|
28
|
-
/**
|
|
29
|
-
* Remove one or more transient services from the container
|
|
30
|
-
*/
|
|
31
|
-
unbind<T extends UseKey>(key: T | T[]): void;
|
|
32
|
-
/**
|
|
33
|
-
* Bind a singleton service to the container
|
|
34
|
-
*/
|
|
35
|
-
singleton<T extends UseKey>(key: T | (new (..._args: any[]) => Bindings[T]), factory: (app: this) => Bindings[T]): void;
|
|
36
|
-
/**
|
|
37
|
-
* Resolve a service from the container
|
|
38
|
-
*/
|
|
39
|
-
make<T extends UseKey>(key: T): Bindings[T];
|
|
40
|
-
make<C extends abstract new (...args: any[]) => any>(key: C): InstanceType<C>;
|
|
41
|
-
make<F extends (...args: any[]) => any>(key: F): ReturnType<F>;
|
|
42
|
-
/**
|
|
43
|
-
* Automatically build a class with constructor dependency injection
|
|
44
|
-
*/
|
|
45
|
-
private build;
|
|
46
|
-
/**
|
|
47
|
-
* Check if a service is registered
|
|
48
|
-
*/
|
|
49
|
-
has(key: UseKey): boolean;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/ServiceProvider.d.ts
|
|
53
|
-
declare const Inference: {
|
|
54
|
-
new (): IServiceProvider;
|
|
55
|
-
};
|
|
56
|
-
declare abstract class ServiceProvider extends Inference {
|
|
57
|
-
/**
|
|
58
|
-
* The current app instance
|
|
59
|
-
*/
|
|
60
|
-
protected app: Application;
|
|
61
|
-
/**
|
|
62
|
-
* Unique Identifier for the service providers
|
|
63
|
-
*/
|
|
64
|
-
static uid?: number;
|
|
65
|
-
/**
|
|
66
|
-
* Sort order
|
|
67
|
-
*/
|
|
68
|
-
static order?: `before:${string}` | `after:${string}` | string | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Sort priority
|
|
71
|
-
*/
|
|
72
|
-
static priority: number;
|
|
73
|
-
/**
|
|
74
|
-
* Indicate that this service provider only runs in console
|
|
75
|
-
*/
|
|
76
|
-
static console: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* List of registered console commands
|
|
79
|
-
*/
|
|
80
|
-
registeredCommands?: (new (app: any, kernel: any) => any)[];
|
|
81
|
-
constructor(app: Application);
|
|
82
|
-
/**
|
|
83
|
-
* Register bindings to the container.
|
|
84
|
-
* Runs before boot().
|
|
85
|
-
*/
|
|
86
|
-
abstract register(...app: unknown[]): void | Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Perform post-registration booting of services.
|
|
89
|
-
* Runs after all providers have been registered.
|
|
90
|
-
*/
|
|
91
|
-
boot?(...app: unknown[]): void | Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Register the listed service providers.
|
|
94
|
-
*
|
|
95
|
-
* @param commands An array of console commands to register.
|
|
96
|
-
*
|
|
97
|
-
* @deprecated since version 1.16.0. Will be removed in future versions, use `registerCommands` instead
|
|
98
|
-
*/
|
|
99
|
-
commands(commands: (new (app: any, kernel: any) => any)[]): void;
|
|
100
|
-
/**
|
|
101
|
-
* Register the listed service providers.
|
|
102
|
-
*
|
|
103
|
-
* @param commands An array of console commands to register.
|
|
104
|
-
*/
|
|
105
|
-
registerCommands(commands: (new (app: any, kernel: any) => any)[]): void;
|
|
106
|
-
}
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/Application.d.ts
|
|
109
|
-
declare class Application extends Container implements IApplication {
|
|
110
|
-
paths: PathLoader;
|
|
111
|
-
context?: (event: H3Event) => Promise<HttpContext>;
|
|
112
|
-
private tries;
|
|
113
|
-
private booted;
|
|
114
|
-
private basePath;
|
|
115
|
-
private versions;
|
|
116
|
-
private static versions;
|
|
117
|
-
private providers;
|
|
118
|
-
protected externalProviders: Array<AServiceProvider>;
|
|
119
|
-
protected filteredProviders: Array<string>;
|
|
120
|
-
/**
|
|
121
|
-
* List of registered console commands
|
|
122
|
-
*/
|
|
123
|
-
registeredCommands: (new (app: any, kernel: any) => any)[];
|
|
124
|
-
constructor(basePath: string);
|
|
125
|
-
/**
|
|
126
|
-
* Register core bindings into the container
|
|
127
|
-
*/
|
|
128
|
-
protected registerBaseBindings(): void;
|
|
129
|
-
protected loadOptions(): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* Get all registered providers
|
|
132
|
-
*/
|
|
133
|
-
getRegisteredProviders(): ServiceProvider[];
|
|
134
|
-
/**
|
|
135
|
-
* Load default and optional providers dynamically
|
|
136
|
-
*
|
|
137
|
-
* Auto-Registration Behavior
|
|
138
|
-
*
|
|
139
|
-
* Minimal App: Loads only core, config, http, router by default.
|
|
140
|
-
* Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.
|
|
141
|
-
*/
|
|
142
|
-
protected getConfiguredProviders(): Promise<Array<AServiceProvider>>;
|
|
143
|
-
protected getAllProviders(): Promise<Array<AServiceProvider>>;
|
|
144
|
-
/**
|
|
145
|
-
* Configure and Dynamically register all configured service providers, then boot the app.
|
|
146
|
-
*
|
|
147
|
-
* @param providers All regitererable service providers
|
|
148
|
-
* @param filtered A list of service provider name strings we do not want to register at all cost
|
|
149
|
-
* @param autoRegisterProviders If set to false, service providers will not be auto discovered and registered.
|
|
150
|
-
*
|
|
151
|
-
* @returns
|
|
152
|
-
*/
|
|
153
|
-
quickStartup(providers: Array<AServiceProvider>, filtered?: string[], autoRegisterProviders?: boolean): Promise<this>;
|
|
154
|
-
/**
|
|
155
|
-
* Dynamically register all configured providers
|
|
156
|
-
*
|
|
157
|
-
* @param autoRegister If set to false, service providers will not be auto discovered and registered.
|
|
158
|
-
*/
|
|
159
|
-
registerConfiguredProviders(autoRegister?: boolean): Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* Register service providers
|
|
162
|
-
*
|
|
163
|
-
* @param providers
|
|
164
|
-
* @param filtered
|
|
165
|
-
*/
|
|
166
|
-
registerProviders(providers: Array<AServiceProvider>, filtered?: string[]): void;
|
|
167
|
-
/**
|
|
168
|
-
* Register a provider
|
|
169
|
-
*/
|
|
170
|
-
register(provider: ServiceProvider): Promise<void>;
|
|
171
|
-
/**
|
|
172
|
-
* Register the listed service providers.
|
|
173
|
-
*
|
|
174
|
-
* @param commands An array of console commands to register.
|
|
175
|
-
*/
|
|
176
|
-
withCommands(commands: (new (app: any, kernel: any) => any)[]): this;
|
|
177
|
-
/**
|
|
178
|
-
* checks if the application is running in CLI
|
|
179
|
-
*/
|
|
180
|
-
runningInConsole(): boolean;
|
|
181
|
-
getRuntimeEnv(): 'browser' | 'node' | 'unknown';
|
|
182
|
-
/**
|
|
183
|
-
* Boot all service providers after registration
|
|
184
|
-
*/
|
|
185
|
-
boot(): Promise<this>;
|
|
186
|
-
/**
|
|
187
|
-
* Fire up the developement server using the user provided arguments
|
|
188
|
-
*
|
|
189
|
-
* Port will be auto assigned if provided one is not available
|
|
190
|
-
*
|
|
191
|
-
* @param h3App The current H3 app instance
|
|
192
|
-
* @param preferedPort If provided, this will overide the port set in the evironment
|
|
193
|
-
*/
|
|
194
|
-
fire(): Promise<this>;
|
|
195
|
-
fire(h3App: H3, preferredPort?: number): Promise<this>;
|
|
196
|
-
/**
|
|
197
|
-
* Get the base path of the app
|
|
198
|
-
*
|
|
199
|
-
* @returns
|
|
200
|
-
*/
|
|
201
|
-
getBasePath(): string;
|
|
202
|
-
/**
|
|
203
|
-
* Dynamically retrieves a path property from the class.
|
|
204
|
-
* Any property ending with "Path" is accessible automatically.
|
|
205
|
-
*
|
|
206
|
-
* @param name - The base name of the path property
|
|
207
|
-
* @returns
|
|
208
|
-
*/
|
|
209
|
-
getPath(name: IPathName, suffix?: string): string;
|
|
210
|
-
/**
|
|
211
|
-
* Programatically set the paths.
|
|
212
|
-
*
|
|
213
|
-
* @param name - The base name of the path property
|
|
214
|
-
* @param path - The new path
|
|
215
|
-
* @returns
|
|
216
|
-
*/
|
|
217
|
-
setPath(name: IPathName, path: string): void;
|
|
218
|
-
/**
|
|
219
|
-
* Returns the installed version of the system core and typescript.
|
|
220
|
-
*
|
|
221
|
-
* @returns
|
|
222
|
-
*/
|
|
223
|
-
getVersion(key: string): string;
|
|
224
|
-
/**
|
|
225
|
-
* Returns the installed version of the system core and typescript.
|
|
226
|
-
*
|
|
227
|
-
* @returns
|
|
228
|
-
*/
|
|
229
|
-
static getVersion(key: string): string;
|
|
230
|
-
}
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region src/Contracts/H3ravelContract.d.ts
|
|
233
|
-
interface EntryConfig {
|
|
234
|
-
/**
|
|
235
|
-
* @param h3 You can provide your own `H3` app instance, this is usefull when `@h3ravel/http`
|
|
236
|
-
* is not installed.
|
|
237
|
-
*/
|
|
238
|
-
h3?: H3;
|
|
239
|
-
/**
|
|
240
|
-
* Determines if we should initialize the app on call.
|
|
241
|
-
*
|
|
242
|
-
* @default false
|
|
243
|
-
*/
|
|
244
|
-
initialize?: boolean;
|
|
245
|
-
/**
|
|
246
|
-
* Determines if service providers should be auto discovered and registered or not.
|
|
247
|
-
*
|
|
248
|
-
* @default false
|
|
249
|
-
*/
|
|
250
|
-
autoload?: boolean;
|
|
251
|
-
/**
|
|
252
|
-
* A list of service provider name strings we do not want to register at all cost
|
|
253
|
-
*
|
|
254
|
-
* @default []
|
|
255
|
-
*/
|
|
256
|
-
filteredProviders?: string[];
|
|
257
|
-
}
|
|
258
|
-
//#endregion
|
|
259
|
-
//#region src/Controller.d.ts
|
|
260
|
-
/**
|
|
261
|
-
* Base controller class
|
|
262
|
-
*/
|
|
263
|
-
declare abstract class Controller implements IController {
|
|
264
|
-
protected app: Application;
|
|
265
|
-
constructor(app: Application);
|
|
266
|
-
show?(..._ctx: any[]): any;
|
|
267
|
-
index?(..._ctx: any[]): any;
|
|
268
|
-
store?(..._ctx: any[]): any;
|
|
269
|
-
update?(..._ctx: any[]): any;
|
|
270
|
-
destroy?(..._ctx: any[]): any;
|
|
271
|
-
}
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/Di/ContainerResolver.d.ts
|
|
274
|
-
declare class ContainerResolver {
|
|
275
|
-
private app;
|
|
276
|
-
constructor(app: Application);
|
|
277
|
-
resolveMethodParams<I extends Record<string, any>>(instance: I, method: keyof I, ..._default: any[]): Promise<I>;
|
|
278
|
-
static isClass(C: any): boolean;
|
|
279
|
-
}
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region src/Di/Inject.d.ts
|
|
282
|
-
declare function Inject(...dependencies: string[]): (target: any) => void;
|
|
283
|
-
/**
|
|
284
|
-
* Allows binding dependencies to both class and class methods
|
|
285
|
-
*
|
|
286
|
-
* @returns
|
|
287
|
-
*/
|
|
288
|
-
declare function Injectable(): ClassDecorator & MethodDecorator;
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region src/Exceptions/ConfigException.d.ts
|
|
291
|
-
declare class ConfigException extends Error {
|
|
292
|
-
key: string;
|
|
293
|
-
constructor(key: string, type?: 'any' | 'config' | 'env', cause?: unknown);
|
|
294
|
-
}
|
|
295
|
-
//#endregion
|
|
296
|
-
//#region src/H3ravel.d.ts
|
|
297
|
-
/**
|
|
298
|
-
* Simple global entry point for H3ravel applications
|
|
299
|
-
*
|
|
300
|
-
* @param providers
|
|
301
|
-
* @param basePath
|
|
302
|
-
* @param callback
|
|
303
|
-
*/
|
|
304
|
-
declare const h3ravel: (
|
|
305
|
-
/**
|
|
306
|
-
* List of intial service providers to register with your app
|
|
307
|
-
*/
|
|
308
|
-
providers?: Exclude<OServiceProvider, "app" | "commands">[],
|
|
309
|
-
/**
|
|
310
|
-
* Entry path of your app
|
|
311
|
-
*/
|
|
312
|
-
basePath?: string,
|
|
313
|
-
/**
|
|
314
|
-
* Configuration option to pass to the initializer
|
|
315
|
-
*/
|
|
316
|
-
config?: EntryConfig,
|
|
317
|
-
/**
|
|
318
|
-
* final middleware function to call once the server is fired up
|
|
319
|
-
*/
|
|
320
|
-
middleware?: (ctx: HttpContext) => Promise<unknown>) => Promise<Application>;
|
|
321
|
-
//#endregion
|
|
322
|
-
//#region src/Http/Kernel.d.ts
|
|
323
|
-
/**
|
|
324
|
-
* Kernel class handles middleware execution and response transformations.
|
|
325
|
-
* It acts as the core middleware pipeline for HTTP requests.
|
|
326
|
-
*/
|
|
327
|
-
declare class Kernel {
|
|
328
|
-
protected context: (event: H3Event) => HttpContext | Promise<HttpContext>;
|
|
329
|
-
protected middleware: IMiddleware[];
|
|
330
|
-
/**
|
|
331
|
-
* @param context - A factory function that converts an H3Event into an HttpContext.
|
|
332
|
-
* @param middleware - An array of middleware classes that will be executed in sequence.
|
|
333
|
-
*/
|
|
334
|
-
constructor(context: (event: H3Event) => HttpContext | Promise<HttpContext>, middleware?: IMiddleware[]);
|
|
335
|
-
/**
|
|
336
|
-
* Handles an incoming request and passes it through middleware before invoking the next handler.
|
|
337
|
-
*
|
|
338
|
-
* @param event - The raw H3 event object.
|
|
339
|
-
* @param next - A callback function that represents the next layer (usually the controller or final handler).
|
|
340
|
-
* @returns A promise resolving to the result of the request pipeline.
|
|
341
|
-
*/
|
|
342
|
-
handle(event: H3Event, next: (ctx: HttpContext) => Promise<unknown>): Promise<unknown>;
|
|
343
|
-
/**
|
|
344
|
-
* Sequentially runs middleware in the order they were registered.
|
|
345
|
-
*
|
|
346
|
-
* @param context - The standardized HttpContext.
|
|
347
|
-
* @param next - Callback to execute when middleware completes.
|
|
348
|
-
* @returns A promise resolving to the final handler's result.
|
|
349
|
-
*/
|
|
350
|
-
private runMiddleware;
|
|
351
|
-
/**
|
|
352
|
-
* Utility function to determine if a value is a plain object or array.
|
|
353
|
-
*
|
|
354
|
-
* @param value - The value to check.
|
|
355
|
-
* @returns True if the value is a plain object or array, otherwise false.
|
|
356
|
-
*/
|
|
357
|
-
private isPlainObject;
|
|
358
|
-
}
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region src/ProviderRegistry.d.ts
|
|
361
|
-
type ProviderCtor = (new (_app: Application) => ServiceProvider) & Partial<ServiceProvider>;
|
|
362
|
-
declare class ProviderRegistry {
|
|
363
|
-
private static providers;
|
|
364
|
-
private static priorityMap;
|
|
365
|
-
private static filteredProviders;
|
|
366
|
-
private static sortable;
|
|
367
|
-
/**
|
|
368
|
-
* Set wether providers should be sorted or not.
|
|
369
|
-
*
|
|
370
|
-
* @returns
|
|
371
|
-
*/
|
|
372
|
-
static setSortable(sort?: boolean): void;
|
|
373
|
-
/**
|
|
374
|
-
* Get a unique identifier for the Provider.
|
|
375
|
-
*
|
|
376
|
-
* @param provider
|
|
377
|
-
* @returns
|
|
378
|
-
*/
|
|
379
|
-
private static getKey;
|
|
380
|
-
/**
|
|
381
|
-
* Register one or more providers.
|
|
382
|
-
* Duplicate constructors will be ignored.
|
|
383
|
-
*
|
|
384
|
-
* @param providers
|
|
385
|
-
* @returns
|
|
386
|
-
*/
|
|
387
|
-
static register(...providers: ProviderCtor[]): void;
|
|
388
|
-
/**
|
|
389
|
-
* Bulk register providers from an array.
|
|
390
|
-
*
|
|
391
|
-
* @param providers
|
|
392
|
-
* @returns
|
|
393
|
-
*/
|
|
394
|
-
static registerMany(providers: ProviderCtor[]): void;
|
|
395
|
-
/**
|
|
396
|
-
* Set the filtered providers.
|
|
397
|
-
*
|
|
398
|
-
* @returns
|
|
399
|
-
*/
|
|
400
|
-
static setFiltered(filtered: string[]): void;
|
|
401
|
-
/**
|
|
402
|
-
* Resolve (instantiate) all providers with the given application or Service Container.
|
|
403
|
-
*
|
|
404
|
-
* @param app
|
|
405
|
-
* @returns
|
|
406
|
-
*/
|
|
407
|
-
static resolve(app: Application, useServiceContainer?: boolean): Promise<ServiceProvider[]>;
|
|
408
|
-
/**
|
|
409
|
-
* Sort the service providers
|
|
410
|
-
*
|
|
411
|
-
* @param providers
|
|
412
|
-
* @returns
|
|
413
|
-
*/
|
|
414
|
-
static sort(providers: ProviderCtor[]): ProviderCtor[];
|
|
415
|
-
/**
|
|
416
|
-
* Sort service providers
|
|
417
|
-
*/
|
|
418
|
-
static doSort(): void;
|
|
419
|
-
/**
|
|
420
|
-
* Log the service providers in a table
|
|
421
|
-
*
|
|
422
|
-
* @param priorityMap
|
|
423
|
-
*/
|
|
424
|
-
static log<P extends ServiceProvider>(providers?: Array<P> | Map<string, P>): void;
|
|
425
|
-
/**
|
|
426
|
-
* Get all registered providers as an array.
|
|
427
|
-
*
|
|
428
|
-
* @returns
|
|
429
|
-
*/
|
|
430
|
-
static all(): ProviderCtor[];
|
|
431
|
-
/**
|
|
432
|
-
* Check if a provider is already registered.
|
|
433
|
-
*
|
|
434
|
-
* @param provider
|
|
435
|
-
* @returns
|
|
436
|
-
*/
|
|
437
|
-
static has(provider: ProviderCtor): boolean;
|
|
438
|
-
/**
|
|
439
|
-
* Automatically search for and discover service providers in packages.
|
|
440
|
-
*
|
|
441
|
-
* @param autoRegister
|
|
442
|
-
* @returns
|
|
443
|
-
*/
|
|
444
|
-
static discoverProviders(autoRegister?: boolean): Promise<ProviderCtor[]>;
|
|
445
|
-
/**
|
|
446
|
-
* Get the content of the package.json file
|
|
447
|
-
*
|
|
448
|
-
* @param manifestPath
|
|
449
|
-
* @returns
|
|
450
|
-
*/
|
|
451
|
-
private static getManifest;
|
|
452
|
-
}
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/Providers/CoreServiceProvider.d.ts
|
|
455
|
-
/**
|
|
456
|
-
* Bootstraps core services and bindings.
|
|
457
|
-
*
|
|
458
|
-
* Bind essential services to the container (logger, config repository).
|
|
459
|
-
* Register app-level singletons.
|
|
460
|
-
* Set up exception handling.
|
|
461
|
-
*
|
|
462
|
-
* Auto-Registered
|
|
463
|
-
*/
|
|
464
|
-
declare class CoreServiceProvider extends ServiceProvider {
|
|
465
|
-
static priority: number;
|
|
466
|
-
register(): void;
|
|
467
|
-
boot(): void | Promise<void>;
|
|
468
|
-
}
|
|
469
|
-
//#endregion
|
|
470
|
-
//#region src/Registerer.d.ts
|
|
471
|
-
declare class Registerer {
|
|
472
|
-
private app;
|
|
473
|
-
constructor(app: Application);
|
|
474
|
-
static register(app: Application): void;
|
|
475
|
-
bootRegister(): void;
|
|
476
|
-
private appPath;
|
|
477
|
-
private basePath;
|
|
478
|
-
private publicPath;
|
|
479
|
-
private storagePath;
|
|
480
|
-
private databasePath;
|
|
481
|
-
}
|
|
482
|
-
//#endregion
|
|
483
|
-
export { AServiceProvider, Application, ConfigException, Container, ContainerResolver, Controller, CoreServiceProvider, EntryConfig, Inject, Injectable, Kernel, OServiceProvider, ProviderRegistry, Registerer, ServiceProvider, ServiceProviderConstructor, h3ravel };
|