@redocly/revel-reef 0.128.0-next.6 → 0.128.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 (76) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +54 -0
  3. package/dist/server/esbuild/esbuild.js +2 -2
  4. package/dist/server/node-bundle-entry.js +1 -1
  5. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +4 -0
  6. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  7. package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.js +1 -1
  8. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.d.ts +1 -0
  9. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +6 -6
  10. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +4 -0
  11. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.js +1 -1
  12. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.d.ts +3 -0
  13. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
  14. package/dist/server/plugins/catalog-entities/database/repositories/remote/catalog-entities-remote-repository.js +1 -1
  15. package/dist/server/plugins/catalog-entities/database/repositories/utils.d.ts +2 -0
  16. package/dist/server/plugins/catalog-entities/database/repositories/utils.js +1 -1
  17. package/dist/server/plugins/catalog-entities/entities/types.d.ts +1 -0
  18. package/dist/server/plugins/default-theme/index.js +1 -1
  19. package/dist/server/plugins/markdown/index.js +1 -1
  20. package/dist/server/plugins/openapi-docs/format-bundle-error.d.ts +6 -0
  21. package/dist/server/plugins/openapi-docs/format-bundle-error.js +5 -0
  22. package/dist/server/plugins/openapi-docs/index.js +1 -1
  23. package/dist/server/plugins/openapi-docs/load-definition.js +3 -3
  24. package/dist/server/plugins/pages/index.js +1 -1
  25. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  26. package/dist/server/plugins/scorecards/workers/run-scorecards-worker.d.ts +2 -0
  27. package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -0
  28. package/dist/server/plugins/scorecards/workers/scorecards.d.ts +14 -0
  29. package/dist/server/plugins/scorecards/workers/scorecards.js +1 -0
  30. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +1 -1
  31. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  32. package/dist/server/plugins/sitemap/index.js +1 -1
  33. package/dist/server/providers/database/databases/catalog-sqlite/migrations/0002_add-scorecards-status.sql +1 -0
  34. package/dist/server/providers/database/databases/catalog-sqlite/migrations/meta/0002_snapshot.json +385 -0
  35. package/dist/server/providers/database/databases/catalog-sqlite/migrations/meta/_journal.json +7 -0
  36. package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.d.ts +19 -0
  37. package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.js +1 -1
  38. package/dist/server/providers/database/databases/main-sqlite/migrations/0004_add-scorecards-tables.sql +10 -0
  39. package/dist/server/providers/database/databases/main-sqlite/migrations/meta/0004_snapshot.json +221 -0
  40. package/dist/server/providers/database/databases/main-sqlite/migrations/meta/_journal.json +7 -0
  41. package/dist/server/providers/database/databases/main-sqlite/schemas/scorecards-config-table.d.ts +162 -0
  42. package/dist/server/providers/database/databases/main-sqlite/schemas/scorecards-config-table.js +1 -0
  43. package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
  44. package/dist/server/providers/database/databases/sqld-sqlite/migrations/0003_add-scorecards-tables.sql +61 -0
  45. package/dist/server/providers/database/databases/sqld-sqlite/migrations/0004_add-scorecards-status.sql +1 -0
  46. package/dist/server/providers/database/databases/sqld-sqlite/migrations/meta/0003_snapshot.json +796 -0
  47. package/dist/server/providers/database/databases/sqld-sqlite/migrations/meta/0004_snapshot.json +803 -0
  48. package/dist/server/providers/database/databases/sqld-sqlite/migrations/meta/_journal.json +14 -0
  49. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-evaluations-table.d.ts +124 -0
  50. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-evaluations-table.js +1 -0
  51. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-level-states-table.d.ts +48 -0
  52. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-level-states-table.js +1 -0
  53. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-levels-table.d.ts +186 -0
  54. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-levels-table.js +1 -0
  55. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-states-table.d.ts +177 -0
  56. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-states-table.js +1 -0
  57. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-results-table.d.ts +179 -0
  58. package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-results-table.js +1 -0
  59. package/dist/server/store.d.ts +1 -1
  60. package/dist/server/types/plugins/common.d.ts +1 -0
  61. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.d.ts +19 -0
  62. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.js +1 -0
  63. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.d.ts +2 -0
  64. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.js +1 -0
  65. package/dist/server/utils/is-catalog-entities-enabled.d.ts +2 -0
  66. package/dist/server/utils/is-catalog-entities-enabled.js +1 -0
  67. package/dist/server/utils/is-scorecards-enabled.d.ts +3 -0
  68. package/dist/server/utils/is-scorecards-enabled.js +1 -0
  69. package/dist/server/web-server/dev-server.js +1 -1
  70. package/dist/server/web-server/routes/replay-oauth2-redirect.js +78 -33
  71. package/dist/server/workers/scorecards-worker-pool.d.ts +4 -0
  72. package/dist/server/workers/scorecards-worker-pool.js +1 -0
  73. package/dist/server/workers/scorecards-worker.d.ts +2 -0
  74. package/dist/server/workers/scorecards-worker.js +1 -0
  75. package/dist/server/workers/types.d.ts +6 -0
  76. package/package.json +8 -8
@@ -1,3 +1,3 @@
1
- import*as d from"path";import{convertSwagger2OpenAPI as Y}from"@redocly/openapi-docs/lib/utils/convertSwagger2OpenAPI.js";import{bundle as Z,createConfig as oo,getTotals as no,resolvePlugins as to}from"@redocly/openapi-core";import{normalizeOptions as io,OpenAPIParser as eo,buildContentItems as ro}from"@redocly/openapi-docs";import{combineUrls as x}from"@redocly/theme/core/utils";import{CONFIG_FILE_NAME as F}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as R}from"../../constants/common.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as ao}from"../../constants/plugins/openapi-docs.js";import{unique as so}from"../../../utils/array/unique.js";import{deepMerge as N}from"../../../utils/object/deep-merge.js";import{pluralize as v}from"../../../utils/string/pluralize.js";import{replaceEnvVariablesDeep as co}from"../../utils/envs/replace-env-variables-deep.js";import{logger as L}from"../../tools/notifiers/logger.js";import{reporter as b}from"../../tools/notifiers/reporter.js";import{injectDecoratorIntoConfig as fo}from"./decorators.js";import{getAllApiConfigsByPath as lo}from"../get-api-config.js";import{normalizeFeedbackOptions as po}from"./utils.js";import{replaceFileExtension as M}from"./store-definition-bundles.js";import{ExternalResolver as uo}from"../../fs/utils/external-ref-resolver.js";async function Ao(o,u){const{fs:e,cache:O,getConfig:g,isPathIgnored:m}=u;if(d.posix.basename(o)===F)return[];let a;try{a=(await O.load(o,"yaml")).data}catch{return[]}if(!a?.openapi&&!a?.swagger)return L.verbose(`${o} file is not definition. Skipping`),[];const p=await g("."),s=await e.getFileInfo(o),n=await g(d.posix.dirname(o)),T=lo(n?.apis,o,n.configPath),E=[],U=await m(o);for(const c of T){if(!c.output&&U)continue;const V=N({decorators:p.decorators},n,{rbac:void 0},c),{resolvedObj:r}=co(V);if(r.decorators&&typeof r.decorators!="object"){await b.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof r.decorators}'`);continue}if(r.plugins&&!Array.isArray(r.plugins)){await b.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof r.plugins}'`);continue}const z=n.configPath?d.posix.dirname(n.configPath):".",t=c.output?d.posix.join(z,c.output):o;if(await m(t))continue;s&&c.output&&!await e.exists(t)&&e.addVirtualFile(t,s);const G=d.resolve(e.cwd,n.realConfigPath||F),S=new uo(e),C=await oo(fo(r,t),{configPath:G,externalRefResolver:S});p.plugins&&p.configPath!==n.configPath&&(C.plugins=so([...C.plugins||[],...await to(p.plugins,e.cwd)],f=>f.id));const D=d.resolve(e.cwd,o),J={config:C,base:d.dirname(D),doc:{source:{absoluteRef:D},parsed:JSON.parse(JSON.stringify(a))},externalRefResolver:S},{bundle:{parsed:y},problems:_,visitorsData:q}=await Z(J),H=q["markdown/markdown"]?.markdocChunks??[],i=no(_);let j=[i.errors&&`${i.errors} ${v(i.errors,"error","errors")}`,i.warnings&&`${i.warnings} ${v(i.warnings,"warning","warnings")}`,i.ignored&&`${i.ignored} ignored`].filter(Boolean).join(", ");if(i.errors){const f=_.filter(l=>l.severity==="error");let $=`${j} while bundling ${t} definition:
2
- `;const P=Math.min(f.length,ao);for(let l=0;l<P;l++){const B=f[l];$+=`${B.message} at ${B.location?.[0]?.pointer??""}
3
- `}if(f.length>P){const l=f.length-P;$+=`... and ${l} more ${v(l,"error","errors")}`}await b.panicOnBuild($)}i.warnings&&L.warn(`${j} while bundling %rp definition`,t);const w=mo(y.swagger!==void 0?await Y(y):y,n.metadata),h=N(p.openapi||{},n.openapi||{},c.openapi||c?.theme?.openapi||{});h.showSchemaCatalogLinks&&(w["x-schema-catalog-link"]=x(R,t));const X=w["x-feedback"]||h.feedback||n.feedback,A={...h,feedback:po(X),hideSidebar:!0,disableRouter:!0,mockServer:r?.mockServer||p?.mockServer,downloadUrls:h.downloadUrls||[{url:x(R,`${M(t,".json")}?download`)},{url:x(R,`${M(t,".yaml")}?download`)}]},I=io(A);let k;try{k=new eo(w,void 0,I)}catch(f){await b.panicOnBuild(f);continue}const{contentItems:K,flatItems:Q}=ro(k,I),W={definition:w,config:r,relativePath:t,realRelativePath:s?.realRelativePath||t,customOutputRelativeFile:c.output&&t,markdocChunks:H,contentItems:K,flatItems:Q,options:I,rawOptions:A,parser:k};E.push(W)}return E}async function Bo(o,u){const{fs:e,cache:O,getConfig:g}=u,m=[];for(const a of await e.scan(/(\.ya?ml|\.json)$/)){if(!await g(d.posix.dirname(a.relativePath)))continue;const s=await O.load(a.relativePath,"load-oas");s.data&&s.data.length&&m.push(...s.data.map(n=>({...n,isVirtual:a.isVirtual||n.isVirtual,hash:s.compoundHash})))}return m}function mo(o,u){return u?{...o,info:{...o.info,"x-metadata":{...o.info["x-metadata"],...u}}}:o}export{Ao as definitionLoader,Bo as definitionsLoader};
1
+ import*as l from"path";import{convertSwagger2OpenAPI as oo}from"@redocly/openapi-docs/lib/utils/convertSwagger2OpenAPI.js";import{Source as no,bundle as ro,createConfig as to,getTotals as io,resolvePlugins as eo}from"@redocly/openapi-core";import{normalizeOptions as ao,OpenAPIParser as so,buildContentItems as co}from"@redocly/openapi-docs";import{combineUrls as E}from"@redocly/theme/core/utils";import{CONFIG_FILE_NAME as A}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as P}from"../../constants/common.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as fo}from"../../constants/plugins/openapi-docs.js";import{unique as lo}from"../../../utils/array/unique.js";import{deepMerge as F}from"../../../utils/object/deep-merge.js";import{pluralize as R}from"../../../utils/string/pluralize.js";import{replaceEnvVariablesDeep as po}from"../../utils/envs/replace-env-variables-deep.js";import{logger as N}from"../../tools/notifiers/logger.js";import{reporter as b}from"../../tools/notifiers/reporter.js";import{injectDecoratorIntoConfig as uo}from"./decorators.js";import{getAllApiConfigsByPath as mo}from"../get-api-config.js";import{normalizeFeedbackOptions as go}from"./utils.js";import{replaceFileExtension as L}from"./store-definition-bundles.js";import{ExternalResolver as wo}from"../../fs/utils/external-ref-resolver.js";import{formatBundleError as ho}from"./format-bundle-error.js";async function Mo(o,u){const{fs:t,cache:O,getConfig:g,isPathIgnored:m}=u;if(l.posix.basename(o)===A)return[];let a;try{a=(await O.load(o,"yaml")).data}catch{return[]}if(!a?.openapi&&!a?.swagger)return N.verbose(`${o} file is not definition. Skipping`),[];const p=await g("."),s=await t.getFileInfo(o),n=await g(l.posix.dirname(o)),M=mo(n?.apis,o,n.configPath),S=[],T=await m(o);for(const c of M){if(!c.output&&T)continue;const U=F({decorators:p.decorators},n,{rbac:void 0},c),{resolvedObj:e}=po(U);if(e.decorators&&typeof e.decorators!="object"){await b.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof e.decorators}'`);continue}if(e.plugins&&!Array.isArray(e.plugins)){await b.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof e.plugins}'`);continue}const V=n.configPath?l.posix.dirname(n.configPath):".",r=c.output?l.posix.join(V,c.output):o;if(await m(r))continue;s&&c.output&&!await t.exists(r)&&t.addVirtualFile(r,s);const z=l.resolve(t.cwd,n.realConfigPath||A),v=new wo(t),C=await to(uo(e,r),{configPath:z,externalRefResolver:v});p.plugins&&p.configPath!==n.configPath&&(C.plugins=lo([...C.plugins||[],...await eo(p.plugins,t.cwd)],f=>f.id));const D=l.resolve(t.cwd,o),G=await t.read(o),J={config:C,base:l.dirname(D),doc:{source:new no(D,G),parsed:JSON.parse(JSON.stringify(a))},externalRefResolver:v},{bundle:{parsed:y},problems:B,visitorsData:q}=await ro(J),H=q["markdown/markdown"]?.markdocChunks??[],i=io(B);let _=[i.errors&&`${i.errors} ${R(i.errors,"error","errors")}`,i.warnings&&`${i.warnings} ${R(i.warnings,"warning","warnings")}`,i.ignored&&`${i.ignored} ignored`].filter(Boolean).join(", ");if(i.errors){const f=B.filter(d=>d.severity==="error");let $=`${_} while bundling ${r} definition:
2
+ `;const x=Math.min(f.length,fo);for(let d=0;d<x;d++){const Y=f[d],Z=await ho(Y,t.cwd);$+=`${Z}
3
+ `}if(f.length>x){const d=f.length-x;$+=`... and ${d} more ${R(d,"error","errors")}`}await b.panicOnBuild($)}i.warnings&&N.warn(`${_} while bundling %rp definition`,r);const w=bo(y.swagger!==void 0?await oo(y):y,n.metadata),h=F(p.openapi||{},n.openapi||{},c.openapi||c?.theme?.openapi||{});h.showSchemaCatalogLinks&&(w["x-schema-catalog-link"]=E(P,r));const X=w["x-feedback"]||h.feedback||n.feedback,j={...h,feedback:go(X),hideSidebar:!0,disableRouter:!0,mockServer:e?.mockServer||p?.mockServer,downloadUrls:h.downloadUrls||[{url:E(P,`${L(r,".json")}?download`)},{url:E(P,`${L(r,".yaml")}?download`)}]},I=ao(j);let k;try{k=new so(w,void 0,I)}catch(f){await b.panicOnBuild(f);continue}const{contentItems:K,flatItems:Q}=co(k,I),W={definition:w,config:e,relativePath:r,realRelativePath:s?.realRelativePath||r,customOutputRelativeFile:c.output&&r,markdocChunks:H,contentItems:K,flatItems:Q,options:I,rawOptions:j,parser:k};S.push(W)}return S}async function To(o,u){const{fs:t,cache:O,getConfig:g}=u,m=[];for(const a of await t.scan(/(\.ya?ml|\.json)$/)){if(!await g(l.posix.dirname(a.relativePath)))continue;const s=await O.load(a.relativePath,"load-oas");s.data&&s.data.length&&m.push(...s.data.map(n=>({...n,isVirtual:a.isVirtual||n.isVirtual,hash:s.compoundHash})))}return m}function bo(o,u){return u?{...o,info:{...o.info,"x-metadata":{...o.info["x-metadata"],...u}}}:o}export{Mo as definitionLoader,To as definitionsLoader};
@@ -1 +1 @@
1
- import g from"node:path";import{REDOCLY_TEAMS_RBAC as h}from"@redocly/config";import{slash as S}from"../../../utils/path/slash.js";import{staticDataLoader as w}from"./loaders/static-data-loader.js";import{findFrontmatterSlugs as y,getSidebarSharedDataId as P,resolveFrontmatterSlugs as b}from"../utils.js";import{reactFrontmatterLoader as v}from"./loaders/react-frontmatter-loader.js";import{registerPageProps as D}from"../register-page-props.js";import{telemetryTraceStep as F}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as R}from"./search/search-resolver.js";async function j(){return{loaders:{"react-frontmatter":v},id:"react-pages",requiredEntitlements:["reactPages"],processContent:async(r,a)=>{await F("build.plugin.pages",async()=>{const{fs:o,cache:f}=a;for(const d of await o.scan(/\.page\.tsx?$/)){const{relativePath:t,realRelativePath:l}=d;if(await a.isPathIgnored(t))continue;const p=r.createTemplate(S(t),g.resolve(o.cwd,l));await D(d,o,r);const{data:e}=await f.load(t,"react-frontmatter"),u=await y(t,"react-frontmatter",e,a),s=b(u,t);let i=null;e?.sidebar&&(i=await P(e.sidebar,t,a.fs)),(s.length?s.reverse():[void 0]).forEach(n=>{r.addRoute({slug:n,templateId:p,fsPath:t,sharedData:i?[{id:i,key:"sidebar"}]:void 0,[h]:e?.rbac,getNavText:async()=>e?.seo?.title,getStaticData:async(m,c)=>({props:await w({frontmatter:e,relativePath:t},a,c)}),getSearchDocuments:R(e,t,r.getSearchFacets,r.setSearchFacets)})});for(const[n,{to:m,type:c}]of Object.entries(e?.redirects||{}))r.addRedirect(n,{to:m||s[0],type:c||301})}})}}}export{j as customPagesPlugin};
1
+ import g from"node:path";import{REDOCLY_TEAMS_RBAC as h}from"@redocly/config";import{slash as S}from"../../../utils/path/slash.js";import{staticDataLoader as w}from"./loaders/static-data-loader.js";import{findFrontmatterSlugs as y,getSidebarSharedDataId as P,resolveFrontmatterSlugs as b}from"../utils.js";import{reactFrontmatterLoader as F}from"./loaders/react-frontmatter-loader.js";import{registerPageProps as v}from"../register-page-props.js";import{telemetryTraceStep as D}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as R}from"./search/search-resolver.js";async function j(){return{loaders:{"react-frontmatter":F},id:"react-pages",requiredEntitlements:["reactPages"],processContent:async(r,a)=>{await D("build.plugin.pages",async()=>{const{fs:o,cache:f}=a;for(const n of await o.scan(/\.page\.tsx?$/)){const{relativePath:e,realRelativePath:l}=n;if(await a.isPathIgnored(e))continue;const p=r.createTemplate(S(e),g.resolve(o.cwd,l));await v(n,o,r);const{data:t}=await f.load(e,"react-frontmatter"),u=await y(e,"react-frontmatter",t,a),s=b(u,e);let i=null;t?.sidebar&&(i=await P(t.sidebar,e,a.fs)),(s.length?s.reverse():[void 0]).forEach(c=>{r.addRoute({excludeFromSearch:t?.excludeFromSearch||!1,slug:c,templateId:p,fsPath:e,sharedData:i?[{id:i,key:"sidebar"}]:void 0,[h]:t?.rbac,getNavText:async()=>t?.seo?.title,getStaticData:async(m,d)=>({props:await w({frontmatter:t,relativePath:e},a,d)}),getSearchDocuments:R(t,e,r.getSearchFacets,r.setSearchFacets)})});for(const[c,{to:m,type:d}]of Object.entries(t?.redirects||{}))r.addRedirect(c,{to:m||s[0],type:d||301})}})}}}export{j as customPagesPlugin};
@@ -1 +1 @@
1
- import{writeFileSync as E}from"node:fs";import R from"path";import{SCORECARD_OUTPUT_FILE_NAME as L}from"../../constants/common.js";import{mapObject as h}from"../../../utils/object/map-object.js";import{readEnvVariable as P}from"../../utils/envs/read-env-variable.js";import{removeLeadingSlash as T}from"../../../utils/url/remove-leading-slash.js";import{combineUrls as y}from"@redocly/theme/core/utils";import{logger as _}from"../../tools/notifiers/logger.js";import{ensureDir as b}from"../../utils/index.js";import{getTemplatePath as A}from"./get-template-path.js";import{getAllRuleNames as F}from"./lint.js";import{getScorecardConfig as O}from"./get-scorecard-config.js";import{CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as j}from"../catalog-classic/index.js";import{getScorecardSlug as w}from"./shared-utils.js";import{scorecardConfigLoader as N}from"./loaders/scorecard-config.js";import{scorecardLoader as U}from"./loaders/scorecard.js";import{computeScorecard as q}from"./compute-scorecard.js";import{telemetryTraceStep as M}from"../../../cli/telemetry/helpers/trace-step.js";const k="scorecardClassic";async function ae({id:D,requiredEntitlements:I,loadersPrefix:p=""}){let d=null,S=null,v=!1;return{id:D??"scorecardClassic",requiredEntitlements:I??["scorecard"],loaders:{[`${p}scorecard-config`]:N,[`${p}scorecard`]:U},async processContent(t,i){await M("build.plugin.scorecard_classic",async u=>{const g=t.createTemplate(k,A("./template/index.js")),l=await i.getConfig(),a=O(l);u?.setAttribute("config",JSON.stringify(a||{}));const m=l?.reunite??{},s=l.catalogClassic??{},c=a.levels||[];if(c.length<1)throw Error("Invalid configuration of levels config");d===null&&(d=await q({actions:t,context:i,scorecardConfig:a,reuniteConfig:m}));const{data:{configs:e}}=await i.cache.load("",`${p}scorecard-config`),{perLevel:n,all:C}=F(e);S={levelNames:c.map(o=>o.name),rules:C,rulesPerLevel:n};for(const[o,r]of Object.entries(s)){const f=y(r.slug,"scorecard/");t.addRoute({duplicateInAllLocales:!0,slug:f,fsPath:y(r.slug,"scorecard/"),templateId:g,hasClientRoutes:!0,excludeFromSidebar:!0,serverPropsGetterIds:[j],sharedData:[{id:"scorecard",key:"scorecard"},{key:"catalog",id:"catalog-"+o}],getNavText:()=>Promise.resolve(r.title||"API design scorecard"),getStaticData:async()=>({props:{catalogId:o,catalogConfig:{...r,items:void 0},scorecardConfig:a,scorecardInfo:S}})})}})},afterRoutesCreated:async(t,{getConfig:i})=>{const u=await i(),g=u.catalogClassic??{},l=O(u);if(Object.keys(g).length){const s={};for(const[c,e]of Object.entries(d||{})){const n=t.getRouteByFsPath(c),C=y(Object.values(g)[0].slug,"scorecard/"),o=t.getRouteByFsPath(c)?.slug;if(o&&(n&&!l.ignoreMetadata&&(n.metadata={...n.metadata,scorecardStatus:e.status,scorecardLevel:e.scorecardLevel,scorecardLevelIdx:e.scorecardLevelIdx,scorecardLevels:h(e.levels,r=>({uniqueErrors:r.uniqueErrors,uniqueWarnings:r.uniqueWarnings})),scoreCardSlug:C+"apis/"+encodeURIComponent(T(o))}),s[o]={...e,levels:h(e.levels,r=>({...r,problems:r.problems.map(f=>({ruleId:f.ruleId,severity:f.severity}))}))},!v)){const r=R.resolve(t.outdir,"_scorecard",w(o));E(b(r),JSON.stringify(e))}}await t.createSharedData("scorecard",s)}const a={};for(const[s,c]of Object.entries(d||{})){const e=t.getRouteByFsPath(s)?.slug;e&&(a[e]=c)}const m=P("REDOCLY_METADATA_OUTPUT_FOLDER");!v&&m&&(_.info("Writing scorecard data..."),E(R.join(m,L),JSON.stringify({scorecardData:a,...S}))),v=!0}}}export{ae as scorecardClassicPlugin};
1
+ import{writeFileSync as E}from"node:fs";import R from"path";import{SCORECARD_OUTPUT_FILE_NAME as L}from"../../constants/common.js";import{mapObject as h}from"../../../utils/object/map-object.js";import{readEnvVariable as P}from"../../utils/envs/read-env-variable.js";import{removeLeadingSlash as _}from"../../../utils/url/remove-leading-slash.js";import{combineUrls as y}from"@redocly/theme/core/utils";import{logger as b}from"../../tools/notifiers/logger.js";import{getRouteSlugToCatalogSlugMap as A}from"../../utils/catalog-classic/get-route-slug-to-catalog-slug-map.js";import{ensureDir as j}from"../../utils/index.js";import{getTemplatePath as w}from"./get-template-path.js";import{getAllRuleNames as F}from"./lint.js";import{getScorecardConfig as D}from"./get-scorecard-config.js";import{CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as N}from"../catalog-classic/index.js";import{getScorecardSlug as U}from"./shared-utils.js";import{scorecardConfigLoader as M}from"./loaders/scorecard-config.js";import{scorecardLoader as k}from"./loaders/scorecard.js";import{computeScorecard as q}from"./compute-scorecard.js";import{telemetryTraceStep as W}from"../../../cli/telemetry/helpers/trace-step.js";const B="scorecardClassic";async function le({id:T,requiredEntitlements:I,loadersPrefix:S=""}){let m=null,C=null,v=!1;return{id:T??"scorecardClassic",requiredEntitlements:I??["scorecard"],loaders:{[`${S}scorecard-config`]:M,[`${S}scorecard`]:k},async processContent(t,l){await W("build.plugin.scorecard_classic",async f=>{const a=t.createTemplate(B,w("./template/index.js")),g=await l.getConfig(),c=D(g);f?.setAttribute("config",JSON.stringify(c||{}));const p=g?.reunite??{},i=g.catalogClassic??{},s=c.levels||[];if(s.length<1)throw Error("Invalid configuration of levels config");m===null&&(m=await q({actions:t,context:l,scorecardConfig:c,reuniteConfig:p}));const{data:{configs:n}}=await l.cache.load("",`${S}scorecard-config`),{perLevel:o,all:d}=F(n);C={levelNames:s.map(r=>r.name),rules:d,rulesPerLevel:o};for(const[r,e]of Object.entries(i)){const u=y(e.slug,"scorecard/");t.addRoute({duplicateInAllLocales:!0,slug:u,fsPath:y(e.slug,"scorecard/"),templateId:a,hasClientRoutes:!0,excludeFromSidebar:!0,serverPropsGetterIds:[N],sharedData:[{id:"scorecard",key:"scorecard"},{key:"catalog",id:"catalog-"+r}],getNavText:()=>Promise.resolve(e.title||"API design scorecard"),getStaticData:async()=>({props:{catalogId:r,catalogConfig:{...e,items:void 0},scorecardConfig:c,scorecardInfo:C}})})}})},afterRoutesCreated:async(t,l)=>{const f=await l.getConfig(),a=f.catalogClassic??{},g=D(f);if(Object.keys(a).length){const i=Object.keys(a).length>1?await A(t,l,a):null,s={};for(const[n,o]of Object.entries(m||{})){const d=t.getRouteByFsPath(n),r=d?.slug;if(r){if(d&&!g.ignoreMetadata){const e=i?i.get(r)??Object.values(a)[0].slug:Object.values(a)[0].slug,u=y(e,"scorecard/");d.metadata={...d.metadata,scorecardStatus:o.status,scorecardLevel:o.scorecardLevel,scorecardLevelIdx:o.scorecardLevelIdx,scorecardLevels:h(o.levels,O=>({uniqueErrors:O.uniqueErrors,uniqueWarnings:O.uniqueWarnings})),scoreCardSlug:u+"apis/"+encodeURIComponent(_(r))}}if(s[r]={...o,levels:h(o.levels,e=>({...e,problems:e.problems.map(u=>({ruleId:u.ruleId,severity:u.severity}))}))},!v){const e=R.resolve(t.outdir,"_scorecard",U(r));E(j(e),JSON.stringify(o))}}}await t.createSharedData("scorecard",s)}const c={};for(const[i,s]of Object.entries(m||{})){const n=t.getRouteByFsPath(i)?.slug;n&&(c[n]=s)}const p=P("REDOCLY_METADATA_OUTPUT_FOLDER");!v&&p&&(b.info("Writing scorecard data..."),E(R.join(p,L),JSON.stringify({scorecardData:c,...C}))),v=!0}}}export{le as scorecardClassicPlugin};
@@ -0,0 +1,2 @@
1
+ export declare function runScorecardsWorker(baseDbDir: string): Promise<void>;
2
+ //# sourceMappingURL=run-scorecards-worker.d.ts.map
@@ -0,0 +1 @@
1
+ import{SCORECARDS_WORKER_KEY as n,scorecardsWorker as i}from"../../../workers/scorecards-worker-pool.js";import{logger as r}from"../../../tools/notifiers/logger.js";const c=5;async function t(s,e){try{const o=await i.exec(n,[{baseDbDir:s,pollingIntervalMs:parseInt(process.env.SCORECARDS_POLLING_INTERVAL_MS||"3000",10)}]);return o.success?r.info(`${o.message}`):r.error(`Scorecards Worker error (attempt ${e}/${c}):`,o.error),Promise.resolve()}catch(o){r.error(`Scorecards Worker execution failed (attempt ${e}/${c}):`,o)}return e<c?(r.info(`Retrying Scorecards Worker (attempt ${e+1}/${c})...`),t(s,e+1)):(r.error(`All ${c} attempts failed. Scorecards Worker could not be started.`),Promise.resolve())}async function l(s){return r.info("Starting continuous Scorecards Worker..."),t(s,1)}export{l as runScorecardsWorker};
@@ -0,0 +1,14 @@
1
+ export type ScorecardsWorkerParams = {
2
+ baseDbDir: string;
3
+ pollingIntervalMs?: number;
4
+ };
5
+ export type ScorecardsWorkerResponse = {
6
+ success: true;
7
+ message: string;
8
+ } | {
9
+ success: false;
10
+ message: string;
11
+ error: string;
12
+ };
13
+ export declare function startScorecardsWorker(params: ScorecardsWorkerParams): Promise<ScorecardsWorkerResponse>;
14
+ //# sourceMappingURL=scorecards.d.ts.map
@@ -0,0 +1 @@
1
+ import{logger as o}from"../../../tools/notifiers/logger.js";import{loadEnvVariables as l}from"../../../utils/envs/load-env-variables.js";import{CatalogEntitiesService as d}from"../../../plugins/catalog-entities/database/catalog-entities-service.js";const u=3e3;async function y(s){try{const{baseDbDir:r,pollingIntervalMs:a=u}=s;l(r),o.verbose(`Initializing Scorecards Worker: polling interval ${a}ms (${a/1e3}s)`);const t=await d.getInstance({baseDbDir:r});return g(t,a),{success:!0,message:"Scorecards Worker started successfully"}}catch(r){const a=r instanceof Error?r.message:String(r);return o.error("Failed to start Scorecards Worker:",r),{success:!1,message:"Failed to start Scorecards Worker",error:a}}}async function g(s,r){let a=0,t=null;return t=setInterval(n,r),new Promise(()=>{});async function c(e){return e&&(await s.updateEntityScorecardsStatus(e.id,"CALCULATING"),await new Promise(i=>{setTimeout(async()=>{i()},1)}),await s.updateEntityScorecardsStatusIfCalculating(e.id,"UP_TO_DATE")?o.verbose(`Catalog Entity (${e.key}) scorecard evaluation completed successfully`):(await s.updateEntityScorecardsStatus(e.id,"OUTDATED"),o.verbose(`Catalog Entity (${e.key}) was updated during calculation, scorecard evaluation in not applicable anymore`))),Promise.resolve()}async function n(){try{a++;const e=await s.getOutdatedEntity();if(!e)return t||(o.verbose(`\u{1F50D} Resuming normal polling interval ${r}ms (${r/1e3}s)`),t=setInterval(n,r)),Promise.resolve();o.verbose(`\u{1F50D} Poll #${a} in Scorecards Worker: found Catalog Entity (${e.key}) for scorecard evaluation`),t&&(clearInterval(t),t=null,o.verbose(`\u{1F50D} Stopping normal polling while processing Catalog Entity (${e.key}) for scorecard evaluation`)),await c(e),await n()}catch(e){o.error("Error during poll in Scorecards Worker:",e),t||(t=setInterval(n,r))}}}export{y as startScorecardsWorker};
@@ -1 +1 @@
1
- import p from"node:path";import{existsSync as b}from"node:fs";import{writeFile as h,access as v,rm as N,constants as X}from"fs/promises";import{REDOCLY_ROUTE_RBAC as S,REDOCLY_TEAMS_RBAC as x}from"@redocly/config";import $ from"picomatch";import{DEFAULT_LOCALE_PLACEHOLDER as _}from"../../../../constants/common.js";import{AI_INDEX_EXPORT_FOLDER as j}from"../../../constants/plugins/search.js";import{LLMS_TXT_FILE_NAME as k}from"../../../constants/common.js";import{isBuildMode as B}from"../../../utils/envs/is-build-mode.js";import{logger as a}from"../../../tools/notifiers/logger.js";import{shaHexShort as G}from"../../../utils/crypto/sha-hex-short.js";import{promiseMapLimit as M}from"../../../utils/async/promise-map-limit.js";import{ensureDir as A}from"../../../utils/fs.js";import{isResourcePubliclyAccessible as H,extractTeamsForSearch as U,getRbacTeamsForSearch as Y}from"../../../utils/rbac.js";import{validateLLMsTxtConfig as J,generateLLMsTxt as K,getLLMsTxtMdSlug as V}from"../llmstxt/index.js";const P=20,R="llms.txt:";async function pt(t,o,{aiSearchEnabled:e,llmstxtEnabled:r}){const s=p.join(t.outdir,k);if(!r){try{await v(s,X.W_OK),await N(s)}catch{}if(!e)return}e&&a.info("Preparing AI search documents..."),r&&a.info(`${R} Generating llms.txt files...`);const L=a.startTiming(),c=a.startTiming(),f=t.getGlobalConfig("seo"),l=f?.llmstxt,T=p.resolve(t.outdir,j),u=t.getConfig(),w=u.rbac??{},C=t.getAllRoutes(),F=u?.l10n?.defaultLocale||u?.i18n?.defaultLocale||_,O=(l?.excludeFiles||[]).map(i=>$(i)),d=[];if(await M(C,P,async i=>{const y=await W(i,t),D=await q(i,y,o,t);if(D){if(r)for(const n of await D.getLLMsTxts()){if(O.some(m=>m(n.fsPath)))continue;const g=p.join(t.outdir,V(n.slug));A(g),await h(g,n.content),n.includeInLLMsTxt&&H(i,u)&&d.push(n)}if(e&&B()){const n=await D.getSearchDocuments();if(!n.length)return;const g=z(i,w),m=i.versions?.find(({active:I})=>I),E=m&&{folder:m.folderId,label:m.label,default:m.default};await Q(n,i.fsPath,g,T,F,E)}}}),e&&a.infoTime(c,"AI search documents prepared"),d.length)try{J(l);const i=await K(d,l,{title:f?.title,description:f?.description},o);A(s),await h(s,i),a.infoTime(L,`${R} files generated`)}catch(i){a.error(`${R} Failed to generate llms.txt file. ${i.message}`)}}async function W(t,o){return t.getStaticData?t.getStaticData(t,{...o,contentDir:o.contentDir,parseMarkdoc:(e,r,s)=>o.parseMarkdoc(e,r,s)}):{}}async function q(t,o,e,r){if(t.getAiDocumentsStore)return t.getAiDocumentsStore(t,{...o,[x]:t[x],[S]:t[S]},e,r)}function z(t,o){const e=U(t?.[x]);return e?.length?e:Y(t,o)}async function Q(t,o,e,r,s,L){await M(t,P,async c=>{const f=`${G(o+c.content)}.json`,l=A(p.join(r,f)),T=c.locale===_?s:c.locale;b(l)||await h(l,JSON.stringify({...c,rbacTeams:e||[],version:L,locale:T}),"utf-8")})}export{pt as prepareAiSearchDocuments};
1
+ import p from"node:path";import{existsSync as b}from"node:fs";import{writeFile as x,access as v,rm as N,constants as X}from"fs/promises";import{REDOCLY_ROUTE_RBAC as S,REDOCLY_TEAMS_RBAC as D}from"@redocly/config";import $ from"picomatch";import{DEFAULT_LOCALE_PLACEHOLDER as _}from"../../../../constants/common.js";import{AI_INDEX_EXPORT_FOLDER as j}from"../../../constants/plugins/search.js";import{LLMS_TXT_FILE_NAME as k}from"../../../constants/common.js";import{isBuildMode as B}from"../../../utils/envs/is-build-mode.js";import{logger as a}from"../../../tools/notifiers/logger.js";import{shaHexShort as G}from"../../../utils/crypto/sha-hex-short.js";import{promiseMapLimit as M}from"../../../utils/async/promise-map-limit.js";import{ensureDir as A}from"../../../utils/fs.js";import{isResourcePubliclyAccessible as H,extractTeamsForSearch as U,getRbacTeamsForSearch as Y}from"../../../utils/rbac.js";import{validateLLMsTxtConfig as J,generateLLMsTxt as K,getLLMsTxtMdSlug as V}from"../llmstxt/index.js";const P=20,R="llms.txt:";async function pt(t,i,{aiSearchEnabled:e,llmstxtEnabled:r}){const s=p.join(t.outdir,k);if(!r){try{await v(s,X.W_OK),await N(s)}catch{}if(!e)return}e&&a.info("Preparing AI search documents..."),r&&a.info(`${R} Generating llms.txt files...`);const L=a.startTiming(),c=a.startTiming(),f=t.getGlobalConfig("seo"),l=f?.llmstxt,T=p.resolve(t.outdir,j),u=t.getConfig(),w=u.rbac??{},C=t.getAllRoutes(),F=u?.l10n?.defaultLocale||u?.i18n?.defaultLocale||_,O=(l?.excludeFiles||[]).map(o=>$(o)),d=[];if(await M(C,P,async o=>{if(o.excludeFromSearch)return;const y=await W(o,t),h=await q(o,y,i,t);if(h){if(r)for(const n of await h.getLLMsTxts()){if(O.some(m=>m(n.fsPath)))continue;const g=p.join(t.outdir,V(n.slug));A(g),await x(g,n.content),n.includeInLLMsTxt&&H(o,u)&&d.push(n)}if(e&&B()){const n=await h.getSearchDocuments();if(!n.length)return;const g=z(o,w),m=o.versions?.find(({active:I})=>I),E=m&&{folder:m.folderId,label:m.label,default:m.default};await Q(n,o.fsPath,g,T,F,E)}}}),e&&a.infoTime(c,"AI search documents prepared"),d.length)try{J(l);const o=await K(d,l,{title:f?.title,description:f?.description},i);A(s),await x(s,o),a.infoTime(L,`${R} files generated`)}catch(o){a.error(`${R} Failed to generate llms.txt file. ${o.message}`)}}async function W(t,i){return t.getStaticData?t.getStaticData(t,{...i,contentDir:i.contentDir,parseMarkdoc:(e,r,s)=>i.parseMarkdoc(e,r,s)}):{}}async function q(t,i,e,r){if(t.getAiDocumentsStore)return t.getAiDocumentsStore(t,{...i,[D]:t[D],[S]:t[S]},e,r)}function z(t,i){const e=U(t?.[D]);return e?.length?e:Y(t,i)}async function Q(t,i,e,r,s,L){await M(t,P,async c=>{const f=`${G(i+c.content)}.json`,l=A(p.join(r,f)),T=c.locale===_?s:c.locale;b(l)||await x(l,JSON.stringify({...c,rbacTeams:e||[],version:L,locale:T}),"utf-8")})}export{pt as prepareAiSearchDocuments};
@@ -1 +1 @@
1
- import{REDOCLY_ROUTE_RBAC as D,REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{existsSync as _}from"fs";import{rm as w}from"node:fs/promises";import{DEFAULT_LOCALE_PLACEHOLDER as x}from"../../../../constants/common.js";import{SEARCH_DATA_EXPORT_FOLDER as T}from"../../../constants/plugins/search.js";import{isBuildMode as h}from"../../../utils/envs/is-build-mode.js";import{logger as c}from"../../../tools/notifiers/logger.js";import{telemetry as b}from"../../../telemetry/index.js";import{extractTeamsForSearch as O,getRbacTeamsForSearch as $}from"../../../utils/index.js";import{getSearchDocumentGroup as M}from"../utils.js";async function G(S,t,f){c.info("Preparing search documents and create indexes..."),h()&&_(`${t.outdir}/${T}`)&&await w(`${t.outdir}/${T}`,{recursive:!0});const R=c.startTiming(),v=t.getConfig().rbac,F=[x,...S.localeFolders.map(s=>s.toLowerCase())];for(const s of F){const i=t.getAllRoutesForLocale(s);for(const r of i){const d=new Map,{product:n}=r,A=await r.getStaticData?.(r,{...t,contentDir:t.contentDir,parseMarkdoc:(a,e,u)=>t.parseMarkdoc(a,e,u)})||{},m=await r.getSearchDocuments?.(r,{...A,[p]:r[p],[D]:r[D]},t),o=r.versions?.find(a=>a.active),C=$(r,v??{});if(m&&m.length)for(const a in m){let e=m[a];const u=O(e?.[p]),g=u?.length?u:C,L=e.tags||[];e={...e,...o&&{version:o.version,isDefaultVersion:o.default,versionFolderId:o.folderId},...n&&{product:n},rbacTeams:g,tags:[...L,...g,...o?o.default?["v:default"]:[`v:${o.folderId}:${o.version}`]:["v:default"],...n?[`p:${n.name}`]:[]],url:e.url&&(e.path&&e.path.length>1?e.url:e.url.split("#")[0])};const l=M(e.facets);if(l){const E=d.get(l)??[];d.set(l,[...E,e])}}for(const[a,e]of d)await f.addDocuments(e,{locale:s,group:a,outDir:t.outdir})}}if(f.cleanupFacetValues(t),c.infoTime(R,"Search indexes created"),h()){c.info("Writing out search data...");const s=c.startTiming();await f.export(t.outdir);const i=c.infoTime(s,"Search data written");i&&b.sendTimingPerformedMessage(i)}}export{G as prepareSearchDocuments};
1
+ import{REDOCLY_ROUTE_RBAC as D,REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{existsSync as E}from"fs";import{rm as _}from"node:fs/promises";import{DEFAULT_LOCALE_PLACEHOLDER as w}from"../../../../constants/common.js";import{SEARCH_DATA_EXPORT_FOLDER as T}from"../../../constants/plugins/search.js";import{isBuildMode as h}from"../../../utils/envs/is-build-mode.js";import{logger as c}from"../../../tools/notifiers/logger.js";import{telemetry as b}from"../../../telemetry/index.js";import{extractTeamsForSearch as O,getRbacTeamsForSearch as $}from"../../../utils/index.js";import{getSearchDocumentGroup as M}from"../utils.js";async function G(S,t,f){c.info("Preparing search documents and create indexes..."),h()&&E(`${t.outdir}/${T}`)&&await _(`${t.outdir}/${T}`,{recursive:!0});const F=c.startTiming(),R=t.getConfig().rbac,v=[w,...S.localeFolders.map(s=>s.toLowerCase())];for(const s of v){const i=t.getAllRoutesForLocale(s);for(const r of i){if(r.excludeFromSearch)continue;const d=new Map,{product:n}=r,A=await r.getStaticData?.(r,{...t,contentDir:t.contentDir,parseMarkdoc:(a,e,u)=>t.parseMarkdoc(a,e,u)})||{},m=await r.getSearchDocuments?.(r,{...A,[p]:r[p],[D]:r[D]},t),o=r.versions?.find(a=>a.active),C=$(r,R??{});if(m&&m.length)for(const a in m){let e=m[a];const u=O(e?.[p]),g=u?.length?u:C,L=e.tags||[];e={...e,...o&&{version:o.version,isDefaultVersion:o.default,versionFolderId:o.folderId},...n&&{product:n},rbacTeams:g,tags:[...L,...g,...o?o.default?["v:default"]:[`v:${o.folderId}:${o.version}`]:["v:default"],...n?[`p:${n.name}`]:[]],url:e.url&&(e.path&&e.path.length>1?e.url:e.url.split("#")[0])};const l=M(e.facets);if(l){const x=d.get(l)??[];d.set(l,[...x,e])}}for(const[a,e]of d)await f.addDocuments(e,{locale:s,group:a,outDir:t.outdir})}}if(f.cleanupFacetValues(t),c.infoTime(F,"Search indexes created"),h()){c.info("Writing out search data...");const s=c.startTiming();await f.export(t.outdir);const i=c.infoTime(s,"Search data written");i&&b.sendTimingPerformedMessage(i)}}export{G as prepareSearchDocuments};
@@ -1 +1 @@
1
- import{SitemapStream as l,streamToPromise as p}from"sitemap";import{Readable as d}from"stream";import{writeFileSync as y}from"fs";import g from"path";import{SITEMAP_FILE_NAME as h}from"../../constants/common.js";import{ServerRoutes as w}from"../../../constants/common.js";import{withPathPrefix as P}from"@redocly/theme/core/utils";import{logger as a}from"../../tools/notifiers/logger.js";import{isResourcePubliclyAccessible as b}from"../../utils/index.js";import{telemetryTraceStep as S}from"../../../cli/telemetry/helpers/trace-step.js";async function R(t,n){if(!t)return;const r=t.endsWith(".tsx"),i=t.endsWith(".md");if(!(!r&&!i))try{const o=r?"react-frontmatter":"markdown-frontmatter",e=await n.load(t,o);return e.data.frontmatter?.seo?.priority??e.data.seo?.priority}catch{return}}async function v(t,n){const r=t.fsPath?await R(t.fsPath,n):void 0;if(typeof r=="number"){if(r>=0&&r<=1)return r;a.warn(`Invalid SEO priority value "${r}" found for route "${t.slug}". Priority must be between 0 and 1. Using default priority instead.`)}const i=t.versions?.find(o=>o.active);return i?.default||!i?.5:.3}async function $(){return{id:"sitemap",async afterRoutesCreated(t,n){await S("build.plugin.sitemap",async r=>{const{seo:i}=t.getConfig();if(r?.setAttribute("config",JSON.stringify(i||{})),!i?.siteUrl)return;const o=t.getAllRoutes().filter(e=>b(e,t.getConfig())&&!Object.keys(w).includes(e.slug));if(o.length)try{const e=g.join(t.outdir,h),m=new l({hostname:i.siteUrl}),f=await Promise.all(o.map(async s=>{const c=await v(s,n.cache);return{url:P(s.slug),priority:c}})),u=await p(d.from(f).pipe(m)).then(s=>s.toString());y(e,u),t.hasSitemap=!0}catch(e){r?.error(e),a.error(`Error creating sitemap: ${e.message}`)}})}}}export{$ as sitemapPlugin};
1
+ import{SitemapStream as l,streamToPromise as d}from"sitemap";import{Readable as p}from"stream";import{writeFileSync as y}from"fs";import g from"path";import{SITEMAP_FILE_NAME as h}from"../../constants/common.js";import{ServerRoutes as w}from"../../../constants/common.js";import{withPathPrefix as P}from"@redocly/theme/core/utils";import{logger as s}from"../../tools/notifiers/logger.js";import{isResourcePubliclyAccessible as b}from"../../utils/index.js";import{telemetryTraceStep as S}from"../../../cli/telemetry/helpers/trace-step.js";async function R(t,n){if(!t)return;const r=t.endsWith(".tsx"),i=t.endsWith(".md");if(!(!r&&!i))try{const o=r?"react-frontmatter":"markdown-frontmatter",e=await n.load(t,o);return e.data.frontmatter?.seo?.priority??e.data.seo?.priority}catch{return}}async function v(t,n){const r=t.fsPath?await R(t.fsPath,n):void 0;if(typeof r=="number"){if(r>=0&&r<=1)return r;s.warn(`Invalid SEO priority value "${r}" found for route "${t.slug}". Priority must be between 0 and 1. Using default priority instead.`)}const i=t.versions?.find(o=>o.active);return i?.default||!i?.5:.3}async function $(){return{id:"sitemap",async afterRoutesCreated(t,n){await S("build.plugin.sitemap",async r=>{const{seo:i}=t.getConfig();if(r?.setAttribute("config",JSON.stringify(i||{})),!i?.siteUrl)return;const o=t.getAllRoutes().filter(e=>!e.excludeFromSearch&&b(e,t.getConfig())&&!Object.keys(w).includes(e.slug));if(o.length)try{const e=g.join(t.outdir,h),m=new l({hostname:i.siteUrl}),c=await Promise.all(o.map(async a=>{const u=await v(a,n.cache);return{url:P(a.slug),priority:u}})),f=await d(p.from(c).pipe(m)).then(a=>a.toString());y(e,f),t.hasSitemap=!0}catch(e){r?.error(e),s.error(`Error creating sitemap: ${e.message}`)}})}}}export{$ as sitemapPlugin};
@@ -0,0 +1 @@
1
+ ALTER TABLE `entities` ADD `scorecards_status` text;
@@ -0,0 +1,385 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "94f96dc6-17d2-49ef-bc5d-ce0bc3b9da07",
5
+ "prevId": "5138f9a4-2c01-49f7-9752-fd30cc163d80",
6
+ "tables": {
7
+ "entities_relations": {
8
+ "name": "entities_relations",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "organization_id": {
18
+ "name": "organization_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "project_id": {
25
+ "name": "project_id",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "source_key": {
32
+ "name": "source_key",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "source_id": {
39
+ "name": "source_id",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "source_version": {
46
+ "name": "source_version",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": false,
50
+ "autoincrement": false
51
+ },
52
+ "source_revision": {
53
+ "name": "source_revision",
54
+ "type": "text",
55
+ "primaryKey": false,
56
+ "notNull": false,
57
+ "autoincrement": false
58
+ },
59
+ "source_to_target_relation": {
60
+ "name": "source_to_target_relation",
61
+ "type": "text",
62
+ "primaryKey": false,
63
+ "notNull": true,
64
+ "autoincrement": false
65
+ },
66
+ "target_key": {
67
+ "name": "target_key",
68
+ "type": "text",
69
+ "primaryKey": false,
70
+ "notNull": true,
71
+ "autoincrement": false
72
+ },
73
+ "target_id": {
74
+ "name": "target_id",
75
+ "type": "text",
76
+ "primaryKey": false,
77
+ "notNull": false,
78
+ "autoincrement": false
79
+ },
80
+ "target_version": {
81
+ "name": "target_version",
82
+ "type": "text",
83
+ "primaryKey": false,
84
+ "notNull": false,
85
+ "autoincrement": false
86
+ },
87
+ "target_revision": {
88
+ "name": "target_revision",
89
+ "type": "text",
90
+ "primaryKey": false,
91
+ "notNull": false,
92
+ "autoincrement": false
93
+ },
94
+ "target_to_source_relation": {
95
+ "name": "target_to_source_relation",
96
+ "type": "text",
97
+ "primaryKey": false,
98
+ "notNull": true,
99
+ "autoincrement": false
100
+ },
101
+ "source_file": {
102
+ "name": "source_file",
103
+ "type": "text",
104
+ "primaryKey": false,
105
+ "notNull": false,
106
+ "autoincrement": false
107
+ },
108
+ "file_hash": {
109
+ "name": "file_hash",
110
+ "type": "text",
111
+ "primaryKey": false,
112
+ "notNull": false,
113
+ "autoincrement": false
114
+ },
115
+ "created_at": {
116
+ "name": "created_at",
117
+ "type": "text",
118
+ "primaryKey": false,
119
+ "notNull": true,
120
+ "autoincrement": false
121
+ },
122
+ "updated_at": {
123
+ "name": "updated_at",
124
+ "type": "text",
125
+ "primaryKey": false,
126
+ "notNull": true,
127
+ "autoincrement": false
128
+ }
129
+ },
130
+ "indexes": {
131
+ "idx_entities_relations_source_key": {
132
+ "name": "idx_entities_relations_source_key",
133
+ "columns": ["source_key"],
134
+ "isUnique": false
135
+ },
136
+ "idx_entities_relations_target_key": {
137
+ "name": "idx_entities_relations_target_key",
138
+ "columns": ["target_key"],
139
+ "isUnique": false
140
+ },
141
+ "idx_entities_relations_source_target": {
142
+ "name": "idx_entities_relations_source_target",
143
+ "columns": ["source_to_target_relation"],
144
+ "isUnique": false
145
+ },
146
+ "idx_entities_relations_target_source": {
147
+ "name": "idx_entities_relations_target_source",
148
+ "columns": ["target_to_source_relation"],
149
+ "isUnique": false
150
+ },
151
+ "idx_entities_relations_unique": {
152
+ "name": "idx_entities_relations_unique",
153
+ "columns": [
154
+ "source_key",
155
+ "target_key",
156
+ "source_version",
157
+ "target_version",
158
+ "source_revision",
159
+ "target_revision"
160
+ ],
161
+ "isUnique": true
162
+ }
163
+ },
164
+ "foreignKeys": {},
165
+ "compositePrimaryKeys": {},
166
+ "uniqueConstraints": {},
167
+ "checkConstraints": {}
168
+ },
169
+ "entities": {
170
+ "name": "entities",
171
+ "columns": {
172
+ "id": {
173
+ "name": "id",
174
+ "type": "text",
175
+ "primaryKey": true,
176
+ "notNull": true,
177
+ "autoincrement": false
178
+ },
179
+ "organization_id": {
180
+ "name": "organization_id",
181
+ "type": "text",
182
+ "primaryKey": false,
183
+ "notNull": true,
184
+ "autoincrement": false
185
+ },
186
+ "project_id": {
187
+ "name": "project_id",
188
+ "type": "text",
189
+ "primaryKey": false,
190
+ "notNull": true,
191
+ "autoincrement": false
192
+ },
193
+ "key": {
194
+ "name": "key",
195
+ "type": "text",
196
+ "primaryKey": false,
197
+ "notNull": true,
198
+ "autoincrement": false
199
+ },
200
+ "type": {
201
+ "name": "type",
202
+ "type": "text",
203
+ "primaryKey": false,
204
+ "notNull": true,
205
+ "autoincrement": false
206
+ },
207
+ "title": {
208
+ "name": "title",
209
+ "type": "text",
210
+ "primaryKey": false,
211
+ "notNull": true,
212
+ "autoincrement": false
213
+ },
214
+ "summary": {
215
+ "name": "summary",
216
+ "type": "text",
217
+ "primaryKey": false,
218
+ "notNull": false,
219
+ "autoincrement": false
220
+ },
221
+ "tags": {
222
+ "name": "tags",
223
+ "type": "text",
224
+ "primaryKey": false,
225
+ "notNull": false,
226
+ "autoincrement": false
227
+ },
228
+ "metadata": {
229
+ "name": "metadata",
230
+ "type": "text",
231
+ "primaryKey": false,
232
+ "notNull": false,
233
+ "autoincrement": false
234
+ },
235
+ "git": {
236
+ "name": "git",
237
+ "type": "text",
238
+ "primaryKey": false,
239
+ "notNull": false,
240
+ "autoincrement": false
241
+ },
242
+ "contact": {
243
+ "name": "contact",
244
+ "type": "text",
245
+ "primaryKey": false,
246
+ "notNull": false,
247
+ "autoincrement": false
248
+ },
249
+ "links": {
250
+ "name": "links",
251
+ "type": "text",
252
+ "primaryKey": false,
253
+ "notNull": false,
254
+ "autoincrement": false
255
+ },
256
+ "created_at": {
257
+ "name": "created_at",
258
+ "type": "text",
259
+ "primaryKey": false,
260
+ "notNull": true,
261
+ "autoincrement": false
262
+ },
263
+ "updated_at": {
264
+ "name": "updated_at",
265
+ "type": "text",
266
+ "primaryKey": false,
267
+ "notNull": true,
268
+ "autoincrement": false
269
+ },
270
+ "source": {
271
+ "name": "source",
272
+ "type": "text",
273
+ "primaryKey": false,
274
+ "notNull": false,
275
+ "autoincrement": false,
276
+ "default": "'file'"
277
+ },
278
+ "source_file": {
279
+ "name": "source_file",
280
+ "type": "text",
281
+ "primaryKey": false,
282
+ "notNull": false,
283
+ "autoincrement": false
284
+ },
285
+ "file_hash": {
286
+ "name": "file_hash",
287
+ "type": "text",
288
+ "primaryKey": false,
289
+ "notNull": false,
290
+ "autoincrement": false
291
+ },
292
+ "version": {
293
+ "name": "version",
294
+ "type": "text",
295
+ "primaryKey": false,
296
+ "notNull": false,
297
+ "autoincrement": false
298
+ },
299
+ "revision": {
300
+ "name": "revision",
301
+ "type": "text",
302
+ "primaryKey": false,
303
+ "notNull": false,
304
+ "autoincrement": false
305
+ },
306
+ "hash": {
307
+ "name": "hash",
308
+ "type": "text",
309
+ "primaryKey": false,
310
+ "notNull": false,
311
+ "autoincrement": false
312
+ },
313
+ "is_current": {
314
+ "name": "is_current",
315
+ "type": "integer",
316
+ "primaryKey": false,
317
+ "notNull": false,
318
+ "autoincrement": false,
319
+ "default": true
320
+ },
321
+ "is_default_version": {
322
+ "name": "is_default_version",
323
+ "type": "integer",
324
+ "primaryKey": false,
325
+ "notNull": false,
326
+ "autoincrement": false,
327
+ "default": false
328
+ },
329
+ "scorecards_status": {
330
+ "name": "scorecards_status",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": false,
334
+ "autoincrement": false
335
+ }
336
+ },
337
+ "indexes": {
338
+ "idx_entities_type": {
339
+ "name": "idx_entities_type",
340
+ "columns": ["type"],
341
+ "isUnique": false
342
+ },
343
+ "idx_entities_hash": {
344
+ "name": "idx_entities_hash",
345
+ "columns": ["hash"],
346
+ "isUnique": false
347
+ },
348
+ "idx_entities_key_source_created_at": {
349
+ "name": "idx_entities_key_source_created_at",
350
+ "columns": ["key", "created_at"],
351
+ "isUnique": false
352
+ },
353
+ "idx_entities_key_source_is_current": {
354
+ "name": "idx_entities_key_source_is_current",
355
+ "columns": ["key", "is_current"],
356
+ "isUnique": false
357
+ },
358
+ "idx_entities_key_source_is_default": {
359
+ "name": "idx_entities_key_source_is_default",
360
+ "columns": ["key", "is_default_version"],
361
+ "isUnique": false
362
+ },
363
+ "idx_entities_key_source": {
364
+ "name": "idx_entities_key_source",
365
+ "columns": ["key", "source", "revision", "version"],
366
+ "isUnique": true
367
+ }
368
+ },
369
+ "foreignKeys": {},
370
+ "compositePrimaryKeys": {},
371
+ "uniqueConstraints": {},
372
+ "checkConstraints": {}
373
+ }
374
+ },
375
+ "views": {},
376
+ "enums": {},
377
+ "_meta": {
378
+ "schemas": {},
379
+ "tables": {},
380
+ "columns": {}
381
+ },
382
+ "internal": {
383
+ "indexes": {}
384
+ }
385
+ }
@@ -15,6 +15,13 @@
15
15
  "when": 1763546809074,
16
16
  "tag": "0001_catalog-versions-and-revisions",
17
17
  "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "6",
22
+ "when": 1764320034138,
23
+ "tag": "0002_add-scorecards-status",
24
+ "breakpoints": true
18
25
  }
19
26
  ]
20
27
  }
@@ -416,6 +416,25 @@ export declare const entitiesTable: import("drizzle-orm/sqlite-core").SQLiteTabl
416
416
  identity: undefined;
417
417
  generated: undefined;
418
418
  }, {}, {}>;
419
+ scorecardsStatus: import("drizzle-orm/sqlite-core").SQLiteColumn<{
420
+ name: "scorecards_status";
421
+ tableName: "entities";
422
+ dataType: "string";
423
+ columnType: "SQLiteText";
424
+ data: string;
425
+ driverParam: string;
426
+ notNull: false;
427
+ hasDefault: false;
428
+ isPrimaryKey: false;
429
+ isAutoincrement: false;
430
+ hasRuntimeDefault: false;
431
+ enumValues: [string, ...string[]];
432
+ baseColumn: never;
433
+ identity: undefined;
434
+ generated: undefined;
435
+ }, {}, {
436
+ length: number | undefined;
437
+ }>;
419
438
  };
420
439
  dialect: "sqlite";
421
440
  }>;
@@ -1 +1 @@
1
- import{sqliteTable as o,text as e,integer as n,index as t,uniqueIndex as s}from"drizzle-orm/sqlite-core";const u=o("entities",{id:e("id").primaryKey(),organizationId:e("organization_id").notNull(),projectId:e("project_id").notNull(),key:e("key").notNull(),type:e("type").notNull(),title:e("title").notNull(),summary:e("summary"),tags:e("tags"),metadata:e("metadata"),git:e("git"),contact:e("contact"),links:e("links"),createdAt:e("created_at").notNull(),updatedAt:e("updated_at").notNull(),source:e("source").default("file"),sourceFile:e("source_file"),fileHash:e("file_hash"),version:e("version"),revision:e("revision"),hash:e("hash"),isCurrent:n("is_current",{mode:"boolean"}).default(!0),isDefaultVersion:n("is_default_version",{mode:"boolean"}).default(!1)},i=>[t("idx_entities_type").on(i.type),t("idx_entities_hash").on(i.hash),t("idx_entities_key_source_created_at").on(i.key,i.createdAt),t("idx_entities_key_source_is_current").on(i.key,i.isCurrent),t("idx_entities_key_source_is_default").on(i.key,i.isDefaultVersion),s("idx_entities_key_source").on(i.key,i.source,i.revision,i.version)]);export{u as entitiesTable};
1
+ import{sqliteTable as o,text as e,integer as s,index as i,uniqueIndex as n}from"drizzle-orm/sqlite-core";const a=o("entities",{id:e("id").primaryKey(),organizationId:e("organization_id").notNull(),projectId:e("project_id").notNull(),key:e("key").notNull(),type:e("type").notNull(),title:e("title").notNull(),summary:e("summary"),tags:e("tags"),metadata:e("metadata"),git:e("git"),contact:e("contact"),links:e("links"),createdAt:e("created_at").notNull(),updatedAt:e("updated_at").notNull(),source:e("source").default("file"),sourceFile:e("source_file"),fileHash:e("file_hash"),version:e("version"),revision:e("revision"),hash:e("hash"),isCurrent:s("is_current",{mode:"boolean"}).default(!0),isDefaultVersion:s("is_default_version",{mode:"boolean"}).default(!1),scorecardsStatus:e("scorecards_status")},t=>[i("idx_entities_type").on(t.type),i("idx_entities_hash").on(t.hash),i("idx_entities_key_source_created_at").on(t.key,t.createdAt),i("idx_entities_key_source_is_current").on(t.key,t.isCurrent),i("idx_entities_key_source_is_default").on(t.key,t.isDefaultVersion),n("idx_entities_key_source").on(t.key,t.source,t.revision,t.version)]);export{a as entitiesTable};
@@ -0,0 +1,10 @@
1
+ CREATE TABLE `scorecards_config` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `slug` text NOT NULL,
4
+ `name` text NOT NULL,
5
+ `description` text,
6
+ `entities` text DEFAULT '{}' NOT NULL,
7
+ `levels` text DEFAULT '{}' NOT NULL,
8
+ `created_at` text NOT NULL,
9
+ `updated_at` text NOT NULL
10
+ );