@scalar/workspace-store 0.21.0 → 0.22.1
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 +39 -0
- package/dist/client.d.ts +14 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -6
- package/dist/client.js.map +2 -2
- package/dist/events/bus.d.ts +1 -1
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/events/bus.js.map +1 -1
- package/dist/events/definitions/auth.d.ts +2 -1
- package/dist/events/definitions/auth.d.ts.map +1 -1
- package/dist/events/definitions/document.d.ts +11 -0
- package/dist/events/definitions/document.d.ts.map +1 -1
- package/dist/events/definitions/index.d.ts +3 -1
- package/dist/events/definitions/index.d.ts.map +1 -1
- package/dist/events/definitions/operation.d.ts +20 -1
- package/dist/events/definitions/operation.d.ts.map +1 -1
- package/dist/events/definitions/tabs.d.ts +16 -1
- package/dist/events/definitions/tabs.d.ts.map +1 -1
- package/dist/events/definitions/tag.d.ts +15 -0
- package/dist/events/definitions/tag.d.ts.map +1 -0
- package/dist/events/definitions/tag.js +1 -0
- package/dist/events/definitions/tag.js.map +7 -0
- package/dist/events/definitions/ui.d.ts +118 -61
- package/dist/events/definitions/ui.d.ts.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js.map +2 -2
- package/dist/mutators/auth.d.ts +6 -1
- package/dist/mutators/auth.d.ts.map +1 -1
- package/dist/mutators/document.d.ts +3 -0
- package/dist/mutators/document.d.ts.map +1 -1
- package/dist/mutators/document.js +24 -0
- package/dist/mutators/document.js.map +2 -2
- package/dist/mutators/index.d.ts +28 -8
- package/dist/mutators/index.d.ts.map +1 -1
- package/dist/mutators/index.js +24 -1
- package/dist/mutators/index.js.map +2 -2
- package/dist/mutators/operation.d.ts +27 -8
- package/dist/mutators/operation.d.ts.map +1 -1
- package/dist/mutators/operation.js +75 -7
- package/dist/mutators/operation.js.map +2 -2
- package/dist/mutators/request.d.ts +2 -1
- package/dist/mutators/request.d.ts.map +1 -1
- package/dist/mutators/request.js.map +1 -1
- package/dist/mutators/server.d.ts.map +1 -1
- package/dist/mutators/server.js +1 -1
- package/dist/mutators/server.js.map +2 -2
- package/dist/mutators/tabs.d.ts +44 -0
- package/dist/mutators/tabs.d.ts.map +1 -0
- package/dist/mutators/tabs.js +133 -0
- package/dist/mutators/tabs.js.map +7 -0
- package/dist/mutators/tag.d.ts +12 -0
- package/dist/mutators/tag.d.ts.map +1 -0
- package/dist/mutators/tag.js +19 -0
- package/dist/mutators/tag.js.map +7 -0
- package/dist/navigation/get-navigation-options.js +4 -4
- package/dist/navigation/get-navigation-options.js.map +2 -2
- package/dist/navigation/helpers/get-openapi-object.d.ts +35 -0
- package/dist/navigation/helpers/get-openapi-object.d.ts.map +1 -0
- package/dist/navigation/helpers/get-openapi-object.js +31 -0
- package/dist/navigation/helpers/get-openapi-object.js.map +7 -0
- package/dist/navigation/helpers/get-operation-entries.d.ts +24 -0
- package/dist/navigation/helpers/get-operation-entries.d.ts.map +1 -0
- package/dist/navigation/helpers/get-operation-entries.js +33 -0
- package/dist/navigation/helpers/get-operation-entries.js.map +7 -0
- package/dist/navigation/helpers/get-parent-entry.d.ts +15 -0
- package/dist/navigation/helpers/get-parent-entry.d.ts.map +1 -0
- package/dist/navigation/helpers/get-parent-entry.js +13 -0
- package/dist/navigation/helpers/get-parent-entry.js.map +7 -0
- package/dist/navigation/helpers/traverse-description.d.ts +0 -1
- package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-description.js +0 -1
- package/dist/navigation/helpers/traverse-description.js.map +2 -2
- package/dist/navigation/helpers/traverse-document.js +1 -1
- package/dist/navigation/helpers/traverse-document.js.map +2 -2
- package/dist/navigation/helpers/traverse-paths.js +1 -1
- package/dist/navigation/helpers/traverse-paths.js.map +1 -1
- package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-tags.js +2 -2
- package/dist/navigation/helpers/traverse-tags.js.map +2 -2
- package/dist/navigation/helpers/utils.d.ts +2 -1
- package/dist/navigation/helpers/utils.d.ts.map +1 -1
- package/dist/navigation/helpers/utils.js.map +1 -1
- package/dist/navigation/index.d.ts +2 -1
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +5 -3
- package/dist/navigation/index.js.map +2 -2
- package/dist/schemas/extensions/operation/index.d.ts +4 -1
- package/dist/schemas/extensions/operation/index.d.ts.map +1 -1
- package/dist/schemas/extensions/operation/index.js +22 -0
- package/dist/schemas/extensions/operation/index.js.map +3 -3
- package/dist/schemas/extensions/operation/x-code-samples.d.ts +0 -5
- package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -1
- package/dist/schemas/extensions/operation/x-code-samples.js +0 -1
- package/dist/schemas/extensions/operation/x-code-samples.js.map +2 -2
- package/dist/schemas/extensions/operation/x-post-response.d.ts +0 -18
- package/dist/schemas/extensions/operation/x-post-response.d.ts.map +1 -1
- package/dist/schemas/extensions/operation/x-post-response.js.map +1 -1
- package/dist/schemas/extensions/tag/x-tag-groups.d.ts +2 -13
- package/dist/schemas/extensions/tag/x-tag-groups.d.ts.map +1 -1
- package/dist/schemas/extensions/tag/x-tag-groups.js +0 -1
- package/dist/schemas/extensions/tag/x-tag-groups.js.map +2 -2
- package/dist/schemas/extensions/workspace/index.d.ts +4 -0
- package/dist/schemas/extensions/workspace/index.d.ts.map +1 -0
- package/dist/schemas/extensions/workspace/index.js +15 -0
- package/dist/schemas/extensions/workspace/index.js.map +7 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.d.ts +36 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.d.ts.map +1 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js +16 -0
- package/dist/schemas/extensions/workspace/x-scalar-tabs.js.map +7 -0
- package/dist/schemas/inmemory-workspace.d.ts +5 -6
- package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
- package/dist/schemas/navigation.d.ts +8 -0
- package/dist/schemas/navigation.d.ts.map +1 -1
- package/dist/schemas/navigation.js.map +1 -1
- package/dist/schemas/reference-config/index.d.ts +2 -3
- package/dist/schemas/reference-config/index.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.d.ts +2 -3
- package/dist/schemas/reference-config/settings.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/header.d.ts +0 -45
- package/dist/schemas/v3.1/strict/header.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/header.js +1 -3
- package/dist/schemas/v3.1/strict/header.js.map +2 -2
- package/dist/schemas/v3.1/strict/oauth-flow.d.ts +0 -99
- package/dist/schemas/v3.1/strict/oauth-flow.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/oauth-flow.js +0 -7
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +2 -2
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +71 -104
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +0 -1
- package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
- package/dist/schemas/v3.1/strict/parameter.d.ts +1 -101
- package/dist/schemas/v3.1/strict/parameter.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/parameter.js +1 -4
- package/dist/schemas/v3.1/strict/parameter.js.map +2 -2
- package/dist/schemas/v3.1/strict/ref-definitions.d.ts +0 -1
- package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/ref-definitions.js +0 -2
- package/dist/schemas/v3.1/strict/ref-definitions.js.map +2 -2
- package/dist/schemas/v3.1/strict/schema.d.ts +28 -11
- package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/schema.js +2 -2
- package/dist/schemas/v3.1/strict/schema.js.map +2 -2
- package/dist/schemas/v3.1/strict/security-scheme.d.ts +1 -54
- package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js +0 -5
- package/dist/schemas/v3.1/strict/security-scheme.js.map +2 -2
- package/dist/schemas/workspace-specification/config.d.ts +2 -3
- package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
- package/dist/schemas/workspace-specification/index.d.ts +2 -3
- package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
- package/dist/schemas/workspace.d.ts +35 -22
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/dist/schemas/workspace.js +11 -6
- package/dist/schemas/workspace.js.map +2 -2
- package/package.json +50 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @scalar/workspace-store
|
|
2
2
|
|
|
3
|
+
## 0.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7476](https://github.com/scalar/scalar/pull/7476) [`8842799`](https://github.com/scalar/scalar/commit/884279984b144082e85b699014e77ed71e9ae6a5) Thanks [@amritk](https://github.com/amritk)! - fix: remove slugging from path in operation id generation
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9ec8adf`](https://github.com/scalar/scalar/commit/9ec8adfea017333dee5bc3949104232f7dc57f4a)]:
|
|
10
|
+
- @scalar/helpers@0.2.0
|
|
11
|
+
- @scalar/json-magic@0.8.4
|
|
12
|
+
- @scalar/object-utils@1.2.14
|
|
13
|
+
|
|
14
|
+
## 0.22.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [#7431](https://github.com/scalar/scalar/pull/7431) [`61c980c`](https://github.com/scalar/scalar/commit/61c980cebef219685a05f3a4cb1e379984922cd4) Thanks [@DemonHa](https://github.com/DemonHa)! - feat: implememnt command palette
|
|
19
|
+
|
|
20
|
+
- [#7455](https://github.com/scalar/scalar/pull/7455) [`1bc2b45`](https://github.com/scalar/scalar/commit/1bc2b45b6eabd5c5045e77d67f59d202ab04d3fb) Thanks [@DemonHa](https://github.com/DemonHa)! - feat: tabs support on the store
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#7465](https://github.com/scalar/scalar/pull/7465) [`9342adc`](https://github.com/scalar/scalar/commit/9342adcd76e26a8e5eff75c1a2abee2c207b1487) Thanks [@marcalexiei](https://github.com/marcalexiei)! - fix: ensure `@scalar/workspace-store` consumers rely only on public exports
|
|
25
|
+
|
|
26
|
+
- [#7387](https://github.com/scalar/scalar/pull/7387) [`bfd814a`](https://github.com/scalar/scalar/commit/bfd814a4219660face190041cc4845182b56ab03) Thanks [@geoffgscott](https://github.com/geoffgscott)! - hotfix: patch exports from build tooling bug
|
|
27
|
+
|
|
28
|
+
- [#7416](https://github.com/scalar/scalar/pull/7416) [`86f028d`](https://github.com/scalar/scalar/commit/86f028deb0b456f923edd261f5f4b0fa9b616b7d) Thanks [@amritk](https://github.com/amritk)! - feat: add update method to client v2
|
|
29
|
+
|
|
30
|
+
- [#7414](https://github.com/scalar/scalar/pull/7414) [`294f9fc`](https://github.com/scalar/scalar/commit/294f9fc6cfd43cdab110deb1c851883509bc2b84) Thanks [@hanspagel](https://github.com/hanspagel)! - feat: show tags without operations
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`781f264`](https://github.com/scalar/scalar/commit/781f2648bc758a251435c3a1e2b126a37f20e44f), [`fa361d2`](https://github.com/scalar/scalar/commit/fa361d2799e358d582fbb224a7b93d5b6e832c0e), [`e04879c`](https://github.com/scalar/scalar/commit/e04879c65602dfb65393876754f5344751b8953d), [`dd8e9dc`](https://github.com/scalar/scalar/commit/dd8e9dc118d3ae98180e2a93bd6ba11e982abbf8), [`bfd814a`](https://github.com/scalar/scalar/commit/bfd814a4219660face190041cc4845182b56ab03), [`781f264`](https://github.com/scalar/scalar/commit/781f2648bc758a251435c3a1e2b126a37f20e44f), [`35af6bf`](https://github.com/scalar/scalar/commit/35af6bfce4bc4ae3d0fc5783ea36e0165e964361), [`86f028d`](https://github.com/scalar/scalar/commit/86f028deb0b456f923edd261f5f4b0fa9b616b7d), [`af54a80`](https://github.com/scalar/scalar/commit/af54a80349269a4269a68f6a372f837177a3537c)]:
|
|
33
|
+
- @scalar/code-highlight@0.2.1
|
|
34
|
+
- @scalar/snippetz@0.5.4
|
|
35
|
+
- @scalar/json-magic@0.8.3
|
|
36
|
+
- @scalar/helpers@0.1.3
|
|
37
|
+
- @scalar/types@0.5.1
|
|
38
|
+
- @scalar/themes@0.13.25
|
|
39
|
+
- @scalar/object-utils@1.2.13
|
|
40
|
+
- @scalar/openapi-upgrader@0.1.5
|
|
41
|
+
|
|
3
42
|
## 0.21.0
|
|
4
43
|
|
|
5
44
|
### Minor Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ export type WorkspaceStore = {
|
|
|
136
136
|
* }
|
|
137
137
|
* })
|
|
138
138
|
*/
|
|
139
|
-
addDocument(input: WorkspaceDocumentInput): Promise<
|
|
139
|
+
addDocument(input: WorkspaceDocumentInput): Promise<boolean>;
|
|
140
140
|
/**
|
|
141
141
|
* Deletes a document from the workspace and all associated data.
|
|
142
142
|
*
|
|
@@ -178,6 +178,18 @@ export type WorkspaceStore = {
|
|
|
178
178
|
* falling back to the first document if none is specified.
|
|
179
179
|
*/
|
|
180
180
|
readonly config: typeof defaultConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Returns the merged configuration for a specific document.
|
|
183
|
+
*
|
|
184
|
+
* This method merges configurations in the following order of precedence:
|
|
185
|
+
* 1. Document-specific configuration (highest priority)
|
|
186
|
+
* 2. Workspace-level configuration
|
|
187
|
+
* 3. Default configuration (lowest priority)
|
|
188
|
+
*
|
|
189
|
+
* @param documentName - The name of the document to get the configuration for
|
|
190
|
+
* @returns The merged configuration for the specified document
|
|
191
|
+
*/
|
|
192
|
+
getDocumentConfiguration(documentName: string): typeof defaultConfig;
|
|
181
193
|
/**
|
|
182
194
|
* Exports the specified document in the requested format.
|
|
183
195
|
*
|
|
@@ -319,7 +331,7 @@ export type WorkspaceStore = {
|
|
|
319
331
|
*
|
|
320
332
|
* @param specification - The workspace specification to import.
|
|
321
333
|
*/
|
|
322
|
-
importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<
|
|
334
|
+
importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<boolean[]>;
|
|
323
335
|
/**
|
|
324
336
|
* Rebases a document in the workspace by refetching its origin and merging with local edits.
|
|
325
337
|
*
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAe,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAK7E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAgB1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAGrE,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAC7F,OAAO,KAAK,EAAE,eAAe,EAA6B,MAAM,oBAAoB,CAAA;AASpF,QAAA,MAAM,aAAa,EAAE,YAAY,CAAC,MAAM,CAEvC,CAAA;AAED;;;GAGG;AACH,KAAK,0BAA0B,GAAG;IAChC,wEAAwE;IACxE,IAAI,CAAC,EAAE,qBAAqB,CAAA;IAC5B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,MAAM,CA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scalar/helpers/string/generate-hash";
|
|
2
3
|
import { measureAsync, measureSync } from "@scalar/helpers/testing/measure";
|
|
3
4
|
import { bundle } from "@scalar/json-magic/bundle";
|
|
@@ -324,7 +325,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
324
325
|
"loadDocument",
|
|
325
326
|
async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch })
|
|
326
327
|
);
|
|
327
|
-
await measureAsync("addDocument", async () => {
|
|
328
|
+
return await measureAsync("addDocument", async () => {
|
|
328
329
|
if (!resolve.ok) {
|
|
329
330
|
console.error(`Failed to fetch document '${name}': request was not successful`);
|
|
330
331
|
workspace.documents[name] = {
|
|
@@ -336,7 +337,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
336
337
|
},
|
|
337
338
|
"x-scalar-original-document-hash": "not-a-hash"
|
|
338
339
|
};
|
|
339
|
-
return;
|
|
340
|
+
return false;
|
|
340
341
|
}
|
|
341
342
|
if (!isObject(resolve.data)) {
|
|
342
343
|
console.error(`Failed to load document '${name}': response data is not a valid object`);
|
|
@@ -349,7 +350,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
349
350
|
},
|
|
350
351
|
"x-scalar-original-document-hash": "not-a-hash"
|
|
351
352
|
};
|
|
352
|
-
return;
|
|
353
|
+
return false;
|
|
353
354
|
}
|
|
354
355
|
await addInMemoryDocument({
|
|
355
356
|
...input,
|
|
@@ -357,6 +358,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
357
358
|
documentSource: getDocumentSource(input),
|
|
358
359
|
documentHash: generateHash(resolve.raw)
|
|
359
360
|
});
|
|
361
|
+
return true;
|
|
360
362
|
});
|
|
361
363
|
}
|
|
362
364
|
const buildSidebar = (documentName) => {
|
|
@@ -381,9 +383,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
381
383
|
return workspace;
|
|
382
384
|
},
|
|
383
385
|
update(key, value) {
|
|
384
|
-
|
|
385
|
-
throw new Error("Invalid key: cannot modify prototype");
|
|
386
|
-
}
|
|
386
|
+
preventPollution(key);
|
|
387
387
|
Object.assign(workspace, { [key]: value });
|
|
388
388
|
},
|
|
389
389
|
updateDocument(name, key, value) {
|
|
@@ -391,6 +391,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
391
391
|
if (!currentDocument) {
|
|
392
392
|
throw "Please select a valid document";
|
|
393
393
|
}
|
|
394
|
+
preventPollution(key);
|
|
394
395
|
Object.assign(currentDocument, { [key]: value });
|
|
395
396
|
},
|
|
396
397
|
async replaceDocument(documentName, input) {
|
|
@@ -458,6 +459,7 @@ const createWorkspaceStore = (workspaceProps) => {
|
|
|
458
459
|
get config() {
|
|
459
460
|
return getDocumentConfiguration(getActiveDocumentName());
|
|
460
461
|
},
|
|
462
|
+
getDocumentConfiguration,
|
|
461
463
|
exportDocument,
|
|
462
464
|
exportActiveDocument: (format, minify) => exportDocument(getActiveDocumentName(), format, minify),
|
|
463
465
|
buildSidebar,
|
package/dist/client.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/client.ts"],
|
|
4
|
-
"sourcesContent": ["import { generateHash } from '@scalar/helpers/string/generate-hash'\nimport { measureAsync, measureSync } from '@scalar/helpers/testing/measure'\nimport { type LoaderPlugin, bundle } from '@scalar/json-magic/bundle'\nimport { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser'\nimport { type Difference, apply, diff, merge } from '@scalar/json-magic/diff'\nimport { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy'\nimport { upgrade } from '@scalar/openapi-upgrader'\nimport type { Record } from '@scalar/typebox'\nimport { Value } from '@scalar/typebox/value'\nimport type { PartialDeep, RequiredDeep } from 'type-fest'\nimport { reactive, toRaw } from 'vue'\nimport YAML from 'yaml'\n\nimport { applySelectiveUpdates } from '@/helpers/apply-selective-updates'\nimport { deepClone } from '@/helpers/deep-clone'\nimport { createDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { type UnknownObject, isObject, safeAssign } from '@/helpers/general'\nimport { getValueByPath } from '@/helpers/json-path-utils'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { createOverridesProxy, unpackOverridesProxy } from '@/helpers/overrides-proxy'\nimport { unpackProxyObject } from '@/helpers/unpack-proxy'\nimport { createNavigation } from '@/navigation'\nimport { externalValueResolver, loadingStatus, refsEverywhere, restoreOriginalRefs } from '@/plugins/bundler'\nimport { getServersFromDocument } from '@/preprocessing/server'\nimport { extensions } from '@/schemas/extensions'\nimport type { InMemoryWorkspace } from '@/schemas/inmemory-workspace'\nimport { defaultReferenceConfig } from '@/schemas/reference-config'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport {\n OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict,\n type OpenApiDocument,\n} from '@/schemas/v3.1/strict/openapi-document'\nimport type { Workspace, WorkspaceDocumentMeta, WorkspaceExtensions, WorkspaceMeta } from '@/schemas/workspace'\nimport type { WorkspaceSpecification } from '@/schemas/workspace-specification'\nimport type { Config, DocumentConfiguration } from '@/schemas/workspace-specification/config'\nimport type { WorkspacePlugin, WorkspaceStateChangeEvent } from '@/workspace-plugin'\n\ntype ExtraDocumentConfigurations = Record<\n string,\n {\n fetch: WorkspaceDocumentMetaInput['fetch']\n }\n>\n\nconst defaultConfig: RequiredDeep<Config> = {\n 'x-scalar-reference-config': defaultReferenceConfig,\n}\n\n/**\n * Input type for workspace document metadata and configuration.\n * This type defines the required and optional fields for initializing a document in the workspace.\n */\ntype WorkspaceDocumentMetaInput = {\n /** Optional metadata about the document like title, description, etc */\n meta?: WorkspaceDocumentMeta\n /** Required unique identifier for the document */\n name: string\n /** Optional configuration options */\n config?: DocumentConfiguration\n /** Overrides for the document */\n overrides?: PartialDeep<OpenApiDocument>\n /** Optional custom fetch implementation to use when retrieving the document. By default the global fetch implementation will be used */\n fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>\n}\n\n/**\n * Represents a document that is loaded from a URL.\n * This type extends WorkspaceDocumentMetaInput to include URL-specific properties.\n */\nexport type UrlDoc = {\n /** URL to fetch the OpenAPI document from */\n url: string\n} & WorkspaceDocumentMetaInput\n\n/** Represents a document that is provided directly as an object rather than loaded from a URL */\nexport type ObjectDoc = {\n /** The OpenAPI document object containing the API specification */\n document: Record<string, unknown>\n} & WorkspaceDocumentMetaInput\n\n/**\n * Union type representing the possible input formats for a workspace document:\n * - UrlDoc: Document loaded from a URL with optional fetch configuration\n * - ObjectDoc: Direct document object with metadata\n */\nexport type WorkspaceDocumentInput = UrlDoc | ObjectDoc\n\n/**\n * Resolves a workspace document from various input sources (URL, local file, or direct document object).\n *\n * @param workspaceDocument - The document input to resolve, which can be:\n * - A URL to fetch the document from\n * - A direct document object\n * @returns A promise that resolves to an object containing:\n * - ok: boolean indicating if the resolution was successful\n * - data: The resolved document data\n *\n * @example\n * // Resolve from URL\n * const urlDoc = await loadDocument({ name: 'api', url: 'https://api.example.com/openapi.json' })\n *\n * // Resolve direct document\n * const directDoc = await loadDocument({\n * name: 'inline',\n * document: { openapi: '3.0.0', paths: {} }\n * })\n */\nfunction loadDocument(workspaceDocument: WorkspaceDocumentInput): ReturnType<LoaderPlugin['exec']> {\n if ('url' in workspaceDocument) {\n return fetchUrls({ fetch: workspaceDocument.fetch }).exec(workspaceDocument.url)\n }\n\n return Promise.resolve({\n ok: true,\n data: workspaceDocument.document,\n // string version of the raw document for hashing purposes\n raw: JSON.stringify(workspaceDocument.document),\n })\n}\n\n/**\n * Returns the origin (URL) of a workspace document if it was loaded from a URL.\n * If the document was provided directly as an object, returns undefined.\n *\n * @param input - The workspace document input (either UrlDoc or ObjectDoc)\n * @returns The URL string if present, otherwise undefined\n */\nconst getDocumentSource = (input: WorkspaceDocumentInput) => {\n if ('url' in input) {\n return input.url\n }\n return undefined\n}\n\n/**\n * Configuration object for initializing a workspace store.\n * Defines the initial state and documents for the workspace.\n */\ntype WorkspaceProps = {\n /** Optional metadata for the workspace including theme, active document, etc */\n meta?: WorkspaceMeta\n /** Workspace configuration */\n config?: PartialDeep<Config>\n /** Fetch function for retrieving documents */\n fetch?: WorkspaceDocumentInput['fetch']\n /** A list of all registered plugins for the current workspace */\n plugins?: WorkspacePlugin[]\n}\n\n/**\n * Type definition for the workspace store return object.\n * This explicit type is needed to avoid TypeScript inference limits.\n *\n * @see https://github.com/microsoft/TypeScript/issues/43817#issuecomment-827746462\n */\nexport type WorkspaceStore = {\n /**\n * Returns the reactive workspace object with an additional activeDocument getter\n */\n readonly workspace: Workspace\n /**\n * Updates a specific metadata field in the workspace\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @example\n * // Update the workspace title\n * update('x-scalar-active-document', 'document-name')\n */\n update<K extends keyof WorkspaceMeta | keyof WorkspaceExtensions>(\n key: K,\n value: (WorkspaceMeta & WorkspaceExtensions)[K],\n ): void\n /**\n * Updates a specific metadata field in a document\n * @param name - The name of the document to update ('active' or a specific document name)\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @throws Error if the specified document doesn't exist\n * @example\n * // Update the auth of the active document\n * updateDocument('active', 'x-scalar-active-auth', 'Bearer')\n * // Update the auth of a specific document\n * updateDocument('document-name', 'x-scalar-active-auth', 'Bearer')\n */\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ): void\n /**\n * Replaces the content of a specific document in the workspace with the provided input.\n * This method computes the difference between the current document and the new input,\n * then applies only the necessary changes in place. The updates are applied atomically,\n * ensuring the document is updated in a single operation.\n *\n * @param documentName - The name of the document to update.\n * @param input - The new content to apply to the document (as a plain object).\n * @example\n * // Replace the content of the 'api' document with new data\n * store.replaceDocument('api', {\n * openapi: '3.1.0',\n * info: { title: 'Updated API', version: '1.0.1' },\n * paths: {},\n * })\n */\n replaceDocument(documentName: string, input: Record<string, unknown>): Promise<void>\n /**\n * Resolves a reference in the active document by following the provided path and resolving any external $ref references.\n * This method traverses the document structure following the given path and resolves any $ref references it encounters.\n * During resolution, it sets a loading status and updates the reference with the resolved content.\n *\n * @param path - Array of strings representing the path to the reference (e.g. ['paths', '/users', 'get', 'responses', '200'])\n * @throws Error if the path is invalid or empty\n * @example\n * // Resolve a reference in the active document\n * resolve(['paths', '/users', 'get', 'responses', '200'])\n */\n resolve(path: string[]): Promise<unknown>\n /**\n * Adds a new document to the workspace\n * @param document - The document content to add. This should be a valid OpenAPI/Swagger document or other supported format\n * @param meta - Metadata for the document, including its name and other properties defined in WorkspaceDocumentMeta\n * @example\n * // Add a new OpenAPI document to the workspace\n * store.addDocument({\n * name: 'name',\n * document: {\n * openapi: '3.0.0',\n * info: { title: 'title' },\n * },\n * meta: {\n * 'x-scalar-active-auth': 'Bearer',\n * 'x-scalar-active-server': 'production'\n * }\n * })\n */\n addDocument(input: WorkspaceDocumentInput): Promise<void>\n /**\n * Deletes a document from the workspace and all associated data.\n *\n * This method removes the document from the workspace along with all related data including:\n * - The document itself from the workspace documents map\n * - Original document data\n * - Intermediate document data (saved local versions)\n * - Document-specific configuration\n * - Document overrides\n * - Extra document configurations\n *\n * If the deleted document was the active document, the active document is automatically\n * reset to the first remaining document in the workspace, or undefined if no documents remain.\n *\n * The deletion is automatically tracked by the workspace change detection system,\n * and appropriate events will be fired to notify registered plugins.\n *\n * @param documentName - The name of the document to delete\n * @returns void\n *\n * @example\n * // Delete the document named 'api'\n * store.deleteDocument('api')\n *\n * @example\n * // Delete multiple documents\n * ['api', 'petstore'].forEach(name => store.deleteDocument(name))\n */\n deleteDocument(documentName: string): void\n /**\n * Returns the merged configuration for the active document.\n *\n * This getter merges configurations in the following order of precedence:\n * 1. Document-specific configuration (highest priority)\n * 2. Workspace-level configuration\n * 3. Default configuration (lowest priority)\n *\n * The active document is determined by the workspace's activeDocument extension,\n * falling back to the first document if none is specified.\n */\n readonly config: typeof defaultConfig\n /**\n * Exports the specified document in the requested format.\n *\n * This method serializes the most recently saved local version of the document (from the intermediateDocuments map)\n * to either JSON or YAML. The exported document reflects the last locally saved state, including any edits\n * that have been saved but not yet synced to a remote registry. Runtime/in-memory changes that have not been saved\n * will not be included.\n *\n * @param documentName - The name of the document to export.\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The document as a string in the requested format, or undefined if the document does not exist.\n *\n * @example\n * // Export a document as JSON\n * const jsonString = store.exportDocument('api', 'json')\n *\n * // Export a document as YAML\n * const yamlString = store.exportDocument('api', 'yaml')\n */\n exportDocument(documentName: string, format: 'json' | 'yaml', minify?: boolean): string | undefined\n /**\n * Exports the currently active document in the requested format.\n *\n * This is a convenience method that exports the active document (determined by the workspace's\n * activeDocument extension) without requiring the caller to specify the document name.\n * The exported document reflects the last locally saved state, including any edits that have\n * been saved but not yet synced to a remote registry.\n *\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The active document as a string in the requested format, or undefined if no active document exists.\n *\n * @example\n * // Export the active document as JSON\n * const jsonString = store.exportActiveDocument('json')\n *\n * // Export the active document as YAML\n * const yamlString = store.exportActiveDocument('yaml')\n */\n exportActiveDocument(format: 'json' | 'yaml', minify?: boolean): string | undefined\n /**\n * Saves the current state of the specified document to the intermediate documents map.\n *\n * This function captures the latest (reactive) state of the document from the workspace and\n * applies its changes to the corresponding entry in the `intermediateDocuments` map.\n * The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n * which may include edits not yet synced to the remote registry.\n *\n * The update is performed in-place. A deep clone of the current document\n * state is used to avoid mutating the reactive object directly.\n *\n * @param documentName - The name of the document to save.\n * @returns An array of diffs that were excluded from being applied (such as changes to ignored keys),\n * or undefined if the document does not exist or cannot be updated.\n *\n * @example\n * // Save the current state of the document named 'api'\n * const excludedDiffs = store.saveDocument('api')\n */\n saveDocument(documentName: string): Promise<unknown[] | undefined>\n /**\n * Builds the sidebar for the specified document.\n *\n * @param documentName - The name of the document to build the sidebar for\n * @returns boolean indicating if the sidebar was built successfully\n */\n buildSidebar: (documentName: string) => boolean\n /**\n * Restores the specified document to its last locally saved state.\n *\n * This method updates the current reactive document (in the workspace) with the contents of the\n * corresponding intermediate document (from the `intermediateDocuments` map), effectively discarding\n * any unsaved in-memory changes and reverting to the last saved version.\n * Vue reactivity is preserved by updating the existing reactive object in place.\n *\n * **Warning:** This operation will discard all unsaved (in-memory) changes to the specified document.\n *\n * @param documentName - The name of the document to restore.\n * @returns void\n *\n * @example\n * // Restore the document named 'api' to its last saved state\n * store.revertDocumentChanges('api')\n */\n revertDocumentChanges(documentName: string): Promise<void>\n /**\n * Commits the specified document.\n *\n * This method is intended to finalize and persist the current state of the document,\n * potentially syncing it with a remote registry or marking it as the latest committed version.\n *\n * @param documentName - The name of the document to commit.\n * @remarks\n * The actual commit logic is not implemented yet.\n */\n commitDocument(documentName: string): void\n /**\n * Exports the complete current workspace state as a plain JavaScript object.\n *\n * The returned object includes all workspace documents (with Vue reactivity removed), workspace metadata,\n * document configurations, and both the original and intermediate document maps. This object can be\n * serialized (e.g., with JSON.stringify) and later imported to fully restore the workspace\u2014including\n * all documents, their configurations, metadata, and historical states.\n *\n * @returns An `InMemoryWorkspace` object representing the entire workspace state,\n * suitable for persistence, backup, or sharing.\n */\n exportWorkspace(): InMemoryWorkspace\n /**\n * Imports a workspace from a serialized JSON string.\n *\n * This method parses the input string using the InMemoryWorkspaceSchema,\n * then updates the current workspace state, including documents, metadata,\n * and configuration, with the imported values.\n *\n * @param input - The serialized workspace JSON string to import.\n */\n loadWorkspace(input: InMemoryWorkspace): void\n /**\n * Imports a workspace from a WorkspaceSpecification object.\n *\n * This method assigns workspace metadata and adds all documents defined in the specification.\n * Each document is added using its $ref and optional overrides.\n *\n * @example\n * ```ts\n * await store.importWorkspaceFromSpecification({\n * documents: {\n * api: { $ref: '/specs/api.yaml' },\n * petstore: { $ref: '/specs/petstore.yaml' }\n * },\n * overrides: {\n * api: { config: { features: { showModels: true } } }\n * },\n * info: { title: 'My Workspace' },\n * workspace: 'v1',\n * \"x-scalar-color-mode\": true\n * })\n * ```\n *\n * @param specification - The workspace specification to import.\n */\n importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<void[]>\n /**\n * Rebases a document in the workspace by refetching its origin and merging with local edits.\n *\n * This method fetches the latest version of the document (optionally with custom fetch/config),\n * calculates changes relative to the original and locally edited versions,\n * and attempts to update the workspace document while preserving user edits.\n * If automatic resolution isn't possible due to conflicts, returns a conflict list for the caller to resolve.\n * If `resolvedConflicts` are provided (e.g., after user intervention), applies them to complete the rebase.\n *\n * @param input Object specifying which document to rebase\n * @returns If there are unresolved conflicts, resolves to an object containing the list of conflicts and a method to apply user-resolved conflicts; otherwise resolves to void.\n *\n * @example\n * // Rebase a document and handle conflicts interactively\n * const result = await store.rebaseDocument({ name: 'api', fetch: customFetch });\n * if (result && result.ok) {\n * // Present conflicts to the user and collect resolutions...\n * await result.applyChanges(userResolvedConflicts);\n * }\n */\n rebaseDocument: (input: WorkspaceDocumentInput) => Promise<\n | { ok: false; type: 'CORRUPTED_STATE' | 'FETCH_FAILED' | 'NO_CHANGES_DETECTED'; message: string }\n | {\n ok: true\n conflicts: ReturnType<typeof merge>['conflicts']\n applyChanges: (resolvedConflicts: Difference<unknown>[]) => Promise<void>\n }\n >\n}\n\n/**\n * Creates a reactive workspace store that manages documents and their metadata.\n * The store provides functionality for accessing, updating, and resolving document references.\n *\n * @param workspaceProps - Configuration object for the workspace\n * @param workspaceProps.meta - Optional metadata for the workspace\n * @param workspaceProps.documents - Optional record of documents to initialize the workspace with\n * Documents that require asynchronous loading must be added using `addDocument` after the store is created\n * this allows atomic awaiting and does not block page load for the store initialization\n * @returns An object containing methods and getters for managing the workspace\n */\nexport const createWorkspaceStore = (workspaceProps?: WorkspaceProps): WorkspaceStore => {\n /**\n * Holds additional configuration options for each document in the workspace.\n *\n * This can include settings that can not be persisted between sessions (not JSON serializable)\n */\n const extraDocumentConfigurations: ExtraDocumentConfigurations = {}\n\n /**\n * Notifies all workspace plugins of a workspace state change event.\n *\n * This function iterates through all registered plugins (if any) and invokes\n * their onWorkspaceStateChanges hook with the given event object.\n *\n * @param event - The workspace state change event to broadcast to plugins\n */\n const fireWorkspaceChange = (event: WorkspaceStateChangeEvent) => {\n workspaceProps?.plugins?.forEach((plugin) => plugin.hooks?.onWorkspaceStateChanges?.(event))\n }\n\n /**\n * An object containing the reactive workspace state.\n *\n * Every change to the workspace, is tracked and broadcast to all registered plugins.\n * allowing for change tracking.\n *\n * NOTE:\n * The detect changes proxy is applied separately beacause the vue reactitvity proxy have to be the outer most proxy.\n * If the order is reversed, Vue cannot properly track mutations, leading to lost reactivity and bugs.\n * By wrapping the contents with the detect changes proxy first, and then passing the result to Vue's `reactive`,\n * we ensure that Vue manages its reactivity as expected and our change detection hooks\n * are also triggered reliably.\n * Do not reverse this order\u203C\uFE0F\n */\n const workspace = reactive<Workspace>(\n createDetectChangesProxy(\n {\n ...workspaceProps?.meta,\n documents: {},\n /**\n * Returns the currently active document from the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The active document or undefined if no document is found\n */\n get activeDocument(): NonNullable<Workspace['activeDocument']> | undefined {\n return workspace.documents[getActiveDocumentName()]\n },\n },\n {\n hooks: {\n onAfterChange(path) {\n const type = path[0]\n\n /** Document changes */\n if (type === 'documents') {\n // We are overriding the while documents object, ignore. This should not happen\n if (path.length < 2) {\n console.log('[WARN]: Overriding entire documents object is not supported')\n return\n }\n\n const documentName = path[1] as string\n const event = {\n type: 'documents',\n documentName,\n value: unpackProxyObject(\n workspace.documents[documentName] ?? {\n openapi: '3.1.0',\n info: { title: '', version: '' },\n 'x-scalar-original-document-hash': '',\n },\n ),\n } satisfies WorkspaceStateChangeEvent\n\n fireWorkspaceChange(event)\n return\n }\n\n /** Active document changes */\n if (type === 'activeDocument') {\n const documentName = getActiveDocumentName()\n // Active document changed\n const event = {\n type: 'documents',\n documentName,\n value: unpackProxyObject(\n workspace.documents[documentName] ?? {\n openapi: '3.1.0',\n info: { title: '', version: '' },\n 'x-scalar-original-document-hash': '',\n },\n ),\n } satisfies WorkspaceStateChangeEvent\n\n fireWorkspaceChange(event)\n return\n }\n\n /** Document meta changes */\n const { activeDocument: _a, documents: _d, ...meta } = workspace\n const event = {\n type: 'meta',\n value: unpackProxyObject(meta, { depth: 1 }),\n } satisfies WorkspaceStateChangeEvent\n\n fireWorkspaceChange(event)\n return\n },\n },\n },\n ),\n )\n\n /**\n * An object containing all the workspace state, wrapped in a detect changes proxy.\n *\n * Every change to the workspace state (documents, configs, metadata, etc.) can be detected here,\n * allowing for change tracking.\n */\n const { originalDocuments, intermediateDocuments, overrides, documentConfigs } = createDetectChangesProxy(\n {\n /**\n * Holds the original, unmodified documents as they were initially loaded into the workspace.\n * These documents are stored in their raw form\u2014prior to any reactive wrapping, dereferencing, or bundling.\n * This map preserves the pristine structure of each document, using deep clones to ensure that\n * subsequent mutations in the workspace do not affect the originals.\n * The originals are retained so that we can restore, compare, or sync with the remote registry as needed.\n */\n originalDocuments: {} as Record<string, UnknownObject>,\n /**\n * Stores the intermediate state of documents after local edits but before syncing with the remote registry.\n *\n * This map acts as a local \"saved\" version of the document, reflecting the user's changes after they hit \"save\".\n * The `originalDocuments` map, by contrast, always mirrors the document as it exists in the remote registry.\n *\n * Use this map to stage local changes that are ready to be propagated back to the remote registry.\n * This separation allows us to distinguish between:\n * - The last known remote version (`originalDocuments`)\n * - The latest locally saved version (`intermediateDocuments`)\n * - The current in-memory (possibly unsaved) workspace document (`workspace.documents`)\n */\n intermediateDocuments: {} as Record<string, UnknownObject>,\n /**\n * A map of document configurations keyed by document name.\n * This stores the configuration options for each document in the workspace,\n * allowing for document-specific settings like navigation options, appearance,\n * and other reference configuration.\n */\n documentConfigs: {} as Record<string, Config>,\n /**\n * Stores per-document overrides for OpenAPI documents.\n * This object is used to override specific fields of a document\n * when you cannot (or should not) modify the source document directly.\n * For example, this enables UI-driven or temporary changes to be applied\n * on top of the original document, without mutating the source.\n * The key is the document name, and the value is a deep partial\n * OpenAPI document representing the overridden fields.\n */\n overrides: {} as InMemoryWorkspace['overrides'],\n },\n {\n hooks: {\n onAfterChange(path) {\n const type = path[0]\n\n if (!type) {\n return\n }\n\n if (path.length < 2) {\n return\n }\n\n const documentName = path[1] as string\n if (type === 'originalDocuments') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(originalDocuments[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n\n if (type === 'intermediateDocuments') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(intermediateDocuments[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n\n if (type === 'documentConfigs') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(documentConfigs[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n\n if (type === 'overrides') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(overrides[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n },\n },\n },\n )\n\n /**\n * Returns the name of the currently active document in the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The name of the active document or an empty string if no document is found\n */\n function getActiveDocumentName() {\n return workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? ''\n }\n\n function exportDocument(documentName: string, format: 'json' | 'yaml', minify?: boolean) {\n const intermediateDocument = intermediateDocuments[documentName]\n\n if (!intermediateDocument) {\n return\n }\n\n if (format === 'json') {\n return minify ? JSON.stringify(intermediateDocument) : JSON.stringify(intermediateDocument, null, 2)\n }\n\n return YAML.stringify(intermediateDocument)\n }\n\n // Save the current state of the specified document to the intermediate documents map.\n // This function captures the latest (reactive) state of the document from the workspace and\n // applies its changes to the corresponding entry in the `intermediateDocuments` map.\n // The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n // which may include edits not yet synced to the remote registry.\n async function saveDocument(documentName: string) {\n const intermediateDocument = intermediateDocuments[documentName]\n const workspaceDocument = workspace.documents[documentName]\n\n if (!workspaceDocument) {\n return\n }\n\n // Obtain the raw state of the current document to ensure accurate diffing\n const updatedDocument = getRaw(workspaceDocument)\n\n // If either the intermediate or updated document is missing, do nothing\n if (!intermediateDocument || !updatedDocument) {\n return\n }\n\n // Traverse the document and convert refs back to the original shape\n const updatedWithOriginalRefs = await bundle(deepClone(updatedDocument), {\n plugins: [restoreOriginalRefs()],\n treeShake: false,\n urlMap: true,\n })\n\n // Apply changes from the current document to the intermediate document in place\n const excludedDiffs = applySelectiveUpdates(intermediateDocument, updatedWithOriginalRefs as UnknownObject)\n return excludedDiffs\n }\n\n const processDocument = (input: OpenApiDocument, options: Config & { documentSource?: string }): OpenApiDocument => {\n // Get the servers from the document or the config and perform some mutations on them\n const servers = getServersFromDocument(options['x-scalar-reference-config']?.settings?.servers ?? input.servers, {\n baseServerUrl: options['x-scalar-reference-config']?.settings?.baseServerUrl,\n documentUrl: options.documentSource,\n })\n\n if (servers.length) {\n input.servers = servers.map((it) => ({ url: it.url, description: it.description, variables: it.variables }))\n }\n\n return input\n }\n\n // Add a document to the store synchronously from an in-memory OpenAPI document\n async function addInMemoryDocument(\n input: ObjectDoc & { initialize?: boolean; documentSource?: string; documentHash: string },\n ) {\n const { name, meta } = input\n const clonedRawInputDocument = measureSync('deepClone', () => deepClone(input.document))\n\n measureSync('initialize', () => {\n if (input.initialize !== false) {\n // Store the original document in the originalDocuments map\n // This is used to track the original state of the document as it was loaded into the workspace\n originalDocuments[name] = deepClone(clonedRawInputDocument)\n\n // Store the intermediate document state for local edits\n // This is used to track the last saved state of the document\n // It allows us to differentiate between the original document and the latest saved version\n // This is important for local edits that are not yet synced with the remote registry\n // The intermediate document is used to store the latest saved state of the document\n // This allows us to track changes and revert to the last saved state if needed\n intermediateDocuments[name] = deepClone(clonedRawInputDocument)\n // Add the document config to the documentConfigs map\n documentConfigs[name] = input.config ?? {}\n // Store the overrides for this document, or an empty object if none are provided\n overrides[name] = input.overrides ?? {}\n // Store extra document configurations that can not be persisted\n extraDocumentConfigurations[name] = { fetch: input.fetch }\n }\n })\n\n const inputDocument = measureSync('upgrade', () => upgrade(deepClone(clonedRawInputDocument), '3.1'))\n\n const strictDocument: UnknownObject = createMagicProxy(\n {\n ...inputDocument,\n ...meta,\n 'x-original-oas-version': originalDocuments[name]?.openapi ?? originalDocuments[name]?.swagger,\n 'x-scalar-original-document-hash': input.documentHash,\n 'x-scalar-original-source-url': input.documentSource,\n },\n { showInternal: true },\n )\n\n if (strictDocument[extensions.document.navigation] === undefined) {\n // If the document navigation is not already present, bundle the entire document to resolve all references.\n // This typically applies when the document is not preprocessed by the server and needs local reference resolution.\n // We need to bundle document first before we validate, so we can also validate the external references\n await measureAsync(\n 'bundle',\n async () =>\n await bundle(getRaw(strictDocument), {\n treeShake: false,\n plugins: [\n fetchUrls({\n fetch: extraDocumentConfigurations[name]?.fetch ?? workspaceProps?.fetch,\n }),\n externalValueResolver(),\n refsEverywhere(),\n ],\n urlMap: true,\n origin: input.documentSource, // use the document origin (if provided) as the base URL for resolution\n }),\n )\n\n // We coerce the values only when the document is not preprocessed by the server-side-store\n const coerced = measureSync('coerceValue', () =>\n coerceValue(OpenAPIDocumentSchemaStrict, deepClone(strictDocument)),\n )\n measureSync('mergeObjects', () => mergeObjects(strictDocument, coerced))\n }\n\n const isValid = Value.Check(OpenAPIDocumentSchemaStrict, strictDocument)\n\n if (!isValid) {\n const validationErrors = Array.from(Value.Errors(OpenAPIDocumentSchemaStrict, strictDocument))\n\n console.warn('document validation errors: ')\n console.warn(\n validationErrors.map((error) => ({\n message: error.message,\n path: error.path,\n schema: error.schema,\n value: error.value,\n })),\n )\n }\n\n // Skip navigation generation if the document already has a server-side generated navigation structure\n if (strictDocument[extensions.document.navigation] === undefined) {\n const navigation = createNavigation(name, strictDocument as OpenApiDocument, input.config)\n\n strictDocument[extensions.document.navigation] = navigation\n\n // Do some document processing\n processDocument(getRaw(strictDocument as OpenApiDocument), {\n ...(documentConfigs[name] ?? {}),\n documentSource: input.documentSource,\n })\n }\n\n // Create a proxied document with magic proxy and apply any overrides, then store it in the workspace documents map\n // We create a new proxy here in order to hide internal properties after validation and processing\n // This ensures that the workspace document only exposes the intended OpenAPI properties and extensions\n workspace.documents[name] = createOverridesProxy(createMagicProxy(getRaw(strictDocument)) as OpenApiDocument, {\n overrides: overrides[name],\n })\n }\n\n // Asynchronously adds a new document to the workspace by loading and validating the input.\n // If loading fails, a placeholder error document is added instead.\n async function addDocument(input: WorkspaceDocumentInput) {\n const { name, meta } = input\n\n const resolve = await measureAsync(\n 'loadDocument',\n async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch }),\n )\n\n // Log the time taken to add a document\n await measureAsync('addDocument', async () => {\n if (!resolve.ok) {\n console.error(`Failed to fetch document '${name}': request was not successful`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n 'x-scalar-original-document-hash': 'not-a-hash',\n }\n\n return\n }\n\n if (!isObject(resolve.data)) {\n console.error(`Failed to load document '${name}': response data is not a valid object`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n 'x-scalar-original-document-hash': 'not-a-hash',\n }\n\n return\n }\n\n await addInMemoryDocument({\n ...input,\n document: resolve.data,\n documentSource: getDocumentSource(input),\n documentHash: generateHash(resolve.raw),\n })\n })\n }\n\n /**\n * Builds (or updates) the navigation sidebar for the specified document.\n *\n * This method generates the sidebar navigation structure for a workspace document,\n * and attaches it to the document's metadata under the navigation extension key.\n * The document is unpacked to avoid assigning proxy objects as direct property references.\n *\n * - Only the top-level object is proxied; all child objects should be unproxied.\n * - This approach enables safe unpacking of the proxy object without recursively traversing the full object tree.\n *\n * @param documentName - The name/key of the document whose sidebar should be built.\n * @returns {boolean} True if the sidebar was built successfully, false if the document does not exist.\n */\n const buildSidebar = (documentName: string): boolean => {\n const document = workspace.documents[documentName]\n\n if (!document) {\n // Log and exit if the document does not exist in the workspace\n console.error(`Document '${documentName}' does not exist in the workspace.`)\n return false\n }\n\n // Generate the navigation structure for the sidebar.\n const navigation = createNavigation(documentName, document, getDocumentConfiguration(documentName))\n\n // Set the computed navigation structure on the document metadata.\n document[extensions.document.navigation] = navigation\n\n return true\n }\n\n // Returns the effective document configuration for a given document name,\n // merging (in order of increasing priority): the default config, workspace-level config, and document-specific config.\n const getDocumentConfiguration = (name: string) => {\n return mergeObjects<typeof defaultConfig>(\n mergeObjects(deepClone(defaultConfig), workspaceProps?.config ?? {}),\n documentConfigs[name] ?? {},\n )\n }\n\n // Cache to track visited nodes during reference resolution to prevent bundling the same subtree multiple times\n // This is needed because we are doing partial bundle operations\n const visitedNodesCache = new Set()\n\n return {\n get workspace() {\n return workspace\n },\n update(key, value) {\n // @ts-expect-error\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n throw new Error('Invalid key: cannot modify prototype')\n }\n Object.assign(workspace, { [key]: value })\n },\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ) {\n const currentDocument = workspace.documents[name === 'active' ? getActiveDocumentName() : name]\n\n if (!currentDocument) {\n throw 'Please select a valid document'\n }\n\n Object.assign(currentDocument, { [key]: value })\n },\n async replaceDocument(documentName: string, input: Record<string, unknown>) {\n const currentDocument = workspace.documents[documentName]\n\n if (!currentDocument) {\n return console.error(`Document '${documentName}' does not exist in the workspace.`)\n }\n\n // Replace the whole document\n await addInMemoryDocument({\n name: documentName,\n document: input,\n // Preserve the current metadata\n documentSource: currentDocument['x-scalar-original-source-url'],\n documentHash: currentDocument['x-scalar-original-document-hash'],\n meta: {\n 'x-scalar-active-auth': currentDocument['x-scalar-active-auth'],\n 'x-scalar-active-server': currentDocument['x-scalar-active-server'],\n },\n initialize: false,\n })\n },\n resolve: (path) => {\n const activeDocument = workspace.activeDocument\n\n const target = getValueByPath(activeDocument, path)\n\n if (!isObject(target)) {\n console.error(\n `Invalid path provided for resolution. Path: [${path.join(', ')}]. Found value of type: ${typeof target}. Expected an object.`,\n )\n return Promise.resolve()\n }\n\n // Bundle the target document with the active document as root, resolving any external references\n // and tracking resolution status through hooks\n return bundle(target, {\n root: activeDocument,\n treeShake: false,\n plugins: [fetchUrls(), loadingStatus(), externalValueResolver()],\n urlMap: true,\n visitedNodes: visitedNodesCache,\n })\n },\n addDocument,\n /**\n * Deletes a document from the workspace and all associated data.\n *\n * This function removes the document and all related data structures.\n * If the deleted document was active, it automatically selects the first remaining document.\n */\n deleteDocument: (documentName: string): void => {\n // Check if the document exists before attempting deletion\n if (!workspace.documents[documentName]) {\n return\n }\n\n // Delete the document from the workspace (this will trigger change detection events)\n delete workspace.documents[documentName]\n\n // Clean up all associated data structures\n delete originalDocuments[documentName]\n delete intermediateDocuments[documentName]\n delete documentConfigs[documentName]\n delete overrides[documentName]\n delete extraDocumentConfigurations[documentName]\n\n // Get remaining documents before deletion to properly set the active document\n const remainingDocuments = Object.keys(workspace.documents)\n const wasActiveDocument = workspace['x-scalar-active-document'] === documentName\n\n // Reset the active document to the first remaining one if the deleted document was the active one\n if (wasActiveDocument) {\n workspace['x-scalar-active-document'] = remainingDocuments[0] ?? undefined\n }\n\n // Fire the deleteDocument event\n fireWorkspaceChange({\n type: 'deleteDocument',\n documentName,\n })\n },\n get config() {\n return getDocumentConfiguration(getActiveDocumentName())\n },\n exportDocument,\n exportActiveDocument: (format, minify) => exportDocument(getActiveDocumentName(), format, minify),\n buildSidebar,\n saveDocument,\n async revertDocumentChanges(documentName: string) {\n const workspaceDocument = workspace.documents[documentName]\n const intermediate = intermediateDocuments[documentName]\n\n if (!workspaceDocument || !intermediate) {\n return\n }\n\n await addInMemoryDocument({\n name: documentName,\n document: intermediate,\n documentSource: workspaceDocument['x-scalar-original-source-url'],\n documentHash: workspaceDocument['x-scalar-original-document-hash'],\n initialize: false,\n })\n },\n commitDocument(documentName: string) {\n // TODO: Implement commit logic\n console.warn(`Commit operation for document '${documentName}' is not implemented yet.`)\n },\n exportWorkspace() {\n const { activeDocument: _, documents, ...meta } = unpackProxyObject(workspace)\n return {\n documents: {\n ...Object.fromEntries(\n Object.entries(documents).map(([name, doc]) => [\n name,\n // Get the raw document without any proxies\n unpackProxyObject(doc),\n ]),\n ),\n },\n meta: unpackProxyObject(meta) ?? {},\n documentConfigs: unpackProxyObject(documentConfigs),\n originalDocuments: unpackProxyObject(originalDocuments),\n intermediateDocuments: unpackProxyObject(intermediateDocuments),\n overrides: unpackProxyObject(overrides),\n } satisfies InMemoryWorkspace\n },\n loadWorkspace(input: InMemoryWorkspace) {\n safeAssign(\n workspace.documents,\n Object.fromEntries(\n Object.entries(input.documents).map(([name, doc]) => [\n name,\n createOverridesProxy(createMagicProxy(doc), {\n overrides: input.overrides[name],\n }),\n ]),\n ),\n )\n\n safeAssign(originalDocuments, input.originalDocuments)\n safeAssign(intermediateDocuments, input.intermediateDocuments)\n safeAssign(documentConfigs, input.documentConfigs as Record<string, Config>)\n safeAssign(overrides, input.overrides)\n safeAssign(workspace, input.meta)\n },\n importWorkspaceFromSpecification: (specification: WorkspaceSpecification) => {\n const { documents, overrides, info: _info, workspace: _workspaceVersion, ...meta } = specification\n\n // Assign workspace metadata\n safeAssign(workspace, meta)\n\n // Add workspace documents\n return Promise.all(\n Object.entries(documents ?? {}).map(([name, doc]) =>\n addDocument({ url: doc.$ref, name, overrides: overrides?.[name] }),\n ),\n )\n },\n rebaseDocument: async (input: WorkspaceDocumentInput) => {\n const { name } = input\n\n // ---- Get the current documents\n const originalDocument = originalDocuments[name]\n const intermediateDocument = intermediateDocuments[name]\n // raw version without any proxies\n const activeDocument = workspace.documents[name]\n ? toRaw(getRaw(unpackOverridesProxy(workspace.documents[name])))\n : undefined\n\n if (!originalDocument || !intermediateDocument || !activeDocument) {\n // If any required document state is missing, do nothing\n return {\n ok: false,\n type: 'CORRUPTED_STATE' as const,\n message: `Cannot rebase document '${name}': missing original, intermediate, or active document state`,\n }\n }\n\n // ---- Resolve input document\n const resolve = await measureAsync(\n 'loadDocument',\n async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch }),\n )\n\n if (!resolve.ok || !isObject(resolve.data)) {\n return {\n ok: false,\n type: 'FETCH_FAILED' as const,\n message: `Failed to fetch document '${name}': request was not successful or returned invalid data`,\n }\n }\n\n // Compare document hashes to see if the document has changed\n // When the hashes match, we can skip the rebase process\n const newHash = generateHash(resolve.raw)\n if (activeDocument['x-scalar-original-document-hash'] === newHash) {\n return {\n ok: false,\n type: 'NO_CHANGES_DETECTED' as const,\n message: `No changes detected for document '${name}': document hash matches the active document`,\n }\n }\n\n const newDocumentOrigin = resolve.data\n\n // ---- Override the configurations and metadata\n documentConfigs[name] = input.config ?? {}\n overrides[name] = input.overrides ?? {}\n extraDocumentConfigurations[name] = { fetch: input.fetch }\n\n // ---- Get the new intermediate document\n const changelogAA = diff(originalDocument, newDocumentOrigin)\n\n // When there are no changes, we can return early since we don't need to do anything\n // This is not supposed to happen due to the hash check above, but just in case\n if (changelogAA.length === 0) {\n return {\n ok: false,\n type: 'NO_CHANGES_DETECTED' as const,\n message: `No changes detected for document '${name}' after fetching the latest version.`,\n }\n }\n\n const changelogAB = diff(originalDocument, intermediateDocument)\n\n const changesA = merge(changelogAA, changelogAB)\n\n return {\n ok: true,\n conflicts: changesA.conflicts,\n applyChanges: async (resolvedConflicts: Difference<unknown>[]) => {\n const changesetA = changesA.diffs.concat(resolvedConflicts)\n\n // Apply the changes to the original document to get the new intermediate\n const newIntermediateDocument = apply(deepClone(originalDocument), changesetA)\n intermediateDocuments[name] = newIntermediateDocument\n\n // Update the original document\n originalDocuments[name] = newDocumentOrigin\n\n // ---- Get the new active document\n const changelogBA = diff(intermediateDocument, newIntermediateDocument)\n const changelogBB = diff(intermediateDocument, activeDocument)\n\n const changesB = merge(changelogBA, changelogBB)\n\n // Auto-conflict resolution: pick only the changes from the first changeset\n // TODO: In the future, implement smarter conflict resolution if needed\n const changesetB = changesB.diffs.concat(changesB.conflicts.flatMap((it) => it[0]))\n\n const newActiveDocument = coerceValue(\n OpenAPIDocumentSchemaStrict,\n apply(deepClone(newIntermediateDocument), changesetB),\n )\n\n // add the new active document to the workspace but don't re-initialize\n await addInMemoryDocument({\n ...input,\n document: {\n ...newActiveDocument,\n // force regeneration of navigation\n // when we are rebasing, we want to ensure that the navigation is always up to date\n [extensions.document.navigation]: undefined,\n },\n documentSource: getDocumentSource(input),\n // Update the original document hash\n documentHash: generateHash(resolve.raw),\n initialize: false,\n })\n },\n }\n },\n }\n}\n\n// biome-ignore lint/performance/noBarrelFile: It's a package entry point\nexport { generateClientMutators } from '@/mutators'\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,cAAc,mBAAmB;AAC1C,SAA4B,cAAc;AAC1C,SAAS,iBAAiB;AAC1B,SAA0B,OAAO,MAAM,aAAa;AACpD,SAAS,kBAAkB,cAAc;AACzC,SAAS,eAAe;AAExB,SAAS,aAAa;AAEtB,SAAS,UAAU,aAAa;AAChC,OAAO,UAAU;AAEjB,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAC1B,SAAS,gCAAgC;AACzC,SAA6B,UAAU,kBAAkB;AACzD,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB,eAAe,gBAAgB,2BAA2B;AAC1F,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,mBAAmB;AAC5B;AAAA,EACE,yBAAyB;AAAA,OAEpB;AAaP,MAAM,gBAAsC;AAAA,EAC1C,6BAA6B;AAC/B;AA6DA,SAAS,aAAa,mBAA6E;AACjG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ACtD;AAGA,gBAAM,oBAAoB;AAAA,YACxB,GAAG;AAAA,YACH,UAAU;AAAA,cACR,GAAG;AAAA;AAAA;AAAA,cAGH,CAAC,WAAW,SAAS,UAAU,GAAG;AAAA,YACpC;AAAA,YACA,gBAAgB,kBAAkB,KAAK;AAAA;AAAA,YAEvC,cAAc,aAAa,QAAQ,GAAG;AAAA,YACtC,YAAY;AAAA,UACd,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAGA,SAAS,8BAA8B;",
|
|
4
|
+
"sourcesContent": ["import { preventPollution } from '@scalar/helpers/object/prevent-pollution'\nimport { generateHash } from '@scalar/helpers/string/generate-hash'\nimport { measureAsync, measureSync } from '@scalar/helpers/testing/measure'\nimport { type LoaderPlugin, bundle } from '@scalar/json-magic/bundle'\nimport { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser'\nimport { type Difference, apply, diff, merge } from '@scalar/json-magic/diff'\nimport { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy'\nimport { upgrade } from '@scalar/openapi-upgrader'\nimport type { Record } from '@scalar/typebox'\nimport { Value } from '@scalar/typebox/value'\nimport type { PartialDeep, RequiredDeep } from 'type-fest'\nimport { reactive, toRaw } from 'vue'\nimport YAML from 'yaml'\n\nimport { applySelectiveUpdates } from '@/helpers/apply-selective-updates'\nimport { deepClone } from '@/helpers/deep-clone'\nimport { createDetectChangesProxy } from '@/helpers/detect-changes-proxy'\nimport { type UnknownObject, isObject, safeAssign } from '@/helpers/general'\nimport { getValueByPath } from '@/helpers/json-path-utils'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { createOverridesProxy, unpackOverridesProxy } from '@/helpers/overrides-proxy'\nimport { unpackProxyObject } from '@/helpers/unpack-proxy'\nimport { createNavigation } from '@/navigation'\nimport { externalValueResolver, loadingStatus, refsEverywhere, restoreOriginalRefs } from '@/plugins/bundler'\nimport { getServersFromDocument } from '@/preprocessing/server'\nimport { extensions } from '@/schemas/extensions'\nimport type { InMemoryWorkspace } from '@/schemas/inmemory-workspace'\nimport { defaultReferenceConfig } from '@/schemas/reference-config'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport {\n OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict,\n type OpenApiDocument,\n} from '@/schemas/v3.1/strict/openapi-document'\nimport type { Workspace, WorkspaceDocumentMeta, WorkspaceExtensions, WorkspaceMeta } from '@/schemas/workspace'\nimport type { WorkspaceSpecification } from '@/schemas/workspace-specification'\nimport type { Config, DocumentConfiguration } from '@/schemas/workspace-specification/config'\nimport type { WorkspacePlugin, WorkspaceStateChangeEvent } from '@/workspace-plugin'\n\ntype ExtraDocumentConfigurations = Record<\n string,\n {\n fetch: WorkspaceDocumentMetaInput['fetch']\n }\n>\n\nconst defaultConfig: RequiredDeep<Config> = {\n 'x-scalar-reference-config': defaultReferenceConfig,\n}\n\n/**\n * Input type for workspace document metadata and configuration.\n * This type defines the required and optional fields for initializing a document in the workspace.\n */\ntype WorkspaceDocumentMetaInput = {\n /** Optional metadata about the document like title, description, etc */\n meta?: WorkspaceDocumentMeta\n /** Required unique identifier for the document */\n name: string\n /** Optional configuration options */\n config?: DocumentConfiguration\n /** Overrides for the document */\n overrides?: PartialDeep<OpenApiDocument>\n /** Optional custom fetch implementation to use when retrieving the document. By default the global fetch implementation will be used */\n fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>\n}\n\n/**\n * Represents a document that is loaded from a URL.\n * This type extends WorkspaceDocumentMetaInput to include URL-specific properties.\n */\nexport type UrlDoc = {\n /** URL to fetch the OpenAPI document from */\n url: string\n} & WorkspaceDocumentMetaInput\n\n/** Represents a document that is provided directly as an object rather than loaded from a URL */\nexport type ObjectDoc = {\n /** The OpenAPI document object containing the API specification */\n document: Record<string, unknown>\n} & WorkspaceDocumentMetaInput\n\n/**\n * Union type representing the possible input formats for a workspace document:\n * - UrlDoc: Document loaded from a URL with optional fetch configuration\n * - ObjectDoc: Direct document object with metadata\n */\nexport type WorkspaceDocumentInput = UrlDoc | ObjectDoc\n\n/**\n * Resolves a workspace document from various input sources (URL, local file, or direct document object).\n *\n * @param workspaceDocument - The document input to resolve, which can be:\n * - A URL to fetch the document from\n * - A direct document object\n * @returns A promise that resolves to an object containing:\n * - ok: boolean indicating if the resolution was successful\n * - data: The resolved document data\n *\n * @example\n * // Resolve from URL\n * const urlDoc = await loadDocument({ name: 'api', url: 'https://api.example.com/openapi.json' })\n *\n * // Resolve direct document\n * const directDoc = await loadDocument({\n * name: 'inline',\n * document: { openapi: '3.0.0', paths: {} }\n * })\n */\nfunction loadDocument(workspaceDocument: WorkspaceDocumentInput): ReturnType<LoaderPlugin['exec']> {\n if ('url' in workspaceDocument) {\n return fetchUrls({ fetch: workspaceDocument.fetch }).exec(workspaceDocument.url)\n }\n\n return Promise.resolve({\n ok: true,\n data: workspaceDocument.document,\n // string version of the raw document for hashing purposes\n raw: JSON.stringify(workspaceDocument.document),\n })\n}\n\n/**\n * Returns the origin (URL) of a workspace document if it was loaded from a URL.\n * If the document was provided directly as an object, returns undefined.\n *\n * @param input - The workspace document input (either UrlDoc or ObjectDoc)\n * @returns The URL string if present, otherwise undefined\n */\nconst getDocumentSource = (input: WorkspaceDocumentInput) => {\n if ('url' in input) {\n return input.url\n }\n return undefined\n}\n\n/**\n * Configuration object for initializing a workspace store.\n * Defines the initial state and documents for the workspace.\n */\ntype WorkspaceProps = {\n /** Optional metadata for the workspace including theme, active document, etc */\n meta?: WorkspaceMeta\n /** Workspace configuration */\n config?: PartialDeep<Config>\n /** Fetch function for retrieving documents */\n fetch?: WorkspaceDocumentInput['fetch']\n /** A list of all registered plugins for the current workspace */\n plugins?: WorkspacePlugin[]\n}\n\n/**\n * Type definition for the workspace store return object.\n * This explicit type is needed to avoid TypeScript inference limits.\n *\n * @see https://github.com/microsoft/TypeScript/issues/43817#issuecomment-827746462\n */\nexport type WorkspaceStore = {\n /**\n * Returns the reactive workspace object with an additional activeDocument getter\n */\n readonly workspace: Workspace\n /**\n * Updates a specific metadata field in the workspace\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @example\n * // Update the workspace title\n * update('x-scalar-active-document', 'document-name')\n */\n update<K extends keyof WorkspaceMeta | keyof WorkspaceExtensions>(\n key: K,\n value: (WorkspaceMeta & WorkspaceExtensions)[K],\n ): void\n /**\n * Updates a specific metadata field in a document\n * @param name - The name of the document to update ('active' or a specific document name)\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @throws Error if the specified document doesn't exist\n * @example\n * // Update the auth of the active document\n * updateDocument('active', 'x-scalar-active-auth', 'Bearer')\n * // Update the auth of a specific document\n * updateDocument('document-name', 'x-scalar-active-auth', 'Bearer')\n */\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ): void\n /**\n * Replaces the content of a specific document in the workspace with the provided input.\n * This method computes the difference between the current document and the new input,\n * then applies only the necessary changes in place. The updates are applied atomically,\n * ensuring the document is updated in a single operation.\n *\n * @param documentName - The name of the document to update.\n * @param input - The new content to apply to the document (as a plain object).\n * @example\n * // Replace the content of the 'api' document with new data\n * store.replaceDocument('api', {\n * openapi: '3.1.0',\n * info: { title: 'Updated API', version: '1.0.1' },\n * paths: {},\n * })\n */\n replaceDocument(documentName: string, input: Record<string, unknown>): Promise<void>\n /**\n * Resolves a reference in the active document by following the provided path and resolving any external $ref references.\n * This method traverses the document structure following the given path and resolves any $ref references it encounters.\n * During resolution, it sets a loading status and updates the reference with the resolved content.\n *\n * @param path - Array of strings representing the path to the reference (e.g. ['paths', '/users', 'get', 'responses', '200'])\n * @throws Error if the path is invalid or empty\n * @example\n * // Resolve a reference in the active document\n * resolve(['paths', '/users', 'get', 'responses', '200'])\n */\n resolve(path: string[]): Promise<unknown>\n /**\n * Adds a new document to the workspace\n * @param document - The document content to add. This should be a valid OpenAPI/Swagger document or other supported format\n * @param meta - Metadata for the document, including its name and other properties defined in WorkspaceDocumentMeta\n * @example\n * // Add a new OpenAPI document to the workspace\n * store.addDocument({\n * name: 'name',\n * document: {\n * openapi: '3.0.0',\n * info: { title: 'title' },\n * },\n * meta: {\n * 'x-scalar-active-auth': 'Bearer',\n * 'x-scalar-active-server': 'production'\n * }\n * })\n */\n addDocument(input: WorkspaceDocumentInput): Promise<boolean>\n /**\n * Deletes a document from the workspace and all associated data.\n *\n * This method removes the document from the workspace along with all related data including:\n * - The document itself from the workspace documents map\n * - Original document data\n * - Intermediate document data (saved local versions)\n * - Document-specific configuration\n * - Document overrides\n * - Extra document configurations\n *\n * If the deleted document was the active document, the active document is automatically\n * reset to the first remaining document in the workspace, or undefined if no documents remain.\n *\n * The deletion is automatically tracked by the workspace change detection system,\n * and appropriate events will be fired to notify registered plugins.\n *\n * @param documentName - The name of the document to delete\n * @returns void\n *\n * @example\n * // Delete the document named 'api'\n * store.deleteDocument('api')\n *\n * @example\n * // Delete multiple documents\n * ['api', 'petstore'].forEach(name => store.deleteDocument(name))\n */\n deleteDocument(documentName: string): void\n /**\n * Returns the merged configuration for the active document.\n *\n * This getter merges configurations in the following order of precedence:\n * 1. Document-specific configuration (highest priority)\n * 2. Workspace-level configuration\n * 3. Default configuration (lowest priority)\n *\n * The active document is determined by the workspace's activeDocument extension,\n * falling back to the first document if none is specified.\n */\n readonly config: typeof defaultConfig\n /**\n * Returns the merged configuration for a specific document.\n *\n * This method merges configurations in the following order of precedence:\n * 1. Document-specific configuration (highest priority)\n * 2. Workspace-level configuration\n * 3. Default configuration (lowest priority)\n *\n * @param documentName - The name of the document to get the configuration for\n * @returns The merged configuration for the specified document\n */\n getDocumentConfiguration(documentName: string): typeof defaultConfig\n /**\n * Exports the specified document in the requested format.\n *\n * This method serializes the most recently saved local version of the document (from the intermediateDocuments map)\n * to either JSON or YAML. The exported document reflects the last locally saved state, including any edits\n * that have been saved but not yet synced to a remote registry. Runtime/in-memory changes that have not been saved\n * will not be included.\n *\n * @param documentName - The name of the document to export.\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The document as a string in the requested format, or undefined if the document does not exist.\n *\n * @example\n * // Export a document as JSON\n * const jsonString = store.exportDocument('api', 'json')\n *\n * // Export a document as YAML\n * const yamlString = store.exportDocument('api', 'yaml')\n */\n exportDocument(documentName: string, format: 'json' | 'yaml', minify?: boolean): string | undefined\n /**\n * Exports the currently active document in the requested format.\n *\n * This is a convenience method that exports the active document (determined by the workspace's\n * activeDocument extension) without requiring the caller to specify the document name.\n * The exported document reflects the last locally saved state, including any edits that have\n * been saved but not yet synced to a remote registry.\n *\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The active document as a string in the requested format, or undefined if no active document exists.\n *\n * @example\n * // Export the active document as JSON\n * const jsonString = store.exportActiveDocument('json')\n *\n * // Export the active document as YAML\n * const yamlString = store.exportActiveDocument('yaml')\n */\n exportActiveDocument(format: 'json' | 'yaml', minify?: boolean): string | undefined\n /**\n * Saves the current state of the specified document to the intermediate documents map.\n *\n * This function captures the latest (reactive) state of the document from the workspace and\n * applies its changes to the corresponding entry in the `intermediateDocuments` map.\n * The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n * which may include edits not yet synced to the remote registry.\n *\n * The update is performed in-place. A deep clone of the current document\n * state is used to avoid mutating the reactive object directly.\n *\n * @param documentName - The name of the document to save.\n * @returns An array of diffs that were excluded from being applied (such as changes to ignored keys),\n * or undefined if the document does not exist or cannot be updated.\n *\n * @example\n * // Save the current state of the document named 'api'\n * const excludedDiffs = store.saveDocument('api')\n */\n saveDocument(documentName: string): Promise<unknown[] | undefined>\n /**\n * Builds the sidebar for the specified document.\n *\n * @param documentName - The name of the document to build the sidebar for\n * @returns boolean indicating if the sidebar was built successfully\n */\n buildSidebar: (documentName: string) => boolean\n /**\n * Restores the specified document to its last locally saved state.\n *\n * This method updates the current reactive document (in the workspace) with the contents of the\n * corresponding intermediate document (from the `intermediateDocuments` map), effectively discarding\n * any unsaved in-memory changes and reverting to the last saved version.\n * Vue reactivity is preserved by updating the existing reactive object in place.\n *\n * **Warning:** This operation will discard all unsaved (in-memory) changes to the specified document.\n *\n * @param documentName - The name of the document to restore.\n * @returns void\n *\n * @example\n * // Restore the document named 'api' to its last saved state\n * store.revertDocumentChanges('api')\n */\n revertDocumentChanges(documentName: string): Promise<void>\n /**\n * Commits the specified document.\n *\n * This method is intended to finalize and persist the current state of the document,\n * potentially syncing it with a remote registry or marking it as the latest committed version.\n *\n * @param documentName - The name of the document to commit.\n * @remarks\n * The actual commit logic is not implemented yet.\n */\n commitDocument(documentName: string): void\n /**\n * Exports the complete current workspace state as a plain JavaScript object.\n *\n * The returned object includes all workspace documents (with Vue reactivity removed), workspace metadata,\n * document configurations, and both the original and intermediate document maps. This object can be\n * serialized (e.g., with JSON.stringify) and later imported to fully restore the workspace\u2014including\n * all documents, their configurations, metadata, and historical states.\n *\n * @returns An `InMemoryWorkspace` object representing the entire workspace state,\n * suitable for persistence, backup, or sharing.\n */\n exportWorkspace(): InMemoryWorkspace\n /**\n * Imports a workspace from a serialized JSON string.\n *\n * This method parses the input string using the InMemoryWorkspaceSchema,\n * then updates the current workspace state, including documents, metadata,\n * and configuration, with the imported values.\n *\n * @param input - The serialized workspace JSON string to import.\n */\n loadWorkspace(input: InMemoryWorkspace): void\n /**\n * Imports a workspace from a WorkspaceSpecification object.\n *\n * This method assigns workspace metadata and adds all documents defined in the specification.\n * Each document is added using its $ref and optional overrides.\n *\n * @example\n * ```ts\n * await store.importWorkspaceFromSpecification({\n * documents: {\n * api: { $ref: '/specs/api.yaml' },\n * petstore: { $ref: '/specs/petstore.yaml' }\n * },\n * overrides: {\n * api: { config: { features: { showModels: true } } }\n * },\n * info: { title: 'My Workspace' },\n * workspace: 'v1',\n * \"x-scalar-color-mode\": true\n * })\n * ```\n *\n * @param specification - The workspace specification to import.\n */\n importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<boolean[]>\n /**\n * Rebases a document in the workspace by refetching its origin and merging with local edits.\n *\n * This method fetches the latest version of the document (optionally with custom fetch/config),\n * calculates changes relative to the original and locally edited versions,\n * and attempts to update the workspace document while preserving user edits.\n * If automatic resolution isn't possible due to conflicts, returns a conflict list for the caller to resolve.\n * If `resolvedConflicts` are provided (e.g., after user intervention), applies them to complete the rebase.\n *\n * @param input Object specifying which document to rebase\n * @returns If there are unresolved conflicts, resolves to an object containing the list of conflicts and a method to apply user-resolved conflicts; otherwise resolves to void.\n *\n * @example\n * // Rebase a document and handle conflicts interactively\n * const result = await store.rebaseDocument({ name: 'api', fetch: customFetch });\n * if (result && result.ok) {\n * // Present conflicts to the user and collect resolutions...\n * await result.applyChanges(userResolvedConflicts);\n * }\n */\n rebaseDocument: (input: WorkspaceDocumentInput) => Promise<\n | { ok: false; type: 'CORRUPTED_STATE' | 'FETCH_FAILED' | 'NO_CHANGES_DETECTED'; message: string }\n | {\n ok: true\n conflicts: ReturnType<typeof merge>['conflicts']\n applyChanges: (resolvedConflicts: Difference<unknown>[]) => Promise<void>\n }\n >\n}\n\n/**\n * Creates a reactive workspace store that manages documents and their metadata.\n * The store provides functionality for accessing, updating, and resolving document references.\n *\n * @param workspaceProps - Configuration object for the workspace\n * @param workspaceProps.meta - Optional metadata for the workspace\n * @param workspaceProps.documents - Optional record of documents to initialize the workspace with\n * Documents that require asynchronous loading must be added using `addDocument` after the store is created\n * this allows atomic awaiting and does not block page load for the store initialization\n * @returns An object containing methods and getters for managing the workspace\n */\nexport const createWorkspaceStore = (workspaceProps?: WorkspaceProps): WorkspaceStore => {\n /**\n * Holds additional configuration options for each document in the workspace.\n *\n * This can include settings that can not be persisted between sessions (not JSON serializable)\n */\n const extraDocumentConfigurations: ExtraDocumentConfigurations = {}\n\n /**\n * Notifies all workspace plugins of a workspace state change event.\n *\n * This function iterates through all registered plugins (if any) and invokes\n * their onWorkspaceStateChanges hook with the given event object.\n *\n * @param event - The workspace state change event to broadcast to plugins\n */\n const fireWorkspaceChange = (event: WorkspaceStateChangeEvent) => {\n workspaceProps?.plugins?.forEach((plugin) => plugin.hooks?.onWorkspaceStateChanges?.(event))\n }\n\n /**\n * An object containing the reactive workspace state.\n *\n * Every change to the workspace, is tracked and broadcast to all registered plugins.\n * allowing for change tracking.\n *\n * NOTE:\n * The detect changes proxy is applied separately beacause the vue reactitvity proxy have to be the outer most proxy.\n * If the order is reversed, Vue cannot properly track mutations, leading to lost reactivity and bugs.\n * By wrapping the contents with the detect changes proxy first, and then passing the result to Vue's `reactive`,\n * we ensure that Vue manages its reactivity as expected and our change detection hooks\n * are also triggered reliably.\n * Do not reverse this order\u203C\uFE0F\n */\n const workspace = reactive<Workspace>(\n createDetectChangesProxy(\n {\n ...workspaceProps?.meta,\n documents: {},\n /**\n * Returns the currently active document from the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The active document or undefined if no document is found\n */\n get activeDocument(): NonNullable<Workspace['activeDocument']> | undefined {\n return workspace.documents[getActiveDocumentName()]\n },\n },\n {\n hooks: {\n onAfterChange(path) {\n const type = path[0]\n\n /** Document changes */\n if (type === 'documents') {\n // We are overriding the while documents object, ignore. This should not happen\n if (path.length < 2) {\n console.log('[WARN]: Overriding entire documents object is not supported')\n return\n }\n\n const documentName = path[1] as string\n const event = {\n type: 'documents',\n documentName,\n value: unpackProxyObject(\n workspace.documents[documentName] ?? {\n openapi: '3.1.0',\n info: { title: '', version: '' },\n 'x-scalar-original-document-hash': '',\n },\n ),\n } satisfies WorkspaceStateChangeEvent\n\n fireWorkspaceChange(event)\n return\n }\n\n /** Active document changes */\n if (type === 'activeDocument') {\n const documentName = getActiveDocumentName()\n // Active document changed\n const event = {\n type: 'documents',\n documentName,\n value: unpackProxyObject(\n workspace.documents[documentName] ?? {\n openapi: '3.1.0',\n info: { title: '', version: '' },\n 'x-scalar-original-document-hash': '',\n },\n ),\n } satisfies WorkspaceStateChangeEvent\n\n fireWorkspaceChange(event)\n return\n }\n\n /** Document meta changes */\n const { activeDocument: _a, documents: _d, ...meta } = workspace\n const event = {\n type: 'meta',\n value: unpackProxyObject(meta, { depth: 1 }),\n } satisfies WorkspaceStateChangeEvent\n\n fireWorkspaceChange(event)\n return\n },\n },\n },\n ),\n )\n\n /**\n * An object containing all the workspace state, wrapped in a detect changes proxy.\n *\n * Every change to the workspace state (documents, configs, metadata, etc.) can be detected here,\n * allowing for change tracking.\n */\n const { originalDocuments, intermediateDocuments, overrides, documentConfigs } = createDetectChangesProxy(\n {\n /**\n * Holds the original, unmodified documents as they were initially loaded into the workspace.\n * These documents are stored in their raw form\u2014prior to any reactive wrapping, dereferencing, or bundling.\n * This map preserves the pristine structure of each document, using deep clones to ensure that\n * subsequent mutations in the workspace do not affect the originals.\n * The originals are retained so that we can restore, compare, or sync with the remote registry as needed.\n */\n originalDocuments: {} as Record<string, UnknownObject>,\n /**\n * Stores the intermediate state of documents after local edits but before syncing with the remote registry.\n *\n * This map acts as a local \"saved\" version of the document, reflecting the user's changes after they hit \"save\".\n * The `originalDocuments` map, by contrast, always mirrors the document as it exists in the remote registry.\n *\n * Use this map to stage local changes that are ready to be propagated back to the remote registry.\n * This separation allows us to distinguish between:\n * - The last known remote version (`originalDocuments`)\n * - The latest locally saved version (`intermediateDocuments`)\n * - The current in-memory (possibly unsaved) workspace document (`workspace.documents`)\n */\n intermediateDocuments: {} as Record<string, UnknownObject>,\n /**\n * A map of document configurations keyed by document name.\n * This stores the configuration options for each document in the workspace,\n * allowing for document-specific settings like navigation options, appearance,\n * and other reference configuration.\n */\n documentConfigs: {} as Record<string, Config>,\n /**\n * Stores per-document overrides for OpenAPI documents.\n * This object is used to override specific fields of a document\n * when you cannot (or should not) modify the source document directly.\n * For example, this enables UI-driven or temporary changes to be applied\n * on top of the original document, without mutating the source.\n * The key is the document name, and the value is a deep partial\n * OpenAPI document representing the overridden fields.\n */\n overrides: {} as InMemoryWorkspace['overrides'],\n },\n {\n hooks: {\n onAfterChange(path) {\n const type = path[0]\n\n if (!type) {\n return\n }\n\n if (path.length < 2) {\n return\n }\n\n const documentName = path[1] as string\n if (type === 'originalDocuments') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(originalDocuments[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n\n if (type === 'intermediateDocuments') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(intermediateDocuments[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n\n if (type === 'documentConfigs') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(documentConfigs[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n\n if (type === 'overrides') {\n const event = {\n type,\n documentName: documentName,\n value: unpackProxyObject(overrides[documentName] ?? {}),\n } satisfies WorkspaceStateChangeEvent\n fireWorkspaceChange(event)\n }\n },\n },\n },\n )\n\n /**\n * Returns the name of the currently active document in the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The name of the active document or an empty string if no document is found\n */\n function getActiveDocumentName() {\n return workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? ''\n }\n\n function exportDocument(documentName: string, format: 'json' | 'yaml', minify?: boolean) {\n const intermediateDocument = intermediateDocuments[documentName]\n\n if (!intermediateDocument) {\n return\n }\n\n if (format === 'json') {\n return minify ? JSON.stringify(intermediateDocument) : JSON.stringify(intermediateDocument, null, 2)\n }\n\n return YAML.stringify(intermediateDocument)\n }\n\n // Save the current state of the specified document to the intermediate documents map.\n // This function captures the latest (reactive) state of the document from the workspace and\n // applies its changes to the corresponding entry in the `intermediateDocuments` map.\n // The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n // which may include edits not yet synced to the remote registry.\n async function saveDocument(documentName: string) {\n const intermediateDocument = intermediateDocuments[documentName]\n const workspaceDocument = workspace.documents[documentName]\n\n if (!workspaceDocument) {\n return\n }\n\n // Obtain the raw state of the current document to ensure accurate diffing\n const updatedDocument = getRaw(workspaceDocument)\n\n // If either the intermediate or updated document is missing, do nothing\n if (!intermediateDocument || !updatedDocument) {\n return\n }\n\n // Traverse the document and convert refs back to the original shape\n const updatedWithOriginalRefs = await bundle(deepClone(updatedDocument), {\n plugins: [restoreOriginalRefs()],\n treeShake: false,\n urlMap: true,\n })\n\n // Apply changes from the current document to the intermediate document in place\n const excludedDiffs = applySelectiveUpdates(intermediateDocument, updatedWithOriginalRefs as UnknownObject)\n return excludedDiffs\n }\n\n const processDocument = (input: OpenApiDocument, options: Config & { documentSource?: string }): OpenApiDocument => {\n // Get the servers from the document or the config and perform some mutations on them\n const servers = getServersFromDocument(options['x-scalar-reference-config']?.settings?.servers ?? input.servers, {\n baseServerUrl: options['x-scalar-reference-config']?.settings?.baseServerUrl,\n documentUrl: options.documentSource,\n })\n\n if (servers.length) {\n input.servers = servers.map((it) => ({ url: it.url, description: it.description, variables: it.variables }))\n }\n\n return input\n }\n\n // Add a document to the store synchronously from an in-memory OpenAPI document\n async function addInMemoryDocument(\n input: ObjectDoc & { initialize?: boolean; documentSource?: string; documentHash: string },\n ) {\n const { name, meta } = input\n const clonedRawInputDocument = measureSync('deepClone', () => deepClone(input.document))\n\n measureSync('initialize', () => {\n if (input.initialize !== false) {\n // Store the original document in the originalDocuments map\n // This is used to track the original state of the document as it was loaded into the workspace\n originalDocuments[name] = deepClone(clonedRawInputDocument)\n\n // Store the intermediate document state for local edits\n // This is used to track the last saved state of the document\n // It allows us to differentiate between the original document and the latest saved version\n // This is important for local edits that are not yet synced with the remote registry\n // The intermediate document is used to store the latest saved state of the document\n // This allows us to track changes and revert to the last saved state if needed\n intermediateDocuments[name] = deepClone(clonedRawInputDocument)\n // Add the document config to the documentConfigs map\n documentConfigs[name] = input.config ?? {}\n // Store the overrides for this document, or an empty object if none are provided\n overrides[name] = input.overrides ?? {}\n // Store extra document configurations that can not be persisted\n extraDocumentConfigurations[name] = { fetch: input.fetch }\n }\n })\n\n const inputDocument = measureSync('upgrade', () => upgrade(deepClone(clonedRawInputDocument), '3.1'))\n\n const strictDocument: UnknownObject = createMagicProxy(\n {\n ...inputDocument,\n ...meta,\n 'x-original-oas-version': originalDocuments[name]?.openapi ?? originalDocuments[name]?.swagger,\n 'x-scalar-original-document-hash': input.documentHash,\n 'x-scalar-original-source-url': input.documentSource,\n },\n { showInternal: true },\n )\n\n if (strictDocument[extensions.document.navigation] === undefined) {\n // If the document navigation is not already present, bundle the entire document to resolve all references.\n // This typically applies when the document is not preprocessed by the server and needs local reference resolution.\n // We need to bundle document first before we validate, so we can also validate the external references\n await measureAsync(\n 'bundle',\n async () =>\n await bundle(getRaw(strictDocument), {\n treeShake: false,\n plugins: [\n fetchUrls({\n fetch: extraDocumentConfigurations[name]?.fetch ?? workspaceProps?.fetch,\n }),\n externalValueResolver(),\n refsEverywhere(),\n ],\n urlMap: true,\n origin: input.documentSource, // use the document origin (if provided) as the base URL for resolution\n }),\n )\n\n // We coerce the values only when the document is not preprocessed by the server-side-store\n const coerced = measureSync('coerceValue', () =>\n coerceValue(OpenAPIDocumentSchemaStrict, deepClone(strictDocument)),\n )\n measureSync('mergeObjects', () => mergeObjects(strictDocument, coerced))\n }\n\n const isValid = Value.Check(OpenAPIDocumentSchemaStrict, strictDocument)\n\n if (!isValid) {\n const validationErrors = Array.from(Value.Errors(OpenAPIDocumentSchemaStrict, strictDocument))\n\n console.warn('document validation errors: ')\n console.warn(\n validationErrors.map((error) => ({\n message: error.message,\n path: error.path,\n schema: error.schema,\n value: error.value,\n })),\n )\n }\n\n // Skip navigation generation if the document already has a server-side generated navigation structure\n if (strictDocument[extensions.document.navigation] === undefined) {\n const navigation = createNavigation(name, strictDocument as OpenApiDocument, input.config)\n\n strictDocument[extensions.document.navigation] = navigation\n\n // Do some document processing\n processDocument(getRaw(strictDocument as OpenApiDocument), {\n ...(documentConfigs[name] ?? {}),\n documentSource: input.documentSource,\n })\n }\n\n // Create a proxied document with magic proxy and apply any overrides, then store it in the workspace documents map\n // We create a new proxy here in order to hide internal properties after validation and processing\n // This ensures that the workspace document only exposes the intended OpenAPI properties and extensions\n workspace.documents[name] = createOverridesProxy(createMagicProxy(getRaw(strictDocument)) as OpenApiDocument, {\n overrides: overrides[name],\n })\n }\n\n // Asynchronously adds a new document to the workspace by loading and validating the input.\n // If loading fails, a placeholder error document is added instead.\n async function addDocument(input: WorkspaceDocumentInput) {\n const { name, meta } = input\n\n const resolve = await measureAsync(\n 'loadDocument',\n async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch }),\n )\n\n // Log the time taken to add a document\n return await measureAsync('addDocument', async () => {\n if (!resolve.ok) {\n console.error(`Failed to fetch document '${name}': request was not successful`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n 'x-scalar-original-document-hash': 'not-a-hash',\n }\n\n return false\n }\n\n if (!isObject(resolve.data)) {\n console.error(`Failed to load document '${name}': response data is not a valid object`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n 'x-scalar-original-document-hash': 'not-a-hash',\n }\n\n return false\n }\n\n await addInMemoryDocument({\n ...input,\n document: resolve.data,\n documentSource: getDocumentSource(input),\n documentHash: generateHash(resolve.raw),\n })\n\n return true\n })\n }\n\n /**\n * Builds (or updates) the navigation sidebar for the specified document.\n *\n * This method generates the sidebar navigation structure for a workspace document,\n * and attaches it to the document's metadata under the navigation extension key.\n * The document is unpacked to avoid assigning proxy objects as direct property references.\n *\n * - Only the top-level object is proxied; all child objects should be unproxied.\n * - This approach enables safe unpacking of the proxy object without recursively traversing the full object tree.\n *\n * @param documentName - The name/key of the document whose sidebar should be built.\n * @returns {boolean} True if the sidebar was built successfully, false if the document does not exist.\n */\n const buildSidebar = (documentName: string): boolean => {\n const document = workspace.documents[documentName]\n\n if (!document) {\n // Log and exit if the document does not exist in the workspace\n console.error(`Document '${documentName}' does not exist in the workspace.`)\n return false\n }\n\n // Generate the navigation structure for the sidebar.\n const navigation = createNavigation(documentName, document, getDocumentConfiguration(documentName))\n\n // Set the computed navigation structure on the document metadata.\n document[extensions.document.navigation] = navigation\n\n return true\n }\n\n // Returns the effective document configuration for a given document name,\n // merging (in order of increasing priority): the default config, workspace-level config, and document-specific config.\n const getDocumentConfiguration = (name: string) => {\n return mergeObjects<typeof defaultConfig>(\n mergeObjects(deepClone(defaultConfig), workspaceProps?.config ?? {}),\n documentConfigs[name] ?? {},\n )\n }\n\n // Cache to track visited nodes during reference resolution to prevent bundling the same subtree multiple times\n // This is needed because we are doing partial bundle operations\n const visitedNodesCache = new Set()\n\n return {\n get workspace() {\n return workspace\n },\n update(key, value) {\n preventPollution(key)\n Object.assign(workspace, { [key]: value })\n },\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ) {\n const currentDocument = workspace.documents[name === 'active' ? getActiveDocumentName() : name]\n\n if (!currentDocument) {\n throw 'Please select a valid document'\n }\n\n preventPollution(key)\n Object.assign(currentDocument, { [key]: value })\n },\n async replaceDocument(documentName: string, input: Record<string, unknown>) {\n const currentDocument = workspace.documents[documentName]\n\n if (!currentDocument) {\n return console.error(`Document '${documentName}' does not exist in the workspace.`)\n }\n\n // Replace the whole document\n await addInMemoryDocument({\n name: documentName,\n document: input,\n // Preserve the current metadata\n documentSource: currentDocument['x-scalar-original-source-url'],\n documentHash: currentDocument['x-scalar-original-document-hash'],\n meta: {\n 'x-scalar-active-auth': currentDocument['x-scalar-active-auth'],\n 'x-scalar-active-server': currentDocument['x-scalar-active-server'],\n },\n initialize: false,\n })\n },\n resolve: (path) => {\n const activeDocument = workspace.activeDocument\n\n const target = getValueByPath(activeDocument, path)\n\n if (!isObject(target)) {\n console.error(\n `Invalid path provided for resolution. Path: [${path.join(', ')}]. Found value of type: ${typeof target}. Expected an object.`,\n )\n return Promise.resolve()\n }\n\n // Bundle the target document with the active document as root, resolving any external references\n // and tracking resolution status through hooks\n return bundle(target, {\n root: activeDocument,\n treeShake: false,\n plugins: [fetchUrls(), loadingStatus(), externalValueResolver()],\n urlMap: true,\n visitedNodes: visitedNodesCache,\n })\n },\n addDocument,\n /**\n * Deletes a document from the workspace and all associated data.\n *\n * This function removes the document and all related data structures.\n * If the deleted document was active, it automatically selects the first remaining document.\n */\n deleteDocument: (documentName: string): void => {\n // Check if the document exists before attempting deletion\n if (!workspace.documents[documentName]) {\n return\n }\n\n // Delete the document from the workspace (this will trigger change detection events)\n delete workspace.documents[documentName]\n\n // Clean up all associated data structures\n delete originalDocuments[documentName]\n delete intermediateDocuments[documentName]\n delete documentConfigs[documentName]\n delete overrides[documentName]\n delete extraDocumentConfigurations[documentName]\n\n // Get remaining documents before deletion to properly set the active document\n const remainingDocuments = Object.keys(workspace.documents)\n const wasActiveDocument = workspace['x-scalar-active-document'] === documentName\n\n // Reset the active document to the first remaining one if the deleted document was the active one\n if (wasActiveDocument) {\n workspace['x-scalar-active-document'] = remainingDocuments[0] ?? undefined\n }\n\n // Fire the deleteDocument event\n fireWorkspaceChange({\n type: 'deleteDocument',\n documentName,\n })\n },\n get config() {\n return getDocumentConfiguration(getActiveDocumentName())\n },\n getDocumentConfiguration,\n exportDocument,\n exportActiveDocument: (format, minify) => exportDocument(getActiveDocumentName(), format, minify),\n buildSidebar,\n saveDocument,\n async revertDocumentChanges(documentName: string) {\n const workspaceDocument = workspace.documents[documentName]\n const intermediate = intermediateDocuments[documentName]\n\n if (!workspaceDocument || !intermediate) {\n return\n }\n\n await addInMemoryDocument({\n name: documentName,\n document: intermediate,\n documentSource: workspaceDocument['x-scalar-original-source-url'],\n documentHash: workspaceDocument['x-scalar-original-document-hash'],\n initialize: false,\n })\n },\n commitDocument(documentName: string) {\n // TODO: Implement commit logic\n console.warn(`Commit operation for document '${documentName}' is not implemented yet.`)\n },\n exportWorkspace() {\n const { activeDocument: _, documents, ...meta } = unpackProxyObject(workspace)\n return {\n documents: {\n ...Object.fromEntries(\n Object.entries(documents).map(([name, doc]) => [\n name,\n // Get the raw document without any proxies\n unpackProxyObject(doc),\n ]),\n ),\n },\n meta: unpackProxyObject(meta) ?? {},\n documentConfigs: unpackProxyObject(documentConfigs),\n originalDocuments: unpackProxyObject(originalDocuments),\n intermediateDocuments: unpackProxyObject(intermediateDocuments),\n overrides: unpackProxyObject(overrides),\n } satisfies InMemoryWorkspace\n },\n loadWorkspace(input: InMemoryWorkspace) {\n safeAssign(\n workspace.documents,\n Object.fromEntries(\n Object.entries(input.documents).map(([name, doc]) => [\n name,\n createOverridesProxy(createMagicProxy(doc), {\n overrides: input.overrides[name],\n }),\n ]),\n ),\n )\n\n safeAssign(originalDocuments, input.originalDocuments)\n safeAssign(intermediateDocuments, input.intermediateDocuments)\n safeAssign(documentConfigs, input.documentConfigs as Record<string, Config>)\n safeAssign(overrides, input.overrides)\n safeAssign(workspace, input.meta)\n },\n importWorkspaceFromSpecification: (specification: WorkspaceSpecification) => {\n const { documents, overrides, info: _info, workspace: _workspaceVersion, ...meta } = specification\n\n // Assign workspace metadata\n safeAssign(workspace, meta)\n\n // Add workspace documents\n return Promise.all(\n Object.entries(documents ?? {}).map(([name, doc]) =>\n addDocument({ url: doc.$ref, name, overrides: overrides?.[name] }),\n ),\n )\n },\n rebaseDocument: async (input: WorkspaceDocumentInput) => {\n const { name } = input\n\n // ---- Get the current documents\n const originalDocument = originalDocuments[name]\n const intermediateDocument = intermediateDocuments[name]\n // raw version without any proxies\n const activeDocument = workspace.documents[name]\n ? toRaw(getRaw(unpackOverridesProxy(workspace.documents[name])))\n : undefined\n\n if (!originalDocument || !intermediateDocument || !activeDocument) {\n // If any required document state is missing, do nothing\n return {\n ok: false,\n type: 'CORRUPTED_STATE' as const,\n message: `Cannot rebase document '${name}': missing original, intermediate, or active document state`,\n }\n }\n\n // ---- Resolve input document\n const resolve = await measureAsync(\n 'loadDocument',\n async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch }),\n )\n\n if (!resolve.ok || !isObject(resolve.data)) {\n return {\n ok: false,\n type: 'FETCH_FAILED' as const,\n message: `Failed to fetch document '${name}': request was not successful or returned invalid data`,\n }\n }\n\n // Compare document hashes to see if the document has changed\n // When the hashes match, we can skip the rebase process\n const newHash = generateHash(resolve.raw)\n if (activeDocument['x-scalar-original-document-hash'] === newHash) {\n return {\n ok: false,\n type: 'NO_CHANGES_DETECTED' as const,\n message: `No changes detected for document '${name}': document hash matches the active document`,\n }\n }\n\n const newDocumentOrigin = resolve.data\n\n // ---- Override the configurations and metadata\n documentConfigs[name] = input.config ?? {}\n overrides[name] = input.overrides ?? {}\n extraDocumentConfigurations[name] = { fetch: input.fetch }\n\n // ---- Get the new intermediate document\n const changelogAA = diff(originalDocument, newDocumentOrigin)\n\n // When there are no changes, we can return early since we don't need to do anything\n // This is not supposed to happen due to the hash check above, but just in case\n if (changelogAA.length === 0) {\n return {\n ok: false,\n type: 'NO_CHANGES_DETECTED' as const,\n message: `No changes detected for document '${name}' after fetching the latest version.`,\n }\n }\n\n const changelogAB = diff(originalDocument, intermediateDocument)\n\n const changesA = merge(changelogAA, changelogAB)\n\n return {\n ok: true,\n conflicts: changesA.conflicts,\n applyChanges: async (resolvedConflicts: Difference<unknown>[]) => {\n const changesetA = changesA.diffs.concat(resolvedConflicts)\n\n // Apply the changes to the original document to get the new intermediate\n const newIntermediateDocument = apply(deepClone(originalDocument), changesetA)\n intermediateDocuments[name] = newIntermediateDocument\n\n // Update the original document\n originalDocuments[name] = newDocumentOrigin\n\n // ---- Get the new active document\n const changelogBA = diff(intermediateDocument, newIntermediateDocument)\n const changelogBB = diff(intermediateDocument, activeDocument)\n\n const changesB = merge(changelogBA, changelogBB)\n\n // Auto-conflict resolution: pick only the changes from the first changeset\n // TODO: In the future, implement smarter conflict resolution if needed\n const changesetB = changesB.diffs.concat(changesB.conflicts.flatMap((it) => it[0]))\n\n const newActiveDocument = coerceValue(\n OpenAPIDocumentSchemaStrict,\n apply(deepClone(newIntermediateDocument), changesetB),\n )\n\n // add the new active document to the workspace but don't re-initialize\n await addInMemoryDocument({\n ...input,\n document: {\n ...newActiveDocument,\n // force regeneration of navigation\n // when we are rebasing, we want to ensure that the navigation is always up to date\n [extensions.document.navigation]: undefined,\n },\n documentSource: getDocumentSource(input),\n // Update the original document hash\n documentHash: generateHash(resolve.raw),\n initialize: false,\n })\n },\n }\n },\n }\n}\n\n// biome-ignore lint/performance/noBarrelFile: It's a package entry point\nexport { generateClientMutators } from '@/mutators'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc,mBAAmB;AAC1C,SAA4B,cAAc;AAC1C,SAAS,iBAAiB;AAC1B,SAA0B,OAAO,MAAM,aAAa;AACpD,SAAS,kBAAkB,cAAc;AACzC,SAAS,eAAe;AAExB,SAAS,aAAa;AAEtB,SAAS,UAAU,aAAa;AAChC,OAAO,UAAU;AAEjB,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAC1B,SAAS,gCAAgC;AACzC,SAA6B,UAAU,kBAAkB;AACzD,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB,eAAe,gBAAgB,2BAA2B;AAC1F,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,mBAAmB;AAC5B;AAAA,EACE,yBAAyB;AAAA,OAEpB;AAaP,MAAM,gBAAsC;AAAA,EAC1C,6BAA6B;AAC/B;AA6DA,SAAS,aAAa,mBAA6E;AACjG,MAAI,SAAS,mBAAmB;AAC9B,WAAO,UAAU,EAAE,OAAO,kBAAkB,MAAM,CAAC,EAAE,KAAK,kBAAkB,GAAG;AAAA,EACjF;AAEA,SAAO,QAAQ,QAAQ;AAAA,IACrB,IA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KAAK;AAAA;AAAA,YAEvC,cAAc,aAAa,QAAQ,GAAG;AAAA,YACtC,YAAY;AAAA,UACd,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAGA,SAAS,8BAA8B;",
|
|
6
6
|
"names": ["event", "overrides"]
|
|
7
7
|
}
|
package/dist/events/bus.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export type WorkspaceEventBus = {
|
|
|
71
71
|
/**
|
|
72
72
|
* Options for creating an event bus
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
type EventBusOptions = {
|
|
75
75
|
/**
|
|
76
76
|
* Enable debug mode to log all events and listener operations
|
|
77
77
|
* Useful for development and troubleshooting
|
package/dist/events/bus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bus.d.ts","sourceRoot":"","sources":["../../src/events/bus.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,KAAK,WAAW,GAAG,MAAM,IAAI,CAAA;AAE7B;;;GAGG;AACH,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,SAAS,SAAS,kBAAkB,CAAC,CAAC,CAAC,GAC5F,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,GACzC,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;AAE5C;;;;;;GAMG;AACH,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,kBAAkB,IAAI,SAAS,SAAS,kBAAkB,CAAC,CAAC,CAAC,GAC7F,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC1G,CAAC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|
-
"sourcesContent": ["import { debounce } from '@scalar/helpers/general/debounce'\n\nimport { unpackProxyObject } from '@/helpers/unpack-proxy'\n\nimport type { ApiReferenceEvents } from './definitions'\n\ntype Unsubscribe = () => void\n\n/**\n * Helper type for event listeners that makes the payload optional\n * if the event allows undefined, otherwise requires it.\n */\ntype EventListener<E extends keyof ApiReferenceEvents> = undefined extends ApiReferenceEvents[E]\n ? (payload?: ApiReferenceEvents[E]) => void\n : (payload: ApiReferenceEvents[E]) => void\n\n/**\n * Helper type for emit parameters that uses rest parameters\n * for a cleaner API surface.\n *\n * @example\n * bus.emit('scalar-update-sidebar', { value: true }, { debounceKey: 'test' })\n */\ntype EmitParameters<E extends keyof ApiReferenceEvents> = undefined extends ApiReferenceEvents[E]\n ? [event: E, payload?: ApiReferenceEvents[E], options?: { skipUnpackProxy?: boolean; debounceKey?: string }]\n : [event: E, payload: ApiReferenceEvents[E], options?: { skipUnpackProxy?: boolean; debounceKey?: string }]\n\n/**\n * Type-safe event bus for workspace events\n *\n * - Full type safety for event names and payloads\n * - Debug mode for development\n */\nexport type WorkspaceEventBus = {\n /**\n * Subscribe to an event\n *\n * @param event - The event name to listen for\n * @param listener - Callback function that receives the event detail\n * @returns Unsubscribe function to remove the listener\n *\n * @example\n * const unsubscribe = bus.on('scalar-update-sidebar', (detail) => {\n * console.log('Sidebar state:', detail.value)\n * })\n *\n * // Later, clean up\n * unsubscribe()\n */\n on<E extends keyof ApiReferenceEvents>(event: E, listener: EventListener<E>): Unsubscribe\n\n /**\n * Remove a specific event listener\n *\n * @param event - The event name\n * @param listener - The listener function to remove\n *\n * @example\n * const handler = (detail) => console.log(detail)\n * bus.on('scalar-update-sidebar', handler)\n * bus.off('scalar-update-sidebar', handler)\n */\n off<E extends keyof ApiReferenceEvents>(event: E, listener: EventListener<E>): void\n\n /**\n * Emit an event with its payload\n *\n * @param event - The event name to emit\n * @param payload - The event detail payload (optional if event allows undefined)\n * @param options.skipUnpackProxy - Whether to skip unpacking the proxy object,\n * useful if we are sure there is no proxy OR when passing js events like keyboard events.\n * @param options.debounceKey - If present we will debounce the event by the key + event name.\n *\n * @example\n * bus.emit('scalar-update-sidebar', { value: true })\n */\n emit<E extends keyof ApiReferenceEvents>(...args: EmitParameters<E>): void\n}\n\n/**\n * Options for creating an event bus\n */\
|
|
4
|
+
"sourcesContent": ["import { debounce } from '@scalar/helpers/general/debounce'\n\nimport { unpackProxyObject } from '@/helpers/unpack-proxy'\n\nimport type { ApiReferenceEvents } from './definitions'\n\ntype Unsubscribe = () => void\n\n/**\n * Helper type for event listeners that makes the payload optional\n * if the event allows undefined, otherwise requires it.\n */\ntype EventListener<E extends keyof ApiReferenceEvents> = undefined extends ApiReferenceEvents[E]\n ? (payload?: ApiReferenceEvents[E]) => void\n : (payload: ApiReferenceEvents[E]) => void\n\n/**\n * Helper type for emit parameters that uses rest parameters\n * for a cleaner API surface.\n *\n * @example\n * bus.emit('scalar-update-sidebar', { value: true }, { debounceKey: 'test' })\n */\ntype EmitParameters<E extends keyof ApiReferenceEvents> = undefined extends ApiReferenceEvents[E]\n ? [event: E, payload?: ApiReferenceEvents[E], options?: { skipUnpackProxy?: boolean; debounceKey?: string }]\n : [event: E, payload: ApiReferenceEvents[E], options?: { skipUnpackProxy?: boolean; debounceKey?: string }]\n\n/**\n * Type-safe event bus for workspace events\n *\n * - Full type safety for event names and payloads\n * - Debug mode for development\n */\nexport type WorkspaceEventBus = {\n /**\n * Subscribe to an event\n *\n * @param event - The event name to listen for\n * @param listener - Callback function that receives the event detail\n * @returns Unsubscribe function to remove the listener\n *\n * @example\n * const unsubscribe = bus.on('scalar-update-sidebar', (detail) => {\n * console.log('Sidebar state:', detail.value)\n * })\n *\n * // Later, clean up\n * unsubscribe()\n */\n on<E extends keyof ApiReferenceEvents>(event: E, listener: EventListener<E>): Unsubscribe\n\n /**\n * Remove a specific event listener\n *\n * @param event - The event name\n * @param listener - The listener function to remove\n *\n * @example\n * const handler = (detail) => console.log(detail)\n * bus.on('scalar-update-sidebar', handler)\n * bus.off('scalar-update-sidebar', handler)\n */\n off<E extends keyof ApiReferenceEvents>(event: E, listener: EventListener<E>): void\n\n /**\n * Emit an event with its payload\n *\n * @param event - The event name to emit\n * @param payload - The event detail payload (optional if event allows undefined)\n * @param options.skipUnpackProxy - Whether to skip unpacking the proxy object,\n * useful if we are sure there is no proxy OR when passing js events like keyboard events.\n * @param options.debounceKey - If present we will debounce the event by the key + event name.\n *\n * @example\n * bus.emit('scalar-update-sidebar', { value: true })\n */\n emit<E extends keyof ApiReferenceEvents>(...args: EmitParameters<E>): void\n}\n\n/**\n * Options for creating an event bus\n */\ntype EventBusOptions = {\n /**\n * Enable debug mode to log all events and listener operations\n * Useful for development and troubleshooting\n */\n debug?: boolean\n}\n\n/**\n * Creates a type-safe event bus for workspace events\n *\n * This implementation uses a Map for O(1) lookups and maintains\n * a separate Set for each event type to efficiently manage listeners.\n *\n * Create this once per application instance.\n *\n * @param options - Configuration options\n * @returns A fully type-safe event bus instance\n *\n * @example\n * const bus = createWorkspaceEventBus()\n *\n * // Subscribe to events\n * const unsubscribe = bus.on('scalar-update-sidebar', (detail) => {\n * console.log('Sidebar:', detail.value)\n * })\n *\n * // Emit events\n * bus.emit('scalar-update-sidebar', { value: true })\n *\n * // Clean up\n * unsubscribe()\n */\nexport const createWorkspaceEventBus = (options: EventBusOptions = {}): WorkspaceEventBus => {\n const { debug = false } = options\n\n /**\n * Map of event names to their listener sets\n * Using Map for O(1) lookups and Set for O(1) add/remove operations\n */\n type ListenerSet = Set<EventListener<keyof ApiReferenceEvents>>\n const events = new Map<keyof ApiReferenceEvents, ListenerSet>()\n\n /**\n * Track pending log entries for batching\n */\n type PendingLogEntry = { message: string; args: unknown[] }\n const pendingLogs: PendingLogEntry[] = []\n let logTimeout: ReturnType<typeof setTimeout> | null = null\n\n /**\n * Single debounce instance for all debounced emits\n * Uses keys to separate different event + debounceKey combinations\n */\n const { execute: debouncedEmitter } = debounce({ delay: 328 })\n\n /**\n * Get or create a listener set for an event\n */\n const getListeners = <E extends keyof ApiReferenceEvents>(event: E): ListenerSet => {\n const listeners = events.get(event) ?? new Set()\n events.set(event, listeners)\n return listeners\n }\n\n /**\n * Flush batched logs using console.groupCollapsed\n */\n const flushLogs = (): void => {\n if (pendingLogs.length === 0) {\n return\n }\n\n if (debug) {\n if (pendingLogs.length === 1) {\n // Only one log, output it normally without grouping\n const firstLog = pendingLogs[0]\n if (firstLog) {\n console.log(`[EventBus] ${firstLog.message}`, ...firstLog.args)\n }\n } else {\n // Multiple logs, use a collapsed group\n console.groupCollapsed(`[EventBus] ${pendingLogs.length} operations`)\n for (const { message, args } of pendingLogs) {\n console.log(message, ...args)\n }\n console.groupEnd()\n }\n }\n\n pendingLogs.length = 0\n logTimeout = null\n }\n\n /**\n * Log debug information if debug mode is enabled\n * Batches multiple logs together using console.groupCollapsed\n */\n const log = (message: string, ...args: unknown[]): void => {\n if (debug) {\n pendingLogs.push({ message, args })\n\n // Clear existing timeout and set a new one to batch logs\n if (logTimeout) {\n clearTimeout(logTimeout)\n }\n logTimeout = setTimeout(flushLogs, 500)\n }\n }\n\n const on = <E extends keyof ApiReferenceEvents>(event: E, listener: EventListener<E>): Unsubscribe => {\n const listeners = getListeners(event)\n listeners.add(listener as EventListener<keyof ApiReferenceEvents>)\n log(`Added listener for \"${String(event)}\" (${listeners.size} total)`)\n\n return () => off(event, listener)\n }\n\n const off = <E extends keyof ApiReferenceEvents>(event: E, listener: EventListener<E>): void => {\n const listeners = events.get(event)\n if (!listeners) {\n return\n }\n\n listeners.delete(listener as EventListener<keyof ApiReferenceEvents>)\n log(`Removed listener for \"${String(event)}\" (${listeners.size} remaining)`)\n\n // Clean up empty listener sets to avoid memory leaks\n if (listeners.size === 0) {\n events.delete(event)\n }\n }\n\n /**\n * Internal function that performs the actual emission logic\n * This is extracted so it can be wrapped with debouncing\n */\n const performEmit = <E extends keyof ApiReferenceEvents>(\n event: E,\n payload: ApiReferenceEvents[E] | undefined,\n options?: { skipUnpackProxy?: boolean },\n ): void => {\n // We unpack the payload here to ensure that, within mutators, we are not assigning proxies directly,\n // but are always assigning plain objects 5 level depth.\n const unpackedPayload = options?.skipUnpackProxy ? payload : unpackProxyObject(payload, { depth: 5 })\n\n const listeners = events.get(event)\n\n if (!listeners || listeners.size === 0) {\n log(`\uD83D\uDED1 No listeners for \"${String(event)}\"`)\n return\n }\n\n log(`Emitting \"${String(event)}\" to ${listeners.size} listener(s)`, payload)\n\n // Convert to array to avoid issues if listeners modify the set during iteration\n const listenersArray = Array.from(listeners)\n\n // Execute all listeners\n for (const listener of listenersArray) {\n try {\n listener(unpackedPayload)\n } catch (error) {\n // Do not let one listener error break other listeners\n console.error(`[EventBus] Error in listener for \"${String(event)}\":`, error)\n }\n }\n }\n\n const emit = <E extends keyof ApiReferenceEvents>(...args: EmitParameters<E>): void => {\n const [event, payload, options] = args\n\n // If no debounce key is provided, emit immediately\n if (!options?.debounceKey) {\n performEmit(event, payload, options)\n return\n }\n\n // Create a unique key for this event + debounce key combination\n const debounceMapKey = `${event}-${options.debounceKey}`\n\n // Pass the closure directly - debounce will store the latest version\n debouncedEmitter(debounceMapKey, () => performEmit(event, payload, options))\n }\n\n return {\n on,\n off,\n emit,\n }\n}\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AAiH3B,MAAM,0BAA0B,CAAC,UAA2B,CAAC,MAAyB;AAC3F,QAAM,EAAE,QAAQ,MAAM,IAAI;AAO1B,QAAM,SAAS,oBAAI,IAA2C;AAM9D,QAAM,cAAiC,CAAC;AACxC,MAAI,aAAmD;AAMvD,QAAM,EAAE,SAAS,iBAAiB,IAAI,SAAS,EAAE,OAAO,IAAI,CAAC;AAK7D,QAAM,eAAe,CAAqC,UAA0B;AAClF,UAAM,YAAY,OAAO,IAAI,KAAK,KAAK,oBAAI,IAAI;AAC/C,WAAO,IAAI,OAAO,SAAS;AAC3B,WAAO;AAAA,EACT;AAKA,QAAM,YAAY,MA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UAAU,kBAAkB,SAAS,EAAE,OAAO,EAAE,CAAC;AAEpG,UAAM,YAAY,OAAO,IAAI,KAAK;AAElC,QAAI,CAAC,aAAa,UAAU,SAAS,GAAG;AACtC,UAAI,+BAAwB,OAAO,KAAK,CAAC,GAAG;AAC5C;AAAA,IACF;AAEA,QAAI,aAAa,OAAO,KAAK,CAAC,QAAQ,UAAU,IAAI,gBAAgB,OAAO;AAG3E,UAAM,iBAAiB,MAAM,KAAK,SAAS;AAG3C,eAAW,YAAY,gBAAgB;AACrC,UAAI;AACF,iBAAS,eAAe;AAAA,MAC1B,SAAS,OAAO;AAEd,gBAAQ,MAAM,qCAAqC,OAAO,KAAK,CAAC,MAAM,KAAK;AAAA,MAC7E;AAAA,IACF;AAAA,EACF;AAEA,QAAM,OAAO,IAAwC,SAAkC;AACrF,UAAM,CAAC,OAAO,SAASA,QAAO,IAAI;AAGlC,QAAI,CAACA,UAAS,aAAa;AACzB,kBAAY,OAAO,SAASA,QAAO;AACnC;AAAA,IACF;AAGA,UAAM,iBAAiB,GAAG,KAAK,IAAIA,SAAQ,WAAW;AAGtD,qBAAiB,gBAAgB,MAAM,YAAY,OAAO,SAASA,QAAO,CAAC;AAAA,EAC7E;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["options"]
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ import type { ApiKeyObject, HttpObject, OAuth2Object } from '../../schemas/v3.1/
|
|
|
11
11
|
* - `oauth2`: Updates to OAuth2 type schemes for each supported OAuth2 flow.
|
|
12
12
|
* - Can set various properties such as auth/token URLs, tokens, PKCE method, client credentials, etc.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
type SecuritySchemeUpdatePayload = ({
|
|
15
15
|
type: 'http';
|
|
16
16
|
} & Partial<Omit<HttpObject, 'type'>>) | ({
|
|
17
17
|
type: 'apiKey';
|
|
@@ -90,4 +90,5 @@ export type AuthEvents = {
|
|
|
90
90
|
names: string[];
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
+
export {};
|
|
93
94
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAEnG;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAEnG;;;;;;;;GAQG;AACH,KAAK,2BAA2B,GAC5B,CAAC;IACC,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,GACtC,CAAC;IACC,IAAI,EAAE,QAAQ,CAAA;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,GACxC,CAAC;IACC,IAAI,EAAE,QAAQ,CAAA;CACf,GAAG,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAA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