@scalar/workspace-store 0.15.7 → 0.15.8
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 +10 -0
- package/dist/client.d.ts +1 -38
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -5
- package/dist/client.js.map +2 -2
- package/dist/navigation/get-navigation-options.d.ts +9 -0
- package/dist/navigation/get-navigation-options.d.ts.map +1 -0
- package/dist/navigation/get-navigation-options.js +77 -0
- package/dist/navigation/get-navigation-options.js.map +7 -0
- package/dist/navigation/helpers/get-x-keys.d.ts +10 -0
- package/dist/navigation/helpers/get-x-keys.d.ts.map +1 -0
- package/dist/navigation/helpers/get-x-keys.js +10 -0
- package/dist/navigation/helpers/get-x-keys.js.map +7 -0
- package/dist/navigation/helpers/traverse-description.d.ts +3 -5
- package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-description.js +4 -5
- package/dist/navigation/helpers/traverse-description.js.map +2 -2
- package/dist/navigation/helpers/traverse-document.d.ts +121 -28
- package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-document.js +16 -21
- package/dist/navigation/helpers/traverse-document.js.map +2 -2
- package/dist/navigation/helpers/traverse-paths.d.ts +4 -5
- package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-paths.js +14 -7
- package/dist/navigation/helpers/traverse-paths.js.map +2 -2
- package/dist/navigation/helpers/traverse-schemas.d.ts +3 -6
- package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-schemas.js +7 -7
- package/dist/navigation/helpers/traverse-schemas.js.map +2 -2
- package/dist/navigation/helpers/traverse-tags.d.ts +2 -5
- package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-tags.js +16 -13
- package/dist/navigation/helpers/traverse-tags.js.map +2 -2
- package/dist/navigation/helpers/traverse-webhooks.d.ts +3 -6
- package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
- package/dist/navigation/helpers/traverse-webhooks.js +27 -7
- package/dist/navigation/helpers/traverse-webhooks.js.map +2 -2
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/index.js.map +2 -2
- package/dist/navigation/types.d.ts +3 -4
- package/dist/navigation/types.d.ts.map +1 -1
- package/dist/schemas/inmemory-workspace.d.ts +162 -102
- package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
- package/dist/schemas/navigation.d.ts +60 -128
- package/dist/schemas/navigation.d.ts.map +1 -1
- package/dist/schemas/navigation.js +40 -44
- package/dist/schemas/navigation.js.map +2 -2
- package/dist/schemas/reference-config/index.d.ts +81 -51
- package/dist/schemas/reference-config/index.d.ts.map +1 -1
- package/dist/schemas/reference-config/settings.d.ts +81 -51
- package/dist/schemas/reference-config/settings.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.d.ts +9980 -1429
- package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/openapi-document.js +31 -4
- package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
- package/dist/schemas/v3.1/strict/ref-definitions.d.ts +8 -0
- package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/ref-definitions.js +12 -1
- package/dist/schemas/v3.1/strict/ref-definitions.js.map +2 -2
- package/dist/schemas/v3.1/strict/schema.d.ts +2 -2
- package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
- package/dist/schemas/v3.1/strict/schema.js +2 -44
- package/dist/schemas/v3.1/strict/schema.js.map +2 -2
- package/dist/schemas/workspace-specification/config.d.ts +113 -51
- package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
- package/dist/schemas/workspace-specification/config.js.map +2 -2
- package/dist/schemas/workspace-specification/index.d.ts +81 -51
- package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
- package/dist/schemas/workspace.d.ts +567 -357
- package/dist/schemas/workspace.d.ts.map +1 -1
- package/dist/server.d.ts +3 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js.map +2 -2
- package/package.json +9 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
1
|
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
2
|
+
import type { DocumentConfiguration } from '../../schemas/workspace-specification/config.js';
|
|
3
3
|
/**
|
|
4
4
|
* Traverses an OpenAPI Document to generate navigation structure and metadata.
|
|
5
5
|
*
|
|
@@ -9,38 +9,68 @@ import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document
|
|
|
9
9
|
* - Tag-based organization of operations and webhooks
|
|
10
10
|
* - Optional schema/model documentation
|
|
11
11
|
*/
|
|
12
|
-
export declare const traverseDocument: (document: OpenApiDocument,
|
|
12
|
+
export declare const traverseDocument: (document: OpenApiDocument, config?: DocumentConfiguration) => {
|
|
13
13
|
entries: (({
|
|
14
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
15
14
|
id: string;
|
|
16
15
|
title: string;
|
|
17
16
|
} & {
|
|
18
17
|
children?: (({
|
|
19
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
20
18
|
id: string;
|
|
21
19
|
title: string;
|
|
22
20
|
} & /*elided*/ any) | ({
|
|
23
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
24
21
|
id: string;
|
|
25
22
|
title: string;
|
|
26
23
|
} & {
|
|
27
|
-
children?: {
|
|
28
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
24
|
+
children?: (({
|
|
29
25
|
id: string;
|
|
30
26
|
title: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
27
|
+
} & /*elided*/ any) | ({
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
} & /*elided*/ any) | ({
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
} & {
|
|
34
|
+
isDeprecated?: boolean | undefined;
|
|
35
|
+
type: "operation";
|
|
36
|
+
ref: string;
|
|
37
|
+
path: string;
|
|
38
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
39
|
+
}) | ({
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
} & {
|
|
43
|
+
type: "model";
|
|
44
|
+
ref: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}) | ({
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
} & {
|
|
50
|
+
isDeprecated?: boolean | undefined;
|
|
51
|
+
type: "webhook";
|
|
52
|
+
ref: string;
|
|
53
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
54
|
+
name: string;
|
|
55
|
+
}))[] | undefined;
|
|
56
|
+
description?: string | undefined;
|
|
57
|
+
isWebhooks?: boolean | undefined;
|
|
58
|
+
xKeys?: {
|
|
59
|
+
[x: string]: unknown;
|
|
60
|
+
} | undefined;
|
|
61
|
+
type: "tag";
|
|
62
|
+
name: string;
|
|
63
|
+
isGroup: boolean;
|
|
33
64
|
}) | ({
|
|
34
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
35
65
|
id: string;
|
|
36
66
|
title: string;
|
|
37
67
|
} & {
|
|
68
|
+
isDeprecated?: boolean | undefined;
|
|
38
69
|
type: "operation";
|
|
39
70
|
ref: string;
|
|
40
|
-
method: string;
|
|
41
71
|
path: string;
|
|
72
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
42
73
|
}) | ({
|
|
43
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
44
74
|
id: string;
|
|
45
75
|
title: string;
|
|
46
76
|
} & {
|
|
@@ -48,40 +78,104 @@ export declare const traverseDocument: (document: OpenApiDocument, { hideModels,
|
|
|
48
78
|
ref: string;
|
|
49
79
|
name: string;
|
|
50
80
|
}) | ({
|
|
51
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
52
81
|
id: string;
|
|
53
82
|
title: string;
|
|
54
83
|
} & {
|
|
84
|
+
isDeprecated?: boolean | undefined;
|
|
55
85
|
type: "webhook";
|
|
56
86
|
ref: string;
|
|
57
|
-
method:
|
|
87
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
58
88
|
name: string;
|
|
59
89
|
}))[] | undefined;
|
|
60
|
-
type: "
|
|
61
|
-
name: string;
|
|
62
|
-
isGroup: boolean;
|
|
90
|
+
type: "text";
|
|
63
91
|
}) | ({
|
|
64
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
65
92
|
id: string;
|
|
66
93
|
title: string;
|
|
67
94
|
} & {
|
|
68
|
-
children?: {
|
|
69
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
95
|
+
children?: (({
|
|
70
96
|
id: string;
|
|
71
97
|
title: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
98
|
+
} & {
|
|
99
|
+
children?: (({
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
} & /*elided*/ any) | ({
|
|
103
|
+
id: string;
|
|
104
|
+
title: string;
|
|
105
|
+
} & /*elided*/ any) | ({
|
|
106
|
+
id: string;
|
|
107
|
+
title: string;
|
|
108
|
+
} & {
|
|
109
|
+
isDeprecated?: boolean | undefined;
|
|
110
|
+
type: "operation";
|
|
111
|
+
ref: string;
|
|
112
|
+
path: string;
|
|
113
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
114
|
+
}) | ({
|
|
115
|
+
id: string;
|
|
116
|
+
title: string;
|
|
117
|
+
} & {
|
|
118
|
+
type: "model";
|
|
119
|
+
ref: string;
|
|
120
|
+
name: string;
|
|
121
|
+
}) | ({
|
|
122
|
+
id: string;
|
|
123
|
+
title: string;
|
|
124
|
+
} & {
|
|
125
|
+
isDeprecated?: boolean | undefined;
|
|
126
|
+
type: "webhook";
|
|
127
|
+
ref: string;
|
|
128
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
129
|
+
name: string;
|
|
130
|
+
}))[] | undefined;
|
|
131
|
+
type: "text";
|
|
132
|
+
}) | ({
|
|
133
|
+
id: string;
|
|
134
|
+
title: string;
|
|
135
|
+
} & /*elided*/ any) | ({
|
|
136
|
+
id: string;
|
|
137
|
+
title: string;
|
|
138
|
+
} & {
|
|
139
|
+
isDeprecated?: boolean | undefined;
|
|
140
|
+
type: "operation";
|
|
141
|
+
ref: string;
|
|
142
|
+
path: string;
|
|
143
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
144
|
+
}) | ({
|
|
145
|
+
id: string;
|
|
146
|
+
title: string;
|
|
147
|
+
} & {
|
|
148
|
+
type: "model";
|
|
149
|
+
ref: string;
|
|
150
|
+
name: string;
|
|
151
|
+
}) | ({
|
|
152
|
+
id: string;
|
|
153
|
+
title: string;
|
|
154
|
+
} & {
|
|
155
|
+
isDeprecated?: boolean | undefined;
|
|
156
|
+
type: "webhook";
|
|
157
|
+
ref: string;
|
|
158
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
159
|
+
name: string;
|
|
160
|
+
}))[] | undefined;
|
|
161
|
+
description?: string | undefined;
|
|
162
|
+
isWebhooks?: boolean | undefined;
|
|
163
|
+
xKeys?: {
|
|
164
|
+
[x: string]: unknown;
|
|
165
|
+
} | undefined;
|
|
166
|
+
type: "tag";
|
|
167
|
+
name: string;
|
|
168
|
+
isGroup: boolean;
|
|
74
169
|
}) | ({
|
|
75
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
76
170
|
id: string;
|
|
77
171
|
title: string;
|
|
78
172
|
} & {
|
|
173
|
+
isDeprecated?: boolean | undefined;
|
|
79
174
|
type: "operation";
|
|
80
175
|
ref: string;
|
|
81
|
-
method: string;
|
|
82
176
|
path: string;
|
|
177
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
83
178
|
}) | ({
|
|
84
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
85
179
|
id: string;
|
|
86
180
|
title: string;
|
|
87
181
|
} & {
|
|
@@ -89,15 +183,14 @@ export declare const traverseDocument: (document: OpenApiDocument, { hideModels,
|
|
|
89
183
|
ref: string;
|
|
90
184
|
name: string;
|
|
91
185
|
}) | ({
|
|
92
|
-
type: "text" | "operation" | "model" | "tag" | "webhook";
|
|
93
186
|
id: string;
|
|
94
187
|
title: string;
|
|
95
188
|
} & {
|
|
189
|
+
isDeprecated?: boolean | undefined;
|
|
96
190
|
type: "webhook";
|
|
97
191
|
ref: string;
|
|
98
|
-
method:
|
|
192
|
+
method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
99
193
|
name: string;
|
|
100
194
|
}))[];
|
|
101
|
-
titles: Map<string, string>;
|
|
102
195
|
};
|
|
103
196
|
//# 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":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,wCAAwC,CAAA;AAC7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAQrF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,eAAe,EAAE,SAAS,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDzF,CAAA"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
+
import { getNavigationOptions } from "../../navigation/get-navigation-options.js";
|
|
1
2
|
import { traverseDescription } from "./traverse-description.js";
|
|
2
3
|
import { traversePaths } from "./traverse-paths.js";
|
|
3
4
|
import { traverseSchemas } from "./traverse-schemas.js";
|
|
4
5
|
import { traverseTags } from "./traverse-tags.js";
|
|
5
6
|
import { traverseWebhooks } from "./traverse-webhooks.js";
|
|
6
|
-
const traverseDocument = (document, {
|
|
7
|
-
hideModels =
|
|
8
|
-
tagsSorter = "alpha",
|
|
9
|
-
operationsSorter = "alpha",
|
|
10
|
-
getHeadingId = (heading) => heading.value,
|
|
11
|
-
getOperationId = (operation) => operation.summary ?? "",
|
|
12
|
-
getWebhookId = (webhook) => webhook?.name ?? "webhooks",
|
|
13
|
-
getModelId = (model) => model?.name ?? "",
|
|
14
|
-
getTagId = (tag) => tag.name ?? ""
|
|
15
|
-
}) => {
|
|
16
|
-
const titles = /* @__PURE__ */ new Map();
|
|
7
|
+
const traverseDocument = (document, config) => {
|
|
8
|
+
const { hideModels, tagsSorter, operationsSorter, getHeadingId, getOperationId, getWebhookId, getModelId, getTagId } = getNavigationOptions(config);
|
|
17
9
|
const tagsMap = new Map(
|
|
18
10
|
document.tags?.map((tag) => [tag.name ?? "Untitled Tag", { tag, entries: [] }]) ?? []
|
|
19
11
|
);
|
|
20
|
-
const entries = traverseDescription(document.info?.description,
|
|
21
|
-
traversePaths(document, tagsMap,
|
|
22
|
-
const untaggedWebhooks = traverseWebhooks(document, tagsMap,
|
|
23
|
-
const tagsEntries = traverseTags(document, tagsMap,
|
|
12
|
+
const entries = traverseDescription(document.info?.description, getHeadingId);
|
|
13
|
+
traversePaths(document, tagsMap, getOperationId);
|
|
14
|
+
const untaggedWebhooks = traverseWebhooks(document, tagsMap, getWebhookId);
|
|
15
|
+
const tagsEntries = traverseTags(document, tagsMap, {
|
|
24
16
|
getTagId,
|
|
25
17
|
tagsSorter,
|
|
26
18
|
operationsSorter
|
|
@@ -28,24 +20,27 @@ const traverseDocument = (document, {
|
|
|
28
20
|
entries.push(...tagsEntries);
|
|
29
21
|
if (untaggedWebhooks.length) {
|
|
30
22
|
entries.push({
|
|
23
|
+
type: "tag",
|
|
31
24
|
id: getWebhookId({ name: "" }),
|
|
32
25
|
title: "Webhooks",
|
|
26
|
+
name: "Webhooks",
|
|
33
27
|
children: untaggedWebhooks,
|
|
34
|
-
|
|
28
|
+
isGroup: false,
|
|
29
|
+
isWebhooks: true
|
|
35
30
|
});
|
|
36
31
|
}
|
|
37
32
|
if (!hideModels && document.components?.schemas) {
|
|
38
|
-
const untaggedModels = traverseSchemas(document, tagsMap,
|
|
33
|
+
const untaggedModels = traverseSchemas(document, tagsMap, getModelId);
|
|
39
34
|
if (untaggedModels.length) {
|
|
40
35
|
entries.push({
|
|
41
|
-
|
|
36
|
+
type: "text",
|
|
37
|
+
id: "models",
|
|
42
38
|
title: "Models",
|
|
43
|
-
children: untaggedModels
|
|
44
|
-
type: "text"
|
|
39
|
+
children: untaggedModels
|
|
45
40
|
});
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
|
-
return { entries
|
|
43
|
+
return { entries };
|
|
49
44
|
};
|
|
50
45
|
export {
|
|
51
46
|
traverseDocument
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-document.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { getNavigationOptions } from '@/navigation/get-navigation-options'\nimport type { TagsMap } from '@/navigation/types'\nimport type { OpenApiDocument, TraversedEntry } from '@/schemas/v3.1/strict/openapi-document'\nimport type { DocumentConfiguration } from '@/schemas/workspace-specification/config'\n\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'\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 = (document: OpenApiDocument, config?: DocumentConfiguration) => {\n const { hideModels, tagsSorter, operationsSorter, getHeadingId, getOperationId, getWebhookId, getModelId, getTagId } =\n getNavigationOptions(config)\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, getHeadingId)\n traversePaths(document, tagsMap, getOperationId)\n const untaggedWebhooks = traverseWebhooks(document, tagsMap, getWebhookId)\n const tagsEntries = traverseTags(document, tagsMap, {\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 type: 'tag',\n id: getWebhookId({ name: '' }),\n title: 'Webhooks',\n name: 'Webhooks',\n children: untaggedWebhooks,\n isGroup: false,\n isWebhooks: true,\n })\n }\n\n // Add models if they are not hidden\n if (!hideModels && document.components?.schemas) {\n const untaggedModels = traverseSchemas(document, tagsMap, getModelId)\n\n if (untaggedModels.length) {\n entries.push({\n type: 'text',\n id: 'models',\n title: 'Models',\n children: untaggedModels,\n })\n }\n }\n\n return { entries }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAKrC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAW1B,MAAM,mBAAmB,CAAC,UAA2B,WAAmC;AAC7F,QAAM,EAAE,YAAY,YAAY,kBAAkB,cAAc,gBAAgB,cAAc,YAAY,SAAS,IACjH,qBAAqB,MAAM;AAG7B,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,YAAY;AAC9F,gBAAc,UAAU,SAAS,cAAc;AAC/C,QAAM,mBAAmB,iBAAiB,UAAU,SAAS,YAAY;AACzE,QAAM,cAAc,aAAa,UAAU,SAAS;AAAA,IAClD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAGD,UAAQ,KAAK,GAAG,WAAW;AAG3B,MAAI,iBAAiB,QAAQ;AAC3B,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,IAAI,aAAa,EAAE,MAAM,GAAG,CAAC;AAAA,MAC7B,OAAO;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AAGA,MAAI,CAAC,cAAc,SAAS,YAAY,SAAS;AAC/C,UAAM,iBAAiB,gBAAgB,UAAU,SAAS,UAAU;AAEpE,QAAI,eAAe,QAAQ;AACzB,cAAQ,KAAK;AAAA,QACX,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ;AACnB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
|
-
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
2
|
+
import type { OpenApiDocument, OperationObject } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
3
|
+
export declare const isDeprecatedOperation: (operation: OperationObject) => boolean;
|
|
3
4
|
/**
|
|
4
5
|
* Traverses the paths in an OpenAPI document to build a map of operations organized by tags.
|
|
5
6
|
*
|
|
@@ -13,13 +14,11 @@ import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document
|
|
|
13
14
|
*
|
|
14
15
|
* @param content - The OpenAPI document to traverse
|
|
15
16
|
* @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects
|
|
16
|
-
* @param
|
|
17
|
+
* @param entitiesMap - Map to store operation IDs and titles for mobile header navigation
|
|
17
18
|
* @param getOperationId - Function to generate unique IDs for operations
|
|
18
19
|
* @returns Map of tag names to arrays of traversed operations
|
|
19
20
|
*/
|
|
20
21
|
export declare const traversePaths: (content: OpenApiDocument,
|
|
21
22
|
/** Map of tags and their entries */
|
|
22
|
-
tagsMap: TagsMap,
|
|
23
|
-
/** Map of titles for the mobile header */
|
|
24
|
-
titlesMap: Map<string, string>, getOperationId: TraverseSpecOptions["getOperationId"]) => void;
|
|
23
|
+
tagsMap: TagsMap, getOperationId: TraverseSpecOptions["getOperationId"]) => void;
|
|
25
24
|
//# sourceMappingURL=traverse-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEtE,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAGhB,MAAM,wCAAwC,CAAA;AAI/C,eAAO,MAAM,qBAAqB,GAAI,WAAW,eAAe,YAE/D,CAAA;AAwCD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,eAAe;AACxB,oCAAoC;AACpC,SAAS,OAAO,EAChB,gBAAgB,mBAAmB,CAAC,gBAAgB,CAAC,SAkCtD,CAAA"}
|
|
@@ -2,21 +2,27 @@ import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
|
|
|
2
2
|
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
3
3
|
import { escapeJsonPointer } from "@scalar/json-magic/helpers/escape-json-pointer";
|
|
4
4
|
import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
|
|
5
|
+
import { XScalarStabilityValues } from "../../schemas/extensions/operation/x-scalar-stability.js";
|
|
5
6
|
import { getTag } from "./get-tag.js";
|
|
6
|
-
const
|
|
7
|
+
const isDeprecatedOperation = (operation) => {
|
|
8
|
+
return operation.deprecated || operation["x-scalar-stability"] === XScalarStabilityValues.Deprecated;
|
|
9
|
+
};
|
|
10
|
+
const createOperationEntry = (ref, operation, method, path = "Unknown", tag, getOperationId) => {
|
|
7
11
|
const id = getOperationId({ ...operation, method, path }, tag);
|
|
8
12
|
const title = operation.summary?.trim() ? operation.summary : path;
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
const isDeprecated = isDeprecatedOperation(operation);
|
|
14
|
+
const entry = {
|
|
11
15
|
id,
|
|
12
16
|
title,
|
|
13
17
|
path,
|
|
14
18
|
method,
|
|
15
19
|
ref,
|
|
16
|
-
type: "operation"
|
|
20
|
+
type: "operation",
|
|
21
|
+
isDeprecated: isDeprecated ? isDeprecated : void 0
|
|
17
22
|
};
|
|
23
|
+
return entry;
|
|
18
24
|
};
|
|
19
|
-
const traversePaths = (content, tagsMap,
|
|
25
|
+
const traversePaths = (content, tagsMap, getOperationId) => {
|
|
20
26
|
Object.entries(content.paths ?? {}).forEach(([path, pathItemObject]) => {
|
|
21
27
|
const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key));
|
|
22
28
|
pathKeys.forEach((method) => {
|
|
@@ -32,16 +38,17 @@ const traversePaths = (content, tagsMap, titlesMap, getOperationId) => {
|
|
|
32
38
|
if (operation.tags?.length) {
|
|
33
39
|
operation.tags.forEach((tagName) => {
|
|
34
40
|
const { tag } = getTag(tagsMap, tagName);
|
|
35
|
-
tagsMap.get(tagName)?.entries.push(createOperationEntry(ref, operation, method, path, tag,
|
|
41
|
+
tagsMap.get(tagName)?.entries.push(createOperationEntry(ref, operation, method, path, tag, getOperationId));
|
|
36
42
|
});
|
|
37
43
|
} else {
|
|
38
44
|
const { tag } = getTag(tagsMap, "default");
|
|
39
|
-
tagsMap.get("default")?.entries.push(createOperationEntry(ref, operation, method, path, tag,
|
|
45
|
+
tagsMap.get("default")?.entries.push(createOperationEntry(ref, operation, method, path, tag, getOperationId));
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
48
|
});
|
|
43
49
|
};
|
|
44
50
|
export {
|
|
51
|
+
isDeprecatedOperation,
|
|
45
52
|
traversePaths
|
|
46
53
|
};
|
|
47
54
|
//# sourceMappingURL=traverse-paths.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-paths.ts"],
|
|
4
|
-
"sourcesContent": ["import { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { objectKeys } from '@scalar/helpers/object/object-keys'\nimport { escapeJsonPointer } from '@scalar/json-magic/helpers/escape-json-pointer'\n\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { objectKeys } from '@scalar/helpers/object/object-keys'\nimport { escapeJsonPointer } from '@scalar/json-magic/helpers/escape-json-pointer'\n\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport { XScalarStabilityValues } from '@/schemas/extensions/operation/x-scalar-stability'\nimport type {\n OpenApiDocument,\n OperationObject,\n TagObject,\n TraversedOperation,\n} from '@/schemas/v3.1/strict/openapi-document'\n\nimport { getTag } from './get-tag'\n\nexport const isDeprecatedOperation = (operation: OperationObject) => {\n return operation.deprecated || operation['x-scalar-stability'] === XScalarStabilityValues.Deprecated\n}\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 entitiesMap - 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: HttpMethod,\n path = 'Unknown',\n tag: TagObject,\n getOperationId: TraverseSpecOptions['getOperationId'],\n): TraversedOperation => {\n const id = getOperationId({ ...operation, method, path }, tag)\n const title = operation.summary?.trim() ? operation.summary : path\n\n const isDeprecated = isDeprecatedOperation(operation)\n\n const entry = {\n id,\n title,\n path,\n method,\n ref,\n type: 'operation',\n isDeprecated: isDeprecated ? isDeprecated : undefined,\n } satisfies TraversedOperation\n\n return entry\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 entitiesMap - 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 getOperationId: TraverseSpecOptions['getOperationId'],\n) => {\n // Traverse paths\n Object.entries(content.paths ?? {}).forEach(([path, pathItemObject]) => {\n const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key))\n\n pathKeys.forEach((method) => {\n const _operation = pathItemObject?.[method]\n const operation = getResolvedRef(_operation)\n if (!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.get(tagName)?.entries.push(createOperationEntry(ref, operation, method, path, tag, getOperationId))\n })\n }\n // Add to default tag\n else {\n const { tag } = getTag(tagsMap, 'default')\n tagsMap.get('default')?.entries.push(createOperationEntry(ref, operation, method, path, tag, getOperationId))\n }\n })\n })\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAElC,SAAS,sBAAsB;AAE/B,SAAS,8BAA8B;AAQvC,SAAS,cAAc;AAEhB,MAAM,wBAAwB,CAAC,cAA+B;AACnE,SAAO,UAAU,cAAc,UAAU,oBAAoB,MAAM,uBAAuB;AAC5F;AAcA,MAAM,uBAAuB,CAC3B,KACA,WACA,QACA,OAAO,WACP,KACA,mBACuB;AACvB,QAAM,KAAK,eAAe,EAAE,GAAG,WAAW,QAAQ,KAAK,GAAG,GAAG;AAC7D,QAAM,QAAQ,UAAU,SAAS,KAAK,IAAI,UAAU,UAAU;AAE9D,QAAM,eAAe,sBAAsB,SAAS;AAEpD,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,cAAc,eAAe,eAAe;AAAA,EAC9C;AAEA,SAAO;AACT;AAmBO,MAAM,gBAAgB,CAC3B,SAEA,SACA,mBACG;AAEH,SAAO,QAAQ,QAAQ,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,cAAc,MAAM;AACtE,UAAM,WAAW,WAAW,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,aAAa,GAAG,CAAC;AAEnF,aAAS,QAAQ,CAAC,WAAW;AAC3B,YAAM,aAAa,iBAAiB,MAAM;AAC1C,YAAM,YAAY,eAAe,UAAU;AAC3C,UAAI,CAAC,WAAW;AACd;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,kBAAQ,IAAI,OAAO,GAAG,QAAQ,KAAK,qBAAqB,KAAK,WAAW,QAAQ,MAAM,KAAK,cAAc,CAAC;AAAA,QAC5G,CAAC;AAAA,MACH,OAEK;AACH,cAAM,EAAE,IAAI,IAAI,OAAO,SAAS,SAAS;AACzC,gBAAQ,IAAI,SAAS,GAAG,QAAQ,KAAK,qBAAqB,KAAK,WAAW,QAAQ,MAAM,KAAK,cAAc,CAAC;AAAA,MAC9G;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
|
-
import type { TraversedSchema } from '../../schemas/
|
|
3
|
-
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
2
|
+
import type { OpenApiDocument, TraversedSchema } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
4
3
|
/** Traverses the schemas in an OpenAPI document to build an array of model entries.
|
|
5
4
|
*
|
|
6
5
|
* This function processes each schema in components.schemas to:
|
|
@@ -9,13 +8,11 @@ import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document
|
|
|
9
8
|
* - Store model IDs and titles for mobile header navigation
|
|
10
9
|
*
|
|
11
10
|
* @param content - The OpenAPI document to traverse
|
|
12
|
-
* @param
|
|
11
|
+
* @param entitiesMap - Map to store schema IDs and titles for mobile header navigation
|
|
13
12
|
* @param getModelId - Function to generate unique IDs for schemas
|
|
14
13
|
* @returns Array of traversed schema entries
|
|
15
14
|
*/
|
|
16
15
|
export declare const traverseSchemas: (content: OpenApiDocument,
|
|
17
16
|
/** Map of tagNames and their entries */
|
|
18
|
-
tagsMap: TagsMap,
|
|
19
|
-
/** Map of titles for the mobile header */
|
|
20
|
-
titlesMap: Map<string, string>, getModelId: TraverseSpecOptions["getModelId"]) => TraversedSchema[];
|
|
17
|
+
tagsMap: TagsMap, getModelId: TraverseSpecOptions["getModelId"]) => TraversedSchema[];
|
|
21
18
|
//# sourceMappingURL=traverse-schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAA2B,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAmCvH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,eAAe;AACxB,wCAAwC;AACxC,SAAS,OAAO,EAChB,YAAY,mBAAmB,CAAC,YAAY,CAAC,KAC5C,eAAe,EA4BjB,CAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
|
|
2
2
|
import { getTag } from "../../navigation/helpers/get-tag.js";
|
|
3
|
-
const createSchemaEntry = (ref, name = "Unknown",
|
|
3
|
+
const createSchemaEntry = (ref, name = "Unknown", getModelId, tag, _schema) => {
|
|
4
4
|
const id = getModelId({ name }, tag);
|
|
5
5
|
const schema = getResolvedRef(_schema);
|
|
6
6
|
const title = schema && "title" in schema && schema.title || name;
|
|
7
|
-
|
|
8
|
-
return {
|
|
7
|
+
const entry = {
|
|
9
8
|
id,
|
|
10
9
|
title,
|
|
11
10
|
name,
|
|
12
11
|
ref,
|
|
13
12
|
type: "model"
|
|
14
13
|
};
|
|
14
|
+
return entry;
|
|
15
15
|
};
|
|
16
|
-
const traverseSchemas = (content, tagsMap,
|
|
16
|
+
const traverseSchemas = (content, tagsMap, getModelId) => {
|
|
17
17
|
const schemas = content.components?.schemas ?? {};
|
|
18
18
|
const untagged = [];
|
|
19
19
|
for (const name in schemas) {
|
|
@@ -21,14 +21,14 @@ const traverseSchemas = (content, tagsMap, titlesMap, getModelId) => {
|
|
|
21
21
|
if (schema?.["x-internal"] || schema?.["x-scalar-ignore"] || !Object.hasOwn(schemas, name)) {
|
|
22
22
|
continue;
|
|
23
23
|
}
|
|
24
|
-
const ref = `#/
|
|
24
|
+
const ref = `#/components/schemas/${name}`;
|
|
25
25
|
if (schema?.["x-tags"]) {
|
|
26
26
|
schema["x-tags"].forEach((tagName) => {
|
|
27
27
|
const { tag } = getTag(tagsMap, tagName);
|
|
28
|
-
tagsMap.get(tagName)?.entries.push(createSchemaEntry(ref, name,
|
|
28
|
+
tagsMap.get(tagName)?.entries.push(createSchemaEntry(ref, name, getModelId, tag));
|
|
29
29
|
});
|
|
30
30
|
} else {
|
|
31
|
-
untagged.push(createSchemaEntry(ref, name,
|
|
31
|
+
untagged.push(createSchemaEntry(ref, name, getModelId, void 0, getResolvedRef(schemas[name])));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return untagged;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/navigation/helpers/traverse-schemas.ts"],
|
|
4
|
-
"sourcesContent": ["import { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { getTag } from '@/navigation/helpers/get-tag'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type {
|
|
5
|
-
"mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { getTag } from '@/navigation/helpers/get-tag'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument, SchemaObject, TagObject, TraversedSchema } from '@/schemas/v3.1/strict/openapi-document'\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 entriesMap - 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 createSchemaEntry = (\n ref: string,\n name = 'Unknown',\n getModelId: TraverseSpecOptions['getModelId'],\n tag?: TagObject,\n _schema?: SchemaObject,\n): TraversedSchema => {\n const id = getModelId({ name }, tag)\n const schema = getResolvedRef(_schema)\n\n // Use schema.title if available, otherwise fall back to name\n // @see https://json-schema.org/draft/2020-12/json-schema-core#section-4.3.5\n const title = (schema && 'title' in schema && (schema.title as string)) || name\n\n const entry = {\n id,\n title,\n name,\n ref,\n type: 'model',\n } satisfies TraversedSchema\n\n return entry\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 entitiesMap - 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 getModelId: TraverseSpecOptions['getModelId'],\n): TraversedSchema[] => {\n const schemas = content.components?.schemas ?? {}\n const untagged: TraversedSchema[] = []\n\n // biome-ignore lint/suspicious/useGuardForIn: we do have an if statement after de-ref\n for (const name in schemas) {\n const schema = getResolvedRef(schemas[name])\n\n if (schema?.['x-internal'] || schema?.['x-scalar-ignore'] || !Object.hasOwn(schemas, name)) {\n continue\n }\n\n const ref = `#/components/schemas/${name}`\n\n // Add to tags\n if (schema?.['x-tags']) {\n schema['x-tags'].forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap.get(tagName)?.entries.push(createSchemaEntry(ref, name, getModelId, tag))\n })\n }\n // Add to untagged\n else {\n untagged.push(createSchemaEntry(ref, name, getModelId, undefined, getResolvedRef(schemas[name])))\n }\n }\n\n return untagged\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AAYvB,MAAM,oBAAoB,CACxB,KACA,OAAO,WACP,YACA,KACA,YACoB;AACpB,QAAM,KAAK,WAAW,EAAE,KAAK,GAAG,GAAG;AACnC,QAAM,SAAS,eAAe,OAAO;AAIrC,QAAM,QAAS,UAAU,WAAW,UAAW,OAAO,SAAqB;AAE3E,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,EACR;AAEA,SAAO;AACT;AAcO,MAAM,kBAAkB,CAC7B,SAEA,SACA,eACsB;AACtB,QAAM,UAAU,QAAQ,YAAY,WAAW,CAAC;AAChD,QAAM,WAA8B,CAAC;AAGrC,aAAW,QAAQ,SAAS;AAC1B,UAAM,SAAS,eAAe,QAAQ,IAAI,CAAC;AAE3C,QAAI,SAAS,YAAY,KAAK,SAAS,iBAAiB,KAAK,CAAC,OAAO,OAAO,SAAS,IAAI,GAAG;AAC1F;AAAA,IACF;AAEA,UAAM,MAAM,wBAAwB,IAAI;AAGxC,QAAI,SAAS,QAAQ,GAAG;AACtB,aAAO,QAAQ,EAAE,QAAQ,CAAC,YAAoB;AAC5C,cAAM,EAAE,IAAI,IAAI,OAAO,SAAS,OAAO;AACvC,gBAAQ,IAAI,OAAO,GAAG,QAAQ,KAAK,kBAAkB,KAAK,MAAM,YAAY,GAAG,CAAC;AAAA,MAClF,CAAC;AAAA,IACH,OAEK;AACH,eAAS,KAAK,kBAAkB,KAAK,MAAM,YAAY,QAAW,eAAe,QAAQ,IAAI,CAAC,CAAC,CAAC;AAAA,IAClG;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { TagsMap, TraverseSpecOptions } from '../../navigation/types.js';
|
|
2
|
-
import type { TraversedEntry } from '../../schemas/
|
|
3
|
-
import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
2
|
+
import type { OpenApiDocument, TraversedEntry } from '../../schemas/v3.1/strict/openapi-document.js';
|
|
4
3
|
type Options = Pick<TraverseSpecOptions, 'getTagId' | 'tagsSorter' | 'operationsSorter'>;
|
|
5
4
|
/**
|
|
6
5
|
* Traverses the tags map to create navigation entries, handling both grouped and ungrouped tags.
|
|
@@ -13,8 +12,6 @@ type Options = Pick<TraverseSpecOptions, 'getTagId' | 'tagsSorter' | 'operations
|
|
|
13
12
|
*/
|
|
14
13
|
export declare const traverseTags: (content: OpenApiDocument,
|
|
15
14
|
/** Map of tags and their entries */
|
|
16
|
-
tagsMap: TagsMap,
|
|
17
|
-
/** Map of titles for the mobile title */
|
|
18
|
-
titlesMap: Map<string, string>, { getTagId, tagsSorter, operationsSorter }: Options) => TraversedEntry[];
|
|
15
|
+
tagsMap: TagsMap, { getTagId, tagsSorter, operationsSorter }: Options) => TraversedEntry[];
|
|
19
16
|
export {};
|
|
20
17
|
//# sourceMappingURL=traverse-tags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAa,cAAc,EAAgB,MAAM,wCAAwC,CAAA;AAItH,KAAK,OAAO,GAAG,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,YAAY,GAAG,kBAAkB,CAAC,CAAA;AA2HxF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,SAAS,eAAe;AACxB,oCAAoC;AACpC,SAAS,OAAO,EAChB,4CAA4C,OAAO,KAClD,cAAc,EAyBhB,CAAA"}
|