@redocly/redoc-reef 0.139.0-next.6 → 0.139.0-next.8

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 (67) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
  3. package/dist/constants/l10n/langs/ar.js +1 -1
  4. package/dist/constants/l10n/langs/de.js +1 -1
  5. package/dist/constants/l10n/langs/en.js +1 -1
  6. package/dist/constants/l10n/langs/es.js +1 -1
  7. package/dist/constants/l10n/langs/fr.js +1 -1
  8. package/dist/constants/l10n/langs/hi.js +1 -1
  9. package/dist/constants/l10n/langs/it.js +1 -1
  10. package/dist/constants/l10n/langs/ja.js +1 -1
  11. package/dist/constants/l10n/langs/ko.js +1 -1
  12. package/dist/constants/l10n/langs/pl.js +1 -1
  13. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  14. package/dist/constants/l10n/langs/pt.js +1 -1
  15. package/dist/constants/l10n/langs/ru.js +1 -1
  16. package/dist/constants/l10n/langs/uk.js +1 -1
  17. package/dist/constants/l10n/langs/zh.js +1 -1
  18. package/dist/markdoc/helpers/get-inner-text.d.ts +2 -0
  19. package/dist/markdoc/helpers/get-inner-text.js +2 -2
  20. package/dist/markdoc/helpers/remove-markdoc-tags.js +1 -1
  21. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +67 -67
  22. package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
  23. package/dist/server/plugins/arazzo-docs/index.js +1 -1
  24. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  25. package/dist/server/plugins/dev-onboarding/api/routes/index.js +1 -1
  26. package/dist/server/plugins/dev-onboarding/template/App.js +4 -4
  27. package/dist/server/plugins/dev-onboarding/template/AppsList.js +7 -7
  28. package/dist/server/plugins/dev-onboarding/template/CreateAppDialog.js +3 -3
  29. package/dist/server/plugins/dev-onboarding/template/components/ApiKeyItem.js +4 -4
  30. package/dist/server/plugins/dev-onboarding/template/components/ApiLogDetails.js +7 -7
  31. package/dist/server/plugins/dev-onboarding/template/components/ApiLogs.js +5 -5
  32. package/dist/server/plugins/dev-onboarding/template/components/ApiLogsActions.js +6 -6
  33. package/dist/server/plugins/dev-onboarding/template/components/ApisList.js +1 -1
  34. package/dist/server/plugins/dev-onboarding/template/components/CreateApiKey.js +1 -1
  35. package/dist/server/plugins/dev-onboarding/template/components/DeleteAppDialog.js +1 -1
  36. package/dist/server/plugins/dev-onboarding/template/components/EditApis.js +1 -1
  37. package/dist/server/plugins/dev-onboarding/template/components/EditAppDescriptionDialog.js +1 -1
  38. package/dist/server/plugins/dev-onboarding/template/components/EditAppDialog.js +1 -1
  39. package/dist/server/plugins/dev-onboarding/template/components/EditCallbackUrlDialog.js +1 -1
  40. package/dist/server/plugins/dev-onboarding/template/components/RevokeAPIKey.js +5 -5
  41. package/dist/server/plugins/dev-onboarding/template/components/RollAPIKey.js +5 -5
  42. package/dist/server/plugins/dev-onboarding/template/components/UpdateApiKey.js +1 -1
  43. package/dist/server/plugins/markdown/index.js +1 -1
  44. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  45. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  46. package/dist/server/plugins/mcp/codemode/prompts.d.ts +0 -1
  47. package/dist/server/plugins/mcp/codemode/prompts.js +3 -3
  48. package/dist/server/plugins/mcp/constants.d.ts +0 -2
  49. package/dist/server/plugins/mcp/constants.js +1 -1
  50. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/endpoint-suggestions.d.ts +0 -2
  51. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/endpoint-suggestions.js +1 -1
  52. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +1 -12
  53. package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
  54. package/dist/server/plugins/mcp/handlers/errors.d.ts +0 -2
  55. package/dist/server/plugins/mcp/handlers/errors.js +1 -1
  56. package/dist/server/plugins/mcp/utils.d.ts +0 -8
  57. package/dist/server/plugins/mcp/utils.js +1 -1
  58. package/dist/server/plugins/pages/index.js +1 -1
  59. package/dist/server/plugins/register-page-props.d.ts +1 -1
  60. package/dist/server/plugins/register-page-props.js +1 -1
  61. package/dist/server/plugins/sidebars/index.js +1 -1
  62. package/dist/server/plugins/sidebars/utils.js +1 -1
  63. package/dist/utils/url/api-keys-url.d.ts +11 -0
  64. package/dist/utils/url/api-keys-url.js +1 -0
  65. package/package.json +6 -6
  66. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.d.ts +0 -3
  67. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +0 -11
@@ -1,2 +1,2 @@
1
- import{isPrimitive as n}from"../../utils/guards/is-primitive.js";import{getNodeAttribute as o}from"./get-node-attribute.js";import{getVariable as p}from"./get-variable.js";import{isNode as l}from"./guards/is-node.js";import{isTag as a}from"./guards/is-tag.js";import{isCodeNode as u}from"./guards/is-code-node.js";import{isConditionalNode as c}from"./guards/is-conditional-node.js";import{isExampleNode as d}from"./guards/is-example-node.js";import{isFenceNode as h}from"./guards/is-fence-node.js";import{isTextNode as N}from"./guards/is-text-node.js";import{isFunction as b}from"./guards/is-function.js";import{isVariable as g}from"./guards/is-variable.js";import{isPromptNode as x}from"./guards/is-prompt-node.js";function t(m,r={}){const{isTrim:s=!0}=r,e=[];for(const i of m){if(n(i))e.push(String(i));else if(l(i)){if(x(i))continue;if(i.type==="tr"&&e.push(`
2
- `),N(i)||u(i)||h(i))e.push(t([o(i,"content")],r));else if(d(i))e.push(t(i.children.map(f=>o(f,"content")),r));else{if(c(i)&&r.skipConditionals)continue;e.push(t(i.children,r))}}else a(i)?e.push(t(i.children,r)):b(i)&&e.push(t(Object.values(i.parameters),r));g(i)&&e.push(t([p(i,r.variables)],r))}return s?e.map(i=>i.trim()).join(" ").trim():e.join(" ")}export{t as getInnerText};
1
+ import{isPrimitive as n}from"../../utils/guards/is-primitive.js";import{getNodeAttribute as o}from"./get-node-attribute.js";import{getVariable as l}from"./get-variable.js";import{isNode as p}from"./guards/is-node.js";import{isTag as a}from"./guards/is-tag.js";import{isCodeNode as d}from"./guards/is-code-node.js";import{isConditionalNode as c}from"./guards/is-conditional-node.js";import{isExampleNode as u}from"./guards/is-example-node.js";import{isFenceNode as h}from"./guards/is-fence-node.js";import{isTextNode as g}from"./guards/is-text-node.js";import{isFunction as N}from"./guards/is-function.js";import{isVariable as T}from"./guards/is-variable.js";import{isPromptNode as b}from"./guards/is-prompt-node.js";function t(f,r={}){const{isTrim:s=!0}=r,i=[];for(const e of f){if(n(e))i.push(String(e));else if(p(e)){if(b(e))continue;if(e.type==="tr"&&i.push(`
2
+ `),g(e)||d(e)||h(e))i.push(t([o(e,"content")],r));else if(u(e))i.push(t(e.children.map(m=>o(m,"content")),r));else{if(c(e)&&r.skipConditionals)continue;if(e.type==="tag"&&r.renderTag){const m=()=>t(e.children,r);i.push(r.renderTag(e,{getBody:m})??m())}else i.push(t(e.children,r))}}else a(e)?i.push(t(e.children,r)):N(e)&&i.push(t(Object.values(e.parameters),r));T(e)&&i.push(t([l(e,r.variables)],r))}return s?i.map(e=>e.trim()).join(" ").trim():i.join(" ")}export{t as getInnerText};
@@ -1 +1 @@
1
- import e from"@markdoc/markdoc";import{getInnerText as n}from"./get-inner-text.js";function a(r){if(!r)return r;const o=e.parse(r);return n([o])}export{a as removeMarkdocTags};
1
+ import n from"@markdoc/markdoc";import{skipAgentsOnlyContent as e}from"@redocly/theme/markdoc/tags/visibility";import{getInnerText as t}from"./get-inner-text.js";function a(r){if(!r)return r;const o=n.parse(r);return t([o],{renderTag:e})}export{a as removeMarkdocTags};
@@ -1,105 +1,105 @@
1
- import T from"node:path";import{REDOCLY_TEAMS_RBAC as C}from"@redocly/config";import{nodeTypes as m,contentType as g,isGraphqlFieldsNode as ln,resolveGraphqlItemFields as fn}from"@redocly/api-docs";import{normalizeApiVersion as an}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as pn,canDownloadApiDefinition as un,extractTeamsFromScopeItems as dn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as H}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as hn}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as mn}from"../../../constants/rbac.js";import{toMarkdown as N}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as $n}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as yn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as gn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as bn}from"../../search/utils.js";import{extractDocumentSearchFacets as In}from"./search-facets.js";import{createApiDocsSearchIndexer as Pn,createLlmDescriptionFormatter as Sn}from"./create-indexer.js";function P(t,r){return r==="openapi"&&"openapi"in t}function K(t,r){return r==="asyncapi"&&"asyncapi"in t}function Xn({items:t,metadata:r,store:l,document:o,specType:n,excludeFromSearch:e,basePath:i,getSearchFacets:c,markdocTags:f}){return async(s,d,p,u)=>{if(e)return;const h={...u.markdocOptions?.tags,...f},{locale:$,translate:nn}=await gn(s.slug,u.getGlobalData?.().l10n),S=$n(h,$,nn),L=u.getConfig(),R=yn(s.fsPath),D=Sn(S),j=Pn(i,D,l?.schemaStore,o,l?.exampleStore,l?.graphqlMeta),V=b=>{for(const a of b)j.addItem(a),a.items?.length&&V(a.items)};V(t);const tn=j.getResult(),F=new Map;for(const b of tn)F.set(b.url,b);const E=typeof r.title=="string"?r.title:void 0,_=an(r.version),k=In(s.metadata||{},E,_,c),A=[],O=[],q=typeof r.description=="string"&&r.description?D(r.description):void 0,G=An(r,q,o,n,D),z=On(n,r,s.fsPath,L),en=xn(t,L,S),on=G+z+`
2
- `+en,sn=G+z;O.push({title:E||"API Overview",description:q,content:on,slug:i,fsPath:s.fsPath,includeInLLMsTxt:!0}),A.push({title:E||"API Overview",content:sn,url:i,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k});const rn=o&&P(o,n)?o.security:void 0,U=b=>{for(const a of b){if(!a.content||!a.link){a.items?.length&&U(a.items);continue}const cn=F.get(a.link),W=a.content.contentType,B=a[C],J=B?dn(B):void 0,Q=J?.length?J:void 0;if(W===g.ITEM){const y=Ln(a,o,n)??X(a,cn,n,_,rn,S,l);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y,slug:a.link,fsPath:s.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y,url:a.link,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k,rbacTeams:Q})}}else if(W===g.GROUP){const y=Rn(a,L,n,S,l);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y.llmstxt,slug:a.link,fsPath:s.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y.aiSearch,url:a.link,fsPath:s.fsPath,locale:R,product:s.product?.name,facets:k,rbacTeams:Q})}}a.items?.length&&U(a.items)}};return U(t),{async getLLMsTxts(){return O},async getSearchDocuments(){return A}}}}function An(t,r,l,o,n){const e=typeof t.title=="string"?t.title:"",i=typeof t.summary=="string"?t.summary:"",c=typeof t.version=="string"?t.version:"";let f=e?`# ${e}
1
+ import C from"node:path";import{REDOCLY_TEAMS_RBAC as x}from"@redocly/config";import{nodeTypes as m,contentType as g,isGraphqlFieldsNode as ln,resolveGraphqlItemFields as fn}from"@redocly/api-docs";import{normalizeApiVersion as an}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as pn,canDownloadApiDefinition as un,extractTeamsFromScopeItems as dn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as H}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Y}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as hn}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as mn}from"../../../constants/rbac.js";import{toMarkdown as N}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as $n}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as yn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as gn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as bn}from"../../search/utils.js";import{extractDocumentSearchFacets as In}from"./search-facets.js";import{createApiDocsSearchIndexer as Pn,createLlmDescriptionFormatter as Sn}from"./create-indexer.js";function P(e,s){return s==="openapi"&&"openapi"in e}function K(e,s){return s==="asyncapi"&&"asyncapi"in e}function Xn({items:e,metadata:s,store:c,document:r,specType:n,excludeFromSearch:l,basePath:t,getSearchFacets:i,markdocTags:f}){return async(o,d,p,u)=>{if(l)return;const h={...u.markdocOptions?.tags,...f},{locale:$,translate:nn}=await gn(o.slug,u.getGlobalData?.().l10n),S=$n(h,$,nn),L=u.getConfig(),R=yn(o.fsPath),D=Sn(S),j=Pn(t,D,c?.schemaStore,r,c?.exampleStore,c?.graphqlMeta),V=b=>{for(const a of b)j.addItem(a),a.items?.length&&V(a.items)};V(e);const tn=j.getResult(),F=new Map;for(const b of tn)F.set(b.url,b);const E=typeof s.title=="string"?s.title:void 0,_=an(s.version),k=In(o.metadata||{},E,_,i),A=[],O=[],q=typeof s.description=="string"&&s.description?D(s.description):void 0,G=An(s,q,r,n,D),z=On(n,s,o.fsPath,L),en=Tn(e,L,S),on=G+z+`
2
+ `+en,sn=G+z;O.push({title:E||"API Overview",description:q,content:on,slug:t,fsPath:o.fsPath,includeInLLMsTxt:!0}),A.push({title:E||"API Overview",content:sn,url:t,fsPath:o.fsPath,locale:R,product:o.product?.name,facets:k});const rn=r&&P(r,n)?r.security:void 0,U=b=>{for(const a of b){if(!a.content||!a.link){a.items?.length&&U(a.items);continue}const cn=F.get(a.link),W=a.content.contentType,B=a[x],J=B?dn(B):void 0,Q=J?.length?J:void 0;if(W===g.ITEM){const y=Ln(a,r,n)??X(a,cn,n,_,rn,S,c);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y,slug:a.link,fsPath:o.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y,url:a.link,fsPath:o.fsPath,locale:R,product:o.product?.name,facets:k,rbacTeams:Q})}}else if(W===g.GROUP){const y=Rn(a,L,n,S,c);if(y){const I=a.label||"";O.push({title:I,description:void 0,content:y.llmstxt,slug:a.link,fsPath:o.fsPath,includeInLLMsTxt:!1}),A.push({title:I,content:y.aiSearch,url:a.link,fsPath:o.fsPath,locale:R,product:o.product?.name,facets:k,rbacTeams:Q})}}a.items?.length&&U(a.items)}};return U(e),{async getLLMsTxts(){return O},async getSearchDocuments(){return A}}}}function An(e,s,c,r,n){const l=typeof e.title=="string"?e.title:"",t=typeof e.summary=="string"?e.summary:"",i=typeof e.version=="string"?e.version:"";let f=l?`# ${l}
3
3
 
4
- `:"";if(f+=r?`${r}
4
+ `:"";if(f+=s?`${s}
5
5
 
6
- `:"",f+=i?`${i}
6
+ `:"",f+=t?`${t}
7
7
 
8
- `:"",f+=c?`Version: ${c}
9
- `:"",l){if(P(l,o)){const{info:s}=l;s?.license?.name&&(f+=`License: ${s.license.name}
10
- `);const d=s["x-metadata"],p=bn(d);p&&(f+=`
8
+ `:"",f+=i?`Version: ${i}
9
+ `:"",c){if(P(c,r)){const{info:o}=c;o?.license?.name&&(f+=`License: ${o.license.name}
10
+ `);const d=o["x-metadata"],p=bn(d);p&&(f+=`
11
11
  Metadata:
12
12
  ${p}
13
- `)}else if(K(l,o)){const{info:s}=l;s?.license?.name&&(f+=`License: ${s.license.name}
13
+ `)}else if(K(c,r)){const{info:o}=c;o?.license?.name&&(f+=`License: ${o.license.name}
14
14
  `)}}return f+=`
15
- `,f+=Tn(l,o,n),f+=Cn(l,o,n),f}function On(t,r,l,o){if(!l)return"";let n,e,i;if(t==="openapi")n=T.posix.join(Y,v(l,".yaml")),e="## Download OpenAPI description",i="OpenAPI definition";else if(t==="asyncapi")n=T.posix.join(Y,v(l,".yaml")),e="## Download AsyncAPI description",i="AsyncAPI definition";else if(t==="graphql"){const s=T.posix.extname(l)||".graphql";n=T.posix.join(hn,v(l,s)),e="## Download GraphQL schema",i="GraphQL schema"}else return"";if(!un(n,o.access?.rbac??{},o.access?.requiresLogin??!1,mn))return"";const f=typeof r.title=="string"&&r.title||i;return`${e}
15
+ `,f+=Cn(c,r,n),f+=xn(c,r,n),f}function On(e,s,c,r){if(!c)return"";let n,l,t;if(e==="openapi")n=C.posix.join(Y,v(c,".yaml")),l="## Download OpenAPI description",t="OpenAPI definition";else if(e==="asyncapi")n=C.posix.join(Y,v(c,".yaml")),l="## Download AsyncAPI description",t="AsyncAPI definition";else if(e==="graphql"){const o=C.posix.extname(c)||".graphql";n=C.posix.join(hn,v(c,o)),l="## Download GraphQL schema",t="GraphQL schema"}else return"";if(!un(n,r.access?.rbac??{},r.access?.requiresLogin??!1,mn))return"";const f=typeof s.title=="string"&&s.title||t;return`${l}
16
16
 
17
- - ${w({title:f,description:void 0,slug:n,siteUrl:o.seo?.siteUrl})}`}function Tn(t,r,l){if(!t)return"";if(P(t,r)){const{servers:o}=t;if(!o?.length)return"";let n=`## Servers
17
+ - ${w({title:f,description:void 0,slug:n,siteUrl:r.seo?.siteUrl})}`}function Cn(e,s,c){if(!e)return"";if(P(e,s)){const{servers:r}=e;if(!r?.length)return"";let n=`## Servers
18
18
 
19
- `;for(const e of o)if(e.description&&(n+=`${l(e.description)}
19
+ `;for(const l of r)if(l.description&&(n+=`${c(l.description)}
20
20
  `),n+=`\`\`\`
21
- ${e.url}
21
+ ${l.url}
22
22
  \`\`\`
23
23
 
24
- `,e.variables){n+=`Variables:
25
- `;for(const[i,c]of Object.entries(e.variables))n+=`- \`${i}\`${c.description?`: ${l(c.description).replace(/\s+/g," ")}`:""}
26
- `,c.default&&(n+=` Default: ${JSON.stringify(c.default)}
27
- `),c.enum&&(n+=` Enum: ${c.enum.map(f=>JSON.stringify(f)).join(", ")}
24
+ `,l.variables){n+=`Variables:
25
+ `;for(const[t,i]of Object.entries(l.variables))n+=`- \`${t}\`${i.description?`: ${c(i.description).replace(/\s+/g," ")}`:""}
26
+ `,i.default&&(n+=` Default: ${JSON.stringify(i.default)}
27
+ `),i.enum&&(n+=` Enum: ${i.enum.map(f=>JSON.stringify(f)).join(", ")}
28
28
  `);n+=`
29
- `}return n}if(K(t,r)){const{servers:o}=t;if(!o||!Object.keys(o).length)return"";let n=`## Servers
29
+ `}return n}if(K(e,s)){const{servers:r}=e;if(!r||!Object.keys(r).length)return"";let n=`## Servers
30
30
 
31
- `;for(const[e,i]of Object.entries(o))n+=`### ${e}
31
+ `;for(const[l,t]of Object.entries(r))n+=`### ${l}
32
32
 
33
- `,i.description&&(n+=`${l(i.description)}
34
- `),i.host&&(n+=`Host: ${i.host}
35
- `),i.protocol&&(n+=`Protocol: ${i.protocol}
36
- `),i.protocolVersion&&(n+=`Protocol Version: ${i.protocolVersion}
37
- `),i.pathname&&(n+=`Pathname: ${i.pathname}
33
+ `,t.description&&(n+=`${c(t.description)}
34
+ `),t.host&&(n+=`Host: ${t.host}
35
+ `),t.protocol&&(n+=`Protocol: ${t.protocol}
36
+ `),t.protocolVersion&&(n+=`Protocol Version: ${t.protocolVersion}
37
+ `),t.pathname&&(n+=`Pathname: ${t.pathname}
38
38
  `),n+=`
39
- `;return n}return""}function Cn(t,r,l){if(!t||!P(t,r))return"";const o=t.components?.securitySchemes;if(!o)return"";let n=`## Security
40
-
41
- `;for(const[e,i]of Object.entries(o)){if(!i||"$ref"in i)continue;const c=i;n+=`### ${e}
42
-
43
- `,c.description&&(n+=`${l(c.description)}
44
-
45
- `),c.type&&(n+=`Type: ${c.type}
46
- `),c.in&&(n+=`In: ${c.in}
47
- `),c.name&&(n+=`Name: ${c.name}
48
- `),c.scheme&&(n+=`Scheme: ${c.scheme}
49
- `),c.bearerFormat&&(n+=`Bearer Format: ${c.bearerFormat}
50
- `),c.openIdConnectUrl&&(n+=`OpenID Connect URL: ${c.openIdConnectUrl}
51
- `);const f=c.flows,s=f?.implicit||f?.password||f?.clientCredentials||f?.authorizationCode;if(s&&("authorizationUrl"in s&&s.authorizationUrl&&(n+=`Authorization URL: ${s.authorizationUrl}
52
- `),"tokenUrl"in s&&s.tokenUrl&&(n+=`Token URL: ${s.tokenUrl}
53
- `),s.scopes)){n+=`Scopes:
54
- `;for(const[d,p]of Object.entries(s.scopes))n+=`- \`${d}\`: ${p}
39
+ `;return n}return""}function xn(e,s,c){if(!e||!P(e,s))return"";const r=e.components?.securitySchemes;if(!r)return"";let n=`## Security
40
+
41
+ `;for(const[l,t]of Object.entries(r)){if(!t||"$ref"in t)continue;const i=t;n+=`### ${l}
42
+
43
+ `,i.description&&(n+=`${c(i.description)}
44
+
45
+ `),i.type&&(n+=`Type: ${i.type}
46
+ `),i.in&&(n+=`In: ${i.in}
47
+ `),i.name&&(n+=`Name: ${i.name}
48
+ `),i.scheme&&(n+=`Scheme: ${i.scheme}
49
+ `),i.bearerFormat&&(n+=`Bearer Format: ${i.bearerFormat}
50
+ `),i.openIdConnectUrl&&(n+=`OpenID Connect URL: ${i.openIdConnectUrl}
51
+ `);const f=i.flows,o=f?.implicit||f?.password||f?.clientCredentials||f?.authorizationCode;if(o&&("authorizationUrl"in o&&o.authorizationUrl&&(n+=`Authorization URL: ${o.authorizationUrl}
52
+ `),"tokenUrl"in o&&o.tokenUrl&&(n+=`Token URL: ${o.tokenUrl}
53
+ `),o.scopes)){n+=`Scopes:
54
+ `;for(const[d,p]of Object.entries(o.scopes))n+=`- \`${d}\`: ${p}
55
55
  `}n+=`
56
- `}return n}function xn(t,r,l){let o="";const n=(e,i)=>{for(const c of e)if(c.link){if(c.content?.contentType===g.GROUP)o+=`${i} ${c.label||""}
56
+ `}return n}function Tn(e,s,c){let r="";const n=(l,t)=>{for(const i of l)if(i.link){if(i.content?.contentType===g.GROUP)r+=`${t} ${i.label||""}
57
57
 
58
- `,c.items?.length&&n(c.items,i+"#");else if(c.content?.contentType===g.ITEM){if(!M(c,r))continue;const f=c,s=f.httpVerb,d=f.httpPath,p=s&&d?`${s.toUpperCase()} ${d}`:c.label||"",u=c.content?x(c.content.children,l):void 0;o+=` - ${w({title:p,description:u?u.slice(0,200):void 0,slug:H(c.link),siteUrl:r.seo?.siteUrl})}`}}};return n(t,"##"),o}function X(t,r,l,o,n,e,i){if(!t.content)return;const c=t,f=t.label||"",s=x(t.content.children,e),d=t.content.meta?.deprecated;let p=`# ${f}${d?" (deprecated)":""}
58
+ `,i.items?.length&&n(i.items,t+"#");else if(i.content?.contentType===g.ITEM){if(!M(i,s))continue;const f=i,o=f.httpVerb,d=f.httpPath,p=o&&d?`${o.toUpperCase()} ${d}`:i.label||"",u=i.content?T(i.content.children,c):void 0;r+=` - ${w({title:p,description:u?u.slice(0,200):void 0,slug:H(i.link),siteUrl:s.seo?.siteUrl})}`}}};return n(e,"##"),r}function X(e,s,c,r,n,l,t){if(!e.content)return;const i=e,f=e.label||"",o=T(e.content.children,l),d=e.content.meta?.deprecated;let p=`# ${f}${d?" (deprecated)":""}
59
59
 
60
- `;if(s&&(p+=`${s}
60
+ `;if(o&&(p+=`${o}
61
61
 
62
- `),l==="openapi"||l==="asyncapi"){const u=c.httpVerb,h=c.httpPath;u&&h?p+=`Endpoint: ${u.toUpperCase()} ${h}
62
+ `),c==="openapi"||c==="asyncapi"){const u=i.httpVerb,h=i.httpPath;u&&h?p+=`Endpoint: ${u.toUpperCase()} ${h}
63
63
  `:u&&(p+=`Method: ${u.toUpperCase()}
64
- `),o&&(p+=`Version: ${o}
65
- `);const $=Dn(t.content.children,n);$&&(p+=`Security: ${$}
66
- `)}return r?.parameters?.length&&l!=="graphql"&&(p+=`
67
- `+En(r.parameters)+`
68
- `),l==="graphql"&&(p+=kn(t.content.children,i)),p}function Ln(t,r,l){if(t.httpVerb!=="tool"||!r||!P(r,l))return;const o=t.content?.meta?.name,n=o?r["x-mcp"]?.tools?.find(i=>i.name===o):void 0;if(!n)return;let e=`# ${t.label||n.name}
64
+ `),r&&(p+=`Version: ${r}
65
+ `);const $=Dn(e.content.children,n);$&&(p+=`Security: ${$}
66
+ `)}return s?.parameters?.length&&c!=="graphql"&&(p+=`
67
+ `+En(s.parameters)+`
68
+ `),c==="graphql"&&(p+=kn(e.content.children,t,l)),p}function Ln(e,s,c){if(e.httpVerb!=="tool"||!s||!P(s,c))return;const r=e.content?.meta?.name,n=r?s["x-mcp"]?.tools?.find(t=>t.name===r):void 0;if(!n)return;let l=`# ${e.label||n.name}
69
69
 
70
- `;return typeof n.description=="string"&&n.description&&(e+=`${n.description}
70
+ `;return typeof n.description=="string"&&n.description&&(l+=`${n.description}
71
71
 
72
- `),e+=`## Input schema:
72
+ `),l+=`## Input schema:
73
73
 
74
- `,e+=`\`\`\`json
74
+ `,l+=`\`\`\`json
75
75
  ${JSON.stringify(n.inputSchema,null,2)}
76
76
  \`\`\`
77
77
 
78
- `,n.outputSchema&&(e+=`## Output schema:
78
+ `,n.outputSchema&&(l+=`## Output schema:
79
79
 
80
- `,e+=`\`\`\`json
80
+ `,l+=`\`\`\`json
81
81
  ${JSON.stringify(n.outputSchema,null,2)}
82
82
  \`\`\`
83
83
 
84
- `),e}function Rn(t,r,l,o,n){if(!t.content)return;const e=t.label||"",i=x(t.content.children,o);let c=`# ${e}
84
+ `),l}function Rn(e,s,c,r,n){if(!e.content)return;const l=e.label||"",t=T(e.content.children,r);let i=`# ${l}
85
85
 
86
- `;if(i&&(c+=`${i}
86
+ `;if(t&&(i+=`${t}
87
87
 
88
- `),l==="graphql"){let s="";const d=p=>{for(const u of p??[])if(!(!u.content||!M(u,r)))if(u.content.contentType===g.ITEM){const h=X(u,void 0,l,void 0,void 0,o,n);h&&(s+=`${h}
88
+ `),c==="graphql"){let o="";const d=p=>{for(const u of p??[])if(!(!u.content||!M(u,s)))if(u.content.contentType===g.ITEM){const h=X(u,void 0,c,void 0,void 0,r,n);h&&(o+=`${h}
89
89
 
90
90
  ---
91
91
 
92
- `)}else u.content.contentType===g.GROUP&&d(u.items)};return d(t.items),{llmstxt:c+s,aiSearch:c}}let f="";if(t.items?.length)for(const s of t.items){if(!s.link||!s.content||s.content.contentType!==g.ITEM||!M(s,r))continue;const d=s,p=d.httpVerb,u=d.httpPath,h=p&&u?`${p.toUpperCase()} ${u}`:s.label||"",$=s.content?x(s.content.children,o):void 0;f+=` - ${w({title:h,description:$?$.slice(0,200):void 0,slug:H(s.link),siteUrl:r.seo?.siteUrl})}`}return{llmstxt:c+f,aiSearch:c}}function Dn(t,r){const l=[],o=n=>{for(const e of n)if(e.nodeType===m.SECURITY){const i=e;for(const c of i.requirements)for(const f of c.schemes)f[C]||f.name&&!l.includes(f.name)&&l.push(f.name)}else(e.nodeType===m.CONTAINER||e.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(e.children)};if(o(t),l.length)return l.join(", ");if(r?.length){const n=r.flatMap(e=>Object.keys(e));if(n.length)return[...new Set(n)].join(", ")}}function En(t){const r={};for(const o of t){const n=`${o.place}${o.mediaType?` (${o.mediaType})`:""}`;r[n]||(r[n]=[]),r[n].push(o)}return Object.entries(r).map(([o,n])=>{const e=n.map(i=>{const c=[...i.path||[],i.name],f=Array.isArray(i.description)?i.description.join(" "):i.description;let s=` - \`${c.join(".")}\` (${i.type}${i.required?", required":""})
93
- `;return f&&(s+=` ${f.trim()}
94
- `),i.enum?s+=` Enum: ${i.enum.map(d=>JSON.stringify(d)).join(", ")}
95
- `:i.example&&(s+=` Example: ${i.example}
96
- `),s});return`## ${Z(o)}:
92
+ `)}else u.content.contentType===g.GROUP&&d(u.items)};return d(e.items),{llmstxt:i+o,aiSearch:i}}let f="";if(e.items?.length)for(const o of e.items){if(!o.link||!o.content||o.content.contentType!==g.ITEM||!M(o,s))continue;const d=o,p=d.httpVerb,u=d.httpPath,h=p&&u?`${p.toUpperCase()} ${u}`:o.label||"",$=o.content?T(o.content.children,r):void 0;f+=` - ${w({title:h,description:$?$.slice(0,200):void 0,slug:H(o.link),siteUrl:s.seo?.siteUrl})}`}return{llmstxt:i+f,aiSearch:i}}function Dn(e,s){const c=[],r=n=>{for(const l of n)if(l.nodeType===m.SECURITY){const t=l;for(const i of t.requirements)for(const f of i.schemes)f[x]||f.name&&!c.includes(f.name)&&c.push(f.name)}else(l.nodeType===m.CONTAINER||l.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&r(l.children)};if(r(e),c.length)return c.join(", ");if(s?.length){const n=s.flatMap(l=>Object.keys(l));if(n.length)return[...new Set(n)].join(", ")}}function En(e){const s={};for(const r of e){const n=`${r.place}${r.mediaType?` (${r.mediaType})`:""}`;s[n]||(s[n]=[]),s[n].push(r)}return Object.entries(s).map(([r,n])=>{const l=n.map(t=>{const i=[...t.path||[],t.name],f=Array.isArray(t.description)?t.description.join(" "):t.description;let o=` - \`${i.join(".")}\` (${t.type}${t.required?", required":""})
93
+ `;return f&&(o+=` ${f.trim()}
94
+ `),t.enum?o+=` Enum: ${t.enum.map(d=>JSON.stringify(d)).join(", ")}
95
+ `:t.example&&(o+=` Example: ${t.example}
96
+ `),o});return`## ${Z(r)}:
97
97
 
98
- ${e.join(`
98
+ ${l.join(`
99
99
  `)}`}).join(`
100
- `)}function kn(t,r){let l="";const o=n=>{for(const e of n)if(e.nodeType===m.ITEM){const i=ln(e)?fn(e,r??{}):void 0;i&&(l+=Un(i,e.variant))}else(e.nodeType===m.CONTAINER||e.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(e.children)};return o(t),l}function Un(t,r){let o=`
101
- ## ${Z(r==="return-type"?"Return type":r==="graphql-args"||r==="arguments"?"Arguments":r==="graphql-fields"?"Fields":r)}:
100
+ `)}function kn(e,s,c){let r="";const n=l=>{for(const t of l)if(t.nodeType===m.ITEM){const i=ln(t)?fn(t,s??{}):void 0;i&&(r+=Un(i,t.variant,c))}else(t.nodeType===m.CONTAINER||t.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&n(t.children)};return n(e),r}function Un(e,s,c){let n=`
101
+ ## ${Z(s==="return-type"?"Return type":s==="graphql-args"||s==="arguments"?"Arguments":s==="graphql-fields"?"Fields":s)}:
102
102
 
103
- `;const n=e=>{const i=e.description?N(Array.isArray(e.description)?e.description:[e.description]).trim():"";return` - \`${e.name}\` (${e.type.display})${i?`: ${i}`:""}
104
- `};if(t.type){const e=t.type.description?N(Array.isArray(t.type.description)?t.type.description:[t.type.description]).trim():"";o+=` Type: ${t.type.display}`,e&&(o+=` - ${e}`),o+=`
105
- `}else if(!t.fields.length)return"";for(const e of t.fields)o+=n(e);return o}function x(t,r){const l=[],o=e=>{for(const i of e)if(i.nodeType===m.MARKDOC){const c=i.content,f=Array.isArray(c)?c:[c],s=N(f,{renderTag:r}).trim();s&&l.push(s)}else(i.nodeType===m.CONTAINER||i.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&o(i.children)};return o(t),l.join(" ").trim()||void 0}function Z(t){return t.charAt(0).toUpperCase()+t.slice(1)}function M(t,r){return r.access?.requiresLogin?!0:pn({slug:t.link||"",[C]:t[C]},r)}export{Xn as getAiDocumentsStore};
103
+ `;const l=t=>{const i=t.description?N(Array.isArray(t.description)?t.description:[t.description],{renderTag:c}).trim():"";return` - \`${t.name}\` (${t.type.display})${i?`: ${i}`:""}
104
+ `};if(e.type){const t=e.type.description?N(Array.isArray(e.type.description)?e.type.description:[e.type.description],{renderTag:c}).trim():"";n+=` Type: ${e.type.display}`,t&&(n+=` - ${t}`),n+=`
105
+ `}else if(!e.fields.length)return"";for(const t of e.fields)n+=l(t);return n}function T(e,s){const c=[],r=l=>{for(const t of l)if(t.nodeType===m.MARKDOC){const i=t.content,f=Array.isArray(i)?i:[i],o=N(f,{renderTag:s}).trim();o&&c.push(o)}else(t.nodeType===m.CONTAINER||t.nodeType===m.OVERVIEW_SECTION_WRAPPER)&&r(t.children)};return r(e),c.join(" ").trim()||void 0}function Z(e){return e.charAt(0).toUpperCase()+e.slice(1)}function M(e,s){return s.access?.requiresLogin?!0:pn({slug:e.link||"",[x]:e[x]},s)}export{Xn as getAiDocumentsStore};
@@ -1,5 +1,5 @@
1
- import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../api-docs/utils/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],e=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;e&&c.output&&!await n.exists(a)&&n.addVirtualFile(a,e);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],r=B(z),b=[r.errors&&`${r.errors} ${$(r.errors,"error","errors")}`,r.warnings&&`${r.warnings} ${$(r.warnings,"warning","warnings")}`,r.ignored&&`${r.ignored} ignored`].filter(Boolean).join(", ");if(r.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
1
+ import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../api-docs/utils/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],e=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;e&&c.output&&!n.exists(a)&&n.addVirtualFile(a,e);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],r=B(z),b=[r.errors&&`${r.errors} ${$(r.errors,"error","errors")}`,r.warnings&&`${r.warnings} ${$(r.warnings,"warning","warnings")}`,r.ignored&&`${r.ignored} ignored`].filter(Boolean).join(", ");if(r.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
2
2
 
3
3
  ${C?.message} at ${C?.location?.[0]?.pointer}
4
4
 
5
- `)}r.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:e?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:e?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of await d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let e;try{e=await u.load(i.relativePath,"arazzo-doc")}catch{continue}e.data?.length&&f.push(...e.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:e.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
5
+ `)}r.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:e?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:e?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let e;try{e=await u.load(i.relativePath,"arazzo-doc")}catch{continue}e.data?.length&&f.push(...e.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:e.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
@@ -1 +1 @@
1
- import{simplifyAstStructure as h}from"@redocly/api-docs";import{storeDefinitionBundles as p}from"./store-definition-bundles.js";import{arazzoDocLoader as y,arazzoDocsLoader as D}from"./arazzo-doc-loader.js";import{telemetryTraceStep as P}from"../../../cli/telemetry/helpers/trace-step.js";const u="arazzo-docs-";async function $(k){let l=[];return{id:"arazzo",loaders:{"arazzo-doc":y,"arazzo-docs":D},processContent:async(e,o)=>{await P("com.redocly.build.plugin.arazzoDocs",async()=>{for(const t of await o.fs.scan(/(\.ya?ml|\.json)$/))if(!await o.isPathIgnored(t.relativePath))try{const{data:a,compoundHash:n}=await o.cache.load(t.realRelativePath,"arazzo-doc");if(!a?.length)continue;l=a.map(({markdocChunks:r,relativePath:c,isVirtual:i,customOutputRelativeFile:s,realRelativePath:d})=>({chunks:r,relativePath:c,realRelativePath:d,isVirtual:s!=null||t.isVirtual||i})),p(a,e.outdir,n);for(const r of a){const c=`${u}${r.relativePath}`;await e.createSharedData(c,{document:r.document})}}catch(a){console.error(a)}})},afterRoutesCreated:async(e,o)=>{for(const{chunks:t,relativePath:a,isVirtual:n,realRelativePath:r}of l)await o.cache.load(a,{loader:async function(){await o.cache.load(r,"arazzo-doc");for(const{node:i,markdown:s,pointer:d,key:z,relativePath:m}of t){const{ast:f}=await e.parseMarkdoc({input:{content:s,relativePath:d,isVirtual:n},context:o,deps:{sharedDataIds:[`${u}${m}`]}});i[`x-parsed-md-${z}`]={result:h(f)}}},name:"arazzo-markdoc-inline-parser"})}}}export{$ as arazzoDocsPlugin};
1
+ import{simplifyAstStructure as h}from"@redocly/api-docs";import{storeDefinitionBundles as p}from"./store-definition-bundles.js";import{arazzoDocLoader as y,arazzoDocsLoader as D}from"./arazzo-doc-loader.js";import{telemetryTraceStep as P}from"../../../cli/telemetry/helpers/trace-step.js";const u="arazzo-docs-";async function $(k){let l=[];return{id:"arazzo",loaders:{"arazzo-doc":y,"arazzo-docs":D},processContent:async(e,o)=>{await P("com.redocly.build.plugin.arazzoDocs",async()=>{for(const t of o.fs.scan(/(\.ya?ml|\.json)$/))if(!await o.isPathIgnored(t.relativePath))try{const{data:a,compoundHash:n}=await o.cache.load(t.realRelativePath,"arazzo-doc");if(!a?.length)continue;l=a.map(({markdocChunks:r,relativePath:c,isVirtual:s,customOutputRelativeFile:i,realRelativePath:d})=>({chunks:r,relativePath:c,realRelativePath:d,isVirtual:i!=null||t.isVirtual||s})),p(a,e.outdir,n);for(const r of a){const c=`${u}${r.relativePath}`;await e.createSharedData(c,{document:r.document})}}catch(a){console.error(a)}})},afterRoutesCreated:async(e,o)=>{for(const{chunks:t,relativePath:a,isVirtual:n,realRelativePath:r}of l)await o.cache.load(a,{loader:async function(){await o.cache.load(r,"arazzo-doc");for(const{node:s,markdown:i,pointer:d,key:z,relativePath:m}of t){const{ast:f}=await e.parseMarkdoc({input:{content:i,relativePath:d,isVirtual:n},context:o,deps:{sharedDataIds:[`${u}${m}`]}});s[`x-parsed-md-${z}`]={result:h(f)}}},name:"arazzo-markdoc-inline-parser"})}}}export{$ as arazzoDocsPlugin};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as R}from"@redocly/config";import{removeLeadingSlash as O}from"@redocly/theme/core/utils";import{toKebabCase as y}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as x}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as $}from"../../../../../utils/rbac.js";import{removeMarkdocTags as S}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as b}from"./base.js";import{OpenapiSchemaResolver as w}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as N}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as d}from"../../../utils/is-valid-tag-name.js";const A=["get","post","put","delete","patch"],T=15,v=15;class V extends b{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return(await this.actions.loadApiDocuments(this.context)).filter(o=>o.type==="openapi").map(o=>({...o,isVirtual:o.isVirtual??!1}))}mapApiDescriptionToEntity(e,o){const n=O(e.realRelativePath),s=e.document.info.title,t=this.resolveEntityKey({realRelativePath:e.realRelativePath,customKey:e.document["x-redocly-catalog-key"]});return{type:this.type,key:t,title:s,summary:S(typeof e.document.info.description=="string"?e.document.info.description:void 0),tags:e.document.tags?.filter(a=>a.name&&d(a.name)).map(a=>a.name),metadata:{specType:this.specType,descriptionFile:n},version:o}}async processApiDescription(e,o,n,s){if(w.clearSchemaCache(),!e?.document)throw new Error("OpenAPI definition is missing a bundled document");const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,n);await this.catalogEntitiesService.createEntity({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,source:"file",isRootEntity:!0,rbacTeams:t,revision:o}),s.delete(`${a.key}:${n}`),await this.#o(e,a.key,a.version,n,o,s,t);const r=this.#n(e.document.paths);if(r.length!==0){const i=(await x(r,T,async({operation:m,path:h,method:f})=>{if(!m.operationId)return;const l=await this.#c(m,h,f,e,a.key,a.version,o,t);s.delete(`${l}:${n}`)},this.#e)).count.failed;i>0&&this.#e.warn(`Extraction completed with ${i} failures out of ${r.length} operations for ${a.key}`)}}#n(e){return Object.entries(e??{}).flatMap(([o,n])=>A.filter(s=>n[s]).map(s=>{const t=n[s];if(!t)throw new Error(`Operation not found for method ${s} on path ${o}`);return{operation:t,path:o,method:s.toUpperCase()}}))}async#o(e,o,n,s,t,a,r){const c=e.document.components?.schemas;if(!c)return;const i=Object.entries(c);i.length!==0&&await E(i,v,async([m,h])=>{const f=`${o}-${y(m)}`,l=await this.#r({schemaName:m,schema:h,description:e,parentKey:o,parentVersion:n,parentRevision:t,rbacTeams:r});a.delete(`${f}:${s}`),l&&await this.catalogEntitiesService.createEntityRelation({sourceKey:o,sourceVersion:n,sourceRevision:t,type:"uses",targetKey:l.key,targetVersion:n,targetRevision:t,sourceFile:e.realRelativePath,fileHash:e.hash})})}async#r({schemaName:e,schema:o,description:n,parentKey:s,parentVersion:t,parentRevision:a,rbacTeams:r}){const c=w.resolveSchemaRefs(o,n.document),i=JSON.stringify(c),m=c[R]?$(c[R]):r,h=$(c["x-rbac"]),f={type:"data-schema",key:`${s}-${y(e)}`,title:e,summary:(typeof c.description=="string"?c.description:c.title)??null,tags:[],metadata:{specType:this.specType,schema:i},version:t};try{return await this.catalogEntitiesService.createEntity({entity:f,sourceFile:n.realRelativePath,fileHash:n.hash,rbacTeams:h.length?h:m,source:"file",revision:a})}catch(l){return this.#e.error(`Failed to create data schema entity for ${e}: ${l instanceof Error?l.message:"Unknown error"}`),null}}async#c(e,o,n,s,t,a,r,c){const i=`${t}-${y(`${e.operationId}`)}`,m=await Promise.all([this.#h(e.requestBody??null,s),this.#l(e.responses??{},s)]),h=m[0].schemaNames,f=m[1].schemaNames;m[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${m[0].errors.join(", ")}`),m[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${m[1].errors.join(", ")}`);const l=h.map(p=>`${t}-${y(p)}`),u=f.map(p=>`${t}-${y(p)}`),g=await this.#p({path:o,method:n,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:u,description:s,parentKey:t,parentVersion:a,parentRevision:r,rbacTeams:c});return g&&await Promise.all([this.#i(h,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#m(f,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#y({apiOperationKey:g.key,operationRelations:e["x-catalogRelations"],descriptionUniqueKey:t,description:s,parentVersion:a,parentRevision:r})]),i}async#i(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}async#m(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}#h(e,o){const n=[],s=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){const a=this.#a(t,o);if(!a)continue;const r=this.#t(a);r?.componentType==="schemas"&&r.componentName&&n.push(r.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.document.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const r of Object.values(a.content??{})){const c=this.#a(r,o);if(!c)continue;const i=this.#t(c);i?.componentType==="schemas"&&i.componentName&&n.push(i.componentName)}}}}catch(t){s.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#l(e,o){const n=[],s=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){const r=this.#a(a,o);if(!r)continue;const c=this.#t(r);c?.componentType==="schemas"&&c.componentName&&n.push(c.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const r=o.document.components?.responses?.[a.componentName];if(r&&"content"in r)for(const c of Object.values(r.content??{})){const i=this.#a(c,o);if(!i)continue;const m=this.#t(i);m?.componentType==="schemas"&&m.componentName&&n.push(m.componentName)}}}}}catch(t){s.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#a(e,o){const n=new Set;let s=e;for(;s&&"$ref"in s;){const t=this.#t(s.$ref),a=t?.componentName;if(t?.componentType!=="mediaTypes"||!a||n.has(a))return;n.add(a),s=o.document.components?.mediaTypes?.[a]}return s?.schema?.$ref}#t(e){try{return N(e)}catch{return{componentType:"",componentName:null}}}async#s(e,o,n,s,t,a,r){return e.length===0?[]:await E(e,v,async c=>await this.#f({operationId:o,schemaName:c,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}))}async#f({operationId:e,schemaName:o,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}){const c=`${t}-${y(o)}`;try{return await this.catalogEntitiesService.createEntityRelation({sourceKey:`${t}-${y(e)}`,type:"uses",targetKey:c,sourceFile:n,fileHash:s,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r}),c}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#p({path:e,method:o,operation:n,requestBodySchemasKeys:s,responseSchemasKeys:t,description:a,parentKey:r,parentVersion:c,parentRevision:i,rbacTeams:m}){const h=`${n.operationId}`,f=`${r}-${y(h)}`,l=n[R]?$(n[R]):m,u=$(n["x-rbac"]),g={type:"api-operation",key:f,title:h,summary:S(n.summary),tags:n.tags?.filter(p=>d(p)),metadata:{path:e,method:o,payload:s,responses:t},version:c};try{return await this.catalogEntitiesService.createEntity({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,rbacTeams:u.length>0?u:l,source:"file",revision:i})}catch(p){return this.#e.error(`Failed to create API operation entity for ${h}: ${p instanceof Error?p.message:"Unknown error"}`),null}}async#y({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:n,description:s,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:"partOf",targetKey:n,sourceFile:s.realRelativePath,fileHash:s.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#u(e,s,o,t,a)}catch(r){this.#e.error(`Failed to create API operation relations for ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async#u(e,o,n,s,t){n?.length&&await E(n,T,async a=>{try{this.validateEntityRelationFileSchema(a),await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:a.type,targetKey:a.key,sourceFile:o.realRelativePath,fileHash:o.hash,sourceVersion:s,targetVersion:"",sourceRevision:t,targetRevision:""})}catch(r){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${r instanceof Error?r.message:"Unknown error"}`)}})}}export{V as OpenApiEntitiesExtractor};
1
+ import{REDOCLY_TEAMS_RBAC as g}from"@redocly/config";import{removeLeadingSlash as x}from"@redocly/theme/core/utils";import{toKebabCase as p}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as S}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as b}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as R}from"../../../../../utils/rbac.js";import{removeMarkdocTags as w}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as N}from"./base.js";import{OpenapiSchemaResolver as d}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as A}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as T}from"../../../utils/is-valid-tag-name.js";const k=["get","post","put","delete","patch"],v=15,O=15;class _ extends N{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return(await this.actions.loadApiDocuments(this.context)).filter(o=>o.type==="openapi").map(o=>({...o,isVirtual:o.isVirtual??!1}))}mapApiDescriptionToEntity(e,o){const n=x(e.realRelativePath),s=e.document.info.title,t=this.resolveEntityKey({realRelativePath:e.realRelativePath,customKey:e.document["x-redocly-catalog-key"]});return{type:this.type,key:t,title:s,summary:w(typeof e.document.info.description=="string"?e.document.info.description:void 0),tags:e.document.tags?.filter(a=>a.name&&T(a.name)).map(a=>a.name),metadata:{specType:this.specType,descriptionFile:n},version:o}}async processApiDescription(e,o,n,s){if(d.clearSchemaCache(),!e?.document)throw new Error("OpenAPI definition is missing a bundled document");const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,n);await this.catalogEntitiesService.createEntity({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,source:"file",isRootEntity:!0,rbacTeams:t,revision:o}),s.delete(`${a.key}:${n}`),await this.#o(e,a.key,a.version,n,o,s,t);const r=this.#n(e.document.paths);if(r.length!==0){const i=(await b(r,v,async({operation:m,path:h,method:f})=>{if(!m.operationId)return;const l=await this.#c(m,h,f,e,a.key,a.version,o,t);s.delete(`${l}:${n}`)},this.#e)).count.failed;i>0&&this.#e.warn(`Extraction completed with ${i} failures out of ${r.length} operations for ${a.key}`)}}#n(e){return Object.entries(e??{}).flatMap(([o,n])=>k.filter(s=>n[s]).map(s=>{const t=n[s];if(!t)throw new Error(`Operation not found for method ${s} on path ${o}`);return{operation:t,path:o,method:s.toUpperCase()}}))}async#o(e,o,n,s,t,a,r){const c=e.document.components?.schemas;if(!c)return;const i=Object.entries(c);i.length!==0&&await S(i,O,async([m,h])=>{const f=`${o}-${p(m)}`,l=await this.#r({schemaName:m,schema:h,description:e,parentKey:o,parentVersion:n,parentRevision:t,rbacTeams:r});a.delete(`${f}:${s}`),l&&await this.catalogEntitiesService.createEntityRelation({sourceKey:o,sourceVersion:n,sourceRevision:t,type:"uses",targetKey:l.key,targetVersion:n,targetRevision:t,sourceFile:e.realRelativePath,fileHash:e.hash})})}async#r({schemaName:e,schema:o,description:n,parentKey:s,parentVersion:t,parentRevision:a,rbacTeams:r}){const c=d.resolveSchemaRefs(o,n.document),i=JSON.stringify(c),m=c[g]?R(c[g]):r,h=R(c["x-rbac"]),f={type:"data-schema",key:`${s}-${p(e)}`,title:e,summary:(typeof c.description=="string"?c.description:c.title)??null,tags:[],metadata:{specType:this.specType,schema:i},version:t};try{return await this.catalogEntitiesService.createEntity({entity:f,sourceFile:n.realRelativePath,fileHash:n.hash,rbacTeams:h.length?h:m,source:"file",revision:a})}catch(l){return this.#e.error(`Failed to create data schema entity for ${e}: ${l instanceof Error?l.message:"Unknown error"}`),null}}async#c(e,o,n,s,t,a,r,c){const i=`${t}-${p(`${e.operationId}`)}`,m=this.#h(e.requestBody??null,s),h=this.#l(e.responses??{},s),f=m.schemaNames,l=h.schemaNames;m.errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${m.errors.join(", ")}`),h.errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${h.errors.join(", ")}`);const u=f.map(E=>`${t}-${p(E)}`),$=l.map(E=>`${t}-${p(E)}`),y=await this.#p({path:o,method:n,operation:e,requestBodySchemasKeys:u,responseSchemasKeys:$,description:s,parentKey:t,parentVersion:a,parentRevision:r,rbacTeams:c});return y&&await Promise.all([this.#i(f,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#m(l,e.operationId??"",s.realRelativePath,s.hash,t,a,r),this.#y({apiOperationKey:y.key,operationRelations:e["x-catalogRelations"],descriptionUniqueKey:t,description:s,parentVersion:a,parentRevision:r})]),i}async#i(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}async#m(e,o,n,s,t,a,r){return e.length===0||!o?[]:await this.#s(e,o,n,s,t,a,r)}#h(e,o){const n=[],s=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){const a=this.#a(t,o);if(!a)continue;const r=this.#t(a);r?.componentType==="schemas"&&r.componentName&&n.push(r.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.document.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const r of Object.values(a.content??{})){const c=this.#a(r,o);if(!c)continue;const i=this.#t(c);i?.componentType==="schemas"&&i.componentName&&n.push(i.componentName)}}}}catch(t){s.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#l(e,o){const n=[],s=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){const r=this.#a(a,o);if(!r)continue;const c=this.#t(r);c?.componentType==="schemas"&&c.componentName&&n.push(c.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const r=o.document.components?.responses?.[a.componentName];if(r&&"content"in r)for(const c of Object.values(r.content??{})){const i=this.#a(c,o);if(!i)continue;const m=this.#t(i);m?.componentType==="schemas"&&m.componentName&&n.push(m.componentName)}}}}}catch(t){s.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(n)],errors:s}}#a(e,o){const n=new Set;let s=e;for(;s&&"$ref"in s;){const t=this.#t(s.$ref),a=t?.componentName;if(t?.componentType!=="mediaTypes"||!a||n.has(a))return;n.add(a),s=o.document.components?.mediaTypes?.[a]}return s?.schema?.$ref}#t(e){try{return A(e)}catch{return{componentType:"",componentName:null}}}async#s(e,o,n,s,t,a,r){return e.length===0?[]:await S(e,O,async c=>await this.#f({operationId:o,schemaName:c,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}))}async#f({operationId:e,schemaName:o,descriptionSourceFile:n,descriptionHash:s,parentKey:t,parentVersion:a,parentRevision:r}){const c=`${t}-${p(o)}`;try{return await this.catalogEntitiesService.createEntityRelation({sourceKey:`${t}-${p(e)}`,type:"uses",targetKey:c,sourceFile:n,fileHash:s,sourceVersion:a,targetVersion:a,sourceRevision:r,targetRevision:r}),c}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#p({path:e,method:o,operation:n,requestBodySchemasKeys:s,responseSchemasKeys:t,description:a,parentKey:r,parentVersion:c,parentRevision:i,rbacTeams:m}){const h=`${n.operationId}`,f=`${r}-${p(h)}`,l=n[g]?R(n[g]):m,u=R(n["x-rbac"]),$={type:"api-operation",key:f,title:h,summary:w(n.summary),tags:n.tags?.filter(y=>T(y)),metadata:{path:e,method:o,payload:s,responses:t},version:c};try{return await this.catalogEntitiesService.createEntity({entity:$,sourceFile:a.realRelativePath,fileHash:a.hash,rbacTeams:u.length>0?u:l,source:"file",revision:i})}catch(y){return this.#e.error(`Failed to create API operation entity for ${h}: ${y instanceof Error?y.message:"Unknown error"}`),null}}async#y({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:n,description:s,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:"partOf",targetKey:n,sourceFile:s.realRelativePath,fileHash:s.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#u(e,s,o,t,a)}catch(r){this.#e.error(`Failed to create API operation relations for ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async#u(e,o,n,s,t){n?.length&&await S(n,v,async a=>{try{this.validateEntityRelationFileSchema(a),await this.catalogEntitiesService.createEntityRelation({sourceKey:e,type:a.type,targetKey:a.key,sourceFile:o.realRelativePath,fileHash:o.hash,sourceVersion:s,targetVersion:"",sourceRevision:t,targetRevision:""})}catch(r){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${r instanceof Error?r.message:"Unknown error"}`)}})}}export{_ as OpenApiEntitiesExtractor};
@@ -1 +1 @@
1
- import{requireAuthMiddleware as e}from"../middlewares/auth.js";import{integrationsMiddleware as d}from"../middlewares/integrations.js";import{listApps as g,createApp as l,getApp as c,createCredential as n,updateCredential as k,deleteCredential as o,deleteApp as y,updateApp as m,getLogs as f,getLogDetails as A}from"./apps.js";import{getMeta as C}from"./meta.js";import{getApiAccessStatus as b,listApiProducts as r}from"./products.js";function w(p,a){const i=a.getConfig().developerOnboarding?.adapters||[],s=a.getConfig().access?.rbac||{},t=a.globalData.apiProducts||{};i&&(p.get("/api/api-keys/meta",e(),C(a)),p.get("/api/api-keys/apps",e(),d(i,t,s),g(a)),p.post("/api/api-keys/apps",e(),d(i,t,s),l(a)),p.get("/api/api-keys/apps/:id",e(),d(i,t,s),c(a)),p.put("/api/api-keys/apps/:id",e(),d(i,t,s),m(a)),p.delete("/api/api-keys/apps/:id",e(),d(i,t,s),y(a)),p.post("/api/api-keys/apps/:id/credentials",e(),d(i,t,s),n(a)),p.put("/api/api-keys/apps/:id/credentials/:credentialId",e(),d(i,t,s),k(a)),p.delete("/api/api-keys/apps/:id/credentials/:credentialId",e(),d(i,t,s),o(a)),p.get("/api/api-keys/apps/:id/logs/:logId",e(),d(i,t,s),A()),p.get("/api/api-keys/apps/:id/logs",e(),d(i,t,s),f()),p.get("/api/api-keys/api-products",e(),d(i,t,s),r(a)),p.get("/api/api-keys/api-products/:id/access",e(),d(i,t,s),b()))}export{w as installRoutes};
1
+ import{requireAuthMiddleware as i}from"../middlewares/auth.js";import{integrationsMiddleware as l}from"../middlewares/integrations.js";import{listApps as g,createApp as c,getApp as n,createCredential as o,updateCredential as m,deleteCredential as f,deleteApp as A,updateApp as r,getLogs as C,getLogDetails as b}from"./apps.js";import{getMeta as u}from"./meta.js";import{getApiAccessStatus as I,listApiProducts as M}from"./products.js";import{apiKeysUrl as t}from"../../../../../utils/url/api-keys-url.js";function h(p,e){const a=e.getConfig().developerOnboarding?.adapters||[],d=e.getConfig().access?.rbac||{},s=e.globalData.apiProducts||{};a&&(p.get(t("/meta"),i(),u(e)),p.get(t("/apps"),i(),l(a,s,d),g(e)),p.post(t("/apps"),i(),l(a,s,d),c(e)),p.get(t("/apps/:id"),i(),l(a,s,d),n(e)),p.put(t("/apps/:id"),i(),l(a,s,d),r(e)),p.delete(t("/apps/:id"),i(),l(a,s,d),A(e)),p.post(t("/apps/:id/credentials"),i(),l(a,s,d),o(e)),p.put(t("/apps/:id/credentials/:credentialId"),i(),l(a,s,d),m(e)),p.delete(t("/apps/:id/credentials/:credentialId"),i(),l(a,s,d),f(e)),p.get(t("/apps/:id/logs/:logId"),i(),l(a,s,d),b()),p.get(t("/apps/:id/logs"),i(),l(a,s,d),C()),p.get(t("/api-products"),i(),l(a,s,d),M(e)),p.get(t("/api-products/:id/access"),i(),l(a,s,d),I()))}export{h as installRoutes};
@@ -1,15 +1,15 @@
1
- import*as e from"react";import i from"styled-components";import{useQuery as v}from"@tanstack/react-query";import{useParams as x}from"react-router";import{Box as y,Flex as E}from"@redocly/portal-legacy-ui";import{Admonition as A}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTabList as w}from"@redocly/theme/core/hooks";import{useTranslate as T}from"../../../../client/app/hooks";import C from"../../../../client/app/CircularProgress";import{Container as P}from"./components/Container";import k from"./components/AppOverview";import I from"./components/ApiKeys";import L from"./components/ApiLogs";import _ from"./components/CreateApiKey";import{Description as B}from"./components/Description";import{CallbackUrl as K}from"./components/CallbackUrl";const S="app-tab-actions-portal",p="api_keys",z="logs";function D(U){const{id:s}=x(),{isLoading:m,error:l,data:t}=v({queryKey:["APP:"+s],queryFn:()=>fetch(`/api/api-keys/apps/${s}`).then(a=>a.json())}),{translate:c}=T(),d=a=>r.findIndex(o=>o.id===a),r=[{id:p,name:c("dev.main.tab.appKeys","API keys"),content:e.createElement(e.Fragment,null,e.createElement(I,{credentials:t?.credentials,attributes:t?.attributes}),e.createElement(B,{text:t?.description}),t?.callbackUrl!==void 0&&e.createElement(K,{text:t.callbackUrl})),show:!0},{id:z,name:c("dev.main.tab.logs","Logs"),content:e.createElement(L,null),show:!!t?.supportsLogs}].filter(a=>a.show),[n,g]=e.useState(0),{tabListProps:u,getTabProps:b,getTabPanelProps:f}=w({count:r.length,activeIndex:n,onChange:g}),h=t?.canCreateKey&&n===d(p);return e.createElement(y,{my:"2rem"},e.createElement(P,null,m?e.createElement(E,{justifyContent:"center",mt:"2em"},e.createElement(C,null)):l?e.createElement(A,{type:"danger"},l?.message??"Something went wrong"):t?e.createElement(e.Fragment,null,e.createElement(k,{app:t}),e.createElement(F,null,e.createElement(O,{...u},r.map(({name:a},o)=>e.createElement("span",{key:a,className:n===o?"active":"",...b(o)},a))),e.createElement("div",{id:S}),h&&e.createElement(_,{initialEnabledApis:(t.credentials||[]).flatMap(a=>a.apiProductIds||[])})),e.createElement(j,{...f(n)},r[n].content)):null))}const ae=i.i`
1
+ import*as e from"react";import i from"styled-components";import{useQuery as v}from"@tanstack/react-query";import{useParams as x}from"react-router";import{Box as y,Flex as E}from"@redocly/portal-legacy-ui";import{Admonition as A}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{useTabList as w}from"@redocly/theme/core/hooks";import{useTranslate as T}from"../../../../client/app/hooks";import C from"../../../../client/app/CircularProgress";import{Container as P}from"./components/Container";import I from"./components/AppOverview";import k from"./components/ApiKeys";import L from"./components/ApiLogs";import _ from"./components/CreateApiKey";import{Description as B}from"./components/Description";import{CallbackUrl as K}from"./components/CallbackUrl";import{apiKeysUrl as S}from"../../../../utils/url/api-keys-url";const z="app-tab-actions-portal",m="api_keys",D="logs";function F(q){const{id:s}=x(),{isLoading:p,error:l,data:t}=v({queryKey:["APP:"+s],queryFn:()=>fetch(S(`/apps/${s}`)).then(r=>r.json())}),{translate:c}=T(),d=r=>a.findIndex(o=>o.id===r),a=[{id:m,name:c("dev.main.tab.appKeys","API keys"),content:e.createElement(e.Fragment,null,e.createElement(k,{credentials:t?.credentials,attributes:t?.attributes}),e.createElement(B,{text:t?.description}),t?.callbackUrl!==void 0&&e.createElement(K,{text:t.callbackUrl})),show:!0},{id:D,name:c("dev.main.tab.logs","Logs"),content:e.createElement(L,null),show:!!t?.supportsLogs}].filter(r=>r.show),[n,g]=e.useState(0),{tabListProps:u,getTabProps:b,getTabPanelProps:f}=w({count:a.length,activeIndex:n,onChange:g}),h=t?.canCreateKey&&n===d(m);return e.createElement(y,{my:"2rem"},e.createElement(P,null,p?e.createElement(E,{justifyContent:"center",mt:"2em"},e.createElement(C,null)):l?e.createElement(A,{type:"danger"},l?.message??"Something went wrong"):t?e.createElement(e.Fragment,null,e.createElement(I,{app:t}),e.createElement(O,null,e.createElement(U,{...u},a.map(({name:r},o)=>e.createElement("span",{key:r,className:n===o?"active":"",...b(o)},r))),e.createElement("div",{id:z}),h&&e.createElement(_,{initialEnabledApis:(t.credentials||[]).flatMap(r=>r.apiProductIds||[])})),e.createElement(j,{...f(n)},a[n].content)):null))}const ae=i.i`
2
2
  display: inline-block;
3
3
  width: 12px;
4
4
  height: 12px;
5
5
  background-repeat: no-repeat;
6
6
  background-size: 12px 12px;
7
7
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='black' viewBox='0 0 451.847 451.847' width='12px' height='12px' %3E%3Cpath d='M225.923 354.706c-8.098 0-16.195-3.092-22.369-9.263L9.27 151.157c-12.359-12.359-12.359-32.397 0-44.751 12.354-12.354 32.388-12.354 44.748 0l171.905 171.915 171.906-171.909c12.359-12.354 32.391-12.354 44.744 0 12.365 12.354 12.365 32.392 0 44.751L248.292 345.449c-6.177 6.172-14.274 9.257-22.369 9.257z' /%3E%3C/svg%3E");
8
- `,F=i.div`
8
+ `,O=i.div`
9
9
  display: flex;
10
10
  justify-content: space-between;
11
11
  align-items: end;
12
- `,O=i.div`
12
+ `,U=i.div`
13
13
  display: flex;
14
14
  align-items: center;
15
15
  height: 42px;
@@ -29,4 +29,4 @@ import*as e from"react";import i from"styled-components";import{useQuery as v}fr
29
29
  }
30
30
  `,j=i.div`
31
31
  margin-top: var(--spacing-base);
32
- `;export{ae as ArrowIcon,S as TAB_ACTIONS_PORTAL_ID,D as default};
32
+ `;export{ae as ArrowIcon,z as TAB_ACTIONS_PORTAL_ID,F as default};
@@ -1,8 +1,8 @@
1
- import*as e from"react";import{useQuery as u}from"@tanstack/react-query";import a from"styled-components";import{Outlet as g,useLocation as h,useNavigate as v,useParams as y}from"react-router";import{Flex as x}from"@redocly/portal-legacy-ui";import{Button as w}from"@redocly/theme/components/Button/Button";import{Sidebar as E}from"@redocly/theme/components/Sidebar/Sidebar";import{Admonition as b}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{MenuItem as P}from"@redocly/theme/components/Menu/MenuItem";import{AddIcon as A}from"@redocly/theme/icons/AddIcon/AddIcon";import{useTranslate as C}from"../../../../client/app/hooks";import k from"../../../../client/app/CircularProgress";import{loadAndNavigate as p}from"../../../../client/app/utils/loadAndNavigate";import S from"./components/icons/PlaceholderIcon";import{ButtonWithLoading as L}from"./components/ButtonWithLoading";import{CreateAppDialog as I}from"./CreateAppDialog";function j(){const{id:n}=y(),s=v(),f=h(),i=e.useRef(null),{translate:o}=C(),{data:r,isLoading:m,isRefetching:l,error:c}=u({refetchOnWindowFocus:!1,queryKey:["APPS"],queryFn:()=>fetch("/api/api-keys/apps").then(t=>t.json().then(d=>t.ok?Promise.resolve(d):Promise.reject(d)))});return e.useEffect(()=>{const t=m||l;!n&&r?.length&&!t?p({navigate:s,to:"apps/"+r[0].id+f.search,origin:"browser",options:{replace:!0}}):n&&!t&&!r?.length&&p({navigate:s,to:"apps/"})},[n,r,l]),e.createElement(e.Fragment,null,m||l?e.createElement(x,{justifyContent:"center",mt:"2em"},e.createElement(k,null)):c?e.createElement(b,{type:"danger"},c?.message??"Something went wrong"):r?e.createElement(z,{"data-component-name":"Layout/PageLayout"},n&&e.createElement(E,{growContent:!1,menu:r?.map(t=>e.createElement(P,{key:t.id,item:{label:t.name,link:"apps/"+t.id,items:[],active:n===t.id,hasActiveSubItem:!1}})),header:e.createElement(D,{"data-translation-key":"dev.sidebar.header"},o("dev.sidebar.header","My apps")),footer:e.createElement(w,{variant:"outlined",fullWidth:!0,onClick:()=>i.current.open(),icon:e.createElement(A,null),iconPosition:"right",size:"small","data-translation-key":"dev.sidebar.footer.text"},o("dev.sidebar.footer.text","New application")),versions:null}),!n&&!r.length?e.createElement(N,null,e.createElement(R,null,e.createElement(S,null),e.createElement(W,{"data-translation-key":"dev.newApp.text"},o("dev.newApp.text","Create your first app")),e.createElement(L,{variant:"primary",onClick:()=>i.current.open(),"data-translation-key":"dev.newApp"},o("dev.newApp","New application")))):e.createElement(F,null,e.createElement(g,null)),e.createElement(I,{ref:i})):null)}const z=a.div`
1
+ import*as e from"react";import{useQuery as u}from"@tanstack/react-query";import o from"styled-components";import{Outlet as g,useLocation as h,useNavigate as v,useParams as y}from"react-router";import{Flex as x}from"@redocly/portal-legacy-ui";import{Button as w}from"@redocly/theme/components/Button/Button";import{Sidebar as E}from"@redocly/theme/components/Sidebar/Sidebar";import{Admonition as b}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{MenuItem as P}from"@redocly/theme/components/Menu/MenuItem";import{AddIcon as A}from"@redocly/theme/icons/AddIcon/AddIcon";import{useTranslate as C}from"../../../../client/app/hooks";import k from"../../../../client/app/CircularProgress";import{loadAndNavigate as f}from"../../../../client/app/utils/loadAndNavigate";import S from"./components/icons/PlaceholderIcon";import{ButtonWithLoading as L}from"./components/ButtonWithLoading";import{CreateAppDialog as I}from"./CreateAppDialog";import{apiKeysUrl as j}from"../../../../utils/url/api-keys-url";function z(){const{id:n}=y(),s=v(),p=h(),i=e.useRef(null),{translate:a}=C(),{data:r,isLoading:m,isRefetching:l,error:c}=u({refetchOnWindowFocus:!1,queryKey:["APPS"],queryFn:()=>fetch(j("/apps")).then(t=>t.json().then(d=>t.ok?Promise.resolve(d):Promise.reject(d)))});return e.useEffect(()=>{const t=m||l;!n&&r?.length&&!t?f({navigate:s,to:"apps/"+r[0].id+p.search,origin:"browser",options:{replace:!0}}):n&&!t&&!r?.length&&f({navigate:s,to:"apps/"})},[n,r,l]),e.createElement(e.Fragment,null,m||l?e.createElement(x,{justifyContent:"center",mt:"2em"},e.createElement(k,null)):c?e.createElement(b,{type:"danger"},c?.message??"Something went wrong"):r?e.createElement(F,{"data-component-name":"Layout/PageLayout"},n&&e.createElement(E,{growContent:!1,menu:r?.map(t=>e.createElement(P,{key:t.id,item:{label:t.name,link:"apps/"+t.id,items:[],active:n===t.id,hasActiveSubItem:!1}})),header:e.createElement(R,{"data-translation-key":"dev.sidebar.header"},a("dev.sidebar.header","My apps")),footer:e.createElement(w,{variant:"outlined",fullWidth:!0,onClick:()=>i.current.open(),icon:e.createElement(A,null),iconPosition:"right",size:"small","data-translation-key":"dev.sidebar.footer.text"},a("dev.sidebar.footer.text","New application")),versions:null}),!n&&!r.length?e.createElement(D,null,e.createElement(W,null,e.createElement(S,null),e.createElement(q,{"data-translation-key":"dev.newApp.text"},a("dev.newApp.text","Create your first app")),e.createElement(L,{variant:"primary",onClick:()=>i.current.open(),"data-translation-key":"dev.newApp"},a("dev.newApp","New application")))):e.createElement(N,null,e.createElement(g,null)),e.createElement(I,{ref:i})):null)}const F=o.div`
2
2
  display: flex;
3
3
  flex-direction: row;
4
4
  min-height: calc(100vh - var(--navbar-height));
5
- `,F=a.div`
5
+ `,N=o.div`
6
6
  flex: 1 0 0;
7
7
  /*
8
8
  flex-basis is ignored for nested flex in Chrome, need to set width
@@ -10,27 +10,27 @@ import*as e from"react";import{useQuery as u}from"@tanstack/react-query";import
10
10
  */
11
11
  width: 0;
12
12
  max-width: 100%;
13
- `,N=a.div`
13
+ `,D=o.div`
14
14
  display: flex;
15
15
  flex-grow: 1;
16
- `,D=a.div`
16
+ `,R=o.div`
17
17
  display: flex;
18
18
  font-weight: var(--font-weight-regular);
19
19
  font-size: var(--font-size-heading-3);
20
20
  line-height: var(--line-height-xxlg);
21
21
  color: var(--text-color-primary);
22
22
  font-family: var(--font-family-base);
23
- `,R=a.div`
23
+ `,W=o.div`
24
24
  display: flex;
25
25
  flex-direction: column;
26
26
  flex-grow: 1;
27
27
  justify-content: center;
28
28
  align-items: center;
29
29
  font-family: var(--font-family-base);
30
- `,W=a.div`
30
+ `,q=o.div`
31
31
  font-weight: var(--font-weight-regular);
32
32
  font-size: 28px;
33
33
  line-height: 36px;
34
34
  color: var(--input-content-placeholder-color);
35
35
  padding: var(--spacing-xl) 0 var(--spacing-lg) 0;
36
- `;export{j as default};
36
+ `;export{z as default};
@@ -1,10 +1,10 @@
1
- import*as e from"react";import{useQueryClient as z,useMutation as B,useQuery as H}from"@tanstack/react-query";import v from"styled-components";import{Flex as V}from"@redocly/portal-legacy-ui";import{Button as $}from"@redocly/theme/components/Button/Button";import{Admonition as A}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{AppCustomAttributes as Q}from"@redocly/theme/components/ApiOnboarding/AppCustomAttributes";import{usePreloadHistory as G}from"../../../../client/app/usePreloadHistory";import{useTranslate as K}from"../../../../client/app/hooks";import W from"./components/ApisList";import{ButtonWithLoading as J}from"./components/ButtonWithLoading";import{Dialog as X}from"./components/Dialog";import{ButtonsContainer as Y}from"./components/RollAPIKey";import{MAX_DESCRIPTION_LENGTH as k,CharacterCounter as Z}from"./components/CharacterCounter";import{DialogHelperText as ee,DialogInputMultiline as S,DialogRow as c,DialogRowContent as p,DialogRowTitle as m,DialogTitleInput as te}from"./components/DialogStyledComponents";const Ce=e.forwardRef((le,w)=>{const{data:I}=H({queryKey:["DEV_ONBOARDING_META"],staleTime:1/0,queryFn:async()=>{const t=await fetch("/api/api-keys/meta");if(!t.ok)throw new Error(`Failed to load meta: ${t.status}`);return t.json()}}),d=(I?.adapters||[]).some(t=>t.capabilities.callbackUrls),[r,P]=e.useState(""),[n,D]=e.useState(""),[u,U]=e.useState(void 0),x=z(),[R,T]=e.useState({}),[N,O]=e.useState(!0),[g,h]=e.useState(""),[L,o]=e.useState(!1),E=G(),f=new URLSearchParams(E.location.search),[y,_]=e.useState([]),{translate:a}=K(),C=f.has("createApp");e.useEffect(()=>{C&&o(!0)},[C]);const F=e.useCallback((t,q)=>{T(t),O(q)},[]),l=B({mutationFn:()=>fetch("/api/api-keys/apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:r,name:r,description:n,callbackUrl:d?u:void 0,apiProductIds:y,attributes:R})}).then(t=>t.json()),onSuccess:t=>{t.error?h(t.error):(E.push("/apps/"+t.id),x.invalidateQueries({queryKey:["APPS"]}),s(),h(""))}}),b=()=>o(!0),s=()=>o(!1);e.useImperativeHandle(w,()=>({open:b}));const M=t=>{_(t||[])},j=async()=>{await l.mutateAsync()},i=/^[a-z][a-z0-9._\-$%#\s]*$/gi.test(r);return e.createElement(e.Fragment,null,e.createElement(X,{open:L,onOpen:b,onClose:s},e.createElement(ae,null,e.createElement(V,{justifyContent:"space-between",alignItems:"center",mb:"2em"},e.createElement(te,{error:!!r&&!i,value:r,onChange:t=>P(t.target.value),placeholder:a("dev.create.app.dialog.appName.placeholder","App name")}),!!r&&!i&&e.createElement(re,null,a("dev.create.app.dialog.appName.error","Name must start with a letter and can only contain: letters, numbers, spaces, ., _, -, $, %, #"))),e.createElement(c,null,e.createElement(m,{"data-translation-key":"dev.create.app.dialog.selectAPIs"},a("dev.create.app.dialog.selectAPIs","Select APIs")),e.createElement(p,null,e.createElement(W,{initialEnabledApis:f.getAll("apiId"),onChange:M}))),e.createElement(c,null,e.createElement(m,{"data-translation-key":"dev.create.app.dialog.description"},a("dev.create.app.dialog.description","Description")),e.createElement(p,null,e.createElement(S,{maxLength:k,value:n,onChange:t=>D(t.target.value),placeholder:a("dev.create.app.dialog.description.placeholder","Empty"),rows:6}))),e.createElement(Z,null,n.length,"/",k),d&&e.createElement(c,null,e.createElement(m,{"data-translation-key":"dev.create.app.dialog.callbackUrls"},a("dev.create.app.dialog.callbackUrls","Callback URLs")),e.createElement(p,null,e.createElement(S,{value:u,onChange:t=>U(t.target.value),placeholder:a("dev.create.app.dialog.callbackUrls.placeholder","https://example.com/callback"),rows:3}),e.createElement(ee,{"data-translation-key":"dev.create.app.dialog.callbackUrls.hint"},a("dev.create.app.dialog.callbackUrls.hint","Separate multiple URLs with a comma")))),e.createElement(Q,{onChange:F}),l.error?e.createElement(A,{type:"danger"},l.error.message):null,e.createElement(Y,null,e.createElement($,{onClick:s,size:"large",variant:"text"},a("dev.create.app.dialog.cancel","Cancel")),e.createElement(J,{variant:"primary",onClick:j,loading:l.isPending,disabled:!N||l.isPending||!i||y.length<1,"data-translation-key":"dev.create.app.dialog.create"},a("dev.create.app.dialog.create","Create application"))),g&&e.createElement(A,{type:"danger"},g))))}),ae=v.div`
1
+ import*as e from"react";import{useQueryClient as B,useMutation as H,useQuery as V}from"@tanstack/react-query";import v from"styled-components";import{Flex as $}from"@redocly/portal-legacy-ui";import{Button as K}from"@redocly/theme/components/Button/Button";import{Admonition as A}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{AppCustomAttributes as Q}from"@redocly/theme/components/ApiOnboarding/AppCustomAttributes";import{withPathPrefix as G}from"@redocly/theme/core/utils";import{usePreloadHistory as W}from"../../../../client/app/usePreloadHistory";import{useTranslate as J}from"../../../../client/app/hooks";import X from"./components/ApisList";import{ButtonWithLoading as Y}from"./components/ButtonWithLoading";import{Dialog as Z}from"./components/Dialog";import{ButtonsContainer as ee}from"./components/RollAPIKey";import{MAX_DESCRIPTION_LENGTH as k,CharacterCounter as te}from"./components/CharacterCounter";import{DialogHelperText as ae,DialogInputMultiline as S,DialogRow as c,DialogRowContent as p,DialogRowTitle as m,DialogTitleInput as re}from"./components/DialogStyledComponents";import{apiKeysUrl as w}from"../../../../utils/url/api-keys-url";const ke=e.forwardRef((oe,P)=>{const{data:I}=V({queryKey:["DEV_ONBOARDING_META"],staleTime:1/0,queryFn:async()=>{const t=await fetch(w("/meta"));if(!t.ok)throw new Error(`Failed to load meta: ${t.status}`);return t.json()}}),d=(I?.adapters||[]).some(t=>t.capabilities.callbackUrls),[r,U]=e.useState(""),[n,D]=e.useState(""),[u,x]=e.useState(void 0),R=B(),[T,N]=e.useState({}),[O,L]=e.useState(!0),[g,h]=e.useState(""),[_,o]=e.useState(!1),E=W(),f=new URLSearchParams(E.location.search),[C,F]=e.useState([]),{translate:a}=J(),y=f.has("createApp");e.useEffect(()=>{y&&o(!0)},[y]);const M=e.useCallback((t,z)=>{N(t),L(z)},[]),l=H({mutationFn:()=>fetch(w("/apps"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:r,name:r,description:n,callbackUrl:d?u:void 0,apiProductIds:C,attributes:T})}).then(t=>t.json()),onSuccess:t=>{t.error?h(t.error):(E.push(G("/apps/"+t.id)),R.invalidateQueries({queryKey:["APPS"]}),s(),h(""))}}),b=()=>o(!0),s=()=>o(!1);e.useImperativeHandle(P,()=>({open:b}));const j=t=>{F(t||[])},q=async()=>{await l.mutateAsync()},i=/^[a-z][a-z0-9._\-$%#\s]*$/gi.test(r);return e.createElement(e.Fragment,null,e.createElement(Z,{open:_,onOpen:b,onClose:s},e.createElement(le,null,e.createElement($,{justifyContent:"space-between",alignItems:"center",mb:"2em"},e.createElement(re,{error:!!r&&!i,value:r,onChange:t=>U(t.target.value),placeholder:a("dev.create.app.dialog.appName.placeholder","App name")}),!!r&&!i&&e.createElement(ne,null,a("dev.create.app.dialog.appName.error","Name must start with a letter and can only contain: letters, numbers, spaces, ., _, -, $, %, #"))),e.createElement(c,null,e.createElement(m,{"data-translation-key":"dev.create.app.dialog.selectAPIs"},a("dev.create.app.dialog.selectAPIs","Select APIs")),e.createElement(p,null,e.createElement(X,{initialEnabledApis:f.getAll("apiId"),onChange:j}))),e.createElement(c,null,e.createElement(m,{"data-translation-key":"dev.create.app.dialog.description"},a("dev.create.app.dialog.description","Description")),e.createElement(p,null,e.createElement(S,{maxLength:k,value:n,onChange:t=>D(t.target.value),placeholder:a("dev.create.app.dialog.description.placeholder","Empty"),rows:6}))),e.createElement(te,null,n.length,"/",k),d&&e.createElement(c,null,e.createElement(m,{"data-translation-key":"dev.create.app.dialog.callbackUrls"},a("dev.create.app.dialog.callbackUrls","Callback URLs")),e.createElement(p,null,e.createElement(S,{value:u,onChange:t=>x(t.target.value),placeholder:a("dev.create.app.dialog.callbackUrls.placeholder","https://example.com/callback"),rows:3}),e.createElement(ae,{"data-translation-key":"dev.create.app.dialog.callbackUrls.hint"},a("dev.create.app.dialog.callbackUrls.hint","Separate multiple URLs with a comma")))),e.createElement(Q,{onChange:M}),l.error?e.createElement(A,{type:"danger"},l.error.message):null,e.createElement(ee,null,e.createElement(K,{onClick:s,size:"large",variant:"text"},a("dev.create.app.dialog.cancel","Cancel")),e.createElement(Y,{variant:"primary",onClick:q,loading:l.isPending,disabled:!O||l.isPending||!i||C.length<1,"data-translation-key":"dev.create.app.dialog.create"},a("dev.create.app.dialog.create","Create application"))),g&&e.createElement(A,{type:"danger"},g))))}),le=v.div`
2
2
  width: 664px;
3
3
  min-height: 428px;
4
4
  display: flex;
5
5
  flex-direction: column;
6
- `,re=v.span`
6
+ `,ne=v.span`
7
7
  padding-top: 5px;
8
8
  color: var(--color-error-base);
9
9
  font-size: 0.9em;
10
- `;export{Ce as CreateAppDialog};
10
+ `;export{ke as CreateAppDialog};
@@ -1,15 +1,15 @@
1
- import*as e from"react";import o from"styled-components";import{useParams as g}from"react-router";import{useMutation as E,useQueryClient as y}from"@tanstack/react-query";import{Flex as s}from"@redocly/portal-legacy-ui";import{Button as x}from"@redocly/theme/components/Button/Button";import{H3 as h}from"@redocly/theme/components/Typography/H3";import{Admonition as v}from"@redocly/theme/markdoc/components/Admonition/Admonition";import k from"./ApiKeyOverview";import{ApiKeyProductsStatus as w}from"./ApiKeyProductStatus";import{UpdateKey as K}from"./UpdateApiKey";import{Dialog as L}from"./Dialog";import{ButtonWithLoading as D}from"./ButtonWithLoading";function S(m){const p=y(),{credential:t}=m,{id:r}=g(),[c,a]=e.useState(!1),[u,n]=e.useState(!1),{isPending:i,error:l,mutate:d}=E({mutationKey:["DELETE_CRED"+t.id],mutationFn:()=>fetch(`/api/api-keys/apps/${r}/credentials/${t.id}`,{method:"DELETE"}),onSuccess:()=>{p.invalidateQueries({queryKey:["APP:"+r]}),n(!1)}}),C=()=>{d()},f=()=>{a(!0)};return e.createElement(e.Fragment,null,e.createElement(A,null,e.createElement(k,{apiKey:t}),e.createElement(w,{apiProductsStatuses:t.apiProductsStatus,secret:t.clientSecret,id:t.id})),e.createElement(K,{credential:t,open:c,onClose:()=>a(!1),onOpen:f}),e.createElement(L,{open:u,onOpen:()=>n(!0),onClose:()=>n(!1)},e.createElement(e.Fragment,null,e.createElement(h,null,"Revoke key"),e.createElement("div",null,"Do you really want to revoke this key?"),l&&e.createElement(v,{type:"danger"},l.message),e.createElement(O,null,e.createElement(x,{onClick:()=>n(!1)},"Cancel"),e.createElement(D,{variant:"primary",onClick:C,disabled:i,loading:i},"Revoke key")))))}const A=o(s)`
1
+ import*as e from"react";import o from"styled-components";import{useParams as g}from"react-router";import{useMutation as E,useQueryClient as y}from"@tanstack/react-query";import{Flex as m}from"@redocly/portal-legacy-ui";import{Button as x}from"@redocly/theme/components/Button/Button";import{H3 as h}from"@redocly/theme/components/Typography/H3";import{Admonition as v}from"@redocly/theme/markdoc/components/Admonition/Admonition";import k from"./ApiKeyOverview";import{ApiKeyProductsStatus as w}from"./ApiKeyProductStatus";import{UpdateKey as K}from"./UpdateApiKey";import{Dialog as L}from"./Dialog";import{ButtonWithLoading as D}from"./ButtonWithLoading";import{apiKeysUrl as S}from"../../../../../utils/url/api-keys-url";function A(s){const p=y(),{credential:t}=s,{id:r}=g(),[c,a]=e.useState(!1),[u,n]=e.useState(!1),{isPending:i,error:l,mutate:d}=E({mutationKey:["DELETE_CRED"+t.id],mutationFn:()=>fetch(S(`/apps/${r}/credentials/${t.id}`),{method:"DELETE"}),onSuccess:()=>{p.invalidateQueries({queryKey:["APP:"+r]}),n(!1)}}),C=()=>{d()},f=()=>{a(!0)};return e.createElement(e.Fragment,null,e.createElement(O,null,e.createElement(k,{apiKey:t}),e.createElement(w,{apiProductsStatuses:t.apiProductsStatus,secret:t.clientSecret,id:t.id})),e.createElement(K,{credential:t,open:c,onClose:()=>a(!1),onOpen:f}),e.createElement(L,{open:u,onOpen:()=>n(!0),onClose:()=>n(!1)},e.createElement(e.Fragment,null,e.createElement(h,null,"Revoke key"),e.createElement("div",null,"Do you really want to revoke this key?"),l&&e.createElement(v,{type:"danger"},l.message),e.createElement(P,null,e.createElement(x,{onClick:()=>n(!1)},"Cancel"),e.createElement(D,{variant:"primary",onClick:C,disabled:i,loading:i},"Revoke key")))))}const O=o(m)`
2
2
  flex-wrap: wrap;
3
3
  gap: 32px;
4
- `,W=o.span`
4
+ `,Z=o.span`
5
5
  margin: 14px 6px;
6
6
  width: 20px;
7
7
  height: 20px;
8
8
  background-repeat: no-repeat;
9
9
  background-size: 20px 20px;
10
10
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='20' height='20' fill='none' style='mix-blend-mode:multiply'/%3E%3Cpath d='M14.9998 6.25L14.1159 7.13381L16.3572 9.375H7.43657C7.31292 8.77515 7.01623 8.22468 6.58316 7.7916C6.15008 7.35853 5.59961 7.06183 4.99976 6.93819V1.25H3.74976V6.93819C3.04406 7.08229 2.40981 7.46575 1.95431 8.02367C1.4988 8.5816 1.25 9.27974 1.25 10C1.25 10.7203 1.4988 11.4184 1.95431 11.9763C2.40981 12.5343 3.04406 12.9177 3.74976 13.0618V18.75H4.99976V13.0618C5.59961 12.9382 6.15008 12.6415 6.58316 12.2084C7.01623 11.7753 7.31292 11.2248 7.43657 10.625H16.3572L14.1159 12.8662L14.9998 13.75L18.7498 10L14.9998 6.25ZM4.37476 11.875C4.00392 11.875 3.6414 11.765 3.33306 11.559C3.02472 11.353 2.7844 11.0601 2.64248 10.7175C2.50057 10.3749 2.46344 9.99792 2.53578 9.63421C2.60813 9.27049 2.78671 8.9364 3.04893 8.67417C3.31116 8.41195 3.64525 8.23338 4.00896 8.16103C4.37268 8.08868 4.74968 8.12581 5.09229 8.26773C5.4349 8.40964 5.72774 8.64996 5.93376 8.95831C6.13979 9.26665 6.24976 9.62916 6.24976 10C6.24921 10.4971 6.05149 10.9737 5.69998 11.3252C5.34847 11.6767 4.87187 11.8745 4.37476 11.875Z' fill='%231E1E1F'/%3E%3C/svg%3E%0A");
11
- `,O=o(s)`
11
+ `,P=o(m)`
12
12
  margin-top: 2em;
13
13
  justify-content: flex-end;
14
14
  gap: var(--spacing-xs);
15
- `;export{O as ButtonsWrapper,W as ConnectSourceIcon,S as default};
15
+ `;export{P as ButtonsWrapper,Z as ConnectSourceIcon,A as default};
@@ -1,4 +1,4 @@
1
- import*as e from"react";import{useQuery as b}from"@tanstack/react-query";import{useParams as g}from"react-router";import t from"styled-components";import{CodeBlock as f}from"@redocly/theme/components/CodeBlock/CodeBlock";import{fetch as v}from"../../../../../client/app/utils";import y from"./LogStatusCode";import{getReadableDate as h}from"./getReadableDate";import{Headers as E}from"./Headers";function x(m){const{logId:a}=m,[s,p]=e.useState(0),{id:u}=g(),{data:r}=b({refetchOnWindowFocus:!1,queryKey:["API-LOGS-"+a],queryFn:()=>v(`/api/api-keys/apps/${u}/logs/${a}`).then(n=>n.json())}),c=[{name:"Request",content:r?.request},{name:"Response",content:r?.response}];if(!a||!r)return e.createElement(d,null);const o=c[s].content;return e.createElement(d,null,e.createElement(w,null,e.createElement(l,null,r.path)),e.createElement(k,null,e.createElement("span",null,"Status"),e.createElement("span",null,e.createElement(y,{statusCode:r.statusCode.toString()})),e.createElement("span",null,"ID"),e.createElement("span",null,r.id),e.createElement("span",null,"Time"),e.createElement("span",null,h(r.timestamp,{hour:"numeric",minute:"numeric",second:"numeric"})),e.createElement("span",null,"IP Address"),e.createElement("span",null,r.ipAddress)),e.createElement(C,null,e.createElement(T,null,c.map(({name:n},i)=>e.createElement(S,{key:n,className:s===i?"active":"",onClick:()=>p(i)},n))),e.createElement(z,null,e.createElement(l,null,"Headers"),Object.keys(o?.headers||{}).length?e.createElement(E,{headers:o?.headers||{}}):e.createElement("span",null,"No headers"))),o?.body&&e.createElement(e.Fragment,null,e.createElement(l,null,"Body"),e.createElement(A,{lang:"json",source:o.body,withLineNumbers:!0})))}const d=t.div`
1
+ import*as e from"react";import{useQuery as b}from"@tanstack/react-query";import{useParams as g}from"react-router";import t from"styled-components";import{CodeBlock as f}from"@redocly/theme/components/CodeBlock/CodeBlock";import{fetch as v}from"../../../../../client/app/utils";import y from"./LogStatusCode";import{getReadableDate as h}from"./getReadableDate";import{Headers as E}from"./Headers";import{apiKeysUrl as x}from"../../../../../utils/url/api-keys-url";function w(m){const{logId:a}=m,[s,p]=e.useState(0),{id:u}=g(),{data:r}=b({refetchOnWindowFocus:!1,queryKey:["API-LOGS-"+a],queryFn:()=>v(x(`/apps/${u}/logs/${a}`)).then(n=>n.json())}),c=[{name:"Request",content:r?.request},{name:"Response",content:r?.response}];if(!a||!r)return e.createElement(d,null);const o=c[s].content;return e.createElement(d,null,e.createElement(k,null,e.createElement(l,null,r.path)),e.createElement(C,null,e.createElement("span",null,"Status"),e.createElement("span",null,e.createElement(y,{statusCode:r.statusCode.toString()})),e.createElement("span",null,"ID"),e.createElement("span",null,r.id),e.createElement("span",null,"Time"),e.createElement("span",null,h(r.timestamp,{hour:"numeric",minute:"numeric",second:"numeric"})),e.createElement("span",null,"IP Address"),e.createElement("span",null,r.ipAddress)),e.createElement(T,null,e.createElement(S,null,c.map(({name:n},i)=>e.createElement(z,{key:n,className:s===i?"active":"",onClick:()=>p(i)},n))),e.createElement(A,null,e.createElement(l,null,"Headers"),Object.keys(o?.headers||{}).length?e.createElement(E,{headers:o?.headers||{}}):e.createElement("span",null,"No headers"))),o?.body&&e.createElement(e.Fragment,null,e.createElement(l,null,"Body"),e.createElement(I,{lang:"json",source:o.body,withLineNumbers:!0})))}const d=t.div`
2
2
  display: flex;
3
3
  flex-grow: 1;
4
4
  flex-direction: column;
@@ -9,14 +9,14 @@ import*as e from"react";import{useQuery as b}from"@tanstack/react-query";import{
9
9
  width: 50%;
10
10
 
11
11
  word-break: break-all;
12
- `,w=t.div`
12
+ `,k=t.div`
13
13
  display: flex;
14
14
  justify-content: space-between;
15
15
  `,l=t.div`
16
16
  font-weight: var(--font-weight-bold);
17
17
  font-size: var(--font-size-base);
18
18
  padding: var(--spacing-base) 0;
19
- `,k=t.div`
19
+ `,C=t.div`
20
20
  display: grid;
21
21
  row-gap: var(--spacing-sm);
22
22
  grid-template-columns: 1fr 2fr;
@@ -29,9 +29,9 @@ import*as e from"react";import{useQuery as b}from"@tanstack/react-query";import{
29
29
  > span {
30
30
  min-height: 24px;
31
31
  }
32
- `,C=t.div``,T=t.div`
32
+ `,T=t.div``,S=t.div`
33
33
  display: flex;
34
- `,S=t.div`
34
+ `,z=t.div`
35
35
  display: flex;
36
36
  flex-grow: 1;
37
37
  justify-content: center;
@@ -44,7 +44,7 @@ import*as e from"react";import{useQuery as b}from"@tanstack/react-query";import{
44
44
  &.active {
45
45
  border-bottom: 2px solid var(--border-color-primary);
46
46
  }
47
- `,z=t.div``,A=t(f)`
47
+ `,A=t.div``,I=t(f)`
48
48
  padding: 0;
49
49
  background-color: transparent;
50
50
 
@@ -66,4 +66,4 @@ import*as e from"react";import{useQuery as b}from"@tanstack/react-query";import{
66
66
  color: #4478d4;
67
67
  }
68
68
  }
69
- `;export{x as default};
69
+ `;export{w as default};