@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,511 @@
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
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
64
+ var __importDefault =
65
+ (this && this.__importDefault) ||
66
+ function (mod) {
67
+ return mod && mod.__esModule ? mod : { default: mod };
68
+ };
69
+ Object.defineProperty(exports, "__esModule", { value: true });
70
+ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
71
+ const sdk = __importStar(require("postman-collection"));
72
+ function setQueryParams(postman, queryParams) {
73
+ postman.url.query.clear();
74
+ const qp = queryParams
75
+ .map((param) => {
76
+ if (!param.value) {
77
+ return undefined;
78
+ }
79
+ // Handle array values
80
+ if (Array.isArray(param.value)) {
81
+ if (param.style === "spaceDelimited") {
82
+ return new sdk.QueryParam({
83
+ key: param.name,
84
+ value: param.value.join(" "),
85
+ });
86
+ } else if (param.style === "pipeDelimited") {
87
+ return new sdk.QueryParam({
88
+ key: param.name,
89
+ value: param.value.join("|"),
90
+ });
91
+ } else if (param.explode) {
92
+ return param.value.map(
93
+ (val) =>
94
+ new sdk.QueryParam({
95
+ key: param.name,
96
+ value: val,
97
+ })
98
+ );
99
+ } else {
100
+ return new sdk.QueryParam({
101
+ key: param.name,
102
+ value: param.value.join(","),
103
+ });
104
+ }
105
+ }
106
+ // Handle object values
107
+ if (param.style === "deepObject") {
108
+ const jsonResult = tryDecodeJsonParam(param.value);
109
+ if (jsonResult && typeof jsonResult === "object") {
110
+ return Object.entries(jsonResult).map(
111
+ ([key, val]) =>
112
+ new sdk.QueryParam({
113
+ key: `${param.name}[${key}]`,
114
+ value: String(val),
115
+ })
116
+ );
117
+ }
118
+ } else if (param.explode) {
119
+ const jsonResult = tryDecodeJsonParam(param.value);
120
+ if (jsonResult && typeof jsonResult === "object") {
121
+ return Object.entries(jsonResult).map(
122
+ ([key, val]) =>
123
+ new sdk.QueryParam({
124
+ key: key,
125
+ value: String(val),
126
+ })
127
+ );
128
+ } else {
129
+ return new sdk.QueryParam({
130
+ key: param.name,
131
+ value: Object.entries(jsonResult)
132
+ .map(([key, val]) => `${key},${val}`)
133
+ .join(","),
134
+ });
135
+ }
136
+ }
137
+ // Parameter allows empty value: "/hello?extended"
138
+ if (param.allowEmptyValue) {
139
+ if (param.value === "true") {
140
+ return new sdk.QueryParam({
141
+ key: param.name,
142
+ value: null,
143
+ });
144
+ }
145
+ return undefined;
146
+ }
147
+ return new sdk.QueryParam({
148
+ key: param.name,
149
+ value: param.value,
150
+ });
151
+ })
152
+ .flat() // Flatten the array in case of nested arrays from map
153
+ .filter((item) => item !== undefined);
154
+ if (qp.length > 0) {
155
+ postman.addQueryParams(qp);
156
+ }
157
+ }
158
+ function setPathParams(postman, pathParams) {
159
+ // Map through the path parameters
160
+ const source = pathParams.map((param) => {
161
+ if (!param.value) {
162
+ return undefined;
163
+ }
164
+ let serializedValue;
165
+ // Handle different styles
166
+ if (Array.isArray(param.value)) {
167
+ if (param.style === "label") {
168
+ serializedValue = `.${param.value.join(".")}`;
169
+ } else if (param.style === "matrix") {
170
+ serializedValue = `;${param.name}=${param.value.join(";")}`;
171
+ } else {
172
+ serializedValue = param.value.join(",");
173
+ }
174
+ return new sdk.Variable({
175
+ key: param.name,
176
+ value: serializedValue,
177
+ });
178
+ }
179
+ const jsonResult = tryDecodeJsonParam(param.value);
180
+ if (jsonResult && typeof jsonResult === "object") {
181
+ if (param.style === "matrix") {
182
+ serializedValue = Object.entries(jsonResult)
183
+ .map(([key, val]) => `;${key}=${val}`)
184
+ .join("");
185
+ } else {
186
+ serializedValue = Object.entries(jsonResult)
187
+ .map(([key, val]) => `${key}=${val}`)
188
+ .join(",");
189
+ }
190
+ } else {
191
+ serializedValue = param.value;
192
+ }
193
+ return new sdk.Variable({
194
+ key: param.name,
195
+ value: serializedValue,
196
+ });
197
+ });
198
+ postman.url.variables.assimilate(
199
+ source.filter((v) => v !== undefined),
200
+ false
201
+ );
202
+ }
203
+ function buildCookie(cookieParams) {
204
+ const cookies = cookieParams
205
+ .map((param) => {
206
+ if (param.value) {
207
+ const jsonResult = tryDecodeJsonParam(param.value);
208
+ if (jsonResult && typeof jsonResult === "object") {
209
+ if (param.style === "form") {
210
+ // Handle form style
211
+ if (param.explode) {
212
+ // Serialize each key-value pair as a separate cookie
213
+ return Object.entries(jsonResult).map(
214
+ ([key, val]) =>
215
+ new sdk.Cookie({
216
+ key: key,
217
+ value: String(val),
218
+ domain: "",
219
+ path: "",
220
+ })
221
+ );
222
+ } else {
223
+ // Serialize the object as a single cookie with key-value pairs joined by commas
224
+ return new sdk.Cookie({
225
+ key: param.name,
226
+ value: Object.entries(jsonResult)
227
+ .map(([key, val]) => `${key},${val}`)
228
+ .join(","),
229
+ domain: "",
230
+ path: "",
231
+ });
232
+ }
233
+ }
234
+ } else {
235
+ // Handle scalar values
236
+ return new sdk.Cookie({
237
+ key: param.name,
238
+ value: String(param.value),
239
+ domain: "",
240
+ path: "",
241
+ });
242
+ }
243
+ }
244
+ return undefined;
245
+ })
246
+ .flat() // Flatten the array in case of nested arrays from map
247
+ .filter((item) => item !== undefined);
248
+ const list = new sdk.CookieList(null, cookies);
249
+ return list.toString();
250
+ }
251
+ function setHeaders(postman, contentType, accept, cookie, headerParams, other) {
252
+ postman.headers.clear();
253
+ if (contentType) {
254
+ postman.addHeader({ key: "Content-Type", value: contentType });
255
+ }
256
+ if (accept) {
257
+ postman.addHeader({ key: "Accept", value: accept });
258
+ }
259
+ headerParams.forEach((param) => {
260
+ if (param.value) {
261
+ const jsonResult = Array.isArray(param.value)
262
+ ? param.value.map(tryDecodeJsonParam)
263
+ : tryDecodeJsonParam(param.value);
264
+ if (Array.isArray(param.value)) {
265
+ if (param.style === "simple") {
266
+ if (param.explode) {
267
+ // Each item in the array is a separate header
268
+ jsonResult.forEach((val) => {
269
+ postman.addHeader({ key: param.name, value: val });
270
+ });
271
+ } else {
272
+ // Array values are joined by commas
273
+ postman.addHeader({
274
+ key: param.name,
275
+ value: param.value.join(","),
276
+ });
277
+ }
278
+ }
279
+ } else if (typeof jsonResult === "object") {
280
+ if (param.style === "simple") {
281
+ if (param.explode) {
282
+ // Each key-value pair in the object is a separate header
283
+ Object.entries(jsonResult).forEach(([key, val]) => {
284
+ postman.addHeader({ key: param.name, value: `${key}=${val}` });
285
+ });
286
+ } else {
287
+ // Object is serialized as a single header with key-value pairs joined by commas
288
+ postman.addHeader({
289
+ key: param.name,
290
+ value: Object.entries(jsonResult)
291
+ .map(([key, val]) => `${key},${val}`)
292
+ .join(","),
293
+ });
294
+ }
295
+ }
296
+ } else {
297
+ // Handle scalar values
298
+ postman.addHeader({ key: param.name, value: param.value });
299
+ }
300
+ }
301
+ });
302
+ other.forEach((header) => {
303
+ postman.addHeader(header);
304
+ });
305
+ if (cookie) {
306
+ postman.addHeader({ key: "Cookie", value: cookie });
307
+ }
308
+ }
309
+ function tryDecodeJsonParam(value) {
310
+ try {
311
+ return JSON.parse(decodeURI(value));
312
+ } catch (e) {
313
+ return false;
314
+ }
315
+ }
316
+ // TODO: this is all a bit hacky
317
+ function setBody(clonedPostman, body) {
318
+ if (clonedPostman.body === undefined) {
319
+ return;
320
+ }
321
+ if (body.type === "empty") {
322
+ clonedPostman.body = undefined;
323
+ return;
324
+ }
325
+ if (body.type === "raw" && body.content?.type === "file") {
326
+ // treat it like file.
327
+ clonedPostman.body.mode = "file";
328
+ clonedPostman.body.file = { src: body.content.value.src };
329
+ return;
330
+ }
331
+ switch (clonedPostman.body.mode) {
332
+ case "raw": {
333
+ // check file even though it should already be set from above
334
+ if (body.type !== "raw" || body.content?.type === "file") {
335
+ clonedPostman.body = undefined;
336
+ return;
337
+ }
338
+ clonedPostman.body.raw = body.content?.value ?? "";
339
+ return;
340
+ }
341
+ case "formdata": {
342
+ clonedPostman.body.formdata?.clear();
343
+ if (body.type !== "form") {
344
+ // treat it like raw.
345
+ clonedPostman.body.mode = "raw";
346
+ clonedPostman.body.raw = `${body.content?.value}`;
347
+ return;
348
+ }
349
+ const params = Object.entries(body.content)
350
+ .filter((entry) => !!entry[1])
351
+ .map(([key, content]) => {
352
+ if (content.type === "file") {
353
+ return new sdk.FormParam({ key: key, ...content });
354
+ }
355
+ return new sdk.FormParam({ key: key, value: content.value });
356
+ });
357
+ clonedPostman.body.formdata?.assimilate(params, false);
358
+ return;
359
+ }
360
+ case "urlencoded": {
361
+ clonedPostman.body.urlencoded?.clear();
362
+ if (body.type !== "form") {
363
+ // treat it like raw.
364
+ clonedPostman.body.mode = "raw";
365
+ clonedPostman.body.raw = `${body.content?.value}`;
366
+ return;
367
+ }
368
+ const params = Object.entries(body.content)
369
+ .filter((entry) => !!entry[1])
370
+ .map(([key, content]) => {
371
+ if (content.type !== "file" && content.value) {
372
+ return new sdk.QueryParam({ key: key, value: content.value });
373
+ }
374
+ return undefined;
375
+ })
376
+ .filter((item) => item !== undefined);
377
+ clonedPostman.body.urlencoded?.assimilate(params, false);
378
+ return;
379
+ }
380
+ default:
381
+ return;
382
+ }
383
+ }
384
+ function buildPostmanRequest(
385
+ postman,
386
+ {
387
+ queryParams,
388
+ pathParams,
389
+ cookieParams,
390
+ contentType,
391
+ accept,
392
+ headerParams,
393
+ body,
394
+ server,
395
+ auth,
396
+ }
397
+ ) {
398
+ const clonedPostman = (0, cloneDeep_1.default)(postman);
399
+ clonedPostman.url.protocol = undefined;
400
+ clonedPostman.url.host = [window.location.origin];
401
+ if (server) {
402
+ let url = server.url.replace(/\/$/, "");
403
+ const variables = server.variables;
404
+ if (variables) {
405
+ Object.keys(variables).forEach((variable) => {
406
+ url = url.replace(`{${variable}}`, variables[variable].default);
407
+ });
408
+ }
409
+ clonedPostman.url.host = [url];
410
+ }
411
+ const enhancedQueryParams = [...queryParams];
412
+ const enhancedCookieParams = [...cookieParams];
413
+ let otherHeaders = [];
414
+ let selectedAuth = [];
415
+ if (auth.selected !== undefined) {
416
+ selectedAuth = auth.options[auth.selected];
417
+ }
418
+ for (const a of selectedAuth) {
419
+ // Bearer Auth
420
+ if (a.type === "http" && a.scheme === "bearer") {
421
+ const { token } = auth.data[a.key];
422
+ if (token === undefined) {
423
+ otherHeaders.push({
424
+ key: "Authorization",
425
+ value: "Bearer <TOKEN>",
426
+ });
427
+ continue;
428
+ }
429
+ otherHeaders.push({
430
+ key: "Authorization",
431
+ value: `Bearer ${token}`,
432
+ });
433
+ continue;
434
+ }
435
+ if (a.type === "oauth2") {
436
+ let token;
437
+ if (auth.data[a.key]) {
438
+ token = auth.data[a.key].token;
439
+ }
440
+ if (token === undefined) {
441
+ otherHeaders.push({
442
+ key: "Authorization",
443
+ value: "Bearer <TOKEN>",
444
+ });
445
+ continue;
446
+ }
447
+ otherHeaders.push({
448
+ key: "Authorization",
449
+ value: `Bearer ${token}`,
450
+ });
451
+ continue;
452
+ }
453
+ // Basic Auth
454
+ if (a.type === "http" && a.scheme === "basic") {
455
+ const { username, password } = auth.data[a.key];
456
+ if (username === undefined || password === undefined) {
457
+ continue;
458
+ }
459
+ otherHeaders.push({
460
+ key: "Authorization",
461
+ value: `Basic ${window.btoa(`${username}:${password}`)}`,
462
+ });
463
+ continue;
464
+ }
465
+ // API Key in header
466
+ if (a.type === "apiKey" && a.in === "header") {
467
+ const { apiKey } = auth.data[a.key];
468
+ otherHeaders.push({
469
+ key: a.name,
470
+ value: apiKey || `<${a.name ?? a.type}>`,
471
+ });
472
+ continue;
473
+ }
474
+ // API Key in query
475
+ if (a.type === "apiKey" && a.in === "query") {
476
+ const { apiKey } = auth.data[a.key];
477
+ enhancedQueryParams.push({
478
+ name: a.name,
479
+ in: "query",
480
+ value: apiKey || `<${a.name ?? a.type}>`,
481
+ });
482
+ continue;
483
+ }
484
+ // API Key in cookie
485
+ if (a.type === "apiKey" && a.in === "cookie") {
486
+ const { apiKey } = auth.data[a.key];
487
+ enhancedCookieParams.push({
488
+ name: a.name,
489
+ in: "cookie",
490
+ value: apiKey || `<${a.name ?? a.type}>`,
491
+ });
492
+ continue;
493
+ }
494
+ }
495
+ // Use the enhanced params that might include API keys
496
+ setQueryParams(clonedPostman, enhancedQueryParams);
497
+ setPathParams(clonedPostman, pathParams);
498
+ // Use enhanced cookie params that might include API keys
499
+ const cookie = buildCookie(enhancedCookieParams);
500
+ setHeaders(
501
+ clonedPostman,
502
+ contentType,
503
+ accept,
504
+ cookie,
505
+ headerParams,
506
+ otherHeaders
507
+ );
508
+ setBody(clonedPostman, body);
509
+ return clonedPostman;
510
+ }
511
+ exports.default = buildPostmanRequest;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { ApiItem } from "@camunda8/docusaurus-plugin-openapi-docs/src/types";
3
+ declare function ApiExplorer({ item, infoPath, }: {
4
+ item: NonNullable<ApiItem>;
5
+ infoPath: string;
6
+ }): React.JSX.Element;
7
+ export default ApiExplorer;
@@ -0,0 +1,107 @@
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
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
64
+ var __importDefault =
65
+ (this && this.__importDefault) ||
66
+ function (mod) {
67
+ return mod && mod.__esModule ? mod : { default: mod };
68
+ };
69
+ Object.defineProperty(exports, "__esModule", { value: true });
70
+ const react_1 = __importDefault(require("react"));
71
+ const client_1 = require("@docusaurus/plugin-content-docs/client");
72
+ const CodeSnippets_1 = __importDefault(
73
+ require("@theme/ApiExplorer/CodeSnippets")
74
+ );
75
+ const Request_1 = __importDefault(require("@theme/ApiExplorer/Request"));
76
+ const Response_1 = __importDefault(require("@theme/ApiExplorer/Response"));
77
+ const SecuritySchemes_1 = __importDefault(
78
+ require("@theme/ApiExplorer/SecuritySchemes")
79
+ );
80
+ const sdk = __importStar(require("postman-collection"));
81
+ function ApiExplorer({ item, infoPath }) {
82
+ const metadata = (0, client_1.useDoc)();
83
+ const { mask_credentials } = metadata.frontMatter;
84
+ const postman = new sdk.Request(
85
+ item.postman
86
+ ? sdk.Request.isRequest(item.postman)
87
+ ? item.postman.toJSON()
88
+ : item.postman
89
+ : {}
90
+ );
91
+ return react_1.default.createElement(
92
+ react_1.default.Fragment,
93
+ null,
94
+ react_1.default.createElement(SecuritySchemes_1.default, {
95
+ infoPath: infoPath,
96
+ }),
97
+ item.method !== "event" &&
98
+ react_1.default.createElement(CodeSnippets_1.default, {
99
+ postman: postman,
100
+ codeSamples: item["x-codeSamples"] ?? [],
101
+ maskCredentials: mask_credentials,
102
+ }),
103
+ react_1.default.createElement(Request_1.default, { item: item }),
104
+ react_1.default.createElement(Response_1.default, { item: item })
105
+ );
106
+ }
107
+ exports.default = ApiExplorer;
@@ -0,0 +1,19 @@
1
+ import { Middleware } from "@reduxjs/toolkit";
2
+ import { ThemeConfig } from "@camunda8/docusaurus-theme-openapi-docs/src/types";
3
+ export declare function createPersistanceMiddleware(options: ThemeConfig["api"]): Middleware<{}, {
4
+ accept: import("./Accept/slice").State;
5
+ contentType: import("./ContentType/slice").State;
6
+ response: import("./Response/slice").State;
7
+ server: import("./Server/slice").State;
8
+ body: import("./Body/slice").FormBody | import("./Body/slice").RawBody | import("./Body/slice").EmptyBody;
9
+ params: import("./ParamOptions/slice").State;
10
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
11
+ }, import("redux-thunk").ThunkDispatch<{
12
+ accept: import("./Accept/slice").State;
13
+ contentType: import("./ContentType/slice").State;
14
+ response: import("./Response/slice").State;
15
+ server: import("./Server/slice").State;
16
+ body: import("./Body/slice").FormBody | import("./Body/slice").RawBody | import("./Body/slice").EmptyBody;
17
+ params: import("./ParamOptions/slice").State;
18
+ auth: import("@theme/ApiExplorer/Authorization/slice").AuthState;
19
+ }, undefined, import("redux").UnknownAction> & import("redux").Dispatch<import("redux").UnknownAction>>;
@@ -0,0 +1,54 @@
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.createPersistanceMiddleware = createPersistanceMiddleware;
10
+ const slice_1 = require("@theme/ApiExplorer/Authorization/slice");
11
+ const storage_utils_1 = require("./storage-utils");
12
+ function createPersistanceMiddleware(options) {
13
+ const persistanceMiddleware = (storeAPI) => (next) => (action) => {
14
+ const result = next(action);
15
+ const state = storeAPI.getState();
16
+ const storage = (0, storage_utils_1.createStorage)("sessionStorage");
17
+ if (action.type === slice_1.setAuthData.type) {
18
+ for (const [key, value] of Object.entries(state.auth.data)) {
19
+ if (Object.values(value).filter(Boolean).length > 0) {
20
+ storage.setItem(key, JSON.stringify(value));
21
+ } else {
22
+ storage.removeItem(key);
23
+ }
24
+ }
25
+ }
26
+ if (action.type === slice_1.setSelectedAuth.type) {
27
+ if (state.auth.selected) {
28
+ storage.setItem(
29
+ (0, storage_utils_1.hashArray)(Object.keys(state.auth.options)),
30
+ state.auth.selected
31
+ );
32
+ }
33
+ }
34
+ // TODO: determine way to rehydrate without flashing
35
+ if (action.type === "contentType/setContentType") {
36
+ storage.setItem("contentType", action.payload);
37
+ }
38
+ if (action.type === "accept/setAccept") {
39
+ storage.setItem("accept", action.payload);
40
+ }
41
+ if (action.type === "server/setServer") {
42
+ storage.setItem("server", action.payload);
43
+ }
44
+ if (action.type === "server/setServerVariable") {
45
+ const server = storage.getItem("server") ?? "{}";
46
+ const variables = JSON.parse(action.payload);
47
+ let serverObject = JSON.parse(server);
48
+ serverObject.variables[variables.key].default = variables.value;
49
+ storage.setItem("server", JSON.stringify(serverObject));
50
+ }
51
+ return result;
52
+ };
53
+ return persistanceMiddleware;
54
+ }
@@ -0,0 +1,4 @@
1
+ export declare function hashArray(arr: string[]): string;
2
+ type Persistance = false | "localStorage" | "sessionStorage" | undefined;
3
+ export declare function createStorage(persistance: Persistance): Storage;
4
+ export {};