@spotify/backstage-plugin-search-backend-module-skill-exchange 0.2.4 → 0.3.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,27 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-search-backend-module-skill-exchange
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Remove support for the legacy backend system.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Update to Backstage `v1.35.0`
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @spotify/backstage-plugin-skill-exchange-node@0.3.0
|
|
14
|
+
- @spotify/backstage-plugin-skill-exchange-common@0.2.5
|
|
15
|
+
|
|
16
|
+
## 0.2.5
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Update to Backstage `v1.34.0`
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @spotify/backstage-plugin-skill-exchange-common@0.2.4
|
|
23
|
+
- @spotify/backstage-plugin-skill-exchange-node@0.2.5
|
|
24
|
+
|
|
3
25
|
## 0.2.4
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var l=require("@backstage/catalog-model"),c=require("@backstage/plugin-search-backend-node");class o extends c.DecoratorBase{#t;#i;#s;#n;#r
|
|
1
|
+
"use strict";var l=require("@backstage/catalog-model"),c=require("@backstage/plugin-search-backend-node");class o extends c.DecoratorBase{#t;#i;#a;#s;#n;#r=0;#e;static#o=`
|
|
2
2
|
query SelfReportedSkills {
|
|
3
3
|
getPublicSelfReportedSkill {
|
|
4
4
|
skill {
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
user
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
`;constructor({
|
|
12
|
+
`;constructor({cache:t,catalog:e,logger:i,skillExchangeClient:r,auth:a}){super(),this.#i=t,this.#t=i,this.#a=e,this.#s=r,this.#n=a}async#l(){const t=await this.#s.doPost("/graphql",{query:o.#o});let e={};return t.ok?e=((await t.json()).data?.getPublicSelfReportedSkill||[]).reduce((i,{user:r,skill:a})=>({...i,[r.toLowerCase()]:[...i[r.toLowerCase()]||[],a]}),e):this.#t.error(`Error fetching self reported skills: ${await t.text()}`),e}async initialize(){this.#r=0,this.#e=await this.#l(),this.#t.info(`Found ${Object.keys(this.#e).length} skill profiles available for decorating`)}async getUserEntity(t){const e=`SkillProfileDecorator:${t}`,i=await this.#i.get(e);if(i)return i;const r=await this.#a.getEntityByRef(t,{credentials:await this.#n.getOwnServiceCredentials()}).catch(a=>{this.#t.error(`Error while retrieving entity with ref: ${t}`,a)});if(r)return await this.#i.set(e,JSON.parse(JSON.stringify(r))),r}async decorate(t){if(!this.#e||t.kind!=="User")return t;const e=t.authorization?.resourceRef||l.stringifyEntityRef({namespace:t.namespace,kind:t.kind,name:t.location.split("/").at(-1)}),i=await this.getUserEntity(e);if(!e||!i)return this.#t.error(`Could not find user entity to decorate, skipping over this document ${e}`),t;const r=this.#e[e.toLowerCase()]?.map(({name:s})=>s)??[],a=i.relations?.filter(({type:s})=>s==="memberOf")?.map(({targetRef:s})=>l.parseEntityRef(s)).filter(({kind:s})=>s==="group").map(({name:s})=>s),n=[];return t.text&&n.push(t.text),r.length&&n.push(r.join(", ")),a?.length&&n.push(a.join(", ")),t.text=n.join(" || "),t.displayName=i.spec.profile?.displayName,t.picture=i.spec.profile?.picture,t.name=i.metadata.name,t.skills=r,t.teams=a||[],this.#r++,t}async finalize(){this.#e=void 0,this.#t.info(`Decorated ${this.#r} documents with skill profile data`)}}exports.SkillProfileDecorator=o;
|
|
13
13
|
//# sourceMappingURL=SkillProfileDecorator.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
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:60*60*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/dist/module.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=require("@backstage/backend-plugin-api"),s=require("@backstage/plugin-catalog-node"),n=require("@backstage/plugin-search-backend-node/alpha");require("@backstage/catalog-model"),require("@backstage/plugin-search-backend-node");var u=require("./decorator/SkillProfileDecoratorFactory.cjs.js");const d=e.createBackendModule({pluginId:"search",moduleId:"skill-exchange",register(r){r.registerInit({deps:{config:e.coreServices.rootConfig,cache:e.coreServices.cache,discovery:e.coreServices.discovery,logger:e.coreServices.logger,envScheduler:e.coreServices.scheduler,auth:e.coreServices.auth,catalog:s.catalogServiceRef,registry:n.searchIndexRegistryExtensionPoint},async init({registry:c,config:o,cache:i,discovery:a,logger:l,catalog:t,auth:g}){c.addDecorator({factory:u.SkillProfileDecoratorFactory.fromConfig(o,{catalog:t,discovery:a,auth:g,logger:l,cache:i})})}})}});exports.searchModuleSkillExchange=d;
|
|
2
2
|
//# sourceMappingURL=module.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.3.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -25,21 +25,20 @@
|
|
|
25
25
|
"postpack": "backstage-cli package postpack"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@backstage/backend-
|
|
29
|
-
"@backstage/backend-plugin-api": "^1.
|
|
30
|
-
"@backstage/catalog-client": "^1.
|
|
31
|
-
"@backstage/catalog-model": "^1.7.
|
|
32
|
-
"@backstage/config": "^1.3.
|
|
33
|
-
"@backstage/plugin-catalog-node": "^1.
|
|
34
|
-
"@backstage/plugin-search-backend-node": "^1.3.
|
|
35
|
-
"@backstage/plugin-search-common": "^1.2.
|
|
36
|
-
"@spotify/backstage-plugin-skill-exchange-common": "^0.2.
|
|
37
|
-
"@spotify/backstage-plugin-skill-exchange-node": "^0.
|
|
38
|
-
"winston": "^3.2.1"
|
|
28
|
+
"@backstage/backend-defaults": "^0.7.0",
|
|
29
|
+
"@backstage/backend-plugin-api": "^1.1.1",
|
|
30
|
+
"@backstage/catalog-client": "^1.9.1",
|
|
31
|
+
"@backstage/catalog-model": "^1.7.3",
|
|
32
|
+
"@backstage/config": "^1.3.2",
|
|
33
|
+
"@backstage/plugin-catalog-node": "^1.15.1",
|
|
34
|
+
"@backstage/plugin-search-backend-node": "^1.3.7",
|
|
35
|
+
"@backstage/plugin-search-common": "^1.2.17",
|
|
36
|
+
"@spotify/backstage-plugin-skill-exchange-common": "^0.2.5",
|
|
37
|
+
"@spotify/backstage-plugin-skill-exchange-node": "^0.3.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@backstage/backend-test-utils": "^1.1
|
|
42
|
-
"@backstage/cli": "^0.29.
|
|
40
|
+
"@backstage/backend-test-utils": "^1.2.1",
|
|
41
|
+
"@backstage/cli": "^0.29.5",
|
|
43
42
|
"node-fetch": "^2.6.7"
|
|
44
43
|
},
|
|
45
44
|
"files": [
|