@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor 2.0.2 → 2.1.1

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,17 @@
1
1
  # @backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 93ad936: This release will be functionally equivalent to 2.1.0.
8
+
9
+ ## 2.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d102b8f: Backstage version bump to v1.34.2
14
+
3
15
  ## 2.0.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -12,7 +12,7 @@ This is an extension module to the catalog-backend plugin, providing an addition
12
12
 
13
13
  ### Installing on the new backend system
14
14
 
15
- To install this module into the [new backend system](https://backstage.io/docs/backend-system/), add the following into the `packages/backend/src/index.ts` file:
15
+ To install this module into the [new backend system](https://backstage.io/docs/backend-system/) add the following into the `packages/backend/src/index.ts` file:
16
16
 
17
17
  ```ts title="packages/backend/src/index.ts
18
18
  const backend = createBackend();
@@ -1 +1 @@
1
- {"version":3,"file":"ScaffolderRelationEntityProcessor.cjs.js","sources":["../src/ScaffolderRelationEntityProcessor.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport type { LocationSpec } from '@backstage/plugin-catalog-common';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n processingResult,\n} from '@backstage/plugin-catalog-node';\n\nimport { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF } from './relations';\nimport type { ScaffoldedFromSpec } from './types';\n\n/** @public */\nexport class ScaffolderRelationEntityProcessor implements CatalogProcessor {\n getProcessorName(): string {\n return 'ScaffolderRelationEntityProcessor';\n }\n\n async postProcessEntity(\n entity: Entity,\n _location: LocationSpec,\n emit: CatalogProcessorEmit,\n ): Promise<Entity> {\n const selfRef = getCompoundEntityRef(entity);\n\n /**\n * Utilities\n */\n function doEmit(\n targets: string | string[] | undefined,\n context: { defaultKind?: string; defaultNamespace: string },\n outgoingRelation: string,\n incomingRelation: string,\n ): void {\n if (!targets) {\n return;\n }\n for (const target of [targets].flat()) {\n const targetRef = parseEntityRef(target, context);\n emit(\n processingResult.relation({\n source: selfRef,\n type: outgoingRelation,\n target: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n }),\n );\n emit(\n processingResult.relation({\n source: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n type: incomingRelation,\n target: selfRef,\n }),\n );\n }\n }\n\n /**\n * Emit relations for entities generated by templates (can be any entity type)\n */\n const arbitraryEntity = entity as Entity & Partial<ScaffoldedFromSpec>;\n doEmit(\n arbitraryEntity.spec?.scaffoldedFrom,\n { defaultKind: 'Template', defaultNamespace: selfRef.namespace },\n RELATION_SCAFFOLDED_FROM,\n RELATION_SCAFFOLDER_OF,\n );\n return entity;\n }\n}\n"],"names":["getCompoundEntityRef","parseEntityRef","processingResult","RELATION_SCAFFOLDED_FROM","RELATION_SCAFFOLDER_OF"],"mappings":";;;;;;AA+BO,MAAM,iCAA8D,CAAA;AAAA,EACzE,gBAA2B,GAAA;AACzB,IAAO,OAAA,mCAAA,CAAA;AAAA,GACT;AAAA,EAEA,MAAM,iBAAA,CACJ,MACA,EAAA,SAAA,EACA,IACiB,EAAA;AACjB,IAAM,MAAA,OAAA,GAAUA,kC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js.js","sources":["../src/ScaffolderRelationEntityProcessor.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport type { LocationSpec } from '@backstage/plugin-catalog-common';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n processingResult,\n} from '@backstage/plugin-catalog-node';\n\nimport { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF } from './relations';\nimport type { ScaffoldedFromSpec } from './types';\n\n/** @public */\nexport class ScaffolderRelationEntityProcessor implements CatalogProcessor {\n getProcessorName(): string {\n return 'ScaffolderRelationEntityProcessor';\n }\n\n async postProcessEntity(\n entity: Entity,\n _location: LocationSpec,\n emit: CatalogProcessorEmit,\n ): Promise<Entity> {\n const selfRef = getCompoundEntityRef(entity);\n\n /**\n * Utilities\n */\n function doEmit(\n targets: string | string[] | undefined,\n context: { defaultKind?: string; defaultNamespace: string },\n outgoingRelation: string,\n incomingRelation: string,\n ): void {\n if (!targets) {\n return;\n }\n for (const target of [targets].flat()) {\n const targetRef = parseEntityRef(target, context);\n emit(\n processingResult.relation({\n source: selfRef,\n type: outgoingRelation,\n target: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n }),\n );\n emit(\n processingResult.relation({\n source: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n type: incomingRelation,\n target: selfRef,\n }),\n );\n }\n }\n\n /**\n * Emit relations for entities generated by templates (can be any entity type)\n */\n const arbitraryEntity = entity as Entity & Partial<ScaffoldedFromSpec>;\n doEmit(\n arbitraryEntity.spec?.scaffoldedFrom,\n { defaultKind: 'Template', defaultNamespace: selfRef.namespace },\n RELATION_SCAFFOLDED_FROM,\n RELATION_SCAFFOLDER_OF,\n );\n return entity;\n }\n}\n"],"names":["getCompoundEntityRef","parseEntityRef","processingResult","RELATION_SCAFFOLDED_FROM","RELATION_SCAFFOLDER_OF"],"mappings":";;;;;;AA+BO,MAAM,iCAA8D,CAAA;AAAA,EACzE,gBAA2B,GAAA;AACzB,IAAO,OAAA,mCAAA;AAAA;AACT,EAEA,MAAM,iBAAA,CACJ,MACA,EAAA,SAAA,EACA,IACiB,EAAA;AACjB,IAAM,MAAA,OAAA,GAAUA,kCAAqB,MAAM,CAAA;AAK3C,IAAA,SAAS,MACP,CAAA,OAAA,EACA,OACA,EAAA,gBAAA,EACA,gBACM,EAAA;AACN,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA;AAAA;AAEF,MAAA,KAAA,MAAW,MAAU,IAAA,CAAC,OAAO,CAAA,CAAE,MAAQ,EAAA;AACrC,QAAM,MAAA,SAAA,GAAYC,2BAAe,CAAA,MAAA,EAAQ,OAAO,CAAA;AAChD,QAAA,IAAA;AAAA,UACEC,mCAAiB,QAAS,CAAA;AAAA,YACxB,MAAQ,EAAA,OAAA;AAAA,YACR,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA;AAAA,cACN,MAAM,SAAU,CAAA,IAAA;AAAA,cAChB,WAAW,SAAU,CAAA,SAAA;AAAA,cACrB,MAAM,SAAU,CAAA;AAAA;AAClB,WACD;AAAA,SACH;AACA,QAAA,IAAA;AAAA,UACEA,mCAAiB,QAAS,CAAA;AAAA,YACxB,MAAQ,EAAA;AAAA,cACN,MAAM,SAAU,CAAA,IAAA;AAAA,cAChB,WAAW,SAAU,CAAA,SAAA;AAAA,cACrB,MAAM,SAAU,CAAA;AAAA,aAClB;AAAA,YACA,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA;AAAA,WACT;AAAA,SACH;AAAA;AACF;AAMF,IAAA,MAAM,eAAkB,GAAA,MAAA;AACxB,IAAA,MAAA;AAAA,MACE,gBAAgB,IAAM,EAAA,cAAA;AAAA,MACtB,EAAE,WAAA,EAAa,UAAY,EAAA,gBAAA,EAAkB,QAAQ,SAAU,EAAA;AAAA,MAC/DC,kCAAA;AAAA,MACAC;AAAA,KACF;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\n\nimport { ScaffolderRelationEntityProcessor } from './ScaffolderRelationEntityProcessor';\n\n/**\n * Catalog processor that adds link relation between scaffolder templates and their generated entities\n *\n * @public\n */\nexport const catalogModuleScaffolderRelationProcessor = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'scaffolder-relation-processor',\n register(env) {\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n logger: coreServices.logger,\n },\n async init({ catalog, logger }) {\n logger.debug(\n 'Registering the scaffolder-relation-processor catalog module',\n );\n catalog.addProcessor(new ScaffolderRelationEntityProcessor());\n },\n });\n },\n});\n"],"names":["createBackendModule","catalogProcessingExtensionPoint","coreServices","ScaffolderRelationEntityProcessor"],"mappings":";;;;;;AA4BO,MAAM,2CAA2CA,oCAAoB,CAAA;AAAA,EAC1E,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,+BAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,OAAS,EAAAC,qCAAA;AAAA,QACT,QAAQC,6BAAa,CAAA,MAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,OAAA,EAAS,QAAU,EAAA;AAC9B,QAAO,MAAA,CAAA,KAAA;AAAA,UACL,8DAAA;AAAA,SACF,CAAA;AACA,QAAQ,OAAA,CAAA,YAAA,CAAa,IAAIC,mEAAA,EAAmC,CAAA,CAAA;AAAA,OAC9D;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\n\nimport { ScaffolderRelationEntityProcessor } from './ScaffolderRelationEntityProcessor';\n\n/**\n * Catalog processor that adds link relation between scaffolder templates and their generated entities\n *\n * @public\n */\nexport const catalogModuleScaffolderRelationProcessor = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'scaffolder-relation-processor',\n register(env) {\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n logger: coreServices.logger,\n },\n async init({ catalog, logger }) {\n logger.debug(\n 'Registering the scaffolder-relation-processor catalog module',\n );\n catalog.addProcessor(new ScaffolderRelationEntityProcessor());\n },\n });\n },\n});\n"],"names":["createBackendModule","catalogProcessingExtensionPoint","coreServices","ScaffolderRelationEntityProcessor"],"mappings":";;;;;;AA4BO,MAAM,2CAA2CA,oCAAoB,CAAA;AAAA,EAC1E,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,+BAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,OAAS,EAAAC,qCAAA;AAAA,QACT,QAAQC,6BAAa,CAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,OAAA,EAAS,QAAU,EAAA;AAC9B,QAAO,MAAA,CAAA,KAAA;AAAA,UACL;AAAA,SACF;AACA,QAAQ,OAAA,CAAA,YAAA,CAAa,IAAIC,mEAAA,EAAmC,CAAA;AAAA;AAC9D,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"relations.cjs.js","sources":["../src/relations.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A relation from a scaffolder template entity to the entity it generated.\n * Reverse direction of {@link RELATION_SCAFFOLDED_FROM}\n *\n * @public\n */\nexport const RELATION_SCAFFOLDER_OF = 'scaffolderOf';\n\n/**\n * A relation of an entity generated from a scaffolder template entity\n * Reverse direction of {@link RELATION_SCAFFOLDER_OF}\n *\n * @public\n */\nexport const RELATION_SCAFFOLDED_FROM = 'scaffoldedFrom';\n"],"names":[],"mappings":";;AAsBO,MAAM,sBAAyB,GAAA,eAAA;AAQ/B,MAAM,wBAA2B,GAAA;;;;;"}
1
+ {"version":3,"file":"relations.cjs.js","sources":["../src/relations.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A relation from a scaffolder template entity to the entity it generated.\n * Reverse direction of {@link RELATION_SCAFFOLDED_FROM}\n *\n * @public\n */\nexport const RELATION_SCAFFOLDER_OF = 'scaffolderOf';\n\n/**\n * A relation of an entity generated from a scaffolder template entity\n * Reverse direction of {@link RELATION_SCAFFOLDER_OF}\n *\n * @public\n */\nexport const RELATION_SCAFFOLDED_FROM = 'scaffoldedFrom';\n"],"names":[],"mappings":";;AAsBO,MAAM,sBAAyB,GAAA;AAQ/B,MAAM,wBAA2B,GAAA;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor",
3
3
  "description": "The scaffolder-relation-processor backend module for the catalog plugin.",
4
- "version": "2.0.2",
4
+ "version": "2.1.1",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -27,6 +27,13 @@
27
27
  },
28
28
  "./package.json": "./package.json"
29
29
  },
30
+ "typesVersions": {
31
+ "*": {
32
+ "index": [
33
+ "dist/index.d.ts"
34
+ ]
35
+ }
36
+ },
30
37
  "scripts": {
31
38
  "start": "backstage-cli package start",
32
39
  "build": "backstage-cli package build",
@@ -38,14 +45,14 @@
38
45
  "tsc": "tsc"
39
46
  },
40
47
  "dependencies": {
41
- "@backstage/backend-plugin-api": "^1.0.1",
42
- "@backstage/catalog-model": "^1.7.0",
43
- "@backstage/plugin-catalog-node": "^1.13.1"
48
+ "@backstage/backend-plugin-api": "^1.1.0",
49
+ "@backstage/catalog-model": "^1.7.2",
50
+ "@backstage/plugin-catalog-node": "^1.15.0"
44
51
  },
45
52
  "devDependencies": {
46
- "@backstage/backend-test-utils": "^1.0.2",
47
- "@backstage/cli": "^0.28.0",
48
- "@backstage/plugin-catalog-common": "^1.1.0"
53
+ "@backstage/backend-test-utils": "^1.2.0",
54
+ "@backstage/cli": "^0.29.4",
55
+ "@backstage/plugin-catalog-common": "^1.1.2"
49
56
  },
50
57
  "files": [
51
58
  "config.d.ts",