# @glideapps/tables 中文文档

规范地址：https://npmcn.com/package/%40glideapps/tables/

版本：1\.0\.21
npm 元数据更新时间：2026-09-16T16:01:26.701Z
中文译文更新时间：2026-11-16T15:44:33.441Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40glideapps/tables
原文对照：https://npmcn.com/package/%40glideapps/tables/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：744 kB，100 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：3 个
- 首次发布：2023-03-31T22:30:16.416Z
- 最新版本发布：2024-03-10T15:30:29.630Z
- 近 30 天下载量：5489（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：55（近 12 个月 0 个）

## 中文简介

Glide API 客户端

## 安装

```sh
npm install @glideapps/tables
```

也可以使用：`pnpm add @glideapps/tables`、`yarn add @glideapps/tables`、`bun add @glideapps/tables`

## README

# 胶片表客户端

## 设置

安装软件包 :

```shell
npm install @glideapps/tables
```

导入它 :

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

生成客户端 :

```shell
# Interactive:
npx @glideapps/tables

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

## 授权

设定 `GLIDE_TOKEN` 环境可变或将符号作为道具传递.

利用某个客户? 添加 `GLIDE_CLIENT_ID` 环境变量或传递作为道具的值.

## 应用程序

```ts
// 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();
```

## 表格

```ts
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 类型( T)

```ts
// 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>;
```

## 查询

大表可以使用 SQL 查询.

```ts
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);
);
```

## 发展

```shell
nvm i
npm run build
npm t
```

## 高级选项

您可以指定一个替代的Glide环境(用于由Glide进行内部测试).

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

或者用包裹:

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

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

## 常见问题

### @glideapps/tables 是什么？

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 和提交记录判断。

