@strapi/plugin-documentation 5.6.0 → 5.7.0

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.
@@ -321,16 +321,26 @@ const hasFindMethod = (handler) => {
321
321
  return false;
322
322
  };
323
323
  const parsePathWithVariables = (routePath) => {
324
- return pathToRegexp__namespace.parse(routePath).map((token) => {
325
- if (___default.default.isObject(token)) {
326
- return `${token.prefix}{${token.name}}`;
324
+ const { tokens } = pathToRegexp__namespace.parse(routePath);
325
+ return tokens.map((token) => {
326
+ switch (token.type) {
327
+ case "text":
328
+ return token.value;
329
+ case "param":
330
+ return `{${token.name}}`;
331
+ case "wildcard":
332
+ return `{${token.name}}`;
333
+ case "group":
334
+ return `(${parsePathWithVariables(token.tokens.map((t) => t).join(""))})`;
335
+ default:
336
+ throw new Error(`Unknown token type: ${token.type}`);
327
337
  }
328
- return token;
329
338
  }).join("");
330
339
  };
331
340
  const getPathParams = (routePath) => {
332
- return pathToRegexp__namespace.parse(routePath).reduce((acc, param) => {
333
- if (!(typeof param === "object")) {
341
+ const { tokens } = pathToRegexp__namespace.parse(routePath);
342
+ return tokens.reduce((acc, param) => {
343
+ if (param.type !== "param") {
334
344
  return acc;
335
345
  }
336
346
  acc.push({
@@ -295,16 +295,26 @@ const hasFindMethod = (handler) => {
295
295
  return false;
296
296
  };
297
297
  const parsePathWithVariables = (routePath) => {
298
- return pathToRegexp.parse(routePath).map((token) => {
299
- if (_.isObject(token)) {
300
- return `${token.prefix}{${token.name}}`;
298
+ const { tokens } = pathToRegexp.parse(routePath);
299
+ return tokens.map((token) => {
300
+ switch (token.type) {
301
+ case "text":
302
+ return token.value;
303
+ case "param":
304
+ return `{${token.name}}`;
305
+ case "wildcard":
306
+ return `{${token.name}}`;
307
+ case "group":
308
+ return `(${parsePathWithVariables(token.tokens.map((t) => t).join(""))})`;
309
+ default:
310
+ throw new Error(`Unknown token type: ${token.type}`);
301
311
  }
302
- return token;
303
312
  }).join("");
304
313
  };
305
314
  const getPathParams = (routePath) => {
306
- return pathToRegexp.parse(routePath).reduce((acc, param) => {
307
- if (!(typeof param === "object")) {
315
+ const { tokens } = pathToRegexp.parse(routePath);
316
+ return tokens.reduce((acc, param) => {
317
+ if (param.type !== "param") {
308
318
  return acc;
309
319
  }
310
320
  acc.push({
@@ -1 +1 @@
1
- {"version":3,"file":"build-api-endpoint-path.d.ts","sourceRoot":"","sources":["../../../../../server/src/services/helpers/build-api-endpoint-path.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,GAAG,EAAW,MAAM,aAAa,CAAC;AAmIhD;;GAEG;AACH,QAAA,MAAM,oBAAoB,QAAS,GAAG,OAKrC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"build-api-endpoint-path.d.ts","sourceRoot":"","sources":["../../../../../server/src/services/helpers/build-api-endpoint-path.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,GAAG,EAAW,MAAM,aAAa,CAAC;AAgJhD;;GAEG;AACH,QAAA,MAAM,oBAAoB,QAAS,GAAG,OAKrC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-documentation",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "Create an OpenAPI Document and visualize your API with SWAGGER UI.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,10 +55,10 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@reduxjs/toolkit": "1.9.7",
58
- "@strapi/admin": "5.6.0",
58
+ "@strapi/admin": "5.7.0",
59
59
  "@strapi/design-system": "2.0.0-rc.14",
60
60
  "@strapi/icons": "2.0.0-rc.14",
61
- "@strapi/utils": "5.6.0",
61
+ "@strapi/utils": "5.7.0",
62
62
  "bcryptjs": "2.4.3",
63
63
  "cheerio": "^1.0.0",
64
64
  "formik": "2.4.5",
@@ -66,7 +66,7 @@
66
66
  "immer": "9.0.21",
67
67
  "koa-static": "^5.0.0",
68
68
  "lodash": "4.17.21",
69
- "path-to-regexp": "6.3.0",
69
+ "path-to-regexp": "8.1.0",
70
70
  "react-intl": "6.6.2",
71
71
  "swagger-ui-dist": "4.19.0",
72
72
  "yaml": "1.10.2",
@@ -74,11 +74,11 @@
74
74
  },
75
75
  "devDependencies": {
76
76
  "@apidevtools/swagger-parser": "^10.1.0",
77
- "@strapi/admin-test-utils": "5.6.0",
77
+ "@strapi/admin-test-utils": "5.7.0",
78
78
  "@strapi/pack-up": "5.0.2",
79
79
  "@strapi/sdk-plugin": "^5.2.0",
80
- "@strapi/strapi": "5.6.0",
81
- "@strapi/types": "5.6.0",
80
+ "@strapi/strapi": "5.7.0",
81
+ "@strapi/types": "5.7.0",
82
82
  "@testing-library/react": "15.0.7",
83
83
  "@testing-library/user-event": "14.5.2",
84
84
  "@types/fs-extra": "11.0.4",