@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,286 +1,284 @@
1
- import { Type } from "@scalar/typebox";
2
- import { createIndexDbConnection } from "../persistence/indexdb.js";
3
- const getWorkspaceId = (namespace, slug) => `${namespace}/${slug}`;
4
- const createWorkspaceStorePersistence = async () => {
5
- const connection = await createIndexDbConnection({
6
- name: "scalar-workspace-store",
7
- version: 1,
8
- tables: {
9
- workspace: {
10
- schema: Type.Object({
11
- /** Visual name for a given workspace */
12
- name: Type.String(),
13
- /** When logged in all new workspaces (remote and local) are scoped to a team */
14
- teamUid: Type.String({ default: "local" }),
15
- /** Namespace associated with a remote workspace */
16
- namespace: Type.String({ default: "local" }),
17
- /** Slug associated with a remote workspace */
18
- slug: Type.String({ default: "local" })
19
- }),
20
- keyPath: ["namespace", "slug"],
21
- indexes: {
22
- teamUid: ["teamUid"]
23
- }
24
- },
25
- meta: {
26
- schema: Type.Object({ workspaceId: Type.String(), data: Type.Any() }),
27
- keyPath: ["workspaceId"]
28
- },
29
- documents: {
30
- schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
31
- keyPath: ["workspaceId", "documentName"]
32
- },
33
- originalDocuments: {
34
- schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
35
- keyPath: ["workspaceId", "documentName"]
36
- },
37
- intermediateDocuments: {
38
- schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
39
- keyPath: ["workspaceId", "documentName"]
40
- },
41
- overrides: {
42
- schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
43
- keyPath: ["workspaceId", "documentName"]
44
- },
45
- history: {
46
- schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
47
- keyPath: ["workspaceId", "documentName"]
48
- },
49
- auth: {
50
- schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
51
- keyPath: ["workspaceId", "documentName"]
52
- }
53
- }
54
- });
55
- const workspaceTable = connection.get("workspace");
56
- const metaTable = connection.get("meta");
57
- const documentsTable = connection.get("documents");
58
- const originalDocumentTable = connection.get("originalDocuments");
59
- const intermediateDocumentTable = connection.get("intermediateDocuments");
60
- const overridesTable = connection.get("overrides");
61
- const historyTable = connection.get("history");
62
- const authTable = connection.get("auth");
63
- return {
64
- close: () => {
65
- connection.closeDatabase();
66
- },
67
- meta: {
68
- /**
69
- * Set meta data for a workspace.
70
- */
71
- setItem: async (workspaceId, data) => {
72
- await metaTable.addItem({ workspaceId }, { data });
73
- }
74
- },
75
- documents: {
76
- /**
77
- * Set (persist) a workspace document using workspaceId and documentName as composite key.
78
- */
79
- setItem: async (workspaceId, documentName, data) => {
80
- await documentsTable.addItem({ workspaceId, documentName }, { data });
81
- }
82
- },
83
- originalDocuments: {
84
- /**
85
- * Set an original (raw) document for a workspace/document pair.
86
- */
87
- setItem: async (workspaceId, documentName, data) => {
88
- await originalDocumentTable.addItem({ workspaceId, documentName }, { data });
89
- }
90
- },
91
- intermediateDocuments: {
92
- /**
93
- * Set an intermediate (transformed) document for a workspace/document pair.
94
- */
95
- setItem: async (workspaceId, documentName, data) => {
96
- await intermediateDocumentTable.addItem({ workspaceId, documentName }, { data });
97
- }
98
- },
99
- overrides: {
100
- /**
101
- * Set document overrides for a workspace/document pair.
102
- */
103
- setItem: async (workspaceId, documentName, data) => {
104
- await overridesTable.addItem({ workspaceId, documentName }, { data });
105
- }
106
- },
107
- history: {
108
- /**
109
- * Set history for a document.
110
- */
111
- setItem: async (workspaceId, documentName, data) => {
112
- await historyTable.addItem({ workspaceId, documentName }, { data });
113
- }
114
- },
115
- auth: {
116
- /**
117
- * Set auth for a document.
118
- */
119
- setItem: async (workspaceId, documentName, data) => {
120
- await authTable.addItem({ workspaceId, documentName }, { data });
121
- }
122
- },
123
- workspace: {
124
- /**
125
- * Retrieves a workspace by its ID.
126
- * Returns undefined if the workspace does not exist.
127
- * Gathers all workspace 'chunk' tables and assembles a full workspace shape.
128
- */
129
- getItem: async ({
130
- namespace,
131
- slug
132
- }) => {
133
- const workspace = await workspaceTable.getItem({ namespace, slug });
134
- if (!workspace) {
135
- return void 0;
136
- }
137
- const id = getWorkspaceId(namespace, slug);
138
- const workspaceDocuments = await documentsTable.getRange([id]);
139
- const workspaceOriginalDocuments = await originalDocumentTable.getRange([id]);
140
- const workspaceIntermediateDocuments = await intermediateDocumentTable.getRange([id]);
141
- const workspaceOverrides = await overridesTable.getRange([id]);
142
- const workspaceMeta = await metaTable.getItem({ workspaceId: id });
143
- const workspaceHistory = await historyTable.getRange([id]);
144
- const workspaceAuth = await authTable.getRange([id]);
145
- return {
146
- name: workspace.name,
147
- teamUid: workspace.teamUid,
148
- namespace: workspace.namespace,
149
- slug: workspace.slug,
150
- workspace: {
151
- documents: Object.fromEntries(workspaceDocuments.map((item) => [item.documentName, item.data])),
152
- originalDocuments: Object.fromEntries(
153
- workspaceOriginalDocuments.map((item) => [item.documentName, item.data])
154
- ),
155
- intermediateDocuments: Object.fromEntries(
156
- workspaceIntermediateDocuments.map((item) => [item.documentName, item.data])
157
- ),
158
- overrides: Object.fromEntries(workspaceOverrides.map((item) => [item.documentName, item.data])),
159
- meta: workspaceMeta?.data,
160
- history: Object.fromEntries(workspaceHistory.map((item) => [item.documentName, item.data])),
161
- auth: Object.fromEntries(workspaceAuth.map((item) => [item.documentName, item.data]))
162
- }
163
- };
164
- },
165
- /**
166
- * Retrieves all workspaces from the database.
167
- * Returns only the workspace ID and name for each workspace.
168
- * To get the full workspace data including documents and metadata, use getItem() with a specific ID.
169
- * Returns an empty array if no workspaces exist.
170
- */
171
- getAll: async () => {
172
- return await workspaceTable.getAll();
173
- },
174
- /**
175
- * Retrieves all workspaces for a given team UID.
176
- */
177
- getAllByTeamUid: async (teamUid) => {
178
- return await workspaceTable.getRange([teamUid], "teamUid");
179
- },
180
- /**
181
- * Saves a workspace to the database.
182
- * All chunks (meta, documents, configs, etc.) are upsert in their respective tables.
183
- * If a workspace with the same ID already exists, it will be replaced.
184
- */
185
- setItem: async ({ namespace = "local", slug }, value) => {
186
- const workspace = await workspaceTable.addItem(
187
- { namespace, slug },
188
- {
189
- name: value.name,
190
- teamUid: value.teamUid ?? "local"
191
- }
192
- );
193
- const id = getWorkspaceId(namespace, slug);
194
- await metaTable.addItem({ workspaceId: id }, { data: value.workspace.meta });
195
- await Promise.all(
196
- Object.entries(value.workspace.documents ?? {}).map(([name, data]) => {
197
- return documentsTable.addItem({ workspaceId: id, documentName: name }, { data });
198
- })
199
- );
200
- await Promise.all(
201
- Object.entries(value.workspace.originalDocuments ?? {}).map(([name, data]) => {
202
- return originalDocumentTable.addItem({ workspaceId: id, documentName: name }, { data });
203
- })
204
- );
205
- await Promise.all(
206
- Object.entries(value.workspace.intermediateDocuments ?? {}).map(([name, data]) => {
207
- return intermediateDocumentTable.addItem({ workspaceId: id, documentName: name }, { data });
208
- })
209
- );
210
- await Promise.all(
211
- Object.entries(value.workspace.overrides ?? {}).map(([name, data]) => {
212
- return overridesTable.addItem({ workspaceId: id, documentName: name }, { data });
213
- })
214
- );
215
- await Promise.all(
216
- Object.entries(value.workspace.history ?? {}).map(([name, data]) => {
217
- return historyTable.addItem({ workspaceId: id, documentName: name }, { data });
218
- })
219
- );
220
- await Promise.all(
221
- Object.entries(value.workspace.auth ?? {}).map(([name, data]) => {
222
- return authTable.addItem({ workspaceId: id, documentName: name }, { data });
223
- })
224
- );
225
- return workspace;
226
- },
227
- /**
228
- * Deletes an entire workspace and all associated chunk records from all tables by ID.
229
- */
230
- deleteItem: async ({ namespace, slug }) => {
231
- const id = getWorkspaceId(namespace, slug);
232
- await workspaceTable.deleteItem({ namespace, slug });
233
- await Promise.all([
234
- // By id
235
- metaTable.deleteItem({ workspaceId: id }),
236
- // By range (composite-key tables)
237
- documentsTable.deleteRange([id]),
238
- originalDocumentTable.deleteRange([id]),
239
- intermediateDocumentTable.deleteRange([id]),
240
- overridesTable.deleteRange([id]),
241
- historyTable.deleteRange([id]),
242
- authTable.deleteRange([id])
243
- ]);
244
- },
245
- /**
246
- * Deletes a single document and all related records (overrides, history, auth, etc.)
247
- * for the given workspace and document name from all relevant tables.
248
- */
249
- deleteDocument: async (workspaceId, documentName) => {
250
- await Promise.all([
251
- documentsTable.deleteItem({ workspaceId, documentName }),
252
- intermediateDocumentTable.deleteItem({ workspaceId, documentName }),
253
- originalDocumentTable.deleteItem({ workspaceId, documentName }),
254
- overridesTable.deleteItem({ workspaceId, documentName }),
255
- historyTable.deleteItem({ workspaceId, documentName }),
256
- authTable.deleteItem({ workspaceId, documentName })
257
- ]);
258
- },
259
- /**
260
- * Updates the name of an existing workspace.
261
- * Returns the updated workspace object, or undefined if the workspace does not exist.
262
- */
263
- updateName: async ({ namespace, slug }, name) => {
264
- const workspace = await workspaceTable.getItem({ namespace, slug });
265
- if (!workspace) {
266
- return void 0;
267
- }
268
- return await workspaceTable.addItem({ namespace, slug }, { ...workspace, name });
269
- },
270
- /**
271
- * Checks if a workspace with the given ID exists in the store.
272
- */
273
- has: async ({ namespace, slug }) => {
274
- return await workspaceTable.getItem({ namespace, slug }) !== void 0;
275
- }
276
- },
277
- clear: async () => {
278
- await workspaceTable.deleteAll();
279
- }
280
- };
1
+ import { Type } from '@scalar/typebox';
2
+ import { createIndexDbConnection } from '../persistence/indexdb.js';
3
+ /** Generates a workspace ID from namespace and slug. */
4
+ export const getWorkspaceId = (namespace, slug) => `${namespace}/${slug}`;
5
+ /**
6
+ * Creates the persistence layer for the workspace store using IndexedDB.
7
+ * This sets up all the required tables for storing workspace chunk information,
8
+ * such as workspace meta, documents, original documents, intermediate documents, overrides, etc.
9
+ * Each logical group (meta, documents, etc) gets its own table keyed appropriately for efficient sub-document access.
10
+ * Returns an object containing `meta`, `documents`, `originalDocuments`, `intermediateDocuments`, `overrides`,
11
+ * `documentMeta`, `documentConfigs`, and `workspace` sections, each exposing a `setItem` method
12
+ * for upsetting records, and in the case of `workspace`, also `getItem` and `deleteItem`.
13
+ */
14
+ export const createWorkspaceStorePersistence = async () => {
15
+ // Create the database connection and setup all required tables for workspace storage.
16
+ const connection = await createIndexDbConnection({
17
+ name: 'scalar-workspace-store',
18
+ version: 1,
19
+ tables: {
20
+ workspace: {
21
+ schema: Type.Object({
22
+ /** Visual name for a given workspace */
23
+ name: Type.String(),
24
+ /** When logged in all new workspaces (remote and local) are scoped to a team */
25
+ teamUid: Type.String({ default: 'local' }),
26
+ /** Namespace associated with a remote workspace */
27
+ namespace: Type.String({ default: 'local' }),
28
+ /** Slug associated with a remote workspace */
29
+ slug: Type.String({ default: 'local' }),
30
+ }),
31
+ keyPath: ['namespace', 'slug'],
32
+ indexes: {
33
+ teamUid: ['teamUid'],
34
+ },
35
+ },
36
+ meta: {
37
+ schema: Type.Object({ workspaceId: Type.String(), data: Type.Any() }),
38
+ keyPath: ['workspaceId'],
39
+ },
40
+ documents: {
41
+ schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
42
+ keyPath: ['workspaceId', 'documentName'],
43
+ },
44
+ originalDocuments: {
45
+ schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
46
+ keyPath: ['workspaceId', 'documentName'],
47
+ },
48
+ intermediateDocuments: {
49
+ schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
50
+ keyPath: ['workspaceId', 'documentName'],
51
+ },
52
+ overrides: {
53
+ schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
54
+ keyPath: ['workspaceId', 'documentName'],
55
+ },
56
+ history: {
57
+ schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
58
+ keyPath: ['workspaceId', 'documentName'],
59
+ },
60
+ auth: {
61
+ schema: Type.Object({ workspaceId: Type.String(), documentName: Type.String(), data: Type.Any() }),
62
+ keyPath: ['workspaceId', 'documentName'],
63
+ },
64
+ },
65
+ });
66
+ // Tables wrappers for each logical section.
67
+ const workspaceTable = connection.get('workspace');
68
+ const metaTable = connection.get('meta');
69
+ const documentsTable = connection.get('documents');
70
+ const originalDocumentTable = connection.get('originalDocuments');
71
+ const intermediateDocumentTable = connection.get('intermediateDocuments');
72
+ const overridesTable = connection.get('overrides');
73
+ const historyTable = connection.get('history');
74
+ const authTable = connection.get('auth');
75
+ // The returned persistence API with logical sections for each table and mapping.
76
+ return {
77
+ close: () => {
78
+ connection.closeDatabase();
79
+ },
80
+ meta: {
81
+ /**
82
+ * Set meta data for a workspace.
83
+ */
84
+ setItem: async (workspaceId, data) => {
85
+ await metaTable.addItem({ workspaceId }, { data });
86
+ },
87
+ },
88
+ documents: {
89
+ /**
90
+ * Set (persist) a workspace document using workspaceId and documentName as composite key.
91
+ */
92
+ setItem: async (workspaceId, documentName, data) => {
93
+ await documentsTable.addItem({ workspaceId, documentName }, { data });
94
+ },
95
+ },
96
+ originalDocuments: {
97
+ /**
98
+ * Set an original (raw) document for a workspace/document pair.
99
+ */
100
+ setItem: async (workspaceId, documentName, data) => {
101
+ await originalDocumentTable.addItem({ workspaceId, documentName }, { data });
102
+ },
103
+ },
104
+ intermediateDocuments: {
105
+ /**
106
+ * Set an intermediate (transformed) document for a workspace/document pair.
107
+ */
108
+ setItem: async (workspaceId, documentName, data) => {
109
+ await intermediateDocumentTable.addItem({ workspaceId, documentName }, { data });
110
+ },
111
+ },
112
+ overrides: {
113
+ /**
114
+ * Set document overrides for a workspace/document pair.
115
+ */
116
+ setItem: async (workspaceId, documentName, data) => {
117
+ await overridesTable.addItem({ workspaceId, documentName }, { data });
118
+ },
119
+ },
120
+ history: {
121
+ /**
122
+ * Set history for a document.
123
+ */
124
+ setItem: async (workspaceId, documentName, data) => {
125
+ await historyTable.addItem({ workspaceId, documentName }, { data });
126
+ },
127
+ },
128
+ auth: {
129
+ /**
130
+ * Set auth for a document.
131
+ */
132
+ setItem: async (workspaceId, documentName, data) => {
133
+ await authTable.addItem({ workspaceId, documentName }, { data });
134
+ },
135
+ },
136
+ workspace: {
137
+ /**
138
+ * Retrieves a workspace by its ID.
139
+ * Returns undefined if the workspace does not exist.
140
+ * Gathers all workspace 'chunk' tables and assembles a full workspace shape.
141
+ */
142
+ getItem: async ({ namespace, slug, }) => {
143
+ const workspace = await workspaceTable.getItem({ namespace, slug });
144
+ if (!workspace) {
145
+ return undefined;
146
+ }
147
+ // Create a composite key for the workspace chunks.
148
+ const id = getWorkspaceId(namespace, slug);
149
+ // Retrieve all chunk records for this workspace.
150
+ const workspaceDocuments = await documentsTable.getRange([id]);
151
+ const workspaceOriginalDocuments = await originalDocumentTable.getRange([id]);
152
+ const workspaceIntermediateDocuments = await intermediateDocumentTable.getRange([id]);
153
+ const workspaceOverrides = await overridesTable.getRange([id]);
154
+ const workspaceMeta = await metaTable.getItem({ workspaceId: id });
155
+ const workspaceHistory = await historyTable.getRange([id]);
156
+ const workspaceAuth = await authTable.getRange([id]);
157
+ // Compose the workspace structure from table records.
158
+ return {
159
+ name: workspace.name,
160
+ teamUid: workspace.teamUid,
161
+ namespace: workspace.namespace,
162
+ slug: workspace.slug,
163
+ workspace: {
164
+ documents: Object.fromEntries(workspaceDocuments.map((item) => [item.documentName, item.data])),
165
+ originalDocuments: Object.fromEntries(workspaceOriginalDocuments.map((item) => [item.documentName, item.data])),
166
+ intermediateDocuments: Object.fromEntries(workspaceIntermediateDocuments.map((item) => [item.documentName, item.data])),
167
+ overrides: Object.fromEntries(workspaceOverrides.map((item) => [item.documentName, item.data])),
168
+ meta: workspaceMeta?.data,
169
+ history: Object.fromEntries(workspaceHistory.map((item) => [item.documentName, item.data])),
170
+ auth: Object.fromEntries(workspaceAuth.map((item) => [item.documentName, item.data])),
171
+ },
172
+ };
173
+ },
174
+ /**
175
+ * Retrieves all workspaces from the database.
176
+ * Returns only the workspace ID and name for each workspace.
177
+ * To get the full workspace data including documents and metadata, use getItem() with a specific ID.
178
+ * Returns an empty array if no workspaces exist.
179
+ */
180
+ getAll: async () => {
181
+ return await workspaceTable.getAll();
182
+ },
183
+ /**
184
+ * Retrieves all workspaces for a given team UID.
185
+ */
186
+ getAllByTeamUid: async (teamUid) => {
187
+ return await workspaceTable.getRange([teamUid], 'teamUid');
188
+ },
189
+ /**
190
+ * Saves a workspace to the database.
191
+ * All chunks (meta, documents, configs, etc.) are upsert in their respective tables.
192
+ * If a workspace with the same ID already exists, it will be replaced.
193
+ */
194
+ setItem: async ({ namespace = 'local', slug }, value) => {
195
+ const workspace = await workspaceTable.addItem({ namespace, slug }, {
196
+ name: value.name,
197
+ teamUid: value.teamUid ?? 'local',
198
+ });
199
+ const id = getWorkspaceId(namespace, slug);
200
+ // Save all meta info for workspace.
201
+ await metaTable.addItem({ workspaceId: id }, { data: value.workspace.meta });
202
+ // Persist all workspace documents (chunks).
203
+ await Promise.all(Object.entries(value.workspace.documents ?? {}).map(([name, data]) => {
204
+ return documentsTable.addItem({ workspaceId: id, documentName: name }, { data });
205
+ }));
206
+ // Persist all original documents.
207
+ await Promise.all(Object.entries(value.workspace.originalDocuments ?? {}).map(([name, data]) => {
208
+ return originalDocumentTable.addItem({ workspaceId: id, documentName: name }, { data });
209
+ }));
210
+ // Persist all intermediate documents.
211
+ await Promise.all(Object.entries(value.workspace.intermediateDocuments ?? {}).map(([name, data]) => {
212
+ return intermediateDocumentTable.addItem({ workspaceId: id, documentName: name }, { data });
213
+ }));
214
+ // Persist all document overrides.
215
+ await Promise.all(Object.entries(value.workspace.overrides ?? {}).map(([name, data]) => {
216
+ return overridesTable.addItem({ workspaceId: id, documentName: name }, { data });
217
+ }));
218
+ // Persist all history.
219
+ await Promise.all(Object.entries(value.workspace.history ?? {}).map(([name, data]) => {
220
+ return historyTable.addItem({ workspaceId: id, documentName: name }, { data });
221
+ }));
222
+ // Persist all auth.
223
+ await Promise.all(Object.entries(value.workspace.auth ?? {}).map(([name, data]) => {
224
+ return authTable.addItem({ workspaceId: id, documentName: name }, { data });
225
+ }));
226
+ return workspace;
227
+ },
228
+ /**
229
+ * Deletes an entire workspace and all associated chunk records from all tables by ID.
230
+ */
231
+ deleteItem: async ({ namespace, slug }) => {
232
+ const id = getWorkspaceId(namespace, slug);
233
+ await workspaceTable.deleteItem({ namespace, slug });
234
+ // Remove all workspace-related records from all chunk tables.
235
+ await Promise.all([
236
+ // By id
237
+ metaTable.deleteItem({ workspaceId: id }),
238
+ // By range (composite-key tables)
239
+ documentsTable.deleteRange([id]),
240
+ originalDocumentTable.deleteRange([id]),
241
+ intermediateDocumentTable.deleteRange([id]),
242
+ overridesTable.deleteRange([id]),
243
+ historyTable.deleteRange([id]),
244
+ authTable.deleteRange([id]),
245
+ ]);
246
+ },
247
+ /**
248
+ * Deletes a single document and all related records (overrides, history, auth, etc.)
249
+ * for the given workspace and document name from all relevant tables.
250
+ */
251
+ deleteDocument: async (workspaceId, documentName) => {
252
+ await Promise.all([
253
+ documentsTable.deleteItem({ workspaceId, documentName }),
254
+ intermediateDocumentTable.deleteItem({ workspaceId, documentName }),
255
+ originalDocumentTable.deleteItem({ workspaceId, documentName }),
256
+ overridesTable.deleteItem({ workspaceId, documentName }),
257
+ historyTable.deleteItem({ workspaceId, documentName }),
258
+ authTable.deleteItem({ workspaceId, documentName }),
259
+ ]);
260
+ },
261
+ /**
262
+ * Updates the name of an existing workspace.
263
+ * Returns the updated workspace object, or undefined if the workspace does not exist.
264
+ */
265
+ updateName: async ({ namespace, slug }, name) => {
266
+ const workspace = await workspaceTable.getItem({ namespace, slug });
267
+ if (!workspace) {
268
+ return undefined;
269
+ }
270
+ // Update the workspace name
271
+ return await workspaceTable.addItem({ namespace, slug }, { ...workspace, name });
272
+ },
273
+ /**
274
+ * Checks if a workspace with the given ID exists in the store.
275
+ */
276
+ has: async ({ namespace, slug }) => {
277
+ return (await workspaceTable.getItem({ namespace, slug })) !== undefined;
278
+ },
279
+ },
280
+ clear: async () => {
281
+ await workspaceTable.deleteAll();
282
+ },
283
+ };
281
284
  };
282
- export {
283
- createWorkspaceStorePersistence,
284
- getWorkspaceId
285
- };
286
- //# sourceMappingURL=index.js.map