@h3ravel/config 1.3.7 → 1.4.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/README.md +13 -1
- package/dist/index.cjs +2908 -21832
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +228 -29
- package/dist/index.d.ts +228 -29
- package/dist/index.js +2913 -83
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/dist/chunk-Q3X4OHHO.js +0 -21416
- package/dist/chunk-Q3X4OHHO.js.map +0 -1
- package/dist/dist-SOP64AJE.js +0 -25
- package/dist/dist-SOP64AJE.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,33 +1,231 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference path="./app.globals.d.ts" />
|
|
2
|
+
import { DotNestedKeys, DotNestedValue, PathLoader } from "@h3ravel/shared";
|
|
3
3
|
|
|
4
|
+
//#region ../core/dist/index.d.ts
|
|
5
|
+
declare var Application: {
|
|
6
|
+
new (basePath: any): {
|
|
7
|
+
paths: PathLoader;
|
|
8
|
+
tries: number;
|
|
9
|
+
booted: boolean;
|
|
10
|
+
versions: {
|
|
11
|
+
app: string;
|
|
12
|
+
ts: string;
|
|
13
|
+
};
|
|
14
|
+
basePath: any;
|
|
15
|
+
providers: any[];
|
|
16
|
+
externalProviders: any[];
|
|
17
|
+
/**
|
|
18
|
+
* List of registered console commands
|
|
19
|
+
*/
|
|
20
|
+
registeredCommands: any[];
|
|
21
|
+
/**
|
|
22
|
+
* Register core bindings into the container
|
|
23
|
+
*/
|
|
24
|
+
registerBaseBindings(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Dynamically register all configured providers
|
|
27
|
+
*/
|
|
28
|
+
registerConfiguredProviders(): Promise<void>;
|
|
29
|
+
loadOptions(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get all registered providers
|
|
32
|
+
*/
|
|
33
|
+
getRegisteredProviders(): any[];
|
|
34
|
+
/**
|
|
35
|
+
* Load default and optional providers dynamically
|
|
36
|
+
*
|
|
37
|
+
* Auto-Registration Behavior
|
|
38
|
+
*
|
|
39
|
+
* Minimal App: Loads only core, config, http, router by default.
|
|
40
|
+
* Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.
|
|
41
|
+
*/
|
|
42
|
+
getConfiguredProviders(): Promise<typeof CoreServiceProvider[]>;
|
|
43
|
+
getAllProviders(): Promise<any>;
|
|
44
|
+
sortProviders(providers: any): any;
|
|
45
|
+
registerProviders(providers: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Register a provider
|
|
48
|
+
*/
|
|
49
|
+
register(provider: any): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* checks if the application is running in CLI
|
|
52
|
+
*/
|
|
53
|
+
runningInConsole(): boolean;
|
|
54
|
+
getRuntimeEnv(): "browser" | "node" | "unknown";
|
|
55
|
+
/**
|
|
56
|
+
* Boot all service providers after registration
|
|
57
|
+
*/
|
|
58
|
+
boot(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Fire up the developement server using the user provided arguments
|
|
61
|
+
*
|
|
62
|
+
* Port will be auto assigned if provided one is not available
|
|
63
|
+
*
|
|
64
|
+
* @param h3App The current H3 app instance
|
|
65
|
+
* @param preferedPort If provided, this will overide the port set in the evironment
|
|
66
|
+
*/
|
|
67
|
+
fire(h3App: any, preferedPort: any): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Attempt to dynamically import an optional module
|
|
70
|
+
*/
|
|
71
|
+
safeImport(moduleName: any): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* Get the base path of the app
|
|
74
|
+
*
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
getBasePath(): any;
|
|
78
|
+
/**
|
|
79
|
+
* Dynamically retrieves a path property from the class.
|
|
80
|
+
* Any property ending with "Path" is accessible automatically.
|
|
81
|
+
*
|
|
82
|
+
* @param name - The base name of the path property
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
getPath(name: any, suffix: any): string;
|
|
86
|
+
/**
|
|
87
|
+
* Programatically set the paths.
|
|
88
|
+
*
|
|
89
|
+
* @param name - The base name of the path property
|
|
90
|
+
* @param path - The new path
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
setPath(name: any, path$1: any): void;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the installed version of the system core and typescript.
|
|
96
|
+
*
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
getVersion(key: any): any;
|
|
100
|
+
bindings: Map<any, any>;
|
|
101
|
+
singletons: Map<any, any>;
|
|
102
|
+
bind(key: any, factory: any): void;
|
|
103
|
+
/**
|
|
104
|
+
* Bind a singleton service to the container
|
|
105
|
+
*/
|
|
106
|
+
singleton(key: any, factory: any): void;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve a service from the container
|
|
109
|
+
*/
|
|
110
|
+
make(key: any): any;
|
|
111
|
+
/**
|
|
112
|
+
* Automatically build a class with constructor dependency injection
|
|
113
|
+
*/
|
|
114
|
+
build(ClassType: any): any;
|
|
115
|
+
/**
|
|
116
|
+
* Check if a service is registered
|
|
117
|
+
*/
|
|
118
|
+
has(key: any): boolean;
|
|
119
|
+
};
|
|
120
|
+
versions: {
|
|
121
|
+
app: string;
|
|
122
|
+
ts: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Returns the installed version of the system core and typescript.
|
|
126
|
+
*
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
getVersion(key: any): any;
|
|
130
|
+
/**
|
|
131
|
+
* Check if the target has any decorators
|
|
132
|
+
*
|
|
133
|
+
* @param target
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
hasAnyDecorator(target: any): boolean;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Bootstraps core services and bindings.
|
|
140
|
+
*
|
|
141
|
+
* Bind essential services to the container (logger, config repository).
|
|
142
|
+
* Register app-level singletons.
|
|
143
|
+
* Set up exception handling.
|
|
144
|
+
*
|
|
145
|
+
* Auto-Registered
|
|
146
|
+
*/
|
|
147
|
+
declare var CoreServiceProvider: {
|
|
148
|
+
new (app: any): {
|
|
149
|
+
register(): void;
|
|
150
|
+
/**
|
|
151
|
+
* List of registered console commands
|
|
152
|
+
*/
|
|
153
|
+
registeredCommands: any;
|
|
154
|
+
app: any;
|
|
155
|
+
/**
|
|
156
|
+
* An array of console commands to register.
|
|
157
|
+
*/
|
|
158
|
+
commands(commands: any): void;
|
|
159
|
+
};
|
|
160
|
+
priority: number;
|
|
161
|
+
/**
|
|
162
|
+
* Sort order
|
|
163
|
+
*/
|
|
164
|
+
order: any;
|
|
165
|
+
/**
|
|
166
|
+
* Indicate that this service provider only runs in console
|
|
167
|
+
*/
|
|
168
|
+
console: boolean;
|
|
169
|
+
};
|
|
170
|
+
declare var ServiceProvider: {
|
|
171
|
+
new (app: any): {
|
|
172
|
+
/**
|
|
173
|
+
* List of registered console commands
|
|
174
|
+
*/
|
|
175
|
+
registeredCommands: any;
|
|
176
|
+
app: any;
|
|
177
|
+
/**
|
|
178
|
+
* An array of console commands to register.
|
|
179
|
+
*/
|
|
180
|
+
commands(commands: any): void;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Sort order
|
|
184
|
+
*/
|
|
185
|
+
order: any;
|
|
186
|
+
/**
|
|
187
|
+
* Sort priority
|
|
188
|
+
*/
|
|
189
|
+
priority: number;
|
|
190
|
+
/**
|
|
191
|
+
* Indicate that this service provider only runs in console
|
|
192
|
+
*/
|
|
193
|
+
console: boolean;
|
|
194
|
+
};
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/ConfigRepository.d.ts
|
|
4
197
|
declare class ConfigRepository {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
198
|
+
protected app: Application;
|
|
199
|
+
private loaded;
|
|
200
|
+
private configs;
|
|
201
|
+
constructor(app: Application);
|
|
202
|
+
/**
|
|
203
|
+
* Get the defined configurations
|
|
204
|
+
*/
|
|
205
|
+
get<X extends Record<string, any>>(): X;
|
|
206
|
+
get<X extends Record<string, any>, K extends DotNestedKeys<X>>(key: K, def?: any): DotNestedValue<X, K>;
|
|
207
|
+
/**
|
|
208
|
+
* Modify the defined configurations
|
|
209
|
+
*/
|
|
210
|
+
set<T extends string>(key: T, value: any): void;
|
|
211
|
+
load(): Promise<this>;
|
|
19
212
|
}
|
|
20
|
-
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/EnvLoader.d.ts
|
|
21
215
|
declare class EnvLoader {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
216
|
+
protected _app: Application;
|
|
217
|
+
constructor(_app: Application);
|
|
218
|
+
/**
|
|
219
|
+
* Get the defined environment vars
|
|
220
|
+
*/
|
|
221
|
+
get<X extends NodeJS.ProcessEnv>(): X;
|
|
222
|
+
get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>>(key: K, def?: any): DotNestedValue<X, K>;
|
|
29
223
|
}
|
|
30
|
-
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/Helpers.d.ts
|
|
226
|
+
declare class Helpers {}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/Providers/ConfigServiceProvider.d.ts
|
|
31
229
|
/**
|
|
32
230
|
* Loads configuration and environment files.
|
|
33
231
|
*
|
|
@@ -37,8 +235,9 @@ declare class EnvLoader {
|
|
|
37
235
|
* Auto-Registered
|
|
38
236
|
*/
|
|
39
237
|
declare class ConfigServiceProvider extends ServiceProvider {
|
|
40
|
-
|
|
41
|
-
|
|
238
|
+
static priority: number;
|
|
239
|
+
register(): Promise<void>;
|
|
42
240
|
}
|
|
43
|
-
|
|
44
|
-
export { ConfigRepository, ConfigServiceProvider, EnvLoader };
|
|
241
|
+
//#endregion
|
|
242
|
+
export { ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
|
|
243
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,231 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference path="./app.globals.d.ts" />
|
|
2
|
+
import { DotNestedKeys, DotNestedValue, PathLoader } from "@h3ravel/shared";
|
|
3
3
|
|
|
4
|
+
//#region ../core/dist/index.d.ts
|
|
5
|
+
declare var Application: {
|
|
6
|
+
new (basePath: any): {
|
|
7
|
+
paths: PathLoader;
|
|
8
|
+
tries: number;
|
|
9
|
+
booted: boolean;
|
|
10
|
+
versions: {
|
|
11
|
+
app: string;
|
|
12
|
+
ts: string;
|
|
13
|
+
};
|
|
14
|
+
basePath: any;
|
|
15
|
+
providers: any[];
|
|
16
|
+
externalProviders: any[];
|
|
17
|
+
/**
|
|
18
|
+
* List of registered console commands
|
|
19
|
+
*/
|
|
20
|
+
registeredCommands: any[];
|
|
21
|
+
/**
|
|
22
|
+
* Register core bindings into the container
|
|
23
|
+
*/
|
|
24
|
+
registerBaseBindings(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Dynamically register all configured providers
|
|
27
|
+
*/
|
|
28
|
+
registerConfiguredProviders(): Promise<void>;
|
|
29
|
+
loadOptions(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get all registered providers
|
|
32
|
+
*/
|
|
33
|
+
getRegisteredProviders(): any[];
|
|
34
|
+
/**
|
|
35
|
+
* Load default and optional providers dynamically
|
|
36
|
+
*
|
|
37
|
+
* Auto-Registration Behavior
|
|
38
|
+
*
|
|
39
|
+
* Minimal App: Loads only core, config, http, router by default.
|
|
40
|
+
* Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.
|
|
41
|
+
*/
|
|
42
|
+
getConfiguredProviders(): Promise<typeof CoreServiceProvider[]>;
|
|
43
|
+
getAllProviders(): Promise<any>;
|
|
44
|
+
sortProviders(providers: any): any;
|
|
45
|
+
registerProviders(providers: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Register a provider
|
|
48
|
+
*/
|
|
49
|
+
register(provider: any): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* checks if the application is running in CLI
|
|
52
|
+
*/
|
|
53
|
+
runningInConsole(): boolean;
|
|
54
|
+
getRuntimeEnv(): "browser" | "node" | "unknown";
|
|
55
|
+
/**
|
|
56
|
+
* Boot all service providers after registration
|
|
57
|
+
*/
|
|
58
|
+
boot(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Fire up the developement server using the user provided arguments
|
|
61
|
+
*
|
|
62
|
+
* Port will be auto assigned if provided one is not available
|
|
63
|
+
*
|
|
64
|
+
* @param h3App The current H3 app instance
|
|
65
|
+
* @param preferedPort If provided, this will overide the port set in the evironment
|
|
66
|
+
*/
|
|
67
|
+
fire(h3App: any, preferedPort: any): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Attempt to dynamically import an optional module
|
|
70
|
+
*/
|
|
71
|
+
safeImport(moduleName: any): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* Get the base path of the app
|
|
74
|
+
*
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
getBasePath(): any;
|
|
78
|
+
/**
|
|
79
|
+
* Dynamically retrieves a path property from the class.
|
|
80
|
+
* Any property ending with "Path" is accessible automatically.
|
|
81
|
+
*
|
|
82
|
+
* @param name - The base name of the path property
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
getPath(name: any, suffix: any): string;
|
|
86
|
+
/**
|
|
87
|
+
* Programatically set the paths.
|
|
88
|
+
*
|
|
89
|
+
* @param name - The base name of the path property
|
|
90
|
+
* @param path - The new path
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
setPath(name: any, path$1: any): void;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the installed version of the system core and typescript.
|
|
96
|
+
*
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
getVersion(key: any): any;
|
|
100
|
+
bindings: Map<any, any>;
|
|
101
|
+
singletons: Map<any, any>;
|
|
102
|
+
bind(key: any, factory: any): void;
|
|
103
|
+
/**
|
|
104
|
+
* Bind a singleton service to the container
|
|
105
|
+
*/
|
|
106
|
+
singleton(key: any, factory: any): void;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve a service from the container
|
|
109
|
+
*/
|
|
110
|
+
make(key: any): any;
|
|
111
|
+
/**
|
|
112
|
+
* Automatically build a class with constructor dependency injection
|
|
113
|
+
*/
|
|
114
|
+
build(ClassType: any): any;
|
|
115
|
+
/**
|
|
116
|
+
* Check if a service is registered
|
|
117
|
+
*/
|
|
118
|
+
has(key: any): boolean;
|
|
119
|
+
};
|
|
120
|
+
versions: {
|
|
121
|
+
app: string;
|
|
122
|
+
ts: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Returns the installed version of the system core and typescript.
|
|
126
|
+
*
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
getVersion(key: any): any;
|
|
130
|
+
/**
|
|
131
|
+
* Check if the target has any decorators
|
|
132
|
+
*
|
|
133
|
+
* @param target
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
hasAnyDecorator(target: any): boolean;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Bootstraps core services and bindings.
|
|
140
|
+
*
|
|
141
|
+
* Bind essential services to the container (logger, config repository).
|
|
142
|
+
* Register app-level singletons.
|
|
143
|
+
* Set up exception handling.
|
|
144
|
+
*
|
|
145
|
+
* Auto-Registered
|
|
146
|
+
*/
|
|
147
|
+
declare var CoreServiceProvider: {
|
|
148
|
+
new (app: any): {
|
|
149
|
+
register(): void;
|
|
150
|
+
/**
|
|
151
|
+
* List of registered console commands
|
|
152
|
+
*/
|
|
153
|
+
registeredCommands: any;
|
|
154
|
+
app: any;
|
|
155
|
+
/**
|
|
156
|
+
* An array of console commands to register.
|
|
157
|
+
*/
|
|
158
|
+
commands(commands: any): void;
|
|
159
|
+
};
|
|
160
|
+
priority: number;
|
|
161
|
+
/**
|
|
162
|
+
* Sort order
|
|
163
|
+
*/
|
|
164
|
+
order: any;
|
|
165
|
+
/**
|
|
166
|
+
* Indicate that this service provider only runs in console
|
|
167
|
+
*/
|
|
168
|
+
console: boolean;
|
|
169
|
+
};
|
|
170
|
+
declare var ServiceProvider: {
|
|
171
|
+
new (app: any): {
|
|
172
|
+
/**
|
|
173
|
+
* List of registered console commands
|
|
174
|
+
*/
|
|
175
|
+
registeredCommands: any;
|
|
176
|
+
app: any;
|
|
177
|
+
/**
|
|
178
|
+
* An array of console commands to register.
|
|
179
|
+
*/
|
|
180
|
+
commands(commands: any): void;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Sort order
|
|
184
|
+
*/
|
|
185
|
+
order: any;
|
|
186
|
+
/**
|
|
187
|
+
* Sort priority
|
|
188
|
+
*/
|
|
189
|
+
priority: number;
|
|
190
|
+
/**
|
|
191
|
+
* Indicate that this service provider only runs in console
|
|
192
|
+
*/
|
|
193
|
+
console: boolean;
|
|
194
|
+
};
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/ConfigRepository.d.ts
|
|
4
197
|
declare class ConfigRepository {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
198
|
+
protected app: Application;
|
|
199
|
+
private loaded;
|
|
200
|
+
private configs;
|
|
201
|
+
constructor(app: Application);
|
|
202
|
+
/**
|
|
203
|
+
* Get the defined configurations
|
|
204
|
+
*/
|
|
205
|
+
get<X extends Record<string, any>>(): X;
|
|
206
|
+
get<X extends Record<string, any>, K extends DotNestedKeys<X>>(key: K, def?: any): DotNestedValue<X, K>;
|
|
207
|
+
/**
|
|
208
|
+
* Modify the defined configurations
|
|
209
|
+
*/
|
|
210
|
+
set<T extends string>(key: T, value: any): void;
|
|
211
|
+
load(): Promise<this>;
|
|
19
212
|
}
|
|
20
|
-
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/EnvLoader.d.ts
|
|
21
215
|
declare class EnvLoader {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
216
|
+
protected _app: Application;
|
|
217
|
+
constructor(_app: Application);
|
|
218
|
+
/**
|
|
219
|
+
* Get the defined environment vars
|
|
220
|
+
*/
|
|
221
|
+
get<X extends NodeJS.ProcessEnv>(): X;
|
|
222
|
+
get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>>(key: K, def?: any): DotNestedValue<X, K>;
|
|
29
223
|
}
|
|
30
|
-
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/Helpers.d.ts
|
|
226
|
+
declare class Helpers {}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/Providers/ConfigServiceProvider.d.ts
|
|
31
229
|
/**
|
|
32
230
|
* Loads configuration and environment files.
|
|
33
231
|
*
|
|
@@ -37,8 +235,9 @@ declare class EnvLoader {
|
|
|
37
235
|
* Auto-Registered
|
|
38
236
|
*/
|
|
39
237
|
declare class ConfigServiceProvider extends ServiceProvider {
|
|
40
|
-
|
|
41
|
-
|
|
238
|
+
static priority: number;
|
|
239
|
+
register(): Promise<void>;
|
|
42
240
|
}
|
|
43
|
-
|
|
44
|
-
export { ConfigRepository, ConfigServiceProvider, EnvLoader };
|
|
241
|
+
//#endregion
|
|
242
|
+
export { ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
|
|
243
|
+
//# sourceMappingURL=index.d.ts.map
|