@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.
- package/CHANGELOG.md +24 -0
- package/README.md +54 -0
- package/dist/server/esbuild/esbuild.js +2 -2
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +4 -0
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.d.ts +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +6 -6
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +4 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.d.ts +3 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/remote/catalog-entities-remote-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/utils.d.ts +2 -0
- package/dist/server/plugins/catalog-entities/database/repositories/utils.js +1 -1
- package/dist/server/plugins/catalog-entities/entities/types.d.ts +1 -0
- package/dist/server/plugins/default-theme/index.js +1 -1
- package/dist/server/plugins/markdown/index.js +1 -1
- package/dist/server/plugins/openapi-docs/format-bundle-error.d.ts +6 -0
- package/dist/server/plugins/openapi-docs/format-bundle-error.js +5 -0
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.js +3 -3
- package/dist/server/plugins/pages/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecards/workers/run-scorecards-worker.d.ts +2 -0
- package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -0
- package/dist/server/plugins/scorecards/workers/scorecards.d.ts +14 -0
- package/dist/server/plugins/scorecards/workers/scorecards.js +1 -0
- package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +1 -1
- package/dist/server/plugins/search/documents/search-documents.js +1 -1
- package/dist/server/plugins/sitemap/index.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/migrations/0002_add-scorecards-status.sql +1 -0
- package/dist/server/providers/database/databases/catalog-sqlite/migrations/meta/0002_snapshot.json +385 -0
- package/dist/server/providers/database/databases/catalog-sqlite/migrations/meta/_journal.json +7 -0
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.d.ts +19 -0
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.js +1 -1
- package/dist/server/providers/database/databases/main-sqlite/migrations/0004_add-scorecards-tables.sql +10 -0
- package/dist/server/providers/database/databases/main-sqlite/migrations/meta/0004_snapshot.json +221 -0
- package/dist/server/providers/database/databases/main-sqlite/migrations/meta/_journal.json +7 -0
- package/dist/server/providers/database/databases/main-sqlite/schemas/scorecards-config-table.d.ts +162 -0
- package/dist/server/providers/database/databases/main-sqlite/schemas/scorecards-config-table.js +1 -0
- package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
- package/dist/server/providers/database/databases/sqld-sqlite/migrations/0003_add-scorecards-tables.sql +61 -0
- package/dist/server/providers/database/databases/sqld-sqlite/migrations/0004_add-scorecards-status.sql +1 -0
- package/dist/server/providers/database/databases/sqld-sqlite/migrations/meta/0003_snapshot.json +796 -0
- package/dist/server/providers/database/databases/sqld-sqlite/migrations/meta/0004_snapshot.json +803 -0
- package/dist/server/providers/database/databases/sqld-sqlite/migrations/meta/_journal.json +14 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-evaluations-table.d.ts +124 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-evaluations-table.js +1 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-level-states-table.d.ts +48 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-level-states-table.js +1 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-levels-table.d.ts +186 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-levels-table.js +1 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-states-table.d.ts +177 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-result-states-table.js +1 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-results-table.d.ts +179 -0
- package/dist/server/providers/database/databases/sqld-sqlite/schemas/scorecard-results-table.js +1 -0
- package/dist/server/store.d.ts +1 -1
- package/dist/server/types/plugins/common.d.ts +1 -0
- package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.d.ts +19 -0
- package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.js +1 -0
- package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.d.ts +2 -0
- package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.js +1 -0
- package/dist/server/utils/is-catalog-entities-enabled.d.ts +2 -0
- package/dist/server/utils/is-catalog-entities-enabled.js +1 -0
- package/dist/server/utils/is-scorecards-enabled.d.ts +3 -0
- package/dist/server/utils/is-scorecards-enabled.js +1 -0
- package/dist/server/web-server/dev-server.js +1 -1
- package/dist/server/web-server/routes/replay-oauth2-redirect.js +78 -33
- package/dist/server/workers/scorecards-worker-pool.d.ts +4 -0
- package/dist/server/workers/scorecards-worker-pool.js +1 -0
- package/dist/server/workers/scorecards-worker.d.ts +2 -0
- package/dist/server/workers/scorecards-worker.js +1 -0
- package/dist/server/workers/types.d.ts +6 -0
- package/package.json +8 -8
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as
|
|
2
|
-
`;const
|
|
3
|
-
`}if(f.length>
|
|
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
|
|
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
|
|
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 @@
|
|
|
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
|
|
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
|
|
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
|
|
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;
|
package/dist/server/providers/database/databases/catalog-sqlite/migrations/meta/0002_snapshot.json
ADDED
|
@@ -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
|
+
}
|
|
@@ -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
|
|
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
|
+
);
|