@sdk-it/spec 0.29.0 → 0.31.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 (57) hide show
  1. package/dist/lib/find-polymorphic-varients.d.ts +3 -3
  2. package/dist/lib/find-polymorphic-varients.d.ts.map +1 -1
  3. package/dist/lib/find-polymorphic-varients.js.map +1 -1
  4. package/dist/lib/find-polymorphic-varients.test.js +2 -2
  5. package/dist/lib/find-polymorphic-varients.test.js.map +2 -2
  6. package/dist/lib/for-each-operation.d.ts +2 -2
  7. package/dist/lib/for-each-operation.d.ts.map +1 -1
  8. package/dist/lib/for-each-operation.js.map +1 -1
  9. package/dist/lib/get-ref-usage.d.ts +2 -2
  10. package/dist/lib/get-ref-usage.d.ts.map +1 -1
  11. package/dist/lib/get-ref-usage.js.map +1 -1
  12. package/dist/lib/ir.d.ts +2 -2
  13. package/dist/lib/ir.d.ts.map +1 -1
  14. package/dist/lib/ir.js +2 -2
  15. package/dist/lib/ir.js.map +2 -2
  16. package/dist/lib/options.d.ts +3 -0
  17. package/dist/lib/options.d.ts.map +1 -1
  18. package/dist/lib/options.js.map +1 -1
  19. package/dist/lib/overview-docs/overview-auth.d.ts +2 -2
  20. package/dist/lib/overview-docs/overview-auth.d.ts.map +1 -1
  21. package/dist/lib/overview-docs/overview-auth.js.map +2 -2
  22. package/dist/lib/overview-docs/overview-docs.d.ts +2 -2
  23. package/dist/lib/overview-docs/overview-docs.d.ts.map +1 -1
  24. package/dist/lib/overview-docs/overview-docs.js.map +1 -1
  25. package/dist/lib/overview-docs/overview-errors.d.ts +2 -2
  26. package/dist/lib/overview-docs/overview-errors.d.ts.map +1 -1
  27. package/dist/lib/overview-docs/overview-errors.js.map +2 -2
  28. package/dist/lib/overview-docs/overview-intro.d.ts +2 -2
  29. package/dist/lib/overview-docs/overview-intro.d.ts.map +1 -1
  30. package/dist/lib/overview-docs/overview-intro.js.map +1 -1
  31. package/dist/lib/overview-docs/overview-pagination.d.ts +2 -2
  32. package/dist/lib/overview-docs/overview-pagination.d.ts.map +1 -1
  33. package/dist/lib/overview-docs/overview-pagination.js +27 -9
  34. package/dist/lib/overview-docs/overview-pagination.js.map +2 -2
  35. package/dist/lib/pagination/pagination.d.ts +2 -2
  36. package/dist/lib/pagination/pagination.d.ts.map +1 -1
  37. package/dist/lib/pagination/pagination.js.map +2 -2
  38. package/dist/lib/security.d.ts +3 -3
  39. package/dist/lib/security.d.ts.map +1 -1
  40. package/dist/lib/security.js.map +2 -2
  41. package/dist/lib/sidebar.d.ts +2 -2
  42. package/dist/lib/sidebar.d.ts.map +1 -1
  43. package/dist/lib/sidebar.js.map +2 -2
  44. package/dist/lib/tune-request-body.d.ts +3 -3
  45. package/dist/lib/tune-request-body.d.ts.map +1 -1
  46. package/dist/lib/tune-request-body.js.map +1 -1
  47. package/dist/lib/tune-response.d.ts +2 -2
  48. package/dist/lib/tune-response.d.ts.map +1 -1
  49. package/dist/lib/tune-response.js.map +1 -1
  50. package/dist/lib/tune.d.ts +3 -3
  51. package/dist/lib/tune.d.ts.map +1 -1
  52. package/dist/lib/tune.js.map +1 -1
  53. package/dist/lib/tune.test.js +2 -2
  54. package/dist/lib/tune.test.js.map +2 -2
  55. package/dist/lib/types.d.ts +1 -1
  56. package/dist/lib/types.d.ts.map +1 -1
  57. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-errors.ts"],
4
- "sourcesContent": ["import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport { distillRef } from '@sdk-it/core';\n\nimport { forEachOperation } from '../for-each-operation.js';\nimport { isErrorStatusCode } from '../is.js';\nimport type { NavItem } from '../sidebar.js';\nimport type { OurOpenAPIObject } from '../types.js';\n\ninterface ErrorSchema {\n statusCode: string;\n title: string;\n description?: string;\n schema: SchemaObject | ReferenceObject;\n operations: string[]; // Track which operations use this error\n}\n\nfunction formatSchemaForDisplay(\n spec: OurOpenAPIObject,\n schema: SchemaObject | ReferenceObject,\n): string {\n const resolvedSchema = distillRef(spec, schema);\n\n return `\\`\\`\\`json\n${JSON.stringify(resolvedSchema, null, 2)}\n\\`\\`\\``;\n}\n\nfunction getStatusDescription(statusCode: string): string {\n const descriptions: Record<string, string> = {\n '400': 'Bad Request - The request was invalid or cannot be served.',\n '401':\n 'Unauthorized - Authentication is required and has failed or has not been provided.',\n '402': 'Payment Required - Payment is required to access this resource.',\n '403':\n 'Forbidden - The request was valid, but the server is refusing action.',\n '404': 'Not Found - The requested resource could not be found.',\n '405':\n 'Method Not Allowed - The request method is not supported for this resource.',\n '406':\n 'Not Acceptable - The requested resource cannot generate content acceptable to the client.',\n '407':\n 'Proxy Authentication Required - Authentication with the proxy is required.',\n '408': 'Request Timeout - The server timed out waiting for the request.',\n '409': 'Conflict - The request could not be completed due to a conflict.',\n '410': 'Gone - The requested resource is no longer available.',\n '411':\n 'Length Required - The request did not specify the length of its content.',\n '412':\n 'Precondition Failed - The server does not meet one of the preconditions.',\n '413':\n 'Payload Too Large - The request is larger than the server is willing to process.',\n '414':\n 'URI Too Long - The URI provided was too long for the server to process.',\n '415':\n 'Unsupported Media Type - The request entity has a media type which the server does not support.',\n '416':\n 'Range Not Satisfiable - The client has asked for a portion of the file that the server cannot supply.',\n '417':\n 'Expectation Failed - The server cannot meet the requirements of the Expect request-header field.',\n '418':\n \"I'm a teapot - The server refuses the attempt to brew coffee with a teapot.\",\n '421':\n 'Misdirected Request - The request was directed at a server that is not able to produce a response.',\n '422':\n 'Unprocessable Entity - The request was well-formed but contains semantic errors.',\n '423': 'Locked - The resource that is being accessed is locked.',\n '424':\n 'Failed Dependency - The request failed due to failure of a previous request.',\n '425':\n 'Too Early - The server is unwilling to risk processing a request that might be replayed.',\n '426':\n 'Upgrade Required - The client should switch to a different protocol.',\n '428':\n 'Precondition Required - The origin server requires the request to be conditional.',\n '429':\n 'Too Many Requests - The user has sent too many requests in a given amount of time.',\n '431':\n 'Request Header Fields Too Large - The server is unwilling to process the request because header fields are too large.',\n '451':\n 'Unavailable For Legal Reasons - The server is denying access to the resource for legal reasons.',\n '500':\n 'Internal Server Error - The server encountered an unexpected condition.',\n '501':\n 'Not Implemented - The server does not support the functionality required to fulfill the request.',\n '502':\n 'Bad Gateway - The server received an invalid response from the upstream server.',\n '503': 'Service Unavailable - The server is currently unavailable.',\n '504':\n 'Gateway Timeout - The server did not receive a timely response from the upstream server.',\n '505':\n 'HTTP Version Not Supported - The server does not support the HTTP protocol version used in the request.',\n '506':\n 'Variant Also Negotiates - The server has an internal configuration error.',\n '507':\n 'Insufficient Storage - The server is unable to store the representation needed to complete the request.',\n '508':\n 'Loop Detected - The server detected an infinite loop while processing the request.',\n '510':\n 'Not Extended - Further extensions to the request are required for the server to fulfill it.',\n '511':\n 'Network Authentication Required - The client needs to authenticate to gain network access.',\n };\n return (\n descriptions[statusCode] ||\n 'An error occurred while processing the request.'\n );\n}\n\nexport function generateErrorsOverview(spec: OurOpenAPIObject): NavItem {\n const errorSchemas: Map<string, ErrorSchema> = new Map();\n const markdown: string[] = [];\n markdown.push(`# Error Handling`);\n markdown.push(\n `This API uses conventional HTTP response codes to indicate the success or failure of an API request.`,\n );\n\n markdown.push(`## HTTP Status Codes`);\n\n // First, collect all error schemas from operations\n forEachOperation(spec, (entry, operation) => {\n if (operation.responses) {\n for (const [statusCode, response] of Object.entries(\n operation.responses,\n )) {\n if (isErrorStatusCode(statusCode)) {\n const content = response.content;\n if (content?.['application/json']?.schema) {\n const key = `${statusCode}`;\n if (errorSchemas.has(key)) {\n const existing = errorSchemas.get(key);\n if (\n existing &&\n !existing.operations.includes(operation.operationId)\n ) {\n existing.operations.push(operation.operationId);\n }\n } else {\n errorSchemas.set(key, {\n statusCode,\n title: response.description || `${statusCode} Error`,\n description: response.description,\n schema: content['application/json'].schema,\n operations: [operation.operationId],\n });\n }\n }\n }\n }\n }\n });\n\n const errors = Array.from(errorSchemas.values()).sort(\n (a, b) => parseInt(a.statusCode) - parseInt(b.statusCode),\n );\n\n if (errors.length === 0) {\n markdown.push(\n `No error responses are documented in this API specification.`,\n );\n } else {\n for (const error of errors) {\n markdown.push(`### ${error.statusCode} - ${error.title}`);\n const description =\n error.description || getStatusDescription(error.statusCode) || '';\n markdown.push(description);\n\n if (error.schema) {\n markdown.push(`**Response Schema:**`);\n markdown.push(formatSchemaForDisplay(spec, error.schema));\n }\n }\n }\n\n return {\n id: 'errors',\n title: 'Errors',\n url: '/errors',\n description: 'Error handling and HTTP status codes',\n content: markdown.join('\\n\\n'),\n };\n}\n"],
5
- "mappings": "AAEA,SAAS,kBAAkB;AAE3B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAYlC,SAAS,uBACP,MACA,QACQ;AACR,QAAM,iBAAiB,WAAW,MAAM,MAAM;AAE9C,SAAO;AAAA,EACP,KAAK,UAAU,gBAAgB,MAAM,CAAC,CAAC;AAAA;AAEzC;AAEA,SAAS,qBAAqB,YAA4B;AACxD,QAAM,eAAuC;AAAA,IAC3C,OAAO;AAAA,IACP,OACE;AAAA,IACF,OAAO;AAAA,IACP,OACE;AAAA,IACF,OAAO;AAAA,IACP,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OAAO;AAAA,IACP,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OAAO;AAAA,IACP,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,IACF,O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,SAAS,QAAQ;AAC1B,eAAS,KAAK,OAAO,MAAM,UAAU,MAAM,MAAM,KAAK,EAAE;AACxD,YAAM,cACJ,MAAM,eAAe,qBAAqB,MAAM,UAAU,KAAK;AACjE,eAAS,KAAK,WAAW;AAEzB,UAAI,MAAM,QAAQ;AAChB,iBAAS,KAAK,sBAAsB;AACpC,iBAAS,KAAK,uBAAuB,MAAM,MAAM,MAAM,CAAC;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,IACb,SAAS,SAAS,KAAK,MAAM;AAAA,EAC/B;AACF;",
4
+ "sourcesContent": ["import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';\n\nimport { distillRef } from '@sdk-it/core';\n\nimport { forEachOperation } from '../for-each-operation.js';\nimport { isErrorStatusCode } from '../is.js';\nimport type { NavItem } from '../sidebar.js';\nimport type { IR } from '../types.js';\n\ninterface ErrorSchema {\n statusCode: string;\n title: string;\n description?: string;\n schema: SchemaObject | ReferenceObject;\n operations: string[]; // Track which operations use this error\n}\n\nfunction formatSchemaForDisplay(\n spec: IR,\n schema: SchemaObject | ReferenceObject,\n): string {\n const resolvedSchema = distillRef(spec, schema);\n\n return `\\`\\`\\`json\n${JSON.stringify(resolvedSchema, null, 2)}\n\\`\\`\\``;\n}\n\nfunction getStatusDescription(statusCode: string): string {\n const descriptions: Record<string, string> = {\n '400': 'Bad Request - The request was invalid or cannot be served.',\n '401':\n 'Unauthorized - Authentication is required and has failed or has not been provided.',\n '402': 'Payment Required - Payment is required to access this resource.',\n '403':\n 'Forbidden - The request was valid, but the server is refusing action.',\n '404': 'Not Found - The requested resource could not be found.',\n '405':\n 'Method Not Allowed - The request method is not supported for this resource.',\n '406':\n 'Not Acceptable - The requested resource cannot generate content acceptable to the client.',\n '407':\n 'Proxy Authentication Required - Authentication with the proxy is required.',\n '408': 'Request Timeout - The server timed out waiting for the request.',\n '409': 'Conflict - The request could not be completed due to a conflict.',\n '410': 'Gone - The requested resource is no longer available.',\n '411':\n 'Length Required - The request did not specify the length of its content.',\n '412':\n 'Precondition Failed - The server does not meet one of the preconditions.',\n '413':\n 'Payload Too Large - The request is larger than the server is willing to process.',\n '414':\n 'URI Too Long - The URI provided was too long for the server to process.',\n '415':\n 'Unsupported Media Type - The request entity has a media type which the server does not support.',\n '416':\n 'Range Not Satisfiable - The client has asked for a portion of the file that the server cannot supply.',\n '417':\n 'Expectation Failed - The server cannot meet the requirements of the Expect request-header field.',\n '418':\n \"I'm a teapot - The server refuses the attempt to brew coffee with a teapot.\",\n '421':\n 'Misdirected Request - The request was directed at a server that is not able to produce a response.',\n '422':\n 'Unprocessable Entity - The request was well-formed but contains semantic errors.',\n '423': 'Locked - The resource that is being accessed is locked.',\n '424':\n 'Failed Dependency - The request failed due to failure of a previous request.',\n '425':\n 'Too Early - The server is unwilling to risk processing a request that might be replayed.',\n '426':\n 'Upgrade Required - The client should switch to a different protocol.',\n '428':\n 'Precondition Required - The origin server requires the request to be conditional.',\n '429':\n 'Too Many Requests - The user has sent too many requests in a given amount of time.',\n '431':\n 'Request Header Fields Too Large - The server is unwilling to process the request because header fields are too large.',\n '451':\n 'Unavailable For Legal Reasons - The server is denying access to the resource for legal reasons.',\n '500':\n 'Internal Server Error - The server encountered an unexpected condition.',\n '501':\n 'Not Implemented - The server does not support the functionality required to fulfill the request.',\n '502':\n 'Bad Gateway - The server received an invalid response from the upstream server.',\n '503': 'Service Unavailable - The server is currently unavailable.',\n '504':\n 'Gateway Timeout - The server did not receive a timely response from the upstream server.',\n '505':\n 'HTTP Version Not Supported - The server does not support the HTTP protocol version used in the request.',\n '506':\n 'Variant Also Negotiates - The server has an internal configuration error.',\n '507':\n 'Insufficient Storage - The server is unable to store the representation needed to complete the request.',\n '508':\n 'Loop Detected - The server detected an infinite loop while processing the request.',\n '510':\n 'Not Extended - Further extensions to the request are required for the server to fulfill it.',\n '511':\n 'Network Authentication Required - The client needs to authenticate to gain network access.',\n };\n return (\n descriptions[statusCode] ||\n 'An error occurred while processing the request.'\n );\n}\n\nexport function generateErrorsOverview(spec: IR): NavItem {\n const errorSchemas: Map<string, ErrorSchema> = new Map();\n const markdown: string[] = [];\n markdown.push(`# Error Handling`);\n markdown.push(\n `This API uses conventional HTTP response codes to indicate the success or failure of an API request.`,\n );\n\n markdown.push(`## HTTP Status Codes`);\n\n // First, collect all error schemas from operations\n forEachOperation(spec, (entry, operation) => {\n if (operation.responses) {\n for (const [statusCode, response] of Object.entries(\n operation.responses,\n )) {\n if (isErrorStatusCode(statusCode)) {\n const content = response.content;\n if (content?.['application/json']?.schema) {\n const key = `${statusCode}`;\n if (errorSchemas.has(key)) {\n const existing = errorSchemas.get(key);\n if (\n existing &&\n !existing.operations.includes(operation.operationId)\n ) {\n existing.operations.push(operation.operationId);\n }\n } else {\n errorSchemas.set(key, {\n statusCode,\n title: response.description || `${statusCode} Error`,\n description: response.description,\n schema: content['application/json'].schema,\n operations: [operation.operationId],\n });\n }\n }\n }\n }\n }\n });\n\n const errors = Array.from(errorSchemas.values()).sort(\n (a, b) => parseInt(a.statusCode) - parseInt(b.statusCode),\n );\n\n if (errors.length === 0) {\n markdown.push(\n `No error responses are documented in this API specification.`,\n );\n } else {\n for (const error of errors) {\n markdown.push(`### ${error.statusCode} - ${error.title}`);\n const description =\n error.description || getStatusDescription(error.statusCode) || '';\n markdown.push(description);\n\n if (error.schema) {\n markdown.push(`**Response Schema:**`);\n markdown.push(formatSchemaForDisplay(spec, error.schema));\n }\n }\n }\n\n return {\n id: 'errors',\n title: 'Errors',\n url: '/errors',\n description: 'Error handling and HTTP status codes',\n content: markdown.join('\\n\\n'),\n };\n}\n"],
5
+ "mappings": "AAEA,SAAS,kBAAkB;AAE3B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAYlC,SAAS,uBACP,MACA,QACQ;AACR,QAAM,iBAAiB,WAAW,MAAM,MAAM;AAE9C,SA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PIObject } from '../types.js';
3
- export declare function generateIntroOverview(spec: OurOpenAPIObject, availablesdks: string[]): NavItem;
2
+ import type { IR } from '../types.js';
3
+ export declare function generateIntroOverview(spec: IR, availablesdks: string[]): NavItem;
4
4
  //# sourceMappingURL=overview-intro.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overview-intro.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-intro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAOpD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CA2FT"}
1
+ {"version":3,"file":"overview-intro.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-intro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAOtC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,EAAE,EACR,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CA2FT"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-intro.ts"],
4
- "sourcesContent": ["import type { NavItem } from '../sidebar.js';\nimport type { OurOpenAPIObject } from '../types.js';\nimport {\n getClientIntroText,\n getTextByCount,\n presetDocs,\n} from './doc-text-utils.js';\n\nexport function generateIntroOverview(\n spec: OurOpenAPIObject,\n availablesdks: string[],\n): NavItem {\n const info = spec.info;\n const markdown: string[] = [];\n\n if (spec.info.title) {\n markdown.push(`# ${spec.info.title || 'API Reference'}\\n`);\n }\n\n if (spec.info.description) {\n markdown.push(`${spec.info.description}\\n`);\n }\n\n if (spec.info.version) {\n markdown.push(`**Version:** ${spec.info.version}\\n`);\n }\n\n if (info.license) {\n let licenseString = `**License:** ${info.license.name}`;\n if (info.license.url) {\n licenseString += ` ([${info.license.url}](${info.license.url}))`;\n }\n markdown.push(`${licenseString}\\n`);\n }\n\n if (spec.servers && spec.servers.length > 0) {\n const serverCount = spec.servers.length;\n\n markdown.push(\n `## ${getTextByCount(serverCount, presetDocs.server.section)}`,\n );\n markdown.push(getTextByCount(serverCount, presetDocs.server.description));\n markdown.push('');\n\n for (const server of spec.servers) {\n let serverLine = `- **${server.url}**`;\n if (server.description) {\n serverLine += ` - ${server.description}`;\n }\n markdown.push(serverLine);\n }\n markdown.push('');\n }\n\n const sdkCount = availablesdks.length;\n markdown.push(`## ${getTextByCount(sdkCount, presetDocs.client.section)}`);\n markdown.push(getClientIntroText(info.title || 'This API', sdkCount));\n\n for (const link of availablesdks) {\n const sdkName = link.replace('/', '').replace('-sdk', '').toUpperCase();\n markdown.push(`- [${sdkName} SDK](${link})`);\n }\n\n // Add \"Need Help?\" section if support information is available\n const hasSupportInfo =\n info.contact?.email ||\n info.contact?.url ||\n (spec.externalDocs?.url &&\n spec.externalDocs?.description?.toLowerCase().includes('support'));\n\n if (hasSupportInfo) {\n markdown.push(`## Need Help?`);\n\n if (info.contact?.email) {\n markdown.push(\n `For support, reach out to us at [${info.contact.email}](mailto:${info.contact.email}).`,\n );\n }\n\n if (info.contact?.url) {\n markdown.push(\n `Visit our support page: [${info.contact.url}](${info.contact.url})`,\n );\n }\n\n if (\n spec.externalDocs?.url &&\n spec.externalDocs?.description?.toLowerCase().includes('support')\n ) {\n markdown.push(\n `For additional support, visit our [${spec.externalDocs.description}](${spec.externalDocs.url}).`,\n );\n }\n }\n\n return {\n id: 'generated-introduction',\n title: 'Introduction',\n url: '/introduction',\n description: 'API overview and getting started guide',\n content: markdown.join('\\n\\n'),\n };\n}\n"],
4
+ "sourcesContent": ["import type { NavItem } from '../sidebar.js';\nimport type { IR } from '../types.js';\nimport {\n getClientIntroText,\n getTextByCount,\n presetDocs,\n} from './doc-text-utils.js';\n\nexport function generateIntroOverview(\n spec: IR,\n availablesdks: string[],\n): NavItem {\n const info = spec.info;\n const markdown: string[] = [];\n\n if (spec.info.title) {\n markdown.push(`# ${spec.info.title || 'API Reference'}\\n`);\n }\n\n if (spec.info.description) {\n markdown.push(`${spec.info.description}\\n`);\n }\n\n if (spec.info.version) {\n markdown.push(`**Version:** ${spec.info.version}\\n`);\n }\n\n if (info.license) {\n let licenseString = `**License:** ${info.license.name}`;\n if (info.license.url) {\n licenseString += ` ([${info.license.url}](${info.license.url}))`;\n }\n markdown.push(`${licenseString}\\n`);\n }\n\n if (spec.servers && spec.servers.length > 0) {\n const serverCount = spec.servers.length;\n\n markdown.push(\n `## ${getTextByCount(serverCount, presetDocs.server.section)}`,\n );\n markdown.push(getTextByCount(serverCount, presetDocs.server.description));\n markdown.push('');\n\n for (const server of spec.servers) {\n let serverLine = `- **${server.url}**`;\n if (server.description) {\n serverLine += ` - ${server.description}`;\n }\n markdown.push(serverLine);\n }\n markdown.push('');\n }\n\n const sdkCount = availablesdks.length;\n markdown.push(`## ${getTextByCount(sdkCount, presetDocs.client.section)}`);\n markdown.push(getClientIntroText(info.title || 'This API', sdkCount));\n\n for (const link of availablesdks) {\n const sdkName = link.replace('/', '').replace('-sdk', '').toUpperCase();\n markdown.push(`- [${sdkName} SDK](${link})`);\n }\n\n // Add \"Need Help?\" section if support information is available\n const hasSupportInfo =\n info.contact?.email ||\n info.contact?.url ||\n (spec.externalDocs?.url &&\n spec.externalDocs?.description?.toLowerCase().includes('support'));\n\n if (hasSupportInfo) {\n markdown.push(`## Need Help?`);\n\n if (info.contact?.email) {\n markdown.push(\n `For support, reach out to us at [${info.contact.email}](mailto:${info.contact.email}).`,\n );\n }\n\n if (info.contact?.url) {\n markdown.push(\n `Visit our support page: [${info.contact.url}](${info.contact.url})`,\n );\n }\n\n if (\n spec.externalDocs?.url &&\n spec.externalDocs?.description?.toLowerCase().includes('support')\n ) {\n markdown.push(\n `For additional support, visit our [${spec.externalDocs.description}](${spec.externalDocs.url}).`,\n );\n }\n }\n\n return {\n id: 'generated-introduction',\n title: 'Introduction',\n url: '/introduction',\n description: 'API overview and getting started guide',\n content: markdown.join('\\n\\n'),\n };\n}\n"],
5
5
  "mappings": "AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,SAAS,sBACd,MACA,eACS;AACT,QAAM,OAAO,KAAK;AAClB,QAAM,WAAqB,CAAC;AAE5B,MAAI,KAAK,KAAK,OAAO;AACnB,aAAS,KAAK,KAAK,KAAK,KAAK,SAAS,eAAe;AAAA,CAAI;AAAA,EAC3D;AAEA,MAAI,KAAK,KAAK,aAAa;AACzB,aAAS,KAAK,GAAG,KAAK,KAAK,WAAW;AAAA,CAAI;AAAA,EAC5C;AAEA,MAAI,KAAK,KAAK,SAAS;AACrB,aAAS,KAAK,gBAAgB,KAAK,KAAK,OAAO;AAAA,CAAI;AAAA,EACrD;AAEA,MAAI,KAAK,SAAS;AAChB,QAAI,gBAAgB,gBAAgB,KAAK,QAAQ,IAAI;AACrD,QAAI,KAAK,QAAQ,KAAK;AACpB,uBAAiB,MAAM,KAAK,QAAQ,GAAG,KAAK,KAAK,QAAQ,GAAG;AAAA,IAC9D;AACA,aAAS,KAAK,GAAG,aAAa;AAAA,CAAI;AAAA,EACpC;AAEA,MAAI,KAAK,WAAW,KAAK,QAAQ,SAAS,GAAG;AAC3C,UAAM,cAAc,KAAK,QAAQ;AAEjC,aAAS;AAAA,MACP,MAAM,eAAe,aAAa,WAAW,OAAO,OAAO,CAAC;AAAA,IAC9D;AACA,aAAS,KAAK,eAAe,aAAa,WAAW,OAAO,WAAW,CAAC;AACxE,aAAS,KAAK,EAAE;AAEhB,eAAW,UAAU,KAAK,SAAS;AACjC,UAAI,aAAa,OAAO,OAAO,GAAG;AAClC,UAAI,OAAO,aAAa;AACtB,sBAAc,MAAM,OAAO,WAAW;AAAA,MACxC;AACA,eAAS,KAAK,UAAU;AAAA,IAC1B;AACA,aAAS,KAAK,EAAE;AAAA,EAClB;AAEA,QAAM,WAAW,cAAc;AAC/B,WAAS,KAAK,MAAM,eAAe,UAAU,WAAW,OAAO,OAAO,CAAC,EAAE;AACzE,WAAS,KAAK,mBAAmB,KAAK,SAAS,YAAY,QAAQ,CAAC;AAEpE,aAAW,QAAQ,eAAe;AAChC,UAAM,UAAU,KAAK,QAAQ,KAAK,EAAE,EAAE,QAAQ,QAAQ,EAAE,EAAE,YAAY;AACtE,aAAS,KAAK,MAAM,OAAO,SAAS,IAAI,GAAG;AAAA,EAC7C;AAGA,QAAM,iBACJ,KAAK,SAAS,SACd,KAAK,SAAS,OACb,KAAK,cAAc,OAClB,KAAK,cAAc,aAAa,YAAY,EAAE,SAAS,SAAS;AAEpE,MAAI,gBAAgB;AAClB,aAAS,KAAK,eAAe;AAE7B,QAAI,KAAK,SAAS,OAAO;AACvB,eAAS;AAAA,QACP,oCAAoC,KAAK,QAAQ,KAAK,YAAY,KAAK,QAAQ,KAAK;AAAA,MACtF;AAAA,IACF;AAEA,QAAI,KAAK,SAAS,KAAK;AACrB,eAAS;AAAA,QACP,4BAA4B,KAAK,QAAQ,GAAG,KAAK,KAAK,QAAQ,GAAG;AAAA,MACnE;AAAA,IACF;AAEA,QACE,KAAK,cAAc,OACnB,KAAK,cAAc,aAAa,YAAY,EAAE,SAAS,SAAS,GAChE;AACA,eAAS;AAAA,QACP,sCAAsC,KAAK,aAAa,WAAW,KAAK,KAAK,aAAa,GAAG;AAAA,MAC/F;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,IACb,SAAS,SAAS,KAAK,MAAM;AAAA,EAC/B;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
1
  import type { NavItem } from '../sidebar.js';
2
- import type { OurOpenAPIObject } from '../types.js';
3
- export declare function generatePaginationOverview(spec: OurOpenAPIObject): NavItem;
2
+ import type { IR } from '../types.js';
3
+ export declare function generatePaginationOverview(spec: IR): NavItem;
4
4
  //# sourceMappingURL=overview-pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overview-pagination.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAkF1E"}
1
+ {"version":3,"file":"overview-pagination.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAoG5D"}
@@ -1,12 +1,20 @@
1
1
  function generatePaginationOverview(spec) {
2
2
  const markdown = [];
3
3
  markdown.push(`# Pagination`);
4
- markdown.push(`This API uses cursor-based pagination to efficiently navigate through large datasets.`);
4
+ markdown.push(
5
+ `This API uses cursor-based pagination to efficiently navigate through large datasets.`
6
+ );
5
7
  markdown.push(`## How Pagination Works`);
6
- markdown.push(`When making requests to endpoints that return multiple items, you can control the number of results and navigate through pages using the following parameters:`);
8
+ markdown.push(
9
+ `When making requests to endpoints that return multiple items, you can control the number of results and navigate through pages using the following parameters:`
10
+ );
7
11
  markdown.push("");
8
- markdown.push(`- **limit** - The maximum number of items to return per page (default: 20, max: 100)`);
9
- markdown.push(`- **cursor** - A token representing the position in the dataset to start from`);
12
+ markdown.push(
13
+ `- **limit** - The maximum number of items to return per page (default: 20, max: 100)`
14
+ );
15
+ markdown.push(
16
+ `- **cursor** - A token representing the position in the dataset to start from`
17
+ );
10
18
  markdown.push("");
11
19
  markdown.push(`## Example Usage`);
12
20
  markdown.push("");
@@ -32,7 +40,9 @@ function generatePaginationOverview(spec) {
32
40
  markdown.push("```json");
33
41
  markdown.push("{");
34
42
  markdown.push(' "data": [...], // Array of items');
35
- markdown.push(' "nextCursor": "eyJpZCI6MTAwfQ==", // Token for next page (null if last page)');
43
+ markdown.push(
44
+ ' "nextCursor": "eyJpZCI6MTAwfQ==", // Token for next page (null if last page)'
45
+ );
36
46
  markdown.push(' "hasMore": true, // Whether more pages exist');
37
47
  markdown.push(' "totalCount": 150 // Total number of items (if available)');
38
48
  markdown.push("}");
@@ -62,10 +72,18 @@ function generatePaginationOverview(spec) {
62
72
  markdown.push("");
63
73
  markdown.push(`## Best Practices`);
64
74
  markdown.push("");
65
- markdown.push(`1. **Use appropriate page sizes** - Balance between number of requests and response size`);
66
- markdown.push(`2. **Handle cursors securely** - Don't modify cursor values; treat them as opaque tokens`);
67
- markdown.push(`3. **Implement retry logic** - Handle temporary failures when iterating through pages`);
68
- markdown.push(`4. **Consider rate limits** - Be mindful of API rate limits when fetching multiple pages`);
75
+ markdown.push(
76
+ `1. **Use appropriate page sizes** - Balance between number of requests and response size`
77
+ );
78
+ markdown.push(
79
+ `2. **Handle cursors securely** - Don't modify cursor values; treat them as opaque tokens`
80
+ );
81
+ markdown.push(
82
+ `3. **Implement retry logic** - Handle temporary failures when iterating through pages`
83
+ );
84
+ markdown.push(
85
+ `4. **Consider rate limits** - Be mindful of API rate limits when fetching multiple pages`
86
+ );
69
87
  return {
70
88
  id: "generated-pagination",
71
89
  title: "Pagination",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-pagination.ts"],
4
- "sourcesContent": ["import type { NavItem } from '../sidebar.js';\nimport type { OurOpenAPIObject } from '../types.js';\n\nexport function generatePaginationOverview(spec: OurOpenAPIObject): NavItem {\n const markdown: string[] = [];\n\n markdown.push(`# Pagination`);\n markdown.push(`This API uses cursor-based pagination to efficiently navigate through large datasets.`);\n \n markdown.push(`## How Pagination Works`);\n markdown.push(`When making requests to endpoints that return multiple items, you can control the number of results and navigate through pages using the following parameters:`);\n markdown.push('');\n markdown.push(`- **limit** - The maximum number of items to return per page (default: 20, max: 100)`);\n markdown.push(`- **cursor** - A token representing the position in the dataset to start from`);\n markdown.push('');\n\n markdown.push(`## Example Usage`);\n markdown.push('');\n markdown.push('### TypeScript');\n markdown.push('```typescript');\n markdown.push('// First page');\n markdown.push('const firstPage = await client.items.list({');\n markdown.push(' limit: 25');\n markdown.push('});');\n markdown.push('');\n markdown.push('// Next page');\n markdown.push('if (firstPage.nextCursor) {');\n markdown.push(' const secondPage = await client.items.list({');\n markdown.push(' limit: 25,');\n markdown.push(' cursor: firstPage.nextCursor');\n markdown.push(' });');\n markdown.push('}');\n markdown.push('```');\n markdown.push('');\n\n markdown.push(`## Response Structure`);\n markdown.push(`Paginated responses follow this structure:`);\n markdown.push('');\n markdown.push('```json');\n markdown.push('{');\n markdown.push(' \"data\": [...], // Array of items');\n markdown.push(' \"nextCursor\": \"eyJpZCI6MTAwfQ==\", // Token for next page (null if last page)');\n markdown.push(' \"hasMore\": true, // Whether more pages exist');\n markdown.push(' \"totalCount\": 150 // Total number of items (if available)');\n markdown.push('}');\n markdown.push('```');\n markdown.push('');\n\n markdown.push(`## Iterating Through All Pages`);\n markdown.push('');\n markdown.push('### TypeScript');\n markdown.push('```typescript');\n markdown.push('async function getAllItems() {');\n markdown.push(' const allItems = [];');\n markdown.push(' let cursor = undefined;');\n markdown.push(' ');\n markdown.push(' do {');\n markdown.push(' const page = await client.items.list({');\n markdown.push(' limit: 100,');\n markdown.push(' cursor');\n markdown.push(' });');\n markdown.push(' ');\n markdown.push(' allItems.push(...page.data);');\n markdown.push(' cursor = page.nextCursor;');\n markdown.push(' } while (cursor);');\n markdown.push(' ');\n markdown.push(' return allItems;');\n markdown.push('}');\n markdown.push('```');\n markdown.push('');\n\n markdown.push(`## Best Practices`);\n markdown.push('');\n markdown.push(`1. **Use appropriate page sizes** - Balance between number of requests and response size`);\n markdown.push(`2. **Handle cursors securely** - Don't modify cursor values; treat them as opaque tokens`);\n markdown.push(`3. **Implement retry logic** - Handle temporary failures when iterating through pages`);\n markdown.push(`4. **Consider rate limits** - Be mindful of API rate limits when fetching multiple pages`);\n\n return {\n id: 'generated-pagination',\n title: 'Pagination',\n url: '/pagination',\n description: 'Learn how to navigate through paginated API responses',\n content: markdown.join('\\n'),\n };\n}"],
5
- "mappings": "AAGO,SAAS,2BAA2B,MAAiC;AAC1E,QAAM,WAAqB,CAAC;AAE5B,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,uFAAuF;AAErG,WAAS,KAAK,yBAAyB;AACvC,WAAS,KAAK,gKAAgK;AAC9K,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,sFAAsF;AACpG,WAAS,KAAK,+EAA+E;AAC7F,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,kBAAkB;AAChC,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,gBAAgB;AAC9B,WAAS,KAAK,eAAe;AAC7B,WAAS,KAAK,eAAe;AAC7B,WAAS,KAAK,6CAA6C;AAC3D,WAAS,KAAK,aAAa;AAC3B,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,6BAA6B;AAC3C,WAAS,KAAK,gDAAgD;AAC9D,WAAS,KAAK,gBAAgB;AAC9B,WAAS,KAAK,kCAAkC;AAChD,WAAS,KAAK,OAAO;AACrB,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,uBAAuB;AACrC,WAAS,KAAK,4CAA4C;AAC1D,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,SAAS;AACvB,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,oCAAoC;AAClD,WAAS,KAAK,gFAAgF;AAC9F,WAAS,KAAK,gDAAgD;AAC9D,WAAS,KAAK,6DAA6D;AAC3E,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,gCAAgC;AAC9C,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,gBAAgB;AAC9B,WAAS,KAAK,eAAe;AAC7B,WAAS,KAAK,gCAAgC;AAC9C,WAAS,KAAK,wBAAwB;AACtC,WAAS,KAAK,2BAA2B;AACzC,WAAS,KAAK,IAAI;AAClB,WAAS,KAAK,QAAQ;AACtB,WAAS,KAAK,4CAA4C;AAC1D,WAAS,KAAK,mBAAmB;AACjC,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,SAAS;AACvB,WAAS,KAAK,MAAM;AACpB,WAAS,KAAK,kCAAkC;AAChD,WAAS,KAAK,+BAA+B;AAC7C,WAAS,KAAK,qBAAqB;AACnC,WAAS,KAAK,IAAI;AAClB,WAAS,KAAK,oBAAoB;AAClC,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,mBAAmB;AACjC,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,0FAA0F;AACxG,WAAS,KAAK,0FAA0F;AACxG,WAAS,KAAK,uFAAuF;AACrG,WAAS,KAAK,0FAA0F;AAExG,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,IACb,SAAS,SAAS,KAAK,IAAI;AAAA,EAC7B;AACF;",
4
+ "sourcesContent": ["import type { NavItem } from '../sidebar.js';\nimport type { IR } from '../types.js';\n\nexport function generatePaginationOverview(spec: IR): NavItem {\n const markdown: string[] = [];\n\n markdown.push(`# Pagination`);\n markdown.push(\n `This API uses cursor-based pagination to efficiently navigate through large datasets.`,\n );\n\n markdown.push(`## How Pagination Works`);\n markdown.push(\n `When making requests to endpoints that return multiple items, you can control the number of results and navigate through pages using the following parameters:`,\n );\n markdown.push('');\n markdown.push(\n `- **limit** - The maximum number of items to return per page (default: 20, max: 100)`,\n );\n markdown.push(\n `- **cursor** - A token representing the position in the dataset to start from`,\n );\n markdown.push('');\n\n markdown.push(`## Example Usage`);\n markdown.push('');\n markdown.push('### TypeScript');\n markdown.push('```typescript');\n markdown.push('// First page');\n markdown.push('const firstPage = await client.items.list({');\n markdown.push(' limit: 25');\n markdown.push('});');\n markdown.push('');\n markdown.push('// Next page');\n markdown.push('if (firstPage.nextCursor) {');\n markdown.push(' const secondPage = await client.items.list({');\n markdown.push(' limit: 25,');\n markdown.push(' cursor: firstPage.nextCursor');\n markdown.push(' });');\n markdown.push('}');\n markdown.push('```');\n markdown.push('');\n\n markdown.push(`## Response Structure`);\n markdown.push(`Paginated responses follow this structure:`);\n markdown.push('');\n markdown.push('```json');\n markdown.push('{');\n markdown.push(' \"data\": [...], // Array of items');\n markdown.push(\n ' \"nextCursor\": \"eyJpZCI6MTAwfQ==\", // Token for next page (null if last page)',\n );\n markdown.push(' \"hasMore\": true, // Whether more pages exist');\n markdown.push(' \"totalCount\": 150 // Total number of items (if available)');\n markdown.push('}');\n markdown.push('```');\n markdown.push('');\n\n markdown.push(`## Iterating Through All Pages`);\n markdown.push('');\n markdown.push('### TypeScript');\n markdown.push('```typescript');\n markdown.push('async function getAllItems() {');\n markdown.push(' const allItems = [];');\n markdown.push(' let cursor = undefined;');\n markdown.push(' ');\n markdown.push(' do {');\n markdown.push(' const page = await client.items.list({');\n markdown.push(' limit: 100,');\n markdown.push(' cursor');\n markdown.push(' });');\n markdown.push(' ');\n markdown.push(' allItems.push(...page.data);');\n markdown.push(' cursor = page.nextCursor;');\n markdown.push(' } while (cursor);');\n markdown.push(' ');\n markdown.push(' return allItems;');\n markdown.push('}');\n markdown.push('```');\n markdown.push('');\n\n markdown.push(`## Best Practices`);\n markdown.push('');\n markdown.push(\n `1. **Use appropriate page sizes** - Balance between number of requests and response size`,\n );\n markdown.push(\n `2. **Handle cursors securely** - Don't modify cursor values; treat them as opaque tokens`,\n );\n markdown.push(\n `3. **Implement retry logic** - Handle temporary failures when iterating through pages`,\n );\n markdown.push(\n `4. **Consider rate limits** - Be mindful of API rate limits when fetching multiple pages`,\n );\n\n return {\n id: 'generated-pagination',\n title: 'Pagination',\n url: '/pagination',\n description: 'Learn how to navigate through paginated API responses',\n content: markdown.join('\\n'),\n };\n}\n"],
5
+ "mappings": "AAGO,SAAS,2BAA2B,MAAmB;AAC5D,QAAM,WAAqB,CAAC;AAE5B,WAAS,KAAK,cAAc;AAC5B,WAAS;AAAA,IACP;AAAA,EACF;AAEA,WAAS,KAAK,yBAAyB;AACvC,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS,KAAK,EAAE;AAChB,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,kBAAkB;AAChC,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,gBAAgB;AAC9B,WAAS,KAAK,eAAe;AAC7B,WAAS,KAAK,eAAe;AAC7B,WAAS,KAAK,6CAA6C;AAC3D,WAAS,KAAK,aAAa;AAC3B,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,6BAA6B;AAC3C,WAAS,KAAK,gDAAgD;AAC9D,WAAS,KAAK,gBAAgB;AAC9B,WAAS,KAAK,kCAAkC;AAChD,WAAS,KAAK,OAAO;AACrB,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,uBAAuB;AACrC,WAAS,KAAK,4CAA4C;AAC1D,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,SAAS;AACvB,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,oCAAoC;AAClD,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS,KAAK,gDAAgD;AAC9D,WAAS,KAAK,6DAA6D;AAC3E,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,gCAAgC;AAC9C,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,gBAAgB;AAC9B,WAAS,KAAK,eAAe;AAC7B,WAAS,KAAK,gCAAgC;AAC9C,WAAS,KAAK,wBAAwB;AACtC,WAAS,KAAK,2BAA2B;AACzC,WAAS,KAAK,IAAI;AAClB,WAAS,KAAK,QAAQ;AACtB,WAAS,KAAK,4CAA4C;AAC1D,WAAS,KAAK,mBAAmB;AACjC,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,SAAS;AACvB,WAAS,KAAK,MAAM;AACpB,WAAS,KAAK,kCAAkC;AAChD,WAAS,KAAK,+BAA+B;AAC7C,WAAS,KAAK,qBAAqB;AACnC,WAAS,KAAK,IAAI;AAClB,WAAS,KAAK,oBAAoB;AAClC,WAAS,KAAK,GAAG;AACjB,WAAS,KAAK,KAAK;AACnB,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,mBAAmB;AACjC,WAAS,KAAK,EAAE;AAChB,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS;AAAA,IACP;AAAA,EACF;AACA,WAAS;AAAA,IACP;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,KAAK;AAAA,IACL,aAAa;AAAA,IACb,SAAS,SAAS,KAAK,IAAI;AAAA,EAC7B;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,3 @@
1
- import type { OurOpenAPIObject, TunedOperationObject } from '../types.js';
2
- export declare function toPagination(spec: OurOpenAPIObject, tunedOperation: TunedOperationObject): any;
1
+ import type { IR, TunedOperationObject } from '../types.js';
2
+ export declare function toPagination(spec: IR, tunedOperation: TunedOperationObject): any;
3
3
  //# sourceMappingURL=pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/pagination.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG1E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,cAAc,EAAE,oBAAoB,OAyBrC"}
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/pagination.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG5D,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,oBAAoB,OAwB1E"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/pagination/pagination.ts"],
4
- "sourcesContent": ["import type {\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core/ref.js';\n\nimport type { OurOpenAPIObject, TunedOperationObject } from '../types.js';\nimport { guessPagination } from './guess-pagination.js';\n\nexport function toPagination(\n spec: OurOpenAPIObject,\n tunedOperation: TunedOperationObject,\n) {\n if (tunedOperation['x-pagination']) {\n return tunedOperation['x-pagination'];\n }\n const schema = getResponseContentSchema(\n spec,\n tunedOperation.responses['200'],\n 'application/json',\n );\n const pagination = guessPagination(\n tunedOperation,\n tunedOperation.requestBody\n ? getRequestContentSchema(\n spec,\n tunedOperation.requestBody,\n 'application/json',\n )\n : undefined,\n schema,\n );\n if (pagination && pagination.type !== 'none' && schema) {\n return pagination;\n }\n return undefined;\n}\n\nfunction getResponseContentSchema(\n spec: OurOpenAPIObject,\n response: ResponseObject,\n type: string,\n) {\n if (!response) {\n return undefined;\n }\n const content = response.content;\n if (!content) {\n return undefined;\n }\n for (const contentType in content) {\n if (contentType.toLowerCase() === type.toLowerCase()) {\n return isRef(content[contentType].schema)\n ? followRef<SchemaObject>(spec, content[contentType].schema.$ref)\n : content[contentType].schema;\n }\n }\n return undefined;\n}\n\nfunction getRequestContentSchema(\n spec: OurOpenAPIObject,\n requestBody: RequestBodyObject,\n type: string,\n) {\n const content = requestBody.content;\n if (!content) {\n return undefined;\n }\n for (const contentType in content) {\n if (contentType.toLowerCase() === type.toLowerCase()) {\n return isRef(content[contentType].schema)\n ? followRef<SchemaObject>(spec, content[contentType].schema.$ref)\n : content[contentType].schema;\n }\n }\n return undefined;\n}\n"],
5
- "mappings": "AAMA,SAAS,WAAW,aAAa;AAGjC,SAAS,uBAAuB;AAEzB,SAAS,aACd,MACA,gBACA;AACA,MAAI,eAAe,cAAc,GAAG;AAClC,WAAO,eAAe,cAAc;AAAA,EACtC;AACA,QAAM,SAAS;AAAA,IACb;AAAA,IACA,eAAe,UAAU,KAAK;AAAA,IAC9B;AAAA,EACF;AACA,QAAM,aAAa;AAAA,IACjB;AAAA,IACA,eAAe,cACX;AAAA,MACE;AAAA,MACA,eAAe;AAAA,MACf;AAAA,IACF,IACA;AAAA,IACJ;AAAA,EACF;AACA,MAAI,cAAc,WAAW,SAAS,UAAU,QAAQ;AACtD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,yBACP,MACA,UACA,MACA;AACA,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,UAAU,SAAS;AACzB,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,aAAW,eAAe,SAAS;AACjC,QAAI,YAAY,YAAY,MAAM,KAAK,YAAY,GAAG;AACpD,aAAO,MAAM,QAAQ,WAAW,EAAE,MAAM,IACpC,UAAwB,MAAM,QAAQ,WAAW,EAAE,OAAO,IAAI,IAC9D,QAAQ,WAAW,EAAE;AAAA,IAC3B;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,wBACP,MACA,aACA,MACA;AACA,QAAM,UAAU,YAAY;AAC5B,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,aAAW,eAAe,SAAS;AACjC,QAAI,YAAY,YAAY,MAAM,KAAK,YAAY,GAAG;AACpD,aAAO,MAAM,QAAQ,WAAW,EAAE,MAAM,IACpC,UAAwB,MAAM,QAAQ,WAAW,EAAE,OAAO,IAAI,IAC9D,QAAQ,WAAW,EAAE;AAAA,IAC3B;AAAA,EACF;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import type {\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core/ref.js';\n\nimport type { IR, TunedOperationObject } from '../types.js';\nimport { guessPagination } from './guess-pagination.js';\n\nexport function toPagination(spec: IR, tunedOperation: TunedOperationObject) {\n if (tunedOperation['x-pagination']) {\n return tunedOperation['x-pagination'];\n }\n const schema = getResponseContentSchema(\n spec,\n tunedOperation.responses['200'],\n 'application/json',\n );\n const pagination = guessPagination(\n tunedOperation,\n tunedOperation.requestBody\n ? getRequestContentSchema(\n spec,\n tunedOperation.requestBody,\n 'application/json',\n )\n : undefined,\n schema,\n );\n if (pagination && pagination.type !== 'none' && schema) {\n return pagination;\n }\n return undefined;\n}\n\nfunction getResponseContentSchema(\n spec: IR,\n response: ResponseObject,\n type: string,\n) {\n if (!response) {\n return undefined;\n }\n const content = response.content;\n if (!content) {\n return undefined;\n }\n for (const contentType in content) {\n if (contentType.toLowerCase() === type.toLowerCase()) {\n return isRef(content[contentType].schema)\n ? followRef<SchemaObject>(spec, content[contentType].schema.$ref)\n : content[contentType].schema;\n }\n }\n return undefined;\n}\n\nfunction getRequestContentSchema(\n spec: IR,\n requestBody: RequestBodyObject,\n type: string,\n) {\n const content = requestBody.content;\n if (!content) {\n return undefined;\n }\n for (const contentType in content) {\n if (contentType.toLowerCase() === type.toLowerCase()) {\n return isRef(content[contentType].schema)\n ? followRef<SchemaObject>(spec, content[contentType].schema.$ref)\n : content[contentType].sch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1
  import type { ParameterLocation, ParameterObject, ReferenceObject, SchemaObject, SecurityRequirementObject, SecuritySchemeObject } from 'openapi3-ts/oas31';
2
- import type { OurOpenAPIObject } from './types.js';
2
+ import type { IR } from './types.js';
3
3
  type OIn = ParameterLocation | 'input';
4
4
  export type OurParameter = Omit<ParameterObject, 'in' | 'schema'> & {
5
5
  in: OIn;
6
6
  'x-optionName'?: string;
7
7
  schema: SchemaObject;
8
8
  };
9
- export declare function securityToOptions(spec: OurOpenAPIObject, security: SecurityRequirementObject[], securitySchemes: Record<string, SecuritySchemeObject | ReferenceObject>, staticIn?: OIn): OurParameter[];
10
- export declare function security(spec: OurOpenAPIObject): OurParameter[];
9
+ export declare function securityToOptions(spec: IR, security: SecurityRequirementObject[], securitySchemes: Record<string, SecuritySchemeObject | ReferenceObject>, staticIn?: OIn): OurParameter[];
10
+ export declare function security(spec: IR): OurParameter[];
11
11
  export {};
12
12
  //# sourceMappingURL=security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/lib/security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,KAAK,GAAG,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG;IAClE,EAAE,EAAE,GAAG,CAAC;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,yBAAyB,EAAE,EACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAAC,EACvE,QAAQ,CAAC,EAAE,GAAG,kBA8Cf;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,kBA4B9C"}
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/lib/security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAErC,KAAK,GAAG,GAAG,iBAAiB,GAAG,OAAO,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG;IAClE,EAAE,EAAE,GAAG,CAAC;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,EAAE,EACR,QAAQ,EAAE,yBAAyB,EAAE,EACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAAC,EACvE,QAAQ,CAAC,EAAE,GAAG,kBA8Cf;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,EAAE,kBA4BhC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/security.ts"],
4
- "sourcesContent": ["import type {\n ParameterLocation,\n ParameterObject,\n ReferenceObject,\n SchemaObject,\n SecurityRequirementObject,\n SecuritySchemeObject,\n} from 'openapi3-ts/oas31';\n\nimport { methods } from '@sdk-it/core/paths.js';\nimport { resolveRef } from '@sdk-it/core/ref.js';\n\nimport type { OurOpenAPIObject } from './types.js';\n\ntype OIn = ParameterLocation | 'input';\n\nexport type OurParameter = Omit<ParameterObject, 'in' | 'schema'> & {\n in: OIn;\n 'x-optionName'?: string;\n schema: SchemaObject;\n};\n\nexport function securityToOptions(\n spec: OurOpenAPIObject,\n security: SecurityRequirementObject[],\n securitySchemes: Record<string, SecuritySchemeObject | ReferenceObject>,\n staticIn?: OIn,\n) {\n const parameters: OurParameter[] = [];\n for (const it of security) {\n const [name] = Object.keys(it);\n if (!name) {\n // this means the operation doesn't necessarily require security\n continue;\n }\n\n const schema = resolveRef<SecuritySchemeObject>(\n spec,\n securitySchemes[name],\n );\n if (schema.type === 'http') {\n parameters.push({\n in: staticIn ?? 'header',\n name: 'authorization',\n required: false,\n schema: { type: 'string', 'x-prefix': 'Bearer ' },\n 'x-optionName': 'token',\n example:\n schema.scheme === 'bearer'\n ? '\"<token>\"'\n : `<${schema.scheme}> <token>`,\n });\n continue;\n }\n if (schema.type === 'apiKey') {\n if (!schema.in) {\n throw new Error(`apiKey security schema must have an \"in\" field`);\n }\n if (!schema.name) {\n throw new Error(`apiKey security schema must have a \"name\" field`);\n }\n parameters.push({\n in: staticIn ?? (schema.in as ParameterLocation),\n name: schema.name,\n required: false,\n schema: { type: 'string' },\n example: `\"proj-${crypto.randomUUID().slice(0, 12)}\"`,\n });\n continue;\n }\n }\n return parameters;\n}\n\nexport function security(spec: OurOpenAPIObject) {\n const security = spec.security || [];\n const paths = Object.values(spec.paths ?? {});\n\n const options = securityToOptions(\n spec,\n security,\n spec.components.securitySchemes,\n );\n\n for (const it of paths) {\n for (const method of methods) {\n const operation = it[method];\n if (!operation) {\n continue;\n }\n Object.assign(\n options,\n securityToOptions(\n spec,\n operation.security || [],\n spec.components.securitySchemes,\n 'input',\n ),\n );\n }\n }\n return options;\n}\n"],
5
- "mappings": "AASA,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAYpB,SAAS,kBACd,MACAA,WACA,iBACA,UACA;AACA,QAAM,aAA6B,CAAC;AACpC,aAAW,MAAMA,WAAU;AACzB,UAAM,CAAC,IAAI,IAAI,OAAO,KAAK,EAAE;AAC7B,QAAI,CAAC,MAAM;AAET;A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,EACF;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import type {\n ParameterLocation,\n ParameterObject,\n ReferenceObject,\n SchemaObject,\n SecurityRequirementObject,\n SecuritySchemeObject,\n} from 'openapi3-ts/oas31';\n\nimport { methods } from '@sdk-it/core/paths.js';\nimport { resolveRef } from '@sdk-it/core/ref.js';\n\nimport type { IR } from './types.js';\n\ntype OIn = ParameterLocation | 'input';\n\nexport type OurParameter = Omit<ParameterObject, 'in' | 'schema'> & {\n in: OIn;\n 'x-optionName'?: string;\n schema: SchemaObject;\n};\n\nexport function securityToOptions(\n spec: IR,\n security: SecurityRequirementObject[],\n securitySchemes: Record<string, SecuritySchemeObject | ReferenceObject>,\n staticIn?: OIn,\n) {\n const parameters: OurParameter[] = [];\n for (const it of security) {\n const [name] = Object.keys(it);\n if (!name) {\n // this means the operation doesn't necessarily require security\n continue;\n }\n\n const schema = resolveRef<SecuritySchemeObject>(\n spec,\n securitySchemes[name],\n );\n if (schema.type === 'http') {\n parameters.push({\n in: staticIn ?? 'header',\n name: 'authorization',\n required: false,\n schema: { type: 'string', 'x-prefix': 'Bearer ' },\n 'x-optionName': 'token',\n example:\n schema.scheme === 'bearer'\n ? '\"<token>\"'\n : `<${schema.scheme}> <token>`,\n });\n continue;\n }\n if (schema.type === 'apiKey') {\n if (!schema.in) {\n throw new Error(`apiKey security schema must have an \"in\" field`);\n }\n if (!schema.name) {\n throw new Error(`apiKey security schema must have a \"name\" field`);\n }\n parameters.push({\n in: staticIn ?? (schema.in as ParameterLocation),\n name: schema.name,\n required: false,\n schema: { type: 'string' },\n example: `\"proj-${crypto.randomUUID().slice(0, 12)}\"`,\n });\n continue;\n }\n }\n return parameters;\n}\n\nexport function security(spec: IR) {\n const security = spec.security || [];\n const paths = Object.values(spec.paths ?? {});\n\n const options = securityToOptions(\n spec,\n security,\n spec.components.securitySchemes,\n );\n\n for (const it of paths) {\n for (const method of methods) {\n const operation = it[method];\n if (!operation) {\n continue;\n }\n Object.assign(\n options,\n securityToOptions(\n spec,\n operation.security || [],\n spec.components.securitySchemes,\n 'input',\n ),\n );\n }\n }\n return options;\n}\n"],
5
+ "mappings": "AASA,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAYpB,SAAS,kBACd,MACAA,WACA,iBACA,UACA;AACA,QAAM,aAA6B,CAAC;AACpC,aAAW,MAAMA,WAAU;AACzB,UAAM,CAAC,IAAI,IAAI,OAAO,KAAK,EAAE;AAC7B,QAAI,CAAC,MAAM;AAET;AAAA,IACF;AAEA,UAAM,SAAS;AAAA,MACb;AAAA,MACA,gBAAgB,IAAI;AAAA,IACtB;AACA,QAAI,OAAO,SAAS,QAAQ;AAC1B,iBAAW,KAAK;AAAA,QACd,IAAI,YAAY;AAAA,QAChB,MAAM;AAAA,QACN,UAAU;AAAA,QACV,QAAQ,EAAE,MAAM,UAAU,YAAY,UAAU;AAAA,QAChD,gBAAgB;AAAA,QAChB,SACE,OAAO,WAAW,WACd,cACA,IAAI,OAAO,MAAM;AAAA,MACzB,CAAC;AACD;AAAA,IACF;AACA,QAAI,OAAO,SAAS,UAAU;AAC5B,UAAI,CAAC,OAAO,IAAI;AACd,cAAM,IAAI,MAAM,gDAAgD;AAAA,MAClE;AACA,UAAI,CAAC,OAAO,MAAM;AAChB,cAAM,IAAI,MAAM,iDAAiD;AAAA,MACnE;AACA,iBAAW,KAAK;AAAA,QACd,IAAI,YAAa,OAAO;AAAA,QACxB,MAAM,OAAO;AAAA,QACb,UAAU;AAAA,QACV,QAAQ,EAAE,MAAM,SAAS;AAAA,QACzB,SAAS,SAAS,OAAO,WAAW,EAAE,MAAM,GAAG,EAAE,CAAC;AAAA,MACpD,CAAC;AACD;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,SAAS,MAAU;AACjC,QAAMA,YAAW,KAAK,YAAY,CAAC;AACnC,QAAM,QAAQ,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC;AAE5C,QAAM,UAAU;AAAA,IACd;AAAA,IACAA;AAAA,IACA,KAAK,WAAW;AAAA,EAClB;AAEA,aAAW,MAAM,OAAO;AACtB,eAAW,UAAU,SAAS;AAC5B,YAAM,YAAY,GAAG,MAAM;AAC3B,UAAI,CAAC,WAAW;AACd;AAAA,MACF;AACA,aAAO;AAAA,QACL;AAAA,QACA;AAAA,UACE;AAAA,UACA,UAAU,YAAY,CAAC;AAAA,UACvB,KAAK,WAAW;AAAA,UAChB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": ["security"]
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { OurOpenAPIObject } from './types.js';
1
+ import type { IR } from './types.js';
2
2
  export type ChildNavItem = {
3
3
  id: string;
4
4
  title: string;
@@ -23,5 +23,5 @@ export interface TagGroups {
23
23
  name: string;
24
24
  tags: string[];
25
25
  }
26
- export declare function toSidebar(spec: OurOpenAPIObject): SidebarData;
26
+ export declare function toSidebar(spec: IR): SidebarData;
27
27
  //# sourceMappingURL=sidebar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/lib/sidebar.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,E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"sources": ["../../src/lib/sidebar.ts"],
4
- "sourcesContent": ["import { camelcase } from 'stringcase';\n\nimport { notNullOrUndefined } from '@sdk-it/core/file-system.js';\n\nimport { forEachOperation } from './for-each-operation.js';\nimport type { OurOpenAPIObject } from './types.js';\n\nexport type ChildNavItem = {\n id: string;\n title: string;\n url: string;\n};\n\nexport type NavItem = {\n id: string;\n title: string;\n description?: string;\n url?: string;\n items?: ChildNavItem[];\n content?: string; // Markdown content\n};\n\nexport type CategoryItem = {\n id: string;\n category: string;\n description?: string;\n items: NavItem[];\n};\n\nexport type SidebarData = CategoryItem[];\n\nexport interface TagGroups {\n name: string;\n tags: string[];\n}\n\nexport function toSidebar(spec: OurOpenAPIObject) {\n const sidebar: SidebarData = spec['x-docs'];\n for (const tagGroup of spec['x-tagGroups']) {\n sidebar.push({\n id: camelcase(tagGroup.name),\n category: tagGroup.name,\n items: tagGroup.tags.map((tag) => {\n const tagSpec = spec.tags?.find((t) => t.name === tag);\n return {\n id: crypto.randomUUID(),\n description: tagSpec?.description,\n title: tagSpec\n ? tagSpec['x-displayName'] || tagSpec.name || tag\n : tag,\n items: forEachOperation(spec, (entry, operation) => {\n if (operation.tags.includes(tag)) {\n const title = operation.summary || operation.operationId;\n return {\n id: operation.operationId,\n title,\n url: `${camelcase(tag)}/${camelcase(operation.operationId)}`,\n };\n }\n return null;\n }).filter(notNullOrUndefined),\n };\n }),\n });\n }\n return sidebar;\n}\n"],
5
- "mappings": "AAAA,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B;AAEnC,SAAS,wBAAwB;AAgC1B,SAAS,UAAU,MAAwB;AAChD,QAAM,UAAuB,KAAK,QAAQ;AAC1C,aAAW,YAAY,KAAK,aAAa,GAAG;AAC1C,YAAQ,KAAK;AAAA,MACX,IAAI,UAAU,SAAS,IAAI;AAAA,MAC3B,UAAU,SAAS;AAAA,MACnB,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ;AAChC,cAAM,UAAU,KAAK,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG;AACrD,eAAO;AAAA,UACL,IAAI,OAAO,WAAW;AAAA,UACtB,aAAa,SAAS;AAAA,UACtB,OAAO,UACH,QAAQ,eAAe,KAAK,QAAQ,QAAQ,MAC5C;AAAA,UACJ,OAAO,iBAAiB,MAAM,CAAC,OAAO,cAAc;AAClD,gBAAI,UAAU,KAAK,SAAS,GAAG,GAAG;AAChC,oBAAM,QAAQ,UAAU,WAAW,UAAU;AAC7C,qBAAO;AAAA,gBACL,IAAI,UAAU;AAAA,gBACd;AAAA,gBACA,KAAK,GAAG,UAAU,GAAG,CAAC,IAAI,UAAU,UAAU,WAAW,CAAC;AAAA,cAC5D;AAAA,YACF;AACA,mBAAO;AAAA,UACT,CAAC,EAAE,OAAO,kBAAkB;AAAA,QAC9B;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import { camelcase } from 'stringcase';\n\nimport { notNullOrUndefined } from '@sdk-it/core/file-system.js';\n\nimport { forEachOperation } from './for-each-operation.js';\nimport type { IR } from './types.js';\n\nexport type ChildNavItem = {\n id: string;\n title: string;\n url: string;\n};\n\nexport type NavItem = {\n id: string;\n title: string;\n description?: string;\n url?: string;\n items?: ChildNavItem[];\n content?: string; // Markdown content\n};\n\nexport type CategoryItem = {\n id: string;\n category: string;\n description?: string;\n items: NavItem[];\n};\n\nexport type SidebarData = CategoryItem[];\n\nexport interface TagGroups {\n name: string;\n tags: string[];\n}\n\nexport function toSidebar(spec: IR) {\n const sidebar: SidebarData = spec['x-docs'];\n for (const tagGroup of spec['x-tagGroups']) {\n sidebar.push({\n id: camelcase(tagGroup.name),\n category: tagGroup.name,\n items: tagGroup.tags.map((tag) => {\n const tagSpec = spec.tags?.find((t) => t.name === tag);\n return {\n id: crypto.randomUUID(),\n description: tagSpec?.description,\n title: tagSpec\n ? tagSpec['x-displayName'] || tagSpec.name || tag\n : tag,\n items: forEachOperation(spec, (entry, operation) => {\n if (operation.tags.includes(tag)) {\n const title = operation.summary || operation.operationId;\n return {\n id: operation.operationId,\n title,\n url: `${camelcase(tag)}/${camelcase(operation.operationId)}`,\n };\n }\n return null;\n }).filter(notNullOrUndefined),\n };\n }),\n });\n }\n return sidebar;\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B;AAEnC,SAAS,wBAAwB;AAgC1B,SAAS,UAAU,MAAU;AAClC,QAAM,UAAuB,KAAK,QAAQ;AAC1C,aAAW,YAAY,KAAK,aAAa,GAAG;AAC1C,YAAQ,KAAK;AAAA,MACX,IAAI,UAAU,SAAS,IAAI;AAAA,MAC3B,UAAU,SAAS;AAAA,MACnB,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ;AAChC,cAAM,UAAU,KAAK,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG;AACrD,eAAO;AAAA,UACL,IAAI,OAAO,WAAW;AAAA,UACtB,aAAa,SAAS;AAAA,UACtB,OAAO,UACH,QAAQ,eAAe,KAAK,QAAQ,QAAQ,MAC5C;AAAA,UACJ,OAAO,iBAAiB,MAAM,CAAC,OAAO,cAAc;AAClD,gBAAI,UAAU,KAAK,SAAS,GAAG,GAAG;AAChC,oBAAM,QAAQ,UAAU,WAAW,UAAU;AAC7C,qBAAO;AAAA,gBACL,IAAI,UAAU;AAAA,gBACd;AAAA,gBACA,KAAK,GAAG,UAAU,GAAG,CAAC,IAAI,UAAU,UAAU,WAAW,CAAC;AAAA,cAC5D;AAAA,YACF;AACA,mBAAO;AAAA,UACT,CAAC,EAAE,OAAO,kBAAkB;AAAA,QAC9B;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { OperationObject, ParameterObject, SchemaObject, SecurityRequirementObject } from 'openapi3-ts/oas31';
2
- import type { OurOpenAPIObject, OurRequestBodyObject } from './types.js';
3
- export declare function patchParameters(spec: OurOpenAPIObject, schema: SchemaObject, parameters: ParameterObject[], security: SecurityRequirementObject[]): void;
4
- export declare function tuneRequestBody(spec: OurOpenAPIObject, operationId: string, operation: OperationObject, parameters: ParameterObject[], security: SecurityRequirementObject[]): OurRequestBodyObject;
2
+ import type { IR, OurRequestBodyObject } from './types.js';
3
+ export declare function patchParameters(spec: IR, schema: SchemaObject, parameters: ParameterObject[], security: SecurityRequirementObject[]): void;
4
+ export declare function tuneRequestBody(spec: IR, operationId: string, operation: OperationObject, parameters: ParameterObject[], security: SecurityRequirementObject[]): OurRequestBodyObject;
5
5
  //# sourceMappingURL=tune-request-body.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tune-request-body.d.ts","sourceRoot":"","sources":["../../src/lib/tune-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAEf,YAAY,EACZ,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEzE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,yBAAyB,EAAE,QA+BtC;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,yBAAyB,EAAE,GACpC,oBAAoB,CA+DtB"}
1
+ {"version":3,"file":"tune-request-body.d.ts","sourceRoot":"","sources":["../../src/lib/tune-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAEf,YAAY,EACZ,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,EAAE,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3D,wBAAgB,eAAe,CAC7B,IAAI,EAAE,EAAE,EACR,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,yBAAyB,EAAE,QA+BtC;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,EAAE,EACR,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,yBAAyB,EAAE,GACpC,oBAAoB,CA+DtB"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/tune-request-body.ts"],
4
- "sourcesContent": ["import type {\n OperationObject,\n ParameterObject,\n RequestBodyObject,\n SchemaObject,\n SecurityRequirementObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core/ref.js';\nimport { isEmpty } from '@sdk-it/core/utils.js';\n\nimport { findUniqueSchemaName } from './find-unique-schema-name.js';\nimport { securityToOptions } from './security.js';\nimport type { OurOpenAPIObject, OurRequestBodyObject } from './types.js';\n\nexport function patchParameters(\n spec: OurOpenAPIObject,\n schema: SchemaObject,\n parameters: ParameterObject[],\n security: SecurityRequirementObject[],\n) {\n const securityOptions = securityToOptions(\n spec,\n security,\n spec.components.securitySchemes,\n );\n\n let required = Array.isArray(schema.required) ? schema.required : [];\n schema['x-properties'] ??= {};\n for (const param of parameters) {\n if (param.required) {\n required.push(param.name);\n }\n schema['x-properties'][param.name] = {\n 'x-in': param.in,\n ...(isRef(param.schema)\n ? followRef<SchemaObject>(spec, param.schema.$ref)\n : (param.schema ?? { type: 'string' })),\n };\n }\n for (const param of securityOptions) {\n required = required.filter((name) => name !== param.name);\n schema['x-properties'][param.name] = {\n 'x-in': 'header',\n ...(isRef(param.schema)\n ? followRef<SchemaObject>(spec, param.schema.$ref)\n : (param.schema ?? { type: 'string' })),\n };\n }\n schema['x-required'] = required;\n}\n\nexport function tuneRequestBody(\n spec: OurOpenAPIObject,\n operationId: string,\n operation: OperationObject,\n parameters: ParameterObject[],\n security: SecurityRequirementObject[],\n): OurRequestBodyObject {\n const inputName = findUniqueSchemaName(spec, operationId, [\n 'input',\n 'payload',\n 'request',\n ]);\n const requestBody = isRef(operation.requestBody)\n ? followRef<RequestBodyObject>(spec, operation.requestBody.$ref)\n : (operation.requestBody ?? {\n content: {},\n required: false,\n });\n if (isEmpty(requestBody.content)) {\n const schema: SchemaObject = {\n 'x-inputname': inputName,\n 'x-requestbody': true,\n };\n patchParameters(spec, schema, parameters, security);\n const tuned: OurRequestBodyObject = {\n ...requestBody,\n content: {\n 'application/empty': {\n schema: { $ref: `#/components/schemas/${inputName}` },\n },\n },\n };\n\n spec.components.schemas[inputName] = schema;\n return tuned;\n }\n for (const contentType in requestBody.content) {\n const mediaType = requestBody.content[contentType];\n let schema: SchemaObject | undefined;\n\n switch (true) {\n case isRef(mediaType.schema):\n schema = followRef<SchemaObject>(spec, mediaType.schema.$ref);\n // we cannot use the model name as inputName as it might be used in other places that are not request bodies\n // inputName = parseRef(mediaType.schema.$ref).model;\n break;\n case isEmpty(mediaType.schema):\n schema ??= {}; // default to empty schema if not defined\n console.warn(\n `Request body schema for content type \"${contentType}\" is empty.`,\n );\n break;\n default:\n schema = mediaType.schema;\n break;\n }\n\n patchParameters(spec, schema, parameters, security);\n spec.components.schemas[inputName] = {\n ...schema,\n 'x-requestbody': true,\n 'x-inputname': inputName,\n };\n\n requestBody.content[contentType].schema = {\n $ref: `#/components/schemas/${inputName}`,\n };\n }\n return requestBody as OurRequestBodyObject;\n}\n"],
4
+ "sourcesContent": ["import type {\n OperationObject,\n ParameterObject,\n RequestBodyObject,\n SchemaObject,\n SecurityRequirementObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core/ref.js';\nimport { isEmpty } from '@sdk-it/core/utils.js';\n\nimport { findUniqueSchemaName } from './find-unique-schema-name.js';\nimport { securityToOptions } from './security.js';\nimport type { IR, OurRequestBodyObject } from './types.js';\n\nexport function patchParameters(\n spec: IR,\n schema: SchemaObject,\n parameters: ParameterObject[],\n security: SecurityRequirementObject[],\n) {\n const securityOptions = securityToOptions(\n spec,\n security,\n spec.components.securitySchemes,\n );\n\n let required = Array.isArray(schema.required) ? schema.required : [];\n schema['x-properties'] ??= {};\n for (const param of parameters) {\n if (param.required) {\n required.push(param.name);\n }\n schema['x-properties'][param.name] = {\n 'x-in': param.in,\n ...(isRef(param.schema)\n ? followRef<SchemaObject>(spec, param.schema.$ref)\n : (param.schema ?? { type: 'string' })),\n };\n }\n for (const param of securityOptions) {\n required = required.filter((name) => name !== param.name);\n schema['x-properties'][param.name] = {\n 'x-in': 'header',\n ...(isRef(param.schema)\n ? followRef<SchemaObject>(spec, param.schema.$ref)\n : (param.schema ?? { type: 'string' })),\n };\n }\n schema['x-required'] = required;\n}\n\nexport function tuneRequestBody(\n spec: IR,\n operationId: string,\n operation: OperationObject,\n parameters: ParameterObject[],\n security: SecurityRequirementObject[],\n): OurRequestBodyObject {\n const inputName = findUniqueSchemaName(spec, operationId, [\n 'input',\n 'payload',\n 'request',\n ]);\n const requestBody = isRef(operation.requestBody)\n ? followRef<RequestBodyObject>(spec, operation.requestBody.$ref)\n : (operation.requestBody ?? {\n content: {},\n required: false,\n });\n if (isEmpty(requestBody.content)) {\n const schema: SchemaObject = {\n 'x-inputname': inputName,\n 'x-requestbody': true,\n };\n patchParameters(spec, schema, parameters, security);\n const tuned: OurRequestBodyObject = {\n ...requestBody,\n content: {\n 'application/empty': {\n schema: { $ref: `#/components/schemas/${inputName}` },\n },\n },\n };\n\n spec.components.schemas[inputName] = schema;\n return tuned;\n }\n for (const contentType in requestBody.content) {\n const mediaType = requestBody.content[contentType];\n let schema: SchemaObject | undefined;\n\n switch (true) {\n case isRef(mediaType.schema):\n schema = followRef<SchemaObject>(spec, mediaType.schema.$ref);\n // we cannot use the model name as inputName as it might be used in other places that are not request bodies\n // inputName = parseRef(mediaType.schema.$ref).model;\n break;\n case isEmpty(mediaType.schema):\n schema ??= {}; // default to empty schema if not defined\n console.warn(\n `Request body schema for content type \"${contentType}\" is empty.`,\n );\n break;\n default:\n schema = mediaType.schema;\n break;\n }\n\n patchParameters(spec, schema, parameters, security);\n spec.components.schemas[inputName] = {\n ...schema,\n 'x-requestbody': true,\n 'x-inputname': inputName,\n };\n\n requestBody.content[contentType].schema = {\n $ref: `#/components/schemas/${inputName}`,\n };\n }\n return requestBody as OurRequestBodyObject;\n}\n"],
5
5
  "mappings": "AAQA,SAAS,WAAW,aAAa;AACjC,SAAS,eAAe;AAExB,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAG3B,SAAS,gBACd,MACA,QACA,YACA,UACA;AACA,QAAM,kBAAkB;AAAA,IACtB;AAAA,IACA;AAAA,IACA,KAAK,WAAW;AAAA,EAClB;AAEA,MAAI,WAAW,MAAM,QAAQ,OAAO,QAAQ,IAAI,OAAO,WAAW,CAAC;AACnE,SAAO,cAAc,MAAM,CAAC;AAC5B,aAAW,SAAS,YAAY;AAC9B,QAAI,MAAM,UAAU;AAClB,eAAS,KAAK,MAAM,IAAI;AAAA,IAC1B;AACA,WAAO,cAAc,EAAE,MAAM,IAAI,IAAI;AAAA,MACnC,QAAQ,MAAM;AAAA,MACd,GAAI,MAAM,MAAM,MAAM,IAClB,UAAwB,MAAM,MAAM,OAAO,IAAI,IAC9C,MAAM,UAAU,EAAE,MAAM,SAAS;AAAA,IACxC;AAAA,EACF;AACA,aAAW,SAAS,iBAAiB;AACnC,eAAW,SAAS,OAAO,CAAC,SAAS,SAAS,MAAM,IAAI;AACxD,WAAO,cAAc,EAAE,MAAM,IAAI,IAAI;AAAA,MACnC,QAAQ;AAAA,MACR,GAAI,MAAM,MAAM,MAAM,IAClB,UAAwB,MAAM,MAAM,OAAO,IAAI,IAC9C,MAAM,UAAU,EAAE,MAAM,SAAS;AAAA,IACxC;AAAA,EACF;AACA,SAAO,YAAY,IAAI;AACzB;AAEO,S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O;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { OperationObject } from 'openapi3-ts/oas31';
2
2
  import { type ResponsesConfig } from './options.js';
3
- import type { OurOpenAPIObject } from './types.js';
4
- export declare function resolveResponses(spec: OurOpenAPIObject, operationId: string, operation: OperationObject, responsesConfig?: ResponsesConfig): import("openapi3-ts/oas31").ResponsesObject;
3
+ import type { IR } from './types.js';
4
+ export declare function resolveResponses(spec: IR, operationId: string, operation: OperationObject, responsesConfig?: ResponsesConfig): import("openapi3-ts/oas31").ResponsesObject;
5
5
  //# sourceMappingURL=tune-response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tune-response.d.ts","sourceRoot":"","sources":["../../src/lib/tune-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,EAC1B,eAAe,CAAC,EAAE,eAAe,+CAuHlC"}
1
+ {"version":3,"file":"tune-response.d.ts","sourceRoot":"","sources":["../../src/lib/tune-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAErC,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,EAAE,EACR,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,eAAe,EAC1B,eAAe,CAAC,EAAE,eAAe,+CAuHlC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/tune-response.ts"],
4
- "sourcesContent": ["import type {\n MediaTypeObject,\n OperationObject,\n ResponseObject,\n} from 'openapi3-ts/oas31';\n\nimport { isRef, parseRef, resolveRef } from '@sdk-it/core/ref.js';\nimport { isEmpty, pascalcase } from '@sdk-it/core/utils.js';\n\nimport { findUniqueSchemaName } from './find-unique-schema-name.js';\nimport {\n isSseContentType,\n isSuccessStatusCode,\n isTextContentType,\n parseJsonContentType,\n} from './is.js';\nimport { type ResponsesConfig } from './options.js';\nimport type { OurOpenAPIObject } from './types.js';\n\nexport function resolveResponses(\n spec: OurOpenAPIObject,\n operationId: string,\n operation: OperationObject,\n responsesConfig?: ResponsesConfig,\n) {\n const responses = operation.responses ?? {};\n operation.responses ??= {};\n let foundSuccessResponse = false;\n for (const status in responses) {\n if (status === 'default') {\n delete responses[status]; // Skip default response\n continue;\n }\n // use structuredClone to avoid mutating a response object\n // that is referenced by multiple operations\n operation.responses[status] = structuredClone(\n resolveRef<ResponseObject>(spec, responses[status]),\n );\n\n if (isSuccessStatusCode(status)) {\n foundSuccessResponse = true;\n }\n }\n\n if (!foundSuccessResponse) {\n operation.responses['200'] = {\n description: 'OK',\n content: {\n 'application/json': {\n schema: {},\n },\n },\n };\n }\n\n for (const status in operation.responses) {\n const response = operation.responses[status] as ResponseObject;\n const statusCode = +status;\n\n const outputName =\n statusCode !== 200\n ? pascalcase(operationId) + status\n : findUniqueSchemaName(spec, operationId, [\n 'output',\n 'payload',\n 'result',\n ]);\n\n if (!responsesConfig?.flattenErrorResponses) {\n if (!isSuccessStatusCode(status)) {\n continue;\n }\n }\n\n if (isEmpty(response.content)) {\n response.content = {\n 'application/octet-stream': {},\n };\n }\n\n response['x-response-name'] = outputName;\n\n // if (isErrorStatusCode(status)) {\n // const mediaType = response.content?.['application/json'];\n // if (mediaType && isRef(mediaType.schema)) {\n // const { model } = parseRef(mediaType.schema.$ref);\n // Object.assign(config.spec.components.schemas[model], {\n // 'x-responsebody': true,\n // // do not assign response ref to a group\n // // because they are supposed to be in a separate file only inlined\n // // schemas are grouped by operationId\n // });\n // response['x-response-name'] = model;\n // }\n // continue;\n // }\n\n for (const [contentType, mediaType] of Object.entries(\n response.content as Record<string, MediaTypeObject>,\n )) {\n if (isRef(mediaType.schema)) {\n const { model } = parseRef(mediaType.schema.$ref);\n Object.assign(spec.components.schemas[model], {\n 'x-responsebody': true,\n // do not assign response ref to a group\n // because they are supposed to be in a separate file only inlined\n // schemas are grouped by operationId\n });\n response['x-response-name'] = model;\n continue;\n }\n if (isSseContentType(contentType)) {\n continue; // Skip SSE content types\n }\n if (parseJsonContentType(contentType)) {\n if (isEmpty(mediaType.schema)) {\n // add \"additionalProperties\" because we're certain this is a response body is of json type\n spec.components.schemas[outputName] = {\n type: 'object',\n additionalProperties: true,\n };\n }\n } else {\n spec.components.schemas[outputName] = {\n ...spec.components.schemas[outputName],\n 'x-stream': !isTextContentType(contentType),\n };\n }\n\n spec.components.schemas[outputName] = {\n ...spec.components.schemas[outputName],\n ...mediaType.schema,\n 'x-responsebody': true,\n 'x-response-group': operationId,\n };\n operation.responses[status].content[contentType].schema = {\n $ref: `#/components/schemas/${outputName}`,\n };\n }\n }\n\n return operation.responses;\n}\n"],
4
+ "sourcesContent": ["import type {\n MediaTypeObject,\n OperationObject,\n ResponseObject,\n} from 'openapi3-ts/oas31';\n\nimport { isRef, parseRef, resolveRef } from '@sdk-it/core/ref.js';\nimport { isEmpty, pascalcase } from '@sdk-it/core/utils.js';\n\nimport { findUniqueSchemaName } from './find-unique-schema-name.js';\nimport {\n isSseContentType,\n isSuccessStatusCode,\n isTextContentType,\n parseJsonContentType,\n} from './is.js';\nimport { type ResponsesConfig } from './options.js';\nimport type { IR } from './types.js';\n\nexport function resolveResponses(\n spec: IR,\n operationId: string,\n operation: OperationObject,\n responsesConfig?: ResponsesConfig,\n) {\n const responses = operation.responses ?? {};\n operation.responses ??= {};\n let foundSuccessResponse = false;\n for (const status in responses) {\n if (status === 'default') {\n delete responses[status]; // Skip default response\n continue;\n }\n // use structuredClone to avoid mutating a response object\n // that is referenced by multiple operations\n operation.responses[status] = structuredClone(\n resolveRef<ResponseObject>(spec, responses[status]),\n );\n\n if (isSuccessStatusCode(status)) {\n foundSuccessResponse = true;\n }\n }\n\n if (!foundSuccessResponse) {\n operation.responses['200'] = {\n description: 'OK',\n content: {\n 'application/json': {\n schema: {},\n },\n },\n };\n }\n\n for (const status in operation.responses) {\n const response = operation.responses[status] as ResponseObject;\n const statusCode = +status;\n\n const outputName =\n statusCode !== 200\n ? pascalcase(operationId) + status\n : findUniqueSchemaName(spec, operationId, [\n 'output',\n 'payload',\n 'result',\n ]);\n\n if (!responsesConfig?.flattenErrorResponses) {\n if (!isSuccessStatusCode(status)) {\n continue;\n }\n }\n\n if (isEmpty(response.content)) {\n response.content = {\n 'application/octet-stream': {},\n };\n }\n\n response['x-response-name'] = outputName;\n\n // if (isErrorStatusCode(status)) {\n // const mediaType = response.content?.['application/json'];\n // if (mediaType && isRef(mediaType.schema)) {\n // const { model } = parseRef(mediaType.schema.$ref);\n // Object.assign(config.spec.components.schemas[model], {\n // 'x-responsebody': true,\n // // do not assign response ref to a group\n // // because they are supposed to be in a separate file only inlined\n // // schemas are grouped by operationId\n // });\n // response['x-response-name'] = model;\n // }\n // continue;\n // }\n\n for (const [contentType, mediaType] of Object.entries(\n response.content as Record<string, MediaTypeObject>,\n )) {\n if (isRef(mediaType.schema)) {\n const { model } = parseRef(mediaType.schema.$ref);\n Object.assign(spec.components.schemas[model], {\n 'x-responsebody': true,\n // do not assign response ref to a group\n // because they are supposed to be in a separate file only inlined\n // schemas are grouped by operationId\n });\n response['x-response-name'] = model;\n continue;\n }\n if (isSseContentType(contentType)) {\n continue; // Skip SSE content types\n }\n if (parseJsonContentType(contentType)) {\n if (isEmpty(mediaType.schema)) {\n // add \"additionalProperties\" because we're certain this is a response body is of json type\n spec.components.schemas[outputName] = {\n type: 'object',\n additionalProperties: true,\n };\n }\n } else {\n spec.components.schemas[outputName] = {\n ...spec.components.schemas[outputName],\n 'x-stream': !isTextContentType(contentType),\n };\n }\n\n spec.components.schemas[outputName] = {\n ...spec.components.schemas[outputName],\n ...mediaType.schema,\n 'x-responsebody': true,\n 'x-response-group': operationId,\n };\n operation.responses[status].content[contentType].schema = {\n $ref: `#/components/schemas/${outputName}`,\n };\n }\n }\n\n return operation.responses;\n}\n"],
5
5
  "mappings": "AAMA,SAAS,OAAO,UAAU,kBAAkB;AAC5C,SAAS,SAAS,kBAAkB;AAEpC,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,eAAqC;AAG9B,SAAS,iBACd,MACA,aACA,WACA,iBACA;AACA,QAAM,YAAY,UAAU,aAAa,CAAC;AAC1C,YAAU,cAAc,CAAC;AACzB,MAAI,uBAAuB;AAC3B,aAAW,UAAU,WAAW;AAC9B,QAAI,WAAW,WAAW;AACxB,aAAO,UAAU,MAAM;AACvB;AAAA,IACF;AAGA,cAAU,UAAU,MAAM,IAAI;AAAA,MAC5B,WAA2B,MAAM,UAAU,MAAM,CAAC;AAAA,IACpD;AAEA,QAAI,oBAAoB,MAAM,GAAG;AAC/B,6BAAuB;AAAA,IACzB;AAAA,EACF;AAEA,MAAI,CAAC,sBAAsB;AACzB,cAAU,UAAU,KAAK,IAAI;AAAA,MAC3B,aAAa;AAAA,MACb,SAAS;AAAA,QACP,oBAAoB;AAAA,UAClB,QAAQ,CAAC;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,aAAW,UAAU,UAAU,WAAW;AACxC,UAAM,WAAW,UAAU,UAAU,MAAM;AAC3C,UAAM,aAAa,CAAC;AAEpB,UAAM,aACJ,eAAe,MACX,WAAW,WAAW,IAAI,SAC1B,qBAAqB,MAAM,aAAa;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAEP,QAAI,CAAC,iBAAiB,uBAAuB;AAC3C,UAAI,CAAC,oBAAoB,MAAM,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emaObject, SchemaObjectType } from 'openapi3-ts/oas31';
2
- import type { OurOpenAPIObject } from './types.js';
3
- export declare function fixSpec(spec: OurOpenAPIObject, schemas: (SchemaObject | ReferenceObject)[], visited?: Set<string>): void;
2
+ import type { IR } from './types.js';
3
+ export declare function fixSpec(spec: IR, schemas: (SchemaObject | ReferenceObject)[], visited?: Set<string>): void;
4
4
  type Refs = {
5
5
  name: string;
6
6
  value: SchemaObject;
7
7
  }[];
8
- export declare function expandSpec(spec: OurOpenAPIObject, schemas: Record<string, SchemaObject | ReferenceObject>, refs: Refs): void;
8
+ export declare function expandSpec(spec: IR, schemas: Record<string, SchemaObject | ReferenceObject>, refs: Refs): void;
9
9
  export declare function coerceTypes(schema: SchemaObject, excludeNull?: boolean): SchemaObjectType[];
10
10
  export {};
11
11
  //# sourceMappingURL=tune.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tune.d.ts","sourceRoot":"","sources":["../../src/lib/tune.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wBAAgB,OAAO,CACrB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,CAAC,YAAY,GAAG,eAAe,CAAC,EAAE,EAC3C,OAAO,cAAoB,QAsK5B;AAED,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,EAAE,CAAC;AAEpD,wBAAgB,UAAU,CACxB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC,EACvD,IAAI,EAAE,IAAI,QAoJX;AA0CD,wBAAgB,WAAW,CACzB,MAAM,EAAE,YAAY,EACpB,WAAW,UAAO,GACjB,gBAAgB,EAAE,CAUpB"}
1
+ {"version":3,"file":"tune.d.ts","sourceRoot":"","sources":["../../src/lib/tune.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAErC,wBAAgB,OAAO,CACrB,IAAI,EAAE,EAAE,EACR,OAAO,EAAE,CAAC,YAAY,GAAG,eAAe,CAAC,EAAE,EAC3C,OAAO,cAAoB,QAsK5B;AAED,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,EAAE,CAAC;AAEpD,wBAAgB,UAAU,CACxB,IAAI,EAAE,EAAE,EACR,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC,EACvD,IAAI,EAAE,IAAI,QAoJX;AA0CD,wBAAgB,WAAW,CACzB,MAAM,EAAE,YAAY,EACpB,WAAW,UAAO,GACjB,gBAAgB,EAAE,CAUpB"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/tune.ts"],
4
- "sourcesContent": ["import { merge, uniq } from 'lodash-es';\nimport assert from 'node:assert';\nimport type {\n ReferenceObject,\n SchemaObject,\n SchemaObjectType,\n} from 'openapi3-ts/oas31';\n\nimport {\n isEmpty,\n isRef,\n joinSkipDigits,\n notRef,\n pascalcase,\n resolveRef,\n snakecase,\n} from '@sdk-it/core';\n\nimport { type Varient, findVarients } from './find-polymorphic-varients.js';\nimport { findUniqueSchemaName } from './find-unique-schema-name.js';\nimport { formatName } from './format-name.js';\nimport { isPrimitiveSchema } from './is-primitive-schema.js';\nimport type { OurOpenAPIObject } from './types.js';\n\nexport function fixSpec(\n spec: OurOpenAPIObject,\n schemas: (SchemaObject | ReferenceObject)[],\n visited = new Set<string>(),\n) {\n for (const schema of schemas) {\n if (isRef(schema)) continue;\n\n if (!isEmpty(schema.properties)) {\n schema.type = 'object';\n delete schema.oneOf;\n delete schema.anyOf;\n fixSpec(spec, Object.values(schema.properties), visited);\n // path param are required and if it happens to have\n // body with defaults then zod would break off. so flat the defaults from object itself to properties\n for (const [key, value] of Object.entries(schema.properties)) {\n if (notRef(value) && isPrimitiveSchema(value)) {\n value.default ??= schema.default?.[key];\n delete schema.default?.[key];\n }\n }\n delete schema.default; // default should not be in properties\n }\n\n if (!isEmpty(schema['x-properties'])) {\n fixSpec(spec, Object.values(schema['x-properties']), visited);\n }\n\n if (!isEmpty(schema.items)) {\n delete schema.oneOf;\n delete schema.anyOf;\n schema.type = 'array';\n fixSpec(spec, [schema.items], visited);\n const items = resolveRef<SchemaObject>(spec, schema.items);\n if (Array.isArray(items.default)) {\n schema.default ??= structuredClone(items.default);\n }\n delete items.default; // default should not be in items\n }\n\n if (!isEmpty(schema.anyOf) && !isEmpty(schema.oneOf)) {\n delete schema.anyOf;\n }\n\n if (isEmpty(schema.enum)) {\n delete schema.enum;\n }\n\n if (!isEmpty(schema.enum)) {\n if (schema.enum.length === 1) {\n schema.const = schema.enum[0];\n delete schema.enum;\n } else {\n const valuesSet = new Set<string>();\n const valuesList = [];\n for (const it of schema.enum) {\n const formattedValue = formatName(snakecase(formatName(it)));\n if (!valuesSet.has(formattedValue)) {\n valuesSet.add(formattedValue);\n valuesList.push(it);\n }\n }\n schema.enum = valuesList;\n }\n delete schema.allOf;\n }\n\n if (schema.const !== undefined) {\n schema.default = schema.const;\n }\n\n if (!isEmpty(schema.allOf)) {\n const schemas = schema.allOf;\n // if (schemas.length === 1) {\n // fixSpec(spec, [schemas[0]], visited);\n // Object.assign(schema, schemas[0]);\n // delete schema.allOf;\n // } else {\n // }\n const resolved = schemas.map((it) => resolveRef<SchemaObject>(spec, it));\n const hasObjects = resolved.some((it) => it.type === 'object');\n const hasOtherTypes = resolved.some(\n (it) => it.type && it.type !== 'object',\n );\n if (hasObjects && hasOtherTypes) {\n assert(false, `allOf must be an object`);\n }\n merge(\n schema,\n ...resolved.map((it) => {\n fixSpec(spec, [it], visited);\n return it;\n }),\n );\n delete schema.allOf;\n } else {\n delete schema.allOf;\n }\n\n if (\n schema.type === 'object' &&\n isEmpty(schema.properties) &&\n typeof schema.additionalProperties === 'object' &&\n !isEmpty(schema.additionalProperties) &&\n notRef(schema.additionalProperties) &&\n !isEmpty(schema.additionalProperties.properties)\n ) {\n // additionalProperties is of type object and properties is empty\n fixSpec(\n spec,\n Object.values(schema.additionalProperties.properties),\n visited,\n );\n Object.assign(schema, schema.additionalProperties);\n delete schema.additionalProperties;\n }\n\n for (const kind of ['oneOf', 'anyOf'] as const) {\n if (!isEmpty(schema[kind])) {\n delete schema.type; // type is not allowed with oneOf or anyOf\n fixSpec(spec, schema[kind], visited);\n if (isEmpty(schema[kind])) {\n // fixSpec can remove oneOf or anyOf if it has no items so we need to check again\n // after fixing\n continue;\n }\n\n let enumSchemaIndex = -1;\n const enumValues: string[] = [];\n for (let idx = 0; idx < schema[kind].length; idx++) {\n // for (const idx in schema[kind]) {\n const item = schema[kind][idx];\n // just handle non ref for now\n if (notRef(item) && item.type === 'string') {\n // if enum equal one it'd already have been converted to const so check for more than one\n if (item.enum && item.enum.length > 1) {\n // foundEnum = true;\n enumValues.push(...item.enum);\n if (enumSchemaIndex === -1) {\n enumSchemaIndex = idx;\n }\n }\n }\n }\n if (enumSchemaIndex !== -1) {\n const enumSchema = schema[kind][enumSchemaIndex];\n if (notRef(enumSchema)) {\n enumSchema.enum = uniq(enumValues);\n }\n // delete the other schemas that have enum\n schema[kind] = schema[kind].filter(\n (it, idx) => idx === enumSchemaIndex || isRef(it),\n );\n }\n const otherTypes = schema[kind].filter(\n (it) => resolveRef<SchemaObject>(spec, it).type !== 'null',\n );\n if (otherTypes.length === 1) {\n Object.assign(schema, otherTypes[0]);\n delete schema[kind];\n continue;\n }\n\n schema['x-varients'] = findVarients(spec, schema[kind]);\n } else {\n delete schema[kind];\n }\n }\n }\n}\n\ntype Refs = { name: string; value: SchemaObject }[];\n\nexport function expandSpec(\n spec: OurOpenAPIObject,\n schemas: Record<string, SchemaObject | ReferenceObject>,\n refs: Refs,\n) {\n for (const [name, schema] of Object.entries(schemas)) {\n if (isRef(schema)) continue;\n\n if (!isEmpty(schema.properties)) {\n if (!isEmpty(schema.oneOf)) {\n for (const oneOfIdx in schema.oneOf) {\n const oneOf = schema.oneOf[oneOfIdx];\n if (isRef(oneOf)) continue;\n for (const key of ['properties', 'x-properties'] as const) {\n if (!isEmpty(oneOf.required) && schema[key]) {\n schema.oneOf[oneOfIdx] = schema[key][oneOf.required[0]];\n }\n }\n }\n delete schema.type;\n expandSpec(spec, schemas, refs);\n continue;\n }\n if (schema.additionalProperties) {\n continue;\n }\n // refs.push({ name, value: schema });\n spec.components.schemas[name] = schema;\n const properties = schema.properties as Record<\n string,\n SchemaObject | ReferenceObject\n >;\n for (const [propName, value] of Object.entries(properties)) {\n if (isRef(value)) continue;\n\n const fixedPropName = propName.replace('[]', '');\n // this neeeds inheritance logic first otherwise it'll create class mess\n // const refName = findUniqueSchemaName(\n // spec,\n // propName,\n // ['Property', 'Field', 'Attribute'],\n // pascalcase(joinSkipDigits([name, fixedPropName], ' ')),\n // );\n const refName = pascalcase(joinSkipDigits([name, fixedPropName], ' '));\n\n if (!isEmpty(value.properties)) {\n // refs.push({ name: refName, value: value });\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.oneOf)) {\n expandOneOf(spec, name, value, refs, 'oneOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.anyOf)) {\n expandOneOf(spec, name, value, refs, 'anyOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else {\n expandSpec(spec, { [refName]: value }, refs);\n }\n }\n\n continue;\n }\n if (!isEmpty(schema['x-properties'])) {\n // refs.push({ name, value: schema });\n spec.components.schemas[name] = schema;\n\n const properties = schema['x-properties'] as Record<\n string,\n SchemaObject | ReferenceObject\n >;\n for (const [propName, value] of Object.entries(properties)) {\n if (isRef(value)) continue;\n\n const fixedPropName = propName.replace('[]', '');\n // this neeeds inheritance logic first otherwise it'll create class mess\n // const refName = findUniqueSchemaName(\n // spec,\n // propName,\n // ['Property', 'Field', 'Attribute'],\n // pascalcase(joinSkipDigits([name, fixedPropName], ' ')),\n // );\n const refName = pascalcase(joinSkipDigits([name, fixedPropName], ' '));\n\n if (!isEmpty(value.properties)) {\n // refs.push({ name: refName, value: value });\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.oneOf)) {\n expandOneOf(spec, name, value, refs, 'oneOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.anyOf)) {\n expandOneOf(spec, name, value, refs, 'anyOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else {\n expandSpec(spec, { [refName]: value }, refs);\n }\n }\n continue;\n }\n\n if (schema.type === 'array') {\n if (isRef(schema.items)) continue;\n if (isEmpty(schema.items)) continue;\n const refName = findUniqueSchemaName(spec, name, ['Item', 'Entry']);\n if (schema.items.type === 'object') {\n // const refName = findUniqueSchemaName(spec, name, ['Object']);\n // refs.push({ name: refName, value: schema.items });\n spec.components.schemas[refName] = schema.items;\n expandSpec(spec, { [refName]: schema.items }, refs);\n schema.items = { $ref: `#/components/schemas/${refName}` };\n continue;\n }\n if (schema.items.type === 'array') {\n // for nested arrays, we need to move the last nested items only\n // so {type: 'array', items: { type: 'array', items: { type: 'object', properties: ... } }}\n // only object schema is moved while the array hirarchy is intact.\n expandSpec(spec, { [refName]: schema.items }, refs);\n continue;\n }\n if (!isEmpty(schema.items.oneOf)) {\n expandOneOf(spec, refName, schema.items, refs, 'oneOf');\n continue;\n }\n if (!isEmpty(schema.items.anyOf)) {\n expandOneOf(spec, refName, schema.items, refs, 'anyOf');\n continue;\n }\n }\n if (!isEmpty(schema.oneOf)) {\n expandOneOf(spec, name, schema, refs, 'oneOf');\n continue;\n }\n if (!isEmpty(schema.anyOf)) {\n expandOneOf(spec, name, schema, refs, 'anyOf');\n continue;\n }\n }\n}\n\nfunction expandOneOf(\n spec: OurOpenAPIObject,\n name: string,\n schema: SchemaObject,\n refs: Refs,\n kind: 'oneOf' | 'anyOf',\n) {\n const varients = schema['x-varients'] as Varient[];\n if (!varients || varients.length === 0) {\n console.warn(\n `No varients found for ${name}. This might be an error in the OpenAPI spec.`,\n );\n }\n varients.forEach((varient) => {\n const varientSchema = schema[kind]![varient.position];\n if (isRef(varientSchema)) return;\n const refName = findUniqueSchemaName(\n spec,\n pascalcase(`${name} ${varient.name}`),\n ['Varient'],\n );\n\n if (varientSchema.type === 'object') {\n expandSpec(spec, { [refName]: varientSchema }, refs);\n schema[kind]![varient.position] = {\n $ref: `#/components/schemas/${refName}`,\n };\n } else {\n expandSpec(spec, { [refName]: varientSchema }, refs);\n }\n\n // const referable = (['array', 'object'] as SchemaObjectType[]).some((type) =>\n // coerceTypes(varientSchema).includes(type),\n // );\n // if (!referable) {\n // return;\n // }\n });\n}\n\nexport function coerceTypes(\n schema: SchemaObject,\n excludeNull = true,\n): SchemaObjectType[] {\n const types = Array.isArray(schema.type)\n ? schema.type\n : schema.type\n ? [schema.type]\n : [];\n if (excludeNull) {\n return types.filter((type) => type !== 'null');\n }\n return types;\n}\n"],
4
+ "sourcesContent": ["import { merge, uniq } from 'lodash-es';\nimport assert from 'node:assert';\nimport type {\n ReferenceObject,\n SchemaObject,\n SchemaObjectType,\n} from 'openapi3-ts/oas31';\n\nimport {\n isEmpty,\n isRef,\n joinSkipDigits,\n notRef,\n pascalcase,\n resolveRef,\n snakecase,\n} from '@sdk-it/core';\n\nimport { type Varient, findVarients } from './find-polymorphic-varients.js';\nimport { findUniqueSchemaName } from './find-unique-schema-name.js';\nimport { formatName } from './format-name.js';\nimport { isPrimitiveSchema } from './is-primitive-schema.js';\nimport type { IR } from './types.js';\n\nexport function fixSpec(\n spec: IR,\n schemas: (SchemaObject | ReferenceObject)[],\n visited = new Set<string>(),\n) {\n for (const schema of schemas) {\n if (isRef(schema)) continue;\n\n if (!isEmpty(schema.properties)) {\n schema.type = 'object';\n delete schema.oneOf;\n delete schema.anyOf;\n fixSpec(spec, Object.values(schema.properties), visited);\n // path param are required and if it happens to have\n // body with defaults then zod would break off. so flat the defaults from object itself to properties\n for (const [key, value] of Object.entries(schema.properties)) {\n if (notRef(value) && isPrimitiveSchema(value)) {\n value.default ??= schema.default?.[key];\n delete schema.default?.[key];\n }\n }\n delete schema.default; // default should not be in properties\n }\n\n if (!isEmpty(schema['x-properties'])) {\n fixSpec(spec, Object.values(schema['x-properties']), visited);\n }\n\n if (!isEmpty(schema.items)) {\n delete schema.oneOf;\n delete schema.anyOf;\n schema.type = 'array';\n fixSpec(spec, [schema.items], visited);\n const items = resolveRef<SchemaObject>(spec, schema.items);\n if (Array.isArray(items.default)) {\n schema.default ??= structuredClone(items.default);\n }\n delete items.default; // default should not be in items\n }\n\n if (!isEmpty(schema.anyOf) && !isEmpty(schema.oneOf)) {\n delete schema.anyOf;\n }\n\n if (isEmpty(schema.enum)) {\n delete schema.enum;\n }\n\n if (!isEmpty(schema.enum)) {\n if (schema.enum.length === 1) {\n schema.const = schema.enum[0];\n delete schema.enum;\n } else {\n const valuesSet = new Set<string>();\n const valuesList = [];\n for (const it of schema.enum) {\n const formattedValue = formatName(snakecase(formatName(it)));\n if (!valuesSet.has(formattedValue)) {\n valuesSet.add(formattedValue);\n valuesList.push(it);\n }\n }\n schema.enum = valuesList;\n }\n delete schema.allOf;\n }\n\n if (schema.const !== undefined) {\n schema.default = schema.const;\n }\n\n if (!isEmpty(schema.allOf)) {\n const schemas = schema.allOf;\n // if (schemas.length === 1) {\n // fixSpec(spec, [schemas[0]], visited);\n // Object.assign(schema, schemas[0]);\n // delete schema.allOf;\n // } else {\n // }\n const resolved = schemas.map((it) => resolveRef<SchemaObject>(spec, it));\n const hasObjects = resolved.some((it) => it.type === 'object');\n const hasOtherTypes = resolved.some(\n (it) => it.type && it.type !== 'object',\n );\n if (hasObjects && hasOtherTypes) {\n assert(false, `allOf must be an object`);\n }\n merge(\n schema,\n ...resolved.map((it) => {\n fixSpec(spec, [it], visited);\n return it;\n }),\n );\n delete schema.allOf;\n } else {\n delete schema.allOf;\n }\n\n if (\n schema.type === 'object' &&\n isEmpty(schema.properties) &&\n typeof schema.additionalProperties === 'object' &&\n !isEmpty(schema.additionalProperties) &&\n notRef(schema.additionalProperties) &&\n !isEmpty(schema.additionalProperties.properties)\n ) {\n // additionalProperties is of type object and properties is empty\n fixSpec(\n spec,\n Object.values(schema.additionalProperties.properties),\n visited,\n );\n Object.assign(schema, schema.additionalProperties);\n delete schema.additionalProperties;\n }\n\n for (const kind of ['oneOf', 'anyOf'] as const) {\n if (!isEmpty(schema[kind])) {\n delete schema.type; // type is not allowed with oneOf or anyOf\n fixSpec(spec, schema[kind], visited);\n if (isEmpty(schema[kind])) {\n // fixSpec can remove oneOf or anyOf if it has no items so we need to check again\n // after fixing\n continue;\n }\n\n let enumSchemaIndex = -1;\n const enumValues: string[] = [];\n for (let idx = 0; idx < schema[kind].length; idx++) {\n // for (const idx in schema[kind]) {\n const item = schema[kind][idx];\n // just handle non ref for now\n if (notRef(item) && item.type === 'string') {\n // if enum equal one it'd already have been converted to const so check for more than one\n if (item.enum && item.enum.length > 1) {\n // foundEnum = true;\n enumValues.push(...item.enum);\n if (enumSchemaIndex === -1) {\n enumSchemaIndex = idx;\n }\n }\n }\n }\n if (enumSchemaIndex !== -1) {\n const enumSchema = schema[kind][enumSchemaIndex];\n if (notRef(enumSchema)) {\n enumSchema.enum = uniq(enumValues);\n }\n // delete the other schemas that have enum\n schema[kind] = schema[kind].filter(\n (it, idx) => idx === enumSchemaIndex || isRef(it),\n );\n }\n const otherTypes = schema[kind].filter(\n (it) => resolveRef<SchemaObject>(spec, it).type !== 'null',\n );\n if (otherTypes.length === 1) {\n Object.assign(schema, otherTypes[0]);\n delete schema[kind];\n continue;\n }\n\n schema['x-varients'] = findVarients(spec, schema[kind]);\n } else {\n delete schema[kind];\n }\n }\n }\n}\n\ntype Refs = { name: string; value: SchemaObject }[];\n\nexport function expandSpec(\n spec: IR,\n schemas: Record<string, SchemaObject | ReferenceObject>,\n refs: Refs,\n) {\n for (const [name, schema] of Object.entries(schemas)) {\n if (isRef(schema)) continue;\n\n if (!isEmpty(schema.properties)) {\n if (!isEmpty(schema.oneOf)) {\n for (const oneOfIdx in schema.oneOf) {\n const oneOf = schema.oneOf[oneOfIdx];\n if (isRef(oneOf)) continue;\n for (const key of ['properties', 'x-properties'] as const) {\n if (!isEmpty(oneOf.required) && schema[key]) {\n schema.oneOf[oneOfIdx] = schema[key][oneOf.required[0]];\n }\n }\n }\n delete schema.type;\n expandSpec(spec, schemas, refs);\n continue;\n }\n if (schema.additionalProperties) {\n continue;\n }\n // refs.push({ name, value: schema });\n spec.components.schemas[name] = schema;\n const properties = schema.properties as Record<\n string,\n SchemaObject | ReferenceObject\n >;\n for (const [propName, value] of Object.entries(properties)) {\n if (isRef(value)) continue;\n\n const fixedPropName = propName.replace('[]', '');\n // this neeeds inheritance logic first otherwise it'll create class mess\n // const refName = findUniqueSchemaName(\n // spec,\n // propName,\n // ['Property', 'Field', 'Attribute'],\n // pascalcase(joinSkipDigits([name, fixedPropName], ' ')),\n // );\n const refName = pascalcase(joinSkipDigits([name, fixedPropName], ' '));\n\n if (!isEmpty(value.properties)) {\n // refs.push({ name: refName, value: value });\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.oneOf)) {\n expandOneOf(spec, name, value, refs, 'oneOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.anyOf)) {\n expandOneOf(spec, name, value, refs, 'anyOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else {\n expandSpec(spec, { [refName]: value }, refs);\n }\n }\n\n continue;\n }\n if (!isEmpty(schema['x-properties'])) {\n // refs.push({ name, value: schema });\n spec.components.schemas[name] = schema;\n\n const properties = schema['x-properties'] as Record<\n string,\n SchemaObject | ReferenceObject\n >;\n for (const [propName, value] of Object.entries(properties)) {\n if (isRef(value)) continue;\n\n const fixedPropName = propName.replace('[]', '');\n // this neeeds inheritance logic first otherwise it'll create class mess\n // const refName = findUniqueSchemaName(\n // spec,\n // propName,\n // ['Property', 'Field', 'Attribute'],\n // pascalcase(joinSkipDigits([name, fixedPropName], ' ')),\n // );\n const refName = pascalcase(joinSkipDigits([name, fixedPropName], ' '));\n\n if (!isEmpty(value.properties)) {\n // refs.push({ name: refName, value: value });\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.oneOf)) {\n expandOneOf(spec, name, value, refs, 'oneOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else if (!isEmpty(value.anyOf)) {\n expandOneOf(spec, name, value, refs, 'anyOf');\n\n spec.components.schemas[refName] = value;\n properties[propName] = { $ref: `#/components/schemas/${refName}` };\n expandSpec(spec, { [refName]: value }, refs);\n } else {\n expandSpec(spec, { [refName]: value }, refs);\n }\n }\n continue;\n }\n\n if (schema.type === 'array') {\n if (isRef(schema.items)) continue;\n if (isEmpty(schema.items)) continue;\n const refName = findUniqueSchemaName(spec, name, ['Item', 'Entry']);\n if (schema.items.type === 'object') {\n // const refName = findUniqueSchemaName(spec, name, ['Object']);\n // refs.push({ name: refName, value: schema.items });\n spec.components.schemas[refName] = schema.items;\n expandSpec(spec, { [refName]: schema.items }, refs);\n schema.items = { $ref: `#/components/schemas/${refName}` };\n continue;\n }\n if (schema.items.type === 'array') {\n // for nested arrays, we need to move the last nested items only\n // so {type: 'array', items: { type: 'array', items: { type: 'object', properties: ... } }}\n // only object schema is moved while the array hirarchy is intact.\n expandSpec(spec, { [refName]: schema.items }, refs);\n continue;\n }\n if (!isEmpty(schema.items.oneOf)) {\n expandOneOf(spec, refName, schema.items, refs, 'oneOf');\n continue;\n }\n if (!isEmpty(schema.items.anyOf)) {\n expandOneOf(spec, refName, schema.items, refs, 'anyOf');\n continue;\n }\n }\n if (!isEmpty(schema.oneOf)) {\n expandOneOf(spec, name, schema, refs, 'oneOf');\n continue;\n }\n if (!isEmpty(schema.anyOf)) {\n expandOneOf(spec, name, schema, refs, 'anyOf');\n continue;\n }\n }\n}\n\nfunction expandOneOf(\n spec: IR,\n name: string,\n schema: SchemaObject,\n refs: Refs,\n kind: 'oneOf' | 'anyOf',\n) {\n const varients = schema['x-varients'] as Varient[];\n if (!varients || varients.length === 0) {\n console.warn(\n `No varients found for ${name}. This might be an error in the OpenAPI spec.`,\n );\n }\n varients.forEach((varient) => {\n const varientSchema = schema[kind]![varient.position];\n if (isRef(varientSchema)) return;\n const refName = findUniqueSchemaName(\n spec,\n pascalcase(`${name} ${varient.name}`),\n ['Varient'],\n );\n\n if (varientSchema.type === 'object') {\n expandSpec(spec, { [refName]: varientSchema }, refs);\n schema[kind]![varient.position] = {\n $ref: `#/components/schemas/${refName}`,\n };\n } else {\n expandSpec(spec, { [refName]: varientSchema }, refs);\n }\n\n // const referable = (['array', 'object'] as SchemaObjectType[]).some((type) =>\n // coerceTypes(varientSchema).includes(type),\n // );\n // if (!referable) {\n // return;\n // }\n });\n}\n\nexport function coerceTypes(\n schema: SchemaObject,\n excludeNull = true,\n): SchemaObjectType[] {\n const types = Array.isArray(schema.type)\n ? schema.type\n : schema.type\n ? [schema.type]\n : [];\n if (excludeNull) {\n return types.filter((type) => type !== 'null');\n }\n return types;\n}\n"],
5
5
  "mappings": "AAAA,SAAS,OAAO,YAAY;AAC5B,OAAO,YAAY;AAOnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAuB,oBAAoB;AAC3C,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAG3B,SAAS,QACd,MACA,SACA,UAAU,oBAAI,IAAY,GAC1B;AACA,aAAW,UAAU,SAAS;AAC5B,QAAI,MAAM,MAAM,EAAG;AAEnB,QAAI,CAAC,QAAQ,OAAO,UAAU,GAAG;AAC/B,aAAO,OAAO;AACd,aAAO,OAAO;AACd,aAAO,OAAO;AACd,cAAQ,MAAM,OAAO,OAAO,OAAO,UAAU,GAAG,OAAO;AAGvD,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,UAAU,GAAG;AAC5D,YAAI,OAAO,KAAK,KAAK,kBAAkB,KAAK,GAAG;AAC7C,gBAAM,YAAY,OAAO,UAAU,GAAG;AACtC,iBAAO,OAAO,UAAU,GAAG;AAAA,QAC7B;AAAA,MACF;AACA,aAAO,OAAO;AAAA,IAChB;AAEA,QAAI,CAAC,QAAQ,OAAO,cAAc,CAAC,GAAG;AACpC,cAAQ,MAAM,OAAO,OAAO,OAAO,cAAc,CAAC,GAAG,OAAO;AAAA,IAC9D;AAEA,QAAI,CAAC,QAAQ,OAAO,KAAK,GAAG;AAC1B,aAAO,OAAO;AACd,aAAO,OAAO;AACd,aAAO,OAAO;AACd,cAAQ,MAAM,CAAC,OAAO,KAAK,GAAG,OAAO;AACrC,YAAM,QAAQ,WAAyB,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C,MAAM,wBAAwB,OAAO;AAAA,MACvC;AAAA,IACF,OAAO;AACL,iBAAW,MAAM,EAAE,CAAC,OAAO,GAAG,cAAc,GAAG,IAAI;AAAA,IACrD;AAAA,EAQF,CAAC;AACH;AAEO,SAAS,YACd,QACA,cAAc,MACM;AACpB,QAAM,QAAQ,MAAM,QAAQ,OAAO,IAAI,IACnC,OAAO,OACP,OAAO,OACL,CAAC,OAAO,IAAI,IACZ,CAAC;AACP,MAAI,aAAa;AACf,WAAO,MAAM,OAAO,CAAC,SAAS,SAAS,MAAM;AAAA,EAC/C;AACA,SAAO;AACT;",
6
6
  "names": ["schemas"]
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import { merge } from "lodash-es";
2
2
  import { describe, it } from "node:test";
3
- import { augmentSpec } from "./ir.ts";
3
+ import { toIR } from "./ir.ts";
4
4
  function createSpec(openapi) {
5
- return augmentSpec(
5
+ return toIR(
6
6
  {
7
7
  spec: merge(
8
8
  {