Skip to content
betterstack-alchemyUnofficial

Incidents.CatalogRelation

Kind ResourceType id BetterStack.Incidents.CatalogRelationSource src/Incidents/CatalogRelation.tsLive test gated Lifecycle test runs against the offline mock; a live run exists but is gated behind BETTERSTACK_TEST_CATALOG=1 because the catalog needs a paid plan (test/Incidents/CatalogRelation.test.ts).

A Better Stack catalog relation: a table in the on-call catalog, such as services or teams. Its attributes are the columns; CatalogRecord rows fill them. When an incident’s metadata matches a record’s primary attributes, the incident gets the record’s other attributes as metadata (an owner, an escalation policy, …).

name, description, matchMode and attributes update in place; organizationId and teamId replace the relation. name defaults to a generated unique name. attributes sent on update replaces every column: a column left out is removed with its values in every record, and a column kept by name keeps its values. List primary attributes first (the API always orders them first). Removing description clears it. organizationId is never returned: it is compared against the previous deploy’s props.

The catalog needs a paid plan: on a plan without it every create fails with a typed Forbidden (“You can’t add a Catalog relation. Please upgrade your account to add Catalog relations.”).

Who owns each service

const services = yield* BetterStack.Incidents.CatalogRelation("services", {
name: "Services",
description: "Who owns each service",
attributes: [{ name: "Service", primary: true }, { name: "Owner" }],
});
yield* BetterStack.Incidents.CatalogRecord("checkout", {
catalogRelationId: services.id,
attributes: [
{ attribute: { name: "Service" }, values: [{ type: "String", value: "checkout-api" }] },
{ attribute: { name: "Owner" }, values: [{ type: "String", value: "Payments team" }] },
],
});

Match on service and environment together

yield* BetterStack.Incidents.CatalogRelation("service-environments", {
name: "Service environments",
matchMode: "all",
attributes: [
{ name: "Service", primary: true },
{ name: "Environment", primary: true },
{ name: "Escalation policy" },
],
});

attributes CreateCatalogRelationRequestAttributesItem[] required

The relation's attributes, in the order the web app shows them as columns. List primary attributes first, since primary attributes always come before the others. Required on create, and at least one must be primary. An update that sends attributes replaces all of them, and any attribute you leave out is removed, along with its values in every record. Leave attributes out of an update to keep the attributes as they are.

description string | null

What this catalog relation describes.

matchMode "any" | "all" | string

How an incident is matched to a record when the relation has several primary attributes.

name string

Catalog relation name. Defaults to a unique name generated from the stack, stage and logical id.

organizationId string

Organization that owns this catalog relation, such as 123. Defaults to the token's own organization. Required when you sign in with OAuth and can access more than one organization.

teamId string

Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.

id string always set

The catalog_relation's id.

attributes CatalogRelationAttributesItem[]

The relation's attributes, in the order the web app shows them as columns. List primary attributes first, since primary attributes always come before the others. Required on create, and at least one must be primary. An update that sends attributes replaces all of them, and any attribute you leave out is removed, along with its values in every record. Leave attributes out of an update to keep the attributes as they are.

description string | null

What this catalog relation describes.

matchMode "any" | "all"

How an incident is matched to a record when the relation has several primary attributes.

name string

Catalog relation name.

recordsCount number

Number of catalog records in this catalog relation.

CatalogRelation.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.

id string required

The relation's id.

teamId string

Team whose token selects the organization, such as t123. Defaults to the credentials' team.