@anu8151/adonisjs-blueprint 0.3.3 → 0.3.6

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.
@@ -0,0 +1,3009 @@
1
+ import { Codemods } from "@adonisjs/core/ace/codemods";
2
+ import { AssemblerRcFile } from "@adonisjs/assembler/types";
3
+ import diagnostics_channel from "node:diagnostics_channel";
4
+ import { ApplicationService } from "@adonisjs/core/types";
5
+
6
+ //#region node_modules/@poppinss/types/build/src/base.d.ts
7
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
8
+ /**
9
+ * Primitive values
10
+ */
11
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
12
+ /**
13
+ * Accept one or more of the mentioned type
14
+ */
15
+ type OneOrMore<T> = T | T[];
16
+ /**
17
+ * Representation of a class constructor
18
+ */
19
+ type Constructor<T, Arguments extends unknown[] = any[]> = new (...args: Arguments) => T;
20
+ /**
21
+ * Representation of an abstract class constructor
22
+ */
23
+ type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new (...args: Arguments) => T;
24
+ /**
25
+ * A function that lazily imports a module with default export.
26
+ */
27
+ type LazyImport<DefaultExport> = () => Promise<{
28
+ default: DefaultExport;
29
+ }>;
30
+ /**
31
+ * Unwraps default export from a lazy import function
32
+ */
33
+ type UnWrapLazyImport<Fn extends LazyImport<any>> = Awaited<ReturnType<Fn>>['default'];
34
+ /**
35
+ * Normalizes constructor to work with mixins. There is an open bug for mixins
36
+ * to allow constructors other than `...args: any[]`
37
+ *
38
+ * https://github.com/microsoft/TypeScript/issues/37142
39
+ */
40
+ type NormalizeConstructor<T extends Constructor<any>> = Omit<T, 'constructor'> & {
41
+ new (...args: any[]): InstanceType<T>;
42
+ };
43
+ /**
44
+ * Create a branded Opaque type for a value. For example
45
+ *
46
+ * type Username = Opaque<string, 'username'>
47
+ * type Password = Opaque<string, 'password'>
48
+ *
49
+ * function checkUser(username: Username) {}
50
+ *
51
+ * const username: Username = 'virk'
52
+ * const password: Password = 'secret'
53
+ *
54
+ * checkUser(username) // ✅
55
+ * checkUser(password) // ❌
56
+ */
57
+ declare const opaqueProp: unique symbol;
58
+ type Opaque<T, K> = T & {
59
+ [opaqueProp]: K;
60
+ };
61
+ type UnwrapOpaque<T> = T extends Opaque<infer A, any> ? A : never;
62
+ /**
63
+ * Extract functions from an object or class instance
64
+ */
65
+ type ExtractFunctions<T, IgnoreList extends keyof T = never> = { [P in keyof T]: P extends IgnoreList ? never : T[P] extends ((...args: any[]) => any) ? P : never }[keyof T];
66
+ /**
67
+ * Check of all the values of an object are optional.
68
+ */
69
+ type AreAllOptional<T> = keyof T extends never ? true : { [K in keyof T]-?: [undefined] extends [T[K]] ? never : K }[keyof T] extends never ? true : false;
70
+ /**
71
+ * Returns a union of properties that could be undefined
72
+ */
73
+ type ExtractUndefined<T> = { [K in keyof T]: undefined extends T[K] ? K : never }[keyof T];
74
+ /**
75
+ * Returns a union of properties that will never be undefined
76
+ */
77
+ type ExtractDefined<T> = { [K in keyof T]: undefined extends T[K] ? never : K }[keyof T];
78
+ /**
79
+ * Returns a union of T or PromiseLike<T>
80
+ */
81
+ type AsyncOrSync<T> = PromiseLike<T> | T;
82
+ /**
83
+ * Marks nested properties as partial
84
+ */
85
+ type DeepPartial<T> = Prettify<{ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] }>;
86
+ //#endregion
87
+ //#region node_modules/@poppinss/types/build/src/route.d.ts
88
+ /**
89
+ * Infers param segment from the route identifier.
90
+ */
91
+ type ParamSegment<Identifier extends string> = Identifier extends `${infer SegmentA}/${infer SegmentB}` ? Param<SegmentA> | ParamSegment<SegmentB> : Param<Identifier>;
92
+ type Param<Segment extends string> = Segment extends `:${string}?` ? never : Segment extends `:${infer ParamName}` ? ParamName extends `${infer ParamWithoutExt}.${string}` ? ParamWithoutExt : ParamName : never;
93
+ /**
94
+ * Infers optional param segment from the route identifier.
95
+ */
96
+ type OptionalParamSegment<Identifier extends string> = Identifier extends `${infer SegmentA}/${infer SegmentB}` ? OptionalParam<SegmentA> | OptionalParamSegment<SegmentB> : OptionalParam<Identifier>;
97
+ type OptionalParam<Segment extends string> = Segment extends `:${infer ParamName}?` ? ParamName : never;
98
+ /**
99
+ * Infers wildcard param segment from the route identifier.
100
+ */
101
+ type WildcardParamSegment<Identifier extends string> = Identifier extends `${infer SegmentA}/${infer SegmentB}` ? WildcardParam<SegmentA> | WildcardParamSegment<SegmentB> : WildcardParam<Identifier>;
102
+ type WildcardParam<Segment extends string> = Segment extends '*' ? '*' : never;
103
+ /**
104
+ * Infer route params from the route idenfifier
105
+ */
106
+ type InferRouteParams<Identifier extends string> = Prettify<{ [Key in ParamSegment<Identifier>]: string } & { [Key in OptionalParamSegment<Identifier>]?: string } & { [Key in WildcardParamSegment<Identifier>]: string[] }>;
107
+ //#endregion
108
+ //#region node_modules/@adonisjs/config/build/src/config.d.ts
109
+ /**
110
+ * Config module eases the process of using configuration inside your AdonisJS
111
+ * applications.
112
+ *
113
+ * The config files are stored inside a dedicated directory, which are loaded and cached
114
+ * on application boot. Later you can access the values using the `dot` syntax.
115
+ *
116
+ * ## Access values
117
+ *
118
+ * 1. **Given the config file is stored as `config/app.ts` with following content**
119
+ *
120
+ * ```js
121
+ * module.exports = {
122
+ * appKey: ''
123
+ * }
124
+ * ```
125
+ *
126
+ * 2. **You access the appKey as follows**
127
+ *
128
+ * ```js
129
+ * const config = new Config(configTree)
130
+ * config.get('app.appKey')
131
+ * ```
132
+ */
133
+ declare class Config {
134
+ #private;
135
+ constructor(config?: Record<any, any>);
136
+ /**
137
+ * Get a tree of config imported from the config directory
138
+ */
139
+ all(): Record<any, any>;
140
+ /**
141
+ * Check if config value exists for a given key
142
+ *
143
+ * ```ts
144
+ * config.has('database.mysql')
145
+ * ```
146
+ */
147
+ has(key: string): boolean;
148
+ /**
149
+ * Read value from the config. Make use of the `dot notation`
150
+ * syntax to read nested values.
151
+ *
152
+ * The `defaultValue` is returned when the original value
153
+ * is `undefined`.
154
+ *
155
+ * ```ts
156
+ * config.get('database.mysql')
157
+ * ```
158
+ */
159
+ get<T>(key: string, defaultValue?: any): T;
160
+ /**
161
+ * Define defaults for a config key. The defaults are merged
162
+ * with the value of the config key.
163
+ */
164
+ defaults(key: string, value: any): void;
165
+ /**
166
+ * Update value for a key. No changes are made on the disk
167
+ *
168
+ * ```ts
169
+ * config.set('database.host', '127.0.0.1')
170
+ * ```
171
+ */
172
+ set(key: string, value: any): void;
173
+ }
174
+ //#endregion
175
+ //#region node_modules/@adonisjs/config/build/src/loader.d.ts
176
+ /**
177
+ * The config loader imports all the script files from a given directory
178
+ * and returns their exports as a tree of objects.
179
+ *
180
+ * Following file extensions are considered script files.
181
+ *
182
+ * - .js
183
+ * - .ts (without .d.ts)
184
+ * - .json
185
+ * - .cjs
186
+ * - .mjs
187
+ */
188
+ declare class ConfigLoader {
189
+ #private;
190
+ constructor(configDir: string | URL);
191
+ /**
192
+ * Load config files as a tree from a given path.
193
+ */
194
+ load(): Promise<any>;
195
+ }
196
+ //#endregion
197
+ //#region node_modules/@adonisjs/application/build/src/stubs/stub.d.ts
198
+ /**
199
+ * The Stub class processes template files using the Tempura template engine
200
+ * to generate code files. Stubs are template files that contain placeholders
201
+ * and logic for generating application resources like controllers, models, etc.
202
+ *
203
+ * Features:
204
+ * - Tempura template processing with data binding
205
+ * - Automatic file writing with directory creation
206
+ * - Force overwrite support
207
+ * - Export metadata parsing from template output
208
+ * - Enhanced error reporting with stub file locations
209
+ *
210
+ * @example
211
+ * const stub = new Stub(app, stubContent, '/path/to/controller.stub')
212
+ * const result = await stub.generate({
213
+ * name: 'UserController',
214
+ * to: app.httpControllersPath('user_controller.ts')
215
+ * })
216
+ */
217
+ declare class Stub {
218
+ #private;
219
+ /**
220
+ * Creates a new Stub instance for processing template files.
221
+ *
222
+ * @param {Application<any>} app - The application instance
223
+ * @param {string} stubContents - The raw contents of the stub template
224
+ * @param {string} stubPath - The absolute path to the stub file
225
+ */
226
+ constructor(app: Application<any>, stubContents: string, stubPath: string);
227
+ /**
228
+ * Replaces the rendered stub output with raw content.
229
+ * When called, the provided content will be used as the final output
230
+ * instead of processing the stub template.
231
+ *
232
+ * @param rawContent - The raw content to use instead of rendering the stub
233
+ * @returns {this} Returns the Stub instance for method chaining
234
+ */
235
+ replaceWith(rawContent: string): this;
236
+ /**
237
+ * Prepares the stub for file generation by rendering the template
238
+ * and extracting all metadata, without actually writing to disk.
239
+ *
240
+ * @param {Record<string, any>} stubData - The data to use for stub preparation
241
+ */
242
+ prepare(stubData: Record<string, any>): Promise<PreparedStub>;
243
+ /**
244
+ * Generates the final resource file by processing the stub template
245
+ * and writing the result to disk, with support for force overwrite.
246
+ *
247
+ * @param {Record<string, any>} stubData - The data to use for stub generation
248
+ */
249
+ generate(stubData: Record<string, any>): Promise<GeneratedStub>;
250
+ }
251
+ //#endregion
252
+ //#region node_modules/@adonisjs/application/build/src/stubs/manager.d.ts
253
+ /**
254
+ * StubsManager handles reading, copying, and building stubs from various sources.
255
+ * Stubs are template files used for code generation in AdonisJS applications.
256
+ *
257
+ * The manager can source stubs from:
258
+ * - Application's local stubs directory (publishTarget)
259
+ * - Custom file system paths
260
+ * - Package exports with stubsRoot
261
+ *
262
+ * @example
263
+ * const stubsManager = new StubsManager(app, '/path/to/stubs')
264
+ * const stub = await stubsManager.build('controller.stub')
265
+ * const files = await stubsManager.copy('models', { pkg: '@adonisjs/lucid' })
266
+ */
267
+ declare class StubsManager {
268
+ #private;
269
+ /**
270
+ * Creates a new StubsManager instance.
271
+ *
272
+ * @param {Application<any>} app - The application instance
273
+ * @param {string} publishTarget - Absolute directory path where stubs should be published
274
+ */
275
+ constructor(app: Application<any>, publishTarget: string);
276
+ /**
277
+ * Creates a Stub instance by locating and loading a stub file.
278
+ * Searches in publishTarget first, then optional source or package locations.
279
+ *
280
+ * @param {string} stubName - Name of the stub file to build (e.g., 'controller.stub')
281
+ * @param {Object} [options] - Optional configuration for stub source
282
+ * @param {string} [options.source] - Custom file system path to search for stubs
283
+ * @param {string} [options.pkg] - Package name to source stubs from
284
+ * @returns {Promise<Stub>} Promise that resolves to a Stub instance
285
+ * @throws {RuntimeException} When stub file cannot be found in any source
286
+ */
287
+ build(stubName: string, options?: {
288
+ source?: string;
289
+ pkg?: string;
290
+ }): Promise<Stub>;
291
+ /**
292
+ * Copies stub files from a source location to the publish target directory.
293
+ * Can copy individual files or entire directories recursively.
294
+ *
295
+ * @param {string} stubPath - Relative path to the stub file or directory to copy
296
+ * @param {Object} options - Copy configuration options
297
+ * @param {boolean} [options.overwrite] - Whether to overwrite existing files
298
+ * @param {string} [options.source] - Source file system path (mutually exclusive with pkg)
299
+ * @param {string} [options.pkg] - Package name to copy from (mutually exclusive with source)
300
+ * @returns {Promise<string[]>} Promise that resolves to an array of copied file paths
301
+ * @throws {Error} When source path cannot be found
302
+ */
303
+ copy(stubPath: string, options: {
304
+ overwrite?: boolean;
305
+ } & ({
306
+ source: string;
307
+ } | {
308
+ pkg: string;
309
+ })): Promise<string[]>;
310
+ }
311
+ //#endregion
312
+ //#region node_modules/@poppinss/exception/build/src/exception.d.ts
313
+ /**
314
+ * Create a custom error class with the ability to define the error
315
+ * code, status, and the help text.
316
+ *
317
+ * ```js
318
+ * export class FileNotFoundException extends Exception {
319
+ * static status = 500
320
+ * static code = 'E_FILE_NOT_FOUND'
321
+ * }
322
+ *
323
+ * throw new FileNotFoundException(
324
+ * `Unable to find file from ${filePath} location`
325
+ * )
326
+ * ```
327
+ */
328
+ declare class Exception extends Error {
329
+ /**
330
+ * Define the error metadata as static properties to avoid
331
+ * setting them repeatedly on the error instance
332
+ */
333
+ static help?: string;
334
+ static code?: string;
335
+ static status?: number;
336
+ static message?: string;
337
+ /**
338
+ * Name of the class that raised the exception.
339
+ */
340
+ name: string;
341
+ /**
342
+ * Optional help description for the error. You can use it to define additional
343
+ * human readable information for the error.
344
+ */
345
+ help?: string;
346
+ /**
347
+ * A machine readable error code. This will allow the error handling logic
348
+ * to narrow down exceptions based upon the error code.
349
+ */
350
+ code?: string;
351
+ /**
352
+ * A status code for the error. Usually helpful when converting errors
353
+ * to HTTP responses.
354
+ */
355
+ status: number;
356
+ constructor(message?: string, options?: ErrorOptions & {
357
+ code?: string;
358
+ status?: number;
359
+ });
360
+ get [Symbol.toStringTag](): string;
361
+ toString(): string;
362
+ }
363
+ declare class InvalidArgumentsException extends Exception {
364
+ static code: string;
365
+ static status: number;
366
+ }
367
+ declare class RuntimeException extends Exception {
368
+ static code: string;
369
+ static status: number;
370
+ }
371
+ /**
372
+ * Helper to create an anonymous error class.
373
+ *
374
+ * ```ts
375
+ *
376
+ * const E_RESOURCE_NOT_FOUND = createError<[number]>(
377
+ * 'Unable to find resource with id %d',
378
+ * 'E_RESOURCE_NOT_FOUND'
379
+ * )
380
+ * const id = 1
381
+ * throw new E_RESOURCE_NOT_FOUND([id])
382
+ *```
383
+ */
384
+ declare function createError<T extends any[] = never>(message: string, code: string, status?: number): typeof Exception & T extends never ? {
385
+ new (args?: any, options?: ErrorOptions): Exception;
386
+ } : {
387
+ new (args: T, options?: ErrorOptions): Exception;
388
+ };
389
+ //#endregion
390
+ //#region node_modules/@adonisjs/fold/build/src/resolver.d.ts
391
+ /**
392
+ * Container resolver exposes the APIs to resolve bindings. You can think
393
+ * of resolver as an isolated container instance, with only the APIs
394
+ * to resolve bindings.
395
+ *
396
+ * ```ts
397
+ * const container = new Container()
398
+ * const resolver = container.createResolver()
399
+ *
400
+ * await resolver.make(BINDING_NAME)
401
+ * await resolver.make(CLASS_CONSTRUCTOR)
402
+ * ```
403
+ */
404
+ declare class ContainerResolver<KnownBindings extends Record<any, any>> {
405
+ #private;
406
+ /**
407
+ * Initialize the container resolver with container bindings and options
408
+ *
409
+ * @param container - Object containing all container bindings, values, swaps, hooks, and aliases
410
+ * @param options - Container configuration options
411
+ */
412
+ constructor(container: {
413
+ bindings: Bindings;
414
+ bindingValues: BindingValues;
415
+ swaps: Swaps;
416
+ hooks: Hooks;
417
+ aliases: Map<Partial<keyof KnownBindings>, keyof KnownBindings | AbstractConstructor<any>>;
418
+ contextualBindings: Map<Constructor<any>, ContextualBindings>;
419
+ }, options: ContainerOptions);
420
+ /**
421
+ * Find if the resolver has a binding registered using the
422
+ * "bind", the "singleton", or the "bindValue" methods.
423
+ *
424
+ * @param binding - The binding key to check for
425
+ *
426
+ * @example
427
+ * ```ts
428
+ * resolver.hasBinding('route')
429
+ * resolver.hasBinding(Route)
430
+ * ```
431
+ */
432
+ hasBinding<Binding extends keyof KnownBindings>(binding: Binding): boolean;
433
+ hasBinding(binding: BindingKey): boolean;
434
+ /**
435
+ * Find if the resolver has all the bindings registered using the
436
+ * "bind", the "singleton", or the "bindValue" methods.
437
+ *
438
+ * @param bindings - Array of binding keys to check for
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * resolver.hasAllBindings(['route', 'encryption'])
443
+ * resolver.hasAllBindings([Route, Encryption])
444
+ * ```
445
+ */
446
+ hasAllBindings<Binding extends keyof KnownBindings>(bindings: Binding[]): boolean;
447
+ hasAllBindings(bindings: BindingKey[]): boolean;
448
+ /**
449
+ * Resolves binding in context of a parent. The method is same as
450
+ * the "make" method, but instead takes a parent class
451
+ * constructor. This is used internally for dependency resolution.
452
+ *
453
+ * @param parent - The parent class requesting the binding
454
+ * @param binding - The binding to resolve
455
+ * @param runtimeValues - Optional runtime values for dependencies
456
+ * @param createError - Error creator function
457
+ *
458
+ * @example
459
+ * ```ts
460
+ * const db = await resolver.resolveFor(UsersController, Database)
461
+ * ```
462
+ */
463
+ resolveFor<Binding>(parent: unknown, binding: Binding, runtimeValues?: any[], createError?: ErrorCreator): Promise<Make<Binding>>;
464
+ /**
465
+ * Resolves the binding or constructor a class instance as follows.
466
+ *
467
+ * - Resolve the binding from the values (if registered)
468
+ * - Resolve the binding from the bindings (if registered)
469
+ * - If binding is a class, then create a instance of it. The constructor
470
+ * dependencies are further resolved as well.
471
+ * - All other values are returned as it is.
472
+ *
473
+ * @param binding - The binding key or class constructor to resolve
474
+ * @param runtimeValues - Optional runtime values for dependencies
475
+ * @param createError - Error creator function
476
+ *
477
+ * @example
478
+ * ```ts
479
+ * await resolver.make('route')
480
+ * await resolver.make(Database)
481
+ * await resolver.make(UsersController, [request, response])
482
+ * ```
483
+ */
484
+ make<Binding extends keyof KnownBindings>(binding: Binding, runtimeValues?: any[], createError?: ErrorCreator): Promise<Binding extends string | symbol ? KnownBindings[Binding] : Make<Binding>>;
485
+ make<Binding>(binding: Binding, runtimeValues?: any[], createError?: ErrorCreator): Promise<Make<Binding>>;
486
+ /**
487
+ * Call a method on an object by injecting its dependencies. The method
488
+ * dependencies are resolved in the same manner as a class constructor
489
+ * dependencies.
490
+ *
491
+ * @param value - The object instance containing the method
492
+ * @param method - The method name to call
493
+ * @param runtimeValues - Optional runtime values for method dependencies
494
+ * @param createError - Error creator function
495
+ *
496
+ * @example
497
+ * ```ts
498
+ * const controller = await resolver.make(UsersController)
499
+ * await resolver.call(controller, 'index')
500
+ * ```
501
+ */
502
+ call<Value extends Record<any, any>, Method extends ExtractFunctions<Value>>(value: Value, method: Method, runtimeValues?: any[], createError?: ErrorCreator): Promise<ReturnType<Value[Method]>>;
503
+ /**
504
+ * Register a binding as a value. Values bound to the resolver are
505
+ * isolated from the container and only available within this resolver instance.
506
+ *
507
+ * @param binding - The binding key (string, symbol, or class constructor)
508
+ * @param value - The pre-resolved value to bind
509
+ *
510
+ * @example
511
+ * ```ts
512
+ * const resolver = container.createResolver()
513
+ * resolver.bindValue(HttpContext, ctx)
514
+ * await resolver.make(UsersController) // Will receive the ctx
515
+ * ```
516
+ */
517
+ bindValue<Binding extends keyof KnownBindings>(
518
+ /**
519
+ * Need to narrow down the "Binding" for the case where "KnownBindings" are <any, any>
520
+ */
521
+
522
+ binding: Binding extends string | symbol ? Binding : never, value: KnownBindings[Binding]): void;
523
+ bindValue<Binding extends AbstractConstructor<any>>(binding: Binding, value: InstanceType<Binding>): void;
524
+ }
525
+ //#endregion
526
+ //#region node_modules/@adonisjs/fold/build/src/types.d.ts
527
+ /**
528
+ * A function to create custom errors when container fails. It can be
529
+ * used to point errors to the original source
530
+ *
531
+ * @param message - The error message to use
532
+ * @returns Exception instance
533
+ */
534
+ type ErrorCreator = (message: string) => Exception;
535
+ /**
536
+ * Shape of a class constructor with injections
537
+ *
538
+ * @template T - The constructor type
539
+ */
540
+ type InspectableConstructor = Function & {
541
+ containerInjections?: Record<string | number | symbol, {
542
+ dependencies: any[];
543
+ createError?: ErrorCreator;
544
+ }>;
545
+ containerProvider?: ContainerProvider;
546
+ };
547
+ /**
548
+ * Returns the inferred value for the make method
549
+ *
550
+ * @template T - The type to infer from
551
+ */
552
+ type Make<T> = T extends AbstractConstructor<infer A> ? A : never;
553
+ /**
554
+ * Accepted values for the binding key
555
+ *
556
+ * Can be a string, symbol, or abstract constructor
557
+ */
558
+ type BindingKey = string | symbol | AbstractConstructor<any>;
559
+ /**
560
+ * Shape of the binding resolver
561
+ *
562
+ * @template KnownBindings - Known bindings record type
563
+ * @template Value - The resolved value type
564
+ * @param resolver - Container resolver instance
565
+ * @param runtimeValues - Optional runtime values
566
+ * @returns The resolved value or promise of resolved value
567
+ */
568
+ type BindingResolver<KnownBindings extends Record<any, any>, Value> = (resolver: ContainerResolver<KnownBindings>, runtimeValues?: any[]) => Value | Promise<Value>;
569
+ /**
570
+ * Shape of the registered bindings
571
+ *
572
+ * Map structure containing binding keys and their resolver configurations
573
+ */
574
+ type Bindings = Map<BindingKey, {
575
+ resolver: BindingResolver<Record<any, any>, any>;
576
+ isSingleton: false;
577
+ } | {
578
+ resolver: (containerResolver: ContainerResolver<Record<any, any>>, runtimeValues?: any[]) => Promise<{
579
+ value: any;
580
+ cached: boolean;
581
+ }>;
582
+ isSingleton: true;
583
+ hooksPromise?: Promise<void>;
584
+ }>;
585
+ /**
586
+ * Shape of the registered contextual bindings
587
+ *
588
+ * Map structure for contextual binding resolvers
589
+ */
590
+ type ContextualBindings = Map<AbstractConstructor<any>, {
591
+ resolver: BindingResolver<Record<any, any>, any>;
592
+ }>;
593
+ /**
594
+ * Shape of the registered swaps
595
+ *
596
+ * Map structure for binding swaps during testing
597
+ */
598
+ type Swaps = Map<AbstractConstructor<any>, BindingResolver<Record<any, any>, any>>;
599
+ /**
600
+ * Shape of the registered binding values
601
+ *
602
+ * Map structure containing cached binding values
603
+ */
604
+ type BindingValues = Map<BindingKey, any>;
605
+ /**
606
+ * The data emitted by the `container_binding:resolved` event. If known bindings
607
+ * are defined, then the bindings and values will be correctly
608
+ * inferred.
609
+ *
610
+ * @template KnownBindings - Known bindings record type
611
+ */
612
+ type ContainerResolveEventData<KnownBindings> = {
613
+ binding: AbstractConstructor<unknown>;
614
+ value: unknown;
615
+ } | { [K in keyof KnownBindings]: {
616
+ binding: K;
617
+ value: KnownBindings[K];
618
+ } }[keyof KnownBindings];
619
+ /**
620
+ * Shape of the hooks callback
621
+ *
622
+ * @template KnownBindings - Known bindings record type
623
+ * @template Value - The resolved value type
624
+ * @param value - The resolved value
625
+ * @param resolver - Container resolver instance
626
+ * @returns Void or promise of void
627
+ */
628
+ type HookCallback<KnownBindings extends Record<any, any>, Value> = (value: Value, resolver: ContainerResolver<KnownBindings>) => void | Promise<void>;
629
+ /**
630
+ * Hooks can be registered for all the supported binding datatypes.
631
+ *
632
+ * Map structure containing binding keys and their associated hook callbacks
633
+ */
634
+ type Hooks = Map<BindingKey, Set<HookCallback<any, any>>>;
635
+ /**
636
+ * The default implementation of the container
637
+ * provider.
638
+ *
639
+ * @param binding - The inspectable constructor
640
+ * @param property - The property key
641
+ * @param resolver - Container resolver instance
642
+ * @param runtimeValues - Optional runtime values
643
+ * @returns Promise of dependency array
644
+ */
645
+ type DefaultContainerProvider = (binding: InspectableConstructor, property: string | symbol | number, resolver: ContainerResolver<any>, runtimeValues?: any[]) => Promise<any[]>;
646
+ /**
647
+ * The container provider to discover and build dependencies
648
+ * for the constructor or the class method.
649
+ *
650
+ * @param binding - The inspectable constructor
651
+ * @param property - The property key
652
+ * @param resolver - Container resolver instance
653
+ * @param defaultProvider - Default container provider
654
+ * @param runtimeValues - Optional runtime values
655
+ * @returns Promise of dependency array
656
+ */
657
+ type ContainerProvider = (binding: InspectableConstructor, property: string | symbol | number, resolver: ContainerResolver<any>, defaultProvider: DefaultContainerProvider, runtimeValues?: any[]) => Promise<any[]>;
658
+ /**
659
+ * Options accepted by the container class
660
+ *
661
+ * @property emitter - Optional event emitter for container events
662
+ */
663
+ type ContainerOptions = {
664
+ emitter?: {
665
+ emit(event: string | symbol, ...values: any[]): any;
666
+ };
667
+ };
668
+ /**
669
+ * The shape of the function that imports a module expression and runs
670
+ * it using the container
671
+ *
672
+ * @template T - The module type
673
+ * @template Args - Function arguments type
674
+ * @param resolver - Container resolver or container instance
675
+ * @param args - Function arguments
676
+ * @returns Promise of any value
677
+ */
678
+ type ModuleCallable<T, Args extends any[]> = T extends undefined ? (resolver: ContainerResolver<any> | Container<any>, ...args: Args) => Promise<any> : (...args: Args) => Promise<any>;
679
+ /**
680
+ * The shape of the handle method object that imports a module expression
681
+ * and runs it using the container
682
+ *
683
+ * @template T - The module type
684
+ * @template Args - Handler arguments type
685
+ * @property name - Optional handler name
686
+ * @property handle - Handler function
687
+ */
688
+ type ModuleHandler<T, Args extends any[]> = T extends undefined ? {
689
+ name?: string;
690
+ handle(resolver: ContainerResolver<any> | Container<any>, ...args: Args): Promise<any>;
691
+ } : {
692
+ name?: string;
693
+ handle(...args: Args): Promise<any>;
694
+ };
695
+ /**
696
+ * Data shared with the container.make tracing channel
697
+ *
698
+ * @property binding - The binding being resolved (constructor, string, or symbol)
699
+ */
700
+ type ContainerMakeTracingData = {
701
+ binding: AbstractConstructor<any> | string | symbol;
702
+ };
703
+ //#endregion
704
+ //#region node_modules/@adonisjs/fold/build/src/contextual_bindings_builder.d.ts
705
+ /**
706
+ * A fluent builder to register contextual bindings with the
707
+ * container.
708
+ */
709
+ declare class ContextBindingsBuilder<KnownBindings extends Record<any, any>, PinnedBinding extends AbstractConstructor<any>> {
710
+ #private;
711
+ /**
712
+ * Initialize the contextual bindings builder
713
+ *
714
+ * @param parent - The parent class constructor for the contextual binding
715
+ * @param container - The container instance to register bindings with
716
+ */
717
+ constructor(parent: Constructor<any>, container: Container<KnownBindings>);
718
+ /**
719
+ * Specify the binding for which to register a custom
720
+ * resolver.
721
+ *
722
+ * @param binding - The dependency class that the parent asks for
723
+ *
724
+ * @example
725
+ * ```ts
726
+ * container
727
+ * .when(UsersController)
728
+ * .asksFor(Hash)
729
+ * .provide(() => new Argon2())
730
+ * ```
731
+ */
732
+ asksFor<Binding extends PinnedBinding>(binding: Binding): ContextBindingsBuilder<KnownBindings, Binding>;
733
+ /**
734
+ * Provide a resolver to resolve the parent dependency
735
+ *
736
+ * @param resolver - Factory function that returns the contextual implementation
737
+ *
738
+ * @example
739
+ * ```ts
740
+ * container
741
+ * .when(UsersController)
742
+ * .asksFor(Hash)
743
+ * .provide(() => new Argon2())
744
+ * ```
745
+ */
746
+ provide(resolver: BindingResolver<KnownBindings, Make<PinnedBinding>>): void;
747
+ }
748
+ //#endregion
749
+ //#region node_modules/@adonisjs/fold/build/src/container.d.ts
750
+ /**
751
+ * The container class exposes the API to register bindings, values
752
+ * and resolve them.
753
+ *
754
+ * Known bindings types can be defined at the time of the constructing
755
+ * the container.
756
+ *
757
+ * ```ts
758
+ * new Container<{ 'route': Route, encryption: Encryption }>()
759
+ * ```
760
+ *
761
+ * You can resolve bindings and construct classes as follows
762
+ *
763
+ * ```ts
764
+ * await container.make(BINDING_NAME)
765
+ * await container.make(CLASS_CONSTRUCTOR)
766
+ * ```
767
+ */
768
+ declare class Container<KnownBindings extends Record<any, any>> {
769
+ #private;
770
+ /**
771
+ * Initialize the container with optional configuration
772
+ *
773
+ * @param options - Optional container configuration including event emitter
774
+ *
775
+ * @example
776
+ * ```ts
777
+ * const container = new Container()
778
+ * ```
779
+ *
780
+ * @example
781
+ * ```ts
782
+ * const container = new Container<{
783
+ * route: Route
784
+ * encryption: Encryption
785
+ * }>({ emitter: eventEmitter })
786
+ * ```
787
+ */
788
+ constructor(options?: ContainerOptions);
789
+ /**
790
+ * Define an emitter instance to use for container events
791
+ *
792
+ * @param emitter - Event emitter instance that implements emit method
793
+ *
794
+ * @example
795
+ * ```ts
796
+ * const container = new Container()
797
+ * container.useEmitter(eventEmitter)
798
+ * ```
799
+ */
800
+ useEmitter(emitter: Exclude<ContainerOptions['emitter'], undefined>): this;
801
+ /**
802
+ * Create a container resolver to resolve bindings, or make classes.
803
+ *
804
+ * ```ts
805
+ * const resolver = container.createResolver()
806
+ * await resolver.make(CLASS_CONSTRUCTOR)
807
+ * ```
808
+ *
809
+ * Bind values with the resolver. Resolver values are isolated from the
810
+ * container.
811
+ *
812
+ * ```ts
813
+ * resolver.bindValue(HttpContext, new HttpContext())
814
+ * await resolver.make(UsersController)
815
+ * ```
816
+ *
817
+ * @returns A new container resolver instance
818
+ */
819
+ createResolver(): ContainerResolver<KnownBindings>;
820
+ /**
821
+ * Find if the container has a binding registered using the
822
+ * "bind", the "singleton", or the "bindValue" methods.
823
+ *
824
+ * @param binding - The binding key to check for
825
+ *
826
+ * @example
827
+ * ```ts
828
+ * container.hasBinding('route')
829
+ * container.hasBinding(Route)
830
+ * ```
831
+ */
832
+ hasBinding<Binding extends keyof KnownBindings>(binding: Binding): boolean;
833
+ hasBinding(binding: BindingKey): boolean;
834
+ /**
835
+ * Find if the container has all the bindings registered using the
836
+ * "bind", the "singleton", or the "bindValue" methods.
837
+ *
838
+ * @param bindings - Array of binding keys to check for
839
+ *
840
+ * @example
841
+ * ```ts
842
+ * container.hasAllBindings(['route', 'encryption'])
843
+ * container.hasAllBindings([Route, Encryption])
844
+ * ```
845
+ */
846
+ hasAllBindings<Binding extends keyof KnownBindings>(bindings: Binding[]): boolean;
847
+ hasAllBindings(binding: BindingKey[]): boolean;
848
+ /**
849
+ * Resolves the binding or constructor a class instance as follows.
850
+ *
851
+ * - Resolve the binding from the values (if registered)
852
+ * - Resolve the binding from the bindings (if registered)
853
+ * - If binding is a class, then create a instance of it. The constructor
854
+ * dependencies are further resolved as well.
855
+ * - All other values are returned as it is.
856
+ *
857
+ * @param binding - The binding key or class constructor to resolve
858
+ * @param runtimeValues - Optional array of runtime values for constructor dependencies
859
+ * @param createError - Optional custom error creator function
860
+ *
861
+ * @example
862
+ * ```ts
863
+ * await container.make('route')
864
+ * await container.make(Database)
865
+ * await container.make(UsersController, [request, response])
866
+ * ```
867
+ */
868
+ make<Binding extends keyof KnownBindings>(binding: Binding, runtimeValues?: any[], createError?: ErrorCreator): Promise<Binding extends string | symbol ? KnownBindings[Binding] : Make<Binding>>;
869
+ make<Binding>(binding: Binding, runtimeValues?: any[], createError?: ErrorCreator): Promise<Make<Binding>>;
870
+ /**
871
+ * Call a method on an object by injecting its dependencies. The method
872
+ * dependencies are resolved in the same manner as a class constructor
873
+ * dependencies.
874
+ *
875
+ * @param value - The object instance containing the method
876
+ * @param method - The method name to call
877
+ * @param runtimeValues - Optional array of runtime values for method dependencies
878
+ * @param createError - Optional custom error creator function
879
+ *
880
+ * @example
881
+ * ```ts
882
+ * const controller = await container.make(UsersController)
883
+ * await container.call(controller, 'index')
884
+ * ```
885
+ */
886
+ call<Value extends Record<any, any>, Method extends ExtractFunctions<Value>>(value: Value, method: Method, runtimeValues?: any[], createError?: ErrorCreator): Promise<ReturnType<Value[Method]>>;
887
+ /**
888
+ * Register an alias for a binding. The value can be a reference
889
+ * to an existing binding or to a class constructor that will
890
+ * instantiate to the same value as the alias.
891
+ *
892
+ * @param alias - The alias name (must be string or symbol)
893
+ * @param value - The constructor or binding key this alias points to
894
+ *
895
+ * @example
896
+ * ```ts
897
+ * container.alias('db', Database)
898
+ * await container.make('db') // returns Database instance
899
+ * ```
900
+ */
901
+ alias<Alias extends keyof KnownBindings>(
902
+ /**
903
+ * An alias must always be defined as a string or a symbol. Classes cannot be
904
+ * aliases
905
+ */
906
+
907
+ alias: Alias extends string | symbol ? Alias : never,
908
+ /**
909
+ * The value should either be the constructor point to the alias value
910
+ * or reference to binding that has the same value as the alias
911
+ */
912
+
913
+ value: AbstractConstructor<KnownBindings[Alias]> | Exclude<{ [K in keyof KnownBindings]: KnownBindings[K] extends KnownBindings[Alias] ? K : never }[keyof KnownBindings], Alias>): void;
914
+ /**
915
+ * Register a binding inside the container. The method receives a
916
+ * key-value pair.
917
+ *
918
+ * - Key can be a string, symbol or a constructor.
919
+ * - The value is always a factory function to construct the dependency.
920
+ *
921
+ * @param binding - The binding key (string, symbol, or class constructor)
922
+ * @param resolver - Factory function that resolves the binding value
923
+ *
924
+ * @example
925
+ * ```ts
926
+ * container.bind('route', () => new Route())
927
+ * await container.make('route')
928
+ * ```
929
+ *
930
+ * @example
931
+ * ```ts
932
+ * container.bind(Route, () => new Route())
933
+ * await container.make(Route)
934
+ * ```
935
+ *
936
+ * @example
937
+ * ```ts
938
+ * const routeSymbol = Symbol('route')
939
+ * container.bind(routeSymbol, () => new Route())
940
+ * await container.make(routeSymbol)
941
+ * ```
942
+ */
943
+ bind<Binding extends keyof KnownBindings>(
944
+ /**
945
+ * Need to narrow down the "Binding" for the case where "KnownBindings" are <any, any>
946
+ */
947
+
948
+ binding: Binding extends string | symbol ? Binding : never, resolver: BindingResolver<KnownBindings, KnownBindings[Binding]>): void;
949
+ bind<Binding extends AbstractConstructor<any>>(binding: Binding, resolver: BindingResolver<KnownBindings, InstanceType<Binding>>): void;
950
+ /**
951
+ * Register a binding as a value. Unlike bind() and singleton(), this
952
+ * method accepts the resolved value directly instead of a factory function.
953
+ *
954
+ * @param binding - The binding key (string, symbol, or class constructor)
955
+ * @param value - The pre-resolved value to bind
956
+ *
957
+ * @example
958
+ * ```ts
959
+ * const route = new Route()
960
+ * container.bindValue(Route, route)
961
+ * ```
962
+ *
963
+ * @example
964
+ * ```ts
965
+ * container.bindValue('config', { debug: true })
966
+ * ```
967
+ */
968
+ bindValue<Binding extends keyof KnownBindings>(
969
+ /**
970
+ * Need to narrow down the "Binding" for the case where "KnownBindings" are <any, any>
971
+ */
972
+
973
+ binding: Binding extends string | symbol ? Binding : never, value: KnownBindings[Binding]): void;
974
+ bindValue<Binding extends AbstractConstructor<any>>(binding: Binding, value: InstanceType<Binding>): void;
975
+ /**
976
+ * Register a binding as a singleton. The singleton method is same
977
+ * as the bind method, but the factory function is invoked
978
+ * only once and the result is cached for subsequent resolutions.
979
+ *
980
+ * @param binding - The binding key (string, symbol, or class constructor)
981
+ * @param resolver - Factory function that resolves the binding value
982
+ *
983
+ * @example
984
+ * ```ts
985
+ * container.singleton('route', () => new Route())
986
+ * await container.make('route')
987
+ * ```
988
+ *
989
+ * @example
990
+ * ```ts
991
+ * container.singleton(Route, () => new Route())
992
+ * await container.make(Route)
993
+ * ```
994
+ *
995
+ * @example
996
+ * ```ts
997
+ * const routeSymbol = Symbol('route')
998
+ * container.singleton(routeSymbol, () => new Route())
999
+ * await container.make(routeSymbol)
1000
+ * ```
1001
+ */
1002
+ singleton<Binding extends keyof KnownBindings>(
1003
+ /**
1004
+ * Need to narrow down the "Binding" for the case where "KnownBindings" are <any, any>
1005
+ */
1006
+
1007
+ binding: Binding extends string | symbol ? Binding : never, resolver: BindingResolver<KnownBindings, KnownBindings[Binding]>): void;
1008
+ singleton<Binding extends AbstractConstructor<any>>(binding: Binding, resolver: BindingResolver<KnownBindings, InstanceType<Binding>>): void;
1009
+ /**
1010
+ * Define a fake implementation for a binding or a class constructor.
1011
+ * Swaps have the highest priority when resolving dependencies
1012
+ * from the container. Useful for testing.
1013
+ *
1014
+ * @param binding - The class constructor to swap
1015
+ * @param resolver - Factory function that returns the swapped implementation
1016
+ *
1017
+ * @example
1018
+ * ```ts
1019
+ * container.swap(Database, () => new MockDatabase())
1020
+ * const db = await container.make(Database) // returns MockDatabase
1021
+ * ```
1022
+ */
1023
+ swap<Binding extends AbstractConstructor<any>>(binding: Binding, resolver: BindingResolver<KnownBindings, InstanceType<Binding>>): void;
1024
+ /**
1025
+ * Restore binding by removing its swap
1026
+ *
1027
+ * @param binding - The class constructor to restore
1028
+ *
1029
+ * @example
1030
+ * ```ts
1031
+ * container.restore(Database)
1032
+ * ```
1033
+ */
1034
+ restore(binding: AbstractConstructor<any>): void;
1035
+ /**
1036
+ * Restore mentioned or all bindings by removing their swaps
1037
+ *
1038
+ * @param bindings - Optional array of class constructors to restore. If not provided, all swaps are removed
1039
+ *
1040
+ * @example
1041
+ * ```ts
1042
+ * container.restoreAll([Database, Cache])
1043
+ * ```
1044
+ *
1045
+ * @example
1046
+ * ```ts
1047
+ * container.restoreAll() // Restore all swaps
1048
+ * ```
1049
+ */
1050
+ restoreAll(bindings?: AbstractConstructor<any>[]): void;
1051
+ /**
1052
+ * Define hooks to be executed after a binding has been resolved
1053
+ * from the container.
1054
+ *
1055
+ * The hooks are executed for:
1056
+ * - Bindings
1057
+ * - Only once for singletons
1058
+ * - Class constructors
1059
+ *
1060
+ * Hooks are not executed for direct values registered with the container.
1061
+ *
1062
+ * @param binding - The binding key or class constructor
1063
+ * @param callback - Hook function to execute after resolution
1064
+ *
1065
+ * @example
1066
+ * ```ts
1067
+ * container.resolving('database', async (db, resolver) => {
1068
+ * await db.connect()
1069
+ * })
1070
+ * ```
1071
+ *
1072
+ * @example
1073
+ * ```ts
1074
+ * container.resolving(Database, async (db, resolver) => {
1075
+ * await db.connect()
1076
+ * })
1077
+ * ```
1078
+ */
1079
+ resolving<Binding extends keyof KnownBindings>(binding: Binding extends string | symbol ? Binding : never, callback: HookCallback<KnownBindings, KnownBindings[Binding]>): void;
1080
+ resolving<Binding extends AbstractConstructor<any>>(binding: Binding, callback: HookCallback<KnownBindings, InstanceType<Binding>>): void;
1081
+ /**
1082
+ * Create a contextual builder to define contextual bindings.
1083
+ * Contextual bindings allow you to specify different implementations
1084
+ * for a dependency based on which class is asking for it.
1085
+ *
1086
+ * @param parent - The class constructor that will receive the contextual binding
1087
+ *
1088
+ * @example
1089
+ * ```ts
1090
+ * container
1091
+ * .when(UsersController)
1092
+ * .asksFor(Hash)
1093
+ * .provide(() => new Argon2())
1094
+ * ```
1095
+ */
1096
+ when(parent: Constructor<any>): ContextBindingsBuilder<KnownBindings, AbstractConstructor<any>>;
1097
+ /**
1098
+ * Add a contextual binding for a given class constructor. A
1099
+ * contextual binding takes a parent, parent's dependency and a callback
1100
+ * to resolve the dependency.
1101
+ *
1102
+ * For example:
1103
+ * - When "UsersController"
1104
+ * - Asks for "Hash class"
1105
+ * - Provide "Argon2" implementation
1106
+ *
1107
+ * @param parent - The class constructor that will receive the contextual binding
1108
+ * @param binding - The dependency class that the parent asks for
1109
+ * @param resolver - Factory function to resolve the contextual binding
1110
+ *
1111
+ * @example
1112
+ * ```ts
1113
+ * container.contextualBinding(
1114
+ * UsersController,
1115
+ * Hash,
1116
+ * () => new Argon2()
1117
+ * )
1118
+ * ```
1119
+ */
1120
+ contextualBinding<Binding extends AbstractConstructor<any>>(parent: Constructor<any>, binding: Binding, resolver: BindingResolver<KnownBindings, Make<Binding>>): void;
1121
+ }
1122
+ //#endregion
1123
+ //#region node_modules/@adonisjs/fold/build/src/decorators/inject.d.ts
1124
+ /**
1125
+ * The "@inject" decorator uses Reflection to inspect the dependencies of a class
1126
+ * or a method and defines them as metadata on the class for the container to
1127
+ * discover them.
1128
+ *
1129
+ * @example
1130
+ * ```ts
1131
+ * @inject()
1132
+ * class UsersController {
1133
+ * constructor(private database: Database) {}
1134
+ * }
1135
+ * ```
1136
+ *
1137
+ * @example
1138
+ * ```ts
1139
+ * class UsersController {
1140
+ * @inject()
1141
+ * async index(request: Request, response: Response) {
1142
+ * // Method with dependency injection
1143
+ * }
1144
+ * }
1145
+ * ```
1146
+ */
1147
+ declare function inject(): {
1148
+ <C extends Function>(target: C): void;
1149
+ (target: any, propertyKey: string | symbol): void;
1150
+ };
1151
+ //#endregion
1152
+ //#region node_modules/@adonisjs/fold/build/src/module_caller.d.ts
1153
+ /**
1154
+ * The moduleCaller works around a very specific pattern we use with
1155
+ * AdonisJS, ie to construct classes and call methods using the
1156
+ * container.
1157
+ *
1158
+ * For example: Controllers of AdonisJS allows defining a controller
1159
+ * as follows
1160
+ *
1161
+ * Behind the scenes, we have to run following operations in order to call the
1162
+ * method on the controller:
1163
+ *
1164
+ * - Create an instance of the controller class using the container.
1165
+ * - Call the method using the container with dependency injection support.
1166
+ *
1167
+ * @param target - The class constructor to instantiate
1168
+ * @param method - The method name to call on the instance
1169
+ *
1170
+ * @example
1171
+ * ```ts
1172
+ * route.get('/', [HomeController, 'index'])
1173
+ * ```
1174
+ *
1175
+ * @example
1176
+ * ```ts
1177
+ * const callable = moduleCaller(HomeController, 'handle')
1178
+ * .toCallable(container)
1179
+ *
1180
+ * await callable(ctx)
1181
+ * ```
1182
+ */
1183
+ declare function moduleCaller(target: Constructor<any>, method: string): {
1184
+ /**
1185
+ * Converts the class reference to a callable function. Invoking this method
1186
+ * internally creates a new instance of the class using the container and
1187
+ * invokes the method using the container.
1188
+ *
1189
+ * You can create a callable function using the container instance as shown below
1190
+ *
1191
+ * ```ts
1192
+ * const fn = moduleCaller(HomeController, 'handle')
1193
+ * .toCallable(container)
1194
+ *
1195
+ * // Call the function and pass context to it
1196
+ * await fn(ctx)
1197
+ * ```
1198
+ *
1199
+ * Another option is to not pass the container at the time of creating
1200
+ * the callable function, but instead pass a resolver instance at
1201
+ * the time of calling the function
1202
+ *
1203
+ * ```ts
1204
+ * const fn = moduleCaller(HomeController, 'handle')
1205
+ * .toCallable()
1206
+ *
1207
+ * // Call the function and pass context to it
1208
+ * const resolver = container.createResolver()
1209
+ * await fn(resolver, ctx)
1210
+ * ```
1211
+ */
1212
+ toCallable<T extends Container<any> | ContainerResolver<any> | undefined = undefined, Args extends any[] = any[]>(container?: T): ModuleCallable<T, Args>;
1213
+ /**
1214
+ * Converts the class reference to an object with handle method. Invoking this
1215
+ * method internally creates a new instance of the class using the container
1216
+ * and invokes the method using the container.
1217
+ *
1218
+ * You can create a handle method object using the container instance as shown below
1219
+ *
1220
+ * ```ts
1221
+ * const handler = moduleCaller(HomeController, 'handle')
1222
+ * .toHandleMethod(container)
1223
+ *
1224
+ * // Call the function and pass context to it
1225
+ * await handler.handle(ctx)
1226
+ * ```
1227
+ *
1228
+ * Another option is to not pass the container at the time of creating
1229
+ * the handle method object, but instead pass a resolver instance at
1230
+ * the time of calling the function
1231
+ *
1232
+ * ```ts
1233
+ * const handler = moduleCaller(HomeController, 'handle')
1234
+ * .toHandleMethod()
1235
+ *
1236
+ * // Call the function and pass context to it
1237
+ * const resolver = container.createResolver()
1238
+ * await handler.handle(resolver, ctx)
1239
+ * ```
1240
+ */
1241
+ toHandleMethod<T extends Container<any> | ContainerResolver<any> | undefined = undefined, Args extends any[] = any[]>(container?: T): ModuleHandler<T, Args>;
1242
+ };
1243
+ //#endregion
1244
+ //#region node_modules/@adonisjs/fold/build/src/module_importer.d.ts
1245
+ /**
1246
+ * The moduleImporter module works around a very specific pattern we use
1247
+ * with AdonisJS, ie to lazy load modules by wrapping import calls inside
1248
+ * a callback.
1249
+ *
1250
+ * For example: Middleware of AdonisJS allows registering middleware as an
1251
+ * array of import calls.
1252
+ *
1253
+ * Behind the scenes, we have to run following operations in order to call the
1254
+ * handle method on the defined middleware:
1255
+ *
1256
+ * - Lazily call the registered callbacks to import the middleware.
1257
+ * - Check if the module has a default export.
1258
+ * - Create an instance of the default export class using the container.
1259
+ * - Call the `handle` method on the middleware class using the container.
1260
+ *
1261
+ * @param importFn - Function that returns a promise with the module's default export
1262
+ * @param method - The method name to call on the imported class instance
1263
+ *
1264
+ * @example
1265
+ * ```ts
1266
+ * defineMiddleware([
1267
+ * () => import('#middleware/silent_auth')
1268
+ * ])
1269
+ * ```
1270
+ *
1271
+ * @example
1272
+ * ```ts
1273
+ * defineMiddleware({
1274
+ * auth: () => import('#middleware/auth')
1275
+ * })
1276
+ * ```
1277
+ *
1278
+ * @example
1279
+ * ```ts
1280
+ * const callable = moduleImporter(() => import('#middleware/auth'), 'handle')
1281
+ * .toCallable(container)
1282
+ *
1283
+ * await callable(ctx)
1284
+ * ```
1285
+ */
1286
+ declare function moduleImporter(importFn: () => Promise<{
1287
+ default: Constructor<any>;
1288
+ }>, method: string): {
1289
+ /**
1290
+ * Converts the module import function to a callable function. Invoking this
1291
+ * method run internally import the module, create a new instance of the
1292
+ * default export class using the container and invokes the method using
1293
+ * the container.
1294
+ *
1295
+ * You can create a callable function using the container instance as shown below
1296
+ *
1297
+ * ```ts
1298
+ * const fn = moduleImporter(() => import('#middleware/auth_middleware'), 'handle')
1299
+ * .toCallable(container)
1300
+ *
1301
+ * // Call the function and pass context to it
1302
+ * await fn(ctx)
1303
+ * ```
1304
+ *
1305
+ * Another option is to not pass the container at the time of creating
1306
+ * the callable function, but instead pass a resolver instance at
1307
+ * the time of calling the function
1308
+ *
1309
+ * ```ts
1310
+ * const fn = moduleImporter(() => import('#middleware/auth_middleware'), 'handle')
1311
+ * .toCallable()
1312
+ *
1313
+ * // Call the function and pass context to it
1314
+ * const resolver = container.createResolver()
1315
+ * await fn(resolver, ctx)
1316
+ * ```
1317
+ */
1318
+ toCallable<T extends Container<any> | ContainerResolver<any> | undefined = undefined, Args extends any[] = any[]>(container?: T): ModuleCallable<T, Args>;
1319
+ /**
1320
+ * Converts the module import function to an object with handle method. Invoking the
1321
+ * handle method run internally imports the module, create a new instance of
1322
+ * the default export class using the container and invokes the method using
1323
+ * the container.
1324
+ *
1325
+ * You can create a handle method object using the container instance as shown below
1326
+ *
1327
+ * ```ts
1328
+ * const handler = moduleImporter(() => import('#middleware/auth_middleware'), 'handle')
1329
+ * .toHandleMethod(container)
1330
+ *
1331
+ * // Call the function and pass context to it
1332
+ * await handler.handle(ctx)
1333
+ * ```
1334
+ *
1335
+ * Another option is to not pass the container at the time of creating
1336
+ * the handle method object, but instead pass a resolver instance at
1337
+ * the time of calling the function
1338
+ *
1339
+ * ```ts
1340
+ * const handler = moduleImporter(() => import('#middleware/auth_middleware'), 'handle')
1341
+ * .toHandleMethod()
1342
+ *
1343
+ * // Call the function and pass context to it
1344
+ * const resolver = container.createResolver()
1345
+ * await handler.handle(resolver, ctx)
1346
+ * ```
1347
+ */
1348
+ toHandleMethod<T extends Container<any> | ContainerResolver<any> | undefined = undefined, Args extends any[] = any[]>(container?: T): ModuleHandler<T, Args>;
1349
+ };
1350
+ //#endregion
1351
+ //#region node_modules/@adonisjs/fold/build/src/module_expression.d.ts
1352
+ /**
1353
+ * The moduleExpression module works around a very specific pattern we use
1354
+ * with AdonisJS, ie to bind modules as string.
1355
+ *
1356
+ * For example: With the router of AdonisJS, we can bind a controller to a route
1357
+ * as follows.
1358
+ *
1359
+ * Behind the scenes, we have to run following operations in order to call a
1360
+ * method on the users_controller class:
1361
+ *
1362
+ * - Dynamic import `#controllers/users_controller` module
1363
+ * - Check if the module has a default export.
1364
+ * - Create an instance of the default export class using the container.
1365
+ * - Call the `index` method on the controller class using the container.
1366
+ *
1367
+ * Router is just one example, we do this with event listeners, redis pub/sub
1368
+ * and so on.
1369
+ *
1370
+ * So, instead of writing all this parsing logic, we encapsulate it inside the
1371
+ * "moduleExpression" module.
1372
+ *
1373
+ * @param expression - The module expression string (e.g., '#controllers/users_controller.index')
1374
+ * @param parentURL - The parent URL for resolving the module
1375
+ *
1376
+ * @example
1377
+ * ```ts
1378
+ * Route.get('users', '#controllers/users_controller.index')
1379
+ * ```
1380
+ *
1381
+ * @example
1382
+ * ```ts
1383
+ * const callable = moduleExpression('#controllers/users_controller.index', import.meta.url)
1384
+ * .toCallable(container)
1385
+ *
1386
+ * await callable(ctx)
1387
+ * ```
1388
+ */
1389
+ declare function moduleExpression(expression: string, parentURL: URL | string): {
1390
+ /**
1391
+ * Parses a module expression to extract the module import path
1392
+ * and the method to call on the default exported class.
1393
+ *
1394
+ * ```ts
1395
+ * moduleExpression('#controllers/users_controller').parse()
1396
+ * // ['#controllers/users_controller', 'handle']
1397
+ * ```
1398
+ *
1399
+ * With method
1400
+ * ```ts
1401
+ * moduleExpression('#controllers/users_controller.index').parse()
1402
+ * // ['#controllers/users_controller', 'index']
1403
+ * ```
1404
+ */
1405
+ parse(): [string, string];
1406
+ /**
1407
+ * Converts the module expression to a callable function. Invoking this
1408
+ * method run internally import the module, create a new instance of the
1409
+ * default export class using the container and invokes the method using
1410
+ * the container.
1411
+ *
1412
+ * You can create a callable function using the container instance as shown below
1413
+ *
1414
+ * ```ts
1415
+ * const fn = moduleExpression('#controllers/users_controller.index')
1416
+ * .toCallable(container)
1417
+ *
1418
+ * // Call the function and pass context to it
1419
+ * await fn(ctx)
1420
+ * ```
1421
+ *
1422
+ * Another option is to not pass the container at the time of creating
1423
+ * the callable function, but instead pass a resolver instance at
1424
+ * the time of calling the function
1425
+ *
1426
+ * ```ts
1427
+ * const fn = moduleExpression('#controllers/users_controller.index')
1428
+ * .toCallable()
1429
+ *
1430
+ * // Call the function and pass context to it
1431
+ * const resolver = container.createResolver()
1432
+ * await fn(resolver, ctx)
1433
+ * ```
1434
+ */
1435
+ toCallable<T extends Container<any> | ContainerResolver<any> | undefined = undefined, Args extends any[] = any[]>(container?: T): ModuleCallable<T, Args>;
1436
+ /**
1437
+ * Converts the module expression to an object with handle method. Invoking the
1438
+ * handle method run internally imports the module, create a new instance of
1439
+ * the default export class using the container and invokes the method using
1440
+ * the container.
1441
+ *
1442
+ * You can create a handle method object using the container instance as shown below
1443
+ *
1444
+ * ```ts
1445
+ * const handler = moduleExpression('#controllers/users_controller.index')
1446
+ * .toHandleMethod(container)
1447
+ *
1448
+ * // Call the function and pass context to it
1449
+ * await handler.handle(ctx)
1450
+ * ```
1451
+ *
1452
+ * Another option is to not pass the container at the time of creating
1453
+ * the handle method object, but instead pass a resolver instance at
1454
+ * the time of calling the function
1455
+ *
1456
+ * ```ts
1457
+ * const handler = moduleExpression('#controllers/users_controller.index')
1458
+ * .toHandleMethod()
1459
+ *
1460
+ * // Call the function and pass context to it
1461
+ * const resolver = container.createResolver()
1462
+ * await handler.handle(resolver, ctx)
1463
+ * ```
1464
+ */
1465
+ toHandleMethod<T extends Container<any> | ContainerResolver<any> | undefined = undefined, Args extends any[] = any[]>(container?: T): ModuleHandler<T, Args>;
1466
+ };
1467
+ //#endregion
1468
+ //#region node_modules/@adonisjs/fold/build/src/parse_binding_reference.d.ts
1469
+ /**
1470
+ * The "parseBindingReference" method is used to parse binding references
1471
+ * similar to route controller binding value or event listener binding value.
1472
+ *
1473
+ * See the following examples to understand how this function works.
1474
+ *
1475
+ * ### Magic strings
1476
+ * ```ts
1477
+ * parseBindingReference('#controllers/home_controller')
1478
+ * // returns { moduleNameOrPath: '#controllers/home_controller', method: 'handle' }
1479
+ *
1480
+ * parseBindingReference('#controllers/home_controller.index')
1481
+ * // returns { moduleNameOrPath: '#controllers/home_controller', method: 'index' }
1482
+ *
1483
+ * parseBindingReference('#controllers/home.controller.index')
1484
+ * // returns { moduleNameOrPath: '#controllers/home.controller', method: 'index' }
1485
+ * ```
1486
+ *
1487
+ * ### Class reference
1488
+ * ```ts
1489
+ * class HomeController {}
1490
+ *
1491
+ * parseBindingReference([HomeController])
1492
+ * // returns { moduleNameOrPath: 'HomeController', method: 'handle' }
1493
+ *
1494
+ * parseBindingReference([HomeController, 'index'])
1495
+ * // returns { moduleNameOrPath: 'HomeController', method: 'index' }
1496
+ * ```
1497
+ *
1498
+ * ### Lazy import reference
1499
+ * ```ts
1500
+ * const HomeController = () => import('#controllers/home_controller')
1501
+ *
1502
+ * parseBindingReference([HomeController])
1503
+ * // returns { moduleNameOrPath: '#controllers/home_controller', method: 'handle' }
1504
+ *
1505
+ * parseBindingReference([HomeController, 'index'])
1506
+ * // returns { moduleNameOrPath: 'controllers/home_controller', method: 'index' }
1507
+ * ```
1508
+ */
1509
+ declare function parseBindingReference(binding: string | [LazyImport<Constructor<any>> | Constructor<any>, any?]): Promise<{
1510
+ moduleNameOrPath: string;
1511
+ method: string;
1512
+ }>;
1513
+ //#endregion
1514
+ //#region node_modules/@adonisjs/fold/build/src/tracing_channels.d.ts
1515
+ /**
1516
+ * Tracing channel for container.make method calls
1517
+ *
1518
+ * This channel emits events when the container resolves dependencies,
1519
+ * providing data about the binding being resolved.
1520
+ *
1521
+ * @example
1522
+ * ```ts
1523
+ * containerMake.subscribe('start', (message) => {
1524
+ * console.log('Starting resolution for:', message.binding)
1525
+ * })
1526
+ * ```
1527
+ */
1528
+ declare const containerMake: diagnostics_channel.TracingChannel<"adonisjs.container.make", ContainerMakeTracingData>;
1529
+ //#endregion
1530
+ //#region node_modules/@poppinss/macroable/build/index.d.ts
1531
+ /**
1532
+ * Abstract class that adds capabilities for extending classes from outside-in,
1533
+ * in the form of macros, instance properties, and getters.
1534
+ *
1535
+ * @example
1536
+ * ```ts
1537
+ * class User extends Macroable {
1538
+ * name: string
1539
+ * constructor(name: string) {
1540
+ * super()
1541
+ * this.name = name
1542
+ * }
1543
+ * }
1544
+ *
1545
+ * // Add a macro
1546
+ * User.macro('greet', function() {
1547
+ * return `Hello, ${this.name}`
1548
+ * })
1549
+ *
1550
+ * // Add a getter
1551
+ * User.getter('upperName', function() {
1552
+ * return this.name.toUpperCase()
1553
+ * })
1554
+ *
1555
+ * const user = new User('John')
1556
+ * user.greet() // "Hello, John"
1557
+ * user.upperName // "JOHN"
1558
+ * ```
1559
+ */
1560
+ declare abstract class Macroable {
1561
+ /**
1562
+ * Set of instance properties that will be added to each instance during construction.
1563
+ * Each entry contains a key and value pair representing the property name and its value.
1564
+ */
1565
+ protected static instanceMacros: Set<{
1566
+ key: string | symbol | number;
1567
+ value: unknown;
1568
+ }>;
1569
+ /**
1570
+ * Adds a macro (property or method) to the class prototype.
1571
+ * Macros are standard properties that get added to the class prototype,
1572
+ * making them available on all instances of the class.
1573
+ *
1574
+ * @param name - The name of the property or method to add
1575
+ * @param value - The value to assign to the property or method
1576
+ *
1577
+ * @example
1578
+ * ```ts
1579
+ * // Add a property macro
1580
+ * MyClass.macro('version', '1.0.0')
1581
+ *
1582
+ * // Add a method macro
1583
+ * MyClass.macro('greet', function() {
1584
+ * return 'Hello!'
1585
+ * })
1586
+ *
1587
+ * const instance = new MyClass()
1588
+ * instance.version // "1.0.0"
1589
+ * instance.greet() // "Hello!"
1590
+ * ```
1591
+ */
1592
+ static macro<T extends {
1593
+ new (...args: any[]): any;
1594
+ }, K extends keyof InstanceType<T>>(this: T, name: K, value: InstanceType<T>[K]): void;
1595
+ /**
1596
+ * Adds an instance property that will be assigned to each instance during construction.
1597
+ * Unlike macros which are added to the prototype, instance properties are unique to each instance.
1598
+ *
1599
+ * @param name - The name of the property to add to instances
1600
+ * @param value - The value to assign to the property on each instance
1601
+ *
1602
+ * @example
1603
+ * ```ts
1604
+ * // Add an instance method
1605
+ * MyClass.instanceProperty('save', function() {
1606
+ * console.log('Saving...', this.id)
1607
+ * })
1608
+ *
1609
+ * const { save } = new MyClass()
1610
+ * save()
1611
+ * ```
1612
+ */
1613
+ static instanceProperty<T extends {
1614
+ new (...args: any[]): any;
1615
+ }, K extends keyof InstanceType<T>>(this: T, name: K, value: InstanceType<T>[K]): void;
1616
+ /**
1617
+ * Adds a getter property to the class prototype using Object.defineProperty.
1618
+ * Getters are computed properties that are evaluated each time they are accessed,
1619
+ * unless the singleton flag is enabled.
1620
+ *
1621
+ * @param name - The name of the getter property
1622
+ * @param accumulator - Function that computes and returns the property value
1623
+ * @param singleton - If true, the getter value is cached after first access
1624
+ *
1625
+ * @example
1626
+ * ```ts
1627
+ * // Add a regular getter
1628
+ * MyClass.getter('timestamp', function() {
1629
+ * return Date.now()
1630
+ * })
1631
+ *
1632
+ * // Add a singleton getter (cached after first access)
1633
+ * MyClass.getter('config', function() {
1634
+ * return loadConfig()
1635
+ * }, true)
1636
+ *
1637
+ * const instance = new MyClass()
1638
+ * instance.timestamp // Computed each time
1639
+ * instance.config // Computed once, then cached
1640
+ * ```
1641
+ */
1642
+ static getter<T extends {
1643
+ new (...args: any[]): any;
1644
+ }, K extends keyof InstanceType<T>>(this: T, name: K, accumulator: () => InstanceType<T>[K], singleton?: boolean): void;
1645
+ /**
1646
+ * Constructor that applies all registered instance properties to the new instance.
1647
+ * This method iterates through the instanceMacros set and assigns each property
1648
+ * to the instance, binding functions to the instance context.
1649
+ */
1650
+ constructor();
1651
+ }
1652
+ //#endregion
1653
+ //#region node_modules/@poppinss/hooks/build/src/runner.d.ts
1654
+ /**
1655
+ * Runner allows running a set of specific hook handlers for a given
1656
+ * event. You can grab the instance of the runner using the "hook.runner" method.
1657
+ *
1658
+ * ```ts
1659
+ * const hooks = new Hooks()
1660
+ *
1661
+ * await hooks.runner('saving').run()
1662
+ * ```
1663
+ */
1664
+ declare class Runner<HookArgs extends any[], CleanUpArgs extends any[]> {
1665
+ #private;
1666
+ action: string;
1667
+ /**
1668
+ * Find if cleanup is pending or not
1669
+ *
1670
+ * @example
1671
+ * ```ts
1672
+ * const runner = hooks.runner('saving')
1673
+ * await runner.run()
1674
+ *
1675
+ * if (runner.isCleanupPending) {
1676
+ * await runner.cleanup()
1677
+ * }
1678
+ * ```
1679
+ */
1680
+ get isCleanupPending(): boolean;
1681
+ /**
1682
+ * Create a new Runner instance
1683
+ *
1684
+ * @param action - The name of the event/action this runner handles
1685
+ * @param hookHandlers - Optional set of hook handlers to initialize with
1686
+ *
1687
+ * @example
1688
+ * ```ts
1689
+ * const runner = new Runner('saving', new Set([handler1, handler2]))
1690
+ * ```
1691
+ */
1692
+ constructor(action: string, hookHandlers?: Set<HookHandler<HookArgs, CleanUpArgs> | HookHandlerProvider<HookArgs, CleanUpArgs>>);
1693
+ /**
1694
+ * Ignore specific or all hook handlers. Calling this
1695
+ * method multiple times will result in overwriting
1696
+ * the existing state.
1697
+ *
1698
+ * @param handlersToIgnore - Array of handler names to ignore, or undefined to skip all hooks
1699
+ *
1700
+ * @example
1701
+ * ```ts
1702
+ * // Skip specific handlers
1703
+ * runner.without(['hashPassword', 'validateEmail']).run()
1704
+ *
1705
+ * // Skip all handlers
1706
+ * runner.without().run()
1707
+ * ```
1708
+ */
1709
+ without(handlersToIgnore?: string[]): this;
1710
+ /**
1711
+ * Execute handlers
1712
+ *
1713
+ * @param data - Arguments to pass to the hook handlers
1714
+ *
1715
+ * @example
1716
+ * ```ts
1717
+ * const runner = hooks.runner('saving')
1718
+ * await runner.run(user, { email: 'new@example.com' })
1719
+ * ```
1720
+ */
1721
+ run(...data: HookArgs): Promise<void>;
1722
+ /**
1723
+ * Execute handlers in reverse order
1724
+ *
1725
+ * @param data - Arguments to pass to the hook handlers
1726
+ *
1727
+ * @example
1728
+ * ```ts
1729
+ * const runner = hooks.runner('deleting')
1730
+ * await runner.runReverse(user)
1731
+ * ```
1732
+ */
1733
+ runReverse(...data: HookArgs): Promise<void>;
1734
+ /**
1735
+ * Execute cleanup actions
1736
+ *
1737
+ * @param data - Arguments to pass to the cleanup handlers
1738
+ *
1739
+ * @example
1740
+ * ```ts
1741
+ * const runner = hooks.runner('saving')
1742
+ * await runner.run(user)
1743
+ *
1744
+ * // Later, cleanup any resources
1745
+ * await runner.cleanup(user)
1746
+ * ```
1747
+ */
1748
+ cleanup(...data: CleanUpArgs): Promise<void>;
1749
+ }
1750
+ //#endregion
1751
+ //#region node_modules/@poppinss/hooks/build/src/types.d.ts
1752
+ /**
1753
+ * Shape of the cleanup handler
1754
+ */
1755
+ type CleanupHandler<Args extends any[]> = (...args: Args) => void | Promise<void>;
1756
+ /**
1757
+ * Shape of the hook handler
1758
+ */
1759
+ type HookHandler<Args extends any[], CleanUpArgs extends any[]> = (...args: Args) => void | CleanupHandler<CleanUpArgs> | Promise<void> | Promise<CleanupHandler<CleanUpArgs>>;
1760
+ /**
1761
+ * Extracts args from a hook handler type
1762
+ */
1763
+ type ExtractHookHandlerArgs<Handler> = Handler extends HookHandler<infer A, infer B> ? [A, B] : never;
1764
+ /**
1765
+ * Hook represented as an object with handle method
1766
+ */
1767
+ type HookHandlerProvider<Args extends any[], CleanUpArgs extends any[]> = {
1768
+ name: string;
1769
+ handle(event: string, ...args: Args): void | CleanupHandler<CleanUpArgs> | Promise<void> | Promise<CleanupHandler<CleanUpArgs>>;
1770
+ };
1771
+ //#endregion
1772
+ //#region node_modules/@adonisjs/application/build/src/feature_flags.d.ts
1773
+ /**
1774
+ * A light weight implementation of feature flags to conditionally enable
1775
+ * experimental and legacy features.
1776
+ *
1777
+ * @template FlagsList - Type definition for the feature flags object
1778
+ *
1779
+ * @example
1780
+ * const flags = new FeatureFlags({ newUI: true, betaFeature: false })
1781
+ * if (flags.enabled('newUI')) {
1782
+ * // Enable new UI
1783
+ * }
1784
+ *
1785
+ * @example
1786
+ * const dynamicFlags = new FeatureFlags(() => getConfigFlags())
1787
+ * flags.when('betaFeature',
1788
+ * () => console.log('Beta enabled'),
1789
+ * () => console.log('Beta disabled')
1790
+ * )
1791
+ */
1792
+ declare class FeatureFlags<FlagsList extends Record<any, any>> {
1793
+ #private;
1794
+ /**
1795
+ * Creates a new FeatureFlags instance
1796
+ *
1797
+ * @param flags - Either a static flags object or a factory function
1798
+ */
1799
+ constructor(flags: FlagsList | (() => FlagsList));
1800
+ /**
1801
+ * Checks if a feature is enabled
1802
+ *
1803
+ * @param feature - The feature name to check
1804
+ * @returns boolean - True if the feature is enabled
1805
+ */
1806
+ enabled<Feature extends keyof FlagsList | (string & {})>(feature: Feature): boolean;
1807
+ /**
1808
+ * Checks if a feature is disabled
1809
+ *
1810
+ * @param feature - The feature name to check
1811
+ * @returns boolean - True if the feature is disabled
1812
+ */
1813
+ disabled<Feature extends keyof FlagsList | (string & {})>(feature: Feature): boolean;
1814
+ /**
1815
+ * Checks if a feature exists in the flags
1816
+ *
1817
+ * @param feature - The feature name to check
1818
+ * @returns boolean - True if the feature exists
1819
+ */
1820
+ has<Feature extends keyof FlagsList | (string & {})>(feature: Feature): boolean;
1821
+ /**
1822
+ * Conditionally executes callbacks based on feature flag state
1823
+ *
1824
+ * @param feature - The feature name to check
1825
+ * @param enabledCallback - Callback to execute when feature is enabled
1826
+ * @param disabledCallback - Optional callback to execute when feature is disabled
1827
+ * @returns The result of the executed callback
1828
+ */
1829
+ when<Feature extends keyof FlagsList | (string & {}), EnabledResult, DisabledResult>(feature: Feature, enabledCallback: () => EnabledResult, disabledCallback?: () => DisabledResult): [never] extends DisabledResult ? EnabledResult | undefined : EnabledResult | DisabledResult;
1830
+ }
1831
+ //#endregion
1832
+ //#region node_modules/@adonisjs/application/build/src/application.d.ts
1833
+ /**
1834
+ * Application class manages the state of an AdonisJS application. It includes:
1835
+ *
1836
+ * - Setting up the base features like importing config and setting up logger.
1837
+ * - Parsing the "adonisrc.js" file
1838
+ * - Setting up the IoC container
1839
+ * - Registering and booting providers
1840
+ * - Invoking lifecycle methods on the providers and hooks
1841
+ *
1842
+ * The Application class extends Macroable to allow runtime extension of functionality.
1843
+ * It manages the entire lifecycle from creation to termination, providing hooks at
1844
+ * each stage for customization.
1845
+ *
1846
+ * @template ContainerBindings - Type definition for IoC container bindings
1847
+ * @extends {Macroable}
1848
+ * @class Application
1849
+ */
1850
+ declare class Application<ContainerBindings extends Record<any, any>> extends Macroable {
1851
+ #private;
1852
+ /**
1853
+ * Stores metadata information about the application including
1854
+ * app name, version, and AdonisJS version.
1855
+ *
1856
+ * @type {Map<string, any>}
1857
+ */
1858
+ info: Map<'appName' | 'version' | 'adonisVersion' | string, any>;
1859
+ /**
1860
+ * Returns the application name from the info map.
1861
+ * Defaults to 'adonisjs_app' if not set.
1862
+ *
1863
+ * @readonly
1864
+ * @type {string}
1865
+ */
1866
+ get appName(): any;
1867
+ /**
1868
+ * Returns the application version from the info map.
1869
+ * Returns null if no version is set.
1870
+ *
1871
+ * @readonly
1872
+ * @type {SemverNode | null}
1873
+ */
1874
+ get version(): SemverNode | null;
1875
+ /**
1876
+ * The parsed version for the "@adonisjs/core" package.
1877
+ * Returns null if no version is available.
1878
+ *
1879
+ * @readonly
1880
+ * @type {SemverNode | null}
1881
+ */
1882
+ get adonisVersion(): SemverNode | null;
1883
+ /**
1884
+ * The URL for the root of the application directory.
1885
+ *
1886
+ * @readonly
1887
+ * @type {URL}
1888
+ */
1889
+ get appRoot(): URL;
1890
+ /**
1891
+ * A boolean to know if the application has been booted.
1892
+ * Returns true when the application state is beyond 'initiated'.
1893
+ *
1894
+ * @readonly
1895
+ * @type {boolean}
1896
+ */
1897
+ get isBooted(): boolean;
1898
+ /**
1899
+ * A boolean to know if the application is ready and fully started.
1900
+ * Returns true only when the application state is 'ready'.
1901
+ *
1902
+ * @readonly
1903
+ * @type {boolean}
1904
+ */
1905
+ get isReady(): boolean;
1906
+ /**
1907
+ * A boolean to know if the application has been terminated.
1908
+ * Returns true only when the application state is 'terminated'.
1909
+ *
1910
+ * @readonly
1911
+ * @type {boolean}
1912
+ */
1913
+ get isTerminated(): boolean;
1914
+ /**
1915
+ * A boolean to know if the application is in the middle of
1916
+ * the termination process but not yet fully terminated.
1917
+ *
1918
+ * @readonly
1919
+ * @type {boolean}
1920
+ */
1921
+ get isTerminating(): boolean;
1922
+ /**
1923
+ * Reference to the config instance. The value is available
1924
+ * after the "init" method has been called.
1925
+ *
1926
+ * @readonly
1927
+ * @type {any}
1928
+ */
1929
+ get config(): Config;
1930
+ /**
1931
+ * Reference to the parsed adonisrc.js file. The value is available
1932
+ * after the "init" method has been called.
1933
+ *
1934
+ * @readonly
1935
+ * @type {any}
1936
+ */
1937
+ get rcFile(): RcFile;
1938
+ /**
1939
+ * Normalized current NODE_ENV value. Converts common variations
1940
+ * to standard values (development, production, test).
1941
+ *
1942
+ * @readonly
1943
+ * @type {string}
1944
+ */
1945
+ get nodeEnvironment(): string;
1946
+ /**
1947
+ * Returns true when the NODE_ENV is set to 'production'.
1948
+ * Useful for conditional logic based on production environment.
1949
+ *
1950
+ * @readonly
1951
+ * @type {boolean}
1952
+ */
1953
+ get inProduction(): boolean;
1954
+ /**
1955
+ * Returns true when the NODE_ENV is set to 'development'.
1956
+ * Useful for enabling development-specific features.
1957
+ *
1958
+ * @readonly
1959
+ * @type {boolean}
1960
+ */
1961
+ get inDev(): boolean;
1962
+ /**
1963
+ * Returns true when the NODE_ENV is set to 'test'.
1964
+ * Useful for enabling test-specific behavior.
1965
+ *
1966
+ * @readonly
1967
+ * @type {boolean}
1968
+ */
1969
+ get inTest(): boolean;
1970
+ /**
1971
+ * Returns true if the process is managed and running under PM2.
1972
+ * Detected by checking for the pm2_id environment variable.
1973
+ *
1974
+ * @readonly
1975
+ * @type {boolean}
1976
+ */
1977
+ get managedByPm2(): boolean;
1978
+ /**
1979
+ * Reference to scaffolding generators for creating application files.
1980
+ * Provides utilities for generating controllers, models, migrations, etc.
1981
+ *
1982
+ * @readonly
1983
+ * @type {any}
1984
+ */
1985
+ get generators(): {
1986
+ singularControllerNames: string[];
1987
+ entityPathSegment(segmentName: string): string;
1988
+ createEntity(entityName: string): {
1989
+ path: string;
1990
+ name: string;
1991
+ };
1992
+ importPath(...paths: string[]): string;
1993
+ tableName(entityName: string): string;
1994
+ modelName(entityName: string): string;
1995
+ modelFileName(entityName: string): string;
1996
+ controllerName(entityName: string, singular?: boolean): string;
1997
+ controllerFileName(entityName: string, singular?: boolean): string;
1998
+ eventName(entityName: string): string;
1999
+ eventFileName(entityName: string): string;
2000
+ listenerName(entityName: string): string;
2001
+ listenerFileName(entityName: string): string;
2002
+ middlewareName(entityName: string): string;
2003
+ middlewareFileName(entityName: string): string;
2004
+ providerName(entityName: string): string;
2005
+ providerFileName(entityName: string): string;
2006
+ policyName(entityName: string): string;
2007
+ policyFileName(entityName: string): string;
2008
+ factoryName(entityName: string): string;
2009
+ factoryFileName(entityName: string): string;
2010
+ serviceName(entityName: string): string;
2011
+ serviceFileName(entityName: string): string;
2012
+ seederName(entityName: string): string;
2013
+ seederFileName(entityName: string): string;
2014
+ commandTerminalName(entityName: string): string;
2015
+ commandName(entityName: string): string;
2016
+ commandFileName(entityName: string): string;
2017
+ validatorName(entityName: string): string;
2018
+ validatorActionName(entityName: string, action: string): string;
2019
+ validatorFileName(entityName: string): string;
2020
+ exceptionName(entityName: string): string;
2021
+ exceptionFileName(entityName: string): string;
2022
+ mailerName(entityName: string, type?: "notification" | "provision"): string;
2023
+ mailerFileName(entityName: string, type?: "notification" | "provision"): string;
2024
+ mailName(entityName: string, type?: string): string;
2025
+ mailFileName(entityName: string, type?: string): string;
2026
+ testGroupName(entity: {
2027
+ path: string;
2028
+ name: string;
2029
+ }): string;
2030
+ testFileName(entityName: string): string;
2031
+ viewFileName(entityName: string): string;
2032
+ transformerName(entityName: string): string;
2033
+ transformerFileName(entityName: string): string;
2034
+ inertiaPageName(entityName: string): string;
2035
+ inertiaPageFileName(entityName: string, extension: string): string;
2036
+ };
2037
+ /**
2038
+ * Reference to the stubs module for scaffolding resources or ejecting stubs.
2039
+ * Provides functionality to create and manage code generation templates.
2040
+ *
2041
+ * @type {Object}
2042
+ * @property {Function} create - Factory function to create a StubsManager instance
2043
+ */
2044
+ stubs: {
2045
+ create: () => Promise<StubsManager>;
2046
+ };
2047
+ /**
2048
+ * Feature flags manager for checking the status of experimental features.
2049
+ * Reads configuration from adonisrc.js experimental section.
2050
+ *
2051
+ * @type {FeatureFlags<ExperimentalFlagsList>}
2052
+ */
2053
+ experimentalFlags: FeatureFlags<ExperimentalFlagsList>;
2054
+ /**
2055
+ * Flag indicating if VineJS provider is configured and available.
2056
+ * When true, the @vinejs/vine package can be safely imported.
2057
+ *
2058
+ * @type {boolean}
2059
+ * @default false
2060
+ */
2061
+ usingVineJS: boolean;
2062
+ /**
2063
+ * Flag indicating if Edge template engine provider is configured.
2064
+ * When true, the edge.js package can be safely imported.
2065
+ *
2066
+ * @type {boolean}
2067
+ * @default false
2068
+ */
2069
+ usingEdgeJS: boolean;
2070
+ /**
2071
+ * Detects which AI coding agent the application is running under.
2072
+ * Checks for environment variables set by different AI coding assistants:
2073
+ * - CLAUDECODE='1' for Claude Code
2074
+ * - GEMINI_CLI='1' for Gemini
2075
+ * - GITHUB_COPILOT_CLI_MODE='1' for GitHub Copilot
2076
+ * - WINDSURF_SESSION='1' or TERM_PROGRAM='windsurf' for Windsurf
2077
+ * - CODEX_CLI='1' or CODEX_SANDBOX='1' for Codex
2078
+ * - OPENCODE='1' for OpenCode
2079
+ * - CURSOR_AGENT='1' for Cursor
2080
+ *
2081
+ * @readonly
2082
+ * @type {'claude' | 'gemini' | 'copilot' | 'windsurf' | 'codex' | 'opencode' | 'cursor' | null}
2083
+ * @returns The name of the detected AI agent, or null if none detected
2084
+ */
2085
+ get detectedAIAgent(): ("claude" | "cursor" | "opencode" | "gemini" | "copilot" | "windsurf" | "codex") | null;
2086
+ /**
2087
+ * Returns true if the application is running within any AI coding agent.
2088
+ * This is a convenience getter that checks if detectedAIAgent is not null.
2089
+ *
2090
+ * @readonly
2091
+ * @type {boolean}
2092
+ * @returns True when running under an AI coding agent, false otherwise
2093
+ */
2094
+ get runningInAIAgent(): boolean;
2095
+ /**
2096
+ * Reference to the AdonisJS IoC container. The container manages
2097
+ * dependency injection and service binding throughout the application.
2098
+ * Available after the "init" method has been called.
2099
+ *
2100
+ * @type {Container<ContainerBindings>}
2101
+ */
2102
+ container: Container<ContainerBindings>;
2103
+ /**
2104
+ * Creates an instance of Application.
2105
+ *
2106
+ * @param {URL} appRoot - The root URL of the application
2107
+ * @param {Object} options - Configuration options
2108
+ * @param {AppEnvironments} options.environment - The application environment
2109
+ * @param {Importer} [options.importer] - Optional module importer function
2110
+ */
2111
+ constructor(appRoot: URL, options: {
2112
+ environment: AppEnvironments;
2113
+ importer?: Importer;
2114
+ });
2115
+ /**
2116
+ * The current environment in which the application is running
2117
+ *
2118
+ * @returns {AppEnvironments} The current application environment
2119
+ */
2120
+ getEnvironment(): AppEnvironments;
2121
+ /**
2122
+ * Switch the environment in which the app is running. The
2123
+ * environment can only be changed before the app is booted.
2124
+ *
2125
+ * @param {AppEnvironments} environment - The new environment to set
2126
+ * @returns {this} Returns the application instance for method chaining
2127
+ * @throws {RuntimeException} When called after the app has been booted
2128
+ */
2129
+ setEnvironment(environment: AppEnvironments): this;
2130
+ /**
2131
+ * The current state of the application
2132
+ *
2133
+ * @returns {ApplicationStates} The current application state
2134
+ */
2135
+ getState(): ApplicationStates;
2136
+ /**
2137
+ * Specify the contents of the "adonisrc.js" file as
2138
+ * an object. Calling this method will disable loading
2139
+ * the "adonisrc.js" file from the disk.
2140
+ *
2141
+ * @param {Record<string, any>} value - The RC file contents as an object
2142
+ * @returns {this} Returns the application instance for method chaining
2143
+ */
2144
+ rcContents(value: Record<string, any>): this;
2145
+ /**
2146
+ * Define the config values to use when booting the
2147
+ * config provider. Calling this method disables
2148
+ * reading files from the config directory.
2149
+ *
2150
+ * @param {Record<any, any>} values - The config values to use
2151
+ * @returns {this} Returns the application instance for method chaining
2152
+ */
2153
+ useConfig(values: Record<any, any>): this;
2154
+ /**
2155
+ * Notify the parent process when the Node.js process is spawned with an IPC channel.
2156
+ * The arguments accepted are same as "process.send"
2157
+ *
2158
+ * @param {any} message - The message to send to the parent process
2159
+ * @param {any} [sendHandle] - Optional handle to send with the message
2160
+ * @param {Object} [options] - Options for sending the message
2161
+ * @param {boolean} [options.swallowErrors] - Whether to swallow errors
2162
+ * @param {boolean} [options.keepOpen] - Whether to keep the connection open
2163
+ * @param {function} [callback] - Callback function to handle send result
2164
+ */
2165
+ notify(message: any, sendHandle?: any, options?: {
2166
+ swallowErrors?: boolean | undefined;
2167
+ keepOpen?: boolean | undefined;
2168
+ }, callback?: (error: Error | null) => void): void;
2169
+ /**
2170
+ * Listen for a process signal. This method is same as calling
2171
+ * "process.on(signal)"
2172
+ *
2173
+ * @param {NodeJS.Signals} signal - The signal to listen for
2174
+ * @param {NodeJS.SignalsListener} callback - The callback to execute when signal is received
2175
+ * @returns {this} Returns the application instance for method chaining
2176
+ */
2177
+ listen(signal: NodeJS.Signals, callback: NodeJS.SignalsListener): this;
2178
+ /**
2179
+ * Listen for a process signal once. This method is same as calling
2180
+ * "process.once(signal)"
2181
+ *
2182
+ * @param {NodeJS.Signals} signal - The signal to listen for
2183
+ * @param {NodeJS.SignalsListener} callback - The callback to execute when signal is received
2184
+ * @returns {this} Returns the application instance for method chaining
2185
+ */
2186
+ listenOnce(signal: NodeJS.Signals, callback: NodeJS.SignalsListener): this;
2187
+ /**
2188
+ * Listen for a process signal conditionally.
2189
+ *
2190
+ * @param {boolean} conditional - Whether to register the listener
2191
+ * @param {NodeJS.Signals} signal - The signal to listen for
2192
+ * @param {NodeJS.SignalsListener} callback - The callback to execute when signal is received
2193
+ * @returns {this} Returns the application instance for method chaining
2194
+ */
2195
+ listenIf(conditional: boolean, signal: NodeJS.Signals, callback: NodeJS.SignalsListener): this;
2196
+ /**
2197
+ * Listen for a process signal once conditionally.
2198
+ *
2199
+ * @param {boolean} conditional - Whether to register the listener
2200
+ * @param {NodeJS.Signals} signal - The signal to listen for
2201
+ * @param {NodeJS.SignalsListener} callback - The callback to execute when signal is received
2202
+ * @returns {this} Returns the application instance for method chaining
2203
+ */
2204
+ listenOnceIf(conditional: boolean, signal: NodeJS.Signals, callback: NodeJS.SignalsListener): this;
2205
+ /**
2206
+ * Register hooks that are called before the app starts
2207
+ * the initiating process
2208
+ *
2209
+ * @param {HookHandler} handler - The hook handler function to register
2210
+ * @returns {this} Returns the application instance for method chaining
2211
+ */
2212
+ initiating(handler: HookHandler<[Application<ContainerBindings>], [Application<ContainerBindings>]>): this;
2213
+ /**
2214
+ * Initiate the application. Calling this method performs following
2215
+ * operations:
2216
+ *
2217
+ * - Parses the "adonisrc.js" file
2218
+ * - Validate and set environment variables
2219
+ * - Loads the application config from the configured config dir.
2220
+ * - Configures the logger
2221
+ * - Instantiates the IoC container
2222
+ *
2223
+ * @returns {Promise<void>} Promise that resolves when initiation is complete
2224
+ */
2225
+ init(): Promise<void>;
2226
+ /**
2227
+ * Register hooks that are called before the app boot
2228
+ * process starts
2229
+ *
2230
+ * @param {HookHandler} handler - The hook handler function to register
2231
+ * @returns {this} Returns the application instance for method chaining
2232
+ */
2233
+ booting(handler: HookHandler<[Application<ContainerBindings>], [Application<ContainerBindings>]>): this;
2234
+ /**
2235
+ * Boot the application. Calling this method performs the following
2236
+ * operations:
2237
+ *
2238
+ * - Resolve providers and call the "register" method on them.
2239
+ * - Call the "boot" method on providers
2240
+ * - Run the "booted" hooks
2241
+ *
2242
+ * @returns {Promise<void>} Promise that resolves when boot is complete
2243
+ */
2244
+ boot(): Promise<void>;
2245
+ /**
2246
+ * Register a hook to get notified when the application has
2247
+ * been booted.
2248
+ *
2249
+ * The hook will be called immediately if the app has already
2250
+ * been booted.
2251
+ *
2252
+ * @param {HookHandler} handler - The hook handler function to register
2253
+ * @returns {Promise<void>} Promise that resolves after the handler is executed
2254
+ */
2255
+ booted(handler: HookHandler<[Application<ContainerBindings>], [Application<ContainerBindings>]>): Promise<void>;
2256
+ /**
2257
+ * Register hooks that are called when the app is starting
2258
+ *
2259
+ * @param {HookHandler} handler - The hook handler function to register
2260
+ * @returns {this} Returns the application instance for method chaining
2261
+ */
2262
+ starting(handler: HookHandler<[Application<ContainerBindings>], [Application<ContainerBindings>]>): this;
2263
+ /**
2264
+ * Start the application. Calling this method performs the following
2265
+ * operations:
2266
+ *
2267
+ * - Run the "start" lifecycle hooks on all the providers
2268
+ * - Start the application by invoking the supplied callback
2269
+ * - Run the "ready" lifecycle hooks on all the providers
2270
+ * - Run the "ready" application hooks
2271
+ *
2272
+ * @param {function} callback - The callback function to invoke when starting the app
2273
+ * @returns {Promise<void>} Promise that resolves when start is complete
2274
+ */
2275
+ start(callback: (app: this) => void | Promise<void>): Promise<void>;
2276
+ /**
2277
+ * Register hooks that are called when the app is ready.
2278
+ *
2279
+ * The hook will be called immediately if the app is already ready.
2280
+ *
2281
+ * @param {HookHandler} handler - The hook handler function to register
2282
+ * @returns {Promise<void>} Promise that resolves after the handler is executed
2283
+ */
2284
+ ready(handler: HookHandler<[Application<ContainerBindings>], [Application<ContainerBindings>]>): Promise<void>;
2285
+ /**
2286
+ * Register hooks that are called before the app is terminated.
2287
+ *
2288
+ * @param {HookHandler} handler - The hook handler function to register
2289
+ * @returns {this} Returns the application instance for method chaining
2290
+ */
2291
+ terminating(handler: HookHandler<[Application<ContainerBindings>], [Application<ContainerBindings>]>): this;
2292
+ /**
2293
+ * Terminate application gracefully. Calling this method performs
2294
+ * the following operations:
2295
+ *
2296
+ * - Run "shutdown" hooks on all the providers
2297
+ * - Run "terminating" app lifecycle hooks
2298
+ *
2299
+ * @returns {Promise<void>} Promise that resolves when termination is complete
2300
+ */
2301
+ terminate(): Promise<void>;
2302
+ /**
2303
+ * Returns relative path to a file from the app root
2304
+ *
2305
+ * @param {string} absolutePath - The absolute path to convert
2306
+ * @returns {string} The relative path from app root
2307
+ */
2308
+ relativePath(absolutePath: string): string;
2309
+ /**
2310
+ * Returns URL to a path from the application root.
2311
+ *
2312
+ * @param {...string} paths - Path segments to join
2313
+ * @returns {URL} The constructed URL
2314
+ */
2315
+ makeURL(...paths: string[]): URL;
2316
+ /**
2317
+ * Returns file system path from the application root.
2318
+ *
2319
+ * @param {...string} paths - Path segments to join
2320
+ * @returns {string} The constructed file system path
2321
+ */
2322
+ makePath(...paths: string[]): string;
2323
+ /**
2324
+ * Makes path to the config directory
2325
+ *
2326
+ * @param {...string} paths - Path segments to append to config directory
2327
+ * @returns {string} The constructed config directory path
2328
+ */
2329
+ configPath(...paths: string[]): string;
2330
+ /**
2331
+ * Makes path to the public directory
2332
+ *
2333
+ * @param {...string} paths - Path segments to append to public directory
2334
+ * @returns {string} The constructed public directory path
2335
+ */
2336
+ publicPath(...paths: string[]): string;
2337
+ /**
2338
+ * Makes path to the providers directory
2339
+ *
2340
+ * @param {...string} paths - Path segments to append to providers directory
2341
+ * @returns {string} The constructed providers directory path
2342
+ */
2343
+ providersPath(...paths: string[]): string;
2344
+ /**
2345
+ * Makes path to the factories directory
2346
+ *
2347
+ * @param {...string} paths - Path segments to append to factories directory
2348
+ * @returns {string} The constructed factories directory path
2349
+ */
2350
+ factoriesPath(...paths: string[]): string;
2351
+ /**
2352
+ * Makes path to the migrations directory
2353
+ *
2354
+ * @param {...string} paths - Path segments to append to migrations directory
2355
+ * @returns {string} The constructed migrations directory path
2356
+ */
2357
+ migrationsPath(...paths: string[]): string;
2358
+ /**
2359
+ * Makes path to the seeders directory
2360
+ *
2361
+ * @param {...string} paths - Path segments to append to seeders directory
2362
+ * @returns {string} The constructed seeders directory path
2363
+ */
2364
+ seedersPath(...paths: string[]): string;
2365
+ /**
2366
+ * Makes path to the language files directory
2367
+ *
2368
+ * @param {...string} paths - Path segments to append to language files directory
2369
+ * @returns {string} The constructed language files directory path
2370
+ */
2371
+ languageFilesPath(...paths: string[]): string;
2372
+ /**
2373
+ * Makes path to the views directory
2374
+ *
2375
+ * @param {...string} paths - Path segments to append to views directory
2376
+ * @returns {string} The constructed views directory path
2377
+ */
2378
+ viewsPath(...paths: string[]): string;
2379
+ /**
2380
+ * Makes path to the start directory
2381
+ *
2382
+ * @param {...string} paths - Path segments to append to start directory
2383
+ * @returns {string} The constructed start directory path
2384
+ */
2385
+ startPath(...paths: string[]): string;
2386
+ /**
2387
+ * Makes path to the tmp directory
2388
+ *
2389
+ * @param {...string} paths - Path segments to append to tmp directory
2390
+ * @returns {string} The constructed tmp directory path
2391
+ */
2392
+ tmpPath(...paths: string[]): string;
2393
+ /**
2394
+ * Makes path to the contracts directory
2395
+ *
2396
+ * @param {...string} paths - Path segments to append to contracts directory
2397
+ * @returns {string} The constructed contracts directory path
2398
+ * @deprecated Use "types" directory instead
2399
+ */
2400
+ contractsPath(...paths: string[]): string;
2401
+ /**
2402
+ * Makes path to the http controllers directory
2403
+ *
2404
+ * @param {...string} paths - Path segments to append to http controllers directory
2405
+ * @returns {string} The constructed http controllers directory path
2406
+ */
2407
+ httpControllersPath(...paths: string[]): string;
2408
+ /**
2409
+ * Makes path to the models directory
2410
+ *
2411
+ * @param {...string} paths - Path segments to append to models directory
2412
+ * @returns {string} The constructed models directory path
2413
+ */
2414
+ modelsPath(...paths: string[]): string;
2415
+ /**
2416
+ * Makes path to the services directory
2417
+ *
2418
+ * @param {...string} paths - Path segments to append to services directory
2419
+ * @returns {string} The constructed services directory path
2420
+ */
2421
+ servicesPath(...paths: string[]): string;
2422
+ /**
2423
+ * Makes path to the exceptions directory
2424
+ *
2425
+ * @param {...string} paths - Path segments to append to exceptions directory
2426
+ * @returns {string} The constructed exceptions directory path
2427
+ */
2428
+ exceptionsPath(...paths: string[]): string;
2429
+ /**
2430
+ * Makes path to the mailers directory
2431
+ *
2432
+ * @param {...string} paths - Path segments to append to mailers directory
2433
+ * @returns {string} The constructed mailers directory path
2434
+ */
2435
+ mailersPath(...paths: string[]): string;
2436
+ /**
2437
+ * Makes path to the mails directory
2438
+ *
2439
+ * @param {...string} paths - Path segments to append to mails directory
2440
+ * @returns {string} The constructed mails directory path
2441
+ */
2442
+ mailsPath(...paths: string[]): string;
2443
+ /**
2444
+ * Makes path to the middleware directory
2445
+ *
2446
+ * @param {...string} paths - Path segments to append to middleware directory
2447
+ * @returns {string} The constructed middleware directory path
2448
+ */
2449
+ middlewarePath(...paths: string[]): string;
2450
+ /**
2451
+ * Makes path to the policies directory
2452
+ *
2453
+ * @param {...string} paths - Path segments to append to policies directory
2454
+ * @returns {string} The constructed policies directory path
2455
+ */
2456
+ policiesPath(...paths: string[]): string;
2457
+ /**
2458
+ * Makes path to the validators directory
2459
+ *
2460
+ * @param {...string} paths - Path segments to append to validators directory
2461
+ * @returns {string} The constructed validators directory path
2462
+ */
2463
+ validatorsPath(...paths: string[]): string;
2464
+ /**
2465
+ * Makes path to the commands directory
2466
+ *
2467
+ * @param {...string} paths - Path segments to append to commands directory
2468
+ * @returns {string} The constructed commands directory path
2469
+ */
2470
+ commandsPath(...paths: string[]): string;
2471
+ /**
2472
+ * Makes path to the events directory
2473
+ *
2474
+ * @param {...string} paths - Path segments to append to events directory
2475
+ * @returns {string} The constructed events directory path
2476
+ */
2477
+ eventsPath(...paths: string[]): string;
2478
+ /**
2479
+ * Makes path to the listeners directory
2480
+ *
2481
+ * @param {...string} paths - Path segments to append to listeners directory
2482
+ * @returns {string} The constructed listeners directory path
2483
+ */
2484
+ listenersPath(...paths: string[]): string;
2485
+ /**
2486
+ * Makes path to the transformers directory
2487
+ *
2488
+ * @param {...string} paths - Path segments to append to transformers directory
2489
+ * @returns {string} The constructed transformers directory path
2490
+ */
2491
+ transformersPath(...paths: string[]): string;
2492
+ /**
2493
+ * Makes path to the client directory for writing generated
2494
+ * output
2495
+ *
2496
+ * @param {...string} paths - Path segments to append to events directory
2497
+ * @returns {string} The constructed directory path
2498
+ */
2499
+ generatedClientPath(...paths: string[]): string;
2500
+ /**
2501
+ * Makes path to the server directory for writing generated
2502
+ * output
2503
+ *
2504
+ * @param {...string} paths - Path segments to append to events directory
2505
+ * @returns {string} The constructed directory path
2506
+ */
2507
+ generatedServerPath(...paths: string[]): string;
2508
+ /**
2509
+ * Import a module by identifier. This method uses the importer function
2510
+ * defined at the time of creating the application instance and throws
2511
+ * an error if no importer was defined.
2512
+ *
2513
+ * @param {string} moduleIdentifier - The module identifier to import
2514
+ * @returns {any} The imported module
2515
+ * @throws {RuntimeException} When no importer function is defined
2516
+ */
2517
+ import(moduleIdentifier: string): any;
2518
+ /**
2519
+ * Import a module by identifier and return its default export. This method uses the importer function
2520
+ * defined at the time of creating the application instance and throws
2521
+ * an error if no importer was defined.
2522
+ *
2523
+ * @template T - The type of the default export
2524
+ * @param {string} moduleIdentifier - The module identifier to import
2525
+ * @returns The default export of the imported module
2526
+ * @throws {RuntimeException} When no importer function is defined
2527
+ */
2528
+ importDefault<T extends object>(moduleIdentifier: string): Promise<T extends {
2529
+ default: infer A;
2530
+ } ? A : never>;
2531
+ /**
2532
+ * JSON representation of the application
2533
+ *
2534
+ * @returns The application state as a JSON object
2535
+ */
2536
+ toJSON(): {
2537
+ isReady: boolean;
2538
+ isTerminating: boolean;
2539
+ environment: AppEnvironments;
2540
+ nodeEnvironment: string;
2541
+ appName: any;
2542
+ version: string | null;
2543
+ adonisVersion: string | null;
2544
+ };
2545
+ }
2546
+ //#endregion
2547
+ //#region node_modules/@adonisjs/application/build/src/types.d.ts
2548
+ /**
2549
+ * Known application environments. The list is strictly limited to
2550
+ * AdonisJS known environments and custom environments are not
2551
+ * supported as of now.
2552
+ *
2553
+ * @example
2554
+ * // Environment-specific behavior
2555
+ * if (app.getEnvironment() === 'test') {
2556
+ * // Test-specific logic
2557
+ * }
2558
+ *
2559
+ * - 'web' - HTTP server environment
2560
+ * - 'console' - Command-line environment (ace commands)
2561
+ * - 'test' - Testing environment
2562
+ * - 'repl' - REPL environment
2563
+ * - 'unknown' - Fallback for unrecognized environments
2564
+ */
2565
+ type AppEnvironments = 'web' | 'console' | 'test' | 'repl' | 'unknown';
2566
+ /**
2567
+ * Known application states.
2568
+ *
2569
+ * - 'created' Creating an application class instance sets the state to 'created'.
2570
+ *
2571
+ * - 'initiated' Calling `app.init()` method sets the state to 'initiated'.
2572
+ * The rc file contents and environment variables are parsed during
2573
+ * init phase.
2574
+ *
2575
+ * - 'booted' Calling `app.boot()` method sets the state to `booted`. The service
2576
+ * providers are registered and booted in this state.
2577
+ *
2578
+ * - 'ready' Calling `app.start()` method sets the state to `ready`. A set of
2579
+ * pre and post start operations inside this method.
2580
+ *
2581
+ * The service providers start methods are called during pre-start phase.
2582
+ * The service providers shutdown and application terminating hooks are
2583
+ * called during post-start phase.
2584
+ *
2585
+ * - 'terminated' Calling `app.terminate' method sets the state to `terminated`. The service
2586
+ * providers shutdown methods are called in this state.
2587
+ */
2588
+ type ApplicationStates = 'created' | 'initiated' | 'booted' | 'ready' | 'terminated';
2589
+ /**
2590
+ * State shared with hooks during application lifecycle.
2591
+ * Represents the application instance parameters passed to hook functions.
2592
+ *
2593
+ * @template ContainerBindings - Type representing the container bindings
2594
+ * @example
2595
+ * // Hook function receiving application state
2596
+ * function myHook(app: Application<ContainerBindings>) {
2597
+ * // Access application instance
2598
+ * }
2599
+ */
2600
+ type HooksState<ContainerBindings extends Record<any, any>> = [[Application<ContainerBindings>], [Application<ContainerBindings>]];
2601
+ /**
2602
+ * Shape of directories object with known and unknown directories.
2603
+ * Defines the standard directory structure for an AdonisJS application.
2604
+ * Custom directories can be added via the index signature.
2605
+ *
2606
+ * @example
2607
+ * const directories: DirectoriesNode = {
2608
+ * config: './config',
2609
+ * public: './public',
2610
+ * // ... other standard directories
2611
+ * customDir: './custom' // Custom directory
2612
+ * }
2613
+ */
2614
+ interface DirectoriesNode {
2615
+ [key: string]: string;
2616
+ config: string;
2617
+ public: string;
2618
+ contracts: string;
2619
+ providers: string;
2620
+ languageFiles: string;
2621
+ migrations: string;
2622
+ seeders: string;
2623
+ factories: string;
2624
+ views: string;
2625
+ start: string;
2626
+ tmp: string;
2627
+ httpControllers: string;
2628
+ models: string;
2629
+ services: string;
2630
+ exceptions: string;
2631
+ mailers: string;
2632
+ middleware: string;
2633
+ policies: string;
2634
+ validators: string;
2635
+ commands: string;
2636
+ events: string;
2637
+ listeners: string;
2638
+ transformers: string;
2639
+ stubs: string;
2640
+ generatedClient: string;
2641
+ generatedServer: string;
2642
+ }
2643
+ /**
2644
+ * To be extended by packages that want to introduce experimental flags.
2645
+ * This interface can be augmented by packages to add their own experimental features.
2646
+ *
2647
+ * @example
2648
+ * // In a package's types file:
2649
+ * declare module '@adonisjs/application/types' {
2650
+ * interface ExperimentalFlagsList {
2651
+ * myExperimentalFeature: boolean
2652
+ * }
2653
+ * }
2654
+ */
2655
+ interface ExperimentalFlagsList {}
2656
+ /**
2657
+ * Shape of preload files configuration.
2658
+ * Preload files are automatically imported during application boot
2659
+ * for specific environments.
2660
+ *
2661
+ * @example
2662
+ * const preloadFile: PreloadNode = {
2663
+ * file: () => import('./start/routes.js'),
2664
+ * environment: ['web', 'console']
2665
+ * }
2666
+ */
2667
+ type PreloadNode = {
2668
+ file: () => Promise<any>;
2669
+ environment: Exclude<AppEnvironments, 'unknown'>[];
2670
+ };
2671
+ /**
2672
+ * Shape of provider modules configuration.
2673
+ * Providers are service containers that register bindings and boot
2674
+ * application services for specific environments.
2675
+ *
2676
+ * @example
2677
+ * const provider: ProviderNode = {
2678
+ * file: () => import('./providers/database_provider.js'),
2679
+ * environment: ['web', 'console']
2680
+ * }
2681
+ */
2682
+ type ProviderNode = {
2683
+ file: () => Promise<{
2684
+ default?: new (app: Application<any>) => ContainerProviderContract;
2685
+ }>;
2686
+ environment: Exclude<AppEnvironments, 'unknown'>[];
2687
+ };
2688
+ /**
2689
+ * Shape of semantic version node.
2690
+ * Represents a parsed semantic version with its components
2691
+ * and utility methods.
2692
+ *
2693
+ * @example
2694
+ * const version: SemverNode = {
2695
+ * major: 1,
2696
+ * minor: 2,
2697
+ * patch: 3,
2698
+ * prerelease: ['beta', 1],
2699
+ * version: '1.2.3-beta.1',
2700
+ * toString: () => '1.2.3-beta.1'
2701
+ * }
2702
+ */
2703
+ type SemverNode = {
2704
+ major: number;
2705
+ minor: number;
2706
+ patch: number;
2707
+ prerelease: (string | number)[];
2708
+ version: string;
2709
+ toString(): string;
2710
+ };
2711
+ /**
2712
+ * Shape of meta file configuration inside the `metaFiles` array
2713
+ * in the `adonisrc.js` file.
2714
+ * Meta files are watched for changes and can trigger server reloads.
2715
+ *
2716
+ * @example
2717
+ * const metaFile: MetaFileNode = {
2718
+ * pattern: './config/**\/*.ts',
2719
+ * reloadServer: true // Reload server when files matching pattern change
2720
+ * }
2721
+ */
2722
+ type MetaFileNode = {
2723
+ pattern: string;
2724
+ reloadServer: boolean;
2725
+ };
2726
+ /**
2727
+ * Shape of the adonisrc.js configuration file.
2728
+ * This is the main configuration file that defines the application structure,
2729
+ * providers, preloads, and other essential settings.
2730
+ *
2731
+ * @example
2732
+ * const rcFile: RcFile = {
2733
+ * typescript: true,
2734
+ * directories: { ... },
2735
+ * providers: [...],
2736
+ * preloads: [...],
2737
+ * // ... other configurations
2738
+ * }
2739
+ */
2740
+ type RcFile = {
2741
+ /**
2742
+ * Indicates whether this is a TypeScript project.
2743
+ */
2744
+ typescript: boolean;
2745
+ /**
2746
+ * List of configured directories for the application.
2747
+ * Combines standard AdonisJS directories with custom ones.
2748
+ */
2749
+ directories: DirectoriesNode & {
2750
+ [key: string]: string;
2751
+ };
2752
+ /**
2753
+ * Array of files to preload after the application has been booted.
2754
+ * These files are automatically imported based on environment.
2755
+ */
2756
+ preloads: PreloadNode[];
2757
+ /**
2758
+ * Array of meta files to watch for changes.
2759
+ * Used by development tools to trigger server reloads.
2760
+ */
2761
+ metaFiles: MetaFileNode[];
2762
+ /**
2763
+ * Providers to register in the IoC container.
2764
+ * Providers are registered based on their environment configuration.
2765
+ */
2766
+ providers: ProviderNode[];
2767
+ /**
2768
+ * Array of Ace commands to register.
2769
+ * Each entry is a function that imports a command class.
2770
+ */
2771
+ commands: (() => Promise<any>)[];
2772
+ /**
2773
+ * Custom aliases for Ace commands.
2774
+ * Maps alias names to actual command names.
2775
+ *
2776
+ * @example
2777
+ * { 'm:c': 'make:controller', 'serve': 'serve' }
2778
+ */
2779
+ commandsAliases: {
2780
+ [key: string]: string;
2781
+ };
2782
+ /**
2783
+ * Assembler hooks configuration for build processes.
2784
+ * Hooks are executed during various build lifecycle events.
2785
+ */
2786
+ hooks: AssemblerRcFile['hooks'];
2787
+ /**
2788
+ * Test suites configuration for the application.
2789
+ * Defines test files, directories, and execution settings.
2790
+ */
2791
+ tests: {
2792
+ suites: {
2793
+ name: string;
2794
+ files: string | string[];
2795
+ directories: string[];
2796
+ timeout?: number;
2797
+ }[];
2798
+ forceExit: boolean;
2799
+ timeout: number;
2800
+ };
2801
+ /**
2802
+ * Reference to the raw contents of the `adonisrc.js` file.
2803
+ * Contains the original, unprocessed configuration object.
2804
+ */
2805
+ raw: Record<string, any>;
2806
+ /**
2807
+ * Flags to enable experimental features.
2808
+ * Can be extended by packages to add their own experimental options.
2809
+ */
2810
+ experimental: ExperimentalFlagsList;
2811
+ };
2812
+ /**
2813
+ * Input shape for RcFile configuration.
2814
+ * A partial version of RcFile used when creating or updating
2815
+ * the application configuration. Includes preset functions for
2816
+ * applying common configurations.
2817
+ *
2818
+ * @example
2819
+ * const input: RcFileInput = {
2820
+ * typescript: true,
2821
+ * presets: [webPreset()],
2822
+ * directories: { controllers: './app/controllers' }
2823
+ * }
2824
+ */
2825
+ interface RcFileInput {
2826
+ /**
2827
+ * List of preset functions to apply to the configuration.
2828
+ * Presets provide common configuration patterns.
2829
+ */
2830
+ presets?: PresetFn[];
2831
+ typescript?: RcFile['typescript'];
2832
+ directories?: Partial<DirectoriesNode> & {
2833
+ [key: string]: string;
2834
+ };
2835
+ preloads?: (PreloadNode | PreloadNode['file'])[];
2836
+ metaFiles?: string[] | RcFile['metaFiles'];
2837
+ commands?: RcFile['commands'];
2838
+ commandsAliases?: RcFile['commandsAliases'];
2839
+ tests?: {
2840
+ suites: {
2841
+ name: string;
2842
+ files: string | string[];
2843
+ timeout?: number;
2844
+ }[];
2845
+ forceExit?: boolean;
2846
+ timeout?: number;
2847
+ };
2848
+ providers?: (ProviderNode | ProviderNode['file'])[];
2849
+ hooks?: RcFile['hooks'];
2850
+ /**
2851
+ * Optional flags to enable experimental features.
2852
+ * Can be extended by packages to add their own experimental options.
2853
+ */
2854
+ experimental?: ExperimentalFlagsList;
2855
+ }
2856
+ /**
2857
+ * RCFile after has been normalized by the RCManager. This file is
2858
+ * shared with the presets
2859
+ */
2860
+ type NormalizedRcFileInput = Prettify<Required<Omit<RcFileInput, 'directories'> & {
2861
+ directories: RcFile['directories'];
2862
+ }>>;
2863
+ /**
2864
+ * Contract for service provider classes.
2865
+ * Service providers are used to register bindings in the IoC container
2866
+ * and boot application services during different lifecycle phases.
2867
+ *
2868
+ * @example
2869
+ * export default class MyProvider implements ContainerProviderContract {
2870
+ * register() {
2871
+ * this.app.container.singleton('myService', () => new MyService())
2872
+ * }
2873
+ *
2874
+ * boot() {
2875
+ * // Boot logic
2876
+ * }
2877
+ * }
2878
+ */
2879
+ interface ContainerProviderContract {
2880
+ /**
2881
+ * The register method is called to register bindings in the IoC container.
2882
+ * This is where you should bind services, singletons, and other dependencies.
2883
+ */
2884
+ register?(): void;
2885
+ /**
2886
+ * The boot method is called to boot application state.
2887
+ * Use this method for registering macros, middleware, REPL bindings,
2888
+ * and other application-level configurations.
2889
+ */
2890
+ boot?(): AsyncOrSync<void>;
2891
+ /**
2892
+ * The start method is called after all providers have been booted.
2893
+ * This is the ideal place to use existing container bindings and
2894
+ * perform startup operations that depend on other services.
2895
+ */
2896
+ start?(): AsyncOrSync<void>;
2897
+ /**
2898
+ * The ready method is called when the application is fully ready.
2899
+ * For HTTP servers, this is called after the server starts listening.
2900
+ * Preloaded files have been imported and the app is ready to serve requests.
2901
+ */
2902
+ ready?(): AsyncOrSync<void>;
2903
+ /**
2904
+ * The shutdown method is called during graceful application shutdown.
2905
+ * Use this method to clean up resources, close connections, and perform
2906
+ * other cleanup tasks. Avoid long-running operations to prevent forceful termination.
2907
+ */
2908
+ shutdown?(): AsyncOrSync<void>;
2909
+ }
2910
+ /**
2911
+ * Function type for importing modules in the context of an AdonisJS application.
2912
+ * This function is called whenever AdonisJS needs to import a module from a string identifier.
2913
+ *
2914
+ * @param moduleIdentifier - The module identifier or path to import
2915
+ * @param options - Optional import call options
2916
+ * @returns The imported module
2917
+ *
2918
+ * @example
2919
+ * const importer: Importer = (id, options) => import(id)
2920
+ */
2921
+ type Importer = (moduleIdentifier: string, options?: ImportCallOptions) => any;
2922
+ /**
2923
+ * Type for AdonisRC preset functions.
2924
+ * Preset functions are used to apply common configuration patterns
2925
+ * to the RcFile configuration object.
2926
+ *
2927
+ * @param options - Object containing the RcFile to modify
2928
+ *
2929
+ * @example
2930
+ * const webPreset: PresetFn = ({ rcFile }) => {
2931
+ * rcFile.providers.push(httpProvider)
2932
+ * rcFile.preloads.push(routesPreload)
2933
+ * }
2934
+ */
2935
+ type PresetFn = (options: {
2936
+ rcFile: NormalizedRcFileInput;
2937
+ }) => void;
2938
+ /**
2939
+ * Represents a prepared stub ready for file generation.
2940
+ * Contains the rendered content and metadata extracted from the stub template,
2941
+ * but has not yet been written to disk.
2942
+ *
2943
+ * @example
2944
+ * const preparedStub: PreparedStub = {
2945
+ * contents: 'export class User {}',
2946
+ * destination: '/app/models/user.ts',
2947
+ * force: false,
2948
+ * attributes: { to: '/app/models/user.ts' }
2949
+ * }
2950
+ */
2951
+ type PreparedStub = {
2952
+ /** The rendered contents of the stub template */contents: string; /** The absolute path where the file should be written */
2953
+ destination: string; /** Whether to overwrite existing files */
2954
+ force: boolean; /** Additional metadata exported from the stub template */
2955
+ attributes: Record<string, any>;
2956
+ };
2957
+ /**
2958
+ * Base type for generated stubs, excluding the 'force' property
2959
+ * which is only relevant during preparation phase.
2960
+ */
2961
+ type GeneratedStubBase = Omit<PreparedStub, 'force'>;
2962
+ /**
2963
+ * Represents the result of stub generation after attempting to write to disk.
2964
+ * Indicates whether the file was created, skipped, or force-created with reasons.
2965
+ *
2966
+ * @example
2967
+ * // File created successfully
2968
+ * const result: GeneratedStub = {
2969
+ * status: 'created',
2970
+ * skipReason: null,
2971
+ * contents: '...',
2972
+ * destination: '/path/to/file.ts',
2973
+ * attributes: {}
2974
+ * }
2975
+ *
2976
+ * @example
2977
+ * // File already exists and force was not enabled
2978
+ * const result: GeneratedStub = {
2979
+ * status: 'skipped',
2980
+ * skipReason: 'File already exists',
2981
+ * contents: '...',
2982
+ * destination: '/path/to/file.ts',
2983
+ * attributes: {}
2984
+ * }
2985
+ */
2986
+ type GeneratedStub = (GeneratedStubBase & {
2987
+ /** File generation was skipped */status: 'skipped'; /** Reason why the file was skipped */
2988
+ skipReason: string;
2989
+ }) | (GeneratedStubBase & {
2990
+ /** File was successfully created */status: 'created';
2991
+ skipReason: null;
2992
+ }) | (GeneratedStubBase & {
2993
+ /** File was overwritten because force option was enabled */status: 'force_created';
2994
+ skipReason: null;
2995
+ });
2996
+ //#endregion
2997
+ //#region src/generators/base_generator.d.ts
2998
+ declare abstract class BaseGenerator {
2999
+ protected app: ApplicationService;
3000
+ protected logger: any;
3001
+ protected manifest?: string[] | undefined;
3002
+ protected forceOverwrite: boolean;
3003
+ protected codemods: Codemods;
3004
+ constructor(app: ApplicationService, logger: any, manifest?: string[] | undefined, codemods?: Codemods, forceOverwrite?: boolean);
3005
+ protected generateStub(stubPath: string, stubState: any, customStubPath?: string): Promise<GeneratedStub>;
3006
+ abstract generate(name: string, definition: any, ...args: any[]): Promise<void>;
3007
+ }
3008
+ //#endregion
3009
+ export { BaseGenerator as t };