@scalar/workspace-store 0.40.2 → 0.40.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 (354) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/client.d.ts +7 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +820 -681
  5. package/dist/entities/auth/index.js +96 -101
  6. package/dist/entities/auth/schema.js +42 -116
  7. package/dist/entities/history/index.js +80 -60
  8. package/dist/entities/history/schema.js +94 -88
  9. package/dist/events/bus.js +146 -93
  10. package/dist/events/definitions/analytics.js +1 -1
  11. package/dist/events/definitions/auth.js +1 -1
  12. package/dist/events/definitions/common.js +1 -1
  13. package/dist/events/definitions/cookie.js +1 -1
  14. package/dist/events/definitions/document.js +1 -1
  15. package/dist/events/definitions/environment.js +1 -1
  16. package/dist/events/definitions/hooks.js +1 -1
  17. package/dist/events/definitions/index.js +1 -1
  18. package/dist/events/definitions/meta.js +1 -1
  19. package/dist/events/definitions/operation.js +1 -1
  20. package/dist/events/definitions/server.js +1 -1
  21. package/dist/events/definitions/tabs.js +1 -1
  22. package/dist/events/definitions/tag.js +1 -1
  23. package/dist/events/definitions/ui.js +1 -1
  24. package/dist/events/definitions/workspace.js +1 -1
  25. package/dist/events/index.js +3 -9
  26. package/dist/events/listeners.js +20 -22
  27. package/dist/events/old-definitions.js +15 -12
  28. package/dist/helpers/deep-clone.js +33 -17
  29. package/dist/helpers/detect-changes-proxy.js +95 -57
  30. package/dist/helpers/general.js +78 -23
  31. package/dist/helpers/generate-unique-value.js +77 -45
  32. package/dist/helpers/get-fetch.js +12 -10
  33. package/dist/helpers/get-resolved-ref.js +11 -10
  34. package/dist/helpers/is-non-optional-security-requirement.js +3 -6
  35. package/dist/helpers/merge-object.js +71 -30
  36. package/dist/helpers/overrides-proxy.js +98 -58
  37. package/dist/helpers/unpack-proxy.js +60 -58
  38. package/dist/mutators/auth.js +358 -230
  39. package/dist/mutators/cookie.js +59 -42
  40. package/dist/mutators/document.js +104 -66
  41. package/dist/mutators/environment.js +97 -72
  42. package/dist/mutators/helpers.js +9 -13
  43. package/dist/mutators/index.js +62 -49
  44. package/dist/mutators/operation/body.js +88 -57
  45. package/dist/mutators/operation/extensions.js +20 -12
  46. package/dist/mutators/operation/helpers/fetch-request-to-har.js +144 -107
  47. package/dist/mutators/operation/helpers/fetch-response-to-har.js +143 -95
  48. package/dist/mutators/operation/helpers/get-parameter-position.js +12 -12
  49. package/dist/mutators/operation/helpers/har-to-operation.js +169 -132
  50. package/dist/mutators/operation/helpers/sync-path-parameters.js +109 -60
  51. package/dist/mutators/operation/history.js +60 -64
  52. package/dist/mutators/operation/index.js +25 -49
  53. package/dist/mutators/operation/operation.js +349 -240
  54. package/dist/mutators/operation/parameters.js +157 -93
  55. package/dist/mutators/server.js +213 -152
  56. package/dist/mutators/tabs.js +173 -130
  57. package/dist/mutators/tag.js +131 -97
  58. package/dist/mutators/workspace.js +72 -42
  59. package/dist/navigation/get-navigation-options.js +97 -84
  60. package/dist/navigation/helpers/get-openapi-object.js +46 -29
  61. package/dist/navigation/helpers/get-operation-entries.js +72 -32
  62. package/dist/navigation/helpers/get-parent-entry.js +16 -12
  63. package/dist/navigation/helpers/get-tag-entries.js +56 -29
  64. package/dist/navigation/helpers/get-tag.js +22 -23
  65. package/dist/navigation/helpers/get-x-keys.js +13 -9
  66. package/dist/navigation/helpers/traverse-description.js +90 -72
  67. package/dist/navigation/helpers/traverse-document.js +111 -98
  68. package/dist/navigation/helpers/traverse-examples.js +35 -31
  69. package/dist/navigation/helpers/traverse-paths.js +118 -106
  70. package/dist/navigation/helpers/traverse-schemas.js +65 -64
  71. package/dist/navigation/helpers/traverse-tags.js +158 -129
  72. package/dist/navigation/helpers/traverse-webhooks.js +96 -90
  73. package/dist/navigation/helpers/update-order-ids.js +59 -51
  74. package/dist/navigation/helpers/utils.js +71 -21
  75. package/dist/navigation/index.js +5 -13
  76. package/dist/navigation/types.js +1 -1
  77. package/dist/persistence/index.js +283 -285
  78. package/dist/persistence/indexdb.js +263 -126
  79. package/dist/plugins/bundler/helpers.js +21 -12
  80. package/dist/plugins/bundler/index.d.ts +7 -0
  81. package/dist/plugins/bundler/index.d.ts.map +1 -1
  82. package/dist/plugins/bundler/index.js +305 -171
  83. package/dist/plugins/client/index.js +1 -5
  84. package/dist/plugins/client/persistence.js +95 -90
  85. package/dist/resolve.js +18 -25
  86. package/dist/schemas/compose.js +6 -7
  87. package/dist/schemas/extensions/document/x-internal.js +3 -7
  88. package/dist/schemas/extensions/document/x-scalar-environments.js +16 -22
  89. package/dist/schemas/extensions/document/x-scalar-icon.js +3 -7
  90. package/dist/schemas/extensions/document/x-scalar-ignore.js +3 -7
  91. package/dist/schemas/extensions/document/x-scalar-is-dirty.js +21 -8
  92. package/dist/schemas/extensions/document/x-scalar-original-document-hash.js +17 -8
  93. package/dist/schemas/extensions/document/x-scalar-registry-meta.js +15 -21
  94. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +5 -13
  95. package/dist/schemas/extensions/document/x-scalar-watch-mode.js +4 -8
  96. package/dist/schemas/extensions/document/x-tags.js +3 -7
  97. package/dist/schemas/extensions/example/x-disabled.js +17 -7
  98. package/dist/schemas/extensions/general/x-scalar-active-environment.js +4 -7
  99. package/dist/schemas/extensions/general/x-scalar-cookies.js +9 -14
  100. package/dist/schemas/extensions/general/x-scalar-order.js +8 -7
  101. package/dist/schemas/extensions/operation/index.js +4 -23
  102. package/dist/schemas/extensions/operation/x-badge.js +42 -50
  103. package/dist/schemas/extensions/operation/x-code-samples.js +8 -12
  104. package/dist/schemas/extensions/operation/x-draft-examples.js +3 -7
  105. package/dist/schemas/extensions/operation/x-post-response.js +18 -7
  106. package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js +57 -13
  107. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +9 -7
  108. package/dist/schemas/extensions/operation/x-scalar-stability.js +15 -14
  109. package/dist/schemas/extensions/parameter/x-global.js +12 -7
  110. package/dist/schemas/extensions/schema/x-additional-properties-name.js +10 -7
  111. package/dist/schemas/extensions/schema/x-enum-descriptions.js +17 -12
  112. package/dist/schemas/extensions/schema/x-enum-varnames.js +21 -8
  113. package/dist/schemas/extensions/schema/x-examples.js +3 -7
  114. package/dist/schemas/extensions/schema/x-variable.js +3 -7
  115. package/dist/schemas/extensions/security/index.js +1 -1
  116. package/dist/schemas/extensions/security/x-default-scopes.js +16 -7
  117. package/dist/schemas/extensions/security/x-scalar-credentials-location.js +16 -7
  118. package/dist/schemas/extensions/security/x-scalar-security-body.js +14 -7
  119. package/dist/schemas/extensions/security/x-scalar-security-query.js +14 -7
  120. package/dist/schemas/extensions/security/x-scalar-security-secrets.js +66 -37
  121. package/dist/schemas/extensions/security/x-tokenName.js +11 -7
  122. package/dist/schemas/extensions/security/x-use-pkce.js +6 -10
  123. package/dist/schemas/extensions/server/x-scalar-selected-server.js +3 -7
  124. package/dist/schemas/extensions/tag/index.js +1 -1
  125. package/dist/schemas/extensions/tag/x-display-name.js +11 -7
  126. package/dist/schemas/extensions/tag/x-tag-groups.js +13 -15
  127. package/dist/schemas/extensions/workspace/index.js +2 -11
  128. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +13 -7
  129. package/dist/schemas/extensions/workspace/x-scalar-tabs.js +15 -13
  130. package/dist/schemas/extensions.js +11 -15
  131. package/dist/schemas/inmemory-workspace.js +13 -21
  132. package/dist/schemas/navigation.js +48 -85
  133. package/dist/schemas/reference-config/appearance.js +15 -22
  134. package/dist/schemas/reference-config/features.js +14 -21
  135. package/dist/schemas/reference-config/index.js +42 -44
  136. package/dist/schemas/reference-config/meta.js +11 -18
  137. package/dist/schemas/reference-config/routing.js +7 -14
  138. package/dist/schemas/reference-config/settings.js +10 -17
  139. package/dist/schemas/typebox-coerce.js +23 -6
  140. package/dist/schemas/v3.1/strict/callback.js +6 -12
  141. package/dist/schemas/v3.1/strict/components.js +26 -48
  142. package/dist/schemas/v3.1/strict/contact.js +9 -12
  143. package/dist/schemas/v3.1/strict/discriminator.js +11 -10
  144. package/dist/schemas/v3.1/strict/encoding.js +15 -12
  145. package/dist/schemas/v3.1/strict/example.js +11 -13
  146. package/dist/schemas/v3.1/strict/external-documentation.js +7 -10
  147. package/dist/schemas/v3.1/strict/header.js +27 -28
  148. package/dist/schemas/v3.1/strict/info.js +10 -16
  149. package/dist/schemas/v3.1/strict/license.js +9 -12
  150. package/dist/schemas/v3.1/strict/link.js +22 -19
  151. package/dist/schemas/v3.1/strict/media-type.js +17 -16
  152. package/dist/schemas/v3.1/strict/oauth-flow.js +28 -62
  153. package/dist/schemas/v3.1/strict/oauthflows.js +14 -20
  154. package/dist/schemas/v3.1/strict/openapi-document.js +126 -210
  155. package/dist/schemas/v3.1/strict/operation.js +16 -43
  156. package/dist/schemas/v3.1/strict/parameter.js +27 -35
  157. package/dist/schemas/v3.1/strict/path-item.js +36 -40
  158. package/dist/schemas/v3.1/strict/paths.js +8 -11
  159. package/dist/schemas/v3.1/strict/ref-definitions.js +76 -100
  160. package/dist/schemas/v3.1/strict/reference.js +18 -21
  161. package/dist/schemas/v3.1/strict/request-body.js +8 -16
  162. package/dist/schemas/v3.1/strict/response.js +12 -16
  163. package/dist/schemas/v3.1/strict/responses.js +13 -11
  164. package/dist/schemas/v3.1/strict/schema.js +149 -157
  165. package/dist/schemas/v3.1/strict/security-requirement.js +13 -12
  166. package/dist/schemas/v3.1/strict/security-scheme.js +29 -41
  167. package/dist/schemas/v3.1/strict/server-variable.js +9 -12
  168. package/dist/schemas/v3.1/strict/server.js +10 -13
  169. package/dist/schemas/v3.1/strict/tag.js +11 -20
  170. package/dist/schemas/v3.1/strict/type-guards.js +20 -20
  171. package/dist/schemas/v3.1/strict/xml.js +17 -16
  172. package/dist/schemas/workspace-specification/index.js +11 -23
  173. package/dist/schemas/workspace-specification/info.js +4 -8
  174. package/dist/schemas/workspace.js +25 -51
  175. package/dist/schemas.js +2 -6
  176. package/dist/server.js +286 -176
  177. package/dist/workspace-plugin.js +1 -1
  178. package/package.json +13 -19
  179. package/dist/client.js.map +0 -7
  180. package/dist/entities/auth/index.js.map +0 -7
  181. package/dist/entities/auth/schema.js.map +0 -7
  182. package/dist/entities/history/index.js.map +0 -7
  183. package/dist/entities/history/schema.js.map +0 -7
  184. package/dist/events/bus.js.map +0 -7
  185. package/dist/events/definitions/analytics.js.map +0 -7
  186. package/dist/events/definitions/auth.js.map +0 -7
  187. package/dist/events/definitions/common.js.map +0 -7
  188. package/dist/events/definitions/cookie.js.map +0 -7
  189. package/dist/events/definitions/document.js.map +0 -7
  190. package/dist/events/definitions/environment.js.map +0 -7
  191. package/dist/events/definitions/hooks.js.map +0 -7
  192. package/dist/events/definitions/index.js.map +0 -7
  193. package/dist/events/definitions/meta.js.map +0 -7
  194. package/dist/events/definitions/operation.js.map +0 -7
  195. package/dist/events/definitions/server.js.map +0 -7
  196. package/dist/events/definitions/tabs.js.map +0 -7
  197. package/dist/events/definitions/tag.js.map +0 -7
  198. package/dist/events/definitions/ui.js.map +0 -7
  199. package/dist/events/definitions/workspace.js.map +0 -7
  200. package/dist/events/index.js.map +0 -7
  201. package/dist/events/listeners.js.map +0 -7
  202. package/dist/events/old-definitions.js.map +0 -7
  203. package/dist/helpers/apply-selective-updates.d.ts +0 -19
  204. package/dist/helpers/apply-selective-updates.d.ts.map +0 -1
  205. package/dist/helpers/apply-selective-updates.js +0 -37
  206. package/dist/helpers/apply-selective-updates.js.map +0 -7
  207. package/dist/helpers/deep-clone.js.map +0 -7
  208. package/dist/helpers/detect-changes-proxy.js.map +0 -7
  209. package/dist/helpers/general.js.map +0 -7
  210. package/dist/helpers/generate-unique-value.js.map +0 -7
  211. package/dist/helpers/get-fetch.js.map +0 -7
  212. package/dist/helpers/get-resolved-ref.js.map +0 -7
  213. package/dist/helpers/is-non-optional-security-requirement.js.map +0 -7
  214. package/dist/helpers/merge-object.js.map +0 -7
  215. package/dist/helpers/overrides-proxy.js.map +0 -7
  216. package/dist/helpers/unpack-proxy.js.map +0 -7
  217. package/dist/mutators/auth.js.map +0 -7
  218. package/dist/mutators/cookie.js.map +0 -7
  219. package/dist/mutators/document.js.map +0 -7
  220. package/dist/mutators/environment.js.map +0 -7
  221. package/dist/mutators/helpers.js.map +0 -7
  222. package/dist/mutators/index.js.map +0 -7
  223. package/dist/mutators/operation/body.js.map +0 -7
  224. package/dist/mutators/operation/extensions.js.map +0 -7
  225. package/dist/mutators/operation/helpers/fetch-request-to-har.js.map +0 -7
  226. package/dist/mutators/operation/helpers/fetch-response-to-har.js.map +0 -7
  227. package/dist/mutators/operation/helpers/get-parameter-position.js.map +0 -7
  228. package/dist/mutators/operation/helpers/har-to-operation.js.map +0 -7
  229. package/dist/mutators/operation/helpers/sync-path-parameters.js.map +0 -7
  230. package/dist/mutators/operation/history.js.map +0 -7
  231. package/dist/mutators/operation/index.js.map +0 -7
  232. package/dist/mutators/operation/operation.js.map +0 -7
  233. package/dist/mutators/operation/parameters.js.map +0 -7
  234. package/dist/mutators/server.js.map +0 -7
  235. package/dist/mutators/tabs.js.map +0 -7
  236. package/dist/mutators/tag.js.map +0 -7
  237. package/dist/mutators/workspace.js.map +0 -7
  238. package/dist/navigation/get-navigation-options.js.map +0 -7
  239. package/dist/navigation/helpers/get-openapi-object.js.map +0 -7
  240. package/dist/navigation/helpers/get-operation-entries.js.map +0 -7
  241. package/dist/navigation/helpers/get-parent-entry.js.map +0 -7
  242. package/dist/navigation/helpers/get-tag-entries.js.map +0 -7
  243. package/dist/navigation/helpers/get-tag.js.map +0 -7
  244. package/dist/navigation/helpers/get-x-keys.js.map +0 -7
  245. package/dist/navigation/helpers/traverse-description.js.map +0 -7
  246. package/dist/navigation/helpers/traverse-document.js.map +0 -7
  247. package/dist/navigation/helpers/traverse-examples.js.map +0 -7
  248. package/dist/navigation/helpers/traverse-paths.js.map +0 -7
  249. package/dist/navigation/helpers/traverse-schemas.js.map +0 -7
  250. package/dist/navigation/helpers/traverse-tags.js.map +0 -7
  251. package/dist/navigation/helpers/traverse-webhooks.js.map +0 -7
  252. package/dist/navigation/helpers/update-order-ids.js.map +0 -7
  253. package/dist/navigation/helpers/utils.js.map +0 -7
  254. package/dist/navigation/index.js.map +0 -7
  255. package/dist/navigation/types.js.map +0 -7
  256. package/dist/persistence/index.js.map +0 -7
  257. package/dist/persistence/indexdb.js.map +0 -7
  258. package/dist/plugins/bundler/helpers.js.map +0 -7
  259. package/dist/plugins/bundler/index.js.map +0 -7
  260. package/dist/plugins/client/index.js.map +0 -7
  261. package/dist/plugins/client/persistence.js.map +0 -7
  262. package/dist/resolve.js.map +0 -7
  263. package/dist/schemas/compose.js.map +0 -7
  264. package/dist/schemas/extensions/document/x-internal.js.map +0 -7
  265. package/dist/schemas/extensions/document/x-scalar-environments.js.map +0 -7
  266. package/dist/schemas/extensions/document/x-scalar-icon.js.map +0 -7
  267. package/dist/schemas/extensions/document/x-scalar-ignore.js.map +0 -7
  268. package/dist/schemas/extensions/document/x-scalar-is-dirty.js.map +0 -7
  269. package/dist/schemas/extensions/document/x-scalar-original-document-hash.js.map +0 -7
  270. package/dist/schemas/extensions/document/x-scalar-registry-meta.js.map +0 -7
  271. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +0 -7
  272. package/dist/schemas/extensions/document/x-scalar-watch-mode.js.map +0 -7
  273. package/dist/schemas/extensions/document/x-tags.js.map +0 -7
  274. package/dist/schemas/extensions/example/x-disabled.js.map +0 -7
  275. package/dist/schemas/extensions/general/x-scalar-active-environment.js.map +0 -7
  276. package/dist/schemas/extensions/general/x-scalar-cookies.js.map +0 -7
  277. package/dist/schemas/extensions/general/x-scalar-order.js.map +0 -7
  278. package/dist/schemas/extensions/operation/index.js.map +0 -7
  279. package/dist/schemas/extensions/operation/x-badge.js.map +0 -7
  280. package/dist/schemas/extensions/operation/x-code-samples.js.map +0 -7
  281. package/dist/schemas/extensions/operation/x-draft-examples.js.map +0 -7
  282. package/dist/schemas/extensions/operation/x-post-response.js.map +0 -7
  283. package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js.map +0 -7
  284. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +0 -7
  285. package/dist/schemas/extensions/operation/x-scalar-stability.js.map +0 -7
  286. package/dist/schemas/extensions/parameter/x-global.js.map +0 -7
  287. package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +0 -7
  288. package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +0 -7
  289. package/dist/schemas/extensions/schema/x-enum-varnames.js.map +0 -7
  290. package/dist/schemas/extensions/schema/x-examples.js.map +0 -7
  291. package/dist/schemas/extensions/schema/x-variable.js.map +0 -7
  292. package/dist/schemas/extensions/security/index.js.map +0 -7
  293. package/dist/schemas/extensions/security/x-default-scopes.js.map +0 -7
  294. package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +0 -7
  295. package/dist/schemas/extensions/security/x-scalar-security-body.js.map +0 -7
  296. package/dist/schemas/extensions/security/x-scalar-security-query.js.map +0 -7
  297. package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +0 -7
  298. package/dist/schemas/extensions/security/x-tokenName.js.map +0 -7
  299. package/dist/schemas/extensions/security/x-use-pkce.js.map +0 -7
  300. package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +0 -7
  301. package/dist/schemas/extensions/tag/index.js.map +0 -7
  302. package/dist/schemas/extensions/tag/x-display-name.js.map +0 -7
  303. package/dist/schemas/extensions/tag/x-tag-groups.js.map +0 -7
  304. package/dist/schemas/extensions/workspace/index.js.map +0 -7
  305. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +0 -7
  306. package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +0 -7
  307. package/dist/schemas/extensions.js.map +0 -7
  308. package/dist/schemas/inmemory-workspace.js.map +0 -7
  309. package/dist/schemas/navigation.js.map +0 -7
  310. package/dist/schemas/reference-config/appearance.js.map +0 -7
  311. package/dist/schemas/reference-config/features.js.map +0 -7
  312. package/dist/schemas/reference-config/index.js.map +0 -7
  313. package/dist/schemas/reference-config/meta.js.map +0 -7
  314. package/dist/schemas/reference-config/routing.js.map +0 -7
  315. package/dist/schemas/reference-config/settings.js.map +0 -7
  316. package/dist/schemas/typebox-coerce.js.map +0 -7
  317. package/dist/schemas/v3.1/strict/callback.js.map +0 -7
  318. package/dist/schemas/v3.1/strict/components.js.map +0 -7
  319. package/dist/schemas/v3.1/strict/contact.js.map +0 -7
  320. package/dist/schemas/v3.1/strict/discriminator.js.map +0 -7
  321. package/dist/schemas/v3.1/strict/encoding.js.map +0 -7
  322. package/dist/schemas/v3.1/strict/example.js.map +0 -7
  323. package/dist/schemas/v3.1/strict/external-documentation.js.map +0 -7
  324. package/dist/schemas/v3.1/strict/header.js.map +0 -7
  325. package/dist/schemas/v3.1/strict/info.js.map +0 -7
  326. package/dist/schemas/v3.1/strict/license.js.map +0 -7
  327. package/dist/schemas/v3.1/strict/link.js.map +0 -7
  328. package/dist/schemas/v3.1/strict/media-type.js.map +0 -7
  329. package/dist/schemas/v3.1/strict/oauth-flow.js.map +0 -7
  330. package/dist/schemas/v3.1/strict/oauthflows.js.map +0 -7
  331. package/dist/schemas/v3.1/strict/openapi-document.js.map +0 -7
  332. package/dist/schemas/v3.1/strict/operation.js.map +0 -7
  333. package/dist/schemas/v3.1/strict/parameter.js.map +0 -7
  334. package/dist/schemas/v3.1/strict/path-item.js.map +0 -7
  335. package/dist/schemas/v3.1/strict/paths.js.map +0 -7
  336. package/dist/schemas/v3.1/strict/ref-definitions.js.map +0 -7
  337. package/dist/schemas/v3.1/strict/reference.js.map +0 -7
  338. package/dist/schemas/v3.1/strict/request-body.js.map +0 -7
  339. package/dist/schemas/v3.1/strict/response.js.map +0 -7
  340. package/dist/schemas/v3.1/strict/responses.js.map +0 -7
  341. package/dist/schemas/v3.1/strict/schema.js.map +0 -7
  342. package/dist/schemas/v3.1/strict/security-requirement.js.map +0 -7
  343. package/dist/schemas/v3.1/strict/security-scheme.js.map +0 -7
  344. package/dist/schemas/v3.1/strict/server-variable.js.map +0 -7
  345. package/dist/schemas/v3.1/strict/server.js.map +0 -7
  346. package/dist/schemas/v3.1/strict/tag.js.map +0 -7
  347. package/dist/schemas/v3.1/strict/type-guards.js.map +0 -7
  348. package/dist/schemas/v3.1/strict/xml.js.map +0 -7
  349. package/dist/schemas/workspace-specification/index.js.map +0 -7
  350. package/dist/schemas/workspace-specification/info.js.map +0 -7
  351. package/dist/schemas/workspace.js.map +0 -7
  352. package/dist/schemas.js.map +0 -7
  353. package/dist/server.js.map +0 -7
  354. package/dist/workspace-plugin.js.map +0 -7
@@ -1,251 +1,360 @@
1
- import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
2
- import { preventPollution } from "@scalar/helpers/object/prevent-pollution";
3
- import { findVariables } from "@scalar/helpers/regex/find-variables";
4
- import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
5
- import { unpackProxyObject } from "../../helpers/unpack-proxy.js";
6
- import { syncParametersForPathChange } from "../../mutators/operation/helpers/sync-path-parameters.js";
7
- import { getOperationEntries } from "../../navigation/index.js";
8
- import { getNavigationOptions } from "../../navigation/get-navigation-options.js";
9
- import { updateOrderIds } from "../../navigation/helpers/update-order-ids.js";
10
- const createOperation = (workspaceStore, payload) => {
11
- const document = workspaceStore?.workspace.documents[payload.documentName];
12
- if (!document) {
13
- payload.callback?.(false);
14
- return void 0;
15
- }
16
- const { path, method, operation } = payload;
17
- const normalizedPath = path.startsWith("/") ? path : `/${path}`;
18
- if (!document.paths) {
19
- document.paths = {};
20
- }
21
- if (!document.paths[normalizedPath]) {
22
- document.paths[normalizedPath] = {};
23
- }
24
- preventPollution(normalizedPath);
25
- preventPollution(method);
26
- document.paths[normalizedPath][method] = operation;
27
- const { servers } = operation;
28
- const firstServer = unpackProxyObject(servers?.[0]);
29
- for (const server of servers ?? []) {
30
- if (!document.servers?.some((s) => s.url === server.url)) {
31
- if (!document.servers) {
32
- document.servers = [];
33
- }
34
- document.servers.push(unpackProxyObject(server));
35
- }
36
- }
37
- if (firstServer) {
38
- document["x-scalar-selected-server"] = firstServer.url;
39
- }
40
- const existingParameters = operation.parameters;
41
- const result = syncParametersForPathChange(normalizedPath, normalizedPath, existingParameters ?? [], getResolvedRef);
42
- if (existingParameters !== void 0 || result.length > 0) {
43
- operation.parameters = result;
44
- }
45
- payload.callback?.(true);
46
- return normalizedPath;
47
- };
48
- const updateOperationMeta = (store, document, { meta, payload }) => {
49
- if (!document || !store) {
50
- return;
51
- }
52
- const documentName = document["x-scalar-navigation"]?.name;
53
- if (documentName === void 0) {
54
- return;
55
- }
56
- const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
57
- if (!operation) {
58
- console.error("Operation not found", { meta, document });
59
- return;
60
- }
61
- Object.assign(operation, payload);
62
- store.buildSidebar(documentName);
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
2
+ import { preventPollution } from '@scalar/helpers/object/prevent-pollution';
3
+ import { findVariables } from '@scalar/helpers/regex/find-variables';
4
+ import { getResolvedRef } from '../../helpers/get-resolved-ref.js';
5
+ import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
6
+ import { syncParametersForPathChange } from '../../mutators/operation/helpers/sync-path-parameters.js';
7
+ import { getOperationEntries } from '../../navigation/index.js';
8
+ import { getNavigationOptions } from '../../navigation/get-navigation-options.js';
9
+ import { updateOrderIds } from '../../navigation/helpers/update-order-ids.js';
10
+ /**
11
+ * Creates a new operation at a specific path and method in the document.
12
+ * Automatically normalizes the path to ensure it starts with a slash.
13
+ *
14
+ * Returns the normalized path if successful, undefined otherwise.
15
+ *
16
+ * Example:
17
+ * ```ts
18
+ * createOperation(
19
+ * document,
20
+ * 'users',
21
+ * 'get',
22
+ * { tags: ['Users'] },
23
+ * )
24
+ * ```
25
+ */
26
+ export const createOperation = (workspaceStore, payload) => {
27
+ const document = workspaceStore?.workspace.documents[payload.documentName];
28
+ if (!document) {
29
+ payload.callback?.(false);
30
+ return undefined;
31
+ }
32
+ const { path, method, operation } = payload;
33
+ /** Ensure the path starts with a slash */
34
+ const normalizedPath = path.startsWith('/') ? path : `/${path}`;
35
+ /** Create the operation in the document */
36
+ if (!document.paths) {
37
+ document.paths = {};
38
+ }
39
+ if (!document.paths[normalizedPath]) {
40
+ document.paths[normalizedPath] = {};
41
+ }
42
+ /** Prevent pollution of the path and method */
43
+ preventPollution(normalizedPath);
44
+ preventPollution(method);
45
+ /** Create the operation in the document */
46
+ document.paths[normalizedPath][method] = operation;
47
+ // Make sure that we are selecting the new operation server
48
+ const { servers } = operation;
49
+ const firstServer = unpackProxyObject(servers?.[0]);
50
+ // For now we only support document servers but in the future we might support operation servers
51
+ for (const server of servers ?? []) {
52
+ // If the server does not exist in the document, add it
53
+ if (!document.servers?.some((s) => s.url === server.url)) {
54
+ if (!document.servers) {
55
+ document.servers = [];
56
+ }
57
+ document.servers.push(unpackProxyObject(server));
58
+ }
59
+ }
60
+ // Update the selected server to the first server of the created operation
61
+ if (firstServer) {
62
+ document['x-scalar-selected-server'] = firstServer.url;
63
+ }
64
+ const existingParameters = operation.parameters;
65
+ // Sync path variables
66
+ const result = syncParametersForPathChange(normalizedPath, normalizedPath, existingParameters ?? [], getResolvedRef);
67
+ if (existingParameters !== undefined || result.length > 0) {
68
+ operation.parameters = result;
69
+ }
70
+ payload.callback?.(true);
71
+ return normalizedPath;
63
72
  };
64
- const updateOperationPathMethod = (document, store, { meta, payload: { method, path }, callback }) => {
65
- const methodChanged = meta.method !== method;
66
- const pathChanged = meta.path !== path;
67
- if (!methodChanged && !pathChanged) {
68
- callback("no-change");
69
- return;
70
- }
71
- const finalMethod = methodChanged ? method : meta.method;
72
- const finalPath = pathChanged ? path : meta.path;
73
- if (document?.paths?.[finalPath]?.[finalMethod]) {
74
- callback("conflict");
75
- return;
76
- }
77
- const documentNavigation = document?.["x-scalar-navigation"];
78
- if (!documentNavigation || !store) {
79
- console.error("Document or workspace not found", { document });
80
- return;
81
- }
82
- const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
83
- if (!operation) {
84
- console.error("Operation not found", { meta, document });
85
- return;
86
- }
87
- if (pathChanged) {
88
- const oldPathParams = findVariables(meta.path, { includePath: true, includeEnv: false }).filter(
89
- (v) => v !== void 0
90
- );
91
- const newPathParams = findVariables(finalPath, { includePath: true, includeEnv: false }).filter(
92
- (v) => v !== void 0
93
- );
94
- if (oldPathParams.length > 0 || newPathParams.length > 0) {
95
- const existingParameters = operation.parameters ?? [];
96
- const result = syncParametersForPathChange(finalPath, meta.path, existingParameters, getResolvedRef);
97
- operation.parameters = result;
98
- }
99
- }
100
- const { generateId } = getNavigationOptions(documentNavigation.name);
101
- const operationEntriesMap = getOperationEntries(documentNavigation);
102
- const entries = operationEntriesMap.get(`${meta.path}|${meta.method}`);
103
- if (entries) {
104
- updateOrderIds({ store, operation, generateId, method: finalMethod, path: finalPath, entries });
105
- }
106
- if (!document.paths) {
107
- document.paths = {};
108
- }
109
- if (!document.paths[finalPath]) {
110
- document.paths[finalPath] = {};
111
- }
112
- preventPollution(finalPath);
113
- preventPollution(meta.path);
114
- preventPollution(finalMethod);
115
- document.paths[finalPath][finalMethod] = unpackProxyObject(operation);
116
- const oldPathItems = document.paths[meta.path];
117
- if (oldPathItems && isHttpMethod(meta.method)) {
118
- delete oldPathItems[meta.method];
119
- if (Object.keys(oldPathItems).length === 0) {
120
- delete document.paths[meta.path];
121
- }
122
- }
123
- store.history.clearOperationHistory(document["x-scalar-navigation"]?.name ?? "", meta.path, meta.method);
124
- callback("success");
73
+ /**
74
+ * Updates the `description` of an operation.
75
+ * Safely no-ops if the document or operation does not exist.
76
+ *
77
+ * Example:
78
+ * ```ts
79
+ * updateOperationDescription(
80
+ * document,
81
+ * { meta: { method: 'get', path: '/users' }, payload: { description: 'Get a single user' },
82
+ * })
83
+ * ```
84
+ */
85
+ export const updateOperationMeta = (store, document, { meta, payload }) => {
86
+ if (!document || !store) {
87
+ return;
88
+ }
89
+ const documentName = document['x-scalar-navigation']?.name;
90
+ if (documentName === undefined) {
91
+ return;
92
+ }
93
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
94
+ if (!operation) {
95
+ console.error('Operation not found', { meta, document });
96
+ return;
97
+ }
98
+ // Update the description of the operation
99
+ Object.assign(operation, payload);
100
+ // Rebuild the sidebar to reflect the cahnges
101
+ store.buildSidebar(documentName);
125
102
  };
126
- const deleteOperation = (workspace, { meta, documentName }) => {
127
- const document = workspace?.workspace.documents[documentName];
128
- if (!document) {
129
- return;
130
- }
131
- preventPollution(meta.path);
132
- preventPollution(meta.method);
133
- delete document.paths?.[meta.path]?.[meta.method];
134
- if (Object.keys(document.paths?.[meta.path] ?? {}).length === 0) {
135
- delete document.paths?.[meta.path];
136
- }
103
+ /**
104
+ * Updates the HTTP method and/or path of an operation and moves it to the new location.
105
+ * This function:
106
+ * 1. Moves the operation from the old method/path to the new method/path under paths
107
+ * 2. Updates x-scalar-order to maintain the operation's position in the sidebar
108
+ * 3. Syncs path parameters when the path changes
109
+ *
110
+ * Safely no-ops if nothing has changed, or if the document or operation does not exist.
111
+ *
112
+ * Example:
113
+ * ```ts
114
+ * updateOperationPathMethod({
115
+ * document,
116
+ * store,
117
+ * meta: { method: 'get', path: '/users' },
118
+ * payload: { method: 'post', path: '/api/users' },
119
+ * })
120
+ * ```
121
+ */
122
+ export const updateOperationPathMethod = (document, store, { meta, payload: { method, path }, callback }) => {
123
+ const methodChanged = meta.method !== method;
124
+ const pathChanged = meta.path !== path;
125
+ // If nothing has changed, no need to do anything
126
+ if (!methodChanged && !pathChanged) {
127
+ callback('no-change');
128
+ return;
129
+ }
130
+ // Determine the final method and path
131
+ const finalMethod = methodChanged ? method : meta.method;
132
+ const finalPath = pathChanged ? path : meta.path;
133
+ // Check for conflicts at the target location
134
+ if (document?.paths?.[finalPath]?.[finalMethod]) {
135
+ callback('conflict');
136
+ return;
137
+ }
138
+ const documentNavigation = document?.['x-scalar-navigation'];
139
+ if (!documentNavigation || !store) {
140
+ console.error('Document or workspace not found', { document });
141
+ return;
142
+ }
143
+ const operation = getResolvedRef(document.paths?.[meta.path]?.[meta.method]);
144
+ if (!operation) {
145
+ console.error('Operation not found', { meta, document });
146
+ return;
147
+ }
148
+ // Sync path parameters if the path has changed
149
+ if (pathChanged) {
150
+ const oldPathParams = findVariables(meta.path, { includePath: true, includeEnv: false }).filter((v) => v !== undefined);
151
+ const newPathParams = findVariables(finalPath, { includePath: true, includeEnv: false }).filter((v) => v !== undefined);
152
+ if (oldPathParams.length > 0 || newPathParams.length > 0) {
153
+ const existingParameters = operation.parameters ?? [];
154
+ const result = syncParametersForPathChange(finalPath, meta.path, existingParameters, getResolvedRef);
155
+ operation.parameters = result;
156
+ }
157
+ }
158
+ /**
159
+ * We don't pass navigation options as we don't have config on the client,
160
+ * and we don't change path or method on the references
161
+ */
162
+ const { generateId } = getNavigationOptions(documentNavigation.name);
163
+ /** Grabs all of the current operation entries for the given path and method */
164
+ const operationEntriesMap = getOperationEntries(documentNavigation);
165
+ const entries = operationEntriesMap.get(`${meta.path}|${meta.method}`);
166
+ // Updates the order ID so we don't lose the sidebar ordering when it rebuilds
167
+ if (entries) {
168
+ updateOrderIds({ store, operation, generateId, method: finalMethod, path: finalPath, entries });
169
+ }
170
+ // Initialize the paths object if it does not exist
171
+ if (!document.paths) {
172
+ document.paths = {};
173
+ }
174
+ // Initialize the new path if it does not exist
175
+ if (!document.paths[finalPath]) {
176
+ document.paths[finalPath] = {};
177
+ }
178
+ // Prevent assigning dangerous keys to the path items object
179
+ preventPollution(finalPath);
180
+ preventPollution(meta.path);
181
+ preventPollution(finalMethod);
182
+ // Move the operation to the new location
183
+ document.paths[finalPath][finalMethod] = unpackProxyObject(operation);
184
+ // Remove the operation from the old location
185
+ const oldPathItems = document.paths[meta.path];
186
+ if (oldPathItems && isHttpMethod(meta.method)) {
187
+ delete oldPathItems[meta.method];
188
+ // If the old path has no more operations, remove the path entry
189
+ if (Object.keys(oldPathItems).length === 0) {
190
+ delete document.paths[meta.path];
191
+ }
192
+ }
193
+ // We need to reset the history for the operation when the path or method changes
194
+ store.history.clearOperationHistory(document['x-scalar-navigation']?.name ?? '', meta.path, meta.method);
195
+ callback('success');
137
196
  };
138
- const createOperationDraftExample = (workspace, { meta: { path, method }, documentName, exampleName }) => {
139
- const document = workspace?.workspace.documents[documentName];
140
- if (!document) {
141
- console.error("Document not found", { documentName });
142
- return;
143
- }
144
- const operation = getResolvedRef(document.paths?.[path]?.[method]);
145
- if (!operation) {
146
- console.error("Operation not found", { path, method });
147
- return;
148
- }
149
- operation["x-draft-examples"] ??= [];
150
- const dedupe = new Set(operation["x-draft-examples"]);
151
- dedupe.add(exampleName);
152
- operation["x-draft-examples"] = Array.from(dedupe);
197
+ /**
198
+ * Deletes an operation from the workspace
199
+ *
200
+ * Example:
201
+ * ```ts
202
+ * deleteOperation({
203
+ * document,
204
+ * meta: { method: 'get', path: '/users' },
205
+ * })
206
+ * ```
207
+ */
208
+ export const deleteOperation = (workspace, { meta, documentName }) => {
209
+ const document = workspace?.workspace.documents[documentName];
210
+ if (!document) {
211
+ return;
212
+ }
213
+ preventPollution(meta.path);
214
+ preventPollution(meta.method);
215
+ delete document.paths?.[meta.path]?.[meta.method];
216
+ // If the path has no more operations, remove the path entry
217
+ if (Object.keys(document.paths?.[meta.path] ?? {}).length === 0) {
218
+ delete document.paths?.[meta.path];
219
+ }
153
220
  };
154
- const deleteOperationExample = (workspace, { meta: { path, method, exampleKey }, documentName }) => {
155
- const document = workspace?.workspace.documents[documentName];
156
- if (!document) {
157
- return;
158
- }
159
- const operation = getResolvedRef(document.paths?.[path]?.[method]);
160
- if (!operation) {
161
- return;
162
- }
163
- const dedupe = new Set(operation["x-draft-examples"] ?? []);
164
- dedupe.delete(exampleKey);
165
- if (operation["x-draft-examples"] !== void 0) {
166
- operation["x-draft-examples"] = Array.from(dedupe);
167
- }
168
- operation.parameters?.forEach((parameter) => {
169
- const resolvedParameter = getResolvedRef(parameter);
170
- if ("content" in resolvedParameter && resolvedParameter.content) {
171
- Object.values(resolvedParameter.content).forEach((mediaType) => {
172
- delete mediaType.examples?.[exampleKey];
173
- });
174
- }
175
- if ("examples" in resolvedParameter && resolvedParameter.examples) {
176
- delete resolvedParameter.examples?.[exampleKey];
177
- }
178
- });
179
- const requestBody = getResolvedRef(operation.requestBody);
180
- if (!requestBody) {
181
- return;
182
- }
183
- Object.values(requestBody.content ?? {}).forEach((mediaType) => {
184
- delete mediaType.examples?.[exampleKey];
185
- });
221
+ /**
222
+ * Adds an example name to the 'x-draft-examples' array for a specific operation in a document.
223
+ *
224
+ * - Finds the target operation using the provided path and method within the specified document.
225
+ * - If the operation is found and has an 'x-draft-examples' array, pushes the new exampleName to it.
226
+ * - Safely no-ops if the document or operation does not exist.
227
+ */
228
+ export const createOperationDraftExample = (workspace, { meta: { path, method }, documentName, exampleName }) => {
229
+ const document = workspace?.workspace.documents[documentName];
230
+ if (!document) {
231
+ console.error('Document not found', { documentName });
232
+ return;
233
+ }
234
+ const operation = getResolvedRef(document.paths?.[path]?.[method]);
235
+ if (!operation) {
236
+ console.error('Operation not found', { path, method });
237
+ return;
238
+ }
239
+ // Ensure that the x-draft-examples array exists
240
+ operation['x-draft-examples'] ??= [];
241
+ // Remove duplicates
242
+ const dedupe = new Set(operation['x-draft-examples']);
243
+ // Add the new example name
244
+ dedupe.add(exampleName);
245
+ // Update the operation with the new x-draft-examples array
246
+ operation['x-draft-examples'] = Array.from(dedupe);
186
247
  };
187
- const renameOperationExample = (workspace, { meta: { path, method, exampleKey }, documentName, payload }) => {
188
- const document = workspace?.workspace.documents[documentName];
189
- if (!document) {
190
- return;
191
- }
192
- const operation = getResolvedRef(document.paths?.[path]?.[method]);
193
- if (!operation) {
194
- return;
195
- }
196
- const nextExampleName = payload.name.trim();
197
- if (!nextExampleName || nextExampleName === exampleKey) {
198
- return;
199
- }
200
- preventPollution(nextExampleName);
201
- const records = [];
202
- operation.parameters?.forEach((parameter) => {
203
- const resolvedParameter = getResolvedRef(parameter);
204
- if ("examples" in resolvedParameter && resolvedParameter.examples) {
205
- records.push(resolvedParameter.examples);
206
- }
207
- if ("content" in resolvedParameter && resolvedParameter.content) {
208
- Object.values(resolvedParameter.content).forEach((mediaType) => {
209
- if (mediaType.examples) {
210
- records.push(mediaType.examples);
248
+ /**
249
+ * Deletes an example with the given exampleKey from operation parameters and request body.
250
+ *
251
+ * - Finds the target operation within the specified document and path/method.
252
+ * - Removes example values matching exampleKey from both parameter-level and content-level examples.
253
+ * - Safely no-ops if the document, operation, or request body does not exist.
254
+ */
255
+ export const deleteOperationExample = (workspace, { meta: { path, method, exampleKey }, documentName }) => {
256
+ // Find the document in workspace based on documentName
257
+ const document = workspace?.workspace.documents[documentName];
258
+ if (!document) {
259
+ return;
260
+ }
261
+ // Get the operation object for the given path and method
262
+ const operation = getResolvedRef(document.paths?.[path]?.[method]);
263
+ if (!operation) {
264
+ return;
265
+ }
266
+ // Remove the example from the x-draft-examples array
267
+ const dedupe = new Set(operation['x-draft-examples'] ?? []);
268
+ dedupe.delete(exampleKey);
269
+ if (operation['x-draft-examples'] !== undefined) {
270
+ operation['x-draft-examples'] = Array.from(dedupe);
271
+ }
272
+ // Remove the example from all operation parameters
273
+ operation.parameters?.forEach((parameter) => {
274
+ const resolvedParameter = getResolvedRef(parameter);
275
+ // Remove from content-level examples (if parameter uses content)
276
+ if ('content' in resolvedParameter && resolvedParameter.content) {
277
+ Object.values(resolvedParameter.content).forEach((mediaType) => {
278
+ delete mediaType.examples?.[exampleKey];
279
+ });
280
+ }
281
+ // Remove from parameter-level examples
282
+ if ('examples' in resolvedParameter && resolvedParameter.examples) {
283
+ delete resolvedParameter.examples?.[exampleKey];
211
284
  }
212
- });
285
+ });
286
+ // Remove the example from request body content types (if requestBody exists)
287
+ const requestBody = getResolvedRef(operation.requestBody);
288
+ if (!requestBody) {
289
+ return;
213
290
  }
214
- });
215
- const requestBody = getResolvedRef(operation.requestBody);
216
- if (requestBody) {
291
+ // For each media type, remove the example matching exampleKey
217
292
  Object.values(requestBody.content ?? {}).forEach((mediaType) => {
218
- if (mediaType.examples) {
219
- records.push(mediaType.examples);
220
- }
293
+ delete mediaType.examples?.[exampleKey];
221
294
  });
222
- if (requestBody["x-scalar-selected-content-type"]) {
223
- records.push(requestBody["x-scalar-selected-content-type"]);
224
- }
225
- }
226
- if (operation["x-draft-examples"]?.includes(nextExampleName) || records.some((record) => Object.hasOwn(record, nextExampleName))) {
227
- return;
228
- }
229
- if (operation["x-draft-examples"]) {
230
- operation["x-draft-examples"] = operation["x-draft-examples"].map(
231
- (name) => name === exampleKey ? nextExampleName : name
232
- );
233
- }
234
- records.forEach((record) => {
235
- if (!Object.hasOwn(record, exampleKey)) {
236
- return;
237
- }
238
- record[nextExampleName] = unpackProxyObject(record[exampleKey]);
239
- delete record[exampleKey];
240
- });
241
295
  };
242
- export {
243
- createOperation,
244
- createOperationDraftExample,
245
- deleteOperation,
246
- deleteOperationExample,
247
- renameOperationExample,
248
- updateOperationMeta,
249
- updateOperationPathMethod
296
+ /**
297
+ * Renames an example key for an operation across all operation-level example containers:
298
+ * - `x-draft-examples`
299
+ * - parameter-level examples
300
+ * - parameter content-level examples
301
+ * - request-body content examples
302
+ * - request-body selected-content-type map
303
+ *
304
+ * If the target example name already exists in any container, this is a no-op to avoid
305
+ * accidental data overwrites.
306
+ */
307
+ export const renameOperationExample = (workspace, { meta: { path, method, exampleKey }, documentName, payload }) => {
308
+ const document = workspace?.workspace.documents[documentName];
309
+ if (!document) {
310
+ return;
311
+ }
312
+ const operation = getResolvedRef(document.paths?.[path]?.[method]);
313
+ if (!operation) {
314
+ return;
315
+ }
316
+ const nextExampleName = payload.name.trim();
317
+ if (!nextExampleName || nextExampleName === exampleKey) {
318
+ return;
319
+ }
320
+ preventPollution(nextExampleName);
321
+ const records = [];
322
+ operation.parameters?.forEach((parameter) => {
323
+ const resolvedParameter = getResolvedRef(parameter);
324
+ if ('examples' in resolvedParameter && resolvedParameter.examples) {
325
+ records.push(resolvedParameter.examples);
326
+ }
327
+ if ('content' in resolvedParameter && resolvedParameter.content) {
328
+ Object.values(resolvedParameter.content).forEach((mediaType) => {
329
+ if (mediaType.examples) {
330
+ records.push(mediaType.examples);
331
+ }
332
+ });
333
+ }
334
+ });
335
+ const requestBody = getResolvedRef(operation.requestBody);
336
+ if (requestBody) {
337
+ Object.values(requestBody.content ?? {}).forEach((mediaType) => {
338
+ if (mediaType.examples) {
339
+ records.push(mediaType.examples);
340
+ }
341
+ });
342
+ if (requestBody['x-scalar-selected-content-type']) {
343
+ records.push(requestBody['x-scalar-selected-content-type']);
344
+ }
345
+ }
346
+ if (operation['x-draft-examples']?.includes(nextExampleName) ||
347
+ records.some((record) => Object.hasOwn(record, nextExampleName))) {
348
+ return;
349
+ }
350
+ if (operation['x-draft-examples']) {
351
+ operation['x-draft-examples'] = operation['x-draft-examples'].map((name) => name === exampleKey ? nextExampleName : name);
352
+ }
353
+ records.forEach((record) => {
354
+ if (!Object.hasOwn(record, exampleKey)) {
355
+ return;
356
+ }
357
+ record[nextExampleName] = unpackProxyObject(record[exampleKey]);
358
+ delete record[exampleKey];
359
+ });
250
360
  };
251
- //# sourceMappingURL=operation.js.map