api-ref: use opaque metadata for owner lookup

Read ApiRef plugin ownership through the internal opaque type helper and gracefully fall back to legacy ID inference for unsupported ref shapes.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-17 10:30:59 +01:00
parent ccc6b25f87
commit 4690f20880
3 changed files with 73 additions and 4 deletions
@@ -31,12 +31,14 @@ type ApiRefBuilderConfig<TId extends string> = {
pluginId?: string;
};
const OpaqueApiRef = OpaqueType.create<{
/** @internal */
export const OpaqueApiRef = OpaqueType.create<{
public: ApiRef<unknown> & {
readonly $$type: '@backstage/ApiRef';
};
versions: {
readonly version: 'v1';
readonly pluginId?: string;
};
}>({
type: '@backstage/ApiRef',