@adonisjs/core 7.0.0-next.10 → 7.0.0-next.12
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/build/ace-DDzvaSs_.js +16 -0
- package/build/app-B6oge7b3.js +5 -0
- package/build/app-BK0PN3li.js +5 -0
- package/build/bodyparser_middleware-DTW0epKM.js +3 -0
- package/build/chunk-MjwdjG2f.js +32 -0
- package/build/commands/add.js +40 -110
- package/build/commands/build.js +51 -107
- package/build/commands/configure.js +82 -177
- package/build/commands/eject.js +17 -60
- package/build/commands/env/add.js +55 -134
- package/build/commands/generate_key.js +22 -66
- package/build/commands/inspect_rcfile.js +27 -55
- package/build/commands/list/routes.js +246 -116
- package/build/commands/make/command.js +15 -57
- package/build/commands/make/controller.js +43 -120
- package/build/commands/make/event.js +16 -62
- package/build/commands/make/exception.js +16 -62
- package/build/commands/make/listener.js +36 -93
- package/build/commands/make/middleware.js +41 -101
- package/build/commands/make/preload.js +47 -113
- package/build/commands/make/provider.js +47 -112
- package/build/commands/make/service.js +16 -55
- package/build/commands/make/test.js +47 -132
- package/build/commands/make/transformer.js +17 -64
- package/build/commands/make/validator.js +20 -80
- package/build/commands/make/view.js +15 -56
- package/build/commands/repl.js +17 -50
- package/build/commands/serve.js +80 -150
- package/build/commands/test.js +92 -202
- package/build/config-B2S2xfmN.js +5 -0
- package/build/config_provider-CY-xuo2R.js +13 -0
- package/build/container-ClFvcykQ.js +5 -0
- package/build/core-CNNCwlhc.js +95 -0
- package/build/create_kernel-B7zWS8Zz.js +38 -0
- package/build/create_kernel-CsTq0pWc.js +3 -0
- package/build/debug-DURPi9xn.js +3 -0
- package/build/decorate-DM0Sx1ye.js +7 -0
- package/build/dumper-C_sMcyFb.js +147 -0
- package/build/edge-LQdCc1L3.js +47 -0
- package/build/encryption-D2HGu0bU.js +5 -0
- package/build/events-B8hK42QT.js +5 -0
- package/build/factories/app.js +2 -9
- package/build/factories/bodyparser.js +2 -9
- package/build/factories/core/ace.js +15 -46
- package/build/factories/core/ignitor.js +12 -180
- package/build/factories/core/main.js +22 -11
- package/build/factories/core/test_utils.js +19 -43
- package/build/factories/encryption.js +2 -9
- package/build/factories/events.js +2 -9
- package/build/factories/hash.js +2 -9
- package/build/factories/http.js +2 -9
- package/build/factories/logger.js +2 -9
- package/build/factories/stubs.js +28 -91
- package/build/ignitor-Dil-rtCo.js +63 -0
- package/build/index.js +13 -46
- package/build/logger-Dha-0hp1.js +13 -0
- package/build/main-2-nm3TiB.js +72 -0
- package/build/main-BTUXw6He.js +171 -0
- package/build/main-BWftwyAK.js +81 -0
- package/build/main-BrJQ1VAM.js +52 -0
- package/build/main-CFmDHDls.js +35 -0
- package/build/main-D5xz2ZN1.js +5 -0
- package/build/main-kn40V-hF.js +2 -0
- package/build/main-q9TMzWUj.js +5 -0
- package/build/modules/ace/codemods.js +222 -477
- package/build/modules/ace/main.js +2 -41
- package/build/modules/app.js +4 -26
- package/build/modules/bodyparser/bodyparser_middleware.js +2 -14
- package/build/modules/bodyparser/main.js +4 -9
- package/build/modules/config.js +4 -26
- package/build/modules/container.js +4 -9
- package/build/modules/dumper/main.js +6 -32
- package/build/modules/dumper/plugins/edge.js +2 -62
- package/build/modules/encryption.js +4 -26
- package/build/modules/env/editor.js +2 -9
- package/build/modules/env/main.js +2 -28
- package/build/modules/events.js +4 -9
- package/build/modules/hash/drivers/argon.js +2 -9
- package/build/modules/hash/drivers/bcrypt.js +2 -20
- package/build/modules/hash/drivers/scrypt.js +2 -9
- package/build/modules/hash/main.js +6 -28
- package/build/modules/hash/phc_formatter.js +2 -9
- package/build/modules/health.js +2 -9
- package/build/modules/http/main.js +4 -15
- package/build/modules/http/url_builder_client.js +2 -9
- package/build/modules/logger.d.ts +30 -0
- package/build/modules/logger.js +4 -9
- package/build/modules/repl.js +4 -9
- package/build/modules/transformers/main.js +4 -9
- package/build/providers/app_provider.js +147 -359
- package/build/providers/edge_provider.js +97 -165
- package/build/providers/hash_provider.js +29 -91
- package/build/providers/repl_provider.js +61 -152
- package/build/providers/vinejs_provider.d.ts +1 -1
- package/build/providers/vinejs_provider.js +20 -66
- package/build/repl-CumYg2V_.js +5 -0
- package/build/services/ace.js +2 -17
- package/build/services/app.js +2 -21
- package/build/services/config.js +2 -13
- package/build/services/dumper.js +5 -21
- package/build/services/emitter.js +2 -14
- package/build/services/encryption.js +2 -14
- package/build/services/hash.js +2 -14
- package/build/services/logger.js +2 -14
- package/build/services/repl.js +2 -14
- package/build/services/router.js +2 -14
- package/build/services/server.js +2 -14
- package/build/services/test_utils.js +2 -17
- package/build/services/url_builder.js +5 -17
- package/build/src/exceptions.js +2 -49
- package/build/src/helpers/assert.js +2 -55
- package/build/src/helpers/http.js +2 -28
- package/build/src/helpers/is.js +3 -31
- package/build/src/helpers/main.js +5 -52
- package/build/src/helpers/string.js +2 -78
- package/build/src/helpers/types.js +26 -135
- package/build/src/helpers/verification_token.js +2 -120
- package/build/src/test_utils/main.js +5 -77
- package/build/src/types.js +0 -8
- package/build/src/vine.js +2 -105
- package/build/string-CJ7ewUFq.js +28 -0
- package/build/test_utils-c_TEaEHW.js +10 -0
- package/build/toolkit/main.js +19 -21
- package/build/types/ace.js +2 -9
- package/build/types/app.js +2 -9
- package/build/types/bodyparser.js +2 -9
- package/build/types/common.js +2 -9
- package/build/types/container.js +2 -9
- package/build/types/encryption.js +2 -9
- package/build/types/events.js +2 -9
- package/build/types/hash.js +2 -9
- package/build/types/health.js +2 -9
- package/build/types/helpers.js +0 -8
- package/build/types/http.js +2 -9
- package/build/types/logger.js +2 -9
- package/build/types/repl.js +2 -9
- package/build/types/transformers.js +2 -9
- package/build/utils-CNQ4tlGM.js +41 -0
- package/build/verification_token-DXsW81rl.js +46 -0
- package/build/vine-Bt4ymkM0.js +32 -0
- package/package.json +81 -31
- package/build/modules/ace/commands.js +0 -157
- package/build/modules/ace/create_kernel.js +0 -91
- package/build/modules/ace/kernel.js +0 -40
- package/build/modules/dumper/define_config.js +0 -36
- package/build/modules/dumper/dumper.js +0 -266
- package/build/modules/dumper/errors.js +0 -119
- package/build/modules/hash/define_config.js +0 -125
- package/build/modules/http/request_validator.js +0 -100
- package/build/src/assembler_hooks/index_entities.js +0 -112
- package/build/src/cli_formatters/routes_list.js +0 -397
- package/build/src/config_provider.js +0 -71
- package/build/src/debug.js +0 -25
- package/build/src/ignitor/ace.js +0 -102
- package/build/src/ignitor/http.js +0 -159
- package/build/src/ignitor/main.js +0 -124
- package/build/src/ignitor/test.js +0 -66
- package/build/src/test_utils/http.js +0 -82
- package/build/src/utils.js +0 -114
- package/build/stubs/main.js +0 -9
- package/build/toolkit/commands/index_commands.js +0 -30
- /package/build/{stubs/make → make}/command/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/actions.stub +0 -0
- /package/build/{stubs/make → make}/controller/api.stub +0 -0
- /package/build/{stubs/make → make}/controller/main.stub +0 -0
- /package/build/{stubs/make → make}/controller/resource.stub +0 -0
- /package/build/{stubs/make → make}/event/main.stub +0 -0
- /package/build/{stubs/make → make}/exception/main.stub +0 -0
- /package/build/{stubs/make → make}/health/controller.stub +0 -0
- /package/build/{stubs/make → make}/health/main.stub +0 -0
- /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
- /package/build/{stubs/make → make}/listener/main.stub +0 -0
- /package/build/{stubs/make → make}/middleware/main.stub +0 -0
- /package/build/{stubs/make → make}/preload/main.stub +0 -0
- /package/build/{stubs/make → make}/provider/main.stub +0 -0
- /package/build/{stubs/make → make}/service/main.stub +0 -0
- /package/build/{stubs/make → make}/test/main.stub +0 -0
- /package/build/{stubs/make → make}/transformer/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/main.stub +0 -0
- /package/build/{stubs/make → make}/validator/resource.stub +0 -0
- /package/build/{stubs/make → make}/view/main.stub +0 -0
|
@@ -1,78 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 prettyHrTime from 'pretty-hrtime';
|
|
10
|
-
import string from '@poppinss/utils/string';
|
|
11
|
-
import he from 'he';
|
|
12
|
-
import StringBuilder from '@poppinss/utils/string_builder';
|
|
13
|
-
/**
|
|
14
|
-
* Collection of string helpers to transform a string value. This object extends
|
|
15
|
-
* the base string utilities from @poppinss/utils with additional AdonisJS-specific
|
|
16
|
-
* string manipulation methods.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Basic string transformations
|
|
20
|
-
* stringHelpers.camelCase('hello_world') // 'helloWorld'
|
|
21
|
-
* stringHelpers.snakeCase('HelloWorld') // 'hello_world'
|
|
22
|
-
* stringHelpers.pascalCase('hello world') // 'HelloWorld'
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // HTML escaping and encoding
|
|
26
|
-
* stringHelpers.escapeHTML('<script>alert("xss")</script>')
|
|
27
|
-
* stringHelpers.encodeSymbols('© 2023 AdonisJS')
|
|
28
|
-
*/
|
|
29
|
-
const stringHelpers = {
|
|
30
|
-
...string,
|
|
31
|
-
toSentence: string.sentence,
|
|
32
|
-
ordinalize: string.ordinal,
|
|
33
|
-
generateRandom: string.random,
|
|
34
|
-
create(value) {
|
|
35
|
-
return new StringBuilder(value);
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* Formats Node.js hrtime output into a human-readable string.
|
|
39
|
-
*
|
|
40
|
-
* @param time - Tuple of [seconds, nanoseconds] from process.hrtime()
|
|
41
|
-
* @param options - Formatting options for output style and precision
|
|
42
|
-
*/
|
|
43
|
-
prettyHrTime(time, options) {
|
|
44
|
-
return prettyHrTime(time, options);
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* Check if a string is empty or contains only whitespace characters.
|
|
48
|
-
*
|
|
49
|
-
* @param value - The string to check for emptiness
|
|
50
|
-
*/
|
|
51
|
-
isEmpty(value) {
|
|
52
|
-
return value.trim().length === 0;
|
|
53
|
-
},
|
|
54
|
-
/**
|
|
55
|
-
* Escape HTML entities to prevent XSS attacks and display HTML safely.
|
|
56
|
-
*
|
|
57
|
-
* @param value - The string containing HTML to escape
|
|
58
|
-
* @param options - Optional configuration for escaping behavior
|
|
59
|
-
* @param options.encodeSymbols - Whether to also encode Unicode symbols as HTML entities
|
|
60
|
-
*/
|
|
61
|
-
escapeHTML(value, options) {
|
|
62
|
-
value = he.escape(value);
|
|
63
|
-
if (options && options.encodeSymbols) {
|
|
64
|
-
value = this.encodeSymbols(value, { allowUnsafeSymbols: true });
|
|
65
|
-
}
|
|
66
|
-
return value;
|
|
67
|
-
},
|
|
68
|
-
/**
|
|
69
|
-
* Encode Unicode symbols and special characters as HTML entities.
|
|
70
|
-
*
|
|
71
|
-
* @param value - The string containing symbols to encode
|
|
72
|
-
* @param options - Encoding options from the 'he' library
|
|
73
|
-
*/
|
|
74
|
-
encodeSymbols(value, options) {
|
|
75
|
-
return he.encode(value, options);
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
export default stringHelpers;
|
|
1
|
+
import { t as string_default } from "../../string-CJ7ewUFq.js";
|
|
2
|
+
export { string_default as default };
|
|
@@ -1,136 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Direct reference to the is utility for type checking lookups.
|
|
28
|
-
* @deprecated Use the is helpers directly instead
|
|
29
|
-
*/
|
|
30
|
-
lookup: is,
|
|
31
|
-
/**
|
|
32
|
-
* Check if value is null.
|
|
33
|
-
* @deprecated Use is.null instead
|
|
34
|
-
*/
|
|
35
|
-
isNull: is.null,
|
|
36
|
-
/**
|
|
37
|
-
* Check if value is a boolean.
|
|
38
|
-
* @deprecated Use is.boolean instead
|
|
39
|
-
*/
|
|
40
|
-
isBoolean: is.boolean,
|
|
41
|
-
/**
|
|
42
|
-
* Check if value is a Buffer.
|
|
43
|
-
* @deprecated Use is.buffer instead
|
|
44
|
-
*/
|
|
45
|
-
isBuffer: is.buffer,
|
|
46
|
-
/**
|
|
47
|
-
* Check if value is a number.
|
|
48
|
-
* @deprecated Use is.number instead
|
|
49
|
-
*/
|
|
50
|
-
isNumber: is.number,
|
|
51
|
-
/**
|
|
52
|
-
* Check if value is a string.
|
|
53
|
-
* @deprecated Use is.string instead
|
|
54
|
-
*/
|
|
55
|
-
isString: is.string,
|
|
56
|
-
/**
|
|
57
|
-
* Check if value is an arguments object.
|
|
58
|
-
* @deprecated Use is.arguments instead
|
|
59
|
-
*/
|
|
60
|
-
isArguments: is.arguments,
|
|
61
|
-
/**
|
|
62
|
-
* Check if value is an object.
|
|
63
|
-
* @deprecated Use is.object instead
|
|
64
|
-
*/
|
|
65
|
-
isObject: is.object,
|
|
66
|
-
/**
|
|
67
|
-
* Check if value is a Date.
|
|
68
|
-
* @deprecated Use is.date instead
|
|
69
|
-
*/
|
|
70
|
-
isDate: is.date,
|
|
71
|
-
/**
|
|
72
|
-
* Check if value is an array.
|
|
73
|
-
* @deprecated Use is.array instead
|
|
74
|
-
*/
|
|
75
|
-
isArray: is.array,
|
|
76
|
-
/**
|
|
77
|
-
* Check if value is a regular expression.
|
|
78
|
-
* @deprecated Use is.regExp instead
|
|
79
|
-
*/
|
|
80
|
-
isRegexp: is.regExp,
|
|
81
|
-
/**
|
|
82
|
-
* Check if value is an error object.
|
|
83
|
-
* @deprecated Use is.error instead
|
|
84
|
-
*/
|
|
85
|
-
isError: is.error,
|
|
86
|
-
/**
|
|
87
|
-
* Check if value is a function.
|
|
88
|
-
* @deprecated Use is.function instead
|
|
89
|
-
*/
|
|
90
|
-
isFunction: is.function,
|
|
91
|
-
/**
|
|
92
|
-
* Check if value is a class.
|
|
93
|
-
* @deprecated Use is.class instead
|
|
94
|
-
*/
|
|
95
|
-
isClass: is.class,
|
|
96
|
-
/**
|
|
97
|
-
* Check if value is an integer.
|
|
98
|
-
* @deprecated Use is.integer instead
|
|
99
|
-
*/
|
|
100
|
-
isInteger: is.integer,
|
|
101
|
-
/**
|
|
102
|
-
* Check if a number is a float (has decimal places).
|
|
103
|
-
*
|
|
104
|
-
* @param value - The number to check
|
|
105
|
-
* @deprecated Use is.decimal or custom logic instead
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* types.isFloat(3.14) // true
|
|
109
|
-
* types.isFloat(42) // false
|
|
110
|
-
*/
|
|
111
|
-
isFloat(value) {
|
|
112
|
-
return value !== (value | 0);
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* Check if a value represents a decimal number with specific decimal places.
|
|
116
|
-
*
|
|
117
|
-
* @param value - The value to check (string or number)
|
|
118
|
-
* @param options - Options for decimal validation
|
|
119
|
-
* @param options.decimalPlaces - Regex pattern for allowed decimal places (default: '1,')
|
|
120
|
-
* @deprecated Use a validation library like Vine or custom logic instead
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* types.isDecimal('3.14') // true
|
|
124
|
-
* types.isDecimal('42.0') // true
|
|
125
|
-
* types.isDecimal('42') // false
|
|
126
|
-
* types.isDecimal('3.141', { decimalPlaces: '1,3' }) // true
|
|
127
|
-
*/
|
|
128
|
-
isDecimal(value, options) {
|
|
129
|
-
if (typeof value === 'number') {
|
|
130
|
-
value = value.toString();
|
|
131
|
-
}
|
|
132
|
-
const decimalPlaces = (options && options.decimalPlaces) || '1,';
|
|
133
|
-
return new RegExp(`^[-+]?([0-9]+)?(\\.[0-9]{${decimalPlaces}})$`).test(value);
|
|
134
|
-
},
|
|
1
|
+
import is from "@sindresorhus/is";
|
|
2
|
+
var types_default = {
|
|
3
|
+
lookup: is,
|
|
4
|
+
isNull: is.null,
|
|
5
|
+
isBoolean: is.boolean,
|
|
6
|
+
isBuffer: is.buffer,
|
|
7
|
+
isNumber: is.number,
|
|
8
|
+
isString: is.string,
|
|
9
|
+
isArguments: is.arguments,
|
|
10
|
+
isObject: is.object,
|
|
11
|
+
isDate: is.date,
|
|
12
|
+
isArray: is.array,
|
|
13
|
+
isRegexp: is.regExp,
|
|
14
|
+
isError: is.error,
|
|
15
|
+
isFunction: is.function,
|
|
16
|
+
isClass: is.class,
|
|
17
|
+
isInteger: is.integer,
|
|
18
|
+
isFloat(value) {
|
|
19
|
+
return value !== (value | 0);
|
|
20
|
+
},
|
|
21
|
+
isDecimal(value, options) {
|
|
22
|
+
if (typeof value === "number") value = value.toString();
|
|
23
|
+
const decimalPlaces = options && options.decimalPlaces || "1,";
|
|
24
|
+
return (/* @__PURE__ */ new RegExp(`^[-+]?([0-9]+)?(\\.[0-9]{${decimalPlaces}})$`)).test(value);
|
|
25
|
+
}
|
|
135
26
|
};
|
|
136
|
-
export default
|
|
27
|
+
export { types_default as default };
|
|
@@ -1,120 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { createHash } from 'node:crypto';
|
|
10
|
-
import string from '@poppinss/utils/string';
|
|
11
|
-
import { safeEqual, Secret } from '@poppinss/utils';
|
|
12
|
-
import base64 from '@poppinss/utils/base64';
|
|
13
|
-
/**
|
|
14
|
-
* Verification token class can be used to create tokens publicly
|
|
15
|
-
* shareable tokens while storing the token hash within the database.
|
|
16
|
-
*
|
|
17
|
-
* This class is used by the Auth and the Persona packages to manage
|
|
18
|
-
* tokens for authentication and authorization purposes.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* class UserToken extends VerificationToken {
|
|
22
|
-
* constructor(user: User, secret: Secret<string>) {
|
|
23
|
-
* super()
|
|
24
|
-
* this.tokenableId = user.id
|
|
25
|
-
* this.computeValue(secret)
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
*/
|
|
29
|
-
export class VerificationToken {
|
|
30
|
-
/**
|
|
31
|
-
* Decodes a publicly shared token and return the series
|
|
32
|
-
* and the token value from it.
|
|
33
|
-
*
|
|
34
|
-
* Returns null when unable to decode the token because of
|
|
35
|
-
* invalid format or encoding.
|
|
36
|
-
*
|
|
37
|
-
* @param value - The token string to decode
|
|
38
|
-
*/
|
|
39
|
-
static decode(value) {
|
|
40
|
-
/**
|
|
41
|
-
* Ensure value is a string and starts with the prefix.
|
|
42
|
-
*/
|
|
43
|
-
if (typeof value !== 'string') {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Remove prefix from the rest of the token.
|
|
48
|
-
*/
|
|
49
|
-
if (!value) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
const [identifier, ...tokenValue] = value.split('.');
|
|
53
|
-
if (!identifier || tokenValue.length === 0) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
const decodedIdentifier = base64.urlDecode(identifier);
|
|
57
|
-
const decodedSecret = base64.urlDecode(tokenValue.join('.'));
|
|
58
|
-
if (!decodedIdentifier || !decodedSecret) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
identifier: decodedIdentifier,
|
|
63
|
-
secret: new Secret(decodedSecret),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Creates a transient token that can be shared with the persistence
|
|
68
|
-
* layer.
|
|
69
|
-
*
|
|
70
|
-
* @param userId - The user ID for whom the token is being created
|
|
71
|
-
* @param size - The size of the random token seed
|
|
72
|
-
* @param expiresIn - Token expiration time (string like '2h' or number in seconds)
|
|
73
|
-
*/
|
|
74
|
-
static createTransientToken(userId, size, expiresIn) {
|
|
75
|
-
const expiresAt = new Date();
|
|
76
|
-
expiresAt.setSeconds(expiresAt.getSeconds() + string.seconds.parse(expiresIn));
|
|
77
|
-
return {
|
|
78
|
-
userId,
|
|
79
|
-
expiresAt,
|
|
80
|
-
...this.seed(size),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Creates a secret opaque token and its hash.
|
|
85
|
-
*
|
|
86
|
-
* @param size - The length of the random token to generate
|
|
87
|
-
*/
|
|
88
|
-
static seed(size) {
|
|
89
|
-
const seed = string.random(size);
|
|
90
|
-
const secret = new Secret(seed);
|
|
91
|
-
const hash = createHash('sha256').update(secret.release()).digest('hex');
|
|
92
|
-
return { secret, hash };
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Compute the value property using the given secret. You can
|
|
96
|
-
* get secret via the static "createTransientToken" method.
|
|
97
|
-
*
|
|
98
|
-
* @param secret - The secret value to compute the public token value from
|
|
99
|
-
*/
|
|
100
|
-
computeValue(secret) {
|
|
101
|
-
this.value = new Secret(`${base64.urlEncode(String(this.identifier))}.${base64.urlEncode(secret.release())}`);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Check if the token has been expired. Verifies
|
|
105
|
-
* the "expiresAt" timestamp with the current
|
|
106
|
-
* date.
|
|
107
|
-
*/
|
|
108
|
-
isExpired() {
|
|
109
|
-
return this.expiresAt < new Date();
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Verifies the value of a token against the pre-defined hash
|
|
113
|
-
*
|
|
114
|
-
* @param secret - The secret to verify against the stored hash
|
|
115
|
-
*/
|
|
116
|
-
verify(secret) {
|
|
117
|
-
const newHash = createHash('sha256').update(secret.release()).digest('hex');
|
|
118
|
-
return safeEqual(this.hash, newHash);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
1
|
+
import { t as VerificationToken } from "../../verification_token-DXsW81rl.js";
|
|
2
|
+
export { VerificationToken };
|
|
@@ -1,77 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 { Socket } from 'node:net';
|
|
10
|
-
import Macroable from '@poppinss/macroable';
|
|
11
|
-
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
12
|
-
import { HttpServerUtils } from "./http.js";
|
|
13
|
-
import { CookieClient } from "../../modules/http/main.js";
|
|
14
|
-
/**
|
|
15
|
-
* Test utils has a collection of helper methods to make testing
|
|
16
|
-
* experience great for AdonisJS applications. It provides utilities
|
|
17
|
-
* for HTTP testing, context creation, and cookie handling.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* const testUtils = new TestUtils(app)
|
|
21
|
-
* await testUtils.boot()
|
|
22
|
-
*
|
|
23
|
-
* const ctx = await testUtils.createHttpContext()
|
|
24
|
-
* const httpUtils = testUtils.httpServer()
|
|
25
|
-
*/
|
|
26
|
-
export class TestUtils extends Macroable {
|
|
27
|
-
app;
|
|
28
|
-
/**
|
|
29
|
-
* Flag to track if test utils have been booted
|
|
30
|
-
*/
|
|
31
|
-
#booted = false;
|
|
32
|
-
/**
|
|
33
|
-
* Check if utils have been booted
|
|
34
|
-
*/
|
|
35
|
-
get isBooted() {
|
|
36
|
-
return this.#booted;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Creates a new TestUtils instance
|
|
40
|
-
*
|
|
41
|
-
* @param app - The application service instance
|
|
42
|
-
*/
|
|
43
|
-
constructor(app) {
|
|
44
|
-
super();
|
|
45
|
-
this.app = app;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Boot test utils. It requires the app to be booted
|
|
49
|
-
* and container to have all the bindings
|
|
50
|
-
*/
|
|
51
|
-
async boot() {
|
|
52
|
-
if (!this.isBooted) {
|
|
53
|
-
this.#booted = true;
|
|
54
|
-
this.cookies = new CookieClient(await this.app.container.make('encryption'));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Returns an instance of the HTTP server testing
|
|
59
|
-
* utils
|
|
60
|
-
*/
|
|
61
|
-
httpServer() {
|
|
62
|
-
return new HttpServerUtils(this);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Create an instance of HTTP context for testing
|
|
66
|
-
*
|
|
67
|
-
* @param options - Options for creating HTTP context with custom req/res objects
|
|
68
|
-
*/
|
|
69
|
-
async createHttpContext(options = {}) {
|
|
70
|
-
const req = options.req || new IncomingMessage(new Socket());
|
|
71
|
-
const res = options.res || new ServerResponse(req);
|
|
72
|
-
const server = await this.app.container.make('server');
|
|
73
|
-
const request = server.createRequest(req, res);
|
|
74
|
-
const response = server.createResponse(req, res);
|
|
75
|
-
return server.createHttpContext(request, response, this.app.container.createResolver());
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
import "../../chunk-MjwdjG2f.js";
|
|
2
|
+
import "../../debug-DURPi9xn.js";
|
|
3
|
+
import "../../main-CFmDHDls.js";
|
|
4
|
+
import { t as TestUtils } from "../../main-2-nm3TiB.js";
|
|
5
|
+
export { TestUtils };
|
package/build/src/types.js
CHANGED
package/build/src/vine.js
CHANGED
|
@@ -1,105 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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, { symbols, BaseLiteralType } from '@vinejs/vine';
|
|
10
|
-
const MULTIPART_FILE = symbols.SUBTYPE ?? Symbol.for('subtype');
|
|
11
|
-
/**
|
|
12
|
-
* Checks if the value is an instance of multipart file from bodyparser.
|
|
13
|
-
* Used internally for type guarding in file validation.
|
|
14
|
-
*
|
|
15
|
-
* @param file - The value to check for MultipartFile instance
|
|
16
|
-
*/
|
|
17
|
-
function isBodyParserFile(file) {
|
|
18
|
-
return !!(file && typeof file === 'object' && 'isMultipartFile' in file);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* VineJS validation rule that validates the file to be an instance of BodyParser
|
|
22
|
-
* MultipartFile class and applies size/extension validation if configured.
|
|
23
|
-
*
|
|
24
|
-
* @param file - The file value to validate
|
|
25
|
-
* @param options - Validation options for file size and extensions
|
|
26
|
-
* @param field - The field context from VineJS validation
|
|
27
|
-
*/
|
|
28
|
-
const isMultipartFile = vine.createRule((file, options, field) => {
|
|
29
|
-
/**
|
|
30
|
-
* Report error when value is not a field multipart
|
|
31
|
-
* file object
|
|
32
|
-
*/
|
|
33
|
-
if (!isBodyParserFile(file)) {
|
|
34
|
-
field.report('The {{ field }} must be a file', 'file', field);
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const validationOptions = typeof options === 'function' ? options(field) : options;
|
|
38
|
-
/**
|
|
39
|
-
* Set size when it's defined in the options and missing
|
|
40
|
-
* on the file instance
|
|
41
|
-
*/
|
|
42
|
-
if (file.sizeLimit === undefined && validationOptions.size) {
|
|
43
|
-
file.sizeLimit = validationOptions.size;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Set extensions when it's defined in the options and missing
|
|
47
|
-
* on the file instance
|
|
48
|
-
*/
|
|
49
|
-
if (file.allowedExtensions === undefined && validationOptions.extnames) {
|
|
50
|
-
file.allowedExtensions = validationOptions.extnames;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Validate file
|
|
54
|
-
*/
|
|
55
|
-
file.validate();
|
|
56
|
-
/**
|
|
57
|
-
* Report errors
|
|
58
|
-
*/
|
|
59
|
-
file.errors.forEach((error) => {
|
|
60
|
-
field.report(error.message, `file.${error.type}`, field, validationOptions);
|
|
61
|
-
});
|
|
62
|
-
return file.isValid;
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Represents a multipart file uploaded via multipart/form-data HTTP
|
|
66
|
-
* request. This class extends VineJS's BaseLiteralType to provide
|
|
67
|
-
* specialized validation for uploaded files.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* const fileSchema = vine.object({
|
|
71
|
-
* avatar: vine.file({
|
|
72
|
-
* size: '2mb',
|
|
73
|
-
* extnames: ['jpg', 'png']
|
|
74
|
-
* })
|
|
75
|
-
* })
|
|
76
|
-
*/
|
|
77
|
-
export class VineMultipartFile extends BaseLiteralType {
|
|
78
|
-
/**
|
|
79
|
-
* Private validation options for file validation
|
|
80
|
-
*/
|
|
81
|
-
#validationOptions;
|
|
82
|
-
/**
|
|
83
|
-
* Symbol identifier for multipart file subtype
|
|
84
|
-
*/
|
|
85
|
-
[MULTIPART_FILE] = 'multipartFile';
|
|
86
|
-
/**
|
|
87
|
-
* Creates a new VineMultipartFile instance
|
|
88
|
-
*
|
|
89
|
-
* @param validationOptions - File validation options like size limits and allowed extensions
|
|
90
|
-
* @param options - Field options from VineJS
|
|
91
|
-
* @param validations - Array of validation functions to apply
|
|
92
|
-
*/
|
|
93
|
-
constructor(validationOptions, options, validations) {
|
|
94
|
-
super(options, validations || []);
|
|
95
|
-
this.#validationOptions = validationOptions;
|
|
96
|
-
this.dataTypeValidator = isMultipartFile(validationOptions || {});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Creates a clone of the current VineMultipartFile instance
|
|
100
|
-
* with the same validation options and configurations
|
|
101
|
-
*/
|
|
102
|
-
clone() {
|
|
103
|
-
return new VineMultipartFile(this.#validationOptions, this.cloneOptions(), this.cloneValidations());
|
|
104
|
-
}
|
|
105
|
-
}
|
|
1
|
+
import { t as VineMultipartFile } from "../vine-Bt4ymkM0.js";
|
|
2
|
+
export { VineMultipartFile };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import prettyHrTime from "pretty-hrtime";
|
|
2
|
+
import string from "@poppinss/utils/string";
|
|
3
|
+
import he from "he";
|
|
4
|
+
import StringBuilder from "@poppinss/utils/string_builder";
|
|
5
|
+
var string_default = {
|
|
6
|
+
...string,
|
|
7
|
+
toSentence: string.sentence,
|
|
8
|
+
ordinalize: string.ordinal,
|
|
9
|
+
generateRandom: string.random,
|
|
10
|
+
create(value) {
|
|
11
|
+
return new StringBuilder(value);
|
|
12
|
+
},
|
|
13
|
+
prettyHrTime(time, options) {
|
|
14
|
+
return prettyHrTime(time, options);
|
|
15
|
+
},
|
|
16
|
+
isEmpty(value) {
|
|
17
|
+
return value.trim().length === 0;
|
|
18
|
+
},
|
|
19
|
+
escapeHTML(value, options) {
|
|
20
|
+
value = he.escape(value);
|
|
21
|
+
if (options && options.encodeSymbols) value = this.encodeSymbols(value, { allowUnsafeSymbols: true });
|
|
22
|
+
return value;
|
|
23
|
+
},
|
|
24
|
+
encodeSymbols(value, options) {
|
|
25
|
+
return he.encode(value, options);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export { string_default as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { t as Ignitor } from "./main-BTUXw6He.js";
|
|
2
|
+
import { t as IgnitorFactory } from "./ignitor-Dil-rtCo.js";
|
|
3
|
+
import { t as TestUtils } from "./main-2-nm3TiB.js";
|
|
4
|
+
var TestUtilsFactory = class {
|
|
5
|
+
create(ignitorOrAppRoot, options) {
|
|
6
|
+
if (ignitorOrAppRoot instanceof Ignitor) return new TestUtils(ignitorOrAppRoot.createApp("test"));
|
|
7
|
+
return new TestUtils(new IgnitorFactory().withCoreConfig().withCoreProviders().create(ignitorOrAppRoot, options).createApp("console"));
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export { TestUtilsFactory as t };
|
package/build/toolkit/main.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { t as __decorate } from "../decorate-DM0Sx1ye.js";
|
|
3
|
+
import { BaseCommand, HelpCommand, IndexGenerator, Kernel, ListLoader, args } from "@adonisjs/ace";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
var IndexCommand = class extends BaseCommand {
|
|
6
|
+
static commandName = "index";
|
|
7
|
+
static description = "Create an index of commands along with a lazy loader";
|
|
8
|
+
async run() {
|
|
9
|
+
await new IndexGenerator(join(process.cwd(), this.commandsDir)).generate();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
__decorate([args.string({ description: "Relative path from cwd to the commands directory" })], IndexCommand.prototype, "commandsDir", void 0);
|
|
12
13
|
const kernel = Kernel.create();
|
|
13
14
|
kernel.addLoader(new ListLoader([IndexCommand]));
|
|
14
|
-
kernel.defineFlag(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
kernel.defineFlag("help", {
|
|
16
|
+
type: "boolean",
|
|
17
|
+
description: HelpCommand.description
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
kernel.
|
|
22
|
-
parsed.args.unshift(command.commandName);
|
|
23
|
-
const help = new HelpCommand($kernel, parsed, kernel.ui, kernel.prompt);
|
|
24
|
-
await help.exec();
|
|
25
|
-
return $kernel.shortcircuit();
|
|
19
|
+
kernel.on("help", async (command, $kernel, parsed) => {
|
|
20
|
+
parsed.args.unshift(command.commandName);
|
|
21
|
+
await new HelpCommand($kernel, parsed, kernel.ui, kernel.prompt).exec();
|
|
22
|
+
return $kernel.shortcircuit();
|
|
26
23
|
});
|
|
27
24
|
await kernel.handle(process.argv.splice(2));
|
|
25
|
+
export {};
|
package/build/types/ace.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 * from '@adonisjs/ace/types';
|
|
1
|
+
export * from "@adonisjs/ace/types";
|
|
2
|
+
export {};
|
package/build/types/app.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 * from '@adonisjs/application/types';
|
|
1
|
+
export * from "@adonisjs/application/types";
|
|
2
|
+
export {};
|