@redocly/openapi-docs 3.0.0-alpha.30 → 3.0.0-alpha.31

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 (84) hide show
  1. package/dist/console.redocly-openapi-docs.min.js +100 -98
  2. package/dist/oauth2-redirect.js +1 -1
  3. package/dist/redocly-openapi-docs.min.js +938 -985
  4. package/lib/components/ContentItems/helpers.js +1 -1
  5. package/lib/components/OperationParameters/OperationParameters.js +1 -1
  6. package/lib/components/RedoclyOpenAPIDocs/Providers.d.ts +1 -1
  7. package/lib/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  8. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -3
  9. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  10. package/lib/components/RedoclyOpenAPIDocs/index.d.ts +0 -1
  11. package/lib/components/RedoclyOpenAPIDocs/index.js +1 -1
  12. package/lib/components/RedoclyOpenAPIDocs/types.d.ts +0 -1
  13. package/lib/components/RedoclyOpenAPIDocs/utils.js +1 -1
  14. package/lib/components/SideMenu/MenuItem.js +1 -1
  15. package/lib/components/rightPanel/Console/Console.js +1 -1
  16. package/lib/components/rightPanel/Console/shallowCopyForTryIt.d.ts +2 -0
  17. package/lib/components/rightPanel/Console/shallowCopyForTryIt.js +2 -0
  18. package/lib/components/rightPanel/ParameterArray.js +3 -1
  19. package/lib/components/rightPanel/utils.d.ts +0 -1
  20. package/lib/components/rightPanel/utils.js +1 -1
  21. package/lib/constants.d.ts +1 -0
  22. package/lib/constants.js +1 -1
  23. package/lib/index.d.ts +12 -8
  24. package/lib/index.js +1 -1
  25. package/lib/models/group.js +1 -1
  26. package/lib/models/operation.js +1 -1
  27. package/lib/services/Options/normalizeOptions.js +1 -1
  28. package/lib/services/code-samples/generator.js +1 -1
  29. package/lib/services/history/helpers.js +1 -1
  30. package/lib/services/menu/operation.js +1 -1
  31. package/lib/services/menu/tags.js +1 -1
  32. package/lib/services/search/DeepSearchStore.js +1 -1
  33. package/lib/services/utils.d.ts +0 -1
  34. package/lib/services/utils.js +1 -1
  35. package/lib/standalone.js +1 -1
  36. package/lib/utils/index.d.ts +0 -1
  37. package/lib/utils/index.js +1 -1
  38. package/lib/utils/loadAndBundleSpec.d.ts +0 -2
  39. package/lib/utils/loadAndBundleSpec.js +1 -1
  40. package/lib/utils/openapi.d.ts +4 -1
  41. package/lib/utils/openapi.js +1 -1
  42. package/lib/utils/path.d.ts +2 -1
  43. package/lib/utils/path.js +1 -1
  44. package/lib-esm/components/ContentItems/helpers.js +1 -1
  45. package/lib-esm/components/OperationParameters/OperationParameters.js +1 -1
  46. package/lib-esm/components/RedoclyOpenAPIDocs/Providers.d.ts +1 -1
  47. package/lib-esm/components/RedoclyOpenAPIDocs/Providers.js +1 -1
  48. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.d.ts +1 -3
  49. package/lib-esm/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +1 -1
  50. package/lib-esm/components/RedoclyOpenAPIDocs/index.d.ts +0 -1
  51. package/lib-esm/components/RedoclyOpenAPIDocs/index.js +1 -1
  52. package/lib-esm/components/RedoclyOpenAPIDocs/types.d.ts +0 -1
  53. package/lib-esm/components/RedoclyOpenAPIDocs/utils.js +1 -1
  54. package/lib-esm/components/SideMenu/MenuItem.js +1 -1
  55. package/lib-esm/components/rightPanel/Console/Console.js +1 -1
  56. package/lib-esm/components/rightPanel/Console/shallowCopyForTryIt.d.ts +2 -0
  57. package/lib-esm/components/rightPanel/Console/shallowCopyForTryIt.js +2 -0
  58. package/lib-esm/components/rightPanel/ParameterArray.js +3 -1
  59. package/lib-esm/components/rightPanel/utils.d.ts +0 -1
  60. package/lib-esm/components/rightPanel/utils.js +1 -1
  61. package/lib-esm/constants.d.ts +1 -0
  62. package/lib-esm/constants.js +1 -1
  63. package/lib-esm/index.d.ts +12 -8
  64. package/lib-esm/index.js +1 -1
  65. package/lib-esm/models/group.js +1 -1
  66. package/lib-esm/models/operation.js +1 -1
  67. package/lib-esm/services/Options/normalizeOptions.js +1 -1
  68. package/lib-esm/services/code-samples/generator.js +1 -1
  69. package/lib-esm/services/history/helpers.js +1 -1
  70. package/lib-esm/services/menu/operation.js +1 -1
  71. package/lib-esm/services/menu/tags.js +1 -1
  72. package/lib-esm/services/search/DeepSearchStore.js +1 -1
  73. package/lib-esm/services/utils.d.ts +0 -1
  74. package/lib-esm/services/utils.js +1 -1
  75. package/lib-esm/standalone.js +1 -1
  76. package/lib-esm/utils/index.d.ts +0 -1
  77. package/lib-esm/utils/index.js +1 -1
  78. package/lib-esm/utils/loadAndBundleSpec.d.ts +0 -2
  79. package/lib-esm/utils/loadAndBundleSpec.js +1 -1
  80. package/lib-esm/utils/openapi.d.ts +4 -1
  81. package/lib-esm/utils/openapi.js +1 -1
  82. package/lib-esm/utils/path.d.ts +2 -1
  83. package/lib-esm/utils/path.js +1 -1
  84. package/package.json +9 -10
@@ -1,2 +1,2 @@
1
- import{generateMediaQueries,LayoutVariant}from"@redocly/theme";import{DEFAULT_SEARCH_MAX_DEPTH,WindowReferenceOptions}from"../../constants";import{SearchMode}from"./types";import{argValueToBoolean,argValueToExpandLevel,argValueToInt,argValueToNumber,getWindowReferenceOptions,isUndefined}from"../../utils";import{normalizePath}from"../utils";import{addTrailingSlash,normalizeExpandResponses,normalizePayloadSampleIdx,normalizeShowExtensions,normalizeScrollYOffset}from"./helpers";import{Pagination,SideNavStyle}from"../types";export function normalizeOptions(e,a){var o,n,l,i,r,s,t,d,u,g,p,h;e=Object.assign(Object.assign(Object.assign({},a),e),{allowedMdComponents:Object.assign(Object.assign({},null==e?void 0:e.allowedMdComponents),{components:Object.assign(Object.assign({},null===(o=null==a?void 0:a.allowedMdComponents)||void 0===o?void 0:o.components),null===(n=null==e?void 0:e.allowedMdComponents)||void 0===n?void 0:n.components),tags:Object.assign(Object.assign({},null===(l=null==a?void 0:a.allowedMdComponents)||void 0===l?void 0:l.tags),null===(i=null==e?void 0:e.allowedMdComponents)||void 0===i?void 0:i.tags),nodes:Object.assign(Object.assign(Object.assign({},null===(r=null==a?void 0:a.allowedMdComponents)||void 0===r?void 0:r.nodes),null===(s=null==e?void 0:e.allowedMdComponents)||void 0===s?void 0:s.nodes),{heading:(null===(d=null===(t=null==a?void 0:a.allowedMdComponents)||void 0===t?void 0:t.nodes)||void 0===d?void 0:d.heading)||(null===(u=null==e?void 0:e.allowedMdComponents)||void 0===u?void 0:u.nodes.heading)})})});const m=Array.isArray(e.ignoreNamedSchemas)?e.ignoreNamedSchemas:null===(g=e.ignoreNamedSchemas)||void 0===g?void 0:g.split(",").map((e=>e.trim())),c={downloadDefinitionUrl:e.downloadDefinitionUrl,schemaDefinitionsTagName:e.schemaDefinitionsTagName,corsProxyUrl:addTrailingSlash(e.corsProxyUrl),authCorsProxyUrl:addTrailingSlash(e.authCorsProxyUrl),ctrlFHijack:argValueToBoolean(e.ctrlFHijack,!0),disableDeepLinks:argValueToBoolean(e.disableDeepLinks,!1),disableTryItRequestUrlEncoding:argValueToBoolean(e.disableTryItRequestUrlEncoding,!1),minCharacterLengthToInitSearch:argValueToNumber(e.minCharacterLengthToInitSearch,3),disableSearch:argValueToBoolean(e.disableSearch,!1),disableSidebar:argValueToBoolean(e.disableSidebar,!1),expandResponses:normalizeExpandResponses(e.expandResponses),jsonSampleExpandLevel:argValueToExpandLevel(e.jsonSampleExpandLevel,2),expandDefaultServerVariables:argValueToBoolean(e.expandDefaultServerVariables,!1),expandDefaultRequest:argValueToBoolean(e.expandDefaultRequest,!0),expandDefaultResponse:argValueToBoolean(e.expandDefaultResponse,!0),expandSingleSchemaField:argValueToBoolean(e.expandSingleSchemaField,!1),generatedPayloadSamplesMaxDepth:argValueToInt(e.generatedPayloadSamplesMaxDepth,8),hideDownloadButton:argValueToBoolean(e.hideDownloadButton),hideInfoDescription:argValueToBoolean(e.hideInfoDescription),hideHostname:argValueToBoolean(e.hideHostname,!1),hideInfoSection:argValueToBoolean(e.hideInfoSection,!1),hideLoading:argValueToBoolean(e.hideLoading,!1),hideLogo:argValueToBoolean(e.hideLogo,!1),hideFab:argValueToBoolean(e.hideFab,!1),hideRequestPayloadSample:argValueToBoolean(e.hideRequestPayloadSample,!1),hideRightPanel:argValueToBoolean(e.hideRightPanel,!1),hideSchemaPattern:argValueToBoolean(e.hideSchemaPattern,!1),hideOneOfDescription:argValueToBoolean(e.hideOneOfDescription,!1),hideSchemaTitles:argValueToBoolean(e.hideSchemaTitles,!1),hideSingleRequestSampleTab:argValueToBoolean(e.hideSingleRequestSampleTab,!1),hideTryItPanel:argValueToBoolean(e.hideTryItPanel,!1),showObjectSchemaExamples:argValueToBoolean(e.showObjectSchemaExamples,!1),showAccessMode:argValueToBoolean(e.showAccessMode,!1),maxDisplayedEnumValues:argValueToNumber(e.maxDisplayedEnumValues),maxResponseHeadersToShowInTryIt:argValueToNumber(e.maxResponseHeadersToShowInTryIt,0),menuToggle:argValueToBoolean(e.menuToggle,!0),mockServer:(null===(p=e.mockServer)||void 0===p?void 0:p.url)?{url:e.mockServer.url,position:e.mockServer.position||"first",description:e.mockServer.description||"Mock server"}:void 0,nativeScrollbars:argValueToBoolean(e.nativeScrollbars,!1),oAuth2RedirectURI:e.oAuth2RedirectURI||null,onlyRequiredInSamples:argValueToBoolean(e.onlyRequiredInSamples,!1),pathInMiddlePanel:argValueToBoolean(e.pathInMiddlePanel,!1),onDeepLinkClick:e.onDeepLinkClick||getWindowReferenceOptions(WindowReferenceOptions.ON_DEEP_LINK_CLICK),requestInterceptor:e.requestInterceptor||getWindowReferenceOptions(WindowReferenceOptions.REQUEST_INTERCEPTOR),routingBasePath:isUndefined(e.enableRouter)?"":e.routingBasePath&&normalizePath(e.routingBasePath)||"",schemaExpansionLevel:argValueToExpandLevel(e.schemaExpansionLevel),pagination:e.pagination||Pagination.None,feedback:e.feedback||{hide:!0},payloadSampleIdx:normalizePayloadSampleIdx(e.payloadSampleIdx,0),requiredPropsFirst:argValueToBoolean(e.requiredPropsFirst,!1),markdownHeadingsAnchorLevel:argValueToNumber(e.markdownHeadingsAnchorLevel,2),samplesTabsMaxCount:argValueToInt(e.samplesTabsMaxCount,5),scrollYOffset:normalizeScrollYOffset(e.scrollYOffset),searchAutoExpand:argValueToBoolean(e.searchAutoExpand,!0),searchFieldLevelBoost:argValueToNumber(e.searchFieldLevelBoost,.95),searchMaxDepth:argValueToNumber(e.searchMaxDepth,DEFAULT_SEARCH_MAX_DEPTH),searchOperationTitleBoost:argValueToNumber(e.searchOperationTitleBoost,4),searchTagTitleBoost:argValueToNumber(e.searchTagTitleBoost,8),sendXUserAgentInTryIt:argValueToBoolean(e.sendXUserAgentInTryIt,!1),showWebhookVerb:argValueToBoolean(e.showWebhookVerb,!1),showChangeLayoutButton:argValueToBoolean(e.showChangeLayoutButton,!0),showConsole:null!=e.hideTryItPanel?!e.hideTryItPanel:null===(h=e.showConsole)||void 0===h||h,showExtensions:normalizeShowExtensions(e.showExtensions),preserveOriginalExtensionsName:argValueToBoolean(e.preserveOriginalExtensionsName,!1),showNextButton:argValueToBoolean(e.showNextButton,!0),showRightPanelToggle:argValueToBoolean(e.showRightPanelToggle,!0),showSecuritySchemeType:argValueToBoolean(e.showSecuritySchemeType,!0),hideSecuritySection:argValueToBoolean(e.hideSecuritySection,!1),simpleOneOfTypeLabel:argValueToBoolean(e.simpleOneOfTypeLabel,!1),sortEnumValuesAlphabetically:argValueToBoolean(e.sortEnumValuesAlphabetically),sortOperationsAlphabetically:argValueToBoolean(e.sortOperationsAlphabetically),sortPropsAlphabetically:argValueToBoolean(e.sortPropsAlphabetically,!1),sortTagsAlphabetically:argValueToBoolean(e.sortTagsAlphabetically,!1),unstable_ignoreMimeParameters:argValueToBoolean(e.unstable_ignoreMimeParameters,!1),untrustedDefinition:argValueToBoolean(e.untrustedDefinition,!1),enumSkipQuotes:argValueToBoolean(e.enumSkipQuotes),whiteLabel:argValueToBoolean(e.whiteLabel),skipBundleAndConvert:argValueToBoolean(e.skipBundleAndConvert),disablePaginationLoadingAnimation:argValueToBoolean(!!e.disablePaginationLoadingAnimation),disableErrorBoundary:argValueToBoolean(e.disableErrorBoundary),ignoreNamedSchemas:new Set(m),mediaQueries:generateMediaQueries((null==e?void 0:e.breakpoints)||{}),showAtBreakpoint:e.showAtBreakpoint,allowedMdComponents:null==e?void 0:e.allowedMdComponents,defaultSampleLanguage:e.defaultSampleLanguage||"",generateCodeSamples:e.generateCodeSamples||{languages:[]},layout:e.layout||LayoutVariant.THREE_PANEL,sideNavStyle:e.sideNavStyle||SideNavStyle.SummaryOnly,searchMode:e.searchMode||SearchMode.Default,sidebarLinks:e.sidebarLinks||{},events:e.events||{},hooks:e.hooks||getWindowReferenceOptions(WindowReferenceOptions.HOOKS)||{},unstable_tryItButtonOverride:e.unstable_tryItButtonOverride||null,unstable_externalCodeSamples:e.unstable_externalCodeSamples||[],markdownItemsPagination:e.markdownItemsPagination||"none",infoNavText:null==e?void 0:e.infoNavText};return null!=e.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),c.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||c.pagination===Pagination.None,c}
1
+ import{generateMediaQueries,LayoutVariant}from"@redocly/theme";import{DEFAULT_SEARCH_MAX_DEPTH,WindowReferenceOptions}from"../../constants";import{SearchMode}from"./types";import{argValueToBoolean,argValueToExpandLevel,argValueToInt,argValueToNumber,getWindowReferenceOptions,isUndefined,normalizePath}from"../../utils";import{addTrailingSlash,normalizeExpandResponses,normalizePayloadSampleIdx,normalizeShowExtensions,normalizeScrollYOffset}from"./helpers";import{Pagination,SideNavStyle}from"../types";export function normalizeOptions(e,a){var o,n,l,i,r,s,t,d,u,g,p,h;e=Object.assign(Object.assign(Object.assign({},a),e),{allowedMdComponents:Object.assign(Object.assign({},null==e?void 0:e.allowedMdComponents),{components:Object.assign(Object.assign({},null===(o=null==a?void 0:a.allowedMdComponents)||void 0===o?void 0:o.components),null===(n=null==e?void 0:e.allowedMdComponents)||void 0===n?void 0:n.components),tags:Object.assign(Object.assign({},null===(l=null==a?void 0:a.allowedMdComponents)||void 0===l?void 0:l.tags),null===(i=null==e?void 0:e.allowedMdComponents)||void 0===i?void 0:i.tags),nodes:Object.assign(Object.assign(Object.assign({},null===(r=null==a?void 0:a.allowedMdComponents)||void 0===r?void 0:r.nodes),null===(s=null==e?void 0:e.allowedMdComponents)||void 0===s?void 0:s.nodes),{heading:(null===(d=null===(t=null==a?void 0:a.allowedMdComponents)||void 0===t?void 0:t.nodes)||void 0===d?void 0:d.heading)||(null===(u=null==e?void 0:e.allowedMdComponents)||void 0===u?void 0:u.nodes.heading)})})});const m=Array.isArray(e.ignoreNamedSchemas)?e.ignoreNamedSchemas:null===(g=e.ignoreNamedSchemas)||void 0===g?void 0:g.split(",").map((e=>e.trim())),c={downloadDefinitionUrl:e.downloadDefinitionUrl,schemaDefinitionsTagName:e.schemaDefinitionsTagName,corsProxyUrl:addTrailingSlash(e.corsProxyUrl),authCorsProxyUrl:addTrailingSlash(e.authCorsProxyUrl),ctrlFHijack:argValueToBoolean(e.ctrlFHijack,!0),disableDeepLinks:argValueToBoolean(e.disableDeepLinks,!1),disableTryItRequestUrlEncoding:argValueToBoolean(e.disableTryItRequestUrlEncoding,!1),minCharacterLengthToInitSearch:argValueToNumber(e.minCharacterLengthToInitSearch,3),disableSearch:argValueToBoolean(e.disableSearch,!1),disableSidebar:argValueToBoolean(e.disableSidebar,!1),expandResponses:normalizeExpandResponses(e.expandResponses),jsonSampleExpandLevel:argValueToExpandLevel(e.jsonSampleExpandLevel,2),expandDefaultServerVariables:argValueToBoolean(e.expandDefaultServerVariables,!1),expandDefaultRequest:argValueToBoolean(e.expandDefaultRequest,!0),expandDefaultResponse:argValueToBoolean(e.expandDefaultResponse,!0),expandSingleSchemaField:argValueToBoolean(e.expandSingleSchemaField,!1),generatedPayloadSamplesMaxDepth:argValueToInt(e.generatedPayloadSamplesMaxDepth,8),hideDownloadButton:argValueToBoolean(e.hideDownloadButton),hideInfoDescription:argValueToBoolean(e.hideInfoDescription),hideHostname:argValueToBoolean(e.hideHostname,!1),hideInfoSection:argValueToBoolean(e.hideInfoSection,!1),hideLoading:argValueToBoolean(e.hideLoading,!1),hideLogo:argValueToBoolean(e.hideLogo,!1),hideFab:argValueToBoolean(e.hideFab,!1),hideRequestPayloadSample:argValueToBoolean(e.hideRequestPayloadSample,!1),hideRightPanel:argValueToBoolean(e.hideRightPanel,!1),hideSchemaPattern:argValueToBoolean(e.hideSchemaPattern,!1),hideOneOfDescription:argValueToBoolean(e.hideOneOfDescription,!1),hideSchemaTitles:argValueToBoolean(e.hideSchemaTitles,!1),hideSingleRequestSampleTab:argValueToBoolean(e.hideSingleRequestSampleTab,!1),hideTryItPanel:argValueToBoolean(e.hideTryItPanel,!1),showObjectSchemaExamples:argValueToBoolean(e.showObjectSchemaExamples,!1),showAccessMode:argValueToBoolean(e.showAccessMode,!1),maxDisplayedEnumValues:argValueToNumber(e.maxDisplayedEnumValues),maxResponseHeadersToShowInTryIt:argValueToNumber(e.maxResponseHeadersToShowInTryIt,0),menuToggle:argValueToBoolean(e.menuToggle,!0),mockServer:(null===(p=e.mockServer)||void 0===p?void 0:p.url)?{url:e.mockServer.url,position:e.mockServer.position||"first",description:e.mockServer.description||"Mock server"}:void 0,nativeScrollbars:argValueToBoolean(e.nativeScrollbars,!1),oAuth2RedirectURI:e.oAuth2RedirectURI||null,onlyRequiredInSamples:argValueToBoolean(e.onlyRequiredInSamples,!1),pathInMiddlePanel:argValueToBoolean(e.pathInMiddlePanel,!1),onDeepLinkClick:e.onDeepLinkClick||getWindowReferenceOptions(WindowReferenceOptions.ON_DEEP_LINK_CLICK),requestInterceptor:e.requestInterceptor||getWindowReferenceOptions(WindowReferenceOptions.REQUEST_INTERCEPTOR),routingBasePath:isUndefined(e.enableRouter)?"":e.routingBasePath&&normalizePath(e.routingBasePath)||"",schemaExpansionLevel:argValueToExpandLevel(e.schemaExpansionLevel),pagination:e.pagination||Pagination.None,feedback:e.feedback||{hide:!0},payloadSampleIdx:normalizePayloadSampleIdx(e.payloadSampleIdx,0),requiredPropsFirst:argValueToBoolean(e.requiredPropsFirst,!1),markdownHeadingsAnchorLevel:argValueToNumber(e.markdownHeadingsAnchorLevel,2),samplesTabsMaxCount:argValueToInt(e.samplesTabsMaxCount,5),scrollYOffset:normalizeScrollYOffset(e.scrollYOffset),searchAutoExpand:argValueToBoolean(e.searchAutoExpand,!0),searchFieldLevelBoost:argValueToNumber(e.searchFieldLevelBoost,.95),searchMaxDepth:argValueToNumber(e.searchMaxDepth,DEFAULT_SEARCH_MAX_DEPTH),searchOperationTitleBoost:argValueToNumber(e.searchOperationTitleBoost,4),searchTagTitleBoost:argValueToNumber(e.searchTagTitleBoost,8),sendXUserAgentInTryIt:argValueToBoolean(e.sendXUserAgentInTryIt,!1),showWebhookVerb:argValueToBoolean(e.showWebhookVerb,!1),showChangeLayoutButton:argValueToBoolean(e.showChangeLayoutButton,!0),showConsole:null!=e.hideTryItPanel?!e.hideTryItPanel:null===(h=e.showConsole)||void 0===h||h,showExtensions:normalizeShowExtensions(e.showExtensions),preserveOriginalExtensionsName:argValueToBoolean(e.preserveOriginalExtensionsName,!1),showNextButton:argValueToBoolean(e.showNextButton,!0),showRightPanelToggle:argValueToBoolean(e.showRightPanelToggle,!0),showSecuritySchemeType:argValueToBoolean(e.showSecuritySchemeType,!0),hideSecuritySection:argValueToBoolean(e.hideSecuritySection,!1),simpleOneOfTypeLabel:argValueToBoolean(e.simpleOneOfTypeLabel,!1),sortEnumValuesAlphabetically:argValueToBoolean(e.sortEnumValuesAlphabetically),sortOperationsAlphabetically:argValueToBoolean(e.sortOperationsAlphabetically),sortPropsAlphabetically:argValueToBoolean(e.sortPropsAlphabetically,!1),sortTagsAlphabetically:argValueToBoolean(e.sortTagsAlphabetically,!1),unstable_ignoreMimeParameters:argValueToBoolean(e.unstable_ignoreMimeParameters,!1),untrustedDefinition:argValueToBoolean(e.untrustedDefinition,!1),enumSkipQuotes:argValueToBoolean(e.enumSkipQuotes),whiteLabel:argValueToBoolean(e.whiteLabel),skipBundleAndConvert:argValueToBoolean(e.skipBundleAndConvert),disablePaginationLoadingAnimation:argValueToBoolean(!!e.disablePaginationLoadingAnimation),disableErrorBoundary:argValueToBoolean(e.disableErrorBoundary),ignoreNamedSchemas:new Set(m),mediaQueries:generateMediaQueries((null==e?void 0:e.breakpoints)||{}),showAtBreakpoint:e.showAtBreakpoint,allowedMdComponents:null==e?void 0:e.allowedMdComponents,defaultSampleLanguage:e.defaultSampleLanguage||"",generateCodeSamples:e.generateCodeSamples||{languages:[]},layout:e.layout||LayoutVariant.THREE_PANEL,sideNavStyle:e.sideNavStyle||SideNavStyle.SummaryOnly,searchMode:e.searchMode||SearchMode.Default,sidebarLinks:e.sidebarLinks||{},events:e.events||{},hooks:e.hooks||getWindowReferenceOptions(WindowReferenceOptions.HOOKS)||{},unstable_tryItButtonOverride:e.unstable_tryItButtonOverride||null,unstable_externalCodeSamples:e.unstable_externalCodeSamples||[],markdownItemsPagination:e.markdownItemsPagination||"none",infoNavText:null==e?void 0:e.infoNavText};return null!=e.showConsole&&console.warn('"showConsole" option is deprecated. Please, use "hideTryItPanel" instead.'),c.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||c.pagination===Pagination.None,c}
2
2
  //# sourceMappingURL=normalizeOptions.js.map
@@ -1,2 +1,2 @@
1
- import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{deleteEmptyArrayItem,isArrayOfObjects,serializeParameterValue,getSecurityDetails,getParameterValue}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../constants";import{l}from"../labels";import{HTTPSnippet}from"./httpsnippet";import StringUtility from"./httpsnippet/helpers/string-utility";import{getActiveMediaType}from"../../models";function mapOperationToHAR(e,{exampleName:t="",skipOptionalParameters:a=!1,withOAuth2Call:r=!1,spec:i,generatedPayloadSamplesMaxDepth:s=8,pathParams:n={},properties:o={}},{activeServer:l,requestValues:u}){var p,c,d;const{securityHeaders:m,securityCookies:h,securityQueries:y,securityOAuth2ExtraCalls:g,basicAuth:f}=getSecurityData(null===(p=e.security)||void 0===p?void 0:p[0],r),v=(null===(c=null==e?void 0:e.requestBody)||void 0===c?void 0:c.content)&&getActiveMediaType(e.requestBody.content),O={skipNonRequired:a,skipReadOnly:!0,maxSampleDepth:s},T={path:null==u?void 0:u.path,cookie:null==u?void 0:u.cookie,header:null==u?void 0:u.header,query:null==u?void 0:u.query,body:null==u?void 0:u.body};let S=!1;const C=e.parameters.filter((e=>"header"===e.in)).filter((e=>!(a&&!e.required))).map((e=>{var t;return{name:e.name,value:(null===(t=T.header)||void 0===t?void 0:t[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,O,i))}})).map((e=>((null==v?void 0:v.name)&&"content-type"===e.name.toLowerCase()&&(S=!0,e.value=v.name),e))).concat(m);!S&&(null==v?void 0:v.name)&&C.unshift({name:"Content-Type",value:null==v?void 0:v.name});const b=e.parameters.filter((e=>"cookie"===e.in)).filter((e=>!(a&&!e.required))).map((e=>parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,O,i))))).reduce(((e,t)=>{var a;for(const[r,i]of Object.entries(t))e.push({name:r,value:String((null===(a=T.cookie)||void 0===a?void 0:a[r])||i)});return e}),[]).concat(h),E=e.parameters.filter((e=>"query"===e.in)).filter((e=>!(a&&!e.required))).map((e=>parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,O,i))))).reduce(((e,t)=>{var a,r,i;for(const[s,n]of Object.entries(t))e.push({name:s,value:isArrayOfObjects(null===(a=T.query)||void 0===a?void 0:a[s])&&JSON.stringify(deleteEmptyArrayItem(null===(r=T.query)||void 0===r?void 0:r[s]))||String((null===(i=T.query)||void 0===i?void 0:i[s])||n)});return e}),[]).concat(y),A=`${null==l?void 0:l.url.replace(/\/$/,"")}/${e.path.replace(/^\//,"")}`,_=e.parameters.filter((e=>"path"===e.in)).reduce(((e,t)=>{var a;const{in:r,name:i}=t;return e[i]=(null===(a=T.path)||void 0===a?void 0:a[i])||n[i]||getParameterValue(r,i),e}),{}),P=null===(d=null==v?void 0:v.examples)||void 0===d?void 0:d[t],R=(null==v?void 0:v.examples)||{},[w]=Object.values(R),D=T.body||(null==P?void 0:P.value)||(null==w?void 0:w.value)||(null==v?void 0:v.schema)&&Sampler.sample(null==v?void 0:v.schema.rawSchema,O,i),j=null==v?void 0:v.name.toLowerCase();let k="",M=[];switch(normalizeMimeType(j)){case MediaTypes.JSON:k=JSON.stringify(getDataRequest(D,o));break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:k=stringifyQueryString(getDataRequest(D,o)),M=objectToHarParams(getDataRequest(D,o));break;default:k=String(D||"")}const H=k?{mimeType:(null==v?void 0:v.name)||MediaTypes.OCTET_STREAM,text:k,params:M}:void 0,q=e.responses.map((e=>e.code));return{method:e.httpVerb,url:A,httpVersion:"HTTP/1.1",cookies:b,headers:C,queryString:E,postData:H,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:g,basicAuth:f,pathParameters:_,serverVariables:(null==l?void 0:l.variables)||e.activeServer.variables,allResponseCodes:q}}const defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:Object.assign(Object.assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:Object.assign(Object.assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:Object.assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:Object.assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:Object.assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:Object.assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:Object.assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:Object.assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:Object.assign({},defaultOptions)}};export function getCodeSample({lang:e,operation:t,exampleName:a,pathParams:r,properties:i,options:s={}}){try{const{skipOptionalParameters:n,withOAuth2Call:o,spec:l,generatedPayloadSamplesMaxDepth:u,store:p}=s,c=mapOperationToHAR(t,{exampleName:a,pathParams:r,properties:i,skipOptionalParameters:n,withOAuth2Call:o,spec:l,generatedPayloadSamplesMaxDepth:u},p),d=new HTTPSnippet(c);return langToSnippetConfig[e]?d.convert(langToSnippetConfig[e].code,langToSnippetConfig[e].defaultTarget,Object.assign(Object.assign({},langToSnippetConfig[e].defaultOptions),s)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t){var a,r,i,s;const n={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0};for(const o of(null==e?void 0:e.schemes)||[]){const e=getSecurityDetails(o.id);switch(o.type){case"openIdConnect":null===(a=n.securityHeaders)||void 0===a||a.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const a=e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";o.flows.clientCredentials&&t?n.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(o.flows.clientCredentials,o.scopes,e)):o.flows.password&&t&&n.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(o.flows.password,o.scopes,e)),null===(r=n.securityHeaders)||void 0===r||r.push({name:"Authorization",value:a});break}case"apiKey":{const t=e.raw||"YOUR_API_KEY_HERE";"header"===o.in&&(null===(i=n.securityHeaders)||void 0===i||i.push({name:o.name,value:t})),"cookie"===o.in&&n.securityCookies.push({name:o.name,value:t}),"query"===o.in&&n.securityQueries.push({name:o.name,value:t});break}case"http":"basic"===o.scheme?n.basicAuth={username:e.username||`<${StringUtility.toSnakeCase(l("tryItAuthBasicUsername"))}>`,password:e.password||`<${StringUtility.toSnakeCase(l("tryItAuthBasicPassword"))}>`}:null===(s=n.securityHeaders)||void 0===s||s.push({name:"Authorization",value:`${capitalizeFirst(o.scheme||"bearer")} <YOUR_${o.bearerFormat||"TOKEN"}_HERE>`})}}return n}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:a.username||"<username>"},{name:"password",value:a.password||"<password>"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,t){if(e){if("object"==typeof e)return merge(e,t,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),t,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e){const t=[];for(const[a,r]of Object.entries(e))t.push({name:a,value:String(r)});return t}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
1
+ import{parse as parseQueryString,stringify as stringifyQueryString}from"query-string";import*as Sampler from"openapi-sampler";import merge from"deepmerge";import{deleteEmptyArrayItem,isArrayOfObjects,serializeParameterValue,getSecurityDetails,getParameterValue}from"../../utils";import{normalizeMimeType,arrayMergeStrategy}from"../utils";import{MediaTypes}from"../../constants";import{l}from"../labels";import{HTTPSnippet}from"./httpsnippet";import StringUtility from"./httpsnippet/helpers/string-utility";import{getActiveMediaType}from"../../models/mediaContent";function mapOperationToHAR(e,{exampleName:t="",skipOptionalParameters:a=!1,withOAuth2Call:r=!1,spec:i,generatedPayloadSamplesMaxDepth:s=8,pathParams:n={},properties:o={}},{activeServer:l,requestValues:u}){var p,c,d;const{securityHeaders:m,securityCookies:h,securityQueries:y,securityOAuth2ExtraCalls:g,basicAuth:f}=getSecurityData(null===(p=e.security)||void 0===p?void 0:p[0],r),v=(null===(c=null==e?void 0:e.requestBody)||void 0===c?void 0:c.content)&&getActiveMediaType(e.requestBody.content),O={skipNonRequired:a,skipReadOnly:!0,maxSampleDepth:s},T={path:null==u?void 0:u.path,cookie:null==u?void 0:u.cookie,header:null==u?void 0:u.header,query:null==u?void 0:u.query,body:null==u?void 0:u.body};let S=!1;const C=e.parameters.filter((e=>"header"===e.in)).filter((e=>!(a&&!e.required))).map((e=>{var t;return{name:e.name,value:(null===(t=T.header)||void 0===t?void 0:t[e.name])||getParameterValue("header",e.name)||serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,O,i))}})).map((e=>((null==v?void 0:v.name)&&"content-type"===e.name.toLowerCase()&&(S=!0,e.value=v.name),e))).concat(m);!S&&(null==v?void 0:v.name)&&C.unshift({name:"Content-Type",value:null==v?void 0:v.name});const b=e.parameters.filter((e=>"cookie"===e.in)).filter((e=>!(a&&!e.required))).map((e=>parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,O,i))))).reduce(((e,t)=>{var a;for(const[r,i]of Object.entries(t))e.push({name:r,value:String((null===(a=T.cookie)||void 0===a?void 0:a[r])||i)});return e}),[]).concat(h),E=e.parameters.filter((e=>"query"===e.in)).filter((e=>!(a&&!e.required))).map((e=>parseQueryString(serializeParameterValue(e,Sampler.sample(e.schema.rawSchema,O,i))))).reduce(((e,t)=>{var a,r,i;for(const[s,n]of Object.entries(t))e.push({name:s,value:isArrayOfObjects(null===(a=T.query)||void 0===a?void 0:a[s])&&JSON.stringify(deleteEmptyArrayItem(null===(r=T.query)||void 0===r?void 0:r[s]))||String((null===(i=T.query)||void 0===i?void 0:i[s])||n)});return e}),[]).concat(y),A=`${null==l?void 0:l.url.replace(/\/$/,"")}/${e.path.replace(/^\//,"")}`,_=e.parameters.filter((e=>"path"===e.in)).reduce(((e,t)=>{var a;const{in:r,name:i}=t;return e[i]=(null===(a=T.path)||void 0===a?void 0:a[i])||n[i]||getParameterValue(r,i),e}),{}),P=null===(d=null==v?void 0:v.examples)||void 0===d?void 0:d[t],R=(null==v?void 0:v.examples)||{},[w]=Object.values(R),D=T.body||(null==P?void 0:P.value)||(null==w?void 0:w.value)||(null==v?void 0:v.schema)&&Sampler.sample(null==v?void 0:v.schema.rawSchema,O,i),j=null==v?void 0:v.name.toLowerCase();let k="",M=[];switch(normalizeMimeType(j)){case MediaTypes.JSON:k=JSON.stringify(getDataRequest(D,o));break;case MediaTypes.URL_ENCODED:case MediaTypes.MULTIPART:k=stringifyQueryString(getDataRequest(D,o)),M=objectToHarParams(getDataRequest(D,o));break;default:k=String(D||"")}const H=k?{mimeType:(null==v?void 0:v.name)||MediaTypes.OCTET_STREAM,text:k,params:M}:void 0,q=e.responses.map((e=>e.code));return{method:e.httpVerb,url:A,httpVersion:"HTTP/1.1",cookies:b,headers:C,queryString:E,postData:H,headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:g,basicAuth:f,pathParameters:_,serverVariables:(null==l?void 0:l.variables)||e.activeServer.variables,allResponseCodes:q}}const defaultOptions={withImports:!0,withComments:!1},langToSnippetConfig={curl:{code:"shell",defaultTarget:"curl",defaultOptions:Object.assign(Object.assign({},defaultOptions),{short:!0})},JavaScript:{code:"javascript",defaultTarget:"fetch",defaultOptions:Object.assign(Object.assign({},defaultOptions),{withImports:!1})},"Node.js":{code:"node",defaultTarget:"fetch",defaultOptions:Object.assign({},defaultOptions)},Python:{code:"python",defaultTarget:"requests",defaultOptions:Object.assign({},defaultOptions)},"Java8+Apache":{code:"java8",defaultTarget:"apachehttp",defaultOptions:Object.assign({},defaultOptions)},Java:{code:"java",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},"C#":{code:"csharp",defaultTarget:"httpclient",defaultOptions:Object.assign({},defaultOptions)},Go:{code:"go",defaultTarget:"http.DefaultClient",defaultOptions:Object.assign({},defaultOptions)},PHP:{code:"php",defaultTarget:"curl",defaultOptions:Object.assign({},defaultOptions)},Ruby:{code:"ruby",defaultTarget:"net::http",defaultOptions:Object.assign({},defaultOptions)},R:{code:"r",defaultTarget:"httr",defaultOptions:Object.assign({},defaultOptions)}};export function getCodeSample({lang:e,operation:t,exampleName:a,pathParams:r,properties:i,options:s={}}){try{const{skipOptionalParameters:n,withOAuth2Call:o,spec:l,generatedPayloadSamplesMaxDepth:u,store:p}=s,c=mapOperationToHAR(t,{exampleName:a,pathParams:r,properties:i,skipOptionalParameters:n,withOAuth2Call:o,spec:l,generatedPayloadSamplesMaxDepth:u},p),d=new HTTPSnippet(c);return langToSnippetConfig[e]?d.convert(langToSnippetConfig[e].code,langToSnippetConfig[e].defaultTarget,Object.assign(Object.assign({},langToSnippetConfig[e].defaultOptions),s)):"Language is not supported."}catch(e){return console.error(e),"Failed to generate code sample."}}function getSecurityData(e,t){var a,r,i,s;const n={securityHeaders:[],securityCookies:[],securityQueries:[],securityOAuth2ExtraCalls:[],basicAuth:void 0};for(const o of(null==e?void 0:e.schemes)||[]){const e=getSecurityDetails(o.id);switch(o.type){case"openIdConnect":null===(a=n.securityHeaders)||void 0===a||a.push({name:"Authorization",value:"Bearer <YOUR_TOKEN_HERE>"});break;case"oauth2":{const a=e.token?`${e.token.token_type||"Bearer"} ${e.token.access_token}`:"Bearer <YOUR_TOKEN_HERE>";o.flows.clientCredentials&&t?n.securityOAuth2ExtraCalls.push(getOAuth2ClientCredsCallHar(o.flows.clientCredentials,o.scopes,e)):o.flows.password&&t&&n.securityOAuth2ExtraCalls.push(getOAuth2PasswordCallHar(o.flows.password,o.scopes,e)),null===(r=n.securityHeaders)||void 0===r||r.push({name:"Authorization",value:a});break}case"apiKey":{const t=e.raw||"YOUR_API_KEY_HERE";"header"===o.in&&(null===(i=n.securityHeaders)||void 0===i||i.push({name:o.name,value:t})),"cookie"===o.in&&n.securityCookies.push({name:o.name,value:t}),"query"===o.in&&n.securityQueries.push({name:o.name,value:t});break}case"http":"basic"===o.scheme?n.basicAuth={username:e.username||`<${StringUtility.toSnakeCase(l("tryItAuthBasicUsername"))}>`,password:e.password||`<${StringUtility.toSnakeCase(l("tryItAuthBasicPassword"))}>`}:null===(s=n.securityHeaders)||void 0===s||s.push({name:"Authorization",value:`${capitalizeFirst(o.scheme||"bearer")} <YOUR_${o.bearerFormat||"TOKEN"}_HERE>`})}}return n}function getOAuth2PasswordCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"password"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},{name:"username",value:a.username||"<username>"},{name:"password",value:a.password||"<password>"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getOAuth2ClientCredsCallHar(e,t,a){return{method:"POST",url:e.tokenUrl,httpVersion:"HTTP/1.1",headers:[{name:"Content-Type",value:MediaTypes.URL_ENCODED},{name:"Accept",value:MediaTypes.JSON}],queryString:[],postData:{mimeType:MediaTypes.URL_ENCODED,text:"",params:[{name:"grant_type",value:"client_credentials"},{name:"client_id",value:a.client_id||"YOUR_CLIENT_ID"},{name:"client_secret",value:a.client_secret||"YOUR_CLIENT_SECRET"},t.length?{name:"scope",value:t.join(" ")}:void 0].filter(isDefined)},cookies:[],headersSize:-1,bodySize:-1,securityOAuth2ExtraCalls:[]}}function getDataRequest(e,t){if(e){if("object"==typeof e)return merge(e,t,{arrayMerge:arrayMergeStrategy});try{return merge(JSON.parse(e),t,{arrayMerge:arrayMergeStrategy})}catch(e){return!1}}return!1}function objectToHarParams(e){const t=[];for(const[a,r]of Object.entries(e))t.push({name:a,value:String(r)});return t}export function isDefined(e){return void 0!==e}export function capitalizeFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}
2
2
  //# sourceMappingURL=generator.js.map
@@ -1,2 +1,2 @@
1
- import{stringify as stringifyQueryString}from"query-string";import{getActiveMediaType}from"../../models";export function isSameHash(e,o){return e===o||"#"+e===o||e==="#"+o}function getContentTypeName(e){var o,n,t,i,d,s,r,p,l,v,u,a,c;if(!e.in)return"request"===e.deps.type&&(null===(t=null===(n=null===(o=e.deps.operation)||void 0===o?void 0:o.requestBody)||void 0===n?void 0:n.content)||void 0===t?void 0:t.mediaTypes)?(null===(s=null===(d=null===(i=e.deps.operation)||void 0===i?void 0:i.requestBody)||void 0===d?void 0:d.content)||void 0===s?void 0:s.mediaTypes.length)>1?(null===(p=null===(r=e.deps.operation)||void 0===r?void 0:r.requestBody)||void 0===p?void 0:p.content)&&getActiveMediaType(e.deps.operation.requestBody.content).name:void 0:"response"===e.deps.type&&(null===(v=null===(l=e.deps.response)||void 0===l?void 0:l.content)||void 0===v?void 0:v.mediaTypes)&&(null===(a=null===(u=e.deps.response)||void 0===u?void 0:u.content)||void 0===a?void 0:a.mediaTypes.length)>1?(null===(c=e.deps.response)||void 0===c?void 0:c.content)&&getActiveMediaType(e.deps.response.content).name:void 0}export function constructFieldDeepFragment(e){var o,n;if(!e)return"";const t={t:e.deps.type,in:e.in||e.deps.in,c:"response"===e.deps.type?null===(o=e.deps.response)||void 0===o?void 0:o.code:void 0,cb:(null===(n=e.deps.operation)||void 0===n?void 0:n.isCallback)?e.deps.operation.callbackId:void 0,ct:getContentTypeName(e),path:e.fieldFullPath};return stringifyQueryString(t,{encode:!1,sort:!1})}export function joinWithSeparator(e="",o="",n="/"){return e.endsWith(n)&&(e=e.slice(0,-n.length)),o.startsWith(n)&&(o=o.slice(n.length)),e&&o?e+n+o:e+o}
1
+ import{stringify as stringifyQueryString}from"query-string";import{getActiveMediaType}from"../../models/mediaContent";export function isSameHash(e,o){return e===o||"#"+e===o||e==="#"+o}function getContentTypeName(e){var o,n,t,i,d,s,r,p,l,v,u,a,c;if(!e.in)return"request"===e.deps.type&&(null===(t=null===(n=null===(o=e.deps.operation)||void 0===o?void 0:o.requestBody)||void 0===n?void 0:n.content)||void 0===t?void 0:t.mediaTypes)?(null===(s=null===(d=null===(i=e.deps.operation)||void 0===i?void 0:i.requestBody)||void 0===d?void 0:d.content)||void 0===s?void 0:s.mediaTypes.length)>1?(null===(p=null===(r=e.deps.operation)||void 0===r?void 0:r.requestBody)||void 0===p?void 0:p.content)&&getActiveMediaType(e.deps.operation.requestBody.content).name:void 0:"response"===e.deps.type&&(null===(v=null===(l=e.deps.response)||void 0===l?void 0:l.content)||void 0===v?void 0:v.mediaTypes)&&(null===(a=null===(u=e.deps.response)||void 0===u?void 0:u.content)||void 0===a?void 0:a.mediaTypes.length)>1?(null===(c=e.deps.response)||void 0===c?void 0:c.content)&&getActiveMediaType(e.deps.response.content).name:void 0}export function constructFieldDeepFragment(e){var o,n;if(!e)return"";const t={t:e.deps.type,in:e.in||e.deps.in,c:"response"===e.deps.type?null===(o=e.deps.response)||void 0===o?void 0:o.code:void 0,cb:(null===(n=e.deps.operation)||void 0===n?void 0:n.isCallback)?e.deps.operation.callbackId:void 0,ct:getContentTypeName(e),path:e.fieldFullPath};return stringifyQueryString(t,{encode:!1,sort:!1})}export function joinWithSeparator(e="",o="",n="/"){return e.endsWith(n)&&(e=e.slice(0,-n.length)),o.startsWith(n)&&(o=o.slice(n.length)),e&&o?e+n+o:e+o}
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1,2 +1,2 @@
1
- import{alphabeticallyByProp,getOperationId,getOperationName}from"../../utils";import{Pagination}from"../types";import{normalizePath}from"../utils";import{joinWithSeparator}from"../history";export function getOperationsItems(t,e,o,a){if(0===e.operations.length)return[];const i=[];for(const r of e.operations){const e=getOperationId(r,t),n="operation";i.push({id:e,type:n,parent:t,operationDefinition:r,depth:o,name:getOperationName(r),httpVerb:r.httpVerb,path:r.pathName,items:[],isWebhook:r.isWebhook,operationId:r.operationId,href:getHref({id:e,type:n,parent:t},a.pagination)})}return a.sortOperationsAlphabetically&&i.sort(alphabeticallyByProp("name")),i}export function getHref({type:t,id:e,parent:o},a){switch(a){case Pagination.None:return`#${e}`;case Pagination.Item:return"section"===t?"tag"===(null==o?void 0:o.type)?normalizePath(joinWithSeparator(o.id,e,"#")):`#${e}`:o&&"group"!==o.type?normalizePath(joinWithSeparator(o.id,e)):normalizePath(e);case Pagination.Section:return"operation"===t||"schema"===t?normalizePath(o?joinWithSeparator(o.id,e,"#"):`#${e}`):"section"===t?o?`#${e}`:normalizePath(`#${e}`):normalizePath(e);default:return""}}
1
+ import{alphabeticallyByProp,getOperationId,getOperationName,normalizePath}from"../../utils";import{Pagination}from"../types";import{joinWithSeparator}from"../history";export function getOperationsItems(t,e,o,a){if(0===e.operations.length)return[];const i=[];for(const r of e.operations){const e=getOperationId(r,a.pagination,t),n="operation";i.push({id:e,type:n,parent:t,operationDefinition:r,depth:o,name:getOperationName(r),httpVerb:r.httpVerb,path:r.pathName,items:[],isWebhook:r.isWebhook,operationId:r.operationId,href:getHref({id:e,type:n,parent:t},a.pagination)})}return a.sortOperationsAlphabetically&&i.sort(alphabeticallyByProp("name")),i}export function getHref({type:t,id:e,parent:o},a){switch(a){case Pagination.None:return`#${e}`;case Pagination.Item:return"section"===t?"tag"===(null==o?void 0:o.type)?normalizePath(joinWithSeparator(o.id,e,"#")):`#${e}`:o&&"group"!==o.type?normalizePath(joinWithSeparator(o.id,e)):normalizePath(e);case Pagination.Section:return"operation"===t||"schema"===t?normalizePath(o?joinWithSeparator(o.id,e,"#"):`#${e}`):"section"===t?o?`#${e}`:normalizePath(`#${e}`):normalizePath(e);default:return""}}
2
2
  //# sourceMappingURL=operation.js.map
@@ -1,2 +1,2 @@
1
- import{getTagOrGroup}from"../../models";import{GROUP_DEPTH}from"../../constants";import{alphabeticallyByProp,getValueFromMdParsedExtension,isOperationName,JsonPointer}from"../../utils";import{getOperationsItems}from"./operation";import{addMarkdownItems}from"./markdown";export function getTagsItems(e,t,n,o,a){let s;if(s=void 0===o?Object.keys(t):o.tags,!Array.isArray(s))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const i=s.map((e=>t[e]?(t[e].used=!0,t[e]):(console.warn(`Non-existing tag "${e}" is added to the group "${null==o?void 0:o.name}"`),null))),r=[];for(const t of i){if(!t)continue;const o=getTagOrGroup("tag",t,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},n);if(o.depth=GROUP_DEPTH+1,""===t.name){const e=[...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(void 0,t,o.depth+1,a)];r.push(...e);continue}const s=getTagRelatedSchema({definition:e.definition,tag:t,parent:o,schemaDefinitionsTagName:a.schemaDefinitionsTagName,options:{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel}});o.items=[...s,...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(o,t,o.depth+1,a)],r.push(o)}return a.sortTagsAlphabetically&&r.sort(alphabeticallyByProp("name")),r}export function getTagGroupsItems(e,t,n,o,a){const s=[];for(const i of n){const n=getTagOrGroup("group",i,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},t);n.depth=GROUP_DEPTH,n.items=getTagsItems(e,o,n,i,a),s.push(n)}return s}function getTagRelatedSchema({definition:e,tag:t,parent:n,schemaDefinitionsTagName:o,options:a}){var s;const i=o?[o]:[];return Object.entries((null===(s=e.components)||void 0===s?void 0:s.schemas)||{}).map((([e,o])=>{if(!(o["x-tags"]||i).includes(t.name))return null;const s=getTagOrGroup("schema",{name:e,"x-displayName":`${o.title||e}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${e}" /%}`,isSchema:!0,level:2},a,n);return s.depth=n.depth+1,s})).filter(Boolean)}export function getTagsWithOperations(e,t){const{definition:n}=e,o={},a=n["x-webhooks"]||n.webhooks;for(const e of t||[])o[e.name]=Object.assign(Object.assign({},e),{operations:[]});return n.paths&&getTags(e,n.paths,o),a&&getTags(e,a,o,!0),o}function getTags(e,t,n,o){for(const a of Object.keys(t||{})){const s=t[a],i=Object.keys(s).filter(isOperationName);for(const t of i){const i=s[t];if(s.$ref){const{resolved:t}=e.deref(s);getTags(e,{[a]:t},n,o);continue}let r=null==i?void 0:i.tags;r&&r.length||(r=[""]);for(const e of r){let r=n[e];void 0===r&&(r={name:e,operations:[]},n[e]=r),r["x-traitTag"]||r.operations.push(Object.assign(Object.assign({},i),{pathName:a,pointer:JsonPointer.compile(["paths",a,t]),httpVerb:t,pathParameters:s.parameters||[],pathServers:s.servers,isWebhook:!!o}))}}}}
1
+ import{getTagOrGroup}from"../../models/group";import{GROUP_DEPTH}from"../../constants";import{alphabeticallyByProp,getValueFromMdParsedExtension,isOperationName,JsonPointer}from"../../utils";import{getOperationsItems}from"./operation";import{addMarkdownItems}from"./markdown";export function getTagsItems(e,t,n,o,a){let s;if(s=void 0===o?Object.keys(t):o.tags,!Array.isArray(s))return console.warn("Unexpected values of tags. Check tags or x-tagGroups in your definition."),[];const i=s.map((e=>t[e]?(t[e].used=!0,t[e]):(console.warn(`Non-existing tag "${e}" is added to the group "${null==o?void 0:o.name}"`),null))),r=[];for(const t of i){if(!t)continue;const o=getTagOrGroup("tag",t,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},n);if(o.depth=GROUP_DEPTH+1,""===t.name){const e=[...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(void 0,t,o.depth+1,a)];r.push(...e);continue}const s=getTagRelatedSchema({definition:e.definition,tag:t,parent:o,schemaDefinitionsTagName:a.schemaDefinitionsTagName,options:{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel}});o.items=[...s,...addMarkdownItems(getValueFromMdParsedExtension(t,"description")||"",o,o.depth+1,a.markdownHeadingsAnchorLevel,a.pagination),...getOperationsItems(o,t,o.depth+1,a)],r.push(o)}return a.sortTagsAlphabetically&&r.sort(alphabeticallyByProp("name")),r}export function getTagGroupsItems(e,t,n,o,a){const s=[];for(const i of n){const n=getTagOrGroup("group",i,{pagination:a.pagination,markdownHeadingsAnchorLevel:a.markdownHeadingsAnchorLevel},t);n.depth=GROUP_DEPTH,n.items=getTagsItems(e,o,n,i,a),s.push(n)}return s}function getTagRelatedSchema({definition:e,tag:t,parent:n,schemaDefinitionsTagName:o,options:a}){var s;const i=o?[o]:[];return Object.entries((null===(s=e.components)||void 0===s?void 0:s.schemas)||{}).map((([e,o])=>{if(!(o["x-tags"]||i).includes(t.name))return null;const s=getTagOrGroup("schema",{name:e,"x-displayName":`${o.title||e}`,description:`{% schemaDefinition showWriteOnly="true" schemaRef="#/components/schemas/${e}" /%}`,isSchema:!0,level:2},a,n);return s.depth=n.depth+1,s})).filter(Boolean)}export function getTagsWithOperations(e,t){const{definition:n}=e,o={},a=n["x-webhooks"]||n.webhooks;for(const e of t||[])o[e.name]=Object.assign(Object.assign({},e),{operations:[]});return n.paths&&getTags(e,n.paths,o),a&&getTags(e,a,o,!0),o}function getTags(e,t,n,o){for(const a of Object.keys(t||{})){const s=t[a],i=Object.keys(s).filter(isOperationName);for(const t of i){const i=s[t];if(s.$ref){const{resolved:t}=e.deref(s);getTags(e,{[a]:t},n,o);continue}let r=null==i?void 0:i.tags;r&&r.length||(r=[""]);for(const e of r){let r=n[e];void 0===r&&(r={name:e,operations:[]},n[e]=r),r["x-traitTag"]||r.operations.push(Object.assign(Object.assign({},i),{pathName:a,pointer:JsonPointer.compile(["paths",a,t]),httpVerb:t,pathParameters:s.parameters||[],pathServers:s.servers,isWebhook:!!o}))}}}}
2
2
  //# sourceMappingURL=tags.js.map
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(i,a){function s(e){try{c(r.next(e))}catch(e){a(e)}}function n(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,n)}c((r=r.apply(e,t||[])).next())}))};import{getRecoil}from"recoil-nexus";import{SearchStore}from"./SearchStore";import{DEFAULT_SEARCH_MAX_DEPTH}from"../../constants";import{globalStoreSelector}from"../../recoil/store";import{getActiveMediaType,getOperation}from"../../models";import{operationStore}from"../../recoil/operation";import{normalizeText}from"../../utils";function removeMarkdown(e){return normalizeText(e).replace(/\[(.*?)][[(].*?[\])]/g,"$1")}export class DeepSearchStore extends SearchStore{constructor(e){super(),Object.defineProperty(this,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(this,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(this,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_SEARCH_MAX_DEPTH}),e.searchOperationTitleBoost&&(this.operationTitleBoost=e.searchOperationTitleBoost),e.searchTagTitleBoost&&(this.tagTitleBoost=e.searchTagTitleBoost),e.searchFieldLevelBoost&&(this.fieldLevelBoost=e.searchFieldLevelBoost),"path-only"===e.searchMode&&(this.pathOnly=!0),e.searchMaxDepth&&(this.searchMaxDepth=e.searchMaxDepth)}indexItems(e){const t=e=>{e&&e.forEach((e=>{if("operation"===e.type&&this.pathOnly){const t=e;this.add(t.path,"",{menuId:t.id,boost:this.operationTitleBoost})}else{if("group"===e.type||this.pathOnly||(this.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?this.operationTitleBoost:this.tagTitleBoost}),e.description&&this.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){const t=e.operationDefinition,{parser:o,options:r}=getRecoil(globalStoreSelector),i=getOperation(o,t,void 0,r,e.href);for(const t of i.parameters||[])this.add(t.name,removeMarkdown(t.description),{menuId:e.id,place:"parameters",path:[t.name]});const a=i.requestBody&&i.requestBody.content&&getActiveMediaType(i.requestBody.content).schema;this.indexSchema(a,e.id,"request fields"),i.responses.forEach((t=>{const o=t.content&&getActiveMediaType(t.content).schema;o&&this.indexSchema(o,e.id,`response ${t.code} fields`)}))}t(e.items)}}))};t(e),this.searchWorker.done()}indexSchema(e,t,o,r=[],i=0){if(!e)return;if(i>this.searchMaxDepth||e.isCircular)return;const{activeOneOf:a}=getRecoil(operationStore(e.deps.operation.pointer));if((e=e.oneOf&&e.oneOf[a]||e).fields)for(const a of e.fields){const e=r.concat([a.name]);"additionalProperties"!==a.kind&&(this.add(a.name,removeMarkdown(a.description),{menuId:t,place:o,path:e,boost:Math.pow(this.fieldLevelBoost,i)}),this.indexSchema(a.schema,t,o,e,i+1))}e.items&&this.indexSchema(e.items,t,o,r,i+1)}add(e,t,o){this.searchWorker.add(e,t,o)}search(e){return __awaiter(this,void 0,void 0,(function*(){return yield this.searchWorker.search(e)}))}toJS(){return __awaiter(this,void 0,void 0,(function*(){return this.searchWorker.toJS()}))}dispose(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}
1
+ var __awaiter=this&&this.__awaiter||function(e,t,o,r){return new(o||(o=Promise))((function(i,a){function s(e){try{c(r.next(e))}catch(e){a(e)}}function n(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,n)}c((r=r.apply(e,t||[])).next())}))};import{getRecoil}from"recoil-nexus";import{SearchStore}from"./SearchStore";import{DEFAULT_SEARCH_MAX_DEPTH}from"../../constants";import{globalStoreSelector}from"../../recoil/store";import{getActiveMediaType}from"../../models/mediaContent";import{getOperation}from"../../models/operation";import{operationStore}from"../../recoil/operation";import{normalizeText}from"../../utils";function removeMarkdown(e){return normalizeText(e).replace(/\[(.*?)][[(].*?[\])]/g,"$1")}export class DeepSearchStore extends SearchStore{constructor(e){super(),Object.defineProperty(this,"operationTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:4}),Object.defineProperty(this,"tagTitleBoost",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"fieldLevelBoost",{enumerable:!0,configurable:!0,writable:!0,value:.95}),Object.defineProperty(this,"pathOnly",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"searchMaxDepth",{enumerable:!0,configurable:!0,writable:!0,value:DEFAULT_SEARCH_MAX_DEPTH}),e.searchOperationTitleBoost&&(this.operationTitleBoost=e.searchOperationTitleBoost),e.searchTagTitleBoost&&(this.tagTitleBoost=e.searchTagTitleBoost),e.searchFieldLevelBoost&&(this.fieldLevelBoost=e.searchFieldLevelBoost),"path-only"===e.searchMode&&(this.pathOnly=!0),e.searchMaxDepth&&(this.searchMaxDepth=e.searchMaxDepth)}indexItems(e){const t=e=>{e&&e.forEach((e=>{if("operation"===e.type&&this.pathOnly){const t=e;this.add(t.path,"",{menuId:t.id,boost:this.operationTitleBoost})}else{if("group"===e.type||this.pathOnly||(this.add(e.name,"operation"===e.type?e.path:"",{menuId:e.id,boost:"operation"===e.type?this.operationTitleBoost:this.tagTitleBoost}),e.description&&this.add("",removeMarkdown(e.description||""),{menuId:e.id})),"operation"===e.type){const t=e.operationDefinition,{parser:o,options:r}=getRecoil(globalStoreSelector),i=getOperation(o,t,void 0,r,e.href);for(const t of i.parameters||[])this.add(t.name,removeMarkdown(t.description),{menuId:e.id,place:"parameters",path:[t.name]});const a=i.requestBody&&i.requestBody.content&&getActiveMediaType(i.requestBody.content).schema;this.indexSchema(a,e.id,"request fields"),i.responses.forEach((t=>{const o=t.content&&getActiveMediaType(t.content).schema;o&&this.indexSchema(o,e.id,`response ${t.code} fields`)}))}t(e.items)}}))};t(e),this.searchWorker.done()}indexSchema(e,t,o,r=[],i=0){if(!e)return;if(i>this.searchMaxDepth||e.isCircular)return;const{activeOneOf:a}=getRecoil(operationStore(e.deps.operation.pointer));if((e=e.oneOf&&e.oneOf[a]||e).fields)for(const a of e.fields){const e=r.concat([a.name]);"additionalProperties"!==a.kind&&(this.add(a.name,removeMarkdown(a.description),{menuId:t,place:o,path:e,boost:Math.pow(this.fieldLevelBoost,i)}),this.indexSchema(a.schema,t,o,e,i+1))}e.items&&this.indexSchema(e.items,t,o,r,i+1)}add(e,t,o){this.searchWorker.add(e,t,o)}search(e){return __awaiter(this,void 0,void 0,(function*(){return yield this.searchWorker.search(e)}))}toJS(){return __awaiter(this,void 0,void 0,(function*(){return this.searchWorker.toJS()}))}dispose(){"terminate"in this.searchWorker&&this.searchWorker.terminate(),this.searchWorker.dispose&&this.searchWorker.dispose()}}
2
2
  //# sourceMappingURL=DeepSearchStore.js.map
@@ -1,4 +1,3 @@
1
- export declare function normalizePath(path: string): string;
2
1
  /**
3
2
  * Compare mime-types ignoring charset or other params (application/json;charset=UTF-8)
4
3
  * @param a
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}s((n=n.apply(e,t||[])).next())}))};import merge from"deepmerge";import{isMergeableObject,isObject}from"../utils";export function normalizePath(e){return e.startsWith("/")||(e="/"+e),e.endsWith("/")&&(e=e.slice(0,-1)),e}export function isSameMime(e,t){return!(!e||!t)&&normalizeMimeType(e)===normalizeMimeType(t)}export function normalizeMimeType(e){if(!e)return;const t=e.split(";")[0].toLowerCase(),[r,n]=t.split("/");if(void 0===n)return r;return`${r}/${n.split("+").pop()}`}export function unescapeServerVariables(e){const t=new RegExp("%7B","g"),r=new RegExp("%7D","g");return e.replace(t,"{").replace(r,"}").replace("///","//")}export function arrayMergeStrategy(e,t){if(!e.length||!hasObjectOrArray(e))return t;const r=e.filter((e=>Object.keys(e).length>0));return t.forEach((function(t,n){isMergeableObject(t)?r[n]=merge(e[n],t,{arrayMerge:arrayMergeStrategy}):Array.isArray(t)?r.push(t):r[n]=t})),r}const hasObjectOrArray=e=>e.some((e=>isObject(e)&&Object.keys(e).length>0));export function isEmptyObject(e){return!!e&&0===Object.keys(e).length}export const cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;export function randString(e=32){let t="";for(;t.length<e;)t+=Math.random().toString(32).substring(2);return t.substring(0,e)}export function encodeState(e){const t=Object.assign({randomStr:randString()},e);return btoa(JSON.stringify(t))}export function sha256(e){return __awaiter(this,void 0,void 0,(function*(){const t=(new TextEncoder).encode(e);return null==cryptoLib?void 0:cryptoLib.subtle.digest("SHA-256",t)}))}export function base64UrlEncode(e){if(e)return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export function deepClone(e){if("object"!=typeof e||null===e)return e;const t=Array.isArray(e)?[]:{};for(const r in e){const n=e[r];t[r]=deepClone(n)}return t}
1
+ var __awaiter=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}s((n=n.apply(e,r||[])).next())}))};import merge from"deepmerge";import{isMergeableObject,isObject}from"../utils/helpers";export function isSameMime(e,r){return!(!e||!r)&&normalizeMimeType(e)===normalizeMimeType(r)}export function normalizeMimeType(e){if(!e)return;const r=e.split(";")[0].toLowerCase(),[t,n]=r.split("/");if(void 0===n)return t;return`${t}/${n.split("+").pop()}`}export function unescapeServerVariables(e){const r=new RegExp("%7B","g"),t=new RegExp("%7D","g");return e.replace(r,"{").replace(t,"}").replace("///","//")}export function arrayMergeStrategy(e,r){if(!e.length||!hasObjectOrArray(e))return r;const t=e.filter((e=>Object.keys(e).length>0));return r.forEach((function(r,n){isMergeableObject(r)?t[n]=merge(e[n],r,{arrayMerge:arrayMergeStrategy}):Array.isArray(r)?t.push(r):t[n]=r})),t}const hasObjectOrArray=e=>e.some((e=>isObject(e)&&Object.keys(e).length>0));export function isEmptyObject(e){return!!e&&0===Object.keys(e).length}export const cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;export function randString(e=32){let r="";for(;r.length<e;)r+=Math.random().toString(32).substring(2);return r.substring(0,e)}export function encodeState(e){const r=Object.assign({randomStr:randString()},e);return btoa(JSON.stringify(r))}export function sha256(e){return __awaiter(this,void 0,void 0,(function*(){const r=(new TextEncoder).encode(e);return null==cryptoLib?void 0:cryptoLib.subtle.digest("SHA-256",r)}))}export function base64UrlEncode(e){if(e)return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}export function deepClone(e){if("object"!=typeof e||null===e)return e;const r=Array.isArray(e)?[]:{};for(const t in e){const n=e[t];r[t]=deepClone(n)}return r}
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,2 +1,2 @@
1
- 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 React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{setRecoil,getRecoil}from"recoil-nexus";import{querySelector,IS_BROWSER,getJsUrl}from"./utils";import{RedoclyOpenAPIDocs,RedoclyOpenAPIDocsStandalone,RedoclyOpenAPIDocsMultiStandalone}from"./components";import{appLocalStore,appSessionStore}from"./recoil/app";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){const t=getRecoil(appLocalStore);setRecoil(appLocalStore,Object.assign(Object.assign({},t),{layout:e}))}export function toggleRightPanel(e){const t=getRecoil(appSessionStore);setRecoil(appSessionStore,Object.assign(Object.assign({},t),{showRightPanelToggle:e}))}const url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){const t={},o=e.attributes;for(let e=0;e<o.length;e++){const r=o[e];t[r.name]=r.value}return t}function parseOptionsFromElement(e){const t=attributesMap(e),o={};for(const e in t){o[e.replace(/-(.)/g,((e,t)=>t.toUpperCase()))]=t[e]}return o}export function hydrate(e,t=document.querySelector("redoc")){hydrateComponent(React.createElement(RedoclyOpenAPIDocs,{store:e}),t)}export function init(e,t={},o=querySelector("redoc"),r){if(null===o)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');let n,i;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyOpenAPIDocsMultiStandalone,{definitions:e,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r):("string"==typeof e?n=e:"object"==typeof e&&(i=e),render(React.createElement(RedoclyOpenAPIDocsStandalone,{definition:i,definitionUrl:n,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r))}export function setPublicPath(e){__webpack_public_path__=e}export const version=__REDOCLY_API_REFERENCE_VERSION__;export const revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){const e=querySelector("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&init(t,{},e)}IS_BROWSER&&setPublicPath(__dirname),autoInit();
1
+ 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 React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{setRecoil,getRecoil}from"recoil-nexus";import{querySelector,IS_BROWSER,getJsUrl}from"./utils";import{RedoclyOpenAPIDocs,RedoclyOpenAPIDocsStandalone}from"./components";import{RedoclyOpenAPIDocsMultiStandalone}from"./components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsMultiStandalone";import{appLocalStore,appSessionStore}from"./recoil/app";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){const t=getRecoil(appLocalStore);setRecoil(appLocalStore,Object.assign(Object.assign({},t),{layout:e}))}export function toggleRightPanel(e){const t=getRecoil(appSessionStore);setRecoil(appSessionStore,Object.assign(Object.assign({},t),{showRightPanelToggle:e}))}const url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){const t={},o=e.attributes;for(let e=0;e<o.length;e++){const r=o[e];t[r.name]=r.value}return t}function parseOptionsFromElement(e){const t=attributesMap(e),o={};for(const e in t){o[e.replace(/-(.)/g,((e,t)=>t.toUpperCase()))]=t[e]}return o}export function hydrate(e,t=document.querySelector("redoc")){hydrateComponent(React.createElement(RedoclyOpenAPIDocs,{store:e}),t)}export function init(e,t={},o=querySelector("redoc"),r){if(null===o)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');let n,i;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyOpenAPIDocsMultiStandalone,{definitions:e,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r):("string"==typeof e?n=e:"object"==typeof e&&(i=e),render(React.createElement(RedoclyOpenAPIDocsStandalone,{definition:i,definitionUrl:n,options:Object.assign(Object.assign({},t),parseOptionsFromElement(o))},["Loading..."]),o,r))}export function setPublicPath(e){__webpack_public_path__=e}export const version=__REDOCLY_API_REFERENCE_VERSION__;export const revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){const e=querySelector("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&init(t,{},e)}IS_BROWSER&&setPublicPath(__dirname),autoInit();
2
2
  //# sourceMappingURL=standalone.js.map
@@ -2,7 +2,6 @@ export * from './JsonPointer';
2
2
  export * from './openapi';
3
3
  export * from './helpers';
4
4
  export * from './highlight';
5
- export * from './loadAndBundleSpec';
6
5
  export * from './dom';
7
6
  export * from './debug';
8
7
  export * from './sort';
@@ -1,2 +1,2 @@
1
- export*from"./JsonPointer";export*from"./openapi";export*from"./helpers";export*from"./highlight";export*from"./loadAndBundleSpec";export*from"./dom";export*from"./debug";export*from"./sort";export*from"./argValuesHelpers";export*from"./media-css";export*from"./theme-helpers";export*from"./debounce";export*from"./security-details";export*from"./session-storage";export*from"./local-storage";export*from"./parameters";export*from"./string";export*from"./test-utils";export*from"./typeGuards";export*from"./compose";export*from"./saveTextBeforeHeading";export*from"./path";
1
+ export*from"./JsonPointer";export*from"./openapi";export*from"./helpers";export*from"./highlight";export*from"./dom";export*from"./debug";export*from"./sort";export*from"./argValuesHelpers";export*from"./media-css";export*from"./theme-helpers";export*from"./debounce";export*from"./security-details";export*from"./session-storage";export*from"./local-storage";export*from"./parameters";export*from"./string";export*from"./test-utils";export*from"./typeGuards";export*from"./compose";export*from"./saveTextBeforeHeading";export*from"./path";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,3 @@
1
- import type { Document } from '@redocly/openapi-core';
2
1
  import type { OpenAPIDefinition } from '../types';
3
2
  export declare function loadAndBundleDefinition(specUrlOrObject: GenericObject | string): Promise<OpenAPIDefinition>;
4
- export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
5
3
  export declare function convertSwagger2OpenAPI(spec: GenericObject): Promise<OpenAPIDefinition>;
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,o,t){return new(o||(o=Promise))((function(r,i){function c(e){try{u(t.next(e))}catch(e){i(e)}}function a(e){try{u(t.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}u((t=t.apply(e,n||[])).next())}))};import{bundle}from"@redocly/openapi-core/lib/bundle";import{Config}from"@redocly/openapi-core/lib/config/config";import{convertObj}from"swagger2openapi";import{IS_BROWSER}from"./dom";export function loadAndBundleDefinition(e){return __awaiter(this,void 0,void 0,(function*(){const n=new Config({}),o={config:n,base:IS_BROWSER?window.location.href:process.cwd()};IS_BROWSER&&(n.resolve.http.customFetch=global.fetch),"object"==typeof e&&null!==e?o.doc=createParsedDocument(e):o.ref=e;const{bundle:{parsed:t}}=yield bundle(o);return void 0!==t.swagger?convertSwagger2OpenAPI(t):t}))}export function createParsedDocument(e){return{source:{absoluteRef:""},parsed:e}}export function convertSwagger2OpenAPI(e){return e.paths||(e.paths={}),new Promise(((n,o)=>convertObj(e,{patch:!0,warnOnly:!0,text:"{}",anchors:!0},((e,t)=>{if(e)return o(e);n(null==t?void 0:t.openapi)}))))}
1
+ var __awaiter=this&&this.__awaiter||function(e,n,o,t){return new(o||(o=Promise))((function(r,i){function c(e){try{p(t.next(e))}catch(e){i(e)}}function a(e){try{p(t.throw(e))}catch(e){i(e)}}function p(e){var n;e.done?r(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}p((t=t.apply(e,n||[])).next())}))};import{bundle}from"@redocly/openapi-core/lib/bundle";import{Config}from"@redocly/openapi-core/lib/config/config";import{convertObj}from"swagger2openapi";import{createParsedDocument}from"./openapi";import{IS_BROWSER}from"./dom";export function loadAndBundleDefinition(e){return __awaiter(this,void 0,void 0,(function*(){const n=new Config({}),o={config:n,base:IS_BROWSER?window.location.href:process.cwd()};IS_BROWSER&&(n.resolve.http.customFetch=global.fetch),"object"==typeof e&&null!==e?o.doc=createParsedDocument(e):o.ref=e;const{bundle:{parsed:t}}=yield bundle(o);return void 0!==t.swagger?convertSwagger2OpenAPI(t):t}))}export function convertSwagger2OpenAPI(e){return e.paths||(e.paths={}),new Promise(((n,o)=>convertObj(e,{patch:!0,warnOnly:!0,text:"{}",anchors:!0},((e,t)=>{if(e)return o(e);n(null==t?void 0:t.openapi)}))))}
2
2
  //# sourceMappingURL=loadAndBundleSpec.js.map
@@ -1,12 +1,14 @@
1
+ import type { Document } from '@redocly/openapi-core';
1
2
  import type { OpenAPIEncoding, OpenAPIMediaType, OpenAPIParameterStyle, OpenAPIRequestBody, OpenAPIResponse, OpenAPISchema, OpenAPIServer, Referenced } from '../types';
2
3
  import type { ExtendedOpenAPIOperation, OpenAPIParser } from '../services';
3
4
  import type { FieldModel, GroupModel } from '../models';
4
5
  import { OpenAPIParameter } from '../types';
6
+ import { Pagination } from '../services';
5
7
  export declare function isStatusCode(statusCode: string): boolean;
6
8
  export declare function getStatusCodeType(statusCode: string | number, defaultAsError?: boolean): string;
7
9
  export declare function isOperationName(key: string): boolean;
8
10
  export declare function getOperationName(operation: ExtendedOpenAPIOperation): string;
9
- export declare function getOperationId(operation: ExtendedOpenAPIOperation, parent?: GroupModel): string;
11
+ export declare function getOperationId(operation: ExtendedOpenAPIOperation, pagination: Pagination, parent?: GroupModel): string;
10
12
  export declare function detectType(schema: OpenAPISchema): string;
11
13
  export declare function isPrimitiveType(schema: OpenAPISchema, type?: string | string[] | undefined): boolean;
12
14
  export declare function isJsonLike(contentType: string): boolean;
@@ -41,3 +43,4 @@ export declare function pluralizeType(displayType: string): string;
41
43
  export declare function getContentWithLegacyExamples(info: OpenAPIRequestBody | OpenAPIResponse): {
42
44
  [mime: string]: OpenAPIMediaType;
43
45
  } | undefined;
46
+ export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
@@ -1,2 +1,2 @@
1
- import{dirname}from"path";import UrlTemplate from"url-template";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl,sanitizeItemId,normalizeText,getValueFromMdParsedExtension}from"./helpers";import{MediaTypes}from"../constants";import{JsonPointer}from"./JsonPointer";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r=!1){if("default"===e)return r?"error":"success";let t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}const operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationName(e){const{operationId:r,pathName:t}=e,i=normalizeText(getValueFromMdParsedExtension(e,"description"));return normalizeText(getValueFromMdParsedExtension(e,"summary"))||r||i&&i.substring(0,50)||t||"<no summary>"}export function getOperationId(e,r){return sanitizeItemId(void 0!==e.operationId?"operation/"+e.operationId:void 0!==r?r.id+e.pointer:e.pointer)}const schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;const r=Object.keys(schemaKeywordTypes);for(const t of r){const r=schemaKeywordTypes[t];if(void 0!==e[t])return r}return"any"}export function isPrimitiveType(e,r=e.type){if(e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;let t=!0;const i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((e=>e.toString())).join(t):"object"==typeof e?Object.keys(e).map((r=>`${r}${t}${e[r]}`)).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((t=>e[t]?`${r}[${t}]=${e[t]}`:void 0)).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){const i="__redoc_param_name__",n=r?"*":"";return UrlTemplate.parse(`{?${i}${n}}`).expand({[i]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){const t=e?"*":"",i="__redoc_param_name__",n=UrlTemplate.parse(`{${i}${t}}`);return decodeURIComponent(n.expand({[i]:r}))}export function urlFormEncodePayload(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((t=>{const i=e[t],{style:n="form",explode:o=!0}=r[t]||{};switch(n){case"form":return serializeFormValue(t,o,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+n),""}})).join("&")}function serializePathParameter(e,r,t,i){const n=t?"*":"";let o="";"label"===r?o=".":"matrix"===r&&(o=";");const a="__redoc_param_name__";return UrlTemplate.parse(`{${o}${a}${n}}`).expand({[a]:i}).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){const n=n=>{switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("%20")}`:(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("|")}`:(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((e=>n(e)))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}export function serializeParameterValue(e,r){const{name:t,style:i,explode:n=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return`${t}=${serializeParameterValueWithMime(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return serializePathParameter(t,i,n,r);case"query":return serializeQueryParameter(t,i,n,r);case"header":return serializeHeaderParameter(i,n,r);case"cookie":return serializeCookieParameter(t,i,n,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}const DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0===e)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function humanizeRangeConstraint(e,r,t){let i;return void 0!==r&&void 0!==t?i=r===t?`= ${r} ${e}`:`[ ${r} .. ${t} ] ${e}`:void 0!==t?i=`<= ${t} ${e}`:void 0!==r&&(i=1===r?"non-empty":`>= ${r} ${e}`),i}export function humanizeNumberRange(e){var r,t;const i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,o="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,a="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?`${o?"( ":"[ "}${i} .. ${n}${a?" )":" ]"}`:void 0!==n?`${a?"< ":"<= "}${n}`:void 0!==i?`${o?"> ":">= "}${i}`:void 0}export function humanizeConstraints(e){const r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);const i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);const n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);const o=humanizeMultipleOfConstraint(e.multipleOf);void 0!==o&&r.push(o);const a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r=[]){const t=[],i=[],n=[];return e.forEach((e=>{e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort(((e,t)=>r.indexOf(e.name)-r.indexOf(t.name))),[...i,...n,...t]}export function sortByField(e,r){return[...e].sort(((e,t)=>e[r].localeCompare(t[r])))}export function mergeParams(e,r=[],t=[],{pathPointer:i,operationPointer:n}){const o={};t.forEach((r=>{({resolved:r}=e.deref(r)),o[r.name+"_"+r.in]=!0}));return[...r.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(i,["parameters",String(r)])}))).filter((({paramOrRef:r})=>(({resolved:r}=e.deref(r)),!o[r.name+"_"+r.in]))),...t.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(n,["parameters",String(r)])})))]}export function mergeSimilarMediaTypes(e){const r={};return Object.keys(e).forEach((t=>{const i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=Object.assign(Object.assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r={}){return e.replace(/(?:{)([\w-.]+)(?:})/g,((e,t)=>r[t]&&r[t].default||e))}export function normalizeServers(e,r){const t=void 0===e?removeQueryStringAndHash((()=>{if(!IS_BROWSER)return"";const e=window.location.href;return e.endsWith(".html")?dirname(e):e})()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((e=>{return Object.assign(Object.assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export const shortenHTTPVerb=e=>({delete:"del",options:"opts"}[e]||e);export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0,"x-tokenEndpointAuthMethod":!0,"x-feedback":!0}||e.startsWith("x-parsed-md-")}export function extractExtensions(e,r){return Object.keys(e).filter((e=>!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1)).reduce(((r,t)=>(r[t]=e[t],r)),{})}export function pluralizeType(e){return e.split(" or ").map((e=>e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2"))).join(" or ")}export function getContentWithLegacyExamples(e){let r=e.content;const t=e["x-examples"],i=e["x-example"];if(t){r=Object.assign({},r);for(const e of Object.keys(t)){const i=t[e];r[e]=Object.assign(Object.assign({},r[e]),{examples:i})}}else if(i){r=Object.assign({},r);for(const e of Object.keys(i)){const t=i[e];r[e]=Object.assign(Object.assign({},r[e]),{example:t})}}return r}
1
+ import{dirname}from"path";import UrlTemplate from"url-template";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl,sanitizeItemId,normalizeText,getValueFromMdParsedExtension}from"./helpers";import{DEFAULT_TAG_SLUG,MediaTypes}from"../constants";import{JsonPointer}from"./JsonPointer";import{joinWithSeparator,Pagination}from"../services";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r=!1){if("default"===e)return r?"error":"success";let t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");let i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}const operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationName(e){const{operationId:r,pathName:t}=e,i=normalizeText(getValueFromMdParsedExtension(e,"description"));return normalizeText(getValueFromMdParsedExtension(e,"summary"))||r||i&&i.substring(0,50)||t||"<no summary>"}export function getOperationId(e,r,t){var i;return r===Pagination.None&&(null==t?void 0:t.id)?joinWithSeparator(t.id,sanitizeItemId(e.operationId?e.operationId:pointerToId(e.pointer))):(null===(i=e.tags)||void 0===i?void 0:i.length)?sanitizeItemId(e.operationId?e.operationId:pointerToId(e.pointer)):sanitizeItemId(e.operationId?joinWithSeparator(DEFAULT_TAG_SLUG,e.operationId):pointerToId(e.pointer))}function pointerToId(e){return(null==e?void 0:e.startsWith("/"))?e.slice(1,e.length):e}const schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;const r=Object.keys(schemaKeywordTypes);for(const t of r){const r=schemaKeywordTypes[t];if(void 0!==e[t])return r}return"any"}export function isPrimitiveType(e,r=e.type){if(e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;let t=!0;const i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((e=>e.toString())).join(t):"object"==typeof e?Object.keys(e).map((r=>`${r}${t}${e[r]}`)).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((t=>e[t]?`${r}[${t}]=${e[t]}`:void 0)).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){const i="__redoc_param_name__",n=r?"*":"";return UrlTemplate.parse(`{?${i}${n}}`).expand({[i]:t}).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){const t=e?"*":"",i="__redoc_param_name__",n=UrlTemplate.parse(`{${i}${t}}`);return decodeURIComponent(n.expand({[i]:r}))}export function urlFormEncodePayload(e,r={}){if(Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((t=>{const i=e[t],{style:n="form",explode:o=!0}=r[t]||{};switch(n){case"form":return serializeFormValue(t,o,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+n),""}})).join("&")}function serializePathParameter(e,r,t,i){const n=t?"*":"";let o="";"label"===r?o=".":"matrix"===r&&(o=";");const a="__redoc_param_name__";return UrlTemplate.parse(`{${o}${a}${n}}`).expand({[a]:i}).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){const n=n=>{switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("%20")}`:(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):`${e}=${n.join("|")}`:(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((e=>n(e)))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn(`Parameter serialization as ${r} is not supported`),"")}export function serializeParameterValue(e,r){const{name:t,style:i,explode:n=!1,serializationMime:o}=e;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return`${t}=${serializeParameterValueWithMime(r,o)}`;default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn(`Missing style attribute or content for parameter ${t}`),"";switch(e.in){case"path":return serializePathParameter(t,i,n,r);case"query":return serializeQueryParameter(t,i,n,r);case"header":return serializeHeaderParameter(i,n,r);case"cookie":return serializeCookieParameter(t,i,n,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}const DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0===e)return;const r=e.toString(10);return/^0\.0*1$/.test(r)?`decimal places <= ${r.split(".")[1].length}`:`multiple of ${r}`}function humanizeRangeConstraint(e,r,t){let i;return void 0!==r&&void 0!==t?i=r===t?`= ${r} ${e}`:`[ ${r} .. ${t} ] ${e}`:void 0!==t?i=`<= ${t} ${e}`:void 0!==r&&(i=1===r?"non-empty":`>= ${r} ${e}`),i}export function humanizeNumberRange(e){var r,t;const i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,o="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,a="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?`${o?"( ":"[ "}${i} .. ${n}${a?" )":" ]"}`:void 0!==n?`${a?"< ":"<= "}${n}`:void 0!==i?`${o?"> ":">= "}${i}`:void 0}export function humanizeConstraints(e){const r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);const i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);const n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);const o=humanizeMultipleOfConstraint(e.multipleOf);void 0!==o&&r.push(o);const a=humanizeNumberRange(e);return void 0!==a&&r.push(a),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r=[]){const t=[],i=[],n=[];return e.forEach((e=>{e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort(((e,t)=>r.indexOf(e.name)-r.indexOf(t.name))),[...i,...n,...t]}export function sortByField(e,r){return[...e].sort(((e,t)=>e[r].localeCompare(t[r])))}export function mergeParams(e,r=[],t=[],{pathPointer:i,operationPointer:n}){const o={};t.forEach((r=>{({resolved:r}=e.deref(r)),o[r.name+"_"+r.in]=!0}));return[...r.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(i,["parameters",String(r)])}))).filter((({paramOrRef:r})=>(({resolved:r}=e.deref(r)),!o[r.name+"_"+r.in]))),...t.map(((e,r)=>({paramOrRef:e,pointer:JsonPointer.join(n,["parameters",String(r)])})))]}export function mergeSimilarMediaTypes(e){const r={};return Object.keys(e).forEach((t=>{const i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=Object.assign(Object.assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r={}){return e.replace(/(?:{)([\w-.]+)(?:})/g,((e,t)=>r[t]&&r[t].default||e))}export function normalizeServers(e,r){const t=void 0===e?removeQueryStringAndHash((()=>{if(!IS_BROWSER)return"";const e=window.location.href;return e.endsWith(".html")?dirname(e):e})()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((e=>{return Object.assign(Object.assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export const shortenHTTPVerb=e=>({delete:"del",options:"opts"}[e]||e);export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0,"x-tokenEndpointAuthMethod":!0,"x-feedback":!0}||e.startsWith("x-parsed-md-")}export function extractExtensions(e,r){return Object.keys(e).filter((e=>!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1)).reduce(((r,t)=>(r[t]=e[t],r)),{})}export function pluralizeType(e){return e.split(" or ").map((e=>e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2"))).join(" or ")}export function getContentWithLegacyExamples(e){let r=e.content;const t=e["x-examples"],i=e["x-example"];if(t){r=Object.assign({},r);for(const e of Object.keys(t)){const i=t[e];r[e]=Object.assign(Object.assign({},r[e]),{examples:i})}}else if(i){r=Object.assign({},r);for(const e of Object.keys(i)){const t=i[e];r[e]=Object.assign(Object.assign({},r[e]),{example:t})}}return r}export function createParsedDocument(e){return{source:{absoluteRef:""},parsed:e}}
2
2
  //# sourceMappingURL=openapi.js.map
@@ -1,4 +1,5 @@
1
1
  import type { Location } from 'react-router-dom';
2
2
  export declare function pathIncludesLink(location: Location, link?: string): boolean;
3
3
  export declare function pathMatchedLink(location: Location, link?: string): boolean;
4
- export declare function normalizeHashPath(link: string): string;
4
+ export declare function normalizePath(path: string): string;
5
+ export declare function normalizeHashPath(path: string): string;
@@ -1,2 +1,2 @@
1
- export function pathIncludesLink(e,n){return!!n&&decodeURIComponent(e.pathname+e.hash).includes(n)}export function pathMatchedLink(e,n=""){return decodeURIComponent(e.pathname)===n||decodeURIComponent(e.hash)===n||decodeURIComponent(e.pathname+e.hash)===n}export function normalizeHashPath(e){return e.startsWith("#")?`/${e}`:e}
1
+ export function pathIncludesLink(t,e){return!!e&&decodeURIComponent(t.pathname+t.hash).includes(e)}export function pathMatchedLink(t,e=""){return decodeURIComponent(t.pathname)===e||decodeURIComponent(t.hash)===e||decodeURIComponent(t.pathname+t.hash)===e}export function normalizePath(t){return t.startsWith("/")||(t="/"+t),t.endsWith("/")&&(t=t.slice(0,-1)),t}export function normalizeHashPath(t){return t.startsWith("#")?normalizePath(t):t}
2
2
  //# sourceMappingURL=path.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.0.0-alpha.30",
3
+ "version": "3.0.0-alpha.31",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -14,6 +14,13 @@
14
14
  "bin": {
15
15
  "openapi-docs": "bin.js"
16
16
  },
17
+ "peerDependencies": {
18
+ "@redocly/theme": ">=0.9.4",
19
+ "core-js": "^3.1.4",
20
+ "react": "^16.8.4 || ^17.0.0",
21
+ "react-dom": "^16.8.4 || ^17.0.0",
22
+ "styled-components": "^4.1.1 || ^5.1.1"
23
+ },
17
24
  "dependencies": {
18
25
  "@markdoc/markdoc": "0.1.13",
19
26
  "@redocly/openapi-core": "^1.0.0-beta.123",
@@ -56,13 +63,6 @@
56
63
  "url-template": "^2.0.8",
57
64
  "yargs": "^17.3.0"
58
65
  },
59
- "peerDependencies": {
60
- "@redocly/theme": "^0.9.4",
61
- "core-js": "^3.1.4",
62
- "react": "^16.8.4 || ^17.0.0",
63
- "react-dom": "^16.8.4 || ^17.0.0",
64
- "styled-components": "^4.1.1 || ^5.1.1"
65
- },
66
66
  "devDependencies": {
67
67
  "react": "^17.0.2",
68
68
  "react-dom": "^17.0.2",
@@ -106,7 +106,6 @@
106
106
  "json-schema": "^0.4.0",
107
107
  "outdent": "^0.8.0",
108
108
  "react-hot-loader": "^4.12.18",
109
- "react-test-renderer": "^17.0.2",
110
109
  "string-replace-loader": "^3.1.0",
111
110
  "style-loader": "^1.0.1",
112
111
  "terser": "^5.6.1",
@@ -120,7 +119,7 @@
120
119
  "webpack-dev-server": "^4.9.3",
121
120
  "workerize-loader": "github:redocly/workerize-loader#webpack-5-dist",
122
121
  "js-yaml": "4.1.0",
123
- "@redocly/theme": "0.9.13"
122
+ "@redocly/theme": "0.9.14"
124
123
  },
125
124
  "nx": {
126
125
  "namedInputs": {