@scalar/blocks 0.11.1 → 0.11.3

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 (325) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/code-example/components/AsyncApiCodeExample.vue.js +111 -6
  3. package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
  4. package/dist/code-example/components/AsyncApiCodeExample3.vue.js +8 -0
  5. package/dist/code-example/components/AsyncApiCodeExample3.vue.js.map +1 -0
  6. package/dist/code-example/components/CodeExample.vue.d.ts +10 -0
  7. package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
  8. package/dist/code-example/components/CodeExample.vue.js +297 -6
  9. package/dist/code-example/components/CodeExample.vue.js.map +1 -1
  10. package/dist/code-example/components/CodeExample3.vue.js +8 -0
  11. package/dist/code-example/components/CodeExample3.vue.js.map +1 -0
  12. package/dist/code-example/components/ExamplePicker.vue.d.ts +2 -0
  13. package/dist/code-example/components/ExamplePicker.vue.d.ts.map +1 -1
  14. package/dist/code-example/components/ExamplePicker.vue.js +50 -4
  15. package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
  16. package/dist/code-example/components/ExamplePicker2.vue.js +6 -0
  17. package/dist/code-example/components/ExamplePicker2.vue.js.map +1 -0
  18. package/dist/code-example/components/HttpMethod.vue.js +32 -4
  19. package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
  20. package/dist/code-example/components/HttpMethod2.vue.js +6 -0
  21. package/dist/code-example/components/HttpMethod2.vue.js.map +1 -0
  22. package/dist/code-example/helpers/filter-clients-by-query.js.map +1 -1
  23. package/dist/code-example/helpers/find-client.js.map +1 -1
  24. package/dist/code-example/helpers/format-language.js.map +1 -1
  25. package/dist/code-example/helpers/generate-client-options.js.map +1 -1
  26. package/dist/code-example/helpers/generate-code-snippet.d.ts +8 -2
  27. package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
  28. package/dist/code-example/helpers/generate-code-snippet.js +57 -27
  29. package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
  30. package/dist/code-example/helpers/get-asyncapi-example-context.js.map +1 -1
  31. package/dist/code-example/helpers/get-clients.js.map +1 -1
  32. package/dist/code-example/helpers/get-custom-code-samples.js.map +1 -1
  33. package/dist/code-example/helpers/get-generated-payload-example.js.map +1 -1
  34. package/dist/code-example/helpers/get-message-example-content.js.map +1 -1
  35. package/dist/code-example/helpers/get-secrets.js.map +1 -1
  36. package/dist/code-example/helpers/get-snippet.d.ts +2 -2
  37. package/dist/code-example/helpers/get-snippet.d.ts.map +1 -1
  38. package/dist/code-example/helpers/get-snippet.js +7 -9
  39. package/dist/code-example/helpers/get-snippet.js.map +1 -1
  40. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +1 -1
  41. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  42. package/dist/code-example/helpers/operation-to-har/operation-to-har.js +1 -1
  43. package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
  44. package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
  45. package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
  46. package/dist/code-example/helpers/operation-to-har/process-body.js +102 -81
  47. package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
  48. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  49. package/dist/code-example/helpers/operation-to-har/process-parameters.js +110 -108
  50. package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
  51. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +6 -6
  52. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
  53. package/dist/code-example/helpers/operation-to-har/process-server-url.js.map +1 -1
  54. package/dist/code-example/index.d.ts +1 -1
  55. package/dist/code-example/index.d.ts.map +1 -1
  56. package/dist/code-example/index.js +14 -14
  57. package/dist/code-example/mount-asyncapi.js +1 -1
  58. package/dist/code-example/mount-asyncapi.js.map +1 -1
  59. package/dist/code-example/mount.js +1 -1
  60. package/dist/code-example/mount.js.map +1 -1
  61. package/dist/constants.js +1 -1
  62. package/dist/schema/LinkButton.vue.js.map +1 -1
  63. package/dist/schema/RenderString.vue.js +11 -4
  64. package/dist/schema/RenderString.vue.js.map +1 -1
  65. package/dist/schema/RenderString2.vue.js +6 -0
  66. package/dist/schema/RenderString2.vue.js.map +1 -0
  67. package/dist/schema/Schema.vue.js +235 -6
  68. package/dist/schema/Schema.vue.js.map +1 -1
  69. package/dist/schema/Schema3.vue.js +8 -0
  70. package/dist/schema/Schema3.vue.js.map +1 -0
  71. package/dist/schema/SchemaCollapsedPreview.vue.js +25 -4
  72. package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
  73. package/dist/schema/SchemaCollapsedPreview2.vue.js +6 -0
  74. package/dist/schema/SchemaCollapsedPreview2.vue.js.map +1 -0
  75. package/dist/schema/SchemaComposition.vue.js +232 -6
  76. package/dist/schema/SchemaComposition.vue.js.map +1 -1
  77. package/dist/schema/SchemaComposition3.vue.js +8 -0
  78. package/dist/schema/SchemaComposition3.vue.js.map +1 -0
  79. package/dist/schema/SchemaEnumPropertyItem.vue.d.ts +1 -0
  80. package/dist/schema/SchemaEnumPropertyItem.vue.d.ts.map +1 -1
  81. package/dist/schema/SchemaEnumPropertyItem.vue.js +23 -4
  82. package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
  83. package/dist/schema/SchemaEnumPropertyItem2.vue.js +6 -0
  84. package/dist/schema/SchemaEnumPropertyItem2.vue.js.map +1 -0
  85. package/dist/schema/SchemaEnums.vue.d.ts.map +1 -1
  86. package/dist/schema/SchemaEnums.vue.js +74 -6
  87. package/dist/schema/SchemaEnums.vue.js.map +1 -1
  88. package/dist/schema/SchemaEnums3.vue.js +8 -0
  89. package/dist/schema/SchemaEnums3.vue.js.map +1 -0
  90. package/dist/schema/SchemaGlyphPuck.vue.js +27 -4
  91. package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
  92. package/dist/schema/SchemaGlyphPuck2.vue.js +6 -0
  93. package/dist/schema/SchemaGlyphPuck2.vue.js.map +1 -0
  94. package/dist/schema/SchemaGutterToggle.vue.js +40 -4
  95. package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
  96. package/dist/schema/SchemaGutterToggle2.vue.js +6 -0
  97. package/dist/schema/SchemaGutterToggle2.vue.js.map +1 -0
  98. package/dist/schema/SchemaHeading.vue.js +32 -6
  99. package/dist/schema/SchemaHeading.vue.js.map +1 -1
  100. package/dist/schema/SchemaHeading3.vue.js +8 -0
  101. package/dist/schema/SchemaHeading3.vue.js.map +1 -0
  102. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +42 -4
  103. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
  104. package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js +6 -0
  105. package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js.map +1 -0
  106. package/dist/schema/SchemaObjectProperties.vue.js +213 -4
  107. package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
  108. package/dist/schema/SchemaObjectProperties2.vue.js +6 -0
  109. package/dist/schema/SchemaObjectProperties2.vue.js.map +1 -0
  110. package/dist/schema/SchemaProperty.vue.d.ts +1 -1
  111. package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
  112. package/dist/schema/SchemaProperty.vue.js +472 -6
  113. package/dist/schema/SchemaProperty.vue.js.map +1 -1
  114. package/dist/schema/SchemaProperty3.vue.js +8 -0
  115. package/dist/schema/SchemaProperty3.vue.js.map +1 -0
  116. package/dist/schema/SchemaPropertyDefault.vue.js +61 -6
  117. package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
  118. package/dist/schema/SchemaPropertyDefault3.vue.js +8 -0
  119. package/dist/schema/SchemaPropertyDefault3.vue.js.map +1 -0
  120. package/dist/schema/SchemaPropertyDetail.vue.js +22 -6
  121. package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
  122. package/dist/schema/SchemaPropertyDetail3.vue.js +8 -0
  123. package/dist/schema/SchemaPropertyDetail3.vue.js.map +1 -0
  124. package/dist/schema/SchemaPropertyExamples.vue.js +133 -6
  125. package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
  126. package/dist/schema/SchemaPropertyExamples3.vue.js +8 -0
  127. package/dist/schema/SchemaPropertyExamples3.vue.js.map +1 -0
  128. package/dist/schema/SchemaPropertyHeading.vue.d.ts +1 -1
  129. package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  130. package/dist/schema/SchemaPropertyHeading.vue.js +312 -6
  131. package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
  132. package/dist/schema/SchemaPropertyHeading3.vue.js +8 -0
  133. package/dist/schema/SchemaPropertyHeading3.vue.js.map +1 -0
  134. package/dist/schema/SchemaPropertyPattern.vue.js +42 -6
  135. package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
  136. package/dist/schema/SchemaPropertyPattern3.vue.js +8 -0
  137. package/dist/schema/SchemaPropertyPattern3.vue.js.map +1 -0
  138. package/dist/schema/SchemaRailPanel.vue.js +53 -4
  139. package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
  140. package/dist/schema/SchemaRailPanel2.vue.js +6 -0
  141. package/dist/schema/SchemaRailPanel2.vue.js.map +1 -0
  142. package/dist/schema/components/CopyLinkButton.vue.d.ts +5 -0
  143. package/dist/schema/components/CopyLinkButton.vue.d.ts.map +1 -1
  144. package/dist/schema/components/CopyLinkButton.vue.js +24 -4
  145. package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
  146. package/dist/schema/components/CopyLinkButton2.vue.js +6 -0
  147. package/dist/schema/components/CopyLinkButton2.vue.js.map +1 -0
  148. package/dist/schema/components/WithBreadcrumb.vue.js +15 -4
  149. package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
  150. package/dist/schema/components/WithBreadcrumb2.vue.js +6 -0
  151. package/dist/schema/components/WithBreadcrumb2.vue.js.map +1 -0
  152. package/dist/schema/helpers/dynamic-scope.js.map +1 -1
  153. package/dist/schema/helpers/format-example.js.map +1 -1
  154. package/dist/schema/helpers/format-structured-value.d.ts +3 -0
  155. package/dist/schema/helpers/format-structured-value.d.ts.map +1 -0
  156. package/dist/schema/helpers/format-structured-value.js +6 -0
  157. package/dist/schema/helpers/format-structured-value.js.map +1 -0
  158. package/dist/schema/helpers/format-value.js.map +1 -1
  159. package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
  160. package/dist/schema/helpers/get-discriminator-values.js.map +1 -1
  161. package/dist/schema/helpers/get-enum-values.js.map +1 -1
  162. package/dist/schema/helpers/get-property-description.js.map +1 -1
  163. package/dist/schema/helpers/get-ref-name.js.map +1 -1
  164. package/dist/schema/helpers/get-rendered-example.js.map +1 -1
  165. package/dist/schema/helpers/get-schema-type.js.map +1 -1
  166. package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
  167. package/dist/schema/helpers/get-type-signature-tokens.js +37 -36
  168. package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
  169. package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
  170. package/dist/schema/helpers/is-empty-schema-object.js.map +1 -1
  171. package/dist/schema/helpers/is-model-linkable.js.map +1 -1
  172. package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -1
  173. package/dist/schema/helpers/is-type-object.js.map +1 -1
  174. package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
  175. package/dist/schema/helpers/normalize-object-composition.js.map +1 -1
  176. package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
  177. package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
  178. package/dist/schema/helpers/schema-cycle.js.map +1 -1
  179. package/dist/schema/helpers/schema-expansion.js.map +1 -1
  180. package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -1
  181. package/dist/schema/helpers/schema-name.js.map +1 -1
  182. package/dist/schema/helpers/should-display-description.js.map +1 -1
  183. package/dist/schema/helpers/should-display-heading.js.map +1 -1
  184. package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
  185. package/dist/schema/helpers/sort-property-names.js.map +1 -1
  186. package/dist/schema/helpers/unwrap-for-read.js.map +1 -1
  187. package/dist/schema/index.js +8 -8
  188. package/dist/schema/localization/index.d.ts +1 -1
  189. package/dist/schema/localization/index.js.map +1 -1
  190. package/dist/schema/localization/translations.js.map +1 -1
  191. package/dist/shared/Badge.vue.js +13 -6
  192. package/dist/shared/Badge.vue.js.map +1 -1
  193. package/dist/shared/Badge3.vue.js +8 -0
  194. package/dist/shared/Badge3.vue.js.map +1 -0
  195. package/dist/shared/ExternalDocs.vue.js +43 -4
  196. package/dist/shared/ExternalDocs.vue.js.map +1 -1
  197. package/dist/shared/ExternalDocs2.vue.js +6 -0
  198. package/dist/shared/ExternalDocs2.vue.js.map +1 -0
  199. package/dist/shared/ExternalExampleStatus.vue.d.ts +12 -0
  200. package/dist/shared/ExternalExampleStatus.vue.d.ts.map +1 -0
  201. package/dist/shared/ExternalExampleStatus.vue.js +26 -0
  202. package/dist/shared/ExternalExampleStatus.vue.js.map +1 -0
  203. package/dist/shared/ExternalExampleStatus2.vue.js +6 -0
  204. package/dist/shared/ExternalExampleStatus2.vue.js.map +1 -0
  205. package/dist/shared/ScreenReader.vue.js +16 -4
  206. package/dist/shared/ScreenReader.vue.js.map +1 -1
  207. package/dist/shared/ScreenReader2.vue.js +6 -0
  208. package/dist/shared/ScreenReader2.vue.js.map +1 -0
  209. package/dist/shared/external-example-localization/index.d.ts +4 -0
  210. package/dist/shared/external-example-localization/index.d.ts.map +1 -0
  211. package/dist/shared/external-example-localization/index.js +17 -0
  212. package/dist/shared/external-example-localization/index.js.map +1 -0
  213. package/dist/shared/external-example-localization/locales/ar.d.ts +8 -0
  214. package/dist/shared/external-example-localization/locales/ar.d.ts.map +1 -0
  215. package/dist/shared/external-example-localization/locales/ar.js +9 -0
  216. package/dist/shared/external-example-localization/locales/ar.js.map +1 -0
  217. package/dist/shared/external-example-localization/locales/de.d.ts +8 -0
  218. package/dist/shared/external-example-localization/locales/de.d.ts.map +1 -0
  219. package/dist/shared/external-example-localization/locales/de.js +9 -0
  220. package/dist/shared/external-example-localization/locales/de.js.map +1 -0
  221. package/dist/shared/external-example-localization/locales/en.d.ts +8 -0
  222. package/dist/shared/external-example-localization/locales/en.d.ts.map +1 -0
  223. package/dist/shared/external-example-localization/locales/en.js +9 -0
  224. package/dist/shared/external-example-localization/locales/en.js.map +1 -0
  225. package/dist/shared/external-example-localization/locales/es.d.ts +8 -0
  226. package/dist/shared/external-example-localization/locales/es.d.ts.map +1 -0
  227. package/dist/shared/external-example-localization/locales/es.js +9 -0
  228. package/dist/shared/external-example-localization/locales/es.js.map +1 -0
  229. package/dist/shared/external-example-localization/locales/fr.d.ts +8 -0
  230. package/dist/shared/external-example-localization/locales/fr.d.ts.map +1 -0
  231. package/dist/shared/external-example-localization/locales/fr.js +9 -0
  232. package/dist/shared/external-example-localization/locales/fr.js.map +1 -0
  233. package/dist/shared/external-example-localization/locales/pt.d.ts +8 -0
  234. package/dist/shared/external-example-localization/locales/pt.d.ts.map +1 -0
  235. package/dist/shared/external-example-localization/locales/pt.js +9 -0
  236. package/dist/shared/external-example-localization/locales/pt.js.map +1 -0
  237. package/dist/shared/external-example-localization/locales/ru.d.ts +8 -0
  238. package/dist/shared/external-example-localization/locales/ru.d.ts.map +1 -0
  239. package/dist/shared/external-example-localization/locales/ru.js +9 -0
  240. package/dist/shared/external-example-localization/locales/ru.js.map +1 -0
  241. package/dist/shared/external-example-localization/locales/zh-cn.d.ts +8 -0
  242. package/dist/shared/external-example-localization/locales/zh-cn.d.ts.map +1 -0
  243. package/dist/shared/external-example-localization/locales/zh-cn.js +9 -0
  244. package/dist/shared/external-example-localization/locales/zh-cn.js.map +1 -0
  245. package/dist/shared/external-example-localization/locales/zh-tw.d.ts +8 -0
  246. package/dist/shared/external-example-localization/locales/zh-tw.d.ts.map +1 -0
  247. package/dist/shared/external-example-localization/locales/zh-tw.js +9 -0
  248. package/dist/shared/external-example-localization/locales/zh-tw.js.map +1 -0
  249. package/dist/shared/external-example-localization/translations.d.ts +67 -0
  250. package/dist/shared/external-example-localization/translations.d.ts.map +1 -0
  251. package/dist/shared/external-example-localization/translations.js +24 -0
  252. package/dist/shared/external-example-localization/translations.js.map +1 -0
  253. package/dist/shared/index.d.ts +3 -0
  254. package/dist/shared/index.d.ts.map +1 -1
  255. package/dist/shared/index.js +6 -4
  256. package/dist/specification-extensions/ExtensionValue.vue.js +89 -4
  257. package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
  258. package/dist/specification-extensions/ExtensionValue2.vue.js +6 -0
  259. package/dist/specification-extensions/ExtensionValue2.vue.js.map +1 -0
  260. package/dist/specification-extensions/SpecificationExtensions.vue.js +76 -4
  261. package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
  262. package/dist/specification-extensions/SpecificationExtensions2.vue.js +6 -0
  263. package/dist/specification-extensions/SpecificationExtensions2.vue.js.map +1 -0
  264. package/dist/specification-extensions/index.js +1 -1
  265. package/dist/style.css +13 -9
  266. package/dist/vue-styles.css +1 -1
  267. package/package.json +18 -18
  268. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +0 -113
  269. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
  270. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +0 -275
  271. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
  272. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +0 -48
  273. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +0 -1
  274. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +0 -34
  275. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js.map +0 -1
  276. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +0 -13
  277. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js.map +0 -1
  278. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +0 -237
  279. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +0 -1
  280. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +0 -27
  281. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +0 -1
  282. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +0 -234
  283. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +0 -1
  284. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +0 -23
  285. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +0 -1
  286. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +0 -77
  287. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +0 -1
  288. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +0 -29
  289. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map +0 -1
  290. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +0 -42
  291. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map +0 -1
  292. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +0 -34
  293. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
  294. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +0 -44
  295. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +0 -1
  296. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +0 -215
  297. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +0 -1
  298. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +0 -469
  299. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +0 -1
  300. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +0 -63
  301. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +0 -1
  302. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +0 -24
  303. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +0 -1
  304. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +0 -135
  305. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +0 -1
  306. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +0 -314
  307. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
  308. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +0 -44
  309. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js.map +0 -1
  310. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +0 -55
  311. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +0 -1
  312. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +0 -25
  313. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map +0 -1
  314. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +0 -17
  315. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +0 -1
  316. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +0 -15
  317. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +0 -1
  318. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +0 -45
  319. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +0 -1
  320. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +0 -18
  321. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js.map +0 -1
  322. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +0 -91
  323. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +0 -1
  324. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +0 -78
  325. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"process-body.js","names":["buildFileParam","fileName","contentType","isBinarySchema","schema","getBinaryPlaceholderFileName","value","objectToFormParams","params","entries","obj","item","key","partEncoding","parentKey","encoding","isMultipart","restored","coerceLeafValueToSchemaType","resolveLeafSchema","arrayParts","serializeMultipartArray","part","hasFormStyle","explicitContentType","binaryPlaceholderFileName","styleParams","serializeFormPropertyWithEncoding","param","file","unpackProxyObject","nestedParams","processBody","_contentType","requestBody","harMimeType","formatBinaryFile","media","aspNetNaming","usesAspNetFormNaming","multipartNaming","needsMultipartEncoding","exampleName","example","body","buildRequestBody","requestBodyCompositionSelection","openapiVersion","jsonSchemaDialect","encoded","serializeMultipartBody","chunk","isFormData","isXmlMediaType","xmlExample","getExampleFromBody","selected","getExampleValue","getExample","explicitText","getExplicitExampleText","_example","exampleValue","getResolvedRef","mergeSiblingReferences","serializeStreamExample","mediaType","contentSchema","exampleSchema","snapshotSchema","isObjectSchema","name","property","resolved","resolve","isArraySchema","isFileSchema","binary","getStreamFormat","extractedExample","getExampleFromSchema"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"sourcesContent":["import { getStreamFormat } from '@scalar/helpers/http/is-streaming-content-type'\nimport { isXmlMediaType } from '@scalar/helpers/http/is-xml-media-type'\nimport { getExampleValue, getExplicitExampleText } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { serializeStreamExample } from '@scalar/workspace-store/helpers/serialize-stream-example'\nimport { snapshotSchema } from '@scalar/workspace-store/helpers/snapshot-schema'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n buildRequestBody,\n coerceLeafValueToSchemaType,\n getExample,\n getExampleFromBody,\n getExampleFromSchema,\n needsMultipartEncoding,\n resolveLeafSchema,\n serializeFormPropertyWithEncoding,\n serializeMultipartArray,\n serializeMultipartBody,\n usesAspNetFormNaming,\n} from '@scalar/workspace-store/request-example'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n MediaTypeObject,\n RequestBodyObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema, isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport type { Param, PostData } from 'har-format'\n\nimport type { OperationToHarProps } from './operation-to-har'\n\ntype ProcessBodyProps = Pick<\n OperationToHarProps,\n | 'multipartNaming'\n | 'contentType'\n | 'example'\n | 'requestBodyCompositionSelection'\n | 'openapiVersion'\n | 'jsonSchemaDialect'\n> & {\n requestBody: RequestBodyObject\n}\n\ntype MultipartEncodingMap = MediaTypeObject['encoding']\n\n/**\n * Builds a HAR param for an uploaded file. `fileName` is what snippet generators read to emit real\n * file handling (for example `files=` in Python or `new Blob` in fetch). `value` keeps the\n * `@filename` placeholder for consumers that only read the text value.\n */\nconst buildFileParam = (name: string, fileName: string, contentType?: string): Param => ({\n name,\n value: `@${fileName}`,\n fileName,\n ...(contentType ? { contentType } : {}),\n})\n\n/** True when the schema describes a binary file (`type: string, format: binary`). */\nconst isBinarySchema = (schema: SchemaObject | undefined): boolean =>\n !!schema && 'type' in schema && schema.type === 'string' && 'format' in schema && schema.format === 'binary'\n\n/**\n * Example generation turns a binary property into the `@filename` placeholder string.\n * Use the schema to tell that apart from a normal text field that happens to start with `@`.\n */\nconst getBinaryPlaceholderFileName = (value: unknown, schema: SchemaObject | undefined): string | undefined =>\n typeof value === 'string' && value.startsWith('@') && isBinarySchema(schema) ? value.slice(1) : undefined\n\n/**\n * Converts a form-data body into HAR `Param[]` entries for `multipart/form-data`\n * and `application/x-www-form-urlencoded` requests.\n *\n * Per OpenAPI 3.1.x Encoding Object, each property's serialization is governed\n * by an optional Encoding entry. When `style` / `explode` / `allowReserved` is\n * set, the value is serialized RFC6570-style and `contentType` is ignored.\n * Multipart arrays apply the encoding to each item and repeat the property name.\n * Object items default to JSON, and uploaded files retain their filename references.\n *\n * @param obj - The form-data payload, either an object keyed by property name\n * or a HAR-style `{ name, value, isDisabled }[]` array.\n * @param encoding - The `encoding` map from the Media Type Object, if any.\n * Used only at the top level (`parentKey` undefined).\n * @param parentKey - When set, we are flattening a nested object inside another\n * property; encoding is ignored and keys are joined with `.` (legacy default).\n * @param isMultipart - True for `multipart/form-data`. Gates the spec defaults\n * for object properties and array items. Urlencoded bodies retain their existing\n * serialization and flattening behavior.\n */\nconst objectToFormParams = (\n obj: object | { name: string; value: unknown; isDisabled: boolean }[],\n encoding?: MultipartEncodingMap,\n parentKey?: string,\n isMultipart = false,\n schema?: SchemaObject,\n): Param[] => {\n const params: Param[] = []\n\n /** Ensure we do not include disabled items */\n const entries: [string, unknown][] = Array.isArray(obj)\n ? obj.filter((item) => !item.isDisabled).map((item) => [String(item.name), item.value])\n : Object.entries(obj)\n\n for (const [key, value] of entries) {\n if (value === undefined || value === null) {\n continue\n }\n\n const partEncoding = parentKey ? undefined : encoding?.[key]\n\n if (isMultipart && !parentKey) {\n const restored = Array.isArray(obj) ? coerceLeafValueToSchemaType(value, resolveLeafSchema(schema, [key])) : value\n const arrayParts = serializeMultipartArray(key, Array.isArray(restored) ? restored : value, partEncoding)\n if (arrayParts) {\n for (const part of arrayParts) {\n if (part.value instanceof File) {\n params.push(buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type))\n continue\n }\n params.push({\n name: part.key,\n value: part.value,\n ...(part.contentType ? { contentType: part.contentType } : {}),\n })\n }\n continue\n }\n }\n /**\n * Per OpenAPI 3.1.1: when style, explode, or allowReserved is explicitly set on the\n * encoding entry, contentType (implicit or explicit) is ignored and the value is\n * serialized as if it were a query-style parameter.\n */\n const hasFormStyle =\n partEncoding &&\n (partEncoding.style !== undefined ||\n partEncoding.explode !== undefined ||\n partEncoding.allowReserved !== undefined)\n /**\n * Per OAS 3.1.x Encoding Object: `contentType` SHALL be ignored if the request body\n * media type is not a multipart. For `application/x-www-form-urlencoded` we still\n * honor `style`/`explode`/`allowReserved` (handled above), but a `contentType`-only\n * entry has no effect — values fall through to the dotted-key flattening default.\n */\n const explicitContentType = hasFormStyle || !isMultipart ? undefined : partEncoding?.contentType\n\n /**\n * When the encoding sets style/explode/allowReserved, serialize the value RFC6570-style\n * (bracket/exploded notation) and ignore contentType. See `serializeFormPropertyWithEncoding`\n * for the per-style rules; it returns null for primitives, Files, and arrays of Files, which\n * then fall through to the dedicated branches below. HAR represents multipart and urlencoded\n * the same way via `PostData.params`, so the resulting parts work for both.\n */\n const binaryPlaceholderFileName =\n isMultipart && !parentKey ? getBinaryPlaceholderFileName(value, resolveLeafSchema(schema, [key])) : undefined\n const styleParams = parentKey ? null : serializeFormPropertyWithEncoding(key, value, partEncoding)\n if (styleParams) {\n for (const param of styleParams) {\n params.push({ name: param.key, value: param.value })\n }\n } else if (value instanceof File) {\n /**\n * File values render as `@filename` references, the conventional cURL syntax for an\n * attached file. Picked up by snippet renderers downstream (e.g. `--form 'x=@file.png'`).\n */\n const file = unpackProxyObject(value)\n params.push(buildFileParam(key, file.name, explicitContentType ?? (isMultipart ? file.type : undefined)))\n } else if (binaryPlaceholderFileName !== undefined) {\n /** A binary property filled in by example generation, so it is a file and not a text field. */\n params.push(buildFileParam(key, binaryPlaceholderFileName, explicitContentType))\n } else if (explicitContentType && typeof value === 'object') {\n /**\n * Per OAS 3.1.x Encoding Object: an explicit `encoding[key].contentType` on a\n * complex value overrides the default and emits a single part containing the value\n * JSON-stringified into that media type. Only reachable when style/explode/allowReserved\n * are unset (otherwise contentType is ignored — see the style branch above).\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: explicitContentType,\n })\n } else if (isMultipart && !parentKey && !hasFormStyle && typeof value === 'object' && !Array.isArray(value)) {\n /**\n * Per OpenAPI 3.x: a top-level multipart property whose value is an object (and not a File)\n * defaults to a single part encoded as application/json, rather than being flattened\n * into multiple parts with dotted keys.\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: 'application/json',\n })\n } else if (Array.isArray(value)) {\n for (const item of value) {\n if (item instanceof File) {\n const file = unpackProxyObject(item)\n params.push(buildFileParam(key, file.name, isMultipart ? file.type : undefined))\n } else {\n params.push({ name: key, value: String(item) })\n }\n }\n } else if (typeof value === 'object') {\n /**\n * Legacy fallback: flatten nested objects into dotted-key parts. Reached when the\n * multipart JSON-default branches above don't apply — i.e. either inside a recursive\n * call (`parentKey` set) or on `application/x-www-form-urlencoded` bodies without an\n * explicit encoding entry. Strict OAS 3.1.x would use `style: form, explode: true` as\n * the urlencoded default (inner keys become top-level params); we keep dotted keys for\n * backwards compatibility with consumers that already parse this shape.\n */\n const nestedParams = objectToFormParams(value, undefined, key)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({\n name: key,\n value: String(value),\n ...(explicitContentType ? { contentType: explicitContentType } : {}),\n })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n * Returns undefined if no example is found\n */\nexport const processBody = ({\n requestBody,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n multipartNaming,\n}: ProcessBodyProps): PostData | undefined => {\n const _contentType = contentType || Object.keys(requestBody.content)[0] || ''\n /** Empty when \"Other\" is selected so snippets do not inject `Content-Type: other`. */\n const harMimeType = _contentType === 'other' ? '' : _contentType\n const formatBinaryFile = (file: File) => {\n const unwrappedFile = unpackProxyObject(file)\n return `@${unwrappedFile.name || 'filename'}`\n }\n const encoding = requestBody.content[_contentType]?.encoding\n\n const media = requestBody.content[_contentType]\n const aspNetNaming = usesAspNetFormNaming(_contentType, media, multipartNaming)\n if (media && (aspNetNaming || needsMultipartEncoding(_contentType, media))) {\n const exampleName = example ?? Object.keys(media.examples ?? {})[0] ?? 'default'\n const body = buildRequestBody(\n { ...requestBody, 'x-scalar-selected-content-type': { [exampleName]: _contentType } },\n exampleName,\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n { multipartNaming, aspNetFilePlaceholders: aspNetNaming && _contentType === 'multipart/form-data' },\n )\n if (aspNetNaming && body?.mode === 'urlencoded') {\n return { mimeType: harMimeType, params: body.value.map(({ key, value }) => ({ name: key, value })) }\n }\n if (aspNetNaming && body?.mode === 'formdata') {\n return {\n mimeType: harMimeType,\n params: body.value.flatMap((part): Param[] => {\n if (part.type === 'file') {\n return [buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type)]\n }\n if (part.type !== 'text') {\n return []\n }\n return [{ name: part.key, value: part.value, ...(part.contentType ? { contentType: part.contentType } : {}) }]\n }),\n }\n }\n if (body?.mode === 'multipart') {\n const encoded = serializeMultipartBody(body.value, body.contentType)\n return {\n mimeType: encoded.contentType,\n // HAR text cannot embed file bytes synchronously. Keep visible file placeholders.\n text: encoded.chunks\n .map((chunk) => {\n if (chunk instanceof File) {\n return formatBinaryFile(chunk)\n }\n return chunk instanceof Blob ? 'BINARY' : String(chunk)\n })\n .join(''),\n }\n }\n }\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Check if this is an XML content type\n if (isXmlMediaType(_contentType)) {\n const xmlExample = getExampleFromBody(\n requestBody,\n _contentType,\n example ?? '',\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n )\n return xmlExample ? { mimeType: harMimeType, text: xmlExample.value as string } : undefined\n }\n\n // Get the example value\n const selected = getExampleValue(getExample(requestBody, example, contentType))\n const explicitText = getExplicitExampleText(selected, _contentType)\n if (explicitText !== undefined) {\n return { mimeType: harMimeType, text: explicitText }\n }\n const _example = selected?.value\n\n // Return the provided top level example\n if (typeof _example !== 'undefined') {\n const exampleValue = _example !== null && typeof _example === 'object' ? unpackProxyObject(_example) : _example\n\n if (isFormData && typeof exampleValue === 'object' && exampleValue !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n exampleValue,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n getResolvedRef(requestBody.content[_contentType]?.schema, mergeSiblingReferences),\n ),\n }\n }\n\n if (exampleValue instanceof File) {\n return {\n mimeType: harMimeType,\n text: formatBinaryFile(exampleValue),\n }\n }\n\n return {\n mimeType: harMimeType,\n text:\n typeof exampleValue === 'string'\n ? exampleValue\n : (serializeStreamExample(exampleValue, _contentType, false) ?? JSON.stringify(exampleValue)),\n }\n }\n\n // Try to extract examples from the schema\n const mediaType = requestBody.content[_contentType]\n const contentSchema = getResolvedRef(mediaType?.schema ?? mediaType?.itemSchema)\n if (typeof contentSchema !== 'undefined') {\n const exampleSchema = snapshotSchema(contentSchema)\n if (_contentType === 'multipart/form-data' && isObjectSchema(exampleSchema)) {\n // Adapt upgraded upload fields only on the code example's private snapshot.\n // The generator already supports the legacy binary shape, including file arrays.\n for (const [name, property] of Object.entries(exampleSchema.properties ?? {})) {\n const resolved = resolve.schema(property)\n const file = resolved && isArraySchema(resolved) ? resolve.schema(resolved.items) : resolved\n if (\n file &&\n !('type' in file) &&\n !('properties' in file) &&\n !file.allOf &&\n !file.oneOf &&\n !file.anyOf &&\n !file.contentSchema &&\n isFileSchema(file, false)\n ) {\n const binary: SchemaObject = { ...file, type: 'string', format: 'binary' }\n exampleSchema.properties![name] =\n resolved && isArraySchema(resolved) ? { ...resolved, items: binary } : binary\n }\n }\n }\n // A migrated whole-body binary schema is empty. Do not infer files from\n // declared values, constraints, compositions, or schemas for individual stream items.\n const isEmptyBinaryBody =\n !isFormData &&\n mediaType?.schema !== undefined &&\n Object.keys(exampleSchema).every((key) => ['__scalar_', 'title', 'description'].includes(key)) &&\n !getStreamFormat(_contentType) &&\n isFileSchema(exampleSchema, false, _contentType)\n if (isEmptyBinaryBody) {\n return { mimeType: harMimeType, text: '@filename' }\n }\n const extractedExample = getExampleFromSchema(\n exampleSchema,\n {\n compositionSelection: requestBodyCompositionSelection,\n mode: 'write',\n openapiVersion,\n jsonSchemaDialect,\n binaryAsFile: _contentType === 'multipart/form-data',\n },\n {\n schemaPath: ['requestBody'],\n },\n )\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n extractedExample,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n contentSchema,\n ),\n }\n }\n\n return {\n mimeType: harMimeType,\n text:\n serializeStreamExample(extractedExample, _contentType, mediaType?.schema === undefined) ??\n (typeof extractedExample === 'string' ? extractedExample : JSON.stringify(extractedExample)),\n }\n }\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;AAmDA,IAAMA,KAAkB,GAAc,GAAkB,OAAiC;CACvF;CACA,OAAO,IAAIC;CACX;CACA,GAAIC,IAAc,EAAE,eAAY,IAAI,CAAC;AACvC,IAGMC,KAAkB,MACtB,CAAC,CAACC,KAAU,UAAUA,KAAUA,EAAO,SAAS,YAAY,YAAYA,KAAUA,EAAO,WAAW,UAMhGC,KAAgC,GAAgB,MACpD,OAAOC,KAAU,YAAYA,EAAM,WAAW,GAAG,KAAKH,EAAeC,CAAM,IAAIE,EAAM,MAAM,CAAC,IAAI,KAAA,GAsB5FC,KACJ,GACA,GACA,GACA,IAAc,IACd,MACY;CACZ,IAAMC,IAAkB,CAAC,GAGnBC,IAA+B,MAAM,QAAQC,CAAG,IAClDA,EAAI,QAAQ,MAAS,CAACC,EAAK,UAAU,CAAC,CAAC,KAAK,MAAS,CAA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}
1
+ {"version":3,"file":"process-body.js","names":["snapshotSchema","buildRequestBody","coerceLeafValueToSchemaType","getExample","getExampleFromBody","getExampleFromSchema","needsMultipartEncoding","resolveLeafSchema","serializeFormPropertyWithEncoding","serializeMultipartArray","serializeMultipartBody","usesAspNetFormNaming","isXmlMediaType","parseMimeType","getExampleValue","getExplicitExampleText","getResolvedRef","mergeSiblingReferences","getStreamFormat","isYamlMediaType","isFileSchema","serializeStreamExample","unpackProxyObject","resolve","isArraySchema","isObjectSchema","binarySchemaMetadata","buildFileParam","name","fileName","contentType","isBinarySchema","schema","getBinaryPlaceholderFileName","value","objectToFormParams","obj","encoding","parentKey","isMultipart","params","entries","item","key","partEncoding","restored","arrayParts","part","hasFormStyle","explicitContentType","binaryPlaceholderFileName","styleParams","param","file","nestedParams","processBody","requestBody","example","openapiVersion","jsonSchemaDialect","requestBodyCompositionSelection","multipartNaming","_contentType","harMimeType","getFileName","filePostData","media","aspNetNaming","exampleName","body","encoded","chunk","isFormData","xmlExample","selected","explicitText","_example","exampleValue","streamFormat","essence","isNonFormWholeBody","supportsRawBinaryMediaType","contentSchema","exampleSchema","property","resolved","binary","schemaPath","isWholeBody","extractedExample"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-body.ts"],"sourcesContent":["import { getStreamFormat } from '@scalar/helpers/http/is-streaming-content-type'\nimport { isXmlMediaType } from '@scalar/helpers/http/is-xml-media-type'\nimport { isYamlMediaType } from '@scalar/helpers/http/is-yaml-media-type'\nimport { parseMimeType } from '@scalar/helpers/http/mime-type'\nimport type { HarRequest } from '@scalar/types/snippetz'\nimport { getExampleValue, getExplicitExampleText } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { isFileSchema } from '@scalar/workspace-store/helpers/is-file-schema'\nimport { serializeStreamExample } from '@scalar/workspace-store/helpers/serialize-stream-example'\nimport { snapshotSchema } from '@scalar/workspace-store/helpers/snapshot-schema'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n buildRequestBody,\n coerceLeafValueToSchemaType,\n getExample,\n getExampleFromBody,\n getExampleFromSchema,\n needsMultipartEncoding,\n resolveLeafSchema,\n serializeFormPropertyWithEncoding,\n serializeMultipartArray,\n serializeMultipartBody,\n usesAspNetFormNaming,\n} from '@scalar/workspace-store/request-example'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n MediaTypeObject,\n RequestBodyObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema, isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport type { Param } from 'har-format'\n\nimport type { OperationToHarProps } from './operation-to-har'\n\n// These fields describe or identify a schema without applying assertions to the body.\nconst binarySchemaMetadata = new Set([\n '__scalar_',\n '$schema',\n '$id',\n '$anchor',\n '$dynamicAnchor',\n '$comment',\n '$defs',\n '$vocabulary',\n 'definitions',\n 'title',\n 'description',\n 'deprecated',\n 'readOnly',\n 'writeOnly',\n 'externalDocs',\n 'xml',\n])\n\ntype ProcessBodyProps = Pick<\n OperationToHarProps,\n | 'multipartNaming'\n | 'contentType'\n | 'example'\n | 'requestBodyCompositionSelection'\n | 'openapiVersion'\n | 'jsonSchemaDialect'\n> & {\n requestBody: RequestBodyObject\n}\n\ntype MultipartEncodingMap = MediaTypeObject['encoding']\n\n/**\n * Builds a HAR param for an uploaded file. `fileName` is what snippet generators read to emit real\n * file handling (for example `files=` in Python or `new Blob` in fetch). `value` keeps the\n * `@filename` placeholder for consumers that only read the text value.\n */\nconst buildFileParam = (name: string, fileName: string, contentType?: string): Param => ({\n name,\n value: `@${fileName}`,\n fileName,\n ...(contentType ? { contentType } : {}),\n})\n\n/** True when the schema describes a binary file (`type: string, format: binary`). */\nconst isBinarySchema = (schema: SchemaObject | undefined): boolean =>\n !!schema && 'type' in schema && schema.type === 'string' && 'format' in schema && schema.format === 'binary'\n\n/**\n * Example generation turns a binary property into the `@filename` placeholder string.\n * Use the schema to tell that apart from a normal text field that happens to start with `@`.\n */\nconst getBinaryPlaceholderFileName = (value: unknown, schema: SchemaObject | undefined): string | undefined =>\n typeof value === 'string' && value.startsWith('@') && isBinarySchema(schema) ? value.slice(1) : undefined\n\n/**\n * Converts a form-data body into HAR `Param[]` entries for `multipart/form-data`\n * and `application/x-www-form-urlencoded` requests.\n *\n * Per OpenAPI 3.1.x Encoding Object, each property's serialization is governed\n * by an optional Encoding entry. When `style` / `explode` / `allowReserved` is\n * set, the value is serialized RFC6570-style and `contentType` is ignored.\n * Multipart arrays apply the encoding to each item and repeat the property name.\n * Object items default to JSON, and uploaded files retain their filename references.\n *\n * @param obj - The form-data payload, either an object keyed by property name\n * or a HAR-style `{ name, value, isDisabled }[]` array.\n * @param encoding - The `encoding` map from the Media Type Object, if any.\n * Used only at the top level (`parentKey` undefined).\n * @param parentKey - When set, we are flattening a nested object inside another\n * property; encoding is ignored and keys are joined with `.` (legacy default).\n * @param isMultipart - True for `multipart/form-data`. Gates the spec defaults\n * for object properties and array items. Urlencoded bodies retain their existing\n * serialization and flattening behavior.\n */\nconst objectToFormParams = (\n obj: object | { name: string; value: unknown; isDisabled: boolean }[],\n encoding?: MultipartEncodingMap,\n parentKey?: string,\n isMultipart = false,\n schema?: SchemaObject,\n): Param[] => {\n const params: Param[] = []\n\n /** Ensure we do not include disabled items */\n const entries: [string, unknown][] = Array.isArray(obj)\n ? obj.filter((item) => !item.isDisabled).map((item) => [String(item.name), item.value])\n : Object.entries(obj)\n\n for (const [key, value] of entries) {\n if (value === undefined || value === null) {\n continue\n }\n\n const partEncoding = parentKey ? undefined : encoding?.[key]\n\n if (isMultipart && !parentKey) {\n const restored = Array.isArray(obj) ? coerceLeafValueToSchemaType(value, resolveLeafSchema(schema, [key])) : value\n const arrayParts = serializeMultipartArray(key, Array.isArray(restored) ? restored : value, partEncoding)\n if (arrayParts) {\n for (const part of arrayParts) {\n if (part.value instanceof File) {\n params.push(buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type))\n continue\n }\n params.push({\n name: part.key,\n value: part.value,\n ...(part.contentType ? { contentType: part.contentType } : {}),\n })\n }\n continue\n }\n }\n /**\n * Per OpenAPI 3.1.1: when style, explode, or allowReserved is explicitly set on the\n * encoding entry, contentType (implicit or explicit) is ignored and the value is\n * serialized as if it were a query-style parameter.\n */\n const hasFormStyle =\n partEncoding &&\n (partEncoding.style !== undefined ||\n partEncoding.explode !== undefined ||\n partEncoding.allowReserved !== undefined)\n /**\n * Per OAS 3.1.x Encoding Object: `contentType` SHALL be ignored if the request body\n * media type is not a multipart. For `application/x-www-form-urlencoded` we still\n * honor `style`/`explode`/`allowReserved` (handled above), but a `contentType`-only\n * entry has no effect — values fall through to the dotted-key flattening default.\n */\n const explicitContentType = hasFormStyle || !isMultipart ? undefined : partEncoding?.contentType\n\n /**\n * When the encoding sets style/explode/allowReserved, serialize the value RFC6570-style\n * (bracket/exploded notation) and ignore contentType. See `serializeFormPropertyWithEncoding`\n * for the per-style rules; it returns null for primitives, Files, and arrays of Files, which\n * then fall through to the dedicated branches below. HAR represents multipart and urlencoded\n * the same way via `PostData.params`, so the resulting parts work for both.\n */\n const binaryPlaceholderFileName =\n isMultipart && !parentKey ? getBinaryPlaceholderFileName(value, resolveLeafSchema(schema, [key])) : undefined\n const styleParams = parentKey ? null : serializeFormPropertyWithEncoding(key, value, partEncoding)\n if (styleParams) {\n for (const param of styleParams) {\n params.push({ name: param.key, value: param.value })\n }\n } else if (value instanceof File) {\n /**\n * File values render as `@filename` references, the conventional cURL syntax for an\n * attached file. Picked up by snippet renderers downstream (e.g. `--form 'x=@file.png'`).\n */\n const file = unpackProxyObject(value)\n params.push(buildFileParam(key, file.name, explicitContentType ?? (isMultipart ? file.type : undefined)))\n } else if (binaryPlaceholderFileName !== undefined) {\n /** A binary property filled in by example generation, so it is a file and not a text field. */\n params.push(buildFileParam(key, binaryPlaceholderFileName, explicitContentType))\n } else if (explicitContentType && typeof value === 'object') {\n /**\n * Per OAS 3.1.x Encoding Object: an explicit `encoding[key].contentType` on a\n * complex value overrides the default and emits a single part containing the value\n * JSON-stringified into that media type. Only reachable when style/explode/allowReserved\n * are unset (otherwise contentType is ignored — see the style branch above).\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: explicitContentType,\n })\n } else if (isMultipart && !parentKey && !hasFormStyle && typeof value === 'object' && !Array.isArray(value)) {\n /**\n * Per OpenAPI 3.x: a top-level multipart property whose value is an object (and not a File)\n * defaults to a single part encoded as application/json, rather than being flattened\n * into multiple parts with dotted keys.\n */\n params.push({\n name: key,\n value: JSON.stringify(unpackProxyObject(value)),\n contentType: 'application/json',\n })\n } else if (Array.isArray(value)) {\n for (const item of value) {\n if (item instanceof File) {\n const file = unpackProxyObject(item)\n params.push(buildFileParam(key, file.name, isMultipart ? file.type : undefined))\n } else {\n params.push({ name: key, value: String(item) })\n }\n }\n } else if (typeof value === 'object') {\n /**\n * Legacy fallback: flatten nested objects into dotted-key parts. Reached when the\n * multipart JSON-default branches above don't apply — i.e. either inside a recursive\n * call (`parentKey` set) or on `application/x-www-form-urlencoded` bodies without an\n * explicit encoding entry. Strict OAS 3.1.x would use `style: form, explode: true` as\n * the urlencoded default (inner keys become top-level params); we keep dotted keys for\n * backwards compatibility with consumers that already parse this shape.\n */\n const nestedParams = objectToFormParams(value, undefined, key)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({\n name: key,\n value: String(value),\n ...(explicitContentType ? { contentType: explicitContentType } : {}),\n })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n * Returns undefined if no example is found\n */\nexport const processBody = ({\n requestBody,\n contentType,\n example,\n openapiVersion,\n jsonSchemaDialect,\n requestBodyCompositionSelection,\n multipartNaming,\n}: ProcessBodyProps): HarRequest['postData'] => {\n const _contentType = contentType || Object.keys(requestBody.content)[0] || ''\n /** Empty when \"Other\" is selected so snippets do not inject `Content-Type: other`. */\n const harMimeType = _contentType === 'other' ? '' : _contentType\n const getFileName = (file: File): string => unpackProxyObject(file).name || 'filename'\n const filePostData = (fileName: string): HarRequest['postData'] => ({\n mimeType: harMimeType,\n text: `@${fileName}`,\n _fileName: fileName,\n })\n const encoding = requestBody.content[_contentType]?.encoding\n\n const media = requestBody.content[_contentType]\n const aspNetNaming = usesAspNetFormNaming(_contentType, media, multipartNaming)\n if (media && (aspNetNaming || needsMultipartEncoding(_contentType, media))) {\n const exampleName = example ?? Object.keys(media.examples ?? {})[0] ?? 'default'\n const body = buildRequestBody(\n { ...requestBody, 'x-scalar-selected-content-type': { [exampleName]: _contentType } },\n exampleName,\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n { multipartNaming, aspNetFilePlaceholders: aspNetNaming && _contentType === 'multipart/form-data' },\n )\n if (aspNetNaming && body?.mode === 'urlencoded') {\n return { mimeType: harMimeType, params: body.value.map(({ key, value }) => ({ name: key, value })) }\n }\n if (aspNetNaming && body?.mode === 'formdata') {\n return {\n mimeType: harMimeType,\n params: body.value.flatMap((part): Param[] => {\n if (part.type === 'file') {\n return [buildFileParam(part.key, part.value.name, part.contentType ?? part.value.type)]\n }\n if (part.type !== 'text') {\n return []\n }\n return [{ name: part.key, value: part.value, ...(part.contentType ? { contentType: part.contentType } : {}) }]\n }),\n }\n }\n if (body?.mode === 'multipart') {\n const encoded = serializeMultipartBody(body.value, body.contentType)\n return {\n mimeType: encoded.contentType,\n // HAR text cannot embed file bytes synchronously. Keep visible file placeholders.\n text: encoded.chunks\n .map((chunk) => {\n if (chunk instanceof File) {\n return `@${getFileName(chunk)}`\n }\n return chunk instanceof Blob ? 'BINARY' : String(chunk)\n })\n .join(''),\n }\n }\n }\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Check if this is an XML content type\n if (isXmlMediaType(_contentType)) {\n const xmlExample = getExampleFromBody(\n requestBody,\n _contentType,\n example ?? '',\n requestBodyCompositionSelection,\n openapiVersion,\n jsonSchemaDialect,\n )\n return xmlExample ? { mimeType: harMimeType, text: xmlExample.value as string } : undefined\n }\n\n // Get the example value\n const selected = getExampleValue(getExample(requestBody, example, contentType))\n const explicitText = getExplicitExampleText(selected, _contentType)\n if (explicitText !== undefined) {\n return { mimeType: harMimeType, text: explicitText }\n }\n const _example = selected?.value\n\n // Return the provided top level example\n if (typeof _example !== 'undefined') {\n const exampleValue = _example !== null && typeof _example === 'object' ? unpackProxyObject(_example) : _example\n\n if (isFormData && typeof exampleValue === 'object' && exampleValue !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n exampleValue,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n getResolvedRef(requestBody.content[_contentType]?.schema, mergeSiblingReferences),\n ),\n }\n }\n\n if (exampleValue instanceof File) {\n return filePostData(getFileName(exampleValue))\n }\n\n return {\n mimeType: harMimeType,\n text:\n typeof exampleValue === 'string'\n ? exampleValue\n : (serializeStreamExample(exampleValue, _contentType, false) ?? JSON.stringify(exampleValue)),\n }\n }\n\n // OpenAPI 3.1+ can describe a raw binary body using just its media type.\n const streamFormat = getStreamFormat(_contentType)\n const { essence } = parseMimeType(_contentType)\n const isNonFormWholeBody =\n !isFormData &&\n !streamFormat &&\n !isYamlMediaType(essence) &&\n !['application/x-www-form-urlencoded', 'application/edn', 'application/graphql', 'application/javascript'].includes(\n essence,\n )\n const supportsRawBinaryMediaType = openapiVersion === undefined || /^3\\.[1-9]\\d*(?:\\.|$)/.test(openapiVersion)\n if (\n media &&\n media.schema === undefined &&\n media.itemSchema === undefined &&\n supportsRawBinaryMediaType &&\n isNonFormWholeBody &&\n !essence.includes('*') &&\n isFileSchema({ __scalar_: '' }, false, _contentType)\n ) {\n return filePostData('filename')\n }\n\n const contentSchema = getResolvedRef(media?.schema ?? media?.itemSchema)\n if (typeof contentSchema !== 'undefined') {\n const exampleSchema = snapshotSchema(contentSchema)\n if (_contentType === 'multipart/form-data' && isObjectSchema(exampleSchema)) {\n // Adapt upgraded upload fields only on the code example's private snapshot.\n // The generator already supports the legacy binary shape, including file arrays.\n for (const [name, property] of Object.entries(exampleSchema.properties ?? {})) {\n const resolved = resolve.schema(property)\n const file = resolved && isArraySchema(resolved) ? resolve.schema(resolved.items) : resolved\n if (\n file &&\n !('type' in file) &&\n !('properties' in file) &&\n !file.allOf &&\n !file.oneOf &&\n !file.anyOf &&\n !file.contentSchema &&\n isFileSchema(file, false)\n ) {\n const binary: SchemaObject = { ...file, type: 'string', format: 'binary' }\n exampleSchema.properties![name] =\n resolved && isArraySchema(resolved) ? { ...resolved, items: binary } : binary\n }\n }\n }\n // A raw binary schema can omit its type and carry only annotations.\n // Any constraints or authored examples still go through schema example generation.\n const isMetadataOnlyBinaryBody =\n isNonFormWholeBody &&\n media?.schema !== undefined &&\n !exampleSchema.readOnly &&\n Object.keys(exampleSchema).every(\n (key) => binarySchemaMetadata.has(key) || (supportsRawBinaryMediaType && key === 'contentMediaType'),\n ) &&\n isFileSchema(exampleSchema, false, _contentType)\n if (isMetadataOnlyBinaryBody) {\n return filePostData('filename')\n }\n const schemaPath = ['requestBody']\n // A legacy mixed multipart schema can describe a file containing the complete payload.\n const isWholeBody = !streamFormat || (streamFormat === 'multipart' && media?.schema !== undefined)\n const extractedExample = getExampleFromSchema(\n exampleSchema,\n {\n compositionSelection: requestBodyCompositionSelection,\n mode: 'write',\n openapiVersion,\n jsonSchemaDialect,\n binaryAsFile: _contentType === 'multipart/form-data',\n generatedBinaryFilePath: !isFormData && isWholeBody ? schemaPath : undefined,\n },\n {\n schemaPath,\n },\n )\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: harMimeType,\n params: objectToFormParams(\n extractedExample,\n encoding,\n undefined,\n _contentType === 'multipart/form-data',\n contentSchema,\n ),\n }\n }\n\n if (extractedExample instanceof File) {\n return filePostData(getFileName(extractedExample))\n }\n\n return {\n mimeType: harMimeType,\n text:\n serializeStreamExample(extractedExample, _contentType, media?.schema === undefined) ??\n (typeof extractedExample === 'string' ? extractedExample : JSON.stringify(extractedExample)),\n }\n }\n }\n\n return undefined\n}\n"],"mappings":";;;;;;;;;;;;;;AAoCA,IAAM0B,oBAAuB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,GAqBKC,KAAkBC,GAAcC,GAAkBC,OAAiC;CACvFF;CACA,OAAO,IAAIC;CACXA;CACA,GAAIC,IAAc,EAAEA,eAAY,IAAI,CAAC;AACvC,IAGMC,KAAkBC,MACtB,CAAC,CAACA,KAAU,UAAUA,KAAUA,EAAO,SAAS,YAAY,YAAYA,KAAUA,EAAO,WAAW,UAMhGC,KAAgCC,GAAgBF,MACpD,OAAOE,KAAU,YAAYA,EAAM,WAAW,GAAG,KAAKH,EAAeC,CAAM,IAAIE,EAAM,MAAM,CAAC,IAAI,KAAA,GAsB5FC,KACJC,GACAC,GACAC,GACAC,IAAc,IACdP,MACY;CACZ,IAAMQ,IAAkB,CAAC,GAGnBC,IAA+B,MAAM,QAAQL,CAAG,IAClDA,EAAI,QAAQM,MAAS,CAACA,EAAK,UAAU,CAAC,CAAC,KAAKA,MAAS,CAAC,OAAOA,EAAK,IAAI,GAAGA,EAAK,KAAK,CAAC,IACpF,OAAO,QAAQN,CAAG;CAEtB,KAAK,IAAM,CAACO,GAAKT,MAAUO,GAAS;EAClC,IAAIP,KAAiC,MACnC;EAGF,IAAMU,IAAeN,IAAY,KAAA,IAAYD,IAAWM;EAExD,IAAIJ,KAAe,CAACD,GAAW;GAC7B,IAAMO,IAAW,MAAM,QAAQT,CAAG,IAAIlC,EAA4BgC,GAAO3B,EAAkByB,GAAQ,CAACW,CAAG,CAAC,CAAC,IAAIT,GACvGY,IAAarC,EAAwBkC,GAAK,MAAM,QAAQE,CAAQ,IAAIA,IAAWX,GAA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ApD,GACA,KAAA,GACAyB,MAAiB,uBACjBoB,CACF;EACF,IAGEO,aAA4B,OACvBxB,EAAaD,EAAYyB,CAAgB,CAAC,IAG5C;GACL,UAAU1B;GACV,MACE1C,EAAuBoE,GAAkB3B,GAAcI,GAAO,WAAW,KAAA,CAAS,MACjF,OAAOuB,KAAqB,WAAWA,IAAmB,KAAK,UAAUA,CAAgB;EAC9F;CAEJ;AAGF"}
@@ -1 +1 @@
1
- {"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AACpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,wFAAwF;AACxF,qBAAa,wBAAyB,SAAQ,KAAK;CAAG;AAEtD,KAAK,mBAAmB,GAAG;IACzB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,+EAA+E;IAC/E,qBAAqB,EAAE,OAAO,CAAA;CAC/B,CAAA;AAuGD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,0FAO/B;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IACzC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,gDAAgD;IAChD,eAAe,EAAE,OAAO,CAAA;IACxB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,KAAG,mBAkSH,CAAA"}
1
+ {"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../src/code-example/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AACpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,wFAAwF;AACxF,qBAAa,wBAAyB,SAAQ,KAAK;CAAG;AAEtD,KAAK,mBAAmB,GAAG;IACzB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,+EAA+E;IAC/E,qBAAqB,EAAE,OAAO,CAAA;CAC/B,CAAA;AA6GD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,0FAO/B;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IACzC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,gDAAgD;IAChD,eAAe,EAAE,OAAO,CAAA;IACxB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,KAAG,mBAkSH,CAAA"}
@@ -1,12 +1,13 @@
1
- import { deSerializeParameter as e, filterDisabledProperties as t, getExampleFromSchema as n, isParamDisabled as r, serializeContentValue as i, serializeCookieStyle as a, serializeDeepObjectStyle as o, serializeFormStyle as s, serializeFormStyleForCookies as c, serializePipeDelimitedStyle as l, serializeSimpleStyle as u, serializeSpaceDelimitedStyle as d } from "@scalar/workspace-store/request-example";
2
- import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
- import { getCookieSerializationError as p } from "@scalar/helpers/http/get-cookie-serialization-error";
4
- import { replacePathVariables as m } from "@scalar/helpers/regex/replace-variables";
5
- import { assertReservedPathUrl as h, hasPathDotSegment as g, includesUndefinedPathPrefix as _, serializePathParameter as v, serializeReservedPathParameter as y } from "@scalar/workspace-store/helpers/encode-path-parameter";
6
- import { getParameterExample as b } from "@scalar/workspace-store/helpers/get-parameter-example";
7
- import { getQuerystringParameter as x, serializeQuerystringParameter as S } from "@scalar/workspace-store/helpers/querystring-parameter";
1
+ import { deSerializeParameter as e, encodeReservedQueryValue as t, filterDisabledProperties as n, getExampleFromSchema as r, isParamDisabled as i, serializeContentValue as a, serializeCookieStyle as o, serializeDeepObjectStyle as s, serializeFormStyle as c, serializeFormStyleForCookies as l, serializePipeDelimitedStyle as u, serializeSimpleStyle as d, serializeSpaceDelimitedStyle as f } from "@scalar/workspace-store/request-example";
2
+ import { getResolvedRef as p } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { isVersionLessThan as m } from "@scalar/helpers/general/compare-versions";
4
+ import { getCookieSerializationError as h } from "@scalar/helpers/http/get-cookie-serialization-error";
5
+ import { replacePathVariables as g } from "@scalar/helpers/regex/replace-variables";
6
+ import { assertReservedPathUrl as _, hasPathDotSegment as v, includesUndefinedPathPrefix as y, serializePathParameter as b, serializeReservedPathParameter as x } from "@scalar/workspace-store/helpers/encode-path-parameter";
7
+ import { getParameterExample as S } from "@scalar/workspace-store/helpers/get-parameter-example";
8
+ import { getQuerystringParameter as C, serializeQuerystringParameter as w } from "@scalar/workspace-store/helpers/querystring-parameter";
8
9
  // src/code-example/helpers/operation-to-har/process-parameters.ts
9
- var C = class extends Error {}, w = (e) => (e ?? []).map((e) => f(e)).filter((e) => e !== void 0), T = (e) => "allowReserved" in e && e.allowReserved !== void 0 ? e.allowReserved : "schema" in e && e.schema && typeof e.schema == "object" && "allowReserved" in e.schema ? e.schema.allowReserved === !0 : !1, E = (e) => {
10
+ var T = class extends Error {}, E = (e) => (e ?? []).map((e) => p(e)).filter((e) => e !== void 0), D = (e) => "allowReserved" in e && e.allowReserved !== void 0 ? e.allowReserved : "schema" in e && e.schema && typeof e.schema == "object" && "allowReserved" in e.schema ? e.schema.allowReserved === !0 : !1, O = (e) => {
10
11
  if (e.in === "header") return {
11
12
  style: "simple",
12
13
  explode: "explode" in e && e.explode !== void 0 && e.explode
@@ -29,171 +30,172 @@ var C = class extends Error {}, w = (e) => (e ?? []).map((e) => f(e)).filter((e)
29
30
  style: n,
30
31
  explode: "explode" in e && e.explode !== void 0 ? e.explode : n === "form"
31
32
  };
32
- }, D = (i, a, o, s, c) => {
33
- let l = b(i, a), u = l.example, d = i.in === "query" && !l.serialized && !l.mediaSerialized ? u?.["x-scalar-disabled-properties"] : void 0;
34
- if (d) return t(e(l.value, i), d, r(i, u, o));
35
- if (r(i, u, o)) return;
36
- if (l.value !== void 0) return e(l.value, i);
37
- if (!("schema" in i) || !i.schema) return;
38
- let p = {
33
+ }, k = (t, a, o, s, c) => {
34
+ let l = S(t, a, s), u = l.example, d = t.in === "query" && !l.serialized && !l.mediaSerialized ? u?.["x-scalar-disabled-properties"] : void 0;
35
+ if (d) return n(e(l.value, t), d, i(t, u, o));
36
+ if (i(t, u, o)) return;
37
+ if (l.value !== void 0) return e(l.value, t);
38
+ if (!("schema" in t) || !t.schema) return;
39
+ let f = {
39
40
  openapiVersion: s,
40
41
  jsonSchemaDialect: c,
41
- ...i.in === "path" ? {
42
- emptyString: `{${i.name}}`,
43
- preserveStringFallback: !0
42
+ ...t.in === "path" ? {
43
+ emptyString: `{${t.name}}`,
44
+ preserveStringFallback: !0,
45
+ ignoreSchemaConst: s !== void 0 && m(s, "3.1.0")
44
46
  } : {}
45
- }, m = f(i.schema);
46
- return m ? n(m, p) : void 0;
47
- }, O = ({ harRequest: t, parameters: n, example: f, defaultDisabled: O, openapiVersion: k, jsonSchemaDialect: A }) => {
48
- let j = [...t.headers], M = [...t.queryString], N = [...t.cookies], P = [], F = t.url, I = t.url, L = !1, R = !1, z = [], B = [], V = (e, t, n = !1) => {
49
- F = m(F, { [e]: t }), I = m(I, { [e]: n ? `x${t}` : t }), L ||= n;
50
- }, H = (e, t, n) => {
51
- T(n) ? z.push(`${encodeURIComponent(e)}=${t}`) : M.push({
47
+ }, h = p(t.schema);
48
+ return h ? r(h, f) : void 0;
49
+ }, A = ({ harRequest: n, parameters: r, example: p, defaultDisabled: m, openapiVersion: A, jsonSchemaDialect: j }) => {
50
+ let M = [...n.headers], N = [...n.queryString], P = [...n.cookies], F = [], I = n.url, L = n.url, R = !1, z = !1, B = [], V = [], H = (e, t, n = !1) => {
51
+ I = g(I, { [e]: t }), L = g(L, { [e]: n ? `x${t}` : t }), R ||= n;
52
+ }, U = (e, n, r) => {
53
+ D(r) ? B.push(`${encodeURIComponent(e)}=${t(n)}`) : N.push({
52
54
  name: e,
53
- value: t
55
+ value: n
54
56
  });
55
- }, U = w(n);
56
- for (let t of U) {
57
+ }, W = E(r);
58
+ for (let t of W) {
57
59
  if (!t.in || !t.name) continue;
58
60
  if (t.in === "querystring") {
59
- let e = x(t, f, {
60
- defaultDisabled: O,
61
- openapiVersion: k,
62
- jsonSchemaDialect: A
61
+ let e = C(t, p, {
62
+ defaultDisabled: m,
63
+ openapiVersion: A,
64
+ jsonSchemaDialect: j
63
65
  });
64
66
  if (e) {
65
- let t = F.indexOf("#"), n = t === -1 ? "" : F.slice(t), r = (t === -1 ? F : F.slice(0, t)).split("?")[0], i = S(e);
66
- F = `${r}${i ? `?${i}` : ""}${n}`;
67
+ let t = I.indexOf("#"), n = t === -1 ? "" : I.slice(t), r = (t === -1 ? I : I.slice(0, t)).split("?")[0], i = w(e);
68
+ I = `${r}${i ? `?${i}` : ""}${n}`;
67
69
  }
68
70
  continue;
69
71
  }
70
- let n = b(t, f);
71
- if (n.serialized && !r(t, n.example, O)) {
72
+ let n = S(t, p, A);
73
+ if (n.serialized && !i(t, n.example, m)) {
72
74
  let e = String(n.value);
73
75
  switch (t.in) {
74
76
  case "path":
75
- V(t.name, e);
77
+ H(t.name, e);
76
78
  break;
77
79
  case "query":
78
- z.push(e);
80
+ B.push(e);
79
81
  break;
80
82
  case "header":
81
- j.push({
83
+ M.push({
82
84
  name: t.name,
83
85
  value: e
84
86
  });
85
87
  break;
86
- case "cookie": B.push(e);
88
+ case "cookie": V.push(e);
87
89
  }
88
90
  continue;
89
91
  }
90
- if (n.mediaSerialized && !r(t, n.example, O)) {
92
+ if (n.mediaSerialized && !i(t, n.example, m)) {
91
93
  let e = String(n.value);
92
94
  switch (t.in) {
93
95
  case "query":
94
- H(t.name, e, t);
96
+ U(t.name, e, t);
95
97
  break;
96
98
  case "header":
97
- j.push({
99
+ M.push({
98
100
  name: t.name,
99
101
  value: e
100
102
  });
101
103
  break;
102
104
  case "path":
103
- V(t.name, encodeURIComponent(e));
105
+ H(t.name, encodeURIComponent(e));
104
106
  break;
105
- case "cookie": N.push({
107
+ case "cookie": P.push({
106
108
  name: t.name,
107
109
  value: e
108
110
  });
109
111
  }
110
112
  continue;
111
113
  }
112
- let { style: m, explode: h } = E(t), g = t.in === "path" && (m === "matrix" || m === "label"), w = g ? e(n.value, t) : D(t, f, O, k, A);
113
- if (!(g ? !n.example || r(t, n.example, O) : w === void 0)) switch (t.in) {
114
+ let { style: r, explode: g } = O(t), _ = t.in === "path" && (r === "matrix" || r === "label"), v = _ ? e(n.value, t) : k(t, p, m, A, j);
115
+ if (!(_ ? !n.example || i(t, n.example, m) : v === void 0)) switch (t.in) {
114
116
  case "path": {
115
- let e = k?.startsWith("3.2.") && "schema" in t && t.allowReserved === !0;
116
- if (R ||= !!e, g) {
117
- let n = v(t.name, {
118
- value: w,
119
- style: m,
120
- explode: h,
121
- includeUndefinedPrefix: _(k)
122
- }, void 0, e), r = m === "matrix" ? ";" : ".";
123
- V(F.includes(`{${t.name}}`) ? t.name : `${r}${t.name}`, n, m === "label" && !e);
124
- } else if (e) V(t.name, y(t.name, {
125
- value: w,
126
- style: m,
127
- explode: h
117
+ let e = A?.startsWith("3.2.") && "schema" in t && t.allowReserved === !0;
118
+ if (z ||= !!e, _) {
119
+ let n = b(t.name, {
120
+ value: v,
121
+ style: r,
122
+ explode: g,
123
+ includeUndefinedPrefix: y(A)
124
+ }, void 0, e), i = r === "matrix" ? ";" : ".";
125
+ H(I.includes(`{${t.name}}`) ? t.name : `${i}${t.name}`, n, r === "label" && !e);
126
+ } else if (e) H(t.name, x(t.name, {
127
+ value: v,
128
+ style: r,
129
+ explode: g
128
130
  }));
129
131
  else {
130
- let e = m === "simple" ? u(w, h) : w;
131
- V(t.name, String(e));
132
+ let e = r === "simple" ? d(v, g) : v;
133
+ H(t.name, String(e));
132
134
  }
133
135
  break;
134
136
  }
135
137
  case "query":
136
138
  if ("content" in t && t.content) {
137
- let e = Object.keys(t.content)[0] ?? "application/json", n = i(w, e);
138
- H(t.name, n, t);
139
+ let e = Object.keys(t.content)[0] ?? "application/json", n = a(v, e);
140
+ U(t.name, n, t);
139
141
  break;
140
142
  }
141
- switch (m) {
143
+ switch (r) {
142
144
  case "form": {
143
- let e = s(w, h);
144
- if (Array.isArray(e)) for (let n of e) H(n.key || t.name, String(n.value), t);
145
- else H(t.name, String(e), t);
145
+ let e = c(v, g);
146
+ if (Array.isArray(e)) for (let n of e) U(n.key || t.name, String(n.value), t);
147
+ else U(t.name, String(e), t);
146
148
  break;
147
149
  }
148
150
  case "spaceDelimited": {
149
- let e = d(w);
150
- H(t.name, e, t);
151
+ let e = f(v);
152
+ U(t.name, e, t);
151
153
  break;
152
154
  }
153
155
  case "pipeDelimited": {
154
- let e = l(w);
155
- H(t.name, e, t);
156
+ let e = u(v);
157
+ U(t.name, e, t);
156
158
  break;
157
159
  }
158
160
  case "deepObject":
159
- if (Array.isArray(w)) {
160
- let e = s(w, !0);
161
- if (Array.isArray(e)) for (let n of e) H(n.key || t.name, String(n.value), t);
162
- else H(t.name, String(e), t);
161
+ if (Array.isArray(v)) {
162
+ let e = c(v, !0);
163
+ if (Array.isArray(e)) for (let n of e) U(n.key || t.name, String(n.value), t);
164
+ else U(t.name, String(e), t);
163
165
  } else {
164
- let e = o(t.name, w);
165
- for (let n of e) H(n.key, n.value, t);
166
+ let e = s(t.name, v);
167
+ for (let n of e) U(n.key, n.value, t);
166
168
  }
167
169
  break;
168
- default: H(t.name, String(w), t);
170
+ default: U(t.name, String(v), t);
169
171
  }
170
172
  break;
171
173
  case "header": {
172
- let e = u(w, h);
173
- j.push({
174
+ let e = d(v, g);
175
+ M.push({
174
176
  name: t.name,
175
177
  value: String(e)
176
178
  });
177
179
  break;
178
180
  }
179
181
  case "cookie": {
180
- let [e, n] = (k ?? "").split("."), r = e === "3" && n === "2" && !("content" in t) ? p(t, w) : void 0;
181
- if (r) throw new C(r);
182
- if (m === "cookie") {
183
- P.push(...a(t.name, w, h));
182
+ let [e, n] = (A ?? "").split("."), i = e === "3" && n === "2" && !("content" in t) ? h(t, v) : void 0;
183
+ if (i) throw new T(i);
184
+ if (r === "cookie") {
185
+ F.push(...o(t.name, v, g));
184
186
  break;
185
187
  }
186
- let i = c(w, h);
187
- if (Array.isArray(i)) for (let e of i) {
188
+ let a = l(v, g);
189
+ if (Array.isArray(a)) for (let e of a) {
188
190
  let n = e.key || t.name, r = e.value === null ? "null" : String(e.value);
189
- N.push({
191
+ P.push({
190
192
  name: n,
191
193
  value: r
192
194
  });
193
195
  }
194
196
  else {
195
- let e = i === null ? "null" : String(i);
196
- N.push({
197
+ let e = a === null ? "null" : String(a);
198
+ P.push({
197
199
  name: t.name,
198
200
  value: e
199
201
  });
@@ -202,34 +204,34 @@ var C = class extends Error {}, w = (e) => (e ?? []).map((e) => f(e)).filter((e)
202
204
  }
203
205
  }
204
206
  }
205
- if (P.length || B.length) {
207
+ if (F.length || V.length) {
206
208
  let e = [
207
- ...N.map((e) => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`),
208
- ...P.map((e) => `${e.name}=${e.value}`),
209
- ...B
210
- ].join("; "), t = j.find((e) => e.name.toLowerCase() === "cookie");
211
- t ? j.splice(j.indexOf(t), 1, {
209
+ ...P.map((e) => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`),
210
+ ...F.map((e) => `${e.name}=${e.value}`),
211
+ ...V
212
+ ].join("; "), t = M.find((e) => e.name.toLowerCase() === "cookie");
213
+ t ? M.splice(M.indexOf(t), 1, {
212
214
  ...t,
213
215
  value: t.value ? `${t.value}; ${e}` : e
214
- }) : j.push({
216
+ }) : M.push({
215
217
  name: "Cookie",
216
218
  value: e
217
219
  });
218
220
  }
219
- if (z.length) {
220
- let e = F.indexOf("#"), t = e < 0 ? "" : F.slice(e), n = e < 0 ? F : F.slice(0, e);
221
- F = `${n}${n.includes("?") ? "&" : "?"}${z.join("&")}${t}`;
221
+ if (B.length) {
222
+ let e = I.indexOf("#"), t = e < 0 ? "" : I.slice(e), n = e < 0 ? I : I.slice(0, e);
223
+ I = `${n}${n.includes("?") ? "&" : "?"}${B.join("&")}${t}`;
222
224
  }
223
- if (R && h(F), L && g(F, I)) throw URIError("A label-style path parameter produces a dot segment that browsers remove.");
225
+ if (z && _(I), R && v(I, L)) throw URIError("A label-style path parameter produces a dot segment that browsers remove.");
224
226
  return {
225
- url: F,
226
- headers: j,
227
- queryString: M,
228
- cookies: P.length || B.length ? [] : N,
229
- hasCookieStyleEntries: P.length > 0 || B.length > 0,
230
- ...z.length ? { hasSerializedQuery: !0 } : {}
227
+ url: I,
228
+ headers: M,
229
+ queryString: N,
230
+ cookies: F.length || V.length ? [] : P,
231
+ hasCookieStyleEntries: F.length > 0 || V.length > 0,
232
+ ...B.length ? { hasSerializedQuery: !0 } : {}
231
233
  };
232
234
  };
233
- export { C as CookieSerializationError, O as processParameters };
235
+ export { T as CookieSerializationError, A as processParameters };
234
236
 
235
237
  //# sourceMappingURL=process-parameters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-parameters.js","names":["CookieSerializationError","deReferenceParams","params","getResolvedRef","param","isAllowReserved","getParameterStyleAndExplode","explode","defaultStyle","style","getParameterValue","selected","getParameterExample","example","exampleValue","propertyStates","filterDisabledProperties","deSerializeParameter","isParamDisabled","defaultDisabled","options","schema","getExampleFromSchema","processParameters","newHeaders","harRequest","newQueryString","newCookies","cookieStyleEntries","newUrl","markedPathUrl","hasStyledLabel","hasReservedPathParameter","serializedQuery","serializedCookies","substitutePathParameter","replacePathVariables","name","value","markLabel","appendQueryParameter","deReferencedParams","parameters","querystring","getQuerystringParameter","hashIndex","hash","base","query","serializeQuerystringParameter","wireValue","text","isStyledPath","paramValue","openapiVersion","jsonSchemaDialect","allowReserved","serializePathParameter","includesUndefinedPathPrefix","operator","serializeReservedPathParameter","serializeSimpleStyle","paramContentType","serializedValue","serializeContentValue","serialized","serializeFormStyle","entry","serializeSpaceDelimitedStyle","serializePipeDelimitedStyle","entries","serializeDeepObjectStyle","major","minor","error","getCookieSerializationError","serializeCookieStyle","serializeFormStyleForCookies","key","cookieValue","cookie","existing","header","assertReservedPathUrl","hasPathDotSegment"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-parameters.ts"],"sourcesContent":["import { getCookieSerializationError } from '@scalar/helpers/http/get-cookie-serialization-error'\nimport { replacePathVariables } from '@scalar/helpers/regex/replace-variables'\nimport {\n assertReservedPathUrl,\n hasPathDotSegment,\n includesUndefinedPathPrefix,\n serializePathParameter,\n serializeReservedPathParameter,\n} from '@scalar/workspace-store/helpers/encode-path-parameter'\nimport { getParameterExample } from '@scalar/workspace-store/helpers/get-parameter-example'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getQuerystringParameter,\n serializeQuerystringParameter,\n} from '@scalar/workspace-store/helpers/querystring-parameter'\nimport {\n deSerializeParameter,\n filterDisabledProperties,\n getExampleFromSchema,\n isParamDisabled,\n serializeContentValue,\n serializeCookieStyle,\n serializeDeepObjectStyle,\n serializeFormStyle,\n serializeFormStyleForCookies,\n serializePipeDelimitedStyle,\n serializeSimpleStyle,\n serializeSpaceDelimitedStyle,\n} from '@scalar/workspace-store/request-example'\nimport type { OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\n/** An invalid cookie declaration that authors can repair before generating a sample. */\nexport class CookieSerializationError extends Error {}\n\ntype ProcessedParameters = {\n /** Named serialized examples already embedded in the URL. */\n hasSerializedQuery?: boolean\n url: string\n headers: HarRequest['headers']\n queryString: HarRequest['queryString']\n cookies: HarRequest['cookies']\n /** Whether serialized cookie-style values require a complete Cookie header. */\n hasCookieStyleEntries: boolean\n}\n\n/** Ensures we don't have any references in the parameters */\nconst deReferenceParams = (params: OperationObject['parameters']): ParameterObject[] =>\n (params ?? []).map((param) => getResolvedRef(param)).filter((param) => param !== undefined)\n\n/** Whether the parameter allows reserved characters (from param or schema). */\nconst isAllowReserved = (param: ParameterObject): boolean => {\n if ('allowReserved' in param && param.allowReserved !== undefined) {\n return param.allowReserved\n }\n if ('schema' in param && param.schema && typeof param.schema === 'object' && 'allowReserved' in param.schema) {\n return (param.schema as { allowReserved?: boolean }).allowReserved === true\n }\n return false\n}\n\n/**\n * Get the style and explode values for a parameter according to OpenAPI 3.1.1 specification.\n * Handles defaults and validation for parameter location restrictions.\n */\nconst getParameterStyleAndExplode = (param: ParameterObject): { style: string; explode: boolean } => {\n // Headers only support 'simple' style\n if (param.in === 'header') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : false\n return { style: 'simple', explode }\n }\n\n // Cookies default to form for compatibility and also support cookie style.\n if (param.in === 'cookie') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : true\n return { style: 'style' in param && param.style === 'cookie' ? 'cookie' : 'form', explode }\n }\n\n const defaultStyle = {\n path: 'simple',\n query: 'form',\n querystring: 'form',\n header: 'simple',\n cookie: 'form',\n }[param.in]\n\n // Use provided style or default based on location\n const style = 'style' in param && param.style ? param.style : defaultStyle\n\n // Determine explode value: use provided value or default based on style\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : style === 'form'\n\n return { style, explode }\n}\n\n/**\n * Extract the value for a parameter from example data or schema.\n * Prioritizes example data over schema examples.\n * Returns null if the parameter is disabled so we can skip it.\n */\nconst getParameterValue = (\n param: ParameterObject,\n example: string | undefined,\n defaultDisabled: boolean,\n openapiVersion?: string,\n jsonSchemaDialect?: string,\n): unknown => {\n // Try to get value from example first\n const selected = getParameterExample(param, example)\n const exampleValue = selected.example\n\n const propertyStates =\n param.in === 'query' && !selected.serialized && !selected.mediaSerialized\n ? exampleValue?.['x-scalar-disabled-properties']\n : undefined\n if (propertyStates) {\n return filterDisabledProperties(\n deSerializeParameter(selected.value, param),\n propertyStates,\n isParamDisabled(param, exampleValue, defaultDisabled),\n )\n }\n\n // If the parameter is disabled, return undefined so we can skip it.\n if (isParamDisabled(param, exampleValue, defaultDisabled)) {\n return undefined\n }\n\n // If the example value is set, return it.\n if (selected.value !== undefined) {\n return deSerializeParameter(selected.value, param)\n }\n\n // Fall back to schema example if available\n if (!('schema' in param) || !param.schema) {\n return undefined\n }\n\n const options = {\n openapiVersion,\n jsonSchemaDialect,\n ...(param.in === 'path' ? { emptyString: `{${param.name}}`, preserveStringFallback: true } : {}),\n }\n const schema = getResolvedRef(param.schema)\n return schema ? getExampleFromSchema(schema, options) : undefined\n}\n\n/**\n * Process OpenAPI parameters and return the updated properties.\n * Handles path, query, and header parameters with various styles and explode options.\n *\n * @see https://spec.openapis.org/oas/latest.html#style-values\n */\nexport const processParameters = ({\n harRequest,\n parameters,\n example,\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n}: {\n harRequest: HarRequest\n parameters: OperationObject['parameters']\n /** The name of the example to use */\n example?: string | undefined\n /** Whether to disable parameters by default. */\n defaultDisabled: boolean\n /** Originating API description version. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n}): ProcessedParameters => {\n // Create copies of the arrays to avoid modifying the input\n const newHeaders = [...harRequest.headers]\n const newQueryString = [...harRequest.queryString]\n const newCookies = [...harRequest.cookies]\n const cookieStyleEntries: HarRequest['cookies'] = []\n let newUrl = harRequest.url\n let markedPathUrl = harRequest.url\n let hasStyledLabel = false\n let hasReservedPathParameter = false\n const serializedQuery: string[] = []\n const serializedCookies: string[] = []\n\n const substitutePathParameter = (name: string, value: string, markLabel = false): void => {\n newUrl = replacePathVariables(newUrl, { [name]: value })\n // Mark only label substitutions so literal dot segments keep their usual URL semantics.\n markedPathUrl = replacePathVariables(markedPathUrl, { [name]: markLabel ? `x${value}` : value })\n hasStyledLabel ||= markLabel\n }\n\n const appendQueryParameter = (name: string, value: string, param: ParameterObject): void => {\n if (isAllowReserved(param)) {\n // HTTP clients cannot infer reserved expansion from a HAR name/value pair.\n serializedQuery.push(`${encodeURIComponent(name)}=${value}`)\n } else {\n newQueryString.push({ name, value })\n }\n }\n\n // Filter out references\n const deReferencedParams = deReferenceParams(parameters)\n\n for (const param of deReferencedParams) {\n if (!param.in || !param.name) {\n continue\n }\n\n if (param.in === 'querystring') {\n const querystring = getQuerystringParameter(param, example, {\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n })\n if (querystring) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex === -1 ? '' : newUrl.slice(hashIndex)\n const base = (hashIndex === -1 ? newUrl : newUrl.slice(0, hashIndex)).split('?')[0]\n const query = serializeQuerystringParameter(querystring)\n newUrl = `${base}${query ? `?${query}` : ''}${hash}`\n }\n continue\n }\n\n const selected = getParameterExample(param, example)\n if (selected.serialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const wireValue = String(selected.value)\n switch (param.in) {\n case 'path':\n substitutePathParameter(param.name, wireValue)\n break\n case 'query':\n serializedQuery.push(wireValue)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: wireValue })\n break\n case 'cookie':\n serializedCookies.push(wireValue)\n break\n }\n continue\n }\n if (selected.mediaSerialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const text = String(selected.value)\n switch (param.in) {\n case 'query':\n appendQueryParameter(param.name, text, param)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: text })\n break\n case 'path':\n substitutePathParameter(param.name, encodeURIComponent(text))\n break\n case 'cookie':\n newCookies.push({ name: param.name, value: text })\n break\n }\n continue\n }\n const { style, explode } = getParameterStyleAndExplode(param)\n const isStyledPath = param.in === 'path' && (style === 'matrix' || style === 'label')\n // Like Test Request, leave the template visible when no example supplies a styled path value.\n const paramValue = isStyledPath\n ? deSerializeParameter(selected.value, param)\n : getParameterValue(param, example, defaultDisabled, openapiVersion, jsonSchemaDialect)\n if (\n isStyledPath\n ? !selected.example || isParamDisabled(param, selected.example, defaultDisabled)\n : paramValue === undefined\n ) {\n continue\n }\n\n switch (param.in) {\n case 'path': {\n const allowReserved = openapiVersion?.startsWith('3.2.') && 'schema' in param && param.allowReserved === true\n hasReservedPathParameter ||= Boolean(allowReserved)\n\n if (isStyledPath) {\n const value = serializePathParameter(\n param.name,\n {\n value: paramValue,\n style,\n explode,\n includeUndefinedPrefix: includesUndefinedPathPrefix(openapiVersion),\n },\n undefined,\n allowReserved,\n )\n // Support older samples that include a URI template operator in the path.\n const operator = style === 'matrix' ? ';' : '.'\n const name = newUrl.includes(`{${param.name}}`) ? param.name : `${operator}${param.name}`\n substitutePathParameter(name, value, style === 'label' && !allowReserved)\n } else if (allowReserved) {\n substitutePathParameter(\n param.name,\n serializeReservedPathParameter(param.name, { value: paramValue, style, explode }),\n )\n } else {\n const value = style === 'simple' ? serializeSimpleStyle(paramValue, explode) : paramValue\n substitutePathParameter(param.name, String(value))\n }\n break\n }\n\n case 'query': {\n // Content type parameters should be serialized according to the parameter's own content type\n if ('content' in param && param.content) {\n // We grab the first for now but eventually we should support selecting the content type per parameter\n const paramContentType = Object.keys(param.content)[0] ?? 'application/json'\n const serializedValue = serializeContentValue(paramValue, paramContentType)\n appendQueryParameter(param.name, serializedValue, param)\n break\n }\n\n // Handle query parameters\n switch (style) {\n case 'form': {\n const serialized = serializeFormStyle(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n }\n // Otherwise, convert to string\n else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n break\n }\n case 'spaceDelimited': {\n const serialized = serializeSpaceDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'pipeDelimited': {\n const serialized = serializePipeDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'deepObject': {\n // OAS marks deepObject-on-array and deepObject+explode:false as undefined.\n // Mirror process-body: fall back to form/explode:true for arrays and always\n // invoke the serializer for objects so authors get useful output instead of\n // a silently-dropped parameter.\n if (Array.isArray(paramValue)) {\n const serialized = serializeFormStyle(paramValue, true)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n } else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n } else {\n const entries = serializeDeepObjectStyle(param.name, paramValue)\n for (const entry of entries) {\n appendQueryParameter(entry.key, entry.value, param)\n }\n }\n break\n }\n\n // Default to form style\n default:\n appendQueryParameter(param.name, String(paramValue), param)\n }\n break\n }\n\n // Headers only support 'simple' style according to OpenAPI 3.1.1\n // For arrays, simple style always produces comma-separated values regardless of explode\n // The explode parameter only affects object serialization\n case 'header': {\n const serialized = serializeSimpleStyle(paramValue, explode)\n newHeaders.push({ name: param.name, value: String(serialized) })\n break\n }\n\n // Keep cookie style separate so snippet generators cannot percent-encode it.\n case 'cookie': {\n const [major, minor] = (openapiVersion ?? '').split('.')\n const error =\n major === '3' && minor === '2' && !('content' in param)\n ? getCookieSerializationError(param, paramValue)\n : undefined\n if (error) {\n throw new CookieSerializationError(error)\n }\n if (style === 'cookie') {\n cookieStyleEntries.push(...serializeCookieStyle(param.name, paramValue, explode))\n break\n }\n const serialized = serializeFormStyleForCookies(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n const value = entry.value === null ? 'null' : String(entry.value)\n newCookies.push({ name: key, value })\n }\n }\n // Otherwise, convert to string\n else {\n const value = serialized === null ? 'null' : String(serialized)\n newCookies.push({ name: param.name, value })\n }\n break\n }\n }\n }\n\n // HAR cookie entries are encoded by snippet generators. Use a complete header\n // when cookie style is present, preserving legacy encoding for other cookies.\n if (cookieStyleEntries.length || serializedCookies.length) {\n const cookieValue = [\n ...newCookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`),\n ...cookieStyleEntries.map((cookie) => `${cookie.name}=${cookie.value}`),\n ...serializedCookies,\n ].join('; ')\n const existing = newHeaders.find((header) => header.name.toLowerCase() === 'cookie')\n if (existing) {\n newHeaders.splice(newHeaders.indexOf(existing), 1, {\n ...existing,\n value: existing.value ? `${existing.value}; ${cookieValue}` : cookieValue,\n })\n } else {\n newHeaders.push({ name: 'Cookie', value: cookieValue })\n }\n }\n\n if (serializedQuery.length) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex < 0 ? '' : newUrl.slice(hashIndex)\n const base = hashIndex < 0 ? newUrl : newUrl.slice(0, hashIndex)\n newUrl = `${base}${base.includes('?') ? '&' : '?'}${serializedQuery.join('&')}${hash}`\n }\n\n if (hasReservedPathParameter) {\n assertReservedPathUrl(newUrl)\n }\n if (hasStyledLabel && hasPathDotSegment(newUrl, markedPathUrl)) {\n throw new URIError('A label-style path parameter produces a dot segment that browsers remove.')\n }\n\n return {\n url: newUrl,\n headers: newHeaders,\n queryString: newQueryString,\n cookies: cookieStyleEntries.length || serializedCookies.length ? [] : newCookies,\n hasCookieStyleEntries: cookieStyleEntries.length > 0 || serializedCookies.length > 0,\n ...(serializedQuery.length ? { hasSerializedQuery: true } : {}),\n }\n}\n"],"mappings":";;;;;;;;AAiCA,IAAaA,IAAb,cAA8C,MAAM,CAAC,GAc/CC,KA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YhB,EAAO,QAAQ,GAAG,GAC9BiB,IAAOD,IAAY,IAAI,KAAKhB,EAAO,MAAMgB,CAAS,GAClDE,IAAOF,IAAY,IAAIhB,IAASA,EAAO,MAAM,GAAGgB,CAAS;EAC/D,IAAS,GAAGE,IAAOA,EAAK,SAAS,GAAG,IAAI,MAAM,MAAMd,EAAgB,KAAK,GAAG,IAAIa;CAClF;CAKA,IAHId,KACFmD,EAAsBtD,CAAM,GAE1BE,KAAkBqD,EAAkBvD,GAAQC,CAAa,GAC3D,MAAU,SAAS,2EAA2E;CAGhG,OAAO;EACL,KAAKD;EACL,SAASL;EACT,aAAaE;EACb,SAASE,EAAmB,UAAUM,EAAkB,SAAS,CAAC,IAAIP;EACtE,uBAAuBC,EAAmB,SAAS,KAAKM,EAAkB,SAAS;EACnF,GAAID,EAAgB,SAAS,EAAE,oBAAoB,GAAK,IAAI,CAAC;CAC/D;AACF"}
1
+ {"version":3,"file":"process-parameters.js","names":["deSerializeParameter","encodeReservedQueryValue","filterDisabledProperties","getExampleFromSchema","isParamDisabled","serializeContentValue","serializeCookieStyle","serializeDeepObjectStyle","serializeFormStyle","serializeFormStyleForCookies","serializePipeDelimitedStyle","serializeSimpleStyle","serializeSpaceDelimitedStyle","getResolvedRef","isVersionLessThan","getCookieSerializationError","replacePathVariables","assertReservedPathUrl","hasPathDotSegment","includesUndefinedPathPrefix","serializePathParameter","serializeReservedPathParameter","getParameterExample","getQuerystringParameter","serializeQuerystringParameter","CookieSerializationError","deReferenceParams","params","param","isAllowReserved","getParameterStyleAndExplode","explode","defaultStyle","style","getParameterValue","example","defaultDisabled","openapiVersion","jsonSchemaDialect","selected","exampleValue","propertyStates","options","schema","processParameters","harRequest","parameters","newHeaders","newQueryString","newCookies","cookieStyleEntries","newUrl","markedPathUrl","hasStyledLabel","hasReservedPathParameter","serializedQuery","serializedCookies","substitutePathParameter","name","value","markLabel","appendQueryParameter","deReferencedParams","querystring","hashIndex","hash","base","query","wireValue","text","isStyledPath","paramValue","allowReserved","operator","paramContentType","serializedValue","serialized","entry","entries","major","minor","error","key","cookieValue","cookie","existing","header"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-parameters.ts"],"sourcesContent":["import { isVersionLessThan } from '@scalar/helpers/general/compare-versions'\nimport { getCookieSerializationError } from '@scalar/helpers/http/get-cookie-serialization-error'\nimport { replacePathVariables } from '@scalar/helpers/regex/replace-variables'\nimport {\n assertReservedPathUrl,\n hasPathDotSegment,\n includesUndefinedPathPrefix,\n serializePathParameter,\n serializeReservedPathParameter,\n} from '@scalar/workspace-store/helpers/encode-path-parameter'\nimport { getParameterExample } from '@scalar/workspace-store/helpers/get-parameter-example'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getQuerystringParameter,\n serializeQuerystringParameter,\n} from '@scalar/workspace-store/helpers/querystring-parameter'\nimport {\n deSerializeParameter,\n encodeReservedQueryValue,\n filterDisabledProperties,\n getExampleFromSchema,\n isParamDisabled,\n serializeContentValue,\n serializeCookieStyle,\n serializeDeepObjectStyle,\n serializeFormStyle,\n serializeFormStyleForCookies,\n serializePipeDelimitedStyle,\n serializeSimpleStyle,\n serializeSpaceDelimitedStyle,\n} from '@scalar/workspace-store/request-example'\nimport type { OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\n/** An invalid cookie declaration that authors can repair before generating a sample. */\nexport class CookieSerializationError extends Error {}\n\ntype ProcessedParameters = {\n /** Named serialized examples already embedded in the URL. */\n hasSerializedQuery?: boolean\n url: string\n headers: HarRequest['headers']\n queryString: HarRequest['queryString']\n cookies: HarRequest['cookies']\n /** Whether serialized cookie-style values require a complete Cookie header. */\n hasCookieStyleEntries: boolean\n}\n\n/** Ensures we don't have any references in the parameters */\nconst deReferenceParams = (params: OperationObject['parameters']): ParameterObject[] =>\n (params ?? []).map((param) => getResolvedRef(param)).filter((param) => param !== undefined)\n\n/** Whether the parameter allows reserved characters (from param or schema). */\nconst isAllowReserved = (param: ParameterObject): boolean => {\n if ('allowReserved' in param && param.allowReserved !== undefined) {\n return param.allowReserved\n }\n if ('schema' in param && param.schema && typeof param.schema === 'object' && 'allowReserved' in param.schema) {\n return (param.schema as { allowReserved?: boolean }).allowReserved === true\n }\n return false\n}\n\n/**\n * Get the style and explode values for a parameter according to OpenAPI 3.1.1 specification.\n * Handles defaults and validation for parameter location restrictions.\n */\nconst getParameterStyleAndExplode = (param: ParameterObject): { style: string; explode: boolean } => {\n // Headers only support 'simple' style\n if (param.in === 'header') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : false\n return { style: 'simple', explode }\n }\n\n // Cookies default to form for compatibility and also support cookie style.\n if (param.in === 'cookie') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : true\n return { style: 'style' in param && param.style === 'cookie' ? 'cookie' : 'form', explode }\n }\n\n const defaultStyle = {\n path: 'simple',\n query: 'form',\n querystring: 'form',\n header: 'simple',\n cookie: 'form',\n }[param.in]\n\n // Use provided style or default based on location\n const style = 'style' in param && param.style ? param.style : defaultStyle\n\n // Determine explode value: use provided value or default based on style\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : style === 'form'\n\n return { style, explode }\n}\n\n/**\n * Extract the value for a parameter from example data or schema.\n * Prioritizes example data over schema examples.\n * Returns null if the parameter is disabled so we can skip it.\n */\nconst getParameterValue = (\n param: ParameterObject,\n example: string | undefined,\n defaultDisabled: boolean,\n openapiVersion?: string,\n jsonSchemaDialect?: string,\n): unknown => {\n // Try to get value from example first\n const selected = getParameterExample(param, example, openapiVersion)\n const exampleValue = selected.example\n\n const propertyStates =\n param.in === 'query' && !selected.serialized && !selected.mediaSerialized\n ? exampleValue?.['x-scalar-disabled-properties']\n : undefined\n if (propertyStates) {\n return filterDisabledProperties(\n deSerializeParameter(selected.value, param),\n propertyStates,\n isParamDisabled(param, exampleValue, defaultDisabled),\n )\n }\n\n // If the parameter is disabled, return undefined so we can skip it.\n if (isParamDisabled(param, exampleValue, defaultDisabled)) {\n return undefined\n }\n\n // If the example value is set, return it.\n if (selected.value !== undefined) {\n return deSerializeParameter(selected.value, param)\n }\n\n // Fall back to schema example if available\n if (!('schema' in param) || !param.schema) {\n return undefined\n }\n\n const options = {\n openapiVersion,\n jsonSchemaDialect,\n ...(param.in === 'path'\n ? {\n emptyString: `{${param.name}}`,\n preserveStringFallback: true,\n ignoreSchemaConst: openapiVersion !== undefined && isVersionLessThan(openapiVersion, '3.1.0'),\n }\n : {}),\n }\n const schema = getResolvedRef(param.schema)\n return schema ? getExampleFromSchema(schema, options) : undefined\n}\n\n/**\n * Process OpenAPI parameters and return the updated properties.\n * Handles path, query, and header parameters with various styles and explode options.\n *\n * @see https://spec.openapis.org/oas/latest.html#style-values\n */\nexport const processParameters = ({\n harRequest,\n parameters,\n example,\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n}: {\n harRequest: HarRequest\n parameters: OperationObject['parameters']\n /** The name of the example to use */\n example?: string | undefined\n /** Whether to disable parameters by default. */\n defaultDisabled: boolean\n /** Originating API description version. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n}): ProcessedParameters => {\n // Create copies of the arrays to avoid modifying the input\n const newHeaders = [...harRequest.headers]\n const newQueryString = [...harRequest.queryString]\n const newCookies = [...harRequest.cookies]\n const cookieStyleEntries: HarRequest['cookies'] = []\n let newUrl = harRequest.url\n let markedPathUrl = harRequest.url\n let hasStyledLabel = false\n let hasReservedPathParameter = false\n const serializedQuery: string[] = []\n const serializedCookies: string[] = []\n\n const substitutePathParameter = (name: string, value: string, markLabel = false): void => {\n newUrl = replacePathVariables(newUrl, { [name]: value })\n // Mark only label substitutions so literal dot segments keep their usual URL semantics.\n markedPathUrl = replacePathVariables(markedPathUrl, { [name]: markLabel ? `x${value}` : value })\n hasStyledLabel ||= markLabel\n }\n\n const appendQueryParameter = (name: string, value: string, param: ParameterObject): void => {\n if (isAllowReserved(param)) {\n // HTTP clients cannot infer reserved expansion from a HAR name/value pair.\n serializedQuery.push(`${encodeURIComponent(name)}=${encodeReservedQueryValue(value)}`)\n } else {\n newQueryString.push({ name, value })\n }\n }\n\n // Filter out references\n const deReferencedParams = deReferenceParams(parameters)\n\n for (const param of deReferencedParams) {\n if (!param.in || !param.name) {\n continue\n }\n\n if (param.in === 'querystring') {\n const querystring = getQuerystringParameter(param, example, {\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n })\n if (querystring) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex === -1 ? '' : newUrl.slice(hashIndex)\n const base = (hashIndex === -1 ? newUrl : newUrl.slice(0, hashIndex)).split('?')[0]\n const query = serializeQuerystringParameter(querystring)\n newUrl = `${base}${query ? `?${query}` : ''}${hash}`\n }\n continue\n }\n\n const selected = getParameterExample(param, example, openapiVersion)\n if (selected.serialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const wireValue = String(selected.value)\n switch (param.in) {\n case 'path':\n substitutePathParameter(param.name, wireValue)\n break\n case 'query':\n serializedQuery.push(wireValue)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: wireValue })\n break\n case 'cookie':\n serializedCookies.push(wireValue)\n break\n }\n continue\n }\n if (selected.mediaSerialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const text = String(selected.value)\n switch (param.in) {\n case 'query':\n appendQueryParameter(param.name, text, param)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: text })\n break\n case 'path':\n substitutePathParameter(param.name, encodeURIComponent(text))\n break\n case 'cookie':\n newCookies.push({ name: param.name, value: text })\n break\n }\n continue\n }\n const { style, explode } = getParameterStyleAndExplode(param)\n const isStyledPath = param.in === 'path' && (style === 'matrix' || style === 'label')\n // Like Test Request, leave the template visible when no example supplies a styled path value.\n const paramValue = isStyledPath\n ? deSerializeParameter(selected.value, param)\n : getParameterValue(param, example, defaultDisabled, openapiVersion, jsonSchemaDialect)\n if (\n isStyledPath\n ? !selected.example || isParamDisabled(param, selected.example, defaultDisabled)\n : paramValue === undefined\n ) {\n continue\n }\n\n switch (param.in) {\n case 'path': {\n const allowReserved = openapiVersion?.startsWith('3.2.') && 'schema' in param && param.allowReserved === true\n hasReservedPathParameter ||= Boolean(allowReserved)\n\n if (isStyledPath) {\n const value = serializePathParameter(\n param.name,\n {\n value: paramValue,\n style,\n explode,\n includeUndefinedPrefix: includesUndefinedPathPrefix(openapiVersion),\n },\n undefined,\n allowReserved,\n )\n // Support older samples that include a URI template operator in the path.\n const operator = style === 'matrix' ? ';' : '.'\n const name = newUrl.includes(`{${param.name}}`) ? param.name : `${operator}${param.name}`\n substitutePathParameter(name, value, style === 'label' && !allowReserved)\n } else if (allowReserved) {\n substitutePathParameter(\n param.name,\n serializeReservedPathParameter(param.name, { value: paramValue, style, explode }),\n )\n } else {\n const value = style === 'simple' ? serializeSimpleStyle(paramValue, explode) : paramValue\n substitutePathParameter(param.name, String(value))\n }\n break\n }\n\n case 'query': {\n // Content type parameters should be serialized according to the parameter's own content type\n if ('content' in param && param.content) {\n // We grab the first for now but eventually we should support selecting the content type per parameter\n const paramContentType = Object.keys(param.content)[0] ?? 'application/json'\n const serializedValue = serializeContentValue(paramValue, paramContentType)\n appendQueryParameter(param.name, serializedValue, param)\n break\n }\n\n // Handle query parameters\n switch (style) {\n case 'form': {\n const serialized = serializeFormStyle(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n }\n // Otherwise, convert to string\n else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n break\n }\n case 'spaceDelimited': {\n const serialized = serializeSpaceDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'pipeDelimited': {\n const serialized = serializePipeDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'deepObject': {\n // OAS marks deepObject-on-array and deepObject+explode:false as undefined.\n // Mirror process-body: fall back to form/explode:true for arrays and always\n // invoke the serializer for objects so authors get useful output instead of\n // a silently-dropped parameter.\n if (Array.isArray(paramValue)) {\n const serialized = serializeFormStyle(paramValue, true)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n } else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n } else {\n const entries = serializeDeepObjectStyle(param.name, paramValue)\n for (const entry of entries) {\n appendQueryParameter(entry.key, entry.value, param)\n }\n }\n break\n }\n\n // Default to form style\n default:\n appendQueryParameter(param.name, String(paramValue), param)\n }\n break\n }\n\n // Headers only support 'simple' style according to OpenAPI 3.1.1\n // For arrays, simple style always produces comma-separated values regardless of explode\n // The explode parameter only affects object serialization\n case 'header': {\n const serialized = serializeSimpleStyle(paramValue, explode)\n newHeaders.push({ name: param.name, value: String(serialized) })\n break\n }\n\n // Keep cookie style separate so snippet generators cannot percent-encode it.\n case 'cookie': {\n const [major, minor] = (openapiVersion ?? '').split('.')\n const error =\n major === '3' && minor === '2' && !('content' in param)\n ? getCookieSerializationError(param, paramValue)\n : undefined\n if (error) {\n throw new CookieSerializationError(error)\n }\n if (style === 'cookie') {\n cookieStyleEntries.push(...serializeCookieStyle(param.name, paramValue, explode))\n break\n }\n const serialized = serializeFormStyleForCookies(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n const value = entry.value === null ? 'null' : String(entry.value)\n newCookies.push({ name: key, value })\n }\n }\n // Otherwise, convert to string\n else {\n const value = serialized === null ? 'null' : String(serialized)\n newCookies.push({ name: param.name, value })\n }\n break\n }\n }\n }\n\n // HAR cookie entries are encoded by snippet generators. Use a complete header\n // when cookie style is present, preserving legacy encoding for other cookies.\n if (cookieStyleEntries.length || serializedCookies.length) {\n const cookieValue = [\n ...newCookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`),\n ...cookieStyleEntries.map((cookie) => `${cookie.name}=${cookie.value}`),\n ...serializedCookies,\n ].join('; ')\n const existing = newHeaders.find((header) => header.name.toLowerCase() === 'cookie')\n if (existing) {\n newHeaders.splice(newHeaders.indexOf(existing), 1, {\n ...existing,\n value: existing.value ? `${existing.value}; ${cookieValue}` : cookieValue,\n })\n } else {\n newHeaders.push({ name: 'Cookie', value: cookieValue })\n }\n }\n\n if (serializedQuery.length) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex < 0 ? '' : newUrl.slice(hashIndex)\n const base = hashIndex < 0 ? newUrl : newUrl.slice(0, hashIndex)\n newUrl = `${base}${base.includes('?') ? '&' : '?'}${serializedQuery.join('&')}${hash}`\n }\n\n if (hasReservedPathParameter) {\n assertReservedPathUrl(newUrl)\n }\n if (hasStyledLabel && hasPathDotSegment(newUrl, markedPathUrl)) {\n throw new URIError('A label-style path parameter produces a dot segment that browsers remove.')\n }\n\n return {\n url: newUrl,\n headers: newHeaders,\n queryString: newQueryString,\n cookies: cookieStyleEntries.length || serializedCookies.length ? [] : newCookies,\n hasCookieStyleEntries: cookieStyleEntries.length > 0 || serializedCookies.length > 0,\n ...(serializedQuery.length ? { hasSerializedQuery: true } : {}),\n }\n}\n"],"mappings":";;;;;;;;;AAmCA,IAAayB,IAAb,cAA8C,MAAM,CAAC,GAc/CC,KAAqBC,OACxBA,KAAU,CAAC,EAAA,CAAG,KAAKC,MAAUf,EAAee,CAAK,CAAC,CAAC,CAAC,QAAQA,MAAUA,MAAU,KAAA,CAAS,GAGtFC,KAAmBD,MACnB,mBAAmBA,KAASA,EAAM,kBAAkB,KAAA,IAC/CA,EAAM,gBAEX,YAAYA,KAASA,EAAM,UAAU,OAAOA,EAAM,UAAW,YAAY,mBAAmBA,EAAM,SAC5FA,EAAM,OAAuC,kBAAkB,KAElE,IAOHE,KAA+BF,MAAgE;CAEnG,IAAIA,EAAM,OAAO,UAEf,OAAO;EAAE,OAAO;EAAU,SADV,aAAaA,KAASA,EAAM,YAAY,KA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