arkos 1.0.20-beta → 1.0.21-beta

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.
@@ -1 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,s){function u(r){return r instanceof n?r:new n(function(i){i(r)})}return new(n||(n=Promise))(function(r,i){function l(o){try{p(s.next(o))}catch(c){i(c)}}function a(o){try{p(s.throw(o))}catch(c){i(c)}}function p(o){o.done?r(o.value):u(o.value).then(l,a)}p((s=s.apply(e,t||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.server=void 0,exports.getArkosConfig=getArkosConfig,exports.getExpressApp=getExpressApp,exports.initApp=initApp;const app_1=require("./app"),deepmerge_helper_1=__importDefault(require("./utils/helpers/deepmerge.helper"));process.on("uncaughtException",e=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),process.exit(1)});let server,_app,_arkosConfig={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function initApp(){return __awaiter(this,arguments,void 0,function*(e={}){_arkosConfig=(0,deepmerge_helper_1.default)(_arkosConfig,e);const t=_arkosConfig.port;return _app=yield(0,app_1.bootstrap)(_arkosConfig),t&&(exports.server=server=_app.listen(e?.host?[t,e?.host]:t,()=>{const n=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${n}\x1B[0m App running on port \x1B[33m${t}\x1B[0m, server waiting on http://localhost:${t}`),process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),_app})}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),server.close(()=>{process.exit(1)})});function getArkosConfig(){return _arkosConfig}function getExpressApp(){return _app}
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,s){function l(r){return r instanceof n?r:new n(function(i){i(r)})}return new(n||(n=Promise))(function(r,i){function u(o){try{p(s.next(o))}catch(c){i(c)}}function a(o){try{p(s.throw(o))}catch(c){i(c)}}function p(o){o.done?r(o.value):l(o.value).then(u,a)}p((s=s.apply(e,t||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.server=void 0,exports.getArkosConfig=getArkosConfig,exports.getExpressApp=getExpressApp,exports.initApp=initApp;const app_1=require("./app"),deepmerge_helper_1=__importDefault(require("./utils/helpers/deepmerge.helper"));process.on("uncaughtException",e=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),process.exit(1)});let server,_app,_arkosConfig={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function initApp(){return __awaiter(this,arguments,void 0,function*(e={}){_arkosConfig=(0,deepmerge_helper_1.default)(_arkosConfig,e);const t=_arkosConfig.port;return _app=yield(0,app_1.bootstrap)(_arkosConfig),t&&(exports.server=server=_app.listen(e?.host?[t,e?.host]:t,()=>{const n=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${n}\x1B[0m App running on port \x1B[33m${t}\x1B[0m, server waiting on http://localhost:${t}`),process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),_app})}process.on("unhandledRejection",e=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(e.name,e.message),console.error(e),server?.close(()=>{process.exit(1)})});function getArkosConfig(){return _arkosConfig}function getExpressApp(){return _app}
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;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AI,uCAAuC,IAAI,+CAA+C,IAAI,EAAE,CACvI,CAAC;gBAEF,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;oBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC9D,CAAC,CACF,CAAC;QAEJ,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwEA,wCAEC;AAED,sCAEC;AAEgB,0BAAO;AA7ExB,+BAAkC;AAElC,wFAAyD;AAEzD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAA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C;IACd,CAAC;CAAA;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getUserFileExtension = exports.userFileExtension = exports.mkdirAsync = exports.accessAsync = exports.statAsync = void 0;
7
7
  const util_1 = require("util");
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
9
10
  exports.statAsync = (0, util_1.promisify)(fs_1.default.stat);
10
11
  exports.accessAsync = (0, util_1.promisify)(fs_1.default.access);
11
12
  exports.mkdirAsync = (0, util_1.promisify)(fs_1.default.mkdir);
@@ -13,24 +14,56 @@ const getUserFileExtension = () => {
13
14
  if (exports.userFileExtension)
14
15
  return exports.userFileExtension;
15
16
  try {
16
- const fs = require("fs");
17
- const path = require("path");
18
- const projectRoot = process.cwd();
19
- if (fs.existsSync(path.join(projectRoot, "tsconfig.json"))) {
20
- exports.userFileExtension = "ts";
17
+ const currentDir = process.cwd();
18
+ const dirName = path_1.default.basename(currentDir);
19
+ if ([".build", "build", "dist", "lib", "out"].includes(dirName)) {
20
+ exports.userFileExtension = "js";
21
21
  return exports.userFileExtension;
22
22
  }
23
- const srcDirs = ["src", "source", "app", "lib"]
24
- .map((dir) => path.join(projectRoot, dir))
25
- .filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());
26
- srcDirs.push(projectRoot);
27
- for (const dir of srcDirs) {
28
- const files = fs.readdirSync(dir);
29
- if (files.some((file) => file.endsWith(".ts") || file.endsWith(".tsx"))) {
23
+ const executionPath = process.argv[1] || "";
24
+ if (executionPath.includes("/.build/") ||
25
+ executionPath.includes("/build/") ||
26
+ executionPath.includes("/dist/")) {
27
+ exports.userFileExtension = "js";
28
+ return exports.userFileExtension;
29
+ }
30
+ let callerIsJS = false;
31
+ try {
32
+ const stack = new Error().stack;
33
+ if (stack) {
34
+ const callerLine = stack.split("\n")[2] || "";
35
+ callerIsJS = callerLine.includes(".js:");
36
+ }
37
+ }
38
+ catch (e) {
39
+ }
40
+ if (callerIsJS) {
41
+ exports.userFileExtension = "js";
42
+ return exports.userFileExtension;
43
+ }
44
+ try {
45
+ const files = fs_1.default.readdirSync(currentDir);
46
+ const hasJSFiles = files.some((file) => file.endsWith(".js") && !file.endsWith(".config.js"));
47
+ const hasTSFiles = files.some((file) => file.endsWith(".ts") && !file.endsWith(".config.ts"));
48
+ if (hasJSFiles && !hasTSFiles) {
49
+ exports.userFileExtension = "js";
50
+ return exports.userFileExtension;
51
+ }
52
+ if (hasTSFiles) {
30
53
  exports.userFileExtension = "ts";
31
54
  return exports.userFileExtension;
32
55
  }
33
56
  }
57
+ catch (e) {
58
+ }
59
+ try {
60
+ if (fs_1.default.existsSync(path_1.default.join(currentDir, "tsconfig.json"))) {
61
+ exports.userFileExtension = "ts";
62
+ return exports.userFileExtension;
63
+ }
64
+ }
65
+ catch (e) {
66
+ }
34
67
  exports.userFileExtension = "js";
35
68
  return exports.userFileExtension;
36
69
  }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EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YAClC,IACE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EACxE,CAAC;gBACD,yBAAiB,GAAG,IAAI,CAAC;gBACzB,OAAO,yBAAiB,CAAC;YAC3B,CAAC;QACH,CAAC;QAGD,yBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QAEX,yBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AA5CW,QAAA,oBAAoB,wBA4C/B","sourcesContent":["import { promisify } from \"util\";\nimport fs from \"fs\";\n\nexport const statAsync = promisify(fs.stat);\nexport const accessAsync = promisify(fs.access);\nexport const mkdirAsync = promisify(fs.mkdir);\n\n// // Runtime-agnostic approach with proper TypeScript support\n// export const extension = (() => {\n// // Safely detect environment without direct import.meta reference\n// let currentFile = \"\";\n\n// // Try to determine the current file using environment-specific approaches\n// try {\n// if (typeof process !== \"undefined\" && process.env) {\n// // Node.js environment - use __filename\n// currentFile = __filename || \"\";\n// } else {\n// // Handle other environments (browser, Deno, etc.)\n// // This branch won't be reached in CommonJS builds\n// if (typeof (global as any)?.document === \"undefined\") {\n// // Non-browser environment that might support import.meta\n// // We'll use eval to prevent direct parsing of import.meta\n// currentFile = new Function(\n// \"return typeof import.meta !== 'undefined' ? import.meta.url : ''\"\n// )();\n// }\n// }\n// } catch (e) {\n// // Ignore errors during detection\n// }\n\n// // Check file extension\n// if (currentFile.endsWith(\".ts\") || currentFile.endsWith(\".tsx\")) {\n// return \"ts\";\n// }\n\n// // Use \"any\" type and conditional checks to avoid TypeScript errors\n// try {\n// // Check for Deno\n// const globalObj = globalThis as any;\n// if (typeof globalObj.Deno !== \"undefined\" && globalObj.Deno.emit) {\n// return \"ts\";\n// }\n\n// // Check for Bun\n// if (typeof globalObj.Bun !== \"undefined\") {\n// return \"ts\";\n// }\n\n// // Check for newer Node with TS support\n// if (\n// typeof process !== \"undefined\" &&\n// process.versions &&\n// parseInt((process.versions as any).node.split(\".\")[0]) >= 18\n// ) {\n// const isUsingTypeScript = new Error().stack?.includes?.(\".ts:\");\n// if (isUsingTypeScript) return \"ts\";\n// }\n// } catch (e) {\n// // Ignore errors during detection\n// }\n\n// return \"js\";\n// })();\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Immediately detects if the user's project uses TypeScript or JavaScript\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n // Only works in Node.js environment\n const fs = require(\"fs\");\n const path = require(\"path\");\n\n // Get the project root\n const projectRoot = process.cwd();\n\n // Check for tsconfig.json in project root as the fastest check\n if (fs.existsSync(path.join(projectRoot, \"tsconfig.json\"))) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n\n // Check common src directories\n const srcDirs = [\"src\", \"source\", \"app\", \"lib\"]\n .map((dir) => path.join(projectRoot, dir))\n .filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());\n\n // Add project root to directories to check\n srcDirs.push(projectRoot);\n\n // Check each directory for .ts files\n for (const dir of srcDirs) {\n const files = fs.readdirSync(dir);\n if (\n files.some((file: any) => file.endsWith(\".ts\") || file.endsWith(\".tsx\"))\n ) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n }\n\n // Default to js if no TypeScript indicators found\n userFileExtension = \"js\";\n return userFileExtension;\n } catch (e) {\n // Fallback to js if any errors occur\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n"]}
1
+ {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/fs.helpers.ts"],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,IAAI,CAAC;QACzB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QAEX,yBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,yBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAtFW,QAAA,oBAAoB,wBAsF/B","sourcesContent":["import { promisify } from \"util\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nexport const statAsync = promisify(fs.stat);\nexport const accessAsync = promisify(fs.access);\nexport const mkdirAsync = promisify(fs.mkdir);\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Detects the file extension that should be used in the current execution context\n * Returns 'js' when running from compiled code and 'ts' in development\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n // Check if we're currently in a build/compiled directory\n const currentDir = process.cwd();\n const dirName = path.basename(currentDir);\n\n // If we're in a build directory, we should use .js because we're in compiled code\n if ([\".build\", \"build\", \"dist\", \"lib\", \"out\"].includes(dirName)) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // Check if current execution path contains indicators of compiled code\n const executionPath = process.argv[1] || \"\";\n if (\n executionPath.includes(\"/.build/\") ||\n executionPath.includes(\"/build/\") ||\n executionPath.includes(\"/dist/\")\n ) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // Check the caller file - if it ends with .js, we're likely in compiled code\n let callerIsJS = false;\n try {\n // This is a hacky way to get the caller file, but can help in many cases\n const stack = new Error().stack;\n if (stack) {\n const callerLine = stack.split(\"\\n\")[2] || \"\";\n callerIsJS = callerLine.includes(\".js:\");\n }\n } catch (e) {\n // Ignore error if we can't get stack trace\n }\n\n if (callerIsJS) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // Check which file extensions are available in the current directory\n try {\n const files = fs.readdirSync(currentDir);\n const hasJSFiles = files.some(\n (file) => file.endsWith(\".js\") && !file.endsWith(\".config.js\")\n );\n const hasTSFiles = files.some(\n (file) => file.endsWith(\".ts\") && !file.endsWith(\".config.ts\")\n );\n\n // If we only have JS files and no TS files, use JS\n if (hasJSFiles && !hasTSFiles) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // If we have TS files, prefer TS\n if (hasTSFiles) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n } catch (e) {\n // Continue if directory read fails\n }\n\n // As a last resort, check for tsconfig.json\n try {\n if (fs.existsSync(path.join(currentDir, \"tsconfig.json\"))) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n } catch (e) {\n // Continue if check fails\n }\n\n // Default to js for safety\n userFileExtension = \"js\";\n return userFileExtension;\n } catch (e) {\n // Always default to js if anything goes wrong\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n"]}
@@ -25,9 +25,13 @@ function loadPrismaModule(a) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  if (!exports.prismaInstance) {
27
27
  try {
28
- let prismaPath = `${process.cwd()}/src/utils/prisma.${(0, fs_helpers_1.getUserFileExtension)()}`;
28
+ let prismaPath = `${process.env.NODE_ENV === "production"
29
+ ? process.cwd() + "/.build/"
30
+ : process.cwd()}/src/utils/prisma.${(0, fs_helpers_1.getUserFileExtension)()}`;
29
31
  if (!fs_1.default.existsSync(prismaPath)) {
30
- prismaPath = `${process.cwd()}/src/utils/prisma/index.${(0, fs_helpers_1.getUserFileExtension)()}`;
32
+ prismaPath = `${process.env.NODE_ENV === "production"
33
+ ? process.cwd() + "/.build/"
34
+ : process.cwd()}/src/utils/prisma/index.${(0, fs_helpers_1.getUserFileExtension)()}`;
31
35
  }
32
36
  const prismaModule = yield (0, global_helpers_1.importModule)(prismaPath);
33
37
  exports.prismaInstance = prismaModule.default || prismaModule.prisma;
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/prisma.helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AASA,4CAoBC;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T,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,mBAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAA,CACF,CAAC","sourcesContent":["import fs from \"fs\";\nimport { Request, Response, NextFunction } from \"express\";\nimport catchAsync from \"../../modules/error-handler/utils/catch-async\";\nimport AppError from \"../../modules/error-handler/utils/app-error\";\nimport { getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\n\nexport let prismaInstance: any = null;\n\nexport async function loadPrismaModule(a?: string) {\n if (!prismaInstance) {\n try {\n let prismaPath = `${process.cwd()}/src/utils/prisma.${getUserFileExtension()}`;\n\n if (!fs.existsSync(prismaPath)) {\n prismaPath = `${process.cwd()}/src/utils/prisma/index.${getUserFileExtension()}`;\n }\n\n const prismaModule = await importModule(prismaPath);\n prismaInstance = prismaModule.default || prismaModule.prisma;\n\n if (!prismaInstance) throw new Error(\"not found\");\n } catch (error) {\n throw new AppError(\"Could not initialize Prisma module.\", 500, {\n tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,\n });\n }\n }\n return prismaInstance;\n}\n\nexport function getPrismaInstance() {\n return prismaInstance;\n}\n\nexport const checkDatabaseConnection = catchAsync(\n async (req: Request, res: Response, next: NextFunction) => {\n const prisma = await loadPrismaModule();\n try {\n await prisma.$connect();\n next();\n } catch (error: any) {\n console.error(\"Database connection error\", error.message);\n next(new AppError(error.message, 503));\n }\n }\n);\n"]}
1
+ {"version":3,"file":"prisma.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/prisma.helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AASA,4CA4BC;AAED,8CAEC;AAzCD,4CAAoB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G,IAAA,qBAAU,EAC/C,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACxC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,mBAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAA,CACF,CAAC","sourcesContent":["import fs from \"fs\";\nimport { Request, Response, NextFunction } from \"express\";\nimport catchAsync from \"../../modules/error-handler/utils/catch-async\";\nimport AppError from \"../../modules/error-handler/utils/app-error\";\nimport { getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\n\nexport let prismaInstance: any = null;\n\nexport async function loadPrismaModule(a?: string) {\n if (!prismaInstance) {\n try {\n let prismaPath = `${\n process.env.NODE_ENV === \"production\"\n ? process.cwd() + \"/.build/\"\n : process.cwd()\n }/src/utils/prisma.${getUserFileExtension()}`;\n\n if (!fs.existsSync(prismaPath)) {\n prismaPath = `${\n process.env.NODE_ENV === \"production\"\n ? process.cwd() + \"/.build/\"\n : process.cwd()\n }/src/utils/prisma/index.${getUserFileExtension()}`;\n }\n\n const prismaModule = await importModule(prismaPath);\n prismaInstance = prismaModule.default || prismaModule.prisma;\n\n if (!prismaInstance) throw new Error(\"not found\");\n } catch (error) {\n throw new AppError(\"Could not initialize Prisma module.\", 500, {\n tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,\n });\n }\n }\n return prismaInstance;\n}\n\nexport function getPrismaInstance() {\n return prismaInstance;\n}\n\nexport const checkDatabaseConnection = catchAsync(\n async (req: Request, res: Response, next: NextFunction) => {\n const prisma = await loadPrismaModule();\n try {\n await prisma.$connect();\n next();\n } catch (error: any) {\n console.error(\"Database connection error\", error.message);\n next(new AppError(error.message, 503));\n }\n }\n);\n"]}
@@ -1 +1 @@
1
- "use strict";var x=function(o,e,n,i){function m(r){return r instanceof n?r:new n(function(c){c(r)})}return new(n||(n=Promise))(function(r,c){function d(t){try{l(i.next(t))}catch(u){c(u)}}function f(t){try{l(i.throw(t))}catch(u){c(u)}}function l(t){t.done?r(t.value):m(t.value).then(d,f)}l((i=i.apply(o,e||[])).next())})};import{bootstrap as E}from"./app";import h from"./utils/helpers/deepmerge.helper";process.on("uncaughtException",o=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),process.exit(1)});let a,p,s={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function N(){return x(this,arguments,void 0,function*(o={}){s=h(s,o);const e=s.port;return p=yield E(s),e&&(a=p.listen(o?.host?[e,o?.host]:e,()=>{const n=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${n}\x1B[0m App running on port \x1B[33m${e}\x1B[0m, server waiting on http://localhost:${e}`),process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),p})}process.on("unhandledRejection",o=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),a.close(()=>{process.exit(1)})});export function getArkosConfig(){return s}export function getExpressApp(){return p}export{a as server,N as initApp};
1
+ "use strict";var x=function(o,e,n,c){function m(r){return r instanceof n?r:new n(function(p){p(r)})}return new(n||(n=Promise))(function(r,p){function d(t){try{u(c.next(t))}catch(a){p(a)}}function f(t){try{u(c.throw(t))}catch(a){p(a)}}function u(t){t.done?r(t.value):m(t.value).then(d,f)}u((c=c.apply(o,e||[])).next())})};import{bootstrap as E}from"./app";import h from"./utils/helpers/deepmerge.helper";process.on("uncaughtException",o=>{console.error("UNCAUGHT EXCEPTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),process.exit(1)});let i,l,s={welcomeMessage:"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com",port:8e3,fileUpload:{baseUploadDir:"uploads",baseRoute:"/api/uploads"}};function v(){return x(this,arguments,void 0,function*(o={}){s=h(s,o);const e=s.port;return l=yield E(s),e&&(i=l.listen(o?.host?[e,o?.host]:e,()=>{const n=new Date().toTimeString().split(" ")[0];console.info(`[\x1B[32mREADY\x1B[0m] \x1B[90m${n}\x1B[0m App running on port \x1B[33m${e}\x1B[0m, server waiting on http://localhost:${e}`),process.env.NODE_ENV&&console.info(`${`Environment: ${process.env.NODE_ENV}`}`)})),l})}process.on("unhandledRejection",o=>{console.error("UNHANDLED REJECTION! SHUTTING DOWN..."),console.error(o.name,o.message),console.error(o),i?.close(()=>{process.exit(1)})});export function getArkosConfig(){return s}export function getExpressApp(){return l}export{i as server,v as initApp};
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAEzD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,MAA6D,CAAC;AAClE,IAAI,IA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C,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAEzD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,MAA6D,CAAC;AAClE,IAAI,IAAa,CAAC;AAElB,IAAI,YAAY,GAAgB;IAC9B,cAAc,EACZ,6FAA6F;IAC/F,IAAI,EAAE,IAAI;IACV,UAAU,EAAE;QACV,aAAa,EAAE,SAAS;QACxB,SAAS,EAAE,cAAc;KAC1B;CACF,CAAC;AAeF,SAAe,OAAO;yDAAC,cAA2B,EAAE;QACl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,CAAC;AAEH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport { ArkosConfig } from \"./types/arkos-config\";\nimport deepmerge from \"./utils/helpers/deepmerge.helper\";\n\nprocess.on(\"uncaughtException\", (err) => {\n console.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\nlet _arkosConfig: ArkosConfig = {\n welcomeMessage:\n \"Welcome to our RESTful API generated by Arkos, find out more about Arkos at www.arkosjs.com\",\n port: 8000,\n fileUpload: {\n baseUploadDir: \"uploads\",\n baseRoute: \"/api/uploads\",\n },\n};\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosConfig} arkosConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(arkosConfig: ArkosConfig = {}): Promise<Express> {\n _arkosConfig = deepmerge(_arkosConfig, arkosConfig);\n\n const port = _arkosConfig.port;\n _app = await bootstrap(_arkosConfig);\n\n if (port)\n server = _app.listen(\n arkosConfig?.host ? [port, arkosConfig?.host!] : port,\n () => {\n const time = new Date().toTimeString().split(\" \")[0];\n console.info(\n `[\\x1b[32mREADY\\x1b[0m] \\x1b[90m${time}\\x1b[0m App running on port \\x1b[33m${port}\\x1b[0m, server waiting on http://localhost:${port}`\n );\n\n if (!!process.env.NODE_ENV)\n console.info(`${`Environment: ${process.env.NODE_ENV}`}`);\n }\n );\n\n return _app;\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n console.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\");\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\nexport function getArkosConfig() {\n return _arkosConfig;\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
@@ -1,5 +1,6 @@
1
1
  import { promisify } from "util";
2
2
  import fs from "fs";
3
+ import path from "path";
3
4
  export const statAsync = promisify(fs.stat);
4
5
  export const accessAsync = promisify(fs.access);
5
6
  export const mkdirAsync = promisify(fs.mkdir);
@@ -8,24 +9,56 @@ export const getUserFileExtension = () => {
8
9
  if (userFileExtension)
9
10
  return userFileExtension;
10
11
  try {
11
- const fs = require("fs");
12
- const path = require("path");
13
- const projectRoot = process.cwd();
14
- if (fs.existsSync(path.join(projectRoot, "tsconfig.json"))) {
15
- userFileExtension = "ts";
12
+ const currentDir = process.cwd();
13
+ const dirName = path.basename(currentDir);
14
+ if ([".build", "build", "dist", "lib", "out"].includes(dirName)) {
15
+ userFileExtension = "js";
16
16
  return userFileExtension;
17
17
  }
18
- const srcDirs = ["src", "source", "app", "lib"]
19
- .map((dir) => path.join(projectRoot, dir))
20
- .filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());
21
- srcDirs.push(projectRoot);
22
- for (const dir of srcDirs) {
23
- const files = fs.readdirSync(dir);
24
- if (files.some((file) => file.endsWith(".ts") || file.endsWith(".tsx"))) {
18
+ const executionPath = process.argv[1] || "";
19
+ if (executionPath.includes("/.build/") ||
20
+ executionPath.includes("/build/") ||
21
+ executionPath.includes("/dist/")) {
22
+ userFileExtension = "js";
23
+ return userFileExtension;
24
+ }
25
+ let callerIsJS = false;
26
+ try {
27
+ const stack = new Error().stack;
28
+ if (stack) {
29
+ const callerLine = stack.split("\n")[2] || "";
30
+ callerIsJS = callerLine.includes(".js:");
31
+ }
32
+ }
33
+ catch (e) {
34
+ }
35
+ if (callerIsJS) {
36
+ userFileExtension = "js";
37
+ return userFileExtension;
38
+ }
39
+ try {
40
+ const files = fs.readdirSync(currentDir);
41
+ const hasJSFiles = files.some((file) => file.endsWith(".js") && !file.endsWith(".config.js"));
42
+ const hasTSFiles = files.some((file) => file.endsWith(".ts") && !file.endsWith(".config.ts"));
43
+ if (hasJSFiles && !hasTSFiles) {
44
+ userFileExtension = "js";
45
+ return userFileExtension;
46
+ }
47
+ if (hasTSFiles) {
25
48
  userFileExtension = "ts";
26
49
  return userFileExtension;
27
50
  }
28
51
  }
52
+ catch (e) {
53
+ }
54
+ try {
55
+ if (fs.existsSync(path.join(currentDir, "tsconfig.json"))) {
56
+ userFileExtension = "ts";
57
+ return userFileExtension;
58
+ }
59
+ }
60
+ catch (e) {
61
+ }
29
62
  userFileExtension = "js";
30
63
  return userFileExtension;
31
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/fs.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AA6D9C,MAAM,CAAC,IAAI,iBAA0C,CAAC;AAMtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAgB,EAAE;IACpD,IAAI,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAEhD,IAAI,CAAC;QAEH,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI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,CAAC,CAAC","sourcesContent":["import { promisify } from \"util\";\nimport fs from \"fs\";\n\nexport const statAsync = promisify(fs.stat);\nexport const accessAsync = promisify(fs.access);\nexport const mkdirAsync = promisify(fs.mkdir);\n\n// // Runtime-agnostic approach with proper TypeScript support\n// export const extension = (() => {\n// // Safely detect environment without direct import.meta reference\n// let currentFile = \"\";\n\n// // Try to determine the current file using environment-specific approaches\n// try {\n// if (typeof process !== \"undefined\" && process.env) {\n// // Node.js environment - use __filename\n// currentFile = __filename || \"\";\n// } else {\n// // Handle other environments (browser, Deno, etc.)\n// // This branch won't be reached in CommonJS builds\n// if (typeof (global as any)?.document === \"undefined\") {\n// // Non-browser environment that might support import.meta\n// // We'll use eval to prevent direct parsing of import.meta\n// currentFile = new Function(\n// \"return typeof import.meta !== 'undefined' ? import.meta.url : ''\"\n// )();\n// }\n// }\n// } catch (e) {\n// // Ignore errors during detection\n// }\n\n// // Check file extension\n// if (currentFile.endsWith(\".ts\") || currentFile.endsWith(\".tsx\")) {\n// return \"ts\";\n// }\n\n// // Use \"any\" type and conditional checks to avoid TypeScript errors\n// try {\n// // Check for Deno\n// const globalObj = globalThis as any;\n// if (typeof globalObj.Deno !== \"undefined\" && globalObj.Deno.emit) {\n// return \"ts\";\n// }\n\n// // Check for Bun\n// if (typeof globalObj.Bun !== \"undefined\") {\n// return \"ts\";\n// }\n\n// // Check for newer Node with TS support\n// if (\n// typeof process !== \"undefined\" &&\n// process.versions &&\n// parseInt((process.versions as any).node.split(\".\")[0]) >= 18\n// ) {\n// const isUsingTypeScript = new Error().stack?.includes?.(\".ts:\");\n// if (isUsingTypeScript) return \"ts\";\n// }\n// } catch (e) {\n// // Ignore errors during detection\n// }\n\n// return \"js\";\n// })();\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Immediately detects if the user's project uses TypeScript or JavaScript\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n // Only works in Node.js environment\n const fs = require(\"fs\");\n const path = require(\"path\");\n\n // Get the project root\n const projectRoot = process.cwd();\n\n // Check for tsconfig.json in project root as the fastest check\n if (fs.existsSync(path.join(projectRoot, \"tsconfig.json\"))) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n\n // Check common src directories\n const srcDirs = [\"src\", \"source\", \"app\", \"lib\"]\n .map((dir) => path.join(projectRoot, dir))\n .filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());\n\n // Add project root to directories to check\n srcDirs.push(projectRoot);\n\n // Check each directory for .ts files\n for (const dir of srcDirs) {\n const files = fs.readdirSync(dir);\n if (\n files.some((file: any) => file.endsWith(\".ts\") || file.endsWith(\".tsx\"))\n ) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n }\n\n // Default to js if no TypeScript indicators found\n userFileExtension = \"js\";\n return userFileExtension;\n } catch (e) {\n // Fallback to js if any errors occur\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n"]}
1
+ {"version":3,"file":"fs.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/fs.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAE9C,MAAM,CAAC,IAAI,iBAA0C,CAAC;AAOtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAgB,EAAE;IACpD,IAAI,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAEhD,IAAI,CAAC;QAEH,MA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E,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAC/D,CAAC;YACF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAC/D,CAAC;YAGF,IAAI,UAAU,IAAI,CAAC,UAAU,EAAE,CAAC;gBAC9B,iBAAiB,GAAG,IAAI,CAAC;gBACzB,OAAO,iBAAiB,CAAC;YAC3B,CAAC;YAGD,IAAI,UAAU,EAAE,CAAC;gBACf,iBAAiB,GAAG,IAAI,CAAC;gBACzB,OAAO,iBAAiB,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;QAEb,CAAC;QAGD,IAAI,CAAC;YACH,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC;gBAC1D,iBAAiB,GAAG,IAAI,CAAC;gBACzB,OAAO,iBAAiB,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;QAEb,CAAC;QAGD,iBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QAEX,iBAAiB,GAAG,IAAI,CAAC;QACzB,OAAO,iBAAiB,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { promisify } from \"util\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nexport const statAsync = promisify(fs.stat);\nexport const accessAsync = promisify(fs.access);\nexport const mkdirAsync = promisify(fs.mkdir);\n\nexport let userFileExtension: \"ts\" | \"js\" | undefined;\n\n/**\n * Detects the file extension that should be used in the current execution context\n * Returns 'js' when running from compiled code and 'ts' in development\n * @returns 'ts' | 'js'\n */\nexport const getUserFileExtension = (): \"ts\" | \"js\" => {\n if (userFileExtension) return userFileExtension;\n\n try {\n // Check if we're currently in a build/compiled directory\n const currentDir = process.cwd();\n const dirName = path.basename(currentDir);\n\n // If we're in a build directory, we should use .js because we're in compiled code\n if ([\".build\", \"build\", \"dist\", \"lib\", \"out\"].includes(dirName)) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // Check if current execution path contains indicators of compiled code\n const executionPath = process.argv[1] || \"\";\n if (\n executionPath.includes(\"/.build/\") ||\n executionPath.includes(\"/build/\") ||\n executionPath.includes(\"/dist/\")\n ) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // Check the caller file - if it ends with .js, we're likely in compiled code\n let callerIsJS = false;\n try {\n // This is a hacky way to get the caller file, but can help in many cases\n const stack = new Error().stack;\n if (stack) {\n const callerLine = stack.split(\"\\n\")[2] || \"\";\n callerIsJS = callerLine.includes(\".js:\");\n }\n } catch (e) {\n // Ignore error if we can't get stack trace\n }\n\n if (callerIsJS) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // Check which file extensions are available in the current directory\n try {\n const files = fs.readdirSync(currentDir);\n const hasJSFiles = files.some(\n (file) => file.endsWith(\".js\") && !file.endsWith(\".config.js\")\n );\n const hasTSFiles = files.some(\n (file) => file.endsWith(\".ts\") && !file.endsWith(\".config.ts\")\n );\n\n // If we only have JS files and no TS files, use JS\n if (hasJSFiles && !hasTSFiles) {\n userFileExtension = \"js\";\n return userFileExtension;\n }\n\n // If we have TS files, prefer TS\n if (hasTSFiles) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n } catch (e) {\n // Continue if directory read fails\n }\n\n // As a last resort, check for tsconfig.json\n try {\n if (fs.existsSync(path.join(currentDir, \"tsconfig.json\"))) {\n userFileExtension = \"ts\";\n return userFileExtension;\n }\n } catch (e) {\n // Continue if check fails\n }\n\n // Default to js for safety\n userFileExtension = \"js\";\n return userFileExtension;\n } catch (e) {\n // Always default to js if anything goes wrong\n userFileExtension = \"js\";\n return userFileExtension;\n }\n};\n"]}
@@ -17,9 +17,13 @@ export function loadPrismaModule(a) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  if (!prismaInstance) {
19
19
  try {
20
- let prismaPath = `${process.cwd()}/src/utils/prisma.${getUserFileExtension()}`;
20
+ let prismaPath = `${process.env.NODE_ENV === "production"
21
+ ? process.cwd() + "/.build/"
22
+ : process.cwd()}/src/utils/prisma.${getUserFileExtension()}`;
21
23
  if (!fs.existsSync(prismaPath)) {
22
- prismaPath = `${process.cwd()}/src/utils/prisma/index.${getUserFileExtension()}`;
24
+ prismaPath = `${process.env.NODE_ENV === "production"
25
+ ? process.cwd() + "/.build/"
26
+ : process.cwd()}/src/utils/prisma/index.${getUserFileExtension()}`;
23
27
  }
24
28
  const prismaModule = yield importModule(prismaPath);
25
29
  prismaInstance = prismaModule.default || prismaModule.prisma;
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/prisma.helpers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,UAAU,MAAM,+CAA+C,CAAC;AACvE,OAAO,QAAQ,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,IAAI,cAAc,GAAQ,IAAI,CAAC;AAEtC,MAAM,UAAgB,gBAAgB,CAAC,CAAU;;QAC/C,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,IAAI,CAAC;gBACH,IAAI,UAAU,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,qBAAqB,oBAAoB,EAAE,EAAE,CAAC;gBAE/E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC/B,UAAU,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,2BAA2B,oBAAoB,EAAE,EAAE,CAAC;gBACnF,CAAC;gBAED,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;gBACpD,cAAc,GAAG,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC;gBAE7D,IAAI,CAAC,cAAc;oBAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;oBAC7D,GAAG,EAAE,qEAAqE,oBAAoB,EAAE,gHAAgH;iBACjN,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;CAAA;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAC/C,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACxC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAA,CACF,CAAC","sourcesContent":["import fs from \"fs\";\nimport { Request, Response, NextFunction } from \"express\";\nimport catchAsync from \"../../modules/error-handler/utils/catch-async\";\nimport AppError from \"../../modules/error-handler/utils/app-error\";\nimport { getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\n\nexport let prismaInstance: any = null;\n\nexport async function loadPrismaModule(a?: string) {\n if (!prismaInstance) {\n try {\n let prismaPath = `${process.cwd()}/src/utils/prisma.${getUserFileExtension()}`;\n\n if (!fs.existsSync(prismaPath)) {\n prismaPath = `${process.cwd()}/src/utils/prisma/index.${getUserFileExtension()}`;\n }\n\n const prismaModule = await importModule(prismaPath);\n prismaInstance = prismaModule.default || prismaModule.prisma;\n\n if (!prismaInstance) throw new Error(\"not found\");\n } catch (error) {\n throw new AppError(\"Could not initialize Prisma module.\", 500, {\n tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,\n });\n }\n }\n return prismaInstance;\n}\n\nexport function getPrismaInstance() {\n return prismaInstance;\n}\n\nexport const checkDatabaseConnection = catchAsync(\n async (req: Request, res: Response, next: NextFunction) => {\n const prisma = await loadPrismaModule();\n try {\n await prisma.$connect();\n next();\n } catch (error: any) {\n console.error(\"Database connection error\", error.message);\n next(new AppError(error.message, 503));\n }\n }\n);\n"]}
1
+ {"version":3,"file":"prisma.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/prisma.helpers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,UAAU,MAAM,+CAA+C,CAAC;AACvE,OAAO,QAAQ,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,IAAI,cAAc,GAAQ,IAAI,CAAC;AAEtC,MAAM,UAAgB,gBAAgB,CAAC,CAAU;;QAC/C,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,IAAI,CAAC;gBACH,IAAI,UAAU,GAAG,GACf,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;oBACnC,CAAC,CAAC,OAAO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,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAA,CACF,CAAC","sourcesContent":["import fs from \"fs\";\nimport { Request, Response, NextFunction } from \"express\";\nimport catchAsync from \"../../modules/error-handler/utils/catch-async\";\nimport AppError from \"../../modules/error-handler/utils/app-error\";\nimport { getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\n\nexport let prismaInstance: any = null;\n\nexport async function loadPrismaModule(a?: string) {\n if (!prismaInstance) {\n try {\n let prismaPath = `${\n process.env.NODE_ENV === \"production\"\n ? process.cwd() + \"/.build/\"\n : process.cwd()\n }/src/utils/prisma.${getUserFileExtension()}`;\n\n if (!fs.existsSync(prismaPath)) {\n prismaPath = `${\n process.env.NODE_ENV === \"production\"\n ? process.cwd() + \"/.build/\"\n : process.cwd()\n }/src/utils/prisma/index.${getUserFileExtension()}`;\n }\n\n const prismaModule = await importModule(prismaPath);\n prismaInstance = prismaModule.default || prismaModule.prisma;\n\n if (!prismaInstance) throw new Error(\"not found\");\n } catch (error) {\n throw new AppError(\"Could not initialize Prisma module.\", 500, {\n tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,\n });\n }\n }\n return prismaInstance;\n}\n\nexport function getPrismaInstance() {\n return prismaInstance;\n}\n\nexport const checkDatabaseConnection = catchAsync(\n async (req: Request, res: Response, next: NextFunction) => {\n const prisma = await loadPrismaModule();\n try {\n await prisma.$connect();\n next();\n } catch (error: any) {\n console.error(\"Database connection error\", error.message);\n next(new AppError(error.message, 503));\n }\n }\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "1.0.20-beta",
3
+ "version": "1.0.21-beta",
4
4
  "description": "The Express & Prisma Framework For RESTful API",
5
5
  "main": "dist/cjs/exports/index.js",
6
6
  "module": "dist/es2020/exports/index.js",
@@ -71,10 +71,6 @@
71
71
  ]
72
72
  }
73
73
  },
74
- "bin": {
75
- "arkos": "./dist/src/utils/scripts/index.js",
76
- "arkos-dev": "./src/utils/scripts/index.ts"
77
- },
78
74
  "scripts": {
79
75
  "build:es2020": "tsc -p tsconfig.es2020.json",
80
76
  "build:types": "tsc -p tsconfig.types.json",