@scalar/workspace-store 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +86 -1
- package/dist/client.d.ts +46 -45152
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +173 -14
- package/dist/client.js.map +2 -2
- package/dist/helpers/apply-selective-updates.d.ts +17 -0
- package/dist/helpers/apply-selective-updates.d.ts.map +1 -0
- package/dist/helpers/apply-selective-updates.js +13 -0
- package/dist/helpers/apply-selective-updates.js.map +7 -0
- package/dist/helpers/general.d.ts +58 -0
- package/dist/helpers/general.d.ts.map +1 -1
- package/dist/helpers/general.js +18 -1
- package/dist/helpers/general.js.map +2 -2
- package/dist/helpers/proxy.d.ts +1 -1
- package/dist/helpers/proxy.d.ts.map +1 -1
- package/dist/helpers/proxy.js.map +2 -2
- package/dist/mutators/cookie.d.ts +17 -0
- package/dist/mutators/cookie.d.ts.map +1 -0
- package/dist/mutators/cookie.js +31 -0
- package/dist/mutators/cookie.js.map +7 -0
- package/dist/mutators/environment.d.ts +17 -0
- package/dist/mutators/environment.d.ts.map +1 -0
- package/dist/mutators/environment.js +31 -0
- package/dist/mutators/environment.js.map +7 -0
- package/dist/mutators/helpers.d.ts +34580 -0
- package/dist/mutators/helpers.d.ts.map +1 -0
- package/dist/mutators/helpers.js +11 -0
- package/dist/mutators/helpers.js.map +7 -0
- package/dist/mutators/index.d.ts +108 -0
- package/dist/mutators/index.d.ts.map +1 -0
- package/dist/mutators/index.js +67 -0
- package/dist/mutators/index.js.map +7 -0
- package/dist/mutators/request-example.d.ts +21 -0
- package/dist/mutators/request-example.d.ts.map +1 -0
- package/dist/mutators/request-example.js +58 -0
- package/dist/mutators/request-example.js.map +7 -0
- package/dist/mutators/request.d.ts +22 -0
- package/dist/mutators/request.d.ts.map +1 -0
- package/dist/mutators/request.js +53 -0
- package/dist/mutators/request.js.map +7 -0
- package/dist/mutators/security-schemes.d.ts +14 -0
- package/dist/mutators/security-schemes.d.ts.map +1 -0
- package/dist/mutators/security-schemes.js +27 -0
- package/dist/mutators/security-schemes.js.map +7 -0
- package/dist/mutators/server.d.ts +12 -0
- package/dist/mutators/server.d.ts.map +1 -0
- package/dist/mutators/server.js +24 -0
- package/dist/mutators/server.js.map +7 -0
- package/dist/navigation/helpers/traverse-description.d.ts +2 -1
- package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-description.js.map +2 -2
- package/dist/navigation/helpers/traverse-document.d.ts +89 -2
- package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-document.js.map +2 -2
- package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-paths.js.map +2 -2
- package/dist/navigation/helpers/traverse-schemas.d.ts +2 -1
- package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-schemas.js.map +2 -2
- package/dist/navigation/helpers/traverse-tags.d.ts +2 -1
- package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-tags.js.map +2 -2
- package/dist/navigation/helpers/traverse-webhooks.d.ts +2 -1
- package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-webhooks.js.map +2 -2
- package/dist/navigation/types.d.ts +1 -39
- package/dist/navigation/types.d.ts.map +1 -1
- package/dist/schemas/compose.d.ts.map +1 -0
- package/dist/schemas/{v3.1/compose.js.map → compose.js.map} +1 -1
- package/dist/schemas/inmemory-workspace.d.ts +68 -0
- package/dist/schemas/inmemory-workspace.d.ts.map +1 -0
- package/dist/schemas/inmemory-workspace.js +14 -0
- package/dist/schemas/inmemory-workspace.js.map +7 -0
- package/dist/schemas/navigation.d.ts +148 -0
- package/dist/schemas/navigation.d.ts.map +1 -0
- package/dist/schemas/navigation.js +76 -0
- package/dist/schemas/navigation.js.map +7 -0
- package/dist/schemas/reference-config/index.d.ts +1 -1
- package/dist/schemas/v3.1/strict/callback.js +1 -1
- package/dist/schemas/v3.1/strict/callback.js.map +1 -1
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts +16 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js +13 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js.map +7 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts +27 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js +23 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js.map +7 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts +38 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts.map +1 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js +45 -0
- package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js.map +7 -0
- package/dist/schemas/v3.1/strict/components.d.ts +45 -7948
- package/dist/schemas/v3.1/strict/components.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/components.js +4 -2
- package/dist/schemas/v3.1/strict/components.js.map +2 -2
- package/dist/schemas/v3.1/strict/contact.js +1 -1
- package/dist/schemas/v3.1/strict/contact.js.map +1 -1
- package/dist/schemas/v3.1/strict/discriminator.js +1 -1
- package/dist/schemas/v3.1/strict/discriminator.js.map +1 -1
- package/dist/schemas/v3.1/strict/encoding.js +1 -1
- package/dist/schemas/v3.1/strict/encoding.js.map +1 -1
- package/dist/schemas/v3.1/strict/example.js +1 -1
- package/dist/schemas/v3.1/strict/example.js.map +1 -1
- package/dist/schemas/v3.1/strict/external-documentation.js +1 -1
- package/dist/schemas/v3.1/strict/external-documentation.js.map +1 -1
- package/dist/schemas/v3.1/strict/header.js +1 -1
- package/dist/schemas/v3.1/strict/header.js.map +1 -1
- package/dist/schemas/v3.1/strict/info.js +1 -1
- package/dist/schemas/v3.1/strict/info.js.map +1 -1
- package/dist/schemas/v3.1/strict/license.js +1 -1
- package/dist/schemas/v3.1/strict/license.js.map +1 -1
- package/dist/schemas/v3.1/strict/link.js +1 -1
- package/dist/schemas/v3.1/strict/link.js.map +1 -1
- package/dist/schemas/v3.1/strict/media-type.js +1 -1
- package/dist/schemas/v3.1/strict/media-type.js.map +1 -1
- package/dist/schemas/v3.1/strict/oauth-flow.js +1 -1
- package/dist/schemas/v3.1/strict/oauth-flow.js.map +1 -1
- package/dist/schemas/v3.1/strict/oauthflows.js +1 -1
- package/dist/schemas/v3.1/strict/oauthflows.js.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +63 -0
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +12 -2
- package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
- package/dist/schemas/v3.1/strict/operation.d.ts +18 -0
- package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/operation.js +8 -1
- package/dist/schemas/v3.1/strict/operation.js.map +2 -2
- package/dist/schemas/v3.1/strict/parameter.js +1 -1
- package/dist/schemas/v3.1/strict/parameter.js.map +1 -1
- package/dist/schemas/v3.1/strict/path-item.d.ts +6 -0
- package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/path-item.js +7 -1
- package/dist/schemas/v3.1/strict/path-item.js.map +2 -2
- package/dist/schemas/v3.1/strict/path-operations.d.ts +3975 -228
- package/dist/schemas/v3.1/strict/path-operations.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/paths.d.ts +1864 -1
- package/dist/schemas/v3.1/strict/paths.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/paths.js +1 -1
- package/dist/schemas/v3.1/strict/paths.js.map +1 -1
- package/dist/schemas/v3.1/strict/reference.js +1 -1
- package/dist/schemas/v3.1/strict/reference.js.map +1 -1
- package/dist/schemas/v3.1/strict/request-body.js +1 -1
- package/dist/schemas/v3.1/strict/request-body.js.map +1 -1
- package/dist/schemas/v3.1/strict/response.js +1 -1
- package/dist/schemas/v3.1/strict/response.js.map +1 -1
- package/dist/schemas/v3.1/strict/responses.js +1 -1
- package/dist/schemas/v3.1/strict/responses.js.map +1 -1
- package/dist/schemas/v3.1/strict/schema.js +1 -1
- package/dist/schemas/v3.1/strict/schema.js.map +1 -1
- package/dist/schemas/v3.1/strict/security-requirement.js +1 -1
- package/dist/schemas/v3.1/strict/security-requirement.js.map +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js +1 -1
- package/dist/schemas/v3.1/strict/security-scheme.js.map +1 -1
- package/dist/schemas/v3.1/strict/server-variable.js +1 -1
- package/dist/schemas/v3.1/strict/server-variable.js.map +1 -1
- package/dist/schemas/v3.1/strict/server.js +1 -1
- package/dist/schemas/v3.1/strict/server.js.map +1 -1
- package/dist/schemas/v3.1/strict/tag.js +1 -1
- package/dist/schemas/v3.1/strict/tag.js.map +1 -1
- package/dist/schemas/v3.1/strict/xml.js +1 -1
- package/dist/schemas/v3.1/strict/xml.js.map +1 -1
- package/dist/schemas/workspace-specification/config.d.ts +48 -0
- package/dist/schemas/workspace-specification/config.d.ts.map +1 -0
- package/dist/schemas/workspace-specification/config.js +11 -0
- package/dist/schemas/workspace-specification/config.js.map +7 -0
- package/dist/schemas/workspace-specification/index.d.ts +210 -0
- package/dist/schemas/workspace-specification/index.d.ts.map +1 -0
- package/dist/schemas/workspace-specification/index.js +27 -0
- package/dist/schemas/workspace-specification/index.js.map +7 -0
- package/dist/schemas/workspace-specification/info.d.ts +5 -0
- package/dist/schemas/workspace-specification/info.d.ts.map +1 -0
- package/dist/schemas/workspace-specification/info.js +9 -0
- package/dist/schemas/workspace-specification/info.js.map +7 -0
- package/dist/schemas/workspace.d.ts +147 -79
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/dist/schemas/workspace.js +19 -4
- package/dist/schemas/workspace.js.map +2 -2
- package/dist/server.d.ts +860 -188
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +12 -10
- package/dist/schemas/v3.1/compose.d.ts.map +0 -1
- /package/dist/schemas/{v3.1/compose.d.ts → compose.d.ts} +0 -0
- /package/dist/schemas/{v3.1/compose.js → compose.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-description.ts"],
|
|
4
|
-
"sourcesContent": ["import { getHeadingsFromMarkdown, getLowestHeadingLevel } from '@/navigation/helpers/utils'\nimport type { Heading
|
|
5
|
-
"mappings": "AAAA,SAAS,yBAAyB,6BAA6B;
|
|
4
|
+
"sourcesContent": ["import { getHeadingsFromMarkdown, getLowestHeadingLevel } from '@/navigation/helpers/utils'\nimport type { Heading } from '@/navigation/types'\nimport type { TraversedDescription } from '@/schemas/navigation'\n\nexport const DEFAULT_INTRODUCTION_SLUG = 'introduction'\n\n/**\n * Creates a hierarchical navigation structure from markdown headings in an OpenAPI description.\n *\n * The function processes markdown headings to create a two-level navigation tree:\n * - Level 1: Main sections (based on the lowest heading level found)\n * - Level 2: Subsections (one level deeper than the main sections)\n *\n * If the description starts with content rather than a heading, an \"Introduction\" section\n * is automatically added as the first entry.\n *\n * @param description - The markdown description text to process\n * @param titlesMap - Map to store heading IDs and titles for mobile header navigation\n * @param getHeadingId - Function to generate unique IDs for headings\n * @returns Array of navigation entries with their hierarchy\n */\nexport const traverseDescription = (\n description: string | undefined,\n /** Map of titles for the mobile header */\n titlesMap: Map<string, string>,\n getHeadingId: (heading: Heading) => string,\n): TraversedDescription[] => {\n if (!description?.trim()) {\n return []\n }\n\n const headings = getHeadingsFromMarkdown(description)\n const lowestLevel = getLowestHeadingLevel(headings)\n\n const entries: TraversedDescription[] = []\n let currentParent: TraversedDescription | null = null\n\n // Add \"Introduction\" as the first heading\n if (description && !description.trim().startsWith('#')) {\n const heading: Heading = {\n depth: 1,\n value: 'Introduction',\n slug: DEFAULT_INTRODUCTION_SLUG,\n }\n\n const id = getHeadingId(heading)\n const title = heading.value\n\n entries.push({\n id,\n title,\n type: 'text',\n })\n titlesMap.set(id, title)\n }\n\n // Traverse for the rest\n for (const heading of headings) {\n if (heading.depth !== lowestLevel && heading.depth !== lowestLevel + 1) {\n continue\n }\n\n const entry: TraversedDescription = {\n id: getHeadingId(heading),\n title: heading.value,\n type: 'text',\n }\n titlesMap.set(entry.id, entry.title)\n\n if (heading.depth === lowestLevel) {\n entry.children = []\n entries.push(entry)\n currentParent = entry\n } else if (currentParent) {\n currentParent.children?.push(entry)\n }\n }\n\n return entries\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,yBAAyB,6BAA6B;AAIxD,MAAM,4BAA4B;AAiBlC,MAAM,sBAAsB,CACjC,aAEA,WACA,iBAC2B;AAC3B,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,WAAW,wBAAwB,WAAW;AACpD,QAAM,cAAc,sBAAsB,QAAQ;AAElD,QAAM,UAAkC,CAAC;AACzC,MAAI,gBAA6C;AAGjD,MAAI,eAAe,CAAC,YAAY,KAAK,EAAE,WAAW,GAAG,GAAG;AACtD,UAAM,UAAmB;AAAA,MACvB,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAEA,UAAM,KAAK,aAAa,OAAO;AAC/B,UAAM,QAAQ,QAAQ;AAEtB,YAAQ,KAAK;AAAA,MACX;AAAA,MACA;AAAA,MACA,MAAM;AAAA,IACR,CAAC;AACD,cAAU,IAAI,IAAI,KAAK;AAAA,EACzB;AAGA,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,UAAU,eAAe,QAAQ,UAAU,cAAc,GAAG;AACtE;AAAA,IACF;AAEA,UAAM,QAA8B;AAAA,MAClC,IAAI,aAAa,OAAO;AAAA,MACxB,OAAO,QAAQ;AAAA,MACf,MAAM;AAAA,IACR;AACA,cAAU,IAAI,MAAM,IAAI,MAAM,KAAK;AAEnC,QAAI,QAAQ,UAAU,aAAa;AACjC,YAAM,WAAW,CAAC;AAClB,cAAQ,KAAK,KAAK;AAClB,sBAAgB;AAAA,IAClB,WAAW,eAAe;AACxB,oBAAc,UAAU,KAAK,KAAK;AAAA,IACpC;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
2
|
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
3
3
|
/**
|
|
4
4
|
* Traverses an OpenAPI Document to generate navigation structure and metadata.
|
|
@@ -10,7 +10,94 @@ import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document
|
|
|
10
10
|
* - Optional schema/model documentation
|
|
11
11
|
*/
|
|
12
12
|
export declare const traverseDocument: (document: OpenApiDocument, { hideModels, tagsSorter, operationsSorter, getHeadingId, getOperationId, getWebhookId, getModelId, getTagId, }: Partial<TraverseSpecOptions>) => {
|
|
13
|
-
entries:
|
|
13
|
+
entries: (({
|
|
14
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
} & {
|
|
18
|
+
children?: {
|
|
19
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
}[] | undefined;
|
|
23
|
+
type: "text";
|
|
24
|
+
}) | ({
|
|
25
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
26
|
+
id: string;
|
|
27
|
+
title: string;
|
|
28
|
+
} & {
|
|
29
|
+
type: "operation";
|
|
30
|
+
ref: string;
|
|
31
|
+
method: string;
|
|
32
|
+
path: string;
|
|
33
|
+
}) | ({
|
|
34
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
35
|
+
id: string;
|
|
36
|
+
title: string;
|
|
37
|
+
} & {
|
|
38
|
+
type: "model";
|
|
39
|
+
ref: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}) | ({
|
|
42
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
} & {
|
|
46
|
+
children?: (({
|
|
47
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
48
|
+
id: string;
|
|
49
|
+
title: string;
|
|
50
|
+
} & {
|
|
51
|
+
children?: {
|
|
52
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
type: "text";
|
|
57
|
+
}) | ({
|
|
58
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
59
|
+
id: string;
|
|
60
|
+
title: string;
|
|
61
|
+
} & {
|
|
62
|
+
type: "operation";
|
|
63
|
+
ref: string;
|
|
64
|
+
method: string;
|
|
65
|
+
path: string;
|
|
66
|
+
}) | ({
|
|
67
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
} & {
|
|
71
|
+
type: "model";
|
|
72
|
+
ref: string;
|
|
73
|
+
name: string;
|
|
74
|
+
}) | ({
|
|
75
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
76
|
+
id: string;
|
|
77
|
+
title: string;
|
|
78
|
+
} & any) | ({
|
|
79
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
80
|
+
id: string;
|
|
81
|
+
title: string;
|
|
82
|
+
} & {
|
|
83
|
+
type: "webhook";
|
|
84
|
+
ref: string;
|
|
85
|
+
method: string;
|
|
86
|
+
name: string;
|
|
87
|
+
}))[] | undefined;
|
|
88
|
+
type: "tag";
|
|
89
|
+
name: string;
|
|
90
|
+
isGroup: boolean;
|
|
91
|
+
}) | ({
|
|
92
|
+
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
93
|
+
id: string;
|
|
94
|
+
title: string;
|
|
95
|
+
} & {
|
|
96
|
+
type: "webhook";
|
|
97
|
+
ref: string;
|
|
98
|
+
method: string;
|
|
99
|
+
name: string;
|
|
100
|
+
}))[];
|
|
14
101
|
titles: Map<string, string>;
|
|
15
102
|
};
|
|
16
103
|
//# sourceMappingURL=traverse-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-document.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traverse-document.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-document.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAW,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAE7E;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,aACjB,eAAe,mHAUtB,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ChC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-document.ts"],
|
|
4
|
-
"sourcesContent": ["import { traverseDescription } from './traverse-description'\nimport { traversePaths } from './traverse-paths'\nimport { traverseSchemas } from './traverse-schemas'\nimport { traverseTags } from './traverse-tags'\nimport { traverseWebhooks } from './traverse-webhooks'\nimport type { TagsMap,
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { TraversedEntry } from '@/schemas/navigation'\nimport { traverseDescription } from './traverse-description'\nimport { traversePaths } from './traverse-paths'\nimport { traverseSchemas } from './traverse-schemas'\nimport { traverseTags } from './traverse-tags'\nimport { traverseWebhooks } from './traverse-webhooks'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\n\n/**\n * Traverses an OpenAPI Document to generate navigation structure and metadata.\n *\n * This function processes the OpenAPI document to create:\n * - A hierarchical navigation structure for the sidebar\n * - A mapping of IDs to titles for mobile header navigation\n * - Tag-based organization of operations and webhooks\n * - Optional schema/model documentation\n */\nexport const traverseDocument = (\n document: OpenApiDocument,\n {\n hideModels = false,\n tagsSorter = 'alpha',\n operationsSorter = 'alpha',\n getHeadingId = (heading) => heading.value,\n getOperationId = (operation) => operation.summary ?? '',\n getWebhookId = (webhook) => webhook?.name ?? 'webhooks',\n getModelId = (model) => model?.name ?? '',\n getTagId = (tag) => tag.name ?? '',\n }: Partial<TraverseSpecOptions>,\n) => {\n /** Map it ID to title for the mobile header */\n const titles = new Map<string, string>()\n\n /** Map of tags and their entries */\n const tagsMap: TagsMap = new Map(\n document.tags?.map((tag) => [tag.name ?? 'Untitled Tag', { tag, entries: [] }]) ?? [],\n )\n\n const entries: TraversedEntry[] = traverseDescription(document.info?.description, titles, getHeadingId)\n traversePaths(document, tagsMap, titles, getOperationId)\n const untaggedWebhooks = traverseWebhooks(document, tagsMap, titles, getWebhookId)\n const tagsEntries = traverseTags(document, tagsMap, titles, {\n getTagId,\n tagsSorter,\n operationsSorter,\n })\n\n // Add tagged operations, webhooks and tagGroups\n entries.push(...tagsEntries)\n\n // Add untagged webhooks\n if (untaggedWebhooks.length) {\n entries.push({\n id: getWebhookId(),\n title: 'Webhooks',\n children: untaggedWebhooks,\n type: 'text',\n })\n }\n\n // Add models if they are not hidden\n if (!hideModels && document.components?.schemas) {\n const untaggedModels = traverseSchemas(document, tagsMap, titles, getModelId)\n\n if (untaggedModels.length) {\n entries.push({\n id: getModelId(),\n title: 'Models',\n children: untaggedModels,\n type: 'text',\n })\n }\n }\n\n return { entries, titles }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAa1B,MAAM,mBAAmB,CAC9B,UACA;AAAA,EACE,aAAa;AAAA,EACb,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,eAAe,CAAC,YAAY,QAAQ;AAAA,EACpC,iBAAiB,CAAC,cAAc,UAAU,WAAW;AAAA,EACrD,eAAe,CAAC,YAAY,SAAS,QAAQ;AAAA,EAC7C,aAAa,CAAC,UAAU,OAAO,QAAQ;AAAA,EACvC,WAAW,CAAC,QAAQ,IAAI,QAAQ;AAClC,MACG;AAEH,QAAM,SAAS,oBAAI,IAAoB;AAGvC,QAAM,UAAmB,IAAI;AAAA,IAC3B,SAAS,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,gBAAgB,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC;AAAA,EACtF;AAEA,QAAM,UAA4B,oBAAoB,SAAS,MAAM,aAAa,QAAQ,YAAY;AACtG,gBAAc,UAAU,SAAS,QAAQ,cAAc;AACvD,QAAM,mBAAmB,iBAAiB,UAAU,SAAS,QAAQ,YAAY;AACjF,QAAM,cAAc,aAAa,UAAU,SAAS,QAAQ;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAGD,UAAQ,KAAK,GAAG,WAAW;AAG3B,MAAI,iBAAiB,QAAQ;AAC3B,YAAQ,KAAK;AAAA,MACX,IAAI,aAAa;AAAA,MACjB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAGA,MAAI,CAAC,cAAc,SAAS,YAAY,SAAS;AAC/C,UAAM,iBAAiB,gBAAgB,UAAU,SAAS,QAAQ,UAAU;AAE5E,QAAI,eAAe,QAAQ;AACzB,cAAQ,KAAK;AAAA,QACX,IAAI,WAAW;AAAA,QACf,OAAO;AAAA,QACP,UAAU;AAAA,QACV,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,OAAO;AAC3B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAwC7E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,YACf,eAAe,WAEf,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,kBACd,mBAAmB,CAAC,gBAAgB,CAAC,SAqCtD,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-paths.ts"],
|
|
4
|
-
"sourcesContent": ["import { getTag } from './get-tag'\nimport type { TagsMap,
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB;
|
|
4
|
+
"sourcesContent": ["import { getTag } from './get-tag'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport { escapeJsonPointer } from '@scalar/openapi-parser'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\nimport { isReference } from '@/schemas/v3.1/type-guard'\nimport type { TagObject } from '@/schemas/v3.1/strict/tag'\nimport type { OperationObject } from '@/schemas/v3.1/strict/path-operations'\nimport type { TraversedOperation } from '@/schemas/navigation'\n\n/**\n * Creates a traversed operation entry from an OpenAPI operation object.\n *\n * @param ref - JSON pointer reference to the operation in the OpenAPI document\n * @param operation - The OpenAPI operation object\n * @param method - HTTP method of the operation\n * @param path - API path of the operation, defaults to 'Unknown'\n * @param tag - Tag object associated with the operation\n * @param titlesMap - Map to store operation IDs and titles for mobile header navigation\n * @param getOperationId - Function to generate unique IDs for operations\n * @returns A traversed operation entry with ID, title, path, method and reference\n */\nconst createOperationEntry = (\n ref: string,\n operation: OperationObject,\n method: string,\n path = 'Unknown',\n tag: TagObject,\n titlesMap: Map<string, string>,\n getOperationId: TraverseSpecOptions['getOperationId'],\n): TraversedOperation => {\n const id = getOperationId({ ...operation, method, path }, tag)\n titlesMap.set(id, operation.summary ?? path)\n\n return {\n id,\n title: operation.summary ?? path,\n path,\n method: method,\n ref,\n type: 'operation',\n }\n}\n\n/**\n * Traverses the paths in an OpenAPI document to build a map of operations organized by tags.\n *\n * This function processes each path and its operations to:\n * - Filter out internal operations (marked with x-internal) and operations to ignore (marked with x-scalar-ignore)\n * - Group operations by their tags\n * - Create a default tag group for untagged operations\n * - Generate unique references and IDs for each operation\n *\n * TODO: filter out internal and scalar-ignore tags\n *\n * @param content - The OpenAPI document to traverse\n * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects\n * @param titlesMap - Map to store operation IDs and titles for mobile header navigation\n * @param getOperationId - Function to generate unique IDs for operations\n * @returns Map of tag names to arrays of traversed operations\n */\nexport const traversePaths = (\n content: OpenApiDocument,\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n /** Map of titles for the mobile header */\n titlesMap: Map<string, string>,\n getOperationId: TraverseSpecOptions['getOperationId'],\n) => {\n // Traverse paths\n Object.entries(content.paths ?? {}).forEach(([path, pathItem]) => {\n const pathEntries = Object.entries(pathItem ?? {}) as [string, OperationObject][]\n\n // Traverse operations\n pathEntries.forEach(([method, operation]) => {\n if (isReference(operation)) {\n return\n }\n\n // Skip if the operation is internal or scalar-ignore\n if (operation['x-internal'] || operation['x-scalar-ignore'] || !isHttpMethod(method)) {\n return\n }\n\n const ref = `#/paths/${escapeJsonPointer(path)}/${method}`\n\n // Traverse tags\n if (operation.tags?.length) {\n operation.tags.forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap\n .get(tagName)\n ?.entries.push(createOperationEntry(ref, operation, method, path, tag, titlesMap, getOperationId))\n })\n }\n // Add to default tag\n else {\n const { tag } = getTag(tagsMap, 'default')\n tagsMap\n .get('default')\n ?.entries.push(createOperationEntry(ref, operation, method, path, tag, titlesMap, getOperationId))\n }\n })\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AAEvB,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB;AAiB5B,MAAM,uBAAuB,CAC3B,KACA,WACA,QACA,OAAO,WACP,KACA,WACA,mBACuB;AACvB,QAAM,KAAK,eAAe,EAAE,GAAG,WAAW,QAAQ,KAAK,GAAG,GAAG;AAC7D,YAAU,IAAI,IAAI,UAAU,WAAW,IAAI;AAE3C,SAAO;AAAA,IACL;AAAA,IACA,OAAO,UAAU,WAAW;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AACF;AAmBO,MAAM,gBAAgB,CAC3B,SAEA,SAEA,WACA,mBACG;AAEH,SAAO,QAAQ,QAAQ,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,QAAQ,MAAM;AAChE,UAAM,cAAc,OAAO,QAAQ,YAAY,CAAC,CAAC;AAGjD,gBAAY,QAAQ,CAAC,CAAC,QAAQ,SAAS,MAAM;AAC3C,UAAI,YAAY,SAAS,GAAG;AAC1B;AAAA,MACF;AAGA,UAAI,UAAU,YAAY,KAAK,UAAU,iBAAiB,KAAK,CAAC,aAAa,MAAM,GAAG;AACpF;AAAA,MACF;AAEA,YAAM,MAAM,WAAW,kBAAkB,IAAI,CAAC,IAAI,MAAM;AAGxD,UAAI,UAAU,MAAM,QAAQ;AAC1B,kBAAU,KAAK,QAAQ,CAAC,YAAoB;AAC1C,gBAAM,EAAE,IAAI,IAAI,OAAO,SAAS,OAAO;AACvC,kBACG,IAAI,OAAO,GACV,QAAQ,KAAK,qBAAqB,KAAK,WAAW,QAAQ,MAAM,KAAK,WAAW,cAAc,CAAC;AAAA,QACrG,CAAC;AAAA,MACH,OAEK;AACH,cAAM,EAAE,IAAI,IAAI,OAAO,SAAS,SAAS;AACzC,gBACG,IAAI,SAAS,GACZ,QAAQ,KAAK,qBAAqB,KAAK,WAAW,QAAQ,MAAM,KAAK,WAAW,cAAc,CAAC;AAAA,MACrG;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TagsMap,
|
|
1
|
+
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
|
+
import type { TraversedSchema } from '../../schemas/navigation.js';
|
|
2
3
|
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
3
4
|
/** Traverses the schemas in an OpenAPI document to build an array of model entries.
|
|
4
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AA8B7E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,YACjB,eAAe,WAEf,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,cAClB,mBAAmB,CAAC,YAAY,CAAC,KAC5C,eAAe,EAyBjB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-schemas.ts"],
|
|
4
|
-
"sourcesContent": ["import { getTag } from '@/navigation/helpers/get-tag'\nimport type { TagsMap,
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import { getTag } from '@/navigation/helpers/get-tag'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { TraversedSchema } from '@/schemas/navigation'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\nimport type { TagObject } from '@/schemas/v3.1/strict/tag'\n\n/** Creates a traversed schema entry from an OpenAPI schema object.\n *\n * @param ref - JSON pointer reference to the schema in the OpenAPI document\n * @param name - Name of the schema, defaults to 'Unknown'\n * @param titlesMap - Map to store schema IDs and titles for mobile header navigation\n * @param getModelId - Function to generate unique IDs for schemas\n * @returns A traversed schema entry with ID, title, name and reference\n */\nconst createModelEntry = (\n ref: string,\n name = 'Unknown',\n titlesMap: Map<string, string>,\n getModelId: TraverseSpecOptions['getModelId'],\n tag?: TagObject,\n): TraversedSchema => {\n const id = getModelId({ name }, tag)\n titlesMap.set(id, name)\n\n return {\n id,\n title: name,\n name,\n ref,\n type: 'model',\n }\n}\n\n/** Traverses the schemas in an OpenAPI document to build an array of model entries.\n *\n * This function processes each schema in components.schemas to:\n * - Filter out internal schemas (marked with x-internal) and schemas to ignore (marked with x-scalar-ignore)\n * - Create model entries with unique references and IDs\n * - Store model IDs and titles for mobile header navigation\n *\n * @param content - The OpenAPI document to traverse\n * @param titlesMap - Map to store schema IDs and titles for mobile header navigation\n * @param getModelId - Function to generate unique IDs for schemas\n * @returns Array of traversed schema entries\n */\nexport const traverseSchemas = (\n content: OpenApiDocument,\n /** Map of tagNames and their entries */\n tagsMap: TagsMap,\n /** Map of titles for the mobile header */\n titlesMap: Map<string, string>,\n getModelId: TraverseSpecOptions['getModelId'],\n): TraversedSchema[] => {\n const schemas = content.components?.schemas ?? {}\n const untagged: TraversedSchema[] = []\n\n for (const name in schemas) {\n if (schemas[name]['x-internal'] || schemas[name]['x-scalar-ignore'] || !Object.hasOwn(schemas, name)) {\n continue\n }\n\n const ref = `#/content/components/schemas/${name}`\n\n // Add to tags\n if (schemas[name]['x-tags']) {\n schemas[name]['x-tags'].forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap.get(tagName)?.entries.push(createModelEntry(ref, name, titlesMap, getModelId, tag))\n })\n }\n // Add to untagged\n else {\n untagged.push(createModelEntry(ref, name, titlesMap, getModelId))\n }\n }\n\n return untagged\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AAcvB,MAAM,mBAAmB,CACvB,KACA,OAAO,WACP,WACA,YACA,QACoB;AACpB,QAAM,KAAK,WAAW,EAAE,KAAK,GAAG,GAAG;AACnC,YAAU,IAAI,IAAI,IAAI;AAEtB,SAAO;AAAA,IACL;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AACF;AAcO,MAAM,kBAAkB,CAC7B,SAEA,SAEA,WACA,eACsB;AACtB,QAAM,UAAU,QAAQ,YAAY,WAAW,CAAC;AAChD,QAAM,WAA8B,CAAC;AAErC,aAAW,QAAQ,SAAS;AAC1B,QAAI,QAAQ,IAAI,EAAE,YAAY,KAAK,QAAQ,IAAI,EAAE,iBAAiB,KAAK,CAAC,OAAO,OAAO,SAAS,IAAI,GAAG;AACpG;AAAA,IACF;AAEA,UAAM,MAAM,gCAAgC,IAAI;AAGhD,QAAI,QAAQ,IAAI,EAAE,QAAQ,GAAG;AAC3B,cAAQ,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,YAAoB;AACnD,cAAM,EAAE,IAAI,IAAI,OAAO,SAAS,OAAO;AACvC,gBAAQ,IAAI,OAAO,GAAG,QAAQ,KAAK,iBAAiB,KAAK,MAAM,WAAW,YAAY,GAAG,CAAC;AAAA,MAC5F,CAAC;AAAA,IACH,OAEK;AACH,eAAS,KAAK,iBAAiB,KAAK,MAAM,WAAW,UAAU,CAAC;AAAA,IAClE;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { TagsMap,
|
|
1
|
+
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
2
|
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
3
|
+
import type { TraversedEntry } from '../../schemas/navigation.js';
|
|
3
4
|
type Options = Pick<TraverseSpecOptions, 'getTagId' | 'tagsSorter' | 'operationsSorter'>;
|
|
4
5
|
/**
|
|
5
6
|
* Traverses the tags map to create navigation entries, handling both grouped and ungrouped tags.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AAExE,KAAK,OAAO,GAAG,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,YAAY,GAAG,kBAAkB,CAAC,CAAA;AA2HxF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,YACd,eAAe,WAEf,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,8CACc,OAAO,KAClD,cAAc,EAyBhB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-tags.ts"],
|
|
4
|
-
"sourcesContent": ["import type { TagObject } from '@/schemas/v3.1/strict/tag'\nimport { getTag } from './get-tag'\nimport type { TagsMap,
|
|
5
|
-
"mappings": "AACA,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import type { TagObject } from '@/schemas/v3.1/strict/tag'\nimport { getTag } from './get-tag'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\nimport type { TraversedEntry, TraversedTag } from '@/schemas/navigation'\n\ntype Options = Pick<TraverseSpecOptions, 'getTagId' | 'tagsSorter' | 'operationsSorter'>\n\n/** Creates a traversed tag entry from an OpenAPI tag object.\n *\n * @param tag - The OpenAPI tag object\n * @param titlesMap - Map to store tag IDs and titles for mobile header navigation\n * @param getTagId - Function to generate unique IDs for tags\n * @param children - Array of child entries (operations, webhooks, etc.)\n * @param isGroup - Whether this tag represents a group of tags\n * @returns A traversed tag entry with ID, title, name and children\n */\nconst createTagEntry = (\n tag: TagObject,\n titlesMap: Map<string, string>,\n getTagId: TraverseSpecOptions['getTagId'],\n children: TraversedEntry[],\n isGroup = false,\n): TraversedTag => {\n const id = getTagId(tag)\n const title = tag['x-displayName'] ?? tag.name ?? 'Untitled Tag'\n titlesMap.set(id, title)\n\n return {\n id,\n title,\n name: tag.name || title,\n children,\n isGroup,\n type: 'tag',\n }\n}\n\n/** Sorts and processes tags to create a hierarchical structure of tag entries.\n *\n * This function handles:\n * - Sorting tags alphabetically or using a custom sort function\n * - Ensuring the default tag appears last\n * - Sorting operations within tags by title, method, or custom function\n * - Filtering out internal and ignored tags\n * - Creating tag entries with their associated operations\n *\n * @param _keys - Array of tag keys to process\n * @param tagsMap - Map of tags and their entries\n * @param tagsDict - Dictionary of OpenAPI tags by name\n * @param titlesMap - Map of titles for the mobile header\n * @param options - Sorting and ID generation options\n * @returns Array of processed and sorted tag entries\n */\n/** Sorts tags and returns entries */\nconst getSortedTagEntries = (\n _keys: string[],\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n /** Map of titles for the mobile header */\n titlesMap: Map<string, string>,\n { getTagId, tagsSorter, operationsSorter }: Options,\n) => {\n // Ensure that default is last if it exists\n const hasDefault = _keys.includes('default')\n const keys = hasDefault ? _keys.filter((key) => key !== 'default') : _keys\n\n // Alpha sort\n if (tagsSorter === 'alpha') {\n keys.sort((a, b) => {\n const nameA = getTag(tagsMap, a).tag['x-displayName'] || a || 'Untitled Tag'\n const nameB = getTag(tagsMap, b).tag['x-displayName'] || b || 'Untitled Tag'\n return nameA.localeCompare(nameB)\n })\n }\n // Custom sort\n else if (typeof tagsSorter === 'function') {\n keys.sort((a, b) => tagsSorter(getTag(tagsMap, a).tag, getTag(tagsMap, b).tag))\n }\n\n if (hasDefault) {\n keys.push('default')\n }\n\n /**\n * Process each tag and its entries:\n * - Skip internal and ignored tags\n * - Sort operations within tags\n * - Create tag entries with sorted operations\n */\n return keys.flatMap((key) => {\n const { tag, entries } = getTag(tagsMap, key)\n\n // Skip if the tag is internal or scalar-ignore\n if (tag['x-internal'] || tag['x-scalar-ignore']) {\n return []\n }\n\n // Alpha sort\n if (operationsSorter === 'alpha') {\n entries.sort((a, b) => ('method' in a && 'method' in b ? a.title.localeCompare(b.title) : 0))\n }\n // Method sort\n else if (operationsSorter === 'method') {\n entries.sort((a, b) => ('method' in a && 'method' in b ? a.method.localeCompare(b.method) : 0))\n }\n // Custom sort\n else if (typeof operationsSorter === 'function') {\n entries.sort((a, b) => {\n // Guard against tags\n if ((a.type !== 'operation' && a.type !== 'webhook') || (b.type !== 'operation' && b.type !== 'webhook')) {\n return 0\n }\n\n // Handle webhooks as well as operations\n const pathA = a.type === 'operation' ? a.path : a.name\n const pathB = b.type === 'operation' ? b.path : b.name\n\n return operationsSorter(\n { method: a.method, path: pathA, ref: a.ref },\n { method: b.method, path: pathB, ref: b.ref },\n )\n })\n }\n\n return entries.length ? createTagEntry(tag, titlesMap, getTagId, entries) : []\n })\n}\n\n/**\n * Traverses the tags map to create navigation entries, handling both grouped and ungrouped tags.\n *\n * This function processes the OpenAPI document's tags to:\n * - Handle tag groups if specified via x-tagGroups\n * - Sort tags and their operations according to provided sorters\n * - Create navigation entries for each tag or tag group\n * - Flatten default tag entries if it's the only tag present\n */\nexport const traverseTags = (\n content: OpenApiDocument,\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n /** Map of titles for the mobile title */\n titlesMap: Map<string, string>,\n { getTagId, tagsSorter, operationsSorter }: Options,\n): TraversedEntry[] => {\n // x-tagGroups\n if (content['x-tagGroups']) {\n const tagGroups = content['x-tagGroups']\n\n return tagGroups.flatMap((tagGroup) => {\n const entries = getSortedTagEntries(tagGroup.tags ?? [], tagsMap, titlesMap, {\n getTagId,\n tagsSorter,\n operationsSorter,\n })\n return entries.length ? createTagEntry(tagGroup, titlesMap, getTagId, entries, true) : []\n })\n }\n\n // Ungrouped regular tags\n const keys = Array.from(tagsMap.keys())\n const tags = getSortedTagEntries(keys, tagsMap, titlesMap, { getTagId, tagsSorter, operationsSorter })\n\n // Flatten if we only have default tag\n if (tags.length === 1 && tags[0].title === 'default') {\n return tags[0].children ?? []\n }\n\n return tags\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,cAAc;AAgBvB,MAAM,iBAAiB,CACrB,KACA,WACA,UACA,UACA,UAAU,UACO;AACjB,QAAM,KAAK,SAAS,GAAG;AACvB,QAAM,QAAQ,IAAI,eAAe,KAAK,IAAI,QAAQ;AAClD,YAAU,IAAI,IAAI,KAAK;AAEvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,MAAM,IAAI,QAAQ;AAAA,IAClB;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AACF;AAmBA,MAAM,sBAAsB,CAC1B,OAEA,SAEA,WACA,EAAE,UAAU,YAAY,iBAAiB,MACtC;AAEH,QAAM,aAAa,MAAM,SAAS,SAAS;AAC3C,QAAM,OAAO,aAAa,MAAM,OAAO,CAAC,QAAQ,QAAQ,SAAS,IAAI;AAGrE,MAAI,eAAe,SAAS;AAC1B,SAAK,KAAK,CAAC,GAAG,MAAM;AAClB,YAAM,QAAQ,OAAO,SAAS,CAAC,EAAE,IAAI,eAAe,KAAK,KAAK;AAC9D,YAAM,QAAQ,OAAO,SAAS,CAAC,EAAE,IAAI,eAAe,KAAK,KAAK;AAC9D,aAAO,MAAM,cAAc,KAAK;AAAA,IAClC,CAAC;AAAA,EACH,WAES,OAAO,eAAe,YAAY;AACzC,SAAK,KAAK,CAAC,GAAG,MAAM,WAAW,OAAO,SAAS,CAAC,EAAE,KAAK,OAAO,SAAS,CAAC,EAAE,GAAG,CAAC;AAAA,EAChF;AAEA,MAAI,YAAY;AACd,SAAK,KAAK,SAAS;AAAA,EACrB;AAQA,SAAO,KAAK,QAAQ,CAAC,QAAQ;AAC3B,UAAM,EAAE,KAAK,QAAQ,IAAI,OAAO,SAAS,GAAG;AAG5C,QAAI,IAAI,YAAY,KAAK,IAAI,iBAAiB,GAAG;AAC/C,aAAO,CAAC;AAAA,IACV;AAGA,QAAI,qBAAqB,SAAS;AAChC,cAAQ,KAAK,CAAC,GAAG,MAAO,YAAY,KAAK,YAAY,IAAI,EAAE,MAAM,cAAc,EAAE,KAAK,IAAI,CAAE;AAAA,IAC9F,WAES,qBAAqB,UAAU;AACtC,cAAQ,KAAK,CAAC,GAAG,MAAO,YAAY,KAAK,YAAY,IAAI,EAAE,OAAO,cAAc,EAAE,MAAM,IAAI,CAAE;AAAA,IAChG,WAES,OAAO,qBAAqB,YAAY;AAC/C,cAAQ,KAAK,CAAC,GAAG,MAAM;AAErB,YAAK,EAAE,SAAS,eAAe,EAAE,SAAS,aAAe,EAAE,SAAS,eAAe,EAAE,SAAS,WAAY;AACxG,iBAAO;AAAA,QACT;AAGA,cAAM,QAAQ,EAAE,SAAS,cAAc,EAAE,OAAO,EAAE;AAClD,cAAM,QAAQ,EAAE,SAAS,cAAc,EAAE,OAAO,EAAE;AAElD,eAAO;AAAA,UACL,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,KAAK,EAAE,IAAI;AAAA,UAC5C,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,KAAK,EAAE,IAAI;AAAA,QAC9C;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,QAAQ,SAAS,eAAe,KAAK,WAAW,UAAU,OAAO,IAAI,CAAC;AAAA,EAC/E,CAAC;AACH;AAWO,MAAM,eAAe,CAC1B,SAEA,SAEA,WACA,EAAE,UAAU,YAAY,iBAAiB,MACpB;AAErB,MAAI,QAAQ,aAAa,GAAG;AAC1B,UAAM,YAAY,QAAQ,aAAa;AAEvC,WAAO,UAAU,QAAQ,CAAC,aAAa;AACrC,YAAM,UAAU,oBAAoB,SAAS,QAAQ,CAAC,GAAG,SAAS,WAAW;AAAA,QAC3E;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AACD,aAAO,QAAQ,SAAS,eAAe,UAAU,WAAW,UAAU,SAAS,IAAI,IAAI,CAAC;AAAA,IAC1F,CAAC;AAAA,EACH;AAGA,QAAM,OAAO,MAAM,KAAK,QAAQ,KAAK,CAAC;AACtC,QAAM,OAAO,oBAAoB,MAAM,SAAS,WAAW,EAAE,UAAU,YAAY,iBAAiB,CAAC;AAGrG,MAAI,KAAK,WAAW,KAAK,KAAK,CAAC,EAAE,UAAU,WAAW;AACpD,WAAO,KAAK,CAAC,EAAE,YAAY,CAAC;AAAA,EAC9B;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TraversedWebhook } from '../../schemas/navigation.js';
|
|
2
|
+
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
3
|
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
3
4
|
/** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.
|
|
4
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAsC7E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,YAClB,eAAe,WAEf,OAAO,aAEL,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,gBAChB,mBAAmB,CAAC,cAAc,CAAC,KAChD,gBAAgB,EAqClB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-webhooks.ts"],
|
|
4
|
-
"sourcesContent": ["import { getTag } from './get-tag'\nimport type { TagsMap,
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { TraversedWebhook } from '@/schemas/navigation'\nimport { getTag } from './get-tag'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@/schemas/v3.1/strict/path-operations'\nimport type { TagObject } from '@/schemas/v3.1/strict/tag'\nimport { isReference } from '@/schemas/v3.1/type-guard'\n\n/** Creates a traversed webhook entry from an OpenAPI webhook object.\n *\n * @param ref - JSON pointer reference to the webhook in the OpenAPI document\n * @param method - HTTP method of the webhook\n * @param name - Name of the webhook, defaults to 'Unknown'\n * @param title - Title of the webhook, defaults to 'Unknown'\n * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @param tag - Optional tag object associated with the webhook\n * @returns A traversed webhook entry with ID, title, name, method and reference\n */\nconst createWebhookEntry = (\n ref: string,\n method: string,\n name = 'Unknown',\n title = 'Unknown',\n titlesMap: Map<string, string>,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n tag?: TagObject,\n): TraversedWebhook => {\n const id = getWebhookId({ name, method }, tag)\n titlesMap.set(id, title)\n\n return {\n id,\n title,\n name,\n ref,\n method: method,\n type: 'webhook',\n }\n}\n\n/** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.\n *\n * This function processes each webhook in the document to:\n * - Filter out internal webhooks (marked with x-internal) and webhooks to ignore (marked with x-scalar-ignore)\n * - Group webhooks by their tags\n * - Create webhook entries with unique references and IDs\n * - Store webhook IDs and titles for mobile header navigation\n *\n * @param content - The OpenAPI document to traverse\n * @param tagsMap - Map of tag names to arrays of traversed entries from operations\n * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects\n * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @returns Array of untagged webhook entries\n */\nexport const traverseWebhooks = (\n content: OpenApiDocument,\n /** The tag map from from traversing paths */\n tagsMap: TagsMap,\n /** Map of titles for the mobile title */\n titlesMap: Map<string, string>,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n): TraversedWebhook[] => {\n const untagged: TraversedWebhook[] = []\n\n // Traverse webhooks\n Object.entries(content.webhooks ?? {}).forEach(([name, pathItemObject]) => {\n const pathEntries = Object.entries(pathItemObject ?? {}) as [string, OperationObject][]\n\n pathEntries.forEach(([method, operation]) => {\n if (isReference(operation)) {\n return\n }\n\n const ref = `#/webhooks/${name}/${method}`\n\n // Skip if the operation is internal or scalar-ignore\n if (operation['x-internal'] || operation['x-scalar-ignore']) {\n return\n }\n\n if (operation.tags?.length) {\n operation.tags.forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap\n .get(tagName)\n ?.entries.push(\n createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId, tag),\n )\n })\n }\n // Add to untagged\n else {\n untagged.push(createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId))\n }\n })\n })\n\n return untagged\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,cAAc;AAKvB,SAAS,mBAAmB;AAa5B,MAAM,qBAAqB,CACzB,KACA,QACA,OAAO,WACP,QAAQ,WACR,WACA,cACA,QACqB;AACrB,QAAM,KAAK,aAAa,EAAE,MAAM,OAAO,GAAG,GAAG;AAC7C,YAAU,IAAI,IAAI,KAAK;AAEvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AACF;AAiBO,MAAM,mBAAmB,CAC9B,SAEA,SAEA,WACA,iBACuB;AACvB,QAAM,WAA+B,CAAC;AAGtC,SAAO,QAAQ,QAAQ,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,cAAc,MAAM;AACzE,UAAM,cAAc,OAAO,QAAQ,kBAAkB,CAAC,CAAC;AAEvD,gBAAY,QAAQ,CAAC,CAAC,QAAQ,SAAS,MAAM;AAC3C,UAAI,YAAY,SAAS,GAAG;AAC1B;AAAA,MACF;AAEA,YAAM,MAAM,cAAc,IAAI,IAAI,MAAM;AAGxC,UAAI,UAAU,YAAY,KAAK,UAAU,iBAAiB,GAAG;AAC3D;AAAA,MACF;AAEA,UAAI,UAAU,MAAM,QAAQ;AAC1B,kBAAU,KAAK,QAAQ,CAAC,YAAoB;AAC1C,gBAAM,EAAE,IAAI,IAAI,OAAO,SAAS,OAAO;AACvC,kBACG,IAAI,OAAO,GACV,QAAQ;AAAA,YACR,mBAAmB,KAAK,QAAQ,MAAM,UAAU,WAAW,MAAM,WAAW,cAAc,GAAG;AAAA,UAC/F;AAAA,QACJ,CAAC;AAAA,MACH,OAEK;AACH,iBAAS,KAAK,mBAAmB,KAAK,QAAQ,MAAM,UAAU,WAAW,MAAM,WAAW,YAAY,CAAC;AAAA,MACzG;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TraversedEntry } from '../schemas/navigation.js';
|
|
1
2
|
import type { OperationObject } from '../schemas/v3.1/strict/path-operations.js';
|
|
2
3
|
import type { TagObject } from '../schemas/v3.1/strict/tag.js';
|
|
3
4
|
/** Map of tagNames and their entries */
|
|
@@ -5,45 +6,6 @@ export type TagsMap = Map<string, {
|
|
|
5
6
|
tag: TagObject;
|
|
6
7
|
entries: TraversedEntry[];
|
|
7
8
|
}>;
|
|
8
|
-
type TraverseEntryBase = {
|
|
9
|
-
type: 'text' | 'operation' | 'model' | 'tag' | 'webhook';
|
|
10
|
-
id: string;
|
|
11
|
-
title: string;
|
|
12
|
-
};
|
|
13
|
-
/** Description entry returned form traversing the document */
|
|
14
|
-
export type TraversedDescription = TraverseEntryBase & {
|
|
15
|
-
type: 'text';
|
|
16
|
-
children?: TraverseEntryBase[];
|
|
17
|
-
};
|
|
18
|
-
/** Operation entry returned form traversing the document */
|
|
19
|
-
export type TraversedOperation = TraverseEntryBase & {
|
|
20
|
-
type: 'operation';
|
|
21
|
-
ref: string;
|
|
22
|
-
method: string;
|
|
23
|
-
path: string;
|
|
24
|
-
};
|
|
25
|
-
/** Model entry returned form traversing the document */
|
|
26
|
-
export type TraversedSchema = TraverseEntryBase & {
|
|
27
|
-
type: 'model';
|
|
28
|
-
ref: string;
|
|
29
|
-
name: string;
|
|
30
|
-
};
|
|
31
|
-
/** Tag entry returned form traversing the document, includes tagGroups */
|
|
32
|
-
export type TraversedTag = TraverseEntryBase & {
|
|
33
|
-
type: 'tag';
|
|
34
|
-
name: string;
|
|
35
|
-
children?: TraversedEntry[];
|
|
36
|
-
isGroup: boolean;
|
|
37
|
-
};
|
|
38
|
-
/** Webhook entry returned form traversing the document, basically the same as an operation but with name instead of path */
|
|
39
|
-
export type TraversedWebhook = TraverseEntryBase & {
|
|
40
|
-
type: 'webhook';
|
|
41
|
-
ref: string;
|
|
42
|
-
method: string;
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
/** Entries returned form traversing the document */
|
|
46
|
-
export type TraversedEntry = TraversedDescription | TraversedOperation | TraversedSchema | TraversedTag | TraversedWebhook;
|
|
47
9
|
type OperationSortValue = {
|
|
48
10
|
method: string;
|
|
49
11
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D,wCAAwC;AACxC,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAAA;AAEhF,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAE1D,wCAAwC;AACxC,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAAA;AAEhF,KAAK,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvE;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,2FAA2F;IAC3F,UAAU,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,KAAK,MAAM,CAAC,CAAA;IAE9D,sGAAsG;IACtG,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,KAAK,MAAM,CAAC,CAAA;IAEjG,wDAAwD;IACxD,UAAU,EAAE,OAAO,CAAA;IAEnB,4DAA4D;IAC5D,YAAY,EAAE,CAAC,OAAO,EAAE;QACtB,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,KAAK,MAAM,CAAA;IAEZ,qDAAqD;IACrD,cAAc,EAAE,CACd,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,GAAG,eAAe,EACnB,SAAS,EAAE,SAAS,KACjB,MAAM,CAAA;IAEX,mDAAmD;IACnD,YAAY,EAAE,CACZ,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,EACD,SAAS,CAAC,EAAE,SAAS,KAClB,MAAM,CAAA;IAEX,yDAAyD;IACzD,UAAU,EAAE,CACV,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;KACb,EACD,SAAS,CAAC,EAAE,SAAS,KAClB,MAAM,CAAA;IAEX,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/schemas/compose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,OAAO,EAAE,WAAW,CAAC,KACX,UAAU,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAC9E,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../src/schemas/compose.ts"],
|
|
4
4
|
"sourcesContent": ["import { Type, type TSchema } from '@sinclair/typebox'\n\n/**\n * Work around for: https://github.com/sinclairzx81/typebox/issues/1264\n */\nexport const compose = <A extends TSchema[]>(...args: A) => {\n return Type.Composite(args) as unknown as ReturnType<typeof Type.Intersect<A>>\n}\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,YAA0B;AAK5B,MAAM,UAAU,IAAyB,SAAY;AAC1D,SAAO,KAAK,UAAU,IAAI;AAC5B;",
|
|
6
6
|
"names": []
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
export declare const InMemoryWorkspaceSchema: import("@sinclair/typebox").TObject<{
|
|
3
|
+
meta: import("@sinclair/typebox").TObject<{
|
|
4
|
+
"x-scalar-dark-mode": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
5
|
+
"x-scalar-default-client": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
+
"x-scalar-active-document": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
|
+
"x-scalar-theme": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
}>;
|
|
9
|
+
documentConfigs: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
10
|
+
'x-scalar-reference-config': import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
11
|
+
title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
|
+
slug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
|
+
settings: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
14
|
+
proxyUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
15
|
+
searchKey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
16
|
+
}>>;
|
|
17
|
+
tagSort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<"alpha">>;
|
|
18
|
+
operationSort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"method">, import("@sinclair/typebox").TLiteral<"alpha">]>>;
|
|
19
|
+
routing: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
20
|
+
basePath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
|
+
pathNotFound: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
|
+
}>>;
|
|
23
|
+
appearance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
24
|
+
layout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"modern">, import("@sinclair/typebox").TLiteral<"classic">]>>;
|
|
25
|
+
theme: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
|
+
favicon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
27
|
+
initialColorMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"dark">, import("@sinclair/typebox").TLiteral<"light">]>>;
|
|
28
|
+
forceColorMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"dark">, import("@sinclair/typebox").TLiteral<"light">]>>;
|
|
29
|
+
css: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
|
+
loadDefaultFonts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
31
|
+
}>>;
|
|
32
|
+
features: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
33
|
+
showSidebar: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
34
|
+
showModels: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
35
|
+
showDownload: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
36
|
+
showTestRequestButton: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
37
|
+
showSearch: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
38
|
+
showApiClientImport: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
39
|
+
showDarkModeToggle: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
40
|
+
expandAllTagSections: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
41
|
+
persistAuthenticationState: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
42
|
+
}>>;
|
|
43
|
+
meta: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
44
|
+
title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
45
|
+
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
46
|
+
ogTitle: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
47
|
+
ogDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
48
|
+
ogImage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
49
|
+
twitterCard: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
50
|
+
}>>;
|
|
51
|
+
httpClients: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"c/libcurl" | "clojure/clj_http" | "csharp/httpclient" | "csharp/restsharp" | "dart/http" | "go/native" | "http/http1.1" | "java/asynchttp" | "java/nethttp" | "java/okhttp" | "java/unirest" | "js/axios" | "js/fetch" | "js/jquery" | "js/ofetch" | "js/xhr" | "kotlin/okhttp" | "node/axios" | "node/fetch" | "node/ofetch" | "node/undici" | "objc/nsurlsession" | "ocaml/cohttp" | "php/curl" | "php/guzzle" | "powershell/restmethod" | "powershell/webrequest" | "python/python3" | "python/requests" | "python/httpx_sync" | "python/httpx_async" | "r/httr" | "ruby/native" | "rust/reqwest" | "shell/curl" | "shell/httpie" | "shell/wget" | "swift/nsurlsession">[]>>>;
|
|
52
|
+
}>>;
|
|
53
|
+
}>>;
|
|
54
|
+
documents: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
55
|
+
"x-scalar-active-auth": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
56
|
+
"x-scalar-active-server": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
57
|
+
}>, import("./v3.1/strict/openapi-document.js").OpenApiDocumentSchemaType]>>;
|
|
58
|
+
originalDocuments: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
59
|
+
"x-scalar-active-auth": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
60
|
+
"x-scalar-active-server": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
61
|
+
}>, import("./v3.1/strict/openapi-document.js").OpenApiDocumentSchemaType]>>;
|
|
62
|
+
intermediateDocuments: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
63
|
+
"x-scalar-active-auth": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
64
|
+
"x-scalar-active-server": import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
65
|
+
}>, import("./v3.1/strict/openapi-document.js").OpenApiDocumentSchemaType]>>;
|
|
66
|
+
}>;
|
|
67
|
+
export type InMemoryWorkspace = Static<typeof InMemoryWorkspaceSchema>;
|
|
68
|
+
//# sourceMappingURL=inmemory-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inmemory-workspace.d.ts","sourceRoot":"","sources":["../../src/schemas/inmemory-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAErD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WorkspaceDocumentSchema, WorkspaceMetaSchema } from "../schemas/workspace.js";
|
|
2
|
+
import { ConfigSchema } from "../schemas/workspace-specification/config.js";
|
|
3
|
+
import { Type } from "@sinclair/typebox";
|
|
4
|
+
const InMemoryWorkspaceSchema = Type.Object({
|
|
5
|
+
meta: WorkspaceMetaSchema,
|
|
6
|
+
documentConfigs: Type.Record(Type.String(), ConfigSchema),
|
|
7
|
+
documents: Type.Record(Type.String(), WorkspaceDocumentSchema),
|
|
8
|
+
originalDocuments: Type.Record(Type.String(), WorkspaceDocumentSchema),
|
|
9
|
+
intermediateDocuments: Type.Record(Type.String(), WorkspaceDocumentSchema)
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
InMemoryWorkspaceSchema
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=inmemory-workspace.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/schemas/inmemory-workspace.ts"],
|
|
4
|
+
"sourcesContent": ["import { WorkspaceDocumentSchema, WorkspaceMetaSchema } from '@/schemas/workspace'\nimport { ConfigSchema } from '@/schemas/workspace-specification/config'\nimport { Type, type Static } from '@sinclair/typebox'\n\nexport const InMemoryWorkspaceSchema = Type.Object({\n meta: WorkspaceMetaSchema,\n documentConfigs: Type.Record(Type.String(), ConfigSchema),\n documents: Type.Record(Type.String(), WorkspaceDocumentSchema),\n originalDocuments: Type.Record(Type.String(), WorkspaceDocumentSchema),\n intermediateDocuments: Type.Record(Type.String(), WorkspaceDocumentSchema),\n})\n\nexport type InMemoryWorkspace = Static<typeof InMemoryWorkspaceSchema>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,yBAAyB,2BAA2B;AAC7D,SAAS,oBAAoB;AAC7B,SAAS,YAAyB;AAE3B,MAAM,0BAA0B,KAAK,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,iBAAiB,KAAK,OAAO,KAAK,OAAO,GAAG,YAAY;AAAA,EACxD,WAAW,KAAK,OAAO,KAAK,OAAO,GAAG,uBAAuB;AAAA,EAC7D,mBAAmB,KAAK,OAAO,KAAK,OAAO,GAAG,uBAAuB;AAAA,EACrE,uBAAuB,KAAK,OAAO,KAAK,OAAO,GAAG,uBAAuB;AAC3E,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|