@sdk-it/spec 0.46.11 → 0.47.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 (176) hide show
  1. package/README.md +8 -4
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +2 -1
  5. package/dist/index.js.map +2 -2
  6. package/dist/lib/external-documents.d.ts +4 -1
  7. package/dist/lib/external-documents.d.ts.map +1 -1
  8. package/dist/lib/external-documents.js +27 -20
  9. package/dist/lib/external-documents.js.map +2 -2
  10. package/dist/lib/finalize-operations.d.ts +8 -0
  11. package/dist/lib/finalize-operations.d.ts.map +1 -0
  12. package/dist/lib/finalize-operations.js +134 -0
  13. package/dist/lib/finalize-operations.js.map +7 -0
  14. package/dist/lib/find-polymorphic-varients.d.ts.map +1 -1
  15. package/dist/lib/find-polymorphic-varients.js +3 -2
  16. package/dist/lib/find-polymorphic-varients.js.map +2 -2
  17. package/dist/lib/find-unique-schema-name.d.ts.map +1 -1
  18. package/dist/lib/for-each-operation.d.ts +3 -2
  19. package/dist/lib/for-each-operation.d.ts.map +1 -1
  20. package/dist/lib/for-each-operation.js +9 -4
  21. package/dist/lib/for-each-operation.js.map +2 -2
  22. package/dist/lib/format-name.d.ts.map +1 -1
  23. package/dist/lib/get-ref-usage.d.ts.map +1 -1
  24. package/dist/lib/get-ref-usage.js +1 -2
  25. package/dist/lib/get-ref-usage.js.map +2 -2
  26. package/dist/lib/guess/guess-resource.d.ts.map +1 -1
  27. package/dist/lib/guess/guess-resource.js +4 -4
  28. package/dist/lib/guess/guess-resource.js.map +2 -2
  29. package/dist/lib/ir.d.ts +2 -2
  30. package/dist/lib/ir.d.ts.map +1 -1
  31. package/dist/lib/ir.js +5 -3
  32. package/dist/lib/ir.js.map +2 -2
  33. package/dist/lib/is-primitive-schema.d.ts +12 -0
  34. package/dist/lib/is-primitive-schema.d.ts.map +1 -1
  35. package/dist/lib/is-primitive-schema.js +34 -1
  36. package/dist/lib/is-primitive-schema.js.map +2 -2
  37. package/dist/lib/is.d.ts +10 -1
  38. package/dist/lib/is.d.ts.map +1 -1
  39. package/dist/lib/is.js +20 -9
  40. package/dist/lib/is.js.map +2 -2
  41. package/dist/lib/loaders/load-spec.d.ts +9 -2
  42. package/dist/lib/loaders/load-spec.d.ts.map +1 -1
  43. package/dist/lib/loaders/load-spec.js +15 -20
  44. package/dist/lib/loaders/load-spec.js.map +2 -2
  45. package/dist/lib/loaders/local-loader.d.ts.map +1 -1
  46. package/dist/lib/loaders/postman/postman-converter.d.ts +1 -1
  47. package/dist/lib/loaders/postman/postman-converter.d.ts.map +1 -1
  48. package/dist/lib/loaders/postman/postman-converter.js +2 -3
  49. package/dist/lib/loaders/postman/postman-converter.js.map +2 -2
  50. package/dist/lib/loaders/postman/spec-types.d.ts.map +1 -1
  51. package/dist/lib/loaders/remote-loader.d.ts.map +1 -1
  52. package/dist/lib/loaders/remote-loader.js +4 -3
  53. package/dist/lib/loaders/remote-loader.js.map +2 -2
  54. package/dist/lib/metadata.d.ts +3 -9
  55. package/dist/lib/metadata.d.ts.map +1 -1
  56. package/dist/lib/metadata.js +22 -17
  57. package/dist/lib/metadata.js.map +2 -2
  58. package/dist/lib/operation-input.d.ts +33 -0
  59. package/dist/lib/operation-input.d.ts.map +1 -0
  60. package/dist/lib/operation-input.js +189 -0
  61. package/dist/lib/operation-input.js.map +7 -0
  62. package/dist/lib/options.d.ts +5 -6
  63. package/dist/lib/options.d.ts.map +1 -1
  64. package/dist/lib/options.js +0 -6
  65. package/dist/lib/options.js.map +2 -2
  66. package/dist/lib/overview-docs/doc-text-utils.d.ts +13 -13
  67. package/dist/lib/overview-docs/doc-text-utils.d.ts.map +1 -1
  68. package/dist/lib/overview-docs/overview-auth.d.ts.map +1 -1
  69. package/dist/lib/overview-docs/overview-auth.js.map +2 -2
  70. package/dist/lib/overview-docs/overview-docs.d.ts.map +1 -1
  71. package/dist/lib/overview-docs/overview-errors.d.ts.map +1 -1
  72. package/dist/lib/overview-docs/overview-errors.js +8 -5
  73. package/dist/lib/overview-docs/overview-errors.js.map +2 -2
  74. package/dist/lib/overview-docs/overview-page.d.ts.map +1 -1
  75. package/dist/lib/overview-docs/overview-page.js +2 -3
  76. package/dist/lib/overview-docs/overview-page.js.map +2 -2
  77. package/dist/lib/overview-docs/overview-pagination.d.ts.map +1 -1
  78. package/dist/lib/overview-docs/overview-sdks.d.ts.map +1 -1
  79. package/dist/lib/overview-docs/overview-sdks.js +2 -1
  80. package/dist/lib/overview-docs/overview-sdks.js.map +2 -2
  81. package/dist/lib/overview-docs/types.d.ts.map +1 -1
  82. package/dist/lib/overview-docs/types.js +1 -1
  83. package/dist/lib/overview-docs/types.js.map +2 -2
  84. package/dist/lib/pagination/guess-pagination.d.ts.map +1 -1
  85. package/dist/lib/pagination/guess-pagination.js.map +2 -2
  86. package/dist/lib/pagination/pagination-result.d.ts +3 -3
  87. package/dist/lib/pagination/pagination-result.d.ts.map +1 -1
  88. package/dist/lib/pagination/pagination-result.js +6 -3
  89. package/dist/lib/pagination/pagination-result.js.map +2 -2
  90. package/dist/lib/pagination/pagination.d.ts +31 -1
  91. package/dist/lib/pagination/pagination.d.ts.map +1 -1
  92. package/dist/lib/pagination/pagination.js +30 -11
  93. package/dist/lib/pagination/pagination.js.map +2 -2
  94. package/dist/lib/processing-plugins/bundle-external-refs.d.ts +13 -6
  95. package/dist/lib/processing-plugins/bundle-external-refs.d.ts.map +1 -1
  96. package/dist/lib/processing-plugins/bundle-external-refs.js +33 -18
  97. package/dist/lib/processing-plugins/bundle-external-refs.js.map +2 -2
  98. package/dist/lib/processing-plugins/canonicalize-spec.d.ts +2 -2
  99. package/dist/lib/processing-plugins/canonicalize-spec.d.ts.map +1 -1
  100. package/dist/lib/processing-plugins/canonicalize-spec.js.map +2 -2
  101. package/dist/lib/processing-plugins/create-default-processing-plugins.d.ts +4 -3
  102. package/dist/lib/processing-plugins/create-default-processing-plugins.d.ts.map +1 -1
  103. package/dist/lib/processing-plugins/create-default-processing-plugins.js +8 -3
  104. package/dist/lib/processing-plugins/create-default-processing-plugins.js.map +2 -2
  105. package/dist/lib/processing-plugins/enrich-examples.d.ts +4 -4
  106. package/dist/lib/processing-plugins/enrich-examples.d.ts.map +1 -1
  107. package/dist/lib/processing-plugins/enrich-examples.js +1 -1
  108. package/dist/lib/processing-plugins/enrich-examples.js.map +2 -2
  109. package/dist/lib/processing-plugins/extract-inline-schemas.d.ts +2 -2
  110. package/dist/lib/processing-plugins/extract-inline-schemas.d.ts.map +1 -1
  111. package/dist/lib/processing-plugins/extract-inline-schemas.js.map +2 -2
  112. package/dist/lib/processing-plugins/extract-overview-docs.d.ts +2 -2
  113. package/dist/lib/processing-plugins/extract-overview-docs.d.ts.map +1 -1
  114. package/dist/lib/processing-plugins/extract-overview-docs.js +4 -1
  115. package/dist/lib/processing-plugins/extract-overview-docs.js.map +2 -2
  116. package/dist/lib/processing-plugins/index.d.ts.map +1 -1
  117. package/dist/lib/processing-plugins/infer-pagination.d.ts +2 -2
  118. package/dist/lib/processing-plugins/infer-pagination.d.ts.map +1 -1
  119. package/dist/lib/processing-plugins/infer-pagination.js +5 -6
  120. package/dist/lib/processing-plugins/infer-pagination.js.map +2 -2
  121. package/dist/lib/processing-plugins/normalize-operation-ids.d.ts +2 -2
  122. package/dist/lib/processing-plugins/normalize-operation-ids.d.ts.map +1 -1
  123. package/dist/lib/processing-plugins/normalize-operation-ids.js.map +2 -2
  124. package/dist/lib/processing-plugins/normalize-parameters.d.ts +2 -2
  125. package/dist/lib/processing-plugins/normalize-parameters.d.ts.map +1 -1
  126. package/dist/lib/processing-plugins/normalize-parameters.js.map +2 -2
  127. package/dist/lib/processing-plugins/normalize-paths.d.ts +2 -2
  128. package/dist/lib/processing-plugins/normalize-paths.d.ts.map +1 -1
  129. package/dist/lib/processing-plugins/normalize-paths.js.map +2 -2
  130. package/dist/lib/processing-plugins/normalize-request-bodies.d.ts +9 -3
  131. package/dist/lib/processing-plugins/normalize-request-bodies.d.ts.map +1 -1
  132. package/dist/lib/processing-plugins/normalize-request-bodies.js +36 -15
  133. package/dist/lib/processing-plugins/normalize-request-bodies.js.map +2 -2
  134. package/dist/lib/processing-plugins/normalize-responses.d.ts +2 -2
  135. package/dist/lib/processing-plugins/normalize-responses.d.ts.map +1 -1
  136. package/dist/lib/processing-plugins/normalize-responses.js +11 -15
  137. package/dist/lib/processing-plugins/normalize-responses.js.map +2 -2
  138. package/dist/lib/processing-plugins/normalize-schemas.d.ts +2 -2
  139. package/dist/lib/processing-plugins/normalize-schemas.d.ts.map +1 -1
  140. package/dist/lib/processing-plugins/normalize-schemas.js +14 -4
  141. package/dist/lib/processing-plugins/normalize-schemas.js.map +2 -2
  142. package/dist/lib/processing-plugins/normalize-security.d.ts +2 -2
  143. package/dist/lib/processing-plugins/normalize-security.d.ts.map +1 -1
  144. package/dist/lib/processing-plugins/normalize-security.js +6 -5
  145. package/dist/lib/processing-plugins/normalize-security.js.map +2 -2
  146. package/dist/lib/processing-plugins/normalize-tags.d.ts +8 -2
  147. package/dist/lib/processing-plugins/normalize-tags.d.ts.map +1 -1
  148. package/dist/lib/processing-plugins/normalize-tags.js +35 -1
  149. package/dist/lib/processing-plugins/normalize-tags.js.map +2 -2
  150. package/dist/lib/processing-plugins/resolve-security-scheme-uris.d.ts +13 -2
  151. package/dist/lib/processing-plugins/resolve-security-scheme-uris.d.ts.map +1 -1
  152. package/dist/lib/processing-plugins/resolve-security-scheme-uris.js +58 -38
  153. package/dist/lib/processing-plugins/resolve-security-scheme-uris.js.map +2 -2
  154. package/dist/lib/processing.d.ts +25 -11
  155. package/dist/lib/processing.d.ts.map +1 -1
  156. package/dist/lib/processing.js +53 -16
  157. package/dist/lib/processing.js.map +2 -2
  158. package/dist/lib/reserved-keywords.d.ts.map +1 -1
  159. package/dist/lib/sidebar.d.ts +5 -4
  160. package/dist/lib/sidebar.d.ts.map +1 -1
  161. package/dist/lib/sidebar.js +46 -23
  162. package/dist/lib/sidebar.js.map +2 -2
  163. package/dist/lib/tag.d.ts.map +1 -1
  164. package/dist/lib/types.d.ts +34 -12
  165. package/dist/lib/types.d.ts.map +1 -1
  166. package/dist/lib/types.js +11 -0
  167. package/dist/lib/types.js.map +3 -3
  168. package/dist/lib/walk-schemas.d.ts +4 -2
  169. package/dist/lib/walk-schemas.d.ts.map +1 -1
  170. package/dist/lib/walk-schemas.js +15 -13
  171. package/dist/lib/walk-schemas.js.map +2 -2
  172. package/package.json +17 -6
  173. package/dist/lib/create-operation.d.ts +0 -28
  174. package/dist/lib/create-operation.d.ts.map +0 -1
  175. package/dist/lib/create-operation.js +0 -62
  176. package/dist/lib/create-operation.js.map +0 -7
@@ -1,14 +1,13 @@
1
1
  import type { OperationObject } from 'openapi3-ts/oas31';
2
2
  import { type OpenAPIDocument } from '@sdk-it/core';
3
- import type { ProcessingDiagnostic, ProcessingPlugin } from './processing.js';
4
- import type { IR } from './types.js';
3
+ import type { ProcessingDiagnostic } from './processing.js';
4
+ import type { ProcessingDocument } from './types.js';
5
5
  export interface GenerateSdkConfig {
6
6
  spec: OpenAPIDocument;
7
7
  responses?: ResponsesConfig;
8
8
  pagination?: PaginationConfig | false;
9
9
  operationId?: (operation: OperationObject, path: string, method: string) => string;
10
10
  tag?: (operation: OperationObject, path: string) => string;
11
- plugins?: readonly ProcessingPlugin[];
12
11
  signal?: AbortSignal;
13
12
  onDiagnostic?: (diagnostic: ProcessingDiagnostic) => void;
14
13
  }
@@ -27,10 +26,10 @@ export declare function coeraceConfig(config: GenerateSdkConfig): {
27
26
  };
28
27
  responses: ResponsesConfig;
29
28
  docs: {
30
- entries: unknown;
31
- sdks: unknown;
29
+ entries: any;
30
+ sdks: any;
32
31
  };
33
- spec: IR;
32
+ spec: ProcessingDocument;
34
33
  operationId: (operation: OperationObject, path: string, method: string) => string;
35
34
  tag: (operation: OperationObject, path: string) => string;
36
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../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CAAC,CAkBxD,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB;;;;;;;QA4BjD,OAAO;QACP,IAAI;;;6BArEK,eAAe,QACpB,MAAM,UACJ,MAAM,KACX,MAAM;qBACO,eAAe,QAAQ,MAAM,KAAK,MAAM;EAuE3D;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,KAAK;;;EAmB9C"}
@@ -37,12 +37,6 @@ function coeraceConfig(config) {
37
37
  paths: config.spec.paths ?? {},
38
38
  "x-docs": [],
39
39
  "x-sdks": [],
40
- "x-tagGroups": config.spec["x-tagGroups"] ?? [
41
- {
42
- name: "API",
43
- tags: config.spec.tags?.map((tag) => tag.name) ?? []
44
- }
45
- ],
46
40
  servers: config.spec.servers ?? [],
47
41
  tags: config.spec.tags ?? []
48
42
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/options.ts"],
4
- "sourcesContent": ["import type { OperationObject } from 'openapi3-ts/oas31';\n\nimport {\n type OpenAPIDocument,\n type OpenAPISecuritySchemeObject,\n camelcase,\n resolveRef,\n} from '@sdk-it/core';\n\nimport type { ProcessingDiagnostic, ProcessingPlugin } from './processing.js';\nimport { determineGenericTag, sanitizeTag } from './tag.js';\nimport type { IR } from './types.js';\n\nexport interface GenerateSdkConfig {\n spec: OpenAPIDocument;\n responses?: ResponsesConfig;\n pagination?: PaginationConfig | false;\n operationId?: (\n operation: OperationObject,\n path: string,\n method: string,\n ) => string;\n tag?: (operation: OperationObject, path: string) => string;\n plugins?: readonly ProcessingPlugin[];\n signal?: AbortSignal;\n onDiagnostic?: (diagnostic: ProcessingDiagnostic) => void;\n}\nexport interface ResponsesConfig {\n flattenErrorResponses?: boolean;\n}\n\nexport type PaginationConfig = {\n guess?: boolean;\n};\nexport function cleanOperationId(operationId: string) {\n return camelcase(operationId.split('#').pop()!);\n}\n\nexport const defaults: Partial<GenerateSdkConfig> &\n Required<Pick<GenerateSdkConfig, 'operationId' | 'tag'>> = {\n operationId: (operation, path, method) => {\n if (operation.operationId) {\n return cleanOperationId(operation.operationId);\n }\n\n return camelcase(\n [method, ...path.replace(/[\\\\/\\\\{\\\\}]/g, ' ').split(' ')]\n .filter(Boolean)\n .join(' ')\n .trim(),\n );\n },\n tag: (operation, path) => {\n return operation.tags?.[0]\n ? sanitizeTag(operation.tags?.[0])\n : determineGenericTag(path, operation);\n },\n};\n\nexport function coeraceConfig(config: GenerateSdkConfig) {\n const spec: IR = {\n ...config.spec,\n components: {\n ...config.spec.components,\n schemas: config.spec.components?.schemas ?? {},\n securitySchemes: Object.fromEntries(\n Object.entries(config.spec.components?.securitySchemes ?? {}).map(\n ([name, schema]) => [\n name,\n resolveRef<OpenAPISecuritySchemeObject>(config.spec, schema),\n ],\n ),\n ),\n },\n paths: config.spec.paths ?? {},\n 'x-docs': [],\n 'x-sdks': [],\n 'x-tagGroups': config.spec['x-tagGroups'] ?? [\n {\n name: 'API',\n tags: config.spec.tags?.map((tag) => tag.name) ?? [],\n },\n ],\n servers: config.spec.servers ?? [],\n tags: config.spec.tags ?? [],\n };\n\n return {\n pagination: coercePaginationConfig(config.pagination),\n responses: config.responses ?? {},\n // Authored `x-docs` / `x-sdks` change shape during processing, so they are\n // handed to the overview plugin as raw input instead of living on the IR.\n docs: {\n entries: config.spec['x-docs'] as unknown,\n sdks: config.spec['x-sdks'] as unknown,\n },\n spec,\n operationId: config.operationId ?? defaults.operationId,\n tag: config.tag ?? defaults.tag,\n };\n}\n\nexport function coercePaginationConfig(\n options: PaginationConfig | undefined | false,\n) {\n if (options === undefined) {\n return {\n guess: true,\n enabled: true,\n };\n }\n if (options === false) {\n return {\n enabled: false,\n guess: false,\n };\n }\n // If options is true, we assume pagination is enabled with guessing\n return {\n guess: options.guess ?? true,\n enabled: true,\n };\n}\n"],
5
- "mappings": "AAEA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAGP,SAAS,qBAAqB,m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AAA,IACjC,MAAM,OAAO,KAAK,QAAQ,CAAC;AAAA,EAC7B;AAEA,SAAO;AAAA,IACL,YAAY,uBAAuB,OAAO,UAAU;AAAA,IACpD,WAAW,OAAO,aAAa,CAAC;AAAA;AAAA;AAAA,IAGhC,MAAM;AAAA,MACJ,SAAS,OAAO,KAAK,QAAQ;AAAA,MAC7B,MAAM,OAAO,KAAK,QAAQ;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,aAAa,OAAO,eAAe,SAAS;AAAA,IAC5C,KAAK,OAAO,OAAO,SAAS;AAAA,EAC9B;AACF;AAEO,SAAS,uBACd,SACA;AACA,MAAI,YAAY,QAAW;AACzB,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AACA,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,QAAQ,SAAS;AAAA,IACxB,SAAS;AAAA,EACX;AACF;",
4
+ "sourcesContent": ["import type { OperationObject } from 'openapi3-ts/oas31';\n\nimport {\n type OpenAPIDocument,\n type OpenAPISecuritySchemeObject,\n camelcase,\n resolveRef,\n} from '@sdk-it/core';\n\nimport type { ProcessingDiagnostic } from './processing.js';\nimport { determineGenericTag, sanitizeTag } from './tag.js';\nimport type { ProcessingDocument } from './types.js';\n\nexport interface GenerateSdkConfig {\n spec: OpenAPIDocument;\n responses?: ResponsesConfig;\n pagination?: PaginationConfig | false;\n operationId?: (\n operation: OperationObject,\n path: string,\n method: string,\n ) => string;\n tag?: (operation: OperationObject, path: string) => string;\n signal?: AbortSignal;\n onDiagnostic?: (diagnostic: ProcessingDiagnostic) => void;\n}\nexport interface ResponsesConfig {\n flattenErrorResponses?: boolean;\n}\n\nexport type PaginationConfig = {\n guess?: boolean;\n};\nexport function cleanOperationId(operationId: string) {\n return camelcase(operationId.split('#').pop()!);\n}\n\nexport const defaults: Partial<GenerateSdkConfig> &\n Required<Pick<GenerateSdkConfig, 'operationId' | 'tag'>> = {\n operationId: (operation, path, method) => {\n if (operation.operationId) {\n return cleanOperationId(operation.operationId);\n }\n\n return camelcase(\n [method, ...path.replace(/[\\\\/\\\\{\\\\}]/g, ' ').split(' ')]\n .filter(Boolean)\n .join(' ')\n .trim(),\n );\n },\n tag: (operation, path) => {\n return operation.tags?.[0]\n ? sanitizeTag(operation.tags?.[0])\n : determineGenericTag(path, operation);\n },\n};\n\nexport function coeraceConfig(config: GenerateSdkConfig) {\n const spec: ProcessingDocument = {\n ...config.spec,\n components: {\n ...config.spec.components,\n schemas: config.spec.components?.schemas ?? {},\n securitySchemes: Object.fromEntries(\n Object.entries(config.spec.components?.securitySchemes ?? {}).map(\n ([name, schema]) => [\n name,\n resolveRef<OpenAPISecuritySchemeObject>(config.spec, schema),\n ],\n ),\n ),\n },\n paths: config.spec.paths ?? {},\n 'x-docs': [],\n 'x-sdks': [],\n servers: config.spec.servers ?? [],\n tags: config.spec.tags ?? [],\n };\n\n return {\n pagination: coercePaginationConfig(config.pagination),\n responses: config.responses ?? {},\n // Authored `x-docs` / `x-sdks` change shape during processing, so they are\n // handed to the overview plugin as raw input instead of living on the IR.\n docs: {\n entries: config.spec['x-docs'],\n sdks: config.spec['x-sdks'],\n },\n spec,\n operationId: config.operationId ?? defaults.operationId,\n tag: config.tag ?? defaults.tag,\n };\n}\n\nexport function coercePaginationConfig(\n options: PaginationConfig | undefined | false,\n) {\n if (options === undefined) {\n return {\n guess: true,\n enabled: true,\n };\n }\n if (options === false) {\n return {\n enabled: false,\n guess: false,\n };\n }\n // If options is true, we assume pagination is enabled with guessing\n return {\n guess: options.guess ?? true,\n enabled: true,\n };\n}\n"],
5
+ "mappings": "AAEA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAGP,SAAS,qBAAqB,mBAAmB;AAuB1C,SAAS,iBAAiB,aAAqB;AACpD,SAAO,UAAU,YAAY,MAAM,GAAG,EAAE,IAAI,CAAE;AA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AAA,IACA;AAAA,IACA,aAAa,OAAO,eAAe,SAAS;AAAA,IAC5C,KAAK,OAAO,OAAO,SAAS;AAAA,EAC9B;AACF;AAEO,SAAS,uBACd,SACA;AACA,MAAI,YAAY,QAAW;AACzB,WAAO;AAAA,MACL,OAAO;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AACA,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,QAAQ,SAAS;AAAA,IACxB,SAAS;AAAA,EACX;AACF;",
6
6
  "names": []
7
7
  }
@@ -4,16 +4,16 @@
4
4
  export declare const presetDocs: {
5
5
  readonly auth: {
6
6
  readonly section: {
7
- readonly singular: "Available Authentication Method";
8
- readonly plural: "Available Authentication Methods";
7
+ readonly singular: 'Available Authentication Method';
8
+ readonly plural: 'Available Authentication Methods';
9
9
  };
10
10
  readonly description: {
11
- readonly singular: "an authentication method";
12
- readonly plural: "various authentication methods";
11
+ readonly singular: 'an authentication method';
12
+ readonly plural: 'various authentication methods';
13
13
  };
14
14
  readonly scheme: {
15
- readonly singular: "the available authentication scheme";
16
- readonly plural: "each available authentication scheme";
15
+ readonly singular: 'the available authentication scheme';
16
+ readonly plural: 'each available authentication scheme';
17
17
  };
18
18
  readonly intro: {
19
19
  readonly template: (count: number, methods: string, schemes: string, pronoun: string) => string;
@@ -21,18 +21,18 @@ export declare const presetDocs: {
21
21
  };
22
22
  readonly server: {
23
23
  readonly section: {
24
- readonly singular: "API Server";
25
- readonly plural: "API Servers";
24
+ readonly singular: 'API Server';
25
+ readonly plural: 'API Servers';
26
26
  };
27
27
  readonly description: {
28
- readonly singular: "The following server is available for this API:";
29
- readonly plural: "The following servers are available for this API:";
28
+ readonly singular: 'The following server is available for this API:';
29
+ readonly plural: 'The following servers are available for this API:';
30
30
  };
31
31
  };
32
32
  readonly client: {
33
33
  readonly section: {
34
- readonly singular: "Official API Client";
35
- readonly plural: "Official API Clients";
34
+ readonly singular: 'Official API Client';
35
+ readonly plural: 'Official API Clients';
36
36
  };
37
37
  };
38
38
  };
@@ -41,7 +41,7 @@ export declare const presetDocs: {
41
41
  */
42
42
  export declare const pronouns: {
43
43
  readonly pronoun: (count: number) => "it" | "them";
44
- readonly determiner: (count: number) => "this" | "these";
44
+ readonly determiner: (count: number) => "these" | "this";
45
45
  readonly article: (count: number) => "" | "a";
46
46
  };
47
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"doc-text-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/doc-text-utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;uCAgBR,MAAM,WACJ,MAAM,WACN,MAAM,WACN,MAAM;;;;;;;;;;;;;;;;;;;CAqBb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,QAAQ;8BACF,MAAM;iCACH,MAAM;8BACT,MAAM;CACf,CAAC;AAEX;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,UAAU,GAAG,QAAQ,EAAE,MAAM,CAAC,EAC5E,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,CAAC,GACb,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM;;;;;;EAQ1C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMtD"}
1
+ {"version":3,"file":"doc-text-utils.d.ts","sources":["../../../src/lib/overview-docs/doc-text-utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;aACrB,IAAI;iBACF,OAAO;qBACL,QAAQ,EAAE,iCAAiC;qBAC3C,MAAM,EAAE,kCAAkC;;iBAE5C,WAAW;qB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,GAAG,OAAO,CAmDtD"}
1
+ {"version":3,"file":"overview-auth.d.ts","sources":["../../../src/lib/overview-docs/overview-auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AA6FtC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAmDtD"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-auth.ts"],
4
- "sourcesContent": ["import type { OAuthFlowsObject, SecuritySchemeObject } from 'openapi3-ts/oas31';\n\nimport { resolveRef } from '@sdk-it/core';\n\nimport type { NavItem } from '../sidebar.js';\nimport type { IR } from '../types.js';\nimport {\n getAuthIntroText,\n getTextByCount,\n presetDocs,\n} from './doc-text-utils.js';\n\nfunction getSecuritySchemeDescription(scheme: SecuritySchemeObject): string {\n switch (scheme.type) {\n case 'apiKey': {\n const location =\n scheme.in === 'header'\n ? 'HTTP header'\n : scheme.in === 'query'\n ? 'query parameter'\n : 'cookie';\n return `API Key authentication requires you to provide an API key in the ${location} named \\`${scheme.name}\\`.`;\n }\n case 'http':\n if (scheme.scheme === 'bearer') {\n const format = scheme.bearerFormat\n ? ` The expected token format is \\`${scheme.bearerFormat}\\`.`\n : '';\n return `Bearer token authentication requires you to include a bearer token in the \\`Authorization\\` header of your requests.${format}`;\n }\n if (scheme.scheme === 'basic') {\n return `Basic authentication requires you to provide a username and password, encoded in base64 format in the \\`Authorization\\` header.`;\n }\n return `HTTP ${scheme.scheme} authentication is required for accessing this API.`;\n case 'oauth2': {\n const flows = Object.keys(scheme.flows || {});\n const flowDescriptions = flows.map((flow) => {\n switch (flow) {\n case 'authorizationCode':\n return 'Authorization Code (for server-side applications)';\n case 'implicit':\n return 'Implicit (for browser-based applications)';\n case 'password':\n return 'Resource Owner Password Credentials';\n case 'clientCredentials':\n return 'Client Credentials (for machine-to-machine authentication)';\n default:\n return flow;\n }\n });\n return `OAuth 2.0 authentication is supported with the following grant type(s): ${flowDescriptions.join(', ')}.`;\n }\n case 'openIdConnect':\n return `OpenID Connect authentication is used for this API. You will need to authenticate through the OpenID provider to obtain access tokens.`;\n default:\n return 'This API uses a custom authentication scheme. Please refer to the API documentation for specific details.';\n }\n}\n\nfunction formatOAuth2Flows(flows: OAuthFlowsObject): string {\n let result = '';\n\n for (const [flowType, flow] of Object.entries(flows || {})) {\n result += `#### ${getFlowDisplayName(flowType)}\\n\\n`;\n\n if (flow.authorizationUrl) {\n result += `- **Authorization URL:** \\`${flow.authorizationUrl}\\`\\n`;\n }\n if (flow.tokenUrl) {\n result += `- **Token URL:** \\`${flow.tokenUrl}\\`\\n`;\n }\n if (flow.refreshUrl) {\n result += `- **Refresh URL:** \\`${flow.refreshUrl}\\`\\n`;\n }\n if (flow.scopes && Object.keys(flow.scopes).length > 0) {\n result += `- **Available Scopes:**\\n`;\n for (const [scope, description] of Object.entries(flow.scopes)) {\n result += ` - \\`${scope}\\`: ${description}\\n`;\n }\n }\n result += '\\n';\n }\n\n return result;\n}\n\nfunction getFlowDisplayName(flowType: string): string {\n const flowNames: Record<string, string> = {\n authorizationCode: 'Authorization Code Flow',\n implicit: 'Implicit Flow',\n password: 'Resource Owner Password Flow',\n clientCredentials: 'Client Credentials Flow',\n };\n return flowNames[flowType] || flowType;\n}\n\nexport function generateAuthOverview(spec: IR): NavItem {\n let markdown = `# Authentication\\n\\n`;\n\n const securitySchemes = spec.components.securitySchemes;\n const globalSecurity = spec.security || [];\n\n const authMethodCount = Object.keys(securitySchemes).length;\n if (!authMethodCount && !globalSecurity.length) {\n markdown += `This API does not require authentication.\\n\\n`;\n } else {\n if (authMethodCount > 1) {\n markdown += `${getAuthIntroText(authMethodCount)}\\n\\n`;\n markdown += `## ${getTextByCount(authMethodCount, presetDocs.auth.section)}\\n\\n`;\n }\n\n for (const [name, scheme] of Object.entries(securitySchemes)) {\n const schemeObj = resolveRef<SecuritySchemeObject>(spec, scheme);\n if (authMethodCount > 1) {\n markdown += `### ${name}\\n\\n`;\n }\n\n const description =\n schemeObj.description || getSecuritySchemeDescription(schemeObj);\n markdown += `${description}\\n\\n`;\n\n if (schemeObj.type === 'apiKey') {\n markdown += `**Details:**\\n`;\n markdown += `- Parameter Name: \\`${schemeObj.name}\\`\\n`;\n markdown += `- Location: ${schemeObj.in === 'header' ? 'HTTP Header' : schemeObj.in === 'query' ? 'Query Parameter' : 'Cookie'}\\n\\n`;\n } else if (schemeObj.type === 'http') {\n if (schemeObj.bearerFormat) {\n markdown += `- Token Format: \\`${schemeObj.bearerFormat}\\`\\n`;\n }\n markdown += '\\n';\n } else if (schemeObj.type === 'oauth2' && schemeObj.flows) {\n markdown += `**OAuth 2.0 Flows:**\\n\\n`;\n markdown += formatOAuth2Flows(schemeObj.flows);\n } else if (schemeObj.type === 'openIdConnect') {\n markdown += `**Details:**\\n`;\n markdown += `- Discovery URL: \\`${schemeObj.openIdConnectUrl}\\`\\n\\n`;\n }\n }\n }\n\n return {\n id: 'authorization',\n url: '/authorization',\n title: 'Authorization',\n description: 'Authentication methods and security schemes',\n content: markdown,\n };\n}\n"],
5
- "mappings": "AAEA,SAAS,kBAAkB;AAI3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,6BAA6B,QAAsC;AAC1E,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,UAAU;AACb,YAAM,WACJ,OAAO,OAAO,WACV,gBACA,OAAO,OAAO,UACZ,oBACA;AACR,aAAO,oEAAoE,QAAQ,YAAY,OAAO,IAAI;AAAA,IAC5G;AAAA,IACA,KAAK;AACH,UAAI,OAAO,WAAW,UAAU;AAC9B,cAAM,SAAS,OAAO,eAClB,mCAAmC,OAAO,YAAY,QACtD;AACJ,eAAO,uHAAuH,MAAM;AAAA,MACtI;AACA,UAAI,OAAO,WAAW,SAAS;AAC7B,eAAO;AAAA,MACT;AAC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Z,oBAAY,sBAAsB,UAAU,gBAAgB;AAAA;AAAA;AAAA,MAC9D;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF;",
4
+ "sourcesContent": ["import type { OAuthFlowsObject } from 'openapi3-ts/oas31';\n\nimport { type OpenAPISecuritySchemeObject, resolveRef } from '@sdk-it/core';\n\nimport type { NavItem } from '../sidebar.js';\nimport type { IR } from '../types.js';\nimport {\n getAuthIntroText,\n getTextByCount,\n presetDocs,\n} from './doc-text-utils.js';\n\nfunction getSecuritySchemeDescription(\n scheme: OpenAPISecuritySchemeObject,\n): string {\n switch (scheme.type) {\n case 'apiKey': {\n const location =\n scheme.in === 'header'\n ? 'HTTP header'\n : scheme.in === 'query'\n ? 'query parameter'\n : 'cookie';\n return `API Key authentication requires you to provide an API key in the ${location} named \\`${scheme.name}\\`.`;\n }\n case 'http':\n if (scheme.scheme === 'bearer') {\n const format = scheme.bearerFormat\n ? ` The expected token format is \\`${scheme.bearerFormat}\\`.`\n : '';\n return `Bearer token authentication requires you to include a bearer token in the \\`Authorization\\` header of your requests.${format}`;\n }\n if (scheme.scheme === 'basic') {\n return `Basic authentication requires you to provide a username and password, encoded in base64 format in the \\`Authorization\\` header.`;\n }\n return `HTTP ${scheme.scheme} authentication is required for accessing this API.`;\n case 'oauth2': {\n const flows = Object.keys(scheme.flows || {});\n const flowDescriptions = flows.map((flow) => {\n switch (flow) {\n case 'authorizationCode':\n return 'Authorization Code (for server-side applications)';\n case 'implicit':\n return 'Implicit (for browser-based applications)';\n case 'password':\n return 'Resource Owner Password Credentials';\n case 'clientCredentials':\n return 'Client Credentials (for machine-to-machine authentication)';\n default:\n return flow;\n }\n });\n return `OAuth 2.0 authentication is supported with the following grant type(s): ${flowDescriptions.join(', ')}.`;\n }\n case 'openIdConnect':\n return `OpenID Connect authentication is used for this API. You will need to authenticate through the OpenID provider to obtain access tokens.`;\n default:\n return 'This API uses a custom authentication scheme. Please refer to the API documentation for specific details.';\n }\n}\n\nfunction formatOAuth2Flows(flows: OAuthFlowsObject): string {\n let result = '';\n\n for (const [flowType, flow] of Object.entries(flows || {})) {\n result += `#### ${getFlowDisplayName(flowType)}\\n\\n`;\n\n if (flow.authorizationUrl) {\n result += `- **Authorization URL:** \\`${flow.authorizationUrl}\\`\\n`;\n }\n if (flow.tokenUrl) {\n result += `- **Token URL:** \\`${flow.tokenUrl}\\`\\n`;\n }\n if (flow.refreshUrl) {\n result += `- **Refresh URL:** \\`${flow.refreshUrl}\\`\\n`;\n }\n if (flow.scopes && Object.keys(flow.scopes).length > 0) {\n result += `- **Available Scopes:**\\n`;\n for (const [scope, description] of Object.entries(flow.scopes)) {\n result += ` - \\`${scope}\\`: ${description}\\n`;\n }\n }\n result += '\\n';\n }\n\n return result;\n}\n\nfunction getFlowDisplayName(flowType: string): string {\n const flowNames: Record<string, string> = {\n authorizationCode: 'Authorization Code Flow',\n implicit: 'Implicit Flow',\n password: 'Resource Owner Password Flow',\n clientCredentials: 'Client Credentials Flow',\n };\n return flowNames[flowType] || flowType;\n}\n\nexport function generateAuthOverview(spec: IR): NavItem {\n let markdown = `# Authentication\\n\\n`;\n\n const securitySchemes = spec.components.securitySchemes;\n const globalSecurity = spec.security || [];\n\n const authMethodCount = Object.keys(securitySchemes).length;\n if (!authMethodCount && !globalSecurity.length) {\n markdown += `This API does not require authentication.\\n\\n`;\n } else {\n if (authMethodCount > 1) {\n markdown += `${getAuthIntroText(authMethodCount)}\\n\\n`;\n markdown += `## ${getTextByCount(authMethodCount, presetDocs.auth.section)}\\n\\n`;\n }\n\n for (const [name, scheme] of Object.entries(securitySchemes)) {\n const schemeObj = resolveRef<OpenAPISecuritySchemeObject>(spec, scheme);\n if (authMethodCount > 1) {\n markdown += `### ${name}\\n\\n`;\n }\n\n const description =\n schemeObj.description || getSecuritySchemeDescription(schemeObj);\n markdown += `${description}\\n\\n`;\n\n if (schemeObj.type === 'apiKey') {\n markdown += `**Details:**\\n`;\n markdown += `- Parameter Name: \\`${schemeObj.name}\\`\\n`;\n markdown += `- Location: ${schemeObj.in === 'header' ? 'HTTP Header' : schemeObj.in === 'query' ? 'Query Parameter' : 'Cookie'}\\n\\n`;\n } else if (schemeObj.type === 'http') {\n if (schemeObj.bearerFormat) {\n markdown += `- Token Format: \\`${schemeObj.bearerFormat}\\`\\n`;\n }\n markdown += '\\n';\n } else if (schemeObj.type === 'oauth2' && schemeObj.flows) {\n markdown += `**OAuth 2.0 Flows:**\\n\\n`;\n markdown += formatOAuth2Flows(schemeObj.flows);\n } else if (schemeObj.type === 'openIdConnect') {\n markdown += `**Details:**\\n`;\n markdown += `- Discovery URL: \\`${schemeObj.openIdConnectUrl}\\`\\n\\n`;\n }\n }\n }\n\n return {\n id: 'authorization',\n url: '/authorization',\n title: 'Authorization',\n description: 'Authentication methods and security schemes',\n content: markdown,\n };\n}\n"],
5
+ "mappings": "AAEA,SAA2C,kBAAkB;AAI7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,6BACP,QACQ;AACR,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,UAAU;AACb,YAAM,WACJ,OAAO,OAAO,WACV,gBACA,OAAO,OAAO,UACZ,oBACA;AACR,aAAO,oEAAoE,QAAQ,YAAY,OAAO,IAAI;AAAA,IAC5G;AAAA,IACA,KAAK;AACH,UAAI,OAAO,WAAW,UAAU;AAC9B,cAAM,SAAS,OAAO,eAClB,mCAAmC,OAAO,YAAY,QACtD;AACJ,eAAO,uHAAuH,MAAM;AAAA,MACtI;AACA,UAAI,OAAO,WAAW,SAAS;AAC7B,eAAO;AAAA,MACT;AACA,aAAO,QAAQ,OAAO,MAAM;AAAA,IAC9B,KAAK,UAAU;AACb,YAAM,QAAQ,OAAO,KAAK,OAAO,SAAS,CAAC,CAAC;AAC5C,YAAM,mBAAmB,MAAM,IAAI,CAAC,SA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IACP,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"overview-docs.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAIhD,CAAC;AAEH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,iBAAiB,GACvB,WAAW,CAyBb"}
1
+ {"version":3,"file":"overview-docs.d.ts","sources":["../../../src/lib/overview-docs/overview-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAItC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAIhD,CAAC;AAEH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,iBAAiB,GACvB,WAAW,CAyBb"}
@@ -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,EAAE,EAAE,MAAM,aAAa,CAAC;AAsGtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAwExD"}
1
+ {"version":3,"file":"overview-errors.d.ts","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;AAkGtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CA6ExD"}
@@ -50,7 +50,7 @@ function getStatusDescription(statusCode) {
50
50
  "510": "Not Extended - Further extensions to the request are required for the server to fulfill it.",
51
51
  "511": "Network Authentication Required - The client needs to authenticate to gain network access."
52
52
  };
53
- return descriptions[statusCode] || "An error occurred while processing the request.";
53
+ return descriptions[statusCode];
54
54
  }
55
55
  function generateErrorsOverview(spec) {
56
56
  const errorSchemas = /* @__PURE__ */ new Map();
@@ -77,7 +77,6 @@ function generateErrorsOverview(spec) {
77
77
  } else {
78
78
  errorSchemas.set(key, {
79
79
  statusCode,
80
- title: response.description || `${statusCode} Error`,
81
80
  description: response.description,
82
81
  schema: content["application/json"].schema,
83
82
  operations: [operation.operationId]
@@ -97,9 +96,13 @@ function generateErrorsOverview(spec) {
97
96
  );
98
97
  } else {
99
98
  for (const error of errors) {
100
- markdown.push(`### ${error.statusCode} - ${error.title}`);
101
- const description = error.description || getStatusDescription(error.statusCode) || "";
102
- markdown.push(description);
99
+ markdown.push(
100
+ error.description ? `### ${error.statusCode} - ${error.description}` : `### ${error.statusCode}`
101
+ );
102
+ const description = error.description || getStatusDescription(error.statusCode);
103
+ if (description) {
104
+ markdown.push(description);
105
+ }
103
106
  if (error.schema) {
104
107
  markdown.push(`**Response Schema:**`);
105
108
  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 { 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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AA,gBACtB,QAAQ,QAAQ,kBAAkB,EAAE;AAAA,gBACpC,YAAY,CAAC,UAAU,WAAW;AAAA,cACpC,CAAC;AAAA,YACH;AAAA,UACF;AAAA,QACF;AAAA,MACF;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;",
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 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 | undefined {\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 descriptions[statusCode];\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 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(\n error.description\n ? `### ${error.statusCode} - ${error.description}`\n : `### ${error.statusCode}`,\n );\n const description =\n error.description || getStatusDescription(error.statusCode);\n if (description) {\n markdown.push(description);\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;AAWlC,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,YAAwC;AACpE,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,OACE;AAAA,IACF,OACE;AAAA,IACF,OACE;AAAA,EACJ;AACA,SAAO,aAAa,UAAU;AAChC;AAEO,SAAS,uBAAuB,MAAmB;AACxD,QAAM,eAAyC,oBAAI,IAAI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,aAAa;AACf,iBAAS,KAAK,WAAW;AAAA,MAC3B;AAEA,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 +1 @@
1
- {"version":3,"file":"overview-page.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CA0EtE"}
1
+ {"version":3,"file":"overview-page.d.ts","sources":["../../../src/lib/overview-docs/overview-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAyEtE"}
@@ -2,8 +2,7 @@ import { getTextByCount, presetDocs } from "./doc-text-utils.js";
2
2
  import { generateSdkSection } from "./overview-sdks.js";
3
3
  function generateOverviewPage(spec, sdks) {
4
4
  const info = spec.info;
5
- const apiTitle = info.title || "API Reference";
6
- const markdown = [`# ${apiTitle}`];
5
+ const markdown = info.title ? [`# ${info.title}`] : [];
7
6
  if (info.description) {
8
7
  markdown.push(info.description);
9
8
  }
@@ -26,7 +25,7 @@ function generateOverviewPage(spec, sdks) {
26
25
  ).join("\n")
27
26
  );
28
27
  }
29
- markdown.push(...generateSdkSection(apiTitle, sdks));
28
+ markdown.push(...generateSdkSection(info.title, sdks));
30
29
  const supportDocs = spec.externalDocs?.url && spec.externalDocs.description?.toLowerCase().includes("support") ? spec.externalDocs : void 0;
31
30
  if (info.contact?.email || info.contact?.url || supportDocs) {
32
31
  markdown.push(`## Need Help?`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-page.ts"],
4
- "sourcesContent": ["import type { NavItem } from '../sidebar.js';\nimport type { IR } from '../types.js';\nimport { getTextByCount, presetDocs } from './doc-text-utils.js';\nimport { generateSdkSection } from './overview-sdks.js';\nimport type { SdkDoc } from './types.js';\n\nexport function generateOverviewPage(spec: IR, sdks: SdkDoc[]): NavItem {\n const info = spec.info;\n const apiTitle = info.title || 'API Reference';\n const markdown: string[] = [`# ${apiTitle}`];\n\n if (info.description) {\n markdown.push(info.description);\n }\n\n if (info.version) {\n markdown.push(`**Version:** ${info.version}`);\n }\n\n if (info.license) {\n const license = info.license.url\n ? `${info.license.name} ([${info.license.url}](${info.license.url}))`\n : info.license.name;\n markdown.push(`**License:** ${license}`);\n }\n\n if (spec.servers.length > 0) {\n const serverCount = spec.servers.length;\n markdown.push(\n `## ${getTextByCount(serverCount, presetDocs.server.section)}`,\n );\n markdown.push(getTextByCount(serverCount, presetDocs.server.description));\n markdown.push(\n spec.servers\n .map((server) =>\n server.description\n ? `- **${server.url}** - ${server.description}`\n : `- **${server.url}**`,\n )\n .join('\\n'),\n );\n }\n\n markdown.push(...generateSdkSection(apiTitle, sdks));\n\n const supportDocs =\n spec.externalDocs?.url &&\n spec.externalDocs.description?.toLowerCase().includes('support')\n ? spec.externalDocs\n : undefined;\n\n if (info.contact?.email || info.contact?.url || supportDocs) {\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 (supportDocs) {\n markdown.push(\n `For additional support, visit our [${supportDocs.description}](${supportDocs.url}).`,\n );\n }\n }\n\n return {\n id: 'overview',\n url: '/',\n title: 'Overview',\n description: 'API overview and getting started guide',\n content: markdown.join('\\n\\n'),\n };\n}\n"],
5
- "mappings": "AAEA,SAAS,gBAAgB,kBAAkB;AAC3C,SAAS,0BAA0B;AAG5B,SAAS,qBAAqB,MAAU,MAAyB;AACtE,QAAM,OAAO,KAAK;AAClB,QAAM,WAAW,KAAK,SAAS;AAC/B,QAAM,WAAqB,CAAC,KAAK,QAAQ,EAAE;AAE3C,MAAI,KAAK,aAAa;AACpB,aAAS,KAAK,KAAK,WAAW;AAAA,EAChC;AAEA,MAAI,KAAK,SAAS;AAChB,aAAS,KAAK,gBAAgB,KAAK,OAAO,EAAE;AAAA,EAC9C;AAEA,MAAI,KAAK,SAAS;AAChB,UAAM,UAAU,KAAK,QAAQ,MACzB,GAAG,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,GAAG,KAAK,KAAK,QAAQ,GAAG,OAC/D,KAAK,QAAQ;AACjB,aAAS,KAAK,gBAAgB,OAAO,EAAE;AAAA,EACzC;AAEA,MAAI,KAAK,QAAQ,SAAS,GAAG;AAC3B,UAAM,cAAc,KAAK,QAAQ;AACjC,aAAS;AAAA,MACP,MAAM,eAAe,aAAa,WAAW,OAAO,OAAO,CAAC;AAAA,IAC9D;AACA,aAAS,KAAK,eAAe,aAAa,WAAW,OAAO,WAAW,CAAC;AACxE,aAAS;AAAA,MACP,KAAK,QACF;AAAA,QAAI,CAAC,WACJ,OAAO,cACH,OAAO,OAAO,GAAG,QAAQ,OAAO,WAAW,KAC3C,OAAO,OAAO,GAAG;AAAA,MACvB,EACC,KAAK,IAAI;AAAA,IACd;AAAA,EACF;AAEA,WAAS,KAAK,GAAG,mBAAmB,UAAU,IAAI,CAAC;AAEnD,QAAM,cACJ,KAAK,cAAc,OACnB,KAAK,aAAa,aAAa,YAAY,EAAE,SAAS,SAAS,IAC3D,KAAK,eACL;AAEN,MAAI,KAAK,SAAS,SAAS,KAAK,SAAS,OAAO,aAAa;AAC3D,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,QAAI,aAAa;AACf,eAAS;AAAA,QACP,sCAAsC,YAAY,WAAW,KAAK,YAAY,GAAG;AAAA,MACnF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,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 { getTextByCount, presetDocs } from './doc-text-utils.js';\nimport { generateSdkSection } from './overview-sdks.js';\nimport type { SdkDoc } from './types.js';\n\nexport function generateOverviewPage(spec: IR, sdks: SdkDoc[]): NavItem {\n const info = spec.info;\n const markdown: string[] = info.title ? [`# ${info.title}`] : [];\n\n if (info.description) {\n markdown.push(info.description);\n }\n\n if (info.version) {\n markdown.push(`**Version:** ${info.version}`);\n }\n\n if (info.license) {\n const license = info.license.url\n ? `${info.license.name} ([${info.license.url}](${info.license.url}))`\n : info.license.name;\n markdown.push(`**License:** ${license}`);\n }\n\n if (spec.servers.length > 0) {\n const serverCount = spec.servers.length;\n markdown.push(\n `## ${getTextByCount(serverCount, presetDocs.server.section)}`,\n );\n markdown.push(getTextByCount(serverCount, presetDocs.server.description));\n markdown.push(\n spec.servers\n .map((server) =>\n server.description\n ? `- **${server.url}** - ${server.description}`\n : `- **${server.url}**`,\n )\n .join('\\n'),\n );\n }\n\n markdown.push(...generateSdkSection(info.title, sdks));\n\n const supportDocs =\n spec.externalDocs?.url &&\n spec.externalDocs.description?.toLowerCase().includes('support')\n ? spec.externalDocs\n : undefined;\n\n if (info.contact?.email || info.contact?.url || supportDocs) {\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 (supportDocs) {\n markdown.push(\n `For additional support, visit our [${supportDocs.description}](${supportDocs.url}).`,\n );\n }\n }\n\n return {\n id: 'overview',\n url: '/',\n title: 'Overview',\n description: 'API overview and getting started guide',\n content: markdown.join('\\n\\n'),\n };\n}\n"],
5
+ "mappings": "AAEA,SAAS,gBAAgB,kBAAkB;AAC3C,SAAS,0BAA0B;AAG5B,SAAS,qBAAqB,MAAU,MAAyB;AACtE,QAAM,OAAO,KAAK;AAClB,QAAM,WAAqB,KAAK,QAAQ,CAAC,KAAK,KAAK,KAAK,EAAE,IAAI,CAAC;AAE/D,MAAI,KAAK,aAAa;AACpB,aAAS,KAAK,KAAK,WAAW;AAAA,EAChC;AAEA,MAAI,KAAK,SAAS;AAChB,aAAS,KAAK,gBAAgB,KAAK,OAAO,EAAE;AAAA,EAC9C;AAEA,MAAI,KAAK,SAAS;AAChB,UAAM,UAAU,KAAK,QAAQ,MACzB,GAAG,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,GAAG,KAAK,KAAK,QAAQ,GAAG,OAC/D,KAAK,QAAQ;AACjB,aAAS,KAAK,g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["../../../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,KAAK,EAAE,EAAE,GAAG,OAAO,CAoG7D"}
1
+ {"version":3,"file":"overview-pagination.d.ts","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,KAAK,EAAE,EAAE,GAAG,OAAO,CAoG7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"overview-sdks.d.ts","sourceRoot":"","sources":["../../../src/lib/overview-docs/overview-sdks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,YAAY,CAAC;AA4BtD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAqB7E"}
1
+ {"version":3,"file":"overview-sdks.d.ts","sources":["../../../src/lib/overview-docs/overview-sdks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,YAAY,CAAC;AA4BtD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAsB7E"}
@@ -22,9 +22,10 @@ function generateSdkSection(apiTitle, sdks) {
22
22
  const languages = listFormat.format(
23
23
  sdks.map((sdk) => sdkLanguages[sdk.language].title)
24
24
  );
25
+ const subject = apiTitle === "" ? "This API" : apiTitle;
25
26
  const markdown = [
26
27
  `## ${getTextByCount(sdks.length, presetDocs.client.section)}`,
27
- `${apiTitle} provides ${sdks.length === 1 ? "an official client SDK" : "official client SDKs"} for ${languages}. Install ${sdks.length === 1 ? "it" : "one"} to get started:`
28
+ `${subject} provides ${sdks.length === 1 ? "an official client SDK" : "official client SDKs"} for ${languages}. Install ${sdks.length === 1 ? "it" : "one"} to get started:`
28
29
  ];
29
30
  for (const sdk of sdks) {
30
31
  const language = sdkLanguages[sdk.language];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/overview-sdks.ts"],
4
- "sourcesContent": ["import { getTextByCount, presetDocs } from './doc-text-utils.js';\nimport type { SdkDoc, SdkLanguage } from './types.js';\n\ninterface SdkLanguageDocs {\n title: string;\n install(packageName: string): string;\n registry(packageName: string): string;\n}\n\nconst sdkLanguages: Record<SdkLanguage, SdkLanguageDocs> = {\n typescript: {\n title: 'TypeScript',\n install: (packageName) => `npm install ${packageName}`,\n registry: (packageName) => `https://www.npmjs.com/package/${packageName}`,\n },\n python: {\n title: 'Python',\n install: (packageName) => `pip install ${packageName}`,\n registry: (packageName) => `https://pypi.org/project/${packageName}`,\n },\n dart: {\n title: 'Dart',\n install: (packageName) => `dart pub add ${packageName}`,\n registry: (packageName) => `https://pub.dev/packages/${packageName}`,\n },\n};\n\nconst listFormat = new Intl.ListFormat('en', { type: 'conjunction' });\n\nexport function generateSdkSection(apiTitle: string, sdks: SdkDoc[]): string[] {\n if (sdks.length === 0) return [];\n\n const languages = listFormat.format(\n sdks.map((sdk) => sdkLanguages[sdk.language].title),\n );\n const markdown: string[] = [\n `## ${getTextByCount(sdks.length, presetDocs.client.section)}`,\n `${apiTitle} provides ${sdks.length === 1 ? 'an official client SDK' : 'official client SDKs'} for ${languages}. Install ${sdks.length === 1 ? 'it' : 'one'} to get started:`,\n ];\n\n for (const sdk of sdks) {\n const language = sdkLanguages[sdk.language];\n markdown.push(`### ${language.title}`);\n markdown.push(['```bash', language.install(sdk.package), '```'].join('\\n'));\n markdown.push(\n `[${sdk.package}](${sdk.url ?? language.registry(sdk.package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AS,SAAS,IAAI,OAAO,CAAC;AAAA,IAC/D;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { getTextByCount, presetDocs } from './doc-text-utils.js';\nimport type { SdkDoc, SdkLanguage } from './types.js';\n\ninterface SdkLanguageDocs {\n title: string;\n install(packageName: string): string;\n registry(packageName: string): string;\n}\n\nconst sdkLanguages: Record<SdkLanguage, SdkLanguageDocs> = {\n typescript: {\n title: 'TypeScript',\n install: (packageName) => `npm install ${packageName}`,\n registry: (packageName) => `https://www.npmjs.com/package/${packageName}`,\n },\n python: {\n title: 'Python',\n install: (packageName) => `pip install ${packageName}`,\n registry: (packageName) => `https://pypi.org/project/${packageName}`,\n },\n dart: {\n title: 'Dart',\n install: (packageName) => `dart pub add ${packageName}`,\n registry: (packageName) => `https://pub.dev/packages/${packageName}`,\n },\n};\n\nconst listFormat = new Intl.ListFormat('en', { type: 'conjunction' });\n\nexport function generateSdkSection(apiTitle: string, sdks: SdkDoc[]): string[] {\n if (sdks.length === 0) return [];\n\n const languages = listFormat.format(\n sdks.map((sdk) => sdkLanguages[sdk.language].title),\n );\n const subject = apiTitle === '' ? 'This API' : apiTitle;\n const markdown: string[] = [\n `## ${getTextByCount(sdks.length, presetDocs.client.section)}`,\n `${subject} provides ${sdks.length === 1 ? 'an official client SDK' : 'official client SDKs'} for ${languages}. Install ${sdks.length === 1 ? 'it' : 'one'} to get started:`,\n ];\n\n for (const sdk of sdks) {\n const language = sdkLanguages[sdk.language];\n markdown.push(`### ${language.title}`);\n markdown.push(['```bash', language.install(sdk.package), '```'].join('\\n'));\n markdown.push(\n `[${sdk.package}](${sdk.url ?? language.registry(sdk.package)})`,\n );\n }\n\n return markdown;\n}\n"],
5
+ "mappings": "AAAA,SAAS,gBAAgB,kBAAkB;AAS3C,MAAM,eAAqD;AAAA,EACzD,YAAY;AAAA,IACV,OAAO;AAAA,IACP,SAAS,CAAC,gBAAgB,eAAe,WAAW;AAAA,IACpD,UAAU,CAAC,gBAA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AAY,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAI/C,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAsB,CAAC;AAUxE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CASlE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CASxD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7C"}
@@ -14,7 +14,7 @@ function isAuthoredDoc(value) {
14
14
  return isRecord(value) && typeof value.title === "string" && value.title.trim() !== "" && isOptionalString(value.id) && isOptionalString(value.description) && isOptionalString(value.content);
15
15
  }
16
16
  function isSdkDoc(value) {
17
- return isRecord(value) && typeof value.language === "string" && SDK_LANGUAGES.includes(value.language) && typeof value.package === "string" && value.package.trim() !== "" && isOptionalString(value.url);
17
+ return isRecord(value) && typeof value.language === "string" && SDK_LANGUAGES.some((language) => language === value.language) && typeof value.package === "string" && value.package.trim() !== "" && isOptionalString(value.url);
18
18
  }
19
19
  function slugify(value) {
20
20
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/overview-docs/types.ts"],
4
- "sourcesContent": ["export type AuthoredDoc = {\n id?: string;\n title: string;\n description?: string;\n content?: string;\n};\n\n/** An authored doc whose id has been normalized to a url-safe slug. */\nexport type ResolvedDoc = AuthoredDoc & { id: string };\n\nexport type SdkLanguage = 'typescript' | 'python' | 'dart';\n\nexport type SdkDoc = {\n language: SdkLanguage;\n package: string;\n url?: string;\n};\n\nexport const SDK_LANGUAGES: readonly SdkLanguage[] = [\n 'typescript',\n 'python',\n 'dart',\n];\n\n/** Doc ids the apiref reserves for its own routes. */\nexport const RESERVED_DOC_IDS: ReadonlySet<string> = new Set(['embed']);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n return value === undefined || typeof value === 'string';\n}\n\nexport function isAuthoredDoc(value: unknown): value is AuthoredDoc {\n return (\n isRecord(value) &&\n typeof value.title === 'string' &&\n value.title.trim() !== '' &&\n isOptionalString(value.id) &&\n isOptionalString(value.description) &&\n isOptionalString(value.content)\n );\n}\n\nexport function isSdkDoc(value: unknown): value is SdkDoc {\n return (\n isRecord(value) &&\n typeof value.language === 'string' &&\n (SDK_LANGUAGES as readonly string[]).includes(value.language) &&\n typeof value.package === 'string' &&\n value.package.trim() !== '' &&\n isOptionalString(value.url)\n );\n}\n\nexport function slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n"],
5
- "mappings": "AAkBO,MAAM,gBAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,mBAAwC,oBAAI,IAAI,CAAC,OAAO,CAAC;AAEtE,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,iBAAiB,OAA6C;AACrE,SAAO,UAAU,UAAa,OAAO,UAAU;AACjD;AAEO,SAAS,cAAc,OAAsC;AAClE,SACE,SAAS,KAAK,KACd,OAAO,MAAM,UAAU,YACvB,MAAM,MAAM,KAAK,MAAM,MACvB,iBAAiB,MAAM,EAAE,KACzB,iBAAiB,MAAM,WAAW,KAClC,iBAAiB,MAAM,OAAO;AAElC;AAEO,SAAS,SAAS,OAAiC;AACxD,SACE,SAAS,KAAK,KACd,OAAO,MAAM,aAAa,YACzB,cAAoC,SAAS,MAAM,QAAQ,KAC5D,OAAO,MAAM,YAAY,YACzB,MAAM,QAAQ,KAAK,MAAM,MACzB,iBAAiB,MAAM,GAAG;AAE9B;AAEO,SAAS,QAAQ,OAAuB;AAC7C,SAAO,MACJ,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE;AAC3B;",
4
+ "sourcesContent": ["export type AuthoredDoc = {\n id?: string;\n title: string;\n description?: string;\n content?: string;\n};\n\n/** An authored doc whose id has been normalized to a url-safe slug. */\nexport type ResolvedDoc = AuthoredDoc & { id: string };\n\nexport type SdkLanguage = 'typescript' | 'python' | 'dart';\n\nexport type SdkDoc = {\n language: SdkLanguage;\n package: string;\n url?: string;\n};\n\nexport const SDK_LANGUAGES: readonly SdkLanguage[] = [\n 'typescript',\n 'python',\n 'dart',\n];\n\n/** Doc ids the apiref reserves for its own routes. */\nexport const RESERVED_DOC_IDS: ReadonlySet<string> = new Set(['embed']);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isOptionalString(value: unknown): value is string | undefined {\n return value === undefined || typeof value === 'string';\n}\n\nexport function isAuthoredDoc(value: unknown): value is AuthoredDoc {\n return (\n isRecord(value) &&\n typeof value.title === 'string' &&\n value.title.trim() !== '' &&\n isOptionalString(value.id) &&\n isOptionalString(value.description) &&\n isOptionalString(value.content)\n );\n}\n\nexport function isSdkDoc(value: unknown): value is SdkDoc {\n return (\n isRecord(value) &&\n typeof value.language === 'string' &&\n SDK_LANGUAGES.some((language) => language === value.language) &&\n typeof value.package === 'string' &&\n value.package.trim() !== '' &&\n isOptionalString(value.url)\n );\n}\n\nexport function slugify(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n"],
5
+ "mappings": "AAkBO,MAAM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AAO,EAAE,MAAM,CAAA;CAAE,CAAC,GACvC,kBAAkB,CAAC;AAIvB,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAKxC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAU/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAMvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAUrC,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,MAAM,EAWlC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAUxC,CAAC;AA+JF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,oBAAoB,EAC/B,IAAI,CAAC,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,YAAY,GACtB,eAAe,CAqCjB"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/pagination/guess-pagination.ts"],
4
- "sourcesContent": ["import type {\n ReferenceObject,\n SchemaObject,\n SchemasObject,\n} from 'openapi3-ts/oas31';\n\nimport { isRef } from '@sdk-it/core/ref.js';\nimport { isEmpty } from '@sdk-it/core/utils.js';\n\nimport { coerceTypes } from '../is.js';\nimport type { TunedOperationObject } from '../types.js';\nimport { getHasMoreName, getItemsName } from './pagination-result.js';\n\ninterface PaginationResultBase {\n type: 'offset' | 'page' | 'cursor' | 'none';\n}\n\nexport interface OffsetPaginationResult extends PaginationResultBase {\n type: 'offset';\n offsetParamName: string;\n offsetKeyword: string; // The actual part of param name that matched\n limitParamName: string;\n limitKeyword: string; // The actual part of param name that matched\n}\n\nexport interface PagePaginationResult extends PaginationResultBase {\n type: 'page';\n pageNumberParamName: string;\n pageNumberKeyword: string;\n pageSizeParamName: string;\n pageSizeKeyword: string;\n}\n\nexport interface CursorPaginationResult extends PaginationResultBase {\n type: 'cursor';\n cursorParamName: string;\n cursorKeyword: string;\n limitParamName: string;\n limitKeyword: string;\n /** Dot-separated response path containing the next request cursor. */\n nextCursor?: string;\n}\n\nexport interface NoPaginationResult extends PaginationResultBase {\n type: 'none';\n reason: string;\n}\n\nexport type PaginationGuess =\n | ((\n OffsetPaginationResult | PagePaginationResult | CursorPaginationResult\n ) & { items: string; hasMore: string })\n | NoPaginationResult;\n\n// --- Keyword Regex Definitions ---\n\nexport const OFFSET_PARAM_REGEXES: RegExp[] = [\n /\\boffset\\b/i,\n /\\bskip\\b/i,\n /\\bstart(?:ing_at|_index)?\\b/i, // e.g., start, starting_at, start_index\n /\\bfrom\\b/i,\n];\n\nexport const GENERIC_LIMIT_PARAM_REGEXES: RegExp[] = [\n /\\blimit\\b/i,\n /\\bcount\\b/i,\n /\\b(?:page_?)?size\\b/i, // e.g., size, page_size, pagesize\n /\\bmax_results\\b/i,\n /\\bnum_results\\b/i,\n /\\bshow\\b/i, // Can sometimes mean limit\n /\\bper_?page\\b/i, // e.g., per_page, perpage\n /\\bper-page\\b/i,\n /\\btake\\b/i,\n];\n\nexport const PAGE_NUMBER_REGEXES: RegExp[] = [\n // /^(currentPage)?page$/i, // Exact match for \"page\"\n // /^currentPage$/i, // Exact match for \"currentPage\"\n /^p$/i, // Exact match for \"p\" (common shorthand)\n // /\\bpage_?(?:number|no|num|idx|index)\\b/i, // e.g., page_number, pageNumber, page_num, page_idx\n /^(current)?_?page(_?)(?:number|no|num|idx|index)?\\b/i,\n];\n\n// Regexes for parameters indicating page size (when used with page number)\nexport const PAGE_SIZE_REGEXES: RegExp[] = [\n /\\bpage_?size\\b/i, // e.g., page_size, pagesize\n /^size$/i, // Exact \"size\"\n // /\\bsize\\b/i, // Broader \"size\" - can be ambiguous, prefer more specific ones first\n /\\blimit\\b/i, // Limit is often used for page size\n /\\bcount\\b/i, // Count can also be used for page size\n /\\bper_?page\\b/i, // e.g., per_page, perpage\n /\\bper-page\\b/i,\n /\\bnum_?(?:items|records|results)\\b/i, // e.g., num_items, numitems\n /\\bresults_?per_?page\\b/i,\n];\n\n// Regexes for parameters indicating a cursor\nexport const CURSOR_REGEXES: RegExp[] = [\n /\\bmarker\\b/i,\n /\\bcursor\\b/i,\n /\\bafter(?:_?cursor)?\\b/i, // e.g., after, after_cursor\n /\\bbefore(?:_?cursor)?\\b/i, // e.g., before, before_cursor\n /\\b(next|prev|previous)_?(?:page_?)?token\\b/i, // e.g., next_page_token, nextPageToken, prev_token\n /\\b(next|prev|previous)_?cursor\\b/i, // e.g., next_cursor, previousCursor\n /\\bcontinuation(?:_?token)?\\b/i, // e.g., continuation, continuation_token\n /\\bpage(?:_?(token|id))?\\b/i, // e.g., after, after_cursor\n\n /\\bstart_?(?:key|cursor|token|after)\\b/i, // e.g., start_key, startCursor, startToken, startAfter\n];\n\n// Regexes for parameters indicating a limit when used with cursors\nexport const CURSOR_LIMIT_REGEXES: RegExp[] = [\n /\\blimit\\b/i,\n /\\bcount\\b/i,\n /\\bsize\\b/i, // General size\n /\\bfirst\\b/i, // Common in Relay-style cursor pagination (forward pagination)\n /\\blast\\b/i, // Common in Relay-style cursor pagination (backward pagination)\n /\\bpage_?size\\b/i, // Sometimes page_size is used with cursors\n /\\bnum_?(?:items|records|results)\\b/i, // e.g., num_items\n /\\bmax_?items\\b/i,\n /\\btake\\b/i,\n];\n\n// --- Helper Function ---\nfunction findParamAndKeyword(\n queryParams: { name: string }[],\n regexes: RegExp[],\n excludeParamName?: string,\n) {\n for (const param of queryParams) {\n if (param.name === excludeParamName) {\n continue;\n }\n for (const regex of regexes) {\n const match = param.name.match(regex);\n if (match) {\n return { param, keyword: match[0] }; // match[0] is the actual matched substring\n }\n }\n }\n return null;\n}\n\nfunction coerceParameters(\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[],\n) {\n const cleanedParameters: {\n name: string;\n schema: Omit<SchemaObject, 'type'> & {\n type: string[]; // Ensure type is always an array\n };\n }[] = [];\n for (const param of parameters) {\n if (!param.schema) {\n continue;\n }\n if (isRef(param.schema)) {\n continue;\n }\n if (param.schema.anyOf || param.schema.oneOf || param.schema.allOf) {\n const schemas = (\n param.schema.anyOf ||\n param.schema.oneOf ||\n param.schema.allOf ||\n []\n ).filter((it): it is SchemaObject => !isRef(it));\n schemas.forEach((schema) => {\n if (schema.type) {\n cleanedParameters.push({\n ...param,\n schema: {\n ...schema,\n type: coerceTypes(schema),\n },\n });\n }\n });\n continue;\n }\n if (!param.schema.type) {\n continue;\n }\n if (param.schema) {\n cleanedParameters.push({\n ...param,\n schema: {\n ...param.schema,\n type: coerceTypes(param.schema),\n },\n });\n }\n }\n return cleanedParameters;\n}\n\nfunction isOffsetPagination(\n operation: TunedOperationObject,\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[],\n): OffsetPaginationResult | null {\n const params = coerceParameters(parameters).filter(\n (it) =>\n it.schema.type.includes('integer') || it.schema.type.includes('number'),\n );\n\n const offsetMatch = findParamAndKeyword(params, OFFSET_PARAM_REGEXES);\n\n if (!offsetMatch) return null;\n\n const limitMatch = findParamAndKeyword(\n params,\n GENERIC_LIMIT_PARAM_REGEXES,\n offsetMatch.param.name,\n );\n if (!limitMatch) return null;\n\n return {\n type: 'offset',\n offsetParamName: offsetMatch.param.name,\n offsetKeyword: offsetMatch.keyword,\n limitParamName: limitMatch.param.name,\n limitKeyword: limitMatch.keyword,\n };\n}\n\nfunction isPagePagination(\n operation: TunedOperationObject,\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[],\n): PagePaginationResult | null {\n const params = coerceParameters(parameters).filter(\n (it) =>\n it.schema.type.includes('integer') || it.schema.type.includes('number'),\n );\n\n if (params.length < 2) return null;\n\n const pageNoMatch = findParamAndKeyword(params, PAGE_NUMBER_REGEXES);\n if (!pageNoMatch) return null;\n\n const pageSizeMatch = findParamAndKeyword(\n params,\n PAGE_SIZE_REGEXES,\n pageNoMatch.param.name,\n );\n if (!pageSizeMatch) return null;\n\n return {\n type: 'page',\n pageNumberParamName: pageNoMatch.param.name,\n pageNumberKeyword: pageNoMatch.keyword,\n pageSizeParamName: pageSizeMatch.param.name,\n pageSizeKeyword: pageSizeMatch.keyword,\n };\n}\n\nfunction isCursorPagination(\n operation: TunedOperationObject,\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[] = [],\n): CursorPaginationResult | null {\n const queryParams = parameters;\n if (queryParams.length < 2) return null; // Need at least a cursor and a limit-like param\n\n const cursorMatch = findParamAndKeyword(queryParams, CURSOR_REGEXES);\n if (!cursorMatch) return null;\n\n const limitMatch = findParamAndKeyword(\n queryParams,\n CURSOR_LIMIT_REGEXES,\n cursorMatch.param.name,\n );\n if (!limitMatch) return null;\n\n return {\n type: 'cursor',\n cursorParamName: cursorMatch.param.name,\n cursorKeyword: cursorMatch.keyword,\n limitParamName: limitMatch.param.name,\n limitKeyword: limitMatch.keyword,\n };\n}\n\n/**\n * Guesses the pagination strategy of an OpenAPI operation based on its query parameters.\n * It checks for offset, page-based, and cursor-based pagination in that order.\n *\n * @param operation The OpenAPI operation object.\n * @returns A PaginationGuess object indicating the detected type and relevant parameters.\n */\nexport function guessPagination(\n operation: TunedOperationObject,\n body?: SchemaObject,\n response?: SchemaObject,\n): PaginationGuess {\n const bodyParameters =\n body && body.properties\n ? Object.entries(body.properties).map(([it, schema]) => ({\n name: it,\n schema,\n }))\n : [];\n const parameters = operation.parameters;\n\n if (isEmpty(operation.parameters) && isEmpty(bodyParameters)) {\n return { type: 'none', reason: 'no parameters' };\n }\n if (!response) {\n return { type: 'none', reason: 'no response' };\n }\n if (!response.properties) {\n return { type: 'none', reason: 'empty response' };\n }\n const properties = response.properties as SchemasObject;\n\n const itemsKey = getItemsName(properties);\n if (!itemsKey) {\n return { type: 'none', reason: 'no items key' };\n }\n const hasMoreKey = getHasMoreName(excludeKey(properties, itemsKey));\n\n if (!hasMoreKey) {\n return { type: 'none', reason: 'no hasMore key' };\n }\n const pagination =\n isOffsetPagination(operation, [...parameters, ...bodyParameters]) ||\n isPagePagination(operation, [...parameters, ...bodyParameters]) ||\n isCursorPagination(operation, [...parameters, ...bodyParameters]);\n return pagination\n ? { ...pagination, items: itemsKey, hasMore: hasMoreKey }\n : { type: 'none', reason: 'no pagination' };\n}\n\nfunction excludeKey<T extends Record<string, any>>(\n obj: T,\n key: string,\n): Omit<T, typeof key> {\n const { [key]: _, ...rest } = obj;\n return rest;\n}\n"],
5
- "mappings": "AAMA,SAAS,aAAa;AACtB,SAAS,eAAe;AAExB,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB,oBAAoB;AA6CtC,MAAM,uBAAiC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AACF;AAEO,MAAM,8BAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,sBAAgC;AAAA;AAAA;AAAA,EAG3C;AAAA;AAAA;AAAA,EAEA;AACF;AAGO,MAAM,oBAA8B;AAAA,EACzC;AAAA;AAAA,EACA;AAAA;AAAA;AAAA,EAEA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AACF;AAGO,MAAM,iBAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AACF;AAGO,MAAM,uBAAiC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAGA,SAAS,oBACP,aACA,SACA,kBACA;AACA,aAAW,SAAS,aAAa;AAC/B,QAAI,MAAM,SAAS,kBAAkB;AACnC;AAAA,IACF;AACA,eAAW,SAAS,SAAS;AAC3B,YAAM,QAAQ,MAAM,KAAK,MAAM,KAAK;AACpC,UAAI,OAAO;AACT,eA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import { isEmpty } from '@sdk-it/core/utils.js';\n\nimport { coerceTypes } from '../is.js';\nimport type { TunedOperationObject } from '../types.js';\nimport { getHasMoreName, getItemsName } from './pagination-result.js';\n\ninterface PaginationResultBase {\n type: 'offset' | 'page' | 'cursor' | 'none';\n}\n\nexport interface OffsetPaginationResult extends PaginationResultBase {\n type: 'offset';\n offsetParamName: string;\n offsetKeyword: string; // The actual part of param name that matched\n limitParamName: string;\n limitKeyword: string; // The actual part of param name that matched\n}\n\nexport interface PagePaginationResult extends PaginationResultBase {\n type: 'page';\n pageNumberParamName: string;\n pageNumberKeyword: string;\n pageSizeParamName: string;\n pageSizeKeyword: string;\n}\n\nexport interface CursorPaginationResult extends PaginationResultBase {\n type: 'cursor';\n cursorParamName: string;\n cursorKeyword: string;\n limitParamName: string;\n limitKeyword: string;\n /** Dot-separated response path containing the next request cursor. */\n nextCursor?: string;\n}\n\nexport interface NoPaginationResult extends PaginationResultBase {\n type: 'none';\n reason: string;\n}\n\nexport type PaginationGuess =\n | ((\n OffsetPaginationResult | PagePaginationResult | CursorPaginationResult\n ) & { items: string; hasMore: string })\n | NoPaginationResult;\n\n// --- Keyword Regex Definitions ---\n\nexport const OFFSET_PARAM_REGEXES: RegExp[] = [\n /\\boffset\\b/i,\n /\\bskip\\b/i,\n /\\bstart(?:ing_at|_index)?\\b/i, // e.g., start, starting_at, start_index\n /\\bfrom\\b/i,\n];\n\nexport const GENERIC_LIMIT_PARAM_REGEXES: RegExp[] = [\n /\\blimit\\b/i,\n /\\bcount\\b/i,\n /\\b(?:page_?)?size\\b/i, // e.g., size, page_size, pagesize\n /\\bmax_results\\b/i,\n /\\bnum_results\\b/i,\n /\\bshow\\b/i, // Can sometimes mean limit\n /\\bper_?page\\b/i, // e.g., per_page, perpage\n /\\bper-page\\b/i,\n /\\btake\\b/i,\n];\n\nexport const PAGE_NUMBER_REGEXES: RegExp[] = [\n // /^(currentPage)?page$/i, // Exact match for \"page\"\n // /^currentPage$/i, // Exact match for \"currentPage\"\n /^p$/i, // Exact match for \"p\" (common shorthand)\n // /\\bpage_?(?:number|no|num|idx|index)\\b/i, // e.g., page_number, pageNumber, page_num, page_idx\n /^(current)?_?page(_?)(?:number|no|num|idx|index)?\\b/i,\n];\n\n// Regexes for parameters indicating page size (when used with page number)\nexport const PAGE_SIZE_REGEXES: RegExp[] = [\n /\\bpage_?size\\b/i, // e.g., page_size, pagesize\n /^size$/i, // Exact \"size\"\n // /\\bsize\\b/i, // Broader \"size\" - can be ambiguous, prefer more specific ones first\n /\\blimit\\b/i, // Limit is often used for page size\n /\\bcount\\b/i, // Count can also be used for page size\n /\\bper_?page\\b/i, // e.g., per_page, perpage\n /\\bper-page\\b/i,\n /\\bnum_?(?:items|records|results)\\b/i, // e.g., num_items, numitems\n /\\bresults_?per_?page\\b/i,\n];\n\n// Regexes for parameters indicating a cursor\nexport const CURSOR_REGEXES: RegExp[] = [\n /\\bmarker\\b/i,\n /\\bcursor\\b/i,\n /\\bafter(?:_?cursor)?\\b/i, // e.g., after, after_cursor\n /\\bbefore(?:_?cursor)?\\b/i, // e.g., before, before_cursor\n /\\b(next|prev|previous)_?(?:page_?)?token\\b/i, // e.g., next_page_token, nextPageToken, prev_token\n /\\b(next|prev|previous)_?cursor\\b/i, // e.g., next_cursor, previousCursor\n /\\bcontinuation(?:_?token)?\\b/i, // e.g., continuation, continuation_token\n /\\bpage(?:_?(token|id))?\\b/i, // e.g., after, after_cursor\n\n /\\bstart_?(?:key|cursor|token|after)\\b/i, // e.g., start_key, startCursor, startToken, startAfter\n];\n\n// Regexes for parameters indicating a limit when used with cursors\nexport const CURSOR_LIMIT_REGEXES: RegExp[] = [\n /\\blimit\\b/i,\n /\\bcount\\b/i,\n /\\bsize\\b/i, // General size\n /\\bfirst\\b/i, // Common in Relay-style cursor pagination (forward pagination)\n /\\blast\\b/i, // Common in Relay-style cursor pagination (backward pagination)\n /\\bpage_?size\\b/i, // Sometimes page_size is used with cursors\n /\\bnum_?(?:items|records|results)\\b/i, // e.g., num_items\n /\\bmax_?items\\b/i,\n /\\btake\\b/i,\n];\n\n// --- Helper Function ---\nfunction findParamAndKeyword(\n queryParams: { name: string }[],\n regexes: RegExp[],\n excludeParamName?: string,\n) {\n for (const param of queryParams) {\n if (param.name === excludeParamName) {\n continue;\n }\n for (const regex of regexes) {\n const match = param.name.match(regex);\n if (match) {\n return { param, keyword: match[0] }; // match[0] is the actual matched substring\n }\n }\n }\n return null;\n}\n\nfunction coerceParameters(\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[],\n) {\n const cleanedParameters: {\n name: string;\n schema: Omit<SchemaObject, 'type'> & {\n type: string[]; // Ensure type is always an array\n };\n }[] = [];\n for (const param of parameters) {\n if (!param.schema) {\n continue;\n }\n if (isRef(param.schema)) {\n continue;\n }\n if (param.schema.anyOf || param.schema.oneOf || param.schema.allOf) {\n const schemas = (\n param.schema.anyOf ||\n param.schema.oneOf ||\n param.schema.allOf ||\n []\n ).filter((it): it is SchemaObject => !isRef(it));\n schemas.forEach((schema) => {\n if (schema.type) {\n cleanedParameters.push({\n ...param,\n schema: {\n ...schema,\n type: coerceTypes(schema),\n },\n });\n }\n });\n continue;\n }\n if (!param.schema.type) {\n continue;\n }\n if (param.schema) {\n cleanedParameters.push({\n ...param,\n schema: {\n ...param.schema,\n type: coerceTypes(param.schema),\n },\n });\n }\n }\n return cleanedParameters;\n}\n\nfunction isOffsetPagination(\n operation: TunedOperationObject,\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[],\n): OffsetPaginationResult | null {\n const params = coerceParameters(parameters).filter(\n (it) =>\n it.schema.type.includes('integer') || it.schema.type.includes('number'),\n );\n\n const offsetMatch = findParamAndKeyword(params, OFFSET_PARAM_REGEXES);\n\n if (!offsetMatch) return null;\n\n const limitMatch = findParamAndKeyword(\n params,\n GENERIC_LIMIT_PARAM_REGEXES,\n offsetMatch.param.name,\n );\n if (!limitMatch) return null;\n\n return {\n type: 'offset',\n offsetParamName: offsetMatch.param.name,\n offsetKeyword: offsetMatch.keyword,\n limitParamName: limitMatch.param.name,\n limitKeyword: limitMatch.keyword,\n };\n}\n\nfunction isPagePagination(\n operation: TunedOperationObject,\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[],\n): PagePaginationResult | null {\n const params = coerceParameters(parameters).filter(\n (it) =>\n it.schema.type.includes('integer') || it.schema.type.includes('number'),\n );\n\n if (params.length < 2) return null;\n\n const pageNoMatch = findParamAndKeyword(params, PAGE_NUMBER_REGEXES);\n if (!pageNoMatch) return null;\n\n const pageSizeMatch = findParamAndKeyword(\n params,\n PAGE_SIZE_REGEXES,\n pageNoMatch.param.name,\n );\n if (!pageSizeMatch) return null;\n\n return {\n type: 'page',\n pageNumberParamName: pageNoMatch.param.name,\n pageNumberKeyword: pageNoMatch.keyword,\n pageSizeParamName: pageSizeMatch.param.name,\n pageSizeKeyword: pageSizeMatch.keyword,\n };\n}\n\nfunction isCursorPagination(\n operation: TunedOperationObject,\n parameters: { name: string; schema?: SchemaObject | ReferenceObject }[] = [],\n): CursorPaginationResult | null {\n const queryParams = parameters;\n if (queryParams.length < 2) return null; // Need at least a cursor and a limit-like param\n\n const cursorMatch = findParamAndKeyword(queryParams, CURSOR_REGEXES);\n if (!cursorMatch) return null;\n\n const limitMatch = findParamAndKeyword(\n queryParams,\n CURSOR_LIMIT_REGEXES,\n cursorMatch.param.name,\n );\n if (!limitMatch) return null;\n\n return {\n type: 'cursor',\n cursorParamName: cursorMatch.param.name,\n cursorKeyword: cursorMatch.keyword,\n limitParamName: limitMatch.param.name,\n limitKeyword: limitMatch.keyword,\n };\n}\n\n/**\n * Guesses the pagination strategy of an OpenAPI operation based on its query parameters.\n * It checks for offset, page-based, and cursor-based pagination in that order.\n *\n * @param operation The OpenAPI operation object.\n * @returns A PaginationGuess object indicating the detected type and relevant parameters.\n */\nexport function guessPagination(\n operation: TunedOperationObject,\n body?: SchemaObject,\n response?: SchemaObject,\n): PaginationGuess {\n const bodyParameters =\n body && body.properties\n ? Object.entries(body.properties).map(([it, schema]) => ({\n name: it,\n schema,\n }))\n : [];\n const parameters = operation.parameters;\n\n if (isEmpty(operation.parameters) && isEmpty(bodyParameters)) {\n return { type: 'none', reason: 'no parameters' };\n }\n if (!response) {\n return { type: 'none', reason: 'no response' };\n }\n if (!response.properties) {\n return { type: 'none', reason: 'empty response' };\n }\n const properties = response.properties;\n\n const itemsKey = getItemsName(properties);\n if (!itemsKey) {\n return { type: 'none', reason: 'no items key' };\n }\n const hasMoreKey = getHasMoreName(excludeKey(properties, itemsKey));\n\n if (!hasMoreKey) {\n return { type: 'none', reason: 'no hasMore key' };\n }\n const pagination =\n isOffsetPagination(operation, [...parameters, ...bodyParameters]) ||\n isPagePagination(operation, [...parameters, ...bodyParameters]) ||\n isCursorPagination(operation, [...parameters, ...bodyParameters]);\n return pagination\n ? { ...pagination, items: itemsKey, hasMore: hasMoreKey }\n : { type: 'none', reason: 'no pagination' };\n}\n\nfunction excludeKey<T extends Record<string, any>>(\n obj: T,\n key: string,\n): Omit<T, typeof key> {\n const { [key]: _, ...rest } = obj;\n return rest;\n}\n"],
5
+ "mappings": "AAEA,SAAS,aAAa;AACtB,SAAS,eAAe;AAExB,SAAS,mBAAmB;AAE5B,SAAS,gBAAgB,oBAAoB;AA6CtC,MAAM,uBAAiC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AACF;AAEO,MAAM,8BAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,sBAAgC;AAAA;AAAA;AAAA,EAG3C;AAAA;AAAA;AAAA,EAEA;AACF;AAGO,MAAM,oBAA8B;AAAA,EACzC;AAAA;AAAA,EACA;AAAA;AAAA;AAAA,EAEA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AACF;AAGO,M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AAQ,iBAAiB;AAAA,EAClD;AACA,QAAM,aACJ,mBAAmB,WAAW,CAAC,GAAG,YAAY,GAAG,cAAc,CAAC,KAChE,iBAAiB,WAAW,CAAC,GAAG,YAAY,GAAG,cAAc,CAAC,KAC9D,mBAAmB,WAAW,CAAC,GAAG,YAAY,GAAG,cAAc,CAAC;AAClE,SAAO,aACH,EAAE,GAAG,YAAY,OAAO,UAAU,SAAS,WAAW,IACtD,EAAE,MAAM,QAAQ,QAAQ,gBAAgB;AAC9C;AAEA,SAAS,WACP,KACA,KACqB;AACrB,QAAM,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,KAAK,IAAI;AAC9B,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { SchemaObject, SchemasObject } from 'openapi3-ts/oas31';
1
+ import type { ReferenceObject, SchemaObject } from 'openapi3-ts/oas31';
2
2
  import type { IR } from '../types.js';
3
3
  export declare function getNextCursorName(schema: SchemaObject, spec: IR, visited?: Set<SchemaObject>): string | undefined;
4
4
  /**
@@ -9,7 +9,7 @@ export declare function getNextCursorName(schema: SchemaObject, spec: IR, visite
9
9
  * @returns The name of the most likely property containing the items array,
10
10
  * or null if no array properties are found in the schema.
11
11
  */
12
- export declare function getItemsName(properties: Record<string, SchemaObject>): string | null;
12
+ export declare function getItemsName(properties: Record<string, SchemaObject | ReferenceObject>): string | null;
13
13
  /**
14
14
  * Tries to guess the name of a boolean property that indicates if there are more items
15
15
  * to fetch (e.g., for pagination).
@@ -18,5 +18,5 @@ export declare function getItemsName(properties: Record<string, SchemaObject>):
18
18
  * @returns The name of the most likely boolean property indicating "has more",
19
19
  * or null if no suitable boolean property is found.
20
20
  */
21
- export declare function getHasMoreName(properties: SchemasObject): string | null;
21
+ export declare function getHasMoreName(properties: Record<string, SchemaObject | ReferenceObject>): string | null;
22
22
  //# sourceMappingURL=pagination-result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination-result.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/pagination-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMrE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,EAAE,EACR,OAAO,oBAA0B,GAChC,MAAM,GAAG,SAAS,CAyCpB;AAkID;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GACvC,MAAM,GAAG,IAAI,CAqFf;AAmFD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAevE"}
1
+ {"version":3,"file":"pagination-result.d.ts","sources":["../../../src/lib/pagination/pagination-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMvE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,EAAE,EACR,OAAO,oBAA0B,GAChC,MAAM,GAAG,SAAS,CAyCpB;AAkID;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC,GACzD,MAAM,GAAG,IAAI,CAqFf;AAsFD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC,GACzD,MAAM,GAAG,IAAI,CAmBf"}