@camunda8/docusaurus-theme-openapi-docs 4.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 (312) hide show
  1. package/babel.config.js +35 -0
  2. package/lib/index.d.ts +2 -0
  3. package/lib/index.js +81 -0
  4. package/lib/markdown/createDescription.d.ts +1 -0
  5. package/lib/markdown/createDescription.js +15 -0
  6. package/lib/markdown/schema.d.ts +3 -0
  7. package/lib/markdown/schema.js +154 -0
  8. package/lib/markdown/utils.d.ts +10 -0
  9. package/lib/markdown/utils.js +49 -0
  10. package/lib/markdown/utils.test.d.ts +1 -0
  11. package/lib/markdown/utils.test.js +43 -0
  12. package/lib/theme/ApiExplorer/Accept/index.d.ts +3 -0
  13. package/lib/theme/ApiExplorer/Accept/index.js +38 -0
  14. package/lib/theme/ApiExplorer/Accept/slice.d.ts +11 -0
  15. package/lib/theme/ApiExplorer/Accept/slice.js +22 -0
  16. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
  18. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +35 -0
  19. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +3 -0
  20. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +41 -0
  21. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +3 -0
  22. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +153 -0
  23. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  24. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  25. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +7 -0
  26. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +147 -0
  27. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  28. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
  29. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +58 -0
  30. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  31. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
  32. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +248 -0
  33. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  34. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
  35. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +59 -0
  36. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  37. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
  38. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +51 -0
  39. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
  40. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +110 -0
  41. package/lib/theme/ApiExplorer/Authorization/auth-types.d.ts +3 -0
  42. package/lib/theme/ApiExplorer/Authorization/auth-types.js +28 -0
  43. package/lib/theme/ApiExplorer/Authorization/index.d.ts +3 -0
  44. package/lib/theme/ApiExplorer/Authorization/index.js +201 -0
  45. package/lib/theme/ApiExplorer/Authorization/slice.d.ts +40 -0
  46. package/lib/theme/ApiExplorer/Authorization/slice.js +102 -0
  47. package/lib/theme/ApiExplorer/Body/index.d.ts +10 -0
  48. package/lib/theme/ApiExplorer/Body/index.js +394 -0
  49. package/lib/theme/ApiExplorer/Body/json2xml.js +43 -0
  50. package/lib/theme/ApiExplorer/Body/slice.d.ts +82 -0
  51. package/lib/theme/ApiExplorer/Body/slice.js +97 -0
  52. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
  53. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
  54. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +11 -0
  55. package/lib/theme/ApiExplorer/CodeSnippets/index.js +435 -0
  56. package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +5 -0
  57. package/lib/theme/ApiExplorer/CodeSnippets/languages.js +133 -0
  58. package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  59. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
  60. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
  61. package/lib/theme/ApiExplorer/CodeTabs/index.js +283 -0
  62. package/lib/theme/ApiExplorer/ContentType/index.d.ts +3 -0
  63. package/lib/theme/ApiExplorer/ContentType/index.js +40 -0
  64. package/lib/theme/ApiExplorer/ContentType/slice.d.ts +11 -0
  65. package/lib/theme/ApiExplorer/ContentType/slice.js +22 -0
  66. package/lib/theme/ApiExplorer/Export/index.d.ts +3 -0
  67. package/lib/theme/ApiExplorer/Export/index.js +57 -0
  68. package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  69. package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +8 -0
  70. package/lib/theme/ApiExplorer/FloatingButton/index.js +28 -0
  71. package/lib/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  72. package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +7 -0
  73. package/lib/theme/ApiExplorer/FormFileUpload/index.js +178 -0
  74. package/lib/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  75. package/lib/theme/ApiExplorer/FormItem/index.d.ts +10 -0
  76. package/lib/theme/ApiExplorer/FormItem/index.js +49 -0
  77. package/lib/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  78. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +9 -0
  79. package/lib/theme/ApiExplorer/FormMultiSelect/index.js +51 -0
  80. package/lib/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  81. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +8 -0
  82. package/lib/theme/ApiExplorer/FormSelect/index.js +35 -0
  83. package/lib/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  84. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +11 -0
  85. package/lib/theme/ApiExplorer/FormTextInput/index.js +80 -0
  86. package/lib/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  87. package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +6 -0
  88. package/lib/theme/ApiExplorer/LiveEditor/index.js +176 -0
  89. package/lib/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  90. package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +8 -0
  91. package/lib/theme/ApiExplorer/MethodEndpoint/index.js +86 -0
  92. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +6 -0
  93. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +230 -0
  94. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +6 -0
  95. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +71 -0
  96. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +6 -0
  97. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +97 -0
  98. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +6 -0
  99. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +72 -0
  100. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +6 -0
  101. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +38 -0
  102. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  103. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +7 -0
  104. package/lib/theme/ApiExplorer/ParamOptions/index.js +233 -0
  105. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +17 -0
  106. package/lib/theme/ApiExplorer/ParamOptions/slice.js +25 -0
  107. package/lib/theme/ApiExplorer/Request/_Request.scss +129 -0
  108. package/lib/theme/ApiExplorer/Request/index.d.ts +6 -0
  109. package/lib/theme/ApiExplorer/Request/index.js +443 -0
  110. package/lib/theme/ApiExplorer/Request/makeRequest.d.ts +4 -0
  111. package/lib/theme/ApiExplorer/Request/makeRequest.js +223 -0
  112. package/lib/theme/ApiExplorer/Response/_Response.scss +121 -0
  113. package/lib/theme/ApiExplorer/Response/index.d.ts +6 -0
  114. package/lib/theme/ApiExplorer/Response/index.js +207 -0
  115. package/lib/theme/ApiExplorer/Response/slice.d.ts +17 -0
  116. package/lib/theme/ApiExplorer/Response/slice.js +51 -0
  117. package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +3 -0
  118. package/lib/theme/ApiExplorer/SecuritySchemes/index.js +519 -0
  119. package/lib/theme/ApiExplorer/Server/_Server.scss +26 -0
  120. package/lib/theme/ApiExplorer/Server/index.d.ts +3 -0
  121. package/lib/theme/ApiExplorer/Server/index.js +213 -0
  122. package/lib/theme/ApiExplorer/Server/slice.d.ts +13 -0
  123. package/lib/theme/ApiExplorer/Server/slice.js +33 -0
  124. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +20 -0
  125. package/lib/theme/ApiExplorer/buildPostmanRequest.js +511 -0
  126. package/lib/theme/ApiExplorer/index.d.ts +7 -0
  127. package/lib/theme/ApiExplorer/index.js +107 -0
  128. package/lib/theme/ApiExplorer/persistanceMiddleware.d.ts +19 -0
  129. package/lib/theme/ApiExplorer/persistanceMiddleware.js +54 -0
  130. package/lib/theme/ApiExplorer/storage-utils.d.ts +4 -0
  131. package/lib/theme/ApiExplorer/storage-utils.js +41 -0
  132. package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
  133. package/lib/theme/ApiItem/Layout/index.js +121 -0
  134. package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
  135. package/lib/theme/ApiItem/hooks.d.ts +12 -0
  136. package/lib/theme/ApiItem/hooks.js +13 -0
  137. package/lib/theme/ApiItem/index.d.ts +2 -0
  138. package/lib/theme/ApiItem/index.js +238 -0
  139. package/lib/theme/ApiItem/store.d.ts +58 -0
  140. package/lib/theme/ApiItem/store.js +53 -0
  141. package/lib/theme/ApiLogo/index.d.ts +2 -0
  142. package/lib/theme/ApiLogo/index.js +51 -0
  143. package/lib/theme/ApiTabs/_ApiTabs.scss +142 -0
  144. package/lib/theme/ApiTabs/index.d.ts +7 -0
  145. package/lib/theme/ApiTabs/index.js +275 -0
  146. package/lib/theme/ArrayBrackets/index.d.ts +3 -0
  147. package/lib/theme/ArrayBrackets/index.js +50 -0
  148. package/lib/theme/CodeSamples/_CodeSamples.scss +3 -0
  149. package/lib/theme/CodeSamples/index.d.ts +8 -0
  150. package/lib/theme/CodeSamples/index.js +27 -0
  151. package/lib/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  152. package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
  153. package/lib/theme/DiscriminatorTabs/index.js +258 -0
  154. package/lib/theme/Markdown/Details/_Details.scss +122 -0
  155. package/lib/theme/Markdown/index.js +179 -0
  156. package/lib/theme/MimeTabs/_MimeTabs.scss +70 -0
  157. package/lib/theme/MimeTabs/index.d.ts +6 -0
  158. package/lib/theme/MimeTabs/index.js +286 -0
  159. package/lib/theme/OperationTabs/_OperationTabs.scss +72 -0
  160. package/lib/theme/OperationTabs/index.d.ts +3 -0
  161. package/lib/theme/OperationTabs/index.js +248 -0
  162. package/lib/theme/ParamsDetails/index.d.ts +6 -0
  163. package/lib/theme/ParamsDetails/index.js +93 -0
  164. package/lib/theme/ParamsItem/_ParamsItem.scss +54 -0
  165. package/lib/theme/ParamsItem/index.d.ts +22 -0
  166. package/lib/theme/ParamsItem/index.js +281 -0
  167. package/lib/theme/RequestSchema/index.d.ts +15 -0
  168. package/lib/theme/RequestSchema/index.js +208 -0
  169. package/lib/theme/ResponseExamples/index.d.ts +18 -0
  170. package/lib/theme/ResponseExamples/index.js +213 -0
  171. package/lib/theme/ResponseHeaders/index.d.ts +13 -0
  172. package/lib/theme/ResponseHeaders/index.js +39 -0
  173. package/lib/theme/ResponseSchema/index.d.ts +15 -0
  174. package/lib/theme/ResponseSchema/index.js +165 -0
  175. package/lib/theme/Schema/index.d.ts +8 -0
  176. package/lib/theme/Schema/index.js +853 -0
  177. package/lib/theme/SchemaItem/_SchemaItem.scss +89 -0
  178. package/lib/theme/SchemaItem/index.d.ts +12 -0
  179. package/lib/theme/SchemaItem/index.js +314 -0
  180. package/lib/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  181. package/lib/theme/SchemaTabs/index.d.ts +3 -0
  182. package/lib/theme/SchemaTabs/index.js +255 -0
  183. package/lib/theme/SkeletonLoader/index.d.ts +6 -0
  184. package/lib/theme/SkeletonLoader/index.js +20 -0
  185. package/lib/theme/StatusCodes/index.d.ts +9 -0
  186. package/lib/theme/StatusCodes/index.js +90 -0
  187. package/lib/theme/styles.scss +215 -0
  188. package/lib/theme/translationIds.d.ts +83 -0
  189. package/lib/theme/translationIds.js +106 -0
  190. package/lib/types.d.ts +46 -0
  191. package/lib/types.js +8 -0
  192. package/package.json +85 -0
  193. package/src/index.ts +85 -0
  194. package/src/markdown/createDescription.ts +13 -0
  195. package/src/markdown/schema.ts +186 -0
  196. package/src/markdown/utils.test.ts +49 -0
  197. package/src/markdown/utils.ts +59 -0
  198. package/src/plugin-content-docs.d.ts +20 -0
  199. package/src/postman-code-generators.d.ts +9 -0
  200. package/src/react-magic-dropzone.d.ts +9 -0
  201. package/src/theme/ApiExplorer/Accept/index.tsx +36 -0
  202. package/src/theme/ApiExplorer/Accept/slice.ts +29 -0
  203. package/src/theme/ApiExplorer/ApiCodeBlock/Container/_Container.scss +7 -0
  204. package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +32 -0
  205. package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx +34 -0
  206. package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +134 -0
  207. package/src/theme/ApiExplorer/ApiCodeBlock/Content/_Content.scss +91 -0
  208. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/_CopyButton.scss +44 -0
  209. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx +83 -0
  210. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/_ExitButton.scss +16 -0
  211. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx +55 -0
  212. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/_ExpandButton.scss +62 -0
  213. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx +166 -0
  214. package/src/theme/ApiExplorer/ApiCodeBlock/Line/_Line.scss +34 -0
  215. package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +48 -0
  216. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/_WordWrapButton.scss +10 -0
  217. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx +54 -0
  218. package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +45 -0
  219. package/src/theme/ApiExplorer/Authorization/auth-types.ts +30 -0
  220. package/src/theme/ApiExplorer/Authorization/index.tsx +199 -0
  221. package/src/theme/ApiExplorer/Authorization/slice.ts +146 -0
  222. package/src/theme/ApiExplorer/Body/index.tsx +388 -0
  223. package/src/theme/ApiExplorer/Body/json2xml.d.ts +8 -0
  224. package/src/theme/ApiExplorer/Body/json2xml.js +43 -0
  225. package/src/theme/ApiExplorer/Body/slice.ts +133 -0
  226. package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +57 -0
  227. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +383 -0
  228. package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  229. package/src/theme/ApiExplorer/CodeSnippets/languages.ts +139 -0
  230. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +505 -0
  231. package/src/theme/ApiExplorer/CodeTabs/index.tsx +261 -0
  232. package/src/theme/ApiExplorer/ContentType/index.tsx +38 -0
  233. package/src/theme/ApiExplorer/ContentType/slice.ts +29 -0
  234. package/src/theme/ApiExplorer/Export/index.tsx +47 -0
  235. package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +27 -0
  236. package/src/theme/ApiExplorer/FloatingButton/index.tsx +29 -0
  237. package/src/theme/ApiExplorer/FormFileUpload/_FormFileUpload.scss +74 -0
  238. package/src/theme/ApiExplorer/FormFileUpload/index.tsx +124 -0
  239. package/src/theme/ApiExplorer/FormItem/_FormItem.scss +21 -0
  240. package/src/theme/ApiExplorer/FormItem/index.tsx +40 -0
  241. package/src/theme/ApiExplorer/FormMultiSelect/_FormMultiSelect.scss +30 -0
  242. package/src/theme/ApiExplorer/FormMultiSelect/index.tsx +57 -0
  243. package/src/theme/ApiExplorer/FormSelect/_FormSelect.scss +43 -0
  244. package/src/theme/ApiExplorer/FormSelect/index.tsx +38 -0
  245. package/src/theme/ApiExplorer/FormTextInput/_FormTextInput.scss +34 -0
  246. package/src/theme/ApiExplorer/FormTextInput/index.tsx +89 -0
  247. package/src/theme/ApiExplorer/LiveEditor/_LiveEditor.scss +15 -0
  248. package/src/theme/ApiExplorer/LiveEditor/index.tsx +122 -0
  249. package/src/theme/ApiExplorer/MethodEndpoint/_MethodEndpoint.scss +22 -0
  250. package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +91 -0
  251. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +185 -0
  252. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +72 -0
  253. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +94 -0
  254. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +74 -0
  255. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +38 -0
  256. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +123 -0
  257. package/src/theme/ApiExplorer/ParamOptions/index.tsx +154 -0
  258. package/src/theme/ApiExplorer/ParamOptions/slice.ts +37 -0
  259. package/src/theme/ApiExplorer/Request/_Request.scss +129 -0
  260. package/src/theme/ApiExplorer/Request/index.tsx +352 -0
  261. package/src/theme/ApiExplorer/Request/makeRequest.ts +255 -0
  262. package/src/theme/ApiExplorer/Response/_Response.scss +121 -0
  263. package/src/theme/ApiExplorer/Response/index.tsx +173 -0
  264. package/src/theme/ApiExplorer/Response/slice.ts +52 -0
  265. package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +375 -0
  266. package/src/theme/ApiExplorer/Server/_Server.scss +26 -0
  267. package/src/theme/ApiExplorer/Server/index.tsx +138 -0
  268. package/src/theme/ApiExplorer/Server/slice.ts +39 -0
  269. package/src/theme/ApiExplorer/buildPostmanRequest.ts +524 -0
  270. package/src/theme/ApiExplorer/index.tsx +52 -0
  271. package/src/theme/ApiExplorer/persistanceMiddleware.ts +73 -0
  272. package/src/theme/ApiExplorer/storage-utils.ts +39 -0
  273. package/src/theme/ApiItem/Layout/index.tsx +85 -0
  274. package/src/theme/ApiItem/Layout/styles.module.css +17 -0
  275. package/src/theme/ApiItem/hooks.ts +13 -0
  276. package/src/theme/ApiItem/index.tsx +222 -0
  277. package/src/theme/ApiItem/store.ts +51 -0
  278. package/src/theme/ApiLogo/index.tsx +52 -0
  279. package/src/theme/ApiTabs/_ApiTabs.scss +142 -0
  280. package/src/theme/ApiTabs/index.tsx +243 -0
  281. package/src/theme/ArrayBrackets/index.tsx +37 -0
  282. package/src/theme/CodeSamples/_CodeSamples.scss +3 -0
  283. package/src/theme/CodeSamples/index.tsx +26 -0
  284. package/src/theme/DiscriminatorTabs/_DiscriminatorTabs.scss +98 -0
  285. package/src/theme/DiscriminatorTabs/index.tsx +229 -0
  286. package/src/theme/Markdown/Details/_Details.scss +122 -0
  287. package/src/theme/Markdown/index.d.ts +8 -0
  288. package/src/theme/Markdown/index.js +179 -0
  289. package/src/theme/MimeTabs/_MimeTabs.scss +70 -0
  290. package/src/theme/MimeTabs/index.tsx +257 -0
  291. package/src/theme/OperationTabs/_OperationTabs.scss +72 -0
  292. package/src/theme/OperationTabs/index.tsx +220 -0
  293. package/src/theme/ParamsDetails/index.tsx +90 -0
  294. package/src/theme/ParamsItem/_ParamsItem.scss +54 -0
  295. package/src/theme/ParamsItem/index.tsx +246 -0
  296. package/src/theme/RequestSchema/index.tsx +172 -0
  297. package/src/theme/ResponseExamples/index.tsx +209 -0
  298. package/src/theme/ResponseHeaders/index.tsx +49 -0
  299. package/src/theme/ResponseSchema/index.tsx +150 -0
  300. package/src/theme/Schema/index.tsx +938 -0
  301. package/src/theme/SchemaItem/_SchemaItem.scss +89 -0
  302. package/src/theme/SchemaItem/index.tsx +273 -0
  303. package/src/theme/SchemaTabs/_SchemaTabs.scss +61 -0
  304. package/src/theme/SchemaTabs/index.tsx +224 -0
  305. package/src/theme/SkeletonLoader/index.tsx +18 -0
  306. package/src/theme/StatusCodes/index.tsx +83 -0
  307. package/src/theme/styles.scss +215 -0
  308. package/src/theme/translationIds.ts +103 -0
  309. package/src/theme-classic.d.ts +80 -0
  310. package/src/theme-openapi.d.ts +20 -0
  311. package/src/types.ts +72 -0
  312. package/tsconfig.json +16 -0
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.OPENAPI_SECURITY_SCHEMES =
10
+ exports.OPENAPI_PARAMS_DETAILS =
11
+ exports.OPENAPI_SCHEMA_ITEM =
12
+ exports.OPENAPI_STATUS_CODES =
13
+ exports.OPENAPI_BODY =
14
+ exports.OPENAPI_RESPONSE_EXAMPLES =
15
+ exports.OPENAPI_AUTH =
16
+ exports.OPENAPI_FORM =
17
+ exports.OPENAPI_FORM_FILE_UPLOAD =
18
+ exports.OPENAPI_PARAM_OPTIONS =
19
+ exports.OPENAPI_SERVER =
20
+ exports.OPENAPI_REQUEST =
21
+ exports.OPENAPI_TABS =
22
+ exports.OPENAPI_RESPONSE =
23
+ void 0;
24
+ exports.OPENAPI_RESPONSE = {
25
+ TITLE: "theme.openapi.response.title",
26
+ CLEAR: "theme.openapi.response.clear",
27
+ PLACEHOLDER: "theme.openapi.response.placeholder",
28
+ HEADERS_TAB: "theme.openapi.response.headersTab",
29
+ };
30
+ exports.OPENAPI_TABS = {
31
+ RESPONSES_LABEL: "theme.openapi.tabs.responses.label",
32
+ };
33
+ exports.OPENAPI_REQUEST = {
34
+ BODY_TITLE: "theme.openapi.request.body.title",
35
+ ACCEPT_TITLE: "theme.openapi.request.accept.title",
36
+ SEND_BUTTON: "theme.openapi.request.sendButton",
37
+ REQUIRED_LABEL: "theme.openapi.request.requiredLabel",
38
+ REQUEST_TITLE: "theme.openapi.request.title",
39
+ COLLAPSE_ALL: "theme.openapi.request.collapseAll",
40
+ EXPAND_ALL: "theme.openapi.request.expandAll",
41
+ BASE_URL_TITLE: "theme.openapi.request.baseUrl.title",
42
+ AUTH_TITLE: "theme.openapi.request.auth.title",
43
+ PARAMETERS_TITLE: "theme.openapi.request.parameters.title",
44
+ FETCHING_MESSAGE: "theme.openapi.request.fetchingMessage",
45
+ CONNECTION_FAILED: "theme.openapi.request.connectionFailed",
46
+ };
47
+ exports.OPENAPI_SERVER = {
48
+ EDIT_BUTTON: "theme.openapi.server.editButton",
49
+ HIDE_BUTTON: "theme.openapi.server.hideButton",
50
+ };
51
+ exports.OPENAPI_PARAM_OPTIONS = {
52
+ SHOW_OPTIONAL: "theme.openapi.paramOptions.showOptional",
53
+ HIDE_OPTIONAL: "theme.openapi.paramOptions.hideOptional",
54
+ };
55
+ exports.OPENAPI_FORM_FILE_UPLOAD = {
56
+ CLEAR_BUTTON: "theme.openapi.formFileUpload.clearButton",
57
+ };
58
+ exports.OPENAPI_FORM = {
59
+ FIELD_REQUIRED: "theme.openapi.form.fieldRequired",
60
+ };
61
+ exports.OPENAPI_AUTH = {
62
+ BEARER_TOKEN: "theme.openapi.auth.bearerToken",
63
+ USERNAME: "theme.openapi.auth.username",
64
+ PASSWORD: "theme.openapi.auth.password",
65
+ SECURITY_SCHEME: "theme.openapi.auth.securityScheme",
66
+ };
67
+ exports.OPENAPI_RESPONSE_EXAMPLES = {
68
+ EXAMPLE: "theme.openapi.responseExamples.example",
69
+ AUTO_EXAMPLE: "theme.openapi.responseExamples.autoExample",
70
+ };
71
+ exports.OPENAPI_BODY = {
72
+ EXAMPLE_FROM_SCHEMA: "theme.openapi.body.exampleFromSchema",
73
+ };
74
+ exports.OPENAPI_STATUS_CODES = {
75
+ RESPONSE_HEADERS: "theme.openapi.statusCodes.responseHeaders",
76
+ SCHEMA_TITLE: "theme.openapi.statusCodes.schemaTitle",
77
+ };
78
+ exports.OPENAPI_SCHEMA_ITEM = {
79
+ REQUIRED: "theme.openapi.schemaItem.required",
80
+ DEPRECATED: "theme.openapi.schemaItem.deprecated",
81
+ NULLABLE: "theme.openapi.schemaItem.nullable",
82
+ DEFAULT_VALUE: "theme.openapi.schemaItem.defaultValue",
83
+ EXAMPLE: "theme.openapi.schemaItem.example",
84
+ EXAMPLES: "theme.openapi.schemaItem.examples",
85
+ DESCRIPTION: "theme.openapi.schemaItem.description",
86
+ CONSTANT_VALUE: "theme.openapi.schemaItem.constantValue",
87
+ ENUM_VALUE: "theme.openapi.schemaItem.enumValue",
88
+ ENUM_DESCRIPTION: "theme.openapi.schemaItem.enumDescription",
89
+ POSSIBLE_VALUES: "theme.openapi.schemaItem.possibleValues",
90
+ ONE_OF: "theme.openapi.schemaItem.oneOf",
91
+ ANY_OF: "theme.openapi.schemaItem.anyOf",
92
+ };
93
+ exports.OPENAPI_PARAMS_DETAILS = {
94
+ PARAMETERS_TITLE: "theme.openapi.paramsDetails.parametersTitle",
95
+ };
96
+ exports.OPENAPI_SECURITY_SCHEMES = {
97
+ NAME: "theme.openapi.securitySchemes.name",
98
+ TYPE: "theme.openapi.securitySchemes.type",
99
+ SCOPES: "theme.openapi.securitySchemes.scopes",
100
+ IN: "theme.openapi.securitySchemes.in",
101
+ FLOWS: "theme.openapi.securitySchemes.flows",
102
+ DESCRIPTION: "theme.openapi.securitySchemes.description",
103
+ SCHEME: "theme.openapi.securitySchemes.scheme",
104
+ BEARER_FORMAT: "theme.openapi.securitySchemes.bearerFormat",
105
+ OPEN_ID_CONNECT_URL: "theme.openapi.securitySchemes.openIdConnectUrl",
106
+ };
package/lib/types.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import type { DocFrontMatter as DocusaurusDocFrontMatter } from "@docusaurus/plugin-content-docs";
2
+ import type { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
3
+ export interface ThemeConfig {
4
+ api?: {
5
+ proxy?: string;
6
+ authPersistance?: false | "localStorage" | "sessionStorage";
7
+ };
8
+ }
9
+ export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
10
+ export type SchemaObject = Omit<JSONSchema, "type" | "allOf" | "oneOf" | "anyOf" | "not" | "items" | "properties" | "additionalProperties"> & {
11
+ type?: "string" | "number" | "integer" | "boolean" | "object" | "array";
12
+ allOf?: SchemaObject[];
13
+ oneOf?: SchemaObject[];
14
+ anyOf?: SchemaObject[];
15
+ not?: SchemaObject;
16
+ items?: SchemaObject;
17
+ properties?: Record<string, SchemaObject>;
18
+ additionalProperties?: boolean | SchemaObject;
19
+ nullable?: boolean;
20
+ discriminator?: DiscriminatorObject;
21
+ readOnly?: boolean;
22
+ writeOnly?: boolean;
23
+ xml?: XMLObject;
24
+ externalDocs?: ExternalDocumentationObject;
25
+ example?: any;
26
+ deprecated?: boolean;
27
+ };
28
+ export interface DiscriminatorObject {
29
+ propertyName: string;
30
+ mapping?: Record<string, string>;
31
+ }
32
+ export interface XMLObject {
33
+ name?: string;
34
+ namespace?: string;
35
+ prefix?: string;
36
+ attribute?: boolean;
37
+ wrapped?: boolean;
38
+ }
39
+ export interface ExternalDocumentationObject {
40
+ description?: string;
41
+ url: string;
42
+ }
43
+ export interface DocFrontMatter extends DocusaurusDocFrontMatter {
44
+ /** Provides OpenAPI Docs with a reference path to their respective Info Doc */
45
+ info_path?: string;
46
+ }
package/lib/types.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /* ============================================================================
3
+ * Copyright (c) Palo Alto Networks
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ * ========================================================================== */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@camunda8/docusaurus-theme-openapi-docs",
3
+ "description": "OpenAPI theme for Docusaurus.",
4
+ "version": "4.5.1",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "openapi",
8
+ "documentation",
9
+ "docusaurus",
10
+ "websites",
11
+ "theme"
12
+ ],
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/camunda/docusaurus-theme-openapi-docs.git",
19
+ "directory": "packages/docusaurus-theme-openapi-docs"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/camunda/docusaurus-theme-openapi-docs/issues"
23
+ },
24
+ "types": "src/theme-openapi.d.ts",
25
+ "main": "lib/index.js",
26
+ "scripts": {
27
+ "build": "tsc --build && node ../../scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc.json --write \"lib/theme/**/*.js\"",
28
+ "watch": "concurrently --names \"lib,lib-next,tsc\" --kill-others \"yarn babel:lib --watch\" \"yarn babel:lib-next --watch\" \"yarn tsc --watch\"",
29
+ "prepare": "npm run build"
30
+ },
31
+ "devDependencies": {
32
+ "@docusaurus/theme-classic": "^3.5.0",
33
+ "@docusaurus/theme-common": "^3.5.0",
34
+ "@docusaurus/types": "^3.5.0",
35
+ "@types/crypto-js": "^4.2.2",
36
+ "@types/file-saver": "^2.0.7",
37
+ "@types/lodash": "^4.17.20",
38
+ "@types/pako": "^2.0.3",
39
+ "@types/postman-collection": "^3.5.11",
40
+ "@types/react-modal": "^3.16.3",
41
+ "concurrently": "^9.2.0",
42
+ "@camunda8/docusaurus-plugin-openapi-docs": "^4.5.1",
43
+ "docusaurus-plugin-sass": "^0.2.6",
44
+ "eslint-plugin-prettier": "^5.5.1"
45
+ },
46
+ "dependencies": {
47
+ "@hookform/error-message": "^2.0.1",
48
+ "@reduxjs/toolkit": "^2.8.2",
49
+ "allof-merge": "^0.6.6",
50
+ "buffer": "^6.0.3",
51
+ "clsx": "^2.1.1",
52
+ "copy-text-to-clipboard": "^3.2.0",
53
+ "crypto-js": "^4.2.0",
54
+ "file-saver": "^2.0.5",
55
+ "lodash": "^4.17.21",
56
+ "pako": "^2.1.0",
57
+ "postman-code-generators": "^2.0.0",
58
+ "postman-collection": "^5.0.2",
59
+ "prism-react-renderer": "^2.4.1",
60
+ "process": "^0.11.10",
61
+ "react-hook-form": "^7.59.0",
62
+ "react-live": "^4.1.8",
63
+ "react-magic-dropzone": "^1.0.1",
64
+ "react-markdown": "^10.1.0",
65
+ "react-modal": "^3.16.3",
66
+ "react-redux": "^9.2.0",
67
+ "rehype-raw": "^7.0.0",
68
+ "remark-gfm": "4.0.1",
69
+ "sass": "^1.89.2",
70
+ "sass-loader": "^16.0.5",
71
+ "unist-util-visit": "^5.0.0",
72
+ "url": "^0.11.4",
73
+ "xml-formatter": "^3.6.6"
74
+ },
75
+ "peerDependencies": {
76
+ "@docusaurus/theme-common": "^3.5.0",
77
+ "@camunda8/docusaurus-plugin-openapi-docs": "^4.0.0",
78
+ "docusaurus-plugin-sass": "^0.2.3",
79
+ "react": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0",
80
+ "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0"
81
+ },
82
+ "engines": {
83
+ "node": ">=14"
84
+ }
85
+ }
package/src/index.ts ADDED
@@ -0,0 +1,85 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import path from "path";
9
+
10
+ import type { Plugin } from "@docusaurus/types";
11
+
12
+ export default function docusaurusThemeOpenAPI(): Plugin<void> {
13
+ return {
14
+ name: "docusaurus-theme-openapi",
15
+
16
+ getClientModules() {
17
+ const modules = [
18
+ require.resolve(
19
+ path.join(__dirname, "..", "lib", "theme", "styles.scss")
20
+ ),
21
+ ];
22
+ return modules;
23
+ },
24
+
25
+ getThemePath() {
26
+ return path.join(__dirname, "..", "lib", "theme");
27
+ },
28
+
29
+ getTypeScriptThemePath() {
30
+ return path.resolve(__dirname, "..", "src", "theme");
31
+ },
32
+
33
+ configureWebpack(_, isServer, utils) {
34
+ const rules: any = _.module?.rules ?? [];
35
+ const sassLoaderRule = rules.filter((r: any) => {
36
+ return String(r.test) === String(/\.s[ca]ss$/);
37
+ });
38
+ const { getStyleLoaders } = utils;
39
+ // Avoid conflicts with docusaurus-plugin-sass
40
+ if (sassLoaderRule.length === 0) {
41
+ return {
42
+ resolve: {
43
+ fallback: {
44
+ buffer: require.resolve("buffer/"),
45
+ },
46
+ },
47
+ plugins: [
48
+ new utils.currentBundler.instance.ProvidePlugin({
49
+ process: require.resolve("process/browser"),
50
+ Buffer: ["buffer", "Buffer"],
51
+ }),
52
+ ],
53
+ module: {
54
+ rules: [
55
+ {
56
+ test: /\.s[ac]ss$/,
57
+ include: path.resolve(__dirname, "..", "lib", "theme"),
58
+ use: [
59
+ ...getStyleLoaders(isServer, {}),
60
+ {
61
+ loader: require.resolve("sass-loader"),
62
+ options: {},
63
+ },
64
+ ],
65
+ },
66
+ ],
67
+ },
68
+ };
69
+ }
70
+ return {
71
+ resolve: {
72
+ fallback: {
73
+ buffer: require.resolve("buffer/"),
74
+ },
75
+ },
76
+ plugins: [
77
+ new utils.currentBundler.instance.ProvidePlugin({
78
+ process: require.resolve("process/browser"),
79
+ Buffer: ["buffer", "Buffer"],
80
+ }),
81
+ ],
82
+ };
83
+ },
84
+ };
85
+ }
@@ -0,0 +1,13 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ export function createDescription(description: string | undefined) {
9
+ if (!description) {
10
+ return "";
11
+ }
12
+ return `\n\n${description}\n\n`;
13
+ }
@@ -0,0 +1,186 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import { translate } from "@docusaurus/Translate";
9
+ import { OPENAPI_SCHEMA_ITEM } from "../theme/translationIds";
10
+ import { SchemaObject } from "../types";
11
+
12
+ function prettyName(schema: SchemaObject, circular?: boolean) {
13
+ if (schema.format) {
14
+ return schema.format;
15
+ }
16
+
17
+ if (schema.allOf) {
18
+ if (typeof schema.allOf[0] === "string") {
19
+ // @ts-ignore
20
+ if (schema.allOf[0].includes("circular")) {
21
+ return schema.allOf[0];
22
+ }
23
+ }
24
+ return "object";
25
+ }
26
+
27
+ if (schema.oneOf) {
28
+ return "object";
29
+ }
30
+
31
+ if (schema.anyOf) {
32
+ return "object";
33
+ }
34
+
35
+ if (schema.type === "object") {
36
+ return schema.xml?.name ?? schema.type;
37
+ // return schema.type;
38
+ }
39
+
40
+ if (schema.type === "array") {
41
+ return schema.xml?.name ?? schema.type;
42
+ // return schema.type;
43
+ }
44
+
45
+ return schema.title ?? schema.type;
46
+ }
47
+
48
+ export function getSchemaName(
49
+ schema: SchemaObject,
50
+ circular?: boolean
51
+ ): string {
52
+ if (schema.items) {
53
+ return prettyName(schema.items, circular) + "[]";
54
+ }
55
+
56
+ return prettyName(schema, circular) ?? "";
57
+ }
58
+
59
+ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
60
+ // TODO:
61
+ // - uniqueItems
62
+ // - maxProperties
63
+ // - minProperties
64
+ // - multipleOf
65
+ if (!schema) {
66
+ return undefined;
67
+ }
68
+
69
+ if (
70
+ schema.items &&
71
+ schema.minItems === undefined &&
72
+ schema.maxItems === undefined
73
+ ) {
74
+ return getQualifierMessage(schema.items);
75
+ }
76
+
77
+ let message = `**${translate({
78
+ id: OPENAPI_SCHEMA_ITEM.POSSIBLE_VALUES,
79
+ message: "Possible values:",
80
+ })}** `;
81
+
82
+ let qualifierGroups = [];
83
+
84
+ if (schema.items && schema.items.enum) {
85
+ if (schema.items.enum) {
86
+ qualifierGroups.push(
87
+ `[${schema.items.enum.map((e) => `\`${e}\``).join(", ")}]`
88
+ );
89
+ }
90
+ }
91
+
92
+ if (schema.minLength || schema.maxLength) {
93
+ let lengthQualifier = "";
94
+ let minLength;
95
+ let maxLength;
96
+ if (schema.minLength && schema.minLength > 1) {
97
+ minLength = `\`>= ${schema.minLength} characters\``;
98
+ }
99
+ if (schema.minLength && schema.minLength === 1) {
100
+ minLength = `\`non-empty\``;
101
+ }
102
+ if (schema.maxLength) {
103
+ maxLength = `\`<= ${schema.maxLength} characters\``;
104
+ }
105
+
106
+ if (minLength && !maxLength) {
107
+ lengthQualifier += minLength;
108
+ }
109
+ if (maxLength && !minLength) {
110
+ lengthQualifier += maxLength;
111
+ }
112
+ if (minLength && maxLength) {
113
+ lengthQualifier += `${minLength} and ${maxLength}`;
114
+ }
115
+
116
+ qualifierGroups.push(lengthQualifier);
117
+ }
118
+
119
+ if (
120
+ schema.minimum != null ||
121
+ schema.maximum != null ||
122
+ typeof schema.exclusiveMinimum === "number" ||
123
+ typeof schema.exclusiveMaximum === "number"
124
+ ) {
125
+ let minmaxQualifier = "";
126
+ let minimum;
127
+ let maximum;
128
+ if (typeof schema.exclusiveMinimum === "number") {
129
+ minimum = `\`> ${schema.exclusiveMinimum}\``;
130
+ } else if (schema.minimum != null && !schema.exclusiveMinimum) {
131
+ minimum = `\`>= ${schema.minimum}\``;
132
+ } else if (schema.minimum != null && schema.exclusiveMinimum === true) {
133
+ minimum = `\`> ${schema.minimum}\``;
134
+ }
135
+ if (typeof schema.exclusiveMaximum === "number") {
136
+ maximum = `\`< ${schema.exclusiveMaximum}\``;
137
+ } else if (schema.maximum != null && !schema.exclusiveMaximum) {
138
+ maximum = `\`<= ${schema.maximum}\``;
139
+ } else if (schema.maximum != null && schema.exclusiveMaximum === true) {
140
+ maximum = `\`< ${schema.maximum}\``;
141
+ }
142
+
143
+ if (minimum && !maximum) {
144
+ minmaxQualifier += minimum;
145
+ }
146
+ if (maximum && !minimum) {
147
+ minmaxQualifier += maximum;
148
+ }
149
+ if (minimum && maximum) {
150
+ minmaxQualifier += `${minimum} and ${maximum}`;
151
+ }
152
+
153
+ qualifierGroups.push(minmaxQualifier);
154
+ }
155
+
156
+ if (schema.pattern) {
157
+ qualifierGroups.push(
158
+ `Value must match regular expression \`${schema.pattern}\``
159
+ );
160
+ }
161
+
162
+ // Check if discriminator mapping
163
+ const discriminator = schema as any;
164
+ if (discriminator.mapping) {
165
+ const values = Object.keys(discriminator.mapping);
166
+ qualifierGroups.push(`[${values.map((e) => `\`${e}\``).join(", ")}]`);
167
+ }
168
+
169
+ if (schema.enum) {
170
+ qualifierGroups.push(`[${schema.enum.map((e) => `\`${e}\``).join(", ")}]`);
171
+ }
172
+
173
+ if (schema.minItems) {
174
+ qualifierGroups.push(`\`>= ${schema.minItems}\``);
175
+ }
176
+
177
+ if (schema.maxItems) {
178
+ qualifierGroups.push(`\`<= ${schema.maxItems}\``);
179
+ }
180
+
181
+ if (qualifierGroups.length === 0) {
182
+ return undefined;
183
+ }
184
+
185
+ return message + qualifierGroups.join(", ");
186
+ }
@@ -0,0 +1,49 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import { guard } from "./utils";
9
+
10
+ describe("guard", () => {
11
+ it("should guard empty strings", () => {
12
+ const actual = guard("", (_) => {
13
+ throw new Error("Should not be called");
14
+ });
15
+ expect(actual).toBe("");
16
+ });
17
+
18
+ it("should guard undefined", () => {
19
+ const actual = guard(undefined, (value) => {
20
+ throw new Error("Should not be called");
21
+ });
22
+ expect(actual).toBe("");
23
+ });
24
+
25
+ it("should guard false booleans", () => {
26
+ const actual = guard(false, (value) => `${value}`);
27
+ expect(actual).toBe("");
28
+ });
29
+
30
+ it("should not guard strings", () => {
31
+ const actual = guard("hello", (value) => value);
32
+ expect(actual).toBe("hello");
33
+ });
34
+
35
+ it("should not guard numbers", () => {
36
+ const actual = guard(1, (value) => `${value}`);
37
+ expect(actual).toBe("1");
38
+ });
39
+
40
+ it("should not guard numbers equals to 0", () => {
41
+ const actual = guard(0, (value) => `${value}`);
42
+ expect(actual).toBe("0");
43
+ });
44
+
45
+ it("should not guard true booleans", () => {
46
+ const actual = guard(true, (value) => `${value}`);
47
+ expect(actual).toBe("true");
48
+ });
49
+ });
@@ -0,0 +1,59 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ import { ReactNode } from "react";
9
+
10
+ /** @deprecated use ReactNode from React instead */
11
+ export type Children = ReactNode;
12
+
13
+ export type Props = Record<string, any> & { children?: ReactNode };
14
+
15
+ export function create(tag: string, props: Props): string {
16
+ const { children, ...rest } = props;
17
+
18
+ let propString = "";
19
+ for (const [key, value] of Object.entries(rest)) {
20
+ propString += ` ${key}={${JSON.stringify(value)}}`;
21
+ }
22
+
23
+ return `<${tag}${propString}>${render(children)}</${tag}>`;
24
+ }
25
+
26
+ export function guard<T>(
27
+ value: T | undefined | string,
28
+ cb: (value: T) => ReactNode
29
+ ) {
30
+ if (!!value || value === 0) {
31
+ const children = cb(value as T);
32
+ return render(children);
33
+ }
34
+ return "";
35
+ }
36
+
37
+ export function render(children: ReactNode) {
38
+ if (Array.isArray(children)) {
39
+ return children.filter((c) => c !== undefined).join("");
40
+ }
41
+ return children ?? "";
42
+ }
43
+
44
+ export function toString(value: any): string | undefined {
45
+ // Return as-is if already string
46
+ if (typeof value === "string") {
47
+ return value;
48
+ }
49
+ // Return undefined if null or undefined
50
+ if (value == null) {
51
+ return undefined;
52
+ }
53
+ // Return formatted array if Array
54
+ if (Array.isArray(value)) {
55
+ return `[${value.join(", ")}]`;
56
+ }
57
+ // Coerce to string in all other cases,
58
+ return value + "";
59
+ }
@@ -0,0 +1,20 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ /// <reference types="@docusaurus/theme-classic" />
9
+
10
+ declare module "@docusaurus/plugin-content-docs/client" {
11
+ export function DocProvider({
12
+ children,
13
+ content,
14
+ }: {
15
+ children: ReactNode;
16
+ content: PropDocContent;
17
+ });
18
+
19
+ export function useDoc();
20
+ }
@@ -0,0 +1,9 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ // TODO: Remove this when https://github.com/facebook/docusaurus/issues/6087 is resolved.
9
+ declare module "postman-code-generators";
@@ -0,0 +1,9 @@
1
+ /* ============================================================================
2
+ * Copyright (c) Palo Alto Networks
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ * ========================================================================== */
7
+
8
+ // TODO: Remove this when https://github.com/facebook/docusaurus/issues/6087 is resolved.
9
+ declare module "react-magic-dropzone";