@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.
- package/CHANGELOG.md +29 -0
- package/README.md +71 -1
- package/dist/client.d.ts +37 -45150
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +124 -14
- package/dist/client.js.map +2 -2
- package/dist/helpers/apply-selective-updates.d.ts +17 -0
- package/dist/helpers/apply-selective-updates.d.ts.map +1 -0
- package/dist/helpers/apply-selective-updates.js +13 -0
- package/dist/helpers/apply-selective-updates.js.map +7 -0
- package/dist/helpers/general.d.ts +33 -0
- package/dist/helpers/general.d.ts.map +1 -1
- package/dist/helpers/general.js +14 -1
- package/dist/helpers/general.js.map +2 -2
- package/dist/helpers/proxy.d.ts +1 -1
- package/dist/helpers/proxy.d.ts.map +1 -1
- package/dist/helpers/proxy.js.map +2 -2
- package/dist/mutators/cookie.d.ts +17 -0
- package/dist/mutators/cookie.d.ts.map +1 -0
- package/dist/mutators/cookie.js +31 -0
- package/dist/mutators/cookie.js.map +7 -0
- package/dist/mutators/environment.d.ts +17 -0
- package/dist/mutators/environment.d.ts.map +1 -0
- package/dist/mutators/environment.js +31 -0
- package/dist/mutators/environment.js.map +7 -0
- package/dist/mutators/helpers.d.ts +34492 -0
- package/dist/mutators/helpers.d.ts.map +1 -0
- package/dist/mutators/helpers.js +11 -0
- package/dist/mutators/helpers.js.map +7 -0
- package/dist/mutators/index.d.ts +108 -0
- package/dist/mutators/index.d.ts.map +1 -0
- package/dist/mutators/index.js +67 -0
- package/dist/mutators/index.js.map +7 -0
- package/dist/mutators/request-example.d.ts +21 -0
- package/dist/mutators/request-example.d.ts.map +1 -0
- package/dist/mutators/request-example.js +58 -0
- package/dist/mutators/request-example.js.map +7 -0
- package/dist/mutators/request.d.ts +22 -0
- package/dist/mutators/request.d.ts.map +1 -0
- package/dist/mutators/request.js +53 -0
- package/dist/mutators/request.js.map +7 -0
- package/dist/mutators/security-schemes.d.ts +14 -0
- package/dist/mutators/security-schemes.d.ts.map +1 -0
- package/dist/mutators/security-schemes.js +27 -0
- package/dist/mutators/security-schemes.js.map +7 -0
- package/dist/mutators/server.d.ts +12 -0
- package/dist/mutators/server.d.ts.map +1 -0
- package/dist/mutators/server.js +24 -0
- package/dist/mutators/server.js.map +7 -0
- package/dist/schemas/compose.d.ts.map +1 -0
- package/dist/schemas/{v3.1/compose.js.map → compose.js.map} +1 -1
- package/dist/schemas/reference-config/index.d.ts +1 -1
- package/dist/schemas/v3.1/strict/callback.js +1 -1
- package/dist/schemas/v3.1/strict/callback.js.map +1 -1
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts +16 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js +13 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js.map +7 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts +27 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js +23 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js.map +7 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts +38 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js +45 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js.map +7 -0
- package/dist/schemas/v3.1/strict/components.d.ts +45 -7948
- package/dist/schemas/v3.1/strict/components.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/components.js +4 -2
- package/dist/schemas/v3.1/strict/components.js.map +2 -2
- package/dist/schemas/v3.1/strict/contact.js +1 -1
- package/dist/schemas/v3.1/strict/contact.js.map +1 -1
- package/dist/schemas/v3.1/strict/discriminator.js +1 -1
- package/dist/schemas/v3.1/strict/discriminator.js.map +1 -1
- package/dist/schemas/v3.1/strict/encoding.js +1 -1
- package/dist/schemas/v3.1/strict/encoding.js.map +1 -1
- package/dist/schemas/v3.1/strict/example.js +1 -1
- package/dist/schemas/v3.1/strict/example.js.map +1 -1
- package/dist/schemas/v3.1/strict/external-documentation.js +1 -1
- package/dist/schemas/v3.1/strict/external-documentation.js.map +1 -1
- package/dist/schemas/v3.1/strict/header.js +1 -1
- package/dist/schemas/v3.1/strict/header.js.map +1 -1
- package/dist/schemas/v3.1/strict/info.js +1 -1
- package/dist/schemas/v3.1/strict/info.js.map +1 -1
- package/dist/schemas/v3.1/strict/license.js +1 -1
- package/dist/schemas/v3.1/strict/license.js.map +1 -1
- package/dist/schemas/v3.1/strict/link.js +1 -1
- package/dist/schemas/v3.1/strict/link.js.map +1 -1
- package/dist/schemas/v3.1/strict/media-type.js +1 -1
- package/dist/schemas/v3.1/strict/media-type.js.map +1 -1
- package/dist/schemas/v3.1/strict/oauth-flow.js +1 -1
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +1 -1
- package/dist/schemas/v3.1/strict/oauthflows.js +1 -1
- package/dist/schemas/v3.1/strict/oauthflows.js.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +16 -0
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +9 -2
- package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
- package/dist/schemas/v3.1/strict/operation.d.ts +18 -0
- package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/operation.js +8 -1
- package/dist/schemas/v3.1/strict/operation.js.map +2 -2
- package/dist/schemas/v3.1/strict/parameter.js +1 -1
- package/dist/schemas/v3.1/strict/parameter.js.map +1 -1
- package/dist/schemas/v3.1/strict/path-item.d.ts +6 -0
- package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/path-item.js +7 -1
- package/dist/schemas/v3.1/strict/path-item.js.map +2 -2
- package/dist/schemas/v3.1/strict/path-operations.d.ts +3975 -228
- package/dist/schemas/v3.1/strict/path-operations.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/paths.d.ts +1864 -1
- package/dist/schemas/v3.1/strict/paths.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/paths.js +1 -1
- package/dist/schemas/v3.1/strict/paths.js.map +1 -1
- package/dist/schemas/v3.1/strict/reference.js +1 -1
- package/dist/schemas/v3.1/strict/reference.js.map +1 -1
- package/dist/schemas/v3.1/strict/request-body.js +1 -1
- package/dist/schemas/v3.1/strict/request-body.js.map +1 -1
- package/dist/schemas/v3.1/strict/response.js +1 -1
- package/dist/schemas/v3.1/strict/response.js.map +1 -1
- package/dist/schemas/v3.1/strict/responses.js +1 -1
- package/dist/schemas/v3.1/strict/responses.js.map +1 -1
- package/dist/schemas/v3.1/strict/schema.js +1 -1
- package/dist/schemas/v3.1/strict/schema.js.map +1 -1
- package/dist/schemas/v3.1/strict/security-requirement.js +1 -1
- package/dist/schemas/v3.1/strict/security-requirement.js.map +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js.map +1 -1
- package/dist/schemas/v3.1/strict/server-variable.js +1 -1
- package/dist/schemas/v3.1/strict/server-variable.js.map +1 -1
- package/dist/schemas/v3.1/strict/server.js +1 -1
- package/dist/schemas/v3.1/strict/server.js.map +1 -1
- package/dist/schemas/v3.1/strict/tag.js +1 -1
- package/dist/schemas/v3.1/strict/tag.js.map +1 -1
- package/dist/schemas/v3.1/strict/xml.js +1 -1
- package/dist/schemas/v3.1/strict/xml.js.map +1 -1
- package/dist/schemas/workspace-specification/config.d.ts +48 -0
- package/dist/schemas/workspace-specification/config.d.ts.map +1 -0
- package/dist/schemas/workspace-specification/config.js +11 -0
- package/dist/schemas/workspace-specification/config.js.map +7 -0
- package/dist/schemas/workspace-specification/index.d.ts +163 -0
- package/dist/schemas/workspace-specification/index.d.ts.map +1 -0
- package/dist/schemas/workspace-specification/index.js +27 -0
- package/dist/schemas/workspace-specification/index.js.map +7 -0
- package/dist/schemas/workspace-specification/info.d.ts +5 -0
- package/dist/schemas/workspace-specification/info.d.ts.map +1 -0
- package/dist/schemas/workspace-specification/info.js +9 -0
- package/dist/schemas/workspace-specification/info.js.map +7 -0
- package/dist/schemas/workspace.d.ts +147 -79
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/dist/schemas/workspace.js +19 -4
- package/dist/schemas/workspace.js.map +2 -2
- package/dist/server.d.ts +780 -108
- package/dist/server.d.ts.map +1 -1
- package/package.json +12 -10
- package/dist/schemas/v3.1/compose.d.ts.map +0 -1
- /package/dist/schemas/{v3.1/compose.d.ts → compose.d.ts} +0 -0
- /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
|
+
```
|