@backstage/plugin-catalog-node 1.3.3 → 1.3.4-next.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 +25 -0
- package/alpha/package.json +3 -3
- package/dist/alpha.cjs.js +27 -0
- package/dist/alpha.cjs.js.map +1 -0
- package/dist/alpha.d.ts +23 -0
- package/dist/index.cjs.js +0 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +106 -136
- package/package.json +26 -16
- package/dist/index.alpha.d.ts +0 -296
- package/dist/index.beta.d.ts +0 -283
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-node
|
|
2
2
|
|
|
3
|
+
## 1.3.4-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/errors@1.1.5-next.0
|
|
9
|
+
- @backstage/catalog-client@1.4.0-next.1
|
|
10
|
+
- @backstage/backend-plugin-api@0.4.1-next.1
|
|
11
|
+
- @backstage/catalog-model@1.2.1-next.1
|
|
12
|
+
- @backstage/types@1.0.2
|
|
13
|
+
- @backstage/plugin-catalog-common@1.0.12-next.1
|
|
14
|
+
|
|
15
|
+
## 1.3.4-next.0
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 928a12a9b3: Internal refactor of `/alpha` exports.
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @backstage/catalog-client@1.4.0-next.0
|
|
22
|
+
- @backstage/backend-plugin-api@0.4.1-next.0
|
|
23
|
+
- @backstage/catalog-model@1.2.1-next.0
|
|
24
|
+
- @backstage/plugin-catalog-common@1.0.12-next.0
|
|
25
|
+
- @backstage/errors@1.1.4
|
|
26
|
+
- @backstage/types@1.0.2
|
|
27
|
+
|
|
3
28
|
## 1.3.3
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/alpha/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
+
var catalogClient = require('@backstage/catalog-client');
|
|
7
|
+
|
|
8
|
+
const catalogServiceRef = backendPluginApi.createServiceRef({
|
|
9
|
+
id: "catalog-client",
|
|
10
|
+
defaultFactory: async (service) => backendPluginApi.createServiceFactory({
|
|
11
|
+
service,
|
|
12
|
+
deps: {
|
|
13
|
+
discoveryApi: backendPluginApi.coreServices.discovery
|
|
14
|
+
},
|
|
15
|
+
async factory({ discoveryApi }) {
|
|
16
|
+
return new catalogClient.CatalogClient({ discoveryApi });
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const catalogProcessingExtensionPoint = backendPluginApi.createExtensionPoint({
|
|
22
|
+
id: "catalog.processing"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.catalogProcessingExtensionPoint = catalogProcessingExtensionPoint;
|
|
26
|
+
exports.catalogServiceRef = catalogServiceRef;
|
|
27
|
+
//# sourceMappingURL=alpha.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/catalogService.ts","../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2022 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\nimport {\n createServiceFactory,\n createServiceRef,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\n\n/**\n * The catalogService provides the catalog API.\n * @alpha\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n discoveryApi: coreServices.discovery,\n },\n async factory({ discoveryApi }) {\n return new CatalogClient({ discoveryApi });\n },\n }),\n});\n","/*\n * Copyright 2022 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 { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport {\n EntityProvider,\n CatalogProcessor,\n} from '@backstage/plugin-catalog-node';\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient","createExtensionPoint"],"mappings":";;;;;;;AA2BO,MAAM,oBAAoBA,iCAA6B,CAAA;AAAA,EAC5D,EAAI,EAAA,gBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAqB,CAAA;AAAA,IACnB,OAAA;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,cAAcC,6BAAa,CAAA,SAAA;AAAA,KAC7B;AAAA,IACA,MAAM,OAAA,CAAQ,EAAE,YAAA,EAAgB,EAAA;AAC9B,MAAA,OAAO,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,CAAA,CAAA;AAAA,KAC3C;AAAA,GACD,CAAA;AACL,CAAC;;ACHM,MAAM,kCACXC,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;;;;"}
|
package/dist/alpha.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
+
import { CatalogApi } from '@backstage/catalog-client';
|
|
3
|
+
import { CatalogProcessor, EntityProvider } from '@backstage/plugin-catalog-node';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The catalogService provides the catalog API.
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
declare const catalogServiceRef: _backstage_backend_plugin_api.ServiceRef<CatalogApi, "plugin">;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
interface CatalogProcessingExtensionPoint {
|
|
15
|
+
addProcessor(...processors: Array<CatalogProcessor | Array<CatalogProcessor>>): void;
|
|
16
|
+
addEntityProvider(...providers: Array<EntityProvider | Array<EntityProvider>>): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
declare const catalogProcessingExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogProcessingExtensionPoint>;
|
|
22
|
+
|
|
23
|
+
export { CatalogProcessingExtensionPoint, catalogProcessingExtensionPoint, catalogServiceRef };
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,27 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
-
var catalogClient = require('@backstage/catalog-client');
|
|
7
5
|
var errors = require('@backstage/errors');
|
|
8
6
|
|
|
9
|
-
const catalogProcessingExtensionPoint = backendPluginApi.createExtensionPoint({
|
|
10
|
-
id: "catalog.processing"
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const catalogServiceRef = backendPluginApi.createServiceRef({
|
|
14
|
-
id: "catalog-client",
|
|
15
|
-
defaultFactory: async (service) => backendPluginApi.createServiceFactory({
|
|
16
|
-
service,
|
|
17
|
-
deps: {
|
|
18
|
-
discoveryApi: backendPluginApi.coreServices.discovery
|
|
19
|
-
},
|
|
20
|
-
async factory({ discoveryApi }) {
|
|
21
|
-
return new catalogClient.CatalogClient({ discoveryApi });
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
|
|
26
7
|
const processingResult = Object.freeze({
|
|
27
8
|
notFoundError(atLocation, message) {
|
|
28
9
|
return {
|
|
@@ -55,7 +36,5 @@ const processingResult = Object.freeze({
|
|
|
55
36
|
}
|
|
56
37
|
});
|
|
57
38
|
|
|
58
|
-
exports.catalogProcessingExtensionPoint = catalogProcessingExtensionPoint;
|
|
59
|
-
exports.catalogServiceRef = catalogServiceRef;
|
|
60
39
|
exports.processingResult = processingResult;
|
|
61
40
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/api/processingResult.ts"],"sourcesContent":["/*\n * Copyright 2020 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\nimport { InputError, NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { CatalogProcessorResult } from './processor';\nimport { EntityRelationSpec } from './common';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * Factory functions for the standard processing result types.\n *\n * @public\n */\nexport const processingResult = Object.freeze({\n notFoundError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new NotFoundError(message),\n };\n },\n\n inputError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new InputError(message),\n };\n },\n\n generalError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return { type: 'error', location: atLocation, error: new Error(message) };\n },\n\n location(newLocation: LocationSpec): CatalogProcessorResult {\n return { type: 'location', location: newLocation };\n },\n\n entity(atLocation: LocationSpec, newEntity: Entity): CatalogProcessorResult {\n return { type: 'entity', location: atLocation, entity: newEntity };\n },\n\n relation(spec: EntityRelationSpec): CatalogProcessorResult {\n return { type: 'relation', relation: spec };\n },\n\n refresh(key: string): CatalogProcessorResult {\n return { type: 'refresh', key };\n },\n} as const);\n"],"names":["NotFoundError","InputError"],"mappings":";;;;;;AA2Ba,MAAA,gBAAA,GAAmB,OAAO,MAAO,CAAA;AAAA,EAC5C,aAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,IAAIA,oBAAA,CAAc,OAAO,CAAA;AAAA,KAClC,CAAA;AAAA,GACF;AAAA,EAEA,UAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,IAAIC,iBAAA,CAAW,OAAO,CAAA;AAAA,KAC/B,CAAA;AAAA,GACF;AAAA,EAEA,YAAA,CACE,YACA,OACwB,EAAA;AACxB,IAAO,OAAA,EAAE,MAAM,OAAS,EAAA,QAAA,EAAU,YAAY,KAAO,EAAA,IAAI,KAAM,CAAA,OAAO,CAAE,EAAA,CAAA;AAAA,GAC1E;AAAA,EAEA,SAAS,WAAmD,EAAA;AAC1D,IAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,QAAA,EAAU,WAAY,EAAA,CAAA;AAAA,GACnD;AAAA,EAEA,MAAA,CAAO,YAA0B,SAA2C,EAAA;AAC1E,IAAA,OAAO,EAAE,IAAM,EAAA,QAAA,EAAU,QAAU,EAAA,UAAA,EAAY,QAAQ,SAAU,EAAA,CAAA;AAAA,GACnE;AAAA,EAEA,SAAS,IAAkD,EAAA;AACzD,IAAA,OAAO,EAAE,IAAA,EAAM,UAAY,EAAA,QAAA,EAAU,IAAK,EAAA,CAAA;AAAA,GAC5C;AAAA,EAEA,QAAQ,GAAqC,EAAA;AAC3C,IAAO,OAAA,EAAE,IAAM,EAAA,SAAA,EAAW,GAAI,EAAA,CAAA;AAAA,GAChC;AACF,CAAU;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The catalog-backend-node module for `@backstage/plugin-catalog-backend`.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
/// <reference types="node" />
|
|
8
|
-
|
|
9
|
-
import { CatalogApi } from '@backstage/catalog-client';
|
|
10
|
-
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
11
|
-
import { Entity } from '@backstage/catalog-model';
|
|
12
|
-
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
2
|
+
import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
|
|
13
3
|
import { JsonValue } from '@backstage/types';
|
|
14
|
-
import { LocationSpec as
|
|
15
|
-
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
16
|
-
|
|
17
|
-
/* Excluded from this release type: CatalogProcessingExtensionPoint */
|
|
4
|
+
import { LocationSpec as LocationSpec$1 } from '@backstage/plugin-catalog-common';
|
|
18
5
|
|
|
19
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Holds the entity location information.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
*
|
|
11
|
+
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
12
|
+
* This flag is then set to indicate that the file can be not present.
|
|
13
|
+
* default value: 'required'.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
|
|
17
|
+
*/
|
|
18
|
+
declare type LocationSpec = LocationSpec$1;
|
|
19
|
+
/**
|
|
20
|
+
* Holds the relation data for entities.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
declare type EntityRelationSpec = {
|
|
25
|
+
/**
|
|
26
|
+
* The source entity of this relation.
|
|
27
|
+
*/
|
|
28
|
+
source: CompoundEntityRef;
|
|
29
|
+
/**
|
|
30
|
+
* The type of the relation.
|
|
31
|
+
*/
|
|
32
|
+
type: string;
|
|
33
|
+
/**
|
|
34
|
+
* The target entity of this relation.
|
|
35
|
+
*/
|
|
36
|
+
target: CompoundEntityRef;
|
|
37
|
+
};
|
|
20
38
|
|
|
21
39
|
/**
|
|
22
40
|
* @public
|
|
23
41
|
*/
|
|
24
|
-
|
|
42
|
+
declare type CatalogProcessor = {
|
|
25
43
|
/**
|
|
26
44
|
* A unique identifier for the Catalog Processor.
|
|
27
45
|
*/
|
|
@@ -37,7 +55,7 @@ export declare type CatalogProcessor = {
|
|
|
37
55
|
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
38
56
|
* @returns True if handled by this processor, false otherwise
|
|
39
57
|
*/
|
|
40
|
-
readLocation?(location:
|
|
58
|
+
readLocation?(location: LocationSpec$1, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
|
|
41
59
|
/**
|
|
42
60
|
* Pre-processes an emitted entity, after it has been emitted but before it
|
|
43
61
|
* has been validated.
|
|
@@ -55,7 +73,7 @@ export declare type CatalogProcessor = {
|
|
|
55
73
|
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
56
74
|
* @returns The same entity or a modified version of it
|
|
57
75
|
*/
|
|
58
|
-
preProcessEntity?(entity: Entity, location:
|
|
76
|
+
preProcessEntity?(entity: Entity, location: LocationSpec$1, emit: CatalogProcessorEmit, originLocation: LocationSpec$1, cache: CatalogProcessorCache): Promise<Entity>;
|
|
59
77
|
/**
|
|
60
78
|
* Validates the entity as a known entity kind, after it has been pre-
|
|
61
79
|
* processed and has passed through basic overall validation.
|
|
@@ -77,9 +95,18 @@ export declare type CatalogProcessor = {
|
|
|
77
95
|
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
78
96
|
* @returns The same entity or a modified version of it
|
|
79
97
|
*/
|
|
80
|
-
postProcessEntity?(entity: Entity, location:
|
|
98
|
+
postProcessEntity?(entity: Entity, location: LocationSpec$1, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
|
|
81
99
|
};
|
|
82
|
-
|
|
100
|
+
/**
|
|
101
|
+
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
102
|
+
* into the actual result pieces. The default implementation performs a YAML
|
|
103
|
+
* document parsing.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
declare type CatalogProcessorParser = (options: {
|
|
107
|
+
data: Buffer;
|
|
108
|
+
location: LocationSpec$1;
|
|
109
|
+
}) => AsyncIterable<CatalogProcessorResult>;
|
|
83
110
|
/**
|
|
84
111
|
* A cache for storing data during processing.
|
|
85
112
|
*
|
|
@@ -96,7 +123,7 @@ export declare type CatalogProcessor = {
|
|
|
96
123
|
*
|
|
97
124
|
* @public
|
|
98
125
|
*/
|
|
99
|
-
|
|
126
|
+
interface CatalogProcessorCache {
|
|
100
127
|
/**
|
|
101
128
|
* Retrieve a value from the cache.
|
|
102
129
|
*/
|
|
@@ -106,102 +133,61 @@ export declare interface CatalogProcessorCache {
|
|
|
106
133
|
*/
|
|
107
134
|
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
|
|
108
135
|
}
|
|
109
|
-
|
|
110
136
|
/** @public */
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
|
|
113
138
|
/** @public */
|
|
114
|
-
|
|
139
|
+
declare type CatalogProcessorLocationResult = {
|
|
140
|
+
type: 'location';
|
|
141
|
+
location: LocationSpec$1;
|
|
142
|
+
};
|
|
143
|
+
/** @public */
|
|
144
|
+
declare type CatalogProcessorEntityResult = {
|
|
115
145
|
type: 'entity';
|
|
116
146
|
entity: Entity;
|
|
117
|
-
location:
|
|
147
|
+
location: LocationSpec$1;
|
|
118
148
|
};
|
|
119
|
-
|
|
120
149
|
/** @public */
|
|
121
|
-
|
|
122
|
-
type: '
|
|
123
|
-
|
|
124
|
-
location: LocationSpec_2;
|
|
150
|
+
declare type CatalogProcessorRelationResult = {
|
|
151
|
+
type: 'relation';
|
|
152
|
+
relation: EntityRelationSpec;
|
|
125
153
|
};
|
|
126
|
-
|
|
127
154
|
/** @public */
|
|
128
|
-
|
|
129
|
-
type: '
|
|
130
|
-
|
|
155
|
+
declare type CatalogProcessorErrorResult = {
|
|
156
|
+
type: 'error';
|
|
157
|
+
error: Error;
|
|
158
|
+
location: LocationSpec$1;
|
|
131
159
|
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
135
|
-
* into the actual result pieces. The default implementation performs a YAML
|
|
136
|
-
* document parsing.
|
|
137
|
-
* @public
|
|
138
|
-
*/
|
|
139
|
-
export declare type CatalogProcessorParser = (options: {
|
|
140
|
-
data: Buffer;
|
|
141
|
-
location: LocationSpec_2;
|
|
142
|
-
}) => AsyncIterable<CatalogProcessorResult>;
|
|
143
|
-
|
|
144
160
|
/** @public */
|
|
145
|
-
|
|
161
|
+
declare type CatalogProcessorRefreshKeysResult = {
|
|
146
162
|
type: 'refresh';
|
|
147
163
|
key: string;
|
|
148
164
|
};
|
|
149
|
-
|
|
150
165
|
/** @public */
|
|
151
|
-
|
|
152
|
-
type: 'relation';
|
|
153
|
-
relation: EntityRelationSpec;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/** @public */
|
|
157
|
-
export declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
158
|
-
|
|
159
|
-
/* Excluded from this release type: catalogServiceRef */
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Entities that are not yet processed.
|
|
163
|
-
* @public
|
|
164
|
-
*/
|
|
165
|
-
export declare type DeferredEntity = {
|
|
166
|
-
entity: Entity;
|
|
167
|
-
locationKey?: string;
|
|
168
|
-
};
|
|
166
|
+
declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
169
167
|
|
|
170
168
|
/**
|
|
171
|
-
*
|
|
172
|
-
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
169
|
+
* Factory functions for the standard processing result types.
|
|
173
170
|
*
|
|
174
171
|
* @public
|
|
175
172
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*/
|
|
186
|
-
connect(connection: EntityProviderConnection): Promise<void>;
|
|
187
|
-
}
|
|
173
|
+
declare const processingResult: Readonly<{
|
|
174
|
+
readonly notFoundError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult;
|
|
175
|
+
readonly inputError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult;
|
|
176
|
+
readonly generalError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult;
|
|
177
|
+
readonly location: (newLocation: LocationSpec$1) => CatalogProcessorResult;
|
|
178
|
+
readonly entity: (atLocation: LocationSpec$1, newEntity: Entity) => CatalogProcessorResult;
|
|
179
|
+
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
180
|
+
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
181
|
+
}>;
|
|
188
182
|
|
|
189
183
|
/**
|
|
190
|
-
*
|
|
191
|
-
* Entity providers use this connection to add and remove entities from the catalog.
|
|
192
|
-
*
|
|
184
|
+
* Entities that are not yet processed.
|
|
193
185
|
* @public
|
|
194
186
|
*/
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Schedules a refresh on all of the entities that have a matching refresh key associated with the provided keys.
|
|
202
|
-
*/
|
|
203
|
-
refresh(options: EntityProviderRefreshOptions): Promise<void>;
|
|
204
|
-
}
|
|
187
|
+
declare type DeferredEntity = {
|
|
188
|
+
entity: Entity;
|
|
189
|
+
locationKey?: string;
|
|
190
|
+
};
|
|
205
191
|
|
|
206
192
|
/**
|
|
207
193
|
* A 'full' mutation replaces all existing entities created by this entity provider with new ones.
|
|
@@ -210,7 +196,7 @@ export declare interface EntityProviderConnection {
|
|
|
210
196
|
*
|
|
211
197
|
* @public
|
|
212
198
|
*/
|
|
213
|
-
|
|
199
|
+
declare type EntityProviderMutation = {
|
|
214
200
|
type: 'full';
|
|
215
201
|
entities: DeferredEntity[];
|
|
216
202
|
} | {
|
|
@@ -221,63 +207,47 @@ export declare type EntityProviderMutation = {
|
|
|
221
207
|
locationKey?: string;
|
|
222
208
|
})[];
|
|
223
209
|
};
|
|
224
|
-
|
|
225
210
|
/**
|
|
226
211
|
* The options given to an entity refresh operation.
|
|
227
212
|
*
|
|
228
213
|
* @public
|
|
229
214
|
*/
|
|
230
|
-
|
|
215
|
+
declare type EntityProviderRefreshOptions = {
|
|
231
216
|
keys: string[];
|
|
232
217
|
};
|
|
233
|
-
|
|
234
218
|
/**
|
|
235
|
-
*
|
|
219
|
+
* The connection between the catalog and the entity provider.
|
|
220
|
+
* Entity providers use this connection to add and remove entities from the catalog.
|
|
236
221
|
*
|
|
237
222
|
* @public
|
|
238
223
|
*/
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* The source entity of this relation.
|
|
242
|
-
*/
|
|
243
|
-
source: CompoundEntityRef;
|
|
224
|
+
interface EntityProviderConnection {
|
|
244
225
|
/**
|
|
245
|
-
*
|
|
226
|
+
* Applies either a full or a delta update to the catalog engine.
|
|
246
227
|
*/
|
|
247
|
-
|
|
228
|
+
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
248
229
|
/**
|
|
249
|
-
*
|
|
230
|
+
* Schedules a refresh on all of the entities that have a matching refresh key associated with the provided keys.
|
|
250
231
|
*/
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Holds the entity location information.
|
|
256
|
-
*
|
|
257
|
-
* @remarks
|
|
258
|
-
*
|
|
259
|
-
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
260
|
-
* This flag is then set to indicate that the file can be not present.
|
|
261
|
-
* default value: 'required'.
|
|
262
|
-
*
|
|
263
|
-
* @public
|
|
264
|
-
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
|
|
265
|
-
*/
|
|
266
|
-
export declare type LocationSpec = LocationSpec_2;
|
|
267
|
-
|
|
232
|
+
refresh(options: EntityProviderRefreshOptions): Promise<void>;
|
|
233
|
+
}
|
|
268
234
|
/**
|
|
269
|
-
*
|
|
235
|
+
* An entity provider is able to provide entities to the catalog.
|
|
236
|
+
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
270
237
|
*
|
|
271
238
|
* @public
|
|
272
239
|
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
240
|
+
interface EntityProvider {
|
|
241
|
+
/**
|
|
242
|
+
* The name of the provider, which must be unique for all providers that are
|
|
243
|
+
* active in a catalog, and stable over time since emitted entities are
|
|
244
|
+
* related to the provider by this name.
|
|
245
|
+
*/
|
|
246
|
+
getProviderName(): string;
|
|
247
|
+
/**
|
|
248
|
+
* Called upon initialization by the catalog engine.
|
|
249
|
+
*/
|
|
250
|
+
connect(connection: EntityProviderConnection): Promise<void>;
|
|
251
|
+
}
|
|
282
252
|
|
|
283
|
-
export { }
|
|
253
|
+
export { CatalogProcessor, CatalogProcessorCache, CatalogProcessorEmit, CatalogProcessorEntityResult, CatalogProcessorErrorResult, CatalogProcessorLocationResult, CatalogProcessorParser, CatalogProcessorRefreshKeysResult, CatalogProcessorRelationResult, CatalogProcessorResult, DeferredEntity, EntityProvider, EntityProviderConnection, EntityProviderMutation, EntityProviderRefreshOptions, EntityRelationSpec, LocationSpec, processingResult };
|
package/package.json
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-node",
|
|
3
3
|
"description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
|
|
4
|
-
"version": "1.3.
|
|
5
|
-
"main": "dist/index.cjs.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
4
|
+
"version": "1.3.4-next.1",
|
|
5
|
+
"main": "./dist/index.cjs.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"require": "./dist/index.cjs.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.cjs.js"
|
|
16
|
+
},
|
|
17
|
+
"./alpha": {
|
|
18
|
+
"require": "./dist/alpha.cjs.js",
|
|
19
|
+
"types": "./dist/alpha.d.ts",
|
|
20
|
+
"default": "./dist/alpha.cjs.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
13
23
|
},
|
|
14
24
|
"backstage": {
|
|
15
25
|
"role": "node-library"
|
|
16
26
|
},
|
|
17
27
|
"scripts": {
|
|
18
28
|
"start": "backstage-cli package start",
|
|
19
|
-
"build": "backstage-cli package build
|
|
29
|
+
"build": "backstage-cli package build",
|
|
20
30
|
"lint": "backstage-cli package lint",
|
|
21
31
|
"test": "backstage-cli package test",
|
|
22
32
|
"clean": "backstage-cli package clean",
|
|
@@ -24,17 +34,17 @@
|
|
|
24
34
|
"postpack": "backstage-cli package postpack"
|
|
25
35
|
},
|
|
26
36
|
"dependencies": {
|
|
27
|
-
"@backstage/backend-plugin-api": "^0.4.
|
|
28
|
-
"@backstage/catalog-client": "^1.
|
|
29
|
-
"@backstage/catalog-model": "^1.2.
|
|
30
|
-
"@backstage/errors": "^1.1.
|
|
31
|
-
"@backstage/plugin-catalog-common": "^1.0.
|
|
37
|
+
"@backstage/backend-plugin-api": "^0.4.1-next.1",
|
|
38
|
+
"@backstage/catalog-client": "^1.4.0-next.1",
|
|
39
|
+
"@backstage/catalog-model": "^1.2.1-next.1",
|
|
40
|
+
"@backstage/errors": "^1.1.5-next.0",
|
|
41
|
+
"@backstage/plugin-catalog-common": "^1.0.12-next.1",
|
|
32
42
|
"@backstage/types": "^1.0.2"
|
|
33
43
|
},
|
|
34
44
|
"devDependencies": {
|
|
35
|
-
"@backstage/backend-common": "^0.18.
|
|
36
|
-
"@backstage/backend-test-utils": "^0.1.
|
|
37
|
-
"@backstage/cli": "^0.22.
|
|
45
|
+
"@backstage/backend-common": "^0.18.3-next.1",
|
|
46
|
+
"@backstage/backend-test-utils": "^0.1.35-next.1",
|
|
47
|
+
"@backstage/cli": "^0.22.4-next.1"
|
|
38
48
|
},
|
|
39
49
|
"files": [
|
|
40
50
|
"dist",
|
package/dist/index.alpha.d.ts
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The catalog-backend-node module for `@backstage/plugin-catalog-backend`.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/// <reference types="node" />
|
|
8
|
-
|
|
9
|
-
import { CatalogApi } from '@backstage/catalog-client';
|
|
10
|
-
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
11
|
-
import { Entity } from '@backstage/catalog-model';
|
|
12
|
-
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
13
|
-
import { JsonValue } from '@backstage/types';
|
|
14
|
-
import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common';
|
|
15
|
-
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @alpha
|
|
19
|
-
*/
|
|
20
|
-
export declare interface CatalogProcessingExtensionPoint {
|
|
21
|
-
addProcessor(...processors: Array<CatalogProcessor | Array<CatalogProcessor>>): void;
|
|
22
|
-
addEntityProvider(...providers: Array<EntityProvider | Array<EntityProvider>>): void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @alpha
|
|
27
|
-
*/
|
|
28
|
-
export declare const catalogProcessingExtensionPoint: ExtensionPoint<CatalogProcessingExtensionPoint>;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export declare type CatalogProcessor = {
|
|
34
|
-
/**
|
|
35
|
-
* A unique identifier for the Catalog Processor.
|
|
36
|
-
*/
|
|
37
|
-
getProcessorName(): string;
|
|
38
|
-
/**
|
|
39
|
-
* Reads the contents of a location.
|
|
40
|
-
*
|
|
41
|
-
* @param location - The location to read
|
|
42
|
-
* @param optional - Whether a missing target should trigger an error
|
|
43
|
-
* @param emit - A sink for items resulting from the read
|
|
44
|
-
* @param parser - A parser, that is able to take the raw catalog descriptor
|
|
45
|
-
* data and turn it into the actual result pieces.
|
|
46
|
-
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
47
|
-
* @returns True if handled by this processor, false otherwise
|
|
48
|
-
*/
|
|
49
|
-
readLocation?(location: LocationSpec_2, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
|
|
50
|
-
/**
|
|
51
|
-
* Pre-processes an emitted entity, after it has been emitted but before it
|
|
52
|
-
* has been validated.
|
|
53
|
-
*
|
|
54
|
-
* This type of processing usually involves enriching the entity with
|
|
55
|
-
* additional data, and the input entity may actually still be incomplete
|
|
56
|
-
* when the processor is invoked.
|
|
57
|
-
*
|
|
58
|
-
* @param entity - The (possibly partial) entity to process
|
|
59
|
-
* @param location - The location that the entity came from
|
|
60
|
-
* @param emit - A sink for auxiliary items resulting from the processing
|
|
61
|
-
* @param originLocation - The location that the entity originally came from.
|
|
62
|
-
* While location resolves to the direct parent location, originLocation
|
|
63
|
-
* tells which location was used to start the ingestion loop.
|
|
64
|
-
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
65
|
-
* @returns The same entity or a modified version of it
|
|
66
|
-
*/
|
|
67
|
-
preProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, originLocation: LocationSpec_2, cache: CatalogProcessorCache): Promise<Entity>;
|
|
68
|
-
/**
|
|
69
|
-
* Validates the entity as a known entity kind, after it has been pre-
|
|
70
|
-
* processed and has passed through basic overall validation.
|
|
71
|
-
*
|
|
72
|
-
* @param entity - The entity to validate
|
|
73
|
-
* @returns Resolves to true, if the entity was of a kind that was known and
|
|
74
|
-
* handled by this processor, and was found to be valid. Resolves to false,
|
|
75
|
-
* if the entity was not of a kind that was known by this processor.
|
|
76
|
-
* Rejects to an Error describing the problem, if the entity was of a kind
|
|
77
|
-
* that was known by this processor and was not valid.
|
|
78
|
-
*/
|
|
79
|
-
validateEntityKind?(entity: Entity): Promise<boolean>;
|
|
80
|
-
/**
|
|
81
|
-
* Post-processes an emitted entity, after it has been validated.
|
|
82
|
-
*
|
|
83
|
-
* @param entity - The entity to process
|
|
84
|
-
* @param location - The location that the entity came from
|
|
85
|
-
* @param emit - A sink for auxiliary items resulting from the processing
|
|
86
|
-
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
87
|
-
* @returns The same entity or a modified version of it
|
|
88
|
-
*/
|
|
89
|
-
postProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A cache for storing data during processing.
|
|
94
|
-
*
|
|
95
|
-
* The values stored in the cache are always local to each processor, meaning
|
|
96
|
-
* no processor can see cache values from other processors.
|
|
97
|
-
*
|
|
98
|
-
* The cache instance provided to the CatalogProcessor is also scoped to the
|
|
99
|
-
* entity being processed, meaning that each processor run can't see cache
|
|
100
|
-
* values from processing runs for other entities.
|
|
101
|
-
*
|
|
102
|
-
* Values that are set during a processing run will only be visible in the directly
|
|
103
|
-
* following run. The cache will be overwritten every run unless no new cache items
|
|
104
|
-
* are written, in which case the existing values remain in the cache.
|
|
105
|
-
*
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
export declare interface CatalogProcessorCache {
|
|
109
|
-
/**
|
|
110
|
-
* Retrieve a value from the cache.
|
|
111
|
-
*/
|
|
112
|
-
get<ItemType extends JsonValue>(key: string): Promise<ItemType | undefined>;
|
|
113
|
-
/**
|
|
114
|
-
* Store a value in the cache.
|
|
115
|
-
*/
|
|
116
|
-
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** @public */
|
|
120
|
-
export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
|
|
121
|
-
|
|
122
|
-
/** @public */
|
|
123
|
-
export declare type CatalogProcessorEntityResult = {
|
|
124
|
-
type: 'entity';
|
|
125
|
-
entity: Entity;
|
|
126
|
-
location: LocationSpec_2;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
/** @public */
|
|
130
|
-
export declare type CatalogProcessorErrorResult = {
|
|
131
|
-
type: 'error';
|
|
132
|
-
error: Error;
|
|
133
|
-
location: LocationSpec_2;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/** @public */
|
|
137
|
-
export declare type CatalogProcessorLocationResult = {
|
|
138
|
-
type: 'location';
|
|
139
|
-
location: LocationSpec_2;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
144
|
-
* into the actual result pieces. The default implementation performs a YAML
|
|
145
|
-
* document parsing.
|
|
146
|
-
* @public
|
|
147
|
-
*/
|
|
148
|
-
export declare type CatalogProcessorParser = (options: {
|
|
149
|
-
data: Buffer;
|
|
150
|
-
location: LocationSpec_2;
|
|
151
|
-
}) => AsyncIterable<CatalogProcessorResult>;
|
|
152
|
-
|
|
153
|
-
/** @public */
|
|
154
|
-
export declare type CatalogProcessorRefreshKeysResult = {
|
|
155
|
-
type: 'refresh';
|
|
156
|
-
key: string;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/** @public */
|
|
160
|
-
export declare type CatalogProcessorRelationResult = {
|
|
161
|
-
type: 'relation';
|
|
162
|
-
relation: EntityRelationSpec;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
/** @public */
|
|
166
|
-
export declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* The catalogService provides the catalog API.
|
|
170
|
-
* @alpha
|
|
171
|
-
*/
|
|
172
|
-
export declare const catalogServiceRef: ServiceRef<CatalogApi, "plugin">;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Entities that are not yet processed.
|
|
176
|
-
* @public
|
|
177
|
-
*/
|
|
178
|
-
export declare type DeferredEntity = {
|
|
179
|
-
entity: Entity;
|
|
180
|
-
locationKey?: string;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* An entity provider is able to provide entities to the catalog.
|
|
185
|
-
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
186
|
-
*
|
|
187
|
-
* @public
|
|
188
|
-
*/
|
|
189
|
-
export declare interface EntityProvider {
|
|
190
|
-
/**
|
|
191
|
-
* The name of the provider, which must be unique for all providers that are
|
|
192
|
-
* active in a catalog, and stable over time since emitted entities are
|
|
193
|
-
* related to the provider by this name.
|
|
194
|
-
*/
|
|
195
|
-
getProviderName(): string;
|
|
196
|
-
/**
|
|
197
|
-
* Called upon initialization by the catalog engine.
|
|
198
|
-
*/
|
|
199
|
-
connect(connection: EntityProviderConnection): Promise<void>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* The connection between the catalog and the entity provider.
|
|
204
|
-
* Entity providers use this connection to add and remove entities from the catalog.
|
|
205
|
-
*
|
|
206
|
-
* @public
|
|
207
|
-
*/
|
|
208
|
-
export declare interface EntityProviderConnection {
|
|
209
|
-
/**
|
|
210
|
-
* Applies either a full or a delta update to the catalog engine.
|
|
211
|
-
*/
|
|
212
|
-
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
213
|
-
/**
|
|
214
|
-
* Schedules a refresh on all of the entities that have a matching refresh key associated with the provided keys.
|
|
215
|
-
*/
|
|
216
|
-
refresh(options: EntityProviderRefreshOptions): Promise<void>;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* A 'full' mutation replaces all existing entities created by this entity provider with new ones.
|
|
221
|
-
* A 'delta' mutation can both add and remove entities provided by this provider. Previously provided
|
|
222
|
-
* entities from a 'full' mutation are not removed.
|
|
223
|
-
*
|
|
224
|
-
* @public
|
|
225
|
-
*/
|
|
226
|
-
export declare type EntityProviderMutation = {
|
|
227
|
-
type: 'full';
|
|
228
|
-
entities: DeferredEntity[];
|
|
229
|
-
} | {
|
|
230
|
-
type: 'delta';
|
|
231
|
-
added: DeferredEntity[];
|
|
232
|
-
removed: (DeferredEntity | {
|
|
233
|
-
entityRef: string;
|
|
234
|
-
locationKey?: string;
|
|
235
|
-
})[];
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* The options given to an entity refresh operation.
|
|
240
|
-
*
|
|
241
|
-
* @public
|
|
242
|
-
*/
|
|
243
|
-
export declare type EntityProviderRefreshOptions = {
|
|
244
|
-
keys: string[];
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Holds the relation data for entities.
|
|
249
|
-
*
|
|
250
|
-
* @public
|
|
251
|
-
*/
|
|
252
|
-
export declare type EntityRelationSpec = {
|
|
253
|
-
/**
|
|
254
|
-
* The source entity of this relation.
|
|
255
|
-
*/
|
|
256
|
-
source: CompoundEntityRef;
|
|
257
|
-
/**
|
|
258
|
-
* The type of the relation.
|
|
259
|
-
*/
|
|
260
|
-
type: string;
|
|
261
|
-
/**
|
|
262
|
-
* The target entity of this relation.
|
|
263
|
-
*/
|
|
264
|
-
target: CompoundEntityRef;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Holds the entity location information.
|
|
269
|
-
*
|
|
270
|
-
* @remarks
|
|
271
|
-
*
|
|
272
|
-
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
273
|
-
* This flag is then set to indicate that the file can be not present.
|
|
274
|
-
* default value: 'required'.
|
|
275
|
-
*
|
|
276
|
-
* @public
|
|
277
|
-
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
|
|
278
|
-
*/
|
|
279
|
-
export declare type LocationSpec = LocationSpec_2;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Factory functions for the standard processing result types.
|
|
283
|
-
*
|
|
284
|
-
* @public
|
|
285
|
-
*/
|
|
286
|
-
export declare const processingResult: Readonly<{
|
|
287
|
-
readonly notFoundError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
|
|
288
|
-
readonly inputError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
|
|
289
|
-
readonly generalError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
|
|
290
|
-
readonly location: (newLocation: LocationSpec_2) => CatalogProcessorResult;
|
|
291
|
-
readonly entity: (atLocation: LocationSpec_2, newEntity: Entity) => CatalogProcessorResult;
|
|
292
|
-
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
293
|
-
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
294
|
-
}>;
|
|
295
|
-
|
|
296
|
-
export { }
|
package/dist/index.beta.d.ts
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The catalog-backend-node module for `@backstage/plugin-catalog-backend`.
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/// <reference types="node" />
|
|
8
|
-
|
|
9
|
-
import { CatalogApi } from '@backstage/catalog-client';
|
|
10
|
-
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
11
|
-
import { Entity } from '@backstage/catalog-model';
|
|
12
|
-
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
13
|
-
import { JsonValue } from '@backstage/types';
|
|
14
|
-
import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common';
|
|
15
|
-
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
16
|
-
|
|
17
|
-
/* Excluded from this release type: CatalogProcessingExtensionPoint */
|
|
18
|
-
|
|
19
|
-
/* Excluded from this release type: catalogProcessingExtensionPoint */
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
export declare type CatalogProcessor = {
|
|
25
|
-
/**
|
|
26
|
-
* A unique identifier for the Catalog Processor.
|
|
27
|
-
*/
|
|
28
|
-
getProcessorName(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Reads the contents of a location.
|
|
31
|
-
*
|
|
32
|
-
* @param location - The location to read
|
|
33
|
-
* @param optional - Whether a missing target should trigger an error
|
|
34
|
-
* @param emit - A sink for items resulting from the read
|
|
35
|
-
* @param parser - A parser, that is able to take the raw catalog descriptor
|
|
36
|
-
* data and turn it into the actual result pieces.
|
|
37
|
-
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
38
|
-
* @returns True if handled by this processor, false otherwise
|
|
39
|
-
*/
|
|
40
|
-
readLocation?(location: LocationSpec_2, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
|
|
41
|
-
/**
|
|
42
|
-
* Pre-processes an emitted entity, after it has been emitted but before it
|
|
43
|
-
* has been validated.
|
|
44
|
-
*
|
|
45
|
-
* This type of processing usually involves enriching the entity with
|
|
46
|
-
* additional data, and the input entity may actually still be incomplete
|
|
47
|
-
* when the processor is invoked.
|
|
48
|
-
*
|
|
49
|
-
* @param entity - The (possibly partial) entity to process
|
|
50
|
-
* @param location - The location that the entity came from
|
|
51
|
-
* @param emit - A sink for auxiliary items resulting from the processing
|
|
52
|
-
* @param originLocation - The location that the entity originally came from.
|
|
53
|
-
* While location resolves to the direct parent location, originLocation
|
|
54
|
-
* tells which location was used to start the ingestion loop.
|
|
55
|
-
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
56
|
-
* @returns The same entity or a modified version of it
|
|
57
|
-
*/
|
|
58
|
-
preProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, originLocation: LocationSpec_2, cache: CatalogProcessorCache): Promise<Entity>;
|
|
59
|
-
/**
|
|
60
|
-
* Validates the entity as a known entity kind, after it has been pre-
|
|
61
|
-
* processed and has passed through basic overall validation.
|
|
62
|
-
*
|
|
63
|
-
* @param entity - The entity to validate
|
|
64
|
-
* @returns Resolves to true, if the entity was of a kind that was known and
|
|
65
|
-
* handled by this processor, and was found to be valid. Resolves to false,
|
|
66
|
-
* if the entity was not of a kind that was known by this processor.
|
|
67
|
-
* Rejects to an Error describing the problem, if the entity was of a kind
|
|
68
|
-
* that was known by this processor and was not valid.
|
|
69
|
-
*/
|
|
70
|
-
validateEntityKind?(entity: Entity): Promise<boolean>;
|
|
71
|
-
/**
|
|
72
|
-
* Post-processes an emitted entity, after it has been validated.
|
|
73
|
-
*
|
|
74
|
-
* @param entity - The entity to process
|
|
75
|
-
* @param location - The location that the entity came from
|
|
76
|
-
* @param emit - A sink for auxiliary items resulting from the processing
|
|
77
|
-
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
78
|
-
* @returns The same entity or a modified version of it
|
|
79
|
-
*/
|
|
80
|
-
postProcessEntity?(entity: Entity, location: LocationSpec_2, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* A cache for storing data during processing.
|
|
85
|
-
*
|
|
86
|
-
* The values stored in the cache are always local to each processor, meaning
|
|
87
|
-
* no processor can see cache values from other processors.
|
|
88
|
-
*
|
|
89
|
-
* The cache instance provided to the CatalogProcessor is also scoped to the
|
|
90
|
-
* entity being processed, meaning that each processor run can't see cache
|
|
91
|
-
* values from processing runs for other entities.
|
|
92
|
-
*
|
|
93
|
-
* Values that are set during a processing run will only be visible in the directly
|
|
94
|
-
* following run. The cache will be overwritten every run unless no new cache items
|
|
95
|
-
* are written, in which case the existing values remain in the cache.
|
|
96
|
-
*
|
|
97
|
-
* @public
|
|
98
|
-
*/
|
|
99
|
-
export declare interface CatalogProcessorCache {
|
|
100
|
-
/**
|
|
101
|
-
* Retrieve a value from the cache.
|
|
102
|
-
*/
|
|
103
|
-
get<ItemType extends JsonValue>(key: string): Promise<ItemType | undefined>;
|
|
104
|
-
/**
|
|
105
|
-
* Store a value in the cache.
|
|
106
|
-
*/
|
|
107
|
-
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/** @public */
|
|
111
|
-
export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
|
|
112
|
-
|
|
113
|
-
/** @public */
|
|
114
|
-
export declare type CatalogProcessorEntityResult = {
|
|
115
|
-
type: 'entity';
|
|
116
|
-
entity: Entity;
|
|
117
|
-
location: LocationSpec_2;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/** @public */
|
|
121
|
-
export declare type CatalogProcessorErrorResult = {
|
|
122
|
-
type: 'error';
|
|
123
|
-
error: Error;
|
|
124
|
-
location: LocationSpec_2;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
/** @public */
|
|
128
|
-
export declare type CatalogProcessorLocationResult = {
|
|
129
|
-
type: 'location';
|
|
130
|
-
location: LocationSpec_2;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
135
|
-
* into the actual result pieces. The default implementation performs a YAML
|
|
136
|
-
* document parsing.
|
|
137
|
-
* @public
|
|
138
|
-
*/
|
|
139
|
-
export declare type CatalogProcessorParser = (options: {
|
|
140
|
-
data: Buffer;
|
|
141
|
-
location: LocationSpec_2;
|
|
142
|
-
}) => AsyncIterable<CatalogProcessorResult>;
|
|
143
|
-
|
|
144
|
-
/** @public */
|
|
145
|
-
export declare type CatalogProcessorRefreshKeysResult = {
|
|
146
|
-
type: 'refresh';
|
|
147
|
-
key: string;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
/** @public */
|
|
151
|
-
export declare type CatalogProcessorRelationResult = {
|
|
152
|
-
type: 'relation';
|
|
153
|
-
relation: EntityRelationSpec;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/** @public */
|
|
157
|
-
export declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
158
|
-
|
|
159
|
-
/* Excluded from this release type: catalogServiceRef */
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Entities that are not yet processed.
|
|
163
|
-
* @public
|
|
164
|
-
*/
|
|
165
|
-
export declare type DeferredEntity = {
|
|
166
|
-
entity: Entity;
|
|
167
|
-
locationKey?: string;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* An entity provider is able to provide entities to the catalog.
|
|
172
|
-
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
173
|
-
*
|
|
174
|
-
* @public
|
|
175
|
-
*/
|
|
176
|
-
export declare interface EntityProvider {
|
|
177
|
-
/**
|
|
178
|
-
* The name of the provider, which must be unique for all providers that are
|
|
179
|
-
* active in a catalog, and stable over time since emitted entities are
|
|
180
|
-
* related to the provider by this name.
|
|
181
|
-
*/
|
|
182
|
-
getProviderName(): string;
|
|
183
|
-
/**
|
|
184
|
-
* Called upon initialization by the catalog engine.
|
|
185
|
-
*/
|
|
186
|
-
connect(connection: EntityProviderConnection): Promise<void>;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* The connection between the catalog and the entity provider.
|
|
191
|
-
* Entity providers use this connection to add and remove entities from the catalog.
|
|
192
|
-
*
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
export declare interface EntityProviderConnection {
|
|
196
|
-
/**
|
|
197
|
-
* Applies either a full or a delta update to the catalog engine.
|
|
198
|
-
*/
|
|
199
|
-
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Schedules a refresh on all of the entities that have a matching refresh key associated with the provided keys.
|
|
202
|
-
*/
|
|
203
|
-
refresh(options: EntityProviderRefreshOptions): Promise<void>;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* A 'full' mutation replaces all existing entities created by this entity provider with new ones.
|
|
208
|
-
* A 'delta' mutation can both add and remove entities provided by this provider. Previously provided
|
|
209
|
-
* entities from a 'full' mutation are not removed.
|
|
210
|
-
*
|
|
211
|
-
* @public
|
|
212
|
-
*/
|
|
213
|
-
export declare type EntityProviderMutation = {
|
|
214
|
-
type: 'full';
|
|
215
|
-
entities: DeferredEntity[];
|
|
216
|
-
} | {
|
|
217
|
-
type: 'delta';
|
|
218
|
-
added: DeferredEntity[];
|
|
219
|
-
removed: (DeferredEntity | {
|
|
220
|
-
entityRef: string;
|
|
221
|
-
locationKey?: string;
|
|
222
|
-
})[];
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* The options given to an entity refresh operation.
|
|
227
|
-
*
|
|
228
|
-
* @public
|
|
229
|
-
*/
|
|
230
|
-
export declare type EntityProviderRefreshOptions = {
|
|
231
|
-
keys: string[];
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Holds the relation data for entities.
|
|
236
|
-
*
|
|
237
|
-
* @public
|
|
238
|
-
*/
|
|
239
|
-
export declare type EntityRelationSpec = {
|
|
240
|
-
/**
|
|
241
|
-
* The source entity of this relation.
|
|
242
|
-
*/
|
|
243
|
-
source: CompoundEntityRef;
|
|
244
|
-
/**
|
|
245
|
-
* The type of the relation.
|
|
246
|
-
*/
|
|
247
|
-
type: string;
|
|
248
|
-
/**
|
|
249
|
-
* The target entity of this relation.
|
|
250
|
-
*/
|
|
251
|
-
target: CompoundEntityRef;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Holds the entity location information.
|
|
256
|
-
*
|
|
257
|
-
* @remarks
|
|
258
|
-
*
|
|
259
|
-
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
260
|
-
* This flag is then set to indicate that the file can be not present.
|
|
261
|
-
* default value: 'required'.
|
|
262
|
-
*
|
|
263
|
-
* @public
|
|
264
|
-
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
|
|
265
|
-
*/
|
|
266
|
-
export declare type LocationSpec = LocationSpec_2;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Factory functions for the standard processing result types.
|
|
270
|
-
*
|
|
271
|
-
* @public
|
|
272
|
-
*/
|
|
273
|
-
export declare const processingResult: Readonly<{
|
|
274
|
-
readonly notFoundError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
|
|
275
|
-
readonly inputError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
|
|
276
|
-
readonly generalError: (atLocation: LocationSpec_2, message: string) => CatalogProcessorResult;
|
|
277
|
-
readonly location: (newLocation: LocationSpec_2) => CatalogProcessorResult;
|
|
278
|
-
readonly entity: (atLocation: LocationSpec_2, newEntity: Entity) => CatalogProcessorResult;
|
|
279
|
-
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
280
|
-
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
281
|
-
}>;
|
|
282
|
-
|
|
283
|
-
export { }
|