api-ref: move opaque helper to frontend-internal
Share the internal ApiRef opaque helper through frontend-internal and fail fast when ApiRef-shaped values have an unsupported opaque version. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { OpaqueType } from '@internal/opaque';
|
||||
import { OpaqueApiRef } from '@internal/frontend';
|
||||
import type { ApiRef } from './types';
|
||||
|
||||
/**
|
||||
@@ -31,20 +31,6 @@ type ApiRefBuilderConfig<TId extends string> = {
|
||||
pluginId?: string;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const OpaqueApiRef = OpaqueType.create<{
|
||||
public: ApiRef<unknown> & {
|
||||
readonly $$type: '@backstage/ApiRef';
|
||||
};
|
||||
versions: {
|
||||
readonly version: 'v1';
|
||||
readonly pluginId?: string;
|
||||
};
|
||||
}>({
|
||||
type: '@backstage/ApiRef',
|
||||
versions: ['v1'],
|
||||
});
|
||||
|
||||
function validateId(id: string): void {
|
||||
const valid = id
|
||||
.split('.')
|
||||
|
||||
Reference in New Issue
Block a user