@sdk-it/spec 0.28.0 → 0.30.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 (91) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/find-polymorphic-varients.d.ts +3 -3
  6. package/dist/lib/find-polymorphic-varients.d.ts.map +1 -1
  7. package/dist/lib/find-polymorphic-varients.js.map +1 -1
  8. package/dist/lib/find-polymorphic-varients.test.js +2 -2
  9. package/dist/lib/find-polymorphic-varients.test.js.map +2 -2
  10. package/dist/lib/for-each-operation.d.ts +2 -2
  11. package/dist/lib/for-each-operation.d.ts.map +1 -1
  12. package/dist/lib/for-each-operation.js.map +1 -1
  13. package/dist/lib/get-ref-usage.d.ts +2 -2
  14. package/dist/lib/get-ref-usage.d.ts.map +1 -1
  15. package/dist/lib/get-ref-usage.js.map +1 -1
  16. package/dist/lib/guess/guess-resource.d.ts.map +1 -1
  17. package/dist/lib/ir.d.ts +4 -0
  18. package/dist/lib/ir.d.ts.map +1 -0
  19. package/dist/lib/{operation.js → ir.js} +3 -3
  20. package/dist/lib/ir.js.map +7 -0
  21. package/dist/lib/ir.test.d.ts +2 -0
  22. package/dist/lib/ir.test.d.ts.map +1 -0
  23. package/dist/lib/{operation.test.js → ir.test.js} +1 -1
  24. package/dist/lib/{operation.test.js.map → ir.test.js.map} +1 -1
  25. package/dist/lib/options.d.ts +1 -1
  26. package/dist/lib/options.d.ts.map +1 -1
  27. package/dist/lib/options.js +2 -1
  28. package/dist/lib/options.js.map +2 -2
  29. package/dist/lib/overview-docs/doc-templates.d.ts +51 -0
  30. package/dist/lib/overview-docs/doc-templates.d.ts.map +1 -0
  31. package/dist/lib/overview-docs/doc-templates.js +123 -0
  32. package/dist/lib/overview-docs/doc-templates.js.map +7 -0
  33. package/dist/lib/overview-docs/doc-text-utils.d.ts +86 -0
  34. package/dist/lib/overview-docs/doc-text-utils.d.ts.map +1 -0
  35. package/dist/lib/overview-docs/doc-text-utils.js +108 -0
  36. package/dist/lib/overview-docs/doc-text-utils.js.map +7 -0
  37. package/dist/lib/overview-docs/overview-auth.d.ts +2 -2
  38. package/dist/lib/overview-docs/overview-auth.d.ts.map +1 -1
  39. package/dist/lib/overview-docs/overview-auth.js +34 -52
  40. package/dist/lib/overview-docs/overview-auth.js.map +2 -2
  41. package/dist/lib/overview-docs/overview-docs.d.ts +2 -2
  42. package/dist/lib/overview-docs/overview-docs.d.ts.map +1 -1
  43. package/dist/lib/overview-docs/overview-docs.js.map +1 -1
  44. package/dist/lib/overview-docs/overview-errors.d.ts +2 -2
  45. package/dist/lib/overview-docs/overview-errors.d.ts.map +1 -1
  46. package/dist/lib/overview-docs/overview-errors.js +11 -28
  47. package/dist/lib/overview-docs/overview-errors.js.map +2 -2
  48. package/dist/lib/overview-docs/overview-intro.d.ts +2 -2
  49. package/dist/lib/overview-docs/overview-intro.d.ts.map +1 -1
  50. package/dist/lib/overview-docs/overview-intro.js +41 -36
  51. package/dist/lib/overview-docs/overview-intro.js.map +2 -2
  52. package/dist/lib/overview-docs/overview-pagination.d.ts +2 -2
  53. package/dist/lib/overview-docs/overview-pagination.d.ts.map +1 -1
  54. package/dist/lib/overview-docs/overview-pagination.js +27 -9
  55. package/dist/lib/overview-docs/overview-pagination.js.map +2 -2
  56. package/dist/lib/pagination/pagination.d.ts +2 -2
  57. package/dist/lib/pagination/pagination.d.ts.map +1 -1
  58. package/dist/lib/pagination/pagination.js.map +2 -2
  59. package/dist/lib/security.d.ts +3 -3
  60. package/dist/lib/security.d.ts.map +1 -1
  61. package/dist/lib/security.js.map +2 -2
  62. package/dist/lib/sidebar.d.ts +2 -2
  63. package/dist/lib/sidebar.d.ts.map +1 -1
  64. package/dist/lib/sidebar.js.map +2 -2
  65. package/dist/lib/tune-request-body.d.ts +3 -3
  66. package/dist/lib/tune-request-body.d.ts.map +1 -1
  67. package/dist/lib/tune-request-body.js.map +1 -1
  68. package/dist/lib/tune-response.d.ts +2 -2
  69. package/dist/lib/tune-response.d.ts.map +1 -1
  70. package/dist/lib/tune-response.js.map +1 -1
  71. package/dist/lib/tune.d.ts +3 -3
  72. package/dist/lib/tune.d.ts.map +1 -1
  73. package/dist/lib/tune.js.map +1 -1
  74. package/dist/lib/tune.test.js +2 -2
  75. package/dist/lib/tune.test.js.map +2 -2
  76. package/dist/lib/types.d.ts +3 -2
  77. package/dist/lib/types.d.ts.map +1 -1
  78. package/package.json +2 -2
  79. package/dist/lib/operation.d.ts +0 -4
  80. package/dist/lib/operation.d.ts.map +0 -1
  81. package/dist/lib/operation.js.map +0 -7
  82. package/dist/lib/operation.test.d.ts +0 -2
  83. package/dist/lib/operation.test.d.ts.map +0 -1
  84. package/dist/lib/overview-docs/overview-quick-reference.d.ts +0 -4
  85. package/dist/lib/overview-docs/overview-quick-reference.d.ts.map +0 -1
  86. package/dist/lib/overview-docs/overview-sdk-examples.d.ts +0 -4
  87. package/dist/lib/overview-docs/overview-sdk-examples.d.ts.map +0 -1
  88. package/dist/lib/overview-docs/overview-usage.d.ts +0 -4
  89. package/dist/lib/overview-docs/overview-usage.d.ts.map +0 -1
  90. package/dist/lib/overview-docs.d.ts +0 -4
  91. package/dist/lib/overview-docs.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
1
  import type { NavItem } from '../sidebar.js';
2
- import type { OurOpenAPIObject } from '../types.js';
3
- export declare function generateErrorsOverview(spec: OurOpenAPIObject): NavItem;
2
+ import type { IR } from '../types.js';
3
+ export declare function generateErrorsOverview(spec: IR): NavItem;
4
4
  //# sourceMappingURL=overview-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overview-errors.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-errors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA6GpD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAyFtE"}
1
+ {"version":3,"file":"overview-errors.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-errors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAsGtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAwExD"}
@@ -1,11 +1,8 @@
1
- import { resolveRef } from "@sdk-it/core";
1
+ import { distillRef } from "@sdk-it/core";
2
2
  import { forEachOperation } from "../for-each-operation.js";
3
3
  import { isErrorStatusCode } from "../is.js";
4
- function resolveSchema(spec, schema) {
5
- return resolveRef(spec, schema);
6
- }
7
4
  function formatSchemaForDisplay(spec, schema) {
8
- const resolvedSchema = resolveSchema(spec, schema);
5
+ const resolvedSchema = distillRef(spec, schema);
9
6
  return `\`\`\`json
10
7
  ${JSON.stringify(resolvedSchema, null, 2)}
11
8
  \`\`\``;
@@ -62,10 +59,6 @@ function generateErrorsOverview(spec) {
62
59
  markdown.push(
63
60
  `This API uses conventional HTTP response codes to indicate the success or failure of an API request.`
64
61
  );
65
- markdown.push(`## Official API Clients`);
66
- markdown.push(
67
- `Vellum maintains official API clients for Python, Node/Typescript, and Go. We recommend using these clients to interact with all stable endpoints. You can find them here:`
68
- );
69
62
  markdown.push(`## HTTP Status Codes`);
70
63
  forEachOperation(spec, (entry, operation) => {
71
64
  if (operation.responses) {
@@ -76,20 +69,19 @@ function generateErrorsOverview(spec) {
76
69
  const content = response.content;
77
70
  if (content?.["application/json"]?.schema) {
78
71
  const key = `${statusCode}`;
79
- const operationId = `${entry.method.toUpperCase()} ${entry.path}`;
80
- if (!errorSchemas.has(key)) {
72
+ if (errorSchemas.has(key)) {
73
+ const existing = errorSchemas.get(key);
74
+ if (existing && !existing.operations.includes(operation.operationId)) {
75
+ existing.operations.push(operation.operationId);
76
+ }
77
+ } else {
81
78
  errorSchemas.set(key, {
82
79
  statusCode,
83
80
  title: response.description || `${statusCode} Error`,
84
81
  description: response.description,
85
82
  schema: content["application/json"].schema,
86
- operations: [operationId]
83
+ operations: [operation.operationId]
87
84
  });
88
- } else {
89
- const existing = errorSchemas.get(key);
90
- if (existing && !existing.operations.includes(operationId)) {
91
- existing.operations.push(operationId);
92
- }
93
85
  }
94
86
  }
95
87
  }
@@ -106,17 +98,8 @@ function generateErrorsOverview(spec) {
106
98
  } else {
107
99
  for (const error of errors) {
108
100
  markdown.push(`### ${error.statusCode} - ${error.title}`);
109
- const description = error.description || getStatusDescription(error.statusCode);
110
- if (description) {
111
- markdown.push(description);
112
- }
113
- if (error.operations.length > 0) {
114
- const operationsList = [`**Used by operations:**`];
115
- for (const operation of error.operations) {
116
- operationsList.push(`- \`${operation}\``);
117
- }
118
- markdown.push(operationsList.join("\n"));
119
- }
101
+ const description = error.description || getStatusDescription(error.statusCode) || "";
102
+ markdown.push(description);
120
103
  if (error.schema) {
121
104
  markdown.push(`**Response Schema:**`);
122
105
  markdown.push(formatSchemaForDisplay(spec, error.schema));
@@ -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 { resolveRef } 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 resolveSchema(\n spec: OurOpenAPIObject,\n schema: SchemaObject | ReferenceObject,\n): SchemaObject {\n return resolveRef<SchemaObject>(spec, schema);\n}\n\nfunction formatSchemaForDisplay(\n spec: OurOpenAPIObject,\n schema: SchemaObject | ReferenceObject,\n): string {\n const resolvedSchema = resolveSchema(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 markdown.push(`## Official API Clients`);\n markdown.push(\n `Vellum maintains official API clients for Python, Node/Typescript, and Go. We recommend using these clients to interact with all stable endpoints. You can find them here:`,\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 const operationId = `${entry.method.toUpperCase()} ${entry.path}`;\n\n if (!errorSchemas.has(key)) {\n errorSchemas.set(key, {\n statusCode,\n title: response.description || `${statusCode} Error`,\n description: response.description,\n schema: content['application/json'].schema as\n | SchemaObject\n | ReferenceObject,\n operations: [operationId],\n });\n } else {\n // Add this operation to the existing error schema\n const existing = errorSchemas.get(key);\n if (existing && !existing.operations.includes(operationId)) {\n existing.operations.push(operationId);\n }\n }\n }\n }\n }\n }\n });\n\n // Then sort and generate documentation\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 if (description) {\n markdown.push(description);\n }\n\n // Show which operations return this error\n if (error.operations.length > 0) {\n const operationsList = [`**Used by operations:**`];\n for (const operation of error.operations) {\n operationsList.push(`- \\`${operation}\\``);\n }\n markdown.push(operationsList.join('\\n'));\n }\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,cACP,MACA,QACc;AACd,SAAO,WAAyB,MAAM,MAAM;AAC9C;AAEA,SAAS,uBACP,MACA,QACQ;AACR,QAAM,iBAAiB,cAAc,MAAM,MAAM;AAEjD,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,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ceObject, 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,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,I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AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,SAAS,MAAM,KAAK,aAAa,OAAO,CAAC,EAAE;AAAA,IAC/C,CAAC,GAAG,MAAM,SAAS,EAAE,UAAU,IAAI,SAAS,EAAE,UAAU;AAAA,EAC1D;AAEA,MAAI,OAAO,WAAW,GAAG;AACvB,aAAS;AAAA,MACP;AAAA,IACF;AAAA,EACF,OAAO;AACL,eAAW,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;",
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 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":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,aAAa,WAAiB,GAC7B,OAAO,CAgFT"}
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,13 +1,11 @@
1
- import { forEachOperation } from "../for-each-operation.js";
2
- function generateIntroOverview(spec, availablesdks = ["typescript"]) {
1
+ import {
2
+ getClientIntroText,
3
+ getTextByCount,
4
+ presetDocs
5
+ } from "./doc-text-utils.js";
6
+ function generateIntroOverview(spec, availablesdks) {
3
7
  const info = spec.info;
4
8
  const markdown = [];
5
- const tags = /* @__PURE__ */ new Set();
6
- const methods = /* @__PURE__ */ new Set();
7
- forEachOperation(spec, (entry) => {
8
- tags.add(entry.tag);
9
- methods.add(entry.method.toUpperCase());
10
- });
11
9
  if (spec.info.title) {
12
10
  markdown.push(`# ${spec.info.title || "API Reference"}
13
11
  `);
@@ -18,11 +16,22 @@ function generateIntroOverview(spec, availablesdks = ["typescript"]) {
18
16
  }
19
17
  if (spec.info.version) {
20
18
  markdown.push(`**Version:** ${spec.info.version}
19
+ `);
20
+ }
21
+ if (info.license) {
22
+ let licenseString = `**License:** ${info.license.name}`;
23
+ if (info.license.url) {
24
+ licenseString += ` ([${info.license.url}](${info.license.url}))`;
25
+ }
26
+ markdown.push(`${licenseString}
21
27
  `);
22
28
  }
23
29
  if (spec.servers && spec.servers.length > 0) {
24
- markdown.push(`## API Servers`);
25
- markdown.push(`The following servers are available for this API:`);
30
+ const serverCount = spec.servers.length;
31
+ markdown.push(
32
+ `## ${getTextByCount(serverCount, presetDocs.server.section)}`
33
+ );
34
+ markdown.push(getTextByCount(serverCount, presetDocs.server.description));
26
35
  markdown.push("");
27
36
  for (const server of spec.servers) {
28
37
  let serverLine = `- **${server.url}**`;
@@ -33,36 +42,32 @@ function generateIntroOverview(spec, availablesdks = ["typescript"]) {
33
42
  }
34
43
  markdown.push("");
35
44
  }
36
- if (info.contact) {
37
- markdown.push(`## Contact`);
38
- if (info.contact.name) {
39
- markdown.push(`**Name:** ${info.contact.name}`);
40
- }
41
- if (info.contact.email) {
42
- markdown.push(`**Email:** ${info.contact.email}`);
43
- }
44
- if (info.contact.url) {
45
- markdown.push(`**URL:** ${info.contact.url}`);
46
- }
47
- }
48
- if (info.license) {
49
- markdown.push(`## License`);
50
- if (info.license.name) {
51
- let licenseString = `**License:** ${info.license.name}`;
52
- if (info.license.url) {
53
- licenseString += ` ([${info.license.url}](${info.license.url}))`;
54
- }
55
- markdown.push(licenseString);
56
- }
57
- }
58
- markdown.push(`## Official API Clients`);
59
- markdown.push(
60
- `${info.title || "This API"} provides official client SDKs for multiple programming languages. We recommend using these clients to interact with all stable endpoints. You can find them here:`
61
- );
45
+ const sdkCount = availablesdks.length;
46
+ markdown.push(`## ${getTextByCount(sdkCount, presetDocs.client.section)}`);
47
+ markdown.push(getClientIntroText(info.title || "This API", sdkCount));
62
48
  for (const link of availablesdks) {
63
49
  const sdkName = link.replace("/", "").replace("-sdk", "").toUpperCase();
64
50
  markdown.push(`- [${sdkName} SDK](${link})`);
65
51
  }
52
+ const hasSupportInfo = info.contact?.email || info.contact?.url || spec.externalDocs?.url && spec.externalDocs?.description?.toLowerCase().includes("support");
53
+ if (hasSupportInfo) {
54
+ markdown.push(`## Need Help?`);
55
+ if (info.contact?.email) {
56
+ markdown.push(
57
+ `For support, reach out to us at [${info.contact.email}](mailto:${info.contact.email}).`
58
+ );
59
+ }
60
+ if (info.contact?.url) {
61
+ markdown.push(
62
+ `Visit our support page: [${info.contact.url}](${info.contact.url})`
63
+ );
64
+ }
65
+ if (spec.externalDocs?.url && spec.externalDocs?.description?.toLowerCase().includes("support")) {
66
+ markdown.push(
67
+ `For additional support, visit our [${spec.externalDocs.description}](${spec.externalDocs.url}).`
68
+ );
69
+ }
70
+ }
66
71
  return {
67
72
  id: "generated-introduction",
68
73
  title: "Introduction",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-intro.ts"],
4
- "sourcesContent": ["import { forEachOperation } from '../for-each-operation.js';\nimport type { NavItem } from '../sidebar.js';\nimport type { OurOpenAPIObject } from '../types.js';\n\nexport function generateIntroOverview(\n spec: OurOpenAPIObject,\n availablesdks = ['typescript'],\n): NavItem {\n const info = spec.info;\n const markdown: string[] = [];\n\n const tags = new Set<string>();\n const methods = new Set<string>();\n\n forEachOperation(spec, (entry) => {\n tags.add(entry.tag);\n methods.add(entry.method.toUpperCase());\n });\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 (spec.servers && spec.servers.length > 0) {\n markdown.push(`## API Servers`);\n markdown.push(`The following servers are available for this API:`);\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 if (info.contact) {\n markdown.push(`## Contact`);\n if (info.contact.name) {\n markdown.push(`**Name:** ${info.contact.name}`);\n }\n if (info.contact.email) {\n markdown.push(`**Email:** ${info.contact.email}`);\n }\n if (info.contact.url) {\n markdown.push(`**URL:** ${info.contact.url}`);\n }\n }\n\n if (info.license) {\n markdown.push(`## License`);\n if (info.license.name) {\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 markdown.push(`## Official API Clients`);\n markdown.push(\n `${info.title || 'This API'} provides official client SDKs for multiple programming languages. We recommend using these clients to interact with all stable endpoints. You can find them here:`,\n );\n\n for (const link of availablesdks) {\n const sdkName = link.replace('/', '').replace('-sdk', '').toUpperCase();\n markdown.push(`- [${sdkName} SDK](${link})`);\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
- "mappings": "AAAA,SAAS,wBAAwB;AAI1B,SAAS,sBACd,MACA,gBAAgB,CAAC,YAAY,GACpB;AACT,QAAM,OAAO,KAAK;AAClB,QAAM,WAAqB,CAAC;AAE5B,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,UAAU,oBAAI,IAAY;AAEhC,mBAAiB,MAAM,CAAC,UAAU;AAChC,SAAK,IAAI,MAAM,GAAG;AAClB,YAAQ,IAAI,MAAM,OAAO,YAAY,CAAC;AAAA,EACxC,CAAC;AAED,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,WAAW,KAAK,QAAQ,SAAS,GAAG;AAC3C,aAAS,KAAK,gBAAgB;AAC9B,aAAS,KAAK,mDAAmD;AACjE,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,MAAI,KAAK,SAAS;AAChB,aAAS,KAAK,YAAY;AAC1B,QAAI,KAAK,QAAQ,MAAM;AACrB,eAAS,KAAK,aAAa,KAAK,QAAQ,IAAI,EAAE;AAAA,IAChD;AACA,QAAI,KAAK,QAAQ,OAAO;AACtB,eAAS,KAAK,cAAc,KAAK,QAAQ,KAAK,EAAE;AAAA,IAClD;AACA,QAAI,KAAK,QAAQ,KAAK;AACpB,eAAS,KAAK,YAAY,KAAK,QAAQ,GAAG,EAAE;AAAA,IAC9C;AAAA,EACF;AAEA,MAAI,KAAK,SAAS;AAChB,aAAS,KAAK,YAAY;AAC1B,QAAI,KAAK,QAAQ,MAAM;AACrB,UAAI,gBAAgB,gBAAgB,KAAK,QAAQ,IAAI;AACrD,UAAI,KAAK,QAAQ,KAAK;AACpB,yBAAiB,MAAM,KAAK,QAAQ,GAAG,KAAK,KAAK,QAAQ,GAAG;AAAA,MAC9D;AACA,eAAS,KAAK,aAAa;AAAA,IAC7B;AAAA,EACF;AAEA,WAAS,KAAK,yBAAyB;AACvC,WAAS;AAAA,IACP,GAAG,KAAK,SAAS,UAAU;AAAA,EAC7B;AAEA,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;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 { 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
+ "mappings": "AA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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].schema;\n }\n }\n return undefined;\n}\n"],
5
+ "mappings": "AAMA,SAAS,WAAW,aAAa;AAGjC,SAAS,uBAAuB;AAEzB,SAAS,aAAa,MAAU,gBAAsC;AAC3E,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;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,12 @@
1
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;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,MAAwB;AAC/C,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;",
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,UAC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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,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;AAEzC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,eA8B/C"}
1
+ {"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/lib/sidebar.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAErC,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,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;AAEzC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,EAAE,eA8BjC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "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,SAAS,gBACd,MACA,aACA,WACA,YACA,UACsB;AACtB,QAAM,YAAY,qBAAqB,MAAM,aAAa;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,cAAc,MAAM,UAAU,WAAW,IAC3C,U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