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

@glideapps/tables

v1.0.21

Published

Client for Glide API

Downloads

1,132

Readme

Glide Tables Client

Setup

Install package:

npm install @glideapps/tables

Import it:

import * as glide from "@glideapps/tables";

Generate a client:

# Interactive:
npx @glideapps/tables

# One-shot
GLIDE_TOKEN=... npx @glideapps/tables [APP_ID] [FILE_NAME]

Authorization

Set GLIDE_TOKEN environment variable or pass the token as props.

Using a particular client? Add GLIDE_CLIENT_ID environment variable or pass the value as props.

Apps

// List all apps
const apps = await glide.getApps();

// Create a reference to an app using its ID
const myApp = glide.app("bAFxpGXU1bHiBgUMcDgn");

// Or get by name
const myApp = await glide.getAppNamed("Employee Directory");

// Get all tables
const tables = await myApp.getTables();

// Get a table by name
const users = await myApp.getTableNamed("Users");

// Get PWA manifest (name, description, icons)
const manifest = await myApp.getManifest();

Tables

const inventory = glide.table({
  // App and table IDs
  app: "bAF...Dgn",
  table: "native-table-tei...",

  columns: {
    // Column names map to their types.
    // You can use this shorthand with internal names only.
    Item: "string",
    Price: "number",

    // When you want to work with display names, you'll need
    // to alias them like this.
    Assignee: { type: "string", name: "7E42F8B3-9988-436E-84D2-5B3B0B22B21F" },
  },
});

// Get all rows (Business+)
const rows = await inventory.get();

// Query rows – Big Tables only (Business+)
const rows = await inventory.get(q => q.where("Price", ">", 100));

// Add a row
const rowID = await inventory.add({
  Item: "Test Item",
  Price: 100,
  Assignee: "David",
});

// Add many rows
await inventory.add([jacket, shirt, shoes]);

// Change a row
await inventory.update(rowID, {
  Price: 200,

  // Use null to clear columns
  Assignee: null,
});

// Delete a row
await inventory.delete(rowID);

// Clear all rows (Business+)
await inventory.clear();

Schema & Types

// Get table schema info (columns with names and types)
const schema = await inventory.getSchema();

// Name the row type (optional)
type InventoryItem = glide.RowOf<typeof inventory>;

Queries

Big Tables can be queried using SQL.

const first10 = await items.get(q => q.limit(10));

const cheapest = await items.get(q => q.orderBy("Price"));

const expensiveInLA = await items.get(
  q => q
    .orderBy("Price", "DESC")
    .where("Quantity", ">", 10_000)
    .and("Port", "=", "Los Angeles")
    .limit(100);
);

Development

nvm i
npm run build
npm t

Advanced Options

You can specify an alternate Glide environment (for internal testing by Glide).

const staging = new Glide({
  endpoint: "https://staging.heyglide.com/api/container",
  /* ... */
});

Or with the package:

import * as glide from "@glideapps/tables";

const staging = glide.withConfig({
  endpoint: "https://staging.heyglide.com/api/container",
  /* ... */
});