@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor 2.0.2 → 2.2.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,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6b3f852: Backstage version bump to v1.35.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
|
|
@@ -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
|
|
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_SCAFFOL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AC/DC,kCAAA;AAAA,MACAC;AAAA,KACF;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
4
|
+
"version": "2.2.0",
|
|
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.
|
|
42
|
-
"@backstage/catalog-model": "^1.7.
|
|
43
|
-
"@backstage/plugin-catalog-node": "^1.
|
|
48
|
+
"@backstage/backend-plugin-api": "^1.1.1",
|
|
49
|
+
"@backstage/catalog-model": "^1.7.3",
|
|
50
|
+
"@backstage/plugin-catalog-node": "^1.15.1"
|
|
44
51
|
},
|
|
45
52
|
"devDependencies": {
|
|
46
|
-
"@backstage/backend-test-utils": "^1.
|
|
47
|
-
"@backstage/cli": "^0.
|
|
48
|
-
"@backstage/plugin-catalog-common": "^1.1.
|
|
53
|
+
"@backstage/backend-test-utils": "^1.2.1",
|
|
54
|
+
"@backstage/cli": "^0.29.5",
|
|
55
|
+
"@backstage/plugin-catalog-common": "^1.1.3"
|
|
49
56
|
},
|
|
50
57
|
"files": [
|
|
51
58
|
"config.d.ts",
|