@mann-conomy/tf-schema
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

tf-schema

A Node.js wrapper for Team Fortress 2 schema-related methods from the Steam Web API.

npm version npm downloads Node.js version GitHub actions GitHub license

Installation

Using npm:

$ npm install @mann-conomy/tf-schema

Using yarn:

$ yarn add @mann-conomy/tf-schema

Testing

Using npm:

$ npm test

Using yarn:

$ yarn test

Examples

Fetching the full Team Fortress 2 item schema from the Steam Web API.

import { SchemaClient } from "@mann-conomy/tf-schema";

const client = new SchemaClient(process.env.STEAM_WEB_API_KEY!);

(async() => {
    try {
        const schema = await client.getItemSchema();
        const item = schema.getItemByName("Team Captain", true);
        console.log(item?.defindex, item?.item_class);
    } catch (error) {
        if (error instanceof Error) {
            console.error("Error fetching the item schema", error.message);
        }
    }
})();

Importing the Team Fortress 2 item schema from a static source, such as a local JSON file.

import { ItemSchema } from "@mann-conomy/tf-schema";

(async() => {
    try {
        const schema = await ItemSchema.import("./assets/static/schema.json");
        const name = schema.getQualityNameById(11);
        console.log(name); // Strange
    } catch (error) {
        if (error instanceof Error) {
            console.error("Error importing the item schema", error.message);
        }
    }
})();

Some more examples are available in the examples and test directories.

Documentation

See the Wiki pages for further documentation.

Contributors

The type descriptions used in this project are based on the work of the amazing contributors over at the Team Fortress 2 Wiki.

Huge thanks to them for their dedication and detailed documentation!

License

MIT

Copyright 2025, The Mann-Conomy Project

Package Sidebar

Install

npm i @mann-conomy/tf-schema

Weekly Downloads

6

Version

1.0.0

License

MIT

Unpacked Size

52.2 kB

Total Files

42

Last publish

Collaborators

  • snabe