@backstage/plugin-catalog-node 1.13.1 → 1.14.0-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 +34 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +15 -3
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +6 -6
- package/dist/catalogService.cjs.js +108 -2
- package/dist/catalogService.cjs.js.map +1 -1
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +38 -1
- package/package.json +12 -11
- package/testUtils/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-node
|
|
2
2
|
|
|
3
|
+
## 1.14.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-plugin-api@1.0.2-next.1
|
|
9
|
+
- @backstage/catalog-client@1.8.0-next.0
|
|
10
|
+
- @backstage/catalog-model@1.7.0
|
|
11
|
+
- @backstage/errors@1.2.4
|
|
12
|
+
- @backstage/types@1.1.1
|
|
13
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
14
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
15
|
+
- @backstage/plugin-permission-node@0.8.5-next.1
|
|
16
|
+
|
|
17
|
+
## 1.14.0-next.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- bc13b42: The `catalogServiceRef` now has its own accompanying `CatalogService` interface that requires Backstage `credentials` objects to be passed. This new version of the `catalogServiceRef` has been promoted and is now available via the main `@backstage/plugin-catalog-node` entry point.
|
|
22
|
+
|
|
23
|
+
The old `catalogServiceRef` with the old `CatalogApi` type is still available from the `/alpha` entry point.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/catalog-client@1.8.0-next.0
|
|
29
|
+
- @backstage/backend-plugin-api@1.0.2-next.0
|
|
30
|
+
- @backstage/catalog-model@1.7.0
|
|
31
|
+
- @backstage/errors@1.2.4
|
|
32
|
+
- @backstage/types@1.1.1
|
|
33
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
34
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
35
|
+
- @backstage/plugin-permission-node@0.8.5-next.0
|
|
36
|
+
|
|
3
37
|
## 1.13.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
|
+
var catalogClient = require('@backstage/catalog-client');
|
|
4
5
|
var extensions = require('./extensions.cjs.js');
|
|
5
6
|
|
|
7
|
+
const catalogServiceRef = backendPluginApi.createServiceRef({
|
|
8
|
+
id: "catalog-client",
|
|
9
|
+
defaultFactory: async (service) => backendPluginApi.createServiceFactory({
|
|
10
|
+
service,
|
|
11
|
+
deps: {
|
|
12
|
+
discoveryApi: backendPluginApi.coreServices.discovery
|
|
13
|
+
},
|
|
14
|
+
async factory({ discoveryApi }) {
|
|
15
|
+
return new catalogClient.CatalogClient({ discoveryApi });
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
});
|
|
6
19
|
|
|
7
|
-
|
|
8
|
-
exports.catalogServiceRef = catalogService.catalogServiceRef;
|
|
9
20
|
exports.catalogAnalysisExtensionPoint = extensions.catalogAnalysisExtensionPoint;
|
|
10
21
|
exports.catalogLocationsExtensionPoint = extensions.catalogLocationsExtensionPoint;
|
|
11
22
|
exports.catalogModelExtensionPoint = extensions.catalogModelExtensionPoint;
|
|
12
23
|
exports.catalogPermissionExtensionPoint = extensions.catalogPermissionExtensionPoint;
|
|
13
24
|
exports.catalogProcessingExtensionPoint = extensions.catalogProcessingExtensionPoint;
|
|
25
|
+
exports.catalogServiceRef = catalogServiceRef;
|
|
14
26
|
//# sourceMappingURL=alpha.cjs.js.map
|
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.ts"],"sourcesContent":["/*\n * Copyright 2023 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 coreServices,\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { catalogServiceRef as _catalogServiceRef } from './catalogService';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead\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\nexport type { CatalogLocationsExtensionPoint } from './extensions';\nexport { catalogLocationsExtensionPoint } from './extensions';\nexport type { CatalogProcessingExtensionPoint } from './extensions';\nexport { catalogProcessingExtensionPoint } from './extensions';\nexport type { CatalogAnalysisExtensionPoint } from './extensions';\nexport { catalogAnalysisExtensionPoint } from './extensions';\nexport type { CatalogPermissionRuleInput } from './extensions';\nexport type { CatalogPermissionExtensionPoint } from './extensions';\nexport { catalogPermissionExtensionPoint } from './extensions';\nexport type { CatalogModelExtensionPoint } from './extensions';\nexport { catalogModelExtensionPoint } from './extensions';\n"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient"],"mappings":";;;;;;AA4BO,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;;;;;;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -5,12 +5,6 @@ import { CatalogProcessor, EntityProvider, PlaceholderResolver, CatalogProcessor
|
|
|
5
5
|
import { PermissionRuleParams, Permission } from '@backstage/plugin-permission-common';
|
|
6
6
|
import { PermissionRule } from '@backstage/plugin-permission-node';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* The catalogService provides the catalog API.
|
|
10
|
-
* @alpha
|
|
11
|
-
*/
|
|
12
|
-
declare const catalogServiceRef: _backstage_backend_plugin_api.ServiceRef<CatalogApi, "plugin", "singleton">;
|
|
13
|
-
|
|
14
8
|
/**
|
|
15
9
|
* @alpha
|
|
16
10
|
*/
|
|
@@ -102,4 +96,10 @@ interface CatalogPermissionExtensionPoint {
|
|
|
102
96
|
*/
|
|
103
97
|
declare const catalogPermissionExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogPermissionExtensionPoint>;
|
|
104
98
|
|
|
99
|
+
/**
|
|
100
|
+
* @alpha
|
|
101
|
+
* @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead
|
|
102
|
+
*/
|
|
103
|
+
declare const catalogServiceRef: _backstage_backend_plugin_api.ServiceRef<CatalogApi, "plugin", "singleton">;
|
|
104
|
+
|
|
105
105
|
export { type CatalogAnalysisExtensionPoint, type CatalogLocationsExtensionPoint, type CatalogModelExtensionPoint, type CatalogPermissionExtensionPoint, type CatalogPermissionRuleInput, type CatalogProcessingExtensionPoint, catalogAnalysisExtensionPoint, catalogLocationsExtensionPoint, catalogModelExtensionPoint, catalogPermissionExtensionPoint, catalogProcessingExtensionPoint, catalogServiceRef };
|
|
@@ -3,15 +3,121 @@
|
|
|
3
3
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
4
|
var catalogClient = require('@backstage/catalog-client');
|
|
5
5
|
|
|
6
|
+
class DefaultCatalogService {
|
|
7
|
+
#auth;
|
|
8
|
+
#catalogApi;
|
|
9
|
+
constructor({
|
|
10
|
+
catalogApi,
|
|
11
|
+
auth
|
|
12
|
+
}) {
|
|
13
|
+
this.#catalogApi = catalogApi;
|
|
14
|
+
this.#auth = auth;
|
|
15
|
+
}
|
|
16
|
+
async getEntities(request, options) {
|
|
17
|
+
return this.#catalogApi.getEntities(
|
|
18
|
+
request,
|
|
19
|
+
await this.#getOptions(options)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
async getEntitiesByRefs(request, options) {
|
|
23
|
+
return this.#catalogApi.getEntitiesByRefs(
|
|
24
|
+
request,
|
|
25
|
+
await this.#getOptions(options)
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
async queryEntities(request, options) {
|
|
29
|
+
return this.#catalogApi.queryEntities(
|
|
30
|
+
request,
|
|
31
|
+
await this.#getOptions(options)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
async getEntityAncestors(request, options) {
|
|
35
|
+
return this.#catalogApi.getEntityAncestors(
|
|
36
|
+
request,
|
|
37
|
+
await this.#getOptions(options)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
async getEntityByRef(entityRef, options) {
|
|
41
|
+
return this.#catalogApi.getEntityByRef(
|
|
42
|
+
entityRef,
|
|
43
|
+
await this.#getOptions(options)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
async removeEntityByUid(uid, options) {
|
|
47
|
+
return this.#catalogApi.removeEntityByUid(
|
|
48
|
+
uid,
|
|
49
|
+
await this.#getOptions(options)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
async refreshEntity(entityRef, options) {
|
|
53
|
+
return this.#catalogApi.refreshEntity(
|
|
54
|
+
entityRef,
|
|
55
|
+
await this.#getOptions(options)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
async getEntityFacets(request, options) {
|
|
59
|
+
return this.#catalogApi.getEntityFacets(
|
|
60
|
+
request,
|
|
61
|
+
await this.#getOptions(options)
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
async getLocationById(id, options) {
|
|
65
|
+
return this.#catalogApi.getLocationById(
|
|
66
|
+
id,
|
|
67
|
+
await this.#getOptions(options)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
async getLocationByRef(locationRef, options) {
|
|
71
|
+
return this.#catalogApi.getLocationByRef(
|
|
72
|
+
locationRef,
|
|
73
|
+
await this.#getOptions(options)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
async addLocation(location, options) {
|
|
77
|
+
return this.#catalogApi.addLocation(
|
|
78
|
+
location,
|
|
79
|
+
await this.#getOptions(options)
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
async removeLocationById(id, options) {
|
|
83
|
+
return this.#catalogApi.removeLocationById(
|
|
84
|
+
id,
|
|
85
|
+
await this.#getOptions(options)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
async getLocationByEntity(entityRef, options) {
|
|
89
|
+
return this.#catalogApi.getLocationByEntity(
|
|
90
|
+
entityRef,
|
|
91
|
+
await this.#getOptions(options)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
async validateEntity(entity, locationRef, options) {
|
|
95
|
+
return this.#catalogApi.validateEntity(
|
|
96
|
+
entity,
|
|
97
|
+
locationRef,
|
|
98
|
+
await this.#getOptions(options)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
async #getOptions(options) {
|
|
102
|
+
return this.#auth.getPluginRequestToken({
|
|
103
|
+
onBehalfOf: options.credentials,
|
|
104
|
+
targetPluginId: "catalog"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
6
108
|
const catalogServiceRef = backendPluginApi.createServiceRef({
|
|
7
109
|
id: "catalog-client",
|
|
8
110
|
defaultFactory: async (service) => backendPluginApi.createServiceFactory({
|
|
9
111
|
service,
|
|
10
112
|
deps: {
|
|
113
|
+
auth: backendPluginApi.coreServices.auth,
|
|
11
114
|
discoveryApi: backendPluginApi.coreServices.discovery
|
|
12
115
|
},
|
|
13
|
-
async factory({ discoveryApi }) {
|
|
14
|
-
return new
|
|
116
|
+
async factory({ auth, discoveryApi }) {
|
|
117
|
+
return new DefaultCatalogService({
|
|
118
|
+
auth,
|
|
119
|
+
catalogApi: new catalogClient.CatalogClient({ discoveryApi })
|
|
120
|
+
});
|
|
15
121
|
}
|
|
16
122
|
})
|
|
17
123
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogService.cjs.js","sources":["../src/catalogService.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"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient"],"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;;;;"}
|
|
1
|
+
{"version":3,"file":"catalogService.cjs.js","sources":["../src/catalogService.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 BackstageCredentials,\n AuthService,\n} from '@backstage/backend-plugin-api';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CatalogApi,\n CatalogClient,\n CatalogRequestOptions,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n ValidateEntityResponse,\n} from '@backstage/catalog-client';\nimport { CompoundEntityRef, Entity } from '@backstage/catalog-model';\n\n/**\n * @public\n */\nexport interface CatalogServiceRequestOptions {\n credentials: BackstageCredentials;\n}\n\n/**\n * A version of the {@link @backstage/catalog-client#CatalogApi | CatalogApi} that\n * requires backend credentials to be passed instead of a token.\n *\n * @public\n */\nexport interface CatalogService {\n getEntities(\n request: GetEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n queryEntities(\n request: QueryEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Entity | undefined>;\n\n removeEntityByUid(\n uid: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n refreshEntity(\n entityRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n getLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n getLocationByRef(\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n addLocation(\n location: AddLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AddLocationResponse>;\n\n removeLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void>;\n\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined>;\n\n validateEntity(\n entity: Entity,\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<ValidateEntityResponse>;\n}\n\nclass DefaultCatalogService implements CatalogService {\n readonly #auth: AuthService;\n readonly #catalogApi: CatalogApi;\n\n constructor({\n catalogApi,\n auth,\n }: {\n catalogApi: CatalogApi;\n auth: AuthService;\n }) {\n this.#catalogApi = catalogApi;\n this.#auth = auth;\n }\n\n async getEntities(\n request: GetEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesResponse> {\n return this.#catalogApi.getEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n return this.#catalogApi.getEntitiesByRefs(\n request,\n await this.#getOptions(options),\n );\n }\n\n async queryEntities(\n request: QueryEntitiesRequest | undefined,\n options: CatalogServiceRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n return this.#catalogApi.queryEntities(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return this.#catalogApi.getEntityAncestors(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Entity | undefined> {\n return this.#catalogApi.getEntityByRef(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async removeEntityByUid(\n uid: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.removeEntityByUid(\n uid,\n await this.#getOptions(options),\n );\n }\n\n async refreshEntity(\n entityRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.refreshEntity(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n return this.#catalogApi.getEntityFacets(\n request,\n await this.#getOptions(options),\n );\n }\n\n async getLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationById(\n id,\n await this.#getOptions(options),\n );\n }\n\n async getLocationByRef(\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationByRef(\n locationRef,\n await this.#getOptions(options),\n );\n }\n\n async addLocation(\n location: AddLocationRequest,\n options: CatalogServiceRequestOptions,\n ): Promise<AddLocationResponse> {\n return this.#catalogApi.addLocation(\n location,\n await this.#getOptions(options),\n );\n }\n\n async removeLocationById(\n id: string,\n options: CatalogServiceRequestOptions,\n ): Promise<void> {\n return this.#catalogApi.removeLocationById(\n id,\n await this.#getOptions(options),\n );\n }\n\n async getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options: CatalogServiceRequestOptions,\n ): Promise<Location | undefined> {\n return this.#catalogApi.getLocationByEntity(\n entityRef,\n await this.#getOptions(options),\n );\n }\n\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options: CatalogServiceRequestOptions,\n ): Promise<ValidateEntityResponse> {\n return this.#catalogApi.validateEntity(\n entity,\n locationRef,\n await this.#getOptions(options),\n );\n }\n\n async #getOptions(\n options: CatalogServiceRequestOptions,\n ): Promise<CatalogRequestOptions> {\n return this.#auth.getPluginRequestToken({\n onBehalfOf: options.credentials,\n targetPluginId: 'catalog',\n });\n }\n}\n\n/**\n * The catalogService provides the catalog API.\n *\n * @public\n */\nexport const catalogServiceRef = createServiceRef<CatalogService>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n auth: coreServices.auth,\n discoveryApi: coreServices.discovery,\n },\n async factory({ auth, discoveryApi }) {\n return new DefaultCatalogService({\n auth,\n catalogApi: new CatalogClient({ discoveryApi }),\n });\n },\n }),\n});\n"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient"],"mappings":";;;;;AAkIA,MAAM,qBAAgD,CAAA;AAAA,EAC3C,KAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EAET,WAAY,CAAA;AAAA,IACV,UAAA;AAAA,IACA,IAAA;AAAA,GAIC,EAAA;AACD,IAAA,IAAA,CAAK,WAAc,GAAA,UAAA,CAAA;AACnB,IAAA,IAAA,CAAK,KAAQ,GAAA,IAAA,CAAA;AAAA,GACf;AAAA,EAEA,MAAM,WACJ,CAAA,OAAA,EACA,OAC8B,EAAA;AAC9B,IAAA,OAAO,KAAK,WAAY,CAAA,WAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAK,CAAA,WAAA,CAAY,OAAO,CAAA;AAAA,KAChC,CAAA;AAAA,GACF;AAAA,EAEA,MAAM,iBACJ,CAAA,OAAA,EACA,OACoC,EAAA;AACpC,IAAA,OAAO,KAAK,WAAY,CAAA,iBAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAK,CAAA,WAAA,CAAY,OAAO,CAAA;AAAA,KAChC,CAAA;AAAA,GACF;AAAA,EAEA,MAAM,aACJ,CAAA,OAAA,EACA,OACgC,EAAA;AAChC,IAAA,OAAO,KAAK,WAAY,CAAA,aAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAK,CAAA,WAAA,CAAY,OAAO,CAAA;AAAA,KAChC,CAAA;AAAA,GACF;AAAA,EAEA,MAAM,kBACJ,CAAA,OAAA,EACA,OACqC,EAAA;AACrC,IAAA,OAAO,KAAK,WAAY,CAAA,kBAAA;AAAA,MACtB,OAAA;AAAA,MACA,MAAM,IAAK,CAAA,WAAA,CAAY,OAAO,CAAA;AAAA,KAChC,CAAA;AAAA,GACF;AAAA,EAEA,MAAM,cACJ,CAAA,SAAA,EACA,OAC6B,EAAA;AAC7B,IAAA,OAAO,KAAK,WAAY,CAAA,c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AC/B,IAAA;AAAA,QACA,UAAY,EAAA,IAAIC,2BAAc,CAAA,EAAE,cAAc,CAAA;AAAA,OAC/C,CAAA,CAAA;AAAA,KACH;AAAA,GACD,CAAA;AACL,CAAC;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var processingResult = require('./api/processingResult.cjs.js');
|
|
4
4
|
var conversion = require('./conversion.cjs.js');
|
|
5
|
+
var catalogService = require('./catalogService.cjs.js');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
exports.processingResult = processingResult.processingResult;
|
|
9
10
|
exports.locationSpecToLocationEntity = conversion.locationSpecToLocationEntity;
|
|
10
11
|
exports.locationSpecToMetadataName = conversion.locationSpecToMetadataName;
|
|
12
|
+
exports.catalogServiceRef = catalogService.catalogServiceRef;
|
|
11
13
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { CompoundEntityRef, Entity, LocationEntityV1alpha1 } from '@backstage/catalog-model';
|
|
3
3
|
import { JsonValue } from '@backstage/types';
|
|
4
4
|
import { LocationSpec as LocationSpec$1, AnalyzeLocationRequest, AnalyzeLocationResponse, AnalyzeLocationExistingEntity } from '@backstage/plugin-catalog-common';
|
|
5
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
5
6
|
import { BackstageCredentials } from '@backstage/backend-plugin-api';
|
|
7
|
+
import { GetEntitiesRequest, GetEntitiesResponse, GetEntitiesByRefsRequest, GetEntitiesByRefsResponse, QueryEntitiesRequest, QueryEntitiesResponse, GetEntityAncestorsRequest, GetEntityAncestorsResponse, GetEntityFacetsRequest, GetEntityFacetsResponse, Location, AddLocationRequest, AddLocationResponse, ValidateEntityResponse } from '@backstage/catalog-client';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Holds the entity location information.
|
|
@@ -367,4 +369,39 @@ declare function locationSpecToLocationEntity(opts: {
|
|
|
367
369
|
parentEntity?: Entity;
|
|
368
370
|
}): LocationEntityV1alpha1;
|
|
369
371
|
|
|
370
|
-
|
|
372
|
+
/**
|
|
373
|
+
* @public
|
|
374
|
+
*/
|
|
375
|
+
interface CatalogServiceRequestOptions {
|
|
376
|
+
credentials: BackstageCredentials;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* A version of the {@link @backstage/catalog-client#CatalogApi | CatalogApi} that
|
|
380
|
+
* requires backend credentials to be passed instead of a token.
|
|
381
|
+
*
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
interface CatalogService {
|
|
385
|
+
getEntities(request: GetEntitiesRequest | undefined, options: CatalogServiceRequestOptions): Promise<GetEntitiesResponse>;
|
|
386
|
+
getEntitiesByRefs(request: GetEntitiesByRefsRequest, options: CatalogServiceRequestOptions): Promise<GetEntitiesByRefsResponse>;
|
|
387
|
+
queryEntities(request: QueryEntitiesRequest | undefined, options: CatalogServiceRequestOptions): Promise<QueryEntitiesResponse>;
|
|
388
|
+
getEntityAncestors(request: GetEntityAncestorsRequest, options: CatalogServiceRequestOptions): Promise<GetEntityAncestorsResponse>;
|
|
389
|
+
getEntityByRef(entityRef: string | CompoundEntityRef, options: CatalogServiceRequestOptions): Promise<Entity | undefined>;
|
|
390
|
+
removeEntityByUid(uid: string, options: CatalogServiceRequestOptions): Promise<void>;
|
|
391
|
+
refreshEntity(entityRef: string, options: CatalogServiceRequestOptions): Promise<void>;
|
|
392
|
+
getEntityFacets(request: GetEntityFacetsRequest, options: CatalogServiceRequestOptions): Promise<GetEntityFacetsResponse>;
|
|
393
|
+
getLocationById(id: string, options: CatalogServiceRequestOptions): Promise<Location | undefined>;
|
|
394
|
+
getLocationByRef(locationRef: string, options: CatalogServiceRequestOptions): Promise<Location | undefined>;
|
|
395
|
+
addLocation(location: AddLocationRequest, options: CatalogServiceRequestOptions): Promise<AddLocationResponse>;
|
|
396
|
+
removeLocationById(id: string, options: CatalogServiceRequestOptions): Promise<void>;
|
|
397
|
+
getLocationByEntity(entityRef: string | CompoundEntityRef, options: CatalogServiceRequestOptions): Promise<Location | undefined>;
|
|
398
|
+
validateEntity(entity: Entity, locationRef: string, options: CatalogServiceRequestOptions): Promise<ValidateEntityResponse>;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* The catalogService provides the catalog API.
|
|
402
|
+
*
|
|
403
|
+
* @public
|
|
404
|
+
*/
|
|
405
|
+
declare const catalogServiceRef: _backstage_backend_plugin_api.ServiceRef<CatalogService, "plugin", "singleton">;
|
|
406
|
+
|
|
407
|
+
export { type AnalyzeOptions, type CatalogProcessor, type CatalogProcessorCache, type CatalogProcessorEmit, type CatalogProcessorEntityResult, type CatalogProcessorErrorResult, type CatalogProcessorLocationResult, type CatalogProcessorParser, type CatalogProcessorRefreshKeysResult, type CatalogProcessorRelationResult, type CatalogProcessorResult, type CatalogService, type CatalogServiceRequestOptions, type DeferredEntity, type EntitiesSearchFilter, type EntityFilter, type EntityProvider, type EntityProviderConnection, type EntityProviderMutation, type EntityProviderRefreshOptions, type EntityRelationSpec, type LocationAnalyzer, type LocationSpec, type PlaceholderResolver, type PlaceholderResolverParams, type PlaceholderResolverRead, type PlaceholderResolverResolveUrl, type ScmLocationAnalyzer, catalogServiceRef, locationSpecToLocationEntity, locationSpecToMetadataName, processingResult };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0-next.1",
|
|
4
4
|
"description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library",
|
|
@@ -61,17 +61,18 @@
|
|
|
61
61
|
"test": "backstage-cli package test"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@backstage/backend-plugin-api": "
|
|
65
|
-
"@backstage/catalog-client": "
|
|
66
|
-
"@backstage/catalog-model": "
|
|
67
|
-
"@backstage/errors": "
|
|
68
|
-
"@backstage/plugin-catalog-common": "
|
|
69
|
-
"@backstage/plugin-permission-common": "
|
|
70
|
-
"@backstage/plugin-permission-node": "
|
|
71
|
-
"@backstage/types": "
|
|
64
|
+
"@backstage/backend-plugin-api": "1.0.2-next.1",
|
|
65
|
+
"@backstage/catalog-client": "1.8.0-next.0",
|
|
66
|
+
"@backstage/catalog-model": "1.7.0",
|
|
67
|
+
"@backstage/errors": "1.2.4",
|
|
68
|
+
"@backstage/plugin-catalog-common": "1.1.0",
|
|
69
|
+
"@backstage/plugin-permission-common": "0.8.1",
|
|
70
|
+
"@backstage/plugin-permission-node": "0.8.5-next.1",
|
|
71
|
+
"@backstage/types": "1.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@backstage/backend-test-utils": "
|
|
75
|
-
"@backstage/cli": "
|
|
74
|
+
"@backstage/backend-test-utils": "1.0.3-next.1",
|
|
75
|
+
"@backstage/cli": "0.29.0-next.1",
|
|
76
|
+
"msw": "^1.0.0"
|
|
76
77
|
}
|
|
77
78
|
}
|