@scalar/openapi-parser 0.25.4 → 0.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/configuration/index.js +24 -24
- package/dist/index.js +24 -45
- package/dist/lib/Validator/Validator.js +125 -108
- package/dist/plugins/fetch-urls/fetch-urls.js +39 -38
- package/dist/plugins/fetch-urls/index.js +1 -6
- package/dist/plugins/read-files/index.js +1 -5
- package/dist/plugins/read-files/read-files.js +53 -51
- package/dist/schemas/v2.0/schema.js +1373 -1377
- package/dist/schemas/v3.0/schema.js +1411 -1415
- package/dist/schemas/v3.1/schema.js +1196 -1200
- package/dist/schemas/v3.2/schema.js +1417 -1421
- package/dist/types/index.js +1 -1
- package/dist/utils/betterAjvErrors/helpers.js +138 -112
- package/dist/utils/betterAjvErrors/index.js +11 -15
- package/dist/utils/betterAjvErrors/utils.js +17 -30
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js +14 -18
- package/dist/utils/betterAjvErrors/validation-errors/base.js +20 -21
- package/dist/utils/betterAjvErrors/validation-errors/default.js +14 -18
- package/dist/utils/betterAjvErrors/validation-errors/enum.js +33 -37
- package/dist/utils/betterAjvErrors/validation-errors/index.js +6 -15
- package/dist/utils/betterAjvErrors/validation-errors/pattern.js +14 -18
- package/dist/utils/betterAjvErrors/validation-errors/required.js +13 -17
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +14 -18
- package/dist/utils/dereference.js +22 -18
- package/dist/utils/details.js +28 -29
- package/dist/utils/filter.js +13 -14
- package/dist/utils/get-entrypoint.js +5 -6
- package/dist/utils/get-list-of-references.js +20 -16
- package/dist/utils/get-segments-from-path.js +13 -9
- package/dist/utils/is-filesystem.js +8 -6
- package/dist/utils/is-json.js +8 -11
- package/dist/utils/is-yaml.js +15 -17
- package/dist/utils/join/index.js +1 -5
- package/dist/utils/join/join.js +267 -153
- package/dist/utils/join/merge-objects.js +35 -18
- package/dist/utils/load/index.js +1 -5
- package/dist/utils/load/load.js +114 -90
- package/dist/utils/make-filesystem.js +20 -21
- package/dist/utils/normalize.js +32 -29
- package/dist/utils/openapi/actions/details.js +9 -10
- package/dist/utils/openapi/actions/files.js +7 -8
- package/dist/utils/openapi/actions/get.js +9 -10
- package/dist/utils/openapi/actions/toJson.js +9 -10
- package/dist/utils/openapi/actions/toYaml.js +9 -10
- package/dist/utils/openapi/commands/dereferenceCommand.js +25 -26
- package/dist/utils/openapi/commands/filterCommand.js +24 -25
- package/dist/utils/openapi/commands/loadCommand.js +40 -41
- package/dist/utils/openapi/commands/upgradeCommand.js +27 -28
- package/dist/utils/openapi/commands/validateCommand.js +31 -32
- package/dist/utils/openapi/openapi.js +16 -14
- package/dist/utils/openapi/openapi.test-d.js +13 -13
- package/dist/utils/openapi/utils/queueTask.js +8 -9
- package/dist/utils/openapi/utils/workThroughQueue.js +64 -50
- package/dist/utils/resolve-references.js +168 -110
- package/dist/utils/to-json.js +1 -5
- package/dist/utils/to-yaml.js +2 -6
- package/dist/utils/transform/sanitize.js +22 -22
- package/dist/utils/transform/utils/addInfoObject.js +9 -14
- package/dist/utils/transform/utils/addLatestOpenApiVersion.js +4 -9
- package/dist/utils/transform/utils/addMissingTags.js +26 -27
- package/dist/utils/transform/utils/normalizeSecuritySchemes.js +39 -37
- package/dist/utils/transform/utils/rejectSwaggerDocuments.js +5 -9
- package/dist/utils/transform-errors.js +62 -55
- package/dist/utils/traverse.js +21 -22
- package/dist/utils/unescape-json-pointer.js +8 -6
- package/dist/utils/upgrade.js +19 -22
- package/dist/utils/validate-path-parameters.js +76 -80
- package/dist/utils/validate.js +23 -19
- package/package.json +9 -14
- package/dist/configuration/index.js.map +0 -7
- package/dist/declarations.d.js +0 -1
- package/dist/declarations.d.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/lib/Validator/Validator.js.map +0 -7
- package/dist/plugins/fetch-urls/fetch-urls.js.map +0 -7
- package/dist/plugins/fetch-urls/index.js.map +0 -7
- package/dist/plugins/read-files/index.js.map +0 -7
- package/dist/plugins/read-files/read-files.js.map +0 -7
- package/dist/schemas/v2.0/schema.js.map +0 -7
- package/dist/schemas/v3.0/schema.js.map +0 -7
- package/dist/schemas/v3.1/schema.js.map +0 -7
- package/dist/schemas/v3.2/schema.js.map +0 -7
- package/dist/types/index.js.map +0 -7
- package/dist/utils/betterAjvErrors/helpers.js.map +0 -7
- package/dist/utils/betterAjvErrors/index.js.map +0 -7
- package/dist/utils/betterAjvErrors/utils.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/base.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/default.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/enum.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/index.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/pattern.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/required.js.map +0 -7
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js.map +0 -7
- package/dist/utils/dereference.js.map +0 -7
- package/dist/utils/details.js.map +0 -7
- package/dist/utils/filter.js.map +0 -7
- package/dist/utils/get-entrypoint.js.map +0 -7
- package/dist/utils/get-list-of-references.js.map +0 -7
- package/dist/utils/get-segments-from-path.js.map +0 -7
- package/dist/utils/is-filesystem.js.map +0 -7
- package/dist/utils/is-json.js.map +0 -7
- package/dist/utils/is-yaml.js.map +0 -7
- package/dist/utils/join/index.js.map +0 -7
- package/dist/utils/join/join.js.map +0 -7
- package/dist/utils/join/merge-objects.js.map +0 -7
- package/dist/utils/load/index.js.map +0 -7
- package/dist/utils/load/load.js.map +0 -7
- package/dist/utils/make-filesystem.js.map +0 -7
- package/dist/utils/normalize.js.map +0 -7
- package/dist/utils/openapi/actions/details.js.map +0 -7
- package/dist/utils/openapi/actions/files.js.map +0 -7
- package/dist/utils/openapi/actions/get.js.map +0 -7
- package/dist/utils/openapi/actions/toJson.js.map +0 -7
- package/dist/utils/openapi/actions/toYaml.js.map +0 -7
- package/dist/utils/openapi/commands/dereferenceCommand.js.map +0 -7
- package/dist/utils/openapi/commands/filterCommand.js.map +0 -7
- package/dist/utils/openapi/commands/loadCommand.js.map +0 -7
- package/dist/utils/openapi/commands/upgradeCommand.js.map +0 -7
- package/dist/utils/openapi/commands/validateCommand.js.map +0 -7
- package/dist/utils/openapi/openapi.js.map +0 -7
- package/dist/utils/openapi/openapi.test-d.js.map +0 -7
- package/dist/utils/openapi/utils/queueTask.js.map +0 -7
- package/dist/utils/openapi/utils/workThroughQueue.js.map +0 -7
- package/dist/utils/resolve-references.js.map +0 -7
- package/dist/utils/to-json.js.map +0 -7
- package/dist/utils/to-yaml.js.map +0 -7
- package/dist/utils/transform/sanitize.js.map +0 -7
- package/dist/utils/transform/utils/addInfoObject.js.map +0 -7
- package/dist/utils/transform/utils/addLatestOpenApiVersion.js.map +0 -7
- package/dist/utils/transform/utils/addMissingTags.js.map +0 -7
- package/dist/utils/transform/utils/normalizeSecuritySchemes.js.map +0 -7
- package/dist/utils/transform/utils/rejectSwaggerDocuments.js.map +0 -7
- package/dist/utils/transform-errors.js.map +0 -7
- package/dist/utils/traverse.js.map +0 -7
- package/dist/utils/unescape-json-pointer.js.map +0 -7
- package/dist/utils/upgrade.js.map +0 -7
- package/dist/utils/validate-path-parameters.js.map +0 -7
- package/dist/utils/validate.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/is-yaml.ts"],
|
|
4
|
-
"sourcesContent": ["import { parse } from 'yaml'\n\nexport function isYaml(value: string) {\n // Line breaks\n if (!value.includes('\\n')) {\n return false\n }\n\n try {\n parse(value, {\n maxAliasCount: 10000,\n })\n\n return true\n } catch (_error) {\n return false\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AAEf,SAAS,OAAO,OAAe;AAEpC,MAAI,CAAC,MAAM,SAAS,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,OAAO;AAAA,MACX,eAAe;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT,SAAS,QAAQ;AACf,WAAO;AAAA,EACT;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/join/join.ts"],
|
|
4
|
-
"sourcesContent": ["import { bundle } from '@scalar/json-magic/bundle'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\nimport type { UnknownObject } from '@/types'\nimport { mergeObjects } from '@/utils/join/merge-objects'\nimport { upgrade } from '@/utils/upgrade'\n\n/**\n * Returns the intersection of two sets as an array.\n *\n * @param a - The first set\n * @param b - The second set\n * @returns An array containing the elements present in both sets\n *\n * @example\n * const setA = new Set([1, 2, 3, 4])\n * const setB = new Set([3, 4, 5, 6])\n * const intersection = getSetIntersection(setA, setB)\n * // intersection: [3, 4]\n */\nconst getSetIntersection = <T>(a: Set<T>, b: Set<T>): T[] => {\n const result: T[] = []\n for (const value of a) {\n if (b.has(value)) {\n result.push(value)\n }\n }\n return result\n}\n\n/**\n * Returns the value if it is not nullish (or, for arrays, not empty), otherwise returns the provided default value.\n * Useful for handling OpenAPI fields that may be missing or empty.\n */\nconst withDefault = <T, K>(value: T, defaultValue: K): T | K => {\n if (Array.isArray(value)) {\n return value.length ? value : defaultValue\n }\n\n if (typeof value === 'object' && value !== null) {\n return Object.keys(value).length ? value : defaultValue\n }\n\n return value ?? defaultValue\n}\n\n/**\n * Merges multiple OpenAPI PathsObjects into a single PathsObject.\n * - If a path does not exist in the result, it is added directly.\n * - If a path already exists, its operations (get, post, etc.) are merged.\n * - If the same operation (e.g., \"get\") exists for the same path in multiple inputs,\n * a conflict is recorded for that path and method.\n *\n * @param inputs - Array of OpenAPIV3_1.PathsObject to merge\n * @returns An object containing the merged paths and a list of conflicts\n */\nconst mergePaths = (inputs: OpenAPIV3_1.PathsObject[]) => {\n const result: OpenAPIV3_1.PathsObject = {}\n const conflicts: { path: string; method: string }[] = []\n\n for (const paths of inputs) {\n if (typeof paths !== 'object') {\n continue\n }\n\n for (const [path, pathItem] of Object.entries(paths)) {\n if (!result[path]) {\n // If the path does not exist, add it directly\n result[path] = pathItem\n continue\n }\n\n // Find intersecting operation keys (e.g., \"get\", \"post\") for this path\n const intersectingKeys = getSetIntersection(new Set(Object.keys(result[path])), new Set(Object.keys(pathItem)))\n\n // If the path exists, merge the operations (get, post, etc.)\n result[path] = { ...result[path], ...pathItem }\n // Record conflicts for each intersecting operation key\n intersectingKeys.forEach((key) => conflicts.push({ method: key, path }))\n }\n }\n\n return { paths: result, conflicts }\n}\n\n/**\n * Merges multiple arrays of OpenAPI TagObjects into a single array, ensuring uniqueness by tag name.\n * - If a tag with the same name appears in multiple arrays, only the first occurrence is included in the result.\n *\n * @param inputs - Array of arrays of OpenAPIV3_1.TagObject to merge\n * @returns An array of unique TagObjects (by name)\n */\nconst mergeTags = (inputs: OpenAPIV3_1.TagObject[][]) => {\n const cache = new Set<string>()\n const result: OpenAPIV3_1.TagObject[] = []\n\n for (const tags of inputs) {\n for (const tag of tags) {\n if (!cache.has(tag.name)) {\n result.push(tag)\n }\n cache.add(tag.name)\n }\n }\n\n return result\n}\n\n/**\n * Merges multiple arrays of OpenAPI ServerObjects into a single array, ensuring uniqueness by server URL.\n * - If a server with the same URL appears in multiple arrays, only the first occurrence is included in the result.\n *\n * @param inputs - Array of arrays of OpenAPIV3_1.ServerObject to merge\n * @returns An array of unique ServerObjects (by url)\n */\nconst mergeServers = (inputs: OpenAPIV3_1.ServerObject[][]) => {\n const cache = new Set<string>()\n const result: OpenAPIV3_1.ServerObject[] = []\n\n for (const servers of inputs) {\n for (const server of servers) {\n if (!cache.has(server.url)) {\n result.push(server)\n }\n cache.add(server.url)\n }\n }\n\n return result\n}\n\n/**\n * Merges multiple OpenAPI ComponentsObject instances into a single components object.\n * - If a component with the same type and name appears in multiple inputs, only the first occurrence is included.\n * - Any conflicts (duplicate component names within the same type) are recorded in the `conflicts` array.\n *\n * @param inputs - Array of OpenAPIV3_1.ComponentsObject to merge\n * @returns An object containing the merged components and an array of conflicts\n */\nconst mergeComponents = (inputs: OpenAPIV3_1.ComponentsObject[]) => {\n const result: OpenAPIV3_1.ComponentsObject = {}\n const conflicts: { componentType: string; name: string }[] = []\n\n for (const components of inputs) {\n if (typeof components !== 'object') {\n continue\n }\n\n // Merge each component type (schemas, responses, parameters, etc.)\n for (const [key, value] of Object.entries(components)) {\n for (const [name, component] of Object.entries(value)) {\n if (!result[key]) {\n result[key] = {}\n }\n\n if (result[key][name]) {\n // If the component already exists, record a conflict\n conflicts.push({ componentType: key, name })\n } else {\n // Otherwise, add the component\n result[key][name] = component\n }\n }\n }\n }\n\n return { components: result, conflicts }\n}\n\n/**\n * Prefixes component names and their references in multiple OpenAPI documents.\n *\n * This function mutates each input document in-place by:\n * 1. Prefixing all component names (e.g., schema names) with the corresponding prefix.\n * 2. Updating all $ref values that point to components to use the prefixed names.\n *\n * This is useful when merging multiple OpenAPI documents to avoid component name collisions.\n *\n * @param inputs - Array of OpenAPI documents to mutate.\n * @param prefixes - Array of prefixes to apply to each document's components.\n */\nconst prefixComponents = async (inputs: OpenAPIV3_1.Document[], prefixes: string[]) => {\n for (const index of inputs.keys()) {\n await bundle(inputs[index], {\n treeShake: false,\n urlMap: false,\n plugins: [\n // Plugin to update $ref values to use the prefixed component names\n {\n type: 'lifecycle',\n onBeforeNodeProcess: (node) => {\n const ref = node['$ref']\n\n if (typeof ref !== 'string') {\n return\n }\n\n // Only process refs that point to components\n if (!ref.startsWith('#/components/')) {\n return\n }\n\n const parts = ref.split('/')\n // Ensure the ref has the expected structure: #/components/{type}/{name}\n if (parts.length < 4) {\n return\n }\n\n // Prefix the component name (parts[3]) with the provided prefix\n parts[3] = `${prefixes[index] ?? ''}${parts[3]}`\n\n node['$ref'] = parts.join('/')\n },\n },\n // Plugin to rename component keys with the prefix\n {\n type: 'lifecycle',\n onBeforeNodeProcess: (node, context) => {\n // Check if the node is a component type object (e.g., schemas, responses) under \"components\"\n if (context.path.length === 2 && context.path[0] === 'components') {\n const prefix = prefixes[index]\n\n Object.keys(node).forEach((key) => {\n const newKey = `${prefix ?? ''}${key}`\n const childNode = node[key]\n delete node[key]\n node[newKey] = childNode\n })\n }\n },\n },\n ],\n })\n }\n}\n\ntype Conflicts =\n | { type: 'path'; path: string; method: string }\n | { type: 'webhook'; path: string; method: string }\n | { type: 'component'; componentType: string; name: string }\ntype JoinResult = { ok: true; document: OpenAPIV3_1.Document } | { ok: false; conflicts: Conflicts[] }\n\n/**\n * Joins multiple OpenAPI documents into a single document.\n *\n * - Merges the \"info\" object, paths, webhooks, tags, and servers from all input documents.\n * - If there are conflicting paths or webhooks (same path and method), returns a list of conflicts.\n * - Only the first occurrence of a tag (by name) or server (by url) is included.\n * - The merge is performed in reverse order, so the first document in the input array has the highest precedence.\n *\n * @param inputs - Array of OpenAPI documents (UnknownObject) to join\n * @returns {JoinResult} - { ok: true, document } if successful, or { ok: false, conflicts } if there are conflicts\n *\n * @example\n * const doc1 = {\n * info: { title: \"API 1\", version: \"1.0.0\" },\n * paths: { \"/foo\": { get: { summary: \"Get Foo\" } } },\n * tags: [{ name: \"foo\" }],\n * servers: [{ url: \"https://api1.example.com\" }]\n * }\n * const doc2 = {\n * info: { description: \"Second API\" },\n * paths: { \"/bar\": { get: { summary: \"Get Bar\" } } },\n * tags: [{ name: \"bar\" }],\n * servers: [{ url: \"https://api2.example.com\" }]\n * }\n * const result = join([doc1, doc2])\n * // result.ok === true\n * // result.document.info.title === \"API 1\"\n * // result.document.info.description === \"Second API\"\n * // result.document.paths has both \"/foo\" and \"/bar\"\n * // result.document.tags contains both \"foo\" and \"bar\"\n * // result.document.servers contains both server URLs\n */\nexport const join = async (inputs: UnknownObject[], config?: { prefixComponents: string[] }): Promise<JoinResult> => {\n // Reverse the input list and upgrade them (first input has highest precedence)\n const upgraded = inputs.map((it) => upgrade(it).specification)\n\n // Preprocess documents by prefixing components if specified\n if (config?.prefixComponents) {\n await prefixComponents(upgraded, config.prefixComponents)\n }\n\n // Reverse the upgraded documents to ensure the first document has the highest precedence\n upgraded.reverse()\n\n // Merge only the \"info\" object from all inputs\n const info = upgraded.reduce<OpenAPIV3_1.InfoObject>((acc, curr) => {\n if (curr.info && typeof curr.info === 'object') {\n return mergeObjects(acc, curr.info)\n }\n return acc\n }, {} as OpenAPIV3_1.InfoObject)\n\n // Merge paths from all documents, collecting conflicts\n const { paths, conflicts: pathConflicts } = mergePaths(upgraded.map((it) => it.paths ?? {}))\n\n // Merge webhooks from all documents, collecting conflicts\n const { paths: webhooks, conflicts: webhookConflicts } = mergePaths(upgraded.map((it) => it.webhooks ?? {}))\n\n // Merge tags, ensuring uniqueness by tag name\n const tags = mergeTags(upgraded.map((it) => it.tags ?? []))\n\n // Merge servers, ensuring uniqueness by server url\n const servers = mergeServers(upgraded.map((it) => it.servers ?? []))\n\n // Merge components, collecting conflicts\n const { components, conflicts: componentConflicts } = mergeComponents(upgraded.map((it) => it.components ?? {}))\n\n // Merge all documents in the upgraded array into a single object (shallow merge)\n const result = upgraded.reduce<UnknownObject>((acc, curr) => ({ ...acc, ...curr }), {})\n\n // Collect all conflicts (paths and webhooks)\n const conflicts: Conflicts[] = [\n ...pathConflicts.map((it) => ({ type: 'path', ...it }) as const),\n ...webhookConflicts.map((it) => ({ type: 'webhook', ...it }) as const),\n ...componentConflicts.map((it) => ({ type: 'component', ...it }) as const),\n ]\n\n // If there are any conflicts, return them\n if (conflicts.length) {\n return {\n ok: false,\n conflicts,\n }\n }\n\n // Return the merged OpenAPI document\n return {\n ok: true,\n document: {\n ...result,\n info,\n paths,\n webhooks: withDefault(webhooks, undefined),\n tags: withDefault(tags, undefined),\n servers: withDefault(servers, undefined),\n components: withDefault(components, und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AY,MAAM,MAAS;AAAA,MACjC,SAAS,YAAY,SAAS,MAAS;AAAA,MACvC,YAAY,YAAY,YAAY,MAAS;AAAA,IAC/C;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/join/merge-objects.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Deep merges two objects, combining their properties recursively.\n *\n * \u26A0\uFE0F Note: This operation assumes there are no key collisions between the objects.\n * @param a - Target object to merge into\n * @param b - Source object to merge from\n * @returns The merged object (mutates and returns a)\n *\n * @example\n * // Simple merge\n * const a = { name: 'John' }\n * const b = { age: 30 }\n * mergeObjects(a, b) // { name: 'John', age: 30 }\n *\n * // Nested merge\n * const a = { user: { name: 'John' } }\n * const b = { user: { age: 30 } }\n * mergeObjects(a, b) // { user: { name: 'John', age: 30 } }\n */\nexport const mergeObjects = <R>(a: Record<string, unknown>, b: Record<string, unknown>): R => {\n for (const key in b) {\n if (!(key in a)) {\n a[key] = b[key]\n } else {\n const aValue = a[key]\n const bValue = b[key]\n\n if (typeof aValue === 'object' && aValue !== null && typeof bValue === 'object' && bValue !== null) {\n mergeObjects(aValue as Record<string, unknown>, bValue as Record<string, unknown>)\n } else {\n a[key] = bValue // Overwrite with b's value if not an object\n }\n }\n }\n\n return a as R\n}\n"],
|
|
5
|
-
"mappings": "AAmBO,MAAM,eAAe,CAAI,GAA4B,MAAkC;AAC5F,aAAW,OAAO,GAAG;AACnB,QAAI,EAAE,OAAO,IAAI;AACf,QAAE,GAAG,IAAI,EAAE,GAAG;AAAA,IAChB,OAAO;AACL,YAAM,SAAS,EAAE,GAAG;AACpB,YAAM,SAAS,EAAE,GAAG;AAEpB,UAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,OAAO,WAAW,YAAY,WAAW,MAAM;AAClG,qBAAa,QAAmC,MAAiC;AAAA,MACnF,OAAO;AACL,UAAE,GAAG,IAAI;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/load/load.ts"],
|
|
4
|
-
"sourcesContent": ["import { ERRORS } from '@/configuration'\nimport type {\n AnyApiDefinitionFormat,\n AnyObject,\n ErrorObject,\n Filesystem,\n LoadResult,\n ThrowOnErrorOption,\n} from '@/types/index'\nimport { getEntrypoint } from '@/utils/get-entrypoint'\nimport { getListOfReferences } from '@/utils/get-list-of-references'\nimport { makeFilesystem } from '@/utils/make-filesystem'\nimport { normalize } from '@/utils/normalize'\n\nexport type LoadPlugin = {\n check: (value?: any) => boolean\n get: (value: any) => any\n resolvePath?: (value: any, reference: string) => string\n getDir?: (value: any) => string\n getFilename?: (value: any) => string\n}\n\nexport type LoadOptions = {\n plugins?: LoadPlugin[]\n filename?: string\n filesystem?: Filesystem\n} & ThrowOnErrorOption\n\n/**\n * @deprecated This function is deprecated and will be removed in a future version.\n * Please use the new bundler utility instead:\n * ```ts\n * import { bundle } from \"@scalar/json-magic/bundle\"\n * ```\n *\n * Loads an OpenAPI document, including any external references.\n *\n * This function handles loading content from various sources, normalizes the content,\n * and recursively loads any external references found within the definition.\n *\n * It builds a filesystem representation of all loaded content and collects any errors\n * encountered during the process.\n */\nexport async function load(value: AnyApiDefinitionFormat, options?: LoadOptions): Promise<LoadResult> {\n const errors: ErrorObject[] = []\n\n // Don't load a reference twice, check the filesystem before fetching something\n if (options?.filesystem?.find((entry) => entry.filename === value)) {\n return {\n specification: getEntrypoint(options.filesystem)?.specification,\n filesystem: options.filesystem,\n errors,\n }\n }\n\n // Check whether the value is an URL or file path\n const plugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(value))\n\n let content: AnyObject\n\n if (plugin) {\n try {\n content = normalize(await plugin.get(value))\n } catch (_error) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value as string))\n }\n\n errors.push({\n code: 'EXTERNAL_REFERENCE_NOT_FOUND',\n message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value as string),\n })\n\n return {\n specification: null,\n filesystem: [],\n errors,\n }\n }\n } else {\n content = normalize(value)\n }\n\n // No content\n if (content === undefined) {\n if (options?.throwOnError) {\n throw new Error('No content to load')\n }\n\n errors.push({\n code: 'NO_CONTENT',\n message: ERRORS.NO_CONTENT,\n })\n\n return {\n specification: null,\n filesystem: [],\n errors,\n }\n }\n\n let filesystem = makeFilesystem(content, {\n filename: options?.filename ?? null,\n })\n\n // Get references from file system entry, or from the content\n const newEntry = options?.filename\n ? filesystem.find((entry) => entry.filename === options?.filename)\n : getEntrypoint(filesystem)\n\n const listOfReferences = newEntry.references ?? getListOfReferences(content)\n\n // No other references\n if (listOfReferences.length === 0) {\n return {\n specification: getEntrypoint(filesystem)?.specification,\n filesystem,\n errors,\n }\n }\n\n // Load other external references\n for (const reference of listOfReferences) {\n // Find a matching plugin\n const otherPlugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(reference))\n\n // Skip if no plugin is found (internal references don't need a plugin for example)\n if (!otherPlugin) {\n continue\n }\n\n const target =\n otherPlugin.check(reference) && otherPlugin.resolvePath ? otherPlugin.resolvePath(value, reference) : reference\n\n // Don't load a reference twice, check the filesystem before fetching something\n if (filesystem.find((entry) => entry.filename === reference)) {\n continue\n }\n\n const { filesystem: referencedFiles, errors: newErrors } = await load(target, {\n ...options,\n // Make the filename the exact same value as the $ref\n // TODO: This leads to problems, if there are multiple references with the same file name but in different folders\n filename: reference,\n })\n\n errors.push(...newErrors)\n\n filesystem = [\n ...filesystem,\n ...referencedFiles.map((file) => {\n return {\n ...file,\n isEntrypoint: false,\n }\n }),\n ]\n }\n\n return {\n specification: getEntrypoint(filesystem)?.specification,\n filesystem,\n errors,\n }\n}\n"],
|
|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WAAW,SAAS,WACtB,WAAW,KAAK,CAAC,UAAU,MAAM,aAAa,SAAS,QAAQ,IAC/D,cAAc,UAAU;AAE5B,QAAM,mBAAmB,SAAS,cAAc,oBAAoB,OAAO;AAG3E,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO;AAAA,MACL,eAAe,cAAc,UAAU,GAAG;AAAA,MAC1C;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,aAAW,aAAa,kBAAkB;AAExC,UAAM,cAAc,SAAS,SAAS,KAAK,CAAC,eAAe,WAAW,MAAM,SAAS,CAAC;AAGtF,QAAI,CAAC,aAAa;AAChB;AAAA,IACF;AAEA,UAAM,SACJ,YAAY,MAAM,SAAS,KAAK,YAAY,cAAc,YAAY,YAAY,OAAO,SAAS,IAAI;AAGxG,QAAI,WAAW,KAAK,CAAC,UAAU,MAAM,aAAa,SAAS,GAAG;AAC5D;AAAA,IACF;AAEA,UAAM,EAAE,YAAY,iBAAiB,QAAQ,UAAU,IAAI,MAAM,KAAK,QAAQ;AAAA,MAC5E,GAAG;AAAA;AAAA;AAAA,MAGH,UAAU;AAAA,IACZ,CAAC;AAED,WAAO,KAAK,GAAG,SAAS;AAExB,iBAAa;AAAA,MACX,GAAG;AAAA,MACH,GAAG,gBAAgB,IAAI,CAAC,SAAS;AAC/B,eAAO;AAAA,UACL,GAAG;AAAA,UACH,cAAc;AAAA,QAChB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,eAAe,cAAc,UAAU,GAAG;AAAA,IAC1C;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/make-filesystem.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject, Filesystem, FilesystemEntry } from '@/types/index'\nimport { getListOfReferences } from './get-list-of-references'\nimport { isFilesystem } from './is-filesystem'\nimport { normalize } from './normalize'\n\nexport function makeFilesystem(\n value: string | AnyObject | Filesystem,\n overwrites: Partial<FilesystemEntry> = {},\n): Filesystem {\n // Keep as is\n if (isFilesystem(value)) {\n return value as Filesystem\n }\n\n // Make an object\n const specification = normalize(value)\n\n // Create fake filesystem\n return [\n {\n isEntrypoint: true,\n specification,\n filename: null,\n dir: './',\n references: getListOfReferences(specification),\n ...overwrites,\n },\n ]\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAEnB,SAAS,eACd,OACA,aAAuC,CAAC,GAC5B;AAEZ,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB,UAAU,KAAK;AAGrC,SAAO;AAAA,IACL;AAAA,MACE,cAAc;AAAA,MACd;AAAA,MACA,UAAU;AAAA,MACV,KAAK;AAAA,MACL,YAAY,oBAAoB,aAAa;AAAA,MAC7C,GAAG;AAAA,IACL;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/normalize.ts"],
|
|
4
|
-
"sourcesContent": ["import type { UnknownObject } from '@scalar/types/utils'\nimport { parse } from 'yaml'\n\nimport type { Filesystem } from '@/types/index'\n\nimport { isFilesystem } from './is-filesystem'\n\n/**\n * Normalize the OpenAPI document (YAML, JSON, object) to a JavaScript object.\n *\n * Doesn't modify the object if it's a `Filesystem` (multiple files) already.\n */\nexport function normalize(content: string | UnknownObject | Filesystem): UnknownObject | Filesystem {\n if (content === null) {\n return undefined\n }\n\n if (typeof content === 'string') {\n if (content.trim() === '') {\n return undefined\n }\n\n try {\n return JSON.parse(content)\n } catch {\n // Does it look like YAML?\n const hasColon = /^[^:]+:/.test(content)\n const isJson = content.slice(0, 50).trimStart().startsWith('{')\n\n if (!hasColon || isJson) {\n return undefined\n }\n\n return parse(content, {\n maxAliasCount: 10000,\n merge: true,\n })\n }\n }\n\n if (isFilesystem(content)) {\n return content\n }\n\n return content\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,aAAa;AAItB,SAAS,oBAAoB;AAOtB,SAAS,UAAU,SAA0E;AAClG,MAAI,YAAY,MAAM;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU;AAC/B,QAAI,QAAQ,KAAK,MAAM,IAAI;AACzB,aAAO;AAAA,IACT;AAEA,QAAI;AACF,aAAO,KAAK,MAAM,OAAO;AAAA,IAC3B,QAAQ;AAEN,YAAM,WAAW,UAAU,KAAK,OAAO;AACvC,YAAM,SAAS,QAAQ,MAAM,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,GAAG;AAE9D,UAAI,CAAC,YAAY,QAAQ;AACvB,eAAO;AAAA,MACT;AAEA,aAAO,MAAM,SAAS;AAAA,QACpB,eAAe;AAAA,QACf,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,aAAa,OAAO,GAAG;AACzB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/actions/details.ts"],
|
|
4
|
-
"sourcesContent": ["import { getEntrypoint } from '@/utils/get-entrypoint'\nimport type { Queue, Task } from '@/types/index'\nimport { details as detailsUtility } from '@/utils/details'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return just some basic information about the OpenAPI document\n */\nexport async function details<T extends Task[]>(queue: Queue<T>): Promise<ReturnType<typeof detailsUtility>> {\n const { filesystem } = await workThroughQueue(queue)\n\n return detailsUtility(getEntrypoint(filesystem).specification)\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;AAE9B,SAAS,WAAW,sBAAsB;AAC1C,SAAS,wBAAwB;AAKjC,eAAsB,QAA0B,OAA6D;AAC3G,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO,eAAe,cAAc,UAAU,EAAE,aAAa;AAC/D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/actions/files.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Filesystem, Queue, Task } from '@/types/index'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return just the filesystem\n */\nexport async function files<T extends Task[]>(queue: Queue<T>): Promise<Filesystem> {\n const { filesystem } = await workThroughQueue(queue)\n\n return filesystem\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,wBAAwB;AAKjC,eAAsB,MAAwB,OAAsC;AAClF,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/actions/get.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CommandChain, Queue, Task } from '@/types/index'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return the results\n */\nexport async function get<T extends Task[]>(queue: Queue<T>): Promise<CommandChain<T>> {\n return {\n filesystem: [],\n ...(await workThroughQueue(queue)),\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,wBAAwB;AAKjC,eAAsB,IAAsB,OAA2C;AACrF,SAAO;AAAA,IACL,YAAY,CAAC;AAAA,IACb,GAAI,MAAM,iBAAiB,KAAK;AAAA,EAClC;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/actions/toJson.ts"],
|
|
4
|
-
"sourcesContent": ["import { getEntrypoint } from '@/utils/get-entrypoint'\nimport type { Queue, Task } from '@/types/index'\nimport { toJson as toJsonUtility } from '@/utils/to-json'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return the results\n */\nexport async function toJson<T extends Task[]>(queue: Queue<T>): Promise<string | undefined> {\n const { filesystem } = await workThroughQueue(queue)\n\n return toJsonUtility(getEntrypoint(filesystem).specification)\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;AAE9B,SAAS,UAAU,qBAAqB;AACxC,SAAS,wBAAwB;AAKjC,eAAsB,OAAyB,OAA8C;AAC3F,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO,cAAc,cAAc,UAAU,EAAE,aAAa;AAC9D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/actions/toYaml.ts"],
|
|
4
|
-
"sourcesContent": ["import { getEntrypoint } from '@/utils/get-entrypoint'\nimport type { Queue, Task } from '@/types/index'\nimport { toYaml as toYamlUtility } from '@/utils/to-yaml'\nimport { workThroughQueue } from '../utils/workThroughQueue'\n\n/**\n * Run the chained tasks and return the results\n */\nexport async function toYaml<T extends Task[]>(queue: Queue<T>): Promise<string> {\n const { filesystem } = await workThroughQueue(queue)\n\n return toYamlUtility(getEntrypoint(filesystem).specification)\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;AAE9B,SAAS,UAAU,qBAAqB;AACxC,SAAS,wBAAwB;AAKjC,eAAsB,OAAyB,OAAkC;AAC/E,QAAM,EAAE,WAAW,IAAI,MAAM,iBAAiB,KAAK;AAEnD,SAAO,cAAc,cAAc,UAAU,EAAE,aAAa;AAC9D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/commands/dereferenceCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import type { DereferenceResult, Queue, Task } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\n\ndeclare global {\n interface Commands {\n dereference: {\n task: {\n name: 'dereference'\n options?: DereferenceOptions\n }\n result: DereferenceResult\n }\n }\n}\n\n/**\n * Dereference the given OpenAPI document\n */\nexport function dereferenceCommand<T extends Task[]>(previousQueue: Queue<T>, options?: DereferenceOptions) {\n const task: Task = {\n name: 'dereference',\n options: {\n throwOnError: previousQueue.options?.throwOnError,\n ...(options ?? {}),\n },\n }\n\n const queue = queueTask<[...T, typeof task]>(previousQueue, task as Task)\n\n return {\n details: () => details(queue),\n files: () => files(queue),\n get: () => get(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAiBnB,SAAS,mBAAqC,eAAyB,SAA8B;AAC1G,QAAM,OAAa;AAAA,IACjB,MAAM;AAAA,IACN,SAAS;AAAA,MACP,cAAc,cAAc,SAAS;AAAA,MACrC,GAAI,WAAW,CAAC;AAAA,IAClB;AAAA,EACF;AAEA,QAAM,QAAQ,UAA+B,eAAe,IAAY;AAExE,SAAO;AAAA,IACL,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,EAC5B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/commands/filterCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import type { FilterResult, Queue, Task } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport type { FilterCallback } from '@/utils/filter'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\nimport { dereferenceCommand } from './dereferenceCommand'\n\ndeclare global {\n interface Commands {\n filter: {\n task: {\n name: 'filter'\n options?: FilterCallback\n }\n result: FilterResult\n }\n }\n}\n\n/**\n * Filter the given OpenAPI document\n */\nexport function filterCommand<T extends Task[]>(previousQueue: Queue<T>, options?: FilterCallback) {\n const task: Task = {\n name: 'filter',\n options,\n }\n\n const queue = queueTask<[...T, typeof task]>(previousQueue, task as Task)\n\n return {\n dereference: (dereferenceOptions?: DereferenceOptions) => dereferenceCommand(queue, dereferenceOptions),\n details: () => details(queue),\n files: () => files(queue),\n get: () => get(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AAiB5B,SAAS,cAAgC,eAAyB,SAA0B;AACjG,QAAM,OAAa;AAAA,IACjB,MAAM;AAAA,IACN;AAAA,EACF;AAEA,QAAM,QAAQ,UAA+B,eAAe,IAAY;AAExE,SAAO;AAAA,IACL,aAAa,CAAC,uBAA4C,mBAAmB,OAAO,kBAAkB;AAAA,IACtG,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,EAC5B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/commands/loadCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyApiDefinitionFormat, AnyObject, LoadResult, Queue, Task } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport type { LoadOptions } from '@/utils/load/load'\nimport type { ValidateOptions } from '@/utils/validate'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\nimport { dereferenceCommand } from './dereferenceCommand'\nimport { filterCommand } from './filterCommand'\nimport { upgradeCommand } from './upgradeCommand'\nimport { validateCommand } from './validateCommand'\n\ndeclare global {\n interface Commands {\n load: {\n task: {\n name: 'load'\n options?: LoadOptions\n }\n result: LoadResult\n }\n }\n}\n\n/**\n * Pass any OpenAPI document\n */\nexport function loadCommand<T extends Task[]>(\n previousQueue: Queue<T>,\n input: AnyApiDefinitionFormat,\n options?: LoadOptions,\n) {\n const task = {\n name: 'load',\n options: {\n // global\n throwOnError: previousQueue.options?.throwOnError,\n // local\n ...options,\n },\n } as const\n\n const queue = {\n // Add the load task\n ...queueTask<[...T, typeof task]>(previousQueue, task as Task),\n // Add input to the queue\n input,\n }\n\n return {\n dereference: (dereferenceOptions?: DereferenceOptions) => dereferenceCommand(queue, dereferenceOptions),\n details: () => details(queue),\n files: () => files(queue),\n filter: (callback: (specification: AnyObject) => boolean) => filterCommand(queue, callback),\n get: () => get(queue),\n upgrade: () => upgradeCommand(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n validate: (validateOptions?: ValidateOptions) => validateCommand(queue, validateOptions),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAiBzB,SAAS,YACd,eACA,OACA,SACA;AACA,QAAM,OAAO;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,MAEP,cAAc,cAAc,SAAS;AAAA;AAAA,MAErC,GAAG;AAAA,IACL;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA;AAAA,IAEZ,GAAG,UAA+B,eAAe,IAAY;AAAA;AAAA,IAE7D;AAAA,EACF;AAEA,SAAO;AAAA,IACL,aAAa,CAAC,uBAA4C,mBAAmB,OAAO,kBAAkB;AAAA,IACtG,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,QAAQ,CAAC,aAAoD,cAAc,OAAO,QAAQ;AAAA,IAC1F,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,SAAS,MAAM,eAAe,KAAK;AAAA,IACnC,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,UAAU,CAAC,oBAAsC,gBAAgB,OAAO,eAAe;AAAA,EACzF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/commands/upgradeCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject, Queue, Task, UpgradeResult } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport type { ValidateOptions } from '@/utils/validate'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\nimport { dereferenceCommand } from './dereferenceCommand'\nimport { filterCommand } from './filterCommand'\nimport { validateCommand } from './validateCommand'\n\ndeclare global {\n interface Commands {\n upgrade: {\n task: {\n name: 'upgrade'\n }\n result: UpgradeResult\n }\n }\n}\n\n/**\n * Upgrade the given OpenAPI document\n */\nexport function upgradeCommand<T extends Task[]>(previousQueue: Queue<T>) {\n const task: Task = {\n name: 'upgrade',\n }\n\n const queue = queueTask<[...T, typeof task]>(previousQueue, task as Task)\n\n return {\n dereference: (dereferenceOptions?: DereferenceOptions) => dereferenceCommand(queue, dereferenceOptions),\n details: () => details(queue),\n files: () => files(queue),\n filter: (callback: (specification: AnyObject) => boolean) => filterCommand(queue, callback),\n get: () => get(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n validate: (validateOptions?: ValidateOptions) => validateCommand(queue, validateOptions),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAgBzB,SAAS,eAAiC,eAAyB;AACxE,QAAM,OAAa;AAAA,IACjB,MAAM;AAAA,EACR;AAEA,QAAM,QAAQ,UAA+B,eAAe,IAAY;AAExE,SAAO;AAAA,IACL,aAAa,CAAC,uBAA4C,mBAAmB,OAAO,kBAAkB;AAAA,IACtG,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,QAAQ,CAAC,aAAoD,cAAc,OAAO,QAAQ;AAAA,IAC1F,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,UAAU,CAAC,oBAAsC,gBAAgB,OAAO,eAAe;AAAA,EACzF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/commands/validateCommand.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject, Queue, Task, ValidateResult } from '@/types/index'\nimport type { DereferenceOptions } from '@/utils/dereference'\nimport type { ValidateOptions } from '@/utils/validate'\nimport { details } from '../actions/details'\nimport { files } from '../actions/files'\nimport { get } from '../actions/get'\nimport { toJson } from '../actions/toJson'\nimport { toYaml } from '../actions/toYaml'\nimport { queueTask } from '../utils/queueTask'\nimport { dereferenceCommand } from './dereferenceCommand'\nimport { filterCommand } from './filterCommand'\nimport { upgradeCommand } from './upgradeCommand'\n\ndeclare global {\n interface Commands {\n validate: {\n task: {\n name: 'validate'\n options?: ValidateOptions\n }\n result: ValidateResult\n }\n }\n}\n\n/**\n * Validate the given OpenAPI document\n */\nexport function validateCommand<T extends Task[]>(previousQueue: Queue<T>, options?: ValidateOptions) {\n const task: Task = {\n name: 'validate',\n options: {\n throwOnError: previousQueue.options?.throwOnError,\n ...(options ?? {}),\n },\n }\n\n const queue = queueTask<[...T, typeof task]>(previousQueue, task as Task)\n\n return {\n dereference: (dereferenceOptions?: DereferenceOptions) => dereferenceCommand(queue, dereferenceOptions),\n details: () => details(queue),\n files: () => files(queue),\n filter: (callback: (specification: AnyObject) => boolean) => filterCommand(queue, callback),\n get: () => get(queue),\n toJson: () => toJson(queue),\n toYaml: () => toYaml(queue),\n upgrade: () => upgradeCommand(queue),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAiBxB,SAAS,gBAAkC,eAAyB,SAA2B;AACpG,QAAM,OAAa;AAAA,IACjB,MAAM;AAAA,IACN,SAAS;AAAA,MACP,cAAc,cAAc,SAAS;AAAA,MACrC,GAAI,WAAW,CAAC;AAAA,IAClB;AAAA,EACF;AAEA,QAAM,QAAQ,UAA+B,eAAe,IAAY;AAExE,SAAO;AAAA,IACL,aAAa,CAAC,uBAA4C,mBAAmB,OAAO,kBAAkB;AAAA,IACtG,SAAS,MAAM,QAAQ,KAAK;AAAA,IAC5B,OAAO,MAAM,MAAM,KAAK;AAAA,IACxB,QAAQ,CAAC,aAAoD,cAAc,OAAO,QAAQ;AAAA,IAC1F,KAAK,MAAM,IAAI,KAAK;AAAA,IACpB,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,QAAQ,MAAM,OAAO,KAAK;AAAA,IAC1B,SAAS,MAAM,eAAe,KAAK;AAAA,EACrC;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/openapi/openapi.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyApiDefinitionFormat, OpenApiOptions, Queue } from '@/types/index'\nimport type { LoadOptions } from '@/utils/load/load'\nimport { loadCommand } from './commands/loadCommand'\n\n/**\n * Creates a fluent OpenAPI pipeline\n *\n * @deprecated We are about to drop the pipeline syntax. Use the individual utilities instead.\n */\nexport function openapi(globalOptions?: OpenApiOptions) {\n // Create a new queue\n const queue = {\n input: null,\n options: globalOptions,\n tasks: [],\n } as Queue<[]>\n\n return {\n load: (input: AnyApiDefinitionFormat, options?: LoadOptions) => loadCommand(queue, input, options),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,mBAAmB;AAOrB,SAAS,QAAQ,eAAgC;AAEtD,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO,CAAC;AAAA,EACV;AAEA,SAAO;AAAA,IACL,MAAM,CAAC,OAA+B,YAA0B,YAAY,OAAO,OAAO,OAAO;AAAA,EACnG;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/openapi/openapi.test-d.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe, expectTypeOf, it } from 'vitest'\n\nimport type { Filesystem } from '../../types/index'\nimport { openapi } from './openapi'\n\ndescribe('openapi', () => {\n it('returns the correct type for load()', async () => {\n const result = await openapi().load({}).get()\n\n expectTypeOf(result.filesystem).toMatchTypeOf<Filesystem>()\n\n // @ts-expect-error `valid` should be undefined\n expectTypeOf(result.valid).toMatchTypeOf<boolean>()\n })\n\n it('returns the correct type for validate()', async () => {\n const result = await openapi().load({}).validate().get()\n\n expectTypeOf(result.valid).toMatchTypeOf<boolean>()\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,UAAU,cAAc,UAAU;AAG3C,SAAS,eAAe;AAExB,SAAS,WAAW,MAAM;AACxB,KAAG,uCAAuC,YAAY;AACpD,UAAM,SAAS,MAAM,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI;AAE5C,iBAAa,OAAO,UAAU,EAAE,cAA0B;AAG1D,iBAAa,OAAO,KAAK,EAAE,cAAuB;AAAA,EACpD,CAAC;AAED,KAAG,2CAA2C,YAAY;AACxD,UAAM,SAAS,MAAM,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI;AAEvD,iBAAa,OAAO,KAAK,EAAE,cAAuB;AAAA,EACpD,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/utils/queueTask.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Queue, Task } from '@/types/index'\n\n/**\n * Add a new task to the existing queue\n */\nexport function queueTask<T extends Task[]>(queue: Queue, task: Task) {\n return {\n ...queue,\n tasks: [...queue.tasks, task],\n } as Queue<T>\n}\n"],
|
|
5
|
-
"mappings": "AAKO,SAAS,UAA4B,OAAc,MAAY;AACpE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,CAAC,GAAG,MAAM,OAAO,IAAI;AAAA,EAC9B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/openapi/utils/workThroughQueue.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CommandChain, Queue, Task } from '@/types/index'\nimport { dereference } from '@/utils/dereference'\nimport { filter } from '@/utils/filter'\nimport { load } from '@/utils/load/load'\nimport { upgrade } from '@/utils/upgrade'\nimport { validate } from '@/utils/validate'\n\n/**\n * Takes a queue of tasks and works through them\n */\nexport async function workThroughQueue<T extends Task[]>(queue: Queue<T>): Promise<CommandChain<T>> {\n const { input } = {\n ...queue,\n }\n let result = {} as CommandChain<T>\n\n // Work through the whole queue\n for (const task of queue.tasks) {\n const name: keyof Commands = task.name\n const options: any = 'options' in task ? task.options : undefined\n\n // Use the result of the previous task, or fall back to the original input\n const currentSpecification = result.specification\n ? result.specification\n : typeof input === 'object'\n ? // Detach from the original object\n structuredClone(input)\n : input\n\n // load\n if (name === 'load') {\n result = {\n ...result,\n ...(await load(input, options as Commands['load']['task']['options'])),\n }\n }\n\n // validate\n else if (name === 'filter') {\n result = {\n ...result,\n ...filter(currentSpecification, options as Commands['filter']['task']['options']),\n }\n }\n\n // dereference\n else if (name === 'dereference') {\n result = {\n ...result,\n ...dereference(currentSpecification, options as Commands['dereference']['task']['options']),\n }\n }\n\n // upgrade\n else if (name === 'upgrade') {\n result = {\n ...result,\n ...upgrade(currentSpecification),\n }\n }\n\n // validate\n else if (name === 'validate') {\n result = {\n ...result,\n ...(await validate(currentSpecification, options as Commands['validate']['task']['options'])),\n }\n }\n\n // Make TS complain when we forgot to handle a command.\n else {\n name satisfies never\n }\n }\n\n return result\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAKzB,eAAsB,iBAAmC,OAA2C;AAClG,QAAM,EAAE,MAAM,IAAI;AAAA,IAChB,GAAG;AAAA,EACL;AACA,MAAI,SAAS,CAAC;AAGd,aAAW,QAAQ,MAAM,OAAO;AAC9B,UAAM,OAAuB,KAAK;AAClC,UAAM,UAAe,aAAa,OAAO,KAAK,UAAU;AAGxD,UAAM,uBAAuB,OAAO,gBAChC,OAAO,gBACP,OAAO,UAAU;AAAA;AAAA,MAEf,gBAAgB,KAAK;AAAA,QACrB;AAGN,QAAI,SAAS,QAAQ;AACnB,eAAS;AAAA,QACP,GAAG;AAAA,QACH,GAAI,MAAM,KAAK,OAAO,OAA8C;AAAA,MACtE;AAAA,IACF,WAGS,SAAS,UAAU;AAC1B,eAAS;AAAA,QACP,GAAG;AAAA,QACH,GAAG,OAAO,sBAAsB,OAAgD;AAAA,MAClF;AAAA,IACF,WAGS,SAAS,eAAe;AAC/B,eAAS;AAAA,QACP,GAAG;AAAA,QACH,GAAG,YAAY,sBAAsB,OAAqD;AAAA,MAC5F;AAAA,IACF,WAGS,SAAS,WAAW;AAC3B,eAAS;AAAA,QACP,GAAG;AAAA,QACH,GAAG,QAAQ,oBAAoB;AAAA,MACjC;AAAA,IACF,WAGS,SAAS,YAAY;AAC5B,eAAS;AAAA,QACP,GAAG;AAAA,QACH,GAAI,MAAM,SAAS,sBAAsB,OAAkD;AAAA,MAC7F;AAAA,IACF,OAGK;AACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/resolve-references.ts"],
|
|
4
|
-
"sourcesContent": ["import { isObject } from '@scalar/helpers/object/is-object'\nimport type { OpenAPI } from '@scalar/openapi-types'\n\nimport { ERRORS } from '@/configuration'\nimport type { AnyObject, ErrorObject, Filesystem, FilesystemEntry, ThrowOnErrorOption } from '@/types/index'\n\nimport { getEntrypoint } from './get-entrypoint'\nimport { getSegmentsFromPath } from './get-segments-from-path'\nimport { makeFilesystem } from './make-filesystem'\n\n// TODO: Add support for all pointer words\n// export const pointerWords = new Set([\n// '$ref',\n// '$id',\n// '$anchor',\n// '$dynamicRef',\n// '$dynamicAnchor',\n// '$schema',\n// ])\n\ntype ResolveReferencesResult = {\n valid: boolean\n errors: ErrorObject[]\n schema: OpenAPI.Document\n}\n\nexport type ResolveReferencesOptions = ThrowOnErrorOption & {\n /**\n * Fired when dereferenced a schema.\n *\n * Note that for object schemas, its properties may not be dereferenced when the hook is called.\n */\n onDereference?: (data: { schema: AnyObject; ref: string }) => void\n}\n\n/**\n * Takes a specification and resolves all references.\n */\nexport function resolveReferences(\n // Just a specification, or a set of files.\n input: AnyObject | Filesystem,\n // Additional options to control the behaviour\n options?: ResolveReferencesOptions,\n // Fallback to the entrypoint\n file?: FilesystemEntry,\n // Errors that occurred during the process\n errors: ErrorObject[] = [],\n): ResolveReferencesResult {\n // Detach from input\n const clonedInput = structuredClone(input)\n\n // Make it a filesystem, even if it's just one file\n const filesystem = makeFilesystem(clonedInput)\n\n // Get the main file\n const entrypoint = getEntrypoint(filesystem)\n\n const finalInput = file?.specification ?? entrypoint.specification\n\n // Does it look like an OpenAPI document?\n if (!isObject(finalInput)) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.NO_CONTENT)\n }\n\n return {\n valid: false,\n errors,\n schema: finalInput as OpenAPI.Document,\n }\n }\n\n // Recursively resolve all references\n dereference(finalInput, filesystem, file ?? entrypoint, new WeakSet(), errors, options)\n\n // Remove duplicates (according to message) from errors\n errors = errors.filter(\n (error, index, self) => index === self.findIndex((t) => t.message === error.message && t.code === error.code),\n )\n\n // Return the resolved specification\n return {\n valid: errors.length === 0,\n errors,\n schema: finalInput as OpenAPI.Document,\n }\n}\n\n/**\n * Resolves the circular reference to an object and deletes the $ref properties (in-place).\n */\nfunction dereference(\n schema: AnyObject,\n filesystem: Filesystem,\n entrypoint: FilesystemEntry,\n // references to resolved object\n resolvedSchemas: WeakSet<object>,\n // error output\n errors: ErrorObject[],\n\n options?: ResolveReferencesOptions,\n): void {\n if (schema === null || resolvedSchemas.has(schema)) {\n return\n }\n resolvedSchemas.add(schema)\n\n function resolveExternal(externalFile: FilesystemEntry) {\n dereference(externalFile.specification, filesystem, externalFile, resolvedSchemas, errors, options)\n\n return externalFile\n }\n\n /**\n * Track seen $ref paths to detect self-referencing schemas.\n *\n * This only tracks $refs within the current while loop (one resolution chain).\n * Each schema object gets its own fresh processedRefs when dereference() is called.\n *\n * This catches invalid cases like:\n * Test: { $ref: '#/components/schemas/Test' }\n *\n * But allows valid recursive schemas where the $ref is nested:\n * Person: { type: 'object', properties: { friend: { $ref: '#/components/schemas/Person' } } }\n */\n const processedRefs = new Set<string>()\n\n while (schema.$ref !== undefined) {\n const selfReferenceDetected = processedRefs.has(schema.$ref)\n\n if (selfReferenceDetected) {\n errors.push({\n code: 'SELF_REFERENCE',\n message: ERRORS.SELF_REFERENCE.replace('%s', schema.$ref),\n })\n\n delete schema.$ref\n\n break\n }\n\n processedRefs.add(schema.$ref)\n\n // Find the referenced content\n const resolved = resolveUri(schema.$ref, options, entrypoint, filesystem, resolveExternal, errors)\n\n // invalid\n if (typeof resolved !== 'object' || resolved === null) {\n break\n }\n const dereferencedRef = schema.$ref\n\n // Get rid of the reference\n delete schema.$ref\n\n for (const key of Object.keys(resolved)) {\n if (schema[key] === undefined) {\n schema[key] = resolved[key]\n }\n }\n\n if (dereferencedRef) {\n options?.onDereference?.({ schema, ref: dereferencedRef })\n }\n }\n\n // Iterate over the whole object\n for (const value of Object.values(schema)) {\n if (typeof value === 'object' && value !== null) {\n dereference(value, filesystem, entrypoint, resolvedSchemas, errors, options)\n }\n }\n}\n\n/**\n * Resolves a URI to a part of the specification\n *\n * The output is not necessarily dereferenced\n */\nfunction resolveUri(\n // 'foobar.json#/foo/bar'\n uri: string,\n options: ResolveReferencesOptions,\n // { filename: './foobar.json '}\n file: FilesystemEntry,\n // [ { filename: './foobar.json '} ]\n filesystem: Filesystem,\n\n // a function to resolve references in external file\n resolve: (file: FilesystemEntry) => FilesystemEntry,\n\n errors: ErrorObject[],\n): AnyObject | undefined {\n // Ignore invalid URIs\n if (typeof uri !== 'string') {\n if (options?.throwOnError) {\n throw new Error(ERRORS.INVALID_REFERENCE.replace('%s', uri))\n }\n\n errors.push({\n code: 'INVALID_REFERENCE',\n message: ERRORS.INVALID_REFERENCE.replace('%s', uri),\n })\n\n return undefined\n }\n\n // Understand the URI\n const [prefix, path] = uri.split('#', 2)\n\n /** Check whether the file is pointing to itself */\n const isDifferentFile = prefix !== file.filename\n\n // External references\n if (prefix && isDifferentFile) {\n const externalReference = filesystem.find((entry) => {\n return entry.filename === prefix\n })\n\n if (!externalReference) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', prefix))\n }\n\n errors.push({\n code: 'EXTERNAL_REFERENCE_NOT_FOUND',\n message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', prefix),\n })\n\n return undefined\n }\n // $ref: 'other-file.yaml'\n if (path === undefined) {\n return externalReference.specification\n }\n\n // $ref: 'other-file.yaml#/foo/bar'\n // resolve refs first before accessing properties directly\n return resolveUri(`#${path}`, options, resolve(externalReference), filesystem, resolve, errors)\n }\n\n // Pointers\n const segments = getSegmentsFromPath(path)\n\n // Try to find the URI\n try {\n return segments.reduce((acc, key) => {\n return acc[key]\n }, file.specification)\n } catch (_error) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.INVALID_REFERENCE.replace('%s', uri))\n }\n\n errors.push({\n code: 'INVALID_REFERENCE',\n message: ERRORS.INVALID_REFERENCE.replace('%s', uri),\n })\n }\n\n return undefined\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,gBAAgB;AAGzB,SAAS,cAAc;AAGvB,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AA8BxB,SAAS,kBAEd,OAEA,SAEA,MAEA,SAAwB,CAAC,GACA;AAEzB,QAAM,cAAc,gBAAgB,KAAK;AAGzC,QAAM,aAAa,eAAe,WAAW;AAG7C,QAAM,aAAa,cAAc,UAAU;AAE3C,QAAM,aAAa,MAAM,iBAAiB,WAAW;AAGrD,MAAI,CAAC,SAAS,UAAU,GAAG;AACzB,QAAI,SAAS,cAAc;AACzB,YAAM,IAAI,MAAM,OAAO,UAAU;AAAA,IACnC;AAEA,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AAGA,cAAY,YAAY,YAAY,QAAQ,YAAY,oBAAI,QAAQ,GAAG,QAAQ,OAAO;AAGtF,WAAS,OAAO;AAAA,IACd,CAAC,OAAO,OAAO,SAAS,UAAU,KAAK,UAAU,CAAC,MAAM,EAAE,YAAY,MAAM,WAAW,EAAE,SAAS,MAAM,IAAI;AAAA,EAC9G;AAGA,SAAO;AAAA,IACL,OAAO,OAAO,WAAW;AAAA,IACzB;AAAA,IACA,QAAQ;AAAA,EACV;AACF;AAKA,SAAS,YACP,QACA,YACA,YAEA,iBAEA,QAEA,SACM;AACN,MAAI,WAAW,QAAQ,gBAAgB,IAAI,M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version": 3,
|
|
3
|
-
"sources": ["../../src/utils/to-json.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nexport const toJson = (value: AnyObject) => JSON.stringify(value, null, 2)\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,SAAS,CAAC,UAAqB,KAAK,UAAU,OAAO,MAAM,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/to-yaml.ts"],
|
|
4
|
-
"sourcesContent": ["import { stringify } from 'yaml'\n\nimport type { AnyObject } from '@/types/index'\n\nexport const toYaml = (value: AnyObject) => stringify(value)\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAInB,MAAM,SAAS,CAAC,UAAqB,UAAU,KAAK;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/transform/sanitize.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPI } from '@scalar/openapi-types'\n\nimport type { AnyObject } from '@/types/index'\n\nimport { addInfoObject } from './utils/addInfoObject'\nimport { addLatestOpenApiVersion } from './utils/addLatestOpenApiVersion'\nimport { addMissingTags } from './utils/addMissingTags'\nimport { normalizeSecuritySchemes } from './utils/normalizeSecuritySchemes'\nimport { rejectSwaggerDocuments } from './utils/rejectSwaggerDocuments'\n\n// biome-ignore lint/performance/noBarrelFile: re-exports utilities\nexport { DEFAULT_TITLE } from './utils/addInfoObject'\nexport { DEFAULT_OPENAPI_VERSION } from './utils/addLatestOpenApiVersion'\n\n/**\n * Make an OpenAPI document a valid and clean OpenAPI document\n *\n * @deprecated We're about to drop this from the package.\n */\nexport function sanitize(definition: AnyObject): OpenAPI.Document {\n const transformers = [\n rejectSwaggerDocuments,\n addLatestOpenApiVersion,\n addInfoObject,\n addMissingTags,\n normalizeSecuritySchemes,\n ]\n\n return transformers.reduce((doc, transformer) => transformer(doc), definition)\n}\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B;AACxC,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,8BAA8B;AAGvC,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B;AAOjC,SAAS,SAAS,YAAyC;AAChE,QAAM,eAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO,aAAa,OAAO,CAAC,KAAK,gBAAgB,YAAY,GAAG,GAAG,UAAU;AAC/E;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/transform/utils/addInfoObject.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nexport const DEFAULT_TITLE = 'API'\nconst DEFAULT_VERSION = '1.0'\n\nexport const addInfoObject = (definition: AnyObject) => ({\n ...definition,\n info: {\n ...definition.info,\n title: definition.info?.title ?? DEFAULT_TITLE,\n version: definition.info?.version ?? DEFAULT_VERSION,\n },\n})\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,gBAAgB;AAC7B,MAAM,kBAAkB;AAEjB,MAAM,gBAAgB,CAAC,gBAA2B;AAAA,EACvD,GAAG;AAAA,EACH,MAAM;AAAA,IACJ,GAAG,WAAW;AAAA,IACd,OAAO,WAAW,MAAM,SAAS;AAAA,IACjC,SAAS,WAAW,MAAM,WAAW;AAAA,EACvC;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/transform/utils/addLatestOpenApiVersion.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nexport const DEFAULT_OPENAPI_VERSION = '3.1.1'\n\nexport const addLatestOpenApiVersion = (definition: AnyObject) => ({\n openapi: definition.openapi ?? DEFAULT_OPENAPI_VERSION,\n ...definition,\n})\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,0BAA0B;AAEhC,MAAM,0BAA0B,CAAC,gBAA2B;AAAA,EACjE,SAAS,WAAW,WAAW;AAAA,EAC/B,GAAG;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/transform/utils/addMissingTags.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nexport const addMissingTags = (definition: AnyObject) => {\n if (!definition.paths) {\n return definition\n }\n\n // Collect all unique tags used in operations\n const usedTags = new Set<string>()\n for (const path of Object.values(definition.paths)) {\n if (typeof path === 'object' && path !== null) {\n for (const operation of Object.values(path)) {\n if (typeof operation === 'object' && operation !== null && 'tags' in operation) {\n const tags = operation.tags\n\n if (Array.isArray(tags)) {\n tags.forEach((tag) => usedTags.add(String(tag)))\n }\n }\n }\n }\n }\n\n // Convert tags to array of tag objects if not already present\n const existingTags = new Set(\n (Array.isArray(definition.tags) ? definition.tags : [])\n .map((tag) => (typeof tag === 'object' && tag !== null ? String(tag.name) : null))\n .filter(Boolean),\n )\n\n // Add missing tags\n const missingTags = [...usedTags].filter((tag) => !existingTags.has(tag)).map((name) => ({ name }))\n\n return {\n ...definition,\n tags: [...(Array.isArray(definition.tags) ? definition.tags : []), ...missingTags],\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,iBAAiB,CAAC,eAA0B;AACvD,MAAI,CAAC,WAAW,OAAO;AACrB,WAAO;AAAA,EACT;AAGA,QAAM,WAAW,oBAAI,IAAY;AACjC,aAAW,QAAQ,OAAO,OAAO,WAAW,KAAK,GAAG;AAClD,QAAI,OAAO,SAAS,YAAY,SAAS,MAAM;AAC7C,iBAAW,aAAa,OAAO,OAAO,IAAI,GAAG;AAC3C,YAAI,OAAO,cAAc,YAAY,cAAc,QAAQ,UAAU,WAAW;AAC9E,gBAAM,OAAO,UAAU;AAEvB,cAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,iBAAK,QAAQ,CAAC,QAAQ,SAAS,IAAI,OAAO,GAAG,CAAC,CAAC;AAAA,UACjD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,QAAM,eAAe,IAAI;AAAA,KACtB,MAAM,QAAQ,WAAW,IAAI,IAAI,WAAW,OAAO,CAAC,GAClD,IAAI,CAAC,QAAS,OAAO,QAAQ,YAAY,QAAQ,OAAO,OAAO,IAAI,IAAI,IAAI,IAAK,EAChF,OAAO,OAAO;AAAA,EACnB;AAGA,QAAM,cAAc,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,aAAa,IAAI,GAAG,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE;AAElG,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MAAM,CAAC,GAAI,MAAM,QAAQ,WAAW,IAAI,IAAI,WAAW,OAAO,CAAC,GAAI,GAAG,WAAW;AAAA,EACnF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/transform/utils/normalizeSecuritySchemes.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nexport const normalizeSecuritySchemes = (definition: AnyObject) => {\n if (!definition.components?.securitySchemes) {\n return definition\n }\n\n const securitySchemes = { ...definition.components.securitySchemes }\n\n for (const scheme of Object.values(securitySchemes)) {\n if (typeof scheme === 'object' && scheme !== null && 'type' in scheme) {\n const type = String(scheme.type).toLowerCase()\n scheme.type =\n {\n apikey: 'apiKey',\n oauth2: 'oauth2',\n http: 'http',\n mutualtls: 'mutualTLS',\n openidconnect: 'openIdConnect',\n }[type] ?? type\n }\n }\n\n // Convert array scopes to objects\n for (const scheme of Object.values(securitySchemes)) {\n if (\n typeof scheme === 'object' &&\n scheme !== null &&\n 'type' in scheme &&\n scheme.type === 'oauth2' &&\n 'flows' in scheme\n ) {\n const flows = scheme.flows as AnyObject\n for (const flow of Object.values(flows)) {\n if (typeof flow === 'object' && flow !== null && 'scopes' in flow && Array.isArray(flow.scopes)) {\n flow.scopes = flow.scopes.reduce((acc: AnyObject, scope: string) => {\n acc[scope] = ''\n return acc\n }, {})\n }\n }\n }\n }\n\n return {\n ...definition,\n components: {\n ...definition.components,\n securitySchemes,\n },\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,2BAA2B,CAAC,eAA0B;AACjE,MAAI,CAAC,WAAW,YAAY,iBAAiB;AAC3C,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB,EAAE,GAAG,WAAW,WAAW,gBAAgB;AAEnE,aAAW,UAAU,OAAO,OAAO,eAAe,GAAG;AACnD,QAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,UAAU,QAAQ;AACrE,YAAM,OAAO,OAAO,OAAO,IAAI,EAAE,YAAY;AAC7C,aAAO,OACL;AAAA,QACE,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QACX,eAAe;AAAA,MACjB,EAAE,IAAI,KAAK;AAAA,IACf;AAAA,EACF;AAGA,aAAW,UAAU,OAAO,OAAO,eAAe,GAAG;AACnD,QACE,OAAO,WAAW,YAClB,WAAW,QACX,UAAU,UACV,OAAO,SAAS,YAChB,WAAW,QACX;AACA,YAAM,QAAQ,OAAO;AACrB,iBAAW,QAAQ,OAAO,OAAO,KAAK,GAAG;AACvC,YAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,YAAY,QAAQ,MAAM,QAAQ,KAAK,MAAM,GAAG;AAC/F,eAAK,SAAS,KAAK,OAAO,OAAO,CAAC,KAAgB,UAAkB;AAClE,gBAAI,KAAK,IAAI;AACb,mBAAO;AAAA,UACT,GAAG,CAAC,CAAC;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,YAAY;AAAA,MACV,GAAG,WAAW;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/utils/transform/utils/rejectSwaggerDocuments.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nexport const rejectSwaggerDocuments = (defintion: AnyObject) => {\n if ('swagger' in defintion) {\n throw new Error('Swagger 2.0 documents are not supported. Please upgrade to OpenAPI 3.x.')\n }\n\n return defintion\n}\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,yBAAyB,CAAC,cAAyB;AAC9D,MAAI,aAAa,WAAW;AAC1B,UAAM,IAAI,MAAM,yEAAyE;AAAA,EAC3F;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/transform-errors.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\n\nimport { betterAjvErrors } from './betterAjvErrors/index'\n\n/**\n * Transforms ajv errors, finds the positions in the schema and returns an enriched format.\n */\nexport function transformErrors(specification: AnyObject, errors: any) {\n // TODO: This should work with multiple files\n\n if (typeof errors === 'string') {\n return [\n {\n message: errors,\n },\n ]\n }\n\n // If specification is null or invalid, betterAjvErrors cannot process it\n // This can happen when reference resolution fails\n if (!specification || typeof specification !== 'object') {\n return [\n {\n message: 'Invalid specification',\n },\n ]\n }\n\n // Wrap betterAjvErrors in a try-catch since it can fail with malformed schemas\n let processedErrors\n try {\n processedErrors = betterAjvErrors(specification, null, errors, {\n indent: 2,\n }).map((error) => {\n error.message = error.message.trim()\n\n return error\n })\n } catch (error) {\n console.error(error)\n // If betterAjvErrors fails, fall back to raw AJV errors\n if (Array.isArray(errors)) {\n return errors.map((err) => {\n let message = err.message || 'Validation error'\n\n // For additionalProperties errors, include the property name\n if (err.keyword === 'additionalProperties' && err.params?.additionalProperty) {\n message = `Property ${err.params.additionalProperty} is not expected to be here`\n }\n\n return {\n message,\n path: err.dataPath || err.instancePath,\n }\n })\n }\n return [\n {\n message: 'Validation failed',\n },\n ]\n }\n\n // Deduplicate errors with the same message and path\n const seen = new Set<string>()\n return processedErrors.filter((error) => {\n const key = `${error.message}||${error.path}`\n if (seen.has(key)) {\n return false\n }\n seen.add(key)\n return true\n })\n}\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,uBAAuB;AAKzB,SAAS,gBAAgB,eAA0B,QAAa;AAGrE,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO;AAAA,MACL;AAAA,QACE,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAIA,MAAI,CAAC,iBAAiB,OAAO,kBAAkB,UAAU;AACvD,WAAO;AAAA,MACL;AAAA,QACE,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAGA,MAAI;AACJ,MAAI;AACF,sBAAkB,gBAAgB,eAAe,MAAM,QAAQ;AAAA,MAC7D,QAAQ;AAAA,IACV,CAAC,EAAE,IAAI,CAAC,UAAU;AAChB,YAAM,UAAU,MAAM,QAAQ,KAAK;AAEnC,aAAO;AAAA,IACT,CAAC;AAAA,EACH,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAEnB,QAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,aAAO,OAAO,IAAI,CAAC,QAAQ;AACzB,YAAI,UAAU,IAAI,WAAW;AAG7B,YAAI,IAAI,YAAY,0BAA0B,IAAI,QAAQ,oBAAoB;AAC5E,oBAAU,YAAY,IAAI,OAAO,kBAAkB;AAAA,QACrD;AAEA,eAAO;AAAA,UACL;AAAA,UACA,MAAM,IAAI,YAAY,IAAI;AAAA,QAC5B;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,MACL;AAAA,QACE,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAGA,QAAM,OAAO,oBAAI,IAAY;AAC7B,SAAO,gBAAgB,OAAO,CAAC,UAAU;AACvC,UAAM,MAAM,GAAG,MAAM,OAAO,KAAK,MAAM,IAAI;AAC3C,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACA,SAAK,IAAI,GAAG;AACZ,WAAO;AAAA,EACT,CAAC;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/traverse.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject } from '@/types/index'\nimport type { UnknownObject } from '@scalar/types/utils'\n\n/**\n * Recursively traverses the content and applies the transform function to each node.\n */\nexport function traverse(\n content: UnknownObject,\n transform: (content: UnknownObject, path?: string[]) => UnknownObject,\n path: string[] = [],\n) {\n const result: AnyObject = {}\n\n for (const [key, value] of Object.entries(content)) {\n const currentPath = [...path, key]\n\n if (Array.isArray(value)) {\n result[key] = value.map((item, index) => {\n if (typeof item === 'object' && !Array.isArray(item) && item !== null) {\n return traverse(item, transform, [...currentPath, index.toString()])\n }\n\n return item\n })\n\n continue\n }\n\n if (typeof value === 'object' && value !== null) {\n result[key] = traverse(value as UnknownObject, transform, currentPath)\n\n continue\n }\n\n result[key] = value\n }\n\n return transform(result, path)\n}\n"],
|
|
5
|
-
"mappings": "AAMO,SAAS,SACd,SACA,WACA,OAAiB,CAAC,GAClB;AACA,QAAM,SAAoB,CAAC;AAE3B,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,UAAM,cAAc,CAAC,GAAG,MAAM,GAAG;AAEjC,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,aAAO,GAAG,IAAI,MAAM,IAAI,CAAC,MAAM,UAAU;AACvC,YAAI,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,KAAK,SAAS,MAAM;AACrE,iBAAO,SAAS,MAAM,WAAW,CAAC,GAAG,aAAa,MAAM,SAAS,CAAC,CAAC;AAAA,QACrE;AAEA,eAAO;AAAA,MACT,CAAC;AAED;AAAA,IACF;AAEA,QAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,aAAO,GAAG,IAAI,SAAS,OAAwB,WAAW,WAAW;AAErE;AAAA,IACF;AAEA,WAAO,GAAG,IAAI;AAAA,EAChB;AAEA,SAAO,UAAU,QAAQ,IAAI;AAC/B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/unescape-json-pointer.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Unescape JSON pointer\n *\n * Examples:\n * /foo~1bar~0baz -> /foo/bar~baz\n */\nexport function unescapeJsonPointer(uri: string) {\n return decodeURI(uri.replace(/~1/g, '/').replace(/~0/g, '~'))\n}\n"],
|
|
5
|
-
"mappings": "AAMO,SAAS,oBAAoB,KAAa;AAC/C,SAAO,UAAU,IAAI,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,CAAC;AAC9D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/upgrade.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPIV3_1 } from '@scalar/openapi-types'\nimport { upgrade as originalUpgrade } from '@scalar/openapi-upgrader'\nimport type { UnknownObject } from '@scalar/types/utils'\n\nimport type { AnyObject, Filesystem, UpgradeResult } from '@/types/index'\n\nimport { getEntrypoint } from './get-entrypoint'\nimport { isFilesystem } from './is-filesystem'\nimport { normalize } from './normalize'\n\n/**\n * Upgrade specification to OpenAPI 3.1.0\n */\nexport function upgrade(value: string | AnyObject | Filesystem): UpgradeResult<OpenAPIV3_1.Document> {\n if (!value) {\n return {\n specification: null,\n version: '3.1',\n }\n }\n\n // TODO: Run upgrade over the whole filesystem\n const document = originalUpgrade(\n isFilesystem(value) ? getEntrypoint(value).specification : (normalize(value) as UnknownObject),\n '3.1',\n )\n\n return {\n specification: document,\n // TODO: Make dynamic\n version: '3.1',\n } as UpgradeResult<OpenAPIV3_1.Document>\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,WAAW,uBAAuB;AAK3C,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAKnB,SAAS,QAAQ,OAA6E;AACnG,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,MACL,eAAe;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AAGA,QAAM,WAAW;AAAA,IACf,aAAa,KAAK,IAAI,cAAc,KAAK,EAAE,gBAAiB,UAAU,KAAK;AAAA,IAC3E;AAAA,EACF;AAEA,SAAO;AAAA,IACL,eAAe;AAAA;AAAA,IAEf,SAAS;AAAA,EACX;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/validate-path-parameters.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnyObject, ErrorObject } from '@/types/index'\n\nconst OPERATION_KEYS = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'])\nconst PATH_PARAMETER_PATTERN = /{([^}]+)}/g\n\ntype PathParameter = {\n name: string\n path: string[]\n}\n\n/**\n * Validates path-template semantics that are not enforced by the JSON schema.\n */\nexport function validatePathParameters(specification: AnyObject): ErrorObject[] {\n const paths = specification?.paths\n\n if (!paths || typeof paths !== 'object') {\n return []\n }\n\n const errors: ErrorObject[] = []\n\n for (const [pathName, pathItem] of Object.entries(paths)) {\n if (!isRecord(pathItem)) {\n continue\n }\n\n const operations = Object.entries(pathItem).filter(\n ([key, value]) => OPERATION_KEYS.has(key) && isRecord(value),\n ) as Array<[string, AnyObject]>\n\n // Preserve the repo's current behaviour for empty path items.\n if (operations.length === 0) {\n continue\n }\n\n const templateParameters = new Set(getTemplateParameterNames(pathName))\n const pathLevelParameters = getPathParameters(pathItem.parameters, ['paths', pathName, 'parameters'])\n\n for (const parameter of pathLevelParameters) {\n if (!templateParameters.has(parameter.name)) {\n errors.push({\n path: parameter.path,\n message: `Path parameter \"${parameter.name}\" must have the corresponding {${parameter.name}} segment in the \"${pathName}\" path`,\n })\n }\n }\n\n for (const [operationKey, operation] of operations) {\n const operationParameters = getPathParameters(operation.parameters, [\n 'paths',\n pathName,\n operationKey,\n 'parameters',\n ])\n\n for (const parameter of operationParameters) {\n if (!templateParameters.has(parameter.name)) {\n errors.push({\n path: parameter.path,\n message: `Path parameter \"${parameter.name}\" must have the corresponding {${parameter.name}} segment in the \"${pathName}\" path`,\n })\n }\n }\n\n const effectiveParameters = new Set(\n [...pathLevelParameters, ...operationParameters].map((parameter) => parameter.name),\n )\n\n for (const templateParameter of templateParameters) {\n if (!effectiveParameters.has(templateParameter)) {\n errors.push({\n path: ['paths', pathName, operationKey],\n message: `Declared path parameter \"${templateParameter}\" needs to be defined as a path parameter at either the path or operation level`,\n })\n }\n }\n }\n }\n\n return deduplicateErrors(errors)\n}\n\nfunction getTemplateParameterNames(pathName: string) {\n return [...pathName.matchAll(PATH_PARAMETER_PATTERN)].map((match) => match[1])\n}\n\nfunction getPathParameters(parameters: unknown, pathPrefix: string[]): PathParameter[] {\n if (!Array.isArray(parameters)) {\n return []\n }\n\n return parameters.flatMap((parameter, index) => {\n if (!isRecord(parameter) || parameter.in !== 'path' || typeof parameter.name !== 'string') {\n return []\n }\n\n return [\n {\n name: parameter.name,\n path: [...pathPrefix, String(index), 'name'],\n },\n ]\n })\n}\n\nfunction deduplicateErrors(errors: ErrorObject[]) {\n const seen = new Set<string>()\n\n return errors.filter((error) => {\n const key = `${error.message}||${error.path?.join('.') ?? ''}`\n\n if (seen.has(key)) {\n return false\n }\n\n seen.add(key)\n\n return true\n })\n}\n\nfunction isRecord(value: unknown): value is AnyObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n"],
|
|
5
|
-
"mappings": "AAEA,MAAM,iBAAiB,oBAAI,IAAI,CAAC,OAAO,OAAO,QAAQ,UAAU,WAAW,QAAQ,SAAS,OAAO,CAAC;AACpG,MAAM,yBAAyB;AAUxB,SAAS,uBAAuB,eAAyC;AAC9E,QAAM,QAAQ,eAAe;AAE7B,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,SAAwB,CAAC;AAE/B,aAAW,CAAC,UAAU,QAAQ,KAAK,OAAO,QAAQ,KAAK,GAAG;AACxD,QAAI,CAAC,SAAS,QAAQ,GAAG;AACvB;AAAA,IACF;AAEA,UAAM,aAAa,OAAO,QAAQ,QAAQ,EAAE;AAAA,MAC1C,CAAC,CAAC,KAAK,KAAK,MAAM,eAAe,IAAI,GAAG,KAAK,SAAS,KAAK;AAAA,IAC7D;AAGA,QAAI,WAAW,WAAW,GAAG;AAC3B;AAAA,IACF;AAEA,UAAM,qBAAqB,IAAI,IAAI,0BAA0B,QAAQ,CAAC;AACtE,UAAM,sBAAsB,kBAAkB,SAAS,YAAY,CAAC,SAAS,UAAU,YAAY,CAAC;AAEpG,eAAW,aAAa,qBAAqB;AAC3C,UAAI,CAAC,mBAAmB,IAAI,UAAU,IAAI,GAAG;AAC3C,eAAO,KAAK;AAAA,UACV,MAAM,UAAU;AAAA,UAChB,SAAS,mBAAmB,UAAU,IAAI,kCAAkC,U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AO;AAAA,MACL;AAAA,QACE,MAAM,UAAU;AAAA,QAChB,MAAM,CAAC,GAAG,YAAY,OAAO,KAAK,GAAG,MAAM;AAAA,MAC7C;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,SAAS,kBAAkB,QAAuB;AAChD,QAAM,OAAO,oBAAI,IAAY;AAE7B,SAAO,OAAO,OAAO,CAAC,UAAU;AAC9B,UAAM,MAAM,GAAG,MAAM,OAAO,KAAK,MAAM,MAAM,KAAK,GAAG,KAAK,EAAE;AAE5D,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AAEA,SAAK,IAAI,GAAG;AAEZ,WAAO;AAAA,EACT,CAAC;AACH;AAEA,SAAS,SAAS,OAAoC;AACpD,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/validate.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPI } from '@scalar/openapi-types'\n\nimport { Validator } from '@/lib/Validator/Validator'\nimport type { AnyObject, Filesystem, ThrowOnErrorOption, ValidateResult } from '@/types/index'\n\nimport { makeFilesystem } from './make-filesystem'\n\nexport type ValidateOptions = ThrowOnErrorOption\n\n/**\n * Validates an OpenAPI document\n */\nexport function validate(value: string | AnyObject | Filesystem, options?: ValidateOptions): Promise<ValidateResult> {\n try {\n const filesystem = makeFilesystem(value)\n\n const validator = new Validator()\n const result = validator.validate(filesystem, options)\n\n /**\n * Currently contains no asynchronous logic, but returns a Promise\n * to preserve API compatibility and allow async logic in the future.\n */\n return Promise.resolve({\n ...result,\n specification: validator.specification as OpenAPI.Document,\n version: validator.version,\n })\n } catch (err) {\n return Promise.reject(err)\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,iBAAiB;AAG1B,SAAS,sBAAsB;AAOxB,SAAS,SAAS,OAAwC,SAAoD;AACnH,MAAI;AACF,UAAM,aAAa,eAAe,KAAK;AAEvC,UAAM,YAAY,IAAI,UAAU;AAChC,UAAM,SAAS,UAAU,SAAS,YAAY,OAAO;AAMrD,WAAO,QAAQ,QAAQ;AAAA,MACrB,GAAG;AAAA,MACH,eAAe,UAAU;AAAA,MACzB,SAAS,UAAU;AAAA,IACrB,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,WAAO,QAAQ,OAAO,GAAG;AAAA,EAC3B;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|