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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tursodatabase/api

v1.9.0

Published

The Turso API gives you everything needed to manage your organization and it's members, groups, databases, and API tokens.

Downloads

6,790

Readme

@tursodatabase/api

⚠️ This SDK is still in development and is not ready for production use.

Usage

import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "", // Your personal account or organization slug
  token: "...",
});
const organizations = await turso.organizations.list();
const orgMembers = await turso.organizations.update({ overages: true });
const orgMembers = await turso.organizations.delete();
const orgMembers = await turso.organizations.members();
const orgMembers = await turso.organizations.addMember("username", "admin");
const orgMembers = await turso.organizations.removeMember("username");
const invite = await turso.organizations.inviteUser(
  "[email protected]",
  "admin"
);
await turso.organizations.deleteInvite("[email protected]");
const invoices = await turso.organizations.invoices();
const locations = await turso.locations.list();
const closest = await turso.locations.closest();
const groups = await turso.groups.list();
const group = await turso.groups.get("default");
const group = await turso.groups.create("customgroup", "lhr");
const group = await turso.groups.create("customgroup", "ams", {
  extensions: "all", // or ["uuid", "vector"]
});
const group = await turso.groups.delete("customgroup");
const group = await turso.groups.addLocation("default", "lhr");
const group = await turso.groups.removeLocation("default", "lhr");
const token = await turso.groups.createToken("default");
const token = await turso.groups.createToken("default", {
  expiration: "1w2d6h3m",
  authorization: "full-access",
});
const token = await turso.groups.createToken("default", {
  permissions: {
    read_attach: {
      databases: ["db1", "db2"],
    },
  },
});
const token = await turso.groups.rotateTokens("default");
const tokens = await turso.apiTokens.list();
const token = await turso.apiTokens.create("superdupertokenname");
const token = await turso.apiTokens.revoke("superdupertokenname");
const token = await turso.apiTokens.validate("token");
const database = await turso.databases.list();
const database = await turso.databases.list({
  schema: "parent-schema-db-name", // Filter by schema database
});
const database = await turso.databases.list({
  group: "group-name", // Filter by group
});
const database = await turso.databases.list({
  type: "schema", // Filter by schema dbs only
});

const database = await turso.databases.get("my-db");

const database = await turso.databases.create("db-name");
const database = await turso.databases.create("db-name", {
  image: "canary",
  group: "my-group",
});
const database = await turso.databases.create("db-name", {
  group: "my-group",
  seed: {
    type: "database",
    name: "my-existing-db",
  },
});
const database = await turso.databases.create("db-name", {
  group: "my-group",
  seed: {
    type: "database",
    name: "my-existing-db",
    timestamp: "2021-01-01T00:00:00Z", // or new Date("2021-01-01T00:00:00Z")
  },
});
const database = await turso.databases.create("parent-db", {
  is_schema: true,
});
const database = await turso.databases.create("child-db", {
  schema: "parent-db",
});

const database = await turso.databases.updateVersion("my-db");

const database = await turso.databases.delete("my-db");

const instances = await turso.databases.listInstances("my-db");
const instances = await turso.databases.getInstance("my-db", "lhr");

const token = await turso.databases.createToken("my-db");
const token = await turso.databases.createToken("my-db", {
  expiration: "1w2d6h3n",
  authorization: "full-access",
});
const token = await turso.databases.createToken("my-db", {
  permissions: {
    read_attach: {
      databases: ["db1", "db2"],
    },
  },
});
const token = await turso.databases.rotateTokens("my-db");

const usageStatsWithDate = await turso.databases.usage("my-db");
const usageStatsWithDate = await turso.databases.usage("my-db", {
  from: new Date("2023-01-01"),
  to: new Date("2023-02-01"),
});
// Using ISOStrings
const usageStatsWithString = await turso.databases.usage("my-db", {
  from: "2023-01-01T00:00:00Z",
  to: "2023-02-01T00:00:00Z",
});

Todo

  • Maybe change to named args for all methods