Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/catalog-client

Package Overview
Dependencies
Maintainers
3
Versions
790
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/catalog-client

An isomorphic client for the catalog backend

  • 1.7.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
114K
decreased by-6.61%
Maintainers
3
Weekly downloads
 
Created

What is @backstage/catalog-client?

@backstage/catalog-client is a client library for interacting with the Backstage catalog, which is a centralized service catalog for managing all your software components, APIs, and other entities. It allows you to programmatically interact with the catalog to perform operations such as retrieving entities, adding new entities, and searching for entities.

What are @backstage/catalog-client's main functionalities?

Retrieve Entities

This feature allows you to retrieve all entities from the Backstage catalog. The code sample demonstrates how to create a CatalogClient instance and use it to fetch entities.

const { CatalogClient } = require('@backstage/catalog-client');
const client = new CatalogClient({ discoveryApi });

async function getEntities() {
  const entities = await client.getEntities();
  console.log(entities);
}

getEntities();

Add New Entity

This feature allows you to add a new entity to the Backstage catalog. The code sample demonstrates how to create a new entity object and use the CatalogClient to add it to the catalog.

const { CatalogClient } = require('@backstage/catalog-client');
const client = new CatalogClient({ discoveryApi });

async function addEntity(entity) {
  const response = await client.addEntity(entity);
  console.log(response);
}

const newEntity = {
  apiVersion: 'backstage.io/v1alpha1',
  kind: 'Component',
  metadata: {
    name: 'my-component',
  },
  spec: {
    type: 'service',
    lifecycle: 'production',
    owner: 'team-a',
  },
};

addEntity(newEntity);

Search Entities

This feature allows you to search for entities in the Backstage catalog based on specific criteria. The code sample demonstrates how to create a query object and use the CatalogClient to search for entities that match the query.

const { CatalogClient } = require('@backstage/catalog-client');
const client = new CatalogClient({ discoveryApi });

async function searchEntities(query) {
  const entities = await client.getEntities({ filter: query });
  console.log(entities);
}

const query = { kind: 'Component', 'metadata.name': 'my-component' };
searchEntities(query);

Other packages similar to @backstage/catalog-client

Keywords

FAQs

Package last updated on 15 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc