arkos 1.4.0-canary.0 → 1.4.0-canary.1

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 (47) hide show
  1. package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
  2. package/dist/cjs/modules/base/base.controller.js +2 -2
  3. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  4. package/dist/cjs/modules/debugger/debugger.service.js +13 -7
  5. package/dist/cjs/modules/debugger/debugger.service.js.map +1 -1
  6. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +1 -1
  7. package/dist/cjs/types/arkos-config.js.map +1 -1
  8. package/dist/cjs/utils/cli/generate.js +1 -1
  9. package/dist/cjs/utils/cli/generate.js.map +1 -1
  10. package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
  11. package/dist/cjs/utils/cli/utils/template-generator/templates/hooks-template.js +1 -1
  12. package/dist/cjs/utils/cli/utils/template-generator/templates/hooks-template.js.map +1 -1
  13. package/dist/cjs/utils/dynamic-loader.js +24 -21
  14. package/dist/cjs/utils/dynamic-loader.js.map +1 -1
  15. package/dist/cjs/utils/helpers/prisma.helpers.js +1 -5
  16. package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
  17. package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +24 -10
  18. package/dist/cjs/utils/prisma/prisma-json-schema-generator.js.map +1 -1
  19. package/dist/cjs/utils/prisma/prisma-schema-parser.js +11 -5
  20. package/dist/cjs/utils/prisma/prisma-schema-parser.js.map +1 -1
  21. package/dist/cjs/utils/prisma/types.js.map +1 -1
  22. package/dist/esm/modules/auth/auth.controller.js.map +1 -1
  23. package/dist/esm/modules/base/base.controller.js +2 -2
  24. package/dist/esm/modules/base/base.controller.js.map +1 -1
  25. package/dist/esm/modules/debugger/debugger.service.js +9 -3
  26. package/dist/esm/modules/debugger/debugger.service.js.map +1 -1
  27. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +2 -2
  28. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +1 -1
  29. package/dist/esm/types/arkos-config.js.map +1 -1
  30. package/dist/esm/utils/cli/generate.js +1 -1
  31. package/dist/esm/utils/cli/generate.js.map +1 -1
  32. package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
  33. package/dist/esm/utils/cli/utils/template-generator/templates/hooks-template.js +1 -1
  34. package/dist/esm/utils/cli/utils/template-generator/templates/hooks-template.js.map +1 -1
  35. package/dist/esm/utils/dynamic-loader.js +24 -21
  36. package/dist/esm/utils/dynamic-loader.js.map +1 -1
  37. package/dist/esm/utils/helpers/prisma.helpers.js +1 -5
  38. package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -1
  39. package/dist/esm/utils/prisma/prisma-json-schema-generator.js +24 -10
  40. package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -1
  41. package/dist/esm/utils/prisma/prisma-schema-parser.js +11 -5
  42. package/dist/esm/utils/prisma/prisma-schema-parser.js.map +1 -1
  43. package/dist/esm/utils/prisma/types.js.map +1 -1
  44. package/dist/types/types/arkos-config.d.ts +1 -1
  45. package/dist/types/utils/dynamic-loader.d.ts +1 -1
  46. package/dist/types/utils/prisma/types.d.ts +2 -1
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;AAAA,qFAA4D;AAC5D,iFAAwD;AAGxD,kEAAyC;AACzC,uDAAmD;AAEnD,sEAA6C;AAC7C,yCAA8C;AAC9C,qFAMiD;AACjD,+FAAqE;AAKxD,QAAA,yBAAyB,GAAG;IACvC,QAAQ,EAAE,KAAK;CAChB,CAAC;AAQK,MAAM,qBAAqB,GAAG,KAAK,EAAE,eAAoB,EAAE,EAAE,EAAE;IACpE,MAAM,WAAW,GAAG,IAAI,0BAAW,CAAC,MAAM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AAC,UAAU,EAAE,EAAE;gBACnB,IAAI,WAAW,EAAE,cAAc,EAAE,IAAI,KAAK,SAAS;oBACjD,OAAQ,UAAkB,EAAE,KAAK,CAAC;gBACpC,OAAO,UAAU,CAAC;YACpB,CAAC,CAAC,CAAC;YAEL,IAAI,CAAC,WAAW;gBACd,MAAM,IAAI,mBAAQ,CAChB,qCAAqC,YAAY,EAAE,EACnD,GAAG,CACJ,CAAC;YAEJ,GAAG,CAAC,IAAI,CAAC;gBACP,KAAK,EAAE,WAAW,CAAC,MAAM;gBACzB,OAAO,EAAE,WAAW,CAAC,MAAM;gBAC3B,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;QACL,CAAC,CACF;KACF,CAAC;AACJ,CAAC,CAAC;AAtaW,QAAA,qBAAqB,yBAsahC","sourcesContent":["import catchAsync from \"../error-handler/utils/catch-async\";\nimport AppError from \"../error-handler/utils/app-error\";\nimport { CookieOptions } from \"express\";\nimport { ArkosRequest, ArkosResponse, ArkosNextFunction } from \"../../types\";\nimport authService from \"./auth.service\";\nimport { BaseService } from \"../base/base.service\";\nimport { User } from \"../../types\";\nimport arkosEnv from \"../../utils/arkos-env\";\nimport { getArkosConfig } from \"../../server\";\nimport {\n createPrismaWhereClause,\n determineUsernameField,\n getNestedValue,\n MsDuration,\n toMs,\n} from \"./utils/helpers/auth.controller.helpers\";\nimport authActionService from \"./utils/services/auth-action.service\";\n\n/**\n * Default fields to exclude from user object when returning to client\n */\nexport const defaultExcludedUserFields = {\n password: false,\n};\n\n/**\n * Factory function to create authentication controller with configurable interceptors\n *\n * @param interceptors - Optional middleware functions to execute after controller actions\n * @returns An object containing all authentication controller methods\n */\nexport const authControllerFactory = async (interceptors: any = {}) => {\n const userService = new BaseService(\"user\");\n\n return {\n /**\n * Retrieves the current authenticated user's information\n */\n getMe: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const user = (await userService.findOne(\n { id: req.user!.id },\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n if (user) delete user[key as keyof User];\n });\n\n if (interceptors?.afterGetMe) {\n req.responseData = { data: user };\n res.locals.data = { data: user };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data: user });\n }\n ),\n\n /**\n * Updates the current authenticated user's information\n */\n updateMe: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n if (\"password\" in req.body)\n throw new AppError(\n \"In order to update password use the update-password endpoint.\",\n 400,\n {},\n \"InvalidFieldPassword\"\n );\n\n const user = (await userService.updateOne(\n { id: req.user!.id },\n req.body,\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n if (user) delete user[key as keyof User];\n });\n\n if (interceptors?.afterUpdateMe) {\n req.responseData = { data: user };\n res.locals.data = { data: user };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data: user });\n }\n ),\n\n /**\n * Logs out the current user by invalidating their access token cookie\n */\n logout: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n res.cookie(\"arkos_access_token\", \"no-token\", {\n expires: new Date(Date.now() + 10 * 1000),\n httpOnly: true,\n });\n\n if (interceptors?.afterLogout) {\n req.responseData = null;\n res.locals.data = null;\n req.responseStatus = 204;\n res.locals.status = 204;\n return next();\n }\n\n res.status(204).json();\n }\n ),\n\n /**\n * Authenticates a user using configurable username field and password\n * Username field can be specified in query parameter or config\n *\n * Supports nested fields and array queries (e.g., \"profile.nickname\", \"phones.some.number\")\n */\n login: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const authConfigs = getArkosConfig()?.authentication;\n\n const usernameField = determineUsernameField(req);\n\n // For the error message, we only care about the top-level field name\n const lastField =\n usernameField.split(\".\")[usernameField.split(\".\").length - 1];\n\n const usernameValue = req.body[lastField];\n\n const { password } = req.body;\n\n if (!usernameValue || !password)\n return next(\n new AppError(`Please provide both ${lastField} and password`, 400)\n );\n\n // Create appropriate where clause for the query\n let whereClause: Record<string, any>;\n\n if (usernameField?.includes?.(\".\")) {\n // For nested paths, we need to extract the actual value to search for\n const valueToFind = getNestedValue(req.body, usernameField);\n if (valueToFind === undefined) {\n return next(new AppError(`Invalid ${usernameField} provided`, 400));\n }\n whereClause = createPrismaWhereClause(usernameField, valueToFind);\n } else {\n // Simple field case\n whereClause = { [usernameField]: usernameValue };\n }\n\n // Use findFirst instead of findUnique for complex queries\n const user = (await userService.findOne(\n whereClause,\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n if (\n !user ||\n !(await authService.isCorrectPassword(password, user.password))\n ) {\n return next(new AppError(`Incorrect ${lastField} or password`, 401));\n }\n\n const token = authService.signJwtToken(user.id!);\n\n const cookieOptions: CookieOptions = {\n expires: new Date(\n Date.now() +\n Number(\n toMs(\n authConfigs?.jwt?.expiresIn ||\n (process.env.JWT_EXPIRES_IN as MsDuration) ||\n (arkosEnv.JWT_EXPIRES_IN as MsDuration)\n )\n )\n ),\n httpOnly:\n authConfigs?.jwt?.cookie?.httpOnly ||\n process.env.JWT_COOKIE_HTTP_ONLY === \"true\" ||\n true,\n secure:\n authConfigs?.jwt?.cookie?.secure ||\n process.env.JWT_COOKIE_SECURE === \"true\" ||\n req.secure ||\n req.headers[\"x-forwarded-proto\"] === \"https\",\n sameSite:\n authConfigs?.jwt?.cookie?.sameSite ||\n (process.env.JWT_COOKIE_SAME_SITE as\n | \"none\"\n | \"lax\"\n | \"strict\"\n | undefined) ||\n (process.env.NODE_ENV === \"production\" ? \"none\" : \"lax\"),\n };\n\n if (\n authConfigs?.login?.sendAccessTokenThrough === \"response-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n ) {\n req.responseData = { accessToken: token };\n res.locals.data = { accessToken: token };\n }\n\n if (\n authConfigs?.login?.sendAccessTokenThrough === \"cookie-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n )\n res.cookie(\"arkos_access_token\", token, cookieOptions);\n\n req.accessToken = token;\n\n if (interceptors?.afterLogin) {\n req.additionalData = { user };\n res.locals.additional = { user };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n if (\n authConfigs?.login?.sendAccessTokenThrough === \"response-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n ) {\n res.status(200).json(req.responseData);\n } else if (\n authConfigs?.login?.sendAccessTokenThrough === \"cookie-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n )\n res.status(200).send();\n }\n ),\n\n /**\n * Creates a new user account using the userService\n */\n signup: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const user = (await userService.createOne(\n req.body,\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n if (interceptors?.afterSignup) {\n req.responseData = { data: user };\n res.locals.data = { data: user };\n req.responseStatus = 201;\n res.locals.status = 201;\n return next();\n }\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n delete user[key as keyof User];\n });\n\n res.status(201).json({ data: user });\n }\n ),\n /**\n * Marks user account as self-deleted by setting deletedSelfAccountAt timestamp\n */\n deleteMe: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const userId = req.user!.id; // Assuming the authenticated user's ID is available in req.user\n\n const updatedUser = (await userService.updateOne(\n { id: userId },\n {\n deletedSelfAccountAt: new Date().toISOString(),\n },\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n if (interceptors?.afterDeleteMe) {\n req.responseData = { data: updatedUser };\n res.locals.data = { data: updatedUser };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n delete updatedUser[key as keyof User];\n });\n\n res.status(200).json({\n message: \"Account deleted successfully\",\n });\n }\n ),\n\n /**\n * Updates the password of the authenticated user\n */\n updatePassword: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const { currentPassword, newPassword } = req.body;\n\n if (!currentPassword || !newPassword)\n return next(\n new AppError(\"currentPassword and newPassword are required\", 400)\n );\n\n const user = req.user;\n\n if (!user || user?.isActive === false || user?.deletedSelfAccountAt)\n return next(new AppError(\"User not found!\", 404));\n\n // Check if the current password is correct\n const isPasswordCorrect = await authService.isCorrectPassword(\n String(currentPassword),\n String(user.password)\n );\n\n const configs = getArkosConfig();\n const initAuthConfigs = configs?.authentication;\n\n if (!isPasswordCorrect)\n return next(new AppError(\"Current password is incorrect.\", 400));\n\n // Check password strength (optional but recommended)\n if (\n !authService.isPasswordStrong(String(newPassword)) &&\n !configs?.validation\n ) {\n return next(\n new AppError(\n initAuthConfigs?.passwordValidation?.message ||\n \"The new password must contain at least one uppercase letter, one lowercase letter, and one number\",\n 400\n )\n );\n }\n\n // Update the password\n await userService.updateOne(\n { id: user.id },\n {\n password: await authService.hashPassword(newPassword),\n passwordChangedAt: new Date(Date.now()),\n }\n );\n\n if (interceptors?.afterUpdatePassword) {\n req.additionalData = {\n user,\n };\n req.responseData = {\n status: \"success\",\n message: \"Password updated successfully!\",\n };\n res.locals.data = {\n status: \"success\",\n message: \"Password updated successfully!\",\n };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({\n status: \"success\",\n message: \"Password updated successfully!\",\n });\n }\n ),\n\n findManyAuthAction: catchAsync(\n async (_: ArkosRequest, res: ArkosResponse) => {\n const arkosConfig = getArkosConfig();\n const authActions = authActionService.getAll()?.map((authAction) => {\n if (arkosConfig?.authentication?.mode === \"dynamic\")\n delete (authAction as any)?.roles;\n return authAction;\n });\n\n res.json({\n total: authActions.length,\n results: authActions.length,\n data: authActions,\n });\n }\n ),\n\n findOneAuthAction: catchAsync(\n async (req: ArkosRequest, res: ArkosResponse) => {\n const arkosConfig = getArkosConfig();\n const resourceName = req.params?.resourceName;\n\n if (!resourceName)\n throw new AppError(`Please provide a resoureName`, 400);\n\n const authActions = authActionService\n .getByResource(req.params?.resourceName)\n ?.map((authAction) => {\n if (arkosConfig?.authentication?.mode === \"dynamic\")\n delete (authAction as any)?.roles;\n return authAction;\n });\n\n if (!authActions)\n throw new AppError(\n `No auth action with resource name ${resourceName}`,\n 404\n );\n\n res.json({\n total: authActions.length,\n results: authActions.length,\n data: authActions,\n });\n }\n ),\n };\n};\n"]}
1
+ {"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../../../src/modules/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;AAAA,qFAA4D;AAC5D,iFAAwD;AAGxD,kEAAyC;AACzC,uDAAmD;AAEnD,sEAA6C;AAC7C,yCAA8C;AAC9C,qFAMiD;AACjD,+FAAqE;AAKxD,QAAA,yBAAyB,GAAG;IACvC,QAAQ,EAAE,KAAK;CAChB,CAAC;AAQK,MAAM,qBAAqB,GAAG,KAAK,EAAE,eAAoB,EAAE,EAAE,EAAE;IACpE,MAAM,WAAW,GAAG,IAAI,0BAAW,CAAC,MAAM,CAAC,CAAC;IAE5C,OAAO;QAIL,KAAK,EAAE,IAAA,qBAAU,EACf,KAAK,EACH,GAAiB,EACjB,GAAkB,EAClB,IAAuB,EACvB,EAAE;YACF,MAAM,IAAI,GAAG,CAAC,MAAM,WAAW,CAAC,OAAO,CACrC,EAAE,EAAE,EAAE,GAAG,CAAC,IAAK,CAAC,EAAE,EAAE,EACpB,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAC7B,CAAwB,CAAC;YAE1B,MAAM,CAAC,IAAI,CAAC,iCAAyB,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACrD,IA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AAE,WAAW;aAClB,CAAC,CAAC;QACL,CAAC,CACF;KACF,CAAC;AACJ,CAAC,CAAC;AAtaW,QAAA,qBAAqB,yBAsahC","sourcesContent":["import catchAsync from \"../error-handler/utils/catch-async\";\nimport AppError from \"../error-handler/utils/app-error\";\nimport { CookieOptions } from \"express\";\nimport { ArkosRequest, ArkosResponse, ArkosNextFunction } from \"../../types\";\nimport authService from \"./auth.service\";\nimport { BaseService } from \"../base/base.service\";\nimport { User } from \"../../types\";\nimport arkosEnv from \"../../utils/arkos-env\";\nimport { getArkosConfig } from \"../../server\";\nimport {\n createPrismaWhereClause,\n determineUsernameField,\n getNestedValue,\n MsDuration,\n toMs,\n} from \"./utils/helpers/auth.controller.helpers\";\nimport authActionService from \"./utils/services/auth-action.service\";\n\n/**\n * Default fields to exclude from user object when returning to client\n */\nexport const defaultExcludedUserFields = {\n password: false,\n};\n\n/**\n * Factory function to create authentication controller with configurable interceptors\n *\n * @param interceptors - Optional middleware functions to execute after controller actions\n * @returns An object containing all authentication controller methods\n */\nexport const authControllerFactory = async (interceptors: any = {}) => {\n const userService = new BaseService(\"user\");\n\n return {\n /**\n * Retrieves the current authenticated user's information\n */\n getMe: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const user = (await userService.findOne(\n { id: req.user!.id },\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n if (user) delete user[key as keyof User];\n });\n\n if (interceptors?.afterGetMe) {\n req.responseData = { data: user };\n res.locals.data = { data: user };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data: user });\n }\n ),\n\n /**\n * Updates the current authenticated user's information\n */\n updateMe: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n if (\"password\" in req.body)\n throw new AppError(\n \"In order to update password use the update-password endpoint.\",\n 400,\n {},\n \"InvalidFieldPassword\"\n );\n\n const user = (await userService.updateOne(\n { id: req.user!.id },\n req.body,\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n if (user) delete user[key as keyof User];\n });\n\n if (interceptors?.afterUpdateMe) {\n req.responseData = { data: user };\n res.locals.data = { data: user };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data: user });\n }\n ),\n\n /**\n * Logs out the current user by invalidating their access token cookie\n */\n logout: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n res.cookie(\"arkos_access_token\", \"no-token\", {\n expires: new Date(Date.now() + 10 * 1000),\n httpOnly: true,\n });\n\n if (interceptors?.afterLogout) {\n req.responseData = null;\n res.locals.data = null;\n req.responseStatus = 204;\n res.locals.status = 204;\n return next();\n }\n\n res.status(204).json();\n }\n ),\n\n /**\n * Authenticates a user using configurable username field and password\n * Username field can be specified in query parameter or config\n *\n * Supports nested fields and array queries (e.g., \"profile.nickname\", \"phones.some.number\")\n */\n login: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const authConfigs = getArkosConfig()?.authentication;\n\n const usernameField = determineUsernameField(req);\n\n // For the error message, we only care about the top-level field name\n const lastField =\n usernameField.split(\".\")[usernameField.split(\".\").length - 1];\n\n const usernameValue = req.body[lastField];\n\n const { password } = req.body;\n\n if (!usernameValue || !password)\n return next(\n new AppError(`Please provide both ${lastField} and password`, 400)\n );\n\n // Create appropriate where clause for the query\n let whereClause: Record<string, any>;\n\n if (usernameField?.includes?.(\".\")) {\n // For nested paths, we need to extract the actual value to search for\n const valueToFind = getNestedValue(req.body, usernameField);\n if (valueToFind === undefined) {\n return next(new AppError(`Invalid ${usernameField} provided`, 400));\n }\n whereClause = createPrismaWhereClause(usernameField, valueToFind);\n } else {\n // Simple field case\n whereClause = { [usernameField]: usernameValue };\n }\n\n // Use findFirst instead of findUnique for complex queries\n const user = (await userService.findOne(\n whereClause,\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n if (\n !user ||\n !(await authService.isCorrectPassword(password, user.password))\n ) {\n return next(new AppError(`Incorrect ${lastField} or password`, 401));\n }\n\n const token = authService.signJwtToken(user.id!);\n\n const cookieOptions: CookieOptions = {\n expires: new Date(\n Date.now() +\n Number(\n toMs(\n authConfigs?.jwt?.expiresIn ||\n (process.env.JWT_EXPIRES_IN as MsDuration) ||\n (arkosEnv.JWT_EXPIRES_IN as MsDuration)\n )\n )\n ),\n httpOnly:\n authConfigs?.jwt?.cookie?.httpOnly ||\n process.env.JWT_COOKIE_HTTP_ONLY === \"true\" ||\n true,\n secure:\n authConfigs?.jwt?.cookie?.secure ||\n process.env.JWT_COOKIE_SECURE === \"true\" ||\n req.secure ||\n req.headers[\"x-forwarded-proto\"] === \"https\",\n sameSite:\n authConfigs?.jwt?.cookie?.sameSite ||\n (process.env.JWT_COOKIE_SAME_SITE as\n | \"none\"\n | \"lax\"\n | \"strict\"\n | undefined) ||\n (process.env.NODE_ENV === \"production\" ? \"none\" : \"lax\"),\n };\n\n if (\n authConfigs?.login?.sendAccessTokenThrough === \"response-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n ) {\n req.responseData = { accessToken: token };\n res.locals.data = { accessToken: token };\n }\n\n if (\n authConfigs?.login?.sendAccessTokenThrough === \"cookie-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n )\n res.cookie(\"arkos_access_token\", token, cookieOptions);\n\n req.accessToken = token;\n\n if (interceptors?.afterLogin) {\n req.additionalData = { user };\n res.locals.additional = { user };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n if (\n authConfigs?.login?.sendAccessTokenThrough === \"response-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n ) {\n res.status(200).json(req.responseData);\n } else if (\n authConfigs?.login?.sendAccessTokenThrough === \"cookie-only\" ||\n authConfigs?.login?.sendAccessTokenThrough === \"both\" ||\n !authConfigs?.login?.sendAccessTokenThrough\n )\n res.status(200).send();\n }\n ),\n\n /**\n * Creates a new user account using the userService\n */\n signup: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const user = (await userService.createOne(\n req.body,\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n if (interceptors?.afterSignup) {\n req.responseData = { data: user };\n res.locals.data = { data: user };\n req.responseStatus = 201;\n res.locals.status = 201;\n return next();\n }\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n delete user[key as keyof User];\n });\n\n res.status(201).json({ data: user });\n }\n ),\n /**\n * Marks user account as self-deleted by setting deletedSelfAccountAt timestamp\n */\n deleteMe: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const userId = req.user!.id;\n\n const updatedUser = (await userService.updateOne(\n { id: userId },\n {\n deletedSelfAccountAt: new Date().toISOString(),\n },\n req.prismaQueryOptions || {}\n )) as Record<string, any>;\n\n if (interceptors?.afterDeleteMe) {\n req.responseData = { data: updatedUser };\n res.locals.data = { data: updatedUser };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n Object.keys(defaultExcludedUserFields).forEach((key) => {\n delete updatedUser[key as keyof User];\n });\n\n res.status(200).json({\n message: \"Account deleted successfully\",\n });\n }\n ),\n\n /**\n * Updates the password of the authenticated user\n */\n updatePassword: catchAsync(\n async (\n req: ArkosRequest,\n res: ArkosResponse,\n next: ArkosNextFunction\n ) => {\n const { currentPassword, newPassword } = req.body;\n\n if (!currentPassword || !newPassword)\n return next(\n new AppError(\"currentPassword and newPassword are required\", 400)\n );\n\n const user = req.user;\n\n if (!user || user?.isActive === false || user?.deletedSelfAccountAt)\n return next(new AppError(\"User not found!\", 404));\n\n // Check if the current password is correct\n const isPasswordCorrect = await authService.isCorrectPassword(\n String(currentPassword),\n String(user.password)\n );\n\n const configs = getArkosConfig();\n const initAuthConfigs = configs?.authentication;\n\n if (!isPasswordCorrect)\n return next(new AppError(\"Current password is incorrect.\", 400));\n\n // Check password strength (optional but recommended)\n if (\n !authService.isPasswordStrong(String(newPassword)) &&\n !configs?.validation\n ) {\n return next(\n new AppError(\n initAuthConfigs?.passwordValidation?.message ||\n \"The new password must contain at least one uppercase letter, one lowercase letter, and one number\",\n 400\n )\n );\n }\n\n // Update the password\n await userService.updateOne(\n { id: user.id },\n {\n password: await authService.hashPassword(newPassword),\n passwordChangedAt: new Date(Date.now()),\n }\n );\n\n if (interceptors?.afterUpdatePassword) {\n req.additionalData = {\n user,\n };\n req.responseData = {\n status: \"success\",\n message: \"Password updated successfully!\",\n };\n res.locals.data = {\n status: \"success\",\n message: \"Password updated successfully!\",\n };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({\n status: \"success\",\n message: \"Password updated successfully!\",\n });\n }\n ),\n\n findManyAuthAction: catchAsync(\n async (_: ArkosRequest, res: ArkosResponse) => {\n const arkosConfig = getArkosConfig();\n const authActions = authActionService.getAll()?.map((authAction) => {\n if (arkosConfig?.authentication?.mode === \"dynamic\")\n delete (authAction as any)?.roles;\n return authAction;\n });\n\n res.json({\n total: authActions.length,\n results: authActions.length,\n data: authActions,\n });\n }\n ),\n\n findOneAuthAction: catchAsync(\n async (req: ArkosRequest, res: ArkosResponse) => {\n const arkosConfig = getArkosConfig();\n const resourceName = req.params?.resourceName;\n\n if (!resourceName)\n throw new AppError(`Please provide a resoureName`, 400);\n\n const authActions = authActionService\n .getByResource(req.params?.resourceName)\n ?.map((authAction) => {\n if (arkosConfig?.authentication?.mode === \"dynamic\")\n delete (authAction as any)?.roles;\n return authAction;\n });\n\n if (!authActions)\n throw new AppError(\n `No auth action with resource name ${resourceName}`,\n 404\n );\n\n res.json({\n total: authActions.length,\n results: authActions.length,\n data: authActions,\n });\n }\n ),\n };\n};\n"]}
@@ -110,7 +110,7 @@ class BaseController {
110
110
  res.status(200).json({ data });
111
111
  });
112
112
  this.updateMany = (0, catch_async_1.default)(async (req, res, next) => {
113
- if (!Object.keys(req.query).some((key) => key !== "prismaQueryOptions")) {
113
+ if (Object.keys(req.query).every((key) => ["filterMode", "prismaQueryOptions"].includes(key))) {
114
114
  return next(new app_error_1.default("Filter criteria not provided for bulk update.", 400, {}, "MissingRequestQueryParameters"));
115
115
  }
116
116
  if (req.query.filterMode === "OR")
@@ -171,7 +171,7 @@ class BaseController {
171
171
  res.status(204).send();
172
172
  });
173
173
  this.deleteMany = (0, catch_async_1.default)(async (req, res, next) => {
174
- if (!Object.keys(req.query).some((key) => key !== "prismaQueryOptions")) {
174
+ if (Object.keys(req.query).every((key) => ["filterMode", "prismaQueryOptions"].includes(key))) {
175
175
  return next(new app_error_1.default("Filter criteria not provided for bulk deletion.", 400, {}, "MissingRequestQueryParameters"));
176
176
  }
177
177
  if (req.query.filterMode === "OR")
@@ -1 +1 @@
1
- {"version":3,"file":"base.controller.js","sourceRoot":"","sources":["../../../../src/modules/base/base.controller.ts"],"names":[],"mappings":";;;;;;AACA,qFAA4D;AAC5D,iDAA6C;AAC7C,iFAAwD;AACxD,iFAAgF;AAChF,+DAAiE;AACjE,0DAAkC;AAClC,4DAAoC;AACpC,mGAAyE;AACzE,+CAAkD;AAClD,4FAA6D;AA2B7D,MAAa,cAAc;IAuBzB,YAAY,SAAiB;QAe7B,cAAS,GAAG,IAAA,qBAAU,EACpB,KAAK,EAAE,GAAiB,EAAE,GAAkB,EAAE,IAAuB,EAAE,EAAE;YACvE,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,IAAI,mBAAW,CAChD,GAAG,EACH,IAAI,CAAC,SAAS,CACf,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;YAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SA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YACnC,aAAa;SACd;KACF,CAAC,CAAC;AACL,CAAC,CACF,CAAC","sourcesContent":["import { ArkosRequest, ArkosResponse, ArkosNextFunction } from \"../../types\";\nimport catchAsync from \"../error-handler/utils/catch-async\";\nimport { BaseService } from \"./base.service\";\nimport AppError from \"../error-handler/utils/app-error\";\nimport { kebabCase, pascalCase } from \"../../utils/helpers/change-case.helpers\";\nimport { getModuleComponents } from \"../../utils/dynamic-loader\";\nimport pluralize from \"pluralize\";\nimport sheu from \"../../utils/sheu\";\nimport prismaSchemaParser from \"../../utils/prisma/prisma-schema-parser\";\nimport { APIFeatures } from \"../../exports/utils\";\nimport deepmerge from \"../../utils/helpers/deepmerge.helper\";\n\n/**\n * The `BaseController` class provides standardized RESTful API endpoints\n * for any Prisma model based on its name. It supports automatic integration\n * with Prisma services and dynamic middleware hooks for extending behaviors.\n *\n * This controller includes:\n * - `createOne` / `createMany`\n * - `findOne` / `findMany`\n * - `updateOne` / `updateMany`\n * - `deleteOne` / `deleteMany`\n *\n * It handles:\n * - Prisma query options\n * - APIFeatures: filtering, sorting, pagination, field limiting\n * - Middleware hooks: `afterCreateOne`, `afterUpdateMany`, etc.\n *\n * @class BaseController\n *\n * @param {string} modelName - The Prisma model name this controller handles.\n *\n * @see {@link https://www.arkosjs.com/docs/api-reference/the-base-controller-class}\n *--\n * **See about how Arkos handles routers**\n * @see {@link https://www.arkosjs.com/docs/guide/adding-custom-routers}\n */\nexport class BaseController {\n /**\n * Service instance to handle business logic operations\n * @private\n */\n private service: BaseService<any>;\n\n /**\n * Name of the model this controller handles\n * @private\n */\n private modelName: string;\n\n /**\n * Model-specific interceptors loaded from model modules\n * @private\n */\n private interceptors: any;\n\n /**\n * Creates a new BaseController instance\n * @param {string} modelName - The name of the model for which this controller will handle operations\n */\n constructor(modelName: string) {\n const components = getModuleComponents(modelName);\n\n this.modelName = modelName;\n this.service = new BaseService(modelName);\n this.interceptors = components?.interceptors || {};\n }\n\n /**\n * Creates a single resource\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n createOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.createOne(\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (this.interceptors.afterCreateOne) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 201;\n res.locals.status = 201;\n return next();\n }\n\n res.status(201).json({ data });\n }\n );\n\n /**\n * Creates multiple resources in a single operation\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n createMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.createMany(\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data)\n return next(\n new AppError(\n \"Failed to create the resources. Please check your input.\",\n 400,\n { body: req.body }\n )\n );\n\n if (this.interceptors.afterCreateMany) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 201;\n res.locals.status = 201;\n return next();\n }\n\n res.status(201).json({ data });\n }\n );\n\n /**\n * Retrieves multiple resources with filtering, sorting, pagination, and field selection\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n findMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(req, this.modelName)\n .filter()\n .sort()\n .limitFields()\n .paginate().filters;\n\n const [data, total] = (await Promise.all([\n this.service.findMany(where, queryOptions, {\n user: req?.user,\n accessToken: req?.accessToken,\n }),\n this.service.count(where, {\n user: req?.user,\n accessToken: req?.accessToken,\n }),\n ])) as [Record<string, any>[], number];\n\n if (this.interceptors.afterFindMany) {\n req.responseData = { total, results: data.length, data };\n res.locals.data = { total, results: data.length, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ total, results: data.length, data });\n }\n );\n\n /**\n * Retrieves a single resource by its identifier\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n findOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.findOne(\n req.params,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data) {\n if (\n Object.keys(req.params).length === 1 &&\n \"id\" in req.params &&\n req.params.id !== \"me\"\n ) {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} with ID ${\n req.params?.id\n } not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n } else {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n }\n }\n\n if (this.interceptors.afterFindOne) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data });\n }\n );\n\n /**\n * Updates a single resource by its identifier\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n updateOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.updateOne(\n req.params,\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data) {\n if (Object.keys(req.params).length === 1 && \"id\" in req.params) {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} with ID ${\n req.params?.id\n } not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n } else {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n }\n }\n\n if (this.interceptors.afterUpdateOne) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data });\n }\n );\n\n /**\n * Updates multiple resources that match specified criteria\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n updateMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n if (!Object.keys(req.query).some((key) => key !== \"prismaQueryOptions\")) {\n return next(\n new AppError(\n \"Filter criteria not provided for bulk update.\",\n 400,\n {},\n \"MissingRequestQueryParameters\"\n )\n );\n }\n\n if (req.query.filterMode === \"OR\")\n throw new AppError(\n \"req.query.filterMode === OR is not valid for update many operation\",\n 400\n );\n\n req.query.filterMode = \"AND\";\n const { where, ...queryOptions } = new APIFeatures(req, this.modelName)\n .filter()\n .sort()\n .limitFields()\n .paginate().filters;\n\n delete queryOptions.include;\n\n const data = (await this.service.updateMany(\n where,\n req.body,\n queryOptions,\n { user: req?.user, accessToken: req?.accessToken }\n )) as { count: number };\n\n if (!data || data.count === 0)\n return next(\n new AppError(\n `${pluralize(pascalCase(String(this.modelName)))} not found`,\n 404\n )\n );\n\n if (this.interceptors.afterUpdateMany) {\n req.responseData = { results: data.count, data };\n res.locals.data = { results: data.count, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.count, data });\n }\n );\n\n /**\n * Updates multiple resources with different data in a single transaction\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n batchUpdate = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.batchUpdate(\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data || data.length === 0)\n return next(\n new AppError(\n \"Failed to update the resources. Please check your input.\",\n 400,\n { body: req.body }\n )\n );\n\n if (this.interceptors.afterBatchUpdate) {\n req.responseData = { results: data.length, data };\n res.locals.data = { results: data.length, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.length, data });\n }\n );\n\n /**\n * Deletes a single resource by its identifier\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n deleteOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const data = await this.service.deleteOne(req.params, {\n user: req?.user,\n accessToken: req?.accessToken,\n });\n\n if (!data) {\n if (Object.keys(req.params).length === 1 && \"id\" in req.params) {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} with ID ${\n req.params?.id\n } not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n } else {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n }\n }\n\n if (this.interceptors.afterDeleteOne) {\n req.additionalData = { data };\n res.locals.additionalData = { data };\n req.responseStatus = 204;\n res.locals.status = 204;\n return next();\n }\n\n res.status(204).send();\n }\n );\n\n /**\n * Deletes multiple resources that match specified criteria\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n deleteMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n if (!Object.keys(req.query).some((key) => key !== \"prismaQueryOptions\")) {\n return next(\n new AppError(\n \"Filter criteria not provided for bulk deletion.\",\n 400,\n {},\n \"MissingRequestQueryParameters\"\n )\n );\n }\n\n if (req.query.filterMode === \"OR\")\n throw new AppError(\n \"req.query.filterMode === OR is not valid for delete many operation\",\n 400\n );\n\n req.query.filterMode = \"AND\";\n const { where } = new APIFeatures(req, this.modelName).filter().filters;\n\n const data = await this.service.deleteMany(where, {\n user: req?.user,\n accessToken: req?.accessToken,\n });\n\n if (!data || data.count === 0) {\n return next(\n new AppError(`No records found to delete`, 404, {}, \"NotFound\")\n );\n }\n\n if (this.interceptors.afterDeleteMany) {\n req.responseData = { results: data.count, data };\n res.locals.data = { results: data.count, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.count, data });\n }\n );\n\n /**\n * Deletes multiple resources with different filters in a single transaction\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n batchDelete = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const data = await this.service.batchDelete(req.body, {\n user: req?.user,\n accessToken: req?.accessToken,\n });\n\n if (!data || data.length === 0)\n return next(\n new AppError(\n \"Failed to delete the resources. Please check your input.\",\n 400,\n { body: req.body }\n )\n );\n\n if (this.interceptors.afterBatchDelete) {\n req.responseData = { results: data.length, data };\n res.locals.data = { results: data.length, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.length, data });\n }\n );\n}\n\n/**\n * Returns a list of all available resource endpoints based on the application's models\n *\n * Will soon be removed\n *\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\nexport const getAvailableResources = catchAsync(\n async (_: any, res: ArkosResponse) => {\n sheu.warn(\n \"This route `/api/available-resources` will be deprecated from 1.4.0-beta, consider using /api/auth-actions instead.\"\n );\n\n res.status(200).json({\n data: [\n ...prismaSchemaParser\n .getModelsAsArrayOfStrings()\n .map((model) => kebabCase(model)),\n \"file-upload\",\n ],\n });\n }\n);\n"]}
1
+ {"version":3,"file":"base.controller.js","sourceRoot":"","sources":["../../../../src/modules/base/base.controller.ts"],"names":[],"mappings":";;;;;;AACA,qFAA4D;AAC5D,iDAA6C;AAC7C,iFAAwD;AACxD,iFAAgF;AAChF,+DAAiE;AACjE,0DAAkC;AAClC,4DAAoC;AACpC,mGAAyE;AACzE,+CAAkD;AAClD,4FAA6D;AA2B7D,MAAa,cAAc;IAuBzB,YAAY,SAAiB;QAe7B,cAAS,GAAG,IAAA,qBAAU,EACpB,KAAK,EAAE,GAAiB,EAAE,GAAkB,EAAE,IAAuB,EAAE,EAAE;YACvE,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,IAAI,mBAAW,CAChD,GAAG,EACH,IAAI,CAAC,SAAS,CACf,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;YAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CACvC,GAAG,CAAC,IAAI,EACR,IAAA,0BAAS,EAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,EAAE,YAAY,CAAC,EACrD,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,CACnD,CAAC;YAEF,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;gBACrC,GAAG,CAAC,YAAY,GAAG,EAAE,IAAI,EAAE,CAAC;gBAC5B,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC;gBAC3B,G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BACjD,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC;gBACzB,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;gBACxB,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,CAAC,CACF,CAAC;QAjeA,MAAM,UAAU,GAAG,IAAA,oCAAmB,EAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAW,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,YAAY,GAAG,UAAU,EAAE,YAAY,IAAI,EAAE,CAAC;IACrD,CAAC;CA6dF;AA1fD,wCA0fC;AAYY,QAAA,qBAAqB,GAAG,IAAA,qBAAU,EAC7C,KAAK,EAAE,CAAM,EAAE,GAAkB,EAAE,EAAE;IACnC,cAAI,CAAC,IAAI,CACP,qHAAqH,CACtH,CAAC;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,IAAI,EAAE;YACJ,GAAG,8BAAkB;iBAClB,yBAAyB,EAAE;iBAC3B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,+BAAS,EAAC,KAAK,CAAC,CAAC;YACnC,aAAa;SACd;KACF,CAAC,CAAC;AACL,CAAC,CACF,CAAC","sourcesContent":["import { ArkosRequest, ArkosResponse, ArkosNextFunction } from \"../../types\";\nimport catchAsync from \"../error-handler/utils/catch-async\";\nimport { BaseService } from \"./base.service\";\nimport AppError from \"../error-handler/utils/app-error\";\nimport { kebabCase, pascalCase } from \"../../utils/helpers/change-case.helpers\";\nimport { getModuleComponents } from \"../../utils/dynamic-loader\";\nimport pluralize from \"pluralize\";\nimport sheu from \"../../utils/sheu\";\nimport prismaSchemaParser from \"../../utils/prisma/prisma-schema-parser\";\nimport { APIFeatures } from \"../../exports/utils\";\nimport deepmerge from \"../../utils/helpers/deepmerge.helper\";\n\n/**\n * The `BaseController` class provides standardized RESTful API endpoints\n * for any Prisma model based on its name. It supports automatic integration\n * with Prisma services and dynamic middleware hooks for extending behaviors.\n *\n * This controller includes:\n * - `createOne` / `createMany`\n * - `findOne` / `findMany`\n * - `updateOne` / `updateMany`\n * - `deleteOne` / `deleteMany`\n *\n * It handles:\n * - Prisma query options\n * - APIFeatures: filtering, sorting, pagination, field limiting\n * - Middleware hooks: `afterCreateOne`, `afterUpdateMany`, etc.\n *\n * @class BaseController\n *\n * @param {string} modelName - The Prisma model name this controller handles.\n *\n * @see {@link https://www.arkosjs.com/docs/api-reference/the-base-controller-class}\n *--\n * **See about how Arkos handles routers**\n * @see {@link https://www.arkosjs.com/docs/guide/adding-custom-routers}\n */\nexport class BaseController {\n /**\n * Service instance to handle business logic operations\n * @private\n */\n private service: BaseService<any>;\n\n /**\n * Name of the model this controller handles\n * @private\n */\n private modelName: string;\n\n /**\n * Model-specific interceptors loaded from model modules\n * @private\n */\n private interceptors: any;\n\n /**\n * Creates a new BaseController instance\n * @param {string} modelName - The name of the model for which this controller will handle operations\n */\n constructor(modelName: string) {\n const components = getModuleComponents(modelName);\n\n this.modelName = modelName;\n this.service = new BaseService(modelName);\n this.interceptors = components?.interceptors || {};\n }\n\n /**\n * Creates a single resource\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n createOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.createOne(\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (this.interceptors.afterCreateOne) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 201;\n res.locals.status = 201;\n return next();\n }\n\n res.status(201).json({ data });\n }\n );\n\n /**\n * Creates multiple resources in a single operation\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n createMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.createMany(\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data)\n return next(\n new AppError(\n \"Failed to create the resources. Please check your input.\",\n 400,\n { body: req.body }\n )\n );\n\n if (this.interceptors.afterCreateMany) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 201;\n res.locals.status = 201;\n return next();\n }\n\n res.status(201).json({ data });\n }\n );\n\n /**\n * Retrieves multiple resources with filtering, sorting, pagination, and field selection\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n findMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(req, this.modelName)\n .filter()\n .sort()\n .limitFields()\n .paginate().filters;\n\n const [data, total] = (await Promise.all([\n this.service.findMany(where, queryOptions, {\n user: req?.user,\n accessToken: req?.accessToken,\n }),\n this.service.count(where, {\n user: req?.user,\n accessToken: req?.accessToken,\n }),\n ])) as [Record<string, any>[], number];\n\n if (this.interceptors.afterFindMany) {\n req.responseData = { total, results: data.length, data };\n res.locals.data = { total, results: data.length, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ total, results: data.length, data });\n }\n );\n\n /**\n * Retrieves a single resource by its identifier\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n findOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.findOne(\n req.params,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data) {\n if (\n Object.keys(req.params).length === 1 &&\n \"id\" in req.params &&\n req.params.id !== \"me\"\n ) {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} with ID ${\n req.params?.id\n } not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n } else {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n }\n }\n\n if (this.interceptors.afterFindOne) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data });\n }\n );\n\n /**\n * Updates a single resource by its identifier\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n updateOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.updateOne(\n req.params,\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data) {\n if (Object.keys(req.params).length === 1 && \"id\" in req.params) {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} with ID ${\n req.params?.id\n } not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n } else {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n }\n }\n\n if (this.interceptors.afterUpdateOne) {\n req.responseData = { data };\n res.locals.data = { data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ data });\n }\n );\n\n /**\n * Updates multiple resources that match specified criteria\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n updateMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n if (\n Object.keys(req.query).every((key) =>\n [\"filterMode\", \"prismaQueryOptions\"].includes(key)\n )\n ) {\n return next(\n new AppError(\n \"Filter criteria not provided for bulk update.\",\n 400,\n {},\n \"MissingRequestQueryParameters\"\n )\n );\n }\n\n if (req.query.filterMode === \"OR\")\n throw new AppError(\n \"req.query.filterMode === OR is not valid for update many operation\",\n 400\n );\n\n req.query.filterMode = \"AND\";\n const { where, ...queryOptions } = new APIFeatures(req, this.modelName)\n .filter()\n .sort()\n .limitFields()\n .paginate().filters;\n\n delete queryOptions.include;\n\n const data = (await this.service.updateMany(\n where,\n req.body,\n queryOptions,\n { user: req?.user, accessToken: req?.accessToken }\n )) as { count: number };\n\n if (!data || data.count === 0)\n return next(\n new AppError(\n `${pluralize(pascalCase(String(this.modelName)))} not found`,\n 404\n )\n );\n\n if (this.interceptors.afterUpdateMany) {\n req.responseData = { results: data.count, data };\n res.locals.data = { results: data.count, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.count, data });\n }\n );\n\n /**\n * Updates multiple resources with different data in a single transaction\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n batchUpdate = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const { where, ...queryOptions } = new APIFeatures(\n req,\n this.modelName\n ).limitFields().filters;\n\n const data = await this.service.batchUpdate(\n req.body,\n deepmerge(req.prismaQueryOptions || {}, queryOptions),\n { user: req?.user, accessToken: req?.accessToken }\n );\n\n if (!data || data.length === 0)\n return next(\n new AppError(\n \"Failed to update the resources. Please check your input.\",\n 400,\n { body: req.body }\n )\n );\n\n if (this.interceptors.afterBatchUpdate) {\n req.responseData = { results: data.length, data };\n res.locals.data = { results: data.length, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.length, data });\n }\n );\n\n /**\n * Deletes a single resource by its identifier\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n deleteOne = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const data = await this.service.deleteOne(req.params, {\n user: req?.user,\n accessToken: req?.accessToken,\n });\n\n if (!data) {\n if (Object.keys(req.params).length === 1 && \"id\" in req.params) {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} with ID ${\n req.params?.id\n } not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n } else {\n return next(\n new AppError(\n `${pascalCase(String(this.modelName))} not found`,\n 404,\n {},\n \"NotFound\"\n )\n );\n }\n }\n\n if (this.interceptors.afterDeleteOne) {\n req.additionalData = { data };\n res.locals.additionalData = { data };\n req.responseStatus = 204;\n res.locals.status = 204;\n return next();\n }\n\n res.status(204).send();\n }\n );\n\n /**\n * Deletes multiple resources that match specified criteria\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n deleteMany = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n if (\n Object.keys(req.query).every((key) =>\n [\"filterMode\", \"prismaQueryOptions\"].includes(key)\n )\n ) {\n return next(\n new AppError(\n \"Filter criteria not provided for bulk deletion.\",\n 400,\n {},\n \"MissingRequestQueryParameters\"\n )\n );\n }\n\n if (req.query.filterMode === \"OR\")\n throw new AppError(\n \"req.query.filterMode === OR is not valid for delete many operation\",\n 400\n );\n\n req.query.filterMode = \"AND\";\n const { where } = new APIFeatures(req, this.modelName).filter().filters;\n\n const data = await this.service.deleteMany(where, {\n user: req?.user,\n accessToken: req?.accessToken,\n });\n\n if (!data || data.count === 0) {\n return next(\n new AppError(`No records found to delete`, 404, {}, \"NotFound\")\n );\n }\n\n if (this.interceptors.afterDeleteMany) {\n req.responseData = { results: data.count, data };\n res.locals.data = { results: data.count, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.count, data });\n }\n );\n\n /**\n * Deletes multiple resources with different filters in a single transaction\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\n batchDelete = catchAsync(\n async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {\n const data = await this.service.batchDelete(req.body, {\n user: req?.user,\n accessToken: req?.accessToken,\n });\n\n if (!data || data.length === 0)\n return next(\n new AppError(\n \"Failed to delete the resources. Please check your input.\",\n 400,\n { body: req.body }\n )\n );\n\n if (this.interceptors.afterBatchDelete) {\n req.responseData = { results: data.length, data };\n res.locals.data = { results: data.length, data };\n req.responseStatus = 200;\n res.locals.status = 200;\n return next();\n }\n\n res.status(200).json({ results: data.length, data });\n }\n );\n}\n\n/**\n * Returns a list of all available resource endpoints based on the application's models\n *\n * Will soon be removed\n *\n * @param {ArkosRequest} req - Express request object\n * @param {ArkosResponse} res - Express response object\n * @param {ArkosNextFunction} next - Express next function\n * @returns {Promise<void>}\n */\nexport const getAvailableResources = catchAsync(\n async (_: any, res: ArkosResponse) => {\n sheu.warn(\n \"This route `/api/available-resources` will be deprecated from 1.4.0-beta, consider using /api/auth-actions instead.\"\n );\n\n res.status(200).json({\n data: [\n ...prismaSchemaParser\n .getModelsAsArrayOfStrings()\n .map((model) => kebabCase(model)),\n \"file-upload\",\n ],\n });\n }\n);\n"]}
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const sheu_1 = __importDefault(require("../../utils/sheu"));
7
- const exports_1 = require("../../exports");
8
7
  const util_1 = __importDefault(require("util"));
9
8
  const fs_helpers_1 = require("../../utils/helpers/fs.helpers");
10
9
  const loaded_components_logger_1 = __importDefault(require("./utils/loaded-components-logger"));
10
+ const server_1 = require("../../server");
11
11
  class DebuggerService {
12
12
  logModuleFinalRouter(moduleName, router) {
13
- const config = (0, exports_1.getArkosConfig)();
13
+ const config = (0, server_1.getArkosConfig)();
14
14
  const debugLevel = config.debugging?.dynamicLoader?.level || 0;
15
15
  if (debugLevel < 3)
16
16
  return;
@@ -22,7 +22,7 @@ class DebuggerService {
22
22
  sheu_1.default.print(util_1.default.inspect(router, { depth: 2, colors: true }));
23
23
  }
24
24
  logDynamicLoadedModulesComponents(appModules) {
25
- const config = (0, exports_1.getArkosConfig)();
25
+ const config = (0, server_1.getArkosConfig)();
26
26
  const debugLevel = config.debugging?.dynamicLoader?.level || 0;
27
27
  if (debugLevel < 1)
28
28
  return;
@@ -41,7 +41,7 @@ ${sheu_1.default.bold("Ending:")} ${moduleName}\n`);
41
41
  });
42
42
  }
43
43
  handleTransformedQueryLog(transformedQuery) {
44
- const config = (0, exports_1.getArkosConfig)();
44
+ const config = (0, server_1.getArkosConfig)();
45
45
  const debugLevel = config.debugging?.requests?.level || 0;
46
46
  if (debugLevel < 2)
47
47
  return;
@@ -54,16 +54,16 @@ ${sheu_1.default.bold("Ending:")} ${moduleName}\n`);
54
54
  });
55
55
  }
56
56
  logLevel2RequestInfo(req, _, next) {
57
- const config = (0, exports_1.getArkosConfig)();
57
+ const config = (0, server_1.getArkosConfig)();
58
58
  const debugLevel = config.debugging?.requests?.level || 0;
59
59
  if (debugLevel < 2)
60
60
  return next();
61
61
  if (req.modelName)
62
62
  sheu_1.default.debug(`Prisma Model Module\n${req.modelName}`, { timestamp: true });
63
63
  if (Object.keys(req.query).length > 0)
64
- sheu_1.default.debug(`Original Request Parameters (req.query)\n${JSON.stringify(req.query || {}, null, 2)}`, { timestamp: true });
64
+ sheu_1.default.debug(`Original Request Params (req.params)\n${JSON.stringify(req.params || {}, null, 2)}`, { timestamp: true });
65
65
  else
66
- sheu_1.default.debug(`Original Request Parameters (req.query) - Empty`, {
66
+ sheu_1.default.debug(`Original Request Params (req.params) - Empty`, {
67
67
  timestamp: true,
68
68
  });
69
69
  if (req.body && Object.keys(req.body).length > 0)
@@ -72,6 +72,12 @@ ${sheu_1.default.bold("Ending:")} ${moduleName}\n`);
72
72
  sheu_1.default.debug(`Original Request Body (req.body) - Empty`, {
73
73
  timestamp: true,
74
74
  });
75
+ if (Object.keys(req.query).length > 0)
76
+ sheu_1.default.debug(`Original Request Query (req.query)\n${JSON.stringify(req.query || {}, null, 2)}`, { timestamp: true });
77
+ else
78
+ sheu_1.default.debug(`Original Request Query (req.query) - Empty`, {
79
+ timestamp: true,
80
+ });
75
81
  next();
76
82
  }
77
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"debugger.service.js","sourceRoot":"","sources":["../../../../src/modules/debugger/debugger.service.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,2CAKuB;AAEvB,gDAAwB;AACxB,+DAAqD;AACrD,gGAAsE;AAGtE,MAAM,eAAe;IACnB,oBAAoB,CAAC,UAAkB,EAAE,MAAc;QACrD,MAAM,MAAM,GAAG,IAAA,wBAAc,GAAE,CAAC;QAChC,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC,CAAC;QAC/D,IAAI,UAAU,GAAG,CAAC;YAAE,OAAO;QAE3B,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC;QAC3E,IACE,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,MA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AAM,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC,CAAC;QAC1D,IAAI,UAAU,GAAG,CAAC;YAAE,OAAO,IAAI,EAAE,CAAC;QAElC,IAAI,GAAG,CAAC,SAAS;YACf,cAAI,CAAC,KAAK,CAAC,wBAAwB,GAAG,CAAC,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE3E,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;YACnC,cAAI,CAAC,KAAK,CACR,4CAA4C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EACtF,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;;YAEF,cAAI,CAAC,KAAK,CAAC,iDAAiD,EAAE;gBAC5D,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QAEL,IAAI,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;YAC9C,cAAI,CAAC,KAAK,CACR,qCAAqC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EACxE,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;;YAEF,cAAI,CAAC,KAAK,CAAC,0CAA0C,EAAE;gBACrD,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QAEL,IAAI,EAAE,CAAC;IACT,CAAC;CACF;AAED,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AAE9C,kBAAe,eAAe,CAAC","sourcesContent":["import sheu from \"../../utils/sheu\";\nimport {\n ArkosNextFunction,\n ArkosRequest,\n ArkosResponse,\n getArkosConfig,\n} from \"../../exports\";\nimport { ModuleComponents } from \"../../utils/dynamic-loader\";\nimport util from \"util\";\nimport { crd } from \"../../utils/helpers/fs.helpers\";\nimport loadedComponentsLogger from \"./utils/loaded-components-logger\";\nimport { Router } from \"express\";\n\nclass DebuggerService {\n logModuleFinalRouter(moduleName: string, router: Router) {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.dynamicLoader?.level || 0;\n if (debugLevel < 3) return;\n\n const moduleNameFilter = config.debugging?.dynamicLoader?.filters?.modules;\n if (\n (moduleNameFilter?.[0]?.length || 0) > 0 &&\n !moduleNameFilter?.some((name) =>\n moduleName.toLowerCase().startsWith(name.toLowerCase())\n )\n )\n return;\n\n sheu.debug(`${sheu.bold(\"Final Router Module:\")} ${moduleName}`);\n sheu.print(util.inspect(router, { depth: 2, colors: true }));\n }\n\n logDynamicLoadedModulesComponents(\n appModules: {\n moduleName: string;\n moduleDir: string;\n components: ModuleComponents;\n }[]\n ) {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.dynamicLoader?.level || 0;\n\n if (debugLevel < 1) return;\n sheu.debug(`${sheu.bold(\"Dynamic Loader Components\")}`, {\n timestamp: true,\n });\n\n const moduleNameFilter = config.debugging?.dynamicLoader?.filters?.modules;\n\n appModules.forEach(({ moduleName, moduleDir, components }) => {\n if (\n (moduleNameFilter?.[0]?.length || 0) > 0 &&\n !moduleNameFilter?.some((name) =>\n moduleName.toLowerCase().startsWith(name.toLowerCase())\n )\n )\n return;\n\n sheu.print(`\\n${sheu.bold(\"Module:\")} ${moduleName}\n${sheu.bold(\"Path:\")} ${moduleDir.replace(crd(), \"\")}\n${sheu.bold(\"Components:\")} ${loadedComponentsLogger.getComponentsNameList(moduleName, components).join(\", \")}${debugLevel >= 2 ? `\\n${loadedComponentsLogger.getLogText(components)}` : \"\"}\n${sheu.bold(\"Ending:\")} ${moduleName}\\n`);\n });\n }\n\n handleTransformedQueryLog(transformedQuery: Record<string, any>) {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.requests?.level || 0;\n if (debugLevel < 2) return;\n\n if (transformedQuery && Object.keys(transformedQuery).length > 0) {\n sheu.debug(\n `Transformed Request Parameters\\n${JSON.stringify(transformedQuery, null, 2)}`,\n { timestamp: true }\n );\n } else\n sheu.debug(`Transformed Request Parameters - Empty`, {\n timestamp: true,\n });\n }\n\n logLevel2RequestInfo(\n req: ArkosRequest,\n _: ArkosResponse,\n next: ArkosNextFunction\n ): void {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.requests?.level || 0;\n if (debugLevel < 2) return next();\n\n if (req.modelName)\n sheu.debug(`Prisma Model Module\\n${req.modelName}`, { timestamp: true });\n\n if (Object.keys(req.query).length > 0)\n sheu.debug(\n `Original Request Parameters (req.query)\\n${JSON.stringify(req.query || {}, null, 2)}`,\n { timestamp: true }\n );\n else\n sheu.debug(`Original Request Parameters (req.query) - Empty`, {\n timestamp: true,\n });\n\n if (req.body && Object.keys(req.body).length > 0)\n sheu.debug(\n `Original Request Body (req.body)\\n${JSON.stringify(req.body, null, 2)}`,\n { timestamp: true }\n );\n else\n sheu.debug(`Original Request Body (req.body) - Empty`, {\n timestamp: true,\n });\n\n next();\n }\n}\n\nconst debuggerService = new DebuggerService();\n\nexport default debuggerService;\n"]}
1
+ {"version":3,"file":"debugger.service.js","sourceRoot":"","sources":["../../../../src/modules/debugger/debugger.service.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AAGpC,gDAAwB;AACxB,+DAAqD;AACrD,gGAAsE;AAEtE,yCAA8C;AAE9C,MAAM,eAAe;IACnB,oBAAoB,CAAC,UAAkB,EAAE,MAAc;QACrD,MAAM,MAAM,GAAG,IAAA,uBAAc,GAAE,CAAC;QAChC,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC,CAAC;QAC/D,IAAI,UAAU,GAAG,CAAC;YAAE,OAAO;QAE3B,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC;QAC3E,IACE,CAAC,gBAAgB,EAAE,C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E,IAAI,EAAE,CACpB,CAAC;;YAEF,cAAI,CAAC,KAAK,CAAC,4CAA4C,EAAE;gBACvD,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QAEL,IAAI,EAAE,CAAC;IACT,CAAC;CACF;AAED,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AAE9C,kBAAe,eAAe,CAAC","sourcesContent":["import sheu from \"../../utils/sheu\";\nimport { ArkosNextFunction, ArkosRequest, ArkosResponse } from \"../../exports\";\nimport { ModuleComponents } from \"../../utils/dynamic-loader\";\nimport util from \"util\";\nimport { crd } from \"../../utils/helpers/fs.helpers\";\nimport loadedComponentsLogger from \"./utils/loaded-components-logger\";\nimport { Router } from \"express\";\nimport { getArkosConfig } from \"../../server\";\n\nclass DebuggerService {\n logModuleFinalRouter(moduleName: string, router: Router) {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.dynamicLoader?.level || 0;\n if (debugLevel < 3) return;\n\n const moduleNameFilter = config.debugging?.dynamicLoader?.filters?.modules;\n if (\n (moduleNameFilter?.[0]?.length || 0) > 0 &&\n !moduleNameFilter?.some((name) =>\n moduleName.toLowerCase().startsWith(name.toLowerCase())\n )\n )\n return;\n\n sheu.debug(`${sheu.bold(\"Final Router Module:\")} ${moduleName}`);\n sheu.print(util.inspect(router, { depth: 2, colors: true }));\n }\n\n logDynamicLoadedModulesComponents(\n appModules: {\n moduleName: string;\n moduleDir: string;\n components: ModuleComponents;\n }[]\n ) {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.dynamicLoader?.level || 0;\n\n if (debugLevel < 1) return;\n sheu.debug(`${sheu.bold(\"Dynamic Loader Components\")}`, {\n timestamp: true,\n });\n\n const moduleNameFilter = config.debugging?.dynamicLoader?.filters?.modules;\n\n appModules.forEach(({ moduleName, moduleDir, components }) => {\n if (\n (moduleNameFilter?.[0]?.length || 0) > 0 &&\n !moduleNameFilter?.some((name) =>\n moduleName.toLowerCase().startsWith(name.toLowerCase())\n )\n )\n return;\n\n sheu.print(`\\n${sheu.bold(\"Module:\")} ${moduleName}\n${sheu.bold(\"Path:\")} ${moduleDir.replace(crd(), \"\")}\n${sheu.bold(\"Components:\")} ${loadedComponentsLogger.getComponentsNameList(moduleName, components).join(\", \")}${debugLevel >= 2 ? `\\n${loadedComponentsLogger.getLogText(components)}` : \"\"}\n${sheu.bold(\"Ending:\")} ${moduleName}\\n`);\n });\n }\n\n handleTransformedQueryLog(transformedQuery: Record<string, any>) {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.requests?.level || 0;\n if (debugLevel < 2) return;\n\n if (transformedQuery && Object.keys(transformedQuery).length > 0) {\n sheu.debug(\n `Transformed Request Parameters\\n${JSON.stringify(transformedQuery, null, 2)}`,\n { timestamp: true }\n );\n } else\n sheu.debug(`Transformed Request Parameters - Empty`, {\n timestamp: true,\n });\n }\n\n logLevel2RequestInfo(\n req: ArkosRequest,\n _: ArkosResponse,\n next: ArkosNextFunction\n ): void {\n const config = getArkosConfig();\n const debugLevel = config.debugging?.requests?.level || 0;\n if (debugLevel < 2) return next();\n\n if (req.modelName)\n sheu.debug(`Prisma Model Module\\n${req.modelName}`, { timestamp: true });\n\n if (Object.keys(req.query).length > 0)\n sheu.debug(\n `Original Request Params (req.params)\\n${JSON.stringify(req.params || {}, null, 2)}`,\n { timestamp: true }\n );\n else\n sheu.debug(`Original Request Params (req.params) - Empty`, {\n timestamp: true,\n });\n\n if (req.body && Object.keys(req.body).length > 0)\n sheu.debug(\n `Original Request Body (req.body)\\n${JSON.stringify(req.body, null, 2)}`,\n { timestamp: true }\n );\n else\n sheu.debug(`Original Request Body (req.body) - Empty`, {\n timestamp: true,\n });\n\n if (Object.keys(req.query).length > 0)\n sheu.debug(\n `Original Request Query (req.query)\\n${JSON.stringify(req.query || {}, null, 2)}`,\n { timestamp: true }\n );\n else\n sheu.debug(`Original Request Query (req.query) - Empty`, {\n timestamp: true,\n });\n\n next();\n }\n}\n\nconst debuggerService = new DebuggerService();\n\nexport default debuggerService;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-prisma-json-schemas.js","sourceRoot":"","sources":["../../../../../../../src/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.ts"],"names":[],"mappings":";;;;;AAIA,8DA6BC;AAhCD,4HAAiG;AACjG,4GAAkF;AAE3E,KAAK,UAAU,yBAAyB,CAAC,WAAwB;IACtE,MAAM,kBAAkB,GAAG;QACzB,GAAG,8BAAkB,CAAC,yBAAyB,EAAE;QACjD,MAAM;KACP,CAAC;IAEF,IAAI,CAAC;QAEH,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CACzC,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YACzC,MAAM,YAAY,GAChB,MAAM,sCAAyB,CAAC,oBAAoB,CAAC;gBACnD,SAAS;gBACT,WAAW;aACZ,CAAC,CAAC;YACL,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC,CACH,CAAC;QAGF,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE;YAC7D,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { ArkosConfig } from \"../../../../../exports\";\nimport PrismaJsonSchemaGenerator from \"../../../../../utils/prisma/prisma-json-schema-generator\";\nimport prismaSchemaParser from \"../../../../../utils/prisma/prisma-schema-parser\";\n\nexport async function generatePrismaJsonSchemas(arkosConfig: ArkosConfig) {\n const requiredAppModules = [\n ...prismaSchemaParser.getModelsAsArrayOfStrings(),\n \"auth\",\n ];\n\n try {\n // Use Promise.all to handle all async operations properly\n const modelSchemasArray = await Promise.all(\n requiredAppModules.map(async (modelName) => {\n const modelSchemas =\n await PrismaJsonSchemaGenerator.generateModelSchemas({\n modelName,\n arkosConfig,\n });\n return modelSchemas;\n })\n );\n\n // Merge all schemas into a single object\n const schemas = modelSchemasArray.reduce((acc, modelSchemas) => {\n return { ...acc, ...modelSchemas };\n }, {});\n\n return schemas;\n } catch (err) {\n console.error(err);\n throw err;\n }\n}\n"]}
1
+ {"version":3,"file":"generate-prisma-json-schemas.js","sourceRoot":"","sources":["../../../../../../../src/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.ts"],"names":[],"mappings":";;;;;AAIA,8DA2BC;AA9BD,4HAAiG;AACjG,4GAAkF;AAE3E,KAAK,UAAU,yBAAyB,CAAC,WAAwB;IACtE,MAAM,kBAAkB,GAAG;QACzB,GAAG,8BAAkB,CAAC,yBAAyB,EAAE;QACjD,MAAM;KACP,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,GAAG,CACzC,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YACzC,MAAM,YAAY,GAChB,MAAM,sCAAyB,CAAC,oBAAoB,CAAC;gBACnD,SAAS;gBACT,WAAW;aACZ,CAAC,CAAC;YACL,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC,CACH,CAAC;QAEF,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE;YAC7D,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;QACrC,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { ArkosConfig } from \"../../../../../exports\";\nimport prismaJsonSchemaGenerator from \"../../../../../utils/prisma/prisma-json-schema-generator\";\nimport prismaSchemaParser from \"../../../../../utils/prisma/prisma-schema-parser\";\n\nexport async function generatePrismaJsonSchemas(arkosConfig: ArkosConfig) {\n const requiredAppModules = [\n ...prismaSchemaParser.getModelsAsArrayOfStrings(),\n \"auth\",\n ];\n\n try {\n const modelSchemasArray = await Promise.all(\n requiredAppModules.map(async (modelName) => {\n const modelSchemas =\n await prismaJsonSchemaGenerator.generateModelSchemas({\n modelName,\n arkosConfig,\n });\n return modelSchemas;\n })\n );\n\n const schemas = modelSchemasArray.reduce((acc, modelSchemas) => {\n return { ...acc, ...modelSchemas };\n }, {});\n\n return schemas;\n } catch (err) {\n console.error(err);\n throw err;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"arkos-config.js","sourceRoot":"","sources":["../../../src/types/arkos-config.ts"],"names":[],"mappings":"","sourcesContent":["import http from \"http\";\nimport cors from \"cors\";\nimport express from \"express\";\nimport { Options as RateLimitOptions } from \"express-rate-limit\";\nimport cookieParser from \"cookie-parser\";\nimport compression from \"compression\";\nimport { Options as QueryParserOptions } from \"../utils/helpers/query-parser.helpers\";\nimport { ValidatorOptions } from \"class-validator\";\nimport { MsDuration } from \"../modules/auth/utils/helpers/auth.controller.helpers\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport type { ApiReferenceConfiguration } from \"@scalar/express-api-reference\" with { \"resolution-mode\": \"import\" };\nimport nodemailer from \"nodemailer\";\nimport { ModuleComponents } from \"../utils/dynamic-loader\";\n/**\n * Defines the initial configs of the api to be loaded at startup when arkos.init() is called.\n */\nexport type ArkosConfig = {\n /**\n * Allows to configure request configs\n */\n request?: {\n /**\n * Allows to configure request parameters\n */\n parameters?: {\n /**\n * Toggles allowing `VERY DANGEROUS` request paramateres under `req.query` for passing prisma query options.\n *\n * See more\n */\n allowDangerousPrismaQueryOptions?: boolean;\n };\n };\n /** Message you would like to send, as Json and 200 response when\n * ```curl\n * GET /api\n * ```\n *\n * ```json\n * { \"message\": \"Welcome to YourAppName\" }\n * ```\n *\n * default message is: Welcome to our Rest API generated by Arkos, find more about Arkos at www.arkosjs.com.\n *\n *\n * */\n welcomeMessage?: string;\n /**\n * Port where the application will run, can be set in 3 ways:\n *\n * 1. default is 8000\n * 2. PORT under environment variables (Lower precedence)\n * 3. this config option (Higher precedence)\n */\n port?: number | undefined;\n /**\n * Allows to listen on a different host than localhost only\n */\n host?: string;\n /**\n * Defines authentication related configurations, by default is undefined.\n *\n * See [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for details.\n */\n authentication?: {\n /**\n * Defines whether to use Static or Dynamic Role-Based Acess Control\n *\n * Visit [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for more details.\n */\n mode: \"static\" | \"dynamic\";\n /**\n * Defines auth login related configurations to customize the api.\n */\n login?: {\n /**\n * Defines the field that will be used as username by the built-in auth system, by default arkos will look for the field \"username\" in your model User, hence when making login for example you must send:\n *\n * ```json\n * {\n * \"username\": \"johndoe\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n *\n * **Note:** You can also modify the usernameField on the fly by passing it to the request query parameters. example:\n *\n * ```curl\n * POST /api/auth/login?usernameField=email\n * ```\n *\n * See more at [www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds](https://www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds)\n *\n * By specifing here another field for username, for example passing \"email\", \"companyCode\" or something else your json will be like:\n *\n * **Example with email**\n *\n * ```json\n * {\n * \"email\": \"john.doe@example.com\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n */\n allowedUsernames?: string[];\n /** Defines wether to send the access token in response after login or only send as cookie, defeault is both.*/\n sendAccessTokenThrough?: \"cookie-only\" | \"response-only\" | \"both\";\n };\n /**\n * Specifies the regex pattern used by the authentication system to enforce password strength requirements.\n *\n * **Important**: If using validation libraries like Zod or class-validator, this will be completely overwritten.\n *\n * **Default**: ```/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).+$/``` - Ensures the password contains at least one uppercase letter, one lowercase letter, and one numeric digit.\n *\n * **message**: (Optional) A custom error message to display when the password does not meet the required strength criteria.\n */\n passwordValidation?: { regex: RegExp; message?: string };\n /**\n * Allows to specify the request rate limit for all authentication endpoints but `/api/users/me`.\n * \n * #### Default\n *{\n windowMs: 5000,\n limit: 10,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n *@see This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n requestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * JWT (JSON Web Token) authentication configuration.\n *\n * You can override these values directly in code, or use environment variables:\n *\n * - `JWT_SECRET`: Secret used to sign and verify JWT tokens.\n * - `JWT_EXPIRES_IN`: Duration string or number indicating when the token should expire (e.g. \"30d\", 3600).\n * - `JWT_COOKIE_SECURE`: Whether the cookie is sent only over HTTPS. Default: `true` in production.\n * - `JWT_COOKIE_HTTP_ONLY`: Whether the cookie is HTTP-only. Default: `true`.\n * - `JWT_COOKIE_SAME_SITE`: Can be \"lax\", \"strict\", or \"none\". Defaults to \"lax\" in dev, \"none\" in prod.\n *\n * ⚠️ Values passed here take precedence over environment variables.\n */\n jwt?: {\n /** Secret key used for signing and verifying JWT tokens */\n secret?: string;\n /**\n * Duration after which the JWT token expires.\n * Accepts either a duration string (e.g. \"30d\", \"1h\") or a number in milliseconds.\n * Defaults to \"30d\" if not provided.\n */\n expiresIn?: MsDuration | number;\n\n /**\n * Configuration for the JWT cookie sent to the client\n */\n cookie?: {\n /**\n * Whether the cookie should be marked as secure (sent only over HTTPS).\n * Defaults to `true` in production and `false` in development.\n */\n secure?: boolean;\n\n /**\n * Whether the cookie should be marked as HTTP-only.\n * Default is `true` to prevent access via JavaScript.\n */\n httpOnly?: boolean;\n\n /**\n * Controls the SameSite attribute of the cookie.\n * Defaults to \"none\" in production and \"lax\" in development.\n * Options: \"lax\" | \"strict\" | \"none\"\n */\n sameSite?: \"lax\" | \"strict\" | \"none\";\n };\n };\n };\n /** Allows to customize and toggle the built-in validation, by default it is set to `false`. If true is passed it will use validation with the default resolver set to `class-validator` if you intend to change the resolver to `zod` do the following:\n *\n *```ts\n * // src/app.ts\n * import arkos from 'arkos'\n *\n * arkos.init({\n * validation: {\n * resolver: \"zod\"\n * }\n * })\n * ```\n *\n * @See [www.arkosjs.com/docs/core-concepts/request-data-validation](https://www.arkosjs.com/docs/core-concepts/request-data-validation) for more details.\n */\n validation?:\n | {\n resolver?: \"class-validator\";\n /**\n * ValidatorOptions to used while validating request data.\n *\n * **Default**:\n * ```ts\n * {\n * whitelist: true\n * }\n * ```\n */\n validationOptions?: ValidatorOptions;\n }\n | {\n resolver?: \"zod\";\n validationOptions?: Record<string, any>;\n };\n /**\n * Defines file upload configurations\n *\n * See [www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations](https://www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations)\n */\n fileUpload?: {\n /**\n * Defiens the base file upload directory, default is set to /uploads (on root directory)\n *\n * When setting up a path dir always now that root directory will be the starting reference.\n *\n * #### Example\n * passing `../my-arkos-uploaded-files`\n *\n * Will save uploaded files one level outside the root dir inside `my-arkos-uploaded-files`\n *\n * NB: You must be aware of permissions on your server to acess files outside your project directory.\n *\n */\n baseUploadDir?: string;\n /**\n * Changes the default `/api/uploads` base route for accessing file upload route.\n *\n * #### IMPORTANT\n * Changing this will not affect the `baseUploadDir` folder. You can\n * pass here `/api/files/my-user-files` and `baseUploadDir` be `/uploaded-files`.\n *\n */\n baseRoute?: string;\n /**\n * Defines options for `express.static(somePath, someOptions)`\n *\n * #### Default:\n *\n * ```ts\n *{\n maxAge: \"1y\",\n etag: true,\n lastModified: true,\n dotfiles: \"ignore\",\n fallthrough: true,\n index: false,\n cacheControl: true,\n }\n * ```\n * \n * By passing your custom options have in mind that it\n * will be deepmerged with the default.\n * \n * Visit [https://expressjs.com/en/4x/api.html#express.static](https://expressjs.com/en/4x/api.html#express.static) for more understanding.\n * \n */\n expressStaticOptions?: Parameters<typeof express.static>[1];\n /**\n * Defines upload restrictions for each file type: image, video, document or other.\n *\n * #### Important:\n * Passing an object without overriding everything will only cause it\n * to be deepmerged with the default options.\n *\n * See [www.arkosjs.com/docs/api-reference/default-supported-upload-files](https://www.arkosjs.com/docs/api-reference/default-supported-upload-files) for detailed explanation about default values.\n * ```\n */\n restrictions?: {\n images?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n videos?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n documents?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n files?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n };\n };\n /**\n * Allows to specify the request rate limit for all endpoints.\n * \n * #### Default\n *```ts\n *{\n windowMs: 60 * 1000,\n limit: 1000,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n ```\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n * This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n globalRequestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * Defines options for the built-in express.json() middleware\n * Nothing is passed by default.\n */\n jsonBodyParserOptions?: Parameters<typeof express.json>[0];\n /**\n * Allows to pass paremeters to cookieParser from npm package cookie-parser\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/cookie-parser](https://www.npmjs.com/package/cookie-parser) for further details.\n */\n cookieParserParameters?: Parameters<typeof cookieParser>;\n /**\n * Allows to define options for npm package compression\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/compression](https://www.npmjs.com/package/compression) for further details.\n */\n compressionOptions?: compression.CompressionOptions;\n /**\n * Options to define how query must be parsed.\n *\n * #### for example:\n * ```\n * GET /api/product?saleId=null\n * ```\n *\n * Normally would parsed to { saleId: \"null\" } so query parser\n * trough setting option `parseNull` will transform { saleId: null }\n * \n * #### Default:\n * \n * {\n parseNull: true,\n parseUndefined: true,\n parseBoolean: true,\n }\n * \n * parseNumber may convert fields that are string but you only passed\n * numbers to query pay attention to this.\n * \n * Soon a feature to converted the query to the end prisma type will be added.\n */\n queryParserOptions?: QueryParserOptions;\n /**\n * Configuration for CORS (Cross-Origin Resource Sharing).\n *\n * @property {string | string[] | \"all\"} [allowedOrigins] - List of allowed origins. If set to `\"all\"`, all origins are accepted.\n * @property {import('cors').CorsOptions} [options] - Additional CORS options passed directly to the `cors` middleware.\n * @property {import('cors').CorsOptionsDelegate} [customMiddleware] - A custom middleware function that overrides the default behavior.\n *\n * @remarks\n * If `customMiddleware` is provided, both `allowedOrigins` and `options` will be ignored in favor of the custom logic.\n *\n * See https://www.npmjs.com/package/cors\n */\n cors?: {\n /**\n * Defines allowed origins to acess the API.\n */\n allowedOrigins?: string | string[] | \"*\";\n options?: cors.CorsOptions;\n /**\n * If you would like to override the entire middleware\n *\n * see\n */\n customHandler?: cors.CorsOptionsDelegate;\n };\n /**\n * Defines express/arkos middlewares configurations\n */\n middlewares?: {\n /**\n * Allows to add an array of custom express middlewares into the default middleware stack.\n *\n * **Tip**: If you would like to acess the express app before everthing use `configureApp` and pass a function.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order](https://www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order)\n *\n * **Note**: If you want to use custom global error handler middleware use `middlewares.replace.globalErrorHandler`.\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.RequestHandler[];\n /**\n * An array containing a list of defaults middlewares to be disabled\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n *\n */\n disable?: (\n | \"compression\"\n | \"global-rate-limit\"\n | \"auth-rate-limit\"\n | \"cors\"\n | \"express-json\"\n | \"cookie-parser\"\n | \"query-parser\"\n | \"request-logger\"\n | \"global-error-handler\"\n )[];\n /**\n * Allows you to replace each of the built-in middlewares with your own implementation\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default compression middleware\n */\n compression?: express.RequestHandler;\n /**\n * Replace the default global rate limit middleware\n */\n globalRateLimit?: express.RequestHandler;\n /**\n * Replace the default authentication rate limit middleware\n */\n authRateLimit?: express.RequestHandler;\n /**\n * Replace the default CORS middleware\n */\n cors?: express.RequestHandler;\n /**\n * Replace the default JSON body parser middleware\n */\n expressJson?: express.RequestHandler;\n /**\n * Replace the default cookie parser middleware\n */\n cookieParser?: express.RequestHandler;\n /**\n * Replace the default query parser middleware\n */\n queryParser?: express.RequestHandler;\n /**\n * Replace the default request logger middleware\n */\n requestLogger?: express.RequestHandler;\n /**\n * Replace the default global error handler middleware\n */\n globalErrorHandler?: express.ErrorRequestHandler;\n };\n };\n /**\n * Defines express/arkos routers configurations\n */\n routers?: {\n /**\n * Strict mode configuration for routing security\n *\n * @default false\n * - all CRUD + Auth (if using auth) endpoits are enabled and avialable by default.\n *\n * When enabled:\n * - If `true`: All CRUD endpoints start disabled and must be explicitly enabled\n * in each model's router configuration\n * - If `'no-bulk'`: Bulk operations (createMany, updateMany, deleteMany) are disabled\n * by default, while individual operations can be enabled per model\n *\n * This provides enhanced security by ensuring no routes are accidentally exposed.\n * Use this in production environments to follow the principle of least privilege.\n *\n * See documentation: https://www.arkosjs.com/docs/guide/security#strict-mode\n */\n strict?: boolean | \"no-bulk\";\n /**\n * Allows to add an array of custom express routers into the default middleware/router stack.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/adding-custom-routers](https://www.arkosjs.com/docs/advanced-guide/adding-custom-routers)\n *\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.Router[];\n disable?: (\n | \"auth-router\"\n | \"prisma-models-router\"\n | \"file-upload\"\n | \"welcome-endpoint\"\n )[];\n /**\n * Allows you to replace each of the built-in routers with your own implementation.\n *\n * **Note**: Doing this you will lose all default middleware chaining, auth control, handlers from the specific router.\n *\n * **Tip**: I you want to disable some prisma models specific endpoint\n * see [www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints](https://www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints)\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default authentication router\n * @param config The original Arkos configuration\n * @returns A router handling authentication endpoints\n */\n authRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default Prisma models router\n * @param config The original Arkos configuration\n * @returns A router handling Prisma model endpoints\n */\n prismaModelsRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default file upload router\n * @param config The original Arkos configuration\n * @returns A router handling file upload endpoints\n */\n fileUpload?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default welcome endpoint handler\n * @param req Express request object\n * @param res Express response object\n * @param next Express next function\n */\n welcomeEndpoint?: express.RequestHandler;\n };\n };\n /**\n * Gives acess to the underlying express app so that you can add custom configurations beyong **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `app.listen` for you.\n *\n * If you want to call `app.listen` by yourself pass port as `undefined` and then use the return app from `arkos.init()`.\n *\n * See how to call `app.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself](https://www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app](https://www.arkosjs.com/docs/guide/accessing-the-express-app) for further details on the method configureApp.\n *\n * @param {express.Express} app\n * @returns {any}\n */\n configureApp?: (app: express.Express) => Promise<any> | any;\n /**\n * Gives access to the underlying HTTP server so that you can add custom configurations beyond **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `server.listen` for you.\n *\n * If you want to call `server.listen` by yourself pass port as `undefined` and then use the return server from `arkos.init()`.\n *\n * See how to call `server.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server) for further details on the method configureServer.\n *\n * @param {http.Server} server - The HTTP server instance\n * @returns {any}\n */\n configureServer?: (server: http.Server) => Promise<any> | any;\n /**\n * Allows to configure email configurations for sending emails through `emailService`\n *\n * See [www.arkosjs.com/docs/core-concepts/sending-emails](https://www.arkosjs.com/docs/core-concepts/sending-emails)\n */\n email?: {\n /**\n * Email name to used like:\n *\n * John Doe\\<john.doe@gmail.com>\n */\n name?: string;\n /**\n * Your email provider url\n */\n host: string;\n /**\n * Email provider SMTP port, Default is `465`\n */\n port?: number;\n /**\n * If smtp connection must be secure, Default is `true`\n */\n secure?: boolean;\n /**\n * Used to authenticate in your smtp server\n */\n auth: {\n /**\n * Email used for auth as well as sending emails\n */\n user: string;\n /**\n * Your SMTP password\n */\n pass: string;\n };\n } & Parameters<typeof nodemailer.createTransport>[0];\n /**\n * Defines Swagger and OpenApi specifications for auto generating swagger documentation UI using whether it is Prisma Schemas, Class-validator DTOs, Zod Schemas or JSON-Schemas.\n *\n * **Important**: Is worth mentioning that this works alongside `@scalar/express-api-reference` npm package, you define it's ApiReferenceConfiguration under ``. also consider checking the package documentation at []\n *\n * **Usage**\n *\n * ```ts\n * // src/app.ts\n *\n * import arkos from \"arkos\"\n *\n * arkos.init({\n * // other configs\n * swagger: {\n * mode: \"zod\",\n * options: {\n * defintion: {\n * info: {\n * openapi: \"3.0.0\",\n * title: \"API Generated By Arkos.js\",\n * description: \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n * }\n * }\n * }\n * }\n * })\n * ```\n * @see {@link https://www.arkosjs.com/docs/core-concepts/swagger-api-documentation}\n */\n swagger?: {\n /**\n * By default Arkos will disable API Documentation when the project is built `npm run build`, it does not matter what node environment is set. If you want to use it even after the `arkos build` command just set this to `true`.\n * */\n enableAfterBuild?: boolean;\n /**\n * Endpoint where the Swagger UI will be available.\n *\n * @default \"/api/api-docs\"\n */\n endpoint?: string;\n /**\n * Determines how your API schemas should be generated.\n *\n * - \"prisma\": Generates schemas based on Prisma models\n * - \"class-validator\": Uses class-validator and class-transformer DTO classes\n * - \"zod\": Uses OpenAPI-compliant schemas directly\n */\n mode: \"prisma\" | \"class-validator\" | \"zod\";\n /**\n * Allows `Arkos.js` to fallback to prisma schema and use them as json schema for defining request body and response data\n * when a given zod Schema or class-validator Class is not found to be transformed to json schema.\n *\n * @default false\n */\n strict?: boolean;\n /**\n * Defines your swagger configurations\n */\n options?: {\n /**\n * Swagger definition according to OpenAPI Specification.\n */\n definition?: {\n /**\n * OpenAPI version.\n *\n * @default \"3.0.0\"\n */\n openapi?: string;\n\n /**\n * Information about your API.\n */\n info?: {\n /**\n * Title of the API documentation.\n *\n *\n * @example \"My API\"\n *\n * @default \"API Generated By Arkos.js\"\n */\n title?: string;\n\n /**\n * Version of the API.\n *\n * @example \"1.0.0\"\n */\n version?: string;\n\n /**\n * Description of the API.\n *\n * @default \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n */\n description?: string;\n };\n\n /**\n * Server configurations for the API.\n *\n * @default [{ url: \"http://localhost:8000\", description: \"Development server\" }]\n *\n * This can be overridden automatically by Arkos based on CLI, .env, or `arkos.init()`.\n */\n servers?: {\n /**\n * Base URL of the server.\n *\n * @example \"http://localhost:8000\"\n */\n url: string;\n\n /**\n * Human-readable description of the server.\n *\n * @example \"Development Server\"\n */\n description?: string;\n }[];\n /**\n * Allows adding more paths for your OpenAPI documentation\n *\n * */\n paths?: OpenAPIV3.PathsObject;\n /**\n * (Optional) Additional metadata such as terms of service, contact, or license.\n *\n * See: https://swagger.io/specification/#infoObject\n */\n termsOfService?: string;\n contact?: {\n name?: string;\n url?: string;\n email?: string;\n };\n license?: {\n name: string;\n url?: string;\n };\n\n /**\n * Tags to group and describe endpoints.\n */\n tags?: {\n name: string;\n description?: string;\n }[];\n\n /**\n * Security definitions (e.g., Bearer Auth).\n */\n components?: {\n securitySchemes?: Record<string, any>;\n schemas?: Record<string, any>;\n };\n\n /**\n * Global security requirements.\n */\n security?: Array<Record<string, string[]>>;\n };\n\n /**\n * Glob patterns defining where Swagger should look for API route definitions and comments.\n *\n * @default \n * ```ts\n * [\"./src/routers/*.router.{ts,js}\", \"./src/modules/**\\/*.router.{ts,js}\"]\n ```\n *\n * Adjust depending on TypeScript or JavaScript usage.\n */\n apis?: string[];\n\n /**\n * Enables deep linking in the Swagger UI.\n *\n * @default true\n */\n deepLinking?: boolean;\n\n /**\n * Enable/disable the \"Try it out\" button globally.\n *\n * @default true\n */\n tryItOutEnabled?: boolean;\n\n /**\n * Whether to persist authorization data across page reloads.\n *\n * @default false\n */\n persistAuthorization?: boolean;\n };\n /**\n * Custom `@scalar/express-api-reference` package options.\n *\n * @see {@link https://guides.scalar.com/scalar/scalar-api-references/integrations/express}\n */\n scalarApiReferenceConfiguration?: Partial<ApiReferenceConfiguration>;\n };\n /**\n * Helps in debugging some of the variables values that are used inside arkos from dynamic loaded components towhat is used into the generated api.\n *\n */\n debugging?: {\n /**\n * Controls debugging over HTTP request level\n */\n requests?: {\n level?: 0 | 1 | 2 | 3;\n filter?: (\n | \"Query\"\n | \"Body\"\n | \"TransformedQuery\"\n | \"ServiceArgs\"\n | \"FinalPrismaQueryArgs\"\n )[];\n };\n /**\n * Controls debugging over the dynamic loaded modules and it's components on app starting\n */\n dynamicLoader?: {\n /**\n * Adjusts logging details\n *\n * 1 - Loaded modules and list of it's components files\n * 2 - All from 1 and detailed inspection per module component\n * 3 - All from 1 and 2, plus the final router component after merged with autho generated router.\n */\n level?: 0 | 1 | 2 | 3;\n filters?: {\n /**\n * Allows filtering by specific modules.\n *\n * Supports only searching for the starting parts of the module name, e.g: If there is`user-profile`, `user`, `posts`, passing `[\"user\"]` will match both `user-profile` and `user`.\n */\n modules?: string[];\n /**\n * Allows filtering by component's names\n */\n components?: keyof ModuleComponents[];\n };\n };\n };\n};\n"]}
1
+ {"version":3,"file":"arkos-config.js","sourceRoot":"","sources":["../../../src/types/arkos-config.ts"],"names":[],"mappings":"","sourcesContent":["import http from \"http\";\nimport cors from \"cors\";\nimport express from \"express\";\nimport { Options as RateLimitOptions } from \"express-rate-limit\";\nimport cookieParser from \"cookie-parser\";\nimport compression from \"compression\";\nimport { Options as QueryParserOptions } from \"../utils/helpers/query-parser.helpers\";\nimport { ValidatorOptions } from \"class-validator\";\nimport { MsDuration } from \"../modules/auth/utils/helpers/auth.controller.helpers\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport type { ApiReferenceConfiguration } from \"@scalar/express-api-reference\" with { \"resolution-mode\": \"import\" };\nimport nodemailer from \"nodemailer\";\nimport { ModuleComponents } from \"../utils/dynamic-loader\";\n/**\n * Defines the initial configs of the api to be loaded at startup when arkos.init() is called.\n */\nexport type ArkosConfig = {\n /**\n * Allows to configure request configs\n */\n request?: {\n /**\n * Allows to configure request parameters\n */\n parameters?: {\n /**\n * Toggles allowing `VERY DANGEROUS` request paramateres under `req.query` for passing prisma query options.\n *\n * See more\n */\n allowDangerousPrismaQueryOptions?: boolean;\n };\n };\n /** Message you would like to send, as Json and 200 response when\n * ```curl\n * GET /api\n * ```\n *\n * ```json\n * { \"message\": \"Welcome to YourAppName\" }\n * ```\n *\n * default message is: Welcome to our Rest API generated by Arkos, find more about Arkos at www.arkosjs.com.\n *\n *\n * */\n welcomeMessage?: string;\n /**\n * Port where the application will run, can be set in 3 ways:\n *\n * 1. default is 8000\n * 2. PORT under environment variables (Lower precedence)\n * 3. this config option (Higher precedence)\n */\n port?: number | undefined;\n /**\n * Allows to listen on a different host than localhost only\n */\n host?: string;\n /**\n * Defines authentication related configurations, by default is undefined.\n *\n * See [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for details.\n */\n authentication?: {\n /**\n * Defines whether to use Static or Dynamic Role-Based Acess Control\n *\n * Visit [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for more details.\n */\n mode: \"static\" | \"dynamic\";\n /**\n * Defines auth login related configurations to customize the api.\n */\n login?: {\n /**\n * Defines the field that will be used as username by the built-in auth system, by default arkos will look for the field \"username\" in your model User, hence when making login for example you must send:\n *\n * ```json\n * {\n * \"username\": \"johndoe\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n *\n * **Note:** You can also modify the usernameField on the fly by passing it to the request query parameters. example:\n *\n * ```curl\n * POST /api/auth/login?usernameField=email\n * ```\n *\n * See more at [www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds](https://www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds)\n *\n * By specifing here another field for username, for example passing \"email\", \"companyCode\" or something else your json will be like:\n *\n * **Example with email**\n *\n * ```json\n * {\n * \"email\": \"john.doe@example.com\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n */\n allowedUsernames?: string[];\n /** Defines wether to send the access token in response after login or only send as cookie, defeault is both.*/\n sendAccessTokenThrough?: \"cookie-only\" | \"response-only\" | \"both\";\n };\n /**\n * Specifies the regex pattern used by the authentication system to enforce password strength requirements.\n *\n * **Important**: If using validation libraries like Zod or class-validator, this will be completely overwritten.\n *\n * **Default**: ```/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).+$/``` - Ensures the password contains at least one uppercase letter, one lowercase letter, and one numeric digit.\n *\n * **message**: (Optional) A custom error message to display when the password does not meet the required strength criteria.\n */\n passwordValidation?: { regex: RegExp; message?: string };\n /**\n * Allows to specify the request rate limit for all authentication endpoints but `/api/users/me`.\n * \n * #### Default\n *{\n windowMs: 5000,\n limit: 10,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n *@see This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n requestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * JWT (JSON Web Token) authentication configuration.\n *\n * You can override these values directly in code, or use environment variables:\n *\n * - `JWT_SECRET`: Secret used to sign and verify JWT tokens.\n * - `JWT_EXPIRES_IN`: Duration string or number indicating when the token should expire (e.g. \"30d\", 3600).\n * - `JWT_COOKIE_SECURE`: Whether the cookie is sent only over HTTPS. Default: `true` in production.\n * - `JWT_COOKIE_HTTP_ONLY`: Whether the cookie is HTTP-only. Default: `true`.\n * - `JWT_COOKIE_SAME_SITE`: Can be \"lax\", \"strict\", or \"none\". Defaults to \"lax\" in dev, \"none\" in prod.\n *\n * ⚠️ Values passed here take precedence over environment variables.\n */\n jwt?: {\n /** Secret key used for signing and verifying JWT tokens */\n secret?: string;\n /**\n * Duration after which the JWT token expires.\n * Accepts either a duration string (e.g. \"30d\", \"1h\") or a number in milliseconds.\n * Defaults to \"30d\" if not provided.\n */\n expiresIn?: MsDuration | number;\n\n /**\n * Configuration for the JWT cookie sent to the client\n */\n cookie?: {\n /**\n * Whether the cookie should be marked as secure (sent only over HTTPS).\n * Defaults to `true` in production and `false` in development.\n */\n secure?: boolean;\n\n /**\n * Whether the cookie should be marked as HTTP-only.\n * Default is `true` to prevent access via JavaScript.\n */\n httpOnly?: boolean;\n\n /**\n * Controls the SameSite attribute of the cookie.\n * Defaults to \"none\" in production and \"lax\" in development.\n * Options: \"lax\" | \"strict\" | \"none\"\n */\n sameSite?: \"lax\" | \"strict\" | \"none\";\n };\n };\n };\n /** Allows to customize and toggle the built-in validation, by default it is set to `false`. If true is passed it will use validation with the default resolver set to `class-validator` if you intend to change the resolver to `zod` do the following:\n *\n *```ts\n * // src/app.ts\n * import arkos from 'arkos'\n *\n * arkos.init({\n * validation: {\n * resolver: \"zod\"\n * }\n * })\n * ```\n *\n * @See [www.arkosjs.com/docs/core-concepts/request-data-validation](https://www.arkosjs.com/docs/core-concepts/request-data-validation) for more details.\n */\n validation?:\n | {\n resolver?: \"class-validator\";\n /**\n * ValidatorOptions to used while validating request data.\n *\n * **Default**:\n * ```ts\n * {\n * whitelist: true\n * }\n * ```\n */\n validationOptions?: ValidatorOptions;\n }\n | {\n resolver?: \"zod\";\n validationOptions?: Record<string, any>;\n };\n /**\n * Defines file upload configurations\n *\n * See [www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations](https://www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations)\n */\n fileUpload?: {\n /**\n * Defiens the base file upload directory, default is set to /uploads (on root directory)\n *\n * When setting up a path dir always now that root directory will be the starting reference.\n *\n * #### Example\n * passing `../my-arkos-uploaded-files`\n *\n * Will save uploaded files one level outside the root dir inside `my-arkos-uploaded-files`\n *\n * NB: You must be aware of permissions on your server to acess files outside your project directory.\n *\n */\n baseUploadDir?: string;\n /**\n * Changes the default `/api/uploads` base route for accessing file upload route.\n *\n * #### IMPORTANT\n * Changing this will not affect the `baseUploadDir` folder. You can\n * pass here `/api/files/my-user-files` and `baseUploadDir` be `/uploaded-files`.\n *\n */\n baseRoute?: string;\n /**\n * Defines options for `express.static(somePath, someOptions)`\n *\n * #### Default:\n *\n * ```ts\n *{\n maxAge: \"1y\",\n etag: true,\n lastModified: true,\n dotfiles: \"ignore\",\n fallthrough: true,\n index: false,\n cacheControl: true,\n }\n * ```\n * \n * By passing your custom options have in mind that it\n * will be deepmerged with the default.\n * \n * Visit [https://expressjs.com/en/4x/api.html#express.static](https://expressjs.com/en/4x/api.html#express.static) for more understanding.\n * \n */\n expressStaticOptions?: Parameters<typeof express.static>[1];\n /**\n * Defines upload restrictions for each file type: image, video, document or other.\n *\n * #### Important:\n * Passing an object without overriding everything will only cause it\n * to be deepmerged with the default options.\n *\n * See [www.arkosjs.com/docs/api-reference/default-supported-upload-files](https://www.arkosjs.com/docs/api-reference/default-supported-upload-files) for detailed explanation about default values.\n * ```\n */\n restrictions?: {\n images?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n videos?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n documents?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n files?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n };\n };\n /**\n * Allows to specify the request rate limit for all endpoints.\n * \n * #### Default\n *```ts\n *{\n windowMs: 60 * 1000,\n limit: 1000,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n ```\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n * This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n globalRequestRateLimitOptions?: Partial<RateLimitOptions>;\n /**\n * Defines options for the built-in express.json() middleware\n * Nothing is passed by default.\n */\n jsonBodyParserOptions?: Parameters<typeof express.json>[0];\n /**\n * Allows to pass paremeters to cookieParser from npm package cookie-parser\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/cookie-parser](https://www.npmjs.com/package/cookie-parser) for further details.\n */\n cookieParserParameters?: Parameters<typeof cookieParser>;\n /**\n * Allows to define options for npm package compression\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/compression](https://www.npmjs.com/package/compression) for further details.\n */\n compressionOptions?: compression.CompressionOptions;\n /**\n * Options to define how query must be parsed.\n *\n * #### for example:\n * ```\n * GET /api/product?saleId=null\n * ```\n *\n * Normally would parsed to { saleId: \"null\" } so query parser\n * trough setting option `parseNull` will transform { saleId: null }\n * \n * #### Default:\n * \n * {\n parseNull: true,\n parseUndefined: true,\n parseBoolean: true,\n }\n * \n * parseNumber may convert fields that are string but you only passed\n * numbers to query pay attention to this.\n * \n * Soon a feature to converted the query to the end prisma type will be added.\n */\n queryParserOptions?: QueryParserOptions;\n /**\n * Configuration for CORS (Cross-Origin Resource Sharing).\n *\n * @property {string | string[] | \"all\"} [allowedOrigins] - List of allowed origins. If set to `\"all\"`, all origins are accepted.\n * @property {import('cors').CorsOptions} [options] - Additional CORS options passed directly to the `cors` middleware.\n * @property {import('cors').CorsOptionsDelegate} [customMiddleware] - A custom middleware function that overrides the default behavior.\n *\n * @remarks\n * If `customMiddleware` is provided, both `allowedOrigins` and `options` will be ignored in favor of the custom logic.\n *\n * See https://www.npmjs.com/package/cors\n */\n cors?: {\n /**\n * Defines allowed origins to acess the API.\n */\n allowedOrigins?: string | string[] | \"*\";\n options?: cors.CorsOptions;\n /**\n * If you would like to override the entire middleware\n *\n * see\n */\n customHandler?: cors.CorsOptionsDelegate;\n };\n /**\n * Defines express/arkos middlewares configurations\n */\n middlewares?: {\n /**\n * Allows to add an array of custom express middlewares into the default middleware stack.\n *\n * **Tip**: If you would like to acess the express app before everthing use `configureApp` and pass a function.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order](https://www.arkosjs.com/docs/advanced-guide/replace-or-disable-built-in-middlewares#middleware-execution-order)\n *\n * **Note**: If you want to use custom global error handler middleware use `middlewares.replace.globalErrorHandler`.\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.RequestHandler[];\n /**\n * An array containing a list of defaults middlewares to be disabled\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n *\n */\n disable?: (\n | \"compression\"\n | \"global-rate-limit\"\n | \"auth-rate-limit\"\n | \"cors\"\n | \"express-json\"\n | \"cookie-parser\"\n | \"query-parser\"\n | \"request-logger\"\n | \"global-error-handler\"\n )[];\n /**\n * Allows you to replace each of the built-in middlewares with your own implementation\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default compression middleware\n */\n compression?: express.RequestHandler;\n /**\n * Replace the default global rate limit middleware\n */\n globalRateLimit?: express.RequestHandler;\n /**\n * Replace the default authentication rate limit middleware\n */\n authRateLimit?: express.RequestHandler;\n /**\n * Replace the default CORS middleware\n */\n cors?: express.RequestHandler;\n /**\n * Replace the default JSON body parser middleware\n */\n expressJson?: express.RequestHandler;\n /**\n * Replace the default cookie parser middleware\n */\n cookieParser?: express.RequestHandler;\n /**\n * Replace the default query parser middleware\n */\n queryParser?: express.RequestHandler;\n /**\n * Replace the default request logger middleware\n */\n requestLogger?: express.RequestHandler;\n /**\n * Replace the default global error handler middleware\n */\n globalErrorHandler?: express.ErrorRequestHandler;\n };\n };\n /**\n * Defines express/arkos routers configurations\n */\n routers?: {\n /**\n * Strict mode configuration for routing security\n *\n * @default false\n * - all CRUD + Auth (if using auth) endpoits are enabled and avialable by default.\n *\n * When enabled:\n * - If `true`: All CRUD endpoints start disabled and must be explicitly enabled\n * in each model's router configuration\n * - If `'no-bulk'`: Bulk operations (createMany, updateMany, deleteMany) are disabled\n * by default, while individual operations can be enabled per model\n *\n * This provides enhanced security by ensuring no routes are accidentally exposed.\n * Use this in production environments to follow the principle of least privilege.\n *\n * See documentation: https://www.arkosjs.com/docs/guide/security#strict-mode\n */\n strict?: boolean | \"no-bulk\";\n /**\n * Allows to add an array of custom express routers into the default middleware/router stack.\n *\n * **Where will these be placed?**: see [www.arkosjs.com/docs/advanced-guide/adding-custom-routers](https://www.arkosjs.com/docs/advanced-guide/adding-custom-routers)\n *\n *\n * Read more about The Arkos Middleware Stack at [www.arkosjs.com/docs/the-middleware-stack](https://www.arkosjs.com/docs/the-middleware-stack) for in-depth details.\n */\n additional?: express.Router[];\n disable?: (\n | \"auth-router\"\n | \"prisma-models-router\"\n | \"file-upload\"\n | \"welcome-endpoint\"\n )[];\n /**\n * Allows you to replace each of the built-in routers with your own implementation.\n *\n * **Note**: Doing this you will lose all default middleware chaining, auth control, handlers from the specific router.\n *\n * **Tip**: I you want to disable some prisma models specific endpoint\n * see [www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints](https://www.arkosjs.com/docs/guide/adding-custom-routers#disabling-auto-generated-endpoints)\n *\n * **Caution**: Be careful with this because you may endup breaking your entire application.\n */\n replace?: {\n /**\n * Replace the default authentication router\n * @param config The original Arkos configuration\n * @returns A router handling authentication endpoints\n */\n authRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default Prisma models router\n * @param config The original Arkos configuration\n * @returns A router handling Prisma model endpoints\n */\n prismaModelsRouter?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default file upload router\n * @param config The original Arkos configuration\n * @returns A router handling file upload endpoints\n */\n fileUpload?: (\n config: ArkosConfig\n ) => express.Router | Promise<express.Router>;\n /**\n * Replace the default welcome endpoint handler\n * @param req Express request object\n * @param res Express response object\n * @param next Express next function\n */\n welcomeEndpoint?: express.RequestHandler;\n };\n };\n /**\n * Gives acess to the underlying express app so that you can add custom configurations beyong **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `app.listen` for you.\n *\n * If you want to call `app.listen` by yourself pass port as `undefined` and then use the return app from `arkos.init()`.\n *\n * See how to call `app.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself](https://www.arkosjs.com/docs/guide/accessing-the-express-app#calling-applisten-by-yourself)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app](https://www.arkosjs.com/docs/guide/accessing-the-express-app) for further details on the method configureApp.\n *\n * @param {express.Express} app\n * @returns {any}\n */\n configureApp?: (app: express.Express) => Promise<any> | any;\n /**\n * Gives access to the underlying HTTP server so that you can add custom configurations beyond **Arkos** customization capabilities\n *\n * **Note**: In the end **Arkos** will call `server.listen` for you.\n *\n * If you want to call `server.listen` by yourself pass port as `undefined` and then use the return server from `arkos.init()`.\n *\n * See how to call `server.listen` correctly [www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#creating-your-own-http-server)\n *\n * See [www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server](https://www.arkosjs.com/docs/guide/accessing-the-express-app#accessing-the-http-server) for further details on the method configureServer.\n *\n * @param {http.Server} server - The HTTP server instance\n * @returns {any}\n */\n configureServer?: (server: http.Server) => Promise<any> | any;\n /**\n * Allows to configure email configurations for sending emails through `emailService`\n *\n * See [www.arkosjs.com/docs/core-concepts/sending-emails](https://www.arkosjs.com/docs/core-concepts/sending-emails)\n */\n email?: {\n /**\n * Email name to used like:\n *\n * John Doe\\<john.doe@gmail.com>\n */\n name?: string;\n /**\n * Your email provider url\n */\n host: string;\n /**\n * Email provider SMTP port, Default is `465`\n */\n port?: number;\n /**\n * If smtp connection must be secure, Default is `true`\n */\n secure?: boolean;\n /**\n * Used to authenticate in your smtp server\n */\n auth: {\n /**\n * Email used for auth as well as sending emails\n */\n user: string;\n /**\n * Your SMTP password\n */\n pass: string;\n };\n } & Parameters<typeof nodemailer.createTransport>[0];\n /**\n * Defines Swagger and OpenApi specifications for auto generating swagger documentation UI using whether it is Prisma Schemas, Class-validator DTOs, Zod Schemas or JSON-Schemas.\n *\n * **Important**: Is worth mentioning that this works alongside `@scalar/express-api-reference` npm package, you define it's ApiReferenceConfiguration under ``. also consider checking the package documentation at []\n *\n * **Usage**\n *\n * ```ts\n * // src/app.ts\n *\n * import arkos from \"arkos\"\n *\n * arkos.init({\n * // other configs\n * swagger: {\n * mode: \"zod\",\n * options: {\n * defintion: {\n * info: {\n * openapi: \"3.0.0\",\n * title: \"API Generated By Arkos.js\",\n * description: \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n * }\n * }\n * }\n * }\n * })\n * ```\n * @see {@link https://www.arkosjs.com/docs/core-concepts/swagger-api-documentation}\n */\n swagger?: {\n /**\n * By default Arkos will disable API Documentation when the project is built `npm run build`, it does not matter what node environment is set. If you want to use it even after the `arkos build` command just set this to `true`.\n * */\n enableAfterBuild?: boolean;\n /**\n * Endpoint where the Swagger UI will be available.\n *\n * @default \"/api/api-docs\"\n */\n endpoint?: string;\n /**\n * Determines how your API schemas should be generated.\n *\n * - \"prisma\": Generates schemas based on Prisma models\n * - \"class-validator\": Uses class-validator and class-transformer DTO classes\n * - \"zod\": Uses OpenAPI-compliant schemas directly\n */\n mode: \"prisma\" | \"class-validator\" | \"zod\";\n /**\n * Allows `Arkos.js` to fallback to prisma schema and use them as json schema for defining request body and response data\n * when a given zod Schema or class-validator Class is not found to be transformed to json schema.\n *\n * @default false\n */\n strict?: boolean;\n /**\n * Defines your swagger configurations\n */\n options?: {\n /**\n * Swagger definition according to OpenAPI Specification.\n */\n definition?: {\n /**\n * OpenAPI version.\n *\n * @default \"3.0.0\"\n */\n openapi?: string;\n\n /**\n * Information about your API.\n */\n info?: {\n /**\n * Title of the API documentation.\n *\n *\n * @example \"My API\"\n *\n * @default \"API Generated By Arkos.js\"\n */\n title?: string;\n\n /**\n * Version of the API.\n *\n * @example \"1.0.0\"\n */\n version?: string;\n\n /**\n * Description of the API.\n *\n * @default \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n */\n description?: string;\n };\n\n /**\n * Server configurations for the API.\n *\n * @default [{ url: \"http://localhost:8000\", description: \"Development server\" }]\n *\n * This can be overridden automatically by Arkos based on CLI, .env, or `arkos.init()`.\n */\n servers?: {\n /**\n * Base URL of the server.\n *\n * @example \"http://localhost:8000\"\n */\n url: string;\n\n /**\n * Human-readable description of the server.\n *\n * @example \"Development Server\"\n */\n description?: string;\n }[];\n /**\n * Allows adding more paths for your OpenAPI documentation\n *\n * */\n paths?: OpenAPIV3.PathsObject;\n /**\n * (Optional) Additional metadata such as terms of service, contact, or license.\n *\n * See: https://swagger.io/specification/#infoObject\n */\n termsOfService?: string;\n contact?: {\n name?: string;\n url?: string;\n email?: string;\n };\n license?: {\n name: string;\n url?: string;\n };\n\n /**\n * Tags to group and describe endpoints.\n */\n tags?: {\n name: string;\n description?: string;\n }[];\n\n /**\n * Security definitions (e.g., Bearer Auth).\n */\n components?: {\n securitySchemes?: Record<string, any>;\n schemas?: Record<string, any>;\n };\n\n /**\n * Global security requirements.\n */\n security?: Array<Record<string, string[]>>;\n };\n\n /**\n * Glob patterns defining where Swagger should look for API route definitions and comments.\n *\n * @default \n * ```ts\n * [\"./src/routers/*.router.{ts,js}\", \"./src/modules/**\\/*.router.{ts,js}\"]\n ```\n *\n * Adjust depending on TypeScript or JavaScript usage.\n */\n apis?: string[];\n\n /**\n * Enables deep linking in the Swagger UI.\n *\n * @default true\n */\n deepLinking?: boolean;\n\n /**\n * Enable/disable the \"Try it out\" button globally.\n *\n * @default true\n */\n tryItOutEnabled?: boolean;\n\n /**\n * Whether to persist authorization data across page reloads.\n *\n * @default false\n */\n persistAuthorization?: boolean;\n };\n /**\n * Custom `@scalar/express-api-reference` package options.\n *\n * @see {@link https://guides.scalar.com/scalar/scalar-api-references/integrations/express}\n */\n scalarApiReferenceConfiguration?: Partial<ApiReferenceConfiguration>;\n };\n /**\n * Helps in debugging some of the variables values that are used inside arkos from dynamic loaded components towhat is used into the generated api.\n *\n */\n debugging?: {\n /**\n * Controls debugging over HTTP request level\n */\n requests?: {\n level?: 0 | 1 | 2 | 3;\n filter?: (\n | \"Query\"\n | \"Body\"\n | \"Params\"\n | \"TransformedQuery\"\n | \"ServiceArgs\"\n | \"FinalPrismaQueryArgs\"\n )[];\n };\n /**\n * Controls debugging over the dynamic loaded modules and it's components on app starting\n */\n dynamicLoader?: {\n /**\n * Adjusts logging details\n *\n * 1 - Loaded modules and list of it's components files\n * 2 - All from 1 and detailed inspection per module component\n * 3 - All from 1 and 2, plus the final router component after merged with autho generated router.\n */\n level?: 0 | 1 | 2 | 3;\n filters?: {\n /**\n * Allows filtering by specific modules.\n *\n * Supports only searching for the starting parts of the module name, e.g: If there is`user-profile`, `user`, `posts`, passing `[\"user\"]` will match both `user-profile` and `user`.\n */\n modules?: string[];\n /**\n * Allows filtering by component's names\n */\n components?: keyof ModuleComponents[];\n };\n };\n };\n};\n"]}
@@ -83,7 +83,7 @@ exports.generateCommand = {
83
83
  interceptors: async (options) => {
84
84
  await generateFile(options, {
85
85
  templateName: "interceptors",
86
- fileSuffix: "middlewares",
86
+ fileSuffix: "interceptors",
87
87
  });
88
88
  },
89
89
  authConfigs: async (options) => {