@redocly/api-docs 0.0.2

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 (974) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +3 -0
  3. package/lib/.tsbuildinfo +1 -0
  4. package/lib/RedoclyApiDocs.d.ts +22 -0
  5. package/lib/RedoclyApiDocs.js +1 -0
  6. package/lib/RedoclyApiDocsStandalone.d.ts +18 -0
  7. package/lib/RedoclyApiDocsStandalone.js +26 -0
  8. package/lib/adapters/asyncapi/build/context.d.ts +10 -0
  9. package/lib/adapters/asyncapi/build/context.js +1 -0
  10. package/lib/adapters/asyncapi/build/navigation.d.ts +2 -0
  11. package/lib/adapters/asyncapi/build/navigation.js +1 -0
  12. package/lib/adapters/asyncapi/build/utils.d.ts +3 -0
  13. package/lib/adapters/asyncapi/build/utils.js +1 -0
  14. package/lib/adapters/asyncapi/buildContext.d.ts +2 -0
  15. package/lib/adapters/asyncapi/buildContext.js +1 -0
  16. package/lib/adapters/asyncapi/index.d.ts +14 -0
  17. package/lib/adapters/asyncapi/index.js +1 -0
  18. package/lib/adapters/asyncapi/items/channel/content.d.ts +5 -0
  19. package/lib/adapters/asyncapi/items/channel/content.js +1 -0
  20. package/lib/adapters/asyncapi/items/channel/item.d.ts +13 -0
  21. package/lib/adapters/asyncapi/items/channel/item.js +1 -0
  22. package/lib/adapters/asyncapi/items/operation/content.d.ts +4 -0
  23. package/lib/adapters/asyncapi/items/operation/content.js +3 -0
  24. package/lib/adapters/asyncapi/items/operation/item.d.ts +15 -0
  25. package/lib/adapters/asyncapi/items/operation/item.js +1 -0
  26. package/lib/adapters/asyncapi/items/overview/content.d.ts +10 -0
  27. package/lib/adapters/asyncapi/items/overview/content.js +1 -0
  28. package/lib/adapters/asyncapi/items/overview/item.d.ts +16 -0
  29. package/lib/adapters/asyncapi/items/overview/item.js +1 -0
  30. package/lib/adapters/asyncapi/panels/brokers.d.ts +4 -0
  31. package/lib/adapters/asyncapi/panels/brokers.js +1 -0
  32. package/lib/adapters/asyncapi/panels/download.d.ts +3 -0
  33. package/lib/adapters/asyncapi/panels/download.js +1 -0
  34. package/lib/adapters/asyncapi/panels/group.d.ts +16 -0
  35. package/lib/adapters/asyncapi/panels/group.js +1 -0
  36. package/lib/adapters/asyncapi/panels/overview.d.ts +3 -0
  37. package/lib/adapters/asyncapi/panels/overview.js +1 -0
  38. package/lib/adapters/asyncapi/store.d.ts +4 -0
  39. package/lib/adapters/asyncapi/store.js +1 -0
  40. package/lib/adapters/asyncapi/utils/avro-to-json-schema.d.ts +4 -0
  41. package/lib/adapters/asyncapi/utils/avro-to-json-schema.js +1 -0
  42. package/lib/adapters/asyncapi/utils/get-channel-label.d.ts +3 -0
  43. package/lib/adapters/asyncapi/utils/get-channel-label.js +1 -0
  44. package/lib/adapters/asyncapi/utils/get-protocol-labels.d.ts +24 -0
  45. package/lib/adapters/asyncapi/utils/get-protocol-labels.js +1 -0
  46. package/lib/adapters/asyncapi/utils/get-server-host.d.ts +3 -0
  47. package/lib/adapters/asyncapi/utils/get-server-host.js +1 -0
  48. package/lib/adapters/asyncapi/utils/resolve-schema.d.ts +2 -0
  49. package/lib/adapters/asyncapi/utils/resolve-schema.js +1 -0
  50. package/lib/adapters/asyncapi/utils/resolveInDoc.d.ts +2 -0
  51. package/lib/adapters/asyncapi/utils/resolveInDoc.js +1 -0
  52. package/lib/adapters/build.d.ts +31 -0
  53. package/lib/adapters/build.js +1 -0
  54. package/lib/adapters/graphql/build/context.d.ts +9 -0
  55. package/lib/adapters/graphql/build/context.js +1 -0
  56. package/lib/adapters/graphql/buildContext.d.ts +2 -0
  57. package/lib/adapters/graphql/buildContext.js +1 -0
  58. package/lib/adapters/graphql/buildStoreFromSdl.d.ts +2 -0
  59. package/lib/adapters/graphql/buildStoreFromSdl.js +1 -0
  60. package/lib/adapters/graphql/group/custom.d.ts +2 -0
  61. package/lib/adapters/graphql/group/custom.js +1 -0
  62. package/lib/adapters/graphql/group/default.d.ts +2 -0
  63. package/lib/adapters/graphql/group/default.js +1 -0
  64. package/lib/adapters/graphql/group/errors.d.ts +1 -0
  65. package/lib/adapters/graphql/group/errors.js +1 -0
  66. package/lib/adapters/graphql/group/itemBuilders.d.ts +5 -0
  67. package/lib/adapters/graphql/group/itemBuilders.js +1 -0
  68. package/lib/adapters/graphql/group/utils.d.ts +8 -0
  69. package/lib/adapters/graphql/group/utils.js +1 -0
  70. package/lib/adapters/graphql/index.d.ts +10 -0
  71. package/lib/adapters/graphql/index.js +1 -0
  72. package/lib/adapters/graphql/items/directive/content.d.ts +4 -0
  73. package/lib/adapters/graphql/items/directive/content.js +1 -0
  74. package/lib/adapters/graphql/items/directive/item.d.ts +3 -0
  75. package/lib/adapters/graphql/items/directive/item.js +1 -0
  76. package/lib/adapters/graphql/items/enum/content.d.ts +4 -0
  77. package/lib/adapters/graphql/items/enum/content.js +1 -0
  78. package/lib/adapters/graphql/items/enum/item.d.ts +3 -0
  79. package/lib/adapters/graphql/items/enum/item.js +1 -0
  80. package/lib/adapters/graphql/items/input/content.d.ts +4 -0
  81. package/lib/adapters/graphql/items/input/content.js +1 -0
  82. package/lib/adapters/graphql/items/input/item.d.ts +3 -0
  83. package/lib/adapters/graphql/items/input/item.js +1 -0
  84. package/lib/adapters/graphql/items/interface/content.d.ts +4 -0
  85. package/lib/adapters/graphql/items/interface/content.js +1 -0
  86. package/lib/adapters/graphql/items/interface/item.d.ts +3 -0
  87. package/lib/adapters/graphql/items/interface/item.js +1 -0
  88. package/lib/adapters/graphql/items/mutation/content.d.ts +4 -0
  89. package/lib/adapters/graphql/items/mutation/content.js +1 -0
  90. package/lib/adapters/graphql/items/mutation/item.d.ts +3 -0
  91. package/lib/adapters/graphql/items/mutation/item.js +1 -0
  92. package/lib/adapters/graphql/items/object/content.d.ts +4 -0
  93. package/lib/adapters/graphql/items/object/content.js +1 -0
  94. package/lib/adapters/graphql/items/object/item.d.ts +3 -0
  95. package/lib/adapters/graphql/items/object/item.js +1 -0
  96. package/lib/adapters/graphql/items/operation/content.d.ts +7 -0
  97. package/lib/adapters/graphql/items/operation/content.js +1 -0
  98. package/lib/adapters/graphql/items/overview/content.d.ts +11 -0
  99. package/lib/adapters/graphql/items/overview/content.js +1 -0
  100. package/lib/adapters/graphql/items/overview/item.d.ts +4 -0
  101. package/lib/adapters/graphql/items/overview/item.js +1 -0
  102. package/lib/adapters/graphql/items/query/content.d.ts +4 -0
  103. package/lib/adapters/graphql/items/query/content.js +1 -0
  104. package/lib/adapters/graphql/items/query/item.d.ts +3 -0
  105. package/lib/adapters/graphql/items/query/item.js +1 -0
  106. package/lib/adapters/graphql/items/scalar/content.d.ts +4 -0
  107. package/lib/adapters/graphql/items/scalar/content.js +1 -0
  108. package/lib/adapters/graphql/items/scalar/item.d.ts +3 -0
  109. package/lib/adapters/graphql/items/scalar/item.js +1 -0
  110. package/lib/adapters/graphql/items/subscription/content.d.ts +4 -0
  111. package/lib/adapters/graphql/items/subscription/content.js +1 -0
  112. package/lib/adapters/graphql/items/subscription/item.d.ts +3 -0
  113. package/lib/adapters/graphql/items/subscription/item.js +1 -0
  114. package/lib/adapters/graphql/items/types.d.ts +7 -0
  115. package/lib/adapters/graphql/items/types.js +0 -0
  116. package/lib/adapters/graphql/items/union/content.d.ts +4 -0
  117. package/lib/adapters/graphql/items/union/content.js +1 -0
  118. package/lib/adapters/graphql/items/union/item.d.ts +3 -0
  119. package/lib/adapters/graphql/items/union/item.js +1 -0
  120. package/lib/adapters/graphql/panels/download.d.ts +3 -0
  121. package/lib/adapters/graphql/panels/download.js +1 -0
  122. package/lib/adapters/graphql/panels/group-items.d.ts +4 -0
  123. package/lib/adapters/graphql/panels/group-items.js +1 -0
  124. package/lib/adapters/graphql/panels/overview.d.ts +3 -0
  125. package/lib/adapters/graphql/panels/overview.js +1 -0
  126. package/lib/adapters/graphql/serializeType.d.ts +5 -0
  127. package/lib/adapters/graphql/serializeType.js +1 -0
  128. package/lib/adapters/graphql/store.d.ts +3 -0
  129. package/lib/adapters/graphql/store.js +1 -0
  130. package/lib/adapters/graphql/utils/appendGraphqlItemFeedback.d.ts +2 -0
  131. package/lib/adapters/graphql/utils/appendGraphqlItemFeedback.js +1 -0
  132. package/lib/adapters/graphql/utils/configMetadataRows.d.ts +3 -0
  133. package/lib/adapters/graphql/utils/configMetadataRows.js +1 -0
  134. package/lib/adapters/graphql/utils/constants.d.ts +23 -0
  135. package/lib/adapters/graphql/utils/constants.js +1 -0
  136. package/lib/adapters/graphql/utils/createApiItem.d.ts +15 -0
  137. package/lib/adapters/graphql/utils/createApiItem.js +1 -0
  138. package/lib/adapters/graphql/utils/getBadges.d.ts +4 -0
  139. package/lib/adapters/graphql/utils/getBadges.js +1 -0
  140. package/lib/adapters/graphql/utils/ignoreInternalItems.d.ts +3 -0
  141. package/lib/adapters/graphql/utils/ignoreInternalItems.js +1 -0
  142. package/lib/adapters/graphql/utils/isRootType.d.ts +2 -0
  143. package/lib/adapters/graphql/utils/isRootType.js +1 -0
  144. package/lib/adapters/graphql/utils/menuSlashRegex.d.ts +1 -0
  145. package/lib/adapters/graphql/utils/menuSlashRegex.js +1 -0
  146. package/lib/adapters/graphql/utils/normalizeMenu.d.ts +3 -0
  147. package/lib/adapters/graphql/utils/normalizeMenu.js +1 -0
  148. package/lib/adapters/graphql/utils/shouldIncludeItem.d.ts +2 -0
  149. package/lib/adapters/graphql/utils/shouldIncludeItem.js +1 -0
  150. package/lib/adapters/graphql/utils/summary.d.ts +4 -0
  151. package/lib/adapters/graphql/utils/summary.js +1 -0
  152. package/lib/adapters/graphql/utils/validateMenuConfig.d.ts +3 -0
  153. package/lib/adapters/graphql/utils/validateMenuConfig.js +1 -0
  154. package/lib/adapters/helpers.d.ts +47 -0
  155. package/lib/adapters/helpers.js +1 -0
  156. package/lib/adapters/openapi/build/context.d.ts +13 -0
  157. package/lib/adapters/openapi/build/context.js +1 -0
  158. package/lib/adapters/openapi/build-code-sample-source.d.ts +5 -0
  159. package/lib/adapters/openapi/build-code-sample-source.js +1 -0
  160. package/lib/adapters/openapi/buildContext.d.ts +2 -0
  161. package/lib/adapters/openapi/buildContext.js +1 -0
  162. package/lib/adapters/openapi/configure/apply-request-values.d.ts +3 -0
  163. package/lib/adapters/openapi/configure/apply-request-values.js +1 -0
  164. package/lib/adapters/openapi/configure/index.d.ts +3 -0
  165. package/lib/adapters/openapi/configure/index.js +1 -0
  166. package/lib/adapters/openapi/configure/merge-utils.d.ts +32 -0
  167. package/lib/adapters/openapi/configure/merge-utils.js +1 -0
  168. package/lib/adapters/openapi/configure/resolve-request-values.d.ts +17 -0
  169. package/lib/adapters/openapi/configure/resolve-request-values.js +1 -0
  170. package/lib/adapters/openapi/constants.d.ts +4 -0
  171. package/lib/adapters/openapi/constants.js +1 -0
  172. package/lib/adapters/openapi/group/content.d.ts +28 -0
  173. package/lib/adapters/openapi/group/content.js +1 -0
  174. package/lib/adapters/openapi/group/item.d.ts +11 -0
  175. package/lib/adapters/openapi/group/item.js +1 -0
  176. package/lib/adapters/openapi/index.d.ts +13 -0
  177. package/lib/adapters/openapi/index.js +1 -0
  178. package/lib/adapters/openapi/items/mcp/content.d.ts +5 -0
  179. package/lib/adapters/openapi/items/mcp/content.js +1 -0
  180. package/lib/adapters/openapi/items/mcp/item.d.ts +9 -0
  181. package/lib/adapters/openapi/items/mcp/item.js +1 -0
  182. package/lib/adapters/openapi/items/operation/content.d.ts +3 -0
  183. package/lib/adapters/openapi/items/operation/content.js +1 -0
  184. package/lib/adapters/openapi/items/operation/item.d.ts +9 -0
  185. package/lib/adapters/openapi/items/operation/item.js +1 -0
  186. package/lib/adapters/openapi/items/overview/content.d.ts +18 -0
  187. package/lib/adapters/openapi/items/overview/content.js +1 -0
  188. package/lib/adapters/openapi/items/overview/item.d.ts +3 -0
  189. package/lib/adapters/openapi/items/overview/item.js +1 -0
  190. package/lib/adapters/openapi/items/schema/content.d.ts +3 -0
  191. package/lib/adapters/openapi/items/schema/content.js +1 -0
  192. package/lib/adapters/openapi/items/schema/item.d.ts +9 -0
  193. package/lib/adapters/openapi/items/schema/item.js +1 -0
  194. package/lib/adapters/openapi/panels/download.d.ts +3 -0
  195. package/lib/adapters/openapi/panels/download.js +1 -0
  196. package/lib/adapters/openapi/panels/languages.d.ts +3 -0
  197. package/lib/adapters/openapi/panels/languages.js +1 -0
  198. package/lib/adapters/openapi/panels/mcp.d.ts +3 -0
  199. package/lib/adapters/openapi/panels/mcp.js +1 -0
  200. package/lib/adapters/openapi/panels/overview.d.ts +3 -0
  201. package/lib/adapters/openapi/panels/overview.js +1 -0
  202. package/lib/adapters/openapi/panels/servers.d.ts +3 -0
  203. package/lib/adapters/openapi/panels/servers.js +1 -0
  204. package/lib/adapters/openapi/resolve-openapi-example-value.d.ts +3 -0
  205. package/lib/adapters/openapi/resolve-openapi-example-value.js +1 -0
  206. package/lib/adapters/openapi/store.d.ts +4 -0
  207. package/lib/adapters/openapi/store.js +1 -0
  208. package/lib/adapters/openapi/utils/JsonPointer.d.ts +51 -0
  209. package/lib/adapters/openapi/utils/JsonPointer.js +1 -0
  210. package/lib/adapters/openapi/utils/applyIgnoreNamedSchemasDeep.d.ts +1 -0
  211. package/lib/adapters/openapi/utils/applyIgnoreNamedSchemasDeep.js +1 -0
  212. package/lib/adapters/openapi/utils/helpers.d.ts +14 -0
  213. package/lib/adapters/openapi/utils/helpers.js +1 -0
  214. package/lib/adapters/openapi/utils/merge-mock-server.d.ts +15 -0
  215. package/lib/adapters/openapi/utils/merge-mock-server.js +1 -0
  216. package/lib/adapters/openapi/utils/operation.d.ts +23 -0
  217. package/lib/adapters/openapi/utils/operation.js +1 -0
  218. package/lib/adapters/openapi/utils/resolvePathItemRef.d.ts +2 -0
  219. package/lib/adapters/openapi/utils/resolvePathItemRef.js +1 -0
  220. package/lib/adapters/openapi/utils/url.d.ts +2 -0
  221. package/lib/adapters/openapi/utils/url.js +1 -0
  222. package/lib/adapters/rbac-schema-propagation.d.ts +2 -0
  223. package/lib/adapters/rbac-schema-propagation.js +1 -0
  224. package/lib/adapters/scopedContext.d.ts +5 -0
  225. package/lib/adapters/scopedContext.js +1 -0
  226. package/lib/adapters/utils/convertSwagger2OpenAPI.d.ts +2 -0
  227. package/lib/adapters/utils/convertSwagger2OpenAPI.js +1 -0
  228. package/lib/adapters/utils/dompurify.d.ts +5 -0
  229. package/lib/adapters/utils/dompurify.js +1 -0
  230. package/lib/adapters/utils/infoMetadata.d.ts +5 -0
  231. package/lib/adapters/utils/infoMetadata.js +1 -0
  232. package/lib/adapters/utils/isPlainText.d.ts +6 -0
  233. package/lib/adapters/utils/isPlainText.js +1 -0
  234. package/lib/adapters/utils/markdoc.d.ts +38 -0
  235. package/lib/adapters/utils/markdoc.js +1 -0
  236. package/lib/adapters/utils/parseMarkdown.d.ts +8 -0
  237. package/lib/adapters/utils/parseMarkdown.js +1 -0
  238. package/lib/adapters/utils/seo.d.ts +3 -0
  239. package/lib/adapters/utils/seo.js +1 -0
  240. package/lib/adapters/utils/simplifyAstStructure.d.ts +2 -0
  241. package/lib/adapters/utils/simplifyAstStructure.js +1 -0
  242. package/lib/components/AdmonitionItem.d.ts +6 -0
  243. package/lib/components/AdmonitionItem.js +1 -0
  244. package/lib/components/ChannelAddressItem.d.ts +7 -0
  245. package/lib/components/ChannelAddressItem.js +31 -0
  246. package/lib/components/ContainerItem.d.ts +9 -0
  247. package/lib/components/ContainerItem.js +1 -0
  248. package/lib/components/EmptyMessageItem.d.ts +6 -0
  249. package/lib/components/EmptyMessageItem.js +6 -0
  250. package/lib/components/ErrorBoundary.d.ts +18 -0
  251. package/lib/components/ErrorBoundary.js +1 -0
  252. package/lib/components/ExtensionsItem.d.ts +7 -0
  253. package/lib/components/ExtensionsItem.js +1 -0
  254. package/lib/components/ExternalDocsItem.d.ts +8 -0
  255. package/lib/components/ExternalDocsItem.js +1 -0
  256. package/lib/components/FeedbackItem.d.ts +9 -0
  257. package/lib/components/FeedbackItem.js +17 -0
  258. package/lib/components/Header/HeaderItem.d.ts +91 -0
  259. package/lib/components/Header/HeaderItem.js +105 -0
  260. package/lib/components/Header/HeaderResponseCodeTabs.d.ts +8 -0
  261. package/lib/components/Header/HeaderResponseCodeTabs.js +1 -0
  262. package/lib/components/Header/ResponseDeepLinkAnchor.d.ts +9 -0
  263. package/lib/components/Header/ResponseDeepLinkAnchor.js +1 -0
  264. package/lib/components/Header/hooks.d.ts +5 -0
  265. package/lib/components/Header/hooks.js +1 -0
  266. package/lib/components/InfoMetadataItem.d.ts +7 -0
  267. package/lib/components/InfoMetadataItem.js +1 -0
  268. package/lib/components/ItemContent/ItemContentRenderer.d.ts +8 -0
  269. package/lib/components/ItemContent/ItemContentRenderer.js +11 -0
  270. package/lib/components/ItemContent/SectionHeader.d.ts +8 -0
  271. package/lib/components/ItemContent/SectionHeader.js +14 -0
  272. package/lib/components/ItemContent/hooks.d.ts +5 -0
  273. package/lib/components/ItemContent/hooks.js +1 -0
  274. package/lib/components/ItemContent/sections/BodyMimeTypeField.d.ts +12 -0
  275. package/lib/components/ItemContent/sections/BodyMimeTypeField.js +60 -0
  276. package/lib/components/ItemContent/sections/BodySection.d.ts +7 -0
  277. package/lib/components/ItemContent/sections/BodySection.js +13 -0
  278. package/lib/components/ItemContent/sections/CallbacksSection.d.ts +5 -0
  279. package/lib/components/ItemContent/sections/CallbacksSection.js +131 -0
  280. package/lib/components/ItemContent/sections/FieldsSection.d.ts +7 -0
  281. package/lib/components/ItemContent/sections/FieldsSection.js +79 -0
  282. package/lib/components/ItemContent/sections/MessagesSection.d.ts +5 -0
  283. package/lib/components/ItemContent/sections/MessagesSection.js +58 -0
  284. package/lib/components/ItemContent/sections/ParametersSection.d.ts +6 -0
  285. package/lib/components/ItemContent/sections/ParametersSection.js +4 -0
  286. package/lib/components/ItemContent/sections/ResponsesSection.d.ts +5 -0
  287. package/lib/components/ItemContent/sections/ResponsesSection.js +28 -0
  288. package/lib/components/ItemContent/sections/ValuesSection.d.ts +5 -0
  289. package/lib/components/ItemContent/sections/ValuesSection.js +26 -0
  290. package/lib/components/LicenseOverlay.d.ts +6 -0
  291. package/lib/components/LicenseOverlay.js +42 -0
  292. package/lib/components/Mapper.d.ts +25 -0
  293. package/lib/components/Mapper.js +1 -0
  294. package/lib/components/MarkdownItem.d.ts +6 -0
  295. package/lib/components/MarkdownItem.js +1 -0
  296. package/lib/components/Mcp/McpPrompt.d.ts +8 -0
  297. package/lib/components/Mcp/McpPrompt.js +1 -0
  298. package/lib/components/Mcp/McpResource.d.ts +8 -0
  299. package/lib/components/Mcp/McpResource.js +3 -0
  300. package/lib/components/Mcp/McpTool.d.ts +8 -0
  301. package/lib/components/Mcp/McpTool.js +1 -0
  302. package/lib/components/Mcp/styled.d.ts +19 -0
  303. package/lib/components/Mcp/styled.js +22 -0
  304. package/lib/components/Mcp/utils.d.ts +6 -0
  305. package/lib/components/Mcp/utils.js +1 -0
  306. package/lib/components/MessageLinksItem.d.ts +7 -0
  307. package/lib/components/MessageLinksItem.js +30 -0
  308. package/lib/components/RenderHook.d.ts +6 -0
  309. package/lib/components/RenderHook.js +1 -0
  310. package/lib/components/Replay/EmbeddedReplay.d.ts +16 -0
  311. package/lib/components/Replay/EmbeddedReplay.js +10 -0
  312. package/lib/components/Replay/Replay.d.ts +13 -0
  313. package/lib/components/Replay/Replay.js +1 -0
  314. package/lib/components/Replay/adapterToMarkdownParser.d.ts +12 -0
  315. package/lib/components/Replay/adapterToMarkdownParser.js +1 -0
  316. package/lib/components/Replay/index.d.ts +2 -0
  317. package/lib/components/Replay/index.js +1 -0
  318. package/lib/components/Schema/SchemaDescription.d.ts +5 -0
  319. package/lib/components/Schema/SchemaDescription.js +1 -0
  320. package/lib/components/Schema/SchemaView.d.ts +20 -0
  321. package/lib/components/Schema/SchemaView.js +1 -0
  322. package/lib/components/Schema/helpers.d.ts +1 -0
  323. package/lib/components/Schema/helpers.js +1 -0
  324. package/lib/components/Schema/hooks/useSchemaDocument.d.ts +7 -0
  325. package/lib/components/Schema/hooks/useSchemaDocument.js +1 -0
  326. package/lib/components/Schema/hooks/useSchemaFieldDeepLink.d.ts +5 -0
  327. package/lib/components/Schema/hooks/useSchemaFieldDeepLink.js +1 -0
  328. package/lib/components/Schema/hooks/useVariantIndexFromHash.d.ts +1 -0
  329. package/lib/components/Schema/hooks/useVariantIndexFromHash.js +1 -0
  330. package/lib/components/Schema/styled.d.ts +146 -0
  331. package/lib/components/Schema/styled.js +342 -0
  332. package/lib/components/Schema/utils.d.ts +26 -0
  333. package/lib/components/Schema/utils.js +1 -0
  334. package/lib/components/Schema/views/ArrayRenderer.d.ts +13 -0
  335. package/lib/components/Schema/views/ArrayRenderer.js +1 -0
  336. package/lib/components/Schema/views/CollapsibleNestedFields.d.ts +25 -0
  337. package/lib/components/Schema/views/CollapsibleNestedFields.js +1 -0
  338. package/lib/components/Schema/views/DefaultMappingOptionLabel.d.ts +5 -0
  339. package/lib/components/Schema/views/DefaultMappingOptionLabel.js +15 -0
  340. package/lib/components/Schema/views/DiscriminatorPropertyRow.d.ts +13 -0
  341. package/lib/components/Schema/views/DiscriminatorPropertyRow.js +1 -0
  342. package/lib/components/Schema/views/Examples.d.ts +7 -0
  343. package/lib/components/Schema/views/Examples.js +1 -0
  344. package/lib/components/Schema/views/ExpandableExample.d.ts +4 -0
  345. package/lib/components/Schema/views/ExpandableExample.js +3 -0
  346. package/lib/components/Schema/views/ObjectRenderer.d.ts +14 -0
  347. package/lib/components/Schema/views/ObjectRenderer.js +1 -0
  348. package/lib/components/Schema/views/Pattern.d.ts +6 -0
  349. package/lib/components/Schema/views/Pattern.js +1 -0
  350. package/lib/components/Schema/views/PrimitiveRenderer.d.ts +5 -0
  351. package/lib/components/Schema/views/PrimitiveRenderer.js +1 -0
  352. package/lib/components/Schema/views/PropertyFieldRow.d.ts +16 -0
  353. package/lib/components/Schema/views/PropertyFieldRow.js +1 -0
  354. package/lib/components/Schema/views/PropertyRenderer.d.ts +15 -0
  355. package/lib/components/Schema/views/PropertyRenderer.js +1 -0
  356. package/lib/components/Schema/views/SchemaEnumDescriptions.d.ts +9 -0
  357. package/lib/components/Schema/views/SchemaEnumDescriptions.js +5 -0
  358. package/lib/components/Schema/views/SchemaEnumValues.d.ts +8 -0
  359. package/lib/components/Schema/views/SchemaEnumValues.js +1 -0
  360. package/lib/components/Schema/views/SchemaTitleLabel.d.ts +5 -0
  361. package/lib/components/Schema/views/SchemaTitleLabel.js +1 -0
  362. package/lib/components/Schema/views/SchemaVariantSelector.d.ts +11 -0
  363. package/lib/components/Schema/views/SchemaVariantSelector.js +1 -0
  364. package/lib/components/Schema/views/SwitcherRenderer.d.ts +14 -0
  365. package/lib/components/Schema/views/SwitcherRenderer.js +1 -0
  366. package/lib/components/Schema/views/VariantDropdown.d.ts +14 -0
  367. package/lib/components/Schema/views/VariantDropdown.js +99 -0
  368. package/lib/components/SchemaCatalogLink.d.ts +6 -0
  369. package/lib/components/SchemaCatalogLink.js +35 -0
  370. package/lib/components/Security/Divider.d.ts +4 -0
  371. package/lib/components/Security/Divider.js +15 -0
  372. package/lib/components/Security/RequiredScopes.d.ts +4 -0
  373. package/lib/components/Security/RequiredScopes.js +5 -0
  374. package/lib/components/Security/ScopeTagWithTooltip.d.ts +11 -0
  375. package/lib/components/Security/ScopeTagWithTooltip.js +28 -0
  376. package/lib/components/Security/SecurityButtonPanel.d.ts +5 -0
  377. package/lib/components/Security/SecurityButtonPanel.js +1 -0
  378. package/lib/components/Security/SecurityFlowDetail.d.ts +5 -0
  379. package/lib/components/Security/SecurityFlowDetail.js +1 -0
  380. package/lib/components/Security/SecurityModal.d.ts +6 -0
  381. package/lib/components/Security/SecurityModal.js +1 -0
  382. package/lib/components/Security/SecuritySection.d.ts +3 -0
  383. package/lib/components/Security/SecuritySection.js +1 -0
  384. package/lib/components/Security/styled.d.ts +83 -0
  385. package/lib/components/Security/styled.js +219 -0
  386. package/lib/components/Security/types.d.ts +3 -0
  387. package/lib/components/Security/types.js +0 -0
  388. package/lib/components/SideMenu/SideMenu.d.ts +7 -0
  389. package/lib/components/SideMenu/SideMenu.js +4 -0
  390. package/lib/components/SideMenu/buildMenuItems.d.ts +29 -0
  391. package/lib/components/SideMenu/buildMenuItems.js +1 -0
  392. package/lib/components/SideMenu/useMenuItems.d.ts +14 -0
  393. package/lib/components/SideMenu/useMenuItems.js +1 -0
  394. package/lib/components/StickySidebar/SidebarActions.d.ts +1 -0
  395. package/lib/components/StickySidebar/SidebarActions.js +5 -0
  396. package/lib/components/StickySidebar/StickySidebar.d.ts +7 -0
  397. package/lib/components/StickySidebar/StickySidebar.js +22 -0
  398. package/lib/components/common/Badge.d.ts +43 -0
  399. package/lib/components/common/Badge.js +33 -0
  400. package/lib/components/common/Breadcrumbs.d.ts +11 -0
  401. package/lib/components/common/Breadcrumbs.js +43 -0
  402. package/lib/components/common/ContentWrapper.d.ts +25 -0
  403. package/lib/components/common/ContentWrapper.js +106 -0
  404. package/lib/components/common/DeepLinkAnchor.d.ts +20 -0
  405. package/lib/components/common/DeepLinkAnchor.js +32 -0
  406. package/lib/components/common/ExpandAllButton.d.ts +6 -0
  407. package/lib/components/common/ExpandAllButton.js +3 -0
  408. package/lib/components/common/ExternalDocumentation.d.ts +10 -0
  409. package/lib/components/common/ExternalDocumentation.js +10 -0
  410. package/lib/components/common/LazyMount.d.ts +9 -0
  411. package/lib/components/common/LazyMount.js +3 -0
  412. package/lib/components/common/LazySection.d.ts +14 -0
  413. package/lib/components/common/LazySection.js +9 -0
  414. package/lib/components/common/Markdown.d.ts +7 -0
  415. package/lib/components/common/Markdown.js +1 -0
  416. package/lib/components/common/MoreDetailsButton.d.ts +5 -0
  417. package/lib/components/common/MoreDetailsButton.js +12 -0
  418. package/lib/components/common/NestedToggleButton.d.ts +10 -0
  419. package/lib/components/common/NestedToggleButton.js +16 -0
  420. package/lib/components/common/PanelItem.d.ts +70 -0
  421. package/lib/components/common/PanelItem.js +62 -0
  422. package/lib/components/common/ResponseCodeTabs.d.ts +8 -0
  423. package/lib/components/common/ResponseCodeTabs.js +36 -0
  424. package/lib/components/common/Tag.d.ts +1 -0
  425. package/lib/components/common/Tag.js +11 -0
  426. package/lib/components/common/VendorExtensions.d.ts +7 -0
  427. package/lib/components/common/VendorExtensions.js +5 -0
  428. package/lib/components/common/ViewNested.d.ts +14 -0
  429. package/lib/components/common/ViewNested.js +31 -0
  430. package/lib/components/graphql/ArrowIcon.d.ts +9 -0
  431. package/lib/components/graphql/ArrowIcon.js +4 -0
  432. package/lib/components/graphql/GraphQLArgumentsSection.d.ts +10 -0
  433. package/lib/components/graphql/GraphQLArgumentsSection.js +1 -0
  434. package/lib/components/graphql/GraphQLEnumEmbedded.d.ts +5 -0
  435. package/lib/components/graphql/GraphQLEnumEmbedded.js +3 -0
  436. package/lib/components/graphql/GraphQLFieldView.d.ts +12 -0
  437. package/lib/components/graphql/GraphQLFieldView.js +1 -0
  438. package/lib/components/graphql/GraphQLFieldsEmbedded.d.ts +9 -0
  439. package/lib/components/graphql/GraphQLFieldsEmbedded.js +1 -0
  440. package/lib/components/graphql/GraphQLGroupTypeList.d.ts +5 -0
  441. package/lib/components/graphql/GraphQLGroupTypeList.js +11 -0
  442. package/lib/components/graphql/GraphQLHeaderExtras.d.ts +7 -0
  443. package/lib/components/graphql/GraphQLHeaderExtras.js +1 -0
  444. package/lib/components/graphql/GraphQLReturnTypeDetails.d.ts +11 -0
  445. package/lib/components/graphql/GraphQLReturnTypeDetails.js +18 -0
  446. package/lib/components/graphql/GraphQLTypeView.d.ts +9 -0
  447. package/lib/components/graphql/GraphQLTypeView.js +1 -0
  448. package/lib/components/graphql/GraphQLUnionEmbedded.d.ts +5 -0
  449. package/lib/components/graphql/GraphQLUnionEmbedded.js +1 -0
  450. package/lib/components/graphql/RequiresScopesButton.d.ts +9 -0
  451. package/lib/components/graphql/RequiresScopesButton.js +38 -0
  452. package/lib/components/graphql/RequiresScopesModal.d.ts +9 -0
  453. package/lib/components/graphql/RequiresScopesModal.js +88 -0
  454. package/lib/components/graphql/ViewNested.d.ts +14 -0
  455. package/lib/components/graphql/ViewNested.js +46 -0
  456. package/lib/components/graphql/renderDescription.d.ts +2 -0
  457. package/lib/components/graphql/renderDescription.js +1 -0
  458. package/lib/components/graphql/sections/GraphQLArgsSection.d.ts +5 -0
  459. package/lib/components/graphql/sections/GraphQLArgsSection.js +7 -0
  460. package/lib/components/graphql/sections/GraphQLFieldsSection.d.ts +5 -0
  461. package/lib/components/graphql/sections/GraphQLFieldsSection.js +1 -0
  462. package/lib/components/graphql/sections/ImplementedBySection.d.ts +5 -0
  463. package/lib/components/graphql/sections/ImplementedBySection.js +1 -0
  464. package/lib/components/graphql/sections/ImplementsSection.d.ts +5 -0
  465. package/lib/components/graphql/sections/ImplementsSection.js +1 -0
  466. package/lib/components/graphql/sections/PossibleTypesSection.d.ts +5 -0
  467. package/lib/components/graphql/sections/PossibleTypesSection.js +1 -0
  468. package/lib/components/graphql/sections/RequiresScopesSection.d.ts +5 -0
  469. package/lib/components/graphql/sections/RequiresScopesSection.js +1 -0
  470. package/lib/components/graphql/sections/ReturnTypeSection.d.ts +5 -0
  471. package/lib/components/graphql/sections/ReturnTypeSection.js +7 -0
  472. package/lib/components/graphql/styled.d.ts +45 -0
  473. package/lib/components/graphql/styled.js +124 -0
  474. package/lib/components/markdoc/Heading.d.ts +11 -0
  475. package/lib/components/markdoc/Heading.js +6 -0
  476. package/lib/components/markdoc/SchemaDefinition.d.ts +11 -0
  477. package/lib/components/markdoc/SchemaDefinition.js +6 -0
  478. package/lib/components/markdoc/apiDocsMarkdocComponents.d.ts +6 -0
  479. package/lib/components/markdoc/apiDocsMarkdocComponents.js +1 -0
  480. package/lib/components/markdoc/buildMarkdocOptions.d.ts +9 -0
  481. package/lib/components/markdoc/buildMarkdocOptions.js +1 -0
  482. package/lib/components/markdoc/defaultMarkdocConfig.d.ts +14 -0
  483. package/lib/components/markdoc/defaultMarkdocConfig.js +1 -0
  484. package/lib/components/markdoc/markdocAdapter.d.ts +11 -0
  485. package/lib/components/markdoc/markdocAdapter.js +1 -0
  486. package/lib/components/markdoc/markdocParser.d.ts +6 -0
  487. package/lib/components/markdoc/markdocParser.js +1 -0
  488. package/lib/components/markdoc/markdocRenderer.d.ts +8 -0
  489. package/lib/components/markdoc/markdocRenderer.js +3 -0
  490. package/lib/components/markdoc/tags/mcp-tag-schemas.d.ts +2 -0
  491. package/lib/components/markdoc/tags/mcp-tag-schemas.js +1 -0
  492. package/lib/components/markdoc/tags/schema-definition-tag.d.ts +2 -0
  493. package/lib/components/markdoc/tags/schema-definition-tag.js +1 -0
  494. package/lib/components/panels/DownloadPanelItem.d.ts +5 -0
  495. package/lib/components/panels/DownloadPanelItem.js +26 -0
  496. package/lib/components/panels/ExampleItem/CallbackPayloadItem.d.ts +5 -0
  497. package/lib/components/panels/ExampleItem/CallbackPayloadItem.js +5 -0
  498. package/lib/components/panels/ExampleItem/CodeSampleItem.d.ts +5 -0
  499. package/lib/components/panels/ExampleItem/CodeSampleItem.js +1 -0
  500. package/lib/components/panels/ExampleItem/ExamplesPanelItem.d.ts +3 -0
  501. package/lib/components/panels/ExampleItem/ExamplesPanelItem.js +1 -0
  502. package/lib/components/panels/ExampleItem/GraphQLQueryItem.d.ts +5 -0
  503. package/lib/components/panels/ExampleItem/GraphQLQueryItem.js +1 -0
  504. package/lib/components/panels/ExampleItem/GraphQLResponseItem.d.ts +5 -0
  505. package/lib/components/panels/ExampleItem/GraphQLResponseItem.js +1 -0
  506. package/lib/components/panels/ExampleItem/GraphQLTypeSampleItem.d.ts +5 -0
  507. package/lib/components/panels/ExampleItem/GraphQLTypeSampleItem.js +1 -0
  508. package/lib/components/panels/ExampleItem/GraphQLVariablesItem.d.ts +5 -0
  509. package/lib/components/panels/ExampleItem/GraphQLVariablesItem.js +1 -0
  510. package/lib/components/panels/ExampleItem/PayloadExampleItem.d.ts +5 -0
  511. package/lib/components/panels/ExampleItem/PayloadExampleItem.js +4 -0
  512. package/lib/components/panels/ExampleItem/ResponseExampleItem.d.ts +5 -0
  513. package/lib/components/panels/ExampleItem/ResponseExampleItem.js +1 -0
  514. package/lib/components/panels/ExampleItem/ServerDropdown.d.ts +17 -0
  515. package/lib/components/panels/ExampleItem/ServerDropdown.js +11 -0
  516. package/lib/components/panels/ExampleItem/hooks.d.ts +25 -0
  517. package/lib/components/panels/ExampleItem/hooks.js +1 -0
  518. package/lib/components/panels/ExampleItem/selectors.d.ts +36 -0
  519. package/lib/components/panels/ExampleItem/selectors.js +1 -0
  520. package/lib/components/panels/ExampleItem/styled.d.ts +164 -0
  521. package/lib/components/panels/ExampleItem/styled.js +128 -0
  522. package/lib/components/panels/ExampleItem/types.d.ts +9 -0
  523. package/lib/components/panels/ExampleItem/types.js +0 -0
  524. package/lib/components/panels/GroupPanelItem.d.ts +5 -0
  525. package/lib/components/panels/GroupPanelItem.js +116 -0
  526. package/lib/components/panels/LanguageItem/LanguageDropdown.d.ts +15 -0
  527. package/lib/components/panels/LanguageItem/LanguageDropdown.js +1 -0
  528. package/lib/components/panels/LanguageItem/LanguageItem.d.ts +11 -0
  529. package/lib/components/panels/LanguageItem/LanguageItem.js +1 -0
  530. package/lib/components/panels/LanguageItem/LanguageList.d.ts +10 -0
  531. package/lib/components/panels/LanguageItem/LanguageList.js +1 -0
  532. package/lib/components/panels/LanguageItem/LanguageListSkeleton.d.ts +4 -0
  533. package/lib/components/panels/LanguageItem/LanguageListSkeleton.js +22 -0
  534. package/lib/components/panels/LanguageItem/LanguagePanelItem.d.ts +5 -0
  535. package/lib/components/panels/LanguageItem/LanguagePanelItem.js +1 -0
  536. package/lib/components/panels/LanguageItem/constants.d.ts +2 -0
  537. package/lib/components/panels/LanguageItem/constants.js +1 -0
  538. package/lib/components/panels/LanguageItem/styled.d.ts +94 -0
  539. package/lib/components/panels/LanguageItem/styled.js +96 -0
  540. package/lib/components/panels/LocationsPanelItem.d.ts +5 -0
  541. package/lib/components/panels/LocationsPanelItem.js +1 -0
  542. package/lib/components/panels/McpExamplePanelItem.d.ts +5 -0
  543. package/lib/components/panels/McpExamplePanelItem.js +6 -0
  544. package/lib/components/panels/McpPanelItem.d.ts +3 -0
  545. package/lib/components/panels/McpPanelItem.js +54 -0
  546. package/lib/components/panels/OverviewPanelItem.d.ts +3 -0
  547. package/lib/components/panels/OverviewPanelItem.js +17 -0
  548. package/lib/components/panels/PanelMapper.d.ts +5 -0
  549. package/lib/components/panels/PanelMapper.js +1 -0
  550. package/lib/components/panels/PanelNodeProps.d.ts +4 -0
  551. package/lib/components/panels/PanelNodeProps.js +0 -0
  552. package/lib/components/panels/ReferencesPanelItem.d.ts +5 -0
  553. package/lib/components/panels/ReferencesPanelItem.js +19 -0
  554. package/lib/components/panels/ServerItem/ServerDescriptionTooltip.d.ts +4 -0
  555. package/lib/components/panels/ServerItem/ServerDescriptionTooltip.js +1 -0
  556. package/lib/components/panels/ServerItem/ServerItem.d.ts +5 -0
  557. package/lib/components/panels/ServerItem/ServerItem.js +40 -0
  558. package/lib/components/panels/ServerItem/ServerPanelItem.d.ts +5 -0
  559. package/lib/components/panels/ServerItem/ServerPanelItem.js +1 -0
  560. package/lib/components/panels/asyncapi/BrokerItem/BrokerBindingsSection.d.ts +7 -0
  561. package/lib/components/panels/asyncapi/BrokerItem/BrokerBindingsSection.js +1 -0
  562. package/lib/components/panels/asyncapi/BrokerItem/BrokerModal.d.ts +8 -0
  563. package/lib/components/panels/asyncapi/BrokerItem/BrokerModal.js +49 -0
  564. package/lib/components/panels/asyncapi/BrokerItem/BrokerOverviewSection.d.ts +6 -0
  565. package/lib/components/panels/asyncapi/BrokerItem/BrokerOverviewSection.js +25 -0
  566. package/lib/components/panels/asyncapi/BrokerItem/BrokerPanel.styled.d.ts +7 -0
  567. package/lib/components/panels/asyncapi/BrokerItem/BrokerPanel.styled.js +25 -0
  568. package/lib/components/panels/asyncapi/BrokerItem/BrokerPanelItem.d.ts +5 -0
  569. package/lib/components/panels/asyncapi/BrokerItem/BrokerPanelItem.js +48 -0
  570. package/lib/components/panels/asyncapi/ChannelBindingItem/ChannelBindingItem.d.ts +5 -0
  571. package/lib/components/panels/asyncapi/ChannelBindingItem/ChannelBindingItem.js +32 -0
  572. package/lib/components/panels/asyncapi/MessageBindingItem/MessageBindingItem.d.ts +5 -0
  573. package/lib/components/panels/asyncapi/MessageBindingItem/MessageBindingItem.js +1 -0
  574. package/lib/components/panels/asyncapi/MessageReferencesItem/MessageReferencesItem.d.ts +5 -0
  575. package/lib/components/panels/asyncapi/MessageReferencesItem/MessageReferencesItem.js +42 -0
  576. package/lib/components/panels/asyncapi/OperationBindingItem/OperationBindingItem.d.ts +5 -0
  577. package/lib/components/panels/asyncapi/OperationBindingItem/OperationBindingItem.js +1 -0
  578. package/lib/components/panels/asyncapi/common/bindingPanel.d.ts +29 -0
  579. package/lib/components/panels/asyncapi/common/bindingPanel.js +48 -0
  580. package/lib/components/panels/shared-panel-styles.d.ts +8 -0
  581. package/lib/components/panels/shared-panel-styles.js +38 -0
  582. package/lib/components/panels/styled.d.ts +20 -0
  583. package/lib/components/panels/styled.js +28 -0
  584. package/lib/components/pluggable/RedocCodeSample.d.ts +12 -0
  585. package/lib/components/pluggable/RedocCodeSample.js +1 -0
  586. package/lib/components/pluggable/RedocExample.d.ts +8 -0
  587. package/lib/components/pluggable/RedocExample.js +7 -0
  588. package/lib/components/pluggable/RedocResponseSamples.d.ts +9 -0
  589. package/lib/components/pluggable/RedocResponseSamples.js +1 -0
  590. package/lib/components/pluggable/RedocSchema.d.ts +12 -0
  591. package/lib/components/pluggable/RedocSchema.js +1 -0
  592. package/lib/components/pluggable/index.d.ts +6 -0
  593. package/lib/components/pluggable/index.js +1 -0
  594. package/lib/constants/openapi.d.ts +30 -0
  595. package/lib/constants/openapi.js +1 -0
  596. package/lib/constants/rendering.d.ts +8 -0
  597. package/lib/constants/rendering.js +1 -0
  598. package/lib/contexts/markdownAdapter.d.ts +21 -0
  599. package/lib/contexts/markdownAdapter.js +1 -0
  600. package/lib/contexts/telemetry.d.ts +3 -0
  601. package/lib/contexts/telemetry.js +1 -0
  602. package/lib/empty-linkedom.d.ts +1 -0
  603. package/lib/empty-linkedom.js +1 -0
  604. package/lib/empty.d.ts +7 -0
  605. package/lib/empty.js +1 -0
  606. package/lib/events/codeSampleCopy.d.ts +2 -0
  607. package/lib/events/codeSampleCopy.js +1 -0
  608. package/lib/events/creator.d.ts +2 -0
  609. package/lib/events/creator.js +1 -0
  610. package/lib/events/index.d.ts +8 -0
  611. package/lib/events/index.js +1 -0
  612. package/lib/events/languageSwitch.d.ts +2 -0
  613. package/lib/events/languageSwitch.js +1 -0
  614. package/lib/events/panelToggle.d.ts +2 -0
  615. package/lib/events/panelToggle.js +1 -0
  616. package/lib/events/serverSwitch.d.ts +2 -0
  617. package/lib/events/serverSwitch.js +1 -0
  618. package/lib/events/tryItOpen.d.ts +2 -0
  619. package/lib/events/tryItOpen.js +1 -0
  620. package/lib/events/tryItSent.d.ts +2 -0
  621. package/lib/events/tryItSent.js +1 -0
  622. package/lib/events/types.d.ts +9 -0
  623. package/lib/events/types.js +1 -0
  624. package/lib/hoc/withItemId.d.ts +6 -0
  625. package/lib/hoc/withItemId.js +1 -0
  626. package/lib/hoc/withReplayPrefetch.d.ts +14 -0
  627. package/lib/hoc/withReplayPrefetch.js +1 -0
  628. package/lib/hoc/withRouter.d.ts +4 -0
  629. package/lib/hoc/withRouter.js +1 -0
  630. package/lib/hoc/withStoreProvider.d.ts +23 -0
  631. package/lib/hoc/withStoreProvider.js +1 -0
  632. package/lib/hooks/useApiDocsRoutes.d.ts +8 -0
  633. package/lib/hooks/useApiDocsRoutes.js +1 -0
  634. package/lib/hooks/useApiDocsScroll.d.ts +9 -0
  635. package/lib/hooks/useApiDocsScroll.js +1 -0
  636. package/lib/hooks/useBodyScrollLock.d.ts +1 -0
  637. package/lib/hooks/useBodyScrollLock.js +1 -0
  638. package/lib/hooks/useCodeHighlight.d.ts +28 -0
  639. package/lib/hooks/useCodeHighlight.js +1 -0
  640. package/lib/hooks/useCopyCodeTelemetry.d.ts +13 -0
  641. package/lib/hooks/useCopyCodeTelemetry.js +1 -0
  642. package/lib/hooks/useDeepLinkSection.d.ts +16 -0
  643. package/lib/hooks/useDeepLinkSection.js +1 -0
  644. package/lib/hooks/useExpandableSection.d.ts +4 -0
  645. package/lib/hooks/useExpandableSection.js +1 -0
  646. package/lib/hooks/useHashLinkRedirect.d.ts +4 -0
  647. package/lib/hooks/useHashLinkRedirect.js +1 -0
  648. package/lib/hooks/useIsExpanded.d.ts +1 -0
  649. package/lib/hooks/useIsExpanded.js +1 -0
  650. package/lib/hooks/useIsHydrated.d.ts +4 -0
  651. package/lib/hooks/useIsHydrated.js +1 -0
  652. package/lib/hooks/useLicense.d.ts +6 -0
  653. package/lib/hooks/useLicense.js +1 -0
  654. package/lib/hooks/useManualScrollAnchor.d.ts +19 -0
  655. package/lib/hooks/useManualScrollAnchor.js +1 -0
  656. package/lib/hooks/useModalDismiss.d.ts +2 -0
  657. package/lib/hooks/useModalDismiss.js +1 -0
  658. package/lib/hooks/useNormalizeUrl.d.ts +2 -0
  659. package/lib/hooks/useNormalizeUrl.js +1 -0
  660. package/lib/hooks/useRouterHashBridge.d.ts +21 -0
  661. package/lib/hooks/useRouterHashBridge.js +1 -0
  662. package/lib/hooks/useScrollSpyUrlSync.d.ts +3 -0
  663. package/lib/hooks/useScrollSpyUrlSync.js +1 -0
  664. package/lib/hooks/useTelemetry.d.ts +2 -0
  665. package/lib/hooks/useTelemetry.js +1 -0
  666. package/lib/hooks/useTelemetryPageMetrics.d.ts +12 -0
  667. package/lib/hooks/useTelemetryPageMetrics.js +1 -0
  668. package/lib/hooks/useTranslate.d.ts +5 -0
  669. package/lib/hooks/useTranslate.js +1 -0
  670. package/lib/hooks/useUrlHash.d.ts +7 -0
  671. package/lib/hooks/useUrlHash.js +1 -0
  672. package/lib/hooks/useUserScrollIntent.d.ts +18 -0
  673. package/lib/hooks/useUserScrollIntent.js +1 -0
  674. package/lib/hooks/useVisitedChannelsTracker.d.ts +6 -0
  675. package/lib/hooks/useVisitedChannelsTracker.js +1 -0
  676. package/lib/icons/CSharpIcon/CSharpIcon.d.ts +2 -0
  677. package/lib/icons/CSharpIcon/CSharpIcon.js +1 -0
  678. package/lib/icons/CSharpIcon/index.d.ts +1 -0
  679. package/lib/icons/CSharpIcon/index.js +1 -0
  680. package/lib/icons/CurlIcon/CurlIcon.d.ts +4 -0
  681. package/lib/icons/CurlIcon/CurlIcon.js +16 -0
  682. package/lib/icons/CurlIcon/index.d.ts +1 -0
  683. package/lib/icons/CurlIcon/index.js +1 -0
  684. package/lib/icons/DefaultMappingIcon/DefaultMappingIcon.d.ts +4 -0
  685. package/lib/icons/DefaultMappingIcon/DefaultMappingIcon.js +10 -0
  686. package/lib/icons/DefaultMappingIcon/index.d.ts +1 -0
  687. package/lib/icons/DefaultMappingIcon/index.js +1 -0
  688. package/lib/icons/GOIcon/GOIcon.d.ts +2 -0
  689. package/lib/icons/GOIcon/GOIcon.js +1 -0
  690. package/lib/icons/GOIcon/index.d.ts +1 -0
  691. package/lib/icons/GOIcon/index.js +1 -0
  692. package/lib/icons/JavaIcon/JavaIcon.d.ts +2 -0
  693. package/lib/icons/JavaIcon/JavaIcon.js +1 -0
  694. package/lib/icons/JavaIcon/index.d.ts +1 -0
  695. package/lib/icons/JavaIcon/index.js +1 -0
  696. package/lib/icons/JavaScriptIcon/JavaScriptIcon.d.ts +2 -0
  697. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +1 -0
  698. package/lib/icons/JavaScriptIcon/index.d.ts +1 -0
  699. package/lib/icons/JavaScriptIcon/index.js +1 -0
  700. package/lib/icons/ListIcon/ListIcon.d.ts +14 -0
  701. package/lib/icons/ListIcon/ListIcon.js +10 -0
  702. package/lib/icons/NodeJSIcon/NodeJSIcon.d.ts +2 -0
  703. package/lib/icons/NodeJSIcon/NodeJSIcon.js +1 -0
  704. package/lib/icons/NodeJSIcon/index.d.ts +1 -0
  705. package/lib/icons/NodeJSIcon/index.js +1 -0
  706. package/lib/icons/PHPIcon/PHPIcon.d.ts +2 -0
  707. package/lib/icons/PHPIcon/PHPIcon.js +1 -0
  708. package/lib/icons/PHPIcon/index.d.ts +1 -0
  709. package/lib/icons/PHPIcon/index.js +1 -0
  710. package/lib/icons/PayloadIcon/PayloadIcon.d.ts +2 -0
  711. package/lib/icons/PayloadIcon/PayloadIcon.js +1 -0
  712. package/lib/icons/PayloadIcon/index.d.ts +1 -0
  713. package/lib/icons/PayloadIcon/index.js +1 -0
  714. package/lib/icons/PlusCircleIcon/PlusCircleIcon.d.ts +7 -0
  715. package/lib/icons/PlusCircleIcon/PlusCircleIcon.js +10 -0
  716. package/lib/icons/PythonIcon/PythonIcon.d.ts +2 -0
  717. package/lib/icons/PythonIcon/PythonIcon.js +1 -0
  718. package/lib/icons/PythonIcon/index.d.ts +1 -0
  719. package/lib/icons/PythonIcon/index.js +1 -0
  720. package/lib/icons/RIcon/RIcon.d.ts +2 -0
  721. package/lib/icons/RIcon/RIcon.js +1 -0
  722. package/lib/icons/RIcon/index.d.ts +1 -0
  723. package/lib/icons/RIcon/index.js +1 -0
  724. package/lib/icons/RubyIcon/RubyIcon.d.ts +2 -0
  725. package/lib/icons/RubyIcon/RubyIcon.js +1 -0
  726. package/lib/icons/RubyIcon/index.d.ts +1 -0
  727. package/lib/icons/RubyIcon/index.js +1 -0
  728. package/lib/index.d.ts +60 -0
  729. package/lib/index.js +1 -0
  730. package/lib/jotai/app.d.ts +76 -0
  731. package/lib/jotai/app.js +1 -0
  732. package/lib/jotai/examples.d.ts +5 -0
  733. package/lib/jotai/examples.js +1 -0
  734. package/lib/jotai/graphql.d.ts +10 -0
  735. package/lib/jotai/graphql.js +1 -0
  736. package/lib/jotai/itemStore.d.ts +49 -0
  737. package/lib/jotai/itemStore.js +1 -0
  738. package/lib/jotai/routes.d.ts +4 -0
  739. package/lib/jotai/routes.js +1 -0
  740. package/lib/jotai/schema.d.ts +3 -0
  741. package/lib/jotai/schema.js +1 -0
  742. package/lib/jotai/store.d.ts +25 -0
  743. package/lib/jotai/store.js +1 -0
  744. package/lib/options/constants.d.ts +16 -0
  745. package/lib/options/constants.js +1 -0
  746. package/lib/options/helpers.d.ts +26 -0
  747. package/lib/options/helpers.js +1 -0
  748. package/lib/options/normalizeOptions.d.ts +2 -0
  749. package/lib/options/normalizeOptions.js +1 -0
  750. package/lib/pages/EntryPage.d.ts +25 -0
  751. package/lib/pages/EntryPage.js +5 -0
  752. package/lib/pages/GroupPage.d.ts +1 -0
  753. package/lib/pages/GroupPage.js +47 -0
  754. package/lib/pages/ItemPage.d.ts +1 -0
  755. package/lib/pages/ItemPage.js +26 -0
  756. package/lib/pages/NotFoundPage.d.ts +6 -0
  757. package/lib/pages/NotFoundPage.js +1 -0
  758. package/lib/pages/OverviewPage.d.ts +1 -0
  759. package/lib/pages/OverviewPage.js +11 -0
  760. package/lib/pages/TopLevelEntryView.d.ts +17 -0
  761. package/lib/pages/TopLevelEntryView.js +1 -0
  762. package/lib/services/code-samples/builder.d.ts +38 -0
  763. package/lib/services/code-samples/builder.js +1 -0
  764. package/lib/services/code-samples/constants/try-it-loading-state.d.ts +6 -0
  765. package/lib/services/code-samples/constants/try-it-loading-state.js +1 -0
  766. package/lib/services/code-samples/convertSampleToString.d.ts +3 -0
  767. package/lib/services/code-samples/convertSampleToString.js +17 -0
  768. package/lib/services/code-samples/discriminator.d.ts +39 -0
  769. package/lib/services/code-samples/discriminator.js +1 -0
  770. package/lib/services/code-samples/example-key.d.ts +25 -0
  771. package/lib/services/code-samples/example-key.js +1 -0
  772. package/lib/services/code-samples/generators/csharp-newtonsoft.d.ts +9 -0
  773. package/lib/services/code-samples/generators/csharp-newtonsoft.js +2 -0
  774. package/lib/services/code-samples/generators/csharp.d.ts +9 -0
  775. package/lib/services/code-samples/generators/csharp.js +2 -0
  776. package/lib/services/code-samples/generators/curl.d.ts +8 -0
  777. package/lib/services/code-samples/generators/curl.js +7 -0
  778. package/lib/services/code-samples/generators/go.d.ts +13 -0
  779. package/lib/services/code-samples/generators/go.js +3 -0
  780. package/lib/services/code-samples/generators/helpers/code-builder.d.ts +56 -0
  781. package/lib/services/code-samples/generators/helpers/code-builder.js +3 -0
  782. package/lib/services/code-samples/generators/helpers/mime.d.ts +1 -0
  783. package/lib/services/code-samples/generators/helpers/mime.js +1 -0
  784. package/lib/services/code-samples/generators/helpers/oauth2-snippets.d.ts +21 -0
  785. package/lib/services/code-samples/generators/helpers/oauth2-snippets.js +1 -0
  786. package/lib/services/code-samples/generators/helpers/php-array.d.ts +6 -0
  787. package/lib/services/code-samples/generators/helpers/php-array.js +5 -0
  788. package/lib/services/code-samples/generators/helpers/r-utils.d.ts +7 -0
  789. package/lib/services/code-samples/generators/helpers/r-utils.js +6 -0
  790. package/lib/services/code-samples/generators/helpers/shell.d.ts +8 -0
  791. package/lib/services/code-samples/generators/helpers/shell.js +1 -0
  792. package/lib/services/code-samples/generators/helpers/string-utils.d.ts +4 -0
  793. package/lib/services/code-samples/generators/helpers/string-utils.js +1 -0
  794. package/lib/services/code-samples/generators/helpers/stringify-js.d.ts +11 -0
  795. package/lib/services/code-samples/generators/helpers/stringify-js.js +8 -0
  796. package/lib/services/code-samples/generators/helpers/sub-request.d.ts +2 -0
  797. package/lib/services/code-samples/generators/helpers/sub-request.js +1 -0
  798. package/lib/services/code-samples/generators/helpers/url-helpers.d.ts +17 -0
  799. package/lib/services/code-samples/generators/helpers/url-helpers.js +2 -0
  800. package/lib/services/code-samples/generators/index.d.ts +16 -0
  801. package/lib/services/code-samples/generators/index.js +1 -0
  802. package/lib/services/code-samples/generators/java.d.ts +9 -0
  803. package/lib/services/code-samples/generators/java.js +3 -0
  804. package/lib/services/code-samples/generators/java8.d.ts +9 -0
  805. package/lib/services/code-samples/generators/java8.js +2 -0
  806. package/lib/services/code-samples/generators/javascript.d.ts +9 -0
  807. package/lib/services/code-samples/generators/javascript.js +1 -0
  808. package/lib/services/code-samples/generators/node.d.ts +10 -0
  809. package/lib/services/code-samples/generators/node.js +1 -0
  810. package/lib/services/code-samples/generators/php.d.ts +13 -0
  811. package/lib/services/code-samples/generators/php.js +6 -0
  812. package/lib/services/code-samples/generators/python.d.ts +3 -0
  813. package/lib/services/code-samples/generators/python.js +9 -0
  814. package/lib/services/code-samples/generators/r.d.ts +10 -0
  815. package/lib/services/code-samples/generators/r.js +7 -0
  816. package/lib/services/code-samples/generators/ruby.d.ts +10 -0
  817. package/lib/services/code-samples/generators/ruby.js +1 -0
  818. package/lib/services/code-samples/generators/types.d.ts +6 -0
  819. package/lib/services/code-samples/generators/types.js +0 -0
  820. package/lib/services/code-samples/har.d.ts +45 -0
  821. package/lib/services/code-samples/har.js +0 -0
  822. package/lib/services/code-samples/index.d.ts +8 -0
  823. package/lib/services/code-samples/index.js +1 -0
  824. package/lib/services/code-samples/replay/embedded-replay-converter.d.ts +6 -0
  825. package/lib/services/code-samples/replay/embedded-replay-converter.js +1 -0
  826. package/lib/services/code-samples/replay/from-openapi-document.d.ts +12 -0
  827. package/lib/services/code-samples/replay/from-openapi-document.js +1 -0
  828. package/lib/services/code-samples/replay/har-to-code-sample-har.d.ts +41 -0
  829. package/lib/services/code-samples/replay/har-to-code-sample-har.js +1 -0
  830. package/lib/services/code-samples/replay/index.d.ts +8 -0
  831. package/lib/services/code-samples/replay/index.js +1 -0
  832. package/lib/services/code-samples/replay/map-servers.d.ts +19 -0
  833. package/lib/services/code-samples/replay/map-servers.js +1 -0
  834. package/lib/services/code-samples/replay/merge-configure-into-source.d.ts +17 -0
  835. package/lib/services/code-samples/replay/merge-configure-into-source.js +1 -0
  836. package/lib/services/code-samples/replay/normalize-servers.d.ts +3 -0
  837. package/lib/services/code-samples/replay/normalize-servers.js +1 -0
  838. package/lib/services/code-samples/replay/overlay-converter.d.ts +15 -0
  839. package/lib/services/code-samples/replay/overlay-converter.js +1 -0
  840. package/lib/services/code-samples/replay/replay-adapter.d.ts +5 -0
  841. package/lib/services/code-samples/replay/replay-adapter.js +1 -0
  842. package/lib/services/code-samples/replay/replay-handler.d.ts +5 -0
  843. package/lib/services/code-samples/replay/replay-handler.js +1 -0
  844. package/lib/services/code-samples/replay/replay-predefined-env.d.ts +4 -0
  845. package/lib/services/code-samples/replay/replay-predefined-env.js +1 -0
  846. package/lib/services/code-samples/replay/replay-types.d.ts +75 -0
  847. package/lib/services/code-samples/replay/replay-types.js +0 -0
  848. package/lib/services/code-samples/resolvers.d.ts +5 -0
  849. package/lib/services/code-samples/resolvers.js +1 -0
  850. package/lib/services/code-samples/sample-har.d.ts +41 -0
  851. package/lib/services/code-samples/sample-har.js +0 -0
  852. package/lib/services/code-samples/server-variables.d.ts +11 -0
  853. package/lib/services/code-samples/server-variables.js +1 -0
  854. package/lib/services/code-samples/source.d.ts +107 -0
  855. package/lib/services/code-samples/source.js +0 -0
  856. package/lib/services/code-samples/use-resolvers.d.ts +2 -0
  857. package/lib/services/code-samples/use-resolvers.js +1 -0
  858. package/lib/services/code-samples/utils/map-request-values.d.ts +6 -0
  859. package/lib/services/code-samples/utils/map-request-values.js +1 -0
  860. package/lib/services/license/check.d.ts +14 -0
  861. package/lib/services/license/check.js +1 -0
  862. package/lib/services/operation-samples/index.d.ts +14 -0
  863. package/lib/services/operation-samples/index.js +2 -0
  864. package/lib/services/operation-samples/types.d.ts +37 -0
  865. package/lib/services/operation-samples/types.js +0 -0
  866. package/lib/services/schema/dialects/graphqlSchema.d.ts +1 -0
  867. package/lib/services/schema/dialects/graphqlSchema.js +1 -0
  868. package/lib/services/schema/dialects/jsonSchema.d.ts +3 -0
  869. package/lib/services/schema/dialects/jsonSchema.js +1 -0
  870. package/lib/services/schema/index.d.ts +1 -0
  871. package/lib/services/schema/index.js +1 -0
  872. package/lib/services/schema/propertyBuilder.d.ts +32 -0
  873. package/lib/services/schema/propertyBuilder.js +1 -0
  874. package/lib/services/schema/propertyTreeBuilder.d.ts +21 -0
  875. package/lib/services/schema/propertyTreeBuilder.js +1 -0
  876. package/lib/services/schema/schemaProcessor.d.ts +2 -0
  877. package/lib/services/schema/schemaProcessor.js +1 -0
  878. package/lib/services/schema/variant-label.d.ts +6 -0
  879. package/lib/services/schema/variant-label.js +1 -0
  880. package/lib/telemetry/RedocTelemetry.d.ts +15 -0
  881. package/lib/telemetry/RedocTelemetry.js +1 -0
  882. package/lib/types/asyncapi.d.ts +367 -0
  883. package/lib/types/asyncapi.js +1 -0
  884. package/lib/types/common.d.ts +168 -0
  885. package/lib/types/common.js +1 -0
  886. package/lib/types/content.d.ts +535 -0
  887. package/lib/types/content.js +0 -0
  888. package/lib/types/events.d.ts +75 -0
  889. package/lib/types/events.js +0 -0
  890. package/lib/types/graphql-store.d.ts +60 -0
  891. package/lib/types/graphql-store.js +1 -0
  892. package/lib/types/graphql.d.ts +54 -0
  893. package/lib/types/graphql.js +0 -0
  894. package/lib/types/index.d.ts +10 -0
  895. package/lib/types/index.js +1 -0
  896. package/lib/types/openapi.d.ts +586 -0
  897. package/lib/types/openapi.js +1 -0
  898. package/lib/types/options.d.ts +260 -0
  899. package/lib/types/options.js +0 -0
  900. package/lib/types/pluggable.d.ts +4 -0
  901. package/lib/types/pluggable.js +0 -0
  902. package/lib/types/schema.d.ts +155 -0
  903. package/lib/types/schema.js +1 -0
  904. package/lib/types/store.d.ts +182 -0
  905. package/lib/types/store.js +0 -0
  906. package/lib/utils/calculateMaxLength.d.ts +6 -0
  907. package/lib/utils/calculateMaxLength.js +1 -0
  908. package/lib/utils/compose.d.ts +7 -0
  909. package/lib/utils/compose.js +1 -0
  910. package/lib/utils/cookies.d.ts +7 -0
  911. package/lib/utils/cookies.js +1 -0
  912. package/lib/utils/deep-link.d.ts +146 -0
  913. package/lib/utils/deep-link.js +1 -0
  914. package/lib/utils/environments.d.ts +6 -0
  915. package/lib/utils/environments.js +1 -0
  916. package/lib/utils/expansion.d.ts +3 -0
  917. package/lib/utils/expansion.js +1 -0
  918. package/lib/utils/extract-extensions.d.ts +4 -0
  919. package/lib/utils/extract-extensions.js +1 -0
  920. package/lib/utils/fetch-openapi-definition.d.ts +6 -0
  921. package/lib/utils/fetch-openapi-definition.js +1 -0
  922. package/lib/utils/form-urlencoded.d.ts +6 -0
  923. package/lib/utils/form-urlencoded.js +1 -0
  924. package/lib/utils/graphql-directive-utils.d.ts +6 -0
  925. package/lib/utils/graphql-directive-utils.js +3 -0
  926. package/lib/utils/graphql-reference-map.d.ts +3 -0
  927. package/lib/utils/graphql-reference-map.js +1 -0
  928. package/lib/utils/graphql-samples.d.ts +25 -0
  929. package/lib/utils/graphql-samples.js +17 -0
  930. package/lib/utils/graphql-scopes.d.ts +6 -0
  931. package/lib/utils/graphql-scopes.js +1 -0
  932. package/lib/utils/graphql-type-expansion.d.ts +5 -0
  933. package/lib/utils/graphql-type-expansion.js +1 -0
  934. package/lib/utils/http-methods.d.ts +8 -0
  935. package/lib/utils/http-methods.js +1 -0
  936. package/lib/utils/languages.d.ts +18 -0
  937. package/lib/utils/languages.js +1 -0
  938. package/lib/utils/loadAndBundleSpec.d.ts +4 -0
  939. package/lib/utils/loadAndBundleSpec.js +1 -0
  940. package/lib/utils/logo.d.ts +8 -0
  941. package/lib/utils/logo.js +1 -0
  942. package/lib/utils/media-type.d.ts +7 -0
  943. package/lib/utils/media-type.js +1 -0
  944. package/lib/utils/multipart.d.ts +7 -0
  945. package/lib/utils/multipart.js +1 -0
  946. package/lib/utils/refPointer.d.ts +2 -0
  947. package/lib/utils/refPointer.js +1 -0
  948. package/lib/utils/resolveText.d.ts +2 -0
  949. package/lib/utils/resolveText.js +1 -0
  950. package/lib/utils/routing.d.ts +49 -0
  951. package/lib/utils/routing.js +1 -0
  952. package/lib/utils/scroll-anchoring.d.ts +3 -0
  953. package/lib/utils/scroll-anchoring.js +1 -0
  954. package/lib/utils/security-scope.d.ts +3 -0
  955. package/lib/utils/security-scope.js +1 -0
  956. package/lib/utils/serialize-parameter.d.ts +8 -0
  957. package/lib/utils/serialize-parameter.js +1 -0
  958. package/lib/utils/serialize-querystring.d.ts +6 -0
  959. package/lib/utils/serialize-querystring.js +1 -0
  960. package/lib/utils/session-storage.d.ts +2 -0
  961. package/lib/utils/session-storage.js +1 -0
  962. package/lib/utils/split-badges-by-position.d.ts +5 -0
  963. package/lib/utils/split-badges-by-position.js +1 -0
  964. package/lib/utils/status-code.d.ts +1 -0
  965. package/lib/utils/status-code.js +1 -0
  966. package/lib/utils/string.d.ts +18 -0
  967. package/lib/utils/string.js +1 -0
  968. package/lib/utils/telemetry.d.ts +1 -0
  969. package/lib/utils/telemetry.js +1 -0
  970. package/lib/utils/url.d.ts +9 -0
  971. package/lib/utils/url.js +1 -0
  972. package/lib/utils/xml.d.ts +1 -0
  973. package/lib/utils/xml.js +1 -0
  974. package/package.json +97 -0
@@ -0,0 +1,21 @@
1
+ import type { CodeBuilder } from './code-builder.js';
2
+ interface BuildCodeSnippetParams {
3
+ tokenUrl: string;
4
+ clientId: string;
5
+ level: number;
6
+ responseVariable?: string;
7
+ capitalize?: boolean;
8
+ short?: boolean;
9
+ }
10
+ export declare function buildJSDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
11
+ export declare function buildPythonDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
12
+ export declare function buildPHPDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
13
+ export declare function buildGoDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
14
+ export declare function buildCSharpDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
15
+ export declare function buildCSharpNewtonsoftDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
16
+ export declare function buildJavaDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
17
+ export declare function buildJava8DeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level }: BuildCodeSnippetParams): void;
18
+ export declare function buildRDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level, responseVariable }: BuildCodeSnippetParams): void;
19
+ export declare function buildRubyDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, level, responseVariable, capitalize }: BuildCodeSnippetParams): void;
20
+ export declare function buildShellDeviceAuthorizationCodeSnippet(code: CodeBuilder, { tokenUrl, clientId, short }: BuildCodeSnippetParams): void;
21
+ export {};
@@ -0,0 +1 @@
1
+ function h(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,`const ${s.var("intervalMs")} = ((oAuth2Data.interval ?? 5) * 1000);`),s.push(p,`const ${s.var("deadline")} = Date.now() + (oAuth2Data.expires_in ?? 600) * 1000;`),s.push(p,`let ${s.var("accessToken")} = '';`),s.blank(),s.push(p,`while (Date.now() < ${s.var("deadline")}) {`),s.push(p+1,`await new Promise(resolve => setTimeout(resolve, ${s.var("intervalMs")}));`),s.blank(),s.push(p+1,`const oAuth2PollResponse = await fetch('${t}', {`),s.push(p+2,"method: 'POST',"),s.push(p+2,"headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },"),s.push(p+2,"body: new URLSearchParams({"),s.push(p+3,"'grant_type': 'urn:ietf:params:oauth:grant-type:device_code',"),s.push(p+3,"'device_code': oAuth2Data.device_code,"),s.push(p+3,`'client_id': '${a}',`),s.push(p+2,"}).toString(),"),s.push(p+1,"});"),s.blank(),s.push(p+1,"const oAuth2PollData = await oAuth2PollResponse.json();"),s.push(p+1,"if (oAuth2PollData.access_token) {"),s.push(p+2,"accessToken = oAuth2PollData.access_token;"),s.push(p+2,"break;"),s.push(p+1,"}"),s.blank(),s.push(p+1,"if (oAuth2PollData.error === 'slow_down') {"),s.push(p+2,`${s.var("intervalMs")} = Math.min(${s.var("intervalMs")} * 2, 10000);`),s.push(p+1,"}"),s.blank(),s.push(p+1,"if (oAuth2PollData.error === 'access_denied' || oAuth2PollData.error === 'expired_token') {"),s.push(p+2,"throw new Error(`Device flow failed: ${oAuth2PollData.error}`);"),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,"if (!accessToken) throw new Error('Timed out waiting for authorization');"),s.blank()}function o(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,'interval_ms = (oauth2_data.get("interval", 5) * 1000)'),s.push(p,'deadline = time.time() + oauth2_data.get("expires_in", 600)'),s.push(p,'access_token = ""'),s.blank(),s.push(p,"while time.time() < deadline:"),s.push(p+1,"time.sleep(interval_ms / 1000)"),s.blank(),s.push(p+1,"oauth2_poll_response = requests.post("),s.push(p+2,`"${t}",`),s.push(p+2,"data={"),s.push(p+3,'"grant_type": "urn:ietf:params:oauth:grant-type:device_code",'),s.push(p+3,'"device_code": oauth2_data["device_code"],'),s.push(p+3,`"client_id": "${a}"`),s.push(p+2,"},"),s.push(p+2,"headers={"),s.push(p+3,'"Content-Type": "application/x-www-form-urlencoded",'),s.push(p+3,'"Accept": "application/json"'),s.push(p+2,"}"),s.push(p+1,")"),s.blank(),s.push(p+1,"oauth2_poll_data = oauth2_poll_response.json()"),s.blank(),s.push(p+1,'if "access_token" in oauth2_poll_data:'),s.push(p+2,'access_token = oauth2_poll_data["access_token"]'),s.push(p+2,"break"),s.blank(),s.push(p+1,'if oauth2_poll_data.get("error") == "slow_down":'),s.push(p+2,"interval_ms = min(interval_ms * 2, 10000)"),s.blank(),s.push(p+1,'if oauth2_poll_data.get("error") in ["access_denied", "expired_token"]:'),s.push(p+2,`raise Exception(f"Device flow failed: {oauth2_poll_data['error']}")`),s.blank(),s.push(p,"if not access_token:"),s.push(p+1,'raise Exception("Timed out waiting for authorization")'),s.blank()}function _(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,"$intervalMs = ($oAuth2Response->interval ?? 5) * 1000;"),s.push(p,"$deadline = time() + ($oAuth2Response->expires_in ?? 600);"),s.push(p,'$accessToken = "";'),s.blank(),s.push(p,"while (time() < $deadline) {"),s.push(p+1,"usleep($intervalMs * 1000);"),s.blank(),s.push(p+1,"$pollCurl = curl_init();"),s.push(p+1,"curl_setopt_array($pollCurl, ["),s.push(p+2,`CURLOPT_URL => "${t}",`),s.push(p+2,"CURLOPT_RETURNTRANSFER => true,"),s.push(p+2,"CURLOPT_POST => true,"),s.push(p+2,"CURLOPT_POSTFIELDS => http_build_query(["),s.push(p+3,'"grant_type" => "urn:ietf:params:oauth:grant-type:device_code",'),s.push(p+3,'"device_code" => $oAuth2Response->device_code,'),s.push(p+3,`"client_id" => "${a}"`),s.push(p+2,"]),"),s.push(p+2,"CURLOPT_HTTPHEADER => ["),s.push(p+3,'"Content-Type: application/x-www-form-urlencoded",'),s.push(p+3,'"Accept: application/json"'),s.push(p+2,"]"),s.push(p+1,"]);"),s.blank(),s.push(p+1,"$pollResponse = curl_exec($pollCurl);"),s.push(p+1,"curl_close($pollCurl);"),s.push(p+1,"$pollData = json_decode($pollResponse);"),s.blank(),s.push(p+1,"if (isset($pollData->access_token)) {"),s.push(p+2,"$accessToken = $pollData->access_token;"),s.push(p+2,"break;"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if (isset($pollData->error) && $pollData->error === "slow_down") {'),s.push(p+2,"$intervalMs = min($intervalMs * 2, 10000);"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if (isset($pollData->error) && in_array($pollData->error, ["access_denied", "expired_token"])) {'),s.push(p+2,'throw new Exception("Device flow failed: " . $pollData->error);'),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,"if (empty($accessToken)) {"),s.push(p+1,'throw new Exception("Timed out waiting for authorization");'),s.push(p,"}"),s.blank()}function k(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,"var intervalMs int64"),s.push(p,"if oAuth2ResBody.Interval != 0 {"),s.push(p+1,"intervalMs = oAuth2ResBody.Interval"),s.push(p,"} else {"),s.push(p+1,"intervalMs = 5"),s.push(p,"}"),s.blank(),s.push(p,"var expiresIn int64"),s.push(p,"if oAuth2ResBody.Expires_in != 0 {"),s.push(p+1,"expiresIn = oAuth2ResBody.Expires_in"),s.push(p,"} else {"),s.push(p+1,"expiresIn = 600"),s.push(p,"}"),s.push(p,"deadline := time.Now().Unix() + expiresIn"),s.push(p,"var accessToken string"),s.blank(),s.push(p,"for time.Now().Unix() < deadline {"),s.push(p+1,"time.Sleep(time.Duration(intervalMs) * time.Second)"),s.blank(),s.push(p+1,"pollData := url.Values{}"),s.push(p+1,'pollData.Set("grant_type", "urn:ietf:params:oauth:grant-type:device_code")'),s.push(p+1,'pollData.Set("device_code", oAuth2ResBody.Device_code)'),s.push(p+1,`pollData.Set("client_id", "${a}")`),s.blank(),s.push(p+1,`pollReq, err := http.NewRequest("POST", "${t}", strings.NewReader(pollData.Encode()))`),s.push(p+1,"if err != nil {"),s.push(p+2,"panic(err)"),s.push(p+1,"}"),s.blank(),s.push(p+1,'pollReq.Header.Add("Content-Type", "application/x-www-form-urlencoded")'),s.push(p+1,'pollReq.Header.Add("Accept", "application/json")'),s.push(p+1,'pollReq.Header.Add("Content-Length", strconv.Itoa(len(pollData.Encode())))'),s.blank(),s.push(p+1,"pollRes, err := http.DefaultClient.Do(pollReq)"),s.push(p+1,"if err != nil {"),s.push(p+2,"panic(err)"),s.push(p+1,"}"),s.blank(),s.push(p+1,"var pollResBody struct {"),s.push(p+2,"Access_token string"),s.push(p+2,"Error string"),s.push(p+1,"}"),s.push(p+1,"err = json.NewDecoder(pollRes.Body).Decode(&pollResBody)"),s.push(p+1,"if err != nil {"),s.push(p+2,"panic(err)"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if pollResBody.Access_token != "" {'),s.push(p+2,"accessToken = pollResBody.Access_token"),s.push(p+2,"break"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if pollResBody.Error == "slow_down" {'),s.push(p+2,"if intervalMs*2 < 10 {"),s.push(p+3,"intervalMs = intervalMs * 2"),s.push(p+2,"} else {"),s.push(p+3,"intervalMs = 10"),s.push(p+2,"}"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if pollResBody.Error == "access_denied" || pollResBody.Error == "expired_token" {'),s.push(p+2,'panic("Device flow failed: " + pollResBody.Error)'),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,'if accessToken == "" {'),s.push(p+1,'panic("Timed out waiting for authorization")'),s.push(p,"}"),s.blank()}function w(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,"using JsonDocument oauth2JsonDoc = JsonDocument.Parse(oauth2Response);"),s.blank(),s.push(p,'var intervalMs = oauth2JsonDoc.RootElement.TryGetProperty("interval", out var intervalProp)'),s.push(p+1,"? intervalProp.GetInt32() * 1000"),s.push(p+1,": 5000;"),s.push(p,'var expiresIn = oauth2JsonDoc.RootElement.TryGetProperty("expires_in", out var expiresProp)'),s.push(p+1,"? expiresProp.GetInt32()"),s.push(p+1,": 600;"),s.push(p,"var deadline = DateTime.UtcNow.AddSeconds(expiresIn);"),s.push(p,'var deviceCode = oauth2JsonDoc.RootElement.GetProperty("device_code").GetString();'),s.push(p,"string accessToken = null;"),s.blank(),s.push(p,"while (DateTime.UtcNow < deadline)"),s.push(p,"{"),s.push(p+1,"await Task.Delay(intervalMs);"),s.blank(),s.push(p+1,"List<KeyValuePair<string, string>> pollData = new List<KeyValuePair<string, string>>();"),s.push(p+1,'pollData.Add(new KeyValuePair<string, string>("grant_type", "urn:ietf:params:oauth:grant-type:device_code"));'),s.push(p+1,'pollData.Add(new KeyValuePair<string, string>("device_code", deviceCode));'),s.push(p+1,`pollData.Add(new KeyValuePair<string, string>("client_id", "${a}"));`),s.blank(),s.push(p+1,"using HttpResponseMessage pollResponse = await oauth2Client.PostAsync("),s.push(p+2,`"${t}",`),s.push(p+2,"new FormUrlEncodedContent(pollData));"),s.blank(),s.push(p+1,"string pollJson = await pollResponse.Content.ReadAsStringAsync();"),s.push(p+1,"using JsonDocument pollDoc = JsonDocument.Parse(pollJson);"),s.blank(),s.push(p+1,'if (pollDoc.RootElement.TryGetProperty("access_token", out var tokenProp))'),s.push(p+1,"{"),s.push(p+2,"accessToken = tokenProp.GetString();"),s.push(p+2,"break;"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if (pollDoc.RootElement.TryGetProperty("error", out var errorProp))'),s.push(p+1,"{"),s.push(p+2,"string errorValue = errorProp.GetString();"),s.push(p+2,'if (errorValue == "slow_down")'),s.push(p+2,"{"),s.push(p+3,"intervalMs = Math.Min(intervalMs * 2, 10000);"),s.push(p+2,"}"),s.push(p+2,'else if (errorValue == "access_denied" || errorValue == "expired_token")'),s.push(p+2,"{"),s.push(p+3,'throw new Exception($"Device flow failed: {errorValue}");'),s.push(p+2,"}"),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,"if (string.IsNullOrEmpty(accessToken))"),s.push(p,"{"),s.push(p+1,'throw new Exception("Timed out waiting for authorization");'),s.push(p,"}"),s.blank()}function b(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,"JObject oauth2JObject = JObject.Parse(oauth2Response);"),s.blank(),s.push(p,'var intervalMs = oauth2JObject["interval"] != null'),s.push(p+1,'? (int)oauth2JObject["interval"] * 1000'),s.push(p+1,": 5000;"),s.push(p,'var expiresIn = oauth2JObject["expires_in"] != null'),s.push(p+1,'? (int)oauth2JObject["expires_in"]'),s.push(p+1,": 600;"),s.push(p,"var deadline = DateTime.UtcNow.AddSeconds(expiresIn);"),s.push(p,'var deviceCode = oauth2JObject["device_code"].ToString();'),s.push(p,"string accessToken = null;"),s.blank(),s.push(p,"while (DateTime.UtcNow < deadline)"),s.push(p,"{"),s.push(p+1,"await Task.Delay(intervalMs);"),s.blank(),s.push(p+1,"List<KeyValuePair<string, string>> pollData = new List<KeyValuePair<string, string>>();"),s.push(p+1,'pollData.Add(new KeyValuePair<string, string>("grant_type", "urn:ietf:params:oauth:grant-type:device_code"));'),s.push(p+1,'pollData.Add(new KeyValuePair<string, string>("device_code", deviceCode));'),s.push(p+1,`pollData.Add(new KeyValuePair<string, string>("client_id", "${a}"));`),s.blank(),s.push(p+1,"var pollResponse = await client.PostAsync("),s.push(p+2,`"${t}",`),s.push(p+2,"new FormUrlEncodedContent(pollData));"),s.blank(),s.push(p+1,"string pollJson = await pollResponse.Content.ReadAsStringAsync();"),s.push(p+1,"JObject pollJObject = JObject.Parse(pollJson);"),s.blank(),s.push(p+1,'if (pollJObject["access_token"] != null)'),s.push(p+1,"{"),s.push(p+2,'accessToken = pollJObject["access_token"].ToString();'),s.push(p+2,"break;"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if (pollJObject["error"] != null)'),s.push(p+1,"{"),s.push(p+2,'string errorValue = pollJObject["error"].ToString();'),s.push(p+2,'if (errorValue == "slow_down")'),s.push(p+2,"{"),s.push(p+3,"intervalMs = Math.Min(intervalMs * 2, 10000);"),s.push(p+2,"}"),s.push(p+2,'else if (errorValue == "access_denied" || errorValue == "expired_token")'),s.push(p+2,"{"),s.push(p+3,'throw new Exception($"Device flow failed: {errorValue}");'),s.push(p+2,"}"),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,"if (string.IsNullOrEmpty(accessToken))"),s.push(p,"{"),s.push(p+1,'throw new Exception("Timed out waiting for authorization");'),s.push(p,"}"),s.blank()}function f(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,"var oauth2JsonObject = new JSONObject(oauth2Response.body());"),s.blank(),s.push(p,'var intervalMs = oauth2JsonObject.has("interval")'),s.push(p+1,'? oauth2JsonObject.getInt("interval") * 1000'),s.push(p+1,": 5000;"),s.push(p,'var expiresIn = oauth2JsonObject.has("expires_in")'),s.push(p+1,'? oauth2JsonObject.getInt("expires_in")'),s.push(p+1,": 600;"),s.push(p,"var deadline = System.currentTimeMillis() + (expiresIn * 1000L);"),s.push(p,'var deviceCode = oauth2JsonObject.getString("device_code");'),s.push(p,"String accessToken = null;"),s.blank(),s.push(p,"while (System.currentTimeMillis() < deadline) {"),s.push(p+1,"Thread.sleep(intervalMs);"),s.blank(),s.push(p+1,"HashMap<String, String> pollParams = new HashMap<>();"),s.push(p+1,'pollParams.put("grant_type", "urn:ietf:params:oauth:grant-type:device_code");'),s.push(p+1,'pollParams.put("device_code", deviceCode);'),s.push(p+1,`pollParams.put("client_id", "${a}");`),s.blank(),s.push(p+1,"var pollForm = pollParams.keySet().stream()"),s.push(p+2,'.map(key -> key + "=" + URLEncoder.encode(pollParams.get(key), StandardCharsets.UTF_8))'),s.push(p+2,'.collect(Collectors.joining("&"));'),s.blank(),s.push(p+1,"var pollRequest = HttpRequest.newBuilder()"),s.push(p+2,".POST(HttpRequest.BodyPublishers.ofString(pollForm))"),s.push(p+2,`.uri(URI.create("${t}"))`),s.push(p+2,'.header("Content-Type", "application/x-www-form-urlencoded")'),s.push(p+2,'.header("Accept", "application/json")'),s.push(p+2,".build();"),s.blank(),s.push(p+1,"var pollResponse = httpClient.send(pollRequest, HttpResponse.BodyHandlers.ofString());"),s.push(p+1,"var pollJsonObject = new JSONObject(pollResponse.body());"),s.blank(),s.push(p+1,'if (pollJsonObject.has("access_token")) {'),s.push(p+2,'accessToken = pollJsonObject.getString("access_token");'),s.push(p+2,"break;"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if (pollJsonObject.has("error")) {'),s.push(p+2,'String errorValue = pollJsonObject.getString("error");'),s.push(p+2,'if (errorValue.equals("slow_down")) {'),s.push(p+3,"intervalMs = Math.min(intervalMs * 2, 10000);"),s.push(p+2,"}"),s.push(p+2,'else if (errorValue.equals("access_denied") || errorValue.equals("expired_token")) {'),s.push(p+3,'throw new Exception("Device flow failed: " + errorValue);'),s.push(p+2,"}"),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,"if (accessToken == null) {"),s.push(p+1,'throw new Exception("Timed out waiting for authorization");'),s.push(p,"}"),s.blank()}function m(s,{tokenUrl:t,clientId:a,level:p}){s.push(p,'var intervalMs = oauth2Response.has("interval") ? oauth2Response.getInt("interval") * 1000 : 5000;'),s.push(p,'var expiresIn = oauth2Response.has("expires_in") ? oauth2Response.getInt("expires_in") : 600;'),s.push(p,"var deadline = System.currentTimeMillis() + (expiresIn * 1000L);"),s.push(p,'var deviceCode = oauth2Response.getString("device_code");'),s.push(p,"String accessToken = null;"),s.blank(),s.push(p,"while (System.currentTimeMillis() < deadline) {"),s.push(p+1,"Thread.sleep(intervalMs);"),s.blank(),s.push(p+1,`HttpPost pollRequest = new HttpPost("${t}");`),s.push(p+1,'pollRequest.setHeader("Content-Type", "application/x-www-form-urlencoded");'),s.push(p+1,'pollRequest.setHeader("Accept", "application/json");'),s.blank(),s.push(p+1,"List<NameValuePair> pollParams = new ArrayList<NameValuePair>();"),s.push(p+1,'pollParams.add(new BasicNameValuePair("grant_type", "urn:ietf:params:oauth:grant-type:device_code"));'),s.push(p+1,'pollParams.add(new BasicNameValuePair("device_code", deviceCode));'),s.push(p+1,`pollParams.add(new BasicNameValuePair("client_id", "${a}"));`),s.push(p+1,"pollRequest.setEntity(new UrlEncodedFormEntity(pollParams));"),s.blank(),s.push(p+1,"JSONObject pollResponse = new JSONObject(EntityUtils.toString(httpClient.execute(pollRequest).getEntity()));"),s.blank(),s.push(p+1,'if (pollResponse.has("access_token")) {'),s.push(p+2,'accessToken = pollResponse.getString("access_token");'),s.push(p+2,"break;"),s.push(p+1,"}"),s.blank(),s.push(p+1,'if (pollResponse.has("error")) {'),s.push(p+2,'String errorValue = pollResponse.getString("error");'),s.push(p+2,'if (errorValue.equals("slow_down")) {'),s.push(p+3,"intervalMs = Math.min(intervalMs * 2, 10000);"),s.push(p+2,"}"),s.push(p+2,'else if (errorValue.equals("access_denied") || errorValue.equals("expired_token")) {'),s.push(p+3,'throw new RuntimeException("Device flow failed: " + errorValue);'),s.push(p+2,"}"),s.push(p+1,"}"),s.push(p,"}"),s.blank(),s.push(p,"if (accessToken == null) {"),s.push(p+1,'throw new RuntimeException("Timed out waiting for authorization");'),s.push(p,"}"),s.blank()}function R(s,{tokenUrl:t,clientId:a,level:p,responseVariable:u}){const i=u||"oauth2_data_req";s.push(`oauth2_response = content(${i}, "parsed")`),s.blank(),s.push("interval_ms = if (!is.null(oauth2_response$interval)) oauth2_response$interval * 1000 else 5000"),s.push("expires_in = if (!is.null(oauth2_response$expires_in)) oauth2_response$expires_in else 600"),s.push("deadline = as.numeric(Sys.time()) + expires_in"),s.push("device_code = oauth2_response$device_code"),s.push("access_token = NULL"),s.blank(),s.push("while (as.numeric(Sys.time()) < deadline) {"),s.push(p+1,"Sys.sleep(interval_ms / 1000)"),s.blank(),s.push(p+1,"poll_body <- list("),s.push(p+2,'grant_type = "urn:ietf:params:oauth:grant-type:device_code",'),s.push(p+2,"device_code = device_code,"),s.push(p+2,`client_id = "${a}"`),s.push(p+1,")"),s.blank(),s.push(p+1,"poll_response <- POST("),s.push(p+2,`"${t}",`),s.push(p+2,'add_headers("Content-Type" = "application/x-www-form-urlencoded", "Accept" = "application/json"),'),s.push(p+2,"body = poll_body,"),s.push(p+2,'encode = "form",'),s.push(p+2,"verbose()"),s.push(p+1,")"),s.blank(),s.push(p+1,'poll_data = content(poll_response, "parsed")'),s.blank(),s.push(p+1,"if (!is.null(poll_data$access_token)) {"),s.push(p+2,"access_token = poll_data$access_token"),s.push(p+2,"break"),s.push(p+1,"}"),s.blank(),s.push(p+1,"if (!is.null(poll_data$error)) {"),s.push(p+2,'if (poll_data$error == "slow_down") {'),s.push(p+3,"interval_ms = min(interval_ms * 2, 10000)"),s.push(p+2,'} else if (poll_data$error %in% c("access_denied", "expired_token")) {'),s.push(p+3,'stop(paste("Device flow failed:", poll_data$error))'),s.push(p+2,"}"),s.push(p+1,"}"),s.push("}"),s.blank(),s.push("if (is.null(access_token)) {"),s.push(p+1,'stop("Timed out waiting for authorization")'),s.push("}"),s.blank()}function g(s,{tokenUrl:t,clientId:a,level:p,responseVariable:u,capitalize:i}){const r=u||"oAuth2Response",n=i?"OAuth2Data":"oauth2_data";s.push(`${n} = JSON.parse(${r}.body)`),s.blank(),s.push(`interval_ms = (${n}['interval'] || 5) * 1000`),s.push(`expires_in = ${n}['expires_in'] || 600`),s.push("deadline = Time.now.to_i + expires_in"),s.push(`device_code = ${n}['device_code']`),s.push("access_token = nil"),s.blank(),s.push("while Time.now.to_i < deadline"),s.push(p+1,"sleep(interval_ms / 1000.0)"),s.blank(),s.push(p+1,`poll_url = URI('${t}')`),s.push(p+1,"poll_http = Net::HTTP.new(poll_url.host, poll_url.port)"),s.push(p+1,"poll_request = Net::HTTP::Post.new(poll_url)"),s.push(p+1,"poll_request['Content-Type'] = 'application/x-www-form-urlencoded'"),s.push(p+1,"poll_request['Accept'] = 'application/json'"),s.push(p+1,"poll_request.body = URI.encode_www_form({"),s.push(p+2,"grant_type: 'urn:ietf:params:oauth:grant-type:device_code',"),s.push(p+2,"device_code: device_code,"),s.push(p+2,`client_id: '${a}'`),s.push(p+1,"})"),s.blank(),s.push(p+1,"poll_response = poll_http.request(poll_request)"),s.push(p+1,"poll_data = JSON.parse(poll_response.body)"),s.blank(),s.push(p+1,"if poll_data['access_token']"),s.push(p+2,"access_token = poll_data['access_token']"),s.push(p+2,"break"),s.push(p+1,"end"),s.blank(),s.push(p+1,"if poll_data['error']"),s.push(p+2,"if poll_data['error'] == 'slow_down'"),s.push(p+3,"interval_ms = [interval_ms * 2, 10000].min"),s.push(p+2,"elsif ['access_denied', 'expired_token'].include?(poll_data['error'])"),s.push(p+3,`raise "Device flow failed: #{poll_data['error']}"`),s.push(p+2,"end"),s.push(p+1,"end"),s.push("end"),s.blank(),s.push("raise 'Timed out waiting for authorization' if access_token.nil?"),s.blank()}function y(s,{tokenUrl:t,clientId:a,short:p}){s.push(""),s.push("# Parse device code response"),s.push(`DEVICE_CODE=$(echo "$OAUTH2_RESPONSE" | jq -r '.device_code')`),s.push(`INTERVAL=$(echo "$OAUTH2_RESPONSE" | jq -r '.interval // 5')`),s.push(`EXPIRES_IN=$(echo "$OAUTH2_RESPONSE" | jq -r '.expires_in // 600')`),s.push("DEADLINE=$(($(date +%s) + EXPIRES_IN))"),s.push('ACCESS_TOKEN=""'),s.push(""),s.push("# Poll for access token"),s.push("while [ $(date +%s) -lt $DEADLINE ]; do"),s.push(" sleep $INTERVAL"),s.push(""),s.push(` POLL_RESPONSE=$(curl -s ${p?"-X":"--request"} POST \\`),s.push(` ${t} \\`),s.push(` ${p?"-H":"--header"} 'Content-Type: application/x-www-form-urlencoded' \\`),s.push(` ${p?"-H":"--header"} 'Accept: application/json' \\`),s.push(` ${p?"-d":"--data"} grant_type=urn:ietf:params:oauth:grant-type:device_code \\`),s.push(` ${p?"-d":"--data"} device_code=$DEVICE_CODE \\`),s.push(` ${p?"-d":"--data"} client_id=${a})`),s.push(""),s.push(` ACCESS_TOKEN=$(echo "$POLL_RESPONSE" | jq -r '.access_token // empty')`),s.push(' [ ! -z "$ACCESS_TOKEN" ] && break'),s.push(""),s.push(` ERROR=$(echo "$POLL_RESPONSE" | jq -r '.error // empty')`),s.push(' if [ "$ERROR" = "slow_down" ]; then'),s.push(" INTERVAL=$((INTERVAL * 2))"),s.push(" [ $INTERVAL -gt 10 ] && INTERVAL=10"),s.push(' elif [ "$ERROR" = "access_denied" ] || [ "$ERROR" = "expired_token" ]; then'),s.push(' echo "Device flow failed: $ERROR" >&2'),s.push(" exit 1"),s.push(" fi"),s.push("done"),s.push(""),s.push('if [ -z "$ACCESS_TOKEN" ]; then'),s.push(' echo "Timed out waiting for authorization" >&2'),s.push(" exit 1"),s.push("fi"),s.push("")}export{w as buildCSharpDeviceAuthorizationCodeSnippet,b as buildCSharpNewtonsoftDeviceAuthorizationCodeSnippet,k as buildGoDeviceAuthorizationCodeSnippet,h as buildJSDeviceAuthorizationCodeSnippet,m as buildJava8DeviceAuthorizationCodeSnippet,f as buildJavaDeviceAuthorizationCodeSnippet,_ as buildPHPDeviceAuthorizationCodeSnippet,o as buildPythonDeviceAuthorizationCodeSnippet,R as buildRDeviceAuthorizationCodeSnippet,g as buildRubyDeviceAuthorizationCodeSnippet,y as buildShellDeviceAuthorizationCodeSnippet};
@@ -0,0 +1,6 @@
1
+ export interface ObjectToPhpArrayOptions {
2
+ indent?: string;
3
+ inlineCharacterLimit?: number;
4
+ singleQuotes?: boolean;
5
+ }
6
+ export declare function objectToPhpArray(input: unknown, options?: ObjectToPhpArrayOptions): string;
@@ -0,0 +1,5 @@
1
+ const h=new Set(["number","boolean","function","symbol"]);function y(e,t={}){return u(e,t,"",[])}function u(e,t,a,i){const o=t.indent||" ",n={newLine:`
2
+ `,newLineOrSpace:`
3
+ `,pad:a,indent:a+o},L=r=>{if(t.inlineCharacterLimit===void 0)return r;const c=r.replace(new RegExp(n.newLine,"g"),"").replace(new RegExp(n.newLineOrSpace,"g")," ").replace(new RegExp(f(n.pad)+"|"+f(n.indent),"g"),"");return c.length<=t.inlineCharacterLimit?c:r.replace(new RegExp(n.newLine+"|"+n.newLineOrSpace,"g"),`
4
+ `).replace(new RegExp(f(n.pad),"g"),a).replace(new RegExp(f(n.indent),"g"),a+o)};if(i.includes(e))return'"Circular"';if(e===null)return"NULL";if(e===void 0||h.has(typeof e))return String(e);if(Array.isArray(e)){if(e.length===0)return"array()";i.push(e);const r="array("+n.newLine+e.map((c,w)=>{const g=e.length-1===w?n.newLine:","+n.newLineOrSpace,s=u(c,t,a+o,i);return n.indent+s+g}).join("")+n.pad+")";return i.pop(),L(r)}if(typeof e=="object"){const r=e,c=Object.keys(r);if(c.length===0)return"(object)[]";i.push(e);const w="array("+n.newLine+c.map((g,s)=>{const p=c.length-1===s?n.newLine:","+n.newLineOrSpace,d=u(r[g],t,a+o,i);return`${n.indent}"${g}" => ${d}${p}`}).join("")+n.pad+")";return i.pop(),L(w)}let l=String(e).replace(/[\r\n]/g,r=>r===`
5
+ `?"\\n":"\\r");return t.singleQuotes===!1?(l=l.replace(/"/g,'\\"'),`"${l}"`):(l=l.replace(/\\?'/g,"\\'"),`"${l}"`)}function f(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{y as objectToPhpArray};
@@ -0,0 +1,7 @@
1
+ import type * as HAR from '../../har.js';
2
+ export declare function objectToRString(input?: Record<string, unknown> | unknown[] | string, options?: {
3
+ indent?: string;
4
+ }): string;
5
+ export declare function postDataToRListBody(input: HAR.Param[], options: {
6
+ indent?: string;
7
+ }): string;
@@ -0,0 +1,6 @@
1
+ function i(n,t){return n==null||n===""?"":typeof n=="string"?JSON.stringify(n):JSON.stringify(n,null,1).split(`
2
+ `).map((o,r,e)=>r===e.length-1?o:(t?.indent??" ")+o).join(`
3
+ `).trim()}function f(n,t){return`
4
+ `+n.map(({name:r,value:e})=>(t?.indent??"")+`${r} = "${e??""}"`).join(`,
5
+ `)+`
6
+ `}export{i as objectToRString,f as postDataToRListBody};
@@ -0,0 +1,8 @@
1
+ export declare const shellHelpers: {
2
+ /**
3
+ * Strong single-quote shell quoting. Matches bash's single-quote rules: only
4
+ * single quotes need escaping, everything else is literal.
5
+ */
6
+ quote(value: string): string;
7
+ escape(value: string): string;
8
+ };
@@ -0,0 +1 @@
1
+ const n=/^[a-z0-9-_/.@%^=:]+$/i;function c(e,...r){let t=0;return e.replace(/%s/g,()=>t<r.length?String(r[t++]):"%s")}const s={quote(e){return n.test(e)?e:c("'%s'",e.replace(/'/g,"'\\''"))},escape(e){return e.replace(/\r/g,"\\r").replace(/\n/g,"\\n")}};export{s as shellHelpers};
@@ -0,0 +1,4 @@
1
+ export declare function camelCase(s: string): string;
2
+ export declare function snakeCase(s: string): string;
3
+ export declare function pascalCase(s: string): string;
4
+ export declare function escapeSingleQuoted(value: string): string;
@@ -0,0 +1 @@
1
+ const S=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/),Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,n="\\ud800-\\udfff",k="\\u0300-\\u036f",D="\\ufe20-\\ufe2f",W="\\u20d0-\\u20ff",H="\\u1ab0-\\u1aff",N="\\u1dc0-\\u1dff",$=k+D+W+H+N,i="\\u2700-\\u27bf",p="a-z\\xdf-\\xf6\\xf8-\\xff",T="\\xac\\xb1\\xd7\\xf7",V="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_="\\u2000-\\u206f",y=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",x="A-Z\\xc0-\\xd6\\xd8-\\xde",g="\\ufe0e\\ufe0f",b=T+V+_+y,R="['\u2019]",C=`[${b}]`,c=`[${$}]`,l="\\d",B=`[${i}]`,m=`[${p}]`,U=`[^${n}${b+l+i+p+x}]`,a="\\ud83c[\\udffb-\\udfff]",F=`(?:${c}|${a})`,A=`[^${n}]`,u="(?:\\ud83c[\\udde6-\\uddff]){2}",f="[\\ud800-\\udbff][\\udc00-\\udfff]",e=`[${x}]`,L="\\u200d",M=`(?:${m}|${U})`,J=`(?:${e}|${U})`,h=`(?:${R}(?:d|ll|m|re|s|t|ve))?`,w=`(?:${R}(?:D|LL|M|RE|S|T|VE))?`,j=`${F}?`,z=`[${g}]?`,P=`(?:${L}(?:${[A,u,f].join("|")})${z+j})*`,q="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",v="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",E=z+j+P,Q=`(?:${[B,u,f].join("|")})${E}`,G=RegExp([`${e}?${m}+${h}(?=${[C,e,"$"].join("|")})`,`${J}+${w}(?=${[C,e+M,"$"].join("|")})`,`${e}?${M}+${h}`,`${e}+${w}`,v,q,`${l}+`,Q].join("|"),"g"),I=RegExp(`[${L+n+$+g}]`),K=s=>I.test(s),X=RegExp(`${a}(?=${a})|(?:${[`${A}${c}?`,c,u,f,`[${n}]`].join("|")})${E}`,"g");function d(s){const o=s.replace(/['\u2019]/g,"");return(S(o)?o.match(G):o.match(Z))||[]}function O(s){if(!s)return"";if(K(s)){const o=s.match(X)||[];return(o[0]||"").toUpperCase()+o.slice(1).join("")}return s[0].toUpperCase()+s.slice(1)}function Y(s){return d(s).reduce((o,r,t)=>o+(t?O(r.toLowerCase()):r.toLowerCase()),"")}function ss(s){return d(s).reduce((o,r,t)=>o+(t?"_":"")+r.toLowerCase(),"")}function os(s){return d(s).reduce((o,r)=>o+O(r.toLowerCase()),"")}function rs(s){return s.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}export{Y as camelCase,rs as escapeSingleQuoted,os as pascalCase,ss as snakeCase};
@@ -0,0 +1,11 @@
1
+ export type TransformFn = (input: Record<string, unknown>, key: string, originalResult: string) => string;
2
+ export interface StringifyOptions {
3
+ indent?: string;
4
+ inlineCharacterLimit?: number;
5
+ transform?: TransformFn;
6
+ }
7
+ export declare function stringifyJSObject(value: unknown, options?: StringifyOptions): string;
8
+ export declare function getPreserveTransformer({ body, authorizationHeader, }: {
9
+ body?: boolean;
10
+ authorizationHeader?: boolean;
11
+ }): TransformFn;
@@ -0,0 +1,8 @@
1
+ const j=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function A(n,r={}){return $(n,r,0,void 0,void 0)}function $(n,r,t,s,d){const{indent:u=" ",inlineCharacterLimit:y,transform:b}=r;let e;if(n==null)e=String(n);else if(typeof n=="string")e=h(n);else if(typeof n=="number"||typeof n=="boolean")e=String(n);else if(Array.isArray(n))if(n.length===0)e="[]";else{const f=n.map(o=>$(o,r,t+1,void 0,void 0)),c=`[${f.join(", ")}]`;if(l(c,y))e=c;else{const o=u.repeat(t+1),g=u.repeat(t);e=`[
2
+ ${f.map(i=>o+i).join(`,
3
+ `)}
4
+ ${g}]`}}else if(typeof n=="object"){const f=n,c=Object.entries(f);if(c.length===0)e="{}";else{const o=c.map(([i,a])=>{const p=j.test(i)?i:h(i),m=$(a,r,t+1,f,i);return`${p}: ${m}`}),g=`{${o.join(", ")}}`;if(l(g,y))e=g;else{const i=u.repeat(t+1),a=u.repeat(t);e=`{
5
+ ${o.map(p=>i+p).join(`,
6
+ `)}
7
+ ${a}}`}}}else e=String(n);return b&&s!==void 0&&d!==void 0?b(s,d,e):e}function h(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}'`}function l(n,r){return r===void 0||n.includes(`
8
+ `)?!1:n.length<=r}function z({body:n,authorizationHeader:r}){return function(t,s,d){return n&&s==="body"&&typeof t.body=="string"?t.body:r&&s==="Authorization"&&typeof t.Authorization=="string"?t.Authorization:d}}export{z as getPreserveTransformer,A as stringifyJSObject};
@@ -0,0 +1,2 @@
1
+ import type { CodeSampleHAR, OAuth2PreRequest } from '../../sample-har.js';
2
+ export declare function toCodeSampleHAR(preReq: OAuth2PreRequest): CodeSampleHAR;
@@ -0,0 +1 @@
1
+ function n(a){const o={};for(const t of a.headers)o[t.name]=t.value;const s={};for(const t of a.queryString??[])s[t.name]=t.value;const r=a.postData?.params?.length?a.postData.params.reduce((t,e)=>(t[e.name]=e.value??"",t),{}):void 0;return{method:a.method.toUpperCase(),url:a.url,httpVersion:a.httpVersion??"HTTP/1.1",cookies:a.cookies??[],headers:a.headers,queryString:a.queryString??[],postData:a.postData,headersSize:a.headersSize??-1,bodySize:a.bodySize??-1,fullUrl:a.url,headersObj:o,allHeaders:{...o},queryObj:s,paramsObj:r,pathParameters:{},serverVariables:{}}}export{n as toCodeSampleHAR};
@@ -0,0 +1,17 @@
1
+ import type { CodeSampleHAR } from '../../sample-har.js';
2
+ import type { CodeBuilder } from './code-builder.js';
3
+ export type CodeOperand = {
4
+ type: 'string';
5
+ value: string;
6
+ } | {
7
+ type: 'variable';
8
+ name: string;
9
+ };
10
+ export declare function parseUrlIntoOperands(url: string, params: Record<string, unknown>): CodeOperand[];
11
+ export declare function buildUrlExpression(har: CodeSampleHAR, code: CodeBuilder, url?: string): string;
12
+ export declare function printUrlVariablesDeclarations(har: CodeSampleHAR, code: CodeBuilder, indentationLevel?: number): void;
13
+ export declare function addIndentation(str: string, { level, indent, firstLine }?: {
14
+ firstLine?: boolean | undefined;
15
+ indent?: string | undefined;
16
+ level?: number | undefined;
17
+ }): string;
@@ -0,0 +1,2 @@
1
+ import{VariableType as b}from"./code-builder.js";function m(e,n){const i=Object.keys(n).map(r=>({name:r,idx:e.indexOf(`{${r}}`)})).filter(({idx:r})=>r>-1).sort((r,s)=>r.idx-s.idx),t=[];let a=0;for(const{name:r,idx:s}of i)s>a&&t.push({type:"string",value:e.substring(a,s)}),t.push({type:"variable",name:r}),a=s+r.length+2;return a<e.length&&t.push({type:"string",value:e.substring(a)}),t}function f(e,n,l){const{joinSymbol:i,variableWrapperFn:t,stringLiteral:a,urlFieldName:r,rawName:s}=n.langOptions,c={...e.pathParameters,...e.serverVariables},p=l??e[r]??"";return m(p,c).map(o=>{if(o.type==="variable"){const u=c[o.name],v=s?o.name:n.var(o.name,b.PATH);return t(v,u)}return a(o.value)}).join(i)}function g(e,n,l){const i={...e.pathParameters,...e.serverVariables};for(const[t,a]of Object.entries(i)){if(t==="server")continue;const r=a!=null&&a!==""?String(a):`YOUR_${t}_PARAMETER`,s=n.var(t,b.PATH),p=m(r,i).some(u=>u.type==="variable"),o=f(e,n,r);l!==void 0?n.push(l,n.langOptions.variableDeclaration(s,{hasVariableInterpolation:p}),o):n.push(n.langOptions.variableDeclaration(s,{hasVariableInterpolation:p}),o)}}function d(e,{level:n=0,indent:l=" ",firstLine:i=!0}={}){const t=l.repeat(n),a=e.replace(/(\r\n|\n|\r)/gm,`
2
+ ${t}`);return i?t.concat(a):a}export{d as addIndentation,f as buildUrlExpression,m as parseUrlIntoOperands,g as printUrlVariablesDeclarations};
@@ -0,0 +1,16 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ export type { GeneratorOptions } from './types.js';
4
+ export declare function isSupportedLanguage(languageKey: string): boolean;
5
+ export type CodeSampleResult = {
6
+ kind: 'ok';
7
+ source: string;
8
+ } | {
9
+ kind: 'unsupported-language';
10
+ language: string;
11
+ } | {
12
+ kind: 'error';
13
+ error: unknown;
14
+ };
15
+ export declare function tryGenerateCodeSample(languageKey: string, har: CodeSampleHAR, options?: GeneratorOptions): CodeSampleResult;
16
+ export declare function generateCodeSample(languageKey: string, har: CodeSampleHAR, options?: GeneratorOptions): string;
@@ -0,0 +1 @@
1
+ import{generateCurl as s}from"./curl.js";import{generateJavaScript as m}from"./javascript.js";import{generateNode as a}from"./node.js";import{generatePython as p}from"./python.js";import{generateJava as i}from"./java.js";import{generateJava8 as u}from"./java8.js";import{generateCSharp as f}from"./csharp.js";import{generateCSharpNewtonsoft as c}from"./csharp-newtonsoft.js";import{generateGo as w}from"./go.js";import{generatePHP as h}from"./php.js";import{generateRuby as l}from"./ruby.js";import{generateR as C}from"./r.js";const n={curl:{withImports:!0,withComments:!1,short:!0},javascript:{withImports:!1,withComments:!1},node:{withImports:!0,withComments:!1},python:{withImports:!0,withComments:!1},java:{withImports:!0,withComments:!1},java8:{withImports:!0,withComments:!1},csharp:{withImports:!0,withComments:!1},csharpnewtonsoft:{withImports:!0,withComments:!1},go:{withImports:!0,withComments:!1},php:{withImports:!0,withComments:!1},ruby:{withImports:!0,withComments:!1},r:{withImports:!0,withComments:!1}};function g(r){return r in n}function N(r,t,o){if(!g(r))return{kind:"unsupported-language",language:r};try{return{kind:"ok",source:d(r,t,o)}}catch(e){return{kind:"error",error:e}}}function d(r,t,o){const e={...n[r],...o};switch(r){case"curl":return s(t,e);case"javascript":return m(t,e);case"node":return a(t,e);case"python":return p(t,e);case"java":return i(t,e);case"java8":return u(t,e);case"csharp":return f(t,e);case"csharpnewtonsoft":return c(t,e);case"go":return w(t,e);case"php":return h(t,e);case"ruby":return l(t,e);case"r":return C(t,e);default:return`// Unsupported language: ${r}`}}export{d as generateCodeSample,g as isSupportedLanguage,N as tryGenerateCodeSample};
@@ -0,0 +1,9 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type JavaOptions = GeneratorOptions & {
4
+ indent?: string;
5
+ withWrapper?: boolean;
6
+ variablesPrefix?: string;
7
+ };
8
+ export declare function generateJava(har: CodeSampleHAR, options?: JavaOptions): string;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import{CodeBuilder as g,Lang as v}from"./helpers/code-builder.js";import{addIndentation as k,buildUrlExpression as D,printUrlVariablesDeclarations as S}from"./helpers/url-helpers.js";import{buildJavaDeviceAuthorizationCodeSnippet as j}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as m}from"./helpers/mime.js";import{MediaTypes as p}from"../../../constants/openapi.js";import{toCodeSampleHAR as R}from"./helpers/sub-request.js";function C(e){const n=e.match(/^([a-z][a-z0-9+.-]*:)\/\/([^/?#]+)(\/[^?#]*)?/i);return n?{protocol:n[1],host:n[2],pathname:n[3]??"/"}:{protocol:"http:",host:"localhost",pathname:"/"}}function h(e){return e.postData&&m(e.postData.mimeType)===p.URL_ENCODED?"HttpRequest.BodyPublishers.ofString(form)":!e.postData?.params?.length&&e.postData?.text&&m(e.postData.mimeType)===p.MULTIPART?"body":e.postData?"HttpRequest.BodyPublishers.ofString(payload)":["POST","PUT","PATCH"].includes(e.method.toUpperCase())?'HttpRequest.BodyPublishers.ofString("some body text")':""}function T(e,n){const r={indent:" ",withWrapper:!0,...n},t=new g({indentation:r.indent,variablesPrefix:r.variablesPrefix,capitalize:!0,lang:v.JAVA}),a=e.oAuth2PreRequests?.[0],u=Object.keys(e.queryObj??{}).length>0,l=m(e.postData?.mimeType);r.withComments&&(t.push("/**"),t.push(" * Requires JDK >= 11"),a&&(t.push(" *"),t.push(' * Requires package "org.json" >= 20201115'),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.json/json")),t.push(" */"),t.blank()),r.withImports&&(t.push("import java.net.*;"),t.push("import java.net.http.*;"),t.push("import java.util.*;"),(l===p.URL_ENCODED&&e.postData?.params||a||u)&&(t.push("import java.nio.charset.StandardCharsets;"),t.push("import java.util.stream.Collectors;")),a&&t.push("import org.json.JSONObject;"),!e.postData?.params?.length&&e.postData?.text&&l===p.MULTIPART&&t.push("import java.nio.file.Path;"),t.blank()),r.withWrapper&&(t.push("public class App {"),t.push(1,"public static void main(String[] args) throws Exception {"),t.push(2,"var httpClient = HttpClient.newBuilder().build();"),t.blank());const i={...e.allHeaders??e.headersObj};if(a){const s=T(R(a),{...r,withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"});t.push(s),t.blank(),t.push(2,"var oauth2Response = httpClient.send(oauth2Request, HttpResponse.BodyHandlers.ofString());"),a.flowType==="deviceAuthorization"?j(t,{tokenUrl:a.tokenUrl??"YOUR_TOKEN_URL",clientId:a.clientId??"YOUR_CLIENT_ID",level:2}):(t.push(2,'var accessToken = new JSONObject(oauth2Response.body()).getString("access_token");'),t.blank()),i.Authorization='"Bearer " + accessToken'}if(e.postData)switch(l){case p.URL_ENCODED:if(e.postData.params?.length){t.push(2,"HashMap<String, String> params = new HashMap<>();");for(const s of e.postData.params)t.push(2,'params.put("%s", "%s");',s.name,s.value??"");t.blank(),t.push(2,"var form = params.keySet().stream()"),t.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),t.push(3,'.collect(Collectors.joining("&"));'),t.blank()}else e.postData.text&&(t.push(2,'var form = "%s";',e.postData.text),t.blank());break;case p.JSON:e.jsonObj&&(t.push(2,`var payload = String.join("\\n"
2
+ ${k(JSON.stringify(e.jsonObj,null,1).replace(/"/g,'\\"').replace(/^/gm,', "').replace(/$/gm,'"'),{level:3,indent:r.indent,firstLine:!1})}`),t.push(2,");"),t.blank());break;case p.XML:if(e.postData.text){t.push(2,'var payload = String.join("\\n"');for(const s of e.postData.text.trim().split(`
3
+ `)){const o=s.replace(/"/g,'\\"');t.push(3,`"${o}", `)}t.push(2,");"),t.blank()}break;case p.OCTET_STREAM:e.postData.text&&(t.push(2,'var payload = "%s";',e.postData.text),t.blank());break;case p.MULTIPART:if(e.postData.params&&e.postData.params.length>0){t.push(2,"var multipartBody = MultipartBodyPublisher.newBuilder();");for(const s of e.postData.params)s.fileName?t.push(2,'multipartBody.append("%s", Path.of("%s"));',s.name,s.fileName):t.push(2,'multipartBody.append("%s", "%s");',s.name,s.value??"");t.push(2,"var body = multipartBody.build();"),t.blank()}else e.postData.text&&(t.push(2,'var payload = "%s";',e.postData.text.replace(/\\/g,"\\\\").replace(/"/g,'\\"')),t.blank());break}if(u){t.push(2,"HashMap<String, String> params = new HashMap<>();");for(const[s,o]of Object.entries(e.queryObj))t.push(2,'params.put("%s", "%s");',s,Array.isArray(o)?o.join(","):o);t.blank(),t.push(2,"var query = params.keySet().stream()"),t.push(3,'.map(key -> key + "=" + URLEncoder.encode(params.get(key), StandardCharsets.UTF_8))'),t.push(3,'.collect(Collectors.joining("&"));'),t.blank()}const{protocol:c,host:d,pathname:f}=C(e.fullUrl??"");t.push(2,`var ${t.var("host")} = "%s";`,c+"//"+d),S(e,t,2);const b=f.replace(/\{/g,"%7B").replace(/\}/g,"%7D"),y={...e,pathname:b};t.push(2,`var ${t.var("pathname")} = %s;`,D(y,t)),t.push(2,`var ${t.var("request")} = HttpRequest.newBuilder()`),e.method.toUpperCase()==="PATCH"?t.push(3,'.method("PATCH", %s)',h(e)):t.push(3,".%s(%s)",e.method.toUpperCase(),h(e)),t.push(3,`.uri(URI.create(${t.var("host")} + ${t.var("pathname")} %s))`,u?"+ '?' + query":"");for(const s of Object.keys(i)){const o=s==="Authorization"&&a;t.push(3,'.header("%s", %s)',s,o?i[s]:`"${i[s]}"`)}if(e.basicAuth){const{username:s,password:o}=e.basicAuth;t.push(3,`.header("Authorization", "Basic " + Base64.getEncoder().encodeToString(("${s}:${o}").getBytes()))`)}return t.push(3,".build();"),r.withWrapper&&(t.blank(),t.push(2,"var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());"),t.blank(),t.push(2,"System.out.println(response.body());"),t.push(1,"}"),t.push("}")),t.join()}export{T as generateJava};
@@ -0,0 +1,9 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type Java8Options = GeneratorOptions & {
4
+ indent?: string;
5
+ withWrapper?: boolean;
6
+ variablesPrefix?: string;
7
+ };
8
+ export declare function generateJava8(har: CodeSampleHAR, options?: Java8Options): string;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import{CodeBuilder as j,Lang as w}from"./helpers/code-builder.js";import{buildUrlExpression as A,printUrlVariablesDeclarations as k}from"./helpers/url-helpers.js";import{buildJava8DeviceAuthorizationCodeSnippet as v}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as D}from"./helpers/mime.js";import{MediaTypes as r}from"../../../constants/openapi.js";import{toCodeSampleHAR as N}from"./helpers/sub-request.js";function C(e){return e.charAt(0).toUpperCase()+e.slice(1)}function g(e){return"Http"+C(e.toLowerCase())}function d(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===0}function b(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e){return typeof e=="string"}function c(e){return S(e)?JSON.stringify(e):e==null?"JSONObject.NULL":String(e)}function q(e,E){const p={indent:" ",withWrapper:!0,...E},t=new j({indentation:p.indent,variablesPrefix:p.variablesPrefix,capitalize:!0,lang:w.JAVA8}),l=g(e.method),a=e.oAuth2PreRequests?.[0],m=D(e.postData?.mimeType);p.withComments&&(t.push("/**"),t.push(" * Requires JDK >= 8"),t.push(" *"),t.push(" * Requires Apache HttpComponents Client >= 4.3.5"),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.apache.httpcomponents/httpcomponents-client"),t.push(" *"),t.push(' * Requires package "junit4"'),t.push(" * See here for installation details:"),t.push(" * https://junit.org/junit4"),t.push(" *"),t.push(' * Requires package "org.json" >= 20180130'),t.push(" * See here for installation details:"),t.push(" * https://search.maven.org/artifact/org.json/json"),t.push(" */"),t.blank()),p.withImports&&(t.push("import org.apache.http.util.EntityUtils;"),t.push("import org.apache.http.NameValuePair;"),t.push("import org.apache.http.client.HttpClient;"),t.push("import org.apache.http.client.entity.UrlEncodedFormEntity;"),e.method&&t.push(`import org.apache.http.client.methods.${l};`),a&&a.method.toLowerCase()!==e.method.toLowerCase()&&t.push(`import org.apache.http.client.methods.${g(a.method)};`),t.push("import org.apache.http.impl.client.HttpClientBuilder;"),t.push("import org.apache.http.message.BasicNameValuePair;"),t.push("import org.apache.http.entity.StringEntity;"),t.push("import org.json.JSONObject;"),t.push("import org.json.JSONArray;"),t.push("import java.util.ArrayList;"),t.push("import java.util.List;"),t.push("import org.apache.http.entity.mime.MultipartEntity;"),t.push("import org.apache.http.entity.mime.content.StringBody;"),!e.postData?.params?.length&&e.postData?.text&&m===r.MULTIPART&&(t.push("import org.apache.http.entity.mime.content.FileBody;"),t.push("import java.io.File;")),e.basicAuth&&t.push("import java.util.Base64;"),t.blank()),p.withWrapper&&(t.push("public class App {"),t.push(1,"public static void main(String[] args ) throws java.io.IOException {"),t.push(2,"HttpClient httpClient = HttpClientBuilder.create().build();"),t.blank());const f={...e.allHeaders??e.headersObj};if(a){const s=q(N(a),{...p,withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"});t.push(s),t.push(2,"JSONObject %s = new JSONObject(EntityUtils.toString(httpClient.execute(%s).getEntity()));","oauth2Response","oauth2Request"),a.flowType==="deviceAuthorization"?v(t,{tokenUrl:a.tokenUrl??"YOUR_TOKEN_URL",clientId:a.clientId??"YOUR_CLIENT_ID",level:2}):(t.push(2,'String accessToken = %s.getString("access_token");',"oauth2Response"),t.blank())}k(e,t,2);const O=A(e,t);t.push(2,`%s ${t.var("request")} = new %s(%s);`,l,l,O);const y=Object.keys(f);if(y.length&&!(e.postData&&e.postData.mimeType===r.MULTIPART))for(const s of y){const i=s.toLowerCase()==="authorization";t.push(2,'%s.setHeader("%s", %s);',t.var("request"),s,a&&i?'"Bearer " + accessToken':`"${f[s]}"`)}if(e.basicAuth){const{username:s,password:i}=e.basicAuth;t.push(2,`String encodedString = Base64.getEncoder().encodeToString("${s}:${i}".getBytes());`),t.push(2,'%s.setHeader("%s", "%s"+encodedString);',t.var("request"),"Authorization","Basic ")}const h=(s,i)=>{const n=Array.isArray(s)?s.map((u,o)=>[String(o),u]):Object.entries(s);for(const[u,o]of n)o!==null&&typeof o=="object"?(t.push(i,'.put("%s", new JSONObject()',u),h(o,i+1),t.push(i,")")):t.push(i,'.put("%s", %s)',u,c(o))};if(e.postData)switch(m){case r.URL_ENCODED:if(e.postData.params?.length){t.blank(),t.push(2,"List<NameValuePair> params = new ArrayList<NameValuePair>();");for(const s of e.postData.params)t.push(2,'params.add(new BasicNameValuePair("%s", "%s"));',s.name,s.value??"");t.push(2,"%s.setEntity(new UrlEncodedFormEntity(params));",t.var("request")),t.blank()}else e.postData.text&&(t.blank(),t.push(2,'%s.setEntity(new StringEntity("%s"));',t.var("request"),e.postData.text),t.blank());break;case r.MULTIPART:if(e.postData.params&&e.postData.params.length>0){t.push(2,"MultipartEntity reqEntity = new MultipartEntity();");for(const s of e.postData.params)s.fileName?t.push(2,'reqEntity.addPart("%s", new FileBody(new File("%s")));',s.name,s.fileName):t.push(2,'reqEntity.addPart("%s", %s);',s.name,S(s.value)?`new StringBody("${s.value}")`:s.value);t.push(2,"%s.setEntity(reqEntity);",t.var("request"))}else e.postData.text&&t.push(2,'%s.setEntity(new StringEntity("%s"));',t.var("request"),e.postData.text.replace(/\\/g,"\\\\").replace(/"/g,'\\"'));break;case r.JSON:if(e.jsonObj){t.push(2,"JSONObject payload = new JSONObject();");for(const[s,i]of Object.entries(e.jsonObj))if(Array.isArray(i)){t.push(2,'payload.put("%s", new JSONArray()',s);for(const n of i)b(n)?(t.push(3,".put(new JSONObject()"),h(n,4),t.push(3,")")):t.push(3,".put(%s)",c(n));t.push(2,");")}else b(i)?(t.push(2,'payload.put("%s", new JSONObject()%s',s,d(i)?");":""),h(i,3),d(i)||t.push(2,");")):t.push(2,'payload.put("%s", %s);',s,c(i));t.push(2,"%s.setEntity(new StringEntity(payload.toString()));",t.var("request"))}break;case r.XML:if(e.postData.text){t.push(2,'String payload = String.join("\\n"');for(const s of e.postData.text.trim().split(`
2
+ `)){const i=s.replace(/"/g,'\\"');t.push(3,`"${i}", `)}t.push(2,");"),t.push(2,"%s.setEntity(new StringEntity(payload));",t.var("request"))}break;case r.OCTET_STREAM:e.postData.text&&t.push(2,'%s.setEntity(new StringEntity("%s"));',t.var("request"),e.postData.text);break}return p.withWrapper&&(t.push(2,`String ${t.var("response")} = EntityUtils.toString(httpClient.execute(request).getEntity());`),t.blank(),t.push(2,"System.out.println(response);"),t.push(1,"}"),t.push("}")),t.join()}export{q as generateJava8};
@@ -0,0 +1,9 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type JavaScriptOptions = GeneratorOptions & {
4
+ indent?: string;
5
+ variablesPrefix?: string;
6
+ credentials?: 'omit' | 'same-origin' | 'include' | null;
7
+ };
8
+ export declare function generateJavaScript(har: CodeSampleHAR, options?: JavaScriptOptions): string;
9
+ export {};
@@ -0,0 +1 @@
1
+ import{CodeBuilder as O,Lang as $}from"./helpers/code-builder.js";import{addIndentation as l,buildUrlExpression as S,printUrlVariablesDeclarations as g}from"./helpers/url-helpers.js";import{buildJSDeviceAuthorizationCodeSnippet as D}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as m}from"./helpers/mime.js";import{escapeSingleQuoted as h}from"./helpers/string-utils.js";import{MediaTypes as n}from"../../../constants/openapi.js";import{stringifyJSObject as p,getPreserveTransformer as j}from"./helpers/stringify-js.js";import{toCodeSampleHAR as A}from"./helpers/sub-request.js";function C(t,b){const a={indent:" ",credentials:null,...b},i=a.indent,e=new O({indentation:i,variablesPrefix:a.variablesPrefix,capitalize:!0,lang:$.JAVASCRIPT});a.withComments&&(e.push("/**"),e.push(" * Requires ES8-compatible browser: https://caniuse.com/async-functions"),e.push(" */"),e.blank());const s={method:t.method.toUpperCase()};Object.keys(t.headersObj).length&&(s.headers={...t.headersObj});let c=!1;const o=t.oAuth2PreRequests?.[0];if(o){const r=C(A(o),{...a,withImports:!1,withComments:!1,variablesPrefix:"oAuth2"});e.push(r),e.blank(),o.flowType==="deviceAuthorization"&&D(e,{tokenUrl:o.tokenUrl??"YOUR_TOKEN_URL",clientId:o.clientId??"YOUR_CLIENT_ID",level:0}),s.headers=s.headers||{},s.headers.Authorization="'Bearer ' + accessToken",c=!0}a.credentials!==null&&a.credentials!==void 0&&(s.credentials=a.credentials);const u=Object.keys(t.queryObj??{}).length>0;u&&e.push(`const ${e.var("query")} = new URLSearchParams(${p(t.queryObj,{indent:i,inlineCharacterLimit:25})}).toString();`).blank();const d=m(t.postData?.mimeType);if(t.postData)switch(d){case n.URL_ENCODED:t.paramsObj?(e.push(`const ${e.var("formData")} = ${l(p(t.paramsObj,{indent:i,inlineCharacterLimit:25}),{level:0,firstLine:!1})};`).blank(),s.body=`new URLSearchParams(${e.var("formData")}).toString()`):s.body=`"${t.postData.text??""}"`;break;case n.JSON:t.jsonObj&&(s.body=`JSON.stringify(${l(p(t.jsonObj,{indent:i,inlineCharacterLimit:25}),{level:1,firstLine:!1})})`);break;case n.MULTIPART:if(e.push(`const ${e.var("form")} = new FormData();`),s.headers&&delete s.headers["Content-Type"],t.postData.params&&t.postData.params.length>0)for(const r of t.postData.params)e.push(`${e.var("form")}.append(%s, %s);`,JSON.stringify(r.name),JSON.stringify(r.value||r.fileName||""));else t.postData.text&&e.push(`${e.var("form")}.append('data', %s);`,JSON.stringify(t.postData.text));s.body=e.var("form"),e.blank();break;default:t.postData.text&&(s.body=`\`${l(t.postData.text,{level:2,indent:i,firstLine:!1}).trim()}\``)}const f=s.headers?.Accept&&m(s.headers.Accept)===n.JSON||d===n.JSON;if(t.basicAuth){const{username:r,password:y}=t.basicAuth;s.headers=s.headers||{},s.headers.Authorization=`'Basic ' + btoa('${h(r)}:${h(y)}')`,c=!0}g(t,e);const v=S(t,e);return e.push(`const ${e.var("resp")} = await fetch(`).push(1,"`"+v+(u?"?${"+e.var("query")+"}":"")+"`,").push(l(p(s,{indent:i,inlineCharacterLimit:25,transform:j({body:!0,authorizationHeader:c})}),{level:1,indent:i})).push(");").blank(),t.allResponseCodes?.includes("204")||t.responseCodes?.includes("204")?e.push("if (resp.status === 204) {").push(1,"console.log('success');").push("} else {").push(1,`const ${e.var("data")} = await ${e.var("resp")}.${f?"json()":"text()"};`).push(1,`console.log(${e.var("data")});`).push("}"):e.push(`const ${e.var("data")} = await ${e.var("resp")}.${f?"json()":"text()"};`).push(`console.log(${e.var("data")});`),e.join()}export{C as generateJavaScript};
@@ -0,0 +1,10 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type NodeOptions = GeneratorOptions & {
4
+ indent?: string;
5
+ variablesPrefix?: string;
6
+ showBoilerplate?: boolean;
7
+ level?: number;
8
+ };
9
+ export declare function generateNode(har: CodeSampleHAR, options?: NodeOptions): string;
10
+ export {};
@@ -0,0 +1 @@
1
+ import{CodeBuilder as w,Lang as k}from"./helpers/code-builder.js";import{addIndentation as p,buildUrlExpression as y,printUrlVariablesDeclarations as S}from"./helpers/url-helpers.js";import{buildJSDeviceAuthorizationCodeSnippet as j}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as $}from"./helpers/mime.js";import{MediaTypes as l}from"../../../constants/openapi.js";import{stringifyJSObject as m,getPreserveTransformer as D}from"./helpers/stringify-js.js";import{toCodeSampleHAR as g}from"./helpers/sub-request.js";function R(t,v){const r={indent:" ",showBoilerplate:!0,level:1,...v},i=r.indent,s=r.level;let c=!1;const e=new w({indentation:i,variablesPrefix:r.variablesPrefix,capitalize:!0,lang:k.NODEJS});r.withComments&&(e.push("/**"),e.push(" * Requires Node.js >= 14"),e.push(" *"),e.push(' * Requires module "node-fetch" >= 2.6.1'),e.push(" * See here for installation details:"),e.push(" * https://www.npmjs.com/package/node-fetch"),e.push(" */"),e.blank()),r.withImports&&(e.push("import fetch from 'node-fetch';"),e.blank()),r.showBoilerplate&&e.push("async function run() {");const a={method:t.method.toUpperCase()};Object.keys(t.headersObj).length&&(a.headers={...t.headersObj});let u=!1;const n=t.oAuth2PreRequests?.[0];if(n){const o=R(g(n),{...r,withImports:!1,withComments:!1,variablesPrefix:"oAuth2",showBoilerplate:!1,level:1});e.push(o),e.blank(),n.flowType==="deviceAuthorization"&&j(e,{tokenUrl:n.tokenUrl??"YOUR_TOKEN_URL",clientId:n.clientId??"YOUR_CLIENT_ID",level:s}),a.headers=a.headers||{},a.headers.Authorization="'Bearer ' + accessToken",u=!0}const d=Object.keys(t.queryObj??{}).length>0;d&&e.push(s,`const ${e.var("query")} = new URLSearchParams(${p(m(t.queryObj,{indent:i,inlineCharacterLimit:25}),{level:s,indent:i,firstLine:!1})}).toString();`).blank();const h=$(t.postData?.mimeType);if(t.postData)switch(h){case l.URL_ENCODED:a.body=t.paramsObj?`new URLSearchParams(${e.var("formData")}).toString()`:`"${t.postData.text??""}"`,t.paramsObj&&e.push(s,`const ${e.var("formData")} = ${p(m(t.paramsObj,{indent:i,inlineCharacterLimit:25}),{level:s,firstLine:!1})};`).blank();break;case l.JSON:t.jsonObj&&(a.body=`JSON.stringify(${p(m(t.jsonObj,{indent:i,inlineCharacterLimit:25}),{level:s,firstLine:!1})})`);break;case l.MULTIPART:if(a.headers&&delete a.headers["Content-Type"],r.withImports&&e.unshift("import FormData from 'form-data';"),e.push(s,`const ${e.var("form")} = new FormData();`),t.postData.params&&t.postData.params.length>0)for(const o of t.postData.params){if(!o.fileName&&!o.contentType){e.push(s,`${e.var("form")}.append('${o.name}', '${o.value??""}');`);continue}o.fileName&&(c=!0,e.blank(),e.push(s,`${e.var("form")}.append('${o.name}', fs.createReadStream('${o.fileName}'));`))}else t.postData.text&&e.push(s,`${e.var("form")}.append('data', ${JSON.stringify(t.postData.text)});`);a.body=e.var("form"),e.blank();break;default:t.postData.text&&(a.body=`\`${p(t.postData.text,{level:s+1,indent:i,firstLine:!1}).trim()}\``)}if(t.cookies.length){const o=t.cookies.map(f=>`${encodeURIComponent(f.name)}=${encodeURIComponent(f.value)}`).join("; ");a.headers=a.headers||{},a.headers.cookie=o}if(t.basicAuth){const{username:o,password:f}=t.basicAuth;a.headers=a.headers||{},a.headers.Authorization=`'Basic ' + Buffer.from('${o}:${f}').toString('base64')`,u=!0}c&&r.withImports&&e.unshift("import fs from 'fs';");const b=a.headers?.Accept&&$(a.headers.Accept)===l.JSON||h===l.JSON;S(t,e,s);const O=y(t,e);return e.push(s,`const ${e.var("resp")} = await fetch(`).push(s+1,"`"+O+(d?"?${"+e.var("query")+"}":"")+"`,").push(s+1,p(m(a,{indent:i,inlineCharacterLimit:25,transform:D({body:!0,authorizationHeader:u})}),{level:s+1,indent:i,firstLine:!1})).push(s,");").blank(),t.allResponseCodes?.includes("204")||t.responseCodes?.includes("204")?e.push(s,"if (resp.status === 204) {").push(s+1,"console.log('success');").push(s,"} else {").push(s+1,`const ${e.var("data")} = await ${e.var("resp")}.${b?"json()":"text()"};`).push(s+1,`console.log(${e.var("data")});`).push(s,"}"):e.push(s,`const ${e.var("data")} = await ${e.var("resp")}.${b?"json()":"text()"};`).push(s,`console.log(${e.var("data")});`),r.showBoilerplate&&e.push("}").blank().push("run();"),e.join().replace(/"fs\.createReadStream\(\\"(.+)\\"\)"/,'fs.createReadStream("$1")')}export{R as generateNode};
@@ -0,0 +1,13 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type PHPOptions = GeneratorOptions & {
4
+ indent?: string;
5
+ showBoilerplate?: boolean;
6
+ noTags?: boolean;
7
+ shortTags?: boolean;
8
+ closingTag?: boolean;
9
+ namedErrors?: boolean;
10
+ variablesPrefix?: string;
11
+ };
12
+ export declare function generatePHP(har: CodeSampleHAR, options?: PHPOptions): string;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import{CodeBuilder as O,Lang as g}from"./helpers/code-builder.js";import{buildUrlExpression as D,printUrlVariablesDeclarations as L}from"./helpers/url-helpers.js";import{buildPHPDeviceAuthorizationCodeSnippet as x}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as A}from"./helpers/mime.js";import{MediaTypes as P}from"../../../constants/openapi.js";import{objectToPhpArray as v}from"./helpers/php-array.js";import{pascalCase as E}from"./helpers/string-utils.js";import{toCodeSampleHAR as j}from"./helpers/sub-request.js";function $(e,...n){let a=0;return e.replace(/%s/g,()=>a<n.length?String(n[a++]):"%s")}function h(e,n){return n?`$${n}${E(e)}`:`$${e}`}function z(e){const n=e.match(/^[a-z][a-z0-9+.-]*:\/\/[^/:]+:(\d+)/i);return n?n[1]:void 0}function N(e,n){const a={showBoilerplate:!0,indent:" ",noTags:!0,shortTags:!1,namedErrors:!1,closingTag:!1,...n};let r,c=!1;const s=new O({indentation:a.indent,capitalize:!0,lang:g.PHP}),i=e.oAuth2PreRequests?.[0],l=h("curl",a.variablesPrefix),R=h("response",a.variablesPrefix),d=h("error",a.variablesPrefix);a.noTags||s.push(a.shortTags?"<?":"<?php").blank();const _={...e.headersObj};let b;if(i){const t="oAuth2",o=N(j(i),{...a,showBoilerplate:!1,variablesPrefix:t});s.push(o),s.blank(),i.flowType==="deviceAuthorization"&&x(s,{tokenUrl:i.tokenUrl??"YOUR_TOKEN_URL",clientId:i.clientId??"YOUR_CLIENT_ID",level:0}),b=`Bearer " . ${i.flowType==="deviceAuthorization"?"$accessToken":`${h("response",t)}->access_token`}`}const T=Object.keys(_).sort().map(t=>t==="Authorization"&&b?$('"%s: %s',t,b):$('"%s: %s"',t,_[t]));if(e.basicAuth){const{username:t,password:o}=e.basicAuth;T.push(`"Authorization: Basic " . base64_encode("${t}:${o}")`)}a.showBoilerplate&&s.push("/**").push(" * Requires libcurl").push(" */").blank(),L(e,s);let p="";if(Object.keys(e.queryObj||{}).length){const t=v(e.queryObj,{indent:a.indent});p="$query",s.push(`${p} = ${t};`).blank()}if(s.push(`${l} = curl_init();`),s.blank(),e.postData)switch(A(e.postData.mimeType)){case P.JSON:{const t=v(e.jsonObj||{},{indent:a.indent});c=!0,r="json_encode($payload)",s.push(`$payload = ${t};`).blank();break}case P.MULTIPART:{if(e.postData.params&&e.postData.params.length>0){const t=e.postData.params.map(({name:o,value:m,fileName:y})=>y?`${a.indent}"${o}" => new CURLFile("${y}"),
2
+ `:`${a.indent}"${o}" => "${m??""}",
3
+ `).join("");c=!0,r="$payload",s.push(`$payload = array(
4
+ ${t});`).blank()}else e.postData.text&&(r=`"${e.postData.text.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`);break}case P.URL_ENCODED:{const t=e.postData.params?.length?e.postData.params.map(({name:o,value:m})=>`${o}=${m}`).join("&"):`${e.postData.text??""}`;c=!0,r="$payload",s.push(`$payload = "${t}";`).blank();break}default:r=e.postData.text}let u=D(e,s);p&&(u.endsWith('"')?u=u.slice(0,-1)+`?" . http_build_query(${p})`:u+=` . "?" . http_build_query(${p})`);const k=z(e.fullUrl??""),C=[{escape:!c,name:"CURLOPT_POSTFIELDS",value:r},{escape:!0,name:"CURLOPT_PORT",value:k},{escape:!1,name:"CURLOPT_URL",value:u},{escape:!1,name:"CURLOPT_RETURNTRANSFER",value:"true"},{escape:!0,name:"CURLOPT_CUSTOMREQUEST",value:e.method.toUpperCase()}];s.push(`curl_setopt_array(${l}, [`);const f=new O({indentation:a.indent,lineJoin:`
5
+ ${a.indent}`,variablesPrefix:a.variablesPrefix,capitalize:!0,lang:g.PHP});T.length&&f.push("CURLOPT_HTTPHEADER => [").push(1,T.join(`,
6
+ `+a.indent+a.indent)).push("],");for(const t of C)t.value===null||t.value===void 0||t.value===""||f.push($("%s => %s,",t.name,t.escape?JSON.stringify(t.value):t.value));const U=e.cookies.map(t=>`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`);return U.length&&f.push($('CURLOPT_COOKIE => "%s",',U.join("; "))),s.push(1,f.join()).push("]);").blank().push(`${R} = curl_exec(${l});`).push(`${d} = curl_error(${l});`).blank().push(`curl_close(${l});`).blank().push(`if (${d}) {`),a.namedErrors?s.push(1,`echo array_flip(get_defined_constants(true)["curl"])[${d}];`):s.push(1,`echo "cURL Error #:" . ${d};`),s.push("} else {").push(1,`echo ${R};`).push("}"),!a.noTags&&a.closingTag&&s.blank().push("?>"),s.join()}export{N as generatePHP};
@@ -0,0 +1,3 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ export declare function generatePython(har: CodeSampleHAR, options?: GeneratorOptions): string;
@@ -0,0 +1,9 @@
1
+ import{CodeBuilder as j,Lang as v}from"./helpers/code-builder.js";import{addIndentation as b,buildUrlExpression as D,printUrlVariablesDeclarations as R}from"./helpers/url-helpers.js";import{buildPythonDeviceAuthorizationCodeSnippet as T}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as g}from"./helpers/mime.js";import{escapeSingleQuoted as w}from"./helpers/string-utils.js";import{MediaTypes as f}from"../../../constants/openapi.js";import{toCodeSampleHAR as q}from"./helpers/sub-request.js";function A(t,i){const l=i?.level??0,e=new j({indentation:" ",lang:v.PYTHON}),p=t.oAuth2PreRequests?.[0],y=p?.flowType==="deviceAuthorization";i?.withComments&&(e.push('"""'),e.push("Requires python >= 3"),e.blank(),e.push('Requires module "requests" >= 2.25.1'),e.push("See here for installation details:"),e.push(" https://requests.readthedocs.io/"),e.push('"""'),e.blank()),i?.withImports!==!1&&(e.push("import requests"),y&&e.push("import time"),e.blank());let L=!1,n={...t.allHeaders};if(p){const s=A(q(p),{...i,withImports:!1,withComments:!1});e.push(s),e.blank(),p.flowType==="deviceAuthorization"&&T(e,{tokenUrl:p.tokenUrl??"YOUR_TOKEN_URL",clientId:p.clientId??"YOUR_CLIENT_ID",level:l}),n={...n},n.Authorization='"Bearer " + access_token',L=!0}R(t,e),e.push(`${e.var("url").toLowerCase()} = %s`,D(t,e)).blank();let m;Object.keys(t.queryObj??{}).length&&(m="query = "+C(t.queryObj," "),e.push(m).blank());let u,d;const h=g(t.postData?.mimeType);if(t.postData)switch(h){case f.URL_ENCODED:u=t.paramsObj?b(C(t.paramsObj," "),{level:0,firstLine:!1}):`"${t.postData.text}"`;break;case f.JSON:t.jsonObj&&(u=b(C(t.jsonObj," "),{level:0,firstLine:!1}));break;case f.MULTIPART:{const s=[],a=[];if(t.postData.params&&t.postData.params.length>0)for(const o of t.postData.params)o.fileName?a.push(`"${o.name}": ("${o.fileName}", open("${o.fileName}", "rb"))`):s.push(`"${o.name}": "${o.value??""}"`);else if(t.postData.text){const o=t.postData.text.replace(/\\/g,"\\\\").replace(/"/g,'\\"');s.push(`"data": "${o}"`)}if(a.length){const o=a.map($=>` ${$}`).join(`,
2
+ `);e.push(`files = {
3
+ ${o}
4
+ }`).blank()}s.length&&(d=`data = {
5
+ ${s.map($=>` ${$}`).join(`,
6
+ `)}
7
+ }`),d&&e.push(d).blank();break}default:t.postData.text&&(u=`'''
8
+ ${b(t.postData.text.trim(),{level:1,indent:" ",firstLine:!0})}
9
+ '''`)}u&&e.push(`${e.var("payload").toLowerCase()} = %s`,u).blank();const c=Object.keys(n).length,_=(s,a)=>s==="Authorization"&&L?a:`"${a}"`;if(c===1)for(const s of Object.keys(n))e.push(`${e.var("headers").toLowerCase()} = {"${s}": ${_(s,n[s])}}`).blank();else if(c>1){let s=1;e.push(`${e.var("headers").toLowerCase()} = {`);for(const a of Object.keys(n)){const o=s++===c;e.push(1,`"${a}": ${_(a,n[a])}${o?"":","}`)}e.push(0,"}").blank()}const k=t.method.toLowerCase();let r=`${e.var("response").toLowerCase()} = requests.${k}(${e.var("url").toLowerCase()}`;if(h===f.MULTIPART&&(d&&(r+=", data=data"),e.join().includes("files = {")&&(r+=", files=files")),u){const s=h===f.JSON?"json":"data";r+=`, ${s}=${e.var("payload").toLowerCase()}`}return c>0&&(r+=`, headers=${e.var("headers").toLowerCase()}`),m&&(r+=`, params=${e.var("query").toLowerCase()}`),t.basicAuth&&(r+=`, auth=('${w(t.basicAuth.username)}','${w(t.basicAuth.password)}')`),r+=")",e.push(r).blank(),t.allResponseCodes?.includes("204")||t.responseCodes?.includes("204")?e.push("if response.status_code == 204:").push(l+1,'print("success")').push("else:").push(l+1,`${e.var("data").toLowerCase()} = ${e.var("response").toLowerCase()}.json()`).push(l+1,`print(${e.var("data").toLowerCase()})`):e.push(`${e.var("data").toLowerCase()} = ${e.var("response").toLowerCase()}.json()`).push(`print(${e.var("data").toLowerCase()})`),e.join()}function C(t,i){return JSON.stringify(t,function(l,e){return l&&typeof e=="boolean"?e?"__REDOCLY_<True>__":"__REDOCLY_<False>__":e===null?"__REDOCLY_<None>__":e},i).replace(/"__REDOCLY_<(\w+)>__"/g,"$1")}export{A as generatePython};
@@ -0,0 +1,10 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type ROptions = GeneratorOptions & {
4
+ indent?: string;
5
+ showBoilerplate?: boolean;
6
+ printBody?: boolean;
7
+ variablesPrefix?: string;
8
+ };
9
+ export declare function generateR(har: CodeSampleHAR, options?: ROptions): string;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import{CodeBuilder as R,Lang as _}from"./helpers/code-builder.js";import{buildUrlExpression as T,printUrlVariablesDeclarations as j}from"./helpers/url-helpers.js";import{buildRDeviceAuthorizationCodeSnippet as A}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as U}from"./helpers/mime.js";import{MediaTypes as m}from"../../../constants/openapi.js";import{objectToRString as k,postDataToRListBody as C}from"./helpers/r-utils.js";import{toCodeSampleHAR as N}from"./helpers/sub-request.js";function O(t,y){const o={indent:" ",showBoilerplate:!0,printBody:!0,...y},e=new R({indentation:o.indent,variablesPrefix:o.variablesPrefix,lang:_.R}),x=t.method.toUpperCase(),c=t.oAuth2PreRequests?.[0];o.showBoilerplate&&e.push("library(httr)").blank();const u={...t.allHeaders??t.headersObj};if(c){const p="oauth2_",s=O(N(c),{...o,variablesPrefix:p,showBoilerplate:!1}),n=`${p}data_req`;e.push(s),c.flowType==="deviceAuthorization"?A(e,{tokenUrl:c.tokenUrl??"YOUR_TOKEN_URL",clientId:c.clientId??"YOUR_CLIENT_ID",level:0,responseVariable:n}):(e.push(`access_token = content(${n}, "parsed")$access_token`),e.blank()),u.Authorization='paste("Bearer", access_token)'}let r,a="";if(t.postData)switch(U(t.postData.mimeType)){case m.URL_ENCODED:{if(a=e.var("body"),t.postData.params?.length){r="form";const s=C(t.postData.params,{indent:o.indent});e.push(`${a} <- list(${s})`).blank()}else t.postData.text&&(r="raw",e.push(`${a} <- "${t.postData.text}"`).blank());break}case m.JSON:{r="json",a=e.var("body");const s=k(t.jsonObj,{indent:o.indent});e.push(`${a} = '${s}'`).blank();break}case m.MULTIPART:{if(r="multipart",a=e.var("body"),t.postData.params?.length){const s=[];for(const i of t.postData.params)i.fileName?s.push(`${o.indent}${i.name} = upload_file("${i.fileName}")`):s.push(`${o.indent}${i.name} = "${i.value??""}"`);const n=`
2
+ `+s.join(`,
3
+ `)+`
4
+ `;e.push(`${a} <- list(${n})`).blank()}else if(t.postData.text){const s=t.postData.text,n=s.match(/^--([^\r\n]+)/);if(n){const i=n[1],w=s.split(new RegExp(`--${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:--)?`,"g")).filter(l=>l.trim().length>0),d=[];for(const l of w){const f=l.match(/Content-Disposition:\s*form-data;\s*name="([^"]+)"(?:;\s*filename="([^"]+)")?/i);if(f){const h=f[1],D=f[2],g=l.match(/\r?\n\r?\n([\s\S]*?)(?:\r?\n)?$/),P=(g?g[1].trim():"").replace(/\\/g,"\\\\").replace(/"/g,'\\"');D?d.push(`${o.indent}${h} = upload_file("${D}")`):d.push(`${o.indent}${h} = "${P}"`)}}if(d.length>0){const l=`
5
+ `+d.join(`,
6
+ `)+`
7
+ `;e.push(`${a} <- list(${l})`).blank()}else{r="raw";const l=t.postData.text.replace(/\\/g,"\\\\").replace(/"/g,'\\"');e.push(`${a} <- "${l}"`).blank()}}else{r="raw";const i=t.postData.text.replace(/\\/g,"\\\\").replace(/"/g,'\\"');e.push(`${a} <- "${i}"`).blank()}}break}default:t.postData.text&&(a=e.var("body"),r="raw",e.push(`${a} = ${k(t.postData.text)}`).blank())}j(t,e),Object.keys({...t.pathParameters,...t.serverVariables}).length&&e.blank().push("# create you own operator").push('"%&%" <- function(x, y)paste0(x,y)').blank();const v=T(t,e);e.push(`url = ${v}`).blank();const $=e.var("data_req");if(e.push(`${$} <- ${x}(`),e.push(1,"url,"),t.basicAuth){const{username:p,password:s}=t.basicAuth;e.push(1,`authenticate("${p}", "${s}")`)}const b=Object.keys(u);if(b.length){const p=b.map(s=>{const n=u[s],i=n.startsWith("paste")?n:`"${n}"`;return`"${s}" = ${i}`}).join(", ");p&&e.push(1,`add_headers(${p}),`)}return a&&(e.push(1,`body = ${a},`),e.push(1,`encode = "${r}",`)),e.push(1,"verbose()"),e.push(")"),o.printBody&&e.blank().push(`content(${$}${r==="raw"?', "text"':""})`),e.join()}export{O as generateR};
@@ -0,0 +1,10 @@
1
+ import type { CodeSampleHAR } from '../sample-har.js';
2
+ import type { GeneratorOptions } from './types.js';
3
+ type RubyOptions = GeneratorOptions & {
4
+ indent?: string;
5
+ capitalize?: boolean;
6
+ showBoilerplate?: boolean;
7
+ variablesPrefix?: string;
8
+ };
9
+ export declare function generateRuby(har: CodeSampleHAR, options?: RubyOptions): string;
10
+ export {};
@@ -0,0 +1 @@
1
+ import{CodeBuilder as h,Lang as v}from"./helpers/code-builder.js";import{buildUrlExpression as T,printUrlVariablesDeclarations as O}from"./helpers/url-helpers.js";import{buildRubyDeviceAuthorizationCodeSnippet as D}from"./helpers/oauth2-snippets.js";import{normalizeMimeType as d}from"./helpers/mime.js";import{escapeSingleQuoted as b}from"./helpers/string-utils.js";import{MediaTypes as i}from"../../../constants/openapi.js";import{stringifyJSObject as l}from"./helpers/stringify-js.js";import{toCodeSampleHAR as y}from"./helpers/sub-request.js";const $=1,_=new Set(["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"]);function q(t){if(t.jsonObj!==void 0)return t.jsonObj;if(t.postData?.text)try{return JSON.parse(t.postData.text)}catch{}return{}}function P(t){const p=(t??"").match(/^([a-z][a-z0-9+.-]*):/i);return p?`${p[1].toLowerCase()}:`:"http:"}function R(t,p){const r={capitalize:!0,showBoilerplate:!0,indent:" ",...p},u=t.method.toUpperCase(),o=t.oAuth2PreRequests?.[0],c=P(t.fullUrl),e=new h({indentation:r.indent,variablesPrefix:r.variablesPrefix,capitalize:r.capitalize,lang:v.RUBY});r.showBoilerplate&&(e.push("require 'uri'").push("require 'net/http'"),c==="https:"&&e.push("require 'openssl'"),(d(t.postData?.mimeType)===i.JSON||o)&&e.unshift("require 'json'"),e.blank());const n={};for(const[s,a]of Object.entries(t.allHeaders??t.headersObj??{}))n[s]=`'${a}'`;const f=u.charAt(0)+u.substring(1).toLowerCase();if(_.has(u)||e.push("class Net::HTTP::%s < Net::HTTPRequest",f).push(" METHOD = '%s'",u).push(" REQUEST_HAS_BODY = '%s'",t.postData?.text?"true":"false").push(" RESPONSE_HAS_BODY = true").push("end").blank(),o){const s="oAuth2",a=R(y(o),{...r,variablesPrefix:s,showBoilerplate:!1}),m=`${s}${r.capitalize?"Response":"response"}`;e.push(a),o.flowType==="deviceAuthorization"?D(e,{tokenUrl:o.tokenUrl??"YOUR_TOKEN_URL",clientId:o.clientId??"YOUR_CLIENT_ID",level:0,responseVariable:m,capitalize:r.capitalize}):(e.push(`access_token = JSON.parse(${m}.body)['access_token']`),e.blank()),n.Authorization='"Bearer " + access_token'}O(t,e),e.push(`${e.var("url")} = URI(${T(t,e)})`),Object.keys(t.queryObj??{}).length>0&&(e.push(`${e.var("params")} = ${l(t.queryObj,{indent:r.indent,inlineCharacterLimit:25})}`),e.push(`${e.var("url")}.query = URI.encode_www_form(${e.var("params")})`)),e.blank().push(`${e.var("http")} = Net::HTTP.new(${e.var("url")}.host, ${e.var("url")}.port)`),c==="https:"&&e.push(`${e.var("http")}.use_ssl = true`),e.blank().push(`${e.var("request")} = Net::HTTP::%s.new(${e.var("url")})`,f);for(const s of Object.keys(n))n[s]!==`'${i.MULTIPART}'`&&e.push(`${e.var("request")}['%s'] = %s`,s,n[s]);if(t.postData)switch(d(t.postData.mimeType)){case i.URL_ENCODED:{if(t.postData.params?.length){const s={};for(const a of t.postData.params)s[a.name]=a.value??"";e.push(`${e.var("request")}.body = URI.encode_www_form(${l(s,{indent:r.indent,inlineCharacterLimit:25})})`)}else t.postData.text&&e.push(`${e.var("request")}.body = "${t.postData.text}"`);break}case i.JSON:e.push(`${e.var("request")}.body = ${l(q(t),{indent:r.indent,inlineCharacterLimit:25}).replace(/null/g,"nil")}.to_json`);break;case i.MULTIPART:{let s=!1;if(t.postData.params&&t.postData.params.length>0){e.push(`${e.var("form_data")} = [`);for(const a of t.postData.params)a.fileName?e.push($,`['${a.name}', File.open('${a.fileName}', 'rb')],`):e.push($,`['${a.name}', '${a.value??""}'],`);e.push("]"),s=!0}else if(t.postData.text){const a=t.postData.text.replace(/\\/g,"\\\\").replace(/'/g,"\\'");e.push(`${e.var("request")}.body = '${a}'`);break}s&&e.push(`${e.var("request")}.set_form(${e.var("form_data")}, '${i.MULTIPART}')`);break}default:t.postData.text&&e.push(`${e.var("request")}.body = ${JSON.stringify(t.postData.text)}`)}if(t.basicAuth){const{username:s,password:a}=t.basicAuth;e.push(`${e.var("request")}.basic_auth('${b(s)}', '${b(a)}')`)}return e.blank().push(`${e.var("response")} = ${e.var("http")}.request(${e.var("request")})`).push(`puts ${e.var("response")}.read_body`).blank(),e.join()}export{R as generateRuby};
@@ -0,0 +1,6 @@
1
+ export type GeneratorOptions = {
2
+ withImports?: boolean;
3
+ withComments?: boolean;
4
+ short?: boolean;
5
+ level?: number;
6
+ };
File without changes
@@ -0,0 +1,45 @@
1
+ export interface Request {
2
+ method: string;
3
+ url: string;
4
+ httpVersion: string;
5
+ cookies: Cookie[];
6
+ headers: Header[];
7
+ queryString: QueryString[];
8
+ postData?: PostData;
9
+ headersSize: number;
10
+ bodySize: number;
11
+ comment?: string;
12
+ }
13
+ export interface Cookie {
14
+ name: string;
15
+ value: string;
16
+ path?: string;
17
+ domain?: string;
18
+ expires?: string | Date | null;
19
+ httpOnly?: boolean;
20
+ secure?: boolean;
21
+ comment?: string;
22
+ }
23
+ export interface Header {
24
+ name: string;
25
+ value: string;
26
+ comment?: string;
27
+ }
28
+ export interface QueryString {
29
+ name: string;
30
+ value: string;
31
+ comment?: string;
32
+ }
33
+ export interface PostData {
34
+ mimeType: string;
35
+ params: Param[];
36
+ text: string;
37
+ comment?: string;
38
+ }
39
+ export interface Param {
40
+ name: string;
41
+ value?: string;
42
+ fileName?: string;
43
+ contentType?: string;
44
+ comment?: string;
45
+ }
File without changes
@@ -0,0 +1,8 @@
1
+ export type * from './source.js';
2
+ export { buildCodeSampleHAR, type HARBuildOptions, type HARBuildResolvers, type HARBuildSelections, } from './builder.js';
3
+ export { createCodeSampleResolvers } from './resolvers.js';
4
+ export { useCodeSampleResolvers } from './use-resolvers.js';
5
+ export { generateCodeSample, tryGenerateCodeSample, isSupportedLanguage, type CodeSampleResult, } from './generators/index.js';
6
+ export { mapReplayAtomValuesToHarRequestValues } from './utils/map-request-values.js';
7
+ export { convertSampleToString } from './convertSampleToString.js';
8
+ export * from './replay/index.js';
@@ -0,0 +1 @@
1
+ import{buildCodeSampleHAR as r}from"./builder.js";import{createCodeSampleResolvers as a}from"./resolvers.js";import{useCodeSampleResolvers as m}from"./use-resolvers.js";import{generateCodeSample as s,tryGenerateCodeSample as S,isSupportedLanguage as d}from"./generators/index.js";import{mapReplayAtomValuesToHarRequestValues as u}from"./utils/map-request-values.js";import{convertSampleToString as n}from"./convertSampleToString.js";export*from"./replay/index.js";export{r as buildCodeSampleHAR,n as convertSampleToString,a as createCodeSampleResolvers,s as generateCodeSample,d as isSupportedLanguage,u as mapReplayAtomValuesToHarRequestValues,S as tryGenerateCodeSample,m as useCodeSampleResolvers};
@@ -0,0 +1,6 @@
1
+ import type { ReplayNormalizedOpenAPIOperation } from './replay-types.js';
2
+ import type { ApiDocsOptions } from '../../../types/options.js';
3
+ import type { ExampleEntry } from '../../../types/store.js';
4
+ import type { CodeSampleSource } from '../source.js';
5
+ import type { HARBuildResolvers } from '../builder.js';
6
+ export declare function createEmbeddedReplayConvertOperation(operationSourceMap: Map<string, CodeSampleSource>, resolvers: HARBuildResolvers, options: ApiDocsOptions, exampleStore: Record<string, ExampleEntry>, requestValues: Record<string, unknown>, activeMimeName?: string): (path: string, method: string) => ReplayNormalizedOpenAPIOperation | undefined;
@@ -0,0 +1 @@
1
+ import{registerExample as u}from"../../../adapters/helpers.js";import{appendUndeclaredConfigureParameters as b,mergeConfigureIntoSourceForReplay as g,pickRuntimeConfigureRequestValues as h}from"./merge-configure-into-source.js";import{toReplayOperation as k}from"./replay-adapter.js";function B(e){const o={};return e.path&&typeof e.path=="object"&&(o.path=e.path),e.query&&typeof e.query=="object"&&(o.query=e.query),e.header&&typeof e.header=="object"&&(o.headers=e.header),e.cookie&&typeof e.cookie=="object"&&(o.cookie=e.cookie),o}function R(e,o,t,y){if(o===void 0||!e.requestBody||Object.keys(e.requestBody).length===0)return e;const n=t&&e.requestBody[t]?t:Object.keys(e.requestBody)[0],i=e.requestBody[n];if(!i)return e;const p=u(y,{value:o,summary:void 0});return{...e,requestBody:{...e.requestBody,[n]:{...i,exampleIds:[p]}}}}function x(e,o,t,y,n,i){const p=B(n),c=n.body,f=h(t,p);return(m,a)=>{try{const r=e.get(`${a.toLowerCase()}:${m}`);if(!r)return;let d=f?g(r,f):r;return f&&(d=b(d,f)),c!==void 0&&(d=R(d,c,i,y)),k(d,o)}catch(r){console.error("[Replay] embedded convertOperationToReplayValue error:",r);return}}}export{x as createEmbeddedReplayConvertOperation};
@@ -0,0 +1,12 @@
1
+ import type { OperationInfo } from '../../../types/openapi.js';
2
+ import type { ApiDocsOptions } from '../../../types/options.js';
3
+ import type { StoreContext } from '../../../types/store.js';
4
+ import type { CodeSampleSource } from '../source.js';
5
+ import type { OpenAPIDefinition } from '../../../types/openapi.js';
6
+ /** Hook to apply adapter-time `configure()` results to a fallback-built `OperationInfo`. */
7
+ export type ApplyConfigureToOperationInfo = (operationInfo: OperationInfo, storeCtx: StoreContext, doc: OpenAPIDefinition) => void;
8
+ /**
9
+ * Build a {@link CodeSampleSource} from a raw OpenAPI document for a given path/method.
10
+ * Fallback path used by the Replay overlay when the prebuilt source map misses.
11
+ */
12
+ export declare function buildCodeSampleSourceFromDocument(pathName: string, method: string, doc: OpenAPIDefinition, options: ApiDocsOptions, applyConfigure?: ApplyConfigureToOperationInfo): CodeSampleSource | undefined;
@@ -0,0 +1 @@
1
+ import{createStoreContext as S,toRecord as b}from"../../../adapters/helpers.js";import{populateOpenApiStore as O}from"../../../adapters/openapi/store.js";import{buildCodeSampleSource as $}from"../../../adapters/openapi/build-code-sample-source.js";function q(e,t){if(!e.length&&!t?.length||!e.length)return t;if(!t?.length)return e;const r=new Set(t.map(a=>{const n=a;return`${n.in}:${n.name}`})),u=[...t];for(const a of e){const n=a,o=`${n.in}:${n.name}`;r.has(o)||u.push(a)}return u}let m=null;function v(e,t){if(m?.doc===e)return m.ctx;const r=S(b(e));return O(e,r,t),m={doc:e,ctx:r},r}function K(e,t,r,u,a){const n=r.paths;if(!n||typeof n!="object")return;const o=n[e];if(!o||typeof o!="object")return;const c=t.toLowerCase(),d=o;let p=c,s=d[c],f=!1;if(!s&&c==="query"&&d["x-query"]&&(s=d["x-query"],p="x-query"),!s&&c!=="query"&&o.additionalOperations){const l=o.additionalOperations,y=t in l?t:Object.keys(l).find(C=>C.toLowerCase()===c);y&&(s=l[y],p=y,f=!0)}if(!s||typeof s!="object")return;const i=s,x=o.parameters??[],h={pointer:f?`/paths/${e}/additionalOperations/${p}`:`/paths/${e}/${p}`,pathName:e,httpVerb:t.toUpperCase(),operationId:i.operationId,summary:typeof i.summary=="string"?i.summary:void 0,isWebhook:!1,isAdditionalOperation:f,tags:[],parameters:q(x,i.parameters),requestBody:i.requestBody,servers:i.servers??o.servers,security:i.security},g=v(r,u);return a?.(h,g,r),$(h,g,u,u.ignoreNamedSchemas)}export{K as buildCodeSampleSourceFromDocument};