1.0.0 • Published 6 months ago
@mann-conomy/tf-schema v1.0.0
tf-schema
A Node.js wrapper for Team Fortress 2 schema-related methods from the Steam Web API.
Installation
Using npm:
$ npm install @mann-conomy/tf-schemaUsing yarn:
$ yarn add @mann-conomy/tf-schemaTesting
Using npm:
$ npm testUsing yarn:
$ yarn testExamples
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
Copyright 2025, The Mann-Conomy Project
1.0.0
6 months ago