@scalar/workspace-store 0.15.7 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +22 -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/extensions/operation/index.d.ts +2 -0
  45. package/dist/schemas/extensions/operation/index.d.ts.map +1 -0
  46. package/dist/schemas/extensions/operation/index.js +1 -0
  47. package/dist/schemas/extensions/operation/index.js.map +7 -0
  48. package/dist/schemas/extensions/operation/x-code-samples.d.ts +2 -0
  49. package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -1
  50. package/dist/schemas/extensions/operation/x-code-samples.js.map +2 -2
  51. package/dist/schemas/extensions/security/x-default-scopes.d.ts +17 -0
  52. package/dist/schemas/extensions/security/x-default-scopes.d.ts.map +1 -0
  53. package/dist/schemas/extensions/security/x-default-scopes.js +8 -0
  54. package/dist/schemas/extensions/security/x-default-scopes.js.map +7 -0
  55. package/dist/schemas/extensions/security/x-scalar-redirect-uri.d.ts +6 -1
  56. package/dist/schemas/extensions/security/x-scalar-redirect-uri.d.ts.map +1 -1
  57. package/dist/schemas/extensions/security/x-scalar-redirect-uri.js +1 -1
  58. package/dist/schemas/extensions/security/x-scalar-redirect-uri.js.map +2 -2
  59. package/dist/schemas/extensions/security/x-scalar-security-secrets.d.ts +27 -3
  60. package/dist/schemas/extensions/security/x-scalar-security-secrets.d.ts.map +1 -1
  61. package/dist/schemas/extensions/security/x-scalar-security-secrets.js +15 -3
  62. package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +2 -2
  63. package/dist/schemas/extensions/security/x-use-pkce.d.ts +1 -1
  64. package/dist/schemas/extensions/security/x-use-pkce.d.ts.map +1 -1
  65. package/dist/schemas/extensions/security/x-use-pkce.js +1 -3
  66. package/dist/schemas/extensions/security/x-use-pkce.js.map +2 -2
  67. package/dist/schemas/inmemory-workspace.d.ts +312 -134
  68. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  69. package/dist/schemas/navigation.d.ts +60 -128
  70. package/dist/schemas/navigation.d.ts.map +1 -1
  71. package/dist/schemas/navigation.js +40 -44
  72. package/dist/schemas/navigation.js.map +2 -2
  73. package/dist/schemas/reference-config/index.d.ts +156 -67
  74. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  75. package/dist/schemas/reference-config/settings.d.ts +156 -67
  76. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  77. package/dist/schemas/v3.1/strict/oauth-flow.d.ts +135 -24
  78. package/dist/schemas/v3.1/strict/oauth-flow.d.ts.map +1 -1
  79. package/dist/schemas/v3.1/strict/oauth-flow.js +37 -15
  80. package/dist/schemas/v3.1/strict/oauth-flow.js.map +2 -2
  81. package/dist/schemas/v3.1/strict/oauthflows.d.ts +67 -12
  82. package/dist/schemas/v3.1/strict/oauthflows.d.ts.map +1 -1
  83. package/dist/schemas/v3.1/strict/openapi-document.d.ts +12434 -1877
  84. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  85. package/dist/schemas/v3.1/strict/openapi-document.js +32 -4
  86. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  87. package/dist/schemas/v3.1/strict/operation.d.ts +1 -0
  88. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  89. package/dist/schemas/v3.1/strict/operation.js +2 -1
  90. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  91. package/dist/schemas/v3.1/strict/ref-definitions.d.ts +8 -0
  92. package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -1
  93. package/dist/schemas/v3.1/strict/ref-definitions.js +12 -1
  94. package/dist/schemas/v3.1/strict/ref-definitions.js.map +2 -2
  95. package/dist/schemas/v3.1/strict/schema.d.ts +2 -2
  96. package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
  97. package/dist/schemas/v3.1/strict/schema.js +2 -44
  98. package/dist/schemas/v3.1/strict/schema.js.map +2 -2
  99. package/dist/schemas/v3.1/strict/security-scheme.d.ts +12 -8
  100. package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
  101. package/dist/schemas/v3.1/strict/security-scheme.js +3 -1
  102. package/dist/schemas/v3.1/strict/security-scheme.js.map +2 -2
  103. package/dist/schemas/workspace-specification/config.d.ts +188 -67
  104. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  105. package/dist/schemas/workspace-specification/config.js.map +2 -2
  106. package/dist/schemas/workspace-specification/index.d.ts +156 -67
  107. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  108. package/dist/schemas/workspace.d.ts +1092 -469
  109. package/dist/schemas/workspace.d.ts.map +1 -1
  110. package/dist/server.d.ts +3 -4
  111. package/dist/server.d.ts.map +1 -1
  112. package/dist/server.js.map +2 -2
  113. package/package.json +13 -13
@@ -1,18 +1,21 @@
1
+ import { getXKeysFromObject } from "../../navigation/helpers/get-x-keys.js";
1
2
  import { getTag } from "./get-tag.js";
2
- const createTagEntry = (tag, titlesMap, getTagId, children, isGroup = false) => {
3
+ const createTagEntry = (tag, getTagId, children, isGroup = false) => {
3
4
  const id = getTagId(tag);
4
5
  const title = tag["x-displayName"] ?? tag.name ?? "Untitled Tag";
5
- titlesMap.set(id, title);
6
- return {
6
+ const entry = {
7
7
  id,
8
8
  title,
9
9
  name: tag.name || title,
10
+ description: tag.description,
10
11
  children,
11
12
  isGroup,
12
- type: "tag"
13
+ type: "tag",
14
+ xKeys: getXKeysFromObject(tag)
13
15
  };
16
+ return entry;
14
17
  };
15
- const getSortedTagEntries = (_keys, tagsMap, titlesMap, { getTagId, tagsSorter, operationsSorter }) => {
18
+ const getSortedTagEntries = (_keys, tagsMap, { getTagId, tagsSorter, operationsSorter }) => {
16
19
  const hasDefault = _keys.includes("default");
17
20
  const keys = hasDefault ? _keys.filter((key) => key !== "default") : _keys;
18
21
  if (tagsSorter === "alpha") {
@@ -33,12 +36,12 @@ const getSortedTagEntries = (_keys, tagsMap, titlesMap, { getTagId, tagsSorter,
33
36
  return [];
34
37
  }
35
38
  if (operationsSorter === "alpha") {
36
- entries.sort((a, b) => "method" in a && "method" in b ? a.title.localeCompare(b.title) : 0);
39
+ entries.sort((a, b) => a.type === "operation" && b.type === "operation" ? a.title.localeCompare(b.title) : 0);
37
40
  } else if (operationsSorter === "method") {
38
- entries.sort((a, b) => "method" in a && "method" in b ? a.method.localeCompare(b.method) : 0);
41
+ entries.sort((a, b) => a.type === "operation" && b.type === "operation" ? a.method.localeCompare(b.method) : 0);
39
42
  } else if (typeof operationsSorter === "function") {
40
43
  entries.sort((a, b) => {
41
- if (a.type !== "operation" && a.type !== "webhook" || b.type !== "operation" && b.type !== "webhook") {
44
+ if (!(a.type === "operation" || a.type === "webhook") || !(b.type === "operation" || b.type === "webhook")) {
42
45
  return 0;
43
46
  }
44
47
  const pathA = a.type === "operation" ? a.path : a.name;
@@ -49,23 +52,23 @@ const getSortedTagEntries = (_keys, tagsMap, titlesMap, { getTagId, tagsSorter,
49
52
  );
50
53
  });
51
54
  }
52
- return entries.length ? createTagEntry(tag, titlesMap, getTagId, entries) : [];
55
+ return entries.length ? createTagEntry(tag, getTagId, entries) : [];
53
56
  });
54
57
  };
55
- const traverseTags = (content, tagsMap, titlesMap, { getTagId, tagsSorter, operationsSorter }) => {
58
+ const traverseTags = (content, tagsMap, { getTagId, tagsSorter, operationsSorter }) => {
56
59
  if (content["x-tagGroups"]) {
57
60
  const tagGroups = content["x-tagGroups"];
58
61
  return tagGroups.flatMap((tagGroup) => {
59
- const entries = getSortedTagEntries(tagGroup.tags ?? [], tagsMap, titlesMap, {
62
+ const entries = getSortedTagEntries(tagGroup.tags ?? [], tagsMap, {
60
63
  getTagId,
61
64
  tagsSorter,
62
65
  operationsSorter
63
66
  });
64
- return entries.length ? createTagEntry(tagGroup, titlesMap, getTagId, entries, true) : [];
67
+ return entries.length ? createTagEntry(tagGroup, getTagId, entries, true) : [];
65
68
  });
66
69
  }
67
70
  const keys = Array.from(tagsMap.keys());
68
- const tags = getSortedTagEntries(keys, tagsMap, titlesMap, { getTagId, tagsSorter, operationsSorter });
71
+ const tags = getSortedTagEntries(keys, tagsMap, { getTagId, tagsSorter, operationsSorter });
69
72
  if (tags.length === 1 && tags[0]?.title === "default") {
70
73
  return tags[0]?.children ?? [];
71
74
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/navigation/helpers/traverse-tags.ts"],
4
- "sourcesContent": ["import type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { TraversedEntry, TraversedTag } from '@/schemas/navigation'\nimport type { OpenApiDocument, TagObject } from '@/schemas/v3.1/strict/openapi-document'\n\nimport { getTag } from './get-tag'\n\ntype Options = Pick<TraverseSpecOptions, 'getTagId' | 'tagsSorter' | 'operationsSorter'>\n\n/** Creates a traversed tag entry from an OpenAPI tag object.\n *\n * @param tag - The OpenAPI tag object\n * @param titlesMap - Map to store tag IDs and titles for mobile header navigation\n * @param getTagId - Function to generate unique IDs for tags\n * @param children - Array of child entries (operations, webhooks, etc.)\n * @param isGroup - Whether this tag represents a group of tags\n * @returns A traversed tag entry with ID, title, name and children\n */\nconst createTagEntry = (\n tag: TagObject,\n titlesMap: Map<string, string>,\n getTagId: TraverseSpecOptions['getTagId'],\n children: TraversedEntry[],\n isGroup = false,\n): TraversedTag => {\n const id = getTagId(tag)\n const title = tag['x-displayName'] ?? tag.name ?? 'Untitled Tag'\n titlesMap.set(id, title)\n\n return {\n id,\n title,\n name: tag.name || title,\n children,\n isGroup,\n type: 'tag',\n }\n}\n\n/** Sorts and processes tags to create a hierarchical structure of tag entries.\n *\n * This function handles:\n * - Sorting tags alphabetically or using a custom sort function\n * - Ensuring the default tag appears last\n * - Sorting operations within tags by title, method, or custom function\n * - Filtering out internal and ignored tags\n * - Creating tag entries with their associated operations\n *\n * @param _keys - Array of tag keys to process\n * @param tagsMap - Map of tags and their entries\n * @param tagsDict - Dictionary of OpenAPI tags by name\n * @param titlesMap - Map of titles for the mobile header\n * @param options - Sorting and ID generation options\n * @returns Array of processed and sorted tag entries\n */\n/** Sorts tags and returns entries */\nconst getSortedTagEntries = (\n _keys: string[],\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n /** Map of titles for the mobile header */\n titlesMap: Map<string, string>,\n { getTagId, tagsSorter, operationsSorter }: Options,\n) => {\n // Ensure that default is last if it exists\n const hasDefault = _keys.includes('default')\n const keys = hasDefault ? _keys.filter((key) => key !== 'default') : _keys\n\n // Alpha sort\n if (tagsSorter === 'alpha') {\n keys.sort((a, b) => {\n const nameA = getTag(tagsMap, a).tag['x-displayName'] || a || 'Untitled Tag'\n const nameB = getTag(tagsMap, b).tag['x-displayName'] || b || 'Untitled Tag'\n return nameA.localeCompare(nameB)\n })\n }\n // Custom sort\n else if (typeof tagsSorter === 'function') {\n keys.sort((a, b) => tagsSorter(getTag(tagsMap, a).tag, getTag(tagsMap, b).tag))\n }\n\n if (hasDefault) {\n keys.push('default')\n }\n\n /**\n * Process each tag and its entries:\n * - Skip internal and ignored tags\n * - Sort operations within tags\n * - Create tag entries with sorted operations\n */\n return keys.flatMap((key) => {\n const { tag, entries } = getTag(tagsMap, key)\n\n // Skip if the tag is internal or scalar-ignore\n if (tag['x-internal'] || tag['x-scalar-ignore']) {\n return []\n }\n\n // Alpha sort\n if (operationsSorter === 'alpha') {\n entries.sort((a, b) => ('method' in a && 'method' in b ? a.title.localeCompare(b.title) : 0))\n }\n // Method sort\n else if (operationsSorter === 'method') {\n entries.sort((a, b) => ('method' in a && 'method' in b ? a.method.localeCompare(b.method) : 0))\n }\n // Custom sort\n else if (typeof operationsSorter === 'function') {\n entries.sort((a, b) => {\n // Guard against tags\n if ((a.type !== 'operation' && a.type !== 'webhook') || (b.type !== 'operation' && b.type !== 'webhook')) {\n return 0\n }\n\n // Handle webhooks as well as operations\n const pathA = a.type === 'operation' ? a.path : a.name\n const pathB = b.type === 'operation' ? b.path : b.name\n\n return operationsSorter(\n { method: a.method, path: pathA, ref: a.ref, httpVerb: a.method },\n { method: b.method, path: pathB, ref: b.ref, httpVerb: b.method },\n )\n })\n }\n\n return entries.length ? createTagEntry(tag, titlesMap, getTagId, entries) : []\n })\n}\n\n/**\n * Traverses the tags map to create navigation entries, handling both grouped and ungrouped tags.\n *\n * This function processes the OpenAPI document's tags to:\n * - Handle tag groups if specified via x-tagGroups\n * - Sort tags and their operations according to provided sorters\n * - Create navigation entries for each tag or tag group\n * - Flatten default tag entries if it's the only tag present\n */\nexport const traverseTags = (\n content: OpenApiDocument,\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n /** Map of titles for the mobile title */\n titlesMap: Map<string, string>,\n { getTagId, tagsSorter, operationsSorter }: Options,\n): TraversedEntry[] => {\n // x-tagGroups\n if (content['x-tagGroups']) {\n const tagGroups = content['x-tagGroups']\n\n return tagGroups.flatMap((tagGroup) => {\n const entries = getSortedTagEntries(tagGroup.tags ?? [], tagsMap, titlesMap, {\n getTagId,\n tagsSorter,\n operationsSorter,\n })\n return entries.length ? createTagEntry(tagGroup, titlesMap, getTagId, entries, true) : []\n })\n }\n\n // Ungrouped regular tags\n const keys = Array.from(tagsMap.keys())\n const tags = getSortedTagEntries(keys, tagsMap, titlesMap, { getTagId, tagsSorter, operationsSorter })\n\n // Flatten if we only have default tag\n if (tags.length === 1 && tags[0]?.title === 'default') {\n return tags[0]?.children ?? []\n }\n\n return tags\n}\n"],
5
- "mappings": "AAIA,SAAS,cAAc;AAavB,MAAM,iBAAiB,CACrB,KACA,WACA,UACA,UACA,UAAU,UACO;AACjB,QAAM,KAAK,SAAS,GAAG;AACvB,Q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AW;AACrD,WAAO,KAAK,CAAC,GAAG,YAAY,CAAC;AAAA,EAC/B;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { getXKeysFromObject } from '@/navigation/helpers/get-x-keys'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument, TagObject, TraversedEntry, TraversedTag } from '@/schemas/v3.1/strict/openapi-document'\n\nimport { getTag } from './get-tag'\n\ntype Options = Pick<TraverseSpecOptions, 'getTagId' | 'tagsSorter' | 'operationsSorter'>\n\n/** Creates a traversed tag entry from an OpenAPI tag object.\n *\n * @param tag - The OpenAPI tag object\n * @param entriesMap - Map to store tag IDs and titles for mobile header navigation\n * @param getTagId - Function to generate unique IDs for tags\n * @param children - Array of child entries (operations, webhooks, etc.)\n * @param isGroup - Whether this tag represents a group of tags\n * @returns A traversed tag entry with ID, title, name and children\n */\nconst createTagEntry = (\n tag: TagObject,\n getTagId: TraverseSpecOptions['getTagId'],\n children: TraversedEntry[],\n isGroup = false,\n): TraversedTag => {\n const id = getTagId(tag)\n const title = tag['x-displayName'] ?? tag.name ?? 'Untitled Tag'\n\n const entry = {\n id,\n title,\n name: tag.name || title,\n description: tag.description,\n children,\n isGroup,\n type: 'tag',\n xKeys: getXKeysFromObject(tag),\n } satisfies TraversedTag\n\n return entry\n}\n\n/** Sorts and processes tags to create a hierarchical structure of tag entries.\n *\n * This function handles:\n * - Sorting tags alphabetically or using a custom sort function\n * - Ensuring the default tag appears last\n * - Sorting operations within tags by title, method, or custom function\n * - Filtering out internal and ignored tags\n * - Creating tag entries with their associated operations\n *\n * @param _keys - Array of tag keys to process\n * @param tagsMap - Map of tags and their entries\n * @param tagsDict - Dictionary of OpenAPI tags by name\n * @param titlesMap - Map of titles for the mobile header\n * @param options - Sorting and ID generation options\n * @returns Array of processed and sorted tag entries\n */\n/** Sorts tags and returns entries */\nconst getSortedTagEntries = (\n _keys: string[],\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n { getTagId, tagsSorter, operationsSorter }: Options,\n) => {\n // Ensure that default is last if it exists\n const hasDefault = _keys.includes('default')\n const keys = hasDefault ? _keys.filter((key) => key !== 'default') : _keys\n\n // Alpha sort\n if (tagsSorter === 'alpha') {\n keys.sort((a, b) => {\n const nameA = getTag(tagsMap, a).tag['x-displayName'] || a || 'Untitled Tag'\n const nameB = getTag(tagsMap, b).tag['x-displayName'] || b || 'Untitled Tag'\n return nameA.localeCompare(nameB)\n })\n }\n // Custom sort\n else if (typeof tagsSorter === 'function') {\n keys.sort((a, b) => tagsSorter(getTag(tagsMap, a).tag, getTag(tagsMap, b).tag))\n }\n\n if (hasDefault) {\n keys.push('default')\n }\n\n /**\n * Process each tag and its entries:\n * - Skip internal and ignored tags\n * - Sort operations within tags\n * - Create tag entries with sorted operations\n */\n return keys.flatMap((key) => {\n const { tag, entries } = getTag(tagsMap, key)\n\n // Skip if the tag is internal or scalar-ignore\n if (tag['x-internal'] || tag['x-scalar-ignore']) {\n return []\n }\n\n // Alpha sort\n if (operationsSorter === 'alpha') {\n entries.sort((a, b) => (a.type === 'operation' && b.type === 'operation' ? a.title.localeCompare(b.title) : 0))\n }\n // Method sort\n else if (operationsSorter === 'method') {\n entries.sort((a, b) => (a.type === 'operation' && b.type === 'operation' ? a.method.localeCompare(b.method) : 0))\n }\n // Custom sort\n else if (typeof operationsSorter === 'function') {\n entries.sort((a, b) => {\n // Guard against tags\n if (!(a.type === 'operation' || a.type === 'webhook') || !(b.type === 'operation' || b.type === 'webhook')) {\n return 0\n }\n\n // Handle webhooks as well as operations\n const pathA = a.type === 'operation' ? a.path : a.name\n const pathB = b.type === 'operation' ? b.path : b.name\n\n return operationsSorter(\n { method: a.method, path: pathA, ref: a.ref, httpVerb: a.method },\n { method: b.method, path: pathB, ref: b.ref, httpVerb: b.method },\n )\n })\n }\n\n return entries.length ? createTagEntry(tag, getTagId, entries) : []\n })\n}\n\n/**\n * Traverses the tags map to create navigation entries, handling both grouped and ungrouped tags.\n *\n * This function processes the OpenAPI document's tags to:\n * - Handle tag groups if specified via x-tagGroups\n * - Sort tags and their operations according to provided sorters\n * - Create navigation entries for each tag or tag group\n * - Flatten default tag entries if it's the only tag present\n */\nexport const traverseTags = (\n content: OpenApiDocument,\n /** Map of tags and their entries */\n tagsMap: TagsMap,\n { getTagId, tagsSorter, operationsSorter }: Options,\n): TraversedEntry[] => {\n // x-tagGroups\n if (content['x-tagGroups']) {\n const tagGroups = content['x-tagGroups']\n\n return tagGroups.flatMap((tagGroup) => {\n const entries = getSortedTagEntries(tagGroup.tags ?? [], tagsMap, {\n getTagId,\n tagsSorter,\n operationsSorter,\n })\n return entries.length ? createTagEntry(tagGroup, getTagId, entries, true) : []\n })\n }\n\n // Ungrouped regular tags\n const keys = Array.from(tagsMap.keys())\n const tags = getSortedTagEntries(keys, tagsMap, { getTagId, tagsSorter, operationsSorter })\n\n // Flatten if we only have default tag\n if (tags.length === 1 && tags[0]?.title === 'default') {\n return tags[0]?.children ?? []\n }\n\n return tags\n}\n"],
5
+ "mappings": "AAAA,SAAS,0BAA0B;AAInC,SAAS,cAAc;AAavB,MAAM,iBAAiB,CACrB,KACA,UACA,UACA,UAAU,UACO;AACjB,QAAM,KAAK,SAAS,GAAG;AACvB,QAAM,QAAQ,IAAI,eAAe,KAAK,IAAI,QAAQ;AAElD,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA,MAAM,IAAI,QAAQ;AAAA,IAClB,aAAa,IAAI;AAAA,IACjB;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,OAAO,mBAAmB,GAAG;AAAA,EAC/B;AAEA,SAAO;AACT;AAmBA,MAAM,sBAAsB,CAC1B,OAEA,SACA,EAAE,UAAU,YAAY,iBAAiB,MACtC;AAEH,QAAM,aAAa,MAAM,SAAS,SAAS;AAC3C,QAAM,OAAO,aAAa,MAAM,OAAO,CAAC,QAAQ,QAAQ,SAAS,IAAI;AAGrE,MAAI,eAAe,SAAS;AAC1B,SAAK,KAAK,CAAC,GAAG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O,KAAK,EAAE,KAAK,UAAU,EAAE,OAAO;AAAA,UAChE,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,KAAK,EAAE,KAAK,UAAU,EAAE,OAAO;AAAA,QAClE;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,QAAQ,SAAS,eAAe,KAAK,UAAU,OAAO,IAAI,CAAC;AAAA,EACpE,CAAC;AACH;AAWO,MAAM,eAAe,CAC1B,SAEA,SACA,EAAE,UAAU,YAAY,iBAAiB,MACpB;AAErB,MAAI,QAAQ,aAAa,GAAG;AAC1B,UAAM,YAAY,QAAQ,aAAa;AAEvC,WAAO,UAAU,QAAQ,CAAC,aAAa;AACrC,YAAM,UAAU,oBAAoB,SAAS,QAAQ,CAAC,GAAG,SAAS;AAAA,QAChE;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AACD,aAAO,QAAQ,SAAS,eAAe,UAAU,UAAU,SAAS,IAAI,IAAI,CAAC;AAAA,IAC/E,CAAC;AAAA,EACH;AAGA,QAAM,OAAO,MAAM,KAAK,QAAQ,KAAK,CAAC;AACtC,QAAM,OAAO,oBAAoB,MAAM,SAAS,EAAE,UAAU,YAAY,iBAAiB,CAAC;AAG1F,MAAI,KAAK,WAAW,KAAK,KAAK,CAAC,GAAG,UAAU,WAAW;AACrD,WAAO,KAAK,CAAC,GAAG,YAAY,CAAC;AAAA,EAC/B;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 { TraversedWebhook } from '../../schemas/navigation.js';
3
- import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document.js';
2
+ import type { OpenApiDocument, TraversedWebhook } from '../../schemas/v3.1/strict/openapi-document.js';
4
3
  /** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.
5
4
  *
6
5
  * This function processes each webhook in the document to:
@@ -12,13 +11,11 @@ import type { OpenApiDocument } from '../../schemas/v3.1/strict/openapi-document
12
11
  * @param content - The OpenAPI document to traverse
13
12
  * @param tagsMap - Map of tag names to arrays of traversed entries from operations
14
13
  * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects
15
- * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation
14
+ * @param entitiesMap - Map to store webhook IDs and titles for mobile header navigation
16
15
  * @param getWebhookId - Function to generate unique IDs for webhooks
17
16
  * @returns Array of untagged webhook entries
18
17
  */
19
18
  export declare const traverseWebhooks: (content: OpenApiDocument,
20
19
  /** The tag map from from traversing paths */
21
- tagsMap: TagsMap,
22
- /** Map of titles for the mobile title */
23
- titlesMap: Map<string, string>, getWebhookId: TraverseSpecOptions["getWebhookId"]) => TraversedWebhook[];
20
+ tagsMap: TagsMap, getWebhookId: TraverseSpecOptions["getWebhookId"]) => TraversedWebhook[];
24
21
  //# sourceMappingURL=traverse-webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,wCAAwC,CAAA;AAqCxF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,eAAe;AACxB,6CAA6C;AAC7C,SAAS,OAAO;AAChB,yCAAyC;AACzC,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,cAAc,mBAAmB,CAAC,cAAc,CAAC,KAChD,gBAAgB,EAuClB,CAAA"}
1
+ {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAa,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAuC1G;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,eAAe;AACxB,6CAA6C;AAC7C,SAAS,OAAO,EAChB,cAAc,mBAAmB,CAAC,cAAc,CAAC,KAChD,gBAAgB,EAyDlB,CAAA"}
@@ -1,20 +1,22 @@
1
1
  import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
2
2
  import { objectKeys } from "@scalar/helpers/object/object-keys";
3
3
  import { getResolvedRef } from "../../helpers/get-resolved-ref.js";
4
+ import { isDeprecatedOperation } from "../../navigation/helpers/traverse-paths.js";
4
5
  import { getTag } from "./get-tag.js";
5
- const createWebhookEntry = (ref, method, name = "Unknown", title = "Unknown", titlesMap, getWebhookId, tag) => {
6
+ const createWebhookEntry = (ref, method, name = "Unknown", title = "Unknown", getWebhookId, tag, isDeprecated) => {
6
7
  const id = getWebhookId({ name, method }, tag);
7
- titlesMap.set(id, title);
8
- return {
8
+ const entry = {
9
9
  id,
10
10
  title,
11
11
  name,
12
12
  ref,
13
13
  method,
14
- type: "webhook"
14
+ type: "webhook",
15
+ isDeprecated: isDeprecated ? isDeprecated : void 0
15
16
  };
17
+ return entry;
16
18
  };
17
- const traverseWebhooks = (content, tagsMap, titlesMap, getWebhookId) => {
19
+ const traverseWebhooks = (content, tagsMap, getWebhookId) => {
18
20
  const untagged = [];
19
21
  Object.entries(content.webhooks ?? {}).forEach(([name, pathItemObject]) => {
20
22
  const pathKeys = objectKeys(pathItemObject ?? {}).filter((key) => isHttpMethod(key));
@@ -32,11 +34,29 @@ const traverseWebhooks = (content, tagsMap, titlesMap, getWebhookId) => {
32
34
  operation.tags.forEach((tagName) => {
33
35
  const { tag } = getTag(tagsMap, tagName);
34
36
  tagsMap.get(tagName)?.entries.push(
35
- createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId, tag)
37
+ createWebhookEntry(
38
+ ref,
39
+ method,
40
+ name,
41
+ operation.summary ?? name,
42
+ getWebhookId,
43
+ tag,
44
+ isDeprecatedOperation(operation)
45
+ )
36
46
  );
37
47
  });
38
48
  } else {
39
- untagged.push(createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId));
49
+ untagged.push(
50
+ createWebhookEntry(
51
+ ref,
52
+ method,
53
+ name,
54
+ operation.summary ?? name,
55
+ getWebhookId,
56
+ void 0,
57
+ isDeprecatedOperation(operation)
58
+ )
59
+ );
40
60
  }
41
61
  });
42
62
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/navigation/helpers/traverse-webhooks.ts"],
4
- "sourcesContent": ["import { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { objectKeys } from '@scalar/helpers/object/object-keys'\n\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { TraversedWebhook } from '@/schemas/navigation'\nimport type { OpenApiDocument, TagObject } from '@/schemas/v3.1/strict/openapi-document'\n\nimport { getTag } from './get-tag'\n\n/** Creates a traversed webhook entry from an OpenAPI webhook object.\n *\n * @param ref - JSON pointer reference to the webhook in the OpenAPI document\n * @param method - HTTP method of the webhook\n * @param name - Name of the webhook, defaults to 'Unknown'\n * @param title - Title of the webhook, defaults to 'Unknown'\n * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @param tag - Optional tag object associated with the webhook\n * @returns A traversed webhook entry with ID, title, name, method and reference\n */\nconst createWebhookEntry = (\n ref: string,\n method: string,\n name = 'Unknown',\n title = 'Unknown',\n titlesMap: Map<string, string>,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n tag?: TagObject,\n): TraversedWebhook => {\n const id = getWebhookId({ name, method }, tag)\n titlesMap.set(id, title)\n\n return {\n id,\n title,\n name,\n ref,\n method: method,\n type: 'webhook',\n }\n}\n\n/** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.\n *\n * This function processes each webhook in the document to:\n * - Filter out internal webhooks (marked with x-internal) and webhooks to ignore (marked with x-scalar-ignore)\n * - Group webhooks by their tags\n * - Create webhook entries with unique references and IDs\n * - Store webhook IDs and titles for mobile header navigation\n *\n * @param content - The OpenAPI document to traverse\n * @param tagsMap - Map of tag names to arrays of traversed entries from operations\n * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects\n * @param titlesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @returns Array of untagged webhook entries\n */\nexport const traverseWebhooks = (\n content: OpenApiDocument,\n /** The tag map from from traversing paths */\n tagsMap: TagsMap,\n /** Map of titles for the mobile title */\n titlesMap: Map<string, string>,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n): TraversedWebhook[] => {\n const untagged: TraversedWebhook[] = []\n\n // Traverse webhooks\n Object.entries(content.webhooks ?? {}).forEach(([name, pathItemObject]) => {\n const 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']) {\n return\n }\n\n const ref = `#/webhooks/${name}/${method}`\n\n if (operation.tags?.length) {\n operation.tags.forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap\n .get(tagName)\n ?.entries.push(\n createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId, tag),\n )\n })\n }\n // Add to untagged\n else {\n untagged.push(createWebhookEntry(ref, method, name, operation.summary ?? name, titlesMap, getWebhookId))\n }\n })\n })\n\n return untagged\n}\n"],
5
- "mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAE3B,SAAS,sBAA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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'\n\nimport { getResolvedRef } from '@/helpers/get-resolved-ref'\nimport { isDeprecatedOperation } from '@/navigation/helpers/traverse-paths'\nimport type { TagsMap, TraverseSpecOptions } from '@/navigation/types'\nimport type { OpenApiDocument, TagObject, TraversedWebhook } from '@/schemas/v3.1/strict/openapi-document'\n\nimport { getTag } from './get-tag'\n\n/** Creates a traversed webhook entry from an OpenAPI webhook object.\n *\n * @param ref - JSON pointer reference to the webhook in the OpenAPI document\n * @param method - HTTP method of the webhook\n * @param name - Name of the webhook, defaults to 'Unknown'\n * @param title - Title of the webhook, defaults to 'Unknown'\n * @param entitiesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @param tag - Optional tag object associated with the webhook\n * @returns A traversed webhook entry with ID, title, name, method and reference\n */\nconst createWebhookEntry = (\n ref: string,\n method: HttpMethod,\n name = 'Unknown',\n title = 'Unknown',\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n tag?: TagObject,\n isDeprecated?: boolean,\n): TraversedWebhook => {\n const id = getWebhookId({ name, method }, tag)\n\n const entry = {\n id,\n title,\n name,\n ref,\n method: method,\n type: 'webhook',\n isDeprecated: isDeprecated ? isDeprecated : undefined,\n } satisfies TraversedWebhook\n\n return entry\n}\n\n/** Traverses the webhooks in an OpenAPI document to build an array of webhook entries.\n *\n * This function processes each webhook in the document to:\n * - Filter out internal webhooks (marked with x-internal) and webhooks to ignore (marked with x-scalar-ignore)\n * - Group webhooks by their tags\n * - Create webhook entries with unique references and IDs\n * - Store webhook IDs and titles for mobile header navigation\n *\n * @param content - The OpenAPI document to traverse\n * @param tagsMap - Map of tag names to arrays of traversed entries from operations\n * @param tagsDict - Dictionary mapping tag names to their OpenAPI tag objects\n * @param entitiesMap - Map to store webhook IDs and titles for mobile header navigation\n * @param getWebhookId - Function to generate unique IDs for webhooks\n * @returns Array of untagged webhook entries\n */\nexport const traverseWebhooks = (\n content: OpenApiDocument,\n /** The tag map from from traversing paths */\n tagsMap: TagsMap,\n getWebhookId: TraverseSpecOptions['getWebhookId'],\n): TraversedWebhook[] => {\n const untagged: TraversedWebhook[] = []\n\n // Traverse webhooks\n Object.entries(content.webhooks ?? {}).forEach(([name, 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']) {\n return\n }\n\n const ref = `#/webhooks/${name}/${method}`\n\n if (operation.tags?.length) {\n operation.tags.forEach((tagName: string) => {\n const { tag } = getTag(tagsMap, tagName)\n tagsMap\n .get(tagName)\n ?.entries.push(\n createWebhookEntry(\n ref,\n method,\n name,\n operation.summary ?? name,\n getWebhookId,\n tag,\n isDeprecatedOperation(operation),\n ),\n )\n })\n }\n // Add to untagged\n else {\n untagged.push(\n createWebhookEntry(\n ref,\n method,\n name,\n operation.summary ?? name,\n getWebhookId,\n undefined,\n isDeprecatedOperation(operation),\n ),\n )\n }\n })\n })\n\n return untagged\n}\n"],
5
+ "mappings": "AACA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAE3B,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AAItC,SAAS,cAAc;AAavB,MAAM,qBAAqB,CACzB,KACA,QACA,OAAO,WACP,QAAQ,WACR,cACA,KACA,iBACqB;AACrB,QAAM,KAAK,aAAa,EAAE,MAAM,OAAO,GAAG,GAAG;AAE7C,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;AAiBO,MAAM,mBAAmB,CAC9B,SAEA,SACA,iBACuB;AACvB,QAAM,WAA+B,CAAC;AAGtC,SAAO,QAAQ,QAAQ,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,cAAc,MAAM;AACzE,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,GAAG;AAC3D;AAAA,MACF;AAEA,YAAM,MAAM,cAAc,IAAI,IAAI,MAAM;AAExC,UAAI,UAAU,MAAM,QAAQ;AAC1B,kBAAU,KAAK,QAAQ,CAAC,YAAoB;AAC1C,gBAAM,EAAE,IAAI,IAAI,OAAO,SAAS,OAAO;AACvC,kBACG,IAAI,OAAO,GACV,QAAQ;AAAA,YACR;AAAA,cACE;AAAA,cACA;AAAA,cACA;AAAA,cACA,UAAU,WAAW;AAAA,cACrB;AAAA,cACA;AAAA,cACA,sBAAsB,SAAS;AAAA,YACjC;AAAA,UACF;AAAA,QACJ,CAAC;AAAA,MACH,OAEK;AACH,iBAAS;AAAA,UACP;AAAA,YACE;AAAA,YACA;AAAA,YACA;AAAA,YACA,UAAU,WAAW;AAAA,YACrB;AAAA,YACA;AAAA,YACA,sBAAsB,SAAS;AAAA,UACjC;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ export { DEFAULT_INTRODUCTION_SLUG } from './helpers/traverse-description.js';
1
2
  export { traverseDocument as createNavigation } from './helpers/traverse-document.js';
2
3
  export type { TraverseSpecOptions as createNavigationOptions } from './types.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAClF,YAAY,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/navigation/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAClF,YAAY,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAA"}
@@ -1,5 +1,7 @@
1
+ import { DEFAULT_INTRODUCTION_SLUG } from "./helpers/traverse-description.js";
1
2
  import { traverseDocument } from "./helpers/traverse-document.js";
2
3
  export {
4
+ DEFAULT_INTRODUCTION_SLUG,
3
5
  traverseDocument as createNavigation
4
6
  };
5
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/navigation/index.ts"],
4
- "sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: Entry point for /navigation\nexport { traverseDocument as createNavigation } from './helpers/traverse-document'\nexport type { TraverseSpecOptions as createNavigationOptions } from './types'\n"],
5
- "mappings": "AACA,SAA6B,wBAAwB;",
4
+ "sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: Entry point for /navigation\nexport { DEFAULT_INTRODUCTION_SLUG } from './helpers/traverse-description'\nexport { traverseDocument as createNavigation } from './helpers/traverse-document'\nexport type { TraverseSpecOptions as createNavigationOptions } from './types'\n"],
5
+ "mappings": "AACA,SAAS,iCAAiC;AAC1C,SAA6B,wBAAwB;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,4 @@
1
- import type { TraversedEntry } from '../schemas/navigation.js';
2
- import type { OperationObject, TagObject } from '../schemas/v3.1/strict/openapi-document.js';
1
+ import type { OperationObject, TagObject, TraversedEntry } from '../schemas/v3.1/strict/openapi-document.js';
3
2
  /** Map of tagNames and their entries */
4
3
  export type TagsMap = Map<string, {
5
4
  tag: TagObject;
@@ -21,9 +20,9 @@ type OperationSortValue = {
21
20
  */
22
21
  export type TraverseSpecOptions = {
23
22
  /** Controls how tags are sorted - either alphabetically or using a custom sort function */
24
- tagsSorter: 'alpha' | ((a: TagObject, b: TagObject) => number);
23
+ tagsSorter?: 'alpha' | ((a: TagObject, b: TagObject) => number);
25
24
  /** Controls how operations are sorted - alphabetically, by method, or using a custom sort function */
26
- operationsSorter: 'alpha' | 'method' | ((a: OperationSortValue, b: OperationSortValue) => number);
25
+ operationsSorter?: 'alpha' | 'method' | ((a: OperationSortValue, b: OperationSortValue) => number);
27
26
  /** Whether to hide model schemas from the navigation */
28
27
  hideModels: boolean;
29
28
  /** Function to generate unique IDs for markdown headings */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AACxF,wCAAwC;AACxC,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAAA;AAEhF,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,2FAA2F;IAC3F,UAAU,EAAE,OAAO,GAAG,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,CAAC,EAAE,SAAS,KAClB,MAAM,CAAA;IAEX,yDAAyD;IACzD,UAAU,EAAE,CACV,KAAK,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,EACD,SAAS,CAAC,EAAE,SAAS,KAClB,MAAM,CAAA;IAEX,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,MAAM,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export type { XCodeSample } from './x-code-samples.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,3 +1,4 @@
1
+ import { type Static } from '@scalar/typebox';
1
2
  export declare const XCodeSampleSchema: import("@scalar/typebox").TObject<{
2
3
  lang: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
3
4
  label: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
@@ -20,4 +21,5 @@ export declare const XCodeSamplesSchema: import("@scalar/typebox").TObject<{
20
21
  source: import("@scalar/typebox").TString;
21
22
  }>>>;
22
23
  }>;
24
+ export type XCodeSample = Static<typeof XCodeSampleSchema>;
23
25
  //# sourceMappingURL=x-code-samples.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-code-samples.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/x-code-samples.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;EAI5B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;EAI7B,CAAA"}
1
+ {"version":3,"file":"x-code-samples.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/operation/x-code-samples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,iBAAiB,CAAA;AAEnD,eAAO,MAAM,iBAAiB;;;;EAI5B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;EAI7B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/schemas/extensions/operation/x-code-samples.ts"],
4
- "sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XCodeSampleSchema = Type.Object({\n lang: Type.Optional(Type.String()),\n label: Type.Optional(Type.String()),\n source: Type.String(),\n})\n\nexport const XCodeSamplesSchema = Type.Object({\n 'x-codeSamples': Type.Optional(Type.Array(XCodeSampleSchema)),\n 'x-code-samples': Type.Optional(Type.Array(XCodeSampleSchema)),\n 'x-custom-examples': Type.Optional(Type.Array(XCodeSampleSchema)),\n})\n"],
5
- "mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,oBAAoB,KAAK,OAAO;AAAA,EAC3C,MAAM,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACjC,OAAO,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EAClC,QAAQ,KAAK,OAAO;AACtB,CAAC;AAEM,MAAM,qBAAqB,KAAK,OAAO;AAAA,EAC5C,iBAAiB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAAA,EAC5D,kBAAkB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAAA,EAC7D,qBAAqB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAClE,CAAC;",
4
+ "sourcesContent": ["import { type Static, Type } from '@scalar/typebox'\n\nexport const XCodeSampleSchema = Type.Object({\n lang: Type.Optional(Type.String()),\n label: Type.Optional(Type.String()),\n source: Type.String(),\n})\n\nexport const XCodeSamplesSchema = Type.Object({\n 'x-codeSamples': Type.Optional(Type.Array(XCodeSampleSchema)),\n 'x-code-samples': Type.Optional(Type.Array(XCodeSampleSchema)),\n 'x-custom-examples': Type.Optional(Type.Array(XCodeSampleSchema)),\n})\n\nexport type XCodeSample = Static<typeof XCodeSampleSchema>\n"],
5
+ "mappings": "AAAA,SAAsB,YAAY;AAE3B,MAAM,oBAAoB,KAAK,OAAO;AAAA,EAC3C,MAAM,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACjC,OAAO,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EAClC,QAAQ,KAAK,OAAO;AACtB,CAAC;AAEM,MAAM,qBAAqB,KAAK,OAAO;AAAA,EAC5C,iBAAiB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAAA,EAC5D,kBAAkB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAAA,EAC7D,qBAAqB,KAAK,SAAS,KAAK,MAAM,iBAAiB,CAAC;AAClE,CAAC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Default selected scopes for the oauth flow
3
+ *
4
+ * @example
5
+ * ```json
6
+ * {
7
+ * "x-default-scopes": [
8
+ * "profile",
9
+ * "email"
10
+ * ]
11
+ * }
12
+ * ```
13
+ */
14
+ export declare const XDefaultScopesSchema: import("@scalar/typebox").TObject<{
15
+ 'x-default-scopes': import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TString>>;
16
+ }>;
17
+ //# sourceMappingURL=x-default-scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-default-scopes.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-default-scopes.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB;;EAE/B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Type } from "@scalar/typebox";
2
+ const XDefaultScopesSchema = Type.Object({
3
+ "x-default-scopes": Type.Optional(Type.Array(Type.String()))
4
+ });
5
+ export {
6
+ XDefaultScopesSchema
7
+ };
8
+ //# sourceMappingURL=x-default-scopes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/schemas/extensions/security/x-default-scopes.ts"],
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * Default selected scopes for the oauth flow\n *\n * @example\n * ```json\n * {\n * \"x-default-scopes\": [\n * \"profile\",\n * \"email\"\n * ]\n * }\n * ```\n */\nexport const XDefaultScopesSchema = Type.Object({\n 'x-default-scopes': Type.Optional(Type.Array(Type.String())),\n})\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAed,MAAM,uBAAuB,KAAK,OAAO;AAAA,EAC9C,oBAAoB,KAAK,SAAS,KAAK,MAAM,KAAK,OAAO,CAAC,CAAC;AAC7D,CAAC;",
6
+ "names": []
7
+ }
@@ -1,4 +1,9 @@
1
+ /**
2
+ * The scalar redirect URI for the OAuth2 flow
3
+ *
4
+ * This should not be exported when exporting the document
5
+ */
1
6
  export declare const XScalarRedirectUriSchema: import("@scalar/typebox").TObject<{
2
- 'x-scalar-redirect-uri': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
7
+ 'x-scalar-redirect-uri': import("@scalar/typebox").TString;
3
8
  }>;
4
9
  //# sourceMappingURL=x-scalar-redirect-uri.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-scalar-redirect-uri.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-scalar-redirect-uri.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;EAEnC,CAAA"}
1
+ {"version":3,"file":"x-scalar-redirect-uri.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-scalar-redirect-uri.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;EAEnC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Type } from "@scalar/typebox";
2
2
  const XScalarRedirectUriSchema = Type.Object({
3
- "x-scalar-redirect-uri": Type.Optional(Type.String())
3
+ "x-scalar-redirect-uri": Type.String()
4
4
  });
5
5
  export {
6
6
  XScalarRedirectUriSchema
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/schemas/extensions/security/x-scalar-redirect-uri.ts"],
4
- "sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XScalarRedirectUriSchema = Type.Object({\n 'x-scalar-redirect-uri': Type.Optional(Type.String()),\n})\n"],
5
- "mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,2BAA2B,KAAK,OAAO;AAAA,EAClD,yBAAyB,KAAK,SAAS,KAAK,OAAO,CAAC;AACtD,CAAC;",
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * The scalar redirect URI for the OAuth2 flow\n *\n * This should not be exported when exporting the document\n */\nexport const XScalarRedirectUriSchema = Type.Object({\n 'x-scalar-redirect-uri': Type.String(),\n})\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAOd,MAAM,2BAA2B,KAAK,OAAO;AAAA,EAClD,yBAAyB,KAAK,OAAO;AACvC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,7 @@
4
4
  * We should not export this when exporting the document
5
5
  */
6
6
  export declare const XScalarSecretTokenSchema: import("@scalar/typebox").TObject<{
7
- 'x-scalar-secret-token': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
7
+ 'x-scalar-secret-token': import("@scalar/typebox").TString;
8
8
  }>;
9
9
  /**
10
10
  * Username and password for HTTP authentication
@@ -12,7 +12,31 @@ export declare const XScalarSecretTokenSchema: import("@scalar/typebox").TObject
12
12
  * We should not export this when exporting the document
13
13
  */
14
14
  export declare const XScalarSecretHTTPSchema: import("@scalar/typebox").TObject<{
15
- 'x-scalar-secret-username': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
16
- 'x-scalar-secret-password': import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
15
+ 'x-scalar-secret-username': import("@scalar/typebox").TString;
16
+ 'x-scalar-secret-password': import("@scalar/typebox").TString;
17
+ }>;
18
+ /**
19
+ * Oauth client secret
20
+ *
21
+ * We should not export this when exporting the document
22
+ */
23
+ export declare const XScalarSecretClientSecretSchema: import("@scalar/typebox").TObject<{
24
+ 'x-scalar-secret-client-secret': import("@scalar/typebox").TString;
25
+ }>;
26
+ /**
27
+ * Oauth client ID
28
+ *
29
+ * We should not export this when exporting the document
30
+ */
31
+ export declare const XScalarSecretClientIdSchema: import("@scalar/typebox").TObject<{
32
+ 'x-scalar-secret-client-id': import("@scalar/typebox").TString;
33
+ }>;
34
+ /**
35
+ * Oauth Redirect URI
36
+ *
37
+ * We should not export this when exporting the document
38
+ */
39
+ export declare const XScalarSecretRedirectUriSchema: import("@scalar/typebox").TObject<{
40
+ 'x-scalar-secret-redirect-uri': import("@scalar/typebox").TString;
17
41
  }>;
18
42
  //# sourceMappingURL=x-scalar-security-secrets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-scalar-security-secrets.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-scalar-security-secrets.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;EAEnC,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;EAGlC,CAAA"}
1
+ {"version":3,"file":"x-scalar-security-secrets.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-scalar-security-secrets.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;EAEnC,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;EAGlC,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;EAE1C,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;EAEtC,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;EAEzC,CAAA"}
@@ -1,13 +1,25 @@
1
1
  import { Type } from "@scalar/typebox";
2
2
  const XScalarSecretTokenSchema = Type.Object({
3
- "x-scalar-secret-token": Type.Optional(Type.String())
3
+ "x-scalar-secret-token": Type.String()
4
4
  });
5
5
  const XScalarSecretHTTPSchema = Type.Object({
6
- "x-scalar-secret-username": Type.Optional(Type.String()),
7
- "x-scalar-secret-password": Type.Optional(Type.String())
6
+ "x-scalar-secret-username": Type.String(),
7
+ "x-scalar-secret-password": Type.String()
8
+ });
9
+ const XScalarSecretClientSecretSchema = Type.Object({
10
+ "x-scalar-secret-client-secret": Type.String()
11
+ });
12
+ const XScalarSecretClientIdSchema = Type.Object({
13
+ "x-scalar-secret-client-id": Type.String()
14
+ });
15
+ const XScalarSecretRedirectUriSchema = Type.Object({
16
+ "x-scalar-secret-redirect-uri": Type.String()
8
17
  });
9
18
  export {
19
+ XScalarSecretClientIdSchema,
20
+ XScalarSecretClientSecretSchema,
10
21
  XScalarSecretHTTPSchema,
22
+ XScalarSecretRedirectUriSchema,
11
23
  XScalarSecretTokenSchema
12
24
  };
13
25
  //# sourceMappingURL=x-scalar-security-secrets.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/schemas/extensions/security/x-scalar-security-secrets.ts"],
4
- "sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * A scalar secret token\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretTokenSchema = Type.Object({\n 'x-scalar-secret-token': Type.Optional(Type.String()),\n})\n\n/**\n * Username and password for HTTP authentication\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretHTTPSchema = Type.Object({\n 'x-scalar-secret-username': Type.Optional(Type.String()),\n 'x-scalar-secret-password': Type.Optional(Type.String()),\n})\n"],
5
- "mappings": "AAAA,SAAS,YAAY;AAOd,MAAM,2BAA2B,KAAK,OAAO;AAAA,EAClD,yBAAyB,KAAK,SAAS,KAAK,OAAO,CAAC;AACtD,CAAC;AAOM,MAAM,0BAA0B,KAAK,OAAO;AAAA,EACjD,4BAA4B,KAAK,SAAS,KAAK,OAAO,CAAC;AAAA,EACvD,4BAA4B,KAAK,SAAS,KAAK,OAAO,CAAC;AACzD,CAAC;",
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\n/**\n * A scalar secret token\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretTokenSchema = Type.Object({\n 'x-scalar-secret-token': Type.String(),\n})\n\n/**\n * Username and password for HTTP authentication\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretHTTPSchema = Type.Object({\n 'x-scalar-secret-username': Type.String(),\n 'x-scalar-secret-password': Type.String(),\n})\n\n/**\n * Oauth client secret\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretClientSecretSchema = Type.Object({\n 'x-scalar-secret-client-secret': Type.String(),\n})\n\n/**\n * Oauth client ID\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretClientIdSchema = Type.Object({\n 'x-scalar-secret-client-id': Type.String(),\n})\n\n/**\n * Oauth Redirect URI\n *\n * We should not export this when exporting the document\n */\nexport const XScalarSecretRedirectUriSchema = Type.Object({\n 'x-scalar-secret-redirect-uri': Type.String(),\n})\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAOd,MAAM,2BAA2B,KAAK,OAAO;AAAA,EAClD,yBAAyB,KAAK,OAAO;AACvC,CAAC;AAOM,MAAM,0BAA0B,KAAK,OAAO;AAAA,EACjD,4BAA4B,KAAK,OAAO;AAAA,EACxC,4BAA4B,KAAK,OAAO;AAC1C,CAAC;AAOM,MAAM,kCAAkC,KAAK,OAAO;AAAA,EACzD,iCAAiC,KAAK,OAAO;AAC/C,CAAC;AAOM,MAAM,8BAA8B,KAAK,OAAO;AAAA,EACrD,6BAA6B,KAAK,OAAO;AAC3C,CAAC;AAOM,MAAM,iCAAiC,KAAK,OAAO;AAAA,EACxD,gCAAgC,KAAK,OAAO;AAC9C,CAAC;",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@ export declare const XusePkceSchema: import("@scalar/typebox").TObject<{
2
2
  /**
3
3
  * Use x-usePkce to enable Proof Key for Code Exchange (PKCE) for the Oauth2 authorization code flow.
4
4
  */
5
- 'x-usePkce': import("@scalar/typebox").TOptional<import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"SHA-256">, import("@scalar/typebox").TLiteral<"plain">, import("@scalar/typebox").TLiteral<"no">]>>;
5
+ 'x-usePkce': import("@scalar/typebox").TUnion<[import("@scalar/typebox").TLiteral<"SHA-256">, import("@scalar/typebox").TLiteral<"plain">, import("@scalar/typebox").TLiteral<"no">]>;
6
6
  }>;
7
7
  //# sourceMappingURL=x-use-pkce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-use-pkce.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-use-pkce.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;IACzB;;OAEG;;EAIH,CAAA"}
1
+ {"version":3,"file":"x-use-pkce.d.ts","sourceRoot":"","sources":["../../../../src/schemas/extensions/security/x-use-pkce.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;IACzB;;OAEG;;EAEH,CAAA"}
@@ -3,9 +3,7 @@ const XusePkceSchema = Type.Object({
3
3
  /**
4
4
  * Use x-usePkce to enable Proof Key for Code Exchange (PKCE) for the Oauth2 authorization code flow.
5
5
  */
6
- "x-usePkce": Type.Optional(
7
- Type.Union([Type.Literal("SHA-256"), Type.Literal("plain"), Type.Literal("no")], { default: "no" })
8
- )
6
+ "x-usePkce": Type.Union([Type.Literal("SHA-256"), Type.Literal("plain"), Type.Literal("no")], { default: "no" })
9
7
  });
10
8
  export {
11
9
  XusePkceSchema
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/schemas/extensions/security/x-use-pkce.ts"],
4
- "sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XusePkceSchema = Type.Object({\n /**\n * Use x-usePkce to enable Proof Key for Code Exchange (PKCE) for the Oauth2 authorization code flow.\n */\n 'x-usePkce': Type.Optional(\n Type.Union([Type.Literal('SHA-256'), Type.Literal('plain'), Type.Literal('no')], { default: 'no' }),\n ),\n})\n"],
5
- "mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,iBAAiB,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA,EAIxC,aAAa,KAAK;AAAA,IAChB,KAAK,MAAM,CAAC,KAAK,QAAQ,SAAS,GAAG,KAAK,QAAQ,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE,SAAS,KAAK,CAAC;AAAA,EACpG;AACF,CAAC;",
4
+ "sourcesContent": ["import { Type } from '@scalar/typebox'\n\nexport const XusePkceSchema = Type.Object({\n /**\n * Use x-usePkce to enable Proof Key for Code Exchange (PKCE) for the Oauth2 authorization code flow.\n */\n 'x-usePkce': Type.Union([Type.Literal('SHA-256'), Type.Literal('plain'), Type.Literal('no')], { default: 'no' }),\n})\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,iBAAiB,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA,EAIxC,aAAa,KAAK,MAAM,CAAC,KAAK,QAAQ,SAAS,GAAG,KAAK,QAAQ,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE,SAAS,KAAK,CAAC;AACjH,CAAC;",
6
6
  "names": []
7
7
  }