@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.
Files changed (76) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/client.d.ts +1 -38
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +2 -5
  5. package/dist/client.js.map +2 -2
  6. package/dist/navigation/get-navigation-options.d.ts +9 -0
  7. package/dist/navigation/get-navigation-options.d.ts.map +1 -0
  8. package/dist/navigation/get-navigation-options.js +77 -0
  9. package/dist/navigation/get-navigation-options.js.map +7 -0
  10. package/dist/navigation/helpers/get-x-keys.d.ts +10 -0
  11. package/dist/navigation/helpers/get-x-keys.d.ts.map +1 -0
  12. package/dist/navigation/helpers/get-x-keys.js +10 -0
  13. package/dist/navigation/helpers/get-x-keys.js.map +7 -0
  14. package/dist/navigation/helpers/traverse-description.d.ts +3 -5
  15. package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
  16. package/dist/navigation/helpers/traverse-description.js +4 -5
  17. package/dist/navigation/helpers/traverse-description.js.map +2 -2
  18. package/dist/navigation/helpers/traverse-document.d.ts +121 -28
  19. package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
  20. package/dist/navigation/helpers/traverse-document.js +16 -21
  21. package/dist/navigation/helpers/traverse-document.js.map +2 -2
  22. package/dist/navigation/helpers/traverse-paths.d.ts +4 -5
  23. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  24. package/dist/navigation/helpers/traverse-paths.js +14 -7
  25. package/dist/navigation/helpers/traverse-paths.js.map +2 -2
  26. package/dist/navigation/helpers/traverse-schemas.d.ts +3 -6
  27. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  28. package/dist/navigation/helpers/traverse-schemas.js +7 -7
  29. package/dist/navigation/helpers/traverse-schemas.js.map +2 -2
  30. package/dist/navigation/helpers/traverse-tags.d.ts +2 -5
  31. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  32. package/dist/navigation/helpers/traverse-tags.js +16 -13
  33. package/dist/navigation/helpers/traverse-tags.js.map +2 -2
  34. package/dist/navigation/helpers/traverse-webhooks.d.ts +3 -6
  35. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  36. package/dist/navigation/helpers/traverse-webhooks.js +27 -7
  37. package/dist/navigation/helpers/traverse-webhooks.js.map +2 -2
  38. package/dist/navigation/index.d.ts +1 -0
  39. package/dist/navigation/index.d.ts.map +1 -1
  40. package/dist/navigation/index.js +2 -0
  41. package/dist/navigation/index.js.map +2 -2
  42. package/dist/navigation/types.d.ts +3 -4
  43. package/dist/navigation/types.d.ts.map +1 -1
  44. package/dist/schemas/inmemory-workspace.d.ts +162 -102
  45. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  46. package/dist/schemas/navigation.d.ts +60 -128
  47. package/dist/schemas/navigation.d.ts.map +1 -1
  48. package/dist/schemas/navigation.js +40 -44
  49. package/dist/schemas/navigation.js.map +2 -2
  50. package/dist/schemas/reference-config/index.d.ts +81 -51
  51. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  52. package/dist/schemas/reference-config/settings.d.ts +81 -51
  53. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  54. package/dist/schemas/v3.1/strict/openapi-document.d.ts +9980 -1429
  55. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  56. package/dist/schemas/v3.1/strict/openapi-document.js +31 -4
  57. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  58. package/dist/schemas/v3.1/strict/ref-definitions.d.ts +8 -0
  59. package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -1
  60. package/dist/schemas/v3.1/strict/ref-definitions.js +12 -1
  61. package/dist/schemas/v3.1/strict/ref-definitions.js.map +2 -2
  62. package/dist/schemas/v3.1/strict/schema.d.ts +2 -2
  63. package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
  64. package/dist/schemas/v3.1/strict/schema.js +2 -44
  65. package/dist/schemas/v3.1/strict/schema.js.map +2 -2
  66. package/dist/schemas/workspace-specification/config.d.ts +113 -51
  67. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  68. package/dist/schemas/workspace-specification/config.js.map +2 -2
  69. package/dist/schemas/workspace-specification/index.d.ts +81 -51
  70. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  71. package/dist/schemas/workspace.d.ts +567 -357
  72. package/dist/schemas/workspace.d.ts.map +1 -1
  73. package/dist/server.d.ts +3 -4
  74. package/dist/server.d.ts.map +1 -1
  75. package/dist/server.js.map +2 -2
  76. 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, { hideModels, tagsSorter, operationsSorter, getHeadingId, getOperationId, getWebhookId, getModelId, getTagId, }: Partial<TraverseSpecOptions>) => {
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
- }[] | undefined;
32
- type: "text";
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: string;
87
+ method: "delete" | "connect" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
58
88
  name: string;
59
89
  }))[] | undefined;
60
- type: "tag";
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
- }[] | undefined;
73
- type: "text";
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: string;
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":"AAAA,OAAO,KAAK,EAAW,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAQ7E;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,eAAe,EACzB,iHASG,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ChC,CAAA"}
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 = false,
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, titles, getHeadingId);
21
- traversePaths(document, tagsMap, titles, getOperationId);
22
- const untaggedWebhooks = traverseWebhooks(document, tagsMap, titles, getWebhookId);
23
- const tagsEntries = traverseTags(document, tagsMap, titles, {
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
- type: "text"
28
+ isGroup: false,
29
+ isWebhooks: true
35
30
  });
36
31
  }
37
32
  if (!hideModels && document.components?.schemas) {
38
- const untaggedModels = traverseSchemas(document, tagsMap, titles, getModelId);
33
+ const untaggedModels = traverseSchemas(document, tagsMap, getModelId);
39
34
  if (untaggedModels.length) {
40
35
  entries.push({
41
- id: getModelId({}),
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, titles };
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 type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { TraversedEntry } from '@/schemas/navigation'\nimport type { OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\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 = (\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({ name: '' }),\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": "AAIA,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAW1B,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,EAAE,MAAM,GAAG,CAAC;AAAA,MAC7B,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,CAAC,CAAC;AAAA,QACjB,OAAO;AAAA,QACP,UAAU;AAAA,QACV,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,OAAO;AAC3B;",
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 titlesMap - Map to store operation IDs and titles for mobile header navigation
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":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEtE,OAAO,KAAK,EAAE,eAAe,EAA8B,MAAM,wCAAwC,CAAA;AAwCzG;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,eAAe;AACxB,oCAAoC;AACpC,SAAS,OAAO;AAChB,0CAA0C;AAC1C,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,gBAAgB,mBAAmB,CAAC,gBAAgB,CAAC,SAsCtD,CAAA"}
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 createOperationEntry = (ref, operation, method, path = "Unknown", tag, titlesMap, getOperationId) => {
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
- titlesMap.set(id, title);
10
- return {
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, titlesMap, getOperationId) => {
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, titlesMap, getOperationId));
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, titlesMap, getOperationId));
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 type { TraversedOperation } from '@/schemas/navigation'\nimport type { OpenApiDocument, OperationObject, TagObject } from '@/schemas/v3.1/strict/openapi-document'\n\nimport { getTag } from './get-tag'\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 const title = operation.summary?.trim() ? operation.summary : path\n\n titlesMap.set(id, title)\n\n return {\n id,\n title,\n path,\n 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, 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\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,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAElC,SAAS,sBAAsB;AAK/B,SAAS,cAAc;AAcvB,MAAM,uBAAuB,CAC3B,KACA,WACA,QACA,OAAO,WACP,KACA,WACA,mBACuB;AACvB,QAAM,KAAK,eAAe,EAAE,GAAG,WAAW,QAAQ,KAAK,GAAG,GAAG;AAC7D,QAAM,QAAQ,UAAU,SAAS,KAAK,IAAI,UAAU,UAAU;AAE9D,YAAU,IAAI,IAAI,KAAK;AAEvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;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,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,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;",
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/navigation.js';
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 titlesMap - Map to store schema IDs and titles for mobile header navigation
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,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAA2B,MAAM,wCAAwC,CAAA;AAoCtG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,eAAe;AACxB,wCAAwC;AACxC,SAAS,OAAO;AAChB,0CAA0C;AAC1C,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,YAAY,mBAAmB,CAAC,YAAY,CAAC,KAC5C,eAAe,EA4BjB,CAAA"}
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", titlesMap, getModelId, tag, _schema) => {
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
- titlesMap.set(id, title);
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, titlesMap, getModelId) => {
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 = `#/content/components/schemas/${name}`;
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, titlesMap, getModelId, tag));
28
+ tagsMap.get(tagName)?.entries.push(createSchemaEntry(ref, name, getModelId, tag));
29
29
  });
30
30
  } else {
31
- untagged.push(createSchemaEntry(ref, name, titlesMap, getModelId, void 0, getResolvedRef(schemas[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 { TraversedSchema } from '@/schemas/navigation'\nimport type { OpenApiDocument, SchemaObject, TagObject } 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 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 createSchemaEntry = (\n ref: string,\n name = 'Unknown',\n titlesMap: Map<string, string>,\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 titlesMap.set(id, title)\n\n return {\n id,\n title,\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 // 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 = `#/content/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, titlesMap, getModelId, tag))\n })\n }\n // Add to untagged\n else {\n untagged.push(createSchemaEntry(ref, name, titlesMap, getModelId, undefined, getResolvedRef(schemas[name])))\n }\n }\n\n return untagged\n}\n"],
5
- "mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AAavB,MAAM,oBAAoB,CACxB,KACA,OAAO,WACP,WACA,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,YAAU,IAAI,IAAI,KAAK;AAEvB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;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;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,gCAAgC,IAAI;AAGhD,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,WAAW,YAAY,GAAG,CAAC;AAAA,MAC7F,CAAC;AAAA,IACH,OAEK;AACH,eAAS,KAAK,kBAAkB,KAAK,MAAM,WAAW,YAAY,QAAW,eAAe,QAAQ,IAAI,CAAC,CAAC,CAAC;AAAA,IAC7G;AAAA,EACF;AAEA,SAAO;AACT;",
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/navigation.js';
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":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,wCAAwC,CAAA;AAIxF,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;AAChB,yCAAyC;AACzC,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,4CAA4C,OAAO,KAClD,cAAc,EAyBhB,CAAA"}
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"}