@codenameryuu/adonis-lucid-auto-preload 1.4.0 → 1.5.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.
Files changed (30) hide show
  1. package/build/adonis-typings/auto_preload.js +1 -0
  2. package/build/adonis-typings/container.d.ts +3 -3
  3. package/build/adonis-typings/container.js +1 -1
  4. package/build/adonis-typings/index.js +3 -1
  5. package/build/commands/index.js +10 -0
  6. package/build/configure.js +9 -0
  7. package/build/index.d.ts +2 -2
  8. package/build/index.js +10 -11
  9. package/build/providers/auto_preload_provider.d.ts +2 -2
  10. package/build/providers/auto_preload_provider.js +17 -30
  11. package/build/src/exceptions/wrong_argument_type_exception.js +6 -7
  12. package/build/src/exceptions/wrong_relationship_type_exception.js +6 -7
  13. package/build/src/mixins/auto_preload.d.ts +2 -2
  14. package/build/src/mixins/auto_preload.js +112 -0
  15. package/package.json +7 -24
  16. package/build/adonis-typings/auto-preload.js +0 -1
  17. package/build/adonis-typings/auto-preload.js.map +0 -1
  18. package/build/adonis-typings/container.js.map +0 -1
  19. package/build/adonis-typings/index.js.map +0 -1
  20. package/build/chunk-2ZUAELPR.js +0 -126
  21. package/build/chunk-2ZUAELPR.js.map +0 -1
  22. package/build/chunk-4THCFWWY.js +0 -14
  23. package/build/chunk-4THCFWWY.js.map +0 -1
  24. package/build/chunk-TQK7SWBT.js +0 -12
  25. package/build/chunk-TQK7SWBT.js.map +0 -1
  26. package/build/index.js.map +0 -1
  27. package/build/providers/auto_preload_provider.js.map +0 -1
  28. package/build/src/exceptions/wrong_argument_type_exception.js.map +0 -1
  29. package/build/src/exceptions/wrong_relationship_type_exception.js.map +0 -1
  30. /package/build/adonis-typings/{auto-preload.d.ts → auto_preload.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
- import type { AutoPreloadMixin } from "./auto-preload.js";
2
- declare module "@adonisjs/core/types" {
1
+ import type { AutoPreloadMixin } from './auto_preload.js';
2
+ declare module '@adonisjs/core/types' {
3
3
  interface ContainerBindings {
4
- "@codenameryuu/adonis-lucid-auto-preload": {
4
+ '@codenameryuu/adonis-lucid-auto-preload': {
5
5
  AutoPreload: AutoPreloadMixin;
6
6
  };
7
7
  }
@@ -1 +1 @@
1
- //# sourceMappingURL=container.js.map
1
+ export {};
@@ -1 +1,3 @@
1
- //# sourceMappingURL=index.js.map
1
+ export {};
2
+ /// <reference path="./auto_preload.ts" />
3
+ /// <reference path="./container.ts" />
@@ -0,0 +1,10 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ | Exporting an array of commands
4
+ |--------------------------------------------------------------------------
5
+ |
6
+ | This package currently ships without Ace commands. Keep the command
7
+ | index in place and export an empty array to satisfy the expected API.
8
+ |
9
+ */
10
+ export default [];
@@ -0,0 +1,9 @@
1
+ export async function configure(command) {
2
+ const codemods = await command.createCodemods();
3
+ /**
4
+ * Register the provider inside `adonisrc.ts`
5
+ */
6
+ await codemods.updateRcFile((rcFile) => {
7
+ rcFile.addProvider('@codenameryuu/adonis-lucid-auto-preload/provider');
8
+ });
9
+ }
package/build/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { configure } from "./configure.js";
2
- export { AutoPreload } from "./src/mixins/auto_preload.ts";
1
+ export { configure } from './configure.js';
2
+ export { AutoPreload } from './src/mixins/auto_preload.ts';
package/build/index.js CHANGED
@@ -1,11 +1,10 @@
1
- import {
2
- AutoPreload,
3
- configure
4
- } from "./chunk-2ZUAELPR.js";
5
- import "./chunk-TQK7SWBT.js";
6
- import "./chunk-4THCFWWY.js";
7
- export {
8
- AutoPreload,
9
- configure
10
- };
11
- //# sourceMappingURL=index.js.map
1
+ /*
2
+ * adonis-lucid-soft-deletes
3
+ *
4
+ * (c) Lookin Anton <alsd@lookinlab.ru>
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 { configure } from './configure.js';
10
+ export { AutoPreload } from "./src/mixins/auto_preload.js";
@@ -1,5 +1,5 @@
1
- import type { ApplicationService } from "@adonisjs/core/types";
2
- export { configure } from "../configure.ts";
1
+ import type { ApplicationService } from '@adonisjs/core/types';
2
+ export { configure } from '../configure.js';
3
3
  export default class AutoPreloadProvider {
4
4
  protected app: ApplicationService;
5
5
  static needsApplication: boolean;
@@ -1,30 +1,17 @@
1
- import {
2
- AutoPreload,
3
- configure
4
- } from "../chunk-2ZUAELPR.js";
5
- import "../chunk-TQK7SWBT.js";
6
- import "../chunk-4THCFWWY.js";
7
-
8
- // providers/auto_preload_provider.ts
9
- var AutoPreloadProvider = class {
10
- constructor(app) {
11
- this.app = app;
12
- }
13
- static needsApplication = true;
14
- register() {
15
- this.app.container.singleton("@codenameryuu/adonis-lucid-auto-preload", () => {
16
- return { AutoPreload };
17
- });
18
- }
19
- async boot() {
20
- }
21
- async ready() {
22
- }
23
- async shutdown() {
24
- }
25
- };
26
- export {
27
- configure,
28
- AutoPreloadProvider as default
29
- };
30
- //# sourceMappingURL=auto_preload_provider.js.map
1
+ import { AutoPreload } from '../src/mixins/auto_preload.js';
2
+ export { configure } from '../configure.js';
3
+ export default class AutoPreloadProvider {
4
+ app;
5
+ static needsApplication = true;
6
+ constructor(app) {
7
+ this.app = app;
8
+ }
9
+ register() {
10
+ this.app.container.singleton('@codenameryuu/adonis-lucid-auto-preload', () => {
11
+ return { AutoPreload };
12
+ });
13
+ }
14
+ async boot() { }
15
+ async ready() { }
16
+ async shutdown() { }
17
+ }
@@ -1,7 +1,6 @@
1
- import {
2
- WrongArgumentTypeException
3
- } from "../../chunk-TQK7SWBT.js";
4
- export {
5
- WrongArgumentTypeException as default
6
- };
7
- //# sourceMappingURL=wrong_argument_type_exception.js.map
1
+ import { Exception } from '@adonisjs/core/exceptions';
2
+ export default class WrongArgumentTypeException extends Exception {
3
+ static invoke(method) {
4
+ return new this(`The method ${method} accepts only an array of strings`);
5
+ }
6
+ }
@@ -1,7 +1,6 @@
1
- import {
2
- WrongRelationshipTypeException
3
- } from "../../chunk-4THCFWWY.js";
4
- export {
5
- WrongRelationshipTypeException as default
6
- };
7
- //# sourceMappingURL=wrong_relationship_type_exception.js.map
1
+ import { Exception } from '@adonisjs/core/exceptions';
2
+ export default class WrongRelationshipTypeException extends Exception {
3
+ static invoke(model) {
4
+ return new this(`The model "${model}" has wrong relationships to be auto-preloaded. Only string and function types are allowed`);
5
+ }
6
+ }
@@ -1,5 +1,5 @@
1
- import type { NormalizeConstructor } from "@adonisjs/core/types/helpers";
2
- import type { LucidModel } from "@adonisjs/lucid/types/model";
1
+ import type { NormalizeConstructor } from '@adonisjs/core/types/helpers';
2
+ import type { LucidModel } from '@adonisjs/lucid/types/model';
3
3
  type AutoPreloadMixin = <T extends NormalizeConstructor<LucidModel>>(superclass: T) => T & {
4
4
  $with: Array<string | ((query: any) => void)>;
5
5
  without(this: T, relationships: Array<string>): T;
@@ -0,0 +1,112 @@
1
+ import WrongRelationshipTypeException from '../exceptions/wrong_relationship_type_exception.js';
2
+ import WrongArgumentTypeException from '../exceptions/wrong_argument_type_exception.js';
3
+ export const AutoPreload = (superclass) => {
4
+ class AutoPreloadModel extends superclass {
5
+ static $with = [];
6
+ static $originalWith = [];
7
+ static boot() {
8
+ if (this.booted) {
9
+ return;
10
+ }
11
+ if (this.$with.length > 0) {
12
+ const isWrongType = this.$with.every((relationship) => {
13
+ return !['function', 'string'].includes(typeof relationship);
14
+ });
15
+ if (isWrongType) {
16
+ throw WrongRelationshipTypeException.invoke(this.name);
17
+ }
18
+ }
19
+ super.boot();
20
+ this.$originalWith = [...this.$with];
21
+ for (const hook of ['fetch', 'find']) {
22
+ this.before(hook, (query) => {
23
+ this.handleAutoPreload(query);
24
+ });
25
+ }
26
+ this.before('paginate', ([_, query]) => {
27
+ this.handleAutoPreload(query, false);
28
+ });
29
+ }
30
+ static without(relationships) {
31
+ this.checkArrayOfRelationships('without', relationships);
32
+ this.$with = this.$with.filter((relationship) => {
33
+ if (typeof relationship === 'string') {
34
+ return !relationships.includes(relationship);
35
+ }
36
+ else if (typeof relationship === 'function') {
37
+ return relationship;
38
+ }
39
+ else {
40
+ throw WrongArgumentTypeException.invoke(relationship);
41
+ }
42
+ });
43
+ return this;
44
+ }
45
+ static withOnly(relationships) {
46
+ this.checkArrayOfRelationships('withOnly', relationships);
47
+ this.$with = this.$with.filter((relationship) => {
48
+ if (typeof relationship === 'string') {
49
+ return relationships.includes(relationship);
50
+ }
51
+ else if (typeof relationship === 'function') {
52
+ return relationship;
53
+ }
54
+ else {
55
+ throw WrongArgumentTypeException.invoke(relationship);
56
+ }
57
+ });
58
+ return this;
59
+ }
60
+ static withoutAny() {
61
+ this.$with = [];
62
+ return this;
63
+ }
64
+ static handleAutoPreload(query, restorePreloads = true) {
65
+ const preloads = this.$with;
66
+ if (preloads.length > 0) {
67
+ for (const preload of preloads) {
68
+ if (typeof preload === 'string') {
69
+ if (preload.includes('.')) {
70
+ this.handleNestedRelationships(query, preload.split('.'));
71
+ }
72
+ else {
73
+ query.preload(preload);
74
+ }
75
+ }
76
+ else if (typeof preload === 'function') {
77
+ preload(query);
78
+ }
79
+ }
80
+ }
81
+ if (restorePreloads) {
82
+ this.$with = [...this.$originalWith];
83
+ }
84
+ }
85
+ /**
86
+ * Recursive function to handle nested relationships.
87
+ */
88
+ static handleNestedRelationships(query, relationships) {
89
+ if (relationships.length > 0) {
90
+ const nextRelation = relationships.shift();
91
+ if (nextRelation) {
92
+ query.preload(nextRelation, (qb) => {
93
+ if (relationships.length > 0) {
94
+ this.handleNestedRelationships(qb, relationships);
95
+ }
96
+ });
97
+ }
98
+ }
99
+ }
100
+ static checkArrayOfRelationships(method, relationships) {
101
+ if (relationships.length > 0) {
102
+ const isWrongType = relationships.every((relationship) => {
103
+ return !['function', 'string'].includes(typeof relationship);
104
+ });
105
+ if (isWrongType) {
106
+ throw WrongArgumentTypeException.invoke(method);
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return AutoPreloadModel;
112
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codenameryuu/adonis-lucid-auto-preload",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Auto-preload multiple relationships when retrieving Lucid models on Adonis JS 7",
5
5
  "author": "codenameryuu",
6
6
  "license": "MIT",
@@ -25,18 +25,15 @@
25
25
  "./providers": "./build/providers/auto_preload_provider.js"
26
26
  },
27
27
  "scripts": {
28
- "lint": "eslint .",
29
- "format": "prettier --write .",
30
28
  "clean": "del-cli build",
31
- "precompile": "npm run lint && npm run clean",
32
- "compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
33
- "build": "npm run compile",
34
- "pretest": "npm run lint",
35
- "test": "c8 npm run quick:test",
36
29
  "typecheck": "tsc --noEmit",
30
+ "lint": "eslint . --ext=.ts",
31
+ "format": "prettier --write .",
32
+ "prebuild": "npm run lint && npm run clean",
33
+ "build": "npm run clean && tsc",
34
+ "release": "release-it",
37
35
  "version": "npm run build",
38
- "prepublishOnly": "npm run build",
39
- "release": "np"
36
+ "prepublishOnly": "npm run build"
40
37
  },
41
38
  "devDependencies": {
42
39
  "@adonisjs/assembler": "^7.7.0",
@@ -93,19 +90,5 @@
93
90
  "tests/**",
94
91
  "bin/**"
95
92
  ]
96
- },
97
- "tsup": {
98
- "entry": [
99
- "./index.ts",
100
- "./src/exceptions/*.ts",
101
- "./adonis-typings/*.ts",
102
- "./providers/auto_preload_provider.ts"
103
- ],
104
- "outDir": "./build",
105
- "clean": true,
106
- "format": "esm",
107
- "dts": false,
108
- "sourcemap": true,
109
- "target": "esnext"
110
93
  }
111
94
  }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=auto-preload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,126 +0,0 @@
1
- import {
2
- WrongArgumentTypeException
3
- } from "./chunk-TQK7SWBT.js";
4
- import {
5
- WrongRelationshipTypeException
6
- } from "./chunk-4THCFWWY.js";
7
-
8
- // configure.ts
9
- async function configure(command) {
10
- const codemods = await command.createCodemods();
11
- await codemods.updateRcFile((rcFile) => {
12
- rcFile.addProvider("@codenameryuu/adonis-lucid-auto-preload/provider");
13
- });
14
- }
15
-
16
- // src/mixins/auto_preload.ts
17
- var AutoPreload = (superclass) => {
18
- class AutoPreloadModel extends superclass {
19
- static $with = [];
20
- static $originalWith = [];
21
- static boot() {
22
- if (this.booted) {
23
- return;
24
- }
25
- if (this.$with.length > 0) {
26
- const isWrongType = this.$with.every((relationship) => {
27
- return !["function", "string"].includes(typeof relationship);
28
- });
29
- if (isWrongType) {
30
- throw WrongRelationshipTypeException.invoke(this.name);
31
- }
32
- }
33
- super.boot();
34
- this.$originalWith = [...this.$with];
35
- for (const hook of ["fetch", "find"]) {
36
- this.before(hook, (query) => {
37
- this.handleAutoPreload(query);
38
- });
39
- }
40
- this.before("paginate", ([_, query]) => {
41
- this.handleAutoPreload(query, false);
42
- });
43
- }
44
- static without(relationships) {
45
- this.checkArrayOfRelationships("without", relationships);
46
- this.$with = this.$with.filter((relationship) => {
47
- if (typeof relationship === "string") {
48
- return !relationships.includes(relationship);
49
- } else if (typeof relationship === "function") {
50
- return relationship;
51
- } else {
52
- throw WrongArgumentTypeException.invoke(relationship);
53
- }
54
- });
55
- return this;
56
- }
57
- static withOnly(relationships) {
58
- this.checkArrayOfRelationships("withOnly", relationships);
59
- this.$with = this.$with.filter((relationship) => {
60
- if (typeof relationship === "string") {
61
- return relationships.includes(relationship);
62
- } else if (typeof relationship === "function") {
63
- return relationship;
64
- } else {
65
- throw WrongArgumentTypeException.invoke(relationship);
66
- }
67
- });
68
- return this;
69
- }
70
- static withoutAny() {
71
- this.$with = [];
72
- return this;
73
- }
74
- static handleAutoPreload(query, restorePreloads = true) {
75
- const preloads = this.$with;
76
- if (preloads.length > 0) {
77
- for (const preload of preloads) {
78
- if (typeof preload === "string") {
79
- if (preload.includes(".")) {
80
- this.handleNestedRelationships(query, preload.split("."));
81
- } else {
82
- query.preload(preload);
83
- }
84
- } else if (typeof preload === "function") {
85
- preload(query);
86
- }
87
- }
88
- }
89
- if (restorePreloads) {
90
- this.$with = [...this.$originalWith];
91
- }
92
- }
93
- /**
94
- * Recursive function to handle nested relationships.
95
- */
96
- static handleNestedRelationships(query, relationships) {
97
- if (relationships.length > 0) {
98
- const nextRelation = relationships.shift();
99
- if (nextRelation) {
100
- query.preload(nextRelation, (qb) => {
101
- if (relationships.length > 0) {
102
- this.handleNestedRelationships(qb, relationships);
103
- }
104
- });
105
- }
106
- }
107
- }
108
- static checkArrayOfRelationships(method, relationships) {
109
- if (relationships.length > 0) {
110
- const isWrongType = relationships.every((relationship) => {
111
- return !["function", "string"].includes(typeof relationship);
112
- });
113
- if (isWrongType) {
114
- throw WrongArgumentTypeException.invoke(method);
115
- }
116
- }
117
- }
118
- }
119
- return AutoPreloadModel;
120
- };
121
-
122
- export {
123
- configure,
124
- AutoPreload
125
- };
126
- //# sourceMappingURL=chunk-2ZUAELPR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../configure.ts","../src/mixins/auto_preload.ts"],"sourcesContent":["import type Configure from '@adonisjs/core/commands/configure'\n\nexport async function configure(command: Configure) {\n const codemods = await command.createCodemods()\n\n /**\n * Register the provider inside `adonisrc.ts`\n */\n await codemods.updateRcFile((rcFile) => {\n rcFile.addProvider('@codenameryuu/adonis-lucid-auto-preload/provider')\n })\n}\n","import type { NormalizeConstructor } from \"@adonisjs/core/types/helpers\";\nimport type { LucidModel, ModelQueryBuilderContract } from \"@adonisjs/lucid/types/model\";\n\nimport WrongRelationshipTypeException from \"../exceptions/wrong_relationship_type_exception.ts\";\nimport WrongArgumentTypeException from \"../exceptions/wrong_argument_type_exception.ts\";\n\ntype AutoPreloadMixin = <T extends NormalizeConstructor<LucidModel>>(\n superclass: T\n) => T & {\n $with: Array<string | ((query: any) => void)>;\n without(this: T, relationships: Array<string>): T;\n withOnly(this: T, relationships: Array<string>): T;\n withoutAny(this: T): T;\n new (...args: Array<any>): {};\n};\n\nexport const AutoPreload: AutoPreloadMixin = (superclass) => {\n class AutoPreloadModel extends superclass {\n public static $with: Array<any> = [];\n\n protected static $originalWith: Array<any> = [];\n\n public static boot() {\n if (this.booted) {\n return;\n }\n\n if (this.$with.length > 0) {\n const isWrongType = this.$with.every((relationship) => {\n return ![\"function\", \"string\"].includes(typeof relationship);\n });\n\n if (isWrongType) {\n throw WrongRelationshipTypeException.invoke(this.name);\n }\n }\n\n super.boot();\n\n this.$originalWith = [...this.$with];\n\n for (const hook of [\"fetch\", \"find\"] as const) {\n this.before(hook, (query: any) => {\n this.handleAutoPreload(query);\n });\n }\n\n this.before(\"paginate\", ([_, query]: [ModelQueryBuilderContract<any>, ModelQueryBuilderContract<any>]) => {\n this.handleAutoPreload(query, false);\n });\n }\n\n public static without(relationships: any): any {\n this.checkArrayOfRelationships(\"without\", relationships);\n\n this.$with = this.$with.filter((relationship) => {\n if (typeof relationship === \"string\") {\n return !relationships.includes(relationship);\n } else if (typeof relationship === \"function\") {\n return relationship;\n } else {\n throw WrongArgumentTypeException.invoke(relationship);\n }\n });\n\n return this;\n }\n\n public static withOnly(relationships: any): any {\n this.checkArrayOfRelationships(\"withOnly\", relationships);\n\n this.$with = this.$with.filter((relationship) => {\n if (typeof relationship === \"string\") {\n return relationships.includes(relationship);\n } else if (typeof relationship === \"function\") {\n return relationship;\n } else {\n throw WrongArgumentTypeException.invoke(relationship);\n }\n });\n\n return this;\n }\n\n public static withoutAny(): any {\n this.$with = [];\n\n return this;\n }\n\n private static handleAutoPreload(query: ModelQueryBuilderContract<any>, restorePreloads = true) {\n const preloads = this.$with;\n\n if (preloads.length > 0) {\n for (const preload of preloads) {\n if (typeof preload === \"string\") {\n if (preload.includes(\".\")) {\n this.handleNestedRelationships(query, preload.split(\".\") as any);\n } else {\n query.preload(preload as any);\n }\n } else if (typeof preload === \"function\") {\n preload(query);\n }\n }\n }\n\n if (restorePreloads) {\n this.$with = [...this.$originalWith];\n }\n }\n\n /**\n * Recursive function to handle nested relationships.\n */\n private static handleNestedRelationships(query: ModelQueryBuilderContract<any>, relationships: any) {\n if (relationships.length > 0) {\n const nextRelation = relationships.shift();\n\n if (nextRelation) {\n query.preload(nextRelation, (qb: any) => {\n if (relationships.length > 0) {\n this.handleNestedRelationships(qb, relationships);\n }\n });\n }\n }\n }\n\n private static checkArrayOfRelationships(method: string, relationships: Array<any>) {\n if (relationships.length > 0) {\n const isWrongType = relationships.every((relationship: any) => {\n return ![\"function\", \"string\"].includes(typeof relationship);\n });\n\n if (isWrongType) {\n throw WrongArgumentTypeException.invoke(method);\n }\n }\n }\n }\n\n return AutoPreloadModel;\n};\n"],"mappings":"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","names":[]}
@@ -1,14 +0,0 @@
1
- // src/exceptions/wrong_relationship_type_exception.ts
2
- import { Exception } from "@adonisjs/core/exceptions";
3
- var WrongRelationshipTypeException = class extends Exception {
4
- static invoke(model) {
5
- return new this(
6
- `The model "${model}" has wrong relationships to be auto-preloaded. Only string and function types are allowed`
7
- );
8
- }
9
- };
10
-
11
- export {
12
- WrongRelationshipTypeException
13
- };
14
- //# sourceMappingURL=chunk-4THCFWWY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/exceptions/wrong_relationship_type_exception.ts"],"sourcesContent":["import { Exception } from '@adonisjs/core/exceptions'\n\nexport default class WrongRelationshipTypeException extends Exception {\n public static invoke(model: string) {\n return new this(\n `The model \"${model}\" has wrong relationships to be auto-preloaded. Only string and function types are allowed`\n )\n }\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAE1B,IAAqB,iCAArB,cAA4D,UAAU;AAAA,EACpE,OAAc,OAAO,OAAe;AAClC,WAAO,IAAI;AAAA,MACT,cAAc,KAAK;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}
@@ -1,12 +0,0 @@
1
- // src/exceptions/wrong_argument_type_exception.ts
2
- import { Exception } from "@adonisjs/core/exceptions";
3
- var WrongArgumentTypeException = class extends Exception {
4
- static invoke(method) {
5
- return new this(`The method ${method} accepts only an array of strings`);
6
- }
7
- };
8
-
9
- export {
10
- WrongArgumentTypeException
11
- };
12
- //# sourceMappingURL=chunk-TQK7SWBT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/exceptions/wrong_argument_type_exception.ts"],"sourcesContent":["import { Exception } from '@adonisjs/core/exceptions'\n\nexport default class WrongArgumentTypeException extends Exception {\n public static invoke(method: string) {\n return new this(`The method ${method} accepts only an array of strings`)\n }\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAE1B,IAAqB,6BAArB,cAAwD,UAAU;AAAA,EAChE,OAAc,OAAO,QAAgB;AACnC,WAAO,IAAI,KAAK,cAAc,MAAM,mCAAmC;AAAA,EACzE;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../providers/auto_preload_provider.ts"],"sourcesContent":["import type { ApplicationService } from \"@adonisjs/core/types\";\nimport { AutoPreload } from \"../src/mixins/auto_preload.ts\";\nexport { configure } from \"../configure.ts\";\n\nexport default class AutoPreloadProvider {\n public static needsApplication = true;\n\n constructor(protected app: ApplicationService) {}\n\n public register() {\n this.app.container.singleton(\"@codenameryuu/adonis-lucid-auto-preload\", () => {\n return { AutoPreload };\n });\n }\n\n public async boot() {}\n\n public async ready() {}\n\n public async shutdown() {}\n}\n"],"mappings":";;;;;;;;AAIA,IAAqB,sBAArB,MAAyC;AAAA,EAGvC,YAAsB,KAAyB;AAAzB;AAAA,EAA0B;AAAA,EAFhD,OAAc,mBAAmB;AAAA,EAI1B,WAAW;AAChB,SAAK,IAAI,UAAU,UAAU,2CAA2C,MAAM;AAC5E,aAAO,EAAE,YAAY;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,OAAO;AAAA,EAAC;AAAA,EAErB,MAAa,QAAQ;AAAA,EAAC;AAAA,EAEtB,MAAa,WAAW;AAAA,EAAC;AAC3B;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}