# @architect/functions 中文文档

规范地址：https://npmcn.com/package/%40architect/functions/

版本：8\.1\.10
npm 元数据更新时间：2026-09-08T18:46:36.400Z
中文译文更新时间：2026-11-06T14:29:37.390Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40architect/functions
原文对照：https://npmcn.com/package/%40architect/functions/?lang=original
项目主页：https://github.com/architect/functions
源码仓库：https://github.com/architect/functions

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

- 包体积（解压后）：78.3 kB，43 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=16
- 运行依赖：13 个
- 首次发布：2017-07-20T20:36:20.885Z
- 最新版本发布：2026-09-08T18:46:35.946Z
- 近 30 天下载量：87839（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：289（近 12 个月 1 个）

## 中文简介

由建筑师( FWAS) 所建的功能 Web Apps 运行时工具库[https://arc.codes (中文(简体) )](https://arc.codes/)(中文(简体) )

## 安装

```sh
npm install @architect/functions
```

也可以使用：`pnpm add @architect/functions`、`yarn add @architect/functions`、`bun add @architect/functions`

## README

![Architect Logo](https://github.com/architect/assets.arc.codes/raw/main/public/architect-logo-500b%402x.png)

## [`@architect/functions`](https://www.npmjs.com/package/@architect/functions)

> 运行时工具库 [实用网络应用程序(FWA)](https://fwa.dev/) 与 \[Architect\] 一同建造[https://arc.codes (中文(简体) )](https://arc.codes/)\[ . \]

[![GitHub CI status](https://github.com/architect/functions/workflows/Node%20CI/badge.svg)](https://github.com/architect/functions/actions?query=workflow%3A%22Node+CI%22)

检查完整的文件 [这个图书馆](https://arc.codes/docs/en/reference/runtime-helpers/node.js) 财务报告和审定财务报表 [建筑师](https://arc.codes/)

## 安装

在您的建筑工程目录中, 添加 `@architect/function` 输入其根 `package.json`数字 :

`npm i @architect/functions`

> 您还可以添加 `@architect/function` 给Lambda个人的建议 `package.json` 但是我们建议利用建筑师的自动Lambda树吊 见 [建筑师依赖管理指南](https://staging.arc.codes/docs/en/guides/developer-experience/dependency-management#node.js) 更多细节.

## 使用量

```js
let {
  events,   // @events pub/sub
  http,     // @http middleware + tools
  queues,   // @queues pub/sub
  services, // Architect resource / service discovery
  static,   // @static asset helper
  tables,   // @tables DynamoDB helper methods + API client
  ws,       // @ws WebSocket helper + API client
} = require('@architect/functions')
```

# API 密码

**[`@events` 方法](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.events)**

-   [`events.subscribe()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.events.subscribe\(\))
-   [`events.publish()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.events.publish\(\))

**[`@http` 方法](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.http)**

-   [`http()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.http)
-   [`http` 中间软件](https://arc.codes/docs/en/reference/runtime-helpers/node.js#middleware)
-   [`http.session`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.http.session)
-   [`http.csrf`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.http.csrf)

**[`@queues` 方法](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.queues)**

-   [`queues.subscribe()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.queues.subscribe\(\))
-   [`queues.publish()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.queues.publish\(\))

**服务发现**

-   [`services()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.services\(\))

**[`@static`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.static\(\))**

-   [`static()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.static\(\))

**[`@tables` 方法](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.tables\(\))**

-   [`tables()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.tables\(\))
    -   [`table.delete()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table.get()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table.put()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table.query()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table.scan()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table.scanAll()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table.update()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#instance-methods)
    -   [`table._db`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#client-methods)
    -   [`table._doc`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#client-methods)
    -   [`table.name`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#client-methods)
    -   [`table.reflect()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#client-methods)

**[`@ws` 方法](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.ws)**

-   [`ws.send()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.ws.send\(\))
-   [`ws.close()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.ws.close\(\))
-   [`ws.info()`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.ws.info\(\))
-   [`ws._api`](https://arc.codes/docs/en/reference/runtime-helpers/node.js#arc.ws._api\(\))

## 常见问题

### @architect/functions 是什么？

由建筑师\( FWAS\) 所建的功能 Web Apps 运行时工具库https://arc\.codes \(中文\(简体\) \)\(中文\(简体\) \)

### 如何安装 @architect/functions？

在项目目录运行 npm install @architect/functions，或使用 pnpm add / yarn add / bun add。

### @architect/functions 支持 TypeScript 吗？

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

### @architect/functions 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @architect/functions 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=16。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @architect/functions 可以商用吗？

@architect/functions 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @architect/functions 的下载量有多少？

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

### @architect/functions 还在维护吗？

最新版本 8\.1\.10 发布于 2026/09/09（1 个月前）；至今共发布 289 个版本，其中过去 12 个月发布了 1 个；首次发布于 2017/07/21。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

