arkos 1.2.20-test → 1.2.22-test

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 (60) hide show
  1. package/dist/cjs/utils/cli/utils/cli.helpers.js +44 -3
  2. package/dist/cjs/utils/cli/utils/cli.helpers.js.map +1 -1
  3. package/dist/esm/app.js +1 -1
  4. package/dist/esm/exports/auth/index.js +1 -1
  5. package/dist/esm/exports/controllers/index.js +2 -2
  6. package/dist/esm/exports/error-handler/index.js +2 -2
  7. package/dist/esm/exports/index.js +2 -2
  8. package/dist/esm/exports/middlewares/index.js +1 -1
  9. package/dist/esm/exports/prisma/index.js +1 -1
  10. package/dist/esm/exports/services/index.js +4 -4
  11. package/dist/esm/exports/utils/index.js +2 -2
  12. package/dist/esm/exports/validation/index.js +2 -2
  13. package/dist/esm/modules/auth/auth.controller.js +7 -7
  14. package/dist/esm/modules/auth/auth.router.js +6 -6
  15. package/dist/esm/modules/auth/auth.service.js +6 -6
  16. package/dist/esm/modules/auth/utils/helpers/auth.controller.helpers.js +2 -2
  17. package/dist/esm/modules/base/base.controller.js +7 -7
  18. package/dist/esm/modules/base/base.middlewares.js +6 -6
  19. package/dist/esm/modules/base/base.router.js +4 -4
  20. package/dist/esm/modules/base/base.service.js +6 -6
  21. package/dist/esm/modules/base/utils/helpers/base.controller.helpers.js +1 -1
  22. package/dist/esm/modules/base/utils/helpers/base.middlewares.helpers.js +1 -1
  23. package/dist/esm/modules/base/utils/helpers/base.router.helpers.js +6 -6
  24. package/dist/esm/modules/base/utils/helpers/base.service.helpers.js +1 -1
  25. package/dist/esm/modules/email/email.service.js +2 -2
  26. package/dist/esm/modules/error-handler/error-handler.controller.js +3 -3
  27. package/dist/esm/modules/error-handler/utils/error-handler.helpers.js +1 -1
  28. package/dist/esm/modules/file-upload/file-upload.controller.js +7 -7
  29. package/dist/esm/modules/file-upload/file-upload.router.js +5 -5
  30. package/dist/esm/modules/file-upload/file-upload.service.js +5 -5
  31. package/dist/esm/modules/file-upload/utils/helpers/file-upload.helpers.js +2 -2
  32. package/dist/esm/modules/swagger/swagger.router.js +2 -2
  33. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +2 -2
  34. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +3 -3
  35. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +2 -2
  36. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schema.js +2 -2
  37. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes.js +2 -2
  38. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js +3 -3
  39. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +9 -9
  40. package/dist/esm/server.js +1 -1
  41. package/dist/esm/utils/cli/build.js +4 -4
  42. package/dist/esm/utils/cli/dev.js +5 -5
  43. package/dist/esm/utils/cli/generate.js +4 -4
  44. package/dist/esm/utils/cli/index.js +5 -5
  45. package/dist/esm/utils/cli/start.js +4 -4
  46. package/dist/esm/utils/cli/utils/cli.helpers.js +13 -5
  47. package/dist/esm/utils/cli/utils/cli.helpers.js.map +1 -1
  48. package/dist/esm/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js +1 -1
  49. package/dist/esm/utils/cli/utils/template-generator/templates/generate-middlewares.js +1 -1
  50. package/dist/esm/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js +2 -2
  51. package/dist/esm/utils/cli/utils/template-generator/templates/generate-router-template.js +1 -1
  52. package/dist/esm/utils/cli/utils/template-generator/templates/generate-service-template.js +2 -2
  53. package/dist/esm/utils/cli/utils/template-generators.js +6 -6
  54. package/dist/esm/utils/features/api.features.js +4 -4
  55. package/dist/esm/utils/features/change-case.features.js +1 -1
  56. package/dist/esm/utils/helpers/models.helpers.js +4 -4
  57. package/dist/esm/utils/helpers/prisma.helpers.js +4 -4
  58. package/dist/esm/utils/validate-dto.js +1 -1
  59. package/dist/esm/utils/validate-schema.js +1 -1
  60. package/package.json +2 -1
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -9,7 +42,8 @@ exports.getVersion = getVersion;
9
42
  const fs_1 = __importDefault(require("fs"));
10
43
  const dev_1 = require("../dev");
11
44
  const start_1 = require("../start");
12
- const path_1 = __importDefault(require("path"));
45
+ const path_1 = __importStar(require("path"));
46
+ const url_1 = require("url");
13
47
  function ensureDirectoryExists(dirPath) {
14
48
  if (!fs_1.default.existsSync(dirPath)) {
15
49
  fs_1.default.mkdirSync(dirPath, { recursive: true });
@@ -20,8 +54,15 @@ function killServerChildProcess() {
20
54
  (0, start_1.killProductionServerChildProcess)();
21
55
  }
22
56
  function getVersion() {
23
- const packageJsonPath = path_1.default.resolve(__dirname || process.cwd(), "../../../../../package.json");
24
- const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, "utf8") || "{}");
57
+ let currentDir;
58
+ try {
59
+ currentDir = eval("__dirname");
60
+ }
61
+ catch {
62
+ const importMeta = eval("import.meta");
63
+ currentDir = (0, path_1.dirname)((0, url_1.fileURLToPath)(importMeta.url));
64
+ }
65
+ const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(currentDir, "../../../../../package.json"), "utf8") || "{}");
25
66
  return packageJson?.version || "1.0.0";
26
67
  }
27
68
  //# sourceMappingURL=cli.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.helpers.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/cli.helpers.ts"],"names":[],"mappings":";;;;;AAOA,sDAIC;AAED,wDAGC;AAsBD,gCAWC;AAjDD,4CAAoB;AACpB,gCAA2D;AAC3D,oCAA4D;AAC5D,gDAAwB;AAIxB,SAAgB,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,YAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,SAAgB,sBAAsB;IACpC,IAAA,uCAAiC,GAAE,CAAC;IACpC,IAAA,wCAAgC,GAAE,CAAC;AACrC,CAAC;AAsBD,SAAgB,UAAU;IAExB,MAAM,eAAe,GAAG,cAAI,CAAC,OAAO,CAClC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,EAC1B,6BAA6B,CAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,IAAI,CACjD,CAAC;IACF,OAAO,WAAW,EAAE,OAAO,IAAI,OAAO,CAAC;AACzC,CAAC","sourcesContent":["import fs from \"fs\";\nimport { killDevelopmentServerChildProcess } from \"../dev\";\nimport { killProductionServerChildProcess } from \"../start\";\nimport path from \"path\";\n// import { fileURLToPath } from \"url\";\n// import { dirname } from \"path\";\n\nexport function ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n}\n\nexport function killServerChildProcess() {\n killDevelopmentServerChildProcess();\n killProductionServerChildProcess();\n}\n\n// export function getVersion() {\n// let currentDir: string;\n// // @ts-ignore\n// if (typeof __dirname !== \"undefined\") {\n// // @ts-ignore\n// currentDir = __dirname;\n// } else {\n// // @ts-ignore\n// currentDir = dirname(fileURLToPath((import.meta as any).url));\n// }\n\n// const packageJson = JSON.parse(\n// fs.readFileSync(\n// path.join(currentDir, \"../../../../../package.json\"),\n// \"utf8\"\n// ) || \"{}\"\n// );\n// return packageJson?.version || \"1.0.0\";\n// }\n\nexport function getVersion() {\n // Just use process.cwd() or a relative path that works from the compiled location\n const packageJsonPath = path.resolve(\n __dirname || process.cwd(),\n \"../../../../../package.json\"\n );\n\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, \"utf8\") || \"{}\"\n );\n return packageJson?.version || \"1.0.0\";\n}\n"]}
1
+ {"version":3,"file":"cli.helpers.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/cli.helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,sDAIC;AAED,wDAGC;AAsBD,gCAmBC;AA1DD,4CAAoB;AACpB,gCAA2D;AAC3D,oCAA4D;AAC5D,6CAAqC;AACrC,6BAAoC;AAIpC,SAAgB,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,YAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,SAAgB,sBAAsB;IACpC,IAAA,uCAAiC,GAAE,CAAC;IACpC,IAAA,wCAAgC,GAAE,CAAC;AACrC,CAAC;AAsBD,SAAgB,UAAU;IACxB,IAAI,UAAkB,CAAC;IAEvB,IAAI,CAAC;QAEH,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QAEP,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;QACvC,UAAU,GAAG,IAAA,cAAO,EAAC,IAAA,mBAAa,EAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAE,CAAC,YAAY,CACb,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,6BAA6B,CAAC,EACpD,MAAM,CACP,IAAI,IAAI,CACV,CAAC;IACF,OAAO,WAAW,EAAE,OAAO,IAAI,OAAO,CAAC;AACzC,CAAC","sourcesContent":["import fs from \"fs\";\nimport { killDevelopmentServerChildProcess } from \"../dev\";\nimport { killProductionServerChildProcess } from \"../start\";\nimport path, { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n// import { fileURLToPath } from \"url\";\n// import { dirname } from \"path\";\n\nexport function ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n}\n\nexport function killServerChildProcess() {\n killDevelopmentServerChildProcess();\n killProductionServerChildProcess();\n}\n\n// export function getVersion() {\n// let currentDir: string;\n// // @ts-ignore\n// if (typeof __dirname !== \"undefined\") {\n// // @ts-ignore\n// currentDir = __dirname;\n// } else {\n// // @ts-ignore\n// currentDir = dirname(fileURLToPath((import.meta as any).url));\n// }\n\n// const packageJson = JSON.parse(\n// fs.readFileSync(\n// path.join(currentDir, \"../../../../../package.json\"),\n// \"utf8\"\n// ) || \"{}\"\n// );\n// return packageJson?.version || \"1.0.0\";\n// }\n\nexport function getVersion() {\n let currentDir: string;\n\n try {\n // Use eval to prevent TypeScript from seeing this as import.meta\n currentDir = eval(\"__dirname\");\n } catch {\n // Fallback for ES modules - also use eval\n const importMeta = eval(\"import.meta\");\n currentDir = dirname(fileURLToPath(importMeta.url));\n }\n\n const packageJson = JSON.parse(\n fs.readFileSync(\n path.join(currentDir, \"../../../../../package.json\"),\n \"utf8\"\n ) || \"{}\"\n );\n return packageJson?.version || \"1.0.0\";\n}\n"]}
package/dist/esm/app.js CHANGED
@@ -1 +1 @@
1
- "use strict";import c from"express";import p from"cors";import m from"cookie-parser";import{getAuthRouter as f}from"./modules/auth/auth.router";import{getPrismaModelsRouter as w,getAvailableResourcesAndRoutesRouter as R}from"./modules/base/base.router";import h from"./modules/error-handler/error-handler.controller";import{rateLimit as P}from"express-rate-limit";import y from"compression";import{handleRequestLogs as b}from"./modules/base/base.middlewares";import{checkDatabaseConnection as q,loadPrismaModule as A}from"./utils/helpers/prisma.helpers";import{getFileUploadRouter as O}from"./modules/file-upload/file-upload.router";import{queryParser as g}from"./utils/helpers/query-parser.helpers";import d from"./utils/helpers/deepmerge.helper";import{getSwaggerRouter as E}from"./modules/swagger/swagger.router";export const app=c();export async function bootstrap(e){await A(),e?.configureApp&&await e.configureApp(app);const n=e?.middlewares,t=n?.disable||[],a=n?.replace||{};t?.includes?.("compression")||app.use(a.compression||y(e?.compressionOptions)),t?.includes?.("global-rate-limit")||app.use(a.globalRateLimit||P(d({windowMs:60*1e3,limit:500,standardHeaders:"draft-7",legacyHeaders:!1,handler:(r,s)=>{s.status(429).json({message:"Too many requests, please try again later"})}},e?.globalRequestRateLimitOptions||{}))),t?.includes?.("cors")||app.use(a.cors||p(e?.cors?.customHandler?e.cors.customHandler:d({origin:(r,s)=>{const i=e?.cors?.allowedOrigins;i==="*"?s(null,!0):Array.isArray(i)?s(null,!r||i?.includes?.(r)):typeof i=="string"?s(null,!r||i===r):s(null,!1)},methods:["GET","POST","PUT","DELETE","PATCH","OPTIONS"],allowedHeaders:["Content-Type","Authorization","Connection"],credentials:!0},e?.cors?.options||{}))),t?.includes?.("express-json")||app.use(a.expressJson||c.json(e?.jsonBodyParserOptions)),t?.includes?.("cookie-parser")||app.use(a.cookieParser||m(...e?.cookieParserParameters||[])),t?.includes?.("query-parser")||app.use(a.queryParser||g(d({parseNull:!0,parseUndefined:!0,parseBoolean:!0},e?.queryParserOptions||{}))),t?.includes?.("database-connection")||app.use(a.databaseConnection||q),t?.includes?.("request-logger")||app.use(a.requestLogger||b),e?.middlewares?.additional&&e.middlewares.additional.forEach(r=>{app.use(r)});const l=e?.routers,u=l?.disable||[],o=l?.replace||{};if(u?.includes?.("welcome-endpoint")||app.get("/api",o.welcomeEndpoint||((r,s)=>{s.status(200).json({message:e.welcomeMessage})})),!u?.includes?.("file-upload")){const r=o.fileUpload?await o.fileUpload(e):await O(e);app.use(r)}if(!u?.includes?.("auth-router")&&e.authentication){const r=o.authRouter?await o.authRouter(e):await f(e);app.use("/api",r)}if(!u?.includes?.("prisma-models-router")){const r=o.prismaModelsRouter?await o.prismaModelsRouter(e):await w(e);app.use("/api",r)}return app.use("/api",R()),e.swagger&&(process.env.ARKOS_BUILD!=="true"||e.swagger.enableAfterBuild===!0)&&app.use("/api",await E(e)),l?.additional&&l.additional.forEach(r=>{app.use(r)}),t?.includes?.("global-error-handler")||app.use(a.globalErrorHandler||h),app.use("*",(r,s)=>{s.status(404).json({message:"Route not found!"})}),app}
1
+ "use strict";import c from"express";import p from"cors";import m from"cookie-parser";import{getAuthRouter as f}from"./modules/auth/auth.router.js";import{getPrismaModelsRouter as w,getAvailableResourcesAndRoutesRouter as R}from"./modules/base/base.router.js";import h from"./modules/error-handler/error-handler.controller.js";import{rateLimit as P}from"express-rate-limit";import y from"compression";import{handleRequestLogs as b}from"./modules/base/base.middlewares.js";import{checkDatabaseConnection as q,loadPrismaModule as A}from"./utils/helpers/prisma.helpers.js";import{getFileUploadRouter as O}from"./modules/file-upload/file-upload.router.js";import{queryParser as g}from"./utils/helpers/query-parser.helpers.js";import d from"./utils/helpers/deepmerge.helper.js";import{getSwaggerRouter as E}from"./modules/swagger/swagger.router.js";export const app=c();export async function bootstrap(e){await A(),e?.configureApp&&await e.configureApp(app);const n=e?.middlewares,t=n?.disable||[],a=n?.replace||{};t?.includes?.("compression")||app.use(a.compression||y(e?.compressionOptions)),t?.includes?.("global-rate-limit")||app.use(a.globalRateLimit||P(d({windowMs:60*1e3,limit:500,standardHeaders:"draft-7",legacyHeaders:!1,handler:(r,s)=>{s.status(429).json({message:"Too many requests, please try again later"})}},e?.globalRequestRateLimitOptions||{}))),t?.includes?.("cors")||app.use(a.cors||p(e?.cors?.customHandler?e.cors.customHandler:d({origin:(r,s)=>{const i=e?.cors?.allowedOrigins;i==="*"?s(null,!0):Array.isArray(i)?s(null,!r||i?.includes?.(r)):typeof i=="string"?s(null,!r||i===r):s(null,!1)},methods:["GET","POST","PUT","DELETE","PATCH","OPTIONS"],allowedHeaders:["Content-Type","Authorization","Connection"],credentials:!0},e?.cors?.options||{}))),t?.includes?.("express-json")||app.use(a.expressJson||c.json(e?.jsonBodyParserOptions)),t?.includes?.("cookie-parser")||app.use(a.cookieParser||m(...e?.cookieParserParameters||[])),t?.includes?.("query-parser")||app.use(a.queryParser||g(d({parseNull:!0,parseUndefined:!0,parseBoolean:!0},e?.queryParserOptions||{}))),t?.includes?.("database-connection")||app.use(a.databaseConnection||q),t?.includes?.("request-logger")||app.use(a.requestLogger||b),e?.middlewares?.additional&&e.middlewares.additional.forEach(r=>{app.use(r)});const l=e?.routers,u=l?.disable||[],o=l?.replace||{};if(u?.includes?.("welcome-endpoint")||app.get("/api",o.welcomeEndpoint||((r,s)=>{s.status(200).json({message:e.welcomeMessage})})),!u?.includes?.("file-upload")){const r=o.fileUpload?await o.fileUpload(e):await O(e);app.use(r)}if(!u?.includes?.("auth-router")&&e.authentication){const r=o.authRouter?await o.authRouter(e):await f(e);app.use("/api",r)}if(!u?.includes?.("prisma-models-router")){const r=o.prismaModelsRouter?await o.prismaModelsRouter(e):await w(e);app.use("/api",r)}return app.use("/api",R()),e.swagger&&(process.env.ARKOS_BUILD!=="true"||e.swagger.enableAfterBuild===!0)&&app.use("/api",await E(e)),l?.additional&&l.additional.forEach(r=>{app.use(r)}),t?.includes?.("global-error-handler")||app.use(a.globalErrorHandler||h),app.use("*",(r,s)=>{s.status(404).json({message:"Route not found!"})}),app}
@@ -1,2 +1,2 @@
1
- export { defaultExcludedUserFields } from "./../../modules/auth/auth.controller";
1
+ export { defaultExcludedUserFields } from "./../../modules/auth/auth.controller.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { BaseController } from "./../../modules/base/base.controller";
2
- import fileUploadController from "../../modules/file-upload/file-upload.controller";
1
+ import { BaseController } from "./../../modules/base/base.controller.js";
2
+ import fileUploadController from "../../modules/file-upload/file-upload.controller.js";
3
3
  export { fileUploadController, BaseController };
4
4
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import catchAsync from "../../modules/error-handler/utils/catch-async";
2
- import AppError from "../../modules/error-handler/utils/app-error";
1
+ import catchAsync from "../../modules/error-handler/utils/catch-async.js";
2
+ import AppError from "../../modules/error-handler/utils/app-error.js";
3
3
  export { catchAsync, AppError };
4
4
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { BaseController } from "./../modules/base/base.controller";
2
- import { initApp, getArkosConfig } from "../server";
1
+ import { BaseController } from "./../modules/base/base.controller.js";
2
+ import { initApp, getArkosConfig } from "../server.js";
3
3
  const arkos = {
4
4
  init: initApp,
5
5
  };
@@ -1,2 +1,2 @@
1
- export { addPrismaQueryOptionsToRequest, handleRequestBodyValidationAndTransformation, } from "../../modules/base/base.middlewares";
1
+ export { addPrismaQueryOptionsToRequest, handleRequestBodyValidationAndTransformation, } from "../../modules/base/base.middlewares.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- import { getModels } from "../../utils/helpers/models.helpers";
1
+ import { getModels } from "../../utils/helpers/models.helpers.js";
2
2
  export { getModels as getPrismaModels, };
3
3
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
- import { getFileUploadServices, FileUploadService, } from "../../modules/file-upload/file-upload.service";
2
- import authService, { AuthService } from "../../modules/auth/auth.service";
3
- import emailService, { EmailService } from "../../modules/email/email.service";
4
- import { BaseService, getBaseServices } from "../../modules/base/base.service";
1
+ import { getFileUploadServices, FileUploadService, } from "../../modules/file-upload/file-upload.service.js";
2
+ import authService, { AuthService } from "../../modules/auth/auth.service.js";
3
+ import emailService, { EmailService } from "../../modules/email/email.service.js";
4
+ import { BaseService, getBaseServices } from "../../modules/base/base.service.js";
5
5
  export { authService, AuthService };
6
6
  export { BaseService, getBaseServices };
7
7
  export { emailService, EmailService };
@@ -1,4 +1,4 @@
1
- export * from "../../utils/helpers/change-case.helpers";
2
- import APIFeatures, { apiFeatures } from "../../utils/features/api.features";
1
+ export * from "../../utils/helpers/change-case.helpers.js";
2
+ import APIFeatures, { apiFeatures } from "../../utils/features/api.features.js";
3
3
  export { APIFeatures, apiFeatures };
4
4
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import validateDto from "../../utils/validate-dto";
2
- import validateSchema from "../../utils/validate-schema";
1
+ import validateDto from "../../utils/validate-dto.js";
2
+ import validateSchema from "../../utils/validate-schema.js";
3
3
  export { validateDto, validateSchema };
4
4
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
- import catchAsync from "../error-handler/utils/catch-async";
2
- import AppError from "../error-handler/utils/app-error";
3
- import authService from "./auth.service";
4
- import { getBaseServices } from "../base/base.service";
5
- import arkosEnv from "../../utils/arkos-env";
6
- import { getArkosConfig } from "../../server";
7
- import { createPrismaWhereClause, determineUsernameField, getNestedValue, toMs, } from "./utils/helpers/auth.controller.helpers";
1
+ import catchAsync from "../error-handler/utils/catch-async.js";
2
+ import AppError from "../error-handler/utils/app-error.js";
3
+ import authService from "./auth.service.js";
4
+ import { getBaseServices } from "../base/base.service.js";
5
+ import arkosEnv from "../../utils/arkos-env.js";
6
+ import { getArkosConfig } from "../../server.js";
7
+ import { createPrismaWhereClause, determineUsernameField, getNestedValue, toMs, } from "./utils/helpers/auth.controller.helpers.js";
8
8
  export const defaultExcludedUserFields = {
9
9
  password: false,
10
10
  };
@@ -1,11 +1,11 @@
1
1
  import { Router } from "express";
2
- import { authControllerFactory } from "./auth.controller";
3
- import authService from "./auth.service";
2
+ import { authControllerFactory } from "./auth.controller.js";
3
+ import authService from "./auth.service.js";
4
4
  import rateLimit from "express-rate-limit";
5
- import { importPrismaModelModules } from "../../utils/helpers/models.helpers";
6
- import { addPrismaQueryOptionsToRequest, handleRequestBodyValidationAndTransformation, sendResponse, } from "../base/base.middlewares";
7
- import deepmerge from "../../utils/helpers/deepmerge.helper";
8
- import catchAsync from "../error-handler/utils/catch-async";
5
+ import { importPrismaModelModules } from "../../utils/helpers/models.helpers.js";
6
+ import { addPrismaQueryOptionsToRequest, handleRequestBodyValidationAndTransformation, sendResponse, } from "../base/base.middlewares.js";
7
+ import deepmerge from "../../utils/helpers/deepmerge.helper.js";
8
+ import catchAsync from "../error-handler/utils/catch-async.js";
9
9
  const router = Router();
10
10
  export async function getAuthRouter(arkosConfigs) {
11
11
  const { middlewares, dtos, schemas, prismaQueryOptions } = await importPrismaModelModules("auth");
@@ -1,11 +1,11 @@
1
1
  import jwt from "jsonwebtoken";
2
2
  import bcrypt from "bcryptjs";
3
- import catchAsync from "../error-handler/utils/catch-async";
4
- import AppError from "../error-handler/utils/app-error";
5
- import { callNext } from "../base/base.middlewares";
6
- import { getArkosConfig } from "../../server";
7
- import arkosEnv from "../../utils/arkos-env";
8
- import { getPrismaInstance } from "../../utils/helpers/prisma.helpers";
3
+ import catchAsync from "../error-handler/utils/catch-async.js";
4
+ import AppError from "../error-handler/utils/app-error.js";
5
+ import { callNext } from "../base/base.middlewares.js";
6
+ import { getArkosConfig } from "../../server.js";
7
+ import arkosEnv from "../../utils/arkos-env.js";
8
+ import { getPrismaInstance } from "../../utils/helpers/prisma.helpers.js";
9
9
  export class AuthService {
10
10
  constructor() {
11
11
  this.authenticate = catchAsync(async (req, res, next) => {
@@ -1,5 +1,5 @@
1
- import { getArkosConfig } from "../../../../server";
2
- import AppError from "../../../error-handler/utils/app-error";
1
+ import { getArkosConfig } from "../../../../server.js";
2
+ import AppError from "../../../error-handler/utils/app-error.js";
3
3
  export const determineUsernameField = (req) => {
4
4
  const authConfigs = getArkosConfig()?.authentication;
5
5
  if (req.query?.usernameField &&
@@ -1,10 +1,10 @@
1
- import catchAsync from "../error-handler/utils/catch-async";
2
- import APIFeatures from "../../utils/features/api.features";
3
- import { BaseService } from "./base.service";
4
- import AppError from "../error-handler/utils/app-error";
5
- import { kebabCase, pascalCase } from "../../utils/helpers/change-case.helpers";
6
- import { getModelModules, getModels } from "../../utils/helpers/models.helpers";
7
- import { getAppRoutes } from "./utils/helpers/base.controller.helpers";
1
+ import catchAsync from "../error-handler/utils/catch-async.js";
2
+ import APIFeatures from "../../utils/features/api.features.js";
3
+ import { BaseService } from "./base.service.js";
4
+ import AppError from "../error-handler/utils/app-error.js";
5
+ import { kebabCase, pascalCase } from "../../utils/helpers/change-case.helpers.js";
6
+ import { getModelModules, getModels } from "../../utils/helpers/models.helpers.js";
7
+ import { getAppRoutes } from "./utils/helpers/base.controller.helpers.js";
8
8
  import pluralize from "pluralize";
9
9
  export class BaseController {
10
10
  constructor(modelName) {
@@ -1,9 +1,9 @@
1
- import { getArkosConfig } from "../../server";
2
- import deepmerge from "../../utils/helpers/deepmerge.helper";
3
- import { catchAsync } from "../../exports/error-handler";
4
- import validateDto from "../../utils/validate-dto";
5
- import validateSchema from "../../utils/validate-schema";
6
- import { resolvePrismaQueryOptions } from "./utils/helpers/base.middlewares.helpers";
1
+ import { getArkosConfig } from "../../server.js";
2
+ import deepmerge from "../../utils/helpers/deepmerge.helper.js";
3
+ import { catchAsync } from "../../exports/error-handler/index.js";
4
+ import validateDto from "../../utils/validate-dto.js";
5
+ import validateSchema from "../../utils/validate-schema.js";
6
+ import { resolvePrismaQueryOptions } from "./utils/helpers/base.middlewares.helpers.js";
7
7
  export function callNext(req, res, next) {
8
8
  next();
9
9
  }
@@ -1,8 +1,8 @@
1
1
  import { Router } from "express";
2
- import { getAvalibleRoutes, getAvailableResources } from "./base.controller";
3
- import { getModels } from "../../utils/helpers/models.helpers";
4
- import authService from "../auth/auth.service";
5
- import { setupRouters } from "./utils/helpers/base.router.helpers";
2
+ import { getAvalibleRoutes, getAvailableResources } from "./base.controller.js";
3
+ import { getModels } from "../../utils/helpers/models.helpers.js";
4
+ import authService from "../auth/auth.service.js";
5
+ import { setupRouters } from "./utils/helpers/base.router.helpers.js";
6
6
  export async function getPrismaModelsRouter(arkosConfigs) {
7
7
  const router = Router();
8
8
  await Promise.all(setupRouters(getModels(), router, arkosConfigs));
@@ -1,9 +1,9 @@
1
- import { camelCase, kebabCase, pascalCase, } from "../../utils/helpers/change-case.helpers";
2
- import { getModels, getPrismaModelRelations, } from "../../utils/helpers/models.helpers";
3
- import deepmerge from "../../utils/helpers/deepmerge.helper";
4
- import { handleRelationFieldsInBody } from "./utils/helpers/base.service.helpers";
5
- import { getPrismaInstance } from "../../utils/helpers/prisma.helpers";
6
- import authService from "../auth/auth.service";
1
+ import { camelCase, kebabCase, pascalCase, } from "../../utils/helpers/change-case.helpers.js";
2
+ import { getModels, getPrismaModelRelations, } from "../../utils/helpers/models.helpers.js";
3
+ import deepmerge from "../../utils/helpers/deepmerge.helper.js";
4
+ import { handleRelationFieldsInBody } from "./utils/helpers/base.service.helpers.js";
5
+ import { getPrismaInstance } from "../../utils/helpers/prisma.helpers.js";
6
+ import authService from "../auth/auth.service.js";
7
7
  export class BaseService {
8
8
  constructor(modelName) {
9
9
  this.modelName = camelCase(modelName);
@@ -1,4 +1,4 @@
1
- import { getExpressApp } from "../../../../server";
1
+ import { getExpressApp } from "../../../../server.js";
2
2
  export const getAppRoutes = () => {
3
3
  const app = getExpressApp();
4
4
  const routes = [];
@@ -1,4 +1,4 @@
1
- import deepmerge from "../../../../utils/helpers/deepmerge.helper";
1
+ import deepmerge from "../../../../utils/helpers/deepmerge.helper.js";
2
2
  export function resolvePrismaQueryOptions(prismaQueryOptions, action) {
3
3
  if (!prismaQueryOptions) {
4
4
  return {};
@@ -1,10 +1,10 @@
1
1
  import pluralize from "pluralize";
2
- import { kebabCase } from "../../../../exports/utils";
3
- import { importPrismaModelModules } from "../../../../utils/helpers/models.helpers";
4
- import authService from "../../../auth/auth.service";
5
- import { BaseController } from "../../base.controller";
6
- import { addPrismaQueryOptionsToRequest, handleRequestBodyValidationAndTransformation, sendResponse, } from "../../base.middlewares";
7
- import catchAsync from "../../../error-handler/utils/catch-async";
2
+ import { kebabCase } from "../../../../exports/utils/index.js";
3
+ import { importPrismaModelModules } from "../../../../utils/helpers/models.helpers.js";
4
+ import authService from "../../../auth/auth.service.js";
5
+ import { BaseController } from "../../base.controller.js";
6
+ import { addPrismaQueryOptionsToRequest, handleRequestBodyValidationAndTransformation, sendResponse, } from "../../base.middlewares.js";
7
+ import catchAsync from "../../../error-handler/utils/catch-async.js";
8
8
  export function setupRouters(models, router, arkosConfigs) {
9
9
  return models.map(async (model) => {
10
10
  const modelNameInKebab = kebabCase(model);
@@ -1,4 +1,4 @@
1
- import { getPrismaModelRelations, getModelUniqueFields, } from "../../../../utils/helpers/models.helpers";
1
+ import { getPrismaModelRelations, getModelUniqueFields, } from "../../../../utils/helpers/models.helpers.js";
2
2
  export function removeApiAction(obj) {
3
3
  if (!obj || typeof obj !== "object")
4
4
  return obj;
@@ -1,7 +1,7 @@
1
1
  import nodemailer from "nodemailer";
2
2
  import { convert } from "html-to-text";
3
- import { getArkosConfig } from "../../server";
4
- import AppError from "../error-handler/utils/app-error";
3
+ import { getArkosConfig } from "../../server.js";
4
+ import AppError from "../error-handler/utils/app-error.js";
5
5
  export class EmailService {
6
6
  constructor(config) {
7
7
  this.transporter = null;
@@ -1,6 +1,6 @@
1
- import AppError from "./utils/app-error";
2
- import * as errorControllerHelper from "./utils/error-handler.helpers";
3
- import { server } from "../../server";
1
+ import AppError from "./utils/app-error.js";
2
+ import * as errorControllerHelper from "./utils/error-handler.helpers.js";
3
+ import { server } from "../../server.js";
4
4
  export default function errorHandler(err, req, res, next) {
5
5
  console.error("[\x1b[31mERROR\x1b[0m]:", err);
6
6
  err.statusCode = err.statusCode || 500;
@@ -1,4 +1,4 @@
1
- import AppError from "./app-error";
1
+ import AppError from "./app-error.js";
2
2
  export function handleJWTError() {
3
3
  return new AppError("Invalid token. Please log in again!", 401);
4
4
  }
@@ -1,12 +1,12 @@
1
- import AppError from "../error-handler/utils/app-error";
2
- import { getFileUploadServices, } from "./file-upload.service";
1
+ import AppError from "../error-handler/utils/app-error.js";
2
+ import { getFileUploadServices, } from "./file-upload.service.js";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
- import catchAsync from "../error-handler/utils/catch-async";
6
- import { getArkosConfig } from "../../server";
7
- import { processFile, processImage } from "./utils/helpers/file-upload.helpers";
8
- import { accessAsync, mkdirAsync, statAsync, } from "../../utils/helpers/fs.helpers";
9
- import { getModelModules } from "../../utils/helpers/models.helpers";
5
+ import catchAsync from "../error-handler/utils/catch-async.js";
6
+ import { getArkosConfig } from "../../server.js";
7
+ import { processFile, processImage } from "./utils/helpers/file-upload.helpers.js";
8
+ import { accessAsync, mkdirAsync, statAsync, } from "../../utils/helpers/fs.helpers.js";
9
+ import { getModelModules } from "../../utils/helpers/models.helpers.js";
10
10
  class FileUploadController {
11
11
  constructor() {
12
12
  this.uploadFile = catchAsync(async (req, res, next) => {
@@ -1,11 +1,11 @@
1
1
  import { Router } from "express";
2
- import { importPrismaModelModules } from "../../utils/helpers/models.helpers";
3
- import authService from "../auth/auth.service";
4
- import fileUploadController from "./file-upload.controller";
2
+ import { importPrismaModelModules } from "../../utils/helpers/models.helpers.js";
3
+ import authService from "../auth/auth.service.js";
4
+ import fileUploadController from "./file-upload.controller.js";
5
5
  import path from "path";
6
6
  import express from "express";
7
- import deepmerge from "../../utils/helpers/deepmerge.helper";
8
- import { sendResponse } from "../base/base.middlewares";
7
+ import deepmerge from "../../utils/helpers/deepmerge.helper.js";
8
+ import { sendResponse } from "../base/base.middlewares.js";
9
9
  const router = Router();
10
10
  export async function getFileUploadRouter({ fileUpload }) {
11
11
  const modelModules = await importPrismaModelModules("file-upload");
@@ -1,12 +1,12 @@
1
1
  import multer from "multer";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
- import AppError from "../error-handler/utils/app-error";
4
+ import AppError from "../error-handler/utils/app-error.js";
5
5
  import { promisify } from "util";
6
- import { getArkosConfig } from "../../server";
7
- import deepmerge from "../../utils/helpers/deepmerge.helper";
8
- import { processFile, processImage } from "./utils/helpers/file-upload.helpers";
9
- import { removeBothSlashes } from "../../utils/helpers/text.helpers";
6
+ import { getArkosConfig } from "../../server.js";
7
+ import deepmerge from "../../utils/helpers/deepmerge.helper.js";
8
+ import { processFile, processImage } from "./utils/helpers/file-upload.helpers.js";
9
+ import { removeBothSlashes } from "../../utils/helpers/text.helpers.js";
10
10
  export class FileUploadService {
11
11
  constructor(uploadDir, fileSizeLimit = 1024 * 1024 * 5, allowedFileTypes = /.*/, maxCount = 30) {
12
12
  this.fileFilter = (req, file, cb) => {
@@ -2,9 +2,9 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import sharp from "sharp";
4
4
  import { promisify } from "util";
5
- import { getArkosConfig } from "../../../../server";
5
+ import { getArkosConfig } from "../../../../server.js";
6
6
  import mimetype from "mimetype";
7
- import { fullCleanCwd } from "../../../../utils/helpers/fs.helpers";
7
+ import { fullCleanCwd } from "../../../../utils/helpers/fs.helpers.js";
8
8
  export function extractRequestInfo(req) {
9
9
  const { fileUpload } = getArkosConfig();
10
10
  const protocol = req.headers["x-forwarded-proto"] === "https" ? "https" : "http";
@@ -1,8 +1,8 @@
1
1
  import { Router } from "express";
2
2
  import swaggerUi from "swagger-ui-express";
3
3
  import swaggerJsdoc from "swagger-jsdoc";
4
- import deepmerge from "../../utils/helpers/deepmerge.helper";
5
- import { generatePathsForModels, getOpenAPIJsonSchemasByConfigMode, } from "./utils/helpers/swagger.router.helpers";
4
+ import deepmerge from "../../utils/helpers/deepmerge.helper.js";
5
+ import { generatePathsForModels, getOpenAPIJsonSchemasByConfigMode, } from "./utils/helpers/swagger.router.helpers.js";
6
6
  const swaggerRouter = Router();
7
7
  export async function getSwaggerRouter(arkosConfig) {
8
8
  const defaultJsonSchemas = await getOpenAPIJsonSchemasByConfigMode(arkosConfig.swagger);
@@ -1,5 +1,5 @@
1
- import { getSchemaRef } from "./swagger.router.helpers";
2
- import { getArkosConfig } from "../../../../server";
1
+ import { getSchemaRef } from "./swagger.router.helpers.js";
2
+ import { getArkosConfig } from "../../../../server.js";
3
3
  export function getAuthenticationJsonSchemaPaths() {
4
4
  const mode = getArkosConfig().swagger?.mode;
5
5
  const paths = {};
@@ -1,8 +1,8 @@
1
1
  import { validationMetadatasToSchemas } from "class-validator-jsonschema";
2
- import { importModule } from "../../../../../utils/helpers/global.helpers";
2
+ import { importModule } from "../../../../../utils/helpers/global.helpers.js";
3
3
  import { getMetadataStorage } from "class-validator";
4
- import { getModelModules, getModels, } from "../../../../../utils/helpers/models.helpers";
5
- import { getCorrectJsonSchemaName } from "../swagger.router.helpers";
4
+ import { getModelModules, getModels, } from "../../../../../utils/helpers/models.helpers.js";
5
+ import { getCorrectJsonSchemaName } from "../swagger.router.helpers.js";
6
6
  export async function generateClassValidatorJsonSchemas() {
7
7
  const models = getModels();
8
8
  const schemas = {};
@@ -1,5 +1,5 @@
1
- import { pascalCase } from "../../../../../exports/utils";
2
- import { getModels, getPrismaSchemasContent, } from "../../../../../utils/helpers/models.helpers";
1
+ import { pascalCase } from "../../../../../exports/utils/index.js";
2
+ import { getModels, getPrismaSchemasContent, } from "../../../../../utils/helpers/models.helpers.js";
3
3
  export async function generatePrismaJsonSchemas() {
4
4
  const schemas = {};
5
5
  const prismaContent = getPrismaSchemasContent();
@@ -1,6 +1,6 @@
1
- import { getModelModules, getModels, } from "../../../../../utils/helpers/models.helpers";
1
+ import { getModelModules, getModels, } from "../../../../../utils/helpers/models.helpers.js";
2
2
  import zodToJsonSchema from "zod-to-json-schema";
3
- import { getCorrectJsonSchemaName } from "../swagger.router.helpers";
3
+ import { getCorrectJsonSchemaName } from "../swagger.router.helpers.js";
4
4
  export async function generateZodJsonSchemas() {
5
5
  const models = [...getModels(), "file-upload", "auth"];
6
6
  const schemas = {};
@@ -1,6 +1,6 @@
1
- import { getSchemaRef } from "../../swagger.router.helpers";
1
+ import { getSchemaRef } from "../../swagger.router.helpers.js";
2
2
  import pluralize from "pluralize";
3
- import { isEndpointDisabled } from "../../../../../base/utils/helpers/base.router.helpers";
3
+ import { isEndpointDisabled } from "../../../../../base/utils/helpers/base.router.helpers.js";
4
4
  export async function generatePrismaModelMainRoutesPaths(paths, routeName, pascalModelName, humanReadableName, humanReadableNamePlural, routerConfig, mode) {
5
5
  if (!isEndpointDisabled(routerConfig, "createOne")) {
6
6
  if (!paths[`/api/${routeName}`])
@@ -1,7 +1,7 @@
1
1
  import pluralize from "pluralize";
2
- import { kebabCase, pascalCase } from "../../../../../../exports/utils";
3
- import { getSchemaRef, kebabToHuman } from "../../swagger.router.helpers";
4
- import { isParentEndpointAllowed } from "../../../../../base/utils/helpers/base.router.helpers";
2
+ import { kebabCase, pascalCase } from "../../../../../../exports/utils/index.js";
3
+ import { getSchemaRef, kebabToHuman } from "../../swagger.router.helpers.js";
4
+ import { isParentEndpointAllowed } from "../../../../../base/utils/helpers/base.router.helpers.js";
5
5
  export async function generatePrismaModelParentRoutePaths(paths, routeName, pascalModelName, humanReadableName, humanReadableNamePlural, routerConfig, mode) {
6
6
  const parentModel = routerConfig.parent.model;
7
7
  const parentRouteName = pluralize.plural(kebabCase(parentModel));
@@ -1,13 +1,13 @@
1
- import { getModels, importPrismaModelModules, } from "../../../../utils/helpers/models.helpers";
2
- import { kebabCase, pascalCase } from "../../../../exports/utils";
1
+ import { getModels, importPrismaModelModules, } from "../../../../utils/helpers/models.helpers.js";
2
+ import { kebabCase, pascalCase } from "../../../../exports/utils/index.js";
3
3
  import pluralize from "pluralize";
4
- import { getSystemJsonSchemaPaths } from "./get-system-json-schema-paths";
5
- import { getAuthenticationJsonSchemaPaths } from "./get-authentication-json-schema-paths";
6
- import { generateZodJsonSchemas } from "./json-schema-generators/generate-zod-json-schema";
7
- import { generateClassValidatorJsonSchemas } from "./json-schema-generators/generate-class-validator-json-schemas";
8
- import { generatePrismaJsonSchemas } from "./json-schema-generators/generate-prisma-json-schemas";
9
- import { generatePrismaModelMainRoutesPaths } from "./json-schema-generators/prisma-models/generate-prisma-model-main-routes";
10
- import { generatePrismaModelParentRoutePaths } from "./json-schema-generators/prisma-models/generate-prisma-model-parent-routes";
4
+ import { getSystemJsonSchemaPaths } from "./get-system-json-schema-paths.js";
5
+ import { getAuthenticationJsonSchemaPaths } from "./get-authentication-json-schema-paths.js";
6
+ import { generateZodJsonSchemas } from "./json-schema-generators/generate-zod-json-schema.js";
7
+ import { generateClassValidatorJsonSchemas } from "./json-schema-generators/generate-class-validator-json-schemas.js";
8
+ import { generatePrismaJsonSchemas } from "./json-schema-generators/generate-prisma-json-schemas.js";
9
+ import { generatePrismaModelMainRoutesPaths } from "./json-schema-generators/prisma-models/generate-prisma-model-main-routes.js";
10
+ import { generatePrismaModelParentRoutePaths } from "./json-schema-generators/prisma-models/generate-prisma-model-parent-routes.js";
11
11
  export async function getOpenAPIJsonSchemasByConfigMode(swaggerConfig) {
12
12
  switch (swaggerConfig.mode) {
13
13
  case "prisma":
@@ -1,3 +1,3 @@
1
- "use strict";import{bootstrap as a}from"./app";import p from"./utils/helpers/deepmerge.helper";import c from"http";import s from"./utils/sheu";import{initializePrismaModels as l}from"./utils/helpers/models.helpers";process.on("uncaughtException",o=>{o.message.includes("EPIPE")||(console.error(`
1
+ "use strict";import{bootstrap as a}from"./app.js";import p from"./utils/helpers/deepmerge.helper.js";import c from"http";import s from"./utils/sheu.js";import{initializePrismaModels as l}from"./utils/helpers/models.helpers.js";process.on("uncaughtException",o=>{o.message.includes("EPIPE")||(console.error(`
2
2
  UNCAUGHT EXCEPTION! SHUTTING DOWN...
3
3
  `),console.error(o.name,o.message),console.error(o),process.exit(1))});let r,t,e={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:Number(process.env.CLI_PORT)||Number(process.env.PORT)||8e3,host:process.env.CLI_HOST||process.env.HOST||"localhost",fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"},available:!1};async function u(o={}){l(),e.available=!0,e=p(e,o);const n=process.env.CLI_PORT||e.port||process.env.PORT||"port"in e?e.port:8e3;t=await a(e);const i=new Date().toTimeString().split(" ")[0];return n?(r=c.createServer(t),e?.configureServer&&await e.configureServer(r),r.listen(Number(n),e.host,()=>{s.ready(`${s.gray(i)} server waiting on http://${e.host||"localhost"}:${n}`)})):s.warn(`${s.gray(i)} port set to undefined, hence no internal http server was setup.`),t}process.on("unhandledRejection",o=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),r?.close(()=>{process.exit(1)})});export function terminateApplicationRunningProcessAndServer(){r?.close(()=>{process.exit(1)})}export function getArkosConfig(){return e}export function getExpressApp(){return t}export{r as server,u as initApp};
@@ -1,10 +1,10 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import { execSync } from "child_process";
4
- import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers";
5
- import { loadEnvironmentVariables } from "../dotenv.helpers";
6
- import { getVersion } from "./utils/cli.helpers";
7
- import { detectPackageManagerFromUserAgent } from "../helpers/global.helpers";
4
+ import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers.js";
5
+ import { loadEnvironmentVariables } from "../dotenv.helpers.js";
6
+ import { getVersion } from "./utils/cli.helpers.js";
7
+ import { detectPackageManagerFromUserAgent } from "../helpers/global.helpers.js";
8
8
  const BUILD_DIR = ".build";
9
9
  const MODULE_TYPES = ["cjs", "esm"];
10
10
  export function buildCommand(options = {}) {
@@ -1,12 +1,12 @@
1
1
  import { spawn } from "child_process";
2
2
  import { watch } from "chokidar";
3
- import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers";
4
- import { getVersion } from "./utils/cli.helpers";
5
- import { loadEnvironmentVariables } from "../dotenv.helpers";
6
- import { importModule } from "../helpers/global.helpers";
3
+ import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers.js";
4
+ import { getVersion } from "./utils/cli.helpers.js";
5
+ import { loadEnvironmentVariables } from "../dotenv.helpers.js";
6
+ import { importModule } from "../helpers/global.helpers.js";
7
7
  import fs from "fs";
8
8
  import path from "path";
9
- import sheu from "../sheu";
9
+ import sheu from "../sheu.js";
10
10
  let child = null;
11
11
  let envFiles;
12
12
  export async function devCommand(options = {}) {
@@ -1,9 +1,9 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { generateTemplate } from "./utils/template-generators";
4
- import { ensureDirectoryExists } from "./utils/cli.helpers";
5
- import { camelCase, kebabCase, pascalCase, } from "../helpers/change-case.helpers";
6
- import { getUserFileExtension } from "../helpers/fs.helpers";
3
+ import { generateTemplate } from "./utils/template-generators.js";
4
+ import { ensureDirectoryExists } from "./utils/cli.helpers.js";
5
+ import { camelCase, kebabCase, pascalCase, } from "../helpers/change-case.helpers.js";
6
+ import { getUserFileExtension } from "../helpers/fs.helpers.js";
7
7
  export const generateCommand = {
8
8
  controller: async (options) => {
9
9
  const modelName = options.model;
@@ -1,9 +1,9 @@
1
1
  import { Command } from "commander";
2
- import { buildCommand } from "./build";
3
- import { devCommand } from "./dev";
4
- import { startCommand } from "./start";
5
- import { generateCommand } from "./generate";
6
- import { getVersion } from "./utils/cli.helpers";
2
+ import { buildCommand } from "./build.js";
3
+ import { devCommand } from "./dev.js";
4
+ import { startCommand } from "./start.js";
5
+ import { generateCommand } from "./generate.js";
6
+ import { getVersion } from "./utils/cli.helpers.js";
7
7
  const program = new Command();
8
8
  program.name("arkos").description("Arkos.js CLI").version(getVersion());
9
9
  program
@@ -1,10 +1,10 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import { spawn } from "child_process";
4
- import { getVersion } from "./utils/cli.helpers";
5
- import { loadEnvironmentVariables } from "../dotenv.helpers";
6
- import { importModule } from "../helpers/global.helpers";
7
- import { fullCleanCwd } from "../helpers/fs.helpers";
4
+ import { getVersion } from "./utils/cli.helpers.js";
5
+ import { loadEnvironmentVariables } from "../dotenv.helpers.js";
6
+ import { importModule } from "../helpers/global.helpers.js";
7
+ import { fullCleanCwd } from "../helpers/fs.helpers.js";
8
8
  let child = null;
9
9
  let envFiles;
10
10
  export async function startCommand(options = {}) {
@@ -1,7 +1,8 @@
1
1
  import fs from "fs";
2
- import { killDevelopmentServerChildProcess } from "../dev";
3
- import { killProductionServerChildProcess } from "../start";
4
- import path from "path";
2
+ import { killDevelopmentServerChildProcess } from "../dev.js";
3
+ import { killProductionServerChildProcess } from "../start.js";
4
+ import path, { dirname } from "path";
5
+ import { fileURLToPath } from "url";
5
6
  export function ensureDirectoryExists(dirPath) {
6
7
  if (!fs.existsSync(dirPath)) {
7
8
  fs.mkdirSync(dirPath, { recursive: true });
@@ -12,8 +13,15 @@ export function killServerChildProcess() {
12
13
  killProductionServerChildProcess();
13
14
  }
14
15
  export function getVersion() {
15
- const packageJsonPath = path.resolve(__dirname || process.cwd(), "../../../../../package.json");
16
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8") || "{}");
16
+ let currentDir;
17
+ try {
18
+ currentDir = eval("__dirname");
19
+ }
20
+ catch {
21
+ const importMeta = eval("import.meta");
22
+ currentDir = dirname(fileURLToPath(importMeta.url));
23
+ }
24
+ const packageJson = JSON.parse(fs.readFileSync(path.join(currentDir, "../../../../../package.json"), "utf8") || "{}");
17
25
  return packageJson?.version || "1.0.0";
18
26
  }
19
27
  //# sourceMappingURL=cli.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.helpers.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/cli.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,iCAAiC,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,iCAAiC,EAAE,CAAC;IACpC,gCAAgC,EAAE,CAAC;AACrC,CAAC;AAsBD,MAAM,UAAU,UAAU;IAExB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAClC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,EAC1B,6BAA6B,CAC9B,CAAC;IAEF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,IAAI,CACjD,CAAC;IACF,OAAO,WAAW,EAAE,OAAO,IAAI,OAAO,CAAC;AACzC,CAAC","sourcesContent":["import fs from \"fs\";\nimport { killDevelopmentServerChildProcess } from \"../dev\";\nimport { killProductionServerChildProcess } from \"../start\";\nimport path from \"path\";\n// import { fileURLToPath } from \"url\";\n// import { dirname } from \"path\";\n\nexport function ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n}\n\nexport function killServerChildProcess() {\n killDevelopmentServerChildProcess();\n killProductionServerChildProcess();\n}\n\n// export function getVersion() {\n// let currentDir: string;\n// // @ts-ignore\n// if (typeof __dirname !== \"undefined\") {\n// // @ts-ignore\n// currentDir = __dirname;\n// } else {\n// // @ts-ignore\n// currentDir = dirname(fileURLToPath((import.meta as any).url));\n// }\n\n// const packageJson = JSON.parse(\n// fs.readFileSync(\n// path.join(currentDir, \"../../../../../package.json\"),\n// \"utf8\"\n// ) || \"{}\"\n// );\n// return packageJson?.version || \"1.0.0\";\n// }\n\nexport function getVersion() {\n // Just use process.cwd() or a relative path that works from the compiled location\n const packageJsonPath = path.resolve(\n __dirname || process.cwd(),\n \"../../../../../package.json\"\n );\n\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, \"utf8\") || \"{}\"\n );\n return packageJson?.version || \"1.0.0\";\n}\n"]}
1
+ {"version":3,"file":"cli.helpers.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/cli.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,iCAAiC,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAIpC,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,iCAAiC,EAAE,CAAC;IACpC,gCAAgC,EAAE,CAAC;AACrC,CAAC;AAsBD,MAAM,UAAU,UAAU;IACxB,IAAI,UAAkB,CAAC;IAEvB,IAAI,CAAC;QAEH,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QAEP,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;QACvC,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CACb,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,6BAA6B,CAAC,EACpD,MAAM,CACP,IAAI,IAAI,CACV,CAAC;IACF,OAAO,WAAW,EAAE,OAAO,IAAI,OAAO,CAAC;AACzC,CAAC","sourcesContent":["import fs from \"fs\";\nimport { killDevelopmentServerChildProcess } from \"../dev\";\nimport { killProductionServerChildProcess } from \"../start\";\nimport path, { dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\n// import { fileURLToPath } from \"url\";\n// import { dirname } from \"path\";\n\nexport function ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n}\n\nexport function killServerChildProcess() {\n killDevelopmentServerChildProcess();\n killProductionServerChildProcess();\n}\n\n// export function getVersion() {\n// let currentDir: string;\n// // @ts-ignore\n// if (typeof __dirname !== \"undefined\") {\n// // @ts-ignore\n// currentDir = __dirname;\n// } else {\n// // @ts-ignore\n// currentDir = dirname(fileURLToPath((import.meta as any).url));\n// }\n\n// const packageJson = JSON.parse(\n// fs.readFileSync(\n// path.join(currentDir, \"../../../../../package.json\"),\n// \"utf8\"\n// ) || \"{}\"\n// );\n// return packageJson?.version || \"1.0.0\";\n// }\n\nexport function getVersion() {\n let currentDir: string;\n\n try {\n // Use eval to prevent TypeScript from seeing this as import.meta\n currentDir = eval(\"__dirname\");\n } catch {\n // Fallback for ES modules - also use eval\n const importMeta = eval(\"import.meta\");\n currentDir = dirname(fileURLToPath(importMeta.url));\n }\n\n const packageJson = JSON.parse(\n fs.readFileSync(\n path.join(currentDir, \"../../../../../package.json\"),\n \"utf8\"\n ) || \"{}\"\n );\n return packageJson?.version || \"1.0.0\";\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getUserFileExtension } from "../../../../helpers/fs.helpers";
1
+ import { getUserFileExtension } from "../../../../helpers/fs.helpers.js";
2
2
  export function generateAuthConfigsTemplate(options) {
3
3
  const { modelName } = options;
4
4
  const ext = getUserFileExtension();
@@ -1,4 +1,4 @@
1
- import { getUserFileExtension } from "../../../../helpers/fs.helpers";
1
+ import { getUserFileExtension } from "../../../../helpers/fs.helpers.js";
2
2
  export function generateMiddlewaresTemplate(options) {
3
3
  const { modelName } = options;
4
4
  const ext = getUserFileExtension();
@@ -1,4 +1,4 @@
1
- import { getUserFileExtension } from "../../../../helpers/fs.helpers";
1
+ import { getUserFileExtension } from "../../../../helpers/fs.helpers.js";
2
2
  export function generateQueryOptionsTemplate(options) {
3
3
  const { modelName } = options;
4
4
  const isAuth = modelName?.camel === "auth";
@@ -15,7 +15,7 @@ export function generateQueryOptionsTemplate(options) {
15
15
  : `: PrismaQueryOptions<typeof prisma.${modelName.camel}>`
16
16
  : "";
17
17
  const prismaImport = isTypeScript
18
- ? `import { prisma } from "../../utils/prisma";\n`
18
+ ? `import { prisma } from "../../utils/prisma.js";\n`
19
19
  : "";
20
20
  if (isAuth) {
21
21
  return `${prismaImport}${imports};
@@ -1,5 +1,5 @@
1
1
  import pluralize from "pluralize";
2
- import { checkFileExists, getUserFileExtension, } from "../../../../helpers/fs.helpers";
2
+ import { checkFileExists, getUserFileExtension, } from "../../../../helpers/fs.helpers.js";
3
3
  export function generateRouterTemplate(options) {
4
4
  const { modelName, imports } = options;
5
5
  if (!modelName)
@@ -1,4 +1,4 @@
1
- import { getUserFileExtension } from "../../../../helpers/fs.helpers";
1
+ import { getUserFileExtension } from "../../../../helpers/fs.helpers.js";
2
2
  export function generateServiceTemplate(options) {
3
3
  const { modelName, imports } = options;
4
4
  const ext = getUserFileExtension();
@@ -6,7 +6,7 @@ export function generateServiceTemplate(options) {
6
6
  if (!modelName)
7
7
  throw new Error("Model name is required for service template");
8
8
  const prismaImport = isTypeScript
9
- ? `import { prisma } from "../../utils/prisma";\n`
9
+ ? `import { prisma } from "../../utils/prisma.js";\n`
10
10
  : "";
11
11
  const baseServiceImport = isTypeScript
12
12
  ? `import { BaseService } from "${imports?.baseService || "arkos/services"}";`
@@ -1,9 +1,9 @@
1
- import { generateControllerTemplate } from "./template-generator/templates/generate-controller-template";
2
- import { generateAuthConfigsTemplate } from "./template-generator/templates/generate-auth-configs-template";
3
- import { generateMiddlewaresTemplate } from "./template-generator/templates/generate-middlewares";
4
- import { generateQueryOptionsTemplate } from "./template-generator/templates/generate-prisma-query-options";
5
- import { generateRouterTemplate } from "./template-generator/templates/generate-router-template";
6
- import { generateServiceTemplate } from "./template-generator/templates/generate-service-template";
1
+ import { generateControllerTemplate } from "./template-generator/templates/generate-controller-template.js";
2
+ import { generateAuthConfigsTemplate } from "./template-generator/templates/generate-auth-configs-template.js";
3
+ import { generateMiddlewaresTemplate } from "./template-generator/templates/generate-middlewares.js";
4
+ import { generateQueryOptionsTemplate } from "./template-generator/templates/generate-prisma-query-options.js";
5
+ import { generateRouterTemplate } from "./template-generator/templates/generate-router-template.js";
6
+ import { generateServiceTemplate } from "./template-generator/templates/generate-service-template.js";
7
7
  export function generateTemplate(type, options) {
8
8
  switch (type) {
9
9
  case "controller":
@@ -1,7 +1,7 @@
1
- import deepmerge from "../helpers/deepmerge.helper";
2
- import { parseQueryParamsWithModifiers } from "../helpers/api.features.helpers";
3
- import AppError from "../../modules/error-handler/utils/app-error";
4
- import { getPrismaInstance } from "../helpers/prisma.helpers";
1
+ import deepmerge from "../helpers/deepmerge.helper.js";
2
+ import { parseQueryParamsWithModifiers } from "../helpers/api.features.helpers.js";
3
+ import AppError from "../../modules/error-handler/utils/app-error.js";
4
+ import { getPrismaInstance } from "../helpers/prisma.helpers.js";
5
5
  export default class APIFeatures {
6
6
  constructor(req, modelName) {
7
7
  this.filters = {};
@@ -1,4 +1,4 @@
1
- import * as changeCase from "../helpers/change-case.helpers";
1
+ import * as changeCase from "../helpers/change-case.helpers.js";
2
2
  const isObject = (object) => object !== null && typeof object === "object";
3
3
  function changeKeysFactory(changeCase) {
4
4
  return function changeKeys(object, depth = 1, options) {
@@ -1,9 +1,9 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- import { camelCase, kebabCase, pascalCase, } from "../../utils/helpers/change-case.helpers";
4
- import { crd, getUserFileExtension } from "./fs.helpers";
5
- import { importModule } from "./global.helpers";
6
- import { killServerChildProcess } from "../cli/utils/cli.helpers";
3
+ import { camelCase, kebabCase, pascalCase, } from "../../utils/helpers/change-case.helpers.js";
4
+ import { crd, getUserFileExtension } from "./fs.helpers.js";
5
+ import { importModule } from "./global.helpers.js";
6
+ import { killServerChildProcess } from "../cli/utils/cli.helpers.js";
7
7
  let prismaModelsModules = {};
8
8
  export function getModelModules(modelName) {
9
9
  return prismaModelsModules[kebabCase(modelName)];
@@ -1,8 +1,8 @@
1
1
  import fs from "fs";
2
- import catchAsync from "../../modules/error-handler/utils/catch-async";
3
- import AppError from "../../modules/error-handler/utils/app-error";
4
- import { crd, getUserFileExtension as ext } from "./fs.helpers";
5
- import { importModule } from "./global.helpers";
2
+ import catchAsync from "../../modules/error-handler/utils/catch-async.js";
3
+ import AppError from "../../modules/error-handler/utils/app-error.js";
4
+ import { crd, getUserFileExtension as ext } from "./fs.helpers.js";
5
+ import { importModule } from "./global.helpers.js";
6
6
  export let prismaInstance = null;
7
7
  export async function loadPrismaModule() {
8
8
  if (!prismaInstance) {
@@ -1,6 +1,6 @@
1
1
  import { plainToInstance } from "class-transformer";
2
2
  import { validate } from "class-validator";
3
- import AppError from "../modules/error-handler/utils/app-error";
3
+ import AppError from "../modules/error-handler/utils/app-error.js";
4
4
  export default async function validateDto(DtoClass, data, validationOptions) {
5
5
  const dataDto = plainToInstance(DtoClass, data);
6
6
  const errors = await validate(dataDto, validationOptions);
@@ -1,4 +1,4 @@
1
- import AppError from "../modules/error-handler/utils/app-error";
1
+ import AppError from "../modules/error-handler/utils/app-error.js";
2
2
  export default async function validateSchema(schema, data) {
3
3
  const result = schema.safeParse(data);
4
4
  if (!result.success) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "1.2.20-test",
3
+ "version": "1.2.22-test",
4
4
  "description": "The Express & Prisma Framework For RESTful API",
5
5
  "main": "dist/cjs/exports/index.js",
6
6
  "module": "dist/esm/exports/index.js",
@@ -94,6 +94,7 @@
94
94
  "test:create": "ts-node src/scripts/create-test.ts",
95
95
  "publish:test": "npm publish --tag test",
96
96
  "publish:beta": "npm publish --tag beta",
97
+ "publish:betaAsLatest": "npm publish --tag latest",
97
98
  "publish": "npm publish"
98
99
  },
99
100
  "keywords": [