@adonisjs/core 6.1.5-9 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/build/commands/build.d.ts +3 -5
- package/build/commands/build.js +5 -9
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.d.ts +21 -28
- package/build/commands/configure.js +60 -118
- package/build/commands/eject.js +2 -1
- package/build/commands/generate_key.js +2 -2
- package/build/commands/inspect_rcfile.js +19 -2
- package/build/commands/main.d.ts +4 -0
- package/build/commands/make/command.d.ts +1 -1
- package/build/commands/make/command.js +5 -2
- package/build/commands/make/controller.d.ts +2 -1
- package/build/commands/make/controller.js +33 -10
- package/build/commands/make/event.d.ts +1 -1
- package/build/commands/make/event.js +5 -3
- package/build/commands/make/exception.d.ts +1 -1
- package/build/commands/make/exception.js +6 -4
- package/build/commands/make/listener.d.ts +1 -1
- package/build/commands/make/listener.js +9 -6
- package/build/commands/make/middleware.d.ts +2 -1
- package/build/commands/make/middleware.js +50 -4
- package/build/commands/make/preload.d.ts +4 -3
- package/build/commands/make/preload.js +34 -35
- package/build/commands/make/provider.d.ts +7 -1
- package/build/commands/make/provider.js +57 -7
- package/build/commands/make/service.d.ts +1 -1
- package/build/commands/make/service.js +5 -3
- package/build/commands/make/test.d.ts +1 -1
- package/build/commands/make/test.js +7 -5
- package/build/commands/make/validator.d.ts +19 -0
- package/build/commands/make/validator.js +53 -0
- package/build/commands/make/view.d.ts +14 -0
- package/build/commands/make/view.js +37 -0
- package/build/commands/serve.js +7 -4
- package/build/commands/test.js +2 -2
- package/build/factories/core/ace.d.ts +2 -2
- package/build/factories/core/ignitor.d.ts +2 -2
- package/build/factories/core/ignitor.js +8 -9
- package/build/factories/core/main.d.ts +0 -1
- package/build/factories/core/main.js +0 -1
- package/build/factories/core/test_utils.d.ts +2 -2
- package/build/factories/stubs.d.ts +2 -2
- package/build/factories/stubs.js +3 -2
- package/build/index.d.ts +11 -140
- package/build/index.js +5 -1
- package/build/modules/ace/codemods.d.ts +93 -0
- package/build/modules/ace/codemods.js +259 -0
- package/build/modules/ace/commands.d.ts +6 -81
- package/build/modules/ace/commands.js +12 -33
- package/build/modules/ace/create_kernel.d.ts +1 -1
- package/build/modules/ace/create_kernel.js +19 -3
- package/build/modules/env/editor.d.ts +1 -0
- package/build/modules/env/editor.js +9 -0
- package/build/modules/hash/define_config.d.ts +29 -12
- package/build/modules/hash/define_config.js +52 -11
- package/build/modules/hash/drivers/argon.d.ts +1 -0
- package/build/modules/hash/drivers/argon.js +9 -0
- package/build/modules/hash/drivers/bcrypt.d.ts +1 -0
- package/build/modules/hash/drivers/bcrypt.js +9 -0
- package/build/modules/hash/drivers/scrypt.d.ts +1 -0
- package/build/modules/hash/drivers/scrypt.js +9 -0
- package/build/modules/hash/main.d.ts +1 -2
- package/build/modules/hash/main.js +1 -2
- package/build/modules/hash/phc_formatter.d.ts +1 -0
- package/build/modules/hash/phc_formatter.js +9 -0
- package/build/modules/http/main.d.ts +5 -0
- package/build/modules/http/main.js +5 -0
- package/build/modules/http/request_validator.d.ts +4 -14
- package/build/modules/http/request_validator.js +2 -10
- package/build/providers/app_provider.d.ts +14 -0
- package/build/providers/app_provider.js +47 -3
- package/build/providers/edge_provider.d.ts +31 -0
- package/build/providers/edge_provider.js +70 -0
- package/build/providers/hash_provider.d.ts +0 -4
- package/build/providers/hash_provider.js +11 -11
- package/build/providers/repl_provider.js +78 -7
- package/build/providers/vinejs_provider.d.ts +43 -0
- package/build/{src/vinejs/extensions/validates_files.js → providers/vinejs_provider.js} +26 -5
- package/build/src/config_provider.d.ts +9 -0
- package/build/src/config_provider.js +26 -0
- package/build/src/debug.d.ts +1 -1
- package/build/src/helpers/assert.d.ts +1 -0
- package/build/src/helpers/assert.js +9 -0
- package/build/src/helpers/main.d.ts +2 -2
- package/build/src/helpers/main.js +2 -2
- package/build/src/helpers/types.d.ts +109 -16
- package/build/src/helpers/types.js +3 -3
- package/build/src/ignitor/ace.js +3 -1
- package/build/src/ignitor/http.d.ts +2 -2
- package/build/src/ignitor/http.js +5 -1
- package/build/src/ignitor/main.d.ts +2 -2
- package/build/src/ignitor/main.js +1 -1
- package/build/src/test_utils/http.d.ts +2 -2
- package/build/src/test_utils/main.d.ts +3 -3
- package/build/src/types.d.ts +17 -17
- package/build/stubs/make/command/main.stub +6 -4
- package/build/stubs/make/controller/actions.stub +14 -0
- package/build/stubs/make/controller/api.stub +6 -4
- package/build/stubs/make/controller/main.stub +6 -4
- package/build/stubs/make/controller/resource.stub +6 -4
- package/build/stubs/make/event/main.stub +5 -3
- package/build/stubs/make/exception/main.stub +5 -3
- package/build/stubs/make/listener/for_event.stub +6 -4
- package/build/stubs/make/listener/main.stub +5 -3
- package/build/stubs/make/middleware/main.stub +7 -5
- package/build/stubs/make/{preload_file → preload}/main.stub +5 -3
- package/build/stubs/make/provider/main.stub +6 -4
- package/build/stubs/make/service/main.stub +5 -3
- package/build/stubs/make/test/main.stub +5 -3
- package/build/stubs/make/validator/main.stub +7 -0
- package/build/stubs/make/validator/resource.stub +26 -0
- package/build/stubs/make/view/main.stub +6 -0
- package/build/types/bodyparser.js +1 -1
- package/build/types/helpers.d.ts +1 -0
- package/build/{src/vinejs/extensions/main.js → types/helpers.js} +1 -1
- package/build/types/http.d.ts +7 -0
- package/package.json +68 -59
- package/build/commands/make/_base.d.ts +0 -36
- package/build/commands/make/_base.js +0 -27
- package/build/modules/ace/shell.d.ts +0 -12
- package/build/modules/ace/shell.js +0 -49
- package/build/modules/hash/drivers_collection.d.ts +0 -21
- package/build/modules/hash/drivers_collection.js +0 -45
- package/build/providers/http_provider.d.ts +0 -26
- package/build/providers/http_provider.js +0 -61
- package/build/src/bindings/repl.d.ts +0 -6
- package/build/src/bindings/repl.js +0 -78
- package/build/src/vinejs/extensions/main.d.ts +0 -1
- package/build/src/vinejs/extensions/validates_files.d.ts +0 -22
- /package/build/modules/{env.d.ts → env/main.d.ts} +0 -0
- /package/build/modules/{env.js → env/main.js} +0 -0
- /package/build/stubs/{index.d.ts → main.d.ts} +0 -0
- /package/build/stubs/{index.js → main.js} +0 -0
|
@@ -1,26 +1,119 @@
|
|
|
1
|
-
/// <reference types="@types/node" resolution-mode="require"/>
|
|
2
|
-
import is from '@sindresorhus/is';
|
|
3
1
|
/**
|
|
4
2
|
* @deprecated
|
|
5
3
|
* Use "is" helpers instead. The types helpers exists
|
|
6
4
|
* for backward compatibility
|
|
7
5
|
*/
|
|
8
6
|
declare const types: {
|
|
9
|
-
lookup:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
lookup: ((value: unknown) => import("@sindresorhus/is").TypeName) & {
|
|
8
|
+
all: typeof import("@sindresorhus/is").isAll;
|
|
9
|
+
any: typeof import("@sindresorhus/is").isAny;
|
|
10
|
+
array: typeof import("@sindresorhus/is").isArray;
|
|
11
|
+
arrayBuffer: typeof import("@sindresorhus/is").isArrayBuffer;
|
|
12
|
+
arrayLike: typeof import("@sindresorhus/is").isArrayLike;
|
|
13
|
+
asyncFunction: typeof import("@sindresorhus/is").isAsyncFunction;
|
|
14
|
+
asyncGenerator: typeof import("@sindresorhus/is").isAsyncGenerator;
|
|
15
|
+
asyncGeneratorFunction: typeof import("@sindresorhus/is").isAsyncGeneratorFunction;
|
|
16
|
+
asyncIterable: typeof import("@sindresorhus/is").isAsyncIterable;
|
|
17
|
+
bigint: typeof import("@sindresorhus/is").isBigint;
|
|
18
|
+
bigInt64Array: typeof import("@sindresorhus/is").isBigInt64Array;
|
|
19
|
+
bigUint64Array: typeof import("@sindresorhus/is").isBigUint64Array;
|
|
20
|
+
blob: typeof import("@sindresorhus/is").isBlob;
|
|
21
|
+
boolean: typeof import("@sindresorhus/is").isBoolean;
|
|
22
|
+
boundFunction: typeof import("@sindresorhus/is").isBoundFunction;
|
|
23
|
+
buffer: typeof import("@sindresorhus/is").isBuffer;
|
|
24
|
+
class: typeof import("@sindresorhus/is").isClass;
|
|
25
|
+
class_: typeof import("@sindresorhus/is").isClass;
|
|
26
|
+
dataView: typeof import("@sindresorhus/is").isDataView;
|
|
27
|
+
date: typeof import("@sindresorhus/is").isDate;
|
|
28
|
+
detect: (value: unknown) => import("@sindresorhus/is").TypeName;
|
|
29
|
+
directInstanceOf: typeof import("@sindresorhus/is").isDirectInstanceOf;
|
|
30
|
+
domElement: typeof import("@sindresorhus/is").isHtmlElement;
|
|
31
|
+
emptyArray: typeof import("@sindresorhus/is").isEmptyArray;
|
|
32
|
+
emptyMap: typeof import("@sindresorhus/is").isEmptyMap;
|
|
33
|
+
emptyObject: typeof import("@sindresorhus/is").isEmptyObject;
|
|
34
|
+
emptySet: typeof import("@sindresorhus/is").isEmptySet;
|
|
35
|
+
emptyString: typeof import("@sindresorhus/is").isEmptyString;
|
|
36
|
+
emptyStringOrWhitespace: typeof import("@sindresorhus/is").isEmptyStringOrWhitespace;
|
|
37
|
+
enumCase: typeof import("@sindresorhus/is").isEnumCase;
|
|
38
|
+
error: typeof import("@sindresorhus/is").isError;
|
|
39
|
+
evenInteger: typeof import("@sindresorhus/is").isEvenInteger;
|
|
40
|
+
falsy: typeof import("@sindresorhus/is").isFalsy;
|
|
41
|
+
float32Array: typeof import("@sindresorhus/is").isFloat32Array;
|
|
42
|
+
float64Array: typeof import("@sindresorhus/is").isFloat64Array;
|
|
43
|
+
formData: typeof import("@sindresorhus/is").isFormData;
|
|
44
|
+
function: typeof import("@sindresorhus/is").isFunction;
|
|
45
|
+
function_: typeof import("@sindresorhus/is").isFunction;
|
|
46
|
+
generator: typeof import("@sindresorhus/is").isGenerator;
|
|
47
|
+
generatorFunction: typeof import("@sindresorhus/is").isGeneratorFunction;
|
|
48
|
+
htmlElement: typeof import("@sindresorhus/is").isHtmlElement;
|
|
49
|
+
infinite: typeof import("@sindresorhus/is").isInfinite;
|
|
50
|
+
inRange: typeof import("@sindresorhus/is").isInRange;
|
|
51
|
+
int16Array: typeof import("@sindresorhus/is").isInt16Array;
|
|
52
|
+
int32Array: typeof import("@sindresorhus/is").isInt32Array;
|
|
53
|
+
int8Array: typeof import("@sindresorhus/is").isInt8Array;
|
|
54
|
+
integer: typeof import("@sindresorhus/is").isInteger;
|
|
55
|
+
iterable: typeof import("@sindresorhus/is").isIterable;
|
|
56
|
+
map: typeof import("@sindresorhus/is").isMap;
|
|
57
|
+
nan: typeof import("@sindresorhus/is").isNan;
|
|
58
|
+
nativePromise: typeof import("@sindresorhus/is").isNativePromise;
|
|
59
|
+
negativeNumber: typeof import("@sindresorhus/is").isNegativeNumber;
|
|
60
|
+
nodeStream: typeof import("@sindresorhus/is").isNodeStream;
|
|
61
|
+
nonEmptyArray: typeof import("@sindresorhus/is").isNonEmptyArray;
|
|
62
|
+
nonEmptyMap: typeof import("@sindresorhus/is").isNonEmptyMap;
|
|
63
|
+
nonEmptyObject: typeof import("@sindresorhus/is").isNonEmptyObject;
|
|
64
|
+
nonEmptySet: typeof import("@sindresorhus/is").isNonEmptySet;
|
|
65
|
+
nonEmptyString: typeof import("@sindresorhus/is").isNonEmptyString;
|
|
66
|
+
nonEmptyStringAndNotWhitespace: typeof import("@sindresorhus/is").isNonEmptyStringAndNotWhitespace;
|
|
67
|
+
null: typeof import("@sindresorhus/is").isNull;
|
|
68
|
+
null_: typeof import("@sindresorhus/is").isNull;
|
|
69
|
+
nullOrUndefined: typeof import("@sindresorhus/is").isNullOrUndefined;
|
|
70
|
+
number: typeof import("@sindresorhus/is").isNumber;
|
|
71
|
+
numericString: typeof import("@sindresorhus/is").isNumericString;
|
|
72
|
+
object: typeof import("@sindresorhus/is").isObject;
|
|
73
|
+
observable: typeof import("@sindresorhus/is").isObservable;
|
|
74
|
+
oddInteger: typeof import("@sindresorhus/is").isOddInteger;
|
|
75
|
+
plainObject: typeof import("@sindresorhus/is").isPlainObject;
|
|
76
|
+
positiveNumber: typeof import("@sindresorhus/is").isPositiveNumber;
|
|
77
|
+
primitive: typeof import("@sindresorhus/is").isPrimitive;
|
|
78
|
+
promise: typeof import("@sindresorhus/is").isPromise;
|
|
79
|
+
propertyKey: typeof import("@sindresorhus/is").isPropertyKey;
|
|
80
|
+
regExp: typeof import("@sindresorhus/is").isRegExp;
|
|
81
|
+
safeInteger: typeof import("@sindresorhus/is").isSafeInteger;
|
|
82
|
+
set: typeof import("@sindresorhus/is").isSet;
|
|
83
|
+
sharedArrayBuffer: typeof import("@sindresorhus/is").isSharedArrayBuffer;
|
|
84
|
+
string: typeof import("@sindresorhus/is").isString;
|
|
85
|
+
symbol: typeof import("@sindresorhus/is").isSymbol;
|
|
86
|
+
truthy: typeof import("@sindresorhus/is").isTruthy;
|
|
87
|
+
tupleLike: typeof import("@sindresorhus/is").isTupleLike;
|
|
88
|
+
typedArray: typeof import("@sindresorhus/is").isTypedArray;
|
|
89
|
+
uint16Array: typeof import("@sindresorhus/is").isUint16Array;
|
|
90
|
+
uint32Array: typeof import("@sindresorhus/is").isUint32Array;
|
|
91
|
+
uint8Array: typeof import("@sindresorhus/is").isUint8Array;
|
|
92
|
+
uint8ClampedArray: typeof import("@sindresorhus/is").isUint8ClampedArray;
|
|
93
|
+
undefined: typeof import("@sindresorhus/is").isUndefined;
|
|
94
|
+
urlInstance: typeof import("@sindresorhus/is").isUrlInstance;
|
|
95
|
+
urlSearchParams: typeof import("@sindresorhus/is").isUrlSearchParams;
|
|
96
|
+
urlString: typeof import("@sindresorhus/is").isUrlString;
|
|
97
|
+
validLength: typeof import("@sindresorhus/is").isValidLength;
|
|
98
|
+
weakMap: typeof import("@sindresorhus/is").isWeakMap;
|
|
99
|
+
weakRef: typeof import("@sindresorhus/is").isWeakRef;
|
|
100
|
+
weakSet: typeof import("@sindresorhus/is").isWeakSet;
|
|
101
|
+
whitespaceString: typeof import("@sindresorhus/is").isWhitespaceString;
|
|
102
|
+
};
|
|
103
|
+
isNull: typeof import("@sindresorhus/is").isNull;
|
|
104
|
+
isBoolean: typeof import("@sindresorhus/is").isBoolean;
|
|
105
|
+
isBuffer: typeof import("@sindresorhus/is").isBuffer;
|
|
106
|
+
isNumber: typeof import("@sindresorhus/is").isNumber;
|
|
107
|
+
isString: typeof import("@sindresorhus/is").isString;
|
|
15
108
|
isArguments: any;
|
|
16
|
-
isObject: (
|
|
17
|
-
isDate: (
|
|
18
|
-
isArray:
|
|
19
|
-
isRegexp: (
|
|
20
|
-
isError: (
|
|
21
|
-
isFunction: (
|
|
22
|
-
isClass:
|
|
23
|
-
isInteger: (
|
|
109
|
+
isObject: typeof import("@sindresorhus/is").isObject;
|
|
110
|
+
isDate: typeof import("@sindresorhus/is").isDate;
|
|
111
|
+
isArray: typeof import("@sindresorhus/is").isArray;
|
|
112
|
+
isRegexp: typeof import("@sindresorhus/is").isRegExp;
|
|
113
|
+
isError: typeof import("@sindresorhus/is").isError;
|
|
114
|
+
isFunction: typeof import("@sindresorhus/is").isFunction;
|
|
115
|
+
isClass: typeof import("@sindresorhus/is").isClass;
|
|
116
|
+
isInteger: typeof import("@sindresorhus/is").isInteger;
|
|
24
117
|
isFloat(value: number): value is number;
|
|
25
118
|
isDecimal(value: string | number, options?: {
|
|
26
119
|
decimalPlaces?: string;
|
|
@@ -14,7 +14,7 @@ import is from '@sindresorhus/is';
|
|
|
14
14
|
*/
|
|
15
15
|
const types = {
|
|
16
16
|
lookup: is,
|
|
17
|
-
isNull: is.
|
|
17
|
+
isNull: is.null,
|
|
18
18
|
isBoolean: is.boolean,
|
|
19
19
|
isBuffer: is.buffer,
|
|
20
20
|
isNumber: is.number,
|
|
@@ -25,8 +25,8 @@ const types = {
|
|
|
25
25
|
isArray: is.array,
|
|
26
26
|
isRegexp: is.regExp,
|
|
27
27
|
isError: is.error,
|
|
28
|
-
isFunction: is.
|
|
29
|
-
isClass: is.
|
|
28
|
+
isFunction: is.function,
|
|
29
|
+
isClass: is.class,
|
|
30
30
|
isInteger: is.integer,
|
|
31
31
|
isFloat(value) {
|
|
32
32
|
return value !== (value | 0);
|
package/build/src/ignitor/ace.js
CHANGED
|
@@ -39,7 +39,9 @@ export class AceProcess {
|
|
|
39
39
|
const app = this.#ignitor.createApp('console');
|
|
40
40
|
await app.init();
|
|
41
41
|
const { createAceKernel } = await import('../../modules/ace/create_kernel.js');
|
|
42
|
-
const
|
|
42
|
+
const commandNameIndex = argv.findIndex((value) => !value.startsWith('-'));
|
|
43
|
+
const commandName = argv[commandNameIndex];
|
|
44
|
+
const kernel = createAceKernel(app, commandName);
|
|
43
45
|
app.container.bindValue('ace', kernel);
|
|
44
46
|
/**
|
|
45
47
|
* Hook into kernel and start the app when the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import type { Server as NodeHttpsServer } from 'node:https';
|
|
4
4
|
import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
|
|
5
5
|
import { Ignitor } from './main.js';
|
|
@@ -91,6 +91,7 @@ export class HttpServerProcess {
|
|
|
91
91
|
* Start the HTTP server by wiring up the application
|
|
92
92
|
*/
|
|
93
93
|
async start(serverCallback) {
|
|
94
|
+
const startTime = process.hrtime();
|
|
94
95
|
/**
|
|
95
96
|
* Method to create the HTTP server
|
|
96
97
|
*/
|
|
@@ -119,7 +120,10 @@ export class HttpServerProcess {
|
|
|
119
120
|
/**
|
|
120
121
|
* Notify
|
|
121
122
|
*/
|
|
122
|
-
this.#notifyServerHasStarted(app, logger, emitter,
|
|
123
|
+
this.#notifyServerHasStarted(app, logger, emitter, {
|
|
124
|
+
...payload,
|
|
125
|
+
duration: process.hrtime(startTime),
|
|
126
|
+
});
|
|
123
127
|
/**
|
|
124
128
|
* Monitor app and the server (after the server is listening)
|
|
125
129
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import { AceProcess } from './ace.js';
|
|
3
3
|
import { TestRunnerProcess } from './test.js';
|
|
4
4
|
import { HttpServerProcess } from './http.js';
|
|
@@ -10,7 +10,7 @@ import type { ApplicationService, IgnitorOptions } from '../types.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class Ignitor {
|
|
12
12
|
#private;
|
|
13
|
-
constructor(appRoot: URL, options
|
|
13
|
+
constructor(appRoot: URL, options?: IgnitorOptions);
|
|
14
14
|
/**
|
|
15
15
|
* Get access to the application instance created
|
|
16
16
|
* by either the http server process or the ace
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import type { TestUtils } from './main.js';
|
|
4
4
|
import type { Server as NodeHttpsServer } from 'node:https';
|
|
5
5
|
import { IncomingMessage, ServerResponse, Server as NodeHttpServer } from 'node:http';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import Macroable from '@poppinss/macroable';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
4
|
import { HttpServerUtils } from './http.js';
|
|
5
|
-
import { CookieClient } from '../../modules/http/main.js';
|
|
6
5
|
import type { ApplicationService } from '../types.js';
|
|
6
|
+
import { CookieClient, type HttpContext } from '../../modules/http/main.js';
|
|
7
7
|
/**
|
|
8
8
|
* Test utils has a collection of helper methods to make testing
|
|
9
9
|
* experience great for AdonisJS applications
|
|
@@ -33,5 +33,5 @@ export declare class TestUtils extends Macroable {
|
|
|
33
33
|
createHttpContext(options?: {
|
|
34
34
|
req?: IncomingMessage;
|
|
35
35
|
res?: ServerResponse;
|
|
36
|
-
}): Promise<
|
|
36
|
+
}): Promise<HttpContext>;
|
|
37
37
|
}
|
package/build/src/types.d.ts
CHANGED
|
@@ -4,28 +4,36 @@ import type { Emitter } from '../modules/events.js';
|
|
|
4
4
|
import type { Kernel } from '../modules/ace/main.js';
|
|
5
5
|
import type { Application } from '../modules/app.js';
|
|
6
6
|
import type { TestUtils } from './test_utils/main.js';
|
|
7
|
+
import type { HttpServerEvents } from '../types/http.js';
|
|
7
8
|
import type { LoggerManager } from '../modules/logger.js';
|
|
9
|
+
import type { HashManager } from '../modules/hash/main.js';
|
|
8
10
|
import type { Encryption } from '../modules/encryption.js';
|
|
11
|
+
import type { ManagerDriverFactory } from '../types/hash.js';
|
|
9
12
|
import type { Router, Server } from '../modules/http/main.js';
|
|
10
|
-
import type { HttpRequestFinishedPayload } from '../types/http.js';
|
|
11
13
|
import type { ContainerResolveEventData } from '../types/container.js';
|
|
12
14
|
import type { LoggerConfig, LoggerManagerConfig } from '../types/logger.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A config provider waits for the application to get booted
|
|
17
|
+
* and then resolves the config. It receives an instance
|
|
18
|
+
* of the application service.
|
|
19
|
+
*/
|
|
20
|
+
export type ConfigProvider<T> = {
|
|
21
|
+
type: 'provider';
|
|
22
|
+
resolver: (app: ApplicationService) => Promise<T>;
|
|
23
|
+
};
|
|
15
24
|
/**
|
|
16
25
|
* Options accepted by ignitor
|
|
17
26
|
*/
|
|
18
27
|
export type IgnitorOptions = {
|
|
19
|
-
importer
|
|
28
|
+
importer?: Importer;
|
|
20
29
|
};
|
|
21
30
|
/**
|
|
22
31
|
* A list of known events. The interface must be extended in
|
|
23
32
|
* user land code or packages to register events and their
|
|
24
33
|
* types.
|
|
25
34
|
*/
|
|
26
|
-
export interface EventsList {
|
|
27
|
-
'
|
|
28
|
-
'http:request_handled': HttpRequestFinishedPayload;
|
|
35
|
+
export interface EventsList extends HttpServerEvents {
|
|
36
|
+
'container_binding:resolved': ContainerResolveEventData<ContainerBindings>;
|
|
29
37
|
'http:server_ready': {
|
|
30
38
|
port: number;
|
|
31
39
|
host: string;
|
|
@@ -38,22 +46,14 @@ export interface EventsList {
|
|
|
38
46
|
export interface LoggersList {
|
|
39
47
|
}
|
|
40
48
|
export type InferLoggers<T extends LoggerManagerConfig<any>> = T['loggers'];
|
|
41
|
-
/**
|
|
42
|
-
* A list of globally available hash drivers
|
|
43
|
-
*/
|
|
44
|
-
export interface HashDriversList {
|
|
45
|
-
bcrypt: (config: BcryptConfig) => Bcrypt;
|
|
46
|
-
argon2: (config: ArgonConfig) => Argon;
|
|
47
|
-
scrypt: (config: ScryptConfig) => Scrypt;
|
|
48
|
-
}
|
|
49
49
|
/**
|
|
50
50
|
* A list of known hashers inferred from the user config
|
|
51
51
|
*/
|
|
52
52
|
export interface HashersList {
|
|
53
53
|
}
|
|
54
|
-
export type InferHashers<T extends {
|
|
54
|
+
export type InferHashers<T extends ConfigProvider<{
|
|
55
55
|
list: Record<string, ManagerDriverFactory>;
|
|
56
|
-
}
|
|
56
|
+
}>> = Awaited<ReturnType<T['resolver']>>['list'];
|
|
57
57
|
/**
|
|
58
58
|
* ----------------------------------------------------------------
|
|
59
59
|
* Container services
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{{#var commandName = generators.commandName(entity.name)}}
|
|
2
2
|
{{#var commandTerminalName = generators.commandTerminalName(entity.name)}}
|
|
3
3
|
{{#var commandFileName = generators.commandFileName(entity.name)}}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
{{{
|
|
5
|
+
exports({
|
|
6
|
+
to: app.commandsPath(entity.path, commandFileName)
|
|
7
|
+
})
|
|
8
|
+
}}}
|
|
7
9
|
import { BaseCommand } from '@adonisjs/core/ace'
|
|
8
|
-
import { CommandOptions } from '@adonisjs/core/types/ace'
|
|
10
|
+
import type { CommandOptions } from '@adonisjs/core/types/ace'
|
|
9
11
|
|
|
10
12
|
export default class {{ commandName }} extends BaseCommand {
|
|
11
13
|
static commandName = '{{ commandTerminalName }}'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{#var controllerName = generators.controllerName(entity.name)}}
|
|
2
|
+
{{#var controllerFileName = generators.controllerFileName(entity.name)}}
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.httpControllersPath(entity.path, controllerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
import type { HttpContext } from '@adonisjs/core/http'
|
|
9
|
+
|
|
10
|
+
export default class {{ controllerName }} {
|
|
11
|
+
{{#each actions as action}}
|
|
12
|
+
async {{action}}({}: HttpContext) {}
|
|
13
|
+
{{/each}}
|
|
14
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{{#var controllerName = generators.controllerName(entity.name)}}
|
|
2
2
|
{{#var controllerFileName = generators.controllerFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.httpControllersPath(entity.path, controllerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
import type { HttpContext } from '@adonisjs/core/http'
|
|
7
9
|
|
|
8
10
|
export default class {{ controllerName }} {
|
|
9
11
|
/**
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{{#var controllerName = generators.controllerName(entity.name)}}
|
|
2
2
|
{{#var controllerFileName = generators.controllerFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.httpControllersPath(entity.path, controllerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
// import type { HttpContext } from '@adonisjs/core/http'
|
|
7
9
|
|
|
8
10
|
export default class {{ controllerName }} {
|
|
9
11
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{{#var controllerName = generators.controllerName(entity.name)}}
|
|
2
2
|
{{#var controllerFileName = generators.controllerFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.httpControllersPath(entity.path, controllerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
import type { HttpContext } from '@adonisjs/core/http'
|
|
7
9
|
|
|
8
10
|
export default class {{ controllerName }} {
|
|
9
11
|
/**
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{{#var eventName = generators.eventName(entity.name)}}
|
|
2
2
|
{{#var eventFileName = generators.eventFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.eventsPath(entity.path, eventFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
6
8
|
import { BaseEvent } from '@adonisjs/core/events'
|
|
7
9
|
|
|
8
10
|
export default class {{ eventName }} extends BaseEvent {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{{#var exceptionName = generators.exceptionName(entity.name)}}
|
|
2
2
|
{{#var exceptionFileName = generators.exceptionFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.exceptionsPath(entity.path, exceptionFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
6
8
|
import { Exception } from '@adonisjs/core/exceptions'
|
|
7
9
|
|
|
8
10
|
export default class {{ exceptionName }} extends Exception {
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
{{#var eventName = generators.eventName(event.name)}}
|
|
4
4
|
{{#var eventFileName = generators.eventFileName(event.name)}}
|
|
5
5
|
{{#var eventImportPath = generators.importPath('#events', event.path, eventFileName)}}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
{{{
|
|
7
|
+
exports({
|
|
8
|
+
to: app.listenersPath(entity.path, listenerFileName)
|
|
9
|
+
})
|
|
10
|
+
}}}
|
|
11
|
+
import type {{ eventName }} from '{{ eventImportPath }}'
|
|
10
12
|
|
|
11
13
|
export default class {{ listenerName }} {
|
|
12
14
|
async handle(event: {{ eventName }}) {}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{{#var listenerName = generators.listenerName(entity.name)}}
|
|
2
2
|
{{#var listenerFileName = generators.listenerFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.listenersPath(entity.path, listenerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
6
8
|
export default class {{ listenerName }} {
|
|
7
9
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{{#var middlewareName = generators.middlewareName(entity.name)}}
|
|
2
2
|
{{#var middlewareFileName = generators.middlewareFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.middlewarePath(entity.path, middlewareFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
import type { HttpContext } from '@adonisjs/core/http'
|
|
9
|
+
import type { NextFn } from '@adonisjs/core/types/http'
|
|
8
10
|
|
|
9
11
|
export default class {{ middlewareName }} {
|
|
10
12
|
async handle(ctx: HttpContext, next: NextFn) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{{#var providerName = generators.providerName(entity.name)}}
|
|
2
2
|
{{#var providerFileName = generators.providerFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.providersPath(entity.path, providerFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
8
|
+
import type { ApplicationService } from '@adonisjs/core/types'
|
|
7
9
|
|
|
8
10
|
export default class {{ providerName }} {
|
|
9
11
|
constructor(protected app: ApplicationService) {}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{{#var testGroupName = generators.testGroupName(entity)}}
|
|
2
2
|
{{#var testFileName = generators.testFileName(entity.name)}}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
{{{
|
|
4
|
+
exports({
|
|
5
|
+
to: app.makePath(suite.directory, entity.path, testFileName)
|
|
6
|
+
})
|
|
7
|
+
}}}
|
|
6
8
|
import { test } from '@japa/runner'
|
|
7
9
|
|
|
8
10
|
test.group('{{ testGroupName }}', () => {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{{#var validatorName = string(generators.validatorName(entity.name)).noCase()}}
|
|
2
|
+
{{#var validatorFileName = generators.validatorFileName(entity.name)}}
|
|
3
|
+
{{#var createAction = generators.validatorActionName(entity.name, 'create')}}
|
|
4
|
+
{{#var updateAction = generators.validatorActionName(entity.name, 'update')}}
|
|
5
|
+
{{{
|
|
6
|
+
exports({
|
|
7
|
+
to: app.validatorsPath(entity.path, validatorFileName)
|
|
8
|
+
})
|
|
9
|
+
}}}
|
|
10
|
+
import vine from '@vinejs/vine'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Validator to validate the payload when creating
|
|
14
|
+
* a new {{ validatorName }}.
|
|
15
|
+
*/
|
|
16
|
+
export const {{ createAction }} = vine.compile(
|
|
17
|
+
vine.object({})
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Validator to validate the payload when updating
|
|
22
|
+
* an existing {{ validatorName }}.
|
|
23
|
+
*/
|
|
24
|
+
export const {{ updateAction }} = vine.compile(
|
|
25
|
+
vine.object({})
|
|
26
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { Opaque, ReadAllFilesOptions, NormalizeConstructor, ImportAllFilesOptions, } from '@poppinss/utils/types';
|
package/build/types/http.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export * from '@adonisjs/http-server/types';
|
|
2
|
+
import type { ValidationOptions } from '@vinejs/vine/types';
|
|
3
|
+
/**
|
|
4
|
+
* Validation options accepted by the "request.validateUsing" method
|
|
5
|
+
*/
|
|
6
|
+
export type RequestValidationOptions<MetaData extends undefined | Record<string, any>> = ValidationOptions<MetaData> & {
|
|
7
|
+
data?: any;
|
|
8
|
+
};
|