arkos 1.4.1-canary.10 → 1.4.1-canary.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +27 -9
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +28 -11
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
- package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +6 -0
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +27 -9
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +28 -11
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
- package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js +6 -0
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma-json-schema-generator.js","sourceRoot":"","sources":["../../../../src/utils/prisma/prisma-json-schema-generator.ts"],"names":[],"mappings":";;;;;;AAEA,mFAAoD;AACpD,sDAG2B;AAC3B,kFAAwD;AAOxD,uGAAsG;AAetG,MAAa,yBAAyB;IAAtC;QACE,WAAM,GAAG,8BAAkB,CAAC,KAAK,EAAE,CAAC;IA2vBtC,CAAC;IAtvBC,oBAAoB,CAAC,MAA8B;QACjD,MAAM,EACJ,SAAS,EACT,WAAW,EACX,iBAAiB,GAAG;YAClB,OAAO;YACP,OAAO;YACP,QAAQ;YAC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port { AuthPrismaQueryOptions, PrismaQueryOptions } from \"../../types\";\nimport deepmerge from \"../helpers/deepmerge.helper\";\nimport {\n getModuleComponents,\n ValidationFileMappingKey,\n} from \"../dynamic-loader\";\nimport prismaSchemaParser from \"./prisma-schema-parser\";\nimport {\n PrismaModel,\n PrismaField,\n JsonSchema,\n JsonSchemaProperty,\n} from \"./types\";\nimport { localValidatorFileExists } from \"../../modules/swagger/utils/helpers/swagger.router.helpers\";\n\nexport interface SchemaGenerationConfig {\n modelName: string;\n arkosConfig: ArkosConfig;\n schemasToGenerate?: ValidationFileMappingKey[];\n}\n\nexport interface GeneratedSchemas {\n [key: string]: JsonSchema;\n}\n\n/**\n * Enhanced JSON Schema generator that creates schemas based on Prisma models and query options\n */\nexport class PrismaJsonSchemaGenerator {\n schema = prismaSchemaParser.parse();\n\n /**\n * Main method to generate all schemas for a model\n */\n generateModelSchemas(config: SchemaGenerationConfig): GeneratedSchemas {\n const {\n modelName,\n arkosConfig,\n schemasToGenerate = [\n \"model\",\n \"login\",\n \"signup\",\n \"getMe\",\n \"updateMe\",\n \"updatePassword\",\n \"create\",\n \"createOne\",\n \"createMany\",\n \"update\",\n \"updateOne\",\n \"updateMany\",\n \"query\",\n \"findOne\",\n \"findMany\",\n ],\n } = config;\n\n const moduleComponents = getModuleComponents(modelName);\n const routerConfig = moduleComponents?.router?.config || {};\n const prismaQueryOptions = moduleComponents?.prismaQueryOptions || {};\n const authModuleModel = [\"auth\", \"me\", \"password\", \"signup\", \"login\"];\n const isAuthModule = authModuleModel.includes(modelName.toLowerCase());\n\n if (arkosConfig?.swagger?.strict && arkosConfig.swagger.mode !== \"prisma\")\n return {};\n\n if (routerConfig?.disable === true) return {};\n\n const model = this.schema.models.find(\n (m) => m.name.toLowerCase() === modelName.toLowerCase()\n );\n if (!model && !isAuthModule) return {};\n\n const schemas: { [key: string]: JsonSchema } = {};\n\n if (isAuthModule) {\n this.generateAuthSchemas(\n this.schema.models.find((m) => m.name.toLowerCase() === \"user\")!,\n schemas,\n arkosConfig,\n schemasToGenerate,\n prismaQueryOptions as AuthPrismaQueryOptions<any>\n );\n } else {\n if (model)\n this.generateCrudSchemas(\n model,\n schemas,\n arkosConfig,\n schemasToGenerate,\n prismaQueryOptions as PrismaQueryOptions<any>,\n routerConfig\n );\n }\n\n return { ...schemas };\n }\n\n /**\n * Generate auth-specific schemas\n */\n private generateAuthSchemas(\n model: PrismaModel,\n schemas: { [key: string]: JsonSchema },\n arkosConfig: ArkosConfig,\n schemasToGenerate: ValidationFileMappingKey[],\n queryOptions?: AuthPrismaQueryOptions<any>,\n routerConfig?: RouterConfig\n ) {\n const modelName = \"Auth\";\n\n // if no auth activated forget those json schemas\n if (!arkosConfig?.authentication) return schemas;\n\n // Login schema (input)\n if (\n schemasToGenerate.includes(\"login\") &&\n !this.isEndpointDisabled(\"login\", routerConfig) &&\n !localValidatorFileExists(\"login\", modelName, arkosConfig)\n ) {\n schemas[`LoginSchema`] = this.generateLoginSchema(arkosConfig);\n }\n\n // Signup schema (input)\n if (\n schemasToGenerate.includes(\"signup\") &&\n !this.isEndpointDisabled(\"signup\", routerConfig) &&\n !localValidatorFileExists(\"signup\", modelName, arkosConfig)\n ) {\n schemas[`SignupSchema`] = this.generateSignupSchema(\n model,\n queryOptions?.signup\n );\n }\n\n // UpdateMe schema (input)\n if (\n schemasToGenerate.includes(\"updateMe\") &&\n !this.isEndpointDisabled(\"updateMe\", routerConfig) &&\n !localValidatorFileExists(\"updateMe\", modelName, arkosConfig)\n ) {\n schemas[`UpdateMeSchema`] = this.generateUpdateMeSchema(\n model,\n queryOptions?.updateMe\n );\n }\n\n // UpdatePassword schema (input)\n if (\n schemasToGenerate.includes(\"updatePassword\") &&\n !this.isEndpointDisabled(\"updatePassword\", routerConfig) &&\n !localValidatorFileExists(\"updatePassword\", modelName, arkosConfig)\n ) {\n schemas[`UpdatePasswordSchema`] = this.generateUpdatePasswordSchema(\n model,\n queryOptions?.updatePassword\n );\n }\n\n if (\n schemasToGenerate.includes(\"getMe\") &&\n !this.isEndpointDisabled(\"getMe\", routerConfig) &&\n !localValidatorFileExists(\"getMe\", modelName, arkosConfig)\n ) {\n schemas[`GetMeSchema`] = this.generateResponseSchema(\n model,\n queryOptions?.getMe || {},\n \"findOne\"\n );\n }\n }\n\n /**\n * Generate standard CRUD schemas\n */\n private generateCrudSchemas(\n model: PrismaModel,\n schemas: { [key: string]: JsonSchema },\n arkosConfig: ArkosConfig,\n schemasToGenerate: ValidationFileMappingKey[],\n queryOptions?: PrismaQueryOptions<any>,\n routerConfig?: RouterConfig<any>\n ) {\n const modelName = model.name;\n\n const ensureBaseSchemaReference = (\n operation: string,\n modelName: string\n ) => {\n const suffix =\n arkosConfig.validation?.resolver === \"zod\" ? \"Schema\" : \"Dto\";\n\n const singleOpName = operation === \"Create\" ? \"createOne\" : \"updateOne\";\n const hasLocalValidator = localValidatorFileExists(\n singleOpName,\n modelName,\n arkosConfig\n );\n\n if (hasLocalValidator) return `${operation}${modelName}${suffix}`;\n else {\n const modelSchemaKey = `${operation}${modelName}ModelSchema`;\n\n if (!schemas[modelSchemaKey]) {\n if (operation === \"Create\") {\n schemas[modelSchemaKey] = this.generateCreateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"createOne\")\n );\n } else if (operation === \"Update\") {\n schemas[modelSchemaKey] = this.generateUpdateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"updateOne\")\n );\n }\n }\n\n return modelSchemaKey;\n }\n };\n\n if (\n schemasToGenerate.includes(\"createOne\") &&\n !this.isEndpointDisabled(\"createOne\", routerConfig) &&\n !localValidatorFileExists(\"createOne\", modelName, arkosConfig)\n ) {\n schemas[`Create${modelName}ModelSchema`] = this.generateCreateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"createOne\")\n );\n }\n\n if (\n schemasToGenerate.includes(\"createMany\") &&\n !this.isEndpointDisabled(\"createMany\", routerConfig) &&\n !localValidatorFileExists(\"createMany\", modelName, arkosConfig)\n ) {\n const baseSchemaKey = ensureBaseSchemaReference(\"Create\", modelName);\n schemas[`CreateMany${modelName}ModelSchema`] = {\n type: \"array\",\n items: { $ref: `#/components/schemas/${baseSchemaKey}` },\n };\n }\n\n if (\n schemasToGenerate.includes(\"updateOne\") &&\n !this.isEndpointDisabled(\"updateOne\", routerConfig) &&\n !localValidatorFileExists(\"updateOne\", modelName, arkosConfig)\n ) {\n schemas[`Update${modelName}ModelSchema`] = this.generateUpdateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"updateOne\")\n );\n }\n\n if (\n schemasToGenerate.includes(\"updateMany\") &&\n !this.isEndpointDisabled(\"updateMany\", routerConfig) &&\n !localValidatorFileExists(\"updateMany\", modelName, arkosConfig)\n ) {\n schemas[`UpdateMany${modelName}ModelSchema`] = this.generateUpdateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"updateOne\")\n );\n }\n if (\n schemasToGenerate.includes(\"findOne\") &&\n !this.isEndpointDisabled(\"findOne\", routerConfig) &&\n !localValidatorFileExists(\"findOne\", modelName, arkosConfig)\n ) {\n schemas[`FindOne${modelName}ModelSchema`] = this.generateResponseSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"findOne\"),\n \"findOne\"\n );\n }\n\n if (\n schemasToGenerate.includes(\"findMany\") &&\n !this.isEndpointDisabled(\"findMany\", routerConfig) &&\n !localValidatorFileExists(\"findMany\", modelName, arkosConfig)\n ) {\n schemas[`FindMany${modelName}ModelSchema`] = {\n type: \"array\",\n items: this.generateResponseSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"findMany\"),\n \"findMany\"\n ),\n };\n }\n }\n\n /**\n * Generate create schema (excludes ID, includes relation IDs only)\n */\n private generateCreateSchema(\n model: PrismaModel,\n _: Record<string, any>\n ): JsonSchema {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const required: string[] = [];\n const restrictedFields = [\"createdAt\", \"updatedAt\", \"deletedAt\", \"id\"];\n\n if (model.name.toLowerCase() === \"auth\")\n restrictedFields.push(\n \"roles\",\n \"role\",\n \"isActive\",\n \"isStaff\",\n \"isSuperUser\",\n \"passwordChangedAt\",\n \"deletedSelfAccountAt\",\n \"lastLoginAt\"\n );\n\n for (const field of model.fields) {\n const isForeignKey = model.fields.some(\n (_field) => _field.foreignKeyField === field.name\n );\n if (field.isId || restrictedFields.includes(field.name) || isForeignKey)\n continue;\n\n if (this.isModelRelation(field.type)) {\n if (!field.isArray) {\n const referencedModel = prismaSchemaParser.models.find(\n (_model) => _model.name === field.type\n )!;\n\n properties[field.name] = {\n type: \"object\",\n properties: {\n [field.foreignReferenceField || \"id\"]: {\n type: this.mapPrismaTypeToJsonSchema(\n referencedModel?.fields.find(\n (_field) => _field.name === field.foreignReferenceField\n )?.type || \"String\"\n ),\n },\n },\n };\n\n if (!field.isOptional && field.defaultValue === undefined)\n required.push(field.name);\n }\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n\n // Field is required if not optional, no default, and not array\n if (\n !field.isOptional &&\n field.defaultValue === undefined &&\n !field.isArray\n ) {\n required.push(field.name);\n }\n }\n\n return {\n type: \"object\",\n properties,\n required,\n };\n }\n\n /**\n * Generate update schema (all fields optional, includes relation IDs only)\n */\n private generateUpdateSchema(\n model: PrismaModel,\n _: Record<string, any>\n ): JsonSchema {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const autoFillFields = [\"createdAt\", \"updatedAt\", \"deletedAt\", \"id\"];\n\n for (const field of model.fields) {\n const isForeignKey = model.fields.some(\n (_field) => _field.foreignKeyField === field.name\n );\n if (field.isId || autoFillFields.includes(field.name) || isForeignKey)\n continue;\n\n if (this.isModelRelation(field.type)) {\n if (!field.isArray) {\n const referencedModel = prismaSchemaParser.models.find(\n (_model) => _model.name === field.type\n )!;\n\n properties[field.name] = {\n type: \"object\",\n properties: {\n [field.foreignReferenceField || \"id\"]: {\n type: this.mapPrismaTypeToJsonSchema(\n referencedModel?.fields.find(\n (_field) => _field.name === field.foreignReferenceField\n )?.type || \"String\"\n ),\n },\n },\n };\n }\n\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n }\n\n return {\n type: \"object\",\n properties,\n required: [], // All fields are optional in update\n };\n }\n\n /**\n * Generate response schema (includes nested relations based on query options)\n */\n private generateResponseSchema(\n model: PrismaModel,\n options: Record<string, any>,\n _: \"findOne\" | \"findMany\"\n ): JsonSchema {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const required: string[] = [];\n\n // Get select and include options\n const selectFields = options?.select;\n const omittedFields = options?.omit;\n const includeRelations = options?.include;\n\n for (const field of model.fields) {\n // Skip password fields\n if (field.name === \"password\") continue;\n\n // Skip ommited fields\n if (omittedFields && omittedFields[field.name]) continue;\n\n // If select is specified, only include selected fields\n if (selectFields && !selectFields[field.name]) continue;\n\n // Handle relations\n if (this.isModelRelation(field.type)) {\n // Include relation if specified in include option\n if (\n includeRelations?.[field.name] ||\n selectFields?.[field.name] ||\n omittedFields?.[field.name] === false\n ) {\n const relationModel = this.schema.models.find(\n (m) => m.name === field.type\n );\n\n if (relationModel) {\n const relationSchema = this.generateNestedRelationSchema(\n relationModel,\n includeRelations?.[field.name] ||\n selectFields?.[field.name] ||\n omittedFields?.[field.name]\n );\n properties[field.name] = field.isArray\n ? { type: \"array\", items: relationSchema }\n : relationSchema;\n }\n }\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n\n // Field is required if not optional (for response schemas, we include all by default)\n if (!field.isOptional) required.push(field.name);\n }\n\n return {\n type: \"object\",\n properties,\n required,\n };\n }\n\n /**\n * Generate nested relation schema\n */\n private generateNestedRelationSchema(\n model: PrismaModel,\n includeOptions: any\n ): JsonSchemaProperty {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const required: string[] = [];\n\n // Handle nested select\n const selectFields = includeOptions?.select;\n const nestedIncludes = includeOptions?.include;\n const ommittedFields = includeOptions?.omit;\n\n for (const field of model.fields) {\n // Skip password fields\n if (field.name.toLowerCase().includes(\"password\")) {\n continue;\n }\n\n if (selectFields && !selectFields[field.name]) {\n continue;\n }\n\n if (this.isModelRelation(field.type)) {\n if (\n nestedIncludes?.[field.name] ||\n selectFields?.[field.name] ||\n ommittedFields?.[field.name] === false\n ) {\n const relationModel = this.schema.models.find(\n (m) => m.name === field.type\n );\n if (relationModel) {\n const nestedSchema = this.generateNestedRelationSchema(\n relationModel,\n nestedIncludes?.[field.name] ||\n selectFields?.[field.name] ||\n ommittedFields?.[field.name]\n );\n properties[field.name] = field.isArray\n ? { type: \"array\", items: nestedSchema }\n : nestedSchema;\n }\n }\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n\n if (!field.isOptional) {\n required.push(field.name);\n }\n }\n\n return {\n type: \"object\",\n properties,\n required,\n };\n }\n\n /**\n * Auth-specific schema generators\n */\n private generateLoginSchema(arkosConfig?: ArkosConfig): JsonSchema {\n const userNameFields =\n arkosConfig?.authentication?.login?.allowedUsernames || [];\n\n // Helper function to get display name for nested fields\n const getDisplayName = (field: string) => {\n if (field.includes(\".\")) return field.split(\".\").pop() || field; // Get the part after the last dot\n return field;\n };\n\n // Base schema with password (always required)\n const baseSchema: JsonSchemaProperty = {\n type: \"object\",\n properties: {\n password: {\n type: \"string\",\n minLength: 8,\n },\n },\n required: [\"password\"],\n };\n\n // Add all username fields to properties\n userNameFields.forEach((field) => {\n const displayName = getDisplayName(field);\n baseSchema.properties![displayName] = {\n type: \"string\",\n format: \"string\",\n description: `Username field: ${field}`, // Optional: show original field path\n };\n });\n\n // At least one username field must be provided along with password\n if (userNameFields.length > 0) {\n const usernameDisplayNames = userNameFields.map(getDisplayName);\n\n return {\n ...baseSchema,\n anyOf: usernameDisplayNames.map(() => ({\n required: [...baseSchema.required!],\n })),\n };\n }\n\n return baseSchema;\n }\n private generateSignupSchema(\n model: PrismaModel,\n options?: Record<string, any>\n ): JsonSchema {\n // Similar to create but might have specific required fields\n const singupSchema = this.generateCreateSchema(model, options || {});\n\n const restrictedFields = [\n \"roles\",\n \"role\",\n \"isActive\",\n \"isStaff\",\n \"isSuperUser\",\n \"passwordChangedAt\",\n \"deletedSelfAccountAt\",\n \"lastLoginAt\",\n ];\n restrictedFields.forEach((field) => {\n delete singupSchema?.properties?.[field];\n });\n\n return singupSchema;\n }\n\n private generateUpdateMeSchema(\n model: PrismaModel,\n options?: Record<string, any>\n ): JsonSchema {\n // Similar to update but might exclude certain fields like role, etc.\n const updateSchema = this.generateUpdateSchema(model, options || {});\n\n // Remove sensitive fields that users shouldn't update themselves\n const restrictedFields = [\n \"roles\",\n \"role\",\n \"isActive\",\n \"isStaff\",\n \"isSuperUser\",\n \"passwordChangedAt\",\n \"deletedSelfAccountAt\",\n \"password\",\n \"lastLoginAt\",\n ];\n restrictedFields.forEach((field) => {\n delete updateSchema?.properties?.[field];\n });\n\n return updateSchema;\n }\n\n private generateUpdatePasswordSchema(\n _: PrismaModel,\n _1?: Record<string, any>\n ): JsonSchema {\n return {\n type: \"object\",\n properties: {\n currentPassword: { type: \"string\" },\n newPassword: { type: \"string\", minLength: 8 },\n },\n required: [\"currentPassword\", \"newPassword\"],\n };\n }\n\n /**\n * Utility methods\n */\n private resolvePrismaQueryOptions(\n prismaQueryOptions?: PrismaQueryOptions<any> | AuthPrismaQueryOptions<any>,\n action?: ValidationFileMappingKey\n ): Record<string, any> {\n if (!prismaQueryOptions || !action) {\n return {};\n }\n\n const options = prismaQueryOptions as any;\n const actionOptions = options[action] || {};\n\n // Start with deprecated queryOptions (for backward compatibility)\n let mergedOptions = options.queryOptions || {};\n\n // Apply global options (replaces queryOptions)\n if (options.global)\n mergedOptions = deepmerge(mergedOptions, options.global);\n\n // Apply general operation options based on action type\n const generalOptions = this.getGeneralOptionsForAction(options, action);\n if (generalOptions)\n mergedOptions = deepmerge(mergedOptions, generalOptions);\n\n // Finally apply specific action options (highest priority)\n if (actionOptions) mergedOptions = deepmerge(mergedOptions, actionOptions);\n\n return mergedOptions;\n }\n\n /**\n * Helps in remmaping those prisma query options that combines many operations for example find, save...\n */\n private getGeneralOptionsForAction(\n options: any,\n action: ValidationFileMappingKey\n ): Record<string, any> | null {\n const actionMap: { [key: string]: string[] } = {\n find: [\"findOne\", \"findMany\"],\n create: [\"createOne\", \"createMany\"],\n update: [\"updateOne\", \"updateMany\"],\n delete: [\"deleteOne\", \"deleteMany\"],\n save: [\"createOne\", \"createMany\", \"updateOne\", \"updateMany\"],\n saveOne: [\"createOne\", \"updateOne\"],\n saveMany: [\"createMany\", \"updateMany\"],\n };\n\n for (const [optionKey, actions] of Object.entries(actionMap)) {\n if (actions.includes(action) && options[optionKey]) {\n return options[optionKey];\n }\n }\n\n return null;\n }\n\n private isEndpointDisabled(\n endpoint: string,\n routerConfig?: RouterConfig<any>\n ): boolean {\n if (!routerConfig?.disable) return false;\n\n if (typeof routerConfig.disable === \"boolean\") {\n return routerConfig.disable;\n }\n\n return (\n routerConfig.disable[endpoint as keyof typeof routerConfig.disable] ||\n false\n );\n }\n\n private isModelRelation(typeName: string): boolean {\n return this.schema.models.some((m) => m.name === typeName);\n }\n\n private convertFieldToJsonSchema(field: PrismaField): JsonSchemaProperty {\n // Reuse the existing method from the original generator\n const baseType = this.mapPrismaTypeToJsonSchema(field.type);\n const property: JsonSchemaProperty = { type: baseType };\n\n if (field.isArray) {\n property.type = \"array\";\n property.items = { type: this.mapPrismaTypeToJsonSchema(field.type) };\n }\n\n if (field.defaultValue !== undefined) {\n property.default = field.defaultValue;\n }\n\n if (field.type === \"DateTime\") {\n property.format = \"date-time\";\n }\n\n if (this.isEnum(field.type)) {\n const enumDef = this.schema.enums.find((e) => e.name === field.type);\n if (enumDef) {\n property.enum = enumDef.values;\n }\n }\n\n return property;\n }\n\n private mapPrismaTypeToJsonSchema(prismaType: string): string {\n const typeMap: { [key: string]: string } = {\n String: \"string\",\n Int: \"number\",\n Float: \"number\",\n Boolean: \"boolean\",\n DateTime: \"string\",\n Json: \"object\",\n Bytes: \"string\",\n };\n\n if (typeMap[prismaType]) return typeMap[prismaType];\n\n if (this.isEnum(prismaType)) return \"string\";\n\n if (this.isModelRelation(prismaType)) return \"object\";\n\n return \"string\";\n }\n\n private isEnum(typeName: string): boolean {\n return this.schema.enums.some((e) => e.name === typeName);\n }\n}\n\nconst prismaJsonSchemaGenerator = new PrismaJsonSchemaGenerator();\n\nexport default prismaJsonSchemaGenerator;\n"]}
|
|
1
|
+
{"version":3,"file":"prisma-json-schema-generator.js","sourceRoot":"","sources":["../../../../src/utils/prisma/prisma-json-schema-generator.ts"],"names":[],"mappings":";;;;;;AAEA,mFAAoD;AACpD,sDAG2B;AAC3B,kFAAwD;AAOxD,uGAAsG;AAetG,MAAa,yBAAyB;IAAtC;QACE,WAAM,GAAG,8BAAkB,CAAC,KAAK,EAAE,CAAC;IAuwBtC,CAAC;IAlwBC,oBAAoB,CAAC,MAA8B;QACjD,MAAM,EACJ,SAAS,EACT,WAAW,EACX,iBAAiB,GAAG;YAClB,OAAO;YACP,OAAO;YACP,QAAQ;YACR,OAAO;YACP,UAAU;YACV,gBAAgB;YAChB,QAAQ;YACR,WAAW;YACX,YAAY;YACZ,QAAQ;YACR,WAAW;YACX,YAAY;YACZ,OAAO;YACP,SAAS;YACT,UAAU;SACX,GACF,GAAG,MAAM,CAAC;QAEX,MAAM,gBAAgB,GAAG,IAAA,oCAAmB,EAAC,SAAS,CAAC,CAAC;QACxD,MAAM,YAAY,GAAG,gBAAgB,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC;QAC5D,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,kBAAkB,IAAI,EAAE,CAAC;QACtE,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtE,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QAEvE,IAAI,WAAW,EAAE,OAAO,EAAE,MAAM,I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AAM,CAAC;YACjC,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,yBAAyB,CAAC,UAAkB;QAClD,MAAM,OAAO,GAA8B;YACzC,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,QAAQ;YACb,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC;QAEF,IAAI,OAAO,CAAC,UAAU,CAAC;YAAE,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;YAAE,OAAO,QAAQ,CAAC;QAE7C,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC;YAAE,OAAO,QAAQ,CAAC;QAEtD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,MAAM,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF;AAxwBD,8DAwwBC;AAED,MAAM,yBAAyB,GAAG,IAAI,yBAAyB,EAAE,CAAC;AAElE,kBAAe,yBAAyB,CAAC","sourcesContent":["import { ArkosConfig, RouterConfig } from \"../../exports\";\nimport { AuthPrismaQueryOptions, PrismaQueryOptions } from \"../../types\";\nimport deepmerge from \"../helpers/deepmerge.helper\";\nimport {\n getModuleComponents,\n ValidationFileMappingKey,\n} from \"../dynamic-loader\";\nimport prismaSchemaParser from \"./prisma-schema-parser\";\nimport {\n PrismaModel,\n PrismaField,\n JsonSchema,\n JsonSchemaProperty,\n} from \"./types\";\nimport { localValidatorFileExists } from \"../../modules/swagger/utils/helpers/swagger.router.helpers\";\n\nexport interface SchemaGenerationConfig {\n modelName: string;\n arkosConfig: ArkosConfig;\n schemasToGenerate?: ValidationFileMappingKey[];\n}\n\nexport interface GeneratedSchemas {\n [key: string]: JsonSchema;\n}\n\n/**\n * Enhanced JSON Schema generator that creates schemas based on Prisma models and query options\n */\nexport class PrismaJsonSchemaGenerator {\n schema = prismaSchemaParser.parse();\n\n /**\n * Main method to generate all schemas for a model\n */\n generateModelSchemas(config: SchemaGenerationConfig): GeneratedSchemas {\n const {\n modelName,\n arkosConfig,\n schemasToGenerate = [\n \"model\",\n \"login\",\n \"signup\",\n \"getMe\",\n \"updateMe\",\n \"updatePassword\",\n \"create\",\n \"createOne\",\n \"createMany\",\n \"update\",\n \"updateOne\",\n \"updateMany\",\n \"query\",\n \"findOne\",\n \"findMany\",\n ],\n } = config;\n\n const moduleComponents = getModuleComponents(modelName);\n const routerConfig = moduleComponents?.router?.config || {};\n const prismaQueryOptions = moduleComponents?.prismaQueryOptions || {};\n const authModuleModel = [\"auth\", \"me\", \"password\", \"signup\", \"login\"];\n const isAuthModule = authModuleModel.includes(modelName.toLowerCase());\n\n if (arkosConfig?.swagger?.strict && arkosConfig.swagger.mode !== \"prisma\")\n return {};\n\n if (routerConfig?.disable === true) return {};\n\n const model = this.schema.models.find(\n (m) => m.name.toLowerCase() === modelName.toLowerCase()\n );\n if (!model && !isAuthModule) return {};\n\n const schemas: { [key: string]: JsonSchema } = {};\n\n if (isAuthModule) {\n this.generateAuthSchemas(\n this.schema.models.find((m) => m.name.toLowerCase() === \"user\")!,\n schemas,\n arkosConfig,\n schemasToGenerate,\n prismaQueryOptions as AuthPrismaQueryOptions<any>\n );\n } else {\n if (model)\n this.generateCrudSchemas(\n model,\n schemas,\n arkosConfig,\n schemasToGenerate,\n prismaQueryOptions as PrismaQueryOptions<any>,\n routerConfig\n );\n }\n\n return { ...schemas };\n }\n\n /**\n * Generate auth-specific schemas\n */\n private generateAuthSchemas(\n model: PrismaModel,\n schemas: { [key: string]: JsonSchema },\n arkosConfig: ArkosConfig,\n schemasToGenerate: ValidationFileMappingKey[],\n queryOptions?: AuthPrismaQueryOptions<any>,\n routerConfig?: RouterConfig\n ) {\n const modelName = \"Auth\";\n\n // if no auth activated forget those json schemas\n if (!arkosConfig?.authentication) return schemas;\n\n // Login schema (input)\n if (\n schemasToGenerate.includes(\"login\") &&\n !this.isEndpointDisabled(\"login\", routerConfig) &&\n !localValidatorFileExists(\"login\", modelName, arkosConfig)\n ) {\n schemas[`LoginSchema`] = this.generateLoginSchema(arkosConfig);\n }\n\n // Signup schema (input)\n if (\n schemasToGenerate.includes(\"signup\") &&\n !this.isEndpointDisabled(\"signup\", routerConfig) &&\n !localValidatorFileExists(\"signup\", modelName, arkosConfig)\n ) {\n schemas[`SignupSchema`] = this.generateSignupSchema(\n model,\n queryOptions?.signup\n );\n }\n\n // UpdateMe schema (input)\n if (\n schemasToGenerate.includes(\"updateMe\") &&\n !this.isEndpointDisabled(\"updateMe\", routerConfig) &&\n !localValidatorFileExists(\"updateMe\", modelName, arkosConfig)\n ) {\n schemas[`UpdateMeSchema`] = this.generateUpdateMeSchema(\n model,\n queryOptions?.updateMe\n );\n }\n\n // UpdatePassword schema (input)\n if (\n schemasToGenerate.includes(\"updatePassword\") &&\n !this.isEndpointDisabled(\"updatePassword\", routerConfig) &&\n !localValidatorFileExists(\"updatePassword\", modelName, arkosConfig)\n ) {\n schemas[`UpdatePasswordSchema`] = this.generateUpdatePasswordSchema(\n model,\n queryOptions?.updatePassword\n );\n }\n\n if (\n schemasToGenerate.includes(\"getMe\") &&\n !this.isEndpointDisabled(\"getMe\", routerConfig) &&\n !localValidatorFileExists(\"getMe\", modelName, arkosConfig)\n ) {\n schemas[`GetMeSchema`] = this.generateResponseSchema(\n model,\n queryOptions?.getMe || {},\n \"findOne\"\n );\n }\n }\n\n /**\n * Generate standard CRUD schemas\n */\n private generateCrudSchemas(\n model: PrismaModel,\n schemas: { [key: string]: JsonSchema },\n arkosConfig: ArkosConfig,\n schemasToGenerate: ValidationFileMappingKey[],\n queryOptions?: PrismaQueryOptions<any>,\n routerConfig?: RouterConfig<any>\n ) {\n const modelName = model.name;\n\n const ensureBaseSchemaReference = (\n operation: string,\n modelName: string\n ) => {\n const suffix =\n arkosConfig.validation?.resolver === \"zod\" ? \"Schema\" : \"Dto\";\n\n const singleOpName = operation === \"Create\" ? \"createOne\" : \"updateOne\";\n const hasLocalValidator = localValidatorFileExists(\n singleOpName,\n modelName,\n arkosConfig\n );\n\n if (hasLocalValidator) return `${operation}${modelName}${suffix}`;\n else {\n const modelSchemaKey = `${operation}${modelName}ModelSchema`;\n\n if (!schemas[modelSchemaKey]) {\n if (operation === \"Create\") {\n schemas[modelSchemaKey] = this.generateCreateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"createOne\")\n );\n } else if (operation === \"Update\") {\n schemas[modelSchemaKey] = this.generateUpdateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"updateOne\")\n );\n }\n }\n\n return modelSchemaKey;\n }\n };\n\n if (\n schemasToGenerate.includes(\"createOne\") &&\n !this.isEndpointDisabled(\"createOne\", routerConfig) &&\n !localValidatorFileExists(\"createOne\", modelName, arkosConfig)\n ) {\n schemas[`Create${modelName}ModelSchema`] = this.generateCreateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"createOne\")\n );\n }\n\n if (\n schemasToGenerate.includes(\"createMany\") &&\n !this.isEndpointDisabled(\"createMany\", routerConfig) &&\n !localValidatorFileExists(\"createMany\", modelName, arkosConfig)\n ) {\n const baseSchemaKey = ensureBaseSchemaReference(\"Create\", modelName);\n schemas[`CreateMany${modelName}ModelSchema`] = {\n type: \"array\",\n items: { $ref: `#/components/schemas/${baseSchemaKey}` },\n };\n }\n\n if (\n schemasToGenerate.includes(\"updateOne\") &&\n !this.isEndpointDisabled(\"updateOne\", routerConfig) &&\n !localValidatorFileExists(\"updateOne\", modelName, arkosConfig)\n ) {\n schemas[`Update${modelName}ModelSchema`] = this.generateUpdateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"updateOne\")\n );\n }\n\n if (\n schemasToGenerate.includes(\"updateMany\") &&\n !this.isEndpointDisabled(\"updateMany\", routerConfig) &&\n !localValidatorFileExists(\"updateMany\", modelName, arkosConfig)\n ) {\n schemas[`UpdateMany${modelName}ModelSchema`] = this.generateUpdateSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"updateOne\")\n );\n }\n if (\n schemasToGenerate.includes(\"findOne\") &&\n !this.isEndpointDisabled(\"findOne\", routerConfig) &&\n !localValidatorFileExists(\"findOne\", modelName, arkosConfig)\n ) {\n schemas[`FindOne${modelName}ModelSchema`] = this.generateResponseSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"findOne\"),\n \"findOne\"\n );\n }\n\n if (\n schemasToGenerate.includes(\"findMany\") &&\n !this.isEndpointDisabled(\"findMany\", routerConfig) &&\n !localValidatorFileExists(\"findMany\", modelName, arkosConfig)\n ) {\n schemas[`FindMany${modelName}ModelSchema`] = {\n type: \"array\",\n items: this.generateResponseSchema(\n model,\n this.resolvePrismaQueryOptions(queryOptions, \"findMany\"),\n \"findMany\"\n ),\n };\n }\n }\n\n /**\n * Generate create schema (excludes ID, includes relation IDs only)\n */\n private generateCreateSchema(\n model: PrismaModel,\n _: Record<string, any>\n ): JsonSchema {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const required: string[] = [];\n const restrictedFields = [\"createdAt\", \"updatedAt\", \"deletedAt\", \"id\"];\n\n if (model.name.toLowerCase() === \"auth\")\n restrictedFields.push(\n \"roles\",\n \"role\",\n \"isActive\",\n \"isStaff\",\n \"isSuperUser\",\n \"passwordChangedAt\",\n \"deletedSelfAccountAt\",\n \"lastLoginAt\"\n );\n\n for (const field of model.fields) {\n const isForeignKey = model.fields.some(\n (_field) => _field.foreignKeyField === field.name\n );\n if (field.isId || restrictedFields.includes(field.name) || isForeignKey)\n continue;\n\n if (this.isModelRelation(field.type)) {\n if (!field.isArray) {\n const referencedModel = prismaSchemaParser.models.find(\n (_model) => _model.name === field.type\n )!;\n\n properties[field.name] = {\n type: \"object\",\n properties: {\n [field.foreignReferenceField || \"id\"]: {\n type: this.mapPrismaTypeToJsonSchema(\n referencedModel?.fields.find(\n (_field) => _field.name === field.foreignReferenceField\n )?.type || \"String\"\n ),\n },\n },\n };\n\n if (!field.isOptional && field.defaultValue === undefined)\n required.push(field.name);\n }\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n\n // Field is required if not optional, no default, and not array\n if (\n !field.isOptional &&\n field.defaultValue === undefined &&\n !field.isArray\n ) {\n required.push(field.name);\n }\n }\n\n return {\n type: \"object\",\n properties,\n required,\n };\n }\n\n /**\n * Generate update schema (all fields optional, includes relation IDs only)\n */\n private generateUpdateSchema(\n model: PrismaModel,\n _: Record<string, any>\n ): JsonSchema {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const autoFillFields = [\"createdAt\", \"updatedAt\", \"deletedAt\", \"id\"];\n\n for (const field of model.fields) {\n const isForeignKey = model.fields.some(\n (_field) => _field.foreignKeyField === field.name\n );\n if (field.isId || autoFillFields.includes(field.name) || isForeignKey)\n continue;\n\n if (this.isModelRelation(field.type)) {\n if (!field.isArray) {\n const referencedModel = prismaSchemaParser.models.find(\n (_model) => _model.name === field.type\n )!;\n\n properties[field.name] = {\n type: \"object\",\n properties: {\n [field.foreignReferenceField || \"id\"]: {\n type: this.mapPrismaTypeToJsonSchema(\n referencedModel?.fields.find(\n (_field) => _field.name === field.foreignReferenceField\n )?.type || \"String\"\n ),\n },\n },\n };\n }\n\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n }\n\n return {\n type: \"object\",\n properties,\n required: [], // All fields are optional in update\n };\n }\n\n /**\n * Generate response schema (includes nested relations based on query options)\n */\n private generateResponseSchema(\n model: PrismaModel,\n options: Record<string, any>,\n _: \"findOne\" | \"findMany\"\n ): JsonSchema {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const required: string[] = [];\n\n // Get select and include options\n const selectFields = options?.select;\n const omittedFields = options?.omit;\n const includeRelations = options?.include;\n\n if (selectFields && includeRelations) {\n throw new Error(\n `Found both 'select' and 'include' in ${model.name} query options. Please use one of them.`\n );\n }\n\n for (const field of model.fields) {\n // Skip password fields\n if (field.name === \"password\") continue;\n\n // Skip ommited fields\n if (omittedFields && omittedFields[field.name]) continue;\n\n // If select is specified, only include selected fields\n if (selectFields && !selectFields[field.name]) continue;\n\n // Handle relations\n if (this.isModelRelation(field.type)) {\n // Include relation if specified in include option\n if (\n includeRelations?.[field.name] ||\n selectFields?.[field.name] ||\n omittedFields?.[field.name] === false\n ) {\n const relationModel = this.schema.models.find(\n (m) => m.name === field.type\n );\n\n if (relationModel) {\n const relationSchema = this.generateNestedRelationSchema(\n relationModel,\n includeRelations?.[field.name] ||\n selectFields?.[field.name] ||\n omittedFields?.[field.name]\n );\n properties[field.name] = field.isArray\n ? { type: \"array\", items: relationSchema }\n : relationSchema;\n }\n }\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n\n // Field is required if not optional (for response schemas, we include all by default)\n if (!field.isOptional) required.push(field.name);\n }\n\n return {\n type: \"object\",\n properties,\n required,\n };\n }\n\n /**\n * Generate nested relation schema\n */\n private generateNestedRelationSchema(\n model: PrismaModel,\n includeOptions: any\n ): JsonSchemaProperty {\n const properties: { [key: string]: JsonSchemaProperty } = {};\n const required: string[] = [];\n\n // Handle nested select\n const selectFields = includeOptions?.select;\n const nestedIncludes = includeOptions?.include;\n const ommittedFields = includeOptions?.omit;\n\n if (selectFields && nestedIncludes) {\n throw new Error(\n `Found both 'select' and 'include' in nested ${model.name} query options. Please use one of them.`\n );\n }\n\n for (const field of model.fields) {\n // Skip password fields\n if (field.name.toLowerCase().includes(\"password\")) {\n continue;\n }\n\n if (selectFields && !selectFields[field.name]) {\n continue;\n }\n\n if (this.isModelRelation(field.type)) {\n if (\n nestedIncludes?.[field.name] ||\n selectFields?.[field.name] ||\n ommittedFields?.[field.name] === false\n ) {\n const relationModel = this.schema.models.find(\n (m) => m.name === field.type\n );\n if (relationModel) {\n const nestedSchema = this.generateNestedRelationSchema(\n relationModel,\n nestedIncludes?.[field.name] ||\n selectFields?.[field.name] ||\n ommittedFields?.[field.name]\n );\n properties[field.name] = field.isArray\n ? { type: \"array\", items: nestedSchema }\n : nestedSchema;\n }\n }\n continue;\n }\n\n const property = this.convertFieldToJsonSchema(field);\n properties[field.name] = property;\n\n if (!field.isOptional) {\n required.push(field.name);\n }\n }\n\n return {\n type: \"object\",\n properties,\n required,\n };\n }\n\n /**\n * Auth-specific schema generators\n */\n private generateLoginSchema(arkosConfig?: ArkosConfig): JsonSchema {\n const userNameFields =\n arkosConfig?.authentication?.login?.allowedUsernames || [];\n\n // Helper function to get display name for nested fields\n const getDisplayName = (field: string) => {\n if (field.includes(\".\")) return field.split(\".\").pop() || field; // Get the part after the last dot\n return field;\n };\n\n // Base schema with password (always required)\n const baseSchema: JsonSchemaProperty = {\n type: \"object\",\n properties: {\n password: {\n type: \"string\",\n minLength: 8,\n },\n },\n required: [\"password\"],\n };\n\n // Add all username fields to properties\n userNameFields.forEach((field) => {\n const displayName = getDisplayName(field);\n baseSchema.properties![displayName] = {\n type: \"string\",\n format: \"string\",\n description: `Username field: ${field}`, // Optional: show original field path\n };\n });\n\n // At least one username field must be provided along with password\n if (userNameFields.length > 0) {\n const usernameDisplayNames = userNameFields.map(getDisplayName);\n\n return {\n ...baseSchema,\n anyOf: usernameDisplayNames.map(() => ({\n required: [...baseSchema.required!],\n })),\n };\n }\n\n return baseSchema;\n }\n private generateSignupSchema(\n model: PrismaModel,\n options?: Record<string, any>\n ): JsonSchema {\n // Similar to create but might have specific required fields\n const singupSchema = this.generateCreateSchema(model, options || {});\n\n const restrictedFields = [\n \"roles\",\n \"role\",\n \"isActive\",\n \"isStaff\",\n \"isSuperUser\",\n \"passwordChangedAt\",\n \"deletedSelfAccountAt\",\n \"lastLoginAt\",\n ];\n restrictedFields.forEach((field) => {\n delete singupSchema?.properties?.[field];\n });\n\n return singupSchema;\n }\n\n private generateUpdateMeSchema(\n model: PrismaModel,\n options?: Record<string, any>\n ): JsonSchema {\n // Similar to update but might exclude certain fields like role, etc.\n const updateSchema = this.generateUpdateSchema(model, options || {});\n\n // Remove sensitive fields that users shouldn't update themselves\n const restrictedFields = [\n \"roles\",\n \"role\",\n \"isActive\",\n \"isStaff\",\n \"isSuperUser\",\n \"passwordChangedAt\",\n \"deletedSelfAccountAt\",\n \"password\",\n \"lastLoginAt\",\n ];\n restrictedFields.forEach((field) => {\n delete updateSchema?.properties?.[field];\n });\n\n return updateSchema;\n }\n\n private generateUpdatePasswordSchema(\n _: PrismaModel,\n _1?: Record<string, any>\n ): JsonSchema {\n return {\n type: \"object\",\n properties: {\n currentPassword: { type: \"string\" },\n newPassword: { type: \"string\", minLength: 8 },\n },\n required: [\"currentPassword\", \"newPassword\"],\n };\n }\n\n /**\n * Utility methods\n */\n private resolvePrismaQueryOptions(\n prismaQueryOptions?: PrismaQueryOptions<any> | AuthPrismaQueryOptions<any>,\n action?: ValidationFileMappingKey\n ): Record<string, any> {\n if (!prismaQueryOptions || !action) {\n return {};\n }\n\n const options = prismaQueryOptions as any;\n const actionOptions = options[action] || {};\n\n // Start with deprecated queryOptions (for backward compatibility)\n let mergedOptions = options.queryOptions || {};\n\n // Apply global options (replaces queryOptions)\n if (options.global)\n mergedOptions = deepmerge(mergedOptions, options.global);\n\n // Apply general operation options based on action type\n const generalOptions = this.getGeneralOptionsForAction(options, action);\n if (generalOptions)\n mergedOptions = deepmerge(mergedOptions, generalOptions);\n\n // Finally apply specific action options (highest priority)\n if (actionOptions) mergedOptions = deepmerge(mergedOptions, actionOptions);\n\n return mergedOptions;\n }\n\n /**\n * Helps in remmaping those prisma query options that combines many operations for example find, save...\n */\n private getGeneralOptionsForAction(\n options: any,\n action: ValidationFileMappingKey\n ): Record<string, any> | null {\n const actionMap: { [key: string]: string[] } = {\n find: [\"findOne\", \"findMany\"],\n create: [\"createOne\", \"createMany\"],\n update: [\"updateOne\", \"updateMany\"],\n delete: [\"deleteOne\", \"deleteMany\"],\n save: [\"createOne\", \"createMany\", \"updateOne\", \"updateMany\"],\n saveOne: [\"createOne\", \"updateOne\"],\n saveMany: [\"createMany\", \"updateMany\"],\n };\n\n for (const [optionKey, actions] of Object.entries(actionMap)) {\n if (actions.includes(action) && options[optionKey]) {\n return options[optionKey];\n }\n }\n\n return null;\n }\n\n private isEndpointDisabled(\n endpoint: string,\n routerConfig?: RouterConfig<any>\n ): boolean {\n if (!routerConfig?.disable) return false;\n\n if (typeof routerConfig.disable === \"boolean\") {\n return routerConfig.disable;\n }\n\n return (\n routerConfig.disable[endpoint as keyof typeof routerConfig.disable] ||\n false\n );\n }\n\n private isModelRelation(typeName: string): boolean {\n return this.schema.models.some((m) => m.name === typeName);\n }\n\n private convertFieldToJsonSchema(field: PrismaField): JsonSchemaProperty {\n // Reuse the existing method from the original generator\n const baseType = this.mapPrismaTypeToJsonSchema(field.type);\n const property: JsonSchemaProperty = { type: baseType };\n\n if (field.isArray) {\n property.type = \"array\";\n property.items = { type: this.mapPrismaTypeToJsonSchema(field.type) };\n }\n\n if (field.defaultValue !== undefined) {\n property.default = field.defaultValue;\n }\n\n if (field.type === \"DateTime\") {\n property.format = \"date-time\";\n }\n\n if (this.isEnum(field.type)) {\n const enumDef = this.schema.enums.find((e) => e.name === field.type);\n if (enumDef) {\n property.enum = enumDef.values;\n }\n }\n\n return property;\n }\n\n private mapPrismaTypeToJsonSchema(prismaType: string): string {\n const typeMap: { [key: string]: string } = {\n String: \"string\",\n Int: \"number\",\n Float: \"number\",\n Boolean: \"boolean\",\n DateTime: \"string\",\n Json: \"object\",\n Bytes: \"string\",\n };\n\n if (typeMap[prismaType]) return typeMap[prismaType];\n\n if (this.isEnum(prismaType)) return \"string\";\n\n if (this.isModelRelation(prismaType)) return \"object\";\n\n return \"string\";\n }\n\n private isEnum(typeName: string): boolean {\n return this.schema.enums.some((e) => e.name === typeName);\n }\n}\n\nconst prismaJsonSchemaGenerator = new PrismaJsonSchemaGenerator();\n\nexport default prismaJsonSchemaGenerator;\n"]}
|
|
@@ -39,7 +39,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
39
39
|
: currentPath?.summary,
|
|
40
40
|
description: currentPath?.description ||
|
|
41
41
|
"Authenticates a user and returns an access token",
|
|
42
|
-
operationId: currentPath?.operationId
|
|
42
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
43
|
+
? "login"
|
|
44
|
+
: currentPath?.operationId,
|
|
43
45
|
requestBody: currentPath?.requestBody || {
|
|
44
46
|
description: "User credentials",
|
|
45
47
|
required: true,
|
|
@@ -90,7 +92,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
90
92
|
? "Logout from the system"
|
|
91
93
|
: currentPath?.summary,
|
|
92
94
|
description: currentPath?.description || "Invalidates the current user's JWT token",
|
|
93
|
-
operationId: currentPath?.operationId
|
|
95
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
96
|
+
? "logout"
|
|
97
|
+
: currentPath?.operationId,
|
|
94
98
|
security: [{ BearerAuth: [] }],
|
|
95
99
|
responses: {
|
|
96
100
|
...(currentPath?.responses || {}),
|
|
@@ -117,7 +121,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
117
121
|
? "Register a new user"
|
|
118
122
|
: currentPath?.summary,
|
|
119
123
|
description: currentPath?.description || "Creates a new user account",
|
|
120
|
-
operationId: currentPath?.operationId
|
|
124
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
125
|
+
? "signup"
|
|
126
|
+
: currentPath?.operationId,
|
|
121
127
|
requestBody: currentPath?.requestBody || {
|
|
122
128
|
description: "User registration data",
|
|
123
129
|
required: true,
|
|
@@ -164,7 +170,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
164
170
|
: currentPath?.summary,
|
|
165
171
|
description: currentPath?.description ||
|
|
166
172
|
"Changes the password for the authenticated user",
|
|
167
|
-
operationId: currentPath?.operationId
|
|
173
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
174
|
+
? "updatePassword"
|
|
175
|
+
: currentPath?.operationId,
|
|
168
176
|
security: [{ BearerAuth: [] }],
|
|
169
177
|
requestBody: currentPath?.requestBody || {
|
|
170
178
|
description: "Current and new password",
|
|
@@ -222,7 +230,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
222
230
|
: currentPath?.summary,
|
|
223
231
|
description: currentPath?.description ||
|
|
224
232
|
"Retrieves information about the currently authenticated user",
|
|
225
|
-
operationId: currentPath?.operationId
|
|
233
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
234
|
+
? "getMe"
|
|
235
|
+
: currentPath?.operationId,
|
|
226
236
|
security: [{ BearerAuth: [] }],
|
|
227
237
|
responses: {
|
|
228
238
|
...(currentPath?.responses || {}),
|
|
@@ -257,7 +267,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
257
267
|
: currentPath?.summary,
|
|
258
268
|
description: currentPath?.description ||
|
|
259
269
|
"Updates information for the currently authenticated user",
|
|
260
|
-
operationId: currentPath?.operationId
|
|
270
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
271
|
+
? "updateMe"
|
|
272
|
+
: currentPath?.operationId,
|
|
261
273
|
security: [{ BearerAuth: [] }],
|
|
262
274
|
requestBody: currentPath?.requestBody || {
|
|
263
275
|
description: "User data to update",
|
|
@@ -304,7 +316,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
304
316
|
: currentPath?.summary,
|
|
305
317
|
description: currentPath?.description ||
|
|
306
318
|
"Marks the current user's account as deleted",
|
|
307
|
-
operationId: currentPath?.operationId
|
|
319
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
320
|
+
? "deleteMe"
|
|
321
|
+
: currentPath?.operationId,
|
|
308
322
|
security: [{ BearerAuth: [] }],
|
|
309
323
|
responses: {
|
|
310
324
|
...(currentPath?.responses || {}),
|
|
@@ -343,7 +357,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
343
357
|
: currentPath?.summary,
|
|
344
358
|
description: currentPath?.description ||
|
|
345
359
|
"Retrieves a list of all available authentication actions and permissions",
|
|
346
|
-
operationId: currentPath?.operationId
|
|
360
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
361
|
+
? "findManyAuthAction"
|
|
362
|
+
: currentPath?.operationId,
|
|
347
363
|
security: [{ BearerAuth: [] }],
|
|
348
364
|
responses: {
|
|
349
365
|
...(currentPath?.responses || {}),
|
|
@@ -410,7 +426,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
|
|
|
410
426
|
: currentPath?.summary,
|
|
411
427
|
description: currentPath?.description ||
|
|
412
428
|
"Retrieves all authentication actions for a specific resource",
|
|
413
|
-
operationId: currentPath?.operationId
|
|
429
|
+
operationId: currentPath?.operationId?.includes(pathname)
|
|
430
|
+
? "findOneAuthAction"
|
|
431
|
+
: currentPath?.operationId,
|
|
414
432
|
security: [{ BearerAuth: [] }],
|
|
415
433
|
parameters: mergedParameters,
|
|
416
434
|
responses: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-authentication-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-authentication-json-schema-paths.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAc,EACd,WAAwB,EACc,EAAE;IACxC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAA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AO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport {\n getSchemaRef,\n localValidatorFileExists,\n} from \"./swagger.router.helpers\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\n\nexport const getSchemaMode = (\n action: string,\n arkosConfig: ArkosConfig\n): \"prisma\" | \"zod\" | \"class-validator\" => {\n const swaggerMode = arkosConfig.swagger?.mode;\n const isStrict = arkosConfig.swagger?.strict;\n\n if (!swaggerMode) return \"prisma\";\n if (isStrict) return swaggerMode;\n\n const actionKey = action as any;\n const localFileExists = localValidatorFileExists(\n actionKey,\n \"auth\",\n arkosConfig\n );\n\n if (!localFileExists) return \"prisma\";\n return swaggerMode;\n};\n\nexport default function getAuthenticationJsonSchemaPaths(\n arkosConfig: ArkosConfig,\n existingPaths: OpenAPIV3.PathsObject\n) {\n const paths: OpenAPIV3.PathsObject = { ...existingPaths };\n\n if (!arkosConfig.swagger?.mode) return paths;\n\n const AuthModuleComponents = getModuleComponents(\"auth\");\n const routerConfig = AuthModuleComponents?.router\n ?.config as RouterConfig<\"auth\">;\n\n if (routerConfig?.disable === true) return paths;\n\n const isAuthEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n // Login\n if (!isAuthEndpointDisabled(\"login\")) {\n const pathname = \"/api/auth/login\";\n if (!paths[pathname]) paths[pathname] = {};\n const loginMode = getSchemaMode(\"login\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Login to the system\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Authenticates a user and returns an access token\",\n operationId: currentPath?.operationId || \"login\",\n requestBody: currentPath?.requestBody || {\n description: \"User credentials\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Login\", loginMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Login successful\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n accessToken: {\n type: \"string\",\n description: \"JWT access token\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Invalid credentials\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Logout\n if (!isAuthEndpointDisabled(\"logout\")) {\n const pathname = \"/api/auth/logout\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Logout from the system\"\n : currentPath?.summary,\n description:\n currentPath?.description || \"Invalidates the current user's JWT token\",\n operationId: currentPath?.operationId || \"logout\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"204\": currentPath?.responses?.[\"204\"] || {\n description: \"Logout successful\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Signup\n if (!isAuthEndpointDisabled(\"signup\")) {\n const pathname = \"/api/auth/signup\";\n if (!paths[pathname]) paths[pathname] = {};\n const signupMode = getSchemaMode(\"signup\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Register a new user\"\n : currentPath?.summary,\n description: currentPath?.description || \"Creates a new user account\",\n operationId: currentPath?.operationId || \"signup\",\n requestBody: currentPath?.requestBody || {\n description: \"User registration data\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Signup\", signupMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"201\": currentPath?.responses?.[\"201\"] || {\n description: \"User created successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"409\": currentPath?.responses?.[\"409\"] || {\n description: \"User already exists\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Password\n if (!isAuthEndpointDisabled(\"updatePassword\")) {\n const pathname = \"/api/auth/update-password\";\n if (!paths[pathname]) paths[pathname] = {};\n const updatePasswordMode = getSchemaMode(\"updatePassword\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update user password\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Changes the password for the authenticated user\",\n operationId: currentPath?.operationId || \"updatePassword\",\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"Current and new password\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdatePassword\", updatePasswordMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Password updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n status: {\n type: \"string\",\n example: \"success\",\n },\n message: {\n type: \"string\",\n example: \"Password updated successfully!\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data or current password incorrect\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Get Me\n if (!isAuthEndpointDisabled(\"getMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const findMeMode = getSchemaMode(\"getMe\", arkosConfig);\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves information about the currently authenticated user\",\n operationId: currentPath?.operationId || \"getMe\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User information retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"GetMe\", findMeMode),\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Me\n if (!isAuthEndpointDisabled(\"updateMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const updateMeMode = getSchemaMode(\"updateMe\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.patch;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Updates information for the currently authenticated user\",\n operationId: currentPath?.operationId || \"updateMe\",\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"User data to update\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdateMe\", updateMeMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete Me\n if (!isAuthEndpointDisabled(\"deleteMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Delete current user account\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Marks the current user's account as deleted\",\n operationId: currentPath?.operationId || \"deleteMe\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Account deleted successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n message: {\n type: \"string\",\n example: \"Account deleted successfully\",\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Find Many Auth Action\n if (!isAuthEndpointDisabled(\"findManyAuthAction\")) {\n const pathname = \"/api/auth-actions\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get all authentication actions\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves a list of all available authentication actions and permissions\",\n operationId: currentPath?.operationId || \"findManyAuthAction\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description: \"Total number of auth actions\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n if (!isAuthEndpointDisabled(\"findOneAuthAction\")) {\n const pathname = \"/api/auth-actions/{resourceName}\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"resourceName\",\n in: \"path\",\n description: \"Name of the resource to retrieve auth actions for\",\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get authentication actions by resource\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves all authentication actions for a specific resource\",\n operationId: currentPath?.operationId || \"findOneAuthAction\",\n security: [{ BearerAuth: [] }],\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions for resource retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description:\n \"Total number of auth actions for this resource\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"Resource not found\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n return paths;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"get-authentication-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-authentication-json-schema-paths.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAc,EACd,WAAwB,EACc,EAAE;IACxC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;IAE7C,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,EAAE,QAAQ;wCACd,WAAW,EACT,gDAAgD;qCACnD;oCACD,OAAO,EAAE;wCACP,IAAI,EAAE,QAAQ;wCACd,WAAW,EAAE,iCAAiC;qCAC/C;oCACD,IAAI,EAAE;wCACJ,IAAI,EAAE,OAAO;wCACb,KAAK,EAAE;4CACL,IAAI,EAAE,qDAAqD;yCAC5D;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,yBAAyB;iBACvC;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,0BAA0B;iBACxC;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,oBAAoB;iBAClC;aACF;SACF,CAAC;QAEF,KAAK,CAAC,QAAQ,CAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;IACpE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport {\n getSchemaRef,\n localValidatorFileExists,\n} from \"./swagger.router.helpers\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\n\nexport const getSchemaMode = (\n action: string,\n arkosConfig: ArkosConfig\n): \"prisma\" | \"zod\" | \"class-validator\" => {\n const swaggerMode = arkosConfig.swagger?.mode;\n const isStrict = arkosConfig.swagger?.strict;\n\n if (!swaggerMode) return \"prisma\";\n if (isStrict) return swaggerMode;\n\n const actionKey = action as any;\n const localFileExists = localValidatorFileExists(\n actionKey,\n \"auth\",\n arkosConfig\n );\n\n if (!localFileExists) return \"prisma\";\n return swaggerMode;\n};\n\nexport default function getAuthenticationJsonSchemaPaths(\n arkosConfig: ArkosConfig,\n existingPaths: OpenAPIV3.PathsObject\n) {\n const paths: OpenAPIV3.PathsObject = { ...existingPaths };\n\n if (!arkosConfig.swagger?.mode) return paths;\n\n const AuthModuleComponents = getModuleComponents(\"auth\");\n const routerConfig = AuthModuleComponents?.router\n ?.config as RouterConfig<\"auth\">;\n\n if (routerConfig?.disable === true) return paths;\n\n const isAuthEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n // Login\n if (!isAuthEndpointDisabled(\"login\")) {\n const pathname = \"/api/auth/login\";\n if (!paths[pathname]) paths[pathname] = {};\n const loginMode = getSchemaMode(\"login\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Login to the system\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Authenticates a user and returns an access token\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"login\"\n : currentPath?.operationId,\n requestBody: currentPath?.requestBody || {\n description: \"User credentials\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Login\", loginMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Login successful\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n accessToken: {\n type: \"string\",\n description: \"JWT access token\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Invalid credentials\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Logout\n if (!isAuthEndpointDisabled(\"logout\")) {\n const pathname = \"/api/auth/logout\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Logout from the system\"\n : currentPath?.summary,\n description:\n currentPath?.description || \"Invalidates the current user's JWT token\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"logout\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"204\": currentPath?.responses?.[\"204\"] || {\n description: \"Logout successful\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Signup\n if (!isAuthEndpointDisabled(\"signup\")) {\n const pathname = \"/api/auth/signup\";\n if (!paths[pathname]) paths[pathname] = {};\n const signupMode = getSchemaMode(\"signup\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Register a new user\"\n : currentPath?.summary,\n description: currentPath?.description || \"Creates a new user account\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"signup\"\n : currentPath?.operationId,\n requestBody: currentPath?.requestBody || {\n description: \"User registration data\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Signup\", signupMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"201\": currentPath?.responses?.[\"201\"] || {\n description: \"User created successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"409\": currentPath?.responses?.[\"409\"] || {\n description: \"User already exists\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Password\n if (!isAuthEndpointDisabled(\"updatePassword\")) {\n const pathname = \"/api/auth/update-password\";\n if (!paths[pathname]) paths[pathname] = {};\n const updatePasswordMode = getSchemaMode(\"updatePassword\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update user password\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Changes the password for the authenticated user\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"updatePassword\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"Current and new password\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdatePassword\", updatePasswordMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Password updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n status: {\n type: \"string\",\n example: \"success\",\n },\n message: {\n type: \"string\",\n example: \"Password updated successfully!\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data or current password incorrect\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Get Me\n if (!isAuthEndpointDisabled(\"getMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const findMeMode = getSchemaMode(\"getMe\", arkosConfig);\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves information about the currently authenticated user\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"getMe\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User information retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"GetMe\", findMeMode),\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Me\n if (!isAuthEndpointDisabled(\"updateMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const updateMeMode = getSchemaMode(\"updateMe\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.patch;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Updates information for the currently authenticated user\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"updateMe\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"User data to update\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdateMe\", updateMeMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete Me\n if (!isAuthEndpointDisabled(\"deleteMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Delete current user account\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Marks the current user's account as deleted\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"deleteMe\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Account deleted successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n message: {\n type: \"string\",\n example: \"Account deleted successfully\",\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Find Many Auth Action\n if (!isAuthEndpointDisabled(\"findManyAuthAction\")) {\n const pathname = \"/api/auth-actions\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get all authentication actions\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves a list of all available authentication actions and permissions\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"findManyAuthAction\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description: \"Total number of auth actions\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n if (!isAuthEndpointDisabled(\"findOneAuthAction\")) {\n const pathname = \"/api/auth-actions/{resourceName}\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"resourceName\",\n in: \"path\",\n description: \"Name of the resource to retrieve auth actions for\",\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get authentication actions by resource\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves all authentication actions for a specific resource\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"findOneAuthAction\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions for resource retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description:\n \"Total number of auth actions for this resource\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"Resource not found\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n return paths;\n}\n"]}
|
|
@@ -78,9 +78,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
|
|
|
78
78
|
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
79
79
|
? "Retrieve uploaded file"
|
|
80
80
|
: currentPath?.summary,
|
|
81
|
-
description: currentPath?.description ||
|
|
82
|
-
`Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory
|
|
83
|
-
|
|
81
|
+
description: currentPath?.description === pathname || !currentPath?.description
|
|
82
|
+
? `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`
|
|
83
|
+
: currentPath?.description,
|
|
84
|
+
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
85
|
+
!currentPath?.operationId
|
|
86
|
+
? "findFile"
|
|
87
|
+
: currentPath?.operationId,
|
|
84
88
|
...(shouldIncludeSecurity("View") && {
|
|
85
89
|
security: [{ BearerAuth: [] }],
|
|
86
90
|
}),
|
|
@@ -178,9 +182,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
|
|
|
178
182
|
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
179
183
|
? "Upload file(s)"
|
|
180
184
|
: currentPath?.summary,
|
|
181
|
-
description: currentPath?.description ||
|
|
182
|
-
"Upload one or multiple files. Supports image processing options for image uploads."
|
|
183
|
-
|
|
185
|
+
description: currentPath?.description === pathname || !currentPath?.description
|
|
186
|
+
? "Upload one or multiple files. Supports image processing options for image uploads."
|
|
187
|
+
: currentPath?.description,
|
|
188
|
+
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
189
|
+
!currentPath?.operationId
|
|
190
|
+
? "uploadFile"
|
|
191
|
+
: currentPath?.operationId,
|
|
184
192
|
...(shouldIncludeSecurity("Create") && {
|
|
185
193
|
security: [{ BearerAuth: [] }],
|
|
186
194
|
}),
|
|
@@ -330,9 +338,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
|
|
|
330
338
|
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
331
339
|
? "Update existing file"
|
|
332
340
|
: currentPath?.summary,
|
|
333
|
-
description: currentPath?.description ||
|
|
334
|
-
"Replace an existing file with a new one. Deletes the old file and uploads the new one."
|
|
335
|
-
|
|
341
|
+
description: currentPath?.description === pathname || !currentPath?.description
|
|
342
|
+
? "Replace an existing file with a new one. Deletes the old file and uploads the new one."
|
|
343
|
+
: currentPath?.description,
|
|
344
|
+
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
345
|
+
!currentPath?.operationId
|
|
346
|
+
? "updateFile"
|
|
347
|
+
: currentPath?.operationId,
|
|
336
348
|
...(shouldIncludeSecurity("Update") && {
|
|
337
349
|
security: [{ BearerAuth: [] }],
|
|
338
350
|
}),
|
|
@@ -451,8 +463,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
|
|
|
451
463
|
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
452
464
|
? "Delete file"
|
|
453
465
|
: currentPath?.summary,
|
|
454
|
-
description: currentPath?.description
|
|
455
|
-
|
|
466
|
+
description: currentPath?.description === pathname || !currentPath?.description
|
|
467
|
+
? "Delete an uploaded file from the server"
|
|
468
|
+
: currentPath?.description,
|
|
469
|
+
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
470
|
+
!currentPath?.operationId
|
|
471
|
+
? "deleteFile"
|
|
472
|
+
: currentPath?.operationId,
|
|
456
473
|
...(shouldIncludeSecurity("Delete") && {
|
|
457
474
|
security: [{ BearerAuth: [] }],
|
|
458
475
|
}),
|