api-ref: keep plugin ownership metadata internal
Hide plugin ownership metadata from the public ApiRef type while preserving internal ownership resolution for the builder-based API ref flow. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -168,6 +168,7 @@ describe('createSpecializedApp', () => {
|
||||
"factory": {
|
||||
"api": {
|
||||
"$$type": "@backstage/ApiRef",
|
||||
"T": null,
|
||||
"id": "core.featureflags",
|
||||
"pluginId": "app",
|
||||
"toString": [Function],
|
||||
@@ -182,6 +183,7 @@ describe('createSpecializedApp', () => {
|
||||
"factory": {
|
||||
"api": {
|
||||
"$$type": "@backstage/ApiRef",
|
||||
"T": null,
|
||||
"id": "core.app-tree",
|
||||
"pluginId": "app",
|
||||
"toString": [Function],
|
||||
@@ -196,6 +198,7 @@ describe('createSpecializedApp', () => {
|
||||
"factory": {
|
||||
"api": {
|
||||
"$$type": "@backstage/ApiRef",
|
||||
"T": null,
|
||||
"id": "core.config",
|
||||
"pluginId": "app",
|
||||
"toString": [Function],
|
||||
@@ -210,6 +213,7 @@ describe('createSpecializedApp', () => {
|
||||
"factory": {
|
||||
"api": {
|
||||
"$$type": "@backstage/ApiRef",
|
||||
"T": null,
|
||||
"id": "core.route-resolution",
|
||||
"pluginId": "app",
|
||||
"toString": [Function],
|
||||
@@ -224,6 +228,7 @@ describe('createSpecializedApp', () => {
|
||||
"factory": {
|
||||
"api": {
|
||||
"$$type": "@backstage/ApiRef",
|
||||
"T": null,
|
||||
"id": "core.identity",
|
||||
"pluginId": "app",
|
||||
"toString": [Function],
|
||||
|
||||
@@ -455,9 +455,10 @@ function createApiFactories(options: {
|
||||
|
||||
// TODO(Rugvip): It would be good if this was more explicit, but I think that
|
||||
// might need to wait for some future update for API factories.
|
||||
function getApiOwnerId(apiRef: { id: string; pluginId?: string }): string {
|
||||
if (apiRef.pluginId) {
|
||||
return apiRef.pluginId;
|
||||
function getApiOwnerId(apiRef: { id: string }): string {
|
||||
const pluginId = (apiRef as { pluginId?: string }).pluginId;
|
||||
if (pluginId) {
|
||||
return pluginId;
|
||||
}
|
||||
|
||||
const apiRefId = apiRef.id;
|
||||
|
||||
Reference in New Issue
Block a user