@scalar/workspace-store 0.40.2 → 0.40.4

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 (368) hide show
  1. package/CHANGELOG.md +13 -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.d.ts +10 -0
  7. package/dist/entities/auth/schema.d.ts.map +1 -1
  8. package/dist/entities/auth/schema.js +42 -116
  9. package/dist/entities/history/index.js +80 -60
  10. package/dist/entities/history/schema.js +94 -88
  11. package/dist/events/bus.js +146 -93
  12. package/dist/events/definitions/analytics.js +1 -1
  13. package/dist/events/definitions/auth.js +1 -1
  14. package/dist/events/definitions/common.js +1 -1
  15. package/dist/events/definitions/cookie.js +1 -1
  16. package/dist/events/definitions/document.js +1 -1
  17. package/dist/events/definitions/environment.js +1 -1
  18. package/dist/events/definitions/hooks.js +1 -1
  19. package/dist/events/definitions/index.js +1 -1
  20. package/dist/events/definitions/meta.js +1 -1
  21. package/dist/events/definitions/operation.js +1 -1
  22. package/dist/events/definitions/server.js +1 -1
  23. package/dist/events/definitions/tabs.js +1 -1
  24. package/dist/events/definitions/tag.js +1 -1
  25. package/dist/events/definitions/ui.js +1 -1
  26. package/dist/events/definitions/workspace.js +1 -1
  27. package/dist/events/index.js +3 -9
  28. package/dist/events/listeners.js +20 -22
  29. package/dist/events/old-definitions.js +15 -12
  30. package/dist/helpers/deep-clone.js +33 -17
  31. package/dist/helpers/detect-changes-proxy.js +95 -57
  32. package/dist/helpers/general.js +78 -23
  33. package/dist/helpers/generate-unique-value.js +77 -45
  34. package/dist/helpers/get-fetch.js +12 -10
  35. package/dist/helpers/get-resolved-ref.js +11 -10
  36. package/dist/helpers/is-non-optional-security-requirement.js +3 -6
  37. package/dist/helpers/merge-object.js +71 -30
  38. package/dist/helpers/overrides-proxy.js +98 -58
  39. package/dist/helpers/unpack-proxy.js +60 -58
  40. package/dist/mutators/auth.js +358 -230
  41. package/dist/mutators/cookie.js +59 -42
  42. package/dist/mutators/document.js +104 -66
  43. package/dist/mutators/environment.js +97 -72
  44. package/dist/mutators/helpers.js +9 -13
  45. package/dist/mutators/index.js +62 -49
  46. package/dist/mutators/operation/body.js +88 -57
  47. package/dist/mutators/operation/extensions.js +20 -12
  48. package/dist/mutators/operation/helpers/fetch-request-to-har.js +144 -107
  49. package/dist/mutators/operation/helpers/fetch-response-to-har.js +143 -95
  50. package/dist/mutators/operation/helpers/get-parameter-position.js +12 -12
  51. package/dist/mutators/operation/helpers/har-to-operation.js +169 -132
  52. package/dist/mutators/operation/helpers/sync-path-parameters.js +109 -60
  53. package/dist/mutators/operation/history.js +60 -64
  54. package/dist/mutators/operation/index.js +25 -49
  55. package/dist/mutators/operation/operation.js +349 -240
  56. package/dist/mutators/operation/parameters.js +157 -93
  57. package/dist/mutators/server.js +213 -152
  58. package/dist/mutators/tabs.js +173 -130
  59. package/dist/mutators/tag.js +131 -97
  60. package/dist/mutators/workspace.js +72 -42
  61. package/dist/navigation/get-navigation-options.js +97 -84
  62. package/dist/navigation/helpers/get-openapi-object.js +46 -29
  63. package/dist/navigation/helpers/get-operation-entries.js +72 -32
  64. package/dist/navigation/helpers/get-parent-entry.js +16 -12
  65. package/dist/navigation/helpers/get-tag-entries.js +56 -29
  66. package/dist/navigation/helpers/get-tag.js +22 -23
  67. package/dist/navigation/helpers/get-x-keys.js +13 -9
  68. package/dist/navigation/helpers/traverse-description.js +90 -72
  69. package/dist/navigation/helpers/traverse-document.js +111 -98
  70. package/dist/navigation/helpers/traverse-examples.js +35 -31
  71. package/dist/navigation/helpers/traverse-paths.js +118 -106
  72. package/dist/navigation/helpers/traverse-schemas.js +65 -64
  73. package/dist/navigation/helpers/traverse-tags.js +158 -129
  74. package/dist/navigation/helpers/traverse-webhooks.js +96 -90
  75. package/dist/navigation/helpers/update-order-ids.js +59 -51
  76. package/dist/navigation/helpers/utils.js +71 -21
  77. package/dist/navigation/index.js +5 -13
  78. package/dist/navigation/types.js +1 -1
  79. package/dist/persistence/index.js +283 -285
  80. package/dist/persistence/indexdb.js +263 -126
  81. package/dist/plugins/bundler/helpers.js +21 -12
  82. package/dist/plugins/bundler/index.d.ts +7 -0
  83. package/dist/plugins/bundler/index.d.ts.map +1 -1
  84. package/dist/plugins/bundler/index.js +305 -171
  85. package/dist/plugins/client/index.js +1 -5
  86. package/dist/plugins/client/persistence.js +95 -90
  87. package/dist/resolve.js +18 -25
  88. package/dist/schemas/compose.js +6 -7
  89. package/dist/schemas/extensions/document/x-internal.js +3 -7
  90. package/dist/schemas/extensions/document/x-scalar-environments.js +16 -22
  91. package/dist/schemas/extensions/document/x-scalar-icon.js +3 -7
  92. package/dist/schemas/extensions/document/x-scalar-ignore.js +3 -7
  93. package/dist/schemas/extensions/document/x-scalar-is-dirty.js +21 -8
  94. package/dist/schemas/extensions/document/x-scalar-original-document-hash.js +17 -8
  95. package/dist/schemas/extensions/document/x-scalar-registry-meta.js +15 -21
  96. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +5 -13
  97. package/dist/schemas/extensions/document/x-scalar-watch-mode.js +4 -8
  98. package/dist/schemas/extensions/document/x-tags.js +3 -7
  99. package/dist/schemas/extensions/example/x-disabled.js +17 -7
  100. package/dist/schemas/extensions/general/x-scalar-active-environment.js +4 -7
  101. package/dist/schemas/extensions/general/x-scalar-cookies.js +9 -14
  102. package/dist/schemas/extensions/general/x-scalar-order.js +8 -7
  103. package/dist/schemas/extensions/operation/index.js +4 -23
  104. package/dist/schemas/extensions/operation/x-badge.js +42 -50
  105. package/dist/schemas/extensions/operation/x-code-samples.js +8 -12
  106. package/dist/schemas/extensions/operation/x-draft-examples.js +3 -7
  107. package/dist/schemas/extensions/operation/x-post-response.js +18 -7
  108. package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js +57 -13
  109. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js +9 -7
  110. package/dist/schemas/extensions/operation/x-scalar-stability.js +15 -14
  111. package/dist/schemas/extensions/parameter/x-global.js +12 -7
  112. package/dist/schemas/extensions/schema/x-additional-properties-name.js +10 -7
  113. package/dist/schemas/extensions/schema/x-enum-descriptions.js +17 -12
  114. package/dist/schemas/extensions/schema/x-enum-varnames.js +21 -8
  115. package/dist/schemas/extensions/schema/x-examples.js +3 -7
  116. package/dist/schemas/extensions/schema/x-variable.js +3 -7
  117. package/dist/schemas/extensions/security/index.js +1 -1
  118. package/dist/schemas/extensions/security/x-default-scopes.js +16 -7
  119. package/dist/schemas/extensions/security/x-scalar-credentials-location.js +16 -7
  120. package/dist/schemas/extensions/security/x-scalar-security-body.js +14 -7
  121. package/dist/schemas/extensions/security/x-scalar-security-query.js +14 -7
  122. package/dist/schemas/extensions/security/x-scalar-security-secrets.js +66 -37
  123. package/dist/schemas/extensions/security/x-tokenName.js +11 -7
  124. package/dist/schemas/extensions/security/x-use-pkce.js +6 -10
  125. package/dist/schemas/extensions/server/x-scalar-selected-server.js +3 -7
  126. package/dist/schemas/extensions/tag/index.js +1 -1
  127. package/dist/schemas/extensions/tag/x-display-name.js +11 -7
  128. package/dist/schemas/extensions/tag/x-tag-groups.js +13 -15
  129. package/dist/schemas/extensions/workspace/index.js +2 -11
  130. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js +13 -7
  131. package/dist/schemas/extensions/workspace/x-scalar-tabs.js +15 -13
  132. package/dist/schemas/extensions.js +11 -15
  133. package/dist/schemas/inmemory-workspace.d.ts +6 -0
  134. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  135. package/dist/schemas/inmemory-workspace.js +13 -21
  136. package/dist/schemas/navigation.js +48 -85
  137. package/dist/schemas/reference-config/appearance.js +15 -22
  138. package/dist/schemas/reference-config/features.js +14 -21
  139. package/dist/schemas/reference-config/index.d.ts +2 -0
  140. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  141. package/dist/schemas/reference-config/index.js +42 -44
  142. package/dist/schemas/reference-config/meta.js +11 -18
  143. package/dist/schemas/reference-config/routing.js +7 -14
  144. package/dist/schemas/reference-config/settings.d.ts +2 -0
  145. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  146. package/dist/schemas/reference-config/settings.js +10 -17
  147. package/dist/schemas/typebox-coerce.js +23 -6
  148. package/dist/schemas/v3.1/strict/callback.js +6 -12
  149. package/dist/schemas/v3.1/strict/components.js +26 -48
  150. package/dist/schemas/v3.1/strict/contact.js +9 -12
  151. package/dist/schemas/v3.1/strict/discriminator.js +11 -10
  152. package/dist/schemas/v3.1/strict/encoding.js +15 -12
  153. package/dist/schemas/v3.1/strict/example.js +11 -13
  154. package/dist/schemas/v3.1/strict/external-documentation.js +7 -10
  155. package/dist/schemas/v3.1/strict/header.js +27 -28
  156. package/dist/schemas/v3.1/strict/info.js +10 -16
  157. package/dist/schemas/v3.1/strict/license.js +9 -12
  158. package/dist/schemas/v3.1/strict/link.js +22 -19
  159. package/dist/schemas/v3.1/strict/media-type.js +17 -16
  160. package/dist/schemas/v3.1/strict/oauth-flow.js +28 -62
  161. package/dist/schemas/v3.1/strict/oauthflows.js +14 -20
  162. package/dist/schemas/v3.1/strict/openapi-document.d.ts +70 -0
  163. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  164. package/dist/schemas/v3.1/strict/openapi-document.js +126 -210
  165. package/dist/schemas/v3.1/strict/operation.js +16 -43
  166. package/dist/schemas/v3.1/strict/parameter.d.ts +6 -0
  167. package/dist/schemas/v3.1/strict/parameter.d.ts.map +1 -1
  168. package/dist/schemas/v3.1/strict/parameter.js +29 -35
  169. package/dist/schemas/v3.1/strict/path-item.js +36 -40
  170. package/dist/schemas/v3.1/strict/paths.js +8 -11
  171. package/dist/schemas/v3.1/strict/ref-definitions.js +76 -100
  172. package/dist/schemas/v3.1/strict/reference.js +18 -21
  173. package/dist/schemas/v3.1/strict/request-body.js +8 -16
  174. package/dist/schemas/v3.1/strict/response.js +12 -16
  175. package/dist/schemas/v3.1/strict/responses.js +13 -11
  176. package/dist/schemas/v3.1/strict/schema.js +149 -157
  177. package/dist/schemas/v3.1/strict/security-requirement.js +13 -12
  178. package/dist/schemas/v3.1/strict/security-scheme.js +29 -41
  179. package/dist/schemas/v3.1/strict/server-variable.js +9 -12
  180. package/dist/schemas/v3.1/strict/server.js +10 -13
  181. package/dist/schemas/v3.1/strict/tag.js +11 -20
  182. package/dist/schemas/v3.1/strict/type-guards.js +20 -20
  183. package/dist/schemas/v3.1/strict/xml.js +17 -16
  184. package/dist/schemas/workspace-specification/index.js +11 -23
  185. package/dist/schemas/workspace-specification/info.js +4 -8
  186. package/dist/schemas/workspace.d.ts +6 -0
  187. package/dist/schemas/workspace.d.ts.map +1 -1
  188. package/dist/schemas/workspace.js +25 -51
  189. package/dist/schemas.js +2 -6
  190. package/dist/server.js +286 -176
  191. package/dist/workspace-plugin.js +1 -1
  192. package/package.json +13 -19
  193. package/dist/client.js.map +0 -7
  194. package/dist/entities/auth/index.js.map +0 -7
  195. package/dist/entities/auth/schema.js.map +0 -7
  196. package/dist/entities/history/index.js.map +0 -7
  197. package/dist/entities/history/schema.js.map +0 -7
  198. package/dist/events/bus.js.map +0 -7
  199. package/dist/events/definitions/analytics.js.map +0 -7
  200. package/dist/events/definitions/auth.js.map +0 -7
  201. package/dist/events/definitions/common.js.map +0 -7
  202. package/dist/events/definitions/cookie.js.map +0 -7
  203. package/dist/events/definitions/document.js.map +0 -7
  204. package/dist/events/definitions/environment.js.map +0 -7
  205. package/dist/events/definitions/hooks.js.map +0 -7
  206. package/dist/events/definitions/index.js.map +0 -7
  207. package/dist/events/definitions/meta.js.map +0 -7
  208. package/dist/events/definitions/operation.js.map +0 -7
  209. package/dist/events/definitions/server.js.map +0 -7
  210. package/dist/events/definitions/tabs.js.map +0 -7
  211. package/dist/events/definitions/tag.js.map +0 -7
  212. package/dist/events/definitions/ui.js.map +0 -7
  213. package/dist/events/definitions/workspace.js.map +0 -7
  214. package/dist/events/index.js.map +0 -7
  215. package/dist/events/listeners.js.map +0 -7
  216. package/dist/events/old-definitions.js.map +0 -7
  217. package/dist/helpers/apply-selective-updates.d.ts +0 -19
  218. package/dist/helpers/apply-selective-updates.d.ts.map +0 -1
  219. package/dist/helpers/apply-selective-updates.js +0 -37
  220. package/dist/helpers/apply-selective-updates.js.map +0 -7
  221. package/dist/helpers/deep-clone.js.map +0 -7
  222. package/dist/helpers/detect-changes-proxy.js.map +0 -7
  223. package/dist/helpers/general.js.map +0 -7
  224. package/dist/helpers/generate-unique-value.js.map +0 -7
  225. package/dist/helpers/get-fetch.js.map +0 -7
  226. package/dist/helpers/get-resolved-ref.js.map +0 -7
  227. package/dist/helpers/is-non-optional-security-requirement.js.map +0 -7
  228. package/dist/helpers/merge-object.js.map +0 -7
  229. package/dist/helpers/overrides-proxy.js.map +0 -7
  230. package/dist/helpers/unpack-proxy.js.map +0 -7
  231. package/dist/mutators/auth.js.map +0 -7
  232. package/dist/mutators/cookie.js.map +0 -7
  233. package/dist/mutators/document.js.map +0 -7
  234. package/dist/mutators/environment.js.map +0 -7
  235. package/dist/mutators/helpers.js.map +0 -7
  236. package/dist/mutators/index.js.map +0 -7
  237. package/dist/mutators/operation/body.js.map +0 -7
  238. package/dist/mutators/operation/extensions.js.map +0 -7
  239. package/dist/mutators/operation/helpers/fetch-request-to-har.js.map +0 -7
  240. package/dist/mutators/operation/helpers/fetch-response-to-har.js.map +0 -7
  241. package/dist/mutators/operation/helpers/get-parameter-position.js.map +0 -7
  242. package/dist/mutators/operation/helpers/har-to-operation.js.map +0 -7
  243. package/dist/mutators/operation/helpers/sync-path-parameters.js.map +0 -7
  244. package/dist/mutators/operation/history.js.map +0 -7
  245. package/dist/mutators/operation/index.js.map +0 -7
  246. package/dist/mutators/operation/operation.js.map +0 -7
  247. package/dist/mutators/operation/parameters.js.map +0 -7
  248. package/dist/mutators/server.js.map +0 -7
  249. package/dist/mutators/tabs.js.map +0 -7
  250. package/dist/mutators/tag.js.map +0 -7
  251. package/dist/mutators/workspace.js.map +0 -7
  252. package/dist/navigation/get-navigation-options.js.map +0 -7
  253. package/dist/navigation/helpers/get-openapi-object.js.map +0 -7
  254. package/dist/navigation/helpers/get-operation-entries.js.map +0 -7
  255. package/dist/navigation/helpers/get-parent-entry.js.map +0 -7
  256. package/dist/navigation/helpers/get-tag-entries.js.map +0 -7
  257. package/dist/navigation/helpers/get-tag.js.map +0 -7
  258. package/dist/navigation/helpers/get-x-keys.js.map +0 -7
  259. package/dist/navigation/helpers/traverse-description.js.map +0 -7
  260. package/dist/navigation/helpers/traverse-document.js.map +0 -7
  261. package/dist/navigation/helpers/traverse-examples.js.map +0 -7
  262. package/dist/navigation/helpers/traverse-paths.js.map +0 -7
  263. package/dist/navigation/helpers/traverse-schemas.js.map +0 -7
  264. package/dist/navigation/helpers/traverse-tags.js.map +0 -7
  265. package/dist/navigation/helpers/traverse-webhooks.js.map +0 -7
  266. package/dist/navigation/helpers/update-order-ids.js.map +0 -7
  267. package/dist/navigation/helpers/utils.js.map +0 -7
  268. package/dist/navigation/index.js.map +0 -7
  269. package/dist/navigation/types.js.map +0 -7
  270. package/dist/persistence/index.js.map +0 -7
  271. package/dist/persistence/indexdb.js.map +0 -7
  272. package/dist/plugins/bundler/helpers.js.map +0 -7
  273. package/dist/plugins/bundler/index.js.map +0 -7
  274. package/dist/plugins/client/index.js.map +0 -7
  275. package/dist/plugins/client/persistence.js.map +0 -7
  276. package/dist/resolve.js.map +0 -7
  277. package/dist/schemas/compose.js.map +0 -7
  278. package/dist/schemas/extensions/document/x-internal.js.map +0 -7
  279. package/dist/schemas/extensions/document/x-scalar-environments.js.map +0 -7
  280. package/dist/schemas/extensions/document/x-scalar-icon.js.map +0 -7
  281. package/dist/schemas/extensions/document/x-scalar-ignore.js.map +0 -7
  282. package/dist/schemas/extensions/document/x-scalar-is-dirty.js.map +0 -7
  283. package/dist/schemas/extensions/document/x-scalar-original-document-hash.js.map +0 -7
  284. package/dist/schemas/extensions/document/x-scalar-registry-meta.js.map +0 -7
  285. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +0 -7
  286. package/dist/schemas/extensions/document/x-scalar-watch-mode.js.map +0 -7
  287. package/dist/schemas/extensions/document/x-tags.js.map +0 -7
  288. package/dist/schemas/extensions/example/x-disabled.js.map +0 -7
  289. package/dist/schemas/extensions/general/x-scalar-active-environment.js.map +0 -7
  290. package/dist/schemas/extensions/general/x-scalar-cookies.js.map +0 -7
  291. package/dist/schemas/extensions/general/x-scalar-order.js.map +0 -7
  292. package/dist/schemas/extensions/operation/index.js.map +0 -7
  293. package/dist/schemas/extensions/operation/x-badge.js.map +0 -7
  294. package/dist/schemas/extensions/operation/x-code-samples.js.map +0 -7
  295. package/dist/schemas/extensions/operation/x-draft-examples.js.map +0 -7
  296. package/dist/schemas/extensions/operation/x-post-response.js.map +0 -7
  297. package/dist/schemas/extensions/operation/x-scalar-disable-parameters.js.map +0 -7
  298. package/dist/schemas/extensions/operation/x-scalar-selected-content-type.js.map +0 -7
  299. package/dist/schemas/extensions/operation/x-scalar-stability.js.map +0 -7
  300. package/dist/schemas/extensions/parameter/x-global.js.map +0 -7
  301. package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +0 -7
  302. package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +0 -7
  303. package/dist/schemas/extensions/schema/x-enum-varnames.js.map +0 -7
  304. package/dist/schemas/extensions/schema/x-examples.js.map +0 -7
  305. package/dist/schemas/extensions/schema/x-variable.js.map +0 -7
  306. package/dist/schemas/extensions/security/index.js.map +0 -7
  307. package/dist/schemas/extensions/security/x-default-scopes.js.map +0 -7
  308. package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +0 -7
  309. package/dist/schemas/extensions/security/x-scalar-security-body.js.map +0 -7
  310. package/dist/schemas/extensions/security/x-scalar-security-query.js.map +0 -7
  311. package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +0 -7
  312. package/dist/schemas/extensions/security/x-tokenName.js.map +0 -7
  313. package/dist/schemas/extensions/security/x-use-pkce.js.map +0 -7
  314. package/dist/schemas/extensions/server/x-scalar-selected-server.js.map +0 -7
  315. package/dist/schemas/extensions/tag/index.js.map +0 -7
  316. package/dist/schemas/extensions/tag/x-display-name.js.map +0 -7
  317. package/dist/schemas/extensions/tag/x-tag-groups.js.map +0 -7
  318. package/dist/schemas/extensions/workspace/index.js.map +0 -7
  319. package/dist/schemas/extensions/workspace/x-scalar-active-proxy.js.map +0 -7
  320. package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +0 -7
  321. package/dist/schemas/extensions.js.map +0 -7
  322. package/dist/schemas/inmemory-workspace.js.map +0 -7
  323. package/dist/schemas/navigation.js.map +0 -7
  324. package/dist/schemas/reference-config/appearance.js.map +0 -7
  325. package/dist/schemas/reference-config/features.js.map +0 -7
  326. package/dist/schemas/reference-config/index.js.map +0 -7
  327. package/dist/schemas/reference-config/meta.js.map +0 -7
  328. package/dist/schemas/reference-config/routing.js.map +0 -7
  329. package/dist/schemas/reference-config/settings.js.map +0 -7
  330. package/dist/schemas/typebox-coerce.js.map +0 -7
  331. package/dist/schemas/v3.1/strict/callback.js.map +0 -7
  332. package/dist/schemas/v3.1/strict/components.js.map +0 -7
  333. package/dist/schemas/v3.1/strict/contact.js.map +0 -7
  334. package/dist/schemas/v3.1/strict/discriminator.js.map +0 -7
  335. package/dist/schemas/v3.1/strict/encoding.js.map +0 -7
  336. package/dist/schemas/v3.1/strict/example.js.map +0 -7
  337. package/dist/schemas/v3.1/strict/external-documentation.js.map +0 -7
  338. package/dist/schemas/v3.1/strict/header.js.map +0 -7
  339. package/dist/schemas/v3.1/strict/info.js.map +0 -7
  340. package/dist/schemas/v3.1/strict/license.js.map +0 -7
  341. package/dist/schemas/v3.1/strict/link.js.map +0 -7
  342. package/dist/schemas/v3.1/strict/media-type.js.map +0 -7
  343. package/dist/schemas/v3.1/strict/oauth-flow.js.map +0 -7
  344. package/dist/schemas/v3.1/strict/oauthflows.js.map +0 -7
  345. package/dist/schemas/v3.1/strict/openapi-document.js.map +0 -7
  346. package/dist/schemas/v3.1/strict/operation.js.map +0 -7
  347. package/dist/schemas/v3.1/strict/parameter.js.map +0 -7
  348. package/dist/schemas/v3.1/strict/path-item.js.map +0 -7
  349. package/dist/schemas/v3.1/strict/paths.js.map +0 -7
  350. package/dist/schemas/v3.1/strict/ref-definitions.js.map +0 -7
  351. package/dist/schemas/v3.1/strict/reference.js.map +0 -7
  352. package/dist/schemas/v3.1/strict/request-body.js.map +0 -7
  353. package/dist/schemas/v3.1/strict/response.js.map +0 -7
  354. package/dist/schemas/v3.1/strict/responses.js.map +0 -7
  355. package/dist/schemas/v3.1/strict/schema.js.map +0 -7
  356. package/dist/schemas/v3.1/strict/security-requirement.js.map +0 -7
  357. package/dist/schemas/v3.1/strict/security-scheme.js.map +0 -7
  358. package/dist/schemas/v3.1/strict/server-variable.js.map +0 -7
  359. package/dist/schemas/v3.1/strict/server.js.map +0 -7
  360. package/dist/schemas/v3.1/strict/tag.js.map +0 -7
  361. package/dist/schemas/v3.1/strict/type-guards.js.map +0 -7
  362. package/dist/schemas/v3.1/strict/xml.js.map +0 -7
  363. package/dist/schemas/workspace-specification/index.js.map +0 -7
  364. package/dist/schemas/workspace-specification/info.js.map +0 -7
  365. package/dist/schemas/workspace.js.map +0 -7
  366. package/dist/schemas.js.map +0 -7
  367. package/dist/server.js.map +0 -7
  368. package/dist/workspace-plugin.js.map +0 -7
@@ -1,94 +1,100 @@
1
- import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
2
- import { objectKeys } from "@scalar/helpers/object/object-keys";
3
- import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
4
- import { isDeprecatedOperation } from "../../navigation/helpers/traverse-paths.js";
5
- import { getTag } from "./get-tag.js";
6
- const createWebhookEntry = ({
7
- ref,
8
- method,
9
- name,
10
- title,
11
- generateId,
12
- parentTag,
13
- webhook,
14
- isDeprecated,
15
- parentId
16
- }) => {
17
- const id = generateId({
18
- type: "webhook",
19
- name,
20
- method,
21
- webhook,
22
- parentTag,
23
- parentId
24
- });
25
- const entry = {
26
- id,
27
- title,
28
- name,
29
- ref,
30
- method,
31
- type: "webhook",
32
- isDeprecated
33
- };
34
- return entry;
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
2
+ import { objectKeys } from '@scalar/helpers/object/object-keys';
3
+ import { getResolvedRef } from '../../helpers/get-resolved-ref.js';
4
+ import { isDeprecatedOperation } from '../../navigation/helpers/traverse-paths.js';
5
+ import { getTag } from './get-tag.js';
6
+ /** Creates a traversed webhook entry from an OpenAPI webhook object.
7
+ *
8
+ * @param ref - JSON pointer reference to the webhook in the OpenAPI document
9
+ * @param method - HTTP method of the webhook
10
+ * @param name - Name of the webhook, defaults to 'Unknown'
11
+ * @param title - Title of the webhook, defaults to 'Unknown'
12
+ * @param entitiesMap - Map to store webhook IDs and titles for mobile header navigation
13
+ * @param getWebhookId - Function to generate unique IDs for webhooks
14
+ * @param tag - Optional tag object associated with the webhook
15
+ * @returns A traversed webhook entry with ID, title, name, method and reference
16
+ */
17
+ const createWebhookEntry = ({ ref, method, name, title, generateId, parentTag, webhook, isDeprecated, parentId, }) => {
18
+ const id = generateId({
19
+ type: 'webhook',
20
+ name,
21
+ method,
22
+ webhook: webhook,
23
+ parentTag,
24
+ parentId: parentId,
25
+ });
26
+ const entry = {
27
+ id,
28
+ title,
29
+ name,
30
+ ref,
31
+ method: method,
32
+ type: 'webhook',
33
+ isDeprecated,
34
+ };
35
+ return entry;
35
36
  };
36
- const traverseWebhooks = ({
37
- document,
38
- tagsMap,
39
- generateId,
40
- untaggedWebhooksParentId,
41
- documentId
42
- }) => {
43
- const untagged = [];
44
- Object.entries(document.webhooks ?? {}).forEach(([name, pathItemObject]) => {
45
- const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key));
46
- pathKeys.forEach((method) => {
47
- const _operation = pathItemObject?.[method];
48
- const operation = getResolvedRef(_operation);
49
- if (!operation) {
50
- return;
51
- }
52
- if (operation["x-internal"] || operation["x-scalar-ignore"]) {
53
- return;
54
- }
55
- const ref = `#/webhooks/${name}/${method}`;
56
- if (operation.tags?.length) {
57
- operation.tags.forEach((tagName) => {
58
- const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
59
- tagsMap.get(tagName)?.entries.push(
60
- createWebhookEntry({
61
- ref,
62
- method,
63
- name,
64
- title: operation.summary ?? name,
65
- webhook: operation,
66
- generateId,
67
- parentTag: { tag, id: tagId },
68
- parentId: tagId,
69
- isDeprecated: isDeprecatedOperation(operation)
70
- })
71
- );
37
+ /** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.
38
+ *
39
+ * This function processes each webhook in the document to:
40
+ * - Filter out internal webhooks (marked with x-internal) and webhooks to ignore (marked with x-scalar-ignore)
41
+ * - Group webhooks by their tags
42
+ * - Create webhook entries with unique references and IDs
43
+ * - Store webhook IDs and titles for mobile header navigation
44
+ *
45
+ * @param content - The OpenAPI document to traverse
46
+ * @param tagsMap - Map of tag names to arrays of traversed entries from operations
47
+ * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects
48
+ * @param entitiesMap - Map to store webhook IDs and titles for mobile header navigation
49
+ * @param getWebhookId - Function to generate unique IDs for webhooks
50
+ * @returns Array of untagged webhook entries
51
+ */
52
+ export const traverseWebhooks = ({ document, tagsMap, generateId, untaggedWebhooksParentId, documentId, }) => {
53
+ const untagged = [];
54
+ // Traverse webhooks
55
+ Object.entries(document.webhooks ?? {}).forEach(([name, pathItemObject]) => {
56
+ const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key));
57
+ pathKeys.forEach((method) => {
58
+ const _operation = pathItemObject?.[method];
59
+ const operation = getResolvedRef(_operation);
60
+ if (!operation) {
61
+ return;
62
+ }
63
+ // Skip if the operation is internal or scalar-ignore
64
+ if (operation['x-internal'] || operation['x-scalar-ignore']) {
65
+ return;
66
+ }
67
+ const ref = `#/webhooks/${name}/${method}`;
68
+ if (operation.tags?.length) {
69
+ operation.tags.forEach((tagName) => {
70
+ const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
71
+ tagsMap.get(tagName)?.entries.push(createWebhookEntry({
72
+ ref,
73
+ method,
74
+ name,
75
+ title: operation.summary ?? name,
76
+ webhook: operation,
77
+ generateId: generateId,
78
+ parentTag: { tag, id: tagId },
79
+ parentId: tagId,
80
+ isDeprecated: isDeprecatedOperation(operation),
81
+ }));
82
+ });
83
+ }
84
+ // Add to untagged
85
+ else {
86
+ untagged.push(createWebhookEntry({
87
+ ref,
88
+ method,
89
+ name,
90
+ title: operation.summary ?? name,
91
+ generateId,
92
+ isDeprecated: isDeprecatedOperation(operation),
93
+ webhook: operation,
94
+ parentId: untaggedWebhooksParentId,
95
+ }));
96
+ }
72
97
  });
73
- } else {
74
- untagged.push(
75
- createWebhookEntry({
76
- ref,
77
- method,
78
- name,
79
- title: operation.summary ?? name,
80
- generateId,
81
- isDeprecated: isDeprecatedOperation(operation),
82
- webhook: operation,
83
- parentId: untaggedWebhooksParentId
84
- })
85
- );
86
- }
87
98
  });
88
- });
89
- return untagged;
90
- };
91
- export {
92
- traverseWebhooks
99
+ return untagged;
93
100
  };
94
- //# sourceMappingURL=traverse-webhooks.js.map
@@ -1,54 +1,62 @@
1
- import { canHaveOrder, getOpenapiObject } from "../../navigation/helpers/get-openapi-object.js";
2
- import { getParentEntry } from "../../navigation/helpers/get-parent-entry.js";
3
- const updateOrderIds = ({ store, generateId, ...rest }) => {
4
- rest.entries?.forEach((entry) => {
5
- if (!canHaveOrder(entry.parent)) {
6
- return;
7
- }
8
- const parentOpenAPIObject = getOpenapiObject({ store, entry: entry.parent });
9
- if (!parentOpenAPIObject || !("x-scalar-order" in parentOpenAPIObject)) {
10
- return;
11
- }
12
- const order = parentOpenAPIObject["x-scalar-order"];
13
- const index = order?.indexOf(entry.id);
14
- if (!Array.isArray(order) || typeof index !== "number" || index < 0) {
15
- return;
16
- }
17
- if ("tag" in rest) {
18
- const oldTagId = entry.id;
19
- const newTagId = generateId({
20
- type: "tag",
21
- parentId: entry.parent.id,
22
- tag: rest.tag
23
- });
24
- order[index] = newTagId;
25
- if (oldTagId !== newTagId) {
26
- const documentEntry = getParentEntry("document", entry);
27
- const document = documentEntry ? store.workspace.documents[documentEntry.name] : null;
28
- const renamedTagObj = document?.tags?.find((t) => t.name === rest.tag.name);
29
- const childOrder = renamedTagObj?.["x-scalar-order"];
30
- if (renamedTagObj && Array.isArray(childOrder)) {
31
- const oldPrefix = `${oldTagId}/`;
32
- const newPrefix = `${newTagId}/`;
33
- renamedTagObj["x-scalar-order"] = childOrder.map(
34
- (id) => id.startsWith(oldPrefix) ? newPrefix + id.slice(oldPrefix.length) : id
35
- );
1
+ import { canHaveOrder, getOpenapiObject } from '../../navigation/helpers/get-openapi-object.js';
2
+ import { getParentEntry } from '../../navigation/helpers/get-parent-entry.js';
3
+ /**
4
+ * Updates the order ID of an entry (operation or tag) in the sidebar.
5
+ * Used when changing path, method, or tag name so we do not lose the sidebar ordering.
6
+ *
7
+ * Accepts either operation/webhook entries or tag entries via a discriminated union,
8
+ * so the correct ID generation props are enforced at the call site.
9
+ */
10
+ export const updateOrderIds = ({ store, generateId, ...rest }) => {
11
+ // Loop over the entries and replace the ID in the x-scalar-order with the new ID
12
+ rest.entries?.forEach((entry) => {
13
+ if (!canHaveOrder(entry.parent)) {
14
+ return;
36
15
  }
37
- }
38
- return;
39
- }
40
- const parentTag = entry.parent.type === "tag" && "name" in parentOpenAPIObject ? { tag: parentOpenAPIObject, id: entry.parent.id } : void 0;
41
- order[index] = generateId({
42
- type: "operation",
43
- path: rest.path,
44
- method: rest.method,
45
- operation: rest.operation,
46
- parentId: entry.parent.id,
47
- parentTag
16
+ // Ensure we have an x-scalar-order property
17
+ const parentOpenAPIObject = getOpenapiObject({ store, entry: entry.parent });
18
+ if (!parentOpenAPIObject || !('x-scalar-order' in parentOpenAPIObject)) {
19
+ return;
20
+ }
21
+ const order = parentOpenAPIObject['x-scalar-order'];
22
+ const index = order?.indexOf(entry.id);
23
+ if (!Array.isArray(order) || typeof index !== 'number' || index < 0) {
24
+ return;
25
+ }
26
+ // Tag entries: generate a new tag ID using the updated tag object
27
+ if ('tag' in rest) {
28
+ const oldTagId = entry.id;
29
+ const newTagId = generateId({
30
+ type: 'tag',
31
+ parentId: entry.parent.id,
32
+ tag: rest.tag,
33
+ });
34
+ order[index] = newTagId;
35
+ // Ensure we update the children as well, so we don't lose the sidebar ordering when it rebuilds
36
+ if (oldTagId !== newTagId) {
37
+ const documentEntry = getParentEntry('document', entry);
38
+ const document = documentEntry ? store.workspace.documents[documentEntry.name] : null;
39
+ const renamedTagObj = document?.tags?.find((t) => t.name === rest.tag.name);
40
+ const childOrder = renamedTagObj?.['x-scalar-order'];
41
+ if (renamedTagObj && Array.isArray(childOrder)) {
42
+ const oldPrefix = `${oldTagId}/`;
43
+ const newPrefix = `${newTagId}/`;
44
+ renamedTagObj['x-scalar-order'] = childOrder.map((id) => id.startsWith(oldPrefix) ? newPrefix + id.slice(oldPrefix.length) : id);
45
+ }
46
+ }
47
+ return;
48
+ }
49
+ // Operation/webhook entries: generate a new operation ID with the updated path and method
50
+ const parentTag = entry.parent.type === 'tag' && 'name' in parentOpenAPIObject
51
+ ? { tag: parentOpenAPIObject, id: entry.parent.id }
52
+ : undefined;
53
+ order[index] = generateId({
54
+ type: 'operation',
55
+ path: rest.path,
56
+ method: rest.method,
57
+ operation: rest.operation,
58
+ parentId: entry.parent.id,
59
+ parentTag,
60
+ });
48
61
  });
49
- });
50
- };
51
- export {
52
- updateOrderIds
53
62
  };
54
- //# sourceMappingURL=update-order-ids.js.map
@@ -1,25 +1,75 @@
1
- import { getHeadings } from "@scalar/code-highlight/markdown";
2
- import GithubSlugger from "github-slugger";
1
+ import { getHeadings } from '@scalar/code-highlight/markdown';
2
+ import GithubSlugger from 'github-slugger';
3
+ /**
4
+ * Adds URL-friendly slugs to each heading in the array.
5
+ * Uses GithubSlugger to generate consistent slugs that match GitHub's heading anchor format.
6
+ *
7
+ * @param headings - Array of heading objects containing value and depth
8
+ * @param slugger - GithubSlugger instance for generating consistent slugs
9
+ * @returns Array of headings with added slug property
10
+ *
11
+ * @example
12
+ * const headings = [
13
+ * { value: 'Getting Started', depth: 1 },
14
+ * { value: 'Installation', depth: 2 }
15
+ * ]
16
+ * const slugger = new GithubSlugger()
17
+ * withSlugs(headings, slugger)
18
+ * // Returns:
19
+ * // [
20
+ * // { value: 'Getting Started', depth: 1, slug: 'getting-started' },
21
+ * // { value: 'Installation', depth: 2, slug: 'installation' }
22
+ * // ]
23
+ */
3
24
  const withSlugs = (headings, slugger) => headings.map((heading) => {
4
- return {
5
- ...heading,
6
- slug: slugger.slug(heading.value)
7
- };
25
+ return {
26
+ ...heading,
27
+ slug: slugger.slug(heading.value),
28
+ };
8
29
  });
9
- function getHeadingsFromMarkdown(input) {
10
- const slugger = new GithubSlugger();
11
- const headings = getHeadings(input);
12
- return withSlugs(headings, slugger);
30
+ /**
31
+ * Extracts all headings from a Markdown string and adds URL-friendly slugs to each heading.
32
+ * Uses GithubSlugger to generate consistent slugs that match GitHub's heading anchor format.
33
+ *
34
+ * @param input - The Markdown string to extract headings from
35
+ * @returns Array of heading objects containing value, depth, and slug
36
+ *
37
+ * @example
38
+ * const markdown = `
39
+ * # Getting Started
40
+ * ## Installation
41
+ * ### Requirements
42
+ * `
43
+ * const headings = getHeadingsFromMarkdown(markdown)
44
+ * // Returns:
45
+ * // [
46
+ * // { value: 'Getting Started', depth: 1, slug: 'getting-started' },
47
+ * // { value: 'Installation', depth: 2, slug: 'installation' },
48
+ * // { value: 'Requirements', depth: 3, slug: 'requirements' }
49
+ * // ]
50
+ */
51
+ export function getHeadingsFromMarkdown(input) {
52
+ const slugger = new GithubSlugger();
53
+ const headings = getHeadings(input);
54
+ return withSlugs(headings, slugger);
13
55
  }
14
- const getLowestHeadingLevel = (headings) => {
15
- const lowestLevel = Math.min(...headings.map((heading) => heading.depth));
16
- if (lowestLevel >= 1 && lowestLevel <= 6) {
17
- return lowestLevel;
18
- }
19
- return 1;
56
+ /**
57
+ * Returns the lowest heading level from a list of headings.
58
+ *
59
+ * @param headings - Array of heading objects containing depth property
60
+ * @returns The lowest heading level (1-6) or 1 if no valid headings found
61
+ *
62
+ * @example
63
+ * const headings = [
64
+ * { value: 'Getting Started', depth: 1 },
65
+ * { value: 'Installation', depth: 2 }
66
+ * ]
67
+ * getLowestHeadingLevel(headings) // Returns: 1
68
+ */
69
+ export const getLowestHeadingLevel = (headings) => {
70
+ const lowestLevel = Math.min(...headings.map((heading) => heading.depth));
71
+ if (lowestLevel >= 1 && lowestLevel <= 6) {
72
+ return lowestLevel;
73
+ }
74
+ return 1;
20
75
  };
21
- export {
22
- getHeadingsFromMarkdown,
23
- getLowestHeadingLevel
24
- };
25
- //# sourceMappingURL=utils.js.map
@@ -1,13 +1,5 @@
1
- import { getOpenapiObject } from "./helpers/get-openapi-object.js";
2
- import { getOperationEntries } from "./helpers/get-operation-entries.js";
3
- import { getParentEntry } from "./helpers/get-parent-entry.js";
4
- import { getTagEntries } from "./helpers/get-tag-entries.js";
5
- import { traverseDocument } from "./helpers/traverse-document.js";
6
- export {
7
- traverseDocument as createNavigation,
8
- getOpenapiObject,
9
- getOperationEntries,
10
- getParentEntry,
11
- getTagEntries
12
- };
13
- //# sourceMappingURL=index.js.map
1
+ export { getOpenapiObject } from './helpers/get-openapi-object.js';
2
+ export { getOperationEntries } from './helpers/get-operation-entries.js';
3
+ export { getParentEntry } from './helpers/get-parent-entry.js';
4
+ export { getTagEntries } from './helpers/get-tag-entries.js';
5
+ export { traverseDocument as createNavigation } from './helpers/traverse-document.js';
@@ -1 +1 @@
1
- //# sourceMappingURL=types.js.map
1
+ export {};