@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,111 +1,123 @@
1
- import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
2
- import { objectKeys } from "@scalar/helpers/object/object-keys";
3
- import { escapeJsonPointer } from "@scalar/json-magic/helpers/escape-json-pointer";
4
- import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
5
- import { traverseOperationExamples } from "../../navigation/helpers/traverse-examples.js";
6
- import { XScalarStabilityValues } from "../../schemas/extensions/operation/index.js";
7
- import { getTag } from "./get-tag.js";
8
- const isDeprecatedOperation = (operation) => {
9
- return operation.deprecated || operation["x-scalar-stability"] === XScalarStabilityValues.Deprecated;
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
2
+ import { objectKeys } from '@scalar/helpers/object/object-keys';
3
+ import { escapeJsonPointer } from '@scalar/json-magic/helpers/escape-json-pointer';
4
+ import { getResolvedRef } from '../../helpers/get-resolved-ref.js';
5
+ import { traverseOperationExamples } from '../../navigation/helpers/traverse-examples.js';
6
+ import { XScalarStabilityValues } from '../../schemas/extensions/operation/index.js';
7
+ import { getTag } from './get-tag.js';
8
+ export const isDeprecatedOperation = (operation) => {
9
+ return operation.deprecated || operation['x-scalar-stability'] === XScalarStabilityValues.Deprecated;
10
10
  };
11
- const createOperationEntry = ({
12
- ref,
13
- operation,
14
- method,
15
- path,
16
- generateId,
17
- parentId,
18
- parentTag
19
- }) => {
20
- const id = generateId({
21
- type: "operation",
22
- operation,
23
- parentTag,
24
- method,
25
- path,
26
- parentId
27
- });
28
- const title = operation.summary?.trim() ? operation.summary : path;
29
- const isDeprecated = isDeprecatedOperation(operation);
30
- const examples = traverseOperationExamples(operation).map((example) => ({
31
- type: "example",
32
- id: generateId({
33
- type: "example",
34
- parentId: id,
35
- name: example
36
- }),
37
- title: example,
38
- name: example
39
- }));
40
- const entry = {
41
- id,
42
- title,
43
- path,
44
- method,
45
- ref,
46
- type: "operation",
47
- isDeprecated,
48
- children: examples.length ? examples : void 0
49
- };
50
- return entry;
11
+ /**
12
+ * Creates a traversed operation entry from an OpenAPI operation object.
13
+ *
14
+ * @param ref - JSON pointer reference to the operation in the OpenAPI document
15
+ * @param operation - The OpenAPI operation object
16
+ * @param method - HTTP method of the operation
17
+ * @param path - API path of the operation, defaults to 'Unknown'
18
+ * @param tag - Tag object associated with the operation
19
+ * @param entitiesMap - Map to store operation IDs and titles for mobile header navigation
20
+ * @param getOperationId - Function to generate unique IDs for operations
21
+ * @returns A traversed operation entry with ID, title, path, method and reference
22
+ */
23
+ const createOperationEntry = ({ ref, operation, method, path, generateId, parentId, parentTag, }) => {
24
+ const id = generateId({
25
+ type: 'operation',
26
+ operation,
27
+ parentTag,
28
+ method: method,
29
+ path: path,
30
+ parentId: parentId,
31
+ });
32
+ const title = operation.summary?.trim() ? operation.summary : path;
33
+ const isDeprecated = isDeprecatedOperation(operation);
34
+ const examples = traverseOperationExamples(operation).map((example) => ({
35
+ type: 'example',
36
+ id: generateId({
37
+ type: 'example',
38
+ parentId: id,
39
+ name: example,
40
+ }),
41
+ title: example,
42
+ name: example,
43
+ }));
44
+ const entry = {
45
+ id,
46
+ title,
47
+ path,
48
+ method,
49
+ ref,
50
+ type: 'operation',
51
+ isDeprecated,
52
+ children: examples.length ? examples : undefined,
53
+ };
54
+ return entry;
51
55
  };
52
- const traversePaths = ({
53
- document,
54
- tagsMap,
55
- generateId,
56
- documentId
57
- }) => {
58
- const untaggedOperations = [];
59
- Object.entries(document.paths ?? {}).forEach(([path, pathItemObject]) => {
60
- const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key));
61
- pathKeys.forEach((method) => {
62
- const _operation = pathItemObject?.[method];
63
- const operation = getResolvedRef(_operation);
64
- if (!operation) {
65
- return;
66
- }
67
- if (operation["x-internal"] || operation["x-scalar-ignore"] || !isHttpMethod(method)) {
68
- return;
69
- }
70
- const ref = `#/paths/${escapeJsonPointer(path)}/${method}`;
71
- if (operation.tags?.length) {
72
- operation.tags.forEach((tagName) => {
73
- const { tag, id: tagId } = getTag({
74
- tagsMap,
75
- name: tagName,
76
- documentId,
77
- generateId
78
- });
79
- tagsMap.get(tagName)?.entries.push(
80
- createOperationEntry({
81
- ref,
82
- operation,
83
- method,
84
- path,
85
- parentTag: { tag, id: tagId },
86
- generateId,
87
- parentId: tagId
88
- })
89
- );
56
+ /**
57
+ * Traverses the paths in an OpenAPI document to build a map of operations organized by tags.
58
+ *
59
+ * This function processes each path and its operations to:
60
+ * - Filter out internal operations (marked with x-internal) and operations to ignore (marked with x-scalar-ignore)
61
+ * - Group operations by their tags
62
+ * - Collect operations without tags to be added at the document level
63
+ * - Generate unique references and IDs for each operation
64
+ *
65
+ * TODO: filter out internal and scalar-ignore tags
66
+ *
67
+ * @param content - The OpenAPI document to traverse
68
+ * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects
69
+ * @param entitiesMap - Map to store operation IDs and titles for mobile header navigation
70
+ * @param getOperationId - Function to generate unique IDs for operations
71
+ * @returns Object containing the tagsMap and an array of untagged operations
72
+ */
73
+ export const traversePaths = ({ document, tagsMap, generateId, documentId, }) => {
74
+ const untaggedOperations = [];
75
+ // Traverse paths
76
+ Object.entries(document.paths ?? {}).forEach(([path, pathItemObject]) => {
77
+ const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key));
78
+ pathKeys.forEach((method) => {
79
+ const _operation = pathItemObject?.[method];
80
+ const operation = getResolvedRef(_operation);
81
+ if (!operation) {
82
+ return;
83
+ }
84
+ // Skip if the operation is internal or scalar-ignore
85
+ if (operation['x-internal'] || operation['x-scalar-ignore'] || !isHttpMethod(method)) {
86
+ return;
87
+ }
88
+ const ref = `#/paths/${escapeJsonPointer(path)}/${method}`;
89
+ // Traverse tags
90
+ if (operation.tags?.length) {
91
+ operation.tags.forEach((tagName) => {
92
+ const { tag, id: tagId } = getTag({
93
+ tagsMap,
94
+ name: tagName,
95
+ documentId,
96
+ generateId,
97
+ });
98
+ tagsMap.get(tagName)?.entries.push(createOperationEntry({
99
+ ref,
100
+ operation,
101
+ method,
102
+ path,
103
+ parentTag: { tag, id: tagId },
104
+ generateId,
105
+ parentId: tagId,
106
+ }));
107
+ });
108
+ }
109
+ else {
110
+ // Collect operations without tags (no parentTag)
111
+ untaggedOperations.push(createOperationEntry({
112
+ ref,
113
+ operation,
114
+ method,
115
+ path,
116
+ generateId,
117
+ parentId: documentId,
118
+ }));
119
+ }
90
120
  });
91
- } else {
92
- untaggedOperations.push(
93
- createOperationEntry({
94
- ref,
95
- operation,
96
- method,
97
- path,
98
- generateId,
99
- parentId: documentId
100
- })
101
- );
102
- }
103
121
  });
104
- });
105
- return { untaggedOperations };
106
- };
107
- export {
108
- isDeprecatedOperation,
109
- traversePaths
122
+ return { untaggedOperations };
110
123
  };
111
- //# sourceMappingURL=traverse-paths.js.map
@@ -1,67 +1,68 @@
1
- import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
2
- import { getTag } from "../../navigation/helpers/get-tag.js";
3
- const createSchemaEntry = ({
4
- ref,
5
- name,
6
- generateId,
7
- parentTag,
8
- _schema,
9
- parentId
10
- }) => {
11
- const id = generateId({ name, type: "model", parentTag, parentId, schema: _schema });
12
- const schema = getResolvedRef(_schema);
13
- const title = schema && "title" in schema && schema.title || name;
14
- const entry = {
15
- id,
16
- title,
17
- name,
18
- ref,
19
- type: "model"
20
- };
21
- return entry;
1
+ import { getResolvedRef } from '../../helpers/get-resolved-ref.js';
2
+ import { getTag } from '../../navigation/helpers/get-tag.js';
3
+ /** Creates a traversed schema entry from an OpenAPI schema object.
4
+ *
5
+ * @param ref - JSON pointer reference to the schema in the OpenAPI document
6
+ * @param name - Name of the schema, defaults to 'Unknown'
7
+ * @param entriesMap - Map to store schema IDs and titles for mobile header navigation
8
+ * @param getModelId - Function to generate unique IDs for schemas
9
+ * @returns A traversed schema entry with ID, title, name and reference
10
+ */
11
+ const createSchemaEntry = ({ ref, name, generateId, parentTag, _schema, parentId, }) => {
12
+ const id = generateId({ name, type: 'model', parentTag, parentId, schema: _schema });
13
+ const schema = getResolvedRef(_schema);
14
+ // Use schema.title if available, otherwise fall back to name
15
+ // @see https://json-schema.org/draft/2020-12/json-schema-core#section-4.3.5
16
+ const title = (schema && 'title' in schema && schema.title) || name;
17
+ const entry = {
18
+ id,
19
+ title,
20
+ name,
21
+ ref,
22
+ type: 'model',
23
+ };
24
+ return entry;
22
25
  };
23
- const traverseSchemas = ({
24
- document,
25
- tagsMap,
26
- generateId,
27
- documentId
28
- }) => {
29
- const schemas = document.components?.schemas ?? {};
30
- const untagged = [];
31
- for (const name in schemas) {
32
- const schema = getResolvedRef(schemas[name]);
33
- if (schema?.["x-internal"] || schema?.["x-scalar-ignore"] || !Object.hasOwn(schemas, name)) {
34
- continue;
26
+ /** Traverses the schemas in an OpenAPI document to build an array of model entries.
27
+ *
28
+ * This function processes each schema in components.schemas to:
29
+ * - Filter out internal schemas (marked with x-internal) and schemas to ignore (marked with x-scalar-ignore)
30
+ * - Create model entries with unique references and IDs
31
+ * - Store model IDs and titles for mobile header navigation
32
+ */
33
+ export const traverseSchemas = ({ document, tagsMap, generateId, documentId, }) => {
34
+ const schemas = document.components?.schemas ?? {};
35
+ const untagged = [];
36
+ // biome-ignore lint/suspicious/useGuardForIn: we do have an if statement after de-ref
37
+ for (const name in schemas) {
38
+ const schema = getResolvedRef(schemas[name]);
39
+ if (schema?.['x-internal'] || schema?.['x-scalar-ignore'] || !Object.hasOwn(schemas, name)) {
40
+ continue;
41
+ }
42
+ const ref = `#/components/schemas/${name}`;
43
+ // Add to tags
44
+ if (schema?.['x-tags']) {
45
+ schema['x-tags'].forEach((tagName) => {
46
+ const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
47
+ tagsMap.get(tagName)?.entries.push(createSchemaEntry({
48
+ ref,
49
+ name,
50
+ generateId,
51
+ parentTag: { tag, id: tagId },
52
+ parentId: documentId,
53
+ }));
54
+ });
55
+ }
56
+ // Add to untagged
57
+ else {
58
+ untagged.push(createSchemaEntry({
59
+ ref,
60
+ name,
61
+ generateId,
62
+ _schema: getResolvedRef(schemas[name]),
63
+ parentId: documentId,
64
+ }));
65
+ }
35
66
  }
36
- const ref = `#/components/schemas/${name}`;
37
- if (schema?.["x-tags"]) {
38
- schema["x-tags"].forEach((tagName) => {
39
- const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
40
- tagsMap.get(tagName)?.entries.push(
41
- createSchemaEntry({
42
- ref,
43
- name,
44
- generateId,
45
- parentTag: { tag, id: tagId },
46
- parentId: documentId
47
- })
48
- );
49
- });
50
- } else {
51
- untagged.push(
52
- createSchemaEntry({
53
- ref,
54
- name,
55
- generateId,
56
- _schema: getResolvedRef(schemas[name]),
57
- parentId: documentId
58
- })
59
- );
60
- }
61
- }
62
- return untagged;
63
- };
64
- export {
65
- traverseSchemas
67
+ return untagged;
66
68
  };
67
- //# sourceMappingURL=traverse-schemas.js.map
@@ -1,137 +1,166 @@
1
- import { sortByOrder } from "@scalar/object-utils/arrays";
2
- import { unpackProxyObject } from "../../helpers/unpack-proxy.js";
3
- import { getXKeysFromObject } from "../../navigation/helpers/get-x-keys.js";
4
- import { getTag } from "./get-tag.js";
5
- const createTagEntry = ({
6
- tag,
7
- generateId,
8
- children,
9
- isGroup = false,
10
- parentId
11
- }) => {
12
- const id = generateId({
13
- type: "tag",
14
- tag,
15
- parentId
16
- });
17
- const title = tag["x-displayName"] ?? tag.name ?? "Untitled Tag";
18
- tag["x-scalar-order"] = children.map((child) => child.id);
19
- const entry = {
20
- id,
21
- title,
22
- name: tag.name || title,
23
- description: tag.description,
24
- children,
25
- isGroup,
26
- isWebhooks: false,
27
- type: "tag",
28
- xKeys: getXKeysFromObject(unpackProxyObject(tag))
29
- };
30
- return entry;
1
+ import { sortByOrder } from '@scalar/object-utils/arrays';
2
+ import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
3
+ import { getXKeysFromObject } from '../../navigation/helpers/get-x-keys.js';
4
+ import { getTag } from './get-tag.js';
5
+ /** Creates a traversed tag entry from an OpenAPI tag object.
6
+ *
7
+ * @param tag - The OpenAPI tag object
8
+ * @param entriesMap - Map to store tag IDs and titles for mobile header navigation
9
+ * @param getTagId - Function to generate unique IDs for tags
10
+ * @param children - Array of child entries (operations, webhooks, etc.)
11
+ * @param isGroup - Whether this tag represents a group of tags
12
+ * @returns A traversed tag entry with ID, title, name and children
13
+ */
14
+ const createTagEntry = ({ tag, generateId, children, isGroup = false, parentId, }) => {
15
+ const id = generateId({
16
+ type: 'tag',
17
+ tag,
18
+ parentId,
19
+ });
20
+ const title = tag['x-displayName'] ?? tag.name ?? 'Untitled Tag';
21
+ // Update the order of the children based on the items
22
+ // This will ensure that the sort order is always in sync with the items
23
+ tag['x-scalar-order'] = children.map((child) => child.id);
24
+ const entry = {
25
+ id,
26
+ title,
27
+ name: tag.name || title,
28
+ description: tag.description,
29
+ children,
30
+ isGroup,
31
+ isWebhooks: false,
32
+ type: 'tag',
33
+ xKeys: getXKeysFromObject(unpackProxyObject(tag)),
34
+ };
35
+ return entry;
31
36
  };
32
- const getSortedTagEntries = ({
33
- _keys,
34
- tagsMap,
35
- options: { tagsSorter, operationsSorter, generateId },
36
- documentId,
37
- sortOrder
38
- }) => {
39
- const entries = _keys.flatMap((key) => {
40
- const { tag, entries: entries2 } = getTag({ tagsMap, name: key, documentId, generateId });
41
- if (tag["x-internal"] || tag["x-scalar-ignore"]) {
42
- return [];
37
+ /** Sorts and processes tags to create a hierarchical structure of tag entries.
38
+ *
39
+ * This function handles:
40
+ * - Sorting tags alphabetically or using a custom sort function
41
+ * - Sorting operations within tags by title, method, or custom function
42
+ * - Filtering out internal and ignored tags
43
+ * - Creating tag entries with their associated operations
44
+ *
45
+ * @param _keys - Array of tag keys to process
46
+ * @param tagsMap - Map of tags and their entries
47
+ * @param tagsDict - Dictionary of OpenAPI tags by name
48
+ * @param titlesMap - Map of titles for the mobile header
49
+ * @param options - Sorting and ID generation options
50
+ * @returns Array of processed and sorted tag entries
51
+ */
52
+ /** Sorts tags and returns entries */
53
+ const getSortedTagEntries = ({ _keys, tagsMap, options: { tagsSorter, operationsSorter, generateId }, documentId, sortOrder, }) => {
54
+ /**
55
+ * Process each tag and its entries:
56
+ * - Skip internal and ignored tags
57
+ * - Sort operations within tags
58
+ * - Create tag entries with sorted operations
59
+ */
60
+ const entries = _keys.flatMap((key) => {
61
+ const { tag, entries } = getTag({ tagsMap, name: key, documentId, generateId });
62
+ // Skip if the tag is internal or scalar-ignore
63
+ if (tag['x-internal'] || tag['x-scalar-ignore']) {
64
+ return [];
65
+ }
66
+ const sortOrder = tag['x-scalar-order'];
67
+ if (sortOrder === undefined) {
68
+ // Alpha sort
69
+ if (operationsSorter === 'alpha') {
70
+ entries.sort((a, b) => (a.type === 'operation' && b.type === 'operation' ? a.title.localeCompare(b.title) : 0));
71
+ }
72
+ // Method sort
73
+ else if (operationsSorter === 'method') {
74
+ entries.sort((a, b) => a.type === 'operation' && b.type === 'operation' ? a.method.localeCompare(b.method) : 0);
75
+ }
76
+ // Custom sort
77
+ else if (typeof operationsSorter === 'function') {
78
+ entries.sort((a, b) => {
79
+ // Guard against tags
80
+ if (!(a.type === 'operation' || a.type === 'webhook') || !(b.type === 'operation' || b.type === 'webhook')) {
81
+ return 0;
82
+ }
83
+ // Handle webhooks as well as operations
84
+ const pathA = a.type === 'operation' ? a.path : a.name;
85
+ const pathB = b.type === 'operation' ? b.path : b.name;
86
+ return operationsSorter({ method: a.method, path: pathA, ref: a.ref, httpVerb: a.method }, { method: b.method, path: pathB, ref: b.ref, httpVerb: b.method });
87
+ });
88
+ }
89
+ }
90
+ return createTagEntry({
91
+ tag,
92
+ generateId,
93
+ children: sortOrder ? sortByOrder(entries, sortOrder, 'id') : entries,
94
+ parentId: documentId,
95
+ isGroup: false,
96
+ });
97
+ });
98
+ // If a custom 'x-scalar-order' is specified in the tag, sort the entries by this order using sortByOrder
99
+ if (sortOrder) {
100
+ return sortByOrder(entries, sortOrder, 'id');
43
101
  }
44
- const sortOrder2 = tag["x-scalar-order"];
45
- if (sortOrder2 === void 0) {
46
- if (operationsSorter === "alpha") {
47
- entries2.sort((a, b) => a.type === "operation" && b.type === "operation" ? a.title.localeCompare(b.title) : 0);
48
- } else if (operationsSorter === "method") {
49
- entries2.sort(
50
- (a, b) => a.type === "operation" && b.type === "operation" ? a.method.localeCompare(b.method) : 0
51
- );
52
- } else if (typeof operationsSorter === "function") {
53
- entries2.sort((a, b) => {
54
- if (!(a.type === "operation" || a.type === "webhook") || !(b.type === "operation" || b.type === "webhook")) {
55
- return 0;
56
- }
57
- const pathA = a.type === "operation" ? a.path : a.name;
58
- const pathB = b.type === "operation" ? b.path : b.name;
59
- return operationsSorter(
60
- { method: a.method, path: pathA, ref: a.ref, httpVerb: a.method },
61
- { method: b.method, path: pathB, ref: b.ref, httpVerb: b.method }
62
- );
102
+ // Alpha sort
103
+ if (tagsSorter === 'alpha') {
104
+ entries.sort((a, b) => {
105
+ const nameA = getTag({
106
+ tagsMap,
107
+ name: a.title,
108
+ documentId,
109
+ generateId,
110
+ }).tag['x-displayName'] ||
111
+ a.title ||
112
+ 'Untitled Tag';
113
+ const nameB = getTag({ tagsMap, name: b.title, documentId, generateId }).tag['x-displayName'] || b.title || 'Untitled Tag';
114
+ return nameA.localeCompare(nameB);
63
115
  });
64
- }
65
116
  }
66
- return createTagEntry({
67
- tag,
68
- generateId,
69
- children: sortOrder2 ? sortByOrder(entries2, sortOrder2, "id") : entries2,
70
- parentId: documentId,
71
- isGroup: false
72
- });
73
- });
74
- if (sortOrder) {
75
- return sortByOrder(entries, sortOrder, "id");
76
- }
77
- if (tagsSorter === "alpha") {
78
- entries.sort((a, b) => {
79
- const nameA = getTag({
80
- tagsMap,
81
- name: a.title,
82
- documentId,
83
- generateId
84
- }).tag["x-displayName"] || a.title || "Untitled Tag";
85
- const nameB = getTag({ tagsMap, name: b.title, documentId, generateId }).tag["x-displayName"] || b.title || "Untitled Tag";
86
- return nameA.localeCompare(nameB);
87
- });
88
- } else if (typeof tagsSorter === "function") {
89
- entries.sort(
90
- (a, b) => tagsSorter(
91
- getTag({ tagsMap, name: a.name, documentId, generateId }).tag,
92
- getTag({ tagsMap, name: b.name, documentId, generateId }).tag
93
- )
94
- );
95
- }
96
- return entries;
117
+ // Custom sort
118
+ else if (typeof tagsSorter === 'function') {
119
+ entries.sort((a, b) => tagsSorter(getTag({ tagsMap, name: a.name, documentId, generateId }).tag, getTag({ tagsMap, name: b.name, documentId, generateId }).tag));
120
+ }
121
+ return entries;
97
122
  };
98
- const traverseTags = ({
99
- document,
100
- tagsMap,
101
- documentId,
102
- options: { generateId, tagsSorter, operationsSorter }
103
- }) => {
104
- if (document["x-tagGroups"]) {
105
- const tagGroups = document["x-tagGroups"];
106
- return tagGroups.flatMap((tagGroup) => {
107
- const entries = getSortedTagEntries({
108
- _keys: tagGroup.tags,
123
+ /**
124
+ * Traverses the tags map to create navigation entries, handling both grouped and ungrouped tags.
125
+ *
126
+ * This function processes the OpenAPI document's tags to:
127
+ * - Handle tag groups if specified via x-tagGroups
128
+ * - Sort tags and their operations according to provided sorters
129
+ * - Create navigation entries for each tag or tag group
130
+ */
131
+ export const traverseTags = ({ document, tagsMap, documentId, options: { generateId, tagsSorter, operationsSorter }, }) => {
132
+ // x-tagGroups
133
+ if (document['x-tagGroups']) {
134
+ const tagGroups = document['x-tagGroups'];
135
+ return tagGroups.flatMap((tagGroup) => {
136
+ const entries = getSortedTagEntries({
137
+ _keys: tagGroup.tags,
138
+ tagsMap,
139
+ options: { tagsSorter, operationsSorter, generateId },
140
+ documentId: documentId,
141
+ sortOrder: tagGroup['x-scalar-order'],
142
+ });
143
+ // Try to update the sort order of the tag group to keep it in sync with the items
144
+ tagGroup['x-scalar-order'] = entries.map((entry) => entry.id);
145
+ return entries.length
146
+ ? createTagEntry({
147
+ tag: tagGroup,
148
+ generateId,
149
+ children: entries,
150
+ parentId: documentId,
151
+ isGroup: true,
152
+ })
153
+ : [];
154
+ });
155
+ }
156
+ // Ungrouped regular tags
157
+ const keys = Array.from(tagsMap.keys());
158
+ const tags = getSortedTagEntries({
159
+ _keys: keys,
109
160
  tagsMap,
110
- options: { tagsSorter, operationsSorter, generateId },
111
- documentId,
112
- sortOrder: tagGroup["x-scalar-order"]
113
- });
114
- tagGroup["x-scalar-order"] = entries.map((entry) => entry.id);
115
- return entries.length ? createTagEntry({
116
- tag: tagGroup,
117
- generateId,
118
- children: entries,
119
- parentId: documentId,
120
- isGroup: true
121
- }) : [];
161
+ options: { generateId, tagsSorter, operationsSorter },
162
+ documentId: documentId,
163
+ sortOrder: document['x-scalar-order'],
122
164
  });
123
- }
124
- const keys = Array.from(tagsMap.keys());
125
- const tags = getSortedTagEntries({
126
- _keys: keys,
127
- tagsMap,
128
- options: { generateId, tagsSorter, operationsSorter },
129
- documentId,
130
- sortOrder: document["x-scalar-order"]
131
- });
132
- return tags;
133
- };
134
- export {
135
- traverseTags
165
+ return tags;
136
166
  };
137
- //# sourceMappingURL=traverse-tags.js.map