@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,46 +1,63 @@
1
- import { xScalarCookieSchema } from "../schemas/extensions/general/x-scalar-cookies.js";
2
- import { coerceValue } from "../schemas/typebox-coerce.js";
3
- const upsertCookie = (collection, { payload, index }) => {
4
- if (!collection) {
5
- return;
6
- }
7
- if (!collection["x-scalar-cookies"]) {
8
- collection["x-scalar-cookies"] = [];
9
- }
10
- if (index !== void 0) {
11
- if (index < 0 || index >= collection["x-scalar-cookies"].length) {
12
- return;
1
+ import { xScalarCookieSchema } from '../schemas/extensions/general/x-scalar-cookies.js';
2
+ import { coerceValue } from '../schemas/typebox-coerce.js';
3
+ /**
4
+ * Adds OR updates a cookie to the document or workspace.
5
+ *
6
+ * @param document - current document if available
7
+ * @param workspace - current workspace if available
8
+ * @param payload - The cookie configuration to add or update
9
+ * @param index - Optional index for updating an existing cookie
10
+ * @param collectionType - Whether this is for a document or workspace
11
+ * @returns the parsed cookie that was added or updated or undefined if the collection is not found
12
+ */
13
+ export const upsertCookie = (collection, { payload, index }) => {
14
+ if (!collection) {
15
+ return;
13
16
  }
14
- const parsed2 = coerceValue(xScalarCookieSchema, {
15
- ...collection["x-scalar-cookies"][index],
16
- ...payload
17
- });
18
- collection["x-scalar-cookies"][index] = parsed2;
19
- return parsed2;
20
- }
21
- const parsed = coerceValue(xScalarCookieSchema, payload);
22
- collection["x-scalar-cookies"].push(parsed);
23
- return parsed;
24
- };
25
- const deleteCookie = (collection, { index }) => {
26
- if (!collection || !collection["x-scalar-cookies"]) {
27
- return false;
28
- }
29
- if (index < 0 || index >= collection["x-scalar-cookies"].length) {
30
- return false;
31
- }
32
- collection["x-scalar-cookies"].splice(index, 1);
33
- return true;
17
+ if (!collection['x-scalar-cookies']) {
18
+ collection['x-scalar-cookies'] = [];
19
+ }
20
+ if (index !== undefined) {
21
+ // Update existing cookie at index
22
+ if (index < 0 || index >= collection['x-scalar-cookies'].length) {
23
+ return;
24
+ }
25
+ // Ensure we parse the payload but keep the existing cookie data
26
+ const parsed = coerceValue(xScalarCookieSchema, {
27
+ ...collection['x-scalar-cookies'][index],
28
+ ...payload,
29
+ });
30
+ // Update
31
+ collection['x-scalar-cookies'][index] = parsed;
32
+ return parsed;
33
+ }
34
+ // Add new cookie
35
+ const parsed = coerceValue(xScalarCookieSchema, payload);
36
+ collection['x-scalar-cookies'].push(parsed);
37
+ return parsed;
34
38
  };
35
- const cookieMutatorsFactory = ({ collection }) => {
36
- return {
37
- upsertCookie: (payload) => upsertCookie(collection, payload),
38
- deleteCookie: (payload) => deleteCookie(collection, payload)
39
- };
39
+ /**
40
+ * Deletes a cookie from the document or workspace by index.
41
+ *
42
+ * @param document - current document if available
43
+ * @param workspace - current workspace if available
44
+ * @param index - Index of the cookie to delete
45
+ * @param collectionType - Whether this is for a document or workspace
46
+ * @returns true if the cookie was deleted, false otherwise
47
+ */
48
+ export const deleteCookie = (collection, { index }) => {
49
+ if (!collection || !collection['x-scalar-cookies']) {
50
+ return false;
51
+ }
52
+ if (index < 0 || index >= collection['x-scalar-cookies'].length) {
53
+ return false;
54
+ }
55
+ collection['x-scalar-cookies'].splice(index, 1);
56
+ return true;
40
57
  };
41
- export {
42
- cookieMutatorsFactory,
43
- deleteCookie,
44
- upsertCookie
58
+ export const cookieMutatorsFactory = ({ collection }) => {
59
+ return {
60
+ upsertCookie: (payload) => upsertCookie(collection, payload),
61
+ deleteCookie: (payload) => deleteCookie(collection, payload),
62
+ };
45
63
  };
46
- //# sourceMappingURL=cookie.js.map
@@ -1,73 +1,111 @@
1
- import { mergeObjects } from "../helpers/merge-object.js";
2
- const updateWatchMode = (document, watchMode) => {
3
- if (!document) {
4
- return;
5
- }
6
- document["x-scalar-watch-mode"] = watchMode;
7
- };
8
- const updateDocumentInfo = (document, payload) => {
9
- if (!document) {
10
- return;
11
- }
12
- mergeObjects(document.info, payload);
13
- if (document["x-scalar-navigation"] && payload.title !== void 0) {
14
- document["x-scalar-navigation"].title = payload.title?.trim() || "Untitled Document";
15
- }
1
+ import { mergeObjects } from '../helpers/merge-object.js';
2
+ /**
3
+ * Updates the "watch mode" state of the given document.
4
+ *
5
+ * @param document WorkspaceDocument or null – The document to modify.
6
+ * @param watchMode boolean – True enables watch mode, false disables it.
7
+ *
8
+ * If document is null, does nothing.
9
+ */
10
+ export const updateWatchMode = (document, watchMode) => {
11
+ if (!document) {
12
+ return;
13
+ }
14
+ // Set (or unset) the x-scalar-watch-mode property on the document
15
+ document['x-scalar-watch-mode'] = watchMode;
16
16
  };
17
- const updateDocumentIcon = (document, icon) => {
18
- if (!document || !document["x-scalar-navigation"]) {
19
- return;
20
- }
21
- document["x-scalar-icon"] = icon;
22
- document["x-scalar-navigation"].icon = icon;
17
+ /**
18
+ * Updates the document's info object (typically, title, description, version, etc.).
19
+ *
20
+ * Uses a shallow merge: only properties present in payload will be overwritten or added.
21
+ *
22
+ * @param document WorkspaceDocument | null – The document whose info should be updated.
23
+ * @param payload DocumentEvents['document:update:info'] – Partial info fields to update/merge.
24
+ *
25
+ * If document is null, does nothing.
26
+ */
27
+ export const updateDocumentInfo = (document, payload) => {
28
+ if (!document) {
29
+ return;
30
+ }
31
+ // Merge the given payload into the document's info object
32
+ mergeObjects(document.info, payload);
33
+ // Update the document title if it is present and the navigation object is present
34
+ // We do this because we don't want to rebuild the entire navigation object if only the title is changed
35
+ // Normalize like traverseDocument: trim and treat whitespace-only as empty so we show "Untitled Document"
36
+ if (document['x-scalar-navigation'] && payload.title !== undefined) {
37
+ document['x-scalar-navigation'].title = payload.title?.trim() || 'Untitled Document';
38
+ }
23
39
  };
24
- const createEmptyDocument = async (store, payload) => {
25
- if (!store) {
26
- return;
27
- }
28
- if (store.workspace.documents[payload.name]) {
29
- payload.callback?.(false);
30
- return;
31
- }
32
- await store.addDocument({
33
- name: payload.name,
34
- document: {
35
- openapi: "3.1.0",
36
- info: { title: payload.name, version: "1.0.0" },
37
- paths: {
38
- "/": {
39
- get: {}
40
- }
41
- },
42
- "x-scalar-icon": payload.icon
40
+ /**
41
+ * Update the document icon and also update the corresponding sidebar entry
42
+ *
43
+ * Does not perform a sidebar rebuild for performance benefit
44
+ */
45
+ export const updateDocumentIcon = (document, icon) => {
46
+ if (!document || !document['x-scalar-navigation']) {
47
+ return;
43
48
  }
44
- });
45
- payload.callback?.(true);
49
+ // Update the document icon
50
+ document['x-scalar-icon'] = icon;
51
+ // Update the sidebar document icon
52
+ document['x-scalar-navigation'].icon = icon;
46
53
  };
47
- const deleteDocument = (store, payload) => {
48
- if (!store) {
49
- return;
50
- }
51
- store.deleteDocument(payload.name);
54
+ /**
55
+ * Creates an empty OpenAPI document and adds it to the workspace.
56
+ *
57
+ * - If the store is null, this is a no-op.
58
+ * - The document name must be unique; if already present, callback is called with `false`.
59
+ * - On success, a new OpenAPI 3.1.0 document is added with a basic path and info.
60
+ * - Callback is called with `true` if document is created.
61
+ *
62
+ * @param store WorkspaceStore | null – The workspace store to add the document to.
63
+ * @param payload DocumentEvents['document:create:empty-document'] – Contains name, icon, and callback.
64
+ */
65
+ export const createEmptyDocument = async (store, payload) => {
66
+ if (!store) {
67
+ return;
68
+ }
69
+ // Check if the document already exists by name for uniqueness
70
+ if (store.workspace.documents[payload.name]) {
71
+ // Document name already exists, call callback with false
72
+ payload.callback?.(false);
73
+ return;
74
+ }
75
+ // Add a new empty OpenAPI 3.1.0 document with minimal info and icon
76
+ await store.addDocument({
77
+ name: payload.name,
78
+ document: {
79
+ openapi: '3.1.0',
80
+ info: { title: payload.name, version: '1.0.0' },
81
+ paths: {
82
+ '/': {
83
+ get: {},
84
+ },
85
+ },
86
+ 'x-scalar-icon': payload.icon,
87
+ },
88
+ });
89
+ // Notify success via callback
90
+ payload.callback?.(true);
52
91
  };
53
- const documentMutatorsFactory = ({
54
- document,
55
- store
56
- }) => {
57
- return {
58
- updateDocumentInfo: (payload) => updateDocumentInfo(document, payload),
59
- updateWatchMode: (payload) => updateWatchMode(document, payload),
60
- updateDocumentIcon: (payload) => updateDocumentIcon(document, payload),
61
- createEmptyDocument: (payload) => createEmptyDocument(store, payload),
62
- deleteDocument: (payload) => deleteDocument(store, payload)
63
- };
92
+ /**
93
+ * Deletes a document from the workspace by its name.
94
+ *
95
+ * Safely no-ops if the store is null.
96
+ */
97
+ export const deleteDocument = (store, payload) => {
98
+ if (!store) {
99
+ return;
100
+ }
101
+ store.deleteDocument(payload.name);
64
102
  };
65
- export {
66
- createEmptyDocument,
67
- deleteDocument,
68
- documentMutatorsFactory,
69
- updateDocumentIcon,
70
- updateDocumentInfo,
71
- updateWatchMode
103
+ export const documentMutatorsFactory = ({ document, store, }) => {
104
+ return {
105
+ updateDocumentInfo: (payload) => updateDocumentInfo(document, payload),
106
+ updateWatchMode: (payload) => updateWatchMode(document, payload),
107
+ updateDocumentIcon: (payload) => updateDocumentIcon(document, payload),
108
+ createEmptyDocument: (payload) => createEmptyDocument(store, payload),
109
+ deleteDocument: (payload) => deleteDocument(store, payload),
110
+ };
72
111
  };
73
- //# sourceMappingURL=document.js.map
@@ -1,79 +1,104 @@
1
- import { unpackProxyObject } from "../helpers/unpack-proxy.js";
2
- import {
3
- xScalarEnvVarSchema,
4
- xScalarEnvironmentSchema
5
- } from "../schemas/extensions/document/x-scalar-environments.js";
6
- import { coerceValue } from "../schemas/typebox-coerce.js";
7
- const upsertEnvironment = (workspace, collection, { environmentName, payload, oldEnvironmentName }) => {
8
- if (!collection || !workspace) {
9
- return;
10
- }
11
- if (!collection["x-scalar-environments"]) {
12
- collection["x-scalar-environments"] = {};
13
- }
14
- const isNewEnvironment = !collection["x-scalar-environments"][oldEnvironmentName ?? environmentName];
15
- const parsed = coerceValue(xScalarEnvironmentSchema, {
16
- ...unpackProxyObject(collection["x-scalar-environments"][oldEnvironmentName ?? environmentName], { depth: 1 }),
17
- ...payload
18
- });
19
- collection["x-scalar-environments"][environmentName] = parsed;
20
- if (oldEnvironmentName && oldEnvironmentName !== environmentName) {
21
- delete collection["x-scalar-environments"][oldEnvironmentName];
22
- if (workspace["x-scalar-active-environment"] === oldEnvironmentName) {
23
- workspace["x-scalar-active-environment"] = environmentName;
1
+ import { unpackProxyObject } from '../helpers/unpack-proxy.js';
2
+ import { xScalarEnvVarSchema, xScalarEnvironmentSchema, } from '../schemas/extensions/document/x-scalar-environments.js';
3
+ import { coerceValue } from '../schemas/typebox-coerce.js';
4
+ /**
5
+ * Adds OR updates an environment to the document or workspace.
6
+ *
7
+ * @param document - current document if available
8
+ * @param workspace - current workspace if available
9
+ * @param environmentName - Name of the environment to add
10
+ * @param payload - The environment configuration to add
11
+ * @param oldEnvironmentName - Only needed when renaming the environment
12
+ * @returns the parsed environment that was added or updated or undefined if the collection is not found
13
+ */
14
+ export const upsertEnvironment = (workspace, collection, { environmentName, payload, oldEnvironmentName }) => {
15
+ /** Discriminating between document and workspace */
16
+ if (!collection || !workspace) {
17
+ return;
24
18
  }
25
- }
26
- if (isNewEnvironment) {
27
- workspace["x-scalar-active-environment"] = environmentName;
28
- }
29
- return parsed;
30
- };
31
- const deleteEnvironment = (workspace, collection, { environmentName }) => {
32
- if (!collection || !workspace) {
33
- return;
34
- }
35
- delete collection["x-scalar-environments"]?.[environmentName];
19
+ if (!collection['x-scalar-environments']) {
20
+ collection['x-scalar-environments'] = {};
21
+ }
22
+ // Check if this is a new environment before we create it
23
+ const isNewEnvironment = !collection['x-scalar-environments'][oldEnvironmentName ?? environmentName];
24
+ // Ensure we parse the payload but keep the old variables
25
+ const parsed = coerceValue(xScalarEnvironmentSchema, {
26
+ ...unpackProxyObject(collection['x-scalar-environments'][oldEnvironmentName ?? environmentName], { depth: 1 }),
27
+ ...payload,
28
+ });
29
+ collection['x-scalar-environments'][environmentName] = parsed;
30
+ // If we are renaming the environment, we need to delete the old one
31
+ if (oldEnvironmentName && oldEnvironmentName !== environmentName) {
32
+ delete collection['x-scalar-environments'][oldEnvironmentName];
33
+ // If the old environment was active, we need to set the new environment as active
34
+ if (workspace['x-scalar-active-environment'] === oldEnvironmentName) {
35
+ workspace['x-scalar-active-environment'] = environmentName;
36
+ }
37
+ }
38
+ // Set the newly created workspace environment as active
39
+ if (isNewEnvironment) {
40
+ workspace['x-scalar-active-environment'] = environmentName;
41
+ }
42
+ return parsed;
36
43
  };
37
- const upsertEnvironmentVariable = (collection, { environmentName, variable, index }) => {
38
- if (!collection?.["x-scalar-environments"]?.[environmentName]) {
39
- console.error("Environment not found", environmentName);
40
- return;
41
- }
42
- const parsed = coerceValue(xScalarEnvVarSchema, variable);
43
- if (index !== void 0) {
44
- if (parsed.name === "") {
45
- collection["x-scalar-environments"][environmentName].variables.splice(index, 1);
46
- return;
44
+ /**
45
+ * Deletes an environment from the given collection and handles active environment state.
46
+ *
47
+ * @param workspace - The workspace object, or null if unavailable.
48
+ * @param collection - The workspace document or workspace object, or null if unavailable.
49
+ * @param environmentName - The name of the environment to delete.
50
+ */
51
+ export const deleteEnvironment = (workspace, collection, { environmentName }) => {
52
+ if (!collection || !workspace) {
53
+ return;
47
54
  }
48
- collection["x-scalar-environments"][environmentName].variables[index] = parsed;
49
- } else {
50
- collection["x-scalar-environments"][environmentName].variables.push(parsed);
51
- }
52
- return parsed;
55
+ // Trigegr the change event for the active environment
56
+ delete collection['x-scalar-environments']?.[environmentName];
53
57
  };
54
- const deleteEnvironmentVariable = (collection, { environmentName, index }) => {
55
- if (!collection?.["x-scalar-environments"]?.[environmentName]) {
56
- console.error("Environment not found", environmentName);
57
- return;
58
- }
59
- collection["x-scalar-environments"]?.[environmentName]?.variables?.splice(index, 1);
58
+ /**
59
+ * Adds OR updates an environment variable to the document or workspace.
60
+ *
61
+ * @param collection - Workspace OR document
62
+ * @param environmentName - Name of the environment to add the variable to
63
+ * @param variableName - Name of the variable to add
64
+ * @param value - Value of the variable to add
65
+ * @returns the parsed variable that was added or updated or undefined if the collection is not found
66
+ */
67
+ export const upsertEnvironmentVariable = (collection, { environmentName, variable, index }) => {
68
+ // The environment should exist by now if we are upserting a variable
69
+ if (!collection?.['x-scalar-environments']?.[environmentName]) {
70
+ console.error('Environment not found', environmentName);
71
+ return;
72
+ }
73
+ // Ensure we parse the variable for type safety
74
+ const parsed = coerceValue(xScalarEnvVarSchema, variable);
75
+ if (index !== undefined) {
76
+ // Delete the row if the name is empty
77
+ if (parsed.name === '') {
78
+ collection['x-scalar-environments'][environmentName].variables.splice(index, 1);
79
+ return;
80
+ }
81
+ // Update
82
+ collection['x-scalar-environments'][environmentName].variables[index] = parsed;
83
+ }
84
+ // Add
85
+ else {
86
+ collection['x-scalar-environments'][environmentName].variables.push(parsed);
87
+ }
88
+ return parsed;
60
89
  };
61
- const environmentMutatorsFactory = ({
62
- workspace,
63
- collection
64
- }) => {
65
- return {
66
- upsertEnvironment: (payload) => upsertEnvironment(workspace, collection, payload),
67
- deleteEnvironment: (payload) => deleteEnvironment(workspace, collection, payload),
68
- upsertEnvironmentVariable: (payload) => upsertEnvironmentVariable(collection, payload),
69
- deleteEnvironmentVariable: (payload) => deleteEnvironmentVariable(collection, payload)
70
- };
90
+ export const deleteEnvironmentVariable = (collection, { environmentName, index }) => {
91
+ if (!collection?.['x-scalar-environments']?.[environmentName]) {
92
+ console.error('Environment not found', environmentName);
93
+ return;
94
+ }
95
+ collection['x-scalar-environments']?.[environmentName]?.variables?.splice(index, 1);
71
96
  };
72
- export {
73
- deleteEnvironment,
74
- deleteEnvironmentVariable,
75
- environmentMutatorsFactory,
76
- upsertEnvironment,
77
- upsertEnvironmentVariable
97
+ export const environmentMutatorsFactory = ({ workspace, collection, }) => {
98
+ return {
99
+ upsertEnvironment: (payload) => upsertEnvironment(workspace, collection, payload),
100
+ deleteEnvironment: (payload) => deleteEnvironment(workspace, collection, payload),
101
+ upsertEnvironmentVariable: (payload) => upsertEnvironmentVariable(collection, payload),
102
+ deleteEnvironmentVariable: (payload) => deleteEnvironmentVariable(collection, payload),
103
+ };
78
104
  };
79
- //# sourceMappingURL=environment.js.map
@@ -1,14 +1,10 @@
1
- const getDocument = (store, documentName) => {
2
- if (!store) {
3
- return null;
4
- }
5
- const document = store.workspace.documents[documentName];
6
- if (!document) {
7
- return null;
8
- }
9
- return document;
1
+ export const getDocument = (store, documentName) => {
2
+ if (!store) {
3
+ return null;
4
+ }
5
+ const document = store.workspace.documents[documentName];
6
+ if (!document) {
7
+ return null;
8
+ }
9
+ return document;
10
10
  };
11
- export {
12
- getDocument
13
- };
14
- //# sourceMappingURL=helpers.js.map
@@ -1,55 +1,68 @@
1
- import { authMutatorsFactory } from "../mutators/auth.js";
2
- import { cookieMutatorsFactory } from "../mutators/cookie.js";
3
- import { documentMutatorsFactory } from "../mutators/document.js";
4
- import { environmentMutatorsFactory } from "../mutators/environment.js";
5
- import { getDocument } from "../mutators/helpers.js";
6
- import { operationMutatorsFactory } from "../mutators/operation/index.js";
7
- import { serverMutatorsFactory } from "../mutators/server.js";
8
- import { tabsMutatorsFactory } from "../mutators/tabs.js";
9
- import { tagMutatorsFactory } from "../mutators/tag.js";
10
- import { workspaceMutatorsFactory } from "../mutators/workspace.js";
11
- function generateClientMutators(store) {
12
- const documentMutators = (document) => {
13
- return {
14
- auth: authMutatorsFactory({ store, document }),
15
- cookie: cookieMutatorsFactory({ collection: document }),
16
- document: documentMutatorsFactory({ document, store }),
17
- operation: operationMutatorsFactory({ document, store }),
18
- server: serverMutatorsFactory({ document }),
19
- tag: tagMutatorsFactory({ store }),
20
- environment: environmentMutatorsFactory({ workspace: store?.workspace ?? null, collection: document })
21
- };
22
- };
23
- const workspaceMutators = () => {
24
- return {
25
- cookie: cookieMutatorsFactory({ collection: store?.workspace ?? null }),
26
- tabs: tabsMutatorsFactory({ workspace: store?.workspace ?? null }),
27
- workspace: workspaceMutatorsFactory({ workspace: store?.workspace ?? null }),
28
- environment: environmentMutatorsFactory({
29
- workspace: store?.workspace ?? null,
30
- collection: store?.workspace ?? null
31
- })
32
- };
33
- };
34
- return {
1
+ import { authMutatorsFactory } from '../mutators/auth.js';
2
+ import { cookieMutatorsFactory } from '../mutators/cookie.js';
3
+ import { documentMutatorsFactory } from '../mutators/document.js';
4
+ import { environmentMutatorsFactory } from '../mutators/environment.js';
5
+ import { getDocument } from '../mutators/helpers.js';
6
+ import { operationMutatorsFactory } from '../mutators/operation/index.js';
7
+ import { serverMutatorsFactory } from '../mutators/server.js';
8
+ import { tabsMutatorsFactory } from '../mutators/tabs.js';
9
+ import { tagMutatorsFactory } from '../mutators/tag.js';
10
+ import { workspaceMutatorsFactory } from '../mutators/workspace.js';
11
+ /**
12
+ * Generates a set of mutators for managing OpenAPI document and workspace state.
13
+ *
14
+ * @param store - The workspace store containing all documents and workspace-level data
15
+ * @returns An object with mutators for the workspace, the active document, and any named document
16
+ */
17
+ export function generateClientMutators(store) {
35
18
  /**
36
- * Returns mutators for the workspace-level configuration.
37
- */
38
- workspace: () => workspaceMutators(),
39
- /**
40
- * Returns mutators for the currently active document.
41
- * Falls back to the first document if no active document is set.
19
+ * Returns mutators for a specific document by name.
20
+ *
21
+ * @param documentName - The name of the document to get mutators for
22
+ * @returns An object containing mutators for requests, request examples, security schemes, environments, and cookies
42
23
  */
43
- active: () => documentMutators(store?.workspace.activeDocument ?? null),
24
+ const documentMutators = (document) => {
25
+ return {
26
+ auth: authMutatorsFactory({ store, document }),
27
+ cookie: cookieMutatorsFactory({ collection: document }),
28
+ document: documentMutatorsFactory({ document, store }),
29
+ operation: operationMutatorsFactory({ document, store }),
30
+ server: serverMutatorsFactory({ document }),
31
+ tag: tagMutatorsFactory({ store }),
32
+ environment: environmentMutatorsFactory({ workspace: store?.workspace ?? null, collection: document }),
33
+ };
34
+ };
44
35
  /**
45
- * Returns mutators for a specific document by name.
36
+ * Returns mutators for the workspace-level configuration.
46
37
  *
47
- * @param name - The name of the document
38
+ * @returns An object containing mutators for environments and cookies at the workspace level
48
39
  */
49
- doc: (name) => documentMutators(getDocument(store, name))
50
- };
40
+ const workspaceMutators = () => {
41
+ return {
42
+ cookie: cookieMutatorsFactory({ collection: store?.workspace ?? null }),
43
+ tabs: tabsMutatorsFactory({ workspace: store?.workspace ?? null }),
44
+ workspace: workspaceMutatorsFactory({ workspace: store?.workspace ?? null }),
45
+ environment: environmentMutatorsFactory({
46
+ workspace: store?.workspace ?? null,
47
+ collection: store?.workspace ?? null,
48
+ }),
49
+ };
50
+ };
51
+ return {
52
+ /**
53
+ * Returns mutators for the workspace-level configuration.
54
+ */
55
+ workspace: () => workspaceMutators(),
56
+ /**
57
+ * Returns mutators for the currently active document.
58
+ * Falls back to the first document if no active document is set.
59
+ */
60
+ active: () => documentMutators(store?.workspace.activeDocument ?? null),
61
+ /**
62
+ * Returns mutators for a specific document by name.
63
+ *
64
+ * @param name - The name of the document
65
+ */
66
+ doc: (name) => documentMutators(getDocument(store, name)),
67
+ };
51
68
  }
52
- export {
53
- generateClientMutators
54
- };
55
- //# sourceMappingURL=index.js.map