@spotify/backstage-plugin-soundcheck-backend-module-github 0.7.13 → 0.7.14
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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var S=require("@backstage/catalog-model"),d=require("@backstage/integration"),F=require("@octokit/rest"),a=require("@spotify/backstage-plugin-soundcheck-common"),m=require("@spotify/backstage-plugin-soundcheck-node"),v=require("git-url-parse"),x=require("zod-to-json-schema"),C=require("../extractors/BranchProtectionsFactExtractor.cjs.js"),b=require("../extractors/BranchRulesFactExtractor.cjs.js"),q=require("../extractors/CodeScanningAlertsFactExtractor.cjs.js"),R=require("../extractors/config/GithubFactCollectorSchema.cjs.js"),A=require("../extractors/DependabotAlertsFactExtractor.cjs.js"),D=require("../extractors/ExtractorService.cjs.js"),T=require("../extractors/helper/BranchHelper.cjs.js"),L=require("../extractors/RepositoryDetailsFactExtractor.cjs.js"),P=require("../extractors/RepositoryLanguagesFactExtractor.cjs.js"),k=require("../extractors/SecretScanningAlertsFactExtractor.cjs.js"),w=require("../extractors/SecurityAdvisoriesFactExtractor.cjs.js"),U=require("../extractors/store/GithubExtractorsStore.cjs.js");function y(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var O=y(v),B=y(x);const G=new Set(["DependabotAlerts","SecretScanningAlerts","CodeScanningAlerts"]);class s{static ID="github";static DEFAULT_TTL=
|
|
1
|
+
"use strict";var S=require("@backstage/catalog-model"),d=require("@backstage/integration"),F=require("@octokit/rest"),a=require("@spotify/backstage-plugin-soundcheck-common"),m=require("@spotify/backstage-plugin-soundcheck-node"),v=require("git-url-parse"),x=require("zod-to-json-schema"),C=require("../extractors/BranchProtectionsFactExtractor.cjs.js"),b=require("../extractors/BranchRulesFactExtractor.cjs.js"),q=require("../extractors/CodeScanningAlertsFactExtractor.cjs.js"),R=require("../extractors/config/GithubFactCollectorSchema.cjs.js"),A=require("../extractors/DependabotAlertsFactExtractor.cjs.js"),D=require("../extractors/ExtractorService.cjs.js"),T=require("../extractors/helper/BranchHelper.cjs.js"),L=require("../extractors/RepositoryDetailsFactExtractor.cjs.js"),P=require("../extractors/RepositoryLanguagesFactExtractor.cjs.js"),k=require("../extractors/SecretScanningAlertsFactExtractor.cjs.js"),w=require("../extractors/SecurityAdvisoriesFactExtractor.cjs.js"),U=require("../extractors/store/GithubExtractorsStore.cjs.js");function y(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var O=y(v),B=y(x);const G=new Set(["DependabotAlerts","SecretScanningAlerts","CodeScanningAlerts"]);class s{static ID="github";static DEFAULT_TTL=7*24*60*60*1e3;#r;#a;#c;#e;#t;static create(r,t,c){return new s(r,t,c)}id=s.ID;name="GitHub";description="Collects facts about your GitHub repositories.";constructor(r,t,c){this.#r=t.child({target:this.id}),this.#a=d.ScmIntegrations.fromConfig(r),this.#c=d.DefaultGithubCredentialsProvider.fromIntegrations(this.#a),this.#e=D.ExtractorService.create({logger:t,cache:c.withOptions({defaultTtl:s.DEFAULT_TTL}),branchHelper:T.BranchHelper.create(this.#r,c.withOptions({defaultTtl:s.DEFAULT_TTL})),factories:[C.BranchProtectionsFactExtractor.factory,b.BranchRulesFactExtractor.factory,q.CodeScanningAlertsFactExtractor.factory,A.DependabotAlertsFactExtractor.factory,L.RepositoryDetailsFactExtractor.factory,P.RepositoryLanguagesFactExtractor.factory,k.SecretScanningAlertsFactExtractor.factory,w.SecurityAdvisoriesFactExtractor.factory]}),this.#t=U.GithubExtractorsStore.create(this.#r)}async collect(r,t){const c=t?.factRefs??this.#t.getExtractorConfigs().map(e=>a.getFactRef(this.id,e));return Promise.all(r.filter(e=>a.isScmEntity(e)).map(async e=>{const o=S.stringifyEntityRef(e),l=a.getEntityScmUrl(e),p=O.default(l),f=await this.getOctokit(l);return f?Promise.all(c.map(async u=>{const g=a.parseFactRef(u,{defaultSource:this.id,defaultScope:a.DEFAULT_SCOPE}),h=this.#t.getExtractorConfig(g.name),E=!!t?.refresh?.map(i=>a.stringifyFactRef(i))?.includes(a.stringifyFactRef(u));return this.#e.extract(h,g.scope,p,f,E).then(i=>{if(i!==void 0)return a.buildFact(o,u,i,G.has(h.type))}).catch(i=>{if(i instanceof m.RateLimitError)throw i;return this.#r.error(`Failed to collect ${a.stringifyFactRef(u)} fact data for ${o} entity: ${i.message??i}`),a.buildCollectionError(o,u,i)})})):Promise.resolve()})).then(e=>e.flat().filter(o=>!!o))}async getOctokit(r){try{const{token:t}=await this.#c.getCredentials({url:r}),c=this.#a.github.byUrl(r);return new F.Octokit({auth:t,baseUrl:c?.config.apiBaseUrl})}catch(t){this.#r.warn(`Skipping Github fact collection for url ${r}: ${t}`);return}}async getCollectionConfigs(){return a.buildCollectionConfigs(this.id,this.#t.getExtractorConfigs())}async getFactNames(){const r=this.#e.listFactTypes(),t=this.#t.getExtractorConfigs();return r.flatMap(c=>t.filter(e=>e.type===c).map(e=>e.factName??e.type)??c)}async getDataSchema(r){const t=a.parseFactRef(r,{defaultSource:this.id,defaultScope:a.DEFAULT_SCOPE}),c=this.#t.getExtractorConfigs().find(e=>{const o=a.parseFactRef(a.getFactRef(this.id,e));return t.source===o.source&&t.name===o.name});if(c)return this.#e.getDataSchema(c)}async getConfig(){return this.#t.getConfig()}async setConfig(r){this.#t.setConfig(r)}async getConfigSchema(){return JSON.stringify(B.default(R.GithubFactCollectorSchema))}}exports.GithubFactCollector=s;
|
|
2
2
|
//# sourceMappingURL=GithubFactCollector.cjs.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify/backstage-plugin-soundcheck-backend-module-github",
|
|
3
3
|
"description": "Soundcheck 3rd party integration with Github",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.14",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com",
|
|
7
7
|
"main": "dist/index.cjs.js",
|