@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor 1.2.9 → 2.0.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 +12 -0
- package/README.md +1 -28
- package/dist/{cjs/ScaffolderRelationEntityProcessor-CDT-3f59.cjs.js → ScaffolderRelationEntityProcessor.cjs.js} +4 -8
- package/dist/ScaffolderRelationEntityProcessor.cjs.js.map +1 -0
- package/dist/index.cjs.js +9 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/{alpha.cjs.js → module.cjs.js} +3 -7
- package/dist/module.cjs.js.map +1 -0
- package/dist/relations.cjs.js +8 -0
- package/dist/relations.cjs.js.map +1 -0
- package/dist-dynamic/package.json +16 -19
- package/dist-dynamic/yarn.lock +3 -6
- package/package.json +8 -15
- package/alpha/package.json +0 -6
- package/dist/alpha.cjs.js.map +0 -1
- package/dist/alpha.d.ts +0 -10
- package/dist/cjs/ScaffolderRelationEntityProcessor-CDT-3f59.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d5bb854: Backstage version bump to v1.32.2
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 94fb1a0: **Breaking** migrate to the new backend system and remove deprecations
|
|
14
|
+
|
|
3
15
|
## 1.2.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ const backend = createBackend();
|
|
|
20
20
|
// highlight-add-start
|
|
21
21
|
backend.add(
|
|
22
22
|
import(
|
|
23
|
-
'@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor
|
|
23
|
+
'@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor'
|
|
24
24
|
),
|
|
25
25
|
);
|
|
26
26
|
// highlight-add-end
|
|
@@ -28,33 +28,6 @@ backend.add(
|
|
|
28
28
|
backend.start();
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
### Installing on the legacy backend system
|
|
32
|
-
|
|
33
|
-
To install this module into the legacy backend system, add the following to the `packages/backend/src/plugins/catalog.ts` file:
|
|
34
|
-
|
|
35
|
-
```ts title=packages/backend/src/plugins/catalog.ts
|
|
36
|
-
// highlight-add-start
|
|
37
|
-
import { ScaffolderRelationEntityProcessor } from '@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor';
|
|
38
|
-
|
|
39
|
-
// highlight-add-end
|
|
40
|
-
|
|
41
|
-
export default async function createPlugin(
|
|
42
|
-
env: PluginEnvironment,
|
|
43
|
-
): Promise<Router> {
|
|
44
|
-
const builder = await CatalogBuilder.create(env);
|
|
45
|
-
|
|
46
|
-
/* ... other processors and/or providers ... */
|
|
47
|
-
// highlight-add-start
|
|
48
|
-
builder.addProcessor(new ScaffolderRelationEntityProcessor());
|
|
49
|
-
// highlight-add-end
|
|
50
|
-
|
|
51
|
-
const { processingEngine, router } = await builder.build();
|
|
52
|
-
await processingEngine.start();
|
|
53
|
-
|
|
54
|
-
return router;
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
31
|
### Usage
|
|
59
32
|
|
|
60
33
|
Catalog entities containing the `spec.scaffoldedFrom` field will have a relation link be formed between it and the `template` corresponding to the entity ref in the `spec.scaffoldedFrom` field.
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var catalogModel = require('@backstage/catalog-model');
|
|
4
4
|
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
5
|
-
|
|
6
|
-
const RELATION_SCAFFOLDER_OF = "scaffolderOf";
|
|
7
|
-
const RELATION_SCAFFOLDED_FROM = "scaffoldedFrom";
|
|
5
|
+
var relations = require('./relations.cjs.js');
|
|
8
6
|
|
|
9
7
|
class ScaffolderRelationEntityProcessor {
|
|
10
8
|
getProcessorName() {
|
|
@@ -46,14 +44,12 @@ class ScaffolderRelationEntityProcessor {
|
|
|
46
44
|
doEmit(
|
|
47
45
|
arbitraryEntity.spec?.scaffoldedFrom,
|
|
48
46
|
{ defaultKind: "Template", defaultNamespace: selfRef.namespace },
|
|
49
|
-
RELATION_SCAFFOLDED_FROM,
|
|
50
|
-
RELATION_SCAFFOLDER_OF
|
|
47
|
+
relations.RELATION_SCAFFOLDED_FROM,
|
|
48
|
+
relations.RELATION_SCAFFOLDER_OF
|
|
51
49
|
);
|
|
52
50
|
return entity;
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
exports.RELATION_SCAFFOLDED_FROM = RELATION_SCAFFOLDED_FROM;
|
|
57
|
-
exports.RELATION_SCAFFOLDER_OF = RELATION_SCAFFOLDER_OF;
|
|
58
54
|
exports.ScaffolderRelationEntityProcessor = ScaffolderRelationEntityProcessor;
|
|
59
|
-
//# sourceMappingURL=ScaffolderRelationEntityProcessor
|
|
55
|
+
//# sourceMappingURL=ScaffolderRelationEntityProcessor.cjs.js.map
|
|
@@ -0,0 +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,kCAAqB,MAAM,CAAA,CAAA;AAK3C,IAAA,SAAS,MACP,CAAA,OAAA,EACA,OACA,EAAA,gBAAA,EACA,gBACM,EAAA;AACN,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA,OAAA;AAAA,OACF;AACA,MAAA,KAAA,MAAW,MAAU,IAAA,CAAC,OAAO,CAAA,CAAE,MAAQ,EAAA;AACrC,QAAM,MAAA,SAAA,GAAYC,2BAAe,CAAA,MAAA,EAAQ,OAAO,CAAA,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,IAAA;AAAA,aAClB;AAAA,WACD,CAAA;AAAA,SACH,CAAA;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,IAAA;AAAA,aAClB;AAAA,YACA,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA,OAAA;AAAA,WACT,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAAA,KACF;AAKA,IAAA,MAAM,eAAkB,GAAA,MAAA,CAAA;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,gCAAA;AAAA,KACF,CAAA;AACA,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require('@backstage/catalog-model');
|
|
5
|
-
require('@backstage/plugin-catalog-node');
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
builder.addProcessor(new ScaffolderRelationEntityProcessor.ScaffolderRelationEntityProcessor());
|
|
11
|
-
}
|
|
12
|
-
};
|
|
5
|
+
var relations = require('./relations.cjs.js');
|
|
6
|
+
var module$1 = require('./module.cjs.js');
|
|
7
|
+
var ScaffolderRelationEntityProcessor = require('./ScaffolderRelationEntityProcessor.cjs.js');
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.RELATION_SCAFFOLDED_FROM = relations.RELATION_SCAFFOLDED_FROM;
|
|
12
|
+
exports.RELATION_SCAFFOLDER_OF = relations.RELATION_SCAFFOLDER_OF;
|
|
13
|
+
exports.default = module$1.catalogModuleScaffolderRelationProcessor;
|
|
16
14
|
exports.ScaffolderRelationEntityProcessor = ScaffolderRelationEntityProcessor.ScaffolderRelationEntityProcessor;
|
|
17
|
-
exports.dynamicPluginInstaller = dynamicPluginInstaller;
|
|
18
15
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
2
|
import { Entity } from '@backstage/catalog-model';
|
|
3
3
|
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
|
4
4
|
import { CatalogProcessor, CatalogProcessorEmit } from '@backstage/plugin-catalog-node';
|
|
@@ -31,10 +31,11 @@ type ScaffoldedFromSpec = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
+
* Catalog processor that adds link relation between scaffolder templates and their generated entities
|
|
34
35
|
*
|
|
35
36
|
* @public
|
|
36
37
|
*/
|
|
37
|
-
declare const
|
|
38
|
+
declare const catalogModuleScaffolderRelationProcessor: _backstage_backend_plugin_api.BackendFeature;
|
|
38
39
|
|
|
39
40
|
/** @public */
|
|
40
41
|
declare class ScaffolderRelationEntityProcessor implements CatalogProcessor {
|
|
@@ -42,4 +43,4 @@ declare class ScaffolderRelationEntityProcessor implements CatalogProcessor {
|
|
|
42
43
|
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF, type ScaffoldedFromSpec, ScaffolderRelationEntityProcessor,
|
|
46
|
+
export { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF, type ScaffoldedFromSpec, ScaffolderRelationEntityProcessor, catalogModuleScaffolderRelationProcessor as default };
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
4
|
var alpha = require('@backstage/plugin-catalog-node/alpha');
|
|
7
|
-
var ScaffolderRelationEntityProcessor = require('./
|
|
8
|
-
require('@backstage/catalog-model');
|
|
9
|
-
require('@backstage/plugin-catalog-node');
|
|
5
|
+
var ScaffolderRelationEntityProcessor = require('./ScaffolderRelationEntityProcessor.cjs.js');
|
|
10
6
|
|
|
11
7
|
const catalogModuleScaffolderRelationProcessor = backendPluginApi.createBackendModule({
|
|
12
8
|
pluginId: "catalog",
|
|
@@ -27,5 +23,5 @@ const catalogModuleScaffolderRelationProcessor = backendPluginApi.createBackendM
|
|
|
27
23
|
}
|
|
28
24
|
});
|
|
29
25
|
|
|
30
|
-
exports.
|
|
31
|
-
//# sourceMappingURL=
|
|
26
|
+
exports.catalogModuleScaffolderRelationProcessor = catalogModuleScaffolderRelationProcessor;
|
|
27
|
+
//# sourceMappingURL=module.cjs.js.map
|
|
@@ -0,0 +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;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const RELATION_SCAFFOLDER_OF = "scaffolderOf";
|
|
4
|
+
const RELATION_SCAFFOLDED_FROM = "scaffoldedFrom";
|
|
5
|
+
|
|
6
|
+
exports.RELATION_SCAFFOLDED_FROM = RELATION_SCAFFOLDED_FROM;
|
|
7
|
+
exports.RELATION_SCAFFOLDER_OF = RELATION_SCAFFOLDER_OF;
|
|
8
|
+
//# sourceMappingURL=relations.cjs.js.map
|
|
@@ -0,0 +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,42 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor-dynamic",
|
|
3
3
|
"description": "The scaffolder-relation-processor backend module for the catalog plugin.",
|
|
4
|
-
"version": "
|
|
5
|
-
"main": "dist/index.cjs.js",
|
|
6
|
-
"types": "
|
|
4
|
+
"version": "1.2.9",
|
|
5
|
+
"main": "./dist/index.cjs.js",
|
|
6
|
+
"types": "src/index.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/backstage/community-plugins",
|
|
14
|
+
"directory": "workspaces/scaffolder-relation-processor/plugins/catalog-backend-module-scaffolder-relation-processor"
|
|
12
15
|
},
|
|
13
16
|
"backstage": {
|
|
14
|
-
"role": "backend-plugin-module"
|
|
17
|
+
"role": "backend-plugin-module",
|
|
18
|
+
"pluginId": "scaffolder-relation-processor",
|
|
19
|
+
"pluginPackage": "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor"
|
|
15
20
|
},
|
|
16
21
|
"exports": {
|
|
17
22
|
".": {
|
|
18
23
|
"require": "./dist/index.cjs.js",
|
|
19
24
|
"default": "./dist/index.cjs.js"
|
|
20
25
|
},
|
|
21
|
-
"./alpha": {
|
|
22
|
-
"require": "./dist/alpha.cjs.js",
|
|
23
|
-
"default": "./dist/alpha.cjs.js"
|
|
24
|
-
},
|
|
25
26
|
"./package.json": "./package.json"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"dist",
|
|
29
|
-
"config.d.ts"
|
|
30
|
-
"alpha"
|
|
30
|
+
"config.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"bundleDependencies": true,
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@backstage/backend-
|
|
35
|
-
"@backstage/
|
|
36
|
-
"@backstage/
|
|
37
|
-
"@backstage/catalog-model": "^1.4.5",
|
|
38
|
-
"@backstage/plugin-catalog-common": "^1.0.22",
|
|
39
|
-
"@backstage/plugin-catalog-node": "^1.11.1"
|
|
34
|
+
"@backstage/backend-plugin-api": "^1.0.0",
|
|
35
|
+
"@backstage/catalog-model": "^1.7.0",
|
|
36
|
+
"@backstage/plugin-catalog-node": "^1.13.0"
|
|
40
37
|
},
|
|
41
38
|
"overrides": {
|
|
42
39
|
"@aws-sdk/util-utf8-browser": {
|
package/dist-dynamic/yarn.lock
CHANGED
|
@@ -8,11 +8,8 @@ __metadata:
|
|
|
8
8
|
version: 0.0.0-use.local
|
|
9
9
|
resolution: "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor-dynamic@workspace:."
|
|
10
10
|
peerDependencies:
|
|
11
|
-
"@backstage/backend-
|
|
12
|
-
"@backstage/
|
|
13
|
-
"@backstage/
|
|
14
|
-
"@backstage/catalog-model": ^1.4.5
|
|
15
|
-
"@backstage/plugin-catalog-common": ^1.0.22
|
|
16
|
-
"@backstage/plugin-catalog-node": ^1.11.1
|
|
11
|
+
"@backstage/backend-plugin-api": ^1.0.0
|
|
12
|
+
"@backstage/catalog-model": ^1.7.0
|
|
13
|
+
"@backstage/plugin-catalog-node": ^1.13.0
|
|
17
14
|
languageName: unknown
|
|
18
15
|
linkType: soft
|
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": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -20,15 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
+
"backstage": "@backstage/BackendFeature",
|
|
23
24
|
"require": "./dist/index.cjs.js",
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
25
26
|
"default": "./dist/index.cjs.js"
|
|
26
27
|
},
|
|
27
|
-
"./alpha": {
|
|
28
|
-
"require": "./dist/alpha.cjs.js",
|
|
29
|
-
"types": "./dist/alpha.d.ts",
|
|
30
|
-
"default": "./dist/alpha.cjs.js"
|
|
31
|
-
},
|
|
32
28
|
"./package.json": "./package.json"
|
|
33
29
|
},
|
|
34
30
|
"scripts": {
|
|
@@ -44,16 +40,14 @@
|
|
|
44
40
|
"tsc": "tsc"
|
|
45
41
|
},
|
|
46
42
|
"dependencies": {
|
|
47
|
-
"@backstage/backend-
|
|
48
|
-
"@backstage/backend-dynamic-feature-service": "^0.4.1",
|
|
49
|
-
"@backstage/backend-plugin-api": "^1.0.0",
|
|
43
|
+
"@backstage/backend-plugin-api": "^1.0.1",
|
|
50
44
|
"@backstage/catalog-model": "^1.7.0",
|
|
51
|
-
"@backstage/plugin-catalog-
|
|
52
|
-
"@backstage/plugin-catalog-node": "^1.13.0"
|
|
45
|
+
"@backstage/plugin-catalog-node": "^1.13.1"
|
|
53
46
|
},
|
|
54
47
|
"devDependencies": {
|
|
55
|
-
"@backstage/backend-test-utils": "^1.0.
|
|
56
|
-
"@backstage/cli": "^0.
|
|
48
|
+
"@backstage/backend-test-utils": "^1.0.2",
|
|
49
|
+
"@backstage/cli": "^0.28.0",
|
|
50
|
+
"@backstage/plugin-catalog-common": "^1.1.0",
|
|
57
51
|
"@janus-idp/cli": "1.13.1"
|
|
58
52
|
},
|
|
59
53
|
"files": [
|
|
@@ -61,7 +55,6 @@
|
|
|
61
55
|
"config.d.ts",
|
|
62
56
|
"dist-dynamic/*.*",
|
|
63
57
|
"dist-dynamic/dist/**",
|
|
64
|
-
"dist-dynamic/alpha/*"
|
|
65
|
-
"alpha"
|
|
58
|
+
"dist-dynamic/alpha/*"
|
|
66
59
|
]
|
|
67
60
|
}
|
package/alpha/package.json
DELETED
package/dist/alpha.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.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;;;;"}
|
package/dist/alpha.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Catalog processor that adds link relation between scaffolder templates and their generated entities
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
declare const catalogModuleScaffolderRelationProcessor: _backstage_backend_plugin_api.BackendFeature;
|
|
9
|
-
|
|
10
|
-
export { catalogModuleScaffolderRelationProcessor as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScaffolderRelationEntityProcessor-CDT-3f59.cjs.js","sources":["../../src/relations.ts","../../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 */\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","/*\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 { 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 { 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"],"mappings":";;;;;AAsBO,MAAM,sBAAyB,GAAA,eAAA;AAQ/B,MAAM,wBAA2B,GAAA;;ACCjC,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,kCAAqB,MAAM,CAAA,CAAA;AAK3C,IAAA,SAAS,MACP,CAAA,OAAA,EACA,OACA,EAAA,gBAAA,EACA,gBACM,EAAA;AACN,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA,OAAA;AAAA,OACF;AACA,MAAA,KAAA,MAAW,MAAU,IAAA,CAAC,OAAO,CAAA,CAAE,MAAQ,EAAA;AACrC,QAAM,MAAA,SAAA,GAAYC,2BAAe,CAAA,MAAA,EAAQ,OAAO,CAAA,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,IAAA;AAAA,aAClB;AAAA,WACD,CAAA;AAAA,SACH,CAAA;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,IAAA;AAAA,aAClB;AAAA,YACA,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA,OAAA;AAAA,WACT,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAAA,KACF;AAKA,IAAA,MAAM,eAAkB,GAAA,MAAA,CAAA;AACxB,IAAA,MAAA;AAAA,MACE,gBAAgB,IAAM,EAAA,cAAA;AAAA,MACtB,EAAE,WAAA,EAAa,UAAY,EAAA,gBAAA,EAAkB,QAAQ,SAAU,EAAA;AAAA,MAC/D,wBAAA;AAAA,MACA,sBAAA;AAAA,KACF,CAAA;AACA,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AACF;;;;;;"}
|