@scalar/workspace-store 0.7.0 → 0.8.0

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 (158) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +71 -1
  3. package/dist/client.d.ts +37 -45150
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +124 -14
  6. package/dist/client.js.map +2 -2
  7. package/dist/helpers/apply-selective-updates.d.ts +17 -0
  8. package/dist/helpers/apply-selective-updates.d.ts.map +1 -0
  9. package/dist/helpers/apply-selective-updates.js +13 -0
  10. package/dist/helpers/apply-selective-updates.js.map +7 -0
  11. package/dist/helpers/general.d.ts +33 -0
  12. package/dist/helpers/general.d.ts.map +1 -1
  13. package/dist/helpers/general.js +14 -1
  14. package/dist/helpers/general.js.map +2 -2
  15. package/dist/helpers/proxy.d.ts +1 -1
  16. package/dist/helpers/proxy.d.ts.map +1 -1
  17. package/dist/helpers/proxy.js.map +2 -2
  18. package/dist/mutators/cookie.d.ts +17 -0
  19. package/dist/mutators/cookie.d.ts.map +1 -0
  20. package/dist/mutators/cookie.js +31 -0
  21. package/dist/mutators/cookie.js.map +7 -0
  22. package/dist/mutators/environment.d.ts +17 -0
  23. package/dist/mutators/environment.d.ts.map +1 -0
  24. package/dist/mutators/environment.js +31 -0
  25. package/dist/mutators/environment.js.map +7 -0
  26. package/dist/mutators/helpers.d.ts +34492 -0
  27. package/dist/mutators/helpers.d.ts.map +1 -0
  28. package/dist/mutators/helpers.js +11 -0
  29. package/dist/mutators/helpers.js.map +7 -0
  30. package/dist/mutators/index.d.ts +108 -0
  31. package/dist/mutators/index.d.ts.map +1 -0
  32. package/dist/mutators/index.js +67 -0
  33. package/dist/mutators/index.js.map +7 -0
  34. package/dist/mutators/request-example.d.ts +21 -0
  35. package/dist/mutators/request-example.d.ts.map +1 -0
  36. package/dist/mutators/request-example.js +58 -0
  37. package/dist/mutators/request-example.js.map +7 -0
  38. package/dist/mutators/request.d.ts +22 -0
  39. package/dist/mutators/request.d.ts.map +1 -0
  40. package/dist/mutators/request.js +53 -0
  41. package/dist/mutators/request.js.map +7 -0
  42. package/dist/mutators/security-schemes.d.ts +14 -0
  43. package/dist/mutators/security-schemes.d.ts.map +1 -0
  44. package/dist/mutators/security-schemes.js +27 -0
  45. package/dist/mutators/security-schemes.js.map +7 -0
  46. package/dist/mutators/server.d.ts +12 -0
  47. package/dist/mutators/server.d.ts.map +1 -0
  48. package/dist/mutators/server.js +24 -0
  49. package/dist/mutators/server.js.map +7 -0
  50. package/dist/schemas/compose.d.ts.map +1 -0
  51. package/dist/schemas/{v3.1/compose.js.map → compose.js.map} +1 -1
  52. package/dist/schemas/reference-config/index.d.ts +1 -1
  53. package/dist/schemas/v3.1/strict/callback.js +1 -1
  54. package/dist/schemas/v3.1/strict/callback.js.map +1 -1
  55. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts +16 -0
  56. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +1 -0
  57. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js +13 -0
  58. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js.map +7 -0
  59. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts +27 -0
  60. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts.map +1 -0
  61. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js +23 -0
  62. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js.map +7 -0
  63. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts +38 -0
  64. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts.map +1 -0
  65. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js +45 -0
  66. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js.map +7 -0
  67. package/dist/schemas/v3.1/strict/components.d.ts +45 -7948
  68. package/dist/schemas/v3.1/strict/components.d.ts.map +1 -1
  69. package/dist/schemas/v3.1/strict/components.js +4 -2
  70. package/dist/schemas/v3.1/strict/components.js.map +2 -2
  71. package/dist/schemas/v3.1/strict/contact.js +1 -1
  72. package/dist/schemas/v3.1/strict/contact.js.map +1 -1
  73. package/dist/schemas/v3.1/strict/discriminator.js +1 -1
  74. package/dist/schemas/v3.1/strict/discriminator.js.map +1 -1
  75. package/dist/schemas/v3.1/strict/encoding.js +1 -1
  76. package/dist/schemas/v3.1/strict/encoding.js.map +1 -1
  77. package/dist/schemas/v3.1/strict/example.js +1 -1
  78. package/dist/schemas/v3.1/strict/example.js.map +1 -1
  79. package/dist/schemas/v3.1/strict/external-documentation.js +1 -1
  80. package/dist/schemas/v3.1/strict/external-documentation.js.map +1 -1
  81. package/dist/schemas/v3.1/strict/header.js +1 -1
  82. package/dist/schemas/v3.1/strict/header.js.map +1 -1
  83. package/dist/schemas/v3.1/strict/info.js +1 -1
  84. package/dist/schemas/v3.1/strict/info.js.map +1 -1
  85. package/dist/schemas/v3.1/strict/license.js +1 -1
  86. package/dist/schemas/v3.1/strict/license.js.map +1 -1
  87. package/dist/schemas/v3.1/strict/link.js +1 -1
  88. package/dist/schemas/v3.1/strict/link.js.map +1 -1
  89. package/dist/schemas/v3.1/strict/media-type.js +1 -1
  90. package/dist/schemas/v3.1/strict/media-type.js.map +1 -1
  91. package/dist/schemas/v3.1/strict/oauth-flow.js +1 -1
  92. package/dist/schemas/v3.1/strict/oauth-flow.js.map +1 -1
  93. package/dist/schemas/v3.1/strict/oauthflows.js +1 -1
  94. package/dist/schemas/v3.1/strict/oauthflows.js.map +1 -1
  95. package/dist/schemas/v3.1/strict/openapi-document.d.ts +16 -0
  96. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  97. package/dist/schemas/v3.1/strict/openapi-document.js +9 -2
  98. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  99. package/dist/schemas/v3.1/strict/operation.d.ts +18 -0
  100. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  101. package/dist/schemas/v3.1/strict/operation.js +8 -1
  102. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  103. package/dist/schemas/v3.1/strict/parameter.js +1 -1
  104. package/dist/schemas/v3.1/strict/parameter.js.map +1 -1
  105. package/dist/schemas/v3.1/strict/path-item.d.ts +6 -0
  106. package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
  107. package/dist/schemas/v3.1/strict/path-item.js +7 -1
  108. package/dist/schemas/v3.1/strict/path-item.js.map +2 -2
  109. package/dist/schemas/v3.1/strict/path-operations.d.ts +3975 -228
  110. package/dist/schemas/v3.1/strict/path-operations.d.ts.map +1 -1
  111. package/dist/schemas/v3.1/strict/paths.d.ts +1864 -1
  112. package/dist/schemas/v3.1/strict/paths.d.ts.map +1 -1
  113. package/dist/schemas/v3.1/strict/paths.js +1 -1
  114. package/dist/schemas/v3.1/strict/paths.js.map +1 -1
  115. package/dist/schemas/v3.1/strict/reference.js +1 -1
  116. package/dist/schemas/v3.1/strict/reference.js.map +1 -1
  117. package/dist/schemas/v3.1/strict/request-body.js +1 -1
  118. package/dist/schemas/v3.1/strict/request-body.js.map +1 -1
  119. package/dist/schemas/v3.1/strict/response.js +1 -1
  120. package/dist/schemas/v3.1/strict/response.js.map +1 -1
  121. package/dist/schemas/v3.1/strict/responses.js +1 -1
  122. package/dist/schemas/v3.1/strict/responses.js.map +1 -1
  123. package/dist/schemas/v3.1/strict/schema.js +1 -1
  124. package/dist/schemas/v3.1/strict/schema.js.map +1 -1
  125. package/dist/schemas/v3.1/strict/security-requirement.js +1 -1
  126. package/dist/schemas/v3.1/strict/security-requirement.js.map +1 -1
  127. package/dist/schemas/v3.1/strict/security-scheme.js +1 -1
  128. package/dist/schemas/v3.1/strict/security-scheme.js.map +1 -1
  129. package/dist/schemas/v3.1/strict/server-variable.js +1 -1
  130. package/dist/schemas/v3.1/strict/server-variable.js.map +1 -1
  131. package/dist/schemas/v3.1/strict/server.js +1 -1
  132. package/dist/schemas/v3.1/strict/server.js.map +1 -1
  133. package/dist/schemas/v3.1/strict/tag.js +1 -1
  134. package/dist/schemas/v3.1/strict/tag.js.map +1 -1
  135. package/dist/schemas/v3.1/strict/xml.js +1 -1
  136. package/dist/schemas/v3.1/strict/xml.js.map +1 -1
  137. package/dist/schemas/workspace-specification/config.d.ts +48 -0
  138. package/dist/schemas/workspace-specification/config.d.ts.map +1 -0
  139. package/dist/schemas/workspace-specification/config.js +11 -0
  140. package/dist/schemas/workspace-specification/config.js.map +7 -0
  141. package/dist/schemas/workspace-specification/index.d.ts +163 -0
  142. package/dist/schemas/workspace-specification/index.d.ts.map +1 -0
  143. package/dist/schemas/workspace-specification/index.js +27 -0
  144. package/dist/schemas/workspace-specification/index.js.map +7 -0
  145. package/dist/schemas/workspace-specification/info.d.ts +5 -0
  146. package/dist/schemas/workspace-specification/info.d.ts.map +1 -0
  147. package/dist/schemas/workspace-specification/info.js +9 -0
  148. package/dist/schemas/workspace-specification/info.js.map +7 -0
  149. package/dist/schemas/workspace.d.ts +147 -79
  150. package/dist/schemas/workspace.d.ts.map +1 -1
  151. package/dist/schemas/workspace.js +19 -4
  152. package/dist/schemas/workspace.js.map +2 -2
  153. package/dist/server.d.ts +780 -108
  154. package/dist/server.d.ts.map +1 -1
  155. package/package.json +12 -10
  156. package/dist/schemas/v3.1/compose.d.ts.map +0 -1
  157. /package/dist/schemas/{v3.1/compose.d.ts → compose.d.ts} +0 -0
  158. /package/dist/schemas/{v3.1/compose.js → compose.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @scalar/workspace-store
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d56f354: feat(workspace-store): differentiate the local saved document with the last known remote version of the document
8
+ - b6ac5b9: feat(workspace-store): create workspace mutators
9
+ - dbc09b9: feat(workspace-store): create extensions schemas for the api-client
10
+ - 20939a8: feat(workspace-store): add support for managing original document state with download and save APIs
11
+ - 909cf33: feat(workspace-store): add workspace specification schema
12
+
13
+ ### Patch Changes
14
+
15
+ - f8ef4ab: fix: add a few missing http methods and type annotations
16
+ - Updated dependencies [ad2e3e6]
17
+ - @scalar/types@0.2.7
18
+ - @scalar/openapi-parser@0.18.1
19
+ - @scalar/code-highlight@0.1.5
20
+
21
+ ## 0.7.1
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [2d7f995]
26
+ - @scalar/code-highlight@0.1.5
27
+ - @scalar/openapi-parser@0.18.1
28
+ - @scalar/openapi-types@0.3.5
29
+ - @scalar/helpers@0.0.6
30
+ - @scalar/types@0.2.6
31
+
3
32
  ## 0.7.0
4
33
 
5
34
  ### Minor Changes
package/README.md CHANGED
@@ -283,4 +283,74 @@ To get the active document configuration you can use config getter\
283
283
  console.log(store.config['x-scalar-reference-config'].features.showModels)
284
284
  ```
285
285
 
286
- When no configuration is provided it will return the default configuration
286
+ When no configuration is provided it will return the default configuration
287
+
288
+ #### Document Persistence and Export
289
+
290
+ The workspace store provides several methods for managing document persistence and exporting:
291
+
292
+ ##### Export Document
293
+
294
+ Export the specified document in JSON or YAML format:
295
+
296
+ ```ts
297
+ // Export the specified document as JSON
298
+ const jsonString = store.exportDocument('documentName', 'json')
299
+
300
+ // Export the specified document as YAML
301
+ const yamlString = store.exportDocument('documentName', 'yaml')
302
+ ```
303
+
304
+ The download method returns the original, unmodified document (before any reactive wrapping) to preserve the initial structure without external references or modifications.
305
+
306
+ ##### Save Document Changes
307
+
308
+ Persist the current state of the specified document back to the intermediate document (local saved version of the document):
309
+
310
+ ```ts
311
+ // Save the specified document state
312
+ const excludedDiffs = store.saveDocument('documentName')
313
+
314
+ // Check if any changes were excluded from being applied
315
+ if (excludedDiffs) {
316
+ console.log('Some changes were excluded:', excludedDiffs)
317
+ }
318
+ ```
319
+
320
+ The `saveDocument` method takes the current reactive document state and persists it. It returns an array of diffs that were excluded from being applied or undefined if no specified document is available.
321
+
322
+ ##### Revert Document Changes
323
+
324
+ Revert the specified document to its most recent local saved state, discarding all unsaved changes:
325
+
326
+ ```ts
327
+ // Revert the specified document to its original state
328
+ store.revertDocumentChanges('documentName')
329
+ ```
330
+
331
+ The `revertDocumentChanges` method restores the specified document to its initial state by copying the original document (before any modifications) back to the specified document.
332
+
333
+ **Warning:** This operation will discard all unsaved changes to the specified document.
334
+
335
+ ##### Complete Example
336
+
337
+ ```ts
338
+ const store = createWorkspaceStore({
339
+ documents: [
340
+ {
341
+ name: 'api',
342
+ document: {
343
+ openapi: '3.0.0',
344
+ info: { title: 'My API', version: '1.0.0' },
345
+ paths: {},
346
+ },
347
+ },
348
+ ],
349
+ })
350
+
351
+ // Make some changes to the document
352
+ store.workspace.documents['api'].info.title = 'Updated API Title'
353
+
354
+ // This will restore the original title since we did not commit the changes yet
355
+ store.revertDocumentChanges()
356
+ ```