stackkit 0.2.8 → 0.2.9
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/README.md +4 -0
- package/dist/lib/fs/files.js +1 -1
- package/dist/lib/generation/code-generator.d.ts +2 -7
- package/dist/lib/generation/code-generator.js +120 -56
- package/dist/lib/utils/fs-helpers.d.ts +1 -1
- package/modules/auth/authjs/generator.json +16 -16
- package/modules/auth/better-auth/files/express/middlewares/authorize.ts +121 -41
- package/modules/auth/better-auth/files/express/modules/auth/auth.controller.ts +257 -0
- package/modules/auth/better-auth/files/express/modules/auth/auth.interface.ts +23 -0
- package/modules/auth/better-auth/files/express/modules/auth/auth.route.ts +22 -0
- package/modules/auth/better-auth/files/express/modules/auth/auth.service.ts +403 -0
- package/modules/auth/better-auth/files/express/templates/google-redirect.ejs +91 -0
- package/modules/auth/better-auth/files/express/templates/otp.ejs +87 -0
- package/modules/auth/better-auth/files/express/types/express.d.ts +6 -8
- package/modules/auth/better-auth/files/express/utils/cookie.ts +19 -0
- package/modules/auth/better-auth/files/express/utils/jwt.ts +34 -0
- package/modules/auth/better-auth/files/express/utils/token.ts +66 -0
- package/modules/auth/better-auth/files/nextjs/api/auth/[...all]/route.ts +1 -1
- package/modules/auth/better-auth/files/nextjs/lib/auth/auth-guards.ts +11 -1
- package/modules/auth/better-auth/files/nextjs/templates/email-otp.tsx +74 -0
- package/modules/auth/better-auth/files/shared/config/env.ts +113 -0
- package/modules/auth/better-auth/files/shared/lib/auth-client.ts +1 -1
- package/modules/auth/better-auth/files/shared/lib/auth.ts +151 -62
- package/modules/auth/better-auth/files/shared/prisma/schema.prisma +22 -11
- package/modules/auth/better-auth/files/shared/utils/email.ts +71 -0
- package/modules/auth/better-auth/generator.json +159 -81
- package/modules/database/mongoose/generator.json +18 -18
- package/modules/database/prisma/generator.json +44 -44
- package/package.json +1 -1
- package/templates/express/env.example +2 -2
- package/templates/express/eslint.config.mjs +7 -0
- package/templates/express/node_modules/.bin/acorn +17 -0
- package/templates/express/node_modules/.bin/eslint +17 -0
- package/templates/express/node_modules/.bin/tsc +17 -0
- package/templates/express/node_modules/.bin/tsserver +17 -0
- package/templates/express/node_modules/.bin/tsx +17 -0
- package/templates/express/package.json +12 -6
- package/templates/express/src/app.ts +15 -7
- package/templates/express/src/config/cors.ts +8 -7
- package/templates/express/src/config/env.ts +26 -5
- package/templates/express/src/config/logger.ts +2 -2
- package/templates/express/src/config/rate-limit.ts +2 -2
- package/templates/express/src/modules/health/health.controller.ts +13 -11
- package/templates/express/src/routes/index.ts +1 -6
- package/templates/express/src/server.ts +12 -12
- package/templates/express/src/shared/errors/app-error.ts +16 -0
- package/templates/express/src/shared/middlewares/error.middleware.ts +154 -12
- package/templates/express/src/shared/middlewares/not-found.middleware.ts +2 -1
- package/templates/express/src/shared/utils/catch-async.ts +11 -0
- package/templates/express/src/shared/utils/pagination.ts +6 -1
- package/templates/express/src/shared/utils/send-response.ts +25 -0
- package/templates/nextjs/lib/env.ts +19 -8
- package/modules/auth/better-auth/files/shared/lib/email/email-service.ts +0 -33
- package/modules/auth/better-auth/files/shared/lib/email/email-templates.ts +0 -89
- package/templates/express/eslint.config.cjs +0 -42
- package/templates/express/src/config/helmet.ts +0 -5
- package/templates/express/src/modules/health/health.service.ts +0 -6
- package/templates/express/src/shared/errors/error-codes.ts +0 -9
- package/templates/express/src/shared/logger/logger.ts +0 -20
- package/templates/express/src/shared/utils/async-handler.ts +0 -9
- package/templates/express/src/shared/utils/response.ts +0 -9
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module.exports = [
|
|
2
|
-
// Global ignores
|
|
3
|
-
{
|
|
4
|
-
ignores: ['**/node_modules/**', '**/dist/**', '.env'],
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
// TypeScript files
|
|
8
|
-
{
|
|
9
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
10
|
-
languageOptions: {
|
|
11
|
-
parser: require('@typescript-eslint/parser'),
|
|
12
|
-
parserOptions: {
|
|
13
|
-
project: './tsconfig.json',
|
|
14
|
-
ecmaVersion: 'latest',
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
plugins: {
|
|
19
|
-
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
'prefer-const': 'error',
|
|
23
|
-
'no-console': 'off',
|
|
24
|
-
eqeqeq: ['error', 'always'],
|
|
25
|
-
curly: ['error', 'multi-line'],
|
|
26
|
-
'no-implicit-coercion': ['warn', { allow: ['!!'] }],
|
|
27
|
-
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^(?:_|next)$' }],
|
|
28
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
29
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
// JavaScript files
|
|
34
|
-
{
|
|
35
|
-
files: ['**/*.js'],
|
|
36
|
-
languageOptions: {
|
|
37
|
-
ecmaVersion: 'latest',
|
|
38
|
-
sourceType: 'module',
|
|
39
|
-
},
|
|
40
|
-
rules: {},
|
|
41
|
-
},
|
|
42
|
-
];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function ts() {
|
|
2
|
-
return new Date().toISOString();
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export const info = (msg: string, meta?: any) => {
|
|
6
|
-
console.log(`${ts()} INFO: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
|
|
7
|
-
};
|
|
8
|
-
export const warn = (msg: string, meta?: any) => {
|
|
9
|
-
console.warn(`${ts()} WARN: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
|
|
10
|
-
};
|
|
11
|
-
export const error = (msg: string, meta?: any) => {
|
|
12
|
-
console.error(`${ts()} ERROR: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
|
|
13
|
-
};
|
|
14
|
-
export const debug = (msg: string, meta?: any) => {
|
|
15
|
-
if (process.env.NODE_ENV !== "production") {
|
|
16
|
-
console.debug(`${ts()} DEBUG: ${msg}` + (meta ? ` ${JSON.stringify(meta)}` : ""));
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default { info, warn, error, debug };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from "express";
|
|
2
|
-
|
|
3
|
-
export default function asyncHandler(
|
|
4
|
-
fn: (req: Request, res: Response, next: NextFunction) => Promise<any>,
|
|
5
|
-
) {
|
|
6
|
-
return (req: Request, res: Response, next: NextFunction) => {
|
|
7
|
-
fn(req, res, next).catch(next);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Response } from "express";
|
|
2
|
-
|
|
3
|
-
export function success(res: Response, data: any, message = "Success", meta?: any) {
|
|
4
|
-
return res.json({ success: true, message, data, meta });
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function fail(res: Response, status = 500, message = "Error", details?: any) {
|
|
8
|
-
return res.status(status).json({ success: false, message, details });
|
|
9
|
-
}
|