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

@1team/sdk

v1.0.4

Published

Official JavaScript/TypeScript SDK for the 1team API

Readme

@1team/sdk

Official JavaScript/TypeScript SDK for the 1team API - manage sports leagues, teams, players, and more.

Installation

npm install @1team/sdk
# or
yarn add @1team/sdk
# or
pnpm add @1team/sdk

Quick Start

Using API Key

import { OneTeamClient } from '@1team/sdk';

const client = new OneTeamClient({
  apiKey: 'gfl_your_api_key_here'
});

// Get all players (paginated)
const players = await client.getPlayers();
console.log(players.items);

// Get a specific player
const player = await client.getPlayer('player-id');

Using OAuth Access Token

import { OneTeamClient } from '@1team/sdk';

const client = new OneTeamClient({
  accessToken: 'your_backend_jwt'
});

// If you only have an OAuth access token, exchange it for a backend token
const { token } = await client.exchangeOAuthToken('your_oauth_access_token');
client.setAccessToken(token);

// Or login with credentials
const { token, user } = await client.login({
  email: '[email protected]',
  password: 'password'
});

// Token is automatically set after login
const currentUser = await client.getCurrentUser();

Configuration

const client = new OneTeamClient({
  // Optional: Use custom API URL
  baseUrl: 'https://api.1team.tv',
  
  // Optional: API key for authentication
  apiKey: 'gfl_...',
  
  // Optional: OAuth access token
  accessToken: 'your_token'
});

// You can also set these after initialization
client.setApiKey('gfl_new_key');
client.setAccessToken('new_token');

Features

Authentication

// Login with email and password
const { token, user } = await client.login({
  email: '[email protected]',
  password: 'password'
});

// Get current user
const user = await client.getCurrentUser();

Players

// Get all players
const players = await client.getPlayers();
console.log(players.items);

// Get players with filters
const players = await client.getPlayers({
  teamId: 'team-id',
  position: 'Forward',
  search: 'John',
  page: 1,
  pageSize: 20
});
console.log(players.items);

// Get a specific player
const player = await client.getPlayer('player-id');

// Create a player
const player = await client.createPlayer({
  teamId: 'team-id',
  firstName: 'John',
  lastName: 'Doe',
  position: 'Forward',
  jerseyNumber: 10
});

// Update a player
const player = await client.updatePlayer('player-id', {
  jerseyNumber: 11
});

// Delete a player
await client.deletePlayer('player-id');

Teams

// Get all teams
const teams = await client.getTeams();
console.log(teams.items);

// Get teams by league
const teams = await client.getTeams({ leagueId: 'league-id' });
console.log(teams.items);

// Get a specific team
const team = await client.getTeam('team-id');

// Create a team
const team = await client.createTeam({
  leagueId: 'league-id',
  name: 'Team Name',
  shortName: 'TN',
  city: 'City'
});

// Update a team
const team = await client.updateTeam('team-id', {
  name: 'New Team Name'
});

// Delete a team
await client.deleteTeam('team-id');

Transfers

// Get all transfers
const transfers = await client.getTransfers();

// Get transfers by status
const transfers = await client.getTransfers({
  status: 'PENDING'
});

// Create a transfer request
const transfer = await client.createTransfer({
  playerId: 'player-id',
  toTeamId: 'team-id',
  expiresInDays: 7
});

// Redeem a transfer
const transfer = await client.redeemTransfer('transfer-code');

// Cancel a transfer
await client.cancelTransfer('transfer-id');

Rosters

// Get all rosters
const rosters = await client.getRosters();
console.log(rosters.items);

// Get rosters for a team
const rosters = await client.getRosters({ teamId: 'team-id' });
console.log(rosters.items);

// Get a specific roster
const roster = await client.getRoster('roster-id');

// Create a roster
const roster = await client.createRoster({
  teamId: 'team-id',
  name: 'Game Day Roster',
  gameDate: '2026-01-04',
  playerIds: ['player-id-1', 'player-id-2']
});

// Update a roster
const roster = await client.updateRoster('roster-id', {
  name: 'Updated Roster'
});

// Delete a roster
await client.deleteRoster('roster-id');

TypeScript Support

This SDK is written in TypeScript and includes full type definitions:

import { 
  1teamClient, 
  Player, 
  Team, 
  Transfer,
  Roster,
  UserRole 
} from '@1team/sdk';

const client = new 1teamClient({ apiKey: 'gfl_...' });

// Fully typed responses
const players: Player[] = await client.getPlayers();
const player: Player = players[0];

// Type-safe inputs
await client.createPlayer({
  teamId: 'team-id',
  firstName: 'John',
  lastName: 'Doe',
  position: 'Forward',
  jerseyNumber: 10
});

Error Handling

try {
  const player = await client.getPlayer('invalid-id');
} catch (error) {
  console.error('API Error:', error.message);
}

Links

License

AGPL-3.0-only