@adonisjs/core 6.1.5-8 → 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 +9 -10
- 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/{http.js → env/editor.js} +1 -1
- 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 +7 -0
- package/build/modules/http/main.js +15 -0
- package/build/modules/http/request_validator.d.ts +34 -0
- package/build/modules/http/request_validator.js +66 -0
- 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 +83 -8
- package/build/providers/vinejs_provider.d.ts +43 -0
- package/build/providers/vinejs_provider.js +97 -0
- package/build/src/cli_formatters/routes_list.d.ts +1 -1
- 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/test_utils/main.js +1 -1
- package/build/src/types.d.ts +18 -18
- 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/types/helpers.js +9 -0
- package/build/types/http.d.ts +7 -0
- package/package.json +71 -56
- 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/modules/http.d.ts +0 -1
- 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/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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
import vine, { BaseLiteralType, Vine } from '@vinejs/vine';
|
|
10
|
+
import { Request, RequestValidator } from '../modules/http/main.js';
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the value is an instance of multipart file
|
|
13
|
+
* from bodyparser.
|
|
14
|
+
*/
|
|
15
|
+
function isBodyParserFile(file) {
|
|
16
|
+
return !!(file && typeof file === 'object' && 'isMultipartFile' in file);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* VineJS validation rule that validates the file to be an
|
|
20
|
+
* instance of BodyParser MultipartFile class.
|
|
21
|
+
*/
|
|
22
|
+
const isMultipartFile = vine.createRule((file, options, field) => {
|
|
23
|
+
/**
|
|
24
|
+
* Report error when value is not a field multipart
|
|
25
|
+
* file object
|
|
26
|
+
*/
|
|
27
|
+
if (!isBodyParserFile(file)) {
|
|
28
|
+
field.report('The {{ field }} must be a file', 'file', field);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const validationOptions = typeof options === 'function' ? options(field) : options;
|
|
32
|
+
/**
|
|
33
|
+
* Set size when it's defined in the options and missing
|
|
34
|
+
* on the file instance
|
|
35
|
+
*/
|
|
36
|
+
if (file.sizeLimit === undefined && validationOptions.size) {
|
|
37
|
+
file.sizeLimit = validationOptions.size;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Set extensions when it's defined in the options and missing
|
|
41
|
+
* on the file instance
|
|
42
|
+
*/
|
|
43
|
+
if (file.allowedExtensions === undefined && validationOptions.extnames) {
|
|
44
|
+
file.allowedExtensions = validationOptions.extnames;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validate file
|
|
48
|
+
*/
|
|
49
|
+
file.validate();
|
|
50
|
+
/**
|
|
51
|
+
* Report errors
|
|
52
|
+
*/
|
|
53
|
+
file.errors.forEach((error) => {
|
|
54
|
+
field.report(error.message, `file.${error.type}`, field, validationOptions);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Represents a multipart file uploaded via multipart/form-data HTTP
|
|
59
|
+
* request.
|
|
60
|
+
*/
|
|
61
|
+
class VineMultipartFile extends BaseLiteralType {
|
|
62
|
+
#validationOptions;
|
|
63
|
+
constructor(validationOptions, options, validations) {
|
|
64
|
+
super(options, validations || [isMultipartFile(validationOptions || {})]);
|
|
65
|
+
this.#validationOptions = validationOptions;
|
|
66
|
+
}
|
|
67
|
+
clone() {
|
|
68
|
+
return new VineMultipartFile(this.#validationOptions, this.cloneOptions(), this.cloneValidations());
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The Edge service provider configures Edge to work within
|
|
73
|
+
* an AdonisJS application environment
|
|
74
|
+
*/
|
|
75
|
+
export default class VineJSServiceProvider {
|
|
76
|
+
app;
|
|
77
|
+
constructor(app) {
|
|
78
|
+
this.app = app;
|
|
79
|
+
this.app.usingVineJS = true;
|
|
80
|
+
}
|
|
81
|
+
boot() {
|
|
82
|
+
/**
|
|
83
|
+
* The file method is used to validate a field to be a valid
|
|
84
|
+
* multipart file.
|
|
85
|
+
*/
|
|
86
|
+
Vine.macro('file', function (options) {
|
|
87
|
+
return new VineMultipartFile(options);
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* The validate method can be used to validate the request
|
|
91
|
+
* data for the current request using VineJS validators
|
|
92
|
+
*/
|
|
93
|
+
Request.macro('validateUsing', function (...args) {
|
|
94
|
+
return new RequestValidator(this.ctx).validateUsing(...args);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApplicationService, ConfigProvider } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Helper to create config provider and resolve config from
|
|
4
|
+
* them
|
|
5
|
+
*/
|
|
6
|
+
export declare const configProvider: {
|
|
7
|
+
create<T>(resolver: (app: ApplicationService) => Promise<T>): ConfigProvider<T>;
|
|
8
|
+
resolve<T_1>(app: ApplicationService, provider: unknown): Promise<T_1 | null>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Helper to create config provider and resolve config from
|
|
11
|
+
* them
|
|
12
|
+
*/
|
|
13
|
+
export const configProvider = {
|
|
14
|
+
create(resolver) {
|
|
15
|
+
return {
|
|
16
|
+
type: 'provider',
|
|
17
|
+
resolver,
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
async resolve(app, provider) {
|
|
21
|
+
if (provider && typeof provider === 'object' && 'type' in provider) {
|
|
22
|
+
return provider.resolver(app);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
},
|
|
26
|
+
};
|
package/build/src/debug.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { assertExists, assertNotNull, assertIsDefined, assertUnreachable, } from '@poppinss/utils/assert';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
export { assertExists, assertNotNull, assertIsDefined, assertUnreachable, } from '@poppinss/utils/assert';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as parseImports } from 'parse-imports';
|
|
2
|
-
export { createId as cuid } from '@paralleldrive/cuid2';
|
|
3
|
-
export {
|
|
2
|
+
export { createId as cuid, isCuid } from '@paralleldrive/cuid2';
|
|
3
|
+
export { slash, base64, compose, Secret, joinToURL, fsReadAll, safeEqual, getDirname, getFilename, fsImportAll, MessageBuilder, } from '@poppinss/utils';
|
|
4
4
|
export { parseBindingReference } from './parse_binding_reference.js';
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
9
|
export { default as parseImports } from 'parse-imports';
|
|
10
|
-
export { createId as cuid } from '@paralleldrive/cuid2';
|
|
11
|
-
export {
|
|
10
|
+
export { createId as cuid, isCuid } from '@paralleldrive/cuid2';
|
|
11
|
+
export { slash, base64, compose, Secret, joinToURL, fsReadAll, safeEqual, getDirname, getFilename, fsImportAll, MessageBuilder, } from '@poppinss/utils';
|
|
12
12
|
export { parseBindingReference } from './parse_binding_reference.js';
|
|
@@ -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.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
|
}
|
|
@@ -10,7 +10,7 @@ import { Socket } from 'node:net';
|
|
|
10
10
|
import Macroable from '@poppinss/macroable';
|
|
11
11
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
12
12
|
import { HttpServerUtils } from './http.js';
|
|
13
|
-
import { CookieClient } from '../../modules/http.js';
|
|
13
|
+
import { CookieClient } from '../../modules/http/main.js';
|
|
14
14
|
/**
|
|
15
15
|
* Test utils has a collection of helper methods to make testing
|
|
16
16
|
* experience great for AdonisJS applications
|
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 {
|
|
7
|
+
import type { HttpServerEvents } from '../types/http.js';
|
|
8
8
|
import type { LoggerManager } from '../modules/logger.js';
|
|
9
|
+
import type { HashManager } from '../modules/hash/main.js';
|
|
9
10
|
import type { Encryption } from '../modules/encryption.js';
|
|
10
|
-
import type {
|
|
11
|
+
import type { ManagerDriverFactory } from '../types/hash.js';
|
|
12
|
+
import type { Router, Server } from '../modules/http/main.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 {
|