@nest-arch/tui 0.4.5 → 0.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 (46) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/constants-DX5wiqrq.js +1 -0
  3. package/dist/index.js +158 -145
  4. package/dist/templates/addons/husky/noop-hook.hbs +2 -0
  5. package/dist/templates/addons/husky/pre-commit.hbs +1 -1
  6. package/dist/templates/base/.env.example.hbs +16 -2
  7. package/dist/templates/base/.env.hbs +16 -2
  8. package/dist/templates/base/README.md.hbs +23 -2
  9. package/dist/templates/base/pnpm-workspace.yaml.hbs +9 -4
  10. package/dist/templates/base/prisma.config.ts.hbs +6 -0
  11. package/dist/templates/base/src/app.module.ts.hbs +6 -22
  12. package/dist/templates/base/src/database/adapters/interfaces/db-adapter.interface.ts.hbs +1 -1
  13. package/dist/templates/base/src/database/adapters/mongo/raw-mongo.adapter.ts.hbs +4 -2
  14. package/dist/templates/base/src/database/db.module.ts.hbs +30 -3
  15. package/dist/templates/base/src/database/db.service.ts.hbs +11 -8
  16. package/dist/templates/base/src/database/entities/todo.entity.ts.hbs +2 -2
  17. package/dist/templates/base/src/database/index.ts.hbs +2 -0
  18. package/dist/templates/base/src/database/orm/drizzle/schema.ts.hbs +48 -12
  19. package/dist/templates/base/src/database/orm/typeorm/data-source.ts.hbs +26 -10
  20. package/dist/templates/base/src/libs/middlewares/graphql-throttler.guard.ts.hbs +22 -0
  21. package/dist/templates/base/src/libs/trpc/inner.context.ts.hbs +2 -2
  22. package/dist/templates/base/src/main.ts.hbs +7 -6
  23. package/dist/templates/base/test/app.e2e-spec.ts.hbs +374 -198
  24. package/dist/templates/base/test/bootstrap.e2e-spec.ts.hbs +2 -2
  25. package/dist/templates/extras/docker/Dockerfile.hbs +8 -1
  26. package/dist/templates/extras/health/src/health/health.controller.ts.hbs +7 -1
  27. package/dist/templates/extras/swagger/create-docs.ts.hbs +6 -1
  28. package/dist/templates/feature/graphql/src/graphql/models/todo.model.ts.hbs +1 -1
  29. package/dist/templates/feature/graphql/src/graphql/resolvers/todo.resolver.ts.hbs +1 -1
  30. package/dist/templates/feature/rest/todo-example/src/api/todo/todo.controller.ts.hbs +80 -7
  31. package/dist/templates/feature/rest/todo-example/src/api/todo/todo.service.ts.hbs +181 -25
  32. package/dist/templates/monorepo/apps/api-gateway/src/main.ts.hbs +10 -9
  33. package/dist/templates/monorepo/root/README.md.hbs +8 -13
  34. package/dist/templates/single-project/architecture/nest-api/.env.hbs +15 -2
  35. package/dist/templates/single-project/architecture/nest-api/pnpm-workspace.yaml.hbs +6 -0
  36. package/dist/templates/single-project/architecture/nest-api/src/main.ts.hbs +10 -9
  37. package/dist/templates/single-project/architecture/nest-gateway/src/main.ts.hbs +10 -9
  38. package/dist/templates/single-project/architecture/nest-microservice/.env.hbs +6 -0
  39. package/dist/templates/single-project/architecture/nest-microservice/src/app.controller.ts.hbs +2 -2
  40. package/dist/templates/single-project/architecture/nest-microservice/src/app.module.ts.hbs +28 -1
  41. package/dist/templates/single-project/architecture/nest-microservice/src/http-throttler.guard.ts.hbs +13 -0
  42. package/dist/templates/single-project/architecture/nest-microservice/src/main.ts.hbs +10 -9
  43. package/dist/templates/single-project/architecture/nest-microservice/test/microservice.e2e-spec.ts.hbs +35 -0
  44. package/dist/templates/single-project/shared/config/env.ts.hbs +9 -0
  45. package/package.json +5 -5
  46. package/dist/constants-BbC7KTI7.js +0 -1
@@ -1,10 +1,10 @@
1
1
  import { ContextOptions } from "nestjs-trpc";
2
- {{#if (eq auth "better-auth")}}
2
+ {{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
3
3
  import type { UserSession } from "../../auth/auth.js";
4
4
  {{else if (eq auth "passport")}}
5
5
  import type { AuthService } from "../../auth/auth.service.js";
6
6
  {{/if}}
7
7
 
8
8
  export type InnerContext = {
9
- session?: {{#if (eq auth "better-auth")}}UserSession{{else if (eq auth "passport")}}{ user: NonNullable<Awaited<ReturnType<AuthService[{{#if (and usePrisma (not hasMongodb))}}"validate"{{else}}"validateUser"{{/if}}]>>> }{{else}}unknown{{/if}};
9
+ session?: {{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}UserSession{{else if (eq auth "passport")}}{ user: NonNullable<Awaited<ReturnType<AuthService[{{#if (and usePrisma (not hasMongodb))}}"validate"{{else}}"validateUser"{{/if}}]>>> }{{else}}unknown{{/if}};
10
10
  } & ContextOptions;
@@ -61,7 +61,6 @@ async function bootstrap() {
61
61
  apiReference({
62
62
  content: await createDocs(app, {
63
63
  description: "{{description}}",
64
- title: "{{projectNamePascalCase}} API",
65
64
  integrations: {
66
65
  {{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless") hasBetterAuthWithoutRest)}}
67
66
  betterAuth: {
@@ -71,25 +70,25 @@ async function bootstrap() {
71
70
  {{/if}}
72
71
  {{#if (includes apis "trpc")}}
73
72
  trpc: {
74
- routerFilePath: "./src/libs/trpc/@generated/server.ts",
75
73
  pathPrefix: "/trpc",
74
+ routerFilePath: "./{{trpcGeneratePath}}/server.ts",
76
75
  },
77
76
  {{/if}}
78
77
  zod: {
79
78
  withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
80
79
  },
81
80
  },
81
+ title: "{{projectNamePascalCase}} API",
82
82
  version: "1.0.0",
83
83
  }),
84
+ {{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
84
85
  pageTitle: "{{projectNamePascalCase}} API Docs",
85
86
  theme: "default",
86
87
  }),
87
88
  );
88
89
  {{else}}
89
90
  const document = await createDocs(app, {
90
- title: "{{projectNamePascalCase}} API",
91
91
  description: "{{description}}",
92
- version: "1.0.0",
93
92
  integrations: {
94
93
  {{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless") hasBetterAuthWithoutRest)}}
95
94
  betterAuth: {
@@ -99,20 +98,22 @@ async function bootstrap() {
99
98
  {{/if}}
100
99
  {{#if (includes apis "trpc")}}
101
100
  trpc: {
102
- routerFilePath: "./src/trpc/router.ts",
103
101
  pathPrefix: "/trpc",
102
+ routerFilePath: "./{{trpcGeneratePath}}/server.ts",
104
103
  },
105
104
  {{/if}}
106
105
  zod: {
107
106
  withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
108
107
  },
109
108
  },
109
+ title: "{{projectNamePascalCase}} API",
110
+ version: "1.0.0",
110
111
  });
111
112
  SwaggerModule.setup(docsPath, app, document);
112
113
  {{/if}}
113
114
  Logger.log(`Swagger documentation available at http://localhost:${env.PORT}${docsPath}`, "SwaggerDocs");
114
115
  {{/if}}
115
- await app.listen(env.PORT);
116
+ await app.listen(env.PORT, "0.0.0.0");
116
117
  {{#if hasRest}}
117
118
  Logger.log(`Started backend server on http://localhost:${env.PORT}/api`, "Main");
118
119
  {{else if hasTrpc}}