npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@map-colonies/semantic-conventions

v1.0.0

Published

Telemetry Semantic conventions for MapColonies services

Readme

Telemetry Semantic Conventions

  • This package goal is to provide a flexible and easy way to allow semantic conventions to be used for telemetry purposes across all MapColonies services.
  • It's based on OpenTelemetry semantic-conventions.
  • Each Domain defines its JSON file that describes the semantic conventions of the domain. The submodule handles the validation of the file and generates TS files for use in code.
  • Supports Javascript & Typescript.

[!IMPORTANT] If OpenTelemetry already defines a value as part of their semantic conventions, use that and do not define a new one.

[!IMPORTANT] Attributes should follow the Open Telemetry semantic-convention naming concept

USAGE

  1. Install the package using the following command:
npm i @map-colonies/semantic-conventions
  1. Import the package and then use the conventions as needed.
import { SCOTTISH_CONVENTIONS, SCOTTISH_FOLD } from '@map-colonies/semantic-conventions';

console.log(SCOTTISH_CONVENTIONS.scottish.straight.David)
console.log(SCOTTISH_FOLD) // This will be marked with strikethrough because it's marked as deprecated

Domain creation

Below is a short example creating of a new semantic attribute domain by creating the domain.json file and generating its attributes.

  1. Create a new file in the semanticConventions directory (The file must be a JSON file).
{
    "domain": "scottish",
    "content": {
      "propertyName": "mapcolonies.scottish",
      "kind": "clan",
      "description": "name of the clan 😺",
      "deprecated": false,
      "subAttributes": {
        "straight": {
          "propertyName": "mapcolonies.scottish.straight",
          "kind": "straightAttributes",
          "description": "attributes related to straights 🙀",
          "deprecated": false,
          "subAttributes": {
            "Jimmy": {
              "propertyName": "mapcolonies.scottish.straight.jimmy",
              "deprecated": false,
              "description": "Jimmy the scottish straight cat 😾"
            },
            "David": {
              "propertyName": "mapcolonies.scottish.straight.david",
              "deprecated": false,
              "description": "David the scottish straight cat 😻"
            }
          }
        },
        "fold": {
          "propertyName": "mapcolonies.scottish.fold",
          "kind": "straightAttributes",
          "description": "attributes related to fold 😿",
          "deprecated": true
        }
      }
    }
  }
  1. Run the validations to make sure the created file is valid.
pnpm run validate:attributes
  1. Run attributes generation to create new ts modules for all defined domain.json files.
pnpm run generate:attributes
  1. Check the created TypeScript files to make sure they are as you intended. They should look like this:
/* eslint-disable */
/**
 * This file was automatically generated by @mapcolonies/telemetry npm package.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and release new compiled package to regenerate this file.
 */

/**
* attributes related to fold 😿
* @constant
* @deprecated Change to new attribute if this one was replaced 

*/
export const SCOTTISH_FOLD = 'mapcolonies.scottish.fold';

/**
 * David the scottish straight cat 😻
 * @constant
 */
export const SCOTTISH_STRAIGHT_DAVID = 'mapcolonies.scottish.straight.david';

/**
 * Jimmy the scottish straight cat 😾
 * @constant
 */
export const SCOTTISH_STRAIGHT_JIMMY = 'mapcolonies.scottish.straight.jimmy';

/**
 * name of the clan 😺
 * @constant
 */
export const SCOTTISH_CONVENTIONS = {
  scottish: {
    /**
    * attributes related to fold 😿
    * @constant
    * @deprecated Change to new attribute if this one was replaced 
    */
    fold: 'mapcolonies.scottish.fold',
    straight: {
      /**
       * David the scottish straight cat 😻
       * @constant
       */
      David: 'mapcolonies.scottish.straight.david',
      /**
       * Jimmy the scottish straight cat 😾
       * @constant
       */
      Jimmy: 'mapcolonies.scottish.straight.jimmy',
    },
  },
} as const;

Development

The Schema used to validate the JSON files and to create the TypeScript types for the script usage is defined and managed inside the repo - schemas/attribute.schema.json.

The schema files have autocomplete support in VsCode. To change the schema and file associations check the .vscode/settings.json.

[!IMPORTANT] After making any changes to a schema, you MUST re-generate its types using the following command:

pnpm run generate:types

All the semantic convention scripts run before the build process of the package, as their only output is TypeScript files that are transpiled as part of the larger build process into javascript.