@adonisjs/core 7.0.0-next.11 → 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.
Files changed (87) hide show
  1. package/build/ace-DDzvaSs_.js +16 -0
  2. package/build/app-B6oge7b3.js +5 -0
  3. package/build/app-BK0PN3li.js +5 -0
  4. package/build/bodyparser_middleware-DTW0epKM.js +3 -0
  5. package/build/chunk-MjwdjG2f.js +32 -0
  6. package/build/commands/add.js +1 -1
  7. package/build/commands/build.js +1 -1
  8. package/build/commands/configure.js +1 -1
  9. package/build/commands/eject.js +1 -1
  10. package/build/commands/env/add.js +1 -1
  11. package/build/commands/generate_key.js +1 -1
  12. package/build/commands/inspect_rcfile.js +1 -1
  13. package/build/commands/list/routes.js +1 -1
  14. package/build/commands/make/command.js +1 -1
  15. package/build/commands/make/controller.js +1 -1
  16. package/build/commands/make/event.js +1 -1
  17. package/build/commands/make/exception.js +1 -1
  18. package/build/commands/make/listener.js +1 -1
  19. package/build/commands/make/middleware.js +1 -1
  20. package/build/commands/make/preload.js +1 -1
  21. package/build/commands/make/provider.js +1 -1
  22. package/build/commands/make/service.js +1 -1
  23. package/build/commands/make/test.js +1 -1
  24. package/build/commands/make/transformer.js +1 -1
  25. package/build/commands/make/validator.js +1 -1
  26. package/build/commands/make/view.js +1 -1
  27. package/build/commands/repl.js +1 -1
  28. package/build/commands/serve.js +1 -1
  29. package/build/commands/test.js +1 -1
  30. package/build/config-B2S2xfmN.js +5 -0
  31. package/build/config_provider-CY-xuo2R.js +13 -0
  32. package/build/container-ClFvcykQ.js +5 -0
  33. package/build/core-CNNCwlhc.js +95 -0
  34. package/build/create_kernel-B7zWS8Zz.js +38 -0
  35. package/build/create_kernel-CsTq0pWc.js +3 -0
  36. package/build/debug-DURPi9xn.js +3 -0
  37. package/build/decorate-DM0Sx1ye.js +7 -0
  38. package/build/dumper-C_sMcyFb.js +147 -0
  39. package/build/edge-LQdCc1L3.js +47 -0
  40. package/build/encryption-D2HGu0bU.js +5 -0
  41. package/build/events-B8hK42QT.js +5 -0
  42. package/build/factories/core/ace.js +5 -5
  43. package/build/factories/core/ignitor.js +2 -2
  44. package/build/factories/core/main.js +6 -6
  45. package/build/factories/core/test_utils.js +3 -3
  46. package/build/factories/stubs.js +1 -1
  47. package/build/ignitor-Dil-rtCo.js +63 -0
  48. package/build/index.js +1 -1
  49. package/build/logger-Dha-0hp1.js +13 -0
  50. package/build/main-2-nm3TiB.js +72 -0
  51. package/build/main-BTUXw6He.js +171 -0
  52. package/build/main-BWftwyAK.js +81 -0
  53. package/build/main-BrJQ1VAM.js +52 -0
  54. package/build/main-CFmDHDls.js +35 -0
  55. package/build/main-D5xz2ZN1.js +5 -0
  56. package/build/main-kn40V-hF.js +2 -0
  57. package/build/main-q9TMzWUj.js +5 -0
  58. package/build/modules/ace/main.js +1 -1
  59. package/build/providers/app_provider.js +1 -1
  60. package/build/repl-CumYg2V_.js +5 -0
  61. package/build/string-CJ7ewUFq.js +28 -0
  62. package/build/test_utils-c_TEaEHW.js +10 -0
  63. package/build/toolkit/main.js +25 -0
  64. package/build/utils-CNQ4tlGM.js +41 -0
  65. package/build/verification_token-DXsW81rl.js +46 -0
  66. package/build/vine-Bt4ymkM0.js +32 -0
  67. package/package.json +6 -13
  68. /package/build/{stubs/make → make}/command/main.stub +0 -0
  69. /package/build/{stubs/make → make}/controller/actions.stub +0 -0
  70. /package/build/{stubs/make → make}/controller/api.stub +0 -0
  71. /package/build/{stubs/make → make}/controller/main.stub +0 -0
  72. /package/build/{stubs/make → make}/controller/resource.stub +0 -0
  73. /package/build/{stubs/make → make}/event/main.stub +0 -0
  74. /package/build/{stubs/make → make}/exception/main.stub +0 -0
  75. /package/build/{stubs/make → make}/health/controller.stub +0 -0
  76. /package/build/{stubs/make → make}/health/main.stub +0 -0
  77. /package/build/{stubs/make → make}/listener/for_event.stub +0 -0
  78. /package/build/{stubs/make → make}/listener/main.stub +0 -0
  79. /package/build/{stubs/make → make}/middleware/main.stub +0 -0
  80. /package/build/{stubs/make → make}/preload/main.stub +0 -0
  81. /package/build/{stubs/make → make}/provider/main.stub +0 -0
  82. /package/build/{stubs/make → make}/service/main.stub +0 -0
  83. /package/build/{stubs/make → make}/test/main.stub +0 -0
  84. /package/build/{stubs/make → make}/transformer/main.stub +0 -0
  85. /package/build/{stubs/make → make}/validator/main.stub +0 -0
  86. /package/build/{stubs/make → make}/validator/resource.stub +0 -0
  87. /package/build/{stubs/make → make}/view/main.stub +0 -0
@@ -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 };
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
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);
13
+ const kernel = Kernel.create();
14
+ kernel.addLoader(new ListLoader([IndexCommand]));
15
+ kernel.defineFlag("help", {
16
+ type: "boolean",
17
+ description: HelpCommand.description
18
+ });
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();
23
+ });
24
+ await kernel.handle(process.argv.splice(2));
25
+ export {};
@@ -0,0 +1,41 @@
1
+ async function importAssembler(app) {
2
+ try {
3
+ return await app.import("@adonisjs/assembler");
4
+ } catch {}
5
+ }
6
+ async function importTypeScript(app) {
7
+ try {
8
+ return await app.importDefault("typescript");
9
+ } catch {}
10
+ }
11
+ async function outputTransformerDataObjects(transformersList, buffer, withSharedProps) {
12
+ const importsBuffer = buffer.create();
13
+ importsBuffer.write(`import type { InferData, InferVariants } from '@adonisjs/core/types/transformers'`);
14
+ if (withSharedProps) importsBuffer.write(`import type { InferSharedProps } from '@adonisjs/inertia/types'`);
15
+ buffer.writeLine(importsBuffer);
16
+ buffer.write("export namespace Data {").indent();
17
+ function generateNamespaceTree(input, parents) {
18
+ Object.keys(input).forEach((key) => {
19
+ const value = input[key];
20
+ if (typeof value === "string") {
21
+ const importName = `${parents.join()}${key}Transformer`;
22
+ importsBuffer.write(`import type ${importName} from '${value}'`);
23
+ buffer.write(`export type ${key} = InferData<${importName}>`);
24
+ buffer.write(`export namespace ${key} {`).indent();
25
+ buffer.write(`export type Variants = InferVariants<${importName}>`);
26
+ buffer.dedent().write("}");
27
+ } else {
28
+ buffer.write(`export namespace ${key} {`).indent();
29
+ generateNamespaceTree(value, [...parents, key]);
30
+ buffer.dedent().write(`}`);
31
+ }
32
+ });
33
+ }
34
+ generateNamespaceTree(transformersList, []);
35
+ if (withSharedProps) {
36
+ importsBuffer.write(`import type InertiaMiddleware from '#middleware/inertia_middleware'`);
37
+ buffer.write("export type SharedProps = InferSharedProps<InertiaMiddleware>");
38
+ }
39
+ buffer.dedent().write("}");
40
+ }
41
+ export { importTypeScript as n, outputTransformerDataObjects as r, importAssembler as t };
@@ -0,0 +1,46 @@
1
+ import string from "@poppinss/utils/string";
2
+ import base64 from "@poppinss/utils/base64";
3
+ import { Secret, safeEqual } from "@poppinss/utils";
4
+ import { createHash } from "node:crypto";
5
+ var VerificationToken = class {
6
+ static decode(value) {
7
+ if (typeof value !== "string") return null;
8
+ if (!value) return null;
9
+ const [identifier, ...tokenValue] = value.split(".");
10
+ if (!identifier || tokenValue.length === 0) return null;
11
+ const decodedIdentifier = base64.urlDecode(identifier);
12
+ const decodedSecret = base64.urlDecode(tokenValue.join("."));
13
+ if (!decodedIdentifier || !decodedSecret) return null;
14
+ return {
15
+ identifier: decodedIdentifier,
16
+ secret: new Secret(decodedSecret)
17
+ };
18
+ }
19
+ static createTransientToken(userId, size, expiresIn) {
20
+ const expiresAt = /* @__PURE__ */ new Date();
21
+ expiresAt.setSeconds(expiresAt.getSeconds() + string.seconds.parse(expiresIn));
22
+ return {
23
+ userId,
24
+ expiresAt,
25
+ ...this.seed(size)
26
+ };
27
+ }
28
+ static seed(size) {
29
+ const secret = new Secret(string.random(size));
30
+ return {
31
+ secret,
32
+ hash: createHash("sha256").update(secret.release()).digest("hex")
33
+ };
34
+ }
35
+ computeValue(secret) {
36
+ this.value = new Secret(`${base64.urlEncode(String(this.identifier))}.${base64.urlEncode(secret.release())}`);
37
+ }
38
+ isExpired() {
39
+ return this.expiresAt < /* @__PURE__ */ new Date();
40
+ }
41
+ verify(secret) {
42
+ const newHash = createHash("sha256").update(secret.release()).digest("hex");
43
+ return safeEqual(this.hash, newHash);
44
+ }
45
+ };
46
+ export { VerificationToken as t };
@@ -0,0 +1,32 @@
1
+ import vine, { BaseLiteralType, symbols } from "@vinejs/vine";
2
+ const MULTIPART_FILE = symbols.SUBTYPE ?? Symbol.for("subtype");
3
+ function isBodyParserFile(file) {
4
+ return !!(file && typeof file === "object" && "isMultipartFile" in file);
5
+ }
6
+ const isMultipartFile = vine.createRule((file, options, field) => {
7
+ if (!isBodyParserFile(file)) {
8
+ field.report("The {{ field }} must be a file", "file", field);
9
+ return false;
10
+ }
11
+ const validationOptions = typeof options === "function" ? options(field) : options;
12
+ if (file.sizeLimit === void 0 && validationOptions.size) file.sizeLimit = validationOptions.size;
13
+ if (file.allowedExtensions === void 0 && validationOptions.extnames) file.allowedExtensions = validationOptions.extnames;
14
+ file.validate();
15
+ file.errors.forEach((error) => {
16
+ field.report(error.message, `file.${error.type}`, field, validationOptions);
17
+ });
18
+ return file.isValid;
19
+ });
20
+ var VineMultipartFile = class VineMultipartFile extends BaseLiteralType {
21
+ #validationOptions;
22
+ [MULTIPART_FILE] = "multipartFile";
23
+ constructor(validationOptions, options, validations) {
24
+ super(options, validations || []);
25
+ this.#validationOptions = validationOptions;
26
+ this.dataTypeValidator = isMultipartFile(validationOptions || {});
27
+ }
28
+ clone() {
29
+ return new VineMultipartFile(this.#validationOptions, this.cloneOptions(), this.cloneValidations());
30
+ }
31
+ };
32
+ export { VineMultipartFile as t };
package/package.json CHANGED
@@ -1,24 +1,16 @@
1
1
  {
2
2
  "name": "@adonisjs/core",
3
3
  "description": "Core of AdonisJS",
4
- "version": "7.0.0-next.11",
4
+ "version": "7.0.0-next.12",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
8
8
  "main": "build/index.js",
9
9
  "type": "module",
10
10
  "files": [
11
- "build/modules",
12
- "build/commands",
13
- "build/providers",
14
- "build/services",
15
- "build/factories",
16
- "build/toolkit",
17
- "build/types",
18
- "build/src",
19
- "build/stubs",
20
- "build/index.d.ts",
21
- "build/index.js"
11
+ "build",
12
+ "!build/bin",
13
+ "!build/tests"
22
14
  ],
23
15
  "bin": {
24
16
  "adonis-kit": "./build/toolkit/main.js"
@@ -68,7 +60,7 @@
68
60
  "pretest": "npm run lint",
69
61
  "test": "cross-env NODE_DEBUG=adonisjs:core c8 npm run quick:test",
70
62
  "clean": "del-cli build",
71
- "copy:templates": "copyfiles \"stubs/**/**/*.stub\" build",
63
+ "copy:templates": "copyfiles \"stubs/**/**/*.stub\" --up=1 build",
72
64
  "precompile": "npm run lint",
73
65
  "compile": "npm run clean && tsdown && tsc --emitDeclarationOnly --declaration",
74
66
  "postcompile": "npm run copy:templates && npm run index:commands",
@@ -231,6 +223,7 @@
231
223
  "factories/core/main.ts",
232
224
  "factories/**/*.ts",
233
225
  "src/types.ts",
226
+ "toolkit/main.ts",
234
227
  "types/**/*.ts",
235
228
  "services/**/*.ts",
236
229
  "providers/**/*.ts",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes