@strapi/plugin-documentation 5.4.2 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/_chunks/{App-Dlx5Hiu3.js → App-C51t4Zpc.js} +3 -5
  2. package/dist/_chunks/{App-Bh6ZOYCv.mjs → App-D3sYdNAh.mjs} +2 -3
  3. package/dist/_chunks/{Settings-CtlcbBE2.js → Settings-DfyHMjZj.js} +3 -5
  4. package/dist/_chunks/{Settings-B-Qva9QN.mjs → Settings-DiK51xGj.mjs} +2 -3
  5. package/dist/_chunks/ar-CkqTE6jh.js +0 -1
  6. package/dist/_chunks/ar-ckp9T43y.mjs +0 -1
  7. package/dist/_chunks/cs-BbyKo6Hc.js +0 -1
  8. package/dist/_chunks/cs-ciLYCxgd.mjs +0 -1
  9. package/dist/_chunks/de-CHwC0A85.js +0 -1
  10. package/dist/_chunks/de-DqkAUMvP.mjs +0 -1
  11. package/dist/_chunks/dk-DgCq8mF-.mjs +0 -1
  12. package/dist/_chunks/dk-qlI2J6S0.js +0 -1
  13. package/dist/_chunks/en-BQ_E53_2.mjs +0 -1
  14. package/dist/_chunks/en-DKizRVCY.js +0 -1
  15. package/dist/_chunks/es-CEiXVnsb.mjs +0 -1
  16. package/dist/_chunks/es-DH1GVZe7.js +0 -1
  17. package/dist/_chunks/fr-B1x-Nj5w.js +0 -1
  18. package/dist/_chunks/fr-BlX-v4UF.mjs +0 -1
  19. package/dist/_chunks/{getTrad-BzQMnOxD.mjs → getTrad-BCVqzyys.mjs} +1 -2
  20. package/dist/_chunks/{getTrad-49jiHamt.js → getTrad-DoREjbyy.js} +1 -2
  21. package/dist/_chunks/id-CPOl6_EU.mjs +0 -1
  22. package/dist/_chunks/id-D3yFE72d.js +0 -1
  23. package/dist/_chunks/index-BTFWrNiz.mjs +0 -1
  24. package/dist/_chunks/{index-Dh0UeWZt.js → index-BlmI1vCi.js} +12 -6
  25. package/dist/_chunks/index-CYcTK1eg.js +0 -1
  26. package/dist/_chunks/{index-efJUvXYO.mjs → index-YnqsO7ap.mjs} +12 -6
  27. package/dist/_chunks/it-DWJI563z.mjs +0 -1
  28. package/dist/_chunks/it-WuNBIqG8.js +0 -1
  29. package/dist/_chunks/ko-CFzSHayG.mjs +0 -1
  30. package/dist/_chunks/ko-De5iYa_O.js +0 -1
  31. package/dist/_chunks/login-EQSKn2h7.js +0 -1
  32. package/dist/_chunks/login-KS59cQ6U.mjs +0 -1
  33. package/dist/_chunks/ms-CUgPFo4U.mjs +0 -1
  34. package/dist/_chunks/ms-DQfa3FDx.js +0 -1
  35. package/dist/_chunks/nl-BZHlqphk.js +0 -1
  36. package/dist/_chunks/nl-B_7CHwVD.mjs +0 -1
  37. package/dist/_chunks/pl-DDl5i_mP.js +0 -1
  38. package/dist/_chunks/pl-DwLr8sw9.mjs +0 -1
  39. package/dist/_chunks/pt-4GQ8ermL.js +0 -1
  40. package/dist/_chunks/pt-BR-D24CJ0qp.js +0 -1
  41. package/dist/_chunks/pt-BR-MVXc6V9P.mjs +0 -1
  42. package/dist/_chunks/pt-C2N9fdeh.mjs +0 -1
  43. package/dist/_chunks/ru-BddeNlU0.mjs +0 -1
  44. package/dist/_chunks/ru-QwZYcU6K.js +0 -1
  45. package/dist/_chunks/sk-BmT4uZTG.mjs +0 -1
  46. package/dist/_chunks/sk-DgAXilB1.js +0 -1
  47. package/dist/_chunks/sv-CCLcAo3U.js +0 -1
  48. package/dist/_chunks/sv-D_-KBtcw.mjs +0 -1
  49. package/dist/_chunks/th-BhgV1BbW.js +0 -1
  50. package/dist/_chunks/th-DkuoSGii.mjs +0 -1
  51. package/dist/_chunks/tr-BysnAErC.js +0 -1
  52. package/dist/_chunks/tr-l-xxK4Yk.mjs +0 -1
  53. package/dist/_chunks/uk-CNlbntFx.js +0 -1
  54. package/dist/_chunks/uk-Cpmsxyku.mjs +0 -1
  55. package/dist/_chunks/vi-ClWGrFm9.mjs +0 -1
  56. package/dist/_chunks/vi-_ib0GmNl.js +0 -1
  57. package/dist/_chunks/zh-Glkg1L2g.mjs +0 -1
  58. package/dist/_chunks/zh-Hans-L_5U2KqC.js +0 -1
  59. package/dist/_chunks/zh-Hans-XLMwjASk.mjs +0 -1
  60. package/dist/_chunks/zh-aEZZdkOu.js +0 -1
  61. package/dist/admin/index.js +1 -2
  62. package/dist/admin/index.mjs +1 -2
  63. package/dist/server/index.js +6 -8
  64. package/dist/server/index.mjs +5 -6
  65. package/dist/server/src/bootstrap.d.ts.map +1 -1
  66. package/package.json +11 -12
  67. package/dist/_chunks/App-Bh6ZOYCv.mjs.map +0 -1
  68. package/dist/_chunks/App-Dlx5Hiu3.js.map +0 -1
  69. package/dist/_chunks/Settings-B-Qva9QN.mjs.map +0 -1
  70. package/dist/_chunks/Settings-CtlcbBE2.js.map +0 -1
  71. package/dist/_chunks/ar-CkqTE6jh.js.map +0 -1
  72. package/dist/_chunks/ar-ckp9T43y.mjs.map +0 -1
  73. package/dist/_chunks/cs-BbyKo6Hc.js.map +0 -1
  74. package/dist/_chunks/cs-ciLYCxgd.mjs.map +0 -1
  75. package/dist/_chunks/de-CHwC0A85.js.map +0 -1
  76. package/dist/_chunks/de-DqkAUMvP.mjs.map +0 -1
  77. package/dist/_chunks/dk-DgCq8mF-.mjs.map +0 -1
  78. package/dist/_chunks/dk-qlI2J6S0.js.map +0 -1
  79. package/dist/_chunks/en-BQ_E53_2.mjs.map +0 -1
  80. package/dist/_chunks/en-DKizRVCY.js.map +0 -1
  81. package/dist/_chunks/es-CEiXVnsb.mjs.map +0 -1
  82. package/dist/_chunks/es-DH1GVZe7.js.map +0 -1
  83. package/dist/_chunks/fr-B1x-Nj5w.js.map +0 -1
  84. package/dist/_chunks/fr-BlX-v4UF.mjs.map +0 -1
  85. package/dist/_chunks/getTrad-49jiHamt.js.map +0 -1
  86. package/dist/_chunks/getTrad-BzQMnOxD.mjs.map +0 -1
  87. package/dist/_chunks/id-CPOl6_EU.mjs.map +0 -1
  88. package/dist/_chunks/id-D3yFE72d.js.map +0 -1
  89. package/dist/_chunks/index-BTFWrNiz.mjs.map +0 -1
  90. package/dist/_chunks/index-CYcTK1eg.js.map +0 -1
  91. package/dist/_chunks/index-Dh0UeWZt.js.map +0 -1
  92. package/dist/_chunks/index-efJUvXYO.mjs.map +0 -1
  93. package/dist/_chunks/it-DWJI563z.mjs.map +0 -1
  94. package/dist/_chunks/it-WuNBIqG8.js.map +0 -1
  95. package/dist/_chunks/ko-CFzSHayG.mjs.map +0 -1
  96. package/dist/_chunks/ko-De5iYa_O.js.map +0 -1
  97. package/dist/_chunks/login-EQSKn2h7.js.map +0 -1
  98. package/dist/_chunks/login-KS59cQ6U.mjs.map +0 -1
  99. package/dist/_chunks/ms-CUgPFo4U.mjs.map +0 -1
  100. package/dist/_chunks/ms-DQfa3FDx.js.map +0 -1
  101. package/dist/_chunks/nl-BZHlqphk.js.map +0 -1
  102. package/dist/_chunks/nl-B_7CHwVD.mjs.map +0 -1
  103. package/dist/_chunks/pl-DDl5i_mP.js.map +0 -1
  104. package/dist/_chunks/pl-DwLr8sw9.mjs.map +0 -1
  105. package/dist/_chunks/pt-4GQ8ermL.js.map +0 -1
  106. package/dist/_chunks/pt-BR-D24CJ0qp.js.map +0 -1
  107. package/dist/_chunks/pt-BR-MVXc6V9P.mjs.map +0 -1
  108. package/dist/_chunks/pt-C2N9fdeh.mjs.map +0 -1
  109. package/dist/_chunks/ru-BddeNlU0.mjs.map +0 -1
  110. package/dist/_chunks/ru-QwZYcU6K.js.map +0 -1
  111. package/dist/_chunks/sk-BmT4uZTG.mjs.map +0 -1
  112. package/dist/_chunks/sk-DgAXilB1.js.map +0 -1
  113. package/dist/_chunks/sv-CCLcAo3U.js.map +0 -1
  114. package/dist/_chunks/sv-D_-KBtcw.mjs.map +0 -1
  115. package/dist/_chunks/th-BhgV1BbW.js.map +0 -1
  116. package/dist/_chunks/th-DkuoSGii.mjs.map +0 -1
  117. package/dist/_chunks/tr-BysnAErC.js.map +0 -1
  118. package/dist/_chunks/tr-l-xxK4Yk.mjs.map +0 -1
  119. package/dist/_chunks/uk-CNlbntFx.js.map +0 -1
  120. package/dist/_chunks/uk-Cpmsxyku.mjs.map +0 -1
  121. package/dist/_chunks/vi-ClWGrFm9.mjs.map +0 -1
  122. package/dist/_chunks/vi-_ib0GmNl.js.map +0 -1
  123. package/dist/_chunks/zh-Glkg1L2g.mjs.map +0 -1
  124. package/dist/_chunks/zh-Hans-L_5U2KqC.js.map +0 -1
  125. package/dist/_chunks/zh-Hans-XLMwjASk.mjs.map +0 -1
  126. package/dist/_chunks/zh-aEZZdkOu.js.map +0 -1
  127. package/dist/admin/index.js.map +0 -1
  128. package/dist/admin/index.mjs.map +0 -1
  129. package/dist/server/index.js.map +0 -1
  130. package/dist/server/index.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../server/src/utils.ts","../../server/src/bootstrap.ts","../../server/src/middlewares/documentation.ts","../../server/src/register.ts","../../server/src/services/helpers/utils/pascal-case.ts","../../server/src/services/helpers/utils/query-params.ts","../../server/src/services/helpers/utils/loop-content-type-names.ts","../../server/src/services/helpers/utils/get-api-responses.ts","../../server/src/services/helpers/utils/routes.ts","../../server/src/services/helpers/build-api-endpoint-path.ts","../../server/src/services/helpers/utils/get-schema-data.ts","../../server/src/services/helpers/utils/clean-schema-attributes.ts","../../server/src/services/helpers/build-component-schema.ts","../../server/src/services/utils/get-plugins-that-need-documentation.ts","../../server/src/services/documentation.ts","../../server/src/services/override.ts","../../server/src/services/index.ts","../../server/src/middlewares/restrict-access.ts","../../server/src/routes/index.ts","../../server/src/controllers/documentation.ts","../../server/src/controllers/index.ts","../../server/src/config/default-plugin-config.ts","../../server/src/config/index.ts","../../server/src/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { Services } from './services';\n\nexport const getService = <TName extends keyof Services>(\n name: TName,\n { strapi }: { strapi: Core.Strapi } = { strapi: global.strapi }\n): Services[TName] => {\n return strapi.plugin('documentation').service<Services[TName]>(name);\n};\n\nexport default {\n getService,\n};\n","import type { Core } from '@strapi/types';\n\nimport { getService } from './utils';\n\n// Add permissions\nconst RBAC_ACTIONS = [\n {\n section: 'plugins',\n displayName: 'Access the Documentation',\n uid: 'read',\n pluginName: 'documentation',\n },\n {\n section: 'plugins',\n displayName: 'Update and delete',\n uid: 'settings.update',\n pluginName: 'documentation',\n },\n {\n section: 'plugins',\n displayName: 'Regenerate',\n uid: 'settings.regenerate',\n pluginName: 'documentation',\n },\n {\n section: 'settings',\n displayName: 'Access the documentation settings page',\n uid: 'settings.read',\n pluginName: 'documentation',\n category: 'documentation',\n },\n];\n\nexport async function bootstrap({ strapi }: { strapi: Core.Strapi }) {\n await strapi.service('admin::permission').actionProvider.registerMany(RBAC_ACTIONS);\n\n const pluginStore = strapi.store!({\n environment: '',\n type: 'plugin',\n name: 'documentation',\n });\n\n const config = await pluginStore.get({ key: 'config' });\n\n if (!config) {\n pluginStore.set({ key: 'config', value: { restrictedAccess: false } });\n }\n\n await getService('documentation').generateFullDoc();\n}\n","import path from 'path';\nimport koaStatic from 'koa-static';\nimport swaggerUi from 'swagger-ui-dist';\n\nimport type { Core } from '@strapi/types';\n\nexport const addDocumentMiddlewares = async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.server.routes([\n {\n method: 'GET',\n path: '/plugins/documentation/(.*)',\n async handler(ctx, next) {\n ctx.url = path.basename(ctx.url);\n\n return koaStatic(swaggerUi.getAbsoluteFSPath(), {\n maxage: 86400000,\n defer: true,\n })(ctx, next);\n },\n config: {\n auth: false,\n },\n },\n ]);\n};\n","import type { Core } from '@strapi/types';\n\nimport { addDocumentMiddlewares } from './middlewares/documentation';\n\nexport async function register({ strapi }: { strapi: Core.Strapi }) {\n await addDocumentMiddlewares({ strapi });\n}\n","import _ from 'lodash';\n\nconst pascalCase = (string: string) => {\n return _.upperFirst(_.camelCase(string));\n};\n\nexport default pascalCase;\n","import type { OpenAPIV3 } from 'openapi-types';\n\nconst params: OpenAPIV3.ParameterObject[] = [\n {\n name: 'sort',\n in: 'query',\n description: 'Sort by attributes ascending (asc) or descending (desc)',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n {\n name: 'pagination[withCount]',\n in: 'query',\n description: 'Return page/pageSize (default: true)',\n deprecated: false,\n required: false,\n schema: {\n type: 'boolean',\n },\n },\n {\n name: 'pagination[page]',\n in: 'query',\n description: 'Page number (default: 0)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'pagination[pageSize]',\n in: 'query',\n description: 'Page size (default: 25)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'pagination[start]',\n in: 'query',\n description: 'Offset value (default: 0)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'pagination[limit]',\n in: 'query',\n description: 'Number of entities to return (default: 25)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'fields',\n in: 'query',\n description: 'Fields to return (ex: title,author)',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n {\n name: 'populate',\n in: 'query',\n description: 'Relations to return',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n {\n name: 'filters',\n in: 'query',\n description: 'Filters to apply',\n deprecated: false,\n required: false,\n schema: {\n type: 'object',\n additionalProperties: true,\n },\n style: 'deepObject',\n },\n {\n name: 'locale',\n in: 'query',\n description: 'Locale to apply',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n];\n\nexport default params;\n","import _ from 'lodash';\n\nimport type { Api, ApiInfo } from '../../../types';\n\n/**\n * @description A reusable loop for building api endpoint paths and component schemas\n */\nconst loopContentTypeNames = (api: Api, callback: (info: ApiInfo) => any) => {\n let result = {};\n for (const contentTypeName of api.ctNames) {\n // Get the attributes found on the api's contentType\n const uid = `${api.getter}::${api.name}.${contentTypeName}`;\n\n const { attributes, info: contentTypeInfo, kind } = strapi.contentType(uid as any);\n\n // Get the routes for the current api\n const routeInfo =\n api.getter === 'plugin'\n ? // @ts-expect-error – TODO: fix this\n strapi.plugin(api.name).routes['content-api']\n : strapi.api(api.name).routes[contentTypeName];\n\n // Continue to next iteration if routeInfo is undefined\n if (!routeInfo) {\n continue;\n }\n\n // Uppercase the first letter of the api name\n const apiName = _.upperFirst(api.name);\n\n // Create a unique name if the api name and contentType name don't match\n const uniqueName =\n api.name === contentTypeName ? apiName : `${apiName} - ${_.upperFirst(contentTypeName)}`;\n\n const apiInfo = {\n ...api,\n routeInfo,\n attributes,\n uniqueName,\n contentTypeInfo,\n kind,\n };\n\n result = {\n ...result,\n ...callback(apiInfo),\n };\n }\n\n return result;\n};\n\nexport default loopContentTypeNames;\n","import type { OpenAPIV3 } from 'openapi-types';\nimport pascalCase from './pascal-case';\n\ninterface Options {\n uniqueName: string;\n route: {\n method: string;\n };\n isListOfEntities?: boolean;\n isLocalizationPath?: boolean;\n}\n\n/**\n * @description - Builds the Swagger response object for a given api\n */\nconst getApiResponse = ({\n uniqueName,\n route,\n isListOfEntities = false,\n}: Options): OpenAPIV3.ResponsesObject => {\n const getSchema = (): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject => {\n if (route.method === 'DELETE') {\n return {\n type: 'integer',\n format: 'int64',\n };\n }\n\n if (isListOfEntities) {\n return { $ref: `#/components/schemas/${pascalCase(uniqueName)}ListResponse` };\n }\n\n return { $ref: `#/components/schemas/${pascalCase(uniqueName)}Response` };\n };\n\n const schema = getSchema();\n\n return {\n 200: {\n description: 'OK',\n content: {\n 'application/json': {\n schema,\n },\n },\n },\n 400: {\n description: 'Bad Request',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 401: {\n description: 'Unauthorized',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 403: {\n description: 'Forbidden',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 404: {\n description: 'Not Found',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 500: {\n description: 'Internal Server Error',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n };\n};\n\nexport default getApiResponse;\n","const hasFindMethod = (handler: unknown) => {\n if (typeof handler === 'string') {\n return handler.split('.').pop() === 'find';\n }\n\n return false;\n};\n\nexport { hasFindMethod };\n","import _ from 'lodash';\nimport * as pathToRegexp from 'path-to-regexp';\n\nimport type { Core } from '@strapi/types';\nimport type { OpenAPIV3 } from 'openapi-types';\n\nimport pascalCase from './utils/pascal-case';\nimport queryParams from './utils/query-params';\nimport loopContentTypeNames from './utils/loop-content-type-names';\nimport getApiResponses from './utils/get-api-responses';\nimport { hasFindMethod } from './utils/routes';\n\nimport type { Api, ApiInfo } from '../../types';\n\n/**\n * @description Parses a route with ':variable'\n *\n * @param {string} routePath - The route's path property\n * @returns {string}\n */\nconst parsePathWithVariables = (routePath: string) => {\n return pathToRegexp\n .parse(routePath)\n .map((token) => {\n if (_.isObject(token)) {\n return `${token.prefix}{${token.name}}`;\n }\n\n return token;\n })\n .join('');\n};\n\n/**\n * @description Builds the required object for a path parameter\n *\n * @param {string} routePath - The route's path property\n *\n * @returns {object } Swagger path params object\n */\nconst getPathParams = (routePath: string): OpenAPIV3.ParameterObject[] => {\n return pathToRegexp.parse(routePath).reduce((acc, param) => {\n if (!(typeof param === 'object')) {\n return acc;\n }\n\n acc.push({\n name: `${param.name}`,\n in: 'path',\n description: '',\n deprecated: false,\n required: true,\n schema: { type: 'number' },\n });\n\n return acc;\n }, [] as OpenAPIV3.ParameterObject[]);\n};\n\nconst getPathWithPrefix = (prefix: string | undefined, route: Core.Route) => {\n // When the prefix is set on the routes and\n // the current route is not trying to remove it\n if (prefix && !_.has(route.config, 'prefix')) {\n // Add the prefix to the path\n return prefix.concat(route.path);\n }\n\n // Otherwise just return path\n return route.path;\n};\n/**\n * @description Gets all paths based on routes\n *\n * @param {object} apiInfo\n * @property {object} apiInfo.routeInfo - The api routes object\n * @property {string} apiInfo.uniqueName - Content type name | Api name + Content type name\n * @property {object} apiInfo.contentTypeInfo - The info object found on content type schemas\n *\n * @returns {object}\n */\nconst getPaths = ({ routeInfo, uniqueName, contentTypeInfo, kind }: ApiInfo) => {\n // Get the routes for the current content type\n const contentTypeRoutes = routeInfo.routes.filter((route) => {\n return (\n route.path.includes(contentTypeInfo.pluralName) ||\n route.path.includes(contentTypeInfo.singularName)\n );\n });\n\n const paths = contentTypeRoutes.reduce((acc: any, route: Core.Route) => {\n // TODO: Find a more reliable way to determine list of entities vs a single entity\n const isListOfEntities = hasFindMethod(route.handler);\n const methodVerb = route.method.toLowerCase();\n const hasPathParams = route.path.includes('/:');\n const pathWithPrefix = getPathWithPrefix(routeInfo.prefix, route);\n const routePath = hasPathParams ? parsePathWithVariables(pathWithPrefix) : pathWithPrefix;\n\n const responses = getApiResponses({\n uniqueName,\n route,\n isListOfEntities: kind !== 'singleType' && isListOfEntities,\n });\n\n const swaggerConfig: OpenAPIV3.OperationObject = {\n responses,\n tags: [_.upperFirst(uniqueName)],\n parameters: [],\n operationId: `${methodVerb}${routePath}`,\n };\n\n if (isListOfEntities) {\n swaggerConfig.parameters?.push(...queryParams);\n }\n\n if (hasPathParams) {\n const pathParams = getPathParams(route.path);\n swaggerConfig.parameters?.push(...pathParams);\n }\n\n if (['post', 'put'].includes(methodVerb)) {\n const refName = 'Request';\n const requestBody = {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: `#/components/schemas/${pascalCase(uniqueName)}${refName}`,\n },\n },\n },\n };\n\n swaggerConfig.requestBody = requestBody;\n }\n\n _.set(acc, `${routePath}.${methodVerb}`, swaggerConfig);\n\n return acc;\n }, {});\n\n return paths;\n};\n\n/**\n * @description - Builds the Swagger paths object for each api\n */\nconst buildApiEndpointPath = (api: Api) => {\n // A reusable loop for building paths and component schemas\n // Uses the api param to build a new set of params for each content type\n // Passes these new params to the function provided\n return loopContentTypeNames(api, getPaths);\n};\n\nexport default buildApiEndpointPath;\n","import type { OpenAPIV3 } from 'openapi-types';\n\n/**\n * @description Determines the format of the data response\n *\n * @param {boolean} isListOfEntities - Checks for a multiple entities\n * @param {object} attributes - The attributes found on a contentType\n\n * @returns object | array of attributes\n */\nexport default (\n isListOfEntities: boolean,\n attributes: Record<string, OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject>\n): OpenAPIV3.SchemaObject => {\n if (isListOfEntities) {\n return {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: { type: 'number' },\n documentId: { type: 'string' },\n ...attributes,\n },\n },\n };\n }\n\n return {\n type: 'object',\n properties: {\n id: { type: 'number' },\n documentId: { type: 'string' },\n ...attributes,\n },\n };\n};\n","import type { Struct } from '@strapi/types';\nimport type { OpenAPIV3 } from 'openapi-types';\n\nimport getSchemaData from './get-schema-data';\nimport pascalCase from './pascal-case';\n\ninterface Options {\n typeMap?: Map<string, boolean>;\n isRequest?: boolean;\n didAddStrapiComponentsToSchemas: (name: string, schema: object) => boolean;\n}\n\n/**\n * @description - Convert attribute component names to OpenAPI component names\n *\n * @returns OpenAPI component name\n */\nconst convertComponentName = (component: string, isRef = false): string => {\n const cleanComponentName = `${pascalCase(component)}Component`;\n\n if (isRef) {\n return `#/components/schemas/${cleanComponentName}`;\n }\n return cleanComponentName;\n};\n\n/**\n * @description - Converts types found on attributes to OpenAPI acceptable data types\n *\n * @returns Attributes using OpenAPI acceptable data types\n */\nconst cleanSchemaAttributes = (\n attributes: Struct.SchemaAttributes,\n { typeMap = new Map(), isRequest = false, didAddStrapiComponentsToSchemas }: Options\n) => {\n const schemaAttributes: Record<string, OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject> = {};\n\n for (const prop of Object.keys(attributes)) {\n const attribute = attributes[prop];\n\n switch (attribute.type) {\n case 'password': {\n if (!isRequest) {\n break;\n }\n\n schemaAttributes[prop] = { type: 'string', format: 'password', example: '*******' };\n break;\n }\n case 'email': {\n schemaAttributes[prop] = { type: 'string', format: 'email' };\n break;\n }\n case 'string':\n case 'text':\n case 'richtext': {\n schemaAttributes[prop] = { type: 'string' };\n break;\n }\n case 'timestamp': {\n schemaAttributes[prop] = { type: 'string', format: 'timestamp', example: Date.now() };\n break;\n }\n case 'time': {\n schemaAttributes[prop] = { type: 'string', format: 'time', example: '12:54.000' };\n break;\n }\n case 'date': {\n schemaAttributes[prop] = { type: 'string', format: 'date' };\n break;\n }\n case 'datetime': {\n schemaAttributes[prop] = { type: 'string', format: 'date-time' };\n break;\n }\n case 'boolean': {\n schemaAttributes[prop] = { type: 'boolean' };\n break;\n }\n case 'enumeration': {\n schemaAttributes[prop] = { type: 'string', enum: [...attribute.enum] };\n break;\n }\n case 'decimal':\n case 'float': {\n schemaAttributes[prop] = { type: 'number', format: 'float' };\n break;\n }\n case 'integer': {\n schemaAttributes[prop] = { type: 'integer' };\n break;\n }\n case 'biginteger': {\n schemaAttributes[prop] = { type: 'string', pattern: '^\\\\d*$', example: '123456789' };\n break;\n }\n case 'json':\n case 'blocks': {\n schemaAttributes[prop] = {};\n break;\n }\n case 'uid': {\n schemaAttributes[prop] = { type: 'string' };\n break;\n }\n case 'component': {\n const componentAttributes = strapi.components[attribute.component].attributes;\n const rawComponentSchema: OpenAPIV3.SchemaObject = {\n type: 'object',\n properties: {\n ...(isRequest ? {} : { id: { type: 'number' } }),\n ...cleanSchemaAttributes(componentAttributes, {\n typeMap,\n isRequest,\n didAddStrapiComponentsToSchemas,\n }),\n },\n };\n\n const refComponentSchema: OpenAPIV3.ReferenceObject = {\n $ref: convertComponentName(attribute.component, true),\n };\n\n const componentExists = didAddStrapiComponentsToSchemas(\n convertComponentName(attribute.component),\n rawComponentSchema\n );\n\n const finalComponentSchema = componentExists ? refComponentSchema : rawComponentSchema;\n if (attribute.repeatable) {\n schemaAttributes[prop] = {\n type: 'array',\n items: finalComponentSchema,\n };\n } else {\n schemaAttributes[prop] = finalComponentSchema;\n }\n break;\n }\n case 'dynamiczone': {\n const components = attribute.components.map((component) => {\n const componentAttributes = strapi.components[component].attributes;\n const rawComponentSchema: OpenAPIV3.SchemaObject = {\n type: 'object',\n properties: {\n ...(isRequest ? {} : { id: { type: 'number' } }),\n __component: { type: 'string', enum: [component] },\n ...cleanSchemaAttributes(componentAttributes, {\n typeMap,\n isRequest,\n didAddStrapiComponentsToSchemas,\n }),\n },\n };\n\n const refComponentSchema: OpenAPIV3.ReferenceObject = {\n $ref: convertComponentName(component, true),\n };\n\n const componentExists = didAddStrapiComponentsToSchemas(\n convertComponentName(component),\n rawComponentSchema\n );\n const finalComponentSchema = componentExists ? refComponentSchema : rawComponentSchema;\n return finalComponentSchema;\n });\n let discriminator: OpenAPIV3.DiscriminatorObject | undefined;\n if (components.every((component) => Object.hasOwn(component, '$ref'))) {\n discriminator = {\n propertyName: '__component',\n mapping: attribute.components.reduce(\n (acc, component) => {\n acc[component] = convertComponentName(component, true);\n return acc;\n },\n {} as {\n [value: string]: string;\n }\n ),\n };\n }\n\n schemaAttributes[prop] = {\n type: 'array',\n items: {\n anyOf: components,\n },\n discriminator,\n };\n break;\n }\n case 'media': {\n const imageAttributes = strapi.contentType('plugin::upload.file').attributes;\n const isListOfEntities = attribute.multiple ?? false;\n\n if (isRequest) {\n const oneOfType: OpenAPIV3.SchemaObject = {\n oneOf: [{ type: 'integer' }, { type: 'string' }],\n example: 'string or id',\n };\n\n schemaAttributes[prop] = isListOfEntities\n ? { type: 'array', items: oneOfType }\n : oneOfType;\n break;\n }\n\n schemaAttributes[prop] = getSchemaData(\n isListOfEntities,\n cleanSchemaAttributes(imageAttributes, { typeMap, didAddStrapiComponentsToSchemas })\n );\n break;\n }\n\n case 'relation': {\n const isListOfEntities = attribute.relation.includes('ToMany');\n\n if (isRequest) {\n const oneOfType: OpenAPIV3.SchemaObject = {\n oneOf: [{ type: 'integer' }, { type: 'string' }],\n example: 'string or id',\n };\n\n schemaAttributes[prop] = isListOfEntities\n ? { type: 'array', items: oneOfType }\n : oneOfType;\n break;\n }\n\n if (!('target' in attribute) || !attribute.target || typeMap.has(attribute.target)) {\n schemaAttributes[prop] = getSchemaData(isListOfEntities, {});\n\n break;\n }\n\n typeMap.set(attribute.target, true);\n const targetAttributes = strapi.contentType(attribute.target).attributes;\n\n schemaAttributes[prop] = getSchemaData(\n isListOfEntities,\n cleanSchemaAttributes(targetAttributes, {\n typeMap,\n isRequest,\n didAddStrapiComponentsToSchemas,\n })\n );\n\n break;\n }\n default: {\n // @ts-expect-error - This is a catch all for any other types\n throw new Error(`Invalid type ${attribute.type} while generating open api schema.`);\n }\n }\n }\n\n return schemaAttributes;\n};\n\nexport default cleanSchemaAttributes;\n","import _ from 'lodash';\n\nimport type { OpenAPIV3 } from 'openapi-types';\nimport type { Core, Struct } from '@strapi/types';\n\nimport cleanSchemaAttributes from './utils/clean-schema-attributes';\nimport loopContentTypeNames from './utils/loop-content-type-names';\nimport pascalCase from './utils/pascal-case';\nimport { hasFindMethod } from './utils/routes';\n\nimport type { Api, ApiInfo } from '../../types';\n\nconst getRequiredAttributes = (allAttributes: Struct.SchemaAttributes) => {\n const requiredAttributes: string[] = [];\n\n for (const key in allAttributes) {\n if (allAttributes[key].required) {\n requiredAttributes.push(key);\n }\n }\n\n return requiredAttributes;\n};\n\n/**\n * @decription Get all open api schema objects for a given content type\n *\n * @param {object} apiInfo\n * @property {string} apiInfo.uniqueName - Api name | Api name + Content type name\n * @property {object} apiInfo.attributes - Attributes on content type\n * @property {object} apiInfo.routeInfo - The routes for the api\n *\n * @returns {object} Open API schemas\n */\nconst getAllSchemasForContentType = ({ routeInfo, attributes, uniqueName }: ApiInfo) => {\n // Store response and request schemas in an object\n let strapiComponentSchemas = {};\n const schemas: OpenAPIV3.ComponentsObject = {};\n const typeName = pascalCase(uniqueName);\n\n // adds a ComponentSchema to the Schemas so it can be used as Ref\n const didAddStrapiComponentsToSchemas = (schemaName: string, schema: OpenAPIV3.SchemaObject) => {\n if (!Object.keys(schema) || !Object.keys(schema.properties!)) return false;\n\n // Add the Strapi components to the schema\n strapiComponentSchemas = {\n ...strapiComponentSchemas,\n [schemaName]: schema,\n };\n\n return true;\n };\n\n // Get all the route methods\n const routeMethods = routeInfo.routes.map((route: Core.Route) => route.method);\n\n const attributesToOmit = [\n 'createdAt',\n 'updatedAt',\n 'publishedAt',\n 'publishedBy',\n 'updatedBy',\n 'createdBy',\n ];\n\n const attributesForRequest = _.omit(attributes, attributesToOmit);\n // Get a list of required attribute names\n const requiredRequestAttributes = getRequiredAttributes(attributesForRequest);\n // Build the request schemas when the route has POST or PUT methods\n if (routeMethods.includes('POST') || routeMethods.includes('PUT')) {\n // Build localization requests schemas\n\n // Build the request schema\n Object.assign(schemas, {\n [`${typeName}Request`]: {\n type: 'object',\n required: ['data'],\n properties: {\n data: {\n ...(requiredRequestAttributes.length && { required: requiredRequestAttributes }),\n type: 'object',\n properties: cleanSchemaAttributes(attributesForRequest, {\n isRequest: true,\n didAddStrapiComponentsToSchemas,\n }),\n },\n },\n },\n });\n }\n\n // Check for routes that need to return a list\n const hasListOfEntities = routeInfo.routes.filter((route: Core.Route) =>\n hasFindMethod(route.handler)\n ).length;\n\n if (hasListOfEntities) {\n // Build the list response schema\n Object.assign(schemas, {\n [`${typeName}ListResponse`]: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: {\n $ref: `#/components/schemas/${typeName}`,\n },\n },\n meta: {\n type: 'object',\n properties: {\n pagination: {\n type: 'object',\n properties: {\n page: { type: 'integer' },\n pageSize: { type: 'integer', minimum: 25 },\n pageCount: { type: 'integer', maximum: 1 },\n total: { type: 'integer' },\n },\n },\n },\n },\n },\n },\n });\n }\n\n const requiredAttributes = getRequiredAttributes(attributes);\n // Build the response schema\n Object.assign(schemas, {\n [`${typeName}`]: {\n type: 'object',\n ...(requiredAttributes.length && { required: requiredAttributes }),\n properties: {\n id: { type: 'number' },\n documentId: { type: 'string' },\n ...cleanSchemaAttributes(attributes, { didAddStrapiComponentsToSchemas }),\n },\n },\n\n [`${typeName}Response`]: {\n type: 'object',\n properties: {\n data: {\n $ref: `#/components/schemas/${typeName}`,\n },\n meta: { type: 'object' },\n },\n },\n });\n\n return { ...schemas, ...strapiComponentSchemas };\n};\n\nconst buildComponentSchema = (api: Api) => {\n // A reusable loop for building paths and component schemas\n // Uses the api param to build a new set of params for each content type\n // Passes these new params to the function provided\n return loopContentTypeNames(api, getAllSchemasForContentType);\n};\n\nexport default buildComponentSchema;\n","import type { PluginConfig } from '../../types';\n\nconst getPluginsThatNeedDocumentation = (config: PluginConfig) => {\n // Default plugins that need documentation generated\n const defaultPlugins = ['upload', 'users-permissions'];\n\n // User specified plugins that need documentation generated\n const userPluginsConfig = config['x-strapi-config'].plugins;\n\n if (userPluginsConfig === null) {\n // The user hasn't specified any plugins to document, use the defaults\n return defaultPlugins;\n }\n\n if (userPluginsConfig.length) {\n // The user has specified certain plugins to document, use them\n return userPluginsConfig;\n }\n\n // The user has specified that no plugins should be documented\n return [];\n};\n\nexport { getPluginsThatNeedDocumentation };\n","import path from 'path';\nimport fs from 'fs-extra';\nimport { produce } from 'immer';\nimport type { Core } from '@strapi/types';\n\nimport { builApiEndpointPath, buildComponentSchema } from './helpers';\nimport { getPluginsThatNeedDocumentation } from './utils/get-plugins-that-need-documentation';\nimport { getService } from '../utils';\n\nimport type { Config, PluginConfig } from '../types';\n\nexport type Version = {\n version: string;\n generatedDate: string;\n url: string;\n};\n\nexport type DocumentationService = ReturnType<typeof createService>;\n\nconst createService = ({ strapi }: { strapi: Core.Strapi }) => {\n const config = strapi.config.get('plugin::documentation') as PluginConfig;\n const pluginsThatNeedDocumentation = getPluginsThatNeedDocumentation(config);\n const overrideService = getService('override');\n\n return {\n getDocumentationVersion() {\n return config.info.version;\n },\n\n getFullDocumentationPath() {\n return path.join(strapi.dirs.app.extensions, 'documentation', 'documentation');\n },\n\n getDocumentationVersions(): Version[] {\n return fs\n .readdirSync(this.getFullDocumentationPath())\n .map((version) => {\n try {\n const filePath = path.resolve(\n this.getFullDocumentationPath(),\n version,\n 'full_documentation.json'\n );\n\n const doc = JSON.parse(fs.readFileSync(filePath).toString());\n\n const generatedDate = doc.info['x-generation-date'];\n\n return { version, generatedDate, url: '' };\n } catch (err) {\n return null;\n }\n })\n .filter((x) => x) as Version[];\n },\n\n /**\n * Returns settings stored in core-store\n */\n async getDocumentationAccess() {\n const { restrictedAccess } = (await strapi.store!({\n environment: '',\n type: 'plugin',\n name: 'documentation',\n key: 'config',\n }).get()) as Config;\n\n return { restrictedAccess };\n },\n\n getApiDocumentationPath(api: { name: string; getter: string }) {\n if (api.getter === 'plugin') {\n return path.join(strapi.dirs.app.extensions, api.name, 'documentation');\n }\n\n return path.join(strapi.dirs.app.api, api.name, 'documentation');\n },\n\n async deleteDocumentation(version: string) {\n const apis = this.getPluginAndApiInfo();\n for (const api of apis) {\n await fs.remove(path.join(this.getApiDocumentationPath(api), version));\n }\n\n await fs.remove(path.join(this.getFullDocumentationPath(), version));\n },\n\n getPluginAndApiInfo() {\n const pluginsToDocument = pluginsThatNeedDocumentation.map((plugin) => {\n return {\n name: plugin,\n getter: 'plugin',\n ctNames: Object.keys(strapi.plugin(plugin).contentTypes),\n };\n });\n\n const apisToDocument = Object.keys(strapi.apis).map((api) => {\n return {\n name: api,\n getter: 'api',\n ctNames: Object.keys(strapi.api(api).contentTypes),\n };\n });\n\n return [...apisToDocument, ...pluginsToDocument];\n },\n\n /**\n * @description - Creates the Swagger json files\n */\n async generateFullDoc(versionOpt?: string) {\n const version = versionOpt ?? this.getDocumentationVersion();\n\n const apis = this.getPluginAndApiInfo();\n const apisThatNeedGeneratedDocumentation = apis.filter(\n ({ name }) => !overrideService.isEnabled(name)\n );\n\n // Initialize the generated documentation with defaults\n const generatedDocumentation = await produce(config, async (draft) => {\n if (draft.servers?.length === 0) {\n // When no servers found set the defaults\n const serverUrl = strapi.config.get('server.absoluteUrl');\n const apiPath = strapi.config.get('api.rest.prefix');\n draft.servers = [\n {\n url: `${serverUrl}${apiPath}`,\n description: 'Development server',\n },\n ];\n }\n\n if (!draft.components) {\n draft.components = {};\n }\n\n // Set the generated date\n draft.info['x-generation-date'] = new Date().toISOString();\n // Set the plugins that need documentation\n draft['x-strapi-config'].plugins = pluginsThatNeedDocumentation;\n\n // Delete the mutateDocumentation key from the config so it doesn't end up in the spec\n delete draft['x-strapi-config'].mutateDocumentation;\n\n // Generate the documentation for each api and update the generatedDocumentation\n for (const api of apisThatNeedGeneratedDocumentation) {\n const newApiPath = builApiEndpointPath(api);\n const generatedSchemas = buildComponentSchema(api);\n\n if (generatedSchemas) {\n draft.components.schemas = { ...draft.components.schemas, ...generatedSchemas };\n }\n\n if (newApiPath) {\n draft.paths = { ...draft.paths, ...newApiPath };\n }\n }\n\n // When overrides are present update the generatedDocumentation\n if (overrideService.registeredOverrides.length > 0) {\n overrideService.registeredOverrides.forEach((override: Partial<PluginConfig>) => {\n // Only run the overrrides when no override version is provided,\n // or when the generated documentation version matches the override version\n if (!override?.info?.version || override.info.version === version) {\n if (override.tags) {\n // Merge override tags with the generated tags\n draft.tags = draft.tags || [];\n draft.tags.push(...override.tags);\n }\n\n if (override.paths) {\n // Merge override paths with the generated paths\n // The override will add a new path or replace the value of an existing path\n draft.paths = { ...draft.paths, ...override.paths };\n }\n\n if (override.components) {\n const keys = Object.keys(override.components) as Array<\n keyof typeof override.components\n >;\n\n keys.forEach((overrideKey) => {\n draft.components = draft.components || {};\n\n const overrideValue = override.components?.[overrideKey];\n const originalValue = draft.components?.[overrideKey];\n\n Object.assign(draft.components, {\n [overrideKey]: {\n ...originalValue,\n ...overrideValue,\n },\n });\n });\n }\n }\n });\n }\n });\n\n // Escape hatch, allow the user to provide a mutateDocumentation function that can alter any part of\n // the generated documentation before it is written to the file system\n const userMutatesDocumentation = config['x-strapi-config'].mutateDocumentation;\n\n const finalDocumentation = userMutatesDocumentation\n ? produce(generatedDocumentation, userMutatesDocumentation)\n : generatedDocumentation;\n\n // Get the file path for the final documentation\n const fullDocJsonPath = path.join(\n this.getFullDocumentationPath(),\n version,\n 'full_documentation.json'\n );\n // Write the documentation to the file system\n await fs.ensureFile(fullDocJsonPath);\n await fs.writeJson(fullDocJsonPath, finalDocumentation, { spaces: 2 });\n },\n };\n};\n\nexport default createService;\n","import type { Core } from '@strapi/types';\n\nimport { getPluginsThatNeedDocumentation } from './utils/get-plugins-that-need-documentation';\nimport type { PluginConfig } from '../types';\n\nexport type OverrideService = ReturnType<typeof createService>;\n\nconst createService = ({ strapi }: { strapi: Core.Strapi }) => {\n const registeredOverrides: Partial<PluginConfig>[] = [];\n const excludedFromGeneration: string[] = [];\n\n return {\n registeredOverrides,\n excludedFromGeneration,\n /**\n *\n * @param {(string | string[])} api - The name of the api or and array of apis to exclude from generation\n */\n excludeFromGeneration(api: string | string[]) {\n if (Array.isArray(api)) {\n excludedFromGeneration.push(...api);\n\n return;\n }\n\n excludedFromGeneration.push(api);\n },\n\n isEnabled(name: string) {\n return excludedFromGeneration.includes(name);\n },\n\n registerOverride(\n override: Partial<PluginConfig>,\n opts?: { pluginOrigin: string; excludeFromGeneration?: string[] }\n ) {\n const { pluginOrigin, excludeFromGeneration = [] } = opts ?? {};\n\n const pluginsThatNeedDocumentation = getPluginsThatNeedDocumentation(\n strapi.config.get('plugin::documentation')\n );\n // Don't apply the override if the plugin is not in the list of plugins that need documentation\n if (pluginOrigin && !pluginsThatNeedDocumentation.includes(pluginOrigin)) return;\n\n if (excludeFromGeneration.length) {\n this.excludeFromGeneration(excludeFromGeneration);\n }\n\n let overrideToRegister = override;\n // Parse yaml if we receive a string\n if (typeof override === 'string') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n overrideToRegister = require('yaml').parse(overrideToRegister);\n }\n // receive an object we can register it directly\n registeredOverrides.push(overrideToRegister);\n },\n };\n};\n\nexport default createService;\n","// import type { Common } from '@strapi/types';\n\nimport documentation, { type DocumentationService } from './documentation';\nimport override, { type OverrideService } from './override';\n\nexport default {\n documentation,\n override,\n};\n\nexport type Services = {\n documentation: DocumentationService;\n override: OverrideService;\n};\n","import type Koa from 'koa';\nimport type {} from 'koa-session';\n\nimport type { Config } from '../types';\n\nexport default async (ctx: Koa.Context, next: Koa.Next) => {\n const pluginStore = strapi.store({ type: 'plugin', name: 'documentation' });\n\n const config = (await pluginStore.get({ key: 'config' })) as Config;\n\n if (!config.restrictedAccess) {\n return next();\n }\n\n if (!ctx.session || !ctx.session.documentation || !ctx.session.documentation.logged) {\n const querystring = ctx.querystring ? `?${ctx.querystring}` : '';\n\n return ctx.redirect(`${strapi.config.server.url}/documentation/login${querystring}`);\n }\n\n // Execute the action.\n return next();\n};\n","import restrictAccess from '../middlewares/restrict-access';\n\nexport default [\n {\n method: 'GET',\n path: '/',\n handler: 'documentation.index',\n config: {\n auth: false,\n middlewares: [restrictAccess],\n },\n },\n {\n method: 'GET',\n path: '/v:major(\\\\d+).:minor(\\\\d+).:patch(\\\\d+)',\n handler: 'documentation.index',\n config: {\n auth: false,\n middlewares: [restrictAccess],\n },\n },\n {\n method: 'GET',\n path: '/login',\n handler: 'documentation.loginView',\n config: {\n auth: false,\n },\n },\n {\n method: 'POST',\n path: '/login',\n handler: 'documentation.login',\n config: {\n auth: false,\n },\n },\n {\n method: 'GET',\n path: '/getInfos',\n handler: 'documentation.getInfos',\n config: {\n policies: [\n { name: 'admin::hasPermissions', config: { actions: ['plugin::documentation.read'] } },\n ],\n },\n },\n {\n method: 'POST',\n path: '/regenerateDoc',\n handler: 'documentation.regenerateDoc',\n config: {\n policies: [\n {\n name: 'admin::hasPermissions',\n config: { actions: ['plugin::documentation.settings.regenerate'] },\n },\n ],\n },\n },\n {\n method: 'PUT',\n path: '/updateSettings',\n handler: 'documentation.updateSettings',\n config: {\n policies: [\n {\n name: 'admin::hasPermissions',\n config: { actions: ['plugin::documentation.settings.update'] },\n },\n ],\n },\n },\n {\n method: 'DELETE',\n path: '/deleteDoc/:version',\n handler: 'documentation.deleteDoc',\n config: {\n policies: [],\n },\n },\n];\n","import path from 'path';\nimport bcrypt from 'bcryptjs';\nimport fs from 'fs-extra';\nimport _ from 'lodash';\nimport koaStatic from 'koa-static';\nimport { yup, validateYupSchema } from '@strapi/utils';\n\nimport type Koa from 'koa';\nimport type {} from 'koa-body';\n\nimport { getService } from '../utils';\nimport type { Config } from '../types';\n\nconst validation = {\n validateSettings: validateYupSchema(\n yup.object().shape({\n restrictedAccess: yup.boolean(),\n password: yup\n .string()\n .min(8)\n .matches(/[a-z]/, '${path} must contain at least one lowercase character')\n .matches(/[A-Z]/, '${path} must contain at least one uppercase character')\n .matches(/\\d/, '${path} must contain at least one number')\n .when('restrictedAccess', (value, initSchema) => {\n return value ? initSchema.required('password is required') : initSchema;\n }),\n })\n ),\n};\n\nexport default {\n async getInfos(ctx: Koa.Context) {\n try {\n const docService = getService('documentation');\n const docVersions = docService.getDocumentationVersions();\n const documentationAccess = await docService.getDocumentationAccess();\n\n ctx.send({\n docVersions,\n currentVersion: docService.getDocumentationVersion(),\n prefix: '/documentation',\n documentationAccess,\n });\n } catch (err) {\n strapi.log.error(err);\n ctx.badRequest();\n }\n },\n\n async index(ctx: Koa.Context, next: Koa.Next) {\n try {\n /**\n * We don't expose the specs using koa-static or something else due to security reasons.\n * That's why, we need to read the file localy and send the specs through it when we serve the Swagger UI.\n */\n const { major, minor, patch } = ctx.params;\n const version =\n major && minor && patch\n ? `${major}.${minor}.${patch}`\n : getService('documentation').getDocumentationVersion();\n\n const openAPISpecsPath = path.join(\n strapi.dirs.app.extensions,\n 'documentation',\n 'documentation',\n version,\n 'full_documentation.json'\n );\n\n try {\n const documentation = fs.readFileSync(openAPISpecsPath, 'utf8');\n\n const layout = (await import('../public/index.html?raw')).default;\n\n const filledLayout = _.template(layout)({\n backendUrl: strapi.config.server.url,\n spec: JSON.stringify(JSON.parse(documentation)),\n });\n\n try {\n const layoutPath = path.resolve(\n strapi.dirs.app.extensions,\n 'documentation',\n 'public',\n 'index.html'\n );\n await fs.ensureFile(layoutPath);\n await fs.writeFile(layoutPath, filledLayout);\n\n // Serve the file.\n ctx.url = path.basename(`${ctx.url}/index.html`);\n\n try {\n const staticFolder = path.resolve(\n strapi.dirs.app.extensions,\n 'documentation',\n 'public'\n );\n return koaStatic(staticFolder)(ctx, next);\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n },\n\n async loginView(ctx: Koa.Context, next: Koa.Next) {\n // lazy require cheerio\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const cheerio = require('cheerio');\n\n const { error } = ctx.query;\n\n try {\n const layout = (await import('../public/login.html?raw')).default;\n\n const filledLayout = _.template(layout.toString())({\n actionUrl: `${strapi.config.server.url}/documentation/login`,\n });\n\n const $ = cheerio.load(filledLayout);\n\n $('.error').text(_.isEmpty(error) ? '' : 'Wrong password...');\n\n try {\n const layoutPath = path.resolve(\n strapi.dirs.app.extensions,\n 'documentation',\n 'public',\n 'login.html'\n );\n await fs.ensureFile(layoutPath);\n await fs.writeFile(layoutPath, $.html());\n\n ctx.url = path.basename(`${ctx.url}/login.html`);\n\n try {\n const staticFolder = path.resolve(strapi.dirs.app.extensions, 'documentation', 'public');\n return koaStatic(staticFolder)(ctx, next);\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n },\n\n async login(ctx: Koa.Context) {\n const {\n body: { password },\n } = ctx.request;\n\n const { password: hash } = (await strapi\n .store({ type: 'plugin', name: 'documentation', key: 'config' })\n .get()) as { password: string };\n\n const isValid = await bcrypt.compare(password, hash);\n\n let querystring = '?error=password';\n\n if (isValid && ctx.session) {\n ctx.session.documentation = {\n logged: true,\n };\n\n querystring = '';\n }\n\n ctx.redirect(`${strapi.config.server.url}/documentation${querystring}`);\n },\n\n async regenerateDoc(ctx: Koa.Context) {\n const { version } = ctx.request.body;\n\n const service = getService('documentation');\n\n const documentationVersions = service.getDocumentationVersions().map((el) => el.version);\n\n if (_.isEmpty(version)) {\n return ctx.badRequest('Please provide a version.');\n }\n\n if (!documentationVersions.includes(version)) {\n return ctx.badRequest('The version you are trying to generate does not exist.');\n }\n\n try {\n strapi.reload.isWatching = false;\n await service.generateFullDoc(version);\n ctx.send({ ok: true });\n } finally {\n strapi.reload.isWatching = true;\n }\n },\n\n async deleteDoc(ctx: Koa.Context) {\n const { version } = ctx.params;\n\n const service = getService('documentation');\n\n const documentationVersions = service.getDocumentationVersions().map((el) => el.version);\n\n if (_.isEmpty(version)) {\n return ctx.badRequest('Please provide a version.');\n }\n\n if (!documentationVersions.includes(version)) {\n return ctx.badRequest('The version you are trying to delete does not exist.');\n }\n\n try {\n strapi.reload.isWatching = false;\n await service.deleteDocumentation(version);\n ctx.send({ ok: true });\n } finally {\n strapi.reload.isWatching = true;\n }\n },\n\n async updateSettings(ctx: Koa.Context) {\n const pluginStore = strapi.store({ type: 'plugin', name: 'documentation' });\n\n const data = await validation.validateSettings(ctx.request.body);\n\n const config: Config = {\n restrictedAccess: Boolean(data.restrictedAccess),\n };\n\n if (data.password) {\n config.password = await bcrypt.hash(data.password, 10);\n }\n\n await pluginStore.set({ key: 'config', value: config });\n\n return ctx.send({ ok: true });\n },\n};\n","import documentation from './documentation';\n\nexport default {\n documentation,\n};\n","import type { PluginConfig } from '../types';\n\nexport const defaultConfig: PluginConfig = {\n openapi: '3.0.0',\n info: {\n version: '1.0.0',\n title: 'DOCUMENTATION',\n description: '',\n termsOfService: 'YOUR_TERMS_OF_SERVICE_URL',\n contact: {\n name: 'TEAM',\n email: 'contact-email@something.io',\n url: 'mywebsite.io',\n },\n license: {\n name: 'Apache 2.0',\n url: 'https://www.apache.org/licenses/LICENSE-2.0.html',\n },\n },\n 'x-strapi-config': {\n plugins: null,\n mutateDocumentation: null,\n },\n servers: [],\n externalDocs: {\n description: 'Find out more',\n url: 'https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html',\n },\n security: [\n {\n bearerAuth: [],\n },\n ],\n paths: {},\n components: {\n securitySchemes: {\n bearerAuth: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n },\n },\n schemas: {\n Error: {\n type: 'object',\n required: ['error'],\n properties: {\n data: {\n nullable: true,\n oneOf: [{ type: 'object' }, { type: 'array', items: { type: 'object' } }],\n },\n error: {\n type: 'object',\n properties: {\n status: {\n type: 'integer',\n },\n name: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n details: {\n type: 'object',\n },\n },\n },\n },\n },\n },\n },\n};\n","import { defaultConfig } from './default-plugin-config';\n\nexport const config = {\n default: defaultConfig,\n};\n","import { bootstrap } from './bootstrap';\nimport { register } from './register';\nimport services from './services';\nimport routes from './routes';\nimport controllers from './controllers';\nimport { config } from './config';\n\nexport default {\n bootstrap,\n config,\n routes,\n controllers,\n register,\n services,\n};\n"],"names":["strapi","config","path","koaStatic","swaggerUi","_","pathToRegexp","getApiResponses","queryParams","createService","fs","produce","builApiEndpointPath","documentation","override","validateYupSchema","yup","bcrypt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIa,MAAA,aAAa,CACxB,MACA,EAAE,QAAAA,QAAA,IAAoC,EAAE,QAAQ,OAAO,aACnC;AACpB,SAAOA,QAAO,OAAO,eAAe,EAAE,QAAyB,IAAI;AACrE;ACJA,MAAM,eAAe;AAAA,EACnB;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AA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,"file":"index.mjs","sources":["../../server/src/utils.ts","../../server/src/bootstrap.ts","../../server/src/middlewares/documentation.ts","../../server/src/register.ts","../../server/src/services/helpers/utils/pascal-case.ts","../../server/src/services/helpers/utils/query-params.ts","../../server/src/services/helpers/utils/loop-content-type-names.ts","../../server/src/services/helpers/utils/get-api-responses.ts","../../server/src/services/helpers/utils/routes.ts","../../server/src/services/helpers/build-api-endpoint-path.ts","../../server/src/services/helpers/utils/get-schema-data.ts","../../server/src/services/helpers/utils/clean-schema-attributes.ts","../../server/src/services/helpers/build-component-schema.ts","../../server/src/services/utils/get-plugins-that-need-documentation.ts","../../server/src/services/documentation.ts","../../server/src/services/override.ts","../../server/src/services/index.ts","../../server/src/middlewares/restrict-access.ts","../../server/src/routes/index.ts","../../server/src/controllers/documentation.ts","../../server/src/controllers/index.ts","../../server/src/config/default-plugin-config.ts","../../server/src/config/index.ts","../../server/src/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport type { Services } from './services';\n\nexport const getService = <TName extends keyof Services>(\n name: TName,\n { strapi }: { strapi: Core.Strapi } = { strapi: global.strapi }\n): Services[TName] => {\n return strapi.plugin('documentation').service<Services[TName]>(name);\n};\n\nexport default {\n getService,\n};\n","import type { Core } from '@strapi/types';\n\nimport { getService } from './utils';\n\n// Add permissions\nconst RBAC_ACTIONS = [\n {\n section: 'plugins',\n displayName: 'Access the Documentation',\n uid: 'read',\n pluginName: 'documentation',\n },\n {\n section: 'plugins',\n displayName: 'Update and delete',\n uid: 'settings.update',\n pluginName: 'documentation',\n },\n {\n section: 'plugins',\n displayName: 'Regenerate',\n uid: 'settings.regenerate',\n pluginName: 'documentation',\n },\n {\n section: 'settings',\n displayName: 'Access the documentation settings page',\n uid: 'settings.read',\n pluginName: 'documentation',\n category: 'documentation',\n },\n];\n\nexport async function bootstrap({ strapi }: { strapi: Core.Strapi }) {\n await strapi.service('admin::permission').actionProvider.registerMany(RBAC_ACTIONS);\n\n const pluginStore = strapi.store!({\n environment: '',\n type: 'plugin',\n name: 'documentation',\n });\n\n const config = await pluginStore.get({ key: 'config' });\n\n if (!config) {\n pluginStore.set({ key: 'config', value: { restrictedAccess: false } });\n }\n\n await getService('documentation').generateFullDoc();\n}\n","import path from 'path';\nimport koaStatic from 'koa-static';\nimport swaggerUi from 'swagger-ui-dist';\n\nimport type { Core } from '@strapi/types';\n\nexport const addDocumentMiddlewares = async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.server.routes([\n {\n method: 'GET',\n path: '/plugins/documentation/(.*)',\n async handler(ctx, next) {\n ctx.url = path.basename(ctx.url);\n\n return koaStatic(swaggerUi.getAbsoluteFSPath(), {\n maxage: 86400000,\n defer: true,\n })(ctx, next);\n },\n config: {\n auth: false,\n },\n },\n ]);\n};\n","import type { Core } from '@strapi/types';\n\nimport { addDocumentMiddlewares } from './middlewares/documentation';\n\nexport async function register({ strapi }: { strapi: Core.Strapi }) {\n await addDocumentMiddlewares({ strapi });\n}\n","import _ from 'lodash';\n\nconst pascalCase = (string: string) => {\n return _.upperFirst(_.camelCase(string));\n};\n\nexport default pascalCase;\n","import type { OpenAPIV3 } from 'openapi-types';\n\nconst params: OpenAPIV3.ParameterObject[] = [\n {\n name: 'sort',\n in: 'query',\n description: 'Sort by attributes ascending (asc) or descending (desc)',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n {\n name: 'pagination[withCount]',\n in: 'query',\n description: 'Return page/pageSize (default: true)',\n deprecated: false,\n required: false,\n schema: {\n type: 'boolean',\n },\n },\n {\n name: 'pagination[page]',\n in: 'query',\n description: 'Page number (default: 0)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'pagination[pageSize]',\n in: 'query',\n description: 'Page size (default: 25)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'pagination[start]',\n in: 'query',\n description: 'Offset value (default: 0)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'pagination[limit]',\n in: 'query',\n description: 'Number of entities to return (default: 25)',\n deprecated: false,\n required: false,\n schema: {\n type: 'integer',\n },\n },\n {\n name: 'fields',\n in: 'query',\n description: 'Fields to return (ex: title,author)',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n {\n name: 'populate',\n in: 'query',\n description: 'Relations to return',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n {\n name: 'filters',\n in: 'query',\n description: 'Filters to apply',\n deprecated: false,\n required: false,\n schema: {\n type: 'object',\n additionalProperties: true,\n },\n style: 'deepObject',\n },\n {\n name: 'locale',\n in: 'query',\n description: 'Locale to apply',\n deprecated: false,\n required: false,\n schema: {\n type: 'string',\n },\n },\n];\n\nexport default params;\n","import _ from 'lodash';\n\nimport type { Api, ApiInfo } from '../../../types';\n\n/**\n * @description A reusable loop for building api endpoint paths and component schemas\n */\nconst loopContentTypeNames = (api: Api, callback: (info: ApiInfo) => any) => {\n let result = {};\n for (const contentTypeName of api.ctNames) {\n // Get the attributes found on the api's contentType\n const uid = `${api.getter}::${api.name}.${contentTypeName}`;\n\n const { attributes, info: contentTypeInfo, kind } = strapi.contentType(uid as any);\n\n // Get the routes for the current api\n const routeInfo =\n api.getter === 'plugin'\n ? // @ts-expect-error – TODO: fix this\n strapi.plugin(api.name).routes['content-api']\n : strapi.api(api.name).routes[contentTypeName];\n\n // Continue to next iteration if routeInfo is undefined\n if (!routeInfo) {\n continue;\n }\n\n // Uppercase the first letter of the api name\n const apiName = _.upperFirst(api.name);\n\n // Create a unique name if the api name and contentType name don't match\n const uniqueName =\n api.name === contentTypeName ? apiName : `${apiName} - ${_.upperFirst(contentTypeName)}`;\n\n const apiInfo = {\n ...api,\n routeInfo,\n attributes,\n uniqueName,\n contentTypeInfo,\n kind,\n };\n\n result = {\n ...result,\n ...callback(apiInfo),\n };\n }\n\n return result;\n};\n\nexport default loopContentTypeNames;\n","import type { OpenAPIV3 } from 'openapi-types';\nimport pascalCase from './pascal-case';\n\ninterface Options {\n uniqueName: string;\n route: {\n method: string;\n };\n isListOfEntities?: boolean;\n isLocalizationPath?: boolean;\n}\n\n/**\n * @description - Builds the Swagger response object for a given api\n */\nconst getApiResponse = ({\n uniqueName,\n route,\n isListOfEntities = false,\n}: Options): OpenAPIV3.ResponsesObject => {\n const getSchema = (): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject => {\n if (route.method === 'DELETE') {\n return {\n type: 'integer',\n format: 'int64',\n };\n }\n\n if (isListOfEntities) {\n return { $ref: `#/components/schemas/${pascalCase(uniqueName)}ListResponse` };\n }\n\n return { $ref: `#/components/schemas/${pascalCase(uniqueName)}Response` };\n };\n\n const schema = getSchema();\n\n return {\n 200: {\n description: 'OK',\n content: {\n 'application/json': {\n schema,\n },\n },\n },\n 400: {\n description: 'Bad Request',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 401: {\n description: 'Unauthorized',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 403: {\n description: 'Forbidden',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 404: {\n description: 'Not Found',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n 500: {\n description: 'Internal Server Error',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n };\n};\n\nexport default getApiResponse;\n","const hasFindMethod = (handler: unknown) => {\n if (typeof handler === 'string') {\n return handler.split('.').pop() === 'find';\n }\n\n return false;\n};\n\nexport { hasFindMethod };\n","import _ from 'lodash';\nimport * as pathToRegexp from 'path-to-regexp';\n\nimport type { Core } from '@strapi/types';\nimport type { OpenAPIV3 } from 'openapi-types';\n\nimport pascalCase from './utils/pascal-case';\nimport queryParams from './utils/query-params';\nimport loopContentTypeNames from './utils/loop-content-type-names';\nimport getApiResponses from './utils/get-api-responses';\nimport { hasFindMethod } from './utils/routes';\n\nimport type { Api, ApiInfo } from '../../types';\n\n/**\n * @description Parses a route with ':variable'\n *\n * @param {string} routePath - The route's path property\n * @returns {string}\n */\nconst parsePathWithVariables = (routePath: string) => {\n return pathToRegexp\n .parse(routePath)\n .map((token) => {\n if (_.isObject(token)) {\n return `${token.prefix}{${token.name}}`;\n }\n\n return token;\n })\n .join('');\n};\n\n/**\n * @description Builds the required object for a path parameter\n *\n * @param {string} routePath - The route's path property\n *\n * @returns {object } Swagger path params object\n */\nconst getPathParams = (routePath: string): OpenAPIV3.ParameterObject[] => {\n return pathToRegexp.parse(routePath).reduce((acc, param) => {\n if (!(typeof param === 'object')) {\n return acc;\n }\n\n acc.push({\n name: `${param.name}`,\n in: 'path',\n description: '',\n deprecated: false,\n required: true,\n schema: { type: 'number' },\n });\n\n return acc;\n }, [] as OpenAPIV3.ParameterObject[]);\n};\n\nconst getPathWithPrefix = (prefix: string | undefined, route: Core.Route) => {\n // When the prefix is set on the routes and\n // the current route is not trying to remove it\n if (prefix && !_.has(route.config, 'prefix')) {\n // Add the prefix to the path\n return prefix.concat(route.path);\n }\n\n // Otherwise just return path\n return route.path;\n};\n/**\n * @description Gets all paths based on routes\n *\n * @param {object} apiInfo\n * @property {object} apiInfo.routeInfo - The api routes object\n * @property {string} apiInfo.uniqueName - Content type name | Api name + Content type name\n * @property {object} apiInfo.contentTypeInfo - The info object found on content type schemas\n *\n * @returns {object}\n */\nconst getPaths = ({ routeInfo, uniqueName, contentTypeInfo, kind }: ApiInfo) => {\n // Get the routes for the current content type\n const contentTypeRoutes = routeInfo.routes.filter((route) => {\n return (\n route.path.includes(contentTypeInfo.pluralName) ||\n route.path.includes(contentTypeInfo.singularName)\n );\n });\n\n const paths = contentTypeRoutes.reduce((acc: any, route: Core.Route) => {\n // TODO: Find a more reliable way to determine list of entities vs a single entity\n const isListOfEntities = hasFindMethod(route.handler);\n const methodVerb = route.method.toLowerCase();\n const hasPathParams = route.path.includes('/:');\n const pathWithPrefix = getPathWithPrefix(routeInfo.prefix, route);\n const routePath = hasPathParams ? parsePathWithVariables(pathWithPrefix) : pathWithPrefix;\n\n const responses = getApiResponses({\n uniqueName,\n route,\n isListOfEntities: kind !== 'singleType' && isListOfEntities,\n });\n\n const swaggerConfig: OpenAPIV3.OperationObject = {\n responses,\n tags: [_.upperFirst(uniqueName)],\n parameters: [],\n operationId: `${methodVerb}${routePath}`,\n };\n\n if (isListOfEntities) {\n swaggerConfig.parameters?.push(...queryParams);\n }\n\n if (hasPathParams) {\n const pathParams = getPathParams(route.path);\n swaggerConfig.parameters?.push(...pathParams);\n }\n\n if (['post', 'put'].includes(methodVerb)) {\n const refName = 'Request';\n const requestBody = {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: `#/components/schemas/${pascalCase(uniqueName)}${refName}`,\n },\n },\n },\n };\n\n swaggerConfig.requestBody = requestBody;\n }\n\n _.set(acc, `${routePath}.${methodVerb}`, swaggerConfig);\n\n return acc;\n }, {});\n\n return paths;\n};\n\n/**\n * @description - Builds the Swagger paths object for each api\n */\nconst buildApiEndpointPath = (api: Api) => {\n // A reusable loop for building paths and component schemas\n // Uses the api param to build a new set of params for each content type\n // Passes these new params to the function provided\n return loopContentTypeNames(api, getPaths);\n};\n\nexport default buildApiEndpointPath;\n","import type { OpenAPIV3 } from 'openapi-types';\n\n/**\n * @description Determines the format of the data response\n *\n * @param {boolean} isListOfEntities - Checks for a multiple entities\n * @param {object} attributes - The attributes found on a contentType\n\n * @returns object | array of attributes\n */\nexport default (\n isListOfEntities: boolean,\n attributes: Record<string, OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject>\n): OpenAPIV3.SchemaObject => {\n if (isListOfEntities) {\n return {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: { type: 'number' },\n documentId: { type: 'string' },\n ...attributes,\n },\n },\n };\n }\n\n return {\n type: 'object',\n properties: {\n id: { type: 'number' },\n documentId: { type: 'string' },\n ...attributes,\n },\n };\n};\n","import type { Struct } from '@strapi/types';\nimport type { OpenAPIV3 } from 'openapi-types';\n\nimport getSchemaData from './get-schema-data';\nimport pascalCase from './pascal-case';\n\ninterface Options {\n typeMap?: Map<string, boolean>;\n isRequest?: boolean;\n didAddStrapiComponentsToSchemas: (name: string, schema: object) => boolean;\n}\n\n/**\n * @description - Convert attribute component names to OpenAPI component names\n *\n * @returns OpenAPI component name\n */\nconst convertComponentName = (component: string, isRef = false): string => {\n const cleanComponentName = `${pascalCase(component)}Component`;\n\n if (isRef) {\n return `#/components/schemas/${cleanComponentName}`;\n }\n return cleanComponentName;\n};\n\n/**\n * @description - Converts types found on attributes to OpenAPI acceptable data types\n *\n * @returns Attributes using OpenAPI acceptable data types\n */\nconst cleanSchemaAttributes = (\n attributes: Struct.SchemaAttributes,\n { typeMap = new Map(), isRequest = false, didAddStrapiComponentsToSchemas }: Options\n) => {\n const schemaAttributes: Record<string, OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject> = {};\n\n for (const prop of Object.keys(attributes)) {\n const attribute = attributes[prop];\n\n switch (attribute.type) {\n case 'password': {\n if (!isRequest) {\n break;\n }\n\n schemaAttributes[prop] = { type: 'string', format: 'password', example: '*******' };\n break;\n }\n case 'email': {\n schemaAttributes[prop] = { type: 'string', format: 'email' };\n break;\n }\n case 'string':\n case 'text':\n case 'richtext': {\n schemaAttributes[prop] = { type: 'string' };\n break;\n }\n case 'timestamp': {\n schemaAttributes[prop] = { type: 'string', format: 'timestamp', example: Date.now() };\n break;\n }\n case 'time': {\n schemaAttributes[prop] = { type: 'string', format: 'time', example: '12:54.000' };\n break;\n }\n case 'date': {\n schemaAttributes[prop] = { type: 'string', format: 'date' };\n break;\n }\n case 'datetime': {\n schemaAttributes[prop] = { type: 'string', format: 'date-time' };\n break;\n }\n case 'boolean': {\n schemaAttributes[prop] = { type: 'boolean' };\n break;\n }\n case 'enumeration': {\n schemaAttributes[prop] = { type: 'string', enum: [...attribute.enum] };\n break;\n }\n case 'decimal':\n case 'float': {\n schemaAttributes[prop] = { type: 'number', format: 'float' };\n break;\n }\n case 'integer': {\n schemaAttributes[prop] = { type: 'integer' };\n break;\n }\n case 'biginteger': {\n schemaAttributes[prop] = { type: 'string', pattern: '^\\\\d*$', example: '123456789' };\n break;\n }\n case 'json':\n case 'blocks': {\n schemaAttributes[prop] = {};\n break;\n }\n case 'uid': {\n schemaAttributes[prop] = { type: 'string' };\n break;\n }\n case 'component': {\n const componentAttributes = strapi.components[attribute.component].attributes;\n const rawComponentSchema: OpenAPIV3.SchemaObject = {\n type: 'object',\n properties: {\n ...(isRequest ? {} : { id: { type: 'number' } }),\n ...cleanSchemaAttributes(componentAttributes, {\n typeMap,\n isRequest,\n didAddStrapiComponentsToSchemas,\n }),\n },\n };\n\n const refComponentSchema: OpenAPIV3.ReferenceObject = {\n $ref: convertComponentName(attribute.component, true),\n };\n\n const componentExists = didAddStrapiComponentsToSchemas(\n convertComponentName(attribute.component),\n rawComponentSchema\n );\n\n const finalComponentSchema = componentExists ? refComponentSchema : rawComponentSchema;\n if (attribute.repeatable) {\n schemaAttributes[prop] = {\n type: 'array',\n items: finalComponentSchema,\n };\n } else {\n schemaAttributes[prop] = finalComponentSchema;\n }\n break;\n }\n case 'dynamiczone': {\n const components = attribute.components.map((component) => {\n const componentAttributes = strapi.components[component].attributes;\n const rawComponentSchema: OpenAPIV3.SchemaObject = {\n type: 'object',\n properties: {\n ...(isRequest ? {} : { id: { type: 'number' } }),\n __component: { type: 'string', enum: [component] },\n ...cleanSchemaAttributes(componentAttributes, {\n typeMap,\n isRequest,\n didAddStrapiComponentsToSchemas,\n }),\n },\n };\n\n const refComponentSchema: OpenAPIV3.ReferenceObject = {\n $ref: convertComponentName(component, true),\n };\n\n const componentExists = didAddStrapiComponentsToSchemas(\n convertComponentName(component),\n rawComponentSchema\n );\n const finalComponentSchema = componentExists ? refComponentSchema : rawComponentSchema;\n return finalComponentSchema;\n });\n let discriminator: OpenAPIV3.DiscriminatorObject | undefined;\n if (components.every((component) => Object.hasOwn(component, '$ref'))) {\n discriminator = {\n propertyName: '__component',\n mapping: attribute.components.reduce(\n (acc, component) => {\n acc[component] = convertComponentName(component, true);\n return acc;\n },\n {} as {\n [value: string]: string;\n }\n ),\n };\n }\n\n schemaAttributes[prop] = {\n type: 'array',\n items: {\n anyOf: components,\n },\n discriminator,\n };\n break;\n }\n case 'media': {\n const imageAttributes = strapi.contentType('plugin::upload.file').attributes;\n const isListOfEntities = attribute.multiple ?? false;\n\n if (isRequest) {\n const oneOfType: OpenAPIV3.SchemaObject = {\n oneOf: [{ type: 'integer' }, { type: 'string' }],\n example: 'string or id',\n };\n\n schemaAttributes[prop] = isListOfEntities\n ? { type: 'array', items: oneOfType }\n : oneOfType;\n break;\n }\n\n schemaAttributes[prop] = getSchemaData(\n isListOfEntities,\n cleanSchemaAttributes(imageAttributes, { typeMap, didAddStrapiComponentsToSchemas })\n );\n break;\n }\n\n case 'relation': {\n const isListOfEntities = attribute.relation.includes('ToMany');\n\n if (isRequest) {\n const oneOfType: OpenAPIV3.SchemaObject = {\n oneOf: [{ type: 'integer' }, { type: 'string' }],\n example: 'string or id',\n };\n\n schemaAttributes[prop] = isListOfEntities\n ? { type: 'array', items: oneOfType }\n : oneOfType;\n break;\n }\n\n if (!('target' in attribute) || !attribute.target || typeMap.has(attribute.target)) {\n schemaAttributes[prop] = getSchemaData(isListOfEntities, {});\n\n break;\n }\n\n typeMap.set(attribute.target, true);\n const targetAttributes = strapi.contentType(attribute.target).attributes;\n\n schemaAttributes[prop] = getSchemaData(\n isListOfEntities,\n cleanSchemaAttributes(targetAttributes, {\n typeMap,\n isRequest,\n didAddStrapiComponentsToSchemas,\n })\n );\n\n break;\n }\n default: {\n // @ts-expect-error - This is a catch all for any other types\n throw new Error(`Invalid type ${attribute.type} while generating open api schema.`);\n }\n }\n }\n\n return schemaAttributes;\n};\n\nexport default cleanSchemaAttributes;\n","import _ from 'lodash';\n\nimport type { OpenAPIV3 } from 'openapi-types';\nimport type { Core, Struct } from '@strapi/types';\n\nimport cleanSchemaAttributes from './utils/clean-schema-attributes';\nimport loopContentTypeNames from './utils/loop-content-type-names';\nimport pascalCase from './utils/pascal-case';\nimport { hasFindMethod } from './utils/routes';\n\nimport type { Api, ApiInfo } from '../../types';\n\nconst getRequiredAttributes = (allAttributes: Struct.SchemaAttributes) => {\n const requiredAttributes: string[] = [];\n\n for (const key in allAttributes) {\n if (allAttributes[key].required) {\n requiredAttributes.push(key);\n }\n }\n\n return requiredAttributes;\n};\n\n/**\n * @decription Get all open api schema objects for a given content type\n *\n * @param {object} apiInfo\n * @property {string} apiInfo.uniqueName - Api name | Api name + Content type name\n * @property {object} apiInfo.attributes - Attributes on content type\n * @property {object} apiInfo.routeInfo - The routes for the api\n *\n * @returns {object} Open API schemas\n */\nconst getAllSchemasForContentType = ({ routeInfo, attributes, uniqueName }: ApiInfo) => {\n // Store response and request schemas in an object\n let strapiComponentSchemas = {};\n const schemas: OpenAPIV3.ComponentsObject = {};\n const typeName = pascalCase(uniqueName);\n\n // adds a ComponentSchema to the Schemas so it can be used as Ref\n const didAddStrapiComponentsToSchemas = (schemaName: string, schema: OpenAPIV3.SchemaObject) => {\n if (!Object.keys(schema) || !Object.keys(schema.properties!)) return false;\n\n // Add the Strapi components to the schema\n strapiComponentSchemas = {\n ...strapiComponentSchemas,\n [schemaName]: schema,\n };\n\n return true;\n };\n\n // Get all the route methods\n const routeMethods = routeInfo.routes.map((route: Core.Route) => route.method);\n\n const attributesToOmit = [\n 'createdAt',\n 'updatedAt',\n 'publishedAt',\n 'publishedBy',\n 'updatedBy',\n 'createdBy',\n ];\n\n const attributesForRequest = _.omit(attributes, attributesToOmit);\n // Get a list of required attribute names\n const requiredRequestAttributes = getRequiredAttributes(attributesForRequest);\n // Build the request schemas when the route has POST or PUT methods\n if (routeMethods.includes('POST') || routeMethods.includes('PUT')) {\n // Build localization requests schemas\n\n // Build the request schema\n Object.assign(schemas, {\n [`${typeName}Request`]: {\n type: 'object',\n required: ['data'],\n properties: {\n data: {\n ...(requiredRequestAttributes.length && { required: requiredRequestAttributes }),\n type: 'object',\n properties: cleanSchemaAttributes(attributesForRequest, {\n isRequest: true,\n didAddStrapiComponentsToSchemas,\n }),\n },\n },\n },\n });\n }\n\n // Check for routes that need to return a list\n const hasListOfEntities = routeInfo.routes.filter((route: Core.Route) =>\n hasFindMethod(route.handler)\n ).length;\n\n if (hasListOfEntities) {\n // Build the list response schema\n Object.assign(schemas, {\n [`${typeName}ListResponse`]: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: {\n $ref: `#/components/schemas/${typeName}`,\n },\n },\n meta: {\n type: 'object',\n properties: {\n pagination: {\n type: 'object',\n properties: {\n page: { type: 'integer' },\n pageSize: { type: 'integer', minimum: 25 },\n pageCount: { type: 'integer', maximum: 1 },\n total: { type: 'integer' },\n },\n },\n },\n },\n },\n },\n });\n }\n\n const requiredAttributes = getRequiredAttributes(attributes);\n // Build the response schema\n Object.assign(schemas, {\n [`${typeName}`]: {\n type: 'object',\n ...(requiredAttributes.length && { required: requiredAttributes }),\n properties: {\n id: { type: 'number' },\n documentId: { type: 'string' },\n ...cleanSchemaAttributes(attributes, { didAddStrapiComponentsToSchemas }),\n },\n },\n\n [`${typeName}Response`]: {\n type: 'object',\n properties: {\n data: {\n $ref: `#/components/schemas/${typeName}`,\n },\n meta: { type: 'object' },\n },\n },\n });\n\n return { ...schemas, ...strapiComponentSchemas };\n};\n\nconst buildComponentSchema = (api: Api) => {\n // A reusable loop for building paths and component schemas\n // Uses the api param to build a new set of params for each content type\n // Passes these new params to the function provided\n return loopContentTypeNames(api, getAllSchemasForContentType);\n};\n\nexport default buildComponentSchema;\n","import type { PluginConfig } from '../../types';\n\nconst getPluginsThatNeedDocumentation = (config: PluginConfig) => {\n // Default plugins that need documentation generated\n const defaultPlugins = ['upload', 'users-permissions'];\n\n // User specified plugins that need documentation generated\n const userPluginsConfig = config['x-strapi-config'].plugins;\n\n if (userPluginsConfig === null) {\n // The user hasn't specified any plugins to document, use the defaults\n return defaultPlugins;\n }\n\n if (userPluginsConfig.length) {\n // The user has specified certain plugins to document, use them\n return userPluginsConfig;\n }\n\n // The user has specified that no plugins should be documented\n return [];\n};\n\nexport { getPluginsThatNeedDocumentation };\n","import path from 'path';\nimport fs from 'fs-extra';\nimport { produce } from 'immer';\nimport type { Core } from '@strapi/types';\n\nimport { builApiEndpointPath, buildComponentSchema } from './helpers';\nimport { getPluginsThatNeedDocumentation } from './utils/get-plugins-that-need-documentation';\nimport { getService } from '../utils';\n\nimport type { Config, PluginConfig } from '../types';\n\nexport type Version = {\n version: string;\n generatedDate: string;\n url: string;\n};\n\nexport type DocumentationService = ReturnType<typeof createService>;\n\nconst createService = ({ strapi }: { strapi: Core.Strapi }) => {\n const config = strapi.config.get('plugin::documentation') as PluginConfig;\n const pluginsThatNeedDocumentation = getPluginsThatNeedDocumentation(config);\n const overrideService = getService('override');\n\n return {\n getDocumentationVersion() {\n return config.info.version;\n },\n\n getFullDocumentationPath() {\n return path.join(strapi.dirs.app.extensions, 'documentation', 'documentation');\n },\n\n getDocumentationVersions(): Version[] {\n return fs\n .readdirSync(this.getFullDocumentationPath())\n .map((version) => {\n try {\n const filePath = path.resolve(\n this.getFullDocumentationPath(),\n version,\n 'full_documentation.json'\n );\n\n const doc = JSON.parse(fs.readFileSync(filePath).toString());\n\n const generatedDate = doc.info['x-generation-date'];\n\n return { version, generatedDate, url: '' };\n } catch (err) {\n return null;\n }\n })\n .filter((x) => x) as Version[];\n },\n\n /**\n * Returns settings stored in core-store\n */\n async getDocumentationAccess() {\n const { restrictedAccess } = (await strapi.store!({\n environment: '',\n type: 'plugin',\n name: 'documentation',\n key: 'config',\n }).get()) as Config;\n\n return { restrictedAccess };\n },\n\n getApiDocumentationPath(api: { name: string; getter: string }) {\n if (api.getter === 'plugin') {\n return path.join(strapi.dirs.app.extensions, api.name, 'documentation');\n }\n\n return path.join(strapi.dirs.app.api, api.name, 'documentation');\n },\n\n async deleteDocumentation(version: string) {\n const apis = this.getPluginAndApiInfo();\n for (const api of apis) {\n await fs.remove(path.join(this.getApiDocumentationPath(api), version));\n }\n\n await fs.remove(path.join(this.getFullDocumentationPath(), version));\n },\n\n getPluginAndApiInfo() {\n const pluginsToDocument = pluginsThatNeedDocumentation.map((plugin) => {\n return {\n name: plugin,\n getter: 'plugin',\n ctNames: Object.keys(strapi.plugin(plugin).contentTypes),\n };\n });\n\n const apisToDocument = Object.keys(strapi.apis).map((api) => {\n return {\n name: api,\n getter: 'api',\n ctNames: Object.keys(strapi.api(api).contentTypes),\n };\n });\n\n return [...apisToDocument, ...pluginsToDocument];\n },\n\n /**\n * @description - Creates the Swagger json files\n */\n async generateFullDoc(versionOpt?: string) {\n const version = versionOpt ?? this.getDocumentationVersion();\n\n const apis = this.getPluginAndApiInfo();\n const apisThatNeedGeneratedDocumentation = apis.filter(\n ({ name }) => !overrideService.isEnabled(name)\n );\n\n // Initialize the generated documentation with defaults\n const generatedDocumentation = await produce(config, async (draft) => {\n if (draft.servers?.length === 0) {\n // When no servers found set the defaults\n const serverUrl = strapi.config.get('server.absoluteUrl');\n const apiPath = strapi.config.get('api.rest.prefix');\n draft.servers = [\n {\n url: `${serverUrl}${apiPath}`,\n description: 'Development server',\n },\n ];\n }\n\n if (!draft.components) {\n draft.components = {};\n }\n\n // Set the generated date\n draft.info['x-generation-date'] = new Date().toISOString();\n // Set the plugins that need documentation\n draft['x-strapi-config'].plugins = pluginsThatNeedDocumentation;\n\n // Delete the mutateDocumentation key from the config so it doesn't end up in the spec\n delete draft['x-strapi-config'].mutateDocumentation;\n\n // Generate the documentation for each api and update the generatedDocumentation\n for (const api of apisThatNeedGeneratedDocumentation) {\n const newApiPath = builApiEndpointPath(api);\n const generatedSchemas = buildComponentSchema(api);\n\n if (generatedSchemas) {\n draft.components.schemas = { ...draft.components.schemas, ...generatedSchemas };\n }\n\n if (newApiPath) {\n draft.paths = { ...draft.paths, ...newApiPath };\n }\n }\n\n // When overrides are present update the generatedDocumentation\n if (overrideService.registeredOverrides.length > 0) {\n overrideService.registeredOverrides.forEach((override: Partial<PluginConfig>) => {\n // Only run the overrrides when no override version is provided,\n // or when the generated documentation version matches the override version\n if (!override?.info?.version || override.info.version === version) {\n if (override.tags) {\n // Merge override tags with the generated tags\n draft.tags = draft.tags || [];\n draft.tags.push(...override.tags);\n }\n\n if (override.paths) {\n // Merge override paths with the generated paths\n // The override will add a new path or replace the value of an existing path\n draft.paths = { ...draft.paths, ...override.paths };\n }\n\n if (override.components) {\n const keys = Object.keys(override.components) as Array<\n keyof typeof override.components\n >;\n\n keys.forEach((overrideKey) => {\n draft.components = draft.components || {};\n\n const overrideValue = override.components?.[overrideKey];\n const originalValue = draft.components?.[overrideKey];\n\n Object.assign(draft.components, {\n [overrideKey]: {\n ...originalValue,\n ...overrideValue,\n },\n });\n });\n }\n }\n });\n }\n });\n\n // Escape hatch, allow the user to provide a mutateDocumentation function that can alter any part of\n // the generated documentation before it is written to the file system\n const userMutatesDocumentation = config['x-strapi-config'].mutateDocumentation;\n\n const finalDocumentation = userMutatesDocumentation\n ? produce(generatedDocumentation, userMutatesDocumentation)\n : generatedDocumentation;\n\n // Get the file path for the final documentation\n const fullDocJsonPath = path.join(\n this.getFullDocumentationPath(),\n version,\n 'full_documentation.json'\n );\n // Write the documentation to the file system\n await fs.ensureFile(fullDocJsonPath);\n await fs.writeJson(fullDocJsonPath, finalDocumentation, { spaces: 2 });\n },\n };\n};\n\nexport default createService;\n","import type { Core } from '@strapi/types';\n\nimport { getPluginsThatNeedDocumentation } from './utils/get-plugins-that-need-documentation';\nimport type { PluginConfig } from '../types';\n\nexport type OverrideService = ReturnType<typeof createService>;\n\nconst createService = ({ strapi }: { strapi: Core.Strapi }) => {\n const registeredOverrides: Partial<PluginConfig>[] = [];\n const excludedFromGeneration: string[] = [];\n\n return {\n registeredOverrides,\n excludedFromGeneration,\n /**\n *\n * @param {(string | string[])} api - The name of the api or and array of apis to exclude from generation\n */\n excludeFromGeneration(api: string | string[]) {\n if (Array.isArray(api)) {\n excludedFromGeneration.push(...api);\n\n return;\n }\n\n excludedFromGeneration.push(api);\n },\n\n isEnabled(name: string) {\n return excludedFromGeneration.includes(name);\n },\n\n registerOverride(\n override: Partial<PluginConfig>,\n opts?: { pluginOrigin: string; excludeFromGeneration?: string[] }\n ) {\n const { pluginOrigin, excludeFromGeneration = [] } = opts ?? {};\n\n const pluginsThatNeedDocumentation = getPluginsThatNeedDocumentation(\n strapi.config.get('plugin::documentation')\n );\n // Don't apply the override if the plugin is not in the list of plugins that need documentation\n if (pluginOrigin && !pluginsThatNeedDocumentation.includes(pluginOrigin)) return;\n\n if (excludeFromGeneration.length) {\n this.excludeFromGeneration(excludeFromGeneration);\n }\n\n let overrideToRegister = override;\n // Parse yaml if we receive a string\n if (typeof override === 'string') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n overrideToRegister = require('yaml').parse(overrideToRegister);\n }\n // receive an object we can register it directly\n registeredOverrides.push(overrideToRegister);\n },\n };\n};\n\nexport default createService;\n","// import type { Common } from '@strapi/types';\n\nimport documentation, { type DocumentationService } from './documentation';\nimport override, { type OverrideService } from './override';\n\nexport default {\n documentation,\n override,\n};\n\nexport type Services = {\n documentation: DocumentationService;\n override: OverrideService;\n};\n","import type Koa from 'koa';\nimport type {} from 'koa-session';\n\nimport type { Config } from '../types';\n\nexport default async (ctx: Koa.Context, next: Koa.Next) => {\n const pluginStore = strapi.store({ type: 'plugin', name: 'documentation' });\n\n const config = (await pluginStore.get({ key: 'config' })) as Config;\n\n if (!config.restrictedAccess) {\n return next();\n }\n\n if (!ctx.session || !ctx.session.documentation || !ctx.session.documentation.logged) {\n const querystring = ctx.querystring ? `?${ctx.querystring}` : '';\n\n return ctx.redirect(`${strapi.config.server.url}/documentation/login${querystring}`);\n }\n\n // Execute the action.\n return next();\n};\n","import restrictAccess from '../middlewares/restrict-access';\n\nexport default [\n {\n method: 'GET',\n path: '/',\n handler: 'documentation.index',\n config: {\n auth: false,\n middlewares: [restrictAccess],\n },\n },\n {\n method: 'GET',\n path: '/v:major(\\\\d+).:minor(\\\\d+).:patch(\\\\d+)',\n handler: 'documentation.index',\n config: {\n auth: false,\n middlewares: [restrictAccess],\n },\n },\n {\n method: 'GET',\n path: '/login',\n handler: 'documentation.loginView',\n config: {\n auth: false,\n },\n },\n {\n method: 'POST',\n path: '/login',\n handler: 'documentation.login',\n config: {\n auth: false,\n },\n },\n {\n method: 'GET',\n path: '/getInfos',\n handler: 'documentation.getInfos',\n config: {\n policies: [\n { name: 'admin::hasPermissions', config: { actions: ['plugin::documentation.read'] } },\n ],\n },\n },\n {\n method: 'POST',\n path: '/regenerateDoc',\n handler: 'documentation.regenerateDoc',\n config: {\n policies: [\n {\n name: 'admin::hasPermissions',\n config: { actions: ['plugin::documentation.settings.regenerate'] },\n },\n ],\n },\n },\n {\n method: 'PUT',\n path: '/updateSettings',\n handler: 'documentation.updateSettings',\n config: {\n policies: [\n {\n name: 'admin::hasPermissions',\n config: { actions: ['plugin::documentation.settings.update'] },\n },\n ],\n },\n },\n {\n method: 'DELETE',\n path: '/deleteDoc/:version',\n handler: 'documentation.deleteDoc',\n config: {\n policies: [],\n },\n },\n];\n","import path from 'path';\nimport bcrypt from 'bcryptjs';\nimport fs from 'fs-extra';\nimport _ from 'lodash';\nimport koaStatic from 'koa-static';\nimport { yup, validateYupSchema } from '@strapi/utils';\n\nimport type Koa from 'koa';\nimport type {} from 'koa-body';\n\nimport { getService } from '../utils';\nimport type { Config } from '../types';\n\nconst validation = {\n validateSettings: validateYupSchema(\n yup.object().shape({\n restrictedAccess: yup.boolean(),\n password: yup\n .string()\n .min(8)\n .matches(/[a-z]/, '${path} must contain at least one lowercase character')\n .matches(/[A-Z]/, '${path} must contain at least one uppercase character')\n .matches(/\\d/, '${path} must contain at least one number')\n .when('restrictedAccess', (value, initSchema) => {\n return value ? initSchema.required('password is required') : initSchema;\n }),\n })\n ),\n};\n\nexport default {\n async getInfos(ctx: Koa.Context) {\n try {\n const docService = getService('documentation');\n const docVersions = docService.getDocumentationVersions();\n const documentationAccess = await docService.getDocumentationAccess();\n\n ctx.send({\n docVersions,\n currentVersion: docService.getDocumentationVersion(),\n prefix: '/documentation',\n documentationAccess,\n });\n } catch (err) {\n strapi.log.error(err);\n ctx.badRequest();\n }\n },\n\n async index(ctx: Koa.Context, next: Koa.Next) {\n try {\n /**\n * We don't expose the specs using koa-static or something else due to security reasons.\n * That's why, we need to read the file localy and send the specs through it when we serve the Swagger UI.\n */\n const { major, minor, patch } = ctx.params;\n const version =\n major && minor && patch\n ? `${major}.${minor}.${patch}`\n : getService('documentation').getDocumentationVersion();\n\n const openAPISpecsPath = path.join(\n strapi.dirs.app.extensions,\n 'documentation',\n 'documentation',\n version,\n 'full_documentation.json'\n );\n\n try {\n const documentation = fs.readFileSync(openAPISpecsPath, 'utf8');\n\n const layout = (await import('../public/index.html?raw')).default;\n\n const filledLayout = _.template(layout)({\n backendUrl: strapi.config.server.url,\n spec: JSON.stringify(JSON.parse(documentation)),\n });\n\n try {\n const layoutPath = path.resolve(\n strapi.dirs.app.extensions,\n 'documentation',\n 'public',\n 'index.html'\n );\n await fs.ensureFile(layoutPath);\n await fs.writeFile(layoutPath, filledLayout);\n\n // Serve the file.\n ctx.url = path.basename(`${ctx.url}/index.html`);\n\n try {\n const staticFolder = path.resolve(\n strapi.dirs.app.extensions,\n 'documentation',\n 'public'\n );\n return koaStatic(staticFolder)(ctx, next);\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n },\n\n async loginView(ctx: Koa.Context, next: Koa.Next) {\n // lazy require cheerio\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const cheerio = require('cheerio');\n\n const { error } = ctx.query;\n\n try {\n const layout = (await import('../public/login.html?raw')).default;\n\n const filledLayout = _.template(layout.toString())({\n actionUrl: `${strapi.config.server.url}/documentation/login`,\n });\n\n const $ = cheerio.load(filledLayout);\n\n $('.error').text(_.isEmpty(error) ? '' : 'Wrong password...');\n\n try {\n const layoutPath = path.resolve(\n strapi.dirs.app.extensions,\n 'documentation',\n 'public',\n 'login.html'\n );\n await fs.ensureFile(layoutPath);\n await fs.writeFile(layoutPath, $.html());\n\n ctx.url = path.basename(`${ctx.url}/login.html`);\n\n try {\n const staticFolder = path.resolve(strapi.dirs.app.extensions, 'documentation', 'public');\n return koaStatic(staticFolder)(ctx, next);\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n } catch (e) {\n strapi.log.error(e);\n }\n },\n\n async login(ctx: Koa.Context) {\n const {\n body: { password },\n } = ctx.request;\n\n const { password: hash } = (await strapi\n .store({ type: 'plugin', name: 'documentation', key: 'config' })\n .get()) as { password: string };\n\n const isValid = await bcrypt.compare(password, hash);\n\n let querystring = '?error=password';\n\n if (isValid && ctx.session) {\n ctx.session.documentation = {\n logged: true,\n };\n\n querystring = '';\n }\n\n ctx.redirect(`${strapi.config.server.url}/documentation${querystring}`);\n },\n\n async regenerateDoc(ctx: Koa.Context) {\n const { version } = ctx.request.body;\n\n const service = getService('documentation');\n\n const documentationVersions = service.getDocumentationVersions().map((el) => el.version);\n\n if (_.isEmpty(version)) {\n return ctx.badRequest('Please provide a version.');\n }\n\n if (!documentationVersions.includes(version)) {\n return ctx.badRequest('The version you are trying to generate does not exist.');\n }\n\n try {\n strapi.reload.isWatching = false;\n await service.generateFullDoc(version);\n ctx.send({ ok: true });\n } finally {\n strapi.reload.isWatching = true;\n }\n },\n\n async deleteDoc(ctx: Koa.Context) {\n const { version } = ctx.params;\n\n const service = getService('documentation');\n\n const documentationVersions = service.getDocumentationVersions().map((el) => el.version);\n\n if (_.isEmpty(version)) {\n return ctx.badRequest('Please provide a version.');\n }\n\n if (!documentationVersions.includes(version)) {\n return ctx.badRequest('The version you are trying to delete does not exist.');\n }\n\n try {\n strapi.reload.isWatching = false;\n await service.deleteDocumentation(version);\n ctx.send({ ok: true });\n } finally {\n strapi.reload.isWatching = true;\n }\n },\n\n async updateSettings(ctx: Koa.Context) {\n const pluginStore = strapi.store({ type: 'plugin', name: 'documentation' });\n\n const data = await validation.validateSettings(ctx.request.body);\n\n const config: Config = {\n restrictedAccess: Boolean(data.restrictedAccess),\n };\n\n if (data.password) {\n config.password = await bcrypt.hash(data.password, 10);\n }\n\n await pluginStore.set({ key: 'config', value: config });\n\n return ctx.send({ ok: true });\n },\n};\n","import documentation from './documentation';\n\nexport default {\n documentation,\n};\n","import type { PluginConfig } from '../types';\n\nexport const defaultConfig: PluginConfig = {\n openapi: '3.0.0',\n info: {\n version: '1.0.0',\n title: 'DOCUMENTATION',\n description: '',\n termsOfService: 'YOUR_TERMS_OF_SERVICE_URL',\n contact: {\n name: 'TEAM',\n email: 'contact-email@something.io',\n url: 'mywebsite.io',\n },\n license: {\n name: 'Apache 2.0',\n url: 'https://www.apache.org/licenses/LICENSE-2.0.html',\n },\n },\n 'x-strapi-config': {\n plugins: null,\n mutateDocumentation: null,\n },\n servers: [],\n externalDocs: {\n description: 'Find out more',\n url: 'https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html',\n },\n security: [\n {\n bearerAuth: [],\n },\n ],\n paths: {},\n components: {\n securitySchemes: {\n bearerAuth: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n },\n },\n schemas: {\n Error: {\n type: 'object',\n required: ['error'],\n properties: {\n data: {\n nullable: true,\n oneOf: [{ type: 'object' }, { type: 'array', items: { type: 'object' } }],\n },\n error: {\n type: 'object',\n properties: {\n status: {\n type: 'integer',\n },\n name: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n details: {\n type: 'object',\n },\n },\n },\n },\n },\n },\n },\n};\n","import { defaultConfig } from './default-plugin-config';\n\nexport const config = {\n default: defaultConfig,\n};\n","import { bootstrap } from './bootstrap';\nimport { register } from './register';\nimport services from './services';\nimport routes from './routes';\nimport controllers from './controllers';\nimport { config } from './config';\n\nexport default {\n bootstrap,\n config,\n routes,\n controllers,\n register,\n services,\n};\n"],"names":["strapi","config","getApiResponses","queryParams","createService","builApiEndpointPath","documentation","override"],"mappings":";;;;;;;;;AAIa,MAAA,aAAa,CACxB,MACA,EAAE,QAAAA,QAAA,IAAoC,EAAE,QAAQ,OAAO,aACnC;AACpB,SAAOA,QAAO,OAAO,eAAe,EAAE,QAAyB,IAAI;AACrE;ACJA,MAAM,eAAe;AAAA,EACnB;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,aAAa;AAAA,IACb,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AACF;AAEsB,eAAA,UAAU,EAAE,QAAAA,WAAmC;AACnE,QAAMA,QAAO,QAAQ,mBAAmB,EAAE,eAAe,aAAa,YAAY;AAE5E,QAAA,cAAcA,QAAO,MAAO;AAAA,IAChC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,EAAA,CACP;AAED,QAAMC,UAAS,MAAM,YAAY,IAAI,EAAE,KAAK,UAAU;AAEtD,MAAI,CAACA,SAAQ;AACC,gBAAA,IAAI,EAAE,KAAK,UAAU,OAAO,EAAE,kBAAkB,MAAM,EAAA,CAAG;AAAA,EACvE;AAEM,QAAA,WAAW,eAAe,EAAE;AACpC;AC3CO,MAAM,yBAAyB,OAAO,EAAE,QAAAD,cAAsC;AACnF,EAAAA,QAAO,OAAO,OAAO;AAAA,IACnB;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,MAAM,QAAQ,KAAK,MAAM;AACvB,YAAI,MAAM,KAA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