@redocly/reference-docs 2.33.0 → 2.33.1

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 (186) hide show
  1. package/bin/cli/commands/redocly-docs-cli.min.js +177 -177
  2. package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +5 -21
  3. package/dist/console.redocly-reference-docs.min.js +106 -106
  4. package/dist/oauth2-redirect.js +1 -1
  5. package/dist/redocly-reference-docs.min.js +472 -472
  6. package/lib/components/Endpoint/Endpoint.js +1 -1
  7. package/lib/components/Endpoint/styled.d.ts +1 -1
  8. package/lib/components/NextSectionButton.js +1 -1
  9. package/lib/components/Panel/Accordion.js +1 -1
  10. package/lib/components/Panel/ContentPanel.js +1 -1
  11. package/lib/components/Panel/PanelComponent.d.ts +1 -1
  12. package/lib/components/RedoclyReferenceDocs.d.ts +1 -9
  13. package/lib/components/RedoclyReferenceDocs.js +1 -1
  14. package/lib/components/RedoclyReferenceDocsMultiStandalone.d.ts +8 -0
  15. package/lib/components/RedoclyReferenceDocsMultiStandalone.js +2 -0
  16. package/lib/components/Samples/use-example-key.js +1 -1
  17. package/lib/components/Search/ProSearchBox.js +1 -1
  18. package/lib/components/StoreProvider.d.ts +1 -1
  19. package/lib/components/common/CheckboxList.d.ts +1 -1
  20. package/lib/components/common/Dropdown/styled.d.ts +4 -4
  21. package/lib/components/console/Console.js +1 -1
  22. package/lib/components/console/RequestBodyForm.d.ts +1 -1
  23. package/lib/components/console/utils.js +1 -1
  24. package/lib/components/index.d.ts +1 -0
  25. package/lib/components/index.js +1 -1
  26. package/lib/redoc-lib/src/common-elements/linkify.d.ts +1 -1
  27. package/lib/redoc-lib/src/common-elements/panels.d.ts +2 -3
  28. package/lib/redoc-lib/src/common-elements/panels.js +1 -1
  29. package/lib/redoc-lib/src/common-elements/perfect-scrollbar.d.ts +1 -1
  30. package/lib/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.js +1 -1
  31. package/lib/redoc-lib/src/components/Callbacks/CallbacksList.js +1 -1
  32. package/lib/redoc-lib/src/components/ContentItem/ContentItem.d.ts +10 -0
  33. package/lib/redoc-lib/src/components/ContentItem/ContentItem.js +2 -0
  34. package/lib/redoc-lib/src/components/ContentItem/index.d.ts +1 -0
  35. package/lib/redoc-lib/src/components/ContentItem/index.js +2 -0
  36. package/lib/redoc-lib/src/components/ContentItems/ContentItems.d.ts +3 -20
  37. package/lib/redoc-lib/src/components/ContentItems/ContentItems.js +1 -1
  38. package/lib/redoc-lib/src/components/ContentItems/Skeleton.d.ts +2 -0
  39. package/lib/redoc-lib/src/components/ContentItems/Skeleton.js +2 -0
  40. package/lib/redoc-lib/src/components/ContentItems/index.d.ts +1 -0
  41. package/lib/redoc-lib/src/components/ContentItems/index.js +2 -0
  42. package/lib/redoc-lib/src/components/ErrorBoundary.d.ts +1 -1
  43. package/lib/redoc-lib/src/components/Fields/EnumValues.js +1 -1
  44. package/lib/redoc-lib/src/components/Markdown/AdvancedMarkdown.js +1 -1
  45. package/lib/redoc-lib/src/components/Operation/index.d.ts +1 -0
  46. package/lib/redoc-lib/src/components/Operation/index.js +2 -0
  47. package/lib/redoc-lib/src/components/OperationItem/OperationItem.d.ts +7 -0
  48. package/lib/redoc-lib/src/components/OperationItem/OperationItem.js +2 -0
  49. package/lib/redoc-lib/src/components/OperationItem/index.d.ts +1 -0
  50. package/lib/redoc-lib/src/components/OperationItem/index.js +2 -0
  51. package/lib/redoc-lib/src/components/PayloadSamples/MediaTypeSamples.js +1 -1
  52. package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
  53. package/lib/redoc-lib/src/components/RequestSamples/CodeSample.js +1 -1
  54. package/lib/redoc-lib/src/components/RequestSamples/RequestSamples.d.ts +1 -1
  55. package/lib/redoc-lib/src/components/RequestSamples/languageSwitchEvent.d.ts +1 -1
  56. package/lib/redoc-lib/src/components/Responses/ResponseSummary.js +1 -1
  57. package/lib/redoc-lib/src/components/Schema/DiscriminatorDropdown.js +1 -1
  58. package/lib/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
  59. package/lib/redoc-lib/src/components/SectionItem/SectionItem.d.ts +7 -0
  60. package/lib/redoc-lib/src/components/SectionItem/SectionItem.js +2 -0
  61. package/lib/redoc-lib/src/components/SectionItem/index.d.ts +1 -0
  62. package/lib/redoc-lib/src/components/SectionItem/index.js +2 -0
  63. package/lib/redoc-lib/src/components/SecurityRequirement/RequiredScopesRow.js +1 -1
  64. package/lib/redoc-lib/src/components/SecurityRequirement/SecurityDefs.js +1 -1
  65. package/lib/redoc-lib/src/components/SecurityRequirement/SecurityRequirement.js +1 -1
  66. package/lib/redoc-lib/src/components/SecurityRequirement/SecurityRequirementElement.js +1 -1
  67. package/lib/redoc-lib/src/components/SecurityRequirement/SecurityRequirementPanelDescription.js +1 -1
  68. package/lib/redoc-lib/src/components/SecuritySchemes/SecuritySchemes.js +1 -1
  69. package/lib/redoc-lib/src/components/SecuritySchemes/helpers.d.ts +1 -1
  70. package/lib/redoc-lib/src/components/SideMenu/MenuItems.js +1 -1
  71. package/lib/redoc-lib/src/components/SideMenu/styled.elements.d.ts +2 -2
  72. package/lib/redoc-lib/src/components/StickySidebar/StickyResponsiveSidebar.d.ts +1 -1
  73. package/lib/redoc-lib/src/components/index.d.ts +1 -1
  74. package/lib/redoc-lib/src/components/index.js +1 -1
  75. package/lib/redoc-lib/src/services/MarkdownRenderer.js +1 -1
  76. package/lib/redoc-lib/src/services/MenuBuilder.d.ts +1 -1
  77. package/lib/redoc-lib/src/services/OpenAPIParser.d.ts +1 -1
  78. package/lib/redoc-lib/src/services/models/MediaContent.d.ts +1 -1
  79. package/lib/redoc-lib/src/services/models/MediaType.d.ts +2 -2
  80. package/lib/redoc-lib/src/services/models/MediaType.js +1 -1
  81. package/lib/redoc-lib/src/services/models/Operation.d.ts +2 -2
  82. package/lib/redoc-lib/src/services/models/RequestBody.d.ts +1 -1
  83. package/lib/redoc-lib/src/services/models/Response.d.ts +1 -1
  84. package/lib/redoc-lib/src/services/models/Schema.d.ts +1 -1
  85. package/lib/redoc-lib/src/utils/openapi.d.ts +1 -1
  86. package/lib/services/ProStore.d.ts +4 -4
  87. package/lib/services/SearchStore.d.ts +1 -1
  88. package/lib/services/VersionedSpecStore.d.ts +1 -1
  89. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +1 -1
  90. package/lib/services/code-samples/httpsnippet/targets/index.d.ts +1 -1
  91. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +1 -1
  92. package/lib/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
  93. package/lib/standalone.d.ts +1 -1
  94. package/lib/standalone.js +1 -1
  95. package/lib/utils.js +1 -1
  96. package/lib-esm/components/Endpoint/Endpoint.js +1 -1
  97. package/lib-esm/components/Endpoint/styled.d.ts +1 -1
  98. package/lib-esm/components/NextSectionButton.js +1 -1
  99. package/lib-esm/components/Panel/Accordion.js +1 -1
  100. package/lib-esm/components/Panel/ContentPanel.js +1 -1
  101. package/lib-esm/components/Panel/PanelComponent.d.ts +1 -1
  102. package/lib-esm/components/RedoclyReferenceDocs.d.ts +1 -9
  103. package/lib-esm/components/RedoclyReferenceDocs.js +1 -1
  104. package/lib-esm/components/RedoclyReferenceDocsMultiStandalone.d.ts +8 -0
  105. package/lib-esm/components/RedoclyReferenceDocsMultiStandalone.js +2 -0
  106. package/lib-esm/components/Samples/use-example-key.js +1 -1
  107. package/lib-esm/components/Search/ProSearchBox.js +1 -1
  108. package/lib-esm/components/StoreProvider.d.ts +1 -1
  109. package/lib-esm/components/common/CheckboxList.d.ts +1 -1
  110. package/lib-esm/components/common/Dropdown/styled.d.ts +4 -4
  111. package/lib-esm/components/console/Console.js +1 -1
  112. package/lib-esm/components/console/RequestBodyForm.d.ts +1 -1
  113. package/lib-esm/components/console/utils.js +1 -1
  114. package/lib-esm/components/index.d.ts +1 -0
  115. package/lib-esm/components/index.js +1 -1
  116. package/lib-esm/redoc-lib/src/common-elements/linkify.d.ts +1 -1
  117. package/lib-esm/redoc-lib/src/common-elements/panels.d.ts +2 -3
  118. package/lib-esm/redoc-lib/src/common-elements/panels.js +1 -1
  119. package/lib-esm/redoc-lib/src/common-elements/perfect-scrollbar.d.ts +1 -1
  120. package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.js +1 -1
  121. package/lib-esm/redoc-lib/src/components/Callbacks/CallbacksList.js +1 -1
  122. package/lib-esm/redoc-lib/src/components/ContentItem/ContentItem.d.ts +10 -0
  123. package/lib-esm/redoc-lib/src/components/ContentItem/ContentItem.js +2 -0
  124. package/lib-esm/redoc-lib/src/components/ContentItem/index.d.ts +1 -0
  125. package/lib-esm/redoc-lib/src/components/ContentItem/index.js +2 -0
  126. package/lib-esm/redoc-lib/src/components/ContentItems/ContentItems.d.ts +3 -20
  127. package/lib-esm/redoc-lib/src/components/ContentItems/ContentItems.js +1 -1
  128. package/lib-esm/redoc-lib/src/components/ContentItems/Skeleton.d.ts +2 -0
  129. package/lib-esm/redoc-lib/src/components/ContentItems/Skeleton.js +2 -0
  130. package/lib-esm/redoc-lib/src/components/ContentItems/index.d.ts +1 -0
  131. package/lib-esm/redoc-lib/src/components/ContentItems/index.js +2 -0
  132. package/lib-esm/redoc-lib/src/components/ErrorBoundary.d.ts +1 -1
  133. package/lib-esm/redoc-lib/src/components/Fields/EnumValues.js +1 -1
  134. package/lib-esm/redoc-lib/src/components/Markdown/AdvancedMarkdown.js +1 -1
  135. package/lib-esm/redoc-lib/src/components/Operation/index.d.ts +1 -0
  136. package/lib-esm/redoc-lib/src/components/Operation/index.js +2 -0
  137. package/lib-esm/redoc-lib/src/components/OperationItem/OperationItem.d.ts +7 -0
  138. package/lib-esm/redoc-lib/src/components/OperationItem/OperationItem.js +2 -0
  139. package/lib-esm/redoc-lib/src/components/OperationItem/index.d.ts +1 -0
  140. package/lib-esm/redoc-lib/src/components/OperationItem/index.js +2 -0
  141. package/lib-esm/redoc-lib/src/components/PayloadSamples/MediaTypeSamples.js +1 -1
  142. package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
  143. package/lib-esm/redoc-lib/src/components/RequestSamples/CodeSample.js +1 -1
  144. package/lib-esm/redoc-lib/src/components/RequestSamples/RequestSamples.d.ts +1 -1
  145. package/lib-esm/redoc-lib/src/components/RequestSamples/languageSwitchEvent.d.ts +1 -1
  146. package/lib-esm/redoc-lib/src/components/Responses/ResponseSummary.js +1 -1
  147. package/lib-esm/redoc-lib/src/components/Schema/DiscriminatorDropdown.js +1 -1
  148. package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
  149. package/lib-esm/redoc-lib/src/components/SectionItem/SectionItem.d.ts +7 -0
  150. package/lib-esm/redoc-lib/src/components/SectionItem/SectionItem.js +2 -0
  151. package/lib-esm/redoc-lib/src/components/SectionItem/index.d.ts +1 -0
  152. package/lib-esm/redoc-lib/src/components/SectionItem/index.js +2 -0
  153. package/lib-esm/redoc-lib/src/components/SecurityRequirement/RequiredScopesRow.js +1 -1
  154. package/lib-esm/redoc-lib/src/components/SecurityRequirement/SecurityDefs.js +1 -1
  155. package/lib-esm/redoc-lib/src/components/SecurityRequirement/SecurityRequirement.js +1 -1
  156. package/lib-esm/redoc-lib/src/components/SecurityRequirement/SecurityRequirementElement.js +1 -1
  157. package/lib-esm/redoc-lib/src/components/SecurityRequirement/SecurityRequirementPanelDescription.js +1 -1
  158. package/lib-esm/redoc-lib/src/components/SecuritySchemes/SecuritySchemes.js +1 -1
  159. package/lib-esm/redoc-lib/src/components/SecuritySchemes/helpers.d.ts +1 -1
  160. package/lib-esm/redoc-lib/src/components/SideMenu/MenuItems.js +1 -1
  161. package/lib-esm/redoc-lib/src/components/SideMenu/styled.elements.d.ts +2 -2
  162. package/lib-esm/redoc-lib/src/components/StickySidebar/StickyResponsiveSidebar.d.ts +1 -1
  163. package/lib-esm/redoc-lib/src/components/index.d.ts +1 -1
  164. package/lib-esm/redoc-lib/src/components/index.js +1 -1
  165. package/lib-esm/redoc-lib/src/services/MarkdownRenderer.js +1 -1
  166. package/lib-esm/redoc-lib/src/services/MenuBuilder.d.ts +1 -1
  167. package/lib-esm/redoc-lib/src/services/OpenAPIParser.d.ts +1 -1
  168. package/lib-esm/redoc-lib/src/services/models/MediaContent.d.ts +1 -1
  169. package/lib-esm/redoc-lib/src/services/models/MediaType.d.ts +2 -2
  170. package/lib-esm/redoc-lib/src/services/models/MediaType.js +1 -1
  171. package/lib-esm/redoc-lib/src/services/models/Operation.d.ts +2 -2
  172. package/lib-esm/redoc-lib/src/services/models/RequestBody.d.ts +1 -1
  173. package/lib-esm/redoc-lib/src/services/models/Response.d.ts +1 -1
  174. package/lib-esm/redoc-lib/src/services/models/Schema.d.ts +1 -1
  175. package/lib-esm/redoc-lib/src/utils/openapi.d.ts +1 -1
  176. package/lib-esm/services/ProStore.d.ts +4 -4
  177. package/lib-esm/services/SearchStore.d.ts +1 -1
  178. package/lib-esm/services/VersionedSpecStore.d.ts +1 -1
  179. package/lib-esm/services/code-samples/httpsnippet/targets/csharp/httpclient.js +1 -1
  180. package/lib-esm/services/code-samples/httpsnippet/targets/index.d.ts +1 -1
  181. package/lib-esm/services/code-samples/httpsnippet/targets/java8/apachehttp.js +1 -1
  182. package/lib-esm/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
  183. package/lib-esm/standalone.d.ts +1 -1
  184. package/lib-esm/standalone.js +1 -1
  185. package/lib-esm/utils.js +1 -1
  186. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- import*as Sampler from"openapi-sampler";import{isFormUrlEncoded,isJsonLike,mapValues}from"../../utils";import{SchemaModel}from"./Schema";import{ExampleModel}from"./Example";var MediaTypeModel=function(){function e(e,i,a,t,o,l){var r=void 0===l?{}:l,s=r.operation,n=r.type,p=r.response;Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isRequestType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onlyRequiredInSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i,this.operation=s,this.isRequestType=a,this.schema=t.schema&&new SchemaModel(e,t.schema,"",o,void 0,void 0,{operation:s,type:n,response:p}),this.onlyRequiredInSamples=o.onlyRequiredInSamples,void 0!==t.examples?this.examples=mapValues(t.examples,(function(a){return new ExampleModel(e,a,i,t.encoding)})):void 0!==t.example?this.examples={default:new ExampleModel(e,{value:e.deref(t.example).resolved},i,t.encoding)}:(isJsonLike(i)||isFormUrlEncoded(i))&&this.generateExample(e,t)}return Object.defineProperty(e.prototype,"generateExample",{enumerable:!1,configurable:!0,writable:!0,value:function(e,i){var a={skipReadOnly:this.isRequestType,skipWriteOnly:!this.isRequestType,skipNonRequired:this.isRequestType&&this.onlyRequiredInSamples,maxSampleDepth:this.options.generatedPayloadSamplesMaxDepth};if(this.schema&&this.schema.oneOf){this.examples={};for(var t=0,o=this.schema.oneOf;t<o.length;t++){var l=o[t],r=Sampler.sample(l.rawSchema,a,e.definition);this.schema.discriminatorProp&&"object"==typeof r&&r&&(r[this.schema.discriminatorProp]=l.title),this.examples[l.title]=new ExampleModel(e,{value:r},this.name,i.encoding)}}else this.schema&&(this.examples={default:new ExampleModel(e,{value:Sampler.sample(i.schema,a,e.definition)},this.name,i.encoding)})}}),e}();export{MediaTypeModel};
1
+ import*as Sampler from"openapi-sampler";import{isFormUrlEncoded,isJsonLike,mapValues}from"../../utils";import{ExampleModel}from"./Example";import{SchemaModel}from"./Schema";var MediaTypeModel=function(){function e(e,i,a,t,o,l){var r=void 0===l?{}:l,s=r.operation,n=r.type,p=r.response;Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isRequestType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onlyRequiredInSamples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i,this.operation=s,this.isRequestType=a,this.schema=t.schema&&new SchemaModel(e,t.schema,"",o,void 0,void 0,{operation:s,type:n,response:p}),this.onlyRequiredInSamples=o.onlyRequiredInSamples,void 0!==t.examples?this.examples=mapValues(t.examples,(function(a){return new ExampleModel(e,a,i,t.encoding)})):void 0!==t.example?this.examples={default:new ExampleModel(e,{value:e.deref(t.example).resolved},i,t.encoding)}:(isJsonLike(i)||isFormUrlEncoded(i))&&this.generateExample(e,t)}return Object.defineProperty(e.prototype,"generateExample",{enumerable:!1,configurable:!0,writable:!0,value:function(e,i){var a={skipReadOnly:this.isRequestType,skipWriteOnly:!this.isRequestType,skipNonRequired:this.isRequestType&&this.onlyRequiredInSamples,maxSampleDepth:this.options.generatedPayloadSamplesMaxDepth};if(this.schema&&this.schema.oneOf){this.examples={};for(var t=0,o=this.schema.oneOf;t<o.length;t++){var l=o[t],r=Sampler.sample(l.rawSchema,a,e.definition);this.schema.discriminatorProp&&"object"==typeof r&&r&&(r[this.schema.discriminatorProp]=l.title),this.examples[l.title]=new ExampleModel(e,{value:r},this.name,i.encoding)}}else this.schema&&(this.examples={default:new ExampleModel(e,{value:Sampler.sample(i.schema,a,e.definition)},this.name,i.encoding)})}}),e}();export{MediaTypeModel};
2
2
  //# sourceMappingURL=MediaType.js.map
@@ -2,13 +2,13 @@ import type { IMenuItem, ContentItemModel, ExtendedOpenAPIOperation, Unstable_Ex
2
2
  import type { OpenAPIExternalDocumentation, OpenAPIServer, OpenAPIXCodeSample, Server } from '../../types';
3
3
  import type { OpenAPIParser } from '../OpenAPIParser';
4
4
  import type { RedocProNormalizedOptions } from '../../../../services';
5
+ import type { MediaContentModel } from './MediaContent';
6
+ import type { GroupModel } from './Group.model';
5
7
  import { CallbackModel } from './Callback';
6
8
  import { FieldModel } from './Field';
7
- import type { MediaContentModel } from './MediaContent';
8
9
  import { RequestBodyModel } from './RequestBody';
9
10
  import { ResponseModel } from './Response';
10
11
  import { SecurityRequirementModel } from './SecurityRequirement';
11
- import type { GroupModel } from './Group.model';
12
12
  export interface Sample {
13
13
  lang: string;
14
14
  label?: string;
@@ -1,8 +1,8 @@
1
1
  import type { OpenAPIRequestBody, Referenced } from '../../types';
2
2
  import type { OpenAPIParser } from '../OpenAPIParser';
3
3
  import type { RedocProNormalizedOptions } from '../../../../services/ProStore';
4
- import { MediaContentModel } from './MediaContent';
5
4
  import type { OperationModel } from './Operation';
5
+ import { MediaContentModel } from './MediaContent';
6
6
  declare type RequestBodyProps = {
7
7
  parser: OpenAPIParser;
8
8
  infoOrRef: Referenced<OpenAPIRequestBody>;
@@ -1,9 +1,9 @@
1
1
  import type { OpenAPIResponse, Referenced } from '../../types';
2
2
  import type { OpenAPIParser } from '../OpenAPIParser';
3
3
  import type { RedocProNormalizedOptions } from '../../../../services/ProStore';
4
+ import type { OperationModel } from './Operation';
4
5
  import { FieldModel } from './Field';
5
6
  import { MediaContentModel } from './MediaContent';
6
- import type { OperationModel } from './Operation';
7
7
  declare type ResponseProps = {
8
8
  parser: OpenAPIParser;
9
9
  code: string;
@@ -2,8 +2,8 @@ import type { OpenAPIExternalDocumentation, OpenAPISchema, Referenced } from '..
2
2
  import type { OpenAPIParser } from '../OpenAPIParser';
3
3
  import type { RedocProNormalizedOptions } from '../../../../services';
4
4
  import type { MergedOpenAPISchema, ResponseModel } from '../';
5
- import { FieldModel } from './Field';
6
5
  import type { OperationModel } from './Operation';
6
+ import { FieldModel } from './Field';
7
7
  export declare type Deps = {
8
8
  parentFieldFullPath?: string;
9
9
  operation?: OperationModel;
@@ -1,7 +1,7 @@
1
- import type { ExtendedOpenAPIOperation } from '../services';
2
1
  import type { FieldModel } from '../services/models';
3
2
  import type { OpenAPIParser } from '../services/OpenAPIParser';
4
3
  import type { OpenAPIEncoding, OpenAPIMediaType, OpenAPIParameter, OpenAPIParameterStyle, OpenAPISchema, OpenAPIServer, Referenced, OpenAPIResponse, OpenAPIRequestBody } from '../types';
4
+ import type { ExtendedOpenAPIOperation } from '../services';
5
5
  export declare function isStatusCode(statusCode: string): boolean;
6
6
  export declare function getStatusCodeType(statusCode: string | number, defaultAsError?: boolean): string;
7
7
  export declare function isOperationName(key: string): boolean;
@@ -1,15 +1,15 @@
1
1
  import type { IValueDidChange } from 'mobx';
2
2
  import type { ContentItemModel, IMenuItem, OpenAPIDefinition, OpenAPIExternalDocumentation, OperationModel, RedocRawOptions, SearchStore } from '../redoc-lib';
3
- import { MarkerService, RedocNormalizedOptions, SpecStore } from '../redoc-lib';
4
- import { ProMenu } from './ProMenu';
5
3
  import type { SearchResultMeta } from './SearchStore';
6
4
  import type { SpecVersions } from './VersionedSpecStore';
7
- import { VersionedSpecStore } from './VersionedSpecStore';
8
5
  import type { LicenseInfo } from './check';
9
6
  import type { CodeSamplesConfig, Languages } from './code-samples/';
10
7
  import type { Events } from './store-types';
11
- import { LayoutVariant } from './store-types';
12
8
  import type { ExternalLink, MarkdownItemsPagination, Normalized, Pagination, RedocProTheme } from './types';
9
+ import { MarkerService, RedocNormalizedOptions, SpecStore } from '../redoc-lib';
10
+ import { ProMenu } from './ProMenu';
11
+ import { VersionedSpecStore } from './VersionedSpecStore';
12
+ import { LayoutVariant } from './store-types';
13
13
  import { SideNavStyle } from './types';
14
14
  export declare type RedocProUserOptionsExt = {
15
15
  licenseKey?: string;
@@ -1,6 +1,6 @@
1
1
  import type { IMenuItem, OperationModel, RedocNormalizedOptions, SearchResult } from '../redoc-lib';
2
- import { SearchStore } from '../redoc-lib';
3
2
  import type { RedocProUserOptionsExt } from './ProStore';
3
+ import { SearchStore } from '../redoc-lib';
4
4
  export declare type SearchResultMeta = {
5
5
  place?: string;
6
6
  path?: string[];
@@ -1,6 +1,6 @@
1
1
  import type { OpenAPIDefinition, ApiInfoModel, OpenAPIParser, OpenAPIExternalDocumentation, SecuritySchemesModel, ContentItemModel } from '../redoc-lib';
2
- import { SpecStore } from '../redoc-lib';
3
2
  import type { RedocProNormalizedOptions } from './ProStore';
3
+ import { SpecStore } from '../redoc-lib';
4
4
  interface VersionInfo {
5
5
  id: string;
6
6
  title: string;
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";import stringifyObject from"stringify-object";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{normalizeMimeType}from"../../../../utils";import{capitalizeFirst}from"../../../generator";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../types";var handler=function(t,e,s){var a,n,i,r,o=s.target,p=s.client,u=Object.assign({indent:" ",withWrapper:!0},e),l=new CodeBuilder({indentation:u.indent,variablesPrefix:u.variablesPrefix,capitalize:!0,lang:Lang.CSHARP}),h=formatHttpMethod(t.method);if(u.withComments&&addComments(l),u.withWrapper&&(l.push("using System;"),l.push("using System.Net.Http;"),l.push("using System.Threading.Tasks;"),(y(MediaTypes.JSON)||y(MediaTypes.XML)||t.basicAuth)&&l.push("using System.Text;"),(y(MediaTypes.URL_ENCODED)||(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length))&&l.push("using System.Collections.Generic;"),(y(MediaTypes.JSON)||(null===(n=t.securityOAuth2ExtraCalls)||void 0===n?void 0:n.length))&&l.push("using Newtonsoft.Json.Linq;"),t.headersObj&&t.headersObj["Content-Type"]===MediaTypes.OCTET_STREAM&&(l.push("using System.IO;"),l.push("using System.Net.Http.Headers;")),l.blank(),l.push("public class Program"),l.push("{"),l.push(1,"public static async Task Main(string[] args)"),l.push(1,"{"),l.push(2,"using (var client = new HttpClient())"),l.push(2,"{")),null===(i=t.securityOAuth2ExtraCalls)||void 0===i?void 0:i.length){var c=new HTTPSnippet(null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(o,p,__assign(__assign({},u),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));l.push(c),l.push(3,"var oauth2Response = await oauth2Request.Content.ReadAsStringAsync();"),l.push(3,"JObject inputJObject = JObject.Parse(oauth2Response);"),l.push(3,'var accessToken = inputJObject["access_token"].ToString();'),l.blank()}var d=Object.keys(t.allHeaders).filter((function(t){switch(t.toLowerCase()){case"content-type":case"content-length":case"accept-encoding":return!1;default:return!0}}));if(d.length&&d.forEach((function(e){var s;l.push(3,'client.DefaultRequestHeaders.Add("%s", %s);',e,(null===(s=t.securityOAuth2ExtraCalls)||void 0===s?void 0:s.length)?'"Bearer " + accessToken':'"'+t.allHeaders[e]+'"')})),t.basicAuth){var m=t.basicAuth,T=m.username,g=m.password;l.push(3,'var base64String = Convert.ToBase64String(Encoding.ASCII.GetBytes("'+T+":"+g+'"));'),l.push(3,'client.DefaultRequestHeaders.Add("Authorization", "Basic "+ base64String);')}if(t.postData)switch(normalizeMimeType(t.postData.mimeType)){case MediaTypes.URL_ENCODED:t.postData.params&&(l.blank(),l.push(3,"List<KeyValuePair<string, string>> postData = new List<KeyValuePair<string, string>>();"),t.postData.params.forEach((function(t){l.push(3,'postData.Add(new KeyValuePair<string, string>("%s", "%s"));',t.name,t.value)})),l.blank());break;case MediaTypes.MULTIPART:t.postData.params&&(l.blank(),l.push(3,"MultipartFormDataContent postData = new MultipartFormDataContent();"),t.postData.params.forEach((function(t){l.push(3,'postData.Add(new StringContent("%s"), "%s");',t.value,t.name)})));break;case MediaTypes.JSON:t.postData.jsonObj&&(l.push(3,'JObject json = JObject.Parse(@"'+addIndentation(stringifyObject(t.postData.jsonObj,{indent:u.indent,inlineCharacterLimit:25}).replace(/"/g,'""'),{level:3,firstLine:!1})+'");'),l.push(3,'var postData = new StringContent(json.ToString(), Encoding.UTF8, "%s");',t.postData.mimeType));break;case MediaTypes.XML:t.postData.text&&(t.postData.text.trim().split("\n").forEach((function(t,e){var s=(0===e?'string xml = @"':"")+t.replace(/"/g,'""');l.push(0===e?3:4,s)})),l.push(3,'";'),l.push(3,'var postData = new StringContent(xml, Encoding.UTF8, "%s");',t.postData.mimeType))}else f()&&(l.push(3,"var ms = new MemoryStream();"),l.push(3,"var postData = new StreamContent(ms);"),l.push(3,'postData.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");'));return printUrlVariablesDeclarations(t,l,3),l.push(3,"var %s = await client.%sAsync(%s%s);",l.var("request"),h,buildUrlExpression(t,l),u.withImports?isDataMethod(t.method)?normalizeMimeType(t.postData&&t.postData.mimeType)===MediaTypes.URL_ENCODED?", new FormUrlEncodedContent(postData)":"delete"===t.method?"":t.postData&&t.postData.params||f()?", postData":", null":"":", new FormUrlEncodedContent(postData)"),u.withWrapper&&(l.push(3,"var response = await request.Content.ReadAsStringAsync();"),l.blank(),l.push(3,"Console.WriteLine(response);"),l.push(2,"}"),l.push(1,"}"),l.push("}")),l.join();function y(e){return t.postData&&normalizeMimeType(t.postData.mimeType)===e}function f(){return t.headersObj&&t.headersObj["Content-Type"]===MediaTypes.OCTET_STREAM}};export var info={key:"httpclient",title:"HttpClient",link:"https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",description:".NET Standard HTTP Client"};export default handler;function addComments(t){t.push("/*"),t.push(" * Requires >= .NET 5"),t.push(" *"),t.push(' * Requires package "Newtonsoft.Json" >= 9.01'),t.push(" * See here for installation details:"),t.push(" * https://www.newtonsoft.com/json"),t.push(" */"),t.blank()}function formatHttpMethod(t){return capitalizeFirst(t.toLowerCase())}function isDataMethod(t){return t&&["POST","PUT","DELETE","PATCH"].includes(t.toUpperCase())}
1
+ import{__assign}from"tslib";import stringifyObject from"stringify-object";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{addIndentation,buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{normalizeMimeType}from"../../../../utils";import{capitalizeFirst}from"../../../generator";import{Lang}from"../../helpers/constants";import{MediaTypes}from"../../../../../types";var handler=function(t,e,a){var s,n,i,r,o=a.target,p=a.client,u=Object.assign({indent:" ",withWrapper:!0},e),l=new CodeBuilder({indentation:u.indent,variablesPrefix:u.variablesPrefix,capitalize:!0,lang:Lang.CSHARP}),h=formatHttpMethod(t.method);if(u.withComments&&addComments(l),u.withWrapper&&(l.push("using System;"),l.push("using System.Net.Http;"),l.push("using System.Threading.Tasks;"),(g(MediaTypes.JSON)||g(MediaTypes.XML)||t.basicAuth)&&l.push("using System.Text;"),(g(MediaTypes.URL_ENCODED)||(null===(s=t.securityOAuth2ExtraCalls)||void 0===s?void 0:s.length))&&l.push("using System.Collections.Generic;"),(g(MediaTypes.JSON)||(null===(n=t.securityOAuth2ExtraCalls)||void 0===n?void 0:n.length))&&l.push("using Newtonsoft.Json.Linq;"),t.headersObj&&t.headersObj["Content-Type"]===MediaTypes.OCTET_STREAM&&(l.push("using System.IO;"),l.push("using System.Net.Http.Headers;")),l.blank(),l.push("public class Program"),l.push("{"),l.push(1,"private readonly IHttpClientFactory _httpClientFactory;"),l.push(1,"public static async Task Main(string[] args)"),l.push(1,"{"),l.push(2,"var client = _httpClientFactory.CreateClient();")),null===(i=t.securityOAuth2ExtraCalls)||void 0===i?void 0:i.length){var c=new HTTPSnippet(null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(o,p,__assign(__assign({},u),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));l.push(c),l.push(2,"var oauth2Response = await oauth2Request.Content.ReadAsStringAsync();"),l.push(2,"JObject inputJObject = JObject.Parse(oauth2Response);"),l.push(2,'var accessToken = inputJObject["access_token"].ToString();'),l.blank()}var d=Object.keys(t.allHeaders).filter((function(t){switch(t.toLowerCase()){case"content-type":case"content-length":case"accept-encoding":return!1;default:return!0}}));if(d.length&&d.forEach((function(e){var a;l.push(2,'client.DefaultRequestHeaders.Add("%s", %s);',e,(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?'"Bearer " + accessToken':'"'+t.allHeaders[e]+'"')})),t.basicAuth){var m=t.basicAuth,y=m.username,T=m.password;l.push(2,'var base64String = Convert.ToBase64String(Encoding.ASCII.GetBytes("'+y+":"+T+'"));'),l.push(2,'client.DefaultRequestHeaders.Add("Authorization", "Basic "+ base64String);')}if(t.postData)switch(normalizeMimeType(t.postData.mimeType)){case MediaTypes.URL_ENCODED:t.postData.params&&(l.blank(),l.push(2,"List<KeyValuePair<string, string>> postData = new List<KeyValuePair<string, string>>();"),t.postData.params.forEach((function(t){l.push(2,'postData.Add(new KeyValuePair<string, string>("%s", "%s"));',t.name,t.value)})),l.blank());break;case MediaTypes.MULTIPART:t.postData.params&&(l.blank(),l.push(2,"MultipartFormDataContent postData = new MultipartFormDataContent();"),t.postData.params.forEach((function(t){l.push(2,'postData.Add(new StringContent("%s"), "%s");',t.value,t.name)})));break;case MediaTypes.JSON:t.postData.jsonObj&&(l.push(2,'JObject json = JObject.Parse(@"'+addIndentation(stringifyObject(t.postData.jsonObj,{indent:u.indent,inlineCharacterLimit:25}).replace(/"/g,'""'),{level:3,firstLine:!1})+'");'),l.push(2,'var postData = new StringContent(json.ToString(), Encoding.UTF8, "%s");',t.postData.mimeType));break;case MediaTypes.XML:t.postData.text&&(t.postData.text.trim().split("\n").forEach((function(t,e){var a=(0===e?'string xml = @"':"")+t.replace(/"/g,'""');l.push(0===e?3:4,a)})),l.push(2,'";'),l.push(2,'var postData = new StringContent(xml, Encoding.UTF8, "%s");',t.postData.mimeType))}else f()&&(l.push(2,"var ms = new MemoryStream();"),l.push(2,"var postData = new StreamContent(ms);"),l.push(2,'postData.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");'));return printUrlVariablesDeclarations(t,l,3),l.push(2,"var %s = await client.%sAsync(%s%s);",l.var("request"),h,buildUrlExpression(t,l),u.withImports?isDataMethod(t.method)?normalizeMimeType(t.postData&&t.postData.mimeType)===MediaTypes.URL_ENCODED?", new FormUrlEncodedContent(postData)":"delete"===t.method?"":t.postData&&t.postData.params||f()?", postData":", null":"":", new FormUrlEncodedContent(postData)"),u.withWrapper&&(l.push(2,"var response = await request.Content.ReadAsStringAsync();"),l.blank(),l.push(2,"Console.WriteLine(response);"),l.push(1,"}"),l.push("}")),l.join();function g(e){return t.postData&&normalizeMimeType(t.postData.mimeType)===e}function f(){return t.headersObj&&t.headersObj["Content-Type"]===MediaTypes.OCTET_STREAM}};export var info={key:"httpclient",title:"HttpClient",link:"https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",description:".NET Standard HTTP Client"};export default handler;function addComments(t){t.push("/*"),t.push(" * Requires >= .NET 5"),t.push(" *"),t.push(' * Requires package "Newtonsoft.Json" >= 9.01'),t.push(" * See here for installation details:"),t.push(" * https://www.newtonsoft.com/json"),t.push(" */"),t.blank()}function formatHttpMethod(t){return capitalizeFirst(t.toLowerCase())}function isDataMethod(t){return t&&["POST","PUT","DELETE","PATCH"].includes(t.toUpperCase())}
2
2
  //# sourceMappingURL=httpclient.js.map
@@ -7,7 +7,7 @@ declare const targets: {
7
7
  default: string;
8
8
  };
9
9
  fetch: import("..").LanguageHandler<(import("../..").BasicLanguageOptions & {
10
- credentials?: "same-origin" | "omit" | "include" | undefined;
10
+ credentials?: "omit" | "same-origin" | "include" | undefined;
11
11
  }) | undefined>;
12
12
  };
13
13
  node: {
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{isEmptyObject,normalizeMimeType}from"../../../../utils";import{capitalizeFirst}from"../../../generator";import{Lang}from"../../helpers/constants";import{buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{MediaTypes}from"../../../../../types";var handler=function(t,e,a){var s,r,i=a.target,p=a.client,n=Object.assign({indent:" ",withWrapper:!0},e),o=new CodeBuilder({indentation:n.indent,variablesPrefix:n.variablesPrefix,capitalize:!0,lang:Lang.JAVA8}),u=formatHttpMethod(t.method);if(n.withComments&&addComments(o),n.withImports&&addImports(o,t),n.withWrapper&&(o.push("public class App {"),o.push(1,"public static void main(String[] args ) throws java.io.IOException {"),o.push(2,"HttpClient httpClient = HttpClientBuilder.create().build();"),o.blank()),null===(s=t.securityOAuth2ExtraCalls)||void 0===s?void 0:s.length){var h=new HTTPSnippet(null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(i,p,__assign(__assign({},n),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));o.push(h),o.push(2,"JSONObject %s = new JSONObject(EntityUtils.toString(httpClient.execute(%s).getEntity()));","oauth2Response","oauth2Request"),o.push(2,'String accessToken = %s.getString("access_token");',"oauth2Response"),o.blank()}printUrlVariablesDeclarations(t,o,2);var l=buildUrlExpression(t,o);o.push(2,"%s "+o.var("request")+" = new %s(%s);",u,u,l);var c=Object.keys(t.allHeaders);if(!c.length||t.postData&&t.postData.mimeType==MediaTypes.MULTIPART||c.forEach((function(e){var a;o.push(2,'%s.setHeader("%s", %s);',o.var("request"),e,(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?'"Bearer " + accessToken':'"'+t.allHeaders[e]+'"')})),t.basicAuth){var m=t.basicAuth,d=m.username,g=m.password;o.push(2,'String encodedString = Base64.getEncoder().encodeToString("'+d+":"+g+'".getBytes());'),o.push(2,'%s.setHeader("%s", "%s"+encodedString);',o.var("request"),"Authorization","Basic ")}if(t.postData)switch(normalizeMimeType(t.postData.mimeType)){case MediaTypes.URL_ENCODED:t.postData.params&&(o.blank(),o.push(2,"List<NameValuePair> params = new ArrayList<NameValuePair>();"),t.postData.params.forEach((function(t){o.push(2,'params.add(new BasicNameValuePair("%s", "%s"));',t.name,t.value)})),o.push(2,"%s.setEntity(new UrlEncodedFormEntity(params));",o.var("request")),o.blank());break;case MediaTypes.MULTIPART:t.postData.params&&(o.push(2,"MultipartEntity reqEntity = new MultipartEntity();"),t.postData.params.forEach((function(t){o.push(2,'reqEntity.addPart("%s", %s);',t.name,isString(t.value)?'new StringBody("'+t.value+'")':t.value)})),o.push(2,"%s.setEntity(reqEntity);",o.var("request")));break;case MediaTypes.JSON:if(t.postData.jsonObj){o.push(2,"JSONObject payload = new JSONObject();");for(var y=0,f=Object.entries(t.postData.jsonObj);y<f.length;y++){var v=f[y],b=v[0],O=v[1];Array.isArray(O)?(o.push(2,'payload.put("%s", new JSONArray()',b),O.forEach((function(t){isObject(t)?(o.push(3,".put(new JSONObject()"),E(t,4),o.push(3,")")):o.push(3,".put(%s)",formatValue(t))})),o.push(2,");")):isObject(O)?(o.push(2,'payload.put("%s", new JSONObject()%s',b,isEmptyObject(O)?");":""),E(O,3),isEmptyObject(O)||o.push(2,");")):o.push(2,'payload.put("%s", %s);',b,formatValue(O))}o.push(2,"%s.setEntity(new StringEntity(payload.toString()));",o.var("request"))}break;case MediaTypes.XML:t.postData.text&&(o.push(2,'String payload = String.join("\\n"'),t.postData.text.trim().split("\n").forEach((function(t){var e=t.replace(/"/g,'\\"');o.push(3,', "'+e+'"')})),o.push(2,");"),o.push(2,"%s.setEntity(new StringEntity(payload));",o.var("request")))}return n.withWrapper&&(o.push(2,"String "+o.var("response")+" = EntityUtils.toString(httpClient.execute(request).getEntity());"),o.blank(),o.push(2,"System.out.println(response);"),o.push(1,"}"),o.push("}")),o.join();function E(t,e){for(var a=0,s=Object.entries(t);a<s.length;a++){var r=s[a],i=r[0],p=r[1];isObject(p)?(o.push(e,'.put("%s", new JSONObject()',i),E(p,e+1),o.push(e,")")):o.push(e,'.put("%s", %s)',i,formatValue(p))}}};export var info={key:"apachehttp",title:"Apache http",link:"https://hc.apache.org/httpcomponents-client-4.5.x/",description:"Apache HttpClient"};export default handler;function addComments(t){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()}function addImports(t,e){var a,s,r;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&&addHttpMethodImport(t,e.method),(null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)&&(null===(s=e.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0].method.toLowerCase())!==e.method.toLowerCase()&&addHttpMethodImport(t,null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0].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.basicAuth&&t.push("import java.util.Base64;"),t.blank()}function addHttpMethodImport(t,e){var a=formatHttpMethod(e);t.push("import org.apache.http.client.methods."+a+";")}function formatHttpMethod(t){return"Http"+capitalizeFirst(t.toLowerCase())}function isString(t){return"[object String]"===Object.prototype.toString.call(t)}function isObject(t){var e=typeof t;return"function"===e||"object"===e&&!!t}function formatValue(t){return isString(t)?JSON.stringify(t):null==t?"JSONObject.NULL":t}
1
+ import{__assign}from"tslib";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../../index";import{isEmptyObject,normalizeMimeType}from"../../../../utils";import{capitalizeFirst}from"../../../generator";import{Lang}from"../../helpers/constants";import{buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{MediaTypes}from"../../../../../types";var handler=function(t,e,a){var s,r,i=a.target,p=a.client,n=Object.assign({indent:" ",withWrapper:!0},e),o=new CodeBuilder({indentation:n.indent,variablesPrefix:n.variablesPrefix,capitalize:!0,lang:Lang.JAVA8}),u=formatHttpMethod(t.method);if(n.withComments&&addComments(o),n.withImports&&addImports(o,t),n.withWrapper&&(o.push("public class App {"),o.push(1,"public static void main(String[] args ) throws java.io.IOException {"),o.push(2,"HttpClient httpClient = HttpClientBuilder.create().build();"),o.blank()),null===(s=t.securityOAuth2ExtraCalls)||void 0===s?void 0:s.length){var h=new HTTPSnippet(null===(r=t.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0]).convert(i,p,__assign(__assign({},n),{withImports:!1,withWrapper:!1,withComments:!1,variablesPrefix:"oauth2"}));o.push(h),o.push(2,"JSONObject %s = new JSONObject(EntityUtils.toString(httpClient.execute(%s).getEntity()));","oauth2Response","oauth2Request"),o.push(2,'String accessToken = %s.getString("access_token");',"oauth2Response"),o.blank()}printUrlVariablesDeclarations(t,o,2);var l=buildUrlExpression(t,o);o.push(2,"%s "+o.var("request")+" = new %s(%s);",u,u,l);var c=Object.keys(t.allHeaders);if(!c.length||t.postData&&t.postData.mimeType==MediaTypes.MULTIPART||c.forEach((function(e){var a;o.push(2,'%s.setHeader("%s", %s);',o.var("request"),e,(null===(a=t.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)?'"Bearer " + accessToken':'"'+t.allHeaders[e]+'"')})),t.basicAuth){var m=t.basicAuth,d=m.username,g=m.password;o.push(2,'String encodedString = Base64.getEncoder().encodeToString("'+d+":"+g+'".getBytes());'),o.push(2,'%s.setHeader("%s", "%s"+encodedString);',o.var("request"),"Authorization","Basic ")}if(t.postData)switch(normalizeMimeType(t.postData.mimeType)){case MediaTypes.URL_ENCODED:t.postData.params&&(o.blank(),o.push(2,"List<NameValuePair> params = new ArrayList<NameValuePair>();"),t.postData.params.forEach((function(t){o.push(2,'params.add(new BasicNameValuePair("%s", "%s"));',t.name,t.value)})),o.push(2,"%s.setEntity(new UrlEncodedFormEntity(params));",o.var("request")),o.blank());break;case MediaTypes.MULTIPART:t.postData.params&&(o.push(2,"MultipartEntity reqEntity = new MultipartEntity();"),t.postData.params.forEach((function(t){o.push(2,'reqEntity.addPart("%s", %s);',t.name,isString(t.value)?'new StringBody("'+t.value+'")':t.value)})),o.push(2,"%s.setEntity(reqEntity);",o.var("request")));break;case MediaTypes.JSON:if(t.postData.jsonObj){o.push(2,"JSONObject payload = new JSONObject();");for(var y=0,f=Object.entries(t.postData.jsonObj);y<f.length;y++){var v=f[y],b=v[0],O=v[1];Array.isArray(O)?(o.push(2,'payload.put("%s", new JSONArray()',b),O.forEach((function(t){isObject(t)?(o.push(3,".put(new JSONObject()"),E(t,4),o.push(3,")")):o.push(3,".put(%s)",formatValue(t))})),o.push(2,");")):isObject(O)?(o.push(2,'payload.put("%s", new JSONObject()%s',b,isEmptyObject(O)?");":""),E(O,3),isEmptyObject(O)||o.push(2,");")):o.push(2,'payload.put("%s", %s);',b,formatValue(O))}o.push(2,"%s.setEntity(new StringEntity(payload.toString()));",o.var("request"))}break;case MediaTypes.XML:t.postData.text&&(o.push(2,'String payload = String.join("\\n"'),t.postData.text.trim().split("\n").forEach((function(t){var e=t.replace(/"/g,'\\"');o.push(3,', "'+e+'"')})),o.push(2,");"),o.push(2,"%s.setEntity(new StringEntity(payload));",o.var("request")))}return n.withWrapper&&(o.push(2,"String "+o.var("response")+" = EntityUtils.toString(httpClient.execute(request).getEntity());"),o.blank(),o.push(2,"System.out.println(response);"),o.push(1,"}"),o.push("}")),o.join();function E(t,e){for(var a=0,s=Object.entries(t);a<s.length;a++){var r=s[a],i=r[0],p=r[1];isObject(p)?(o.push(e,'.put("%s", new JSONObject()',i),E(p,e+1),o.push(e,")")):o.push(e,'.put("%s", %s)',i,formatValue(p))}}};export var info={key:"apachehttp",title:"Apache http",link:"https://hc.apache.org/httpcomponents-client-4.5.x/",description:"Apache HttpClient"};export default handler;function addComments(t){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()}function addImports(t,e){var a,s,r;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&&addHttpMethodImport(t,e.method),(null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a.length)&&(null===(s=e.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0].method.toLowerCase())!==e.method.toLowerCase()&&addHttpMethodImport(t,null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0].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.basicAuth&&t.push("import java.util.Base64;"),t.blank()}function addHttpMethodImport(t,e){var a=formatHttpMethod(e);t.push("import org.apache.http.client.methods."+a+";")}function formatHttpMethod(t){return"Http"+capitalizeFirst(t.toLowerCase())}function isString(t){return"[object String]"===Object.prototype.toString.call(t)}function isObject(t){var e=typeof t;return"function"===e||"object"===e&&!!t}function formatValue(t){return isString(t)?JSON.stringify(t):null==t?"JSONObject.NULL":t}
2
2
  //# sourceMappingURL=apachehttp.js.map
@@ -6,7 +6,7 @@ declare const _default: {
6
6
  default: string;
7
7
  };
8
8
  fetch: import("../..").LanguageHandler<(import("../../..").BasicLanguageOptions & {
9
- credentials?: "same-origin" | "omit" | "include" | undefined;
9
+ credentials?: "omit" | "same-origin" | "include" | undefined;
10
10
  }) | undefined>;
11
11
  };
12
12
  export default _default;
@@ -15,8 +15,8 @@ import 'unfetch/polyfill/index';
15
15
  import 'url-polyfill';
16
16
  import type { OpenAPIDefinition } from './redoc-lib';
17
17
  import type { ProStoreState, RedocProRawOptions } from './services/ProStore';
18
- import { LayoutVariant } from './services/store-types';
19
18
  import type { SpecVersions } from './services/VersionedSpecStore';
19
+ import { LayoutVariant } from './services/store-types';
20
20
  export { setSecurityDetails, setParameterValue, setSecurityDetailsVariants } from './utils';
21
21
  export declare function toggleLayout(layout?: LayoutVariant): void;
22
22
  export declare function toggleRightPanel(value?: boolean): void;
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore,getJsUrl}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
1
+ import{__assign}from"tslib";import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore,getJsUrl}from"./utils";import{RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocsMultiStandalone";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var t=getGlobalStore();t&&t.toggleLayout((null!=e?e:t.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var t=getGlobalStore();t&&t.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var t={},r=e.attributes,o=0;o<r.length;o++){var i=r[o];t[i.name]=i.value}return t}function parseOptionsFromElement(e){var t=attributesMap(e),r={};for(var o in t){r[o.replace(/-(.)/g,(function(e,t){return t.toUpperCase()}))]=t[o]}return r}export function hydrate(e,t){void 0===t&&(t=document.querySelector("redoc"));var r=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:r}),t)}export function init(e,t,r,o){if(void 0===t&&(t={}),void 0===r&&(r=querySelector("redoc")),null===r)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},t),parseOptionsFromElement(r))},["Loading..."]),r,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},t),parseOptionsFromElement(r))},["Loading..."]),r,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var t=e.getAttribute("spec-url");t&&init(t,{},e)}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
2
2
  //# sourceMappingURL=standalone.js.map
package/lib-esm/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- import{IS_BROWSER}from"./redoc-lib/src/utils/";var _store;export var getGlobalStore=function(){return _store};export var setGlobalStore=function(e){return _store=e};export function debounce(e,t,r){var o,n=0;return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];function s(){n>1&&e.apply(void 0,i),n=0,o=null}n++,o?clearTimeout(o):r&&e.apply(void 0,i),o=setTimeout(s,t)}}export function toSessionStorage(e,t){IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}export function fromSessionStorage(e){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}export function setParameterValue(e,t,r){toSessionStorage(e+"."+t,JSON.stringify(r))}export function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}export function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}export function fromLocalStorage(e){return IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}export function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}export function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}export function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}export function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}export function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),r=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:r&&JSON.parse(r)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}export function getSecurityDetailsOptions(e,t){var r=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!r)return null;var o=JSON.parse(r);return o&&Array.isArray(o)?o.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}export function get(e,t,r){return void 0===e&&(e={}),"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:r}),e)}export function joinStringFactory(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter(Boolean).join(e)}}export var dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";var t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+t+'"><\/script>'),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}
1
+ import{IS_BROWSER}from"./redoc-lib/src/utils";var _store;export var getGlobalStore=function(){return _store};export var setGlobalStore=function(e){return _store=e};export function debounce(e,t,r){var o,n=0;return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];function s(){n>1&&e.apply(void 0,i),n=0,o=null}n++,o?clearTimeout(o):r&&e.apply(void 0,i),o=setTimeout(s,t)}}export function toSessionStorage(e,t){IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}export function fromSessionStorage(e){return IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}export function setParameterValue(e,t,r){toSessionStorage(e+"."+t,JSON.stringify(r))}export function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}export function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}export function fromLocalStorage(e){return IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}export function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}export function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}export function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}export function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}export function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),r=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:r&&JSON.parse(r)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}export function getSecurityDetailsOptions(e,t){var r=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!r)return null;var o=JSON.parse(r);return o&&Array.isArray(o)?o.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}export function get(e,t,r){return void 0===e&&(e={}),"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:r}),e)}export function joinStringFactory(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter(Boolean).join(e)}}export var dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";var t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+t+'"><\/script>'),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}
2
2
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reference-docs",
3
- "version": "2.33.0",
3
+ "version": "2.33.1",
4
4
  "description": "Redocly Reference Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -158,13 +158,13 @@
158
158
  "url-polyfill": "^1.1.7",
159
159
  "webpack": "^5.64.4",
160
160
  "webpack-cli": "^4.9.1",
161
- "webpack-dev-server": "^4.6.0",
161
+ "webpack-dev-server": "^4.9.3",
162
162
  "workerize-loader": "github:redocly/workerize-loader#webpack-5-dist",
163
163
  "yaml-js": "^0.2.3"
164
164
  },
165
165
  "lint-staged": {
166
166
  "*.{ts,tsx}": [
167
- "npm run lint:fix"
167
+ "eslint --fix"
168
168
  ],
169
169
  "**/*": [
170
170
  "prettier --write --ignore-unknown"