@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,63 +1,101 @@
1
- import { isObject } from "@scalar/helpers/object/is-object";
2
- const isDetectChangesProxy = Symbol("isDetectChangesProxy");
3
- const detectChangesProxyTarget = Symbol("detectChangesProxyTarget");
4
- const createDetectChangesProxy = (target, options, args = {
5
- proxyCache: /* @__PURE__ */ new WeakMap(),
6
- path: []
1
+ import { isObject } from '@scalar/helpers/object/is-object';
2
+ const isDetectChangesProxy = Symbol('isDetectChangesProxy');
3
+ const detectChangesProxyTarget = Symbol('detectChangesProxyTarget');
4
+ /**
5
+ * createDetectChangesProxy - Creates a proxy for an object or array that detects and triggers hooks on changes.
6
+ *
7
+ * This proxy enables detection of set operations, triggering optional hooks (onBeforeChange, onAfterChange) with the path and value changed.
8
+ * The proxy can be applied recursively to all nested objects/arrays, and caches proxies to prevent creating multiple proxies for the same object.
9
+ *
10
+ * Example usage:
11
+ *
12
+ * const obj = { foo: 1, bar: { baz: 2 } };
13
+ * const proxy = createDetectChangesProxy(obj, {
14
+ * hooks: {
15
+ * onBeforeChange: (path, value) => console.log('Before', path, value),
16
+ * onAfterChange: (path, value) => console.log('After', path, value),
17
+ * }
18
+ * });
19
+ * proxy.foo = 42; // Console: Before ['foo'] '42', After ['foo'] '42'
20
+ * proxy.bar.baz = 99; // Console: Before ['bar', 'baz'] '99', After ['bar', 'baz'] '99'
21
+ *
22
+ * @param target The target object or array to wrap in a proxy
23
+ * @param options Optional: hooks for change detection
24
+ * @param args Internal: proxy cache and current property path (used for recursion)
25
+ * @returns The proxied object/array with change detection capabilities
26
+ */
27
+ export const createDetectChangesProxy = (target, options, args = {
28
+ proxyCache: new WeakMap(),
29
+ path: [],
7
30
  }) => {
8
- if (!isObject(target) && !Array.isArray(target)) {
9
- return target;
10
- }
11
- if (args.proxyCache.has(target)) {
12
- return args.proxyCache.get(target);
13
- }
14
- const proxy = new Proxy(target, {
15
- get(target2, prop, receiver) {
16
- if (prop === isDetectChangesProxy) {
17
- return true;
18
- }
19
- if (prop === detectChangesProxyTarget) {
20
- return target2;
21
- }
22
- const value = Reflect.get(target2, prop, receiver);
23
- if (isDetectChangesProxyObject(value)) {
24
- return value;
25
- }
26
- return createDetectChangesProxy(value, options, { ...args, path: [...args.path, String(prop)] });
27
- },
28
- set(target2, prop, value, receiver) {
29
- const path = [...args.path, String(prop)];
30
- options?.hooks?.onBeforeChange?.(path, value);
31
- const result = Reflect.set(target2, prop, value, receiver);
32
- options?.hooks?.onAfterChange?.(path, value);
33
- return result;
34
- },
35
- deleteProperty(target2, prop) {
36
- const path = [...args.path, String(prop)];
37
- options?.hooks?.onBeforeChange?.(path);
38
- const result = Reflect.deleteProperty(target2, prop);
39
- options?.hooks?.onAfterChange?.(path);
40
- return result;
31
+ // Only wrap objects or arrays
32
+ if (!isObject(target) && !Array.isArray(target)) {
33
+ return target;
41
34
  }
42
- });
43
- args.proxyCache.set(target, proxy);
44
- return proxy;
35
+ // Return cached proxy if already created for this target
36
+ if (args.proxyCache.has(target)) {
37
+ return args.proxyCache.get(target);
38
+ }
39
+ const proxy = new Proxy(target, {
40
+ get(target, prop, receiver) {
41
+ // Allow identifying if an object is a detect changes proxy
42
+ if (prop === isDetectChangesProxy) {
43
+ return true;
44
+ }
45
+ // Allow access to the original target
46
+ if (prop === detectChangesProxyTarget) {
47
+ return target;
48
+ }
49
+ // Recursively wrap property values in the detect changes proxy
50
+ const value = Reflect.get(target, prop, receiver);
51
+ if (isDetectChangesProxyObject(value)) {
52
+ return value;
53
+ }
54
+ return createDetectChangesProxy(value, options, { ...args, path: [...args.path, String(prop)] });
55
+ },
56
+ set(target, prop, value, receiver) {
57
+ const path = [...args.path, String(prop)];
58
+ // Call before-change hook if provided
59
+ options?.hooks?.onBeforeChange?.(path, value);
60
+ const result = Reflect.set(target, prop, value, receiver);
61
+ // Call after-change hook if provided
62
+ options?.hooks?.onAfterChange?.(path, value);
63
+ return result;
64
+ },
65
+ deleteProperty(target, prop) {
66
+ const path = [...args.path, String(prop)];
67
+ options?.hooks?.onBeforeChange?.(path);
68
+ const result = Reflect.deleteProperty(target, prop);
69
+ options?.hooks?.onAfterChange?.(path);
70
+ return result;
71
+ },
72
+ });
73
+ // Cache the proxy for this target
74
+ args.proxyCache.set(target, proxy);
75
+ return proxy;
45
76
  };
46
- const isDetectChangesProxyObject = (obj) => {
47
- return typeof obj === "object" && obj !== null && obj[isDetectChangesProxy] === true;
77
+ export const isDetectChangesProxyObject = (obj) => {
78
+ return (typeof obj === 'object' &&
79
+ obj !== null &&
80
+ obj[isDetectChangesProxy] === true);
48
81
  };
49
- const unpackDetectChangesProxy = (obj) => {
50
- if (typeof obj !== "object" || obj === null) {
82
+ /**
83
+ * Returns the raw/original (non-proxy) object if the passed object is a detect-changes proxy.
84
+ * If the object is not a proxy, it returns the same object.
85
+ *
86
+ * @example
87
+ * const proxy = createDetectChangesProxy({ a: 1 });
88
+ * const raw = unpackDetectChangesProxy(proxy); // Gets the original object { a: 1 }
89
+ * const notProxy = { b: 2 };
90
+ * const stillRaw = unpackDetectChangesProxy(notProxy); // Returns { b: 2 }, unchanged
91
+ */
92
+ export const unpackDetectChangesProxy = (obj) => {
93
+ if (typeof obj !== 'object' || obj === null) {
94
+ return obj;
95
+ }
96
+ // If object is a detect-changes proxy, return its underlying target
97
+ if (obj[isDetectChangesProxy]) {
98
+ return obj[detectChangesProxyTarget];
99
+ }
51
100
  return obj;
52
- }
53
- if (obj[isDetectChangesProxy]) {
54
- return obj[detectChangesProxyTarget];
55
- }
56
- return obj;
57
- };
58
- export {
59
- createDetectChangesProxy,
60
- isDetectChangesProxyObject,
61
- unpackDetectChangesProxy
62
101
  };
63
- //# sourceMappingURL=detect-changes-proxy.js.map
@@ -1,28 +1,83 @@
1
- function isLocalRef(value) {
2
- return value.startsWith("#");
1
+ /**
2
+ * Checks if a string is a local reference (starts with #)
3
+ * @param value - The reference string to check
4
+ * @returns true if the string is a local reference, false otherwise
5
+ * @example
6
+ * ```ts
7
+ * isLocalRef('#/components/schemas/User') // true
8
+ * isLocalRef('https://example.com/schema.json') // false
9
+ * isLocalRef('./local-schema.json') // false
10
+ * ```
11
+ */
12
+ export function isLocalRef(value) {
13
+ return value.startsWith('#');
3
14
  }
4
- function keyOf(value) {
5
- return Object.keys(value);
15
+ export function keyOf(value) {
16
+ return Object.keys(value);
6
17
  }
7
- const deepClone = (value) => {
8
- return JSON.parse(JSON.stringify(value));
18
+ /**
19
+ * Deep clones a value using JSON serialization.
20
+ *
21
+ * @param value - The value to deep clone
22
+ * @template T - The type of the value
23
+ * @returns A deep clone of the value
24
+ */
25
+ export const deepClone = (value) => {
26
+ return JSON.parse(JSON.stringify(value));
9
27
  };
10
- const split = (array, condition) => {
11
- return array.reduce(
12
- ([pass, fail], item) => {
13
- return condition(item) ? [[...pass, item], fail] : [pass, [...fail, item]];
14
- },
15
- [[], []]
16
- );
28
+ /**
29
+ * Splits an array into two arrays based on a condition.
30
+ *
31
+ * This function takes an array and a predicate function, then returns a tuple containing
32
+ * two arrays: the first contains elements that pass the condition, and the second contains
33
+ * elements that fail the condition.
34
+ *
35
+ * @param array - The array to split
36
+ * @param condition - A predicate function that determines which array each element belongs to
37
+ * @returns A tuple of two arrays: [passingElements, failingElements]
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const numbers = [1, 2, 3, 4, 5, 6]
42
+ * const [evens, odds] = split(numbers, (n) => n % 2 === 0)
43
+ * // evens: [2, 4, 6]
44
+ * // odds: [1, 3, 5]
45
+ *
46
+ * const words = ['apple', 'banana', 'cherry', 'date']
47
+ * const [longWords, shortWords] = split(words, (word) => word.length > 5)
48
+ * // longWords: ['banana', 'cherry']
49
+ * // shortWords: ['apple', 'date']
50
+ * ```
51
+ */
52
+ export const split = (array, condition) => {
53
+ return array.reduce(([pass, fail], item) => {
54
+ return condition(item) ? [[...pass, item], fail] : [pass, [...fail, item]];
55
+ }, [[], []]);
17
56
  };
18
- const safeAssign = (target, source) => {
19
- Object.assign(target, source);
57
+ /**
58
+ * Safely assigns properties from a source object to a target object.
59
+ *
60
+ * This function uses Object.assign to copy enumerable properties from the source object
61
+ * to the target object. It's a type-safe wrapper around Object.assign that ensures
62
+ * the source object is compatible with the target object's type.
63
+ *
64
+ * @param target - The target object to assign properties to
65
+ * @param source - The source object containing properties to assign
66
+ * @template T - The type of the target object
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const target = { name: 'John', age: 30 }
71
+ * const source = { age: 31, city: 'New York' }
72
+ * safeAssign(target, source)
73
+ * // target is now: { name: 'John', age: 31, city: 'New York' }
74
+ *
75
+ * const config = { theme: 'dark', language: 'en' }
76
+ * const updates = { theme: 'light' }
77
+ * safeAssign(config, updates)
78
+ * // config is now: { theme: 'light', language: 'en' }
79
+ * ```
80
+ */
81
+ export const safeAssign = (target, source) => {
82
+ Object.assign(target, source);
20
83
  };
21
- export {
22
- deepClone,
23
- isLocalRef,
24
- keyOf,
25
- safeAssign,
26
- split
27
- };
28
- //# sourceMappingURL=general.js.map
@@ -1,47 +1,79 @@
1
- async function generateUniqueValue({
2
- defaultValue,
3
- /** Check function to verify the uniqueness of the value */
4
- validation,
5
- /** Transformation function to transform the default value (such as into a slug) */
6
- transformation,
7
- /** The maximum number of attempts to create a unique value by incrementing. */
8
- maxRetries = 5
9
- }) {
10
- const transformed = transformation?.(defaultValue) ?? defaultValue;
11
- if (await validation(transformed)) {
12
- return transformed;
13
- }
14
- return incrementValue({
15
- value: [transformed, 1],
16
- validation,
17
- maxRetries,
18
- transformation
19
- });
1
+ /**
2
+ * Generates a unique value based on a given default value and a validation function.
3
+ *
4
+ * The process works as follows:
5
+ * 1. Optionally transform (e.g., slugify) the default value using a transformation function.
6
+ * 2. Check if this value is unique by executing the provided validation function.
7
+ * 3. If not unique, repeatedly append an incrementing integer (e.g., "my-name 1", "my-name 2", ...) and re-check uniqueness,
8
+ * up to a maximum number of attempts (maxRetries).
9
+ * 4. Returns the first unique value found or undefined if a unique value cannot be generated within the maximum retries.
10
+ *
11
+ * Example:
12
+ * ```ts
13
+ * // Existing names in use
14
+ * const existing = new Set(['foo', 'foo 1', 'foo 2']);
15
+ * const uniqueName = generateUniqueValue({
16
+ * defaultValue: 'foo',
17
+ * validation: (value) => !existing.has(value),
18
+ * // transformation is optional, e.g. (val) => val.toLowerCase().replace(/[^\w]+/g, '-'),
19
+ * maxRetries: 10,
20
+ * });
21
+ * // uniqueName === 'foo 3'
22
+ * ```
23
+ */
24
+ export async function generateUniqueValue({ defaultValue,
25
+ /** Check function to verify the uniqueness of the value */
26
+ validation,
27
+ /** Transformation function to transform the default value (such as into a slug) */
28
+ transformation,
29
+ /** The maximum number of attempts to create a unique value by incrementing. */
30
+ maxRetries = 5, }) {
31
+ const transformed = transformation?.(defaultValue) ?? defaultValue;
32
+ if (await validation(transformed)) {
33
+ return transformed;
34
+ }
35
+ return incrementValue({
36
+ value: [transformed, 1],
37
+ validation,
38
+ maxRetries,
39
+ transformation,
40
+ });
20
41
  }
21
- async function incrementValue({
22
- value,
23
- validation,
24
- maxRetries,
25
- attempts = 0,
26
- transformation
27
- }) {
28
- if (attempts >= maxRetries) {
29
- return;
30
- }
31
- const incremented = value.join(" ");
32
- const transformed = transformation?.(incremented) ?? incremented;
33
- if (await validation(transformed)) {
34
- return transformed;
35
- }
36
- return incrementValue({
37
- value: [value[0], value[1] + 1],
38
- validation,
39
- maxRetries,
40
- transformation,
41
- attempts: attempts + 1
42
- });
42
+ /**
43
+ * Attempts to generate a unique value by appending and incrementing a counter to a base string.
44
+ *
45
+ * On each attempt, appends the next incrementing integer (e.g. "foo 1", "foo 2", etc.) to the original value,
46
+ * and checks with the validation function whether the candidate value is unique.
47
+ *
48
+ * Continues until a unique value is found, or the maximum number of attempts is reached.
49
+ *
50
+ * Returns the first unique value found, or undefined if a unique value cannot be generated within maxRetries.
51
+ *
52
+ * Example:
53
+ * ```ts
54
+ * const existing = new Set(['bar', 'bar 1']);
55
+ * const result = incrementValue({
56
+ * value: ['bar', 1],
57
+ * validation: (val) => !existing.has(val),
58
+ * maxRetries: 5,
59
+ * });
60
+ * // result === "bar 2"
61
+ * ```
62
+ */
63
+ async function incrementValue({ value, validation, maxRetries, attempts = 0, transformation, }) {
64
+ if (attempts >= maxRetries) {
65
+ return;
66
+ }
67
+ const incremented = value.join(' ');
68
+ const transformed = transformation?.(incremented) ?? incremented;
69
+ if (await validation(transformed)) {
70
+ return transformed;
71
+ }
72
+ return incrementValue({
73
+ value: [value[0], value[1] + 1],
74
+ validation,
75
+ maxRetries,
76
+ transformation,
77
+ attempts: attempts + 1,
78
+ });
43
79
  }
44
- export {
45
- generateUniqueValue
46
- };
47
- //# sourceMappingURL=generate-unique-value.js.map
@@ -1,11 +1,13 @@
1
- import { redirectToProxy } from "@scalar/helpers/url/redirect-to-proxy";
2
- const getFetch = (config) => {
3
- if (config.fetch) {
4
- return config.fetch;
5
- }
6
- return (input, init) => fetch(redirectToProxy(config.proxyUrl, input.toString()), init);
1
+ import { redirectToProxy } from '@scalar/helpers/url/redirect-to-proxy';
2
+ /**
3
+ * Get the fetch function from the configuration
4
+ *
5
+ * @param config - The API reference configuration.
6
+ * @returns The fetch function.
7
+ */
8
+ export const getFetch = (config) => {
9
+ if (config.fetch) {
10
+ return config.fetch;
11
+ }
12
+ return ((input, init) => fetch(redirectToProxy(config.proxyUrl, input.toString()), init));
7
13
  };
8
- export {
9
- getFetch
10
- };
11
- //# sourceMappingURL=get-fetch.js.map
@@ -1,13 +1,14 @@
1
1
  const defaultTransform = (node) => {
2
- return node["$ref-value"];
2
+ return node['$ref-value'];
3
3
  };
4
- const getResolvedRef = (node, transform = defaultTransform) => {
5
- if (typeof node === "object" && node !== null && "$ref" in node) {
6
- return transform(node);
7
- }
8
- return node;
4
+ /**
5
+ * Resolves a node that may be a $ref object to its actual value.
6
+ * If the node contains a $ref, applies the provided transform (default: returns '$ref-value').
7
+ * Otherwise, returns the node as-is.
8
+ */
9
+ export const getResolvedRef = (node, transform = defaultTransform) => {
10
+ if (typeof node === 'object' && node !== null && '$ref' in node) {
11
+ return transform(node);
12
+ }
13
+ return node;
9
14
  };
10
- export {
11
- getResolvedRef
12
- };
13
- //# sourceMappingURL=get-resolved-ref.js.map
@@ -1,7 +1,4 @@
1
- const isNonOptionalSecurityRequirement = (securityRequirement) => {
2
- return securityRequirement !== void 0 && Object.keys(securityRequirement).length > 0;
1
+ /** Type guard to determine if a security requirement is non-optional */
2
+ export const isNonOptionalSecurityRequirement = (securityRequirement) => {
3
+ return securityRequirement !== undefined && Object.keys(securityRequirement).length > 0;
3
4
  };
4
- export {
5
- isNonOptionalSecurityRequirement
6
- };
7
- //# sourceMappingURL=is-non-optional-security-requirement.js.map
@@ -1,34 +1,75 @@
1
- import { getRaw } from "@scalar/json-magic/magic-proxy";
2
- const mergeObjects = (a, b, replaceArrays = false, cache = /* @__PURE__ */ new Set()) => {
3
- for (const key in b) {
4
- if (!(key in a)) {
5
- a[key] = b[key];
6
- } else {
7
- const aValue = a[key];
8
- const bValue = b[key];
9
- const shouldReplaceArrays = replaceArrays && (Array.isArray(aValue) || Array.isArray(bValue));
10
- if (typeof aValue === "object" && aValue !== null && typeof bValue === "object" && bValue !== null && !shouldReplaceArrays) {
11
- const rawA = getRaw(aValue);
12
- const rawB = getRaw(bValue);
13
- if (cache.has(rawA) || cache.has(rawB)) {
14
- continue;
1
+ import { getRaw } from '@scalar/json-magic/magic-proxy';
2
+ /**
3
+ * Deep merges two objects, combining their properties recursively.
4
+ * Handles circular references by tracking visited objects to prevent infinite recursion.
5
+ *
6
+ * ⚠️ Note: This operation assumes there are no key collisions between the objects.
7
+ * Use isKeyCollisions() to check for collisions before merging.
8
+ *
9
+ * @param a - Target object to merge into
10
+ * @param b - Source object to merge from
11
+ * @param cache - Set of visited objects to prevent circular reference issues
12
+ * @returns The merged object (mutates and returns a)
13
+ *
14
+ * @example
15
+ * // Simple merge
16
+ * const a = { name: 'John' }
17
+ * const b = { age: 30 }
18
+ * mergeObjects(a, b) // { name: 'John', age: 30 }
19
+ *
20
+ * // Nested merge
21
+ * const a = { user: { name: 'John' } }
22
+ * const b = { user: { age: 30 } }
23
+ * mergeObjects(a, b) // { user: { name: 'John', age: 30 } }
24
+ *
25
+ * // Circular reference safe
26
+ * const obj = { name: 'John' }
27
+ * obj.self = obj
28
+ * const target = { age: 30 }
29
+ * mergeObjects(target, obj) // Safely merges without infinite recursion
30
+ */
31
+ export const mergeObjects = (a, b,
32
+ /**
33
+ * By default we overwrite array indexes, our store is built on this assumption when coercing the document
34
+ * Alternatively we may want to prevent this behaviour when merging with defaults and replace the whole array instead
35
+ */
36
+ replaceArrays = false, cache = new Set()) => {
37
+ for (const key in b) {
38
+ if (!(key in a)) {
39
+ a[key] = b[key];
15
40
  }
16
- cache.add(rawA);
17
- cache.add(rawB);
18
- mergeObjects(aValue, bValue, replaceArrays, cache);
19
- } else {
20
- try {
21
- a[key] = bValue;
22
- } catch (error) {
23
- console.warn(`Issue setting ${key} on object`);
24
- console.warn(error);
41
+ else {
42
+ const aValue = a[key];
43
+ const bValue = b[key];
44
+ /** Replace whole array instead of replacing each index */
45
+ const shouldReplaceArrays = replaceArrays && (Array.isArray(aValue) || Array.isArray(bValue));
46
+ if (typeof aValue === 'object' &&
47
+ aValue !== null &&
48
+ typeof bValue === 'object' &&
49
+ bValue !== null &&
50
+ !shouldReplaceArrays) {
51
+ const rawA = getRaw(aValue);
52
+ const rawB = getRaw(bValue);
53
+ // Check for circular references before recursive merge
54
+ if (cache.has(rawA) || cache.has(rawB)) {
55
+ // Skip merging this branch to prevent infinite recursion
56
+ continue;
57
+ }
58
+ // Add objects to cache before recursive call
59
+ cache.add(rawA);
60
+ cache.add(rawB);
61
+ mergeObjects(aValue, bValue, replaceArrays, cache);
62
+ }
63
+ else {
64
+ try {
65
+ a[key] = bValue; // Overwrite with b's value if not an object
66
+ }
67
+ catch (error) {
68
+ console.warn(`Issue setting ${key} on object`);
69
+ console.warn(error);
70
+ }
71
+ }
25
72
  }
26
- }
27
73
  }
28
- }
29
- return a;
74
+ return a;
30
75
  };
31
- export {
32
- mergeObjects
33
- };
34
- //# sourceMappingURL=merge-object.js.map