@glideapps/tables

中文文档
1.0.21发布于 2024/03/10MITTypeScriptESM + CJS近 30 天下载 5489

Client for Glide API

原始使用文档
文档目录8 节
  1. Setup
  2. Authorization
  3. Apps
  4. Tables
  5. Schema & Types
  6. Queries
  7. Development
  8. Advanced Options

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",
  /* ... */
});

版本与发布记录

@glideapps/tables 共发布 55 个版本,首次发布于 2023/04/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.21latest2024/03/102 年前
1.0.202024/03/102 年前
1.0.192024/03/102 年前
1.0.182024/03/102 年前
1.0.172024/03/102 年前
1.0.162024/03/102 年前

关于 @glideapps/tables 的常见问题

@glideapps/tables 是什么?

Client for Glide API

如何安装 @glideapps/tables?

在项目目录运行 npm install @glideapps/tables,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 tables,可以用 npx tables 直接运行。

@glideapps/tables 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@glideapps/tables 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@glideapps/tables 可以商用吗?

@glideapps/tables 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@glideapps/tables 的下载量有多少?

根据 npm 官方下载统计,@glideapps/tables 在 2026/10/17 – 2026/11/15 这 30 天内被下载 5,489 次,日均约 183 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@glideapps/tables 还在维护吗?

最新版本 1.0.21 发布于 2024/03/10(2 年前);至今共发布 55 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/04/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。