@spotify/backstage-plugin-search-backend-module-skill-exchange 0.4.5 → 0.5.0
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,5 +1,28 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-search-backend-module-skill-exchange
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Refined user search results to display only current skill proficiencies
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependency `backstage` to `1.46.0`.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @spotify/backstage-plugin-skill-exchange-common@0.2.12
|
|
15
|
+
- @spotify/backstage-plugin-skill-exchange-node@0.6.0
|
|
16
|
+
|
|
17
|
+
## 0.4.6
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependency `backstage` to `1.45.0`.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @spotify/backstage-plugin-skill-exchange-common@0.2.11
|
|
24
|
+
- @spotify/backstage-plugin-skill-exchange-node@0.5.3
|
|
25
|
+
|
|
3
26
|
## 0.4.5
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=require("@backstage/catalog-model"),h=require("@backstage/plugin-search-backend-node");class o extends h.DecoratorBase{#t;#i;#s;#a;#n;#r=0;#e;static#l=`
|
|
2
2
|
query SelfReportedSkills {
|
|
3
3
|
getPublicSelfReportedSkill {
|
|
4
|
+
level
|
|
4
5
|
skill {
|
|
5
6
|
id
|
|
6
7
|
name
|
|
@@ -9,5 +10,5 @@
|
|
|
9
10
|
user
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
|
-
`;constructor({cache:t,catalog:
|
|
13
|
+
`;constructor({cache:t,catalog:i,logger:e,skillExchangeClient:r,auth:s}){super(),this.#i=t,this.#t=e,this.#s=i,this.#a=r,this.#n=s}async#o(){const t=await this.#a.doPost("/graphql",{query:o.#l});let i={};return t.ok?i=((await t.json()).data?.getPublicSelfReportedSkill||[]).filter(({level:e})=>e>0).reduce((e,{user:r,skill:s})=>({...e,[r.toLowerCase()]:[...e[r.toLowerCase()]||[],s]}),i):this.#t.error(`Error fetching self reported skills: ${await t.text()}`),i}async initialize(){this.#r=0,this.#e=await this.#o(),this.#t.info(`Found ${Object.keys(this.#e).length} skill profiles available for decorating`)}async getUserEntity(t){const i=`SkillProfileDecorator:${t}`,e=await this.#i.get(i);if(e)return e;const r=await this.#s.getEntityByRef(t,{credentials:await this.#n.getOwnServiceCredentials()}).catch(s=>{this.#t.error(`Error while retrieving entity with ref: ${t}`,s)});if(r)return await this.#i.set(i,JSON.parse(JSON.stringify(r))),r}async decorate(t){if(!this.#e||t.kind!=="User")return t;const i=t.authorization?.resourceRef||l.stringifyEntityRef({namespace:t.namespace,kind:t.kind,name:t.location.split("/").at(-1)}),e=await this.getUserEntity(i);if(!i||!e)return this.#t.error(`Could not find user entity to decorate, skipping over this document ${i}`),t;const r=this.#e[i.toLowerCase()]?.map(({name:a})=>a)??[],s=e.relations?.filter(({type:a})=>a==="memberOf")?.map(({targetRef:a})=>l.parseEntityRef(a)).filter(({kind:a})=>a==="group").map(l.stringifyEntityRef),c=s?.map(a=>l.parseEntityRef(a).name)||[],n=[];return t.text&&n.push(t.text),r.length&&n.push(r.join(", ")),s?.length&&(n.push(s.join(", ")),n.push(c.join(", "))),t.text=n.join(" || "),t.displayName=e.spec.profile?.displayName,t.picture=e.spec.profile?.picture,t.name=e.metadata.name,t.skills=r,t.teams=s||[],this.#r++,t}async finalize(){this.#e=void 0,this.#t.info(`Decorated ${this.#r} documents with skill profile data`)}}exports.SkillProfileDecorator=o;
|
|
13
14
|
//# sourceMappingURL=SkillProfileDecorator.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=require("@spotify/backstage-plugin-skill-exchange-node"),l=require("./SkillProfileDecorator.cjs.js");class i{types=["software-catalog"];#t;#e;#i;#r;#o;discovery;static fromConfig(t,e){return new i({config:t,...e})}constructor({cache:t,config:e,logger:c,discovery:r,catalog:a,auth:o}){this.#e=c,this.discovery=r,this.#t=t.withOptions({defaultTtl:
|
|
1
|
+
"use strict";var s=require("@spotify/backstage-plugin-skill-exchange-node"),l=require("./SkillProfileDecorator.cjs.js");class i{types=["software-catalog"];#t;#e;#i;#r;#o;discovery;static fromConfig(t,e){return new i({config:t,...e})}constructor({cache:t,config:e,logger:c,discovery:r,catalog:a,auth:o}){this.#e=c,this.discovery=r,this.#t=t.withOptions({defaultTtl:3600*1e3}),this.#i=a,this.#r=new s.SkillExchangeClient({config:e,discovery:r,auth:o}),this.#o=o}async getDecorator(){return new l.SkillProfileDecorator({cache:this.#t,catalog:this.#i,logger:this.#e,skillExchangeClient:this.#r,auth:this.#o})}}exports.SkillProfileDecoratorFactory=i;
|
|
2
2
|
//# sourceMappingURL=SkillProfileDecoratorFactory.cjs.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify/backstage-plugin-search-backend-module-skill-exchange",
|
|
3
3
|
"description": "The skill-exchange backend module for the search plugin.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"postpack": "backstage-cli package postpack"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@backstage/backend-defaults": "^0.
|
|
32
|
-
"@backstage/backend-plugin-api": "^1.
|
|
33
|
-
"@backstage/catalog-client": "^1.12.
|
|
34
|
-
"@backstage/catalog-model": "^1.7.
|
|
35
|
-
"@backstage/config": "^1.3.
|
|
36
|
-
"@backstage/plugin-catalog-node": "^1.
|
|
37
|
-
"@backstage/plugin-search-backend-node": "^1.
|
|
38
|
-
"@backstage/plugin-search-common": "^1.2.
|
|
39
|
-
"@spotify/backstage-plugin-skill-exchange-common": "^0.2.
|
|
40
|
-
"@spotify/backstage-plugin-skill-exchange-node": "^0.
|
|
31
|
+
"@backstage/backend-defaults": "^0.14.0",
|
|
32
|
+
"@backstage/backend-plugin-api": "^1.6.0",
|
|
33
|
+
"@backstage/catalog-client": "^1.12.1",
|
|
34
|
+
"@backstage/catalog-model": "^1.7.6",
|
|
35
|
+
"@backstage/config": "^1.3.6",
|
|
36
|
+
"@backstage/plugin-catalog-node": "^1.20.1",
|
|
37
|
+
"@backstage/plugin-search-backend-node": "^1.4.0",
|
|
38
|
+
"@backstage/plugin-search-common": "^1.2.21",
|
|
39
|
+
"@spotify/backstage-plugin-skill-exchange-common": "^0.2.12",
|
|
40
|
+
"@spotify/backstage-plugin-skill-exchange-node": "^0.6.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@backstage/backend-test-utils": "^1.
|
|
44
|
-
"@backstage/cli": "^0.
|
|
43
|
+
"@backstage/backend-test-utils": "^1.10.2",
|
|
44
|
+
"@backstage/cli": "^0.35.0"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"dist",
|