@scalar/api-client 2.15.0 → 2.17.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 (271) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/dist/hooks/useResponseBody.js +6 -6
  3. package/dist/libs/errors.d.ts +1 -0
  4. package/dist/libs/errors.d.ts.map +1 -1
  5. package/dist/libs/errors.js +1 -0
  6. package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
  7. package/dist/libs/send-request/create-request-operation.js +41 -35
  8. package/dist/style.css +1 -1
  9. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +28 -38
  10. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +84 -45
  12. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -11
  13. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  15. package/dist/v2/blocks/operation-block/components/Header.vue2.js +28 -35
  16. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +10 -0
  17. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -0
  18. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +22 -0
  19. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +31 -0
  20. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -0
  21. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +31 -0
  22. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +3 -9
  23. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
  24. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +56 -0
  25. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +10 -3
  26. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
  27. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +46 -0
  28. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +45 -0
  29. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -0
  30. package/dist/v2/blocks/operation-block/helpers/build-request.js +66 -0
  31. package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +9 -0
  32. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts +16 -0
  33. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts.map +1 -0
  34. package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js +4 -0
  35. package/dist/v2/blocks/operation-block/helpers/get-delimiter.js +17 -0
  36. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +9 -3
  37. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  38. package/dist/v2/blocks/operation-block/helpers/get-example.js +21 -0
  39. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +53 -0
  40. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -0
  41. package/dist/v2/blocks/operation-block/helpers/send-request.js +120 -0
  42. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +1 -1
  43. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
  44. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  45. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  46. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +89 -110
  47. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +2 -2
  48. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -1
  49. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +8 -13
  50. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -1
  51. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +22 -28
  52. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +19 -8
  53. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  54. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +30 -24
  55. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +12 -0
  56. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts.map +1 -0
  57. package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js +20 -0
  58. package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts +10 -0
  59. package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts.map +1 -0
  60. package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js +4 -0
  61. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +14 -12
  62. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
  63. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +191 -169
  64. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  65. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +10 -10
  66. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +2 -1
  67. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  68. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +15 -19
  69. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +2 -2
  70. package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -1
  71. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
  72. package/dist/v2/blocks/operation-code-sample/types.d.ts +16 -0
  73. package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -1
  74. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +15 -10
  75. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  76. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  77. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +158 -125
  78. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  80. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +59 -50
  81. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +8 -0
  82. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -0
  83. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +127 -0
  84. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue2.js +4 -0
  85. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  86. package/dist/v2/blocks/request-block/components/RequestParams.vue.js +24 -23
  87. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +1 -0
  88. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  89. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +148 -149
  90. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts +1 -0
  91. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
  92. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js +1 -1
  93. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue2.js +28 -27
  94. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +3 -2
  95. package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +1 -1
  96. package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +13 -3
  97. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +4 -4
  98. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  99. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +3 -3
  100. package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +41 -45
  101. package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
  102. package/dist/v2/blocks/response-block/components/Headers.vue.js +27 -27
  103. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js +1 -1
  104. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts +18 -0
  105. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts.map +1 -0
  106. package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js +12 -0
  107. package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -2
  108. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +0 -2
  109. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  110. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  111. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +97 -87
  112. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts +19 -0
  113. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts.map +1 -0
  114. package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +24 -0
  115. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +3 -2
  116. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  117. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +59 -56
  118. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
  119. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  120. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +3 -1
  121. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  122. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +26 -24
  123. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +2 -1
  124. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  125. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +44 -43
  126. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +4 -0
  127. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +1 -0
  128. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +7 -0
  129. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +4 -4
  130. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  131. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -2
  132. package/dist/v2/components/code-input/CodeInput.vue.d.ts +7 -6
  133. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  134. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  135. package/dist/v2/components/code-input/CodeInput.vue2.js +61 -59
  136. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +2 -2
  137. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  138. package/dist/v2/components/data-table/DataTableInputSelect.vue.js +44 -44
  139. package/dist/v2/components/resize/index.d.ts +0 -1
  140. package/dist/v2/components/resize/index.d.ts.map +1 -1
  141. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -5
  142. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  143. package/dist/v2/components/sidebar/Sidebar.vue.js +49 -47
  144. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +1 -1
  145. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  146. package/dist/v2/features/app/App.vue.d.ts +3 -0
  147. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  148. package/dist/v2/features/app/App.vue.js +128 -139
  149. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +3 -3
  150. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  151. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  152. package/dist/v2/features/app/components/AppSidebar.vue2.js +137 -105
  153. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +1 -1
  154. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  155. package/dist/v2/features/app/components/{ItemDecorator.vue.d.ts → SidebarItemMenu.vue.d.ts} +1 -1
  156. package/dist/v2/features/app/components/SidebarItemMenu.vue.d.ts.map +1 -0
  157. package/dist/v2/features/app/components/SidebarItemMenu.vue.js +129 -0
  158. package/dist/v2/features/app/components/SidebarItemMenu.vue2.js +4 -0
  159. package/dist/v2/features/app/components/WebTopNav.vue.d.ts +1 -1
  160. package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
  161. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +2 -2
  162. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  163. package/dist/v2/features/app/helpers/create-api-client-app.js +8 -8
  164. package/dist/v2/features/app/helpers/routes.d.ts +32 -6
  165. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  166. package/dist/v2/features/app/helpers/routes.js +25 -16
  167. package/dist/v2/{hooks/use-sidebar-state.d.ts → features/app/hooks/use-app-sidebar.d.ts} +10 -11
  168. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +1 -0
  169. package/dist/v2/{hooks/use-sidebar-state.js → features/app/hooks/use-app-sidebar.js} +19 -19
  170. package/dist/v2/features/app/hooks/use-document-watcher.d.ts.map +1 -0
  171. package/dist/v2/{hooks → features/app/hooks}/use-sync-path.d.ts +2 -2
  172. package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +1 -0
  173. package/dist/v2/features/app/hooks/use-sync-path.js +52 -0
  174. package/dist/v2/{hooks → features/app/hooks}/use-tabs.d.ts +2 -2
  175. package/dist/v2/features/app/hooks/use-tabs.d.ts.map +1 -0
  176. package/dist/v2/{hooks → features/app/hooks}/use-tabs.js +1 -1
  177. package/dist/v2/{hooks/use-workspace-client-events.d.ts → features/app/hooks/use-workspace-client-app-events.d.ts} +5 -5
  178. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -0
  179. package/dist/v2/{hooks/use-workspace-client-events.js → features/app/hooks/use-workspace-client-app-events.js} +48 -45
  180. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +1 -0
  181. package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.js +1 -1
  182. package/dist/v2/features/collection/DocumentCollection.vue.js +92 -2
  183. package/dist/v2/features/collection/DocumentCollection.vue2.js +2 -91
  184. package/dist/v2/features/collection/WorkspaceCollection.vue.js +42 -2
  185. package/dist/v2/features/collection/WorkspaceCollection.vue2.js +2 -41
  186. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  187. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  188. package/dist/v2/features/collection/components/Authentication.vue2.js +14 -12
  189. package/dist/v2/features/collection/components/Cookies.vue.js +30 -1
  190. package/dist/v2/features/collection/components/Cookies.vue2.js +1 -29
  191. package/dist/v2/features/collection/components/Environment.vue.js +32 -1
  192. package/dist/v2/features/collection/components/Environment.vue2.js +1 -31
  193. package/dist/v2/features/collection/components/Overview.vue2.js +5 -4
  194. package/dist/v2/features/collection/components/Servers.vue.js +142 -2
  195. package/dist/v2/features/collection/components/Servers.vue2.js +2 -141
  196. package/dist/v2/features/collection/components/Settings.vue.js +58 -2
  197. package/dist/v2/features/collection/components/Settings.vue2.js +2 -57
  198. package/dist/v2/features/modal/Modal.vue.d.ts +23 -1
  199. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  200. package/dist/v2/features/modal/Modal.vue.js +1 -1
  201. package/dist/v2/features/modal/Modal.vue2.js +118 -31
  202. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +18 -32
  203. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  204. package/dist/v2/features/modal/helpers/create-api-client-modal.js +46 -26
  205. package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts +55 -0
  206. package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts.map +1 -0
  207. package/dist/v2/features/modal/helpers/resolve-route-parameters.js +29 -0
  208. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +42 -0
  209. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts.map +1 -0
  210. package/dist/v2/features/modal/hooks/use-modal-sidebar.js +93 -0
  211. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts +18 -0
  212. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -0
  213. package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +30 -0
  214. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  215. package/dist/v2/features/operation/Operation.vue.js +59 -28
  216. package/dist/v2/features/operation/helpers/get-operation-header.d.ts +17 -0
  217. package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +1 -0
  218. package/dist/v2/features/operation/helpers/get-operation-header.js +12 -0
  219. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
  220. package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
  221. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +7 -0
  222. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -0
  223. package/dist/v2/features/operation/helpers/get-selected-security.js +19 -0
  224. package/dist/v2/features/operation/index.d.ts +0 -1
  225. package/dist/v2/features/operation/index.d.ts.map +1 -1
  226. package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +1 -1
  227. package/dist/v2/features/search/components/SearchModal.vue.js +3 -3
  228. package/dist/v2/features/search/components/SearchModal.vue2.js +45 -44
  229. package/dist/v2/helpers/generate-location-id.d.ts +19 -0
  230. package/dist/v2/helpers/generate-location-id.d.ts.map +1 -0
  231. package/dist/v2/helpers/generate-location-id.js +10 -0
  232. package/dist/v2/helpers/get-active-environment.d.ts +5 -0
  233. package/dist/v2/helpers/get-active-environment.d.ts.map +1 -0
  234. package/dist/v2/helpers/get-active-environment.js +22 -0
  235. package/dist/v2/helpers/get-tab-details.d.ts +2 -2
  236. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
  237. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  238. package/dist/v2/helpers/plugins.d.ts +59 -0
  239. package/dist/v2/helpers/plugins.d.ts.map +1 -0
  240. package/dist/v2/helpers/plugins.js +11 -0
  241. package/dist/v2/hooks/use-scroll-lock.d.ts +28 -0
  242. package/dist/v2/hooks/use-scroll-lock.d.ts.map +1 -0
  243. package/dist/v2/hooks/use-scroll-lock.js +21 -0
  244. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +2 -0
  245. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
  246. package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +1 -1
  247. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +0 -1
  248. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -1
  249. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  250. package/package.json +20 -20
  251. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +0 -7
  252. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +0 -1
  253. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +0 -28
  254. package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts +0 -6
  255. package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts.map +0 -1
  256. package/dist/v2/blocks/request-block/helpers/get-parameter-example.js +0 -12
  257. package/dist/v2/features/app/components/ItemDecorator.vue.d.ts.map +0 -1
  258. package/dist/v2/features/app/components/ItemDecorator.vue.js +0 -138
  259. package/dist/v2/features/app/components/ItemDecorator.vue2.js +0 -4
  260. package/dist/v2/hooks/use-document-watcher.d.ts.map +0 -1
  261. package/dist/v2/hooks/use-sidebar-state.d.ts.map +0 -1
  262. package/dist/v2/hooks/use-sync-path.d.ts.map +0 -1
  263. package/dist/v2/hooks/use-sync-path.js +0 -51
  264. package/dist/v2/hooks/use-tabs.d.ts.map +0 -1
  265. package/dist/v2/hooks/use-workspace-client-events.d.ts.map +0 -1
  266. package/dist/v2/hooks/use-workspace-selector.d.ts.map +0 -1
  267. package/dist/v2/plugins.d.ts +0 -44
  268. package/dist/v2/plugins.d.ts.map +0 -1
  269. /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.d.ts +0 -0
  270. /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.js +0 -0
  271. /package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.d.ts +0 -0
@@ -1,21 +1,22 @@
1
- import { defineComponent as D, computed as n, ref as C, watch as N, useId as R, createBlock as i, createCommentVNode as f, openBlock as s, unref as o, withCtx as r, createVNode as u, createSlots as z, createElementVNode as g, createElementBlock as S, renderSlot as y, createTextVNode as K, toDisplayString as M } from "vue";
2
- import { ScalarCard as T, ScalarCardHeader as U, ScalarCombobox as A, ScalarButton as F, ScalarCardSection as q, ScalarCodeBlock as Z, ScalarVirtualText as G, ScalarCardFooter as J } from "@scalar/components";
3
- import { freezeElement as P } from "@scalar/helpers/dom/freeze-element";
4
- import { ScalarIconCaretDown as Q } from "@scalar/icons";
1
+ import { defineComponent as D, computed as a, ref as C, watch as I, useId as N, createBlock as i, createCommentVNode as f, openBlock as s, unref as o, withCtx as n, createVNode as r, createSlots as W, createElementVNode as b, createElementBlock as x, renderSlot as y, createTextVNode as R, toDisplayString as z } from "vue";
2
+ import { ScalarCard as S, ScalarCardHeader as U, ScalarCombobox as A, ScalarButton as F, ScalarCardSection as T, ScalarCodeBlock as M, ScalarVirtualText as K, ScalarCardFooter as Z } from "@scalar/components";
3
+ import { freezeElement as G } from "@scalar/helpers/dom/freeze-element";
4
+ import { ScalarIconCaretDown as J } from "@scalar/icons";
5
5
  import { emitCustomEvent as V } from "@scalar/workspace-store/events";
6
- import { getResolvedRef as X } from "@scalar/workspace-store/helpers/get-resolved-ref";
7
- import { operationToHar as Y } from "../helpers/operation-to-har/operation-to-har.js";
8
- import E from "./HttpMethod.vue.js";
9
- import { findClient as O } from "../helpers/find-client.js";
10
- import { generateCustomId as $ } from "../helpers/generate-client-options.js";
11
- import { generateCodeSnippet as _ } from "../helpers/generate-code-snippet.js";
12
- import { getSecrets as ee } from "../helpers/get-secrets.js";
6
+ import { getResolvedRef as P } from "@scalar/workspace-store/helpers/get-resolved-ref";
7
+ import { operationToHar as Q } from "../helpers/operation-to-har/operation-to-har.js";
8
+ import q from "./HttpMethod.vue.js";
9
+ import { findClient as $ } from "../helpers/find-client.js";
10
+ import { getClients as X } from "../helpers/get-clients.js";
11
+ import { getCustomCodeSamples as Y } from "../helpers/get-custom-code-samples.js";
12
+ import { getSecrets as _ } from "../helpers/get-secrets.js";
13
+ import { generateCodeSnippet as ee } from "../helpers/generate-code-snippet.js";
13
14
  import te from "./ExamplePicker.vue.js";
14
15
  const le = ["innerHTML"], oe = ["id"], ae = {
15
16
  key: 0,
16
17
  class: "request-card-footer-addon"
17
- }, ne = { class: "request-header" }, re = {}, Ce = /* @__PURE__ */ D({
18
- ...re,
18
+ }, ne = { class: "request-header" }, se = {}, ge = /* @__PURE__ */ D({
19
+ ...se,
19
20
  __name: "OperationCodeSample",
20
21
  props: {
21
22
  clientOptions: {},
@@ -31,99 +32,77 @@ const le = ["innerHTML"], oe = ["id"], ae = {
31
32
  generateLabel: { type: Function },
32
33
  isWebhook: { type: Boolean }
33
34
  },
34
- setup(l) {
35
- const d = n(() => {
36
- const e = X(l.operation.requestBody)?.content ?? {}, t = l.selectedContentType || Object.keys(e)[0];
37
- return t ? e[t]?.examples ?? {} : {};
35
+ setup(t) {
36
+ const d = a(() => {
37
+ const e = P(t.operation.requestBody)?.content ?? {}, l = t.selectedContentType || Object.keys(e)[0];
38
+ return l ? e[l]?.examples ?? {} : {};
38
39
  }), p = C(
39
- l.selectedExample ?? Object.keys(d.value)[0] ?? ""
40
- ), b = n(() => [
41
- "x-custom-examples",
42
- "x-codeSamples",
43
- "x-code-samples"
44
- ].flatMap((t) => l.operation[t] ?? [])), h = n(() => b.value.length ? [
45
- {
46
- label: "Code Examples",
47
- options: b.value.map((t) => {
48
- const a = $(t), k = t.label || t.lang || a;
49
- return {
50
- id: a,
51
- lang: t.lang || "plaintext",
52
- title: k,
53
- label: k
54
- };
55
- })
56
- },
57
- ...l.clientOptions
58
- ] : l.clientOptions), c = C(
59
- O(h.value, l.selectedClient)
40
+ t.selectedExample ?? Object.keys(d.value)[0] ?? ""
41
+ ), g = a(() => Y(t.operation)), h = a(
42
+ () => X(g.value, t.clientOptions)
43
+ ), u = C(
44
+ $(h.value, t.selectedClient)
60
45
  );
61
- N(
62
- () => l.selectedClient,
46
+ I(
47
+ () => t.selectedClient,
63
48
  (e) => {
64
- const t = O(h.value, e);
65
- t && (c.value = t);
49
+ const l = $(h.value, e);
50
+ l && (u.value = l);
66
51
  }
67
52
  );
68
- const x = n(() => {
69
- if (!l.isWebhook) return null;
53
+ const k = a(() => {
54
+ if (!t.isWebhook) return null;
70
55
  try {
71
- return Y({
72
- operation: l.operation,
73
- method: l.method,
74
- path: l.path,
56
+ return Q({
57
+ operation: t.operation,
58
+ method: t.method,
59
+ path: t.path,
75
60
  example: p.value
76
61
  });
77
62
  } catch (e) {
78
63
  return console.error("[webhookHar]", e), null;
79
64
  }
80
- }), v = n(() => {
81
- try {
82
- const e = c.value?.id;
83
- return e ? e.startsWith("custom") ? b.value.find(
84
- (t) => $(t) === c.value?.id
85
- )?.source ?? "Custom example not found" : l.isWebhook ? x.value?.postData?.text ?? "" : _({
86
- clientId: e,
87
- operation: l.operation,
88
- method: l.method,
89
- server: l.selectedServer,
90
- securitySchemes: l.securitySchemes,
91
- contentType: l.selectedContentType,
92
- path: l.path,
93
- example: p.value
94
- }) : "";
95
- } catch (e) {
96
- return console.error("[generateSnippet]", e), "";
97
- }
98
- }), B = n(() => l.isWebhook ? j.value : c.value?.lang), j = n(() => {
99
- if (!x.value?.postData) return "json";
100
- const e = x.value.postData.mimeType;
65
+ }), v = a(() => t.isWebhook ? k.value?.postData?.text ?? "" : ee({
66
+ clientId: u.value?.id,
67
+ customCodeSamples: g.value,
68
+ operation: t.operation,
69
+ method: t.method,
70
+ path: t.path,
71
+ contentType: t.selectedContentType,
72
+ server: t.selectedServer,
73
+ securitySchemes: t.securitySchemes,
74
+ example: p.value
75
+ })), B = a(() => t.isWebhook ? E.value : u.value?.lang), E = a(() => {
76
+ if (!k.value?.postData) return "json";
77
+ const e = k.value.postData.mimeType;
101
78
  return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
102
- }), w = n(() => ee(l.securitySchemes)), m = C(null), H = (e) => {
79
+ }), O = a(() => _(t.securitySchemes)), m = C(null), j = (e) => {
103
80
  if (m.value) {
104
- const t = P(m.value.$el);
81
+ const l = G(m.value.$el);
105
82
  setTimeout(() => {
106
- t();
83
+ l();
107
84
  }, 300);
108
85
  }
109
- c.value = e, e.id.startsWith("custom") || V(m.value?.$el, "scalar-update-selected-client", e.id);
110
- }, L = 2e4, I = n(() => (v.value.length ?? 0) > L), W = R();
111
- return (e, t) => v.value ? (s(), i(o(T), {
86
+ u.value = e, e.id.startsWith("custom") || V(m.value?.$el, "scalar-update-selected-client", e.id);
87
+ }, w = 2e4, H = a(
88
+ () => (v.value.length ?? 0) > w
89
+ ), L = N();
90
+ return (e, l) => v.value ? (s(), i(o(S), {
112
91
  key: 0,
113
92
  ref_key: "elem",
114
93
  ref: m,
115
94
  class: "request-card dark-mode"
116
95
  }, {
117
- default: r(() => [
118
- u(o(U), { class: "pr-2.5" }, z({
119
- default: r(() => [
120
- t[3] || (t[3] = g("span", { class: "sr-only" }, "Request Example for", -1)),
121
- u(E, {
96
+ default: n(() => [
97
+ r(o(U), { class: "pr-2.5" }, W({
98
+ default: n(() => [
99
+ l[3] || (l[3] = b("span", { class: "sr-only" }, "Request Example for", -1)),
100
+ r(q, {
122
101
  as: "span",
123
102
  class: "request-method",
124
103
  method: e.method
125
104
  }, null, 8, ["method"]),
126
- e.generateLabel ? (s(), S("span", {
105
+ e.generateLabel ? (s(), x("span", {
127
106
  key: 0,
128
107
  innerHTML: e.generateLabel()
129
108
  }, null, 8, le)) : f("", !0),
@@ -133,24 +112,24 @@ const le = ["innerHTML"], oe = ["id"], ae = {
133
112
  }, [
134
113
  !e.isWebhook && h.value.length ? {
135
114
  name: "actions",
136
- fn: r(() => [
137
- u(o(A), {
115
+ fn: n(() => [
116
+ r(o(A), {
138
117
  class: "max-h-80",
139
- modelValue: c.value,
118
+ modelValue: u.value,
140
119
  options: h.value,
141
120
  placement: "bottom-end",
142
121
  teleport: "",
143
- "onUpdate:modelValue": t[0] || (t[0] = (a) => H(a))
122
+ "onUpdate:modelValue": l[0] || (l[0] = (c) => j(c))
144
123
  }, {
145
- default: r(() => [
146
- u(o(F), {
124
+ default: n(() => [
125
+ r(o(F), {
147
126
  class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal",
148
127
  "data-testid": "client-picker",
149
128
  variant: "ghost"
150
129
  }, {
151
- default: r(() => [
152
- K(M(c.value?.title) + " ", 1),
153
- u(o(Q), {
130
+ default: n(() => [
131
+ R(z(u.value?.title) + " ", 1),
132
+ r(o(J), {
154
133
  class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
155
134
  weight: "bold"
156
135
  })
@@ -164,23 +143,23 @@ const le = ["innerHTML"], oe = ["id"], ae = {
164
143
  key: "0"
165
144
  } : void 0
166
145
  ]), 1024),
167
- u(o(q), { class: "request-editor-section custom-scroll p-0" }, {
168
- default: r(() => [
169
- g("div", {
170
- id: `${o(W)}-example`,
146
+ r(o(T), { class: "request-editor-section custom-scroll p-0" }, {
147
+ default: n(() => [
148
+ b("div", {
149
+ id: `${o(L)}-example`,
171
150
  class: "code-snippet"
172
151
  }, [
173
- I.value ? (s(), i(o(G), {
152
+ H.value ? (s(), i(o(K), {
174
153
  key: 1,
175
154
  containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen",
176
155
  contentClass: "language-plaintext whitespace-pre font-code text-base",
177
156
  lineHeight: 20,
178
157
  text: v.value
179
- }, null, 8, ["text"])) : (s(), i(o(Z), {
158
+ }, null, 8, ["text"])) : (s(), i(o(M), {
180
159
  key: 0,
181
160
  class: "bg-b-2 !min-h-full -outline-offset-2",
182
161
  content: v.value,
183
- hideCredentials: w.value,
162
+ hideCredentials: O.value,
184
163
  lang: B.value,
185
164
  lineNumbers: ""
186
165
  }, null, 8, ["content", "hideCredentials", "lang"]))
@@ -188,21 +167,21 @@ const le = ["innerHTML"], oe = ["id"], ae = {
188
167
  ]),
189
168
  _: 1
190
169
  }),
191
- Object.keys(d.value).length > 1 || e.$slots.footer ? (s(), i(o(J), {
170
+ Object.keys(d.value).length > 1 || e.$slots.footer ? (s(), i(o(Z), {
192
171
  key: 0,
193
172
  class: "request-card-footer bg-b-3"
194
173
  }, {
195
- default: r(() => [
196
- Object.keys(d.value).length > 1 ? (s(), S("div", ae, [
174
+ default: n(() => [
175
+ Object.keys(d.value).length > 1 ? (s(), x("div", ae, [
197
176
  Object.keys(d.value).length ? (s(), i(te, {
198
177
  key: 0,
199
178
  modelValue: p.value,
200
179
  "onUpdate:modelValue": [
201
- t[1] || (t[1] = (a) => p.value = a),
202
- t[2] || (t[2] = (a) => o(V)(
180
+ l[1] || (l[1] = (c) => p.value = c),
181
+ l[2] || (l[2] = (c) => o(V)(
203
182
  m.value?.$el,
204
183
  "scalar-update-selected-example",
205
- a
184
+ c
206
185
  ))
207
186
  ],
208
187
  examples: d.value
@@ -214,15 +193,15 @@ const le = ["innerHTML"], oe = ["id"], ae = {
214
193
  })) : f("", !0)
215
194
  ]),
216
195
  _: 3
217
- }, 512)) : e.fallback ? (s(), i(o(T), {
196
+ }, 512)) : e.fallback ? (s(), i(o(S), {
218
197
  key: 1,
219
198
  class: "request-card dark-mode"
220
199
  }, {
221
- default: r(() => [
222
- u(o(q), { class: "request-card-simple" }, {
223
- default: r(() => [
224
- g("div", ne, [
225
- u(E, {
200
+ default: n(() => [
201
+ r(o(T), { class: "request-card-simple" }, {
202
+ default: n(() => [
203
+ b("div", ne, [
204
+ r(q, {
226
205
  as: "span",
227
206
  class: "request-method",
228
207
  method: e.method
@@ -239,5 +218,5 @@ const le = ["innerHTML"], oe = ["id"], ae = {
239
218
  }
240
219
  });
241
220
  export {
242
- Ce as default
221
+ ge as default
243
222
  };
@@ -1,5 +1,5 @@
1
1
  import { type AvailableClients } from '@scalar/snippetz';
2
- import type { ClientOption, ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
2
+ import type { ClientOption, CustomClientOption, CustomClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
3
3
  export declare const DEFAULT_CLIENT = "shell/curl";
4
4
  /** Type guard to check if a string is a valid client id */
5
5
  export declare const isClient: (id: any) => id is AvailableClients[number];
@@ -37,5 +37,5 @@ export declare const isClient: (id: any) => id is AvailableClients[number];
37
37
  * // Returns: { id: 'js/fetch', label: 'Fetch API', lang: 'js' }
38
38
  * ```
39
39
  */
40
- export declare const findClient: (clientGroups: ClientOptionGroup[], clientId?: AvailableClients[number] | undefined) => ClientOption | undefined;
40
+ export declare const findClient: (clientGroups: CustomClientOptionGroup[], clientId?: AvailableClients[number] | undefined) => ClientOption | CustomClientOption | undefined;
41
41
  //# sourceMappingURL=find-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-client.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/find-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAE9F,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,GAAI,IAAI,GAAG,KAAG,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAmC,CAAA;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,iBAAiB,EAAE,EACjC,WAAW,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,KAC9C,YAAY,GAAG,SAwBjB,CAAA"}
1
+ {"version":3,"file":"find-client.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/find-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAA;AAExH,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,GAAI,IAAI,GAAG,KAAG,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAmC,CAAA;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,uBAAuB,EAAE,EACvC,WAAW,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,KAC9C,YAAY,GAAG,kBAAkB,GAAG,SAwBtC,CAAA"}
@@ -1,20 +1,15 @@
1
- import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
1
+ import { type AvailableClients } from '@scalar/snippetz';
2
2
  import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
3
3
  import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
4
+ /** Type of custom code sample IDs */
5
+ export type CustomCodeSampleId = `custom/${string}`;
4
6
  /** Helper to generate an ID for custom code samples */
5
- export declare const generateCustomId: (example: XCodeSample) => string;
7
+ export declare const generateCustomId: (example: XCodeSample) => CustomCodeSampleId;
6
8
  /**
7
- * Generates client options for the request example block by filtering and organizing
8
- * built-in snippets based on the hiddenClients configuration. This function creates
9
- * a structured list of available client options that can be used to generate code
10
- * examples for different programming languages and frameworks.
9
+ * Generate client options for the request example block by filtering by allowed clients
11
10
  *
12
- * The function filters built-in clients based on the hiddenClients parameter and
13
- * groups them by their category (e.g., JavaScript, Python, etc.). The hiddenClients
14
- * parameter supports multiple formats:
15
- * - boolean: true to hide all clients
16
- * - array: ['fetch', 'axios'] to hide specific clients across all categories
17
- * - object: { node: true, python: ['requests'] } to hide entire categories or specific clients within categories
11
+ * @param allowedClients - The list of allowed clients to include in the options
12
+ * @returns A list of client option groups
18
13
  */
19
- export declare const generateClientOptions: (hiddenClients: ApiReferenceConfiguration["hiddenClients"]) => ClientOptionGroup[];
14
+ export declare const generateClientOptions: (allowedClients?: AvailableClients) => ClientOptionGroup[];
20
15
  //# sourceMappingURL=generate-client-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-client-options.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-client-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AAGvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAEhF,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,WAA6B,CAAA;AAElF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAChC,eAAe,yBAAyB,CAAC,eAAe,CAAC,KACxD,iBAAiB,EAwDnB,CAAA"}
1
+ {"version":3,"file":"generate-client-options.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-client-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAY,MAAM,kBAAkB,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AAGvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAEhF,qCAAqC;AACrC,MAAM,MAAM,kBAAkB,GAAG,UAAU,MAAM,EAAE,CAAA;AAEnD,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,KAAG,kBAA8C,CAAA;AAEtG;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,iBAAgB,gBAAoC,KAAG,iBAAiB,EAsC7G,CAAA"}
@@ -1,33 +1,27 @@
1
- import { snippetz as l } from "@scalar/snippetz";
2
- import { capitalize as o } from "vue";
3
- const y = (t) => `custom/${t.lang}`, m = (t) => t === !0 ? [] : l().clients().flatMap((e) => {
4
- const n = e.clients.flatMap((r) => {
5
- const c = `${e.key}/${r.client}`;
6
- if (Array.isArray(t) && t.includes(r.client))
7
- return [];
8
- if (typeof t == "object" && t !== null) {
9
- const i = t[e.key];
10
- if (i === !0)
11
- return [];
12
- if (Array.isArray(i) && i.includes(r.client))
13
- return [];
14
- }
15
- return {
16
- id: c,
17
- lang: r.client === "curl" ? "curl" : e.key,
18
- title: `${o(e.title)} ${r.title}`,
19
- label: r.title,
20
- targetKey: e.key,
21
- targetTitle: e.title,
22
- clientKey: r.client
1
+ import { AVAILABLE_CLIENTS as o, snippetz as a } from "@scalar/snippetz";
2
+ import { capitalize as c } from "vue";
3
+ const y = (n) => `custom/${n.lang}`, $ = (n = o) => {
4
+ const s = new Set(n);
5
+ return a().clients().flatMap((t) => {
6
+ const l = t.clients.flatMap((e) => {
7
+ const i = `${t.key}/${e.client}`;
8
+ return s.has(i) ? {
9
+ id: i,
10
+ lang: e.client === "curl" ? "curl" : t.key,
11
+ title: `${c(t.title)} ${e.title}`,
12
+ label: e.title,
13
+ targetKey: t.key,
14
+ targetTitle: t.title,
15
+ clientKey: e.client
16
+ } : [];
17
+ });
18
+ return l.length === 0 ? [] : {
19
+ label: t.title,
20
+ options: l
23
21
  };
24
22
  });
25
- return n.length === 0 ? [] : {
26
- label: e.title,
27
- options: n
28
- };
29
- });
23
+ };
30
24
  export {
31
- m as generateClientOptions,
25
+ $ as generateClientOptions,
32
26
  y as generateCustomId
33
27
  };
@@ -1,17 +1,28 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
- import type { AvailableClients } from '@scalar/snippetz';
2
+ import type { AvailableClient } from '@scalar/snippetz';
3
+ import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
3
4
  import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
- type Props = {
5
- clientId: AvailableClients[number];
6
- operation: OperationObject;
5
+ import { type CustomCodeSampleId } from './generate-client-options.js';
6
+ export type GenerateCodeSnippetProps = {
7
+ /** The selected client/language for code generation (e.g., 'node/fetch') or a custom code sample ID. */
8
+ clientId: AvailableClient | CustomCodeSampleId | undefined;
9
+ /** The Content-Type header value for the request body (e.g., 'application/json'). */
10
+ contentType?: string | undefined;
11
+ /** Array of custom code samples defined in the OpenAPI x-codeSamples extension. */
12
+ customCodeSamples: XCodeSample[];
13
+ /** The specific example value to use when generating the code snippet. */
7
14
  example?: string | undefined;
15
+ /** The HTTP method for the operation (e.g., GET, POST, PUT). */
8
16
  method: HttpMethod;
17
+ /** The OpenAPI operation object containing request/response details. */
18
+ operation: OperationObject;
19
+ /** The API endpoint path (e.g., '/users/{id}'). */
9
20
  path: string;
10
- contentType?: string | undefined;
11
- server?: ServerObject | undefined;
21
+ /** Array of security schemes to apply to the request (e.g., API keys, OAuth). */
12
22
  securitySchemes?: SecuritySchemeObject[] | undefined;
23
+ /** The server object defining the base URL for the API request. */
24
+ server?: ServerObject | undefined;
13
25
  };
14
26
  /** Generate the code snippet for the selected example OR operation */
15
- export declare const generateCodeSnippet: ({ clientId, operation, method, path, example, contentType, server, securitySchemes, }: Props) => string;
16
- export {};
27
+ export declare const generateCodeSnippet: ({ clientId, customCodeSamples, operation, method, path, example, contentType, server, securitySchemes, }: GenerateCodeSnippetProps) => string;
17
28
  //# sourceMappingURL=generate-code-snippet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAA;AAC5E,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAClC,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACjC,eAAe,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAA;CACrD,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,GAAI,uFASjC,KAAK,KAAG,MAyBV,CAAA"}
1
+ {"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,2BAA2B,CAAA;AAErF,MAAM,MAAM,wBAAwB,GAAG;IACrC,wGAAwG;IACxG,QAAQ,EAAE,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAA;IAC1D,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,mFAAmF;IACnF,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,gEAAgE;IAChE,MAAM,EAAE,UAAU,CAAA;IAClB,wEAAwE;IACxE,SAAS,EAAE,eAAe,CAAA;IAC1B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,eAAe,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAA;IACpD,mEAAmE;IACnE,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,GAAI,0GAUjC,wBAAwB,KAAG,MAqC7B,CAAA"}
@@ -1,30 +1,36 @@
1
- import { operationToHar as m } from "./operation-to-har/operation-to-har.js";
2
- import { getSnippet as u } from "../../../../views/Components/CodeSnippet/helpers/get-snippet.js";
3
- const f = ({
4
- clientId: t,
5
- operation: o,
6
- method: n,
7
- path: p,
8
- example: i,
9
- contentType: a,
10
- server: s,
11
- securitySchemes: c
1
+ import { operationToHar as C } from "./operation-to-har/operation-to-har.js";
2
+ import { getSnippet as y } from "../../../../views/Components/CodeSnippet/helpers/get-snippet.js";
3
+ import { generateCustomId as S } from "./generate-client-options.js";
4
+ const E = ({
5
+ clientId: e,
6
+ customCodeSamples: o,
7
+ operation: n,
8
+ method: p,
9
+ path: s,
10
+ example: a,
11
+ contentType: i,
12
+ server: g,
13
+ securitySchemes: m
12
14
  }) => {
13
15
  try {
14
- const e = m({
15
- operation: o,
16
- contentType: a,
17
- method: n,
18
- path: p,
19
- server: s,
20
- securitySchemes: c,
21
- example: i
22
- }), [g, d] = t.split("/"), [r, l] = u(g, d, e);
23
- return r ? (console.error("[generateCodeSnippet]", r), r.message ?? "Error generating code snippet") : l;
24
- } catch (e) {
25
- return console.error("[generateCodeSnippet]", e), "Error generating code snippet";
16
+ if (!e)
17
+ return "";
18
+ if (e.startsWith("custom"))
19
+ return o.find((d) => S(d) === e)?.source ?? "Custom example not found";
20
+ const r = C({
21
+ operation: n,
22
+ contentType: i,
23
+ method: p,
24
+ path: s,
25
+ server: g,
26
+ securitySchemes: m,
27
+ example: a
28
+ }), [u, c] = e.split("/"), [t, f] = y(u, c, r);
29
+ return t ? (console.error("[generateCodeSnippet]", t), t.message ?? "Error generating code snippet") : f;
30
+ } catch (r) {
31
+ return console.error("[generateCodeSnippet]", r), "Error generating code snippet";
26
32
  }
27
33
  };
28
34
  export {
29
- f as generateCodeSnippet
35
+ E as generateCodeSnippet
30
36
  };
@@ -0,0 +1,12 @@
1
+ import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
2
+ import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/index.js';
3
+ import type { CustomClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
4
+ /**
5
+ * Merges custom code samples with the client options
6
+ *
7
+ * @param customCodeSamples - The custom code samples from the operation to merge with the client options
8
+ * @param clientOptions - The client options to merge with the custom code samples
9
+ * @returns A list of client option groups
10
+ */
11
+ export declare const getClients: (customCodeSamples: XCodeSample[], clientOptions: ClientOptionGroup[]) => CustomClientOptionGroup[];
12
+ //# sourceMappingURL=get-clients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-clients.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/get-clients.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AAEvF,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,mCAAmC,CAAA;AAE9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAA;AAEtF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,mBAAmB,WAAW,EAAE,EAChC,eAAe,iBAAiB,EAAE,KACjC,uBAAuB,EA2BzB,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { generateCustomId as i } from "./generate-client-options.js";
2
+ const a = (n, e) => n.length ? [
3
+ {
4
+ label: "Code Examples",
5
+ options: n.map((t) => {
6
+ const l = i(t), o = t.label || t.lang || l, r = t.lang || "plaintext";
7
+ return {
8
+ id: l,
9
+ lang: r,
10
+ title: o,
11
+ label: o,
12
+ clientKey: "custom"
13
+ };
14
+ })
15
+ },
16
+ ...e
17
+ ] : e;
18
+ export {
19
+ a as getClients
20
+ };
@@ -0,0 +1,10 @@
1
+ import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
2
+ import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ /**
4
+ * Grabs any custom code samples from the operation
5
+ *
6
+ * @param operation - The operation to get the custom code samples from
7
+ * @returns An array of custom code samples which exist in the operation
8
+ */
9
+ export declare const getCustomCodeSamples: (operation: OperationObject) => XCodeSample[];
10
+ //# sourceMappingURL=get-custom-code-samples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-custom-code-samples.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,eAAe,KAAG,WAAW,EAG5E,CAAA"}
@@ -0,0 +1,4 @@
1
+ const t = (e) => ["x-custom-examples", "x-codeSamples", "x-code-samples"].flatMap((s) => e[s] ?? []);
2
+ export {
3
+ t as getCustomCodeSamples
4
+ };
@@ -1,4 +1,16 @@
1
1
  import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ type GetExampleFromSchemaOptions = {
3
+ /** Fallback string for empty string values. */
4
+ emptyString?: string;
5
+ /** Whether to use XML tag names as keys. */
6
+ xml?: boolean;
7
+ /** Whether to show read-only/write-only properties. */
8
+ mode?: 'read' | 'write';
9
+ /** Dynamic variables which can replace values via x-variable. */
10
+ variables?: Record<string, unknown>;
11
+ /** Whether to omit empty and optional properties. */
12
+ omitEmptyAndOptionalProperties?: boolean;
13
+ };
2
14
  /**
3
15
  * Generate an example value from a given OpenAPI SchemaObject.
4
16
  *
@@ -14,21 +26,11 @@ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/o
14
26
  * @param name - The name of the property being processed.
15
27
  * @returns An example value for the given schema.
16
28
  */
17
- export declare const getExampleFromSchema: (schema: SchemaObject, options?: {
18
- /** Fallback string for empty string values. */
19
- emptyString?: string;
20
- /** Whether to use XML tag names as keys. */
21
- xml?: boolean;
22
- /** Whether to show read-only/write-only properties. */
23
- mode?: "read" | "write";
24
- /** Dynamic variables which can replace values via x-variable. */
25
- variables?: Record<string, unknown>;
26
- /** Whether to omit empty and optional properties. */
27
- omitEmptyAndOptionalProperties?: boolean;
28
- }, args?: Partial<{
29
+ export declare const getExampleFromSchema: (schema: SchemaObject, options?: GetExampleFromSchemaOptions, { level, parentSchema, name, seen, }?: Partial<{
29
30
  level: number;
30
31
  parentSchema: SchemaObject;
31
32
  name: string;
32
33
  seen: WeakSet<object>;
33
34
  }>) => unknown;
35
+ export {};
34
36
  //# sourceMappingURL=get-example-from-schema.d.ts.map