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

@backstage/catalog-model

Package Overview
Dependencies
Maintainers
3
Versions
752
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/catalog-model

Types and validators that help describe the model of a Backstage Catalog

  • 0.0.0-nightly-20241212023754
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
160K
decreased by-12.05%
Maintainers
3
Weekly downloads
 
Created

What is @backstage/catalog-model?

@backstage/catalog-model is a package that provides models and utilities for working with the Backstage catalog. It allows you to define, validate, and manipulate entities within the Backstage ecosystem, such as services, components, and APIs.

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

Entity Validation

This feature allows you to validate entities against the Backstage catalog model. The `validateEntity` function checks if the provided entity conforms to the expected schema.

const { Entity, validateEntity } = require('@backstage/catalog-model');

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

const validationResult = validateEntity(entity);
console.log(validationResult);

Entity Kind and API Version

This feature allows you to check the kind and API version of an entity. The `Entity.isComponent` function checks if the entity is of kind 'Component'.

const { Entity } = require('@backstage/catalog-model');

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

console.log(Entity.isComponent(entity)); // true

Entity Relations

This feature allows you to define and manipulate relations between entities. The `relations` field in the entity metadata can be used to specify relationships like ownership.

const { Entity, RELATION_OWNED_BY } = require('@backstage/catalog-model');

const entity = {
  apiVersion: 'backstage.io/v1alpha1',
  kind: 'Component',
  metadata: {
    name: 'my-component',
    relations: [
      {
        type: RELATION_OWNED_BY,
        target: {
          kind: 'Group',
          name: 'team-a',
          namespace: 'default',
        },
      },
    ],
  },
  spec: {
    type: 'service',
    lifecycle: 'production',
    owner: 'team-a',
  },
};

console.log(entity.metadata.relations);

Other packages similar to @backstage/catalog-model

Keywords

FAQs

Package last updated on 12 Dec 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