@warlock.js/core 4.0.131 → 4.0.133

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 (86) hide show
  1. package/esm/cli/commands/create-database.command.d.ts +2 -0
  2. package/esm/cli/commands/create-database.command.d.ts.map +1 -0
  3. package/esm/cli/commands/create-database.command.js +18 -0
  4. package/esm/cli/commands/create-database.command.js.map +1 -0
  5. package/esm/cli/commands/generate/generate.command.d.ts +10 -0
  6. package/esm/cli/commands/generate/generate.command.d.ts.map +1 -0
  7. package/esm/cli/commands/generate/generate.command.js +167 -0
  8. package/esm/cli/commands/generate/generate.command.js.map +1 -0
  9. package/esm/cli/commands/generate/generators/controller.generator.d.ts +3 -0
  10. package/esm/cli/commands/generate/generators/controller.generator.d.ts.map +1 -0
  11. package/esm/cli/commands/generate/generators/controller.generator.js +51 -0
  12. package/esm/cli/commands/generate/generators/controller.generator.js.map +1 -0
  13. package/esm/cli/commands/generate/generators/migration.generator.d.ts +13 -0
  14. package/esm/cli/commands/generate/generators/migration.generator.d.ts.map +1 -0
  15. package/esm/cli/commands/generate/generators/migration.generator.js +42 -0
  16. package/esm/cli/commands/generate/generators/migration.generator.js.map +1 -0
  17. package/esm/cli/commands/generate/generators/model.generator.d.ts +3 -0
  18. package/esm/cli/commands/generate/generators/model.generator.d.ts.map +1 -0
  19. package/esm/cli/commands/generate/generators/model.generator.js +56 -0
  20. package/esm/cli/commands/generate/generators/model.generator.js.map +1 -0
  21. package/esm/cli/commands/generate/generators/module.generator.d.ts +3 -0
  22. package/esm/cli/commands/generate/generators/module.generator.d.ts.map +1 -0
  23. package/esm/cli/commands/generate/generators/module.generator.js +156 -0
  24. package/esm/cli/commands/generate/generators/module.generator.js.map +1 -0
  25. package/esm/cli/commands/generate/generators/repository.generator.d.ts +3 -0
  26. package/esm/cli/commands/generate/generators/repository.generator.d.ts.map +1 -0
  27. package/esm/cli/commands/generate/generators/repository.generator.js +37 -0
  28. package/esm/cli/commands/generate/generators/repository.generator.js.map +1 -0
  29. package/esm/cli/commands/generate/generators/resource.generator.d.ts +3 -0
  30. package/esm/cli/commands/generate/generators/resource.generator.d.ts.map +1 -0
  31. package/esm/cli/commands/generate/generators/resource.generator.js +37 -0
  32. package/esm/cli/commands/generate/generators/resource.generator.js.map +1 -0
  33. package/esm/cli/commands/generate/generators/service.generator.d.ts +3 -0
  34. package/esm/cli/commands/generate/generators/service.generator.d.ts.map +1 -0
  35. package/esm/cli/commands/generate/generators/service.generator.js +37 -0
  36. package/esm/cli/commands/generate/generators/service.generator.js.map +1 -0
  37. package/esm/cli/commands/generate/generators/validation.generator.d.ts +3 -0
  38. package/esm/cli/commands/generate/generators/validation.generator.d.ts.map +1 -0
  39. package/esm/cli/commands/generate/generators/validation.generator.js +46 -0
  40. package/esm/cli/commands/generate/generators/validation.generator.js.map +1 -0
  41. package/esm/cli/commands/generate/templates/stubs.d.ts +111 -0
  42. package/esm/cli/commands/generate/templates/stubs.d.ts.map +1 -0
  43. package/esm/cli/commands/generate/templates/stubs.js +569 -0
  44. package/esm/cli/commands/generate/templates/stubs.js.map +1 -0
  45. package/esm/cli/commands/generate/types.d.ts +53 -0
  46. package/esm/cli/commands/generate/types.d.ts.map +1 -0
  47. package/esm/cli/commands/generate/utils/name-parser.d.ts +45 -0
  48. package/esm/cli/commands/generate/utils/name-parser.d.ts.map +1 -0
  49. package/esm/cli/commands/generate/utils/name-parser.js +76 -0
  50. package/esm/cli/commands/generate/utils/name-parser.js.map +1 -0
  51. package/esm/cli/commands/generate/utils/path-resolver.d.ts +30 -0
  52. package/esm/cli/commands/generate/utils/path-resolver.d.ts.map +1 -0
  53. package/esm/cli/commands/generate/utils/path-resolver.js +42 -0
  54. package/esm/cli/commands/generate/utils/path-resolver.js.map +1 -0
  55. package/esm/cli/commands/generate/utils/prompt.d.ts +13 -0
  56. package/esm/cli/commands/generate/utils/prompt.d.ts.map +1 -0
  57. package/esm/cli/framework-cli-commands.d.ts.map +1 -1
  58. package/esm/cli/framework-cli-commands.js +12 -1
  59. package/esm/cli/framework-cli-commands.js.map +1 -1
  60. package/esm/database/create-database-action.d.ts +3 -0
  61. package/esm/database/create-database-action.d.ts.map +1 -0
  62. package/esm/database/create-database-action.js +28 -0
  63. package/esm/database/create-database-action.js.map +1 -0
  64. package/esm/index.js +1 -1
  65. package/esm/resource/define-resource.d.ts.map +1 -1
  66. package/esm/resource/define-resource.js +6 -2
  67. package/esm/resource/define-resource.js.map +1 -1
  68. package/esm/resource/index.d.ts +1 -0
  69. package/esm/resource/index.d.ts.map +1 -1
  70. package/esm/resource/register-resource.d.ts +21 -0
  71. package/esm/resource/register-resource.d.ts.map +1 -0
  72. package/esm/resource/register-resource.js +23 -0
  73. package/esm/resource/register-resource.js.map +1 -0
  74. package/esm/resource/resource-field-builder.d.ts +22 -1
  75. package/esm/resource/resource-field-builder.d.ts.map +1 -1
  76. package/esm/resource/resource-field-builder.js +71 -14
  77. package/esm/resource/resource-field-builder.js.map +1 -1
  78. package/esm/resource/resource.d.ts +19 -8
  79. package/esm/resource/resource.d.ts.map +1 -1
  80. package/esm/resource/resource.js +59 -40
  81. package/esm/resource/resource.js.map +1 -1
  82. package/esm/resource/types.d.ts +25 -1
  83. package/esm/resource/types.d.ts.map +1 -1
  84. package/esm/router/types.d.ts +6 -0
  85. package/esm/router/types.d.ts.map +1 -1
  86. package/package.json +7 -7
@@ -0,0 +1,3 @@
1
+ import type { CommandActionData } from "../../../types";
2
+ export declare function generateRepository(data: CommandActionData): Promise<void>;
3
+ //# sourceMappingURL=repository.generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.generator.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/generate/generators/repository.generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAUxD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C/E"}
@@ -0,0 +1,37 @@
1
+ import {colors}from'@mongez/copper';import {putFileAsync}from'@mongez/fs';import {repositoryStub}from'../templates/stubs.js';import {parseModulePath,parseName}from'../utils/name-parser.js';import {moduleExists,componentExists,ensureComponentDirectory,resolveComponentPath}from'../utils/path-resolver.js';async function generateRepository(data) {
2
+ const input = data.args[0];
3
+ if (!input) {
4
+ console.log(colors.red("Error: Repository name is required"));
5
+ console.log(colors.yellow("Usage: warlock create.repository <module>/<name>"));
6
+ console.log(colors.yellow("Example: warlock create.repository users/user"));
7
+ process.exit(1);
8
+ }
9
+ const { module, name: componentName } = parseModulePath(input);
10
+ if (!module) {
11
+ console.log(colors.red("Error: Module name is required"));
12
+ console.log(colors.yellow("Usage: warlock create.repository <module>/<name>"));
13
+ process.exit(1);
14
+ }
15
+ // Check if module exists
16
+ if (!(await moduleExists(module))) {
17
+ console.log(colors.red(`Error: Module "${module}" does not exist`));
18
+ console.log(colors.yellow(`Run: warlock create.module ${module}`));
19
+ process.exit(1);
20
+ }
21
+ const name = parseName(componentName, module);
22
+ const force = data.options.force || data.options.f;
23
+ // Check if repository already exists
24
+ if ((await componentExists(module, "repositories", `${name.kebab}.repository`)) && !force) {
25
+ console.log(colors.red(`Error: Repository "${name.kebab}.repository.ts" already exists`));
26
+ console.log(colors.yellow("Use --force to overwrite"));
27
+ process.exit(1);
28
+ }
29
+ // Ensure directories exist
30
+ await ensureComponentDirectory(module, "repositories");
31
+ // Generate repository
32
+ const repositoryPath = resolveComponentPath(module, "repositories", `${name.kebab}.repository`);
33
+ const repositoryContent = repositoryStub(name);
34
+ await putFileAsync(repositoryPath, repositoryContent);
35
+ console.log(colors.green(`✓ Created repository: ${repositoryPath}`));
36
+ console.log(colors.cyan(`\n✨ Repository "${name.pascal}Repository" generated successfully!`));
37
+ }export{generateRepository};//# sourceMappingURL=repository.generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.generator.js","sources":["../../../../../src/cli/commands/generate/generators/repository.generator.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<void>;
3
+ //# sourceMappingURL=resource.generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.generator.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/generate/generators/resource.generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAUxD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C7E"}
@@ -0,0 +1,37 @@
1
+ import {colors}from'@mongez/copper';import {putFileAsync}from'@mongez/fs';import {resourceStub}from'../templates/stubs.js';import {parseModulePath,parseName}from'../utils/name-parser.js';import {moduleExists,componentExists,ensureComponentDirectory,resolveComponentPath}from'../utils/path-resolver.js';async function generateResource(data) {
2
+ const input = data.args[0];
3
+ if (!input) {
4
+ console.log(colors.red("Error: Resource name is required"));
5
+ console.log(colors.yellow("Usage: warlock create.resource <module>/<name>"));
6
+ console.log(colors.yellow("Example: warlock create.resource users/user"));
7
+ process.exit(1);
8
+ }
9
+ const { module, name: componentName } = parseModulePath(input);
10
+ if (!module) {
11
+ console.log(colors.red("Error: Module name is required"));
12
+ console.log(colors.yellow("Usage: warlock create.resource <module>/<name>"));
13
+ process.exit(1);
14
+ }
15
+ // Check if module exists
16
+ if (!(await moduleExists(module))) {
17
+ console.log(colors.red(`Error: Module "${module}" does not exist`));
18
+ console.log(colors.yellow(`Run: warlock create.module ${module}`));
19
+ process.exit(1);
20
+ }
21
+ const name = parseName(componentName, module);
22
+ const force = data.options.force || data.options.f;
23
+ // Check if resource already exists
24
+ if ((await componentExists(module, "resources", `${name.kebab}.resource`)) && !force) {
25
+ console.log(colors.red(`Error: Resource "${name.kebab}.resource.ts" already exists`));
26
+ console.log(colors.yellow("Use --force to overwrite"));
27
+ process.exit(1);
28
+ }
29
+ // Ensure directories exist
30
+ await ensureComponentDirectory(module, "resources");
31
+ // Generate resource
32
+ const resourcePath = resolveComponentPath(module, "resources", `${name.kebab}.resource`);
33
+ const resourceContent = resourceStub(name);
34
+ await putFileAsync(resourcePath, resourceContent);
35
+ console.log(colors.green(`✓ Created resource: ${resourcePath}`));
36
+ console.log(colors.cyan(`\n✨ Resource "${name.pascal}Resource" generated successfully!`));
37
+ }export{generateResource};//# sourceMappingURL=resource.generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.generator.js","sources":["../../../../../src/cli/commands/generate/generators/resource.generator.ts"],"sourcesContent":[null],"names":[],"mappings":"8SAYO,eAAe,gBAAgB,CAAC,IAAuB,EAAA;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAC,CAAC;AAC1E,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,KAAA;AAED,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAE/D,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;AAC7E,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,KAAA;;IAGD,IAAI,EAAE,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE;AACjC,QAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,C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,oBAAA,EAAuB,YAAY,CAAA,CAAE,CAAC,CAAC,CAAC;AAEjE,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAiB,cAAA,EAAA,IAAI,CAAC,MAAM,CAAmC,iCAAA,CAAA,CAAC,CAAC,CAAC;AAC5F"}
@@ -0,0 +1,3 @@
1
+ import type { CommandActionData } from "../../../types";
2
+ export declare function generateService(data: CommandActionData): Promise<void>;
3
+ //# sourceMappingURL=service.generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.generator.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/generate/generators/service.generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAUxD,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C5E"}
@@ -0,0 +1,37 @@
1
+ import {colors}from'@mongez/copper';import {putFileAsync}from'@mongez/fs';import {serviceStub}from'../templates/stubs.js';import {parseModulePath,parseName}from'../utils/name-parser.js';import {moduleExists,componentExists,ensureComponentDirectory,resolveComponentPath}from'../utils/path-resolver.js';async function generateService(data) {
2
+ const input = data.args[0];
3
+ if (!input) {
4
+ console.log(colors.red("Error: Service name is required"));
5
+ console.log(colors.yellow("Usage: warlock create.service <module>/<name>"));
6
+ console.log(colors.yellow("Example: warlock create.service users/create-user"));
7
+ process.exit(1);
8
+ }
9
+ const { module, name: componentName } = parseModulePath(input);
10
+ if (!module) {
11
+ console.log(colors.red("Error: Module name is required"));
12
+ console.log(colors.yellow("Usage: warlock create.service <module>/<name>"));
13
+ process.exit(1);
14
+ }
15
+ // Check if module exists
16
+ if (!(await moduleExists(module))) {
17
+ console.log(colors.red(`Error: Module "${module}" does not exist`));
18
+ console.log(colors.yellow(`Run: warlock create.module ${module}`));
19
+ process.exit(1);
20
+ }
21
+ const name = parseName(componentName, module);
22
+ const force = data.options.force || data.options.f;
23
+ // Check if service already exists
24
+ if ((await componentExists(module, "services", `${name.kebab}.service`)) && !force) {
25
+ console.log(colors.red(`Error: Service "${name.kebab}.service.ts" already exists`));
26
+ console.log(colors.yellow("Use --force to overwrite"));
27
+ process.exit(1);
28
+ }
29
+ // Ensure directories exist
30
+ await ensureComponentDirectory(module, "services");
31
+ // Generate service
32
+ const servicePath = resolveComponentPath(module, "services", `${name.kebab}.service`);
33
+ const serviceContent = serviceStub(name);
34
+ await putFileAsync(servicePath, serviceContent);
35
+ console.log(colors.green(`✓ Created service: ${servicePath}`));
36
+ console.log(colors.cyan(`\n✨ Service "${name.camel}" generated successfully!`));
37
+ }export{generateService};//# sourceMappingURL=service.generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.generator.js","sources":["../../../../../src/cli/commands/generate/generators/service.generator.ts"],"sourcesContent":[null],"names":[],"mappings":"6SAYO,eAAe,eAAe,CAAC,IAAuB,EAAA;IAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,+CAA+C,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,mDAAmD,CAAC,CAAC,CAAC;AAChF,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,KAAA;AAED,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAE/D,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,M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AAI,CAAC,KAAK,CAAA,QAAA,CAAU,CAAC,CAAC;AACtF,IAAA,MAAM,cAAc,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;AAEzC,IAAA,MAAM,YAAY,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAChD,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,mBAAA,EAAsB,WAAW,CAAA,CAAE,CAAC,CAAC,CAAC;AAE/D,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAgB,aAAA,EAAA,IAAI,CAAC,KAAK,CAA2B,yBAAA,CAAA,CAAC,CAAC,CAAC;AAClF"}
@@ -0,0 +1,3 @@
1
+ import type { CommandActionData } from "../../../types";
2
+ export declare function generateValidation(data: CommandActionData): Promise<void>;
3
+ //# sourceMappingURL=validation.generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.generator.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/generate/generators/validation.generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAUxD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0D/E"}
@@ -0,0 +1,46 @@
1
+ import {colors}from'@mongez/copper';import {putFileAsync}from'@mongez/fs';import {validationStub,requestStub}from'../templates/stubs.js';import {parseModulePath,parseName}from'../utils/name-parser.js';import {moduleExists,componentExists,ensureComponentDirectory,resolveComponentPath}from'../utils/path-resolver.js';async function generateValidation(data) {
2
+ const input = data.args[0];
3
+ if (!input) {
4
+ console.log(colors.red("Error: Validation name is required"));
5
+ console.log(colors.yellow("Usage: warlock create.validation <module>/<name>"));
6
+ console.log(colors.yellow("Example: warlock create.validation users/create-user"));
7
+ process.exit(1);
8
+ }
9
+ const { module, name: componentName } = parseModulePath(input);
10
+ if (!module) {
11
+ console.log(colors.red("Error: Module name is required"));
12
+ console.log(colors.yellow("Usage: warlock create.validation <module>/<name>"));
13
+ process.exit(1);
14
+ }
15
+ // Check if module exists
16
+ if (!(await moduleExists(module))) {
17
+ console.log(colors.red(`Error: Module "${module}" does not exist`));
18
+ console.log(colors.yellow(`Run: warlock create.module ${module}`));
19
+ process.exit(1);
20
+ }
21
+ const name = parseName(componentName, module);
22
+ const force = data.options.force || data.options.f;
23
+ const withRequest = data.options.withRequest || data.options.r;
24
+ // Check if validation already exists
25
+ if ((await componentExists(module, "validation", `${name.kebab}.schema`)) && !force) {
26
+ console.log(colors.red(`Error: Validation "${name.kebab}.schema.ts" already exists`));
27
+ console.log(colors.yellow("Use --force to overwrite"));
28
+ process.exit(1);
29
+ }
30
+ // Ensure directories exist
31
+ await ensureComponentDirectory(module, "validation");
32
+ // Generate validation
33
+ const validationPath = resolveComponentPath(module, "validation", `${name.kebab}.schema`);
34
+ const validationContent = validationStub(name);
35
+ await putFileAsync(validationPath, validationContent);
36
+ console.log(colors.green(`✓ Created validation: ${validationPath}`));
37
+ // Generate request if requested
38
+ if (withRequest) {
39
+ await ensureComponentDirectory(module, "requests");
40
+ const requestPath = resolveComponentPath(module, "requests", `${name.kebab}.request`);
41
+ const requestContent = requestStub(name);
42
+ await putFileAsync(requestPath, requestContent);
43
+ console.log(colors.green(`✓ Created request: ${requestPath}`));
44
+ }
45
+ console.log(colors.cyan(`\n✨ Validation "${name.camel}Schema" generated successfully!`));
46
+ }export{generateValidation};//# sourceMappingURL=validation.generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.generator.js","sources":["../../../../../src/cli/commands/generate/generators/validation.generator.ts"],"sourcesContent":[null],"names":[],"mappings":"4TAYO,eAAe,kBAAkB,CAAC,IAAuB,EAAA;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GA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AAC,CAAC;AAChD,QAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,mBAAA,EAAsB,WAAW,CAAA,CAAE,CAAC,CAAC,CAAC;AAChE,KAAA;AAED,IAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAmB,gBAAA,EAAA,IAAI,CAAC,KAAK,CAAiC,+BAAA,CAAA,CAAC,CAAC,CAAC;AAC3F"}
@@ -0,0 +1,111 @@
1
+ import type { ParsedName } from "../types";
2
+ /**
3
+ * Controller template stub
4
+ */
5
+ export declare function controllerStub(name: ParsedName, options?: {
6
+ withValidation?: boolean;
7
+ }): string;
8
+ /**
9
+ * CRUD Create Controller template
10
+ * Note: moduleName is the module (plural), we need singular entity name
11
+ */
12
+ export declare function crudCreateControllerStub(moduleName: ParsedName): string;
13
+ /**
14
+ * CRUD Update Controller template
15
+ */
16
+ export declare function crudUpdateControllerStub(moduleName: ParsedName): string;
17
+ /**
18
+ * CRUD List Controller template
19
+ */
20
+ export declare function crudListControllerStub(moduleName: ParsedName): string;
21
+ /**
22
+ * CRUD Show/Get Controller template
23
+ */
24
+ export declare function crudShowControllerStub(moduleName: ParsedName): string;
25
+ /**
26
+ * CRUD Delete Controller template
27
+ */
28
+ export declare function crudDeleteControllerStub(moduleName: ParsedName): string;
29
+ /**
30
+ * CRUD Routes template
31
+ */
32
+ export declare function crudRoutesStub(moduleName: ParsedName): string;
33
+ /**
34
+ * CRUD Model template
35
+ */
36
+ export declare function crudModelStub(moduleName: ParsedName): string;
37
+ /**
38
+ * CRUD Resource template
39
+ */
40
+ export declare function crudResourceStub(moduleName: ParsedName): string;
41
+ /**
42
+ * CRUD Repository template
43
+ */
44
+ export declare function crudRepositoryStub(moduleName: ParsedName): string;
45
+ /**
46
+ * CRUD Create Service template
47
+ */
48
+ export declare function crudCreateServiceStub(moduleName: ParsedName): string;
49
+ /**
50
+ * CRUD Update Service template
51
+ */
52
+ export declare function crudUpdateServiceStub(moduleName: ParsedName): string;
53
+ /**
54
+ * CRUD List Service template
55
+ */
56
+ export declare function crudListServiceStub(moduleName: ParsedName): string;
57
+ /**
58
+ * CRUD Get Service template
59
+ */
60
+ export declare function crudGetServiceStub(moduleName: ParsedName): string;
61
+ /**
62
+ * CRUD Delete Service template
63
+ */
64
+ export declare function crudDeleteServiceStub(moduleName: ParsedName): string;
65
+ /**
66
+ * CRUD Seed template
67
+ */
68
+ export declare function crudSeedStub(moduleName: ParsedName): string;
69
+ /**
70
+ * Migration template
71
+ */
72
+ export declare function migrationStub(entityName: ParsedName): string;
73
+ /**
74
+ * CRUD Create Validation template
75
+ */
76
+ export declare function crudCreateValidationStub(moduleName: ParsedName): string;
77
+ /**
78
+ * CRUD Update Validation template
79
+ */
80
+ export declare function crudUpdateValidationStub(moduleName: ParsedName): string;
81
+ /**
82
+ * Service template stub
83
+ */
84
+ export declare function serviceStub(name: ParsedName): string;
85
+ /**
86
+ * Validation schema template stub
87
+ */
88
+ export declare function validationStub(name: ParsedName): string;
89
+ /**
90
+ * Request type template stub
91
+ */
92
+ export declare function requestStub(name: ParsedName): string;
93
+ /**
94
+ * Model template stub
95
+ */
96
+ export declare function modelStub(name: ParsedName, options?: {
97
+ tableName?: string;
98
+ withResource?: boolean;
99
+ }): string;
100
+ /**
101
+ * Repository template stub
102
+ */
103
+ export declare function repositoryStub(name: ParsedName): string;
104
+ /**
105
+ * Resource template stub
106
+ */
107
+ export declare function resourceStub(name: ParsedName): string;
108
+ /**
109
+ * Migration template stub
110
+ */
111
+ //# sourceMappingURL=stubs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/generate/templates/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE;IAAE,cAAc,CAA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