arkos 1.3.7-canary.6 → 1.3.7-canary.8

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.
@@ -17,15 +17,17 @@ const swaggerRouter = (0, express_1.Router)();
17
17
  async function getSwaggerRouter(arkosConfig) {
18
18
  let defaultJsonSchemas = await (0, swagger_router_helpers_1.getOpenAPIJsonSchemasByConfigMode)(arkosConfig);
19
19
  const defaultModelsPaths = await (0, swagger_router_helpers_1.generatePathsForModels)(arkosConfig);
20
+ const fileUploadDefaultPaths = (0, get_file_upload_json_schema_paths_1.default)(arkosConfig);
20
21
  const missingJsonSchemas = await missing_json_schemas_generator_1.default.generateMissingJsonSchemas(defaultModelsPaths, defaultJsonSchemas, arkosConfig);
21
22
  defaultJsonSchemas = {
22
23
  ...defaultJsonSchemas,
23
24
  ...missingJsonSchemas,
24
25
  ...(0, generate_system_json_schemas_1.default)(arkosConfig),
25
- ...(0, get_file_upload_json_schema_paths_1.default)(arkosConfig),
26
26
  };
27
- const swaggerConfigs = (0, deepmerge_helper_1.default)((await (0, get_swagger_default_configs_1.default)(defaultModelsPaths, defaultJsonSchemas)) ||
28
- {}, arkosConfig.swagger || {});
27
+ const swaggerConfigs = (0, deepmerge_helper_1.default)((await (0, get_swagger_default_configs_1.default)({
28
+ ...defaultModelsPaths,
29
+ ...fileUploadDefaultPaths,
30
+ }, defaultJsonSchemas)) || {}, arkosConfig.swagger || {});
29
31
  const { definition, ...options } = swaggerConfigs?.options;
30
32
  const swaggerSpecification = (0, swagger_jsdoc_1.default)({
31
33
  definition: definition,
@@ -1 +1 @@
1
- {"version":3,"file":"swagger.router.js","sourceRoot":"","sources":["../../../../src/modules/swagger/swagger.router.ts"],"names":[],"mappings":";;;;;AAgBA,4CA6CC;AA7DD,qCAAiC;AACjC,kEAAyC;AAEzC,4FAA6D;AAC7D,mFAGgD;AAChD,oHAAwF;AACxF,8GAAkF;AAClF,uEAAyF;AACzF,uIAA4G;AAC5G,0HAA6F;AAE7F,MAAM,aAAa,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,KAAK,UAAU,gBAAgB,CACpC,WAAwB;IAExB,IAAI,kBAAkB,GAAG,MAAM,IAAA,0DAAiC,EAAC,WAAW,CAAC,CAAC;IAC9E,MAAM,kBAAkB,GAAG,MAAM,IAAA,+CAAsB,EAAC,WAAW,CAAC,CAAC;IACrE,MAAM,kBAAkB,GACtB,MAAM,wCAA0B,CAAC,0BAA0B,CACzD,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,CACZ,CAAC;IAEJ,kBAAkB,GAAG;QACnB,GAAG,kBAAkB;QACrB,GAAG,kBAAkB;QACrB,GAAG,IAAA,sCAAyB,EAAC,WAAW,CAAC;QACzC,GAAG,IAAA,2CAA4B,EAAC,WAAW,CAAC;KAC7C,CAAC;IAEF,MAAM,cAAc,GAAG,IAAA,0BAAS,EAC9B,CAAC,MAAM,IAAA,qCAAuB,EAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QACrE,EAAE,EACJ,WAAW,CAAC,OAAO,IAAI,EAAE,CACA,CAAC;IAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,OAAQ,CAAC;IAE5D,MAAM,oBAAoB,GAAG,IAAA,uBAAY,EAAC;QACxC,UAAU,EAAE,UAA4C;QACxD,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,IAAA,oDAAmC,EACtD,+BAA+B,CAChC,CAAC;IAEF,aAAa,CAAC,GAAG,CACf,cAAe,CAAC,QAAS,EACzB,MAAM,CAAC,YAAY,CAAC;QAClB,OAAO,EAAE,oBAAoB;QAC7B,GAAG,cAAc,EAAE,+BAA+B;KACnD,CAAC,CACH,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { Router } from \"express\";\nimport swaggerJsdoc from \"swagger-jsdoc\";\nimport { ArkosConfig } from \"../../types/arkos-config\";\nimport deepmerge from \"../../utils/helpers/deepmerge.helper\";\nimport {\n generatePathsForModels,\n getOpenAPIJsonSchemasByConfigMode,\n} from \"./utils/helpers/swagger.router.helpers\";\nimport missingJsonSchemaGenerator from \"./utils/helpers/missing-json-schemas-generator\";\nimport getSwaggerDefaultConfig from \"./utils/helpers/get-swagger-default-configs\";\nimport { importEsmPreventingTsTransformation } from \"../../utils/helpers/global.helpers\";\nimport generateSystemJsonSchemas from \"./utils/helpers/json-schema-generators/generate-system-json-schemas\";\nimport getFileUploadJsonSchemaPaths from \"./utils/helpers/get-file-upload-json-schema-paths\";\n\nconst swaggerRouter = Router();\n\nexport async function getSwaggerRouter(\n arkosConfig: ArkosConfig\n): Promise<Router> {\n let defaultJsonSchemas = await getOpenAPIJsonSchemasByConfigMode(arkosConfig);\n const defaultModelsPaths = await generatePathsForModels(arkosConfig);\n const missingJsonSchemas =\n await missingJsonSchemaGenerator.generateMissingJsonSchemas(\n defaultModelsPaths,\n defaultJsonSchemas,\n arkosConfig\n );\n\n defaultJsonSchemas = {\n ...defaultJsonSchemas,\n ...missingJsonSchemas,\n ...generateSystemJsonSchemas(arkosConfig),\n ...getFileUploadJsonSchemaPaths(arkosConfig),\n };\n\n const swaggerConfigs = deepmerge(\n (await getSwaggerDefaultConfig(defaultModelsPaths, defaultJsonSchemas)) ||\n {},\n arkosConfig.swagger || {}\n ) as ArkosConfig[\"swagger\"];\n\n const { definition, ...options } = swaggerConfigs?.options!;\n\n const swaggerSpecification = swaggerJsdoc({\n definition: definition as swaggerJsdoc.SwaggerDefinition,\n ...options,\n });\n\n const scalar = await importEsmPreventingTsTransformation(\n \"@scalar/express-api-reference\"\n );\n\n swaggerRouter.use(\n swaggerConfigs!.endpoint!,\n scalar.apiReference({\n content: swaggerSpecification,\n ...swaggerConfigs?.scalarApiReferenceConfiguration,\n })\n );\n\n return swaggerRouter;\n}\n"]}
1
+ {"version":3,"file":"swagger.router.js","sourceRoot":"","sources":["../../../../src/modules/swagger/swagger.router.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AY,CAAC;QAClB,OAAO,EAAE,oBAAoB;QAC7B,GAAG,cAAc,EAAE,+BAA+B;KACnD,CAAC,CACH,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { Router } from \"express\";\nimport swaggerJsdoc from \"swagger-jsdoc\";\nimport { ArkosConfig } from \"../../types/arkos-config\";\nimport deepmerge from \"../../utils/helpers/deepmerge.helper\";\nimport {\n generatePathsForModels,\n getOpenAPIJsonSchemasByConfigMode,\n} from \"./utils/helpers/swagger.router.helpers\";\nimport missingJsonSchemaGenerator from \"./utils/helpers/missing-json-schemas-generator\";\nimport getSwaggerDefaultConfig from \"./utils/helpers/get-swagger-default-configs\";\nimport { importEsmPreventingTsTransformation } from \"../../utils/helpers/global.helpers\";\nimport generateSystemJsonSchemas from \"./utils/helpers/json-schema-generators/generate-system-json-schemas\";\nimport getFileUploadJsonSchemaPaths from \"./utils/helpers/get-file-upload-json-schema-paths\";\n\nconst swaggerRouter = Router();\n\nexport async function getSwaggerRouter(\n arkosConfig: ArkosConfig\n): Promise<Router> {\n let defaultJsonSchemas = await getOpenAPIJsonSchemasByConfigMode(arkosConfig);\n const defaultModelsPaths = await generatePathsForModels(arkosConfig);\n const fileUploadDefaultPaths = getFileUploadJsonSchemaPaths(arkosConfig);\n const missingJsonSchemas =\n await missingJsonSchemaGenerator.generateMissingJsonSchemas(\n defaultModelsPaths,\n defaultJsonSchemas,\n arkosConfig\n );\n\n defaultJsonSchemas = {\n ...defaultJsonSchemas,\n ...missingJsonSchemas,\n ...generateSystemJsonSchemas(arkosConfig),\n };\n\n const swaggerConfigs = deepmerge(\n (await getSwaggerDefaultConfig(\n {\n ...defaultModelsPaths,\n ...fileUploadDefaultPaths,\n },\n defaultJsonSchemas\n )) || {},\n arkosConfig.swagger || {}\n ) as ArkosConfig[\"swagger\"];\n\n const { definition, ...options } = swaggerConfigs?.options!;\n\n const swaggerSpecification = swaggerJsdoc({\n definition: definition as swaggerJsdoc.SwaggerDefinition,\n ...options,\n });\n\n const scalar = await importEsmPreventingTsTransformation(\n \"@scalar/express-api-reference\"\n );\n\n swaggerRouter.use(\n swaggerConfigs!.endpoint!,\n scalar.apiReference({\n content: swaggerSpecification,\n ...swaggerConfigs?.scalarApiReferenceConfiguration,\n })\n );\n\n return swaggerRouter;\n}\n"]}
@@ -8,7 +8,7 @@ const dynamic_loader_1 = require("../../../../utils/dynamic-loader");
8
8
  const base_router_helpers_1 = require("../../../base/utils/helpers/base.router.helpers");
9
9
  const deepmerge_helper_1 = __importDefault(require("../../../../utils/helpers/deepmerge.helper"));
10
10
  const file_upload_service_1 = require("../../../file-upload/file-upload.service");
11
- async function getFileUploadJsonSchemaPaths(arkosConfig) {
11
+ function getFileUploadJsonSchemaPaths(arkosConfig) {
12
12
  const paths = {};
13
13
  if (!arkosConfig.fileUpload)
14
14
  return paths;
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-upload-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.ts"],"names":[],"mappings":";;;;;AAOA,+CA4bC;AAjcD,qEAAuE;AACvE,yFAAqF;AACrF,kGAAmE;AACnE,kFAAyF;AAE1E,KAAK,UAAU,4BAA4B,CACxD,WAAwB;IAExB,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,IAAI,CAAC,WAAW,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE1C,MAAM,0BAA0B,GAAG,IAAA,oCAAmB,EAAC,aAAa,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,0BAA0B,EAAE,MAAM;QACrD,EAAE,MAAqC,CAAC;IAC1C,MAAM,WAAW,GAAG,0BAA0B,EAAE,WAAW,CAAC;IAE5D,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAEjD,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAW,EAAE;QACjE,OAAO,IAAA,wCAAkB,EAAC,YAAY,EAAE,QAA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AAS,EAAE;gBACT,KAAK,EAAE;oBACL,WAAW,EAAE,2BAA2B;iBACzC;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,gBAAgB;iBAC9B;gBACD,GAAG,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI;oBACrC,KAAK,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE;oBACjD,KAAK,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE;iBACnE,CAAC;aACH;SACF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\nimport deepmerge from \"../../../../utils/helpers/deepmerge.helper\";\nimport { fileUploadDefaultRestrictions } from \"../../../file-upload/file-upload.service\";\n\nexport default async function getFileUploadJsonSchemaPaths(\n arkosConfig: ArkosConfig\n) {\n const paths: OpenAPIV3.PathsObject = {};\n\n if (!arkosConfig.fileUpload) return paths;\n\n const FileUploadModuleComponents = getModuleComponents(\"file-upload\");\n const routerConfig = FileUploadModuleComponents?.router\n ?.config as RouterConfig<\"file-upload\">;\n const authConfigs = FileUploadModuleComponents?.authConfigs;\n\n if (routerConfig?.disable === true) return paths;\n\n const isFileUploadEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n const basePathname = arkosConfig.fileUpload?.baseRoute || \"/api/uploads/\";\n const baseUploadDir = arkosConfig.fileUpload?.baseUploadDir || \"uploads\";\n\n const restrictions = deepmerge(\n fileUploadDefaultRestrictions,\n arkosConfig.fileUpload?.restrictions || {}\n );\n\n const formatBytes = (bytes: number): string => {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + \" \" + sizes[i];\n };\n\n const getFileTypeDescription = (fileType: string): string => {\n const restriction = restrictions[fileType as keyof typeof restrictions];\n if (!restriction) return \"\";\n\n const maxSize = formatBytes(restriction.maxSize!);\n const maxCount = restriction.maxCount;\n const formats = restriction.supportedFilesRegex\n ?.toString()\n .replace(/\\|/g, \", \")\n .replace(/\\//g, \"\")\n .replace(/\\.\\*/g, \"any format\");\n\n return `Maximum file size: ${maxSize}. Maximum files per upload: ${maxCount}. Supported formats: ${formats}`;\n };\n\n const shouldIncludeSecurity = (\n action: \"View\" | \"Create\" | \"Update\" | \"Delete\"\n ): boolean => {\n const authControl = authConfigs?.authenticationControl;\n if (!authControl) return false;\n\n if (typeof authControl === \"boolean\") return authControl;\n if (typeof authControl === \"object\") {\n return authControl[action] === true;\n }\n\n return false;\n };\n\n if (!isFileUploadEndpointDisabled(\"findFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{filePath*}`] = {\n get: {\n tags: [\"File Upload\"],\n summary: \"Retrieve uploaded file\",\n description: `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`,\n operationId: \"findFile\",\n ...(shouldIncludeSecurity(\"View\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"filePath\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description:\n \"Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)\",\n },\n ],\n responses: {\n \"200\": {\n description: \"File retrieved successfully\",\n content: {\n \"application/octet-stream\": {\n schema: {\n type: \"string\",\n format: \"binary\",\n },\n },\n },\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"View\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to view files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"uploadFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}`] = {\n post: {\n tags: [\"File Upload\"],\n summary: \"Upload file(s)\",\n description:\n \"Upload one or multiple files. Supports image processing options for image uploads.\",\n operationId: \"uploadFile\",\n ...(shouldIncludeSecurity(\"Create\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being uploaded\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File(s) uploaded successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of uploaded file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of uploaded files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n ...(shouldIncludeSecurity(\"Create\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to upload files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"updateFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {\n ...(paths[`${cleanBasePath}/{fileType}/{fileName}`] || {}),\n patch: {\n tags: [\"File Upload\"],\n summary: \"Update existing file\",\n description:\n \"Replace an existing file with a new one. Deletes the old file and uploads the new one.\",\n operationId: \"updateFile\",\n ...(shouldIncludeSecurity(\"Update\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being updated\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to update\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of updated file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of updated files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n \"404\": {\n description: \"Original file not found\",\n },\n ...(shouldIncludeSecurity(\"Update\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to update files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"deleteFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n if (!paths[`${cleanBasePath}/{fileType}/{fileName}`]) {\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {};\n }\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`]!.delete = {\n tags: [\"File Upload\"],\n summary: \"Delete file\",\n description: \"Delete an uploaded file from the server\",\n operationId: \"deleteFile\",\n ...(shouldIncludeSecurity(\"Delete\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being deleted\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to delete\",\n },\n ],\n responses: {\n \"204\": {\n description: \"File deleted successfully\",\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"Delete\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to delete files\" },\n }),\n },\n };\n }\n\n return paths;\n}\n"]}
1
+ {"version":3,"file":"get-file-upload-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.ts"],"names":[],"mappings":";;;;;AAOA,+CA0bC;AA/bD,qEAAuE;AACvE,yFAAqF;AACrF,kGAAmE;AACnE,kFAAyF;AAEzF,SAAwB,4BAA4B,CAAC,WAAwB;IAC3E,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,IAAI,CAAC,WAAW,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE1C,MAAM,0BAA0B,GAAG,IAAA,oCAAmB,EAAC,aAAa,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,0BAA0B,EAAE,MAAM;QACrD,EAAE,MAAqC,CAAC;IAC1C,MAAM,WAAW,GAAG,0BAA0B,EAAE,WAAW,CAAC;IAE5D,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAEjD,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAW,EAAE;QACjE,OAAO,IAAA,wCAAkB,EAAC,YAAY,EAAE,QAAe,CAAC,CAAC;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T,KAAK,EAAE;oBACL,WAAW,EAAE,2BAA2B;iBACzC;gBACD,KAAK,EAAE;oBACL,WAAW,EAAE,gBAAgB;iBAC9B;gBACD,GAAG,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI;oBACrC,KAAK,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE;oBACjD,KAAK,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE;iBACnE,CAAC;aACH;SACF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\nimport deepmerge from \"../../../../utils/helpers/deepmerge.helper\";\nimport { fileUploadDefaultRestrictions } from \"../../../file-upload/file-upload.service\";\n\nexport default function getFileUploadJsonSchemaPaths(arkosConfig: ArkosConfig) {\n const paths: OpenAPIV3.PathsObject = {};\n\n if (!arkosConfig.fileUpload) return paths;\n\n const FileUploadModuleComponents = getModuleComponents(\"file-upload\");\n const routerConfig = FileUploadModuleComponents?.router\n ?.config as RouterConfig<\"file-upload\">;\n const authConfigs = FileUploadModuleComponents?.authConfigs;\n\n if (routerConfig?.disable === true) return paths;\n\n const isFileUploadEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n const basePathname = arkosConfig.fileUpload?.baseRoute || \"/api/uploads/\";\n const baseUploadDir = arkosConfig.fileUpload?.baseUploadDir || \"uploads\";\n\n const restrictions = deepmerge(\n fileUploadDefaultRestrictions,\n arkosConfig.fileUpload?.restrictions || {}\n );\n\n const formatBytes = (bytes: number): string => {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + \" \" + sizes[i];\n };\n\n const getFileTypeDescription = (fileType: string): string => {\n const restriction = restrictions[fileType as keyof typeof restrictions];\n if (!restriction) return \"\";\n\n const maxSize = formatBytes(restriction.maxSize!);\n const maxCount = restriction.maxCount;\n const formats = restriction.supportedFilesRegex\n ?.toString()\n .replace(/\\|/g, \", \")\n .replace(/\\//g, \"\")\n .replace(/\\.\\*/g, \"any format\");\n\n return `Maximum file size: ${maxSize}. Maximum files per upload: ${maxCount}. Supported formats: ${formats}`;\n };\n\n const shouldIncludeSecurity = (\n action: \"View\" | \"Create\" | \"Update\" | \"Delete\"\n ): boolean => {\n const authControl = authConfigs?.authenticationControl;\n if (!authControl) return false;\n\n if (typeof authControl === \"boolean\") return authControl;\n if (typeof authControl === \"object\") {\n return authControl[action] === true;\n }\n\n return false;\n };\n\n if (!isFileUploadEndpointDisabled(\"findFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{filePath*}`] = {\n get: {\n tags: [\"File Upload\"],\n summary: \"Retrieve uploaded file\",\n description: `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`,\n operationId: \"findFile\",\n ...(shouldIncludeSecurity(\"View\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"filePath\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description:\n \"Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)\",\n },\n ],\n responses: {\n \"200\": {\n description: \"File retrieved successfully\",\n content: {\n \"application/octet-stream\": {\n schema: {\n type: \"string\",\n format: \"binary\",\n },\n },\n },\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"View\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to view files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"uploadFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}`] = {\n post: {\n tags: [\"File Upload\"],\n summary: \"Upload file(s)\",\n description:\n \"Upload one or multiple files. Supports image processing options for image uploads.\",\n operationId: \"uploadFile\",\n ...(shouldIncludeSecurity(\"Create\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being uploaded\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File(s) uploaded successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of uploaded file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of uploaded files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n ...(shouldIncludeSecurity(\"Create\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to upload files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"updateFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {\n ...(paths[`${cleanBasePath}/{fileType}/{fileName}`] || {}),\n patch: {\n tags: [\"File Upload\"],\n summary: \"Update existing file\",\n description:\n \"Replace an existing file with a new one. Deletes the old file and uploads the new one.\",\n operationId: \"updateFile\",\n ...(shouldIncludeSecurity(\"Update\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being updated\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to update\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of updated file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of updated files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n \"404\": {\n description: \"Original file not found\",\n },\n ...(shouldIncludeSecurity(\"Update\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to update files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"deleteFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n if (!paths[`${cleanBasePath}/{fileType}/{fileName}`]) {\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {};\n }\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`]!.delete = {\n tags: [\"File Upload\"],\n summary: \"Delete file\",\n description: \"Delete an uploaded file from the server\",\n operationId: \"deleteFile\",\n ...(shouldIncludeSecurity(\"Delete\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being deleted\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to delete\",\n },\n ],\n responses: {\n \"204\": {\n description: \"File deleted successfully\",\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"Delete\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to delete files\" },\n }),\n },\n };\n }\n\n return paths;\n}\n"]}
@@ -19,6 +19,6 @@ function killServerChildProcess() {
19
19
  (0, start_1.killProductionServerChildProcess)();
20
20
  }
21
21
  function getVersion() {
22
- return "1.3.7-canary.6";
22
+ return "1.3.7-canary.8";
23
23
  }
24
24
  //# sourceMappingURL=cli.helpers.js.map
@@ -11,15 +11,17 @@ const swaggerRouter = Router();
11
11
  export async function getSwaggerRouter(arkosConfig) {
12
12
  let defaultJsonSchemas = await getOpenAPIJsonSchemasByConfigMode(arkosConfig);
13
13
  const defaultModelsPaths = await generatePathsForModels(arkosConfig);
14
+ const fileUploadDefaultPaths = getFileUploadJsonSchemaPaths(arkosConfig);
14
15
  const missingJsonSchemas = await missingJsonSchemaGenerator.generateMissingJsonSchemas(defaultModelsPaths, defaultJsonSchemas, arkosConfig);
15
16
  defaultJsonSchemas = {
16
17
  ...defaultJsonSchemas,
17
18
  ...missingJsonSchemas,
18
19
  ...generateSystemJsonSchemas(arkosConfig),
19
- ...getFileUploadJsonSchemaPaths(arkosConfig),
20
20
  };
21
- const swaggerConfigs = deepmerge((await getSwaggerDefaultConfig(defaultModelsPaths, defaultJsonSchemas)) ||
22
- {}, arkosConfig.swagger || {});
21
+ const swaggerConfigs = deepmerge((await getSwaggerDefaultConfig({
22
+ ...defaultModelsPaths,
23
+ ...fileUploadDefaultPaths,
24
+ }, defaultJsonSchemas)) || {}, arkosConfig.swagger || {});
23
25
  const { definition, ...options } = swaggerConfigs?.options;
24
26
  const swaggerSpecification = swaggerJsdoc({
25
27
  definition: definition,
@@ -1 +1 @@
1
- {"version":3,"file":"swagger.router.js","sourceRoot":"","sources":["../../../../src/modules/swagger/swagger.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,SAAS,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,wCAAwC,CAAC;AAChD,OAAO,0BAA0B,MAAM,gDAAgD,CAAC;AACxF,OAAO,uBAAuB,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,yBAAyB,MAAM,qEAAqE,CAAC;AAC5G,OAAO,4BAA4B,MAAM,mDAAmD,CAAC;AAE7F,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,WAAwB;IAExB,IAAI,kBAAkB,GAAG,MAAM,iCAAiC,CAAC,WAAW,CAAC,CAAC;IAC9E,MAAM,kBAAkB,GAAG,MAAM,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,kBAAkB,GACtB,MAAM,0BAA0B,CAAC,0BAA0B,CACzD,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,CACZ,CAAC;IAEJ,kBAAkB,GAAG;QACnB,GAAG,kBAAkB;QACrB,GAAG,kBAAkB;QACrB,GAAG,yBAAyB,CAAC,WAAW,CAAC;QACzC,GAAG,4BAA4B,CAAC,WAAW,CAAC;KAC7C,CAAC;IAEF,MAAM,cAAc,GAAG,SAAS,CAC9B,CAAC,MAAM,uBAAuB,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QACrE,EAAE,EACJ,WAAW,CAAC,OAAO,IAAI,EAAE,CACA,CAAC;IAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,OAAQ,CAAC;IAE5D,MAAM,oBAAoB,GAAG,YAAY,CAAC;QACxC,UAAU,EAAE,UAA4C;QACxD,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,mCAAmC,CACtD,+BAA+B,CAChC,CAAC;IAEF,aAAa,CAAC,GAAG,CACf,cAAe,CAAC,QAAS,EACzB,MAAM,CAAC,YAAY,CAAC;QAClB,OAAO,EAAE,oBAAoB;QAC7B,GAAG,cAAc,EAAE,+BAA+B;KACnD,CAAC,CACH,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { Router } from \"express\";\nimport swaggerJsdoc from \"swagger-jsdoc\";\nimport { ArkosConfig } from \"../../types/arkos-config\";\nimport deepmerge from \"../../utils/helpers/deepmerge.helper\";\nimport {\n generatePathsForModels,\n getOpenAPIJsonSchemasByConfigMode,\n} from \"./utils/helpers/swagger.router.helpers\";\nimport missingJsonSchemaGenerator from \"./utils/helpers/missing-json-schemas-generator\";\nimport getSwaggerDefaultConfig from \"./utils/helpers/get-swagger-default-configs\";\nimport { importEsmPreventingTsTransformation } from \"../../utils/helpers/global.helpers\";\nimport generateSystemJsonSchemas from \"./utils/helpers/json-schema-generators/generate-system-json-schemas\";\nimport getFileUploadJsonSchemaPaths from \"./utils/helpers/get-file-upload-json-schema-paths\";\n\nconst swaggerRouter = Router();\n\nexport async function getSwaggerRouter(\n arkosConfig: ArkosConfig\n): Promise<Router> {\n let defaultJsonSchemas = await getOpenAPIJsonSchemasByConfigMode(arkosConfig);\n const defaultModelsPaths = await generatePathsForModels(arkosConfig);\n const missingJsonSchemas =\n await missingJsonSchemaGenerator.generateMissingJsonSchemas(\n defaultModelsPaths,\n defaultJsonSchemas,\n arkosConfig\n );\n\n defaultJsonSchemas = {\n ...defaultJsonSchemas,\n ...missingJsonSchemas,\n ...generateSystemJsonSchemas(arkosConfig),\n ...getFileUploadJsonSchemaPaths(arkosConfig),\n };\n\n const swaggerConfigs = deepmerge(\n (await getSwaggerDefaultConfig(defaultModelsPaths, defaultJsonSchemas)) ||\n {},\n arkosConfig.swagger || {}\n ) as ArkosConfig[\"swagger\"];\n\n const { definition, ...options } = swaggerConfigs?.options!;\n\n const swaggerSpecification = swaggerJsdoc({\n definition: definition as swaggerJsdoc.SwaggerDefinition,\n ...options,\n });\n\n const scalar = await importEsmPreventingTsTransformation(\n \"@scalar/express-api-reference\"\n );\n\n swaggerRouter.use(\n swaggerConfigs!.endpoint!,\n scalar.apiReference({\n content: swaggerSpecification,\n ...swaggerConfigs?.scalarApiReferenceConfiguration,\n })\n );\n\n return swaggerRouter;\n}\n"]}
1
+ {"version":3,"file":"swagger.router.js","sourceRoot":"","sources":["../../../../src/modules/swagger/swagger.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,SAAS,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,wCAAwC,CAAC;AAChD,OAAO,0BAA0B,MAAM,gDAAgD,CAAC;AACxF,OAAO,uBAAuB,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,yBAAyB,MAAM,qEAAqE,CAAC;AAC5G,OAAO,4BAA4B,MAAM,mDAAmD,CAAC;AAE7F,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,WAAwB;IAExB,IAAI,kBAAkB,GAAG,MAAM,iCAAiC,CAAC,WAAW,CAAC,CAAC;IAC9E,MAAM,kBAAkB,GAAG,MAAM,sBAAsB,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,sBAAsB,GAAG,4BAA4B,CAAC,WAAW,CAAC,CAAC;IACzE,MAAM,kBAAkB,GACtB,MAAM,0BAA0B,CAAC,0BAA0B,CACzD,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,CACZ,CAAC;IAEJ,kBAAkB,GAAG;QACnB,GAAG,kBAAkB;QACrB,GAAG,kBAAkB;QACrB,GAAG,yBAAyB,CAAC,WAAW,CAAC;KAC1C,CAAC;IAEF,MAAM,cAAc,GAAG,SAAS,CAC9B,CAAC,MAAM,uBAAuB,CAC5B;QACE,GAAG,kBAAkB;QACrB,GAAG,sBAAsB;KAC1B,EACD,kBAAkB,CACnB,CAAC,IAAI,EAAE,EACR,WAAW,CAAC,OAAO,IAAI,EAAE,CACA,CAAC;IAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,OAAQ,CAAC;IAE5D,MAAM,oBAAoB,GAAG,YAAY,CAAC;QACxC,UAAU,EAAE,UAA4C;QACxD,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,mCAAmC,CACtD,+BAA+B,CAChC,CAAC;IAEF,aAAa,CAAC,GAAG,CACf,cAAe,CAAC,QAAS,EACzB,MAAM,CAAC,YAAY,CAAC;QAClB,OAAO,EAAE,oBAAoB;QAC7B,GAAG,cAAc,EAAE,+BAA+B;KACnD,CAAC,CACH,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { Router } from \"express\";\nimport swaggerJsdoc from \"swagger-jsdoc\";\nimport { ArkosConfig } from \"../../types/arkos-config\";\nimport deepmerge from \"../../utils/helpers/deepmerge.helper\";\nimport {\n generatePathsForModels,\n getOpenAPIJsonSchemasByConfigMode,\n} from \"./utils/helpers/swagger.router.helpers\";\nimport missingJsonSchemaGenerator from \"./utils/helpers/missing-json-schemas-generator\";\nimport getSwaggerDefaultConfig from \"./utils/helpers/get-swagger-default-configs\";\nimport { importEsmPreventingTsTransformation } from \"../../utils/helpers/global.helpers\";\nimport generateSystemJsonSchemas from \"./utils/helpers/json-schema-generators/generate-system-json-schemas\";\nimport getFileUploadJsonSchemaPaths from \"./utils/helpers/get-file-upload-json-schema-paths\";\n\nconst swaggerRouter = Router();\n\nexport async function getSwaggerRouter(\n arkosConfig: ArkosConfig\n): Promise<Router> {\n let defaultJsonSchemas = await getOpenAPIJsonSchemasByConfigMode(arkosConfig);\n const defaultModelsPaths = await generatePathsForModels(arkosConfig);\n const fileUploadDefaultPaths = getFileUploadJsonSchemaPaths(arkosConfig);\n const missingJsonSchemas =\n await missingJsonSchemaGenerator.generateMissingJsonSchemas(\n defaultModelsPaths,\n defaultJsonSchemas,\n arkosConfig\n );\n\n defaultJsonSchemas = {\n ...defaultJsonSchemas,\n ...missingJsonSchemas,\n ...generateSystemJsonSchemas(arkosConfig),\n };\n\n const swaggerConfigs = deepmerge(\n (await getSwaggerDefaultConfig(\n {\n ...defaultModelsPaths,\n ...fileUploadDefaultPaths,\n },\n defaultJsonSchemas\n )) || {},\n arkosConfig.swagger || {}\n ) as ArkosConfig[\"swagger\"];\n\n const { definition, ...options } = swaggerConfigs?.options!;\n\n const swaggerSpecification = swaggerJsdoc({\n definition: definition as swaggerJsdoc.SwaggerDefinition,\n ...options,\n });\n\n const scalar = await importEsmPreventingTsTransformation(\n \"@scalar/express-api-reference\"\n );\n\n swaggerRouter.use(\n swaggerConfigs!.endpoint!,\n scalar.apiReference({\n content: swaggerSpecification,\n ...swaggerConfigs?.scalarApiReferenceConfiguration,\n })\n );\n\n return swaggerRouter;\n}\n"]}
@@ -2,7 +2,7 @@ import { getModuleComponents } from "../../../../utils/dynamic-loader.js";
2
2
  import { isEndpointDisabled } from "../../../base/utils/helpers/base.router.helpers.js";
3
3
  import deepmerge from "../../../../utils/helpers/deepmerge.helper.js";
4
4
  import { fileUploadDefaultRestrictions } from "../../../file-upload/file-upload.service.js";
5
- export default async function getFileUploadJsonSchemaPaths(arkosConfig) {
5
+ export default function getFileUploadJsonSchemaPaths(arkosConfig) {
6
6
  const paths = {};
7
7
  if (!arkosConfig.fileUpload)
8
8
  return paths;
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-upload-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,SAAS,MAAM,4CAA4C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B,CACxD,WAAwB;IAExB,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,IAAI,CAAC,WAAW,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE1C,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,0BAA0B,EAAE,MAAM;QACrD,EAAE,MAAqC,CAAC;IAC1C,MAAM,WAAW,GAAG,0BAA0B,EAAE,WAAW,CAAC;IAE5D,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAEjD,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAW,EAAE;QACjE,OAAO,kBAAkB,CAAC,YAAY,EAAE,QAAe,CAAC,CAAC;IAC3D,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,EAAE,SAAS,IAAI,eAAe,CAAC;IAC1E,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,EAAE,aAAa,IAAI,SAAS,CAAC;IAEzE,MAAM,YAAY,GAAG,SAAS,CAC5B,6BAA6B,EAC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,EAAE,WAAW,EAAE,0CAA0C,EAAE;iBACnE,CAAC;aACH;SACF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\nimport deepmerge from \"../../../../utils/helpers/deepmerge.helper\";\nimport { fileUploadDefaultRestrictions } from \"../../../file-upload/file-upload.service\";\n\nexport default async function getFileUploadJsonSchemaPaths(\n arkosConfig: ArkosConfig\n) {\n const paths: OpenAPIV3.PathsObject = {};\n\n if (!arkosConfig.fileUpload) return paths;\n\n const FileUploadModuleComponents = getModuleComponents(\"file-upload\");\n const routerConfig = FileUploadModuleComponents?.router\n ?.config as RouterConfig<\"file-upload\">;\n const authConfigs = FileUploadModuleComponents?.authConfigs;\n\n if (routerConfig?.disable === true) return paths;\n\n const isFileUploadEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n const basePathname = arkosConfig.fileUpload?.baseRoute || \"/api/uploads/\";\n const baseUploadDir = arkosConfig.fileUpload?.baseUploadDir || \"uploads\";\n\n const restrictions = deepmerge(\n fileUploadDefaultRestrictions,\n arkosConfig.fileUpload?.restrictions || {}\n );\n\n const formatBytes = (bytes: number): string => {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + \" \" + sizes[i];\n };\n\n const getFileTypeDescription = (fileType: string): string => {\n const restriction = restrictions[fileType as keyof typeof restrictions];\n if (!restriction) return \"\";\n\n const maxSize = formatBytes(restriction.maxSize!);\n const maxCount = restriction.maxCount;\n const formats = restriction.supportedFilesRegex\n ?.toString()\n .replace(/\\|/g, \", \")\n .replace(/\\//g, \"\")\n .replace(/\\.\\*/g, \"any format\");\n\n return `Maximum file size: ${maxSize}. Maximum files per upload: ${maxCount}. Supported formats: ${formats}`;\n };\n\n const shouldIncludeSecurity = (\n action: \"View\" | \"Create\" | \"Update\" | \"Delete\"\n ): boolean => {\n const authControl = authConfigs?.authenticationControl;\n if (!authControl) return false;\n\n if (typeof authControl === \"boolean\") return authControl;\n if (typeof authControl === \"object\") {\n return authControl[action] === true;\n }\n\n return false;\n };\n\n if (!isFileUploadEndpointDisabled(\"findFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{filePath*}`] = {\n get: {\n tags: [\"File Upload\"],\n summary: \"Retrieve uploaded file\",\n description: `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`,\n operationId: \"findFile\",\n ...(shouldIncludeSecurity(\"View\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"filePath\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description:\n \"Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)\",\n },\n ],\n responses: {\n \"200\": {\n description: \"File retrieved successfully\",\n content: {\n \"application/octet-stream\": {\n schema: {\n type: \"string\",\n format: \"binary\",\n },\n },\n },\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"View\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to view files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"uploadFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}`] = {\n post: {\n tags: [\"File Upload\"],\n summary: \"Upload file(s)\",\n description:\n \"Upload one or multiple files. Supports image processing options for image uploads.\",\n operationId: \"uploadFile\",\n ...(shouldIncludeSecurity(\"Create\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being uploaded\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File(s) uploaded successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of uploaded file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of uploaded files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n ...(shouldIncludeSecurity(\"Create\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to upload files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"updateFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {\n ...(paths[`${cleanBasePath}/{fileType}/{fileName}`] || {}),\n patch: {\n tags: [\"File Upload\"],\n summary: \"Update existing file\",\n description:\n \"Replace an existing file with a new one. Deletes the old file and uploads the new one.\",\n operationId: \"updateFile\",\n ...(shouldIncludeSecurity(\"Update\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being updated\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to update\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of updated file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of updated files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n \"404\": {\n description: \"Original file not found\",\n },\n ...(shouldIncludeSecurity(\"Update\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to update files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"deleteFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n if (!paths[`${cleanBasePath}/{fileType}/{fileName}`]) {\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {};\n }\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`]!.delete = {\n tags: [\"File Upload\"],\n summary: \"Delete file\",\n description: \"Delete an uploaded file from the server\",\n operationId: \"deleteFile\",\n ...(shouldIncludeSecurity(\"Delete\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being deleted\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to delete\",\n },\n ],\n responses: {\n \"204\": {\n description: \"File deleted successfully\",\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"Delete\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to delete files\" },\n }),\n },\n };\n }\n\n return paths;\n}\n"]}
1
+ {"version":3,"file":"get-file-upload-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,SAAS,MAAM,4CAA4C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,WAAwB;IAC3E,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,IAAI,CAAC,WAAW,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IAE1C,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,0BAA0B,EAAE,MAAM;QACrD,EAAE,MAAqC,CAAC;IAC1C,MAAM,WAAW,GAAG,0BAA0B,EAAE,WAAW,CAAC;IAE5D,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAEjD,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAW,EAAE;QACjE,OAAO,kBAAkB,CAAC,YAAY,EAAE,QAAe,CAAC,CAAC;IAC3D,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,EAAE,SAAS,IAAI,eAAe,CAAC;IAC1E,MAAM,aAAa,GA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BAAqB,CAAC,QAAQ,CAAC,IAAI;oBACrC,KAAK,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE;oBACjD,KAAK,EAAE,EAAE,WAAW,EAAE,0CAA0C,EAAE;iBACnE,CAAC;aACH;SACF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\nimport deepmerge from \"../../../../utils/helpers/deepmerge.helper\";\nimport { fileUploadDefaultRestrictions } from \"../../../file-upload/file-upload.service\";\n\nexport default function getFileUploadJsonSchemaPaths(arkosConfig: ArkosConfig) {\n const paths: OpenAPIV3.PathsObject = {};\n\n if (!arkosConfig.fileUpload) return paths;\n\n const FileUploadModuleComponents = getModuleComponents(\"file-upload\");\n const routerConfig = FileUploadModuleComponents?.router\n ?.config as RouterConfig<\"file-upload\">;\n const authConfigs = FileUploadModuleComponents?.authConfigs;\n\n if (routerConfig?.disable === true) return paths;\n\n const isFileUploadEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n const basePathname = arkosConfig.fileUpload?.baseRoute || \"/api/uploads/\";\n const baseUploadDir = arkosConfig.fileUpload?.baseUploadDir || \"uploads\";\n\n const restrictions = deepmerge(\n fileUploadDefaultRestrictions,\n arkosConfig.fileUpload?.restrictions || {}\n );\n\n const formatBytes = (bytes: number): string => {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + \" \" + sizes[i];\n };\n\n const getFileTypeDescription = (fileType: string): string => {\n const restriction = restrictions[fileType as keyof typeof restrictions];\n if (!restriction) return \"\";\n\n const maxSize = formatBytes(restriction.maxSize!);\n const maxCount = restriction.maxCount;\n const formats = restriction.supportedFilesRegex\n ?.toString()\n .replace(/\\|/g, \", \")\n .replace(/\\//g, \"\")\n .replace(/\\.\\*/g, \"any format\");\n\n return `Maximum file size: ${maxSize}. Maximum files per upload: ${maxCount}. Supported formats: ${formats}`;\n };\n\n const shouldIncludeSecurity = (\n action: \"View\" | \"Create\" | \"Update\" | \"Delete\"\n ): boolean => {\n const authControl = authConfigs?.authenticationControl;\n if (!authControl) return false;\n\n if (typeof authControl === \"boolean\") return authControl;\n if (typeof authControl === \"object\") {\n return authControl[action] === true;\n }\n\n return false;\n };\n\n if (!isFileUploadEndpointDisabled(\"findFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{filePath*}`] = {\n get: {\n tags: [\"File Upload\"],\n summary: \"Retrieve uploaded file\",\n description: `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`,\n operationId: \"findFile\",\n ...(shouldIncludeSecurity(\"View\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"filePath\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description:\n \"Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)\",\n },\n ],\n responses: {\n \"200\": {\n description: \"File retrieved successfully\",\n content: {\n \"application/octet-stream\": {\n schema: {\n type: \"string\",\n format: \"binary\",\n },\n },\n },\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"View\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to view files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"uploadFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}`] = {\n post: {\n tags: [\"File Upload\"],\n summary: \"Upload file(s)\",\n description:\n \"Upload one or multiple files. Supports image processing options for image uploads.\",\n operationId: \"uploadFile\",\n ...(shouldIncludeSecurity(\"Create\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being uploaded\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File(s) uploaded successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of uploaded file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of uploaded files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n ...(shouldIncludeSecurity(\"Create\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to upload files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"updateFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {\n ...(paths[`${cleanBasePath}/{fileType}/{fileName}`] || {}),\n patch: {\n tags: [\"File Upload\"],\n summary: \"Update existing file\",\n description:\n \"Replace an existing file with a new one. Deletes the old file and uploads the new one.\",\n operationId: \"updateFile\",\n ...(shouldIncludeSecurity(\"Update\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being updated\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to update\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description:\n \"Resize strategy (only applicable for fileType=images)\",\n },\n ],\n requestBody: {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: \"File updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of updated file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of updated files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n \"404\": {\n description: \"Original file not found\",\n },\n ...(shouldIncludeSecurity(\"Update\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to update files\" },\n }),\n },\n },\n };\n }\n\n if (!isFileUploadEndpointDisabled(\"deleteFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n\n if (!paths[`${cleanBasePath}/{fileType}/{fileName}`]) {\n paths[`${cleanBasePath}/{fileType}/{fileName}`] = {};\n }\n\n paths[`${cleanBasePath}/{fileType}/{fileName}`]!.delete = {\n tags: [\"File Upload\"],\n summary: \"Delete file\",\n description: \"Delete an uploaded file from the server\",\n operationId: \"deleteFile\",\n ...(shouldIncludeSecurity(\"Delete\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being deleted\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to delete\",\n },\n ],\n responses: {\n \"204\": {\n description: \"File deleted successfully\",\n },\n \"404\": {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"Delete\") && {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions to delete files\" },\n }),\n },\n };\n }\n\n return paths;\n}\n"]}
@@ -11,6 +11,6 @@ export function killServerChildProcess() {
11
11
  killProductionServerChildProcess();
12
12
  }
13
13
  export function getVersion() {
14
- return "1.3.7-canary.6";
14
+ return "1.3.7-canary.8";
15
15
  }
16
16
  //# sourceMappingURL=cli.helpers.js.map
@@ -1,3 +1,3 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
2
  import { ArkosConfig } from "../../../../exports";
3
- export default function getFileUploadJsonSchemaPaths(arkosConfig: ArkosConfig): Promise<OpenAPIV3.PathsObject<{}, {}>>;
3
+ export default function getFileUploadJsonSchemaPaths(arkosConfig: ArkosConfig): OpenAPIV3.PathsObject<{}, {}>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "1.3.7-canary.6",
3
+ "version": "1.3.7-canary.8",
4
4
  "description": "The Express & Prisma RESTful Framework",
5
5
  "main": "dist/cjs/exports/index.js",
6
6
  "module": "dist/esm/exports/index.js",